mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-18 17:50:37 +01:00
Merge branch 'ItsPhenom-nadeo-patches'
This commit is contained in:
commit
780dd6d22b
1 changed files with 18 additions and 8 deletions
|
@ -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,11 +60,19 @@ 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.raw.maxspectators = results[3].CurrentMaxSpectators;
|
||||||
state.map = this.stripColors(results[4].Name);
|
state.map = this.stripColors(results[4].Name);
|
||||||
|
state.raw.mapUid = results[4].UId;
|
||||||
state.raw.gametype = gamemode;
|
state.raw.gametype = gamemode;
|
||||||
|
state.raw.players = results[2];
|
||||||
|
state.raw.mapcount = results[5].NbChallenge;
|
||||||
|
state.raw.nextmapName = this.stripColors(results[6].Name);
|
||||||
|
state.raw.nextmapUid = results[6].UId;
|
||||||
|
|
||||||
for (const player of results[2]) {
|
for (const player of state.raw.players) {
|
||||||
state.players.push({name:this.stripColors(player.Name)});
|
state.players.push({
|
||||||
|
name:this.stripColors(player.Name || player.NickName)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.finish(state);
|
this.finish(state);
|
||||||
|
@ -71,8 +80,9 @@ class Nadeo extends require('./core') {
|
||||||
}
|
}
|
||||||
|
|
||||||
stripColors(str) {
|
stripColors(str) {
|
||||||
return str.replace(/\$([0-9a-f][^\$]?[^\$]?|[^\$]?)/g,'');
|
return str.replace(/\$([0-9a-f]{3}|[a-z])/gi,'');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Nadeo;
|
module.exports = Nadeo;
|
||||||
|
|
Loading…
Reference in a new issue