Fix return object to spec

Updated return object to spec defined in readme.md. Additionally added raw response object.
This commit is contained in:
josh 2023-12-02 21:12:06 -05:00
parent c35fc29e9d
commit e054b73d63
2 changed files with 12 additions and 11 deletions

View File

@ -36,6 +36,7 @@ see next point) and `tshock` (which is `terraria`).
* Removed the players::setNum method, the library will no longer add empty players as
a placeholder in the `players` fields.
* Stabilized field `numplayers`.
* Added support for monitoring Halo Online (ElDewrito)
### 4.2.0
* Renamed `Counter Strike: 2D` to `CS2D` in [games.txt](games.txt) (why? see [this](https://cs2d.com/faq.php?show=misc_name#misc_name)).

View File

@ -6,18 +6,18 @@ export default class eldewrito extends Core {
url: 'http://' + this.options.address + ':' + this.options.port,
responseType: 'json'
})
for (const one of json.players) {
state.players.push({ name: one.name, team: one.team })
}
state.gameState = json.status
state.gamePort = json.port
state.numplayers = json.numPlayers
state.maxplayers = json.maxPlayers
state.map = json.map
state.variant = json.variant
for (const one of json.players) {
state.players.push({ name: one.name, team: one.team })
}
state.name = json.name
state.map = json.map
state.password = false
state.maxplayers = json.maxPlayers
state.bots = [];
state.connect = this.options.address + ":" + json.port
state.raw = json
}
}