Skip to content

Commit

Permalink
chore: number parsing in player list and squad list
Browse files Browse the repository at this point in the history
  • Loading branch information
fantinodavide committed Jan 3, 2024
1 parent dc55169 commit b4c42d0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions squad-server/rcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ export default class SquadRcon extends Rcon {
if (!match) continue;

const data = match.groups;
data.playerID = +data.playerID;
data.isLeader = data.isLeader === 'True';
data.squadID = data.squadID !== 'N/A' ? data.squadID : null;
data.teamID = data.teamID !== 'N/A' ? +data.teamID : null;
data.squadID = data.squadID !== 'N/A' ? +data.squadID : null;

players.push(data);
}
Expand All @@ -169,10 +171,11 @@ export default class SquadRcon extends Rcon {
);
const matchSide = line.match(/Team ID: (\d) \((.+)\)/);
if (matchSide) {
teamID = matchSide[1];
teamID = +matchSide[1];
teamName = matchSide[2];
}
if (!match) continue;
match.groups.squadID = +match.groups.squadID;
squads.push({
...match.groups,
teamID: teamID,
Expand Down

0 comments on commit b4c42d0

Please sign in to comment.