mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
Convert tabs to spaces
This commit is contained in:
parent
0dd25bfcda
commit
3674d384d0
39 changed files with 2414 additions and 2414 deletions
|
|
@ -1,48 +1,48 @@
|
|||
class Ase extends require('./core') {
|
||||
run(state) {
|
||||
run(state) {
|
||||
this.udpSend('s',(buffer) => {
|
||||
const reader = this.reader(buffer);
|
||||
const reader = this.reader(buffer);
|
||||
|
||||
const header = reader.string({length:4});
|
||||
if(header !== 'EYE1') return;
|
||||
if(header !== 'EYE1') return;
|
||||
|
||||
state.raw.gamename = this.readString(reader);
|
||||
state.raw.port = parseInt(this.readString(reader));
|
||||
state.name = this.readString(reader);
|
||||
state.raw.gametype = this.readString(reader);
|
||||
state.map = this.readString(reader);
|
||||
state.raw.version = this.readString(reader);
|
||||
state.password = this.readString(reader) === '1';
|
||||
state.raw.numplayers = parseInt(this.readString(reader));
|
||||
state.maxplayers = parseInt(this.readString(reader));
|
||||
state.raw.gamename = this.readString(reader);
|
||||
state.raw.port = parseInt(this.readString(reader));
|
||||
state.name = this.readString(reader);
|
||||
state.raw.gametype = this.readString(reader);
|
||||
state.map = this.readString(reader);
|
||||
state.raw.version = this.readString(reader);
|
||||
state.password = this.readString(reader) === '1';
|
||||
state.raw.numplayers = parseInt(this.readString(reader));
|
||||
state.maxplayers = parseInt(this.readString(reader));
|
||||
|
||||
while(!reader.done()) {
|
||||
const key = this.readString(reader);
|
||||
if(!key) break;
|
||||
while(!reader.done()) {
|
||||
const key = this.readString(reader);
|
||||
if(!key) break;
|
||||
const value = this.readString(reader);
|
||||
state.raw[key] = value;
|
||||
}
|
||||
state.raw[key] = value;
|
||||
}
|
||||
|
||||
while(!reader.done()) {
|
||||
while(!reader.done()) {
|
||||
const flags = reader.uint(1);
|
||||
const player = {};
|
||||
if(flags & 1) player.name = this.readString(reader);
|
||||
if(flags & 2) player.team = this.readString(reader);
|
||||
if(flags & 4) player.skin = this.readString(reader);
|
||||
if(flags & 8) player.score = parseInt(this.readString(reader));
|
||||
if(flags & 16) player.ping = parseInt(this.readString(reader));
|
||||
if(flags & 32) player.time = parseInt(this.readString(reader));
|
||||
state.players.push(player);
|
||||
}
|
||||
|
||||
this.finish(state);
|
||||
});
|
||||
}
|
||||
if(flags & 1) player.name = this.readString(reader);
|
||||
if(flags & 2) player.team = this.readString(reader);
|
||||
if(flags & 4) player.skin = this.readString(reader);
|
||||
if(flags & 8) player.score = parseInt(this.readString(reader));
|
||||
if(flags & 16) player.ping = parseInt(this.readString(reader));
|
||||
if(flags & 32) player.time = parseInt(this.readString(reader));
|
||||
state.players.push(player);
|
||||
}
|
||||
|
||||
readString(reader) {
|
||||
this.finish(state);
|
||||
});
|
||||
}
|
||||
|
||||
readString(reader) {
|
||||
const len = reader.uint(1);
|
||||
return reader.string({length:len-1});
|
||||
}
|
||||
return reader.string({length:len-1});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Ase;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue