Skip to content

Commit

Permalink
added naming to party games and tnt tag
Browse files Browse the repository at this point in the history
I could do something nicer in the toMode function, but I think it's okay for now
  • Loading branch information
camnwalter authored and ChristianDobbie committed Jan 10, 2022
1 parent d120443 commit 2afbce6
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions processors/processGameCounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,34 @@ function processGameCounts(data) {
};
const { games: games_, playerCount } = data;
for (const [rawGame, data_] of Object.entries(games_)) {
const cleanGame = toMode(rawGame.replace(/_LOBBY/, ''), modes) || rawGame;
const cleanGame = toMode(rawGame.replace(/_LOBBY/, ''), modes);
if (data_.modes && Object.keys(data_.modes).length > 1) {
const modes_ = {};
for (const [rawMode, count] of Object.entries(data_.modes)) {
const cleanMode = toMode(rawMode, modes) || rawMode;
const cleanMode = toMode(rawMode, modes);
modes_[rawMode] = {};
if (cleanMode !== rawMode) {
modes_[rawMode].name = cleanMode;
switch (rawMode) {
case "PARTY":
modes_[rawMode].name = "Party Games";
break;
case "TNTAG":
modes_[rawMode].name = "TNT Tag";
break;
default:
modes_[rawMode].name = cleanMode;
break;
}
modes_[rawMode].players = count;
}
object.games[rawGame] = {};
if (cleanGame !== rawGame) {
if (cleanGame) {
object.games[rawGame].name = cleanGame;
}
object.games[rawGame].players = data_.players;
object.games[rawGame].modes = modes_;
} else {
object.games[rawGame] = {};
if (cleanGame !== rawGame) {
if (cleanGame) {
object.games[rawGame].name = cleanGame;
}
object.games[rawGame].players = data_.players;
Expand Down

0 comments on commit 2afbce6

Please sign in to comment.