diff --git a/CHANGELOG.md b/CHANGELOG.md index 51bcba3..f82fe52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 4.0.1 +* Rust - Fixed maxplayers >255 +* dayZ - Fixed tag info not parsing when queryRules wasn't set + ### 4.0.0 #### Breaking Changes diff --git a/package.json b/package.json index 43c63aa..811b40f 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ ], "main": "lib/index.js", "author": "GameDig Contributors", - "version": "4.0.0", + "version": "4.0.1", "repository": { "type": "git", "url": "https://github.com/gamedig/node-gamedig.git" diff --git a/protocols/valve.js b/protocols/valve.js index 3aa23e4..5492796 100644 --- a/protocols/valve.js +++ b/protocols/valve.js @@ -7,7 +7,8 @@ const AppId = { Squad: 393380, Bat1944: 489940, Ship: 2400, - DayZ: 221100 + DayZ: 221100, + Rust: 252490 }; class Valve extends Core { @@ -116,6 +117,8 @@ class Valve extends Core { } } + const appId = state.raw.appId; + // from https://developer.valvesoftware.com/wiki/Server_queries if( state.raw.protocol === 7 && ( @@ -132,6 +135,56 @@ class Valve extends Core { this.logger.debug("GOLDSRC DETECTED - USING MODIFIED SPLIT FORMAT"); this.goldsrcSplits = true; } + + // DayZ embeds some of the server information inside the tags attribute + if (appId === AppId.DayZ) { + if (state.raw.tags) { + state.raw.dlcEnabled = false + state.raw.firstPerson = false + for (const tag of state.raw.tags) { + if (tag.startsWith('lqs')) { + const value = parseInt(tag.replace('lqs', '')); + if (!isNaN(value)) { + state.raw.queue = value; + } + } + if (tag.includes('no3rd')) { + state.raw.firstPerson = true; + } + if (tag.includes('isDLC')) { + state.raw.dlcEnabled = true; + } + if (tag.includes(':')) { + state.raw.time = tag; + } + if (tag.startsWith('etm')) { + const value = parseInt(tag.replace('etm', '')); + if (!isNaN(value)) { + state.raw.dayAcceleration = value; + } + } + if (tag.startsWith('entm')) { + const value = parseInt(tag.replace('entm', '')); + if (!isNaN(value)) { + state.raw.nightAcceleration = value; + } + } + } + } + } + + if (appId === AppId.Rust) { + if (state.raw.tags) { + for (const tag of state.raw.tags) { + if (tag.startsWith('mp')) { + const value = parseInt(tag.replace('mp', '')); + if (!isNaN(value)) { + state.maxplayers = value; + } + } + } + } + } } async queryChallenge() { @@ -262,42 +315,7 @@ class Valve extends Core { } } - // DayZ embeds some of the server information inside the tags attribute if (appId === AppId.DayZ) { - if (state.raw.tags) { - state.raw.dlcEnabled = false - state.raw.firstPerson = false - for (const tag of state.raw.tags) { - if (tag.startsWith('lqs')) { - const value = parseInt(tag.replace('lqs', '')); - if (!isNaN(value)) { - state.raw.queue = value; - } - } - if (tag.includes('no3rd')) { - state.raw.firstPerson = true; - } - if (tag.includes('isDLC')) { - state.raw.dlcEnabled = true; - } - if (tag.includes(':')) { - state.raw.time = tag; - } - if (tag.startsWith('etm')) { - const value = parseInt(tag.replace('etm', '')); - if (!isNaN(value)) { - state.raw.dayAcceleration = value; - } - } - if (tag.startsWith('entm')) { - const value = parseInt(tag.replace('entm', '')); - if (!isNaN(value)) { - state.raw.nightAcceleration = value; - } - } - } - } - state.raw.dayzMods = this.readDayzMods(Buffer.from(dayZPayload)); } }