Skip to content

Commit

Permalink
Bring changes from Master repo
Browse files Browse the repository at this point in the history
https: //github.com/Team-Silver-Sphere/pull/243/commits/90ed90cb68316b07712f5b453201c40a29f7e24f
https: //github.com/Team-Silver-Sphere/pull/243/commits/b9f5766cc98dd90d9d72db988df5a85f939d5796
Co-Authored-By: ect0s <[email protected]>
  • Loading branch information
bombitmanbomb and ect0s committed Oct 13, 2022
1 parent cf882aa commit 2bfab95
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 30 deletions.
18 changes: 9 additions & 9 deletions squad-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ export default class SquadServer extends EventEmitter {

this.emit('PLAYER_BANNED', data);
});

this.rcon.on('SQUAD_CREATED', async (data) => {
data.player = await this.getPlayerBySteamID(data.playerSteamID, true);
delete data.playerName;
delete data.playerSteamID;
delete data.squadID;

this.emit('SQUAD_CREATED', data);
});
}

async restartRCON() {
Expand Down Expand Up @@ -293,15 +302,6 @@ export default class SquadServer extends EventEmitter {
this.logParser.on('TICK_RATE', (data) => {
this.emit('TICK_RATE', data);
});

this.logParser.on('SQUAD_CREATED', async (data) => {
data.player = await this.getPlayerBySteamID(data.playerSteamID, true);
delete data.playerName;
delete data.playerSteamID;
delete data.squadID;

this.emit('SQUAD_CREATED', data);
});
}

async restartLogParser() {
Expand Down
4 changes: 1 addition & 3 deletions squad-server/log-parser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import PlayerWounded from './player-wounded.js';
import RoundWinner from './round-winner.js';
import ServerTickRate from './server-tick-rate.js';
import SteamIDConnected from './steamid-connected.js';
import SquadCreated from './squad-created.js';

export default class SquadLogParser extends LogParser {
constructor(options) {
Expand All @@ -36,8 +35,7 @@ export default class SquadLogParser extends LogParser {
PlayerWounded,
RoundWinner,
ServerTickRate,
SteamIDConnected,
SquadCreated
SteamIDConnected
];
}
}
18 changes: 0 additions & 18 deletions squad-server/log-parser/squad-created.js

This file was deleted.

18 changes: 18 additions & 0 deletions squad-server/rcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,24 @@ export default class SquadRcon extends Rcon {
return;
}

const matchSqCreated = decodedPacket.body.match(
/(.+) \(Steam ID: ([0-9]{17})\) has created Squad (\d+) \(Squad Name: (.+)\) on (.+)/
);
if (matchSqCreated) {
Logger.verbose('SquadRcon', 2, `Matched Squad Created: ${decodedPacket.body}`);

this.emit('SQUAD_CREATED', {
time: new Date(),
playerName: matchSqCreated[1],
playerSteamID: matchSqCreated[2],
squadID: matchSqCreated[3],
squadName: matchSqCreated[4],
teamName: matchSqCreated[5]
});

return;
}

const matchBan = decodedPacket.body.match(
/Banned player ([0-9]+)\. \[steamid=(.*?)\] (.*) for interval (.*)/
);
Expand Down

0 comments on commit 2bfab95

Please sign in to comment.