mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-16 00:38:31 +01:00
ad9adff06c
* Redo imports and exports for lib * Redo imports and exports for bim * Redo imports and exports for games * Remove remaining module.exports * Use export default in lib * Use export default in protocols * Fix import in genreadme.js * Make package module and solve __dirname * Fix minecraft protocol imports * Fix imports on games and make binary runnable * Renamed protocol class exports to lowercase * Export promises class as default * Update README.md to use imports instead of require * Update CHANGELOG to mention the changes. * Remove Valve unused imports * Fix iconv import
24 lines
734 B
JavaScript
24 lines
734 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);
|
|
}
|
|
}
|