mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
4.0.1 Fix maxplayers >255 in rust
This commit is contained in:
parent
7837351f9f
commit
343e23c4ad
3 changed files with 59 additions and 37 deletions
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue