From a283466140166feaaf9d1d5ddbd184232709f9bc Mon Sep 17 00:00:00 2001 From: Pedro Ivo Hudson Date: Sat, 10 Feb 2024 07:48:34 -0300 Subject: [PATCH] fix delete version --- protocols/armagetron.js | 5 +---- protocols/ase.js | 5 +---- protocols/battlefield.js | 5 +---- protocols/farmingsimulator.js | 5 +---- protocols/ffow.js | 5 +---- protocols/geneshift.js | 5 +---- protocols/openttd.js | 5 +---- protocols/rfactor.js | 5 +---- protocols/samp.js | 5 +---- protocols/savage2.js | 5 +---- protocols/starmade.js | 7 +------ protocols/tribes1.js | 5 +---- protocols/valve.js | 5 +---- 13 files changed, 13 insertions(+), 54 deletions(-) diff --git a/protocols/armagetron.js b/protocols/armagetron.js index 781f27b..968aa68 100644 --- a/protocols/armagetron.js +++ b/protocols/armagetron.js @@ -21,12 +21,9 @@ export default class armagetron extends Core { state.numplayers = this.readUInt(reader) state.raw.versionmin = this.readUInt(reader) state.raw.versionmax = this.readUInt(reader) - state.raw.version = this.readString(reader) - state.version = state.raw.version + state.version = this.readString(reader) state.maxplayers = this.readUInt(reader) - delete state.raw.version - const players = this.readString(reader) const list = players.split('\n') for (const name of list) { diff --git a/protocols/ase.js b/protocols/ase.js index d2993dd..b5977a2 100644 --- a/protocols/ase.js +++ b/protocols/ase.js @@ -14,14 +14,11 @@ export default class ase extends Core { state.name = this.readString(reader) state.raw.gametype = this.readString(reader) state.map = this.readString(reader) - state.raw.version = this.readString(reader) - state.version = state.raw.version + state.version = this.readString(reader) state.password = this.readString(reader) === '1' state.numplayers = parseInt(this.readString(reader)) state.maxplayers = parseInt(this.readString(reader)) - delete state.raw.version - while (!reader.done()) { const key = this.readString(reader) if (!key) break diff --git a/protocols/battlefield.js b/protocols/battlefield.js index 056ffaf..d6b6568 100644 --- a/protocols/battlefield.js +++ b/protocols/battlefield.js @@ -66,10 +66,7 @@ export default class battlefield extends Core { { const data = await this.query(socket, ['version']) data.shift() - state.raw.version = data.shift() - state.version = state.raw.version - - delete state.raw.version + state.version = data.shift() } { diff --git a/protocols/farmingsimulator.js b/protocols/farmingsimulator.js index e0baf75..7adbad4 100644 --- a/protocols/farmingsimulator.js +++ b/protocols/farmingsimulator.js @@ -48,10 +48,7 @@ export default class farmingsimulator extends Core { } }) - state.raw.version = serverInfo.attr('version') - state.version = state.raw.version - - delete state.raw.version + state.version = serverInfo.attr('version') // TODO: Add state.raw } diff --git a/protocols/ffow.js b/protocols/ffow.js index d1012a8..ff6e81e 100644 --- a/protocols/ffow.js +++ b/protocols/ffow.js @@ -22,8 +22,7 @@ export default class ffow extends valve { state.raw.mod = reader.string() state.raw.gamemode = reader.string() state.raw.description = reader.string() - state.raw.version = reader.string() - state.version = state.raw.version + state.version = reader.string() state.gamePort = reader.uint(2) state.numplayers = reader.uint(1) state.maxplayers = reader.uint(1) @@ -35,7 +34,5 @@ export default class ffow extends valve { state.raw.round = reader.uint(1) state.raw.maxrounds = reader.uint(1) state.raw.timeleft = reader.uint(2) - - delete state.raw.version } } diff --git a/protocols/geneshift.js b/protocols/geneshift.js index e4d57bf..f71a4c5 100644 --- a/protocols/geneshift.js +++ b/protocols/geneshift.js @@ -41,9 +41,6 @@ export default class geneshift extends Core { state.raw.friendlyfire = !!parseInt(found[16]) state.raw.mercs = !!parseInt(found[17]) // fields[18] is unknown? listen server? - state.raw.version = found[19] - state.version = state.raw.version - - delete state.raw.version + state.version = found[19] } } diff --git a/protocols/openttd.js b/protocols/openttd.js index e2d860b..61c91ab 100644 --- a/protocols/openttd.js +++ b/protocols/openttd.js @@ -25,10 +25,7 @@ export default class openttd extends Core { } state.name = reader.string() - state.raw.version = reader.string() - state.version = state.raw.version - - delete state.raw.version + state.version = reader.string() state.raw.language = this.decode( reader.uint(1), diff --git a/protocols/rfactor.js b/protocols/rfactor.js index 89e0ea2..1089abf 100644 --- a/protocols/rfactor.js +++ b/protocols/rfactor.js @@ -10,8 +10,7 @@ export default class rfactor extends Core { state.raw.region = reader.uint(2) state.raw.ip = reader.part(4) state.raw.size = reader.uint(2) - state.raw.version = reader.uint(2) - state.version = state.raw.version + state.version = reader.uint(2) state.raw.versionRaceCast = reader.uint(2) state.gamePort = reader.uint(2) state.raw.queryPort = reader.uint(2) @@ -37,8 +36,6 @@ export default class rfactor extends Core { reader.skip(3) state.raw.vehicles = reader.string() - delete state.raw.version - state.password = !!(state.raw.packedSpecial & 2) state.raw.raceCast = !!(state.raw.packedSpecial & 4) state.raw.fixedSetups = !!(state.raw.packedSpecial & 16) diff --git a/protocols/samp.js b/protocols/samp.js index fbac09a..12fdea1 100644 --- a/protocols/samp.js +++ b/protocols/samp.js @@ -15,10 +15,7 @@ export default class samp extends Core { const reader = await this.sendPacket('i') if (this.isVcmp) { const consumed = reader.part(12) - state.raw.version = this.reader(consumed).string() - state.version = state.raw.version - - delete state.raw.version + state.version = this.reader(consumed).string() } state.password = !!reader.uint(1) state.numplayers = reader.uint(2) diff --git a/protocols/savage2.js b/protocols/savage2.js index 4c0c77e..411423e 100644 --- a/protocols/savage2.js +++ b/protocols/savage2.js @@ -15,11 +15,8 @@ export default class savage2 extends Core { state.raw.location = reader.string() state.raw.minplayers = reader.uint(1) state.raw.gametype = reader.string() - state.raw.version = reader.string() - state.version = state.raw.version + state.version = reader.string() state.raw.minlevel = reader.uint(1) - - delete state.raw.version } stripColorCodes (str) { diff --git a/protocols/starmade.js b/protocols/starmade.js index fec73c9..64b1cdb 100644 --- a/protocols/starmade.js +++ b/protocols/starmade.js @@ -57,12 +57,7 @@ export default class starmade extends Core { this.logger.debug('Received raw data array', data) if (typeof data[0] === 'number') state.raw.infoVersion = data[0] - if (typeof data[1] === 'number') { - state.raw.version = data[1] - state.version = state.raw.version - - delete state.raw.version - } + if (typeof data[1] === 'number') state.version = data[1] if (typeof data[2] === 'string') state.name = data[2] if (typeof data[3] === 'string') state.raw.description = data[3] if (typeof data[4] === 'number') state.raw.startTime = data[4] diff --git a/protocols/tribes1.js b/protocols/tribes1.js index 46cd3e7..050e2b3 100644 --- a/protocols/tribes1.js +++ b/protocols/tribes1.js @@ -35,12 +35,9 @@ export default class tribes1 extends Core { state.raw.gametype = this.readString(reader) const isStarsiege2009 = state.raw.gametype === 'Starsiege' - state.raw.version = this.readString(reader) - state.version = state.raw.version + state.version = this.readString(reader) state.name = this.readString(reader) - delete state.raw.version - if (isStarsiege2009) { state.password = !!reader.uint(1) state.raw.dedicated = !!reader.uint(1) diff --git a/protocols/valve.js b/protocols/valve.js index 1d68b27..8c1c5a8 100644 --- a/protocols/valve.js +++ b/protocols/valve.js @@ -94,10 +94,7 @@ export default class valve extends Core { state.raw.shipwitnesses = reader.uint(1) state.raw.shipduration = reader.uint(1) } - state.raw.version = reader.string() - state.version = state.raw.version - - delete state.raw.version + state.version = reader.string() const extraFlag = reader.uint(1) if (extraFlag & 0x80) state.gamePort = reader.uint(2)