Merge pull request #81 from ItsPhenom/master

Nadeo patches
This commit is contained in:
Michael Morrison 2018-03-18 05:39:49 -05:00 committed by GitHub
commit 471d3775b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 12 deletions

View File

@ -21,11 +21,12 @@ class Nadeo extends require('./core') {
const cmds = [ const cmds = [
['Connect'], ['Connect'],
['Authenticate', this.options.login,this.options.password], ['Authenticate', this.options.login,this.options.password],
['GetStatus'], ['GetStatus'], // 1
['GetPlayerList',500,0], ['GetPlayerList',10000,0], // 2
['GetServerOptions'], ['GetServerOptions'], // 3
['GetCurrentChallengeInfo'], ['GetCurrentMapInfo'], // 4
['GetCurrentGameInfo'] ['GetCurrentGameInfo'], // 5
['GetNextMapInfo'] // 6
]; ];
const results = []; const results = [];
@ -59,20 +60,23 @@ class Nadeo extends require('./core') {
state.name = this.stripColors(results[3].Name); state.name = this.stripColors(results[3].Name);
state.password = (results[3].Password !== 'No password'); state.password = (results[3].Password !== 'No password');
state.maxplayers = results[3].CurrentMaxPlayers; state.maxplayers = results[3].CurrentMaxPlayers;
state.map = this.stripColors(results[4].Name); state.maxspectators = results[3].CurrentMaxSpectators;
state.raw.gametype = gamemode; state.currmap_name = this.stripColors(results[4].Name);
state.currmap_uid = results[4].UId;
for (const player of results[2]) { state.gametype = gamemode;
state.players.push({name:this.stripColors(player.Name)}); state.players = results[2];
} state.mapcount = results[5].NbChallenge;
state.nextmap_name = this.stripColors(results[6].Name);
state.nextmap_uid = results[6].UId;
this.finish(state); this.finish(state);
}); });
} }
stripColors(str) { stripColors(str) {
return str.replace(/\$([0-9a-f][^\$]?[^\$]?|[^\$]?)/g,''); return str.replace(/(\$[0-9a-f|A-F]{3}|\$[a-z|A-Z]{1})/g,'');
} }
} }
module.exports = Nadeo; module.exports = Nadeo;