mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
More async conversion
This commit is contained in:
parent
484e99b29c
commit
efe12a00aa
25 changed files with 774 additions and 858 deletions
|
|
@ -10,35 +10,32 @@ class Armagetron extends Core {
|
|||
async run(state) {
|
||||
const b = Buffer.from([0,0x35,0,0,0,0,0,0x11]);
|
||||
|
||||
await this.udpSend(b,(buffer) => {
|
||||
const reader = this.reader(buffer);
|
||||
const buffer = await this.udpSend(b,b => b);
|
||||
const reader = this.reader(buffer);
|
||||
|
||||
reader.skip(6);
|
||||
reader.skip(6);
|
||||
|
||||
state.raw.port = this.readUInt(reader);
|
||||
state.raw.hostname = this.readString(reader);
|
||||
state.name = this.stripColorCodes(this.readString(reader));
|
||||
state.raw.numplayers = this.readUInt(reader);
|
||||
state.raw.versionmin = this.readUInt(reader);
|
||||
state.raw.versionmax = this.readUInt(reader);
|
||||
state.raw.version = this.readString(reader);
|
||||
state.maxplayers = this.readUInt(reader);
|
||||
state.raw.port = this.readUInt(reader);
|
||||
state.raw.hostname = this.readString(reader);
|
||||
state.name = this.stripColorCodes(this.readString(reader));
|
||||
state.raw.numplayers = this.readUInt(reader);
|
||||
state.raw.versionmin = this.readUInt(reader);
|
||||
state.raw.versionmax = this.readUInt(reader);
|
||||
state.raw.version = this.readString(reader);
|
||||
state.maxplayers = this.readUInt(reader);
|
||||
|
||||
const players = this.readString(reader);
|
||||
const list = players.split('\n');
|
||||
for(const name of list) {
|
||||
if(!name) continue;
|
||||
state.players.push({
|
||||
name: this.stripColorCodes(name)
|
||||
});
|
||||
}
|
||||
const players = this.readString(reader);
|
||||
const list = players.split('\n');
|
||||
for(const name of list) {
|
||||
if(!name) continue;
|
||||
state.players.push({
|
||||
name: this.stripColorCodes(name)
|
||||
});
|
||||
}
|
||||
|
||||
state.raw.options = this.stripColorCodes(this.readString(reader));
|
||||
state.raw.uri = this.readString(reader);
|
||||
state.raw.globalids = this.readString(reader);
|
||||
this.finish(state);
|
||||
return null;
|
||||
});
|
||||
state.raw.options = this.stripColorCodes(this.readString(reader));
|
||||
state.raw.uri = this.readString(reader);
|
||||
state.raw.globalids = this.readString(reader);
|
||||
}
|
||||
|
||||
readUInt(reader) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue