mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-18 01:30:39 +01:00
93a9095d99
* Add initial prettier and eslint configs * Modify prettierrc * Run eslint on everything * Actually remove prettier * Fix some eslints * Remove label in gs2 * Update CHANGELOG * Update eslintrc to specify es2021
24 lines
680 B
JavaScript
24 lines
680 B
JavaScript
import Core from './core.js'
|
|
|
|
export default class mumbleping extends Core {
|
|
constructor () {
|
|
super()
|
|
this.byteorder = 'be'
|
|
}
|
|
|
|
async run (state) {
|
|
const data = await this.udpSend('\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08', (buffer) => {
|
|
if (buffer.length >= 24) return buffer
|
|
})
|
|
|
|
const reader = this.reader(data)
|
|
reader.skip(1)
|
|
state.raw.versionMajor = reader.uint(1)
|
|
state.raw.versionMinor = reader.uint(1)
|
|
state.raw.versionPatch = reader.uint(1)
|
|
reader.skip(8)
|
|
state.players.setNum(reader.uint(4))
|
|
state.maxplayers = reader.uint(4)
|
|
state.raw.allowedbandwidth = reader.uint(4)
|
|
}
|
|
}
|