From 242565c87e4a13ca284bde2925b5548adabf5290 Mon Sep 17 00:00:00 2001 From: RattleSN4K3 Date: Sat, 21 Sep 2024 17:12:22 +0200 Subject: [PATCH] Pass state.password as raw + move to separate method for subclassing --- protocols/renegadex.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/protocols/renegadex.js b/protocols/renegadex.js index 1b2814e7..b2c5007e 100644 --- a/protocols/renegadex.js +++ b/protocols/renegadex.js @@ -28,6 +28,15 @@ export default class renegadex extends Core { throw new Error('Server not found in master server list') } + // set state properties based on received server info + this.populateProperties(state, serverInfo) + } + + /** + * Translates raw properties into known properties + * @param {Object} state Parsed data + */ + populateProperties (state, serverInfo) { let emptyPrefix = '' if (serverInfo.NamePrefix) emptyPrefix = serverInfo.NamePrefix + ' ' const servername = `${emptyPrefix}${serverInfo.Name}` @@ -37,7 +46,7 @@ export default class renegadex extends Core { state.name = servername state.map = serverInfo['Current Map'] - state.password = Math.abs(!!variables.bPassworded) + state.password = variables.bPassworded state.numplayers = numplayers state.maxplayers = variables['Player Limit'] || 0