teeworlds-econ
Version:
Teeworlds external console
23 lines (19 loc) • 764 B
JavaScript
var debug, handleKillMessage, parseWeapon, ref;
ref = require('../utils'), debug = ref.debug, parseWeapon = ref.parseWeapon;
handleKillMessage = function(econ, message) {
var matches;
if (matches = /^\[game\]: kill killer='([0-9]+):(.+?)' victim='([0-9]+)+:(.+?)' weapon=([0-9-]+) special=[0-9]+$/.exec(message)) {
if (matches[5] === '-3') {
return;
}
debug.events('%s:%s econ %s event', econ.server.host, econ.server.port, 'kill');
return econ.emit('kill', {
killer: matches[2],
victim: matches[4],
weapon: parseWeapon(parseInt(matches[5])),
killerClient: econ.getClientInfo(parseInt(matches[1])),
victimClient: econ.getClientInfo(parseInt(matches[3]))
});
}
};
module.exports = handleKillMessage;