mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
Add Eco (2018) support. (#363)
* Add initial working eco query * Add default port and add the game to games.txt * Add to changelog * Fix request Info object and add to raw the object * Rearrange some code to be more readable
This commit is contained in:
parent
17f91904ab
commit
328d518d5b
5 changed files with 24 additions and 1 deletions
19
protocols/eco.js
Normal file
19
protocols/eco.js
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import Core from './core.js';
|
||||
|
||||
export default class eco extends Core {
|
||||
async run(state) {
|
||||
if (!this.options.port) this.options.port = 3001;
|
||||
|
||||
const request = await this.request({
|
||||
url: `http://${this.options.address}:${this.options.port}/frontpage`,
|
||||
responseType: 'json'
|
||||
});
|
||||
const serverInfo = request.Info;
|
||||
|
||||
state.name = serverInfo.Description;
|
||||
state.maxplayers = serverInfo.TotalPlayers;
|
||||
state.password = serverInfo.HasPassword;
|
||||
state.gamePort = serverInfo.GamePort;
|
||||
state.raw = serverInfo;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue