From 0854345f407dd2962ae5946dbddc889086038e13 Mon Sep 17 00:00:00 2001 From: mmorrison Date: Sun, 18 Mar 2018 05:42:44 -0500 Subject: [PATCH] Nadeo cleanup for merge --- protocols/nadeo.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/protocols/nadeo.js b/protocols/nadeo.js index f6a4387..77f2ce2 100644 --- a/protocols/nadeo.js +++ b/protocols/nadeo.js @@ -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,''); } }