SquadJS/squad-server/log-parser/round-ended.js

22 lines
708 B
JavaScript
Raw Normal View History

/**
* Matches when Map state Changes to PostMatch (ScoreBoard)
*
* Emits winner and loser from eventstore
*
* winner and loser may be null if the match ends with a draw
*/
export default {
regex:
/^\[([0-9.:-]+)]\[([ 0-9]*)]LogGameState: Match State Changed from InProgress to WaitingPostMatch/,
onMatch: (args, logParser) => {
const data = {
winner: logParser.eventStore.ROUND_WINNER ? logParser.eventStore.ROUND_WINNER : null,
2022-09-28 22:00:55 -05:00
loser: logParser.eventStore.ROUND_LOSER ? logParser.eventStore.ROUND_LOSER : null,
time: args[1]
};
logParser.emit('ROUND_ENDED', data);
delete logParser.eventStore.ROUND_WINNER;
delete logParser.eventStore.ROUND_LOSER;
}
};