Skip to content

Commit

Permalink
Parse additional dayz tags: first person, dlc enabled and time
Browse files Browse the repository at this point in the history
  • Loading branch information
podrivo committed Jul 21, 2021
1 parent a8b7cad commit f3d97b6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions protocols/valve.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,27 @@ class Valve extends Core {
}
}

// DayZ embeds some of the server information inside the tags attribute
if (appId === AppId.DayZ) {
state.raw.dayzMods = this.readDayzMods(Buffer.from(dayZPayload));

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)) {
Expand All @@ -286,6 +296,8 @@ class Valve extends Core {
}
}
}

state.raw.dayzMods = this.readDayzMods(Buffer.from(dayZPayload));
}
}

Expand Down

0 comments on commit f3d97b6

Please sign in to comment.