mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-07-13 15:24:35 +00:00
Return formatted stats based off other gameTypes
This commit is contained in:
parent
96e15be86d
commit
ef32d90030
1 changed files with 25 additions and 10 deletions
|
|
@ -25,19 +25,34 @@ export class GameService {
|
||||||
throw new NotFoundException(`Game ID: ${gameId} not found`);
|
throw new NotFoundException(`Game ID: ${gameId} not found`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to set return based off gameType
|
const game: any = {
|
||||||
|
...query[0].game
|
||||||
|
};
|
||||||
|
|
||||||
if (query[0].gametype !== 'CTFGame') {
|
// Need to set return based off gameType
|
||||||
return query;
|
// Modify game object if not a CTF type game and return early
|
||||||
|
if (query[0].gametype !== 'CTFGame' && query[0].gametype !== 'SCtFGame') {
|
||||||
|
game['players'] = [];
|
||||||
|
for (const player of query) {
|
||||||
|
const { playerName, stats } = player;
|
||||||
|
|
||||||
|
const p = {
|
||||||
|
playerGuid: player.playerGuid.playerGuid,
|
||||||
|
playerName,
|
||||||
|
stats
|
||||||
|
};
|
||||||
|
|
||||||
|
game.players.push(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
return game;
|
||||||
}
|
}
|
||||||
|
|
||||||
const game: any = {
|
// Team Based game stats (CTF/SCtF)
|
||||||
...query[0].game,
|
game['teams'] = {
|
||||||
teams: {
|
obs: { score: 0, players: [] },
|
||||||
obs: { score: 0, players: [] },
|
storm: { score: 0, players: [] },
|
||||||
storm: { score: 0, players: [] },
|
inferno: { score: 0, players: [] }
|
||||||
inferno: { score: 0, players: [] }
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const player of query) {
|
for (const player of query) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue