Compare commits

...

13 Commits

Author SHA1 Message Date
Pedro Ivo Hudson 304e276ff1
Merge a4790bbfaa into 2b58e0d233 2024-05-11 15:41:12 -03:00
CosminPerRam 2b58e0d233 feat: bump version to 5.0.0 2024-05-11 19:36:07 +03:00
CosminPerRam 00d2f17991 docs: revert and add back the a tags in games_list and simplify nadeo name 2024-05-11 19:16:21 +03:00
CosminPerRam d124f4d454 docs: remove a tags from GAMES_LIST 2024-05-11 19:13:30 +03:00
CosminPerRam 9aa8914418 docs: add minecraft game id performance note
Added as a side effect of #370
2024-05-11 19:10:05 +03:00
CosminPerRam a4886eaff4 docs: add a note regarding the attemptTimeout option
Added as a side effect of #370
2024-05-11 19:05:26 +03:00
CosminPerRam 9bd3caab7b feat(protocol/minecraft): reduce repeated code on promise.push 2024-05-11 18:47:38 +03:00
Rob Stivanson f52f9b2322
feat: add abiotic factor support (#563) 2024-05-07 12:07:17 +03:00
Pedro Ivo Hudson a4790bbfaa fix alias reference in tools 2024-02-14 11:33:35 -03:00
Pedro Ivo Hudson 242a1f4035 adds checkAlias option 2024-02-14 11:31:58 -03:00
Pedro Ivo Hudson c9d8e00139 add alias as an extra field 2024-02-09 21:15:36 -03:00
Pedro Ivo Hudson c317cfc760 Merge branch 'master' into fat/add-game-type-alias 2024-02-09 21:09:50 -03:00
Pedro Ivo Hudson cebefe3899 feat: add game type alias 2024-01-18 08:00:08 -03:00
10 changed files with 52 additions and 31 deletions

View File

@ -1,6 +1,9 @@
## To Be Released...
## 5.0.0-beta.3
## 5.X.Y
In progress?
## 5.0.0
* Added a new stabilized field `version` in the query response (By @podrivo #532)
* Euro Truck Simulator 2 (2012) - Added support (By @podrivo #523)
* Eco - Fixed querying servers using reverse queries and player names (By @Vito0912 #526)
@ -17,6 +20,7 @@
* Fix: BeamMP filter servers by address, not host (By @Rephot #558)
* Palworld - Replace old and broken protocol with the new one (#560)
* Nova-Life: Amboise - Added support.
* Abiotic Factor - Added Support.
## 5.0.0-beta.2
* Fixed support for projects using `require`.

View File

@ -4,6 +4,7 @@
| a2oa | ARMA 2: Operation Arrowhead | [Valve Protocol](#valve) |
| aaa | ARMA: Armed Assault | |
| aapg | America's Army: Proving Grounds | [Valve Protocol](#valve) |
| abioticfactor | Abiotic Factor | [Valve Protocol](#valve) |
| actionsource | Action: Source | [Valve Protocol](#valve) |
| acwa | ARMA: Cold War Assault | |
| ahl | Action Half-Life | [Valve Protocol](#valve) |
@ -398,18 +399,18 @@ Games with Additional Notes
To receive a full player list response from CS:GO servers, the server must
have set the cvar: host_players_show 2
### Discord
### <a name="discord"></a> Discord
You must set the `guildId` request field to the server's guild ID. Do not provide an IP.
The Guild ID can be found in server widget settings (Server ID) or by enabling developer mode in client settings and right-clicking the server's icon.
In order to retrieve information from discord server's they must have the `Enable server widget` option enabled.
### Mumble
### <a name="mumble"></a> Mumble
For full query results from Mumble, you must be running the
[GTmurmur plugin](http://www.gametracker.com/downloads/gtmurmurplugin.php).
If you do not wish to run the plugin, or do not require details such as channel and user lists,
you can use the 'mumbleping' server type instead, which uses a less accurate but more reliable solution
### Nadeo (ShootMania / TrackMania / etc)
### <a name="nadeo"></a> Nadeo (ShootMania / TrackMania / etc)
The server must have xmlrpc enabled, and you must pass the xmlrpc port to GameDig, not the connection port.
You must have a user account on the server with access level User or higher.
Pass the login into to GameDig with the additional options: login, password
@ -428,11 +429,11 @@ For teamspeak 3 queries to work correctly, the following permissions must be ava
In the extremely unusual case that your server host responds to queries on a non-default port (the default is 10011),
you can specify their host query port using the teamspeakQueryPort option.
### Terraria
### <a name="terraria"></a>Terraria
Requires tshock server mod, and a REST user token, which can be passed to GameDig with the
additional option: `token`
### Valheim
### <a name="valheim"></a>Valheim
Valheim servers will only respond to queries if they are started in public mode (`-public 1`).
### <a name="dayz"></a>DayZ
@ -441,13 +442,15 @@ DayZ stores some of it's servers information inside the `tags` attribute. Make s
### <a name="thefront"></a>The Front
Responses with wrong `name` (gives out a steamid instead of the server name) and `maxplayers` (always 200, whatever the config would be) field values.
### <a name="conanexiles">Conan Exiles
### <a name="conanexiles"></a>Conan Exiles
Conan Exiles never responds to player query.
### <a name="minecraft">Minecraft
Many Minecraft servers do not respond with players data.
### <a name="minecraft"></a>Minecraft
Many Minecraft servers do not respond with players data.
Beware that using this entry is quite slow as it attempts 3 protocols at a time (`minecraftvanilla`, `minecraftbedrock` and `gamespy3`) and waits for all the queries to finish.
If you know your use case, it's better to use a single protocol or make your own logic for attempting multiple ones.
### <a name='farmingsimulator'>Farming Simulator
### <a name='farmingsimulator'></a>Farming Simulator
Farming Simulator servers need a token (reffered as code in the game). It can be obtained at your server's web interface (http://ip:port/settings.html). It can be passed to GameDig with the additional option: `token`. It does only work for your own server.
The response includes much information about the server. Currently, only the fields about server information (name, map, version, etc.), players and mods are parsed.

View File

@ -50,7 +50,7 @@ Confused on how this works, or you want to see more? Checkout the [examples](/ex
| **port** | number | Game port | Connection port or query port for the game server. Some games utilize a separate "query" port. If specifying the game port does not seem to work as expected, passing in this query port may work instead. |
| **maxRetries** | number | 1 | Number of retries to query server in case of failure. Note that this amount multiplies with the number of attempts. |
| **socketTimeout** | number | 2000 | Milliseconds to wait for a single packet. Beware that increasing this will cause many queries to take longer even if the server is online. |
| **attemptTimeout** | number | 10000 | Milliseconds allowed for an entire query attempt. This timeout is not commonly hit, as the socketTimeout typically fires first. |
| **attemptTimeout** | number | 10000 | Milliseconds allowed for an entire query attempt (including `socketTimeout`, beware that if this value is smaller (or even equal) to the socket one, the query will always fail). |
| **givenPortOnly** | boolean | false | Only attempt to query server on given port. It will ignore the game's default port. |
| **ipFamily** | number | 0 | IP family/version returned when looking up hostnames via DNS, can be 0 (IPv4 and IPv6), 4 (IPv4 only) or 6 (IPv6 only). |
| **debug** | boolean | false | Enables massive amounts of debug logging to stdout. |
@ -61,6 +61,7 @@ Confused on how this works, or you want to see more? Checkout the [examples](/ex
| **portCache** | boolean | true | After you queried a server, the second time you query that exact server (identified by specified ip and port), first add an attempt to query with the last successful port. |
| **noBreadthOrder** | boolean | false | Enable the behaviour of retrying an attempt X times followed by the next attempt X times, otherwise try attempt A, then B, then A, then B until reaching the X retry count of each. |
| **checkOldIDs** | boolean | false | Also checks the old ids amongst the current ones. |
| **checkAlias** | boolean | false | Also checks for alternative game ids. |
## Query Response

View File

@ -6,7 +6,7 @@ import Minimist from 'minimist'
import { GameDig } from './../lib/index.js'
const argv = Minimist(process.argv.slice(2), {
boolean: ['pretty', 'debug', 'givenPortOnly', 'requestRules', 'requestRulesRequired', 'requestPlayersRequired', 'stripColors', 'portCache', 'noBreadthOrder', 'checkOldIDs'],
boolean: ['pretty', 'debug', 'givenPortOnly', 'requestRules', 'requestRulesRequired', 'requestPlayersRequired', 'stripColors', 'portCache', 'noBreadthOrder', 'checkOldIDs', 'checkAlias'],
string: ['guildId', 'listenUdpPort', 'ipFamily', 'token'],
default: {
stripColors: true,

View File

@ -13,6 +13,12 @@ export const lookup = (options) => {
let game = games[type]
if (options.checkAlias) {
Object.keys(games).forEach((id) => {
if (games[id]?.extra?.alias) game = games[id]
})
}
if (options.checkOldIDs) {
Object.keys(games).forEach((id) => {
if (games[id]?.extra?.old_id === type) {

View File

@ -1,4 +1,12 @@
export const games = {
abioticfactor: {
name: 'Abiotic Factor',
release_year: 2024,
options: {
port: 27015,
protocol: 'valve'
}
},
actionsource: {
name: 'Action: Source',
release_year: 2019,
@ -2562,7 +2570,7 @@ export const games = {
protocol: 'nadeo'
},
extra: {
doc_notes: 'nadeo-shootmania--trackmania--etc'
doc_notes: 'nadeo'
}
},
sin: {
@ -2928,7 +2936,7 @@ export const games = {
protocol: 'nadeo'
},
extra: {
doc_notes: 'nadeo-shootmania--trackmania--etc'
doc_notes: 'nadeo'
}
},
trackmaniaforever: {
@ -2940,7 +2948,7 @@ export const games = {
protocol: 'nadeo'
},
extra: {
doc_notes: 'nadeo-shootmania--trackmania--etc'
doc_notes: 'nadeo'
}
},
tremulous: {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "gamedig",
"version": "5.0.0-beta.0",
"version": "5.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "gamedig",
"version": "5.0.0-beta.0",
"version": "5.0.0",
"license": "MIT",
"dependencies": {
"cheerio": "^1.0.0-rc.12",

View File

@ -32,7 +32,7 @@
"require": "./dist/index.cjs"
},
"author": "GameDig Contributors",
"version": "5.0.0-beta.2",
"version": "5.0.0",
"repository": {
"type": "git",
"url": "https://github.com/gamedig/node-gamedig.git"

View File

@ -24,9 +24,7 @@ export default class minecraft extends Core {
const vanillaResolver = new minecraftvanilla()
vanillaResolver.options = this.options
vanillaResolver.udpSocket = this.udpSocket
promises.push((async () => {
try { return await vanillaResolver.runOnceSafe() } catch (e) {}
})())
promises.push(vanillaResolver)
const gamespyResolver = new Gamespy3()
gamespyResolver.options = {
@ -34,18 +32,15 @@ export default class minecraft extends Core {
encoding: 'utf8'
}
gamespyResolver.udpSocket = this.udpSocket
promises.push((async () => {
try { return await gamespyResolver.runOnceSafe() } catch (e) {}
})())
promises.push(gamespyResolver)
const bedrockResolver = new minecraftbedrock()
bedrockResolver.options = this.options
bedrockResolver.udpSocket = this.udpSocket
promises.push((async () => {
try { return await bedrockResolver.runOnceSafe() } catch (e) {}
})())
promises.push(bedrockResolver)
const [vanillaState, gamespyState, bedrockState] = await Promise.all(promises)
const ranPromises = promises.map(p => p.runOnceSafe().catch(_ => undefined))
const [vanillaState, gamespyState, bedrockState] = await Promise.all(ranPromises)
state.raw.vanilla = vanillaState
state.raw.gamespy = gamespyState

View File

@ -21,12 +21,16 @@ sortedGamesIds.forEach(key => {
})
let generated = ''
generated += '| GameDig Type ID | Name | See Also\n'
generated += '|---|---|---\n'
generated += '| GameDig Type ID | Alias | Name | See Also\n'
generated += '|---|---|---|---\n'
for (const id in sortedGames) {
const game = sortedGames[id]
generated += '| ' + id.padEnd(10, ' ') + ' | ' + game.name
if (!game?.extra?.alias) {
game.alias = ' '
}
generated += '| ' + id.padEnd(10, ' ') + ' | ' + game.alias + ' | ' + game.name
const notes = []
if (game?.extra?.doc_notes) {
notes.push('[Notes](#' + game.extra.doc_notes + ')')