mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-18 09:35:50 +00:00
Super epic commit 2
Added pretty much every game ever Tons of new protocols and game definitions Cleaned up and discovered some new tricks in gamespy3 and quake2
This commit is contained in:
parent
b51877ef5c
commit
e23aa6cf9c
21 changed files with 854 additions and 222 deletions
|
|
@ -7,6 +7,7 @@ module.exports = require('./core').extend({
|
|||
this.encoding = 'latin1';
|
||||
this.byteorder = 'be';
|
||||
this.noChallenge = false;
|
||||
this.useOnlySingleSplit = false;
|
||||
},
|
||||
run: function(state) {
|
||||
var self = this;
|
||||
|
|
@ -17,7 +18,6 @@ module.exports = require('./core').extend({
|
|||
if(self.noChallenge) return c();
|
||||
self.sendPacket(9,false,false,false,function(buffer) {
|
||||
var reader = self.reader(buffer);
|
||||
reader.skip(5);
|
||||
challenge = parseInt(reader.string());
|
||||
c();
|
||||
});
|
||||
|
|
@ -125,16 +125,25 @@ module.exports = require('./core').extend({
|
|||
if(iSessionId != self.sessionId) return;
|
||||
|
||||
if(!assemble) {
|
||||
c(buffer);
|
||||
c(buffer.slice(5));
|
||||
return true;
|
||||
}
|
||||
if(self.useOnlySingleSplit) {
|
||||
// has split headers, but they are worthless and only one packet is used
|
||||
c([buffer.slice(16)]);
|
||||
return true;
|
||||
}
|
||||
|
||||
var id = buffer.readUInt16LE(14);
|
||||
var last = (id & 0x80);
|
||||
id = id & 0x7f;
|
||||
if(last || self._singlePacketSplits) numPackets = id+1;
|
||||
if(last) numPackets = id+1;
|
||||
|
||||
packets[id] = buffer.slice(16);
|
||||
if(self.debug) {
|
||||
console.log("Received packet #"+id);
|
||||
if(last) console.log("(last)");
|
||||
}
|
||||
|
||||
if(!numPackets || Object.keys(packets).length != numPackets) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue