Add Savage 2: A Tortured Soul (2008) (2.0.24)

This commit is contained in:
Michael Morrison 2021-01-08 20:02:23 -06:00
parent 81a3ec1019
commit e99b3c1812
5 changed files with 38 additions and 3 deletions

View file

@ -1,3 +1,6 @@
### 2.0.24
* Add Savage 2: A Tortured Soul (2008)
### 2.0.23
* Fix Conan Exiles and other games which don't respond to the valve player query
* Add givenPortOnly query option for users that require extreme optimization

View file

@ -274,6 +274,7 @@ Games List
| `rust` | Rust
| `stalker` | S.T.A.L.K.E.R.
| `samp` | San Andreas Multiplayer
| `savage2` | Savage 2: A Tortured Soul (2008)
| `ss` | Serious Sam
| `ss2` | Serious Sam 2
| `shatteredhorizon` | Shattered Horizon
@ -385,7 +386,6 @@ Games List
* Red Faction
* S.T.A.L.K.E.R. Clear Sky
* Savage: The Battle For Newerth
* Savage 2: A Tortured Soul
* SiN 1 Multiplayer
* South Park
* Star Wars Jedi Knight: Dark Forces II

View file

@ -216,6 +216,7 @@ rs2|Rising Storm 2: Vietnam|valve|port=27015
rune|Rune|gamespy1|port=7777,port_query_offset=1
rust|Rust|valve|port=28015
samp|San Andreas Multiplayer|samp|port=7777
savage2|Savage 2: A Tortured Soul (2008)|savage2|port_query=11235
spaceengineers|Space Engineers|valve|port=27015
ss|Serious Sam|gamespy1|port=25600,port_query_offset=1
ss2|Serious Sam 2|gamespy2|port=25600

View file

@ -24,7 +24,7 @@
],
"main": "lib/index.js",
"author": "GameDig Contributors",
"version": "2.0.23",
"version": "2.0.24",
"repository": {
"type": "git",
"url": "https://github.com/gamedig/node-gamedig.git"

31
protocols/savage2.js Normal file
View file

@ -0,0 +1,31 @@
const Core = require('./core');
class Savage2 extends Core {
constructor() {
super();
}
async run(state) {
const buffer = await this.udpSend('\x01',b => b);
const reader = this.reader(buffer);
reader.skip(12);
state.name = this.stripColorCodes(reader.string());
state.players = reader.uint(1);
state.maxplayers = reader.uint(1);
state.raw.time = reader.string();
state.map = reader.string();
state.raw.nextmap = reader.string();
state.raw.location = reader.string();
state.raw.minplayers = reader.uint(1);
state.raw.gametype = reader.string();
state.raw.version = reader.string();
state.raw.minlevel = reader.uint(1);
}
stripColorCodes(str) {
return str.replace(/\^./g,'');
}
}
module.exports = Savage2;