Fixes for ase, geneshift, minecraftping, and quake 2 arising from cleanup

This commit is contained in:
mmorrison 2017-08-09 05:04:32 -05:00
parent 14aa56714f
commit b015d58a0a
8 changed files with 29 additions and 21 deletions

View file

@ -125,6 +125,7 @@ graw|Ghost Recon: Advanced Warfighter|gamespy2|port_query=15250
graw2|Ghost Recon: Advanced Warfighter 2|gamespy2|port_query=16250
giantscitizenkabuto|Giants: Citizen Kabuto|gamespy1|port_query=8911
globaloperations|Global Operations|gamespy1|port_query=28672
geneshift|Geneshift|geneshift|port=11235
ges|GoldenEye: Source|valve
gore|Gore|gamespy1|port=27777,port_query_offset=1
gunmanchronicles|Gunman Chronicles|valve
@ -171,7 +172,7 @@ mtavc|Multi Theft Auto: Vice City|ase|port=22003,port_query_offset=123
mtasa|Multi Theft Auto: San Andreas|ase|port=22003,port_query_offset=123
mumble|Mumble|mumble|port=64738,port_query=27800|doc_notes=mumble
mumbleping|Mumble|mumbleping|port=64738|doc_notes=mumble
mutantfactions|Mutant Factions|mutantfactions|port=11235
mutantfactions|Mutant Factions|geneshift|port=11235
nascarthunder2004|Nascar Thunder 2004|gamespy2|port_query=13333
netpanzer|netPanzer|gamespy1|3030
nmrih|No More Room in Hell|valve

2
package-lock.json generated
View file

@ -1,6 +1,6 @@
{
"name": "gamedig",
"version": "0.2.29",
"version": "0.2.30",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -23,7 +23,6 @@ class Ase extends require('./core') {
state.raw[key] = value;
}
console.log(reader.rest());
while(!reader.done()) {
const flags = reader.uint(1);
const player = {};

View file

@ -125,15 +125,19 @@ class Core extends EventEmitter {
parseDns(host,c) {
const resolveStandard = (host,c) => {
if(this.debug) console.log("Standard DNS Lookup: " + host);
dns.lookup(host, (err,address,family) => {
if(err) return this.fatal(err);
if(this.debug) console.log(address);
this.options.address = address;
c();
});
};
const resolveSrv = (srv,host,c) => {
if(this.debug) console.log("SRV DNS Lookup: " + srv+'.'+host);
dns.resolve(srv+'.'+host, 'SRV', (err,addresses) => {
if(this.debug) console.log(err, addresses);
if(err) return resolveStandard(host,c);
if(addresses.length >= 1) {
const line = addresses[0];

View file

@ -1,9 +1,9 @@
const request = require('request');
class MutantFactions extends require('./core') {
class GeneShift extends require('./core') {
run(state) {
request({
uri: 'http://mutantfactions.net/game/receiveLobby.php',
uri: 'http://geneshift.net/game/receiveLobby.php',
timeout: 3000,
}, (e,r,body) => {
if(e) return this.fatal('Lobby request error');
@ -14,7 +14,7 @@ class MutantFactions extends require('./core') {
const fields = line.split('::');
const ip = fields[2];
const port = fields[3];
if(ip === this.options.address && port === this.options.port) {
if(ip === this.options.address && parseInt(port) === this.options.port) {
found = fields;
break;
}
@ -26,18 +26,18 @@ class MutantFactions extends require('./core') {
state.raw.country = found[1];
state.name = found[4];
state.map = found[5];
state.raw.numplayers = found[6];
state.maxplayers = found[7];
state.raw.numplayers = parseInt(found[6]);
state.maxplayers = parseInt(found[7]);
// fields[8] is unknown?
state.raw.rules = found[9];
state.raw.gamemode = found[10];
state.raw.gangsters = found[11];
state.raw.cashrate = found[12];
state.raw.missions = found[13];
state.raw.vehicles = found[14];
state.raw.customweapons = found[15];
state.raw.friendlyfire = found[16];
state.raw.mercs = found[17];
state.raw.gamemode = parseInt(found[10]);
state.raw.gangsters = parseInt(found[11]);
state.raw.cashrate = parseInt(found[12]);
state.raw.missions = !!parseInt(found[13]);
state.raw.vehicles = !!parseInt(found[14]);
state.raw.customweapons = !!parseInt(found[15]);
state.raw.friendlyfire = !!parseInt(found[16]);
state.raw.mercs = !!parseInt(found[17]);
// fields[18] is unknown? listen server?
state.raw.version = found[19];
@ -50,4 +50,4 @@ class MutantFactions extends require('./core') {
}
}
module.exports = MutantFactions;
module.exports = GeneShift;

View file

@ -2,7 +2,7 @@ const varint = require('varint'),
async = require('async');
function varIntBuffer(num) {
return Buffer.alloc(varint.encode(num));
return Buffer.from(varint.encode(num));
}
function buildPacket(id,data) {
if(!data) data = Buffer.from([]);

View file

@ -15,7 +15,6 @@ class Quake2 extends require('./core') {
const header = reader.string({length:4});
if(header !== '\xff\xff\xff\xff') return;
this.debugBuffer(buffer);
let response;
if(this.isQuake1) {
response = reader.string({length:this.responseHeader.length});

View file

@ -1 +1,6 @@
bin/gamedig.js --debug --type "$1" --host "$2" --port "$3"
#!/bin/bash
PORTPARAM=""
if [[ "$#" > 2 ]]; then
PORTPARAM=$(printf -- "--port %q" "$3")
fi
bin/gamedig.js --output pretty --debug --type "$1" --host "$2" $PORTPARAM