Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/gamedig/node-gamedig
Browse files Browse the repository at this point in the history
  • Loading branch information
xCausxn committed Jul 9, 2024
2 parents 9c9ee54 + 38229cd commit 7ca4db5
Show file tree
Hide file tree
Showing 18 changed files with 165 additions and 69 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

## To Be Released...
## 5.X.Y
* FOUNDRY - Added support (#585)

## 5.0.1
* Minetest - Added support for minetest utilizing official server list (By @xCausxn #573)
* Soulmask - Added support (By @xCausxn #572)
* Restore Minecraft's favicon (#575)
* Fix Minecraft's missing favicon from response (#575)
* Grand Theft Auto V: Rage MP - Added support (By @xCausxn #576)
* Fix duplicate game entry for The Forest (2014), add old id for backwards compatibility (By @xCausxn #579)
* Fix Xonotic player's names being numbers and their names being in the "raw" field (#580)

## 5.0.0
* Added a new stabilized field `version` in the query response (By @podrivo #532)
Expand Down
6 changes: 6 additions & 0 deletions GAMES_LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@
| fof | Fistful of Frags | [Valve Protocol](#valve) |
| formulaone2002 | Formula One 2002 | |
| fortressforever | Fortress Forever | [Valve Protocol](#valve) |
| foundry | FOUNDRY | [Valve Protocol](#valve) |
| garrysmod | Garry's Mod | [Valve Protocol](#valve) |
| gck | Giants: Citizen Kabuto | |
| geneshift | Geneshift | |
| globaloperations | Global Operations | |
| goldeneyesource | GoldenEye: Source | [Valve Protocol](#valve) |
| groundbreach | Ground Breach | [Valve Protocol](#valve) |
| gta5f | Grand Theft Auto V - FiveM | |
| gta5r | Grand Theft Auto V - RAGE MP | [Notes](#gta5r) |
| gtasam | Grand Theft Auto: San Andreas Multiplayer | |
| gtasamta | Grand Theft Auto: San Andreas - Multi Theft Auto | |
| gtasao | Grand Theft Auto: San Andreas OpenMP | |
Expand Down Expand Up @@ -416,6 +418,10 @@ The server must have xmlrpc enabled, and you must pass the xmlrpc port to GameDi
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

### <a name="gta5r"></a> Grand Theft Auto V - RAGE MP
If you are using a FQDN for your server, you will need to set the host parameter to be this domain e.g. rage2.mydomain.com
This is due to how the Rage MP master server works with server ids as the ip is only used in the ID if no FQDN is provided.

### <a name="teamspeak3"></a>TeamSpeak 3
For teamspeak 3 queries to work correctly, the following permissions must be available for the guest server group:

Expand Down
2 changes: 1 addition & 1 deletion lib/Logger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { debugDump } from './HexUtil.js'
import { Buffer} from 'node:buffer'
import { Buffer } from 'node:buffer'

export default class Logger {
constructor () {
Expand Down
21 changes: 20 additions & 1 deletion lib/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,14 @@ export const games = {
protocol: 'valve'
}
},
foundry: {
name: 'FOUNDRY',
release_year: 2024,
options: {
port: 27015,
protocol: 'valve'
}
},
fortressforever: {
name: 'Fortress Forever',
release_year: 2007,
Expand Down Expand Up @@ -1270,6 +1278,17 @@ export const games = {
old_id: 'fivem'
}
},
gta5r: {
name: 'Grand Theft Auto V - RageMP',
release_year: 2016,
options: {
port: 22005,
protocol: 'ragemp'
},
extra: {
doc_notes: 'gta5r'
}
},
garrysmod: {
name: "Garry's Mod",
release_year: 2004,
Expand Down Expand Up @@ -3250,7 +3269,7 @@ export const games = {
release_year: 2011,
options: {
port: 26000,
protocol: 'quake3'
protocol: 'xonotic'
}
},
xpandrally: {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"require": "./dist/index.cjs"
},
"author": "GameDig Contributors",
"version": "5.0.0",
"version": "5.0.1",
"repository": {
"type": "git",
"url": "https://github.com/gamedig/node-gamedig.git"
Expand Down
2 changes: 1 addition & 1 deletion protocols/asa.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class asa extends Epic {
this.deploymentId = 'ad9a8feffb3b4b2ca315546f038c3ae2'
}

async run(state) {
async run (state) {
await super.run(state)
state.version = state.raw.attributes.BUILDID_s + '.' + state.raw.attributes.MINORBUILDID_s
}
Expand Down
4 changes: 2 additions & 2 deletions protocols/assettocorsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class assettocorsa extends Core {
responseType: 'json'
})
const carInfo = await this.request({
url: `http://${this.options.address}:${this.options.port}/JSON|${parseInt(Math.random() * 999999999999999, 10)}`,
url: `http://${this.options.address}:${this.options.port}/JSON|${Math.floor(Math.random() * 999999999999999)}`,
responseType: 'json'
})

Expand All @@ -21,7 +21,7 @@ export default class assettocorsa extends Core {
state.password = serverInfo.pass
state.gamePort = serverInfo.port
state.numplayers = serverInfo.clients
state.version = state.raw.serverInfo.poweredBy
state.version = serverInfo.poweredBy

state.raw.carInfo = carInfo.Cars
state.raw.serverInfo = serverInfo
Expand Down
4 changes: 2 additions & 2 deletions protocols/dayz.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ export default class dayz extends valve {
state.raw.dlcEnabled = true
}
if (tag.includes('privHive')) {
state.raw.privateHive = true;
state.raw.privateHive = true
}
if (tag.includes('external')) {
state.raw.external = true;
state.raw.external = true
}
if (tag.includes(':')) {
state.raw.time = tag
Expand Down
2 changes: 1 addition & 1 deletion protocols/gtasao.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import samp from './samp.js'

export default class gtasao extends samp {
constructor() {
constructor () {
super()
this.isOmp = true
}
Expand Down
6 changes: 4 additions & 2 deletions protocols/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@ import beammpmaster from './beammpmaster.js'
import beammp from './beammp.js'
import dayz from './dayz.js'
import theisleevrima from './theisleevrima.js'
import ragemp from './ragemp.js'
import xonotic from './xonotic.js'

export {
armagetron, ase, asa, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, eco, epic, factorio, farmingsimulator, ffow,
fivem, gamespy1, gamespy2, gamespy3, geneshift, goldsrc, gtasao, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
minecraftbedrock, minecraftvanilla, minetest, mumble, mumbleping, nadeo, openttd, palworld, quake1, quake2, quake3, rfactor, samp,
minecraftbedrock, minecraftvanilla, minetest, mumble, mumbleping, nadeo, openttd, palworld, quake1, quake2, quake3, rfactor, ragemp, samp,
savage2, starmade, starsiege, teamspeak2, teamspeak3, terraria, tribes1, tribes1master, unreal2, ut3, valve,
vcmp, ventrilo, warsow, eldewrito, beammpmaster, beammp, dayz, theisleevrima
vcmp, ventrilo, warsow, eldewrito, beammpmaster, beammp, dayz, theisleevrima, xonotic
}
4 changes: 2 additions & 2 deletions protocols/minetest.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Core from './core.js'

export default class minetest extends Core {
constructor() {
constructor () {
super()
this.usedTcp = true
}

async run(state) {
async run (state) {
const servers = await this.request({
url: 'https://servers.minetest.net/list',
responseType: 'json'
Expand Down
2 changes: 1 addition & 1 deletion protocols/quake1.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class quake1 extends quake2 {
this.isQuake1 = true
}

async run(state) {
async run (state) {
await super.run(state)
if ('*version' in state.raw) state.version = state.raw['*version']
}
Expand Down
49 changes: 49 additions & 0 deletions protocols/ragemp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Core from './core.js'

export default class ragemp extends Core {
constructor () {
super()
this.usedTcp = true
}

async run (state) {
const results = await this.request({
url: 'https://cdn.rage.mp/master/v2/',
responseType: 'json'
})

if (results == null) {
throw new Error('Unable to retrieve master server list')
}

const targetID = `${this.options.host}:${this.options.port}`

let serverResult = null
let serverInfo = null

for (const entry of results) {
if (entry.id === targetID) {
serverResult = entry
serverInfo = entry.servers.at(0)
break
}

for (const serverEntry of entry.servers) {
if (serverEntry.id === targetID) {
serverResult = entry
serverInfo = serverEntry
break
}
}
}

if (serverInfo == null) {
throw new Error('Server not found in master server list.')
}

state.name = serverInfo.name
state.numplayers = serverInfo.players.amount
state.maxplayers = serverInfo.players.max
state.raw = serverResult
}
}
16 changes: 16 additions & 0 deletions protocols/xonotic.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import quake3 from './quake3.js'

export default class xonotic extends quake3 {
async run (state) {
await super.run(state)

// Sometimes, the server returns a player's name as a number (which seems to be the team?) and the name in
// an extra field called "address", we are not sure of this behaviour nor if this is a good enough solution
for (const player of state.players) {
if (!isNaN(player.name) && player.raw.address) {
player.raw.team = player.name
player.name = player.raw.address
}
}
}
}
3 changes: 1 addition & 2 deletions tools/attempt_protocols.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ if (argv._.length >= 1) {

const gamedig = new GameDig(options)

let protocolList = []
const protocolList = []
Object.keys(protocols).forEach((key) => protocolList.push(key))

const services = ['discord', 'beammpmaster', 'beammp', 'teamspeak2', 'teamspeak3']
const protocolListFiltered = protocolList.filter((protocol) => !services.includes(protocol))


const run = async () => {
for (const protocol of protocolListFiltered) {
try {
Expand Down
Loading

0 comments on commit 7ca4db5

Please sign in to comment.