feat: add Renegade X support (#643)

This commit is contained in:
RattleSN4K3 2024-10-04 09:42:43 +02:00 committed by GitHub
parent b3947164d3
commit fe9d4f2cfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 266 additions and 2 deletions

View file

@ -0,0 +1,21 @@
import renegadex from './renegadex.js'
/**
* Implements the protocol for retrieving a master list for Renegade X, an UnrealEngine3 based game
*/
export default class renegadexmaster extends renegadex {
async run (state) {
const servers = await this.getMasterServerList()
// pass processed servers as raw list
state.raw.servers = servers.map((serverInfo) => {
// TODO: may use any other deep-copy method like structuredClone() (in Node.js 17+)
// or use a method of Core to retrieve a clean state
const serverState = JSON.parse(JSON.stringify(state))
// set state properties based on received server info
this.populateProperties(serverState, serverInfo)
return serverState
})
}
}