From e99b3c1812f104cd1a253d6980c25865714bf4ac Mon Sep 17 00:00:00 2001 From: Michael Morrison Date: Fri, 8 Jan 2021 20:02:23 -0600 Subject: [PATCH] Add Savage 2: A Tortured Soul (2008) (2.0.24) --- CHANGELOG.md | 3 +++ README.md | 4 ++-- games.txt | 1 + package.json | 2 +- protocols/savage2.js | 31 +++++++++++++++++++++++++++++++ 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 protocols/savage2.js diff --git a/CHANGELOG.md b/CHANGELOG.md index fc5aa5f..b066805 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index a1e8e9c..ec06072 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ Games List | `minecraft`
`minecraftping` | Minecraft (2009) | `minecraftpe`
`minecraftbe` | Minecraft: Bedrock Edition (2011) | `mnc` | Monday Night Combat (2011) -| `mordhau` | Mordhau (2019) +| `mordhau` | Mordhau (2019) | `mumble` | Mumble - GTmurmur Plugin (2005) | [Notes](#mumble) | `mumbleping` | Mumble - Lightweight (2005) | [Notes](#mumble) | `nascarthunder2004` | NASCAR Thunder 2004 (2003) @@ -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 diff --git a/games.txt b/games.txt index acc0747..b8f6e1a 100644 --- a/games.txt +++ b/games.txt @@ -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 diff --git a/package.json b/package.json index 25fc7dc..bd68f22 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/protocols/savage2.js b/protocols/savage2.js new file mode 100644 index 0000000..8dae2eb --- /dev/null +++ b/protocols/savage2.js @@ -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;