From 9c8c6e4f894cb341febe5ef70c176c716ebf6ec4 Mon Sep 17 00:00:00 2001 From: Nicolas Graf Date: Mon, 26 Feb 2018 23:52:42 +0100 Subject: [PATCH 1/4] Added more states for trackmania --- protocols/nadeo.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/protocols/nadeo.js b/protocols/nadeo.js index 7a5fbb6..a23a2e6 100644 --- a/protocols/nadeo.js +++ b/protocols/nadeo.js @@ -21,11 +21,12 @@ class Nadeo extends require('./core') { const cmds = [ ['Connect'], ['Authenticate', this.options.login,this.options.password], - ['GetStatus'], - ['GetPlayerList',500,0], - ['GetServerOptions'], - ['GetCurrentChallengeInfo'], - ['GetCurrentGameInfo'] + ['GetStatus'], // 1 + ['GetPlayerList',500,0], // 2 + ['GetServerOptions'], // 3 + ['GetCurrentMapInfo'], // 4 + ['GetCurrentGameInfo'], // 5 + ['GetNextMapInfo'] // 6 ]; const results = []; @@ -59,8 +60,13 @@ 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.map = this.stripColors(results[4].Name); - state.raw.gametype = gamemode; + state.maxspectators = results[3].CurrentMaxSpectators; + state.currmap_name = this.stripColors(results[4].Name); + state.currmap_uid = results[4].UId; + state.gametype = gamemode; + state.mapcount = results[5].NbChallenge; + state.nextmap_name = this.stripColors(results[6].Name); + state.nextmap_uid = results[6].UId; for (const player of results[2]) { state.players.push({name:this.stripColors(player.Name)}); From 284a1fcf401d66e91a946e5db49b09189bc37bd9 Mon Sep 17 00:00:00 2001 From: Nicolas Graf Date: Wed, 28 Feb 2018 03:47:14 +0100 Subject: [PATCH 2/4] removed player loop, enabled full playerlist output, and increased maxoutput on playerlist --- protocols/nadeo.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/protocols/nadeo.js b/protocols/nadeo.js index a23a2e6..49a123e 100644 --- a/protocols/nadeo.js +++ b/protocols/nadeo.js @@ -22,7 +22,7 @@ class Nadeo extends require('./core') { ['Connect'], ['Authenticate', this.options.login,this.options.password], ['GetStatus'], // 1 - ['GetPlayerList',500,0], // 2 + ['GetPlayerList',10000,0], // 2 ['GetServerOptions'], // 3 ['GetCurrentMapInfo'], // 4 ['GetCurrentGameInfo'], // 5 @@ -64,14 +64,11 @@ class Nadeo extends require('./core') { 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; - for (const player of results[2]) { - state.players.push({name:this.stripColors(player.Name)}); - } - this.finish(state); }); } From 7c5c230686004c201be94d7c407dae82bf580c90 Mon Sep 17 00:00:00 2001 From: Nicolas Graf Date: Thu, 1 Mar 2018 09:34:30 +0100 Subject: [PATCH 3/4] fixed faulty regex --- protocols/nadeo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protocols/nadeo.js b/protocols/nadeo.js index 49a123e..dbe6661 100644 --- a/protocols/nadeo.js +++ b/protocols/nadeo.js @@ -74,8 +74,9 @@ class Nadeo extends require('./core') { } stripColors(str) { - return str.replace(/\$([0-9a-f][^\$]?[^\$]?|[^\$]?)/g,''); + return str.replace(/\$([0-9a-f][^\$][^\$]|[^\$]?[^\$]?[^\$])/g,''); } + } module.exports = Nadeo; From 871647fcbc397c00689919684c0a93dd3eb5d7be Mon Sep 17 00:00:00 2001 From: Nicolas Graf Date: Thu, 1 Mar 2018 13:05:16 +0100 Subject: [PATCH 4/4] fixed regex again --- protocols/nadeo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/nadeo.js b/protocols/nadeo.js index dbe6661..f6a4387 100644 --- a/protocols/nadeo.js +++ b/protocols/nadeo.js @@ -74,7 +74,7 @@ class Nadeo extends require('./core') { } stripColors(str) { - return str.replace(/\$([0-9a-f][^\$][^\$]|[^\$]?[^\$]?[^\$])/g,''); + return str.replace(/(\$[0-9a-f|A-F]{3}|\$[a-z|A-Z]{1})/g,''); } }