Skip to content

Commit

Permalink
feat: Add Grand Theft Auto V - RAGE MP support (gamedig#576)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
xCausxn authored Jun 24, 2024
1 parent ce29238 commit cfd5614
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions GAMES_LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand Down Expand Up @@ -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:

Expand Down
11 changes: 11 additions & 0 deletions lib/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion protocols/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 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
}
}

0 comments on commit cfd5614

Please sign in to comment.