Merge pull request #31 from Netifriik/master

added Killing Floor 2, 7 Days to Die, Battlefield Hardline and Unturned support
This commit is contained in:
Michael Morrison 2015-08-08 19:22:20 -05:00
commit 957c0e20ea
4 changed files with 21 additions and 10 deletions

View file

@ -73,10 +73,12 @@ Games List
###Supported ###Supported
<!--- BEGIN GENERATED GAMES --> <!--- BEGIN GENERATED GAMES -->
* 7 Days to Die (7d2d)
* Age of Chivalry (ageofchivalry) * Age of Chivalry (ageofchivalry)
* Age of Empires 2 (aoe2) [[Separate Query Port](#separate-query-port)] * Age of Empires 2 (aoe2) [[Separate Query Port](#separate-query-port)]
* Alien Arena (alienarena) [[Separate Query Port](#separate-query-port)] * Alien Arena (alienarena) [[Separate Query Port](#separate-query-port)]
* Alien Swarm (alienswarm) * Alien Swarm (alienswarm)
* ARK: Survival Evolved (arkse) [[Separate Query Port](#separate-query-port)]
* Aliens vs Predator 2 (avp2) * Aliens vs Predator 2 (avp2)
* Aliens vs Predator 2010 (avp2010) * Aliens vs Predator 2010 (avp2010)
* America's Army (americasarmy) [[Separate Query Port](#separate-query-port)] * America's Army (americasarmy) [[Separate Query Port](#separate-query-port)]
@ -95,6 +97,7 @@ Games List
* Battlefield: Bad Company 2 (bfbc2) [[Separate Query Port](#separate-query-port)] * Battlefield: Bad Company 2 (bfbc2) [[Separate Query Port](#separate-query-port)]
* Battlefield 3 (bf3) [[Separate Query Port](#separate-query-port)] * Battlefield 3 (bf3) [[Separate Query Port](#separate-query-port)]
* Battlefield 4 (bf4) [[Separate Query Port](#separate-query-port)] * Battlefield 4 (bf4) [[Separate Query Port](#separate-query-port)]
* Battlefield Hardline (bfh) [[Separate Query Port](#separate-query-port)]
* Breach (breach) * Breach (breach)
* Breed (breed) * Breed (breed)
* Brink (brink) [[Separate Query Port](#separate-query-port)] * Brink (brink) [[Separate Query Port](#separate-query-port)]
@ -172,6 +175,7 @@ Games List
* James Bond: Nightfire (jamesbondnightfire) [[Separate Query Port](#separate-query-port)] * James Bond: Nightfire (jamesbondnightfire) [[Separate Query Port](#separate-query-port)]
* Just Cause 2 Multiplayer (jc2mp) * Just Cause 2 Multiplayer (jc2mp)
* Killing Floor (killingfloor) [[Separate Query Port](#separate-query-port)] * Killing Floor (killingfloor) [[Separate Query Port](#separate-query-port)]
* Killing Floor 2 (killingfloor2) [[Separate Query Port](#separate-query-port)]
* Kingpin: Life of Crime (kingpin) [[Separate Query Port](#separate-query-port)] * Kingpin: Life of Crime (kingpin) [[Separate Query Port](#separate-query-port)]
* KISS Psycho Circus (kisspc) [[Separate Query Port](#separate-query-port)] * KISS Psycho Circus (kisspc) [[Separate Query Port](#separate-query-port)]
* KzMod (kzmod) * KzMod (kzmod)
@ -278,6 +282,7 @@ Games List
* Turok 2 (turok2) [[Separate Query Port](#separate-query-port)] * Turok 2 (turok2) [[Separate Query Port](#separate-query-port)]
* Universal Combat (universalcombat) [[Separate Query Port](#separate-query-port)] * Universal Combat (universalcombat) [[Separate Query Port](#separate-query-port)]
* Unreal (unreal) [[Separate Query Port](#separate-query-port)] * Unreal (unreal) [[Separate Query Port](#separate-query-port)]
* unturned (unturned) [[Separate Query Port](#separate-query-port)]
* Unreal Tournament (ut) [[Separate Query Port](#separate-query-port)] * Unreal Tournament (ut) [[Separate Query Port](#separate-query-port)]
* Unreal Tournament 2003 (ut2003) [[Separate Query Port](#separate-query-port)] * Unreal Tournament 2003 (ut2003) [[Separate Query Port](#separate-query-port)]
* Unreal Tournament 2004 (ut2004) [[Separate Query Port](#separate-query-port)] * Unreal Tournament 2004 (ut2004) [[Separate Query Port](#separate-query-port)]

View file

@ -28,11 +28,12 @@
# worldinconflict|World in Conflict|worldinconflict # worldinconflict|World in Conflict|worldinconflict
7d2d|7 Days to Die|valve|port_quer_offset=1
ageofchivalry|Age of Chivalry|valve ageofchivalry|Age of Chivalry|valve
aoe2|Age of Empires 2|ase|port_query=27224 aoe2|Age of Empires 2|ase|port_query=27224
alienarena|Alien Arena|quake2|port_query=27910 alienarena|Alien Arena|quake2|port_query=27910
alienswarm|Alien Swarm|valve alienswarm|Alien Swarm|valve
arkse|ARK: Survival Evolved|valve|port=7777,port_query=27015
avp2|Aliens vs Predator 2|gamespy1|port=27888 avp2|Aliens vs Predator 2|gamespy1|port=27888
# avp2010 doesn't really... have a default port or query port # avp2010 doesn't really... have a default port or query port
# both port and port_query should be specified when used # both port and port_query should be specified when used
@ -57,6 +58,7 @@ bf2142|Battlefield 2142|gamespy3|port=16567,port_query=29900
bfbc2|Battlefield: Bad Company 2|battlefield|port=19567,port_query=48888|isBadCompany2 bfbc2|Battlefield: Bad Company 2|battlefield|port=19567,port_query=48888|isBadCompany2
bf3|Battlefield 3|battlefield|port=25200,port_query_offset=22000 bf3|Battlefield 3|battlefield|port=25200,port_query_offset=22000
bf4|Battlefield 4|battlefield|port=25200,port_query_offset=22000 bf4|Battlefield 4|battlefield|port=25200,port_query_offset=22000
bfh|Battlefield Hardline|battlefield|port=25200,port_query_offset=22000
breach|Breach|valve|port=27016 breach|Breach|valve|port=27016
breed|Breed|gamespy2|port=7649 breed|Breed|gamespy2|port=7649
@ -141,6 +143,7 @@ ironstorm|Iron Storm|gamespy1|port_query=3505
jamesbondnightfire|James Bond: Nightfire|gamespy1|port_query=6550 jamesbondnightfire|James Bond: Nightfire|gamespy1|port_query=6550
jc2mp|Just Cause 2 Multiplayer|jc2mp|port=7777|isJc2mp jc2mp|Just Cause 2 Multiplayer|jc2mp|port=7777|isJc2mp
killingfloor|Killing Floor|killingfloor|port=7707,port_query_offset=1 killingfloor|Killing Floor|killingfloor|port=7707,port_query_offset=1
killingfloor2|Killing Floor 2|valve|port=7777,port_query=27015
kingpin|Kingpin: Life of Crime|gamespy1|port=31510,port_query_offset=-10 kingpin|Kingpin: Life of Crime|gamespy1|port=31510,port_query_offset=-10
kisspc|KISS Psycho Circus|gamespy1|port=7777,port_query_offset=1 kisspc|KISS Psycho Circus|gamespy1|port=7777,port_query_offset=1
kzmod|KzMod|valve kzmod|KzMod|valve
@ -257,6 +260,7 @@ turok2|Turok 2|gamespy1|port_query=12880
universalcombat|Universal Combat|ase|port=1135,port_query_offset=123 universalcombat|Universal Combat|ase|port=1135,port_query_offset=123
unreal|Unreal|gamespy1|port=7777,port_query_offset=1 unreal|Unreal|gamespy1|port=7777,port_query_offset=1
unturned|unturned|valve|port=27015,port_query=27016
ut|Unreal Tournament|gamespy1|port=7777,port_query_offset=1 ut|Unreal Tournament|gamespy1|port=7777,port_query_offset=1
ut2003|Unreal Tournament 2003|unreal2|port=7757,port_query_offset=1 ut2003|Unreal Tournament 2003|unreal2|port=7757,port_query_offset=1
ut2004|Unreal Tournament 2004|ut2004|port=7777,port_query_offset=1 ut2004|Unreal Tournament 2004|ut2004|port=7777,port_query_offset=1

View file

@ -39,7 +39,7 @@ module.exports = Class.extend(EventEmitter,{
name: '', name: '',
map: '', map: '',
password: false, password: false,
raw: {}, raw: {},
maxplayers: 0, maxplayers: 0,
@ -82,7 +82,7 @@ module.exports = Class.extend(EventEmitter,{
}); });
} }
this.timers = []; this.timers = [];
if(this.tcpSocket) { if(this.tcpSocket) {
this.tcpSocket.destroy(); this.tcpSocket.destroy();
delete this.tcpSocket; delete this.tcpSocket;
@ -124,7 +124,7 @@ module.exports = Class.extend(EventEmitter,{
}, },
parseDns: function(host,c) { parseDns: function(host,c) {
var self = this; var self = this;
function resolveStandard(host,c) { function resolveStandard(host,c) {
dns.lookup(host, function(err,address,family) { dns.lookup(host, function(err,address,family) {
if(err) return self.fatal(err); if(err) return self.fatal(err);
@ -139,7 +139,7 @@ module.exports = Class.extend(EventEmitter,{
var line = addresses[0]; var line = addresses[0];
self.options.port = line.port; self.options.port = line.port;
var srvhost = line.name; var srvhost = line.name;
if(srvhost.match(/\d+\.\d+\.\d+\.\d+/)) { if(srvhost.match(/\d+\.\d+\.\d+\.\d+/)) {
self.options.address = srvhost; self.options.address = srvhost;
c(); c();
@ -177,8 +177,8 @@ module.exports = Class.extend(EventEmitter,{
return id; return id;
}, },
trueTest: function(str) { trueTest: function(str) {
if(typeof str == 'boolean') return str; if(typeof str == 'boolean') return str;
if(typeof str == 'number') return str != 0; if(typeof str == 'number') return str != 0;
@ -228,7 +228,7 @@ module.exports = Class.extend(EventEmitter,{
socket.setTimeout(10000); socket.setTimeout(10000);
socket.setNoDelay(true); socket.setNoDelay(true);
if(this.debug) console.log(address+':'+port+" TCPCONNECT"); if(this.debug) console.log(address+':'+port+" TCPCONNECT");
var writeHook = socket.write; var writeHook = socket.write;
socket.write = function(data) { socket.write = function(data) {
if(self.debug) console.log(address+':'+port+" TCP--> "+data.toString('hex')); if(self.debug) console.log(address+':'+port+" TCP--> "+data.toString('hex'));
@ -292,7 +292,7 @@ module.exports = Class.extend(EventEmitter,{
if(!('address' in this.options)) return this.fatal('Attempted to send without setting an address'); if(!('address' in this.options)) return this.fatal('Attempted to send without setting an address');
if(typeof buffer == 'string') buffer = new Buffer(buffer,'binary'); if(typeof buffer == 'string') buffer = new Buffer(buffer,'binary');
if(this.debug) console.log(this.options.address+':'+this.options.port_query+" UDP--> "+buffer.toString('hex')); if(this.debug) console.log(this.options.address+':'+this.options.port_query+" UDP--> "+buffer.toString('hex'));
this.udpSocket.send(buffer,0,buffer.length,this.options.port_query,this.options.address); this.udpSocket.send(buffer,0,buffer.length,this.options.port_query,this.options.address);
}, },

View file

@ -12,7 +12,7 @@ module.exports = require('./core').extend({
this.udpSend('\xff\xff\xff\xff'+this.sendHeader+'\x00',function(buffer) { this.udpSend('\xff\xff\xff\xff'+this.sendHeader+'\x00',function(buffer) {
var reader = self.reader(buffer); var reader = self.reader(buffer);
var header = reader.string({length:4}); var header = reader.string({length:4});
if(header != '\xff\xff\xff\xff') return; if(header != '\xff\xff\xff\xff') return;
@ -76,7 +76,9 @@ module.exports = require('./core').extend({
if('g_needpass' in state.raw) state.password = state.raw.g_needpass; if('g_needpass' in state.raw) state.password = state.raw.g_needpass;
if('mapname' in state.raw) state.map = state.raw.mapname; if('mapname' in state.raw) state.map = state.raw.mapname;
if('sv_maxclients' in state.raw) state.maxplayers = state.raw.sv_maxclients; if('sv_maxclients' in state.raw) state.maxplayers = state.raw.sv_maxclients;
if('maxclients' in state.raw) state.maxplayers = state.raw.maxclients;
if('sv_hostname' in state.raw) state.name = state.raw.sv_hostname; if('sv_hostname' in state.raw) state.name = state.raw.sv_hostname;
if('hostname' in state.raw) state.name = state.raw.hostname;
self.finish(state); self.finish(state);
return true; return true;