chore: number parsing in player list and squad list

This commit is contained in:
Fantino Davide 2024-01-03 13:09:20 +01:00
parent dc55169e05
commit b4c42d099f

View File

@ -145,8 +145,10 @@ export default class SquadRcon extends Rcon {
if (!match) continue; if (!match) continue;
const data = match.groups; const data = match.groups;
data.playerID = +data.playerID;
data.isLeader = data.isLeader === 'True'; 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); players.push(data);
} }
@ -169,10 +171,11 @@ export default class SquadRcon extends Rcon {
); );
const matchSide = line.match(/Team ID: (\d) \((.+)\)/); const matchSide = line.match(/Team ID: (\d) \((.+)\)/);
if (matchSide) { if (matchSide) {
teamID = matchSide[1]; teamID = +matchSide[1];
teamName = matchSide[2]; teamName = matchSide[2];
} }
if (!match) continue; if (!match) continue;
match.groups.squadID = +match.groups.squadID;
squads.push({ squads.push({
...match.groups, ...match.groups,
teamID: teamID, teamID: teamID,