fix: Nadeo failing queries on map info (#667)

* fix: nadeo failing queries

* docs: update changelog, fix games list issue not being hyperlinked

* feat: Adding CurrentChallengeInfo to get Map Informations (#669)

Co-authored-by: Stephan Schaffner <stephan.schaffner@check24.de>

* docs: remove note removal notice from games_list

* docs: update changelog to note for version

* docs: mention @Hornochs in the changelog line

* chore: swap some lines around

---------

Co-authored-by: Stephan Schaffner <chaos_bloated856@memehorst.de>
Co-authored-by: Stephan Schaffner <stephan.schaffner@check24.de>
This commit is contained in:
CosminPerRam 2025-01-21 19:40:49 +02:00 committed by GitHub
parent a62f623134
commit 56a90eabce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 14 deletions

View file

@ -9,20 +9,19 @@ export default class nadeo extends Core {
await this.query(client, 'Authenticate', this.options.login, this.options.password)
this.registerRtt(Date.now() - start)
// const data = this.methodCall(client, 'GetStatus');
{
const results = await this.query(client, 'GetServerOptions')
state.name = this.stripColors(results.Name)
state.password = (results.Password !== 'No password')
state.maxplayers = results.CurrentMaxPlayers
state.raw.maxspectators = results.CurrentMaxSpectators
state.raw.GetServerOptions = results
}
{
const results = await this.query(client, 'GetCurrentMapInfo')
const results = await this.query(client, 'GetCurrentChallengeInfo')
state.map = this.stripColors(results.Name)
state.raw.mapUid = results.UId
state.raw.GetCurrentChallengeInfo = results
}
{
@ -37,12 +36,13 @@ export default class nadeo extends Core {
if (igm === 5) gamemode = 'Cup'
state.raw.gametype = gamemode
state.raw.mapcount = results.NbChallenge
state.raw.GetCurrentGameInfo = results
}
{
const results = await this.query(client, 'GetNextMapInfo')
state.raw.nextmapName = this.stripColors(results.Name)
state.raw.nextmapUid = results.UId
const results = await this.query(client, 'GetVersion')
state.version = results.Version
state.raw.GetVersion = results
}
if (this.options.port === 5000) {
@ -71,11 +71,10 @@ export default class nadeo extends Core {
}
}
async query (client, ...cmdset) {
const cmd = cmdset[0]
const params = cmdset.slice(1)
async query (client, command, ...args) {
const params = args.slice()
const sentPromise = client.query(cmd, params)
const sentPromise = client.query(command, params)
const timeoutPromise = Promises.createTimeout(this.options.socketTimeout, 'GBX Method Call')
return await Promise.race([sentPromise, timeoutPromise, this.abortedPromise])
}