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-11-25 16:03:56 +02:00
parent 2630d918d5
commit e25fcf17bd
4 changed files with 30 additions and 0 deletions

View File

@ -2,6 +2,15 @@
### To Be Released...
* (changelog)
#### Other changes
* Replaced usage of deprecated `substr` with `substring`.
* Moved the library a `module`.
* CLI: Resolved incorrect error message when querying with a non-existent protocol name.
* Replaced deprecated internal `punycode` with the [punycode](https://www.npmjs.com/package/punycode) package.
### 4.2.0
* Eco (2018) - Added support (requested by @dgibbs64)
### 4.1.0
* Replace `compressjs` dependency by `seek-bzip` to solve some possible import issues.
* Sons Of The Forest (2023) - Added support

View File

@ -96,6 +96,7 @@
| `doom3` | Doom 3 (2004) | |
| `dota2` | Dota 2 (2013) | [Valve Protocol](#valve) |
| `drakan` | Drakan: Order of the Flame (1999) | |
| `eco` | Eco (2018) | |
| `empyrion` | Empyrion - Galactic Survival (2015) | [Valve Protocol](#valve) |
| `etqw` | Enemy Territory: Quake Wars (2007) | |
| `fear` | F.E.A.R. (2005) | |

View File

@ -108,6 +108,7 @@ doom3|Doom 3 (2004)|doom3|port=27666
dota2|Dota 2 (2013)|valve|port=27015
drakan|Drakan: Order of the Flame (1999)|gamespy1|port=27045,port_query_offset=1
dst|Don't Starve Together (2016)|valve|port=10999,port_query=27016
eco|Eco (2018)|eco|port=3000,port_query_offset=1
empyrion|Empyrion - Galactic Survival (2015)|valve|port=30000,port_query_offset=1
etqw|Enemy Territory: Quake Wars (2007)|doom3|port=3074,port_query=27733
fear|F.E.A.R. (2005)|gamespy2|port_query=27888

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;
}
}