Skip to content

Commit

Permalink
Merge pull request #16 from rustymotors/deepsource-transform-97474c41
Browse files Browse the repository at this point in the history
style: format code with Prettier
  • Loading branch information
drazisil authored Jun 1, 2024
2 parents a1e0717 + c9418bf commit 28b5d1d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 35 deletions.
65 changes: 34 additions & 31 deletions packages/main/src/ShardService.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/** @type {Map<number, import("obsidian-main").IShardEntry>} */
const shards = new Map();

Expand Down Expand Up @@ -56,8 +55,8 @@ class ShardEntry {
}

/**
*
* @param {number} population
*
* @param {number} population
*/
setPopulation(population) {
this.population = population;
Expand All @@ -67,45 +66,49 @@ class ShardEntry {
* @returns {string}
*/
formatForWeb() {
return `[${this.name}]\n`
+ `\tDescription=${this.id}\n`
+ `\tShardId=${this.id}\n`
+ `\tLoginServerIP=${this.loginServerIP}\n`
+ `\tLoginServerPort=${this.loginServerPort}\n`
+ `\tLobbyServerIP=${this.lobbyServerIP}\n`
+ `\tLobbyServerPort=${this.lobbyServerPort}\n`
+ `\tMCOTSServerIP=${this.mcotsServerIP}\n`
+ `\tStatusId=${this.statusId}\n`
+ `\tStatus_Reason=${this.statusReason}\n`
+ `\tServerGroup_Name=${this.serverGroupName}\n`
+ `\tPopulation=${this.population}\n`
+ `\tMaxPersonasPerUser=${this.maxPersonasPerUser}\n`
+ `\tDiagnosticServerHost=${this.diagServerIP}\n`
+ `\tDiagnosticServerPort=${this.diagServerPort}\n`;
return (
`[${this.name}]\n` +
`\tDescription=${this.id}\n` +
`\tShardId=${this.id}\n` +
`\tLoginServerIP=${this.loginServerIP}\n` +
`\tLoginServerPort=${this.loginServerPort}\n` +
`\tLobbyServerIP=${this.lobbyServerIP}\n` +
`\tLobbyServerPort=${this.lobbyServerPort}\n` +
`\tMCOTSServerIP=${this.mcotsServerIP}\n` +
`\tStatusId=${this.statusId}\n` +
`\tStatus_Reason=${this.statusReason}\n` +
`\tServerGroup_Name=${this.serverGroupName}\n` +
`\tPopulation=${this.population}\n` +
`\tMaxPersonasPerUser=${this.maxPersonasPerUser}\n` +
`\tDiagnosticServerHost=${this.diagServerIP}\n` +
`\tDiagnosticServerPort=${this.diagServerPort}\n`
);
}
}

export class ShardService {

/**
*
* @param {number} id
* @param {string} name
*
* @param {number} id
* @param {string} name
* @param {string} description
* @param {string} ip
* @param {string} serverGroupName
*/
addShard(id, name, description, ip, serverGroupName) {
shards.set(id, new ShardEntry({
shards.set(
id,
name,
description,
loginServerIP: ip,
lobbyServerIP: ip,
serverGroupName: serverGroupName,
mcotsServerIP: ip,
diagServerIP: ip,
}));
new ShardEntry({
id,
name,
description,
loginServerIP: ip,
lobbyServerIP: ip,
serverGroupName: serverGroupName,
mcotsServerIP: ip,
diagServerIP: ip,
}),
);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/UserLoginService.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class UserLoginService {
*/
checkUser(username, password) {
const user = users.find(
(user) => user.username === username && user.password === password
(user) => user.username === username && user.password === password,
);

return user ? user.customerId : -1;
Expand Down
3 changes: 1 addition & 2 deletions packages/main/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export default function main() {
"Group - 1",
);


const userLoginService = new UserLoginService();

const mainLoop = new MainLoop();
Expand All @@ -151,7 +150,7 @@ export default function main() {
);
mainLoop.addTask(
"stop",
userLoginService.deleteAllTokens.bind(userLoginService)
userLoginService.deleteAllTokens.bind(userLoginService),
);

mainLoop.start();
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/web.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function sendError(res, statusCode, message) {
res.statusCode = statusCode;
res.setHeader("Content-Type", "text/plain");
res.end(
`reasoncode=INV-200\nreasontext=${message}\nreasonurl=https://rusty-motors.com`
`reasoncode=INV-200\nreasontext=${message}\nreasonurl=https://rusty-motors.com`,
);
}

Expand Down

0 comments on commit 28b5d1d

Please sign in to comment.