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:
CosminPerRam 2023-09-17 13:01:39 +03:00 committed by GitHub
parent 17f91904ab
commit 328d518d5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 1 deletions

19
protocols/eco.js Normal file
View 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;
}
}

View file

@ -6,6 +6,7 @@ import buildandshoot from "./buildandshoot.js";
import cs2d from "./cs2d.js";
import discord from "./discord.js";
import doom3 from "./doom3.js";
import eco from "./eco.js";
import ffow from "./ffow.js";
import fivem from "./fivem.js";
import gamespy1 from "./gamespy1.js";
@ -45,7 +46,7 @@ import vcmp from "./vcmp.js";
import ventrilo from "./ventrilo.js";
import warsow from "./warsow.js";
export { armagetron, ase, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, ffow, fivem, gamespy1,
export { armagetron, ase, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, eco, ffow, fivem, gamespy1,
gamespy2, gamespy3, geneshift, goldsrc, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
minecraftbedrock, minecraftvanilla, mumble, mumbleping, nadeo, openttd, quake1, quake2, quake3, rfactor, samp,
savage2, starmade, starsiege, teamspeak2, teamspeak3, terraria, tribes1, tribes1master, unreal2, ut3, valve,