mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-10-07 01:13:52 +02: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
30 lines
853 B
JavaScript
30 lines
853 B
JavaScript
import Core from './core.js';
|
|
|
|
export default class savage2 extends Core {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
async run(state) {
|
|
const buffer = await this.udpSend('\x01',b => b);
|
|
const reader = this.reader(buffer);
|
|
|
|
reader.skip(12);
|
|
state.name = this.stripColorCodes(reader.string());
|
|
state.players.setNum(reader.uint(1));
|
|
state.maxplayers = reader.uint(1);
|
|
state.raw.time = reader.string();
|
|
state.map = reader.string();
|
|
state.raw.nextmap = reader.string();
|
|
state.raw.location = reader.string();
|
|
state.raw.minplayers = reader.uint(1);
|
|
state.raw.gametype = reader.string();
|
|
state.raw.version = reader.string();
|
|
state.raw.minlevel = reader.uint(1);
|
|
}
|
|
|
|
stripColorCodes(str) {
|
|
return str.replace(/\^./g,'');
|
|
}
|
|
}
|