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
<!--- BEGIN GENERATED GAMES -->
* 7 Days to Die (7d2d)
* Age of Chivalry (ageofchivalry)
* Age of Empires 2 (aoe2) [[Separate Query Port](#separate-query-port)]
* Alien Arena (alienarena) [[Separate Query Port](#separate-query-port)]
* Alien Swarm (alienswarm)
* ARK: Survival Evolved (arkse) [[Separate Query Port](#separate-query-port)]
* Aliens vs Predator 2 (avp2)
* Aliens vs Predator 2010 (avp2010)
* 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 3 (bf3) [[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)
* Breed (breed)
* Brink (brink) [[Separate Query Port](#separate-query-port)]
@ -172,6 +175,7 @@ Games List
* James Bond: Nightfire (jamesbondnightfire) [[Separate Query Port](#separate-query-port)]
* Just Cause 2 Multiplayer (jc2mp)
* 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)]
* KISS Psycho Circus (kisspc) [[Separate Query Port](#separate-query-port)]
* KzMod (kzmod)
@ -278,6 +282,7 @@ Games List
* Turok 2 (turok2) [[Separate Query Port](#separate-query-port)]
* Universal Combat (universalcombat) [[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 2003 (ut2003) [[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
7d2d|7 Days to Die|valve|port_quer_offset=1
ageofchivalry|Age of Chivalry|valve
aoe2|Age of Empires 2|ase|port_query=27224
alienarena|Alien Arena|quake2|port_query=27910
alienswarm|Alien Swarm|valve
arkse|ARK: Survival Evolved|valve|port=7777,port_query=27015
avp2|Aliens vs Predator 2|gamespy1|port=27888
# avp2010 doesn't really... have a default port or query port
# 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
bf3|Battlefield 3|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
breed|Breed|gamespy2|port=7649
@ -141,6 +143,7 @@ ironstorm|Iron Storm|gamespy1|port_query=3505
jamesbondnightfire|James Bond: Nightfire|gamespy1|port_query=6550
jc2mp|Just Cause 2 Multiplayer|jc2mp|port=7777|isJc2mp
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
kisspc|KISS Psycho Circus|gamespy1|port=7777,port_query_offset=1
kzmod|KzMod|valve
@ -257,6 +260,7 @@ turok2|Turok 2|gamespy1|port_query=12880
universalcombat|Universal Combat|ase|port=1135,port_query_offset=123
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
ut2003|Unreal Tournament 2003|unreal2|port=7757,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: '',
map: '',
password: false,
raw: {},
maxplayers: 0,
@ -82,7 +82,7 @@ module.exports = Class.extend(EventEmitter,{
});
}
this.timers = [];
if(this.tcpSocket) {
this.tcpSocket.destroy();
delete this.tcpSocket;
@ -124,7 +124,7 @@ module.exports = Class.extend(EventEmitter,{
},
parseDns: function(host,c) {
var self = this;
function resolveStandard(host,c) {
dns.lookup(host, function(err,address,family) {
if(err) return self.fatal(err);
@ -139,7 +139,7 @@ module.exports = Class.extend(EventEmitter,{
var line = addresses[0];
self.options.port = line.port;
var srvhost = line.name;
if(srvhost.match(/\d+\.\d+\.\d+\.\d+/)) {
self.options.address = srvhost;
c();
@ -177,8 +177,8 @@ module.exports = Class.extend(EventEmitter,{
return id;
},
trueTest: function(str) {
if(typeof str == 'boolean') return str;
if(typeof str == 'number') return str != 0;
@ -228,7 +228,7 @@ module.exports = Class.extend(EventEmitter,{
socket.setTimeout(10000);
socket.setNoDelay(true);
if(this.debug) console.log(address+':'+port+" TCPCONNECT");
var writeHook = socket.write;
socket.write = function(data) {
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(typeof buffer == 'string') buffer = new Buffer(buffer,'binary');
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);
},

View File

@ -12,7 +12,7 @@ module.exports = require('./core').extend({
this.udpSend('\xff\xff\xff\xff'+this.sendHeader+'\x00',function(buffer) {
var reader = self.reader(buffer);
var header = reader.string({length:4});
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('mapname' in state.raw) state.map = state.raw.mapname;
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('hostname' in state.raw) state.name = state.raw.hostname;
self.finish(state);
return true;