mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-09-19 00:51:29 +02:00
feat: Add Grand Theft Auto V - RAGE MP support (#576)
* feat: Add Grand Theft Auto V - RAGE MP support * Add changelog entry * Change ID for RageMP to gta5r * Rename to be RageMP * Revert prettier changing * to - * Add notes to ragemp. * Update CHANGELOG.md
This commit is contained in:
parent
ce29238428
commit
cfd5614353
@ -4,6 +4,7 @@
|
||||
* Minetest - Added support for minetest utilizing official server list (By @xCausxn #573)
|
||||
* Soulmask - Added support (By @xCausxn #572)
|
||||
* Restore Minecraft's favicon (#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)
|
||||
|
||||
## 5.0.0
|
||||
|
@ -137,6 +137,7 @@
|
||||
| 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 | |
|
||||
@ -416,6 +417,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:
|
||||
|
||||
|
11
lib/games.js
11
lib/games.js
@ -1270,6 +1270,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,
|
||||
|
@ -57,11 +57,12 @@ 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'
|
||||
|
||||
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
|
||||
}
|
||||
|
49
protocols/ragemp.js
Normal file
49
protocols/ragemp.js
Normal file
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user