Nadeo cleanup for merge

This commit is contained in:
mmorrison 2018-03-18 05:42:44 -05:00
parent 471d3775b3
commit 0854345f40

View file

@ -60,21 +60,27 @@ class Nadeo extends require('./core') {
state.name = this.stripColors(results[3].Name);
state.password = (results[3].Password !== 'No password');
state.maxplayers = results[3].CurrentMaxPlayers;
state.maxspectators = results[3].CurrentMaxSpectators;
state.currmap_name = this.stripColors(results[4].Name);
state.currmap_uid = results[4].UId;
state.gametype = gamemode;
state.players = results[2];
state.mapcount = results[5].NbChallenge;
state.nextmap_name = this.stripColors(results[6].Name);
state.nextmap_uid = results[6].UId;
state.raw.maxspectators = results[3].CurrentMaxSpectators;
state.map = this.stripColors(results[4].Name);
state.raw.mapUid = results[4].UId;
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 state.raw.players) {
state.players.push({
name:this.stripColors(player.Name || player.NickName)
});
}
this.finish(state);
});
}
stripColors(str) {
return str.replace(/(\$[0-9a-f|A-F]{3}|\$[a-z|A-Z]{1})/g,'');
return str.replace(/\$([0-9a-f]{3}|[a-z])/gi,'');
}
}