Skip to content

Commit

Permalink
Pass state.password as raw + move to separate method for subclassing
Browse files Browse the repository at this point in the history
  • Loading branch information
RattleSN4K3 committed Sep 21, 2024
1 parent 9786d98 commit c656225
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion protocols/renegadex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
Expand All @@ -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
Expand Down

0 comments on commit c656225

Please sign in to comment.