mirror of
https://github.com/AsgardEternal/SquadJS.git
synced 2024-09-28 11:54:23 -05:00
Merge branch 'Team-Silver-Sphere:master' into upstream-playerdisconnectbug
This commit is contained in:
commit
5804002d08
@ -139,9 +139,11 @@ export default class SquadRcon extends Rcon {
|
||||
|
||||
const players = [];
|
||||
|
||||
if(!response || response.length < 1) return players;
|
||||
|
||||
for (const line of response.split('\n')) {
|
||||
const match = line.match(
|
||||
/ID: ([0-9]+) \| SteamID: ([0-9]{17}) \| Name: (.+) \| Team ID: ([0-9]+) \| Squad ID: ([0-9]+|N\/A)/
|
||||
/ID: ([0-9]+) \| SteamID: ([0-9]{17}) \| Name: (.+) \| Team ID: ([0-9]+) \| Squad ID: ([0-9]+|N\/A) \| Is Leader: (True|False) \| Role: ([A-Za-z0-9_]*)\b/
|
||||
);
|
||||
if (!match) continue;
|
||||
|
||||
@ -150,7 +152,9 @@ export default class SquadRcon extends Rcon {
|
||||
steamID: match[2],
|
||||
name: match[3],
|
||||
teamID: match[4],
|
||||
squadID: match[5] !== 'N/A' ? match[5] : null
|
||||
squadID: match[5] !== 'N/A' ? match[5] : null,
|
||||
isLeader: match[6] === 'True',
|
||||
role: match[7]
|
||||
});
|
||||
}
|
||||
|
||||
@ -164,9 +168,11 @@ export default class SquadRcon extends Rcon {
|
||||
let teamName;
|
||||
let teamID;
|
||||
|
||||
if(!responseSquad || responseSquad.length < 1) return squads;
|
||||
|
||||
for (const line of responseSquad.split('\n')) {
|
||||
const match = line.match(
|
||||
/ID: ([0-9]+) \| Name: (.+) \| Size: ([0-9]+) \| Locked: (True|False)/
|
||||
/ID: ([0-9]+) \| Name: (.+) \| Size: ([0-9]+) \| Locked: (True|False) \| Creator Name: (.+) \| Creator Steam ID: ([0-9]{17})/
|
||||
);
|
||||
const matchSide = line.match(/Team ID: (1|2) \((.+)\)/);
|
||||
if (matchSide) {
|
||||
@ -174,11 +180,13 @@ export default class SquadRcon extends Rcon {
|
||||
teamName = matchSide[2];
|
||||
}
|
||||
if (!match) continue;
|
||||
await squads.push({
|
||||
squads.push({
|
||||
squadID: match[1],
|
||||
squadName: match[2],
|
||||
size: match[3],
|
||||
locked: match[4],
|
||||
creatorName: match[5],
|
||||
creatorSteamID: match[6],
|
||||
teamID: teamID,
|
||||
teamName: teamName
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user