mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-16 00:38:31 +01:00
More async
This commit is contained in:
parent
29ce0b82d0
commit
e937c725bb
20 changed files with 100 additions and 86 deletions
|
@ -424,7 +424,7 @@ additional option: token
|
|||
Games with this note use a query port which is usually not the same as the game's connection port.
|
||||
Usually, no action will be required from you. The 'port' option you pass GameDig should be the game's
|
||||
connection port. GameDig will attempt to calculate the query port automatically. If the query still fails,
|
||||
you may need to pass the 'port_query' option to GameDig as well, indicating the separate query port.
|
||||
you may need to find your server's query port, and pass that to GameDig instead.
|
||||
|
||||
Usage from Command Line
|
||||
---
|
||||
|
|
93
games.txt
93
games.txt
|
@ -15,7 +15,6 @@
|
|||
# gr|Ghost Recon|ghostrecon|port=2346,port_query_offset=2
|
||||
# gtr2|GTR2|gtr2|port=34297,port_query_offset=1
|
||||
# haze|Haze|haze
|
||||
# openttd|OpenTTD|openttd|port=3979
|
||||
# plainsight|Plain Sight|plainsight
|
||||
# redfaction|Red Faction|redfaction|port_query=7755
|
||||
# savage|Savage|savage|port_query=11235
|
||||
|
@ -28,15 +27,15 @@
|
|||
|
||||
|
||||
7d2d|7 Days to Die|valve|port=26900,port_query_offset=1
|
||||
ageofchivalry|Age of Chivalry|valve
|
||||
ageofchivalry|Age of Chivalry|valve|port=27015
|
||||
aoe2|Age of Empires 2|ase|port_query=27224
|
||||
alienarena|Alien Arena|quake2|port_query=27910
|
||||
alienswarm|Alien Swarm|valve
|
||||
alienswarm|Alien Swarm|valve|port=27015
|
||||
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
|
||||
avp2010|Aliens vs Predator 2010|valve
|
||||
avp2010|Aliens vs Predator 2010|valve|port=27015
|
||||
|
||||
americasarmy|America's Army|gamespy2|port=1716,port_query_offset=1
|
||||
americasarmy2|America's Army 2|gamespy2|port=1716,port_query_offset=1
|
||||
|
@ -83,10 +82,10 @@ cacrenegade|Command and Conquer: Renegade|gamespy1|port=4848,port_query=25300
|
|||
conanexiles|Conan Exiles|valve|port=7777,port_query=27015
|
||||
contactjack|Contact J.A.C.K.|gamespy1|port_query=27888
|
||||
|
||||
cs16|Counter-Strike 1.6|valve
|
||||
cscz|Counter-Strike: Condition Zero|valve
|
||||
css|Counter-Strike: Source|valve
|
||||
csgo|Counter-Strike: Global Offensive|valve||doc_notes=csgo
|
||||
cs16|Counter-Strike 1.6|valve|port=27015
|
||||
cscz|Counter-Strike: Condition Zero|valve|port=27015
|
||||
css|Counter-Strike: Source|valve|port=27015
|
||||
csgo|Counter-Strike: Global Offensive|valve||port=27015|doc_notes=csgo
|
||||
|
||||
crossracing|Cross Racing Championship|ase|port=12321,port_query_offset=123
|
||||
|
||||
|
@ -95,7 +94,7 @@ crysiswars|Crysis Wars|gamespy3|port=64100
|
|||
crysis2|Crysis 2|gamespy3|port=64000
|
||||
|
||||
daikatana|Daikatana|quake2|port=27982,port_query_offset=10
|
||||
dmomam|Dark Messiah of Might and Magic|valve
|
||||
dmomam|Dark Messiah of Might and Magic|valve|port=27015
|
||||
darkesthour|Darkest Hour|unreal2|port=7757,port_query_offset=1
|
||||
dayz|DayZ|valve|port=2302,port_query_offset=24714|doc_notes=dayz
|
||||
dayzmod|DayZ Mod|valve|port=2302,port_query_offset=1
|
||||
|
@ -104,14 +103,14 @@ dh2005|Deer Hunter 2005|gamespy2|port=23459,port_query=34567
|
|||
descent3|Descent 3|gamespy1|port=2092,port_query=20142
|
||||
deusex|Deus Ex|gamespy2|port=7791,port_query_offset=1
|
||||
devastation|Devastation|unreal2|port=7777,port_query_offset=1
|
||||
dinodday|Dino D-Day|valve
|
||||
dinodday|Dino D-Day|valve|port=27015
|
||||
dirttrackracing2|Dirt Track Racing 2|gamespy1|port=32240,port_query_offset=-100
|
||||
dnl|Dark and Light|valve|port=7777,port_query=27015
|
||||
dod|Day of Defeat|valve
|
||||
dods|Day of Defeat: Source|valve
|
||||
doi|Day of Infamy|valve
|
||||
dod|Day of Defeat|valve|port=27015
|
||||
dods|Day of Defeat: Source|valve|port=27015
|
||||
doi|Day of Infamy|valve|port=27015
|
||||
doom3|Doom 3|doom3|port=27666
|
||||
dota2|DOTA 2|valve
|
||||
dota2|DOTA 2|valve|port=27015
|
||||
drakan|Drakan|gamespy1|port=27045,port_query_offset=1
|
||||
etqw|Enemy Territory Quake Wars|doom3|port=3074,port_query=27733
|
||||
fear|F.E.A.R.|gamespy2|port_query=27888
|
||||
|
@ -119,33 +118,33 @@ f12002|F1 2002|gamespy1|port_query=3297
|
|||
f1c9902|F1 Challenge 99-02|gamespy1|port_query=34397
|
||||
farcry|Far Cry|ase|port=49001,port_query_offset=123
|
||||
farcry2|Far Cry|ase|port_query=14001
|
||||
fortressforever|Fortress Forever|valve
|
||||
fortressforever|Fortress Forever|valve|port=27015
|
||||
flashpoint|Flashpoint|gamespy1|port=2302,port_query_offset=1
|
||||
ffow|Frontlines: Fuel of War|ffow|port=5476,port_query_offset=2
|
||||
fivem|FiveM|fivem|port=30120
|
||||
garrysmod|Garry's Mod|valve
|
||||
garrysmod|Garry's Mod|valve|port=27015
|
||||
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
|
||||
ges|GoldenEye: Source|valve|port=27015
|
||||
gore|Gore|gamespy1|port=27777,port_query_offset=1
|
||||
gunmanchronicles|Gunman Chronicles|valve
|
||||
hldm|Half-Life 1 Deathmatch|valve
|
||||
hl2dm|Half-Life 2 Deathmatch|valve
|
||||
gunmanchronicles|Gunman Chronicles|valve|port=27015
|
||||
hldm|Half-Life 1 Deathmatch|valve|port=27015
|
||||
hl2dm|Half-Life 2 Deathmatch|valve|port=27015
|
||||
halo|Halo|gamespy2|port=2302
|
||||
halo2|Halo 2|gamespy2|port=2302
|
||||
heretic2|Heretic 2|gamespy1|port=27900,port_query_offset=1
|
||||
hexen2|Hexen 2|hexen2|port=26900,port_query_offset=50
|
||||
hidden|The Hidden: Source|valve
|
||||
hidden|The Hidden: Source|valve|port=27015
|
||||
had2|Hidden and Dangerous 2|gamespy1|port=11001,port_query_offset=3
|
||||
homefront|Homefront|valve
|
||||
homefront|Homefront|valve|port=27015
|
||||
homeworld2|Homeworld 2|gamespy1|port_query=6500
|
||||
hurtworld|Hurtworld|valve|port=12871,port_query=12881
|
||||
igi2|IGI-2: Covert Strike|gamespy1|port_query=26001
|
||||
il2|IL-2 Sturmovik|gamespy1|port_query=21000
|
||||
insurgency|Insurgency|valve
|
||||
insurgency|Insurgency|valve|port=27015
|
||||
ironstorm|Iron Storm|gamespy1|port_query=3505
|
||||
jamesbondnightfire|James Bond: Nightfire|gamespy1|port_query=6550
|
||||
jc2mp|Just Cause 2 Multiplayer|jc2mp|port=7777
|
||||
|
@ -154,11 +153,11 @@ 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
|
||||
kspdmp|DMP - KSP Multiplayer|kspdmp|port=6702,port_query_offset=1
|
||||
kzmod|KzMod|valve
|
||||
left4dead|Left 4 Dead|valve
|
||||
left4dead2|Left 4 Dead 2|valve
|
||||
kzmod|KzMod|valve|port=27015
|
||||
left4dead|Left 4 Dead|valve|port=27015
|
||||
left4dead2|Left 4 Dead 2|valve|port=27015
|
||||
m2mp|Mafia 2 Multiplayer|m2mp|port=27016,port_query_offset=1
|
||||
medievalengineers|Medieval Engineers|valve
|
||||
medievalengineers|Medieval Engineers|valve|port=27015
|
||||
|
||||
mohaa|Medal of Honor: Allied Assault|gamespy1|port=12203,port_query_offset=97
|
||||
mohpa|Medal of Honor: Pacific Assault|gamespy1|port=13203,port_query_offset=97
|
||||
|
@ -180,9 +179,9 @@ mumble|Mumble|mumble|port=64738,port_query=27800|doc_notes=mumble
|
|||
mumbleping|Mumble|mumbleping|port=64738|doc_notes=mumble
|
||||
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
|
||||
ns|Natural Selection|valve
|
||||
netpanzer|netPanzer|gamespy1|port=3030
|
||||
nmrih|No More Room in Hell|valve|port=27015
|
||||
ns|Natural Selection|valve|port=27015
|
||||
ns2|Natural Selection 2|valve|port_query_offset=1
|
||||
nfshp2|Need for Speed: Hot Pursuit 2|gamespy1|port_query=61220
|
||||
nab|Nerf Arena Blast|gamespy1|port=4444,port_query_offset=1
|
||||
|
@ -192,7 +191,7 @@ nexuiz|Nexuiz|quake3|port_query=26000
|
|||
nitrofamily|Nitro Family|gamespy1|port_query=25601
|
||||
nolf|No One Lives Forever|gamespy1|port_query=27888
|
||||
nolf2|No One Lives Forever 2|gamespy1|port_query=27890
|
||||
nucleardawn|Nuclear Dawn|valve
|
||||
nucleardawn|Nuclear Dawn|valve|port=27015
|
||||
openarena|OpenArena|quake3|port_query=27960
|
||||
openttd|OpenTTD|openttd|port=3979
|
||||
operationflashpoint|Operation Flashpoint|gamespy1|port=2234,port_query_offset=1
|
||||
|
@ -206,7 +205,7 @@ quake2|Quake 2|quake2|port=27910
|
|||
quake3|Quake 3: Arena|quake3|port=27960
|
||||
quake4|Quake 4|doom3|port=28004
|
||||
|
||||
ragdollkungfu|Rag Doll Kung Fu|valve
|
||||
ragdollkungfu|Rag Doll Kung Fu|valve|port=27015
|
||||
|
||||
r6|Rainbow Six|gamespy1|port_query=2348
|
||||
r6roguespear|Rainbow Six 2: Rogue Spear|gamespy1|port_query=2346
|
||||
|
@ -219,20 +218,20 @@ redorchestraost|Red Orchestra: Ostfront 41-45|gamespy1|port=7757,port_query_offs
|
|||
redorchestra2|Red Orchestra 2|valve|port=7777,port_query=27015
|
||||
redline|Redline|gamespy1|port_query=25252
|
||||
rtcw|Return to Castle Wolfenstein|quake3|port_query=27960
|
||||
ricochet|Ricochet|valve
|
||||
ricochet|Ricochet|valve|port=27015
|
||||
riseofnations|Rise of Nations|gamespy1|port_query=6501
|
||||
rune|Rune|gamespy1|port=7777,port_query_offset=1
|
||||
rust|Rust|valve|port=28015
|
||||
samp|San Andreas Multiplayer|samp|port=7777
|
||||
spaceengineers|Space Engineers|valve
|
||||
spaceengineers|Space Engineers|valve|port=27015
|
||||
ss|Serious Sam|gamespy1|port=25600,port_query_offset=1
|
||||
ss2|Serious Sam 2|gamespy2|port=25600
|
||||
shatteredhorizon|Shattered Horizon|valve
|
||||
ship|The Ship|valve
|
||||
shatteredhorizon|Shattered Horizon|valve|port=27015
|
||||
ship|The Ship|valve|port=27015
|
||||
shogo|Shogo|gamespy1|port_query=27888
|
||||
shootmania|Shootmania|nadeo|port=2350,port_query=5000|doc_notes=nadeo-shootmania--trackmania--etc
|
||||
sin|SiN|gamespy1|port_query=22450
|
||||
sinep|SiN Episodes|valve
|
||||
sinep|SiN Episodes|valve|port=27015
|
||||
soldat|Soldat|ase|port=13073,port_query_offset=123
|
||||
sof|Soldier of Fortune|quake1|port_query=28910
|
||||
sof2|Soldier of Fortune 2|quake3|port_query=20100
|
||||
|
@ -250,22 +249,22 @@ swrc|Star Wars: Republic Commando|gamespy2|port=7777,port_query=11138
|
|||
|
||||
starbound|Starbound|valve|port=21025
|
||||
starmade|StarMade|starmade|port=4242
|
||||
suicidesurvival|Suicide Survival|valve
|
||||
suicidesurvival|Suicide Survival|valve|port=27015
|
||||
swat4|SWAT 4|gamespy2|port=10480,port_query_offset=2
|
||||
svencoop|Sven Coop|valve
|
||||
synergy|Synergy|valve
|
||||
svencoop|Sven Coop|valve|port=27015
|
||||
synergy|Synergy|valve|port=27015
|
||||
tacticalops|Tactical Ops|gamespy1|port=7777,port_query_offset=1
|
||||
teamfactor|Team Factor|gamespy1|port_query=57778
|
||||
tfc|Team Fortress Classic|valve
|
||||
tf2|Team Fortress 2|valve
|
||||
teamspeak2|Teamspeak 2|teamspeak2|port=8767,port_query=51234
|
||||
teamspeak3|Teamspeak 3|teamspeak3|port=9987,port_query=10011|doc_notes=teamspeak3
|
||||
tfc|Team Fortress Classic|valve|port=27015
|
||||
tf2|Team Fortress 2|valve|port=27015
|
||||
teamspeak2|Teamspeak 2|teamspeak2|port=8767
|
||||
teamspeak3|Teamspeak 3|teamspeak3|port=9987|doc_notes=teamspeak3
|
||||
terminus|Terminus|gamespy1|port_query=12286
|
||||
terraria|Terraria|terraria|port=7777,port_query_offset=101|doc_notes=terraria
|
||||
thps3|Tony Hawk's Pro Skater 3|gamespy1|port_query=6500
|
||||
thps4|Tony Hawk's Pro Skater 4|gamespy1|port_query=6500
|
||||
thu2|Tony Hawk's Underground 2|gamespy1|port_query=5153
|
||||
towerunite|Tower Unite|valve
|
||||
towerunite|Tower Unite|valve|port=27015
|
||||
trackmania2|Trackmania 2|nadeo|port=2350,port_query=5000|doc_notes=nadeo-shootmania--trackmania--etc
|
||||
trackmaniaforever|Trackmania Forever|nadeo|port=2350,port_query=5000|doc_notes=nadeo-shootmania--trackmania--etc
|
||||
tremulous|Tremulous|quake3|port_query=30720
|
||||
|
@ -292,5 +291,5 @@ wheeloftime|Wheel of Time|gamespy1|port=7777,port_query_offset=1
|
|||
wolfenstein2009|Wolfenstein 2009|doom3|port=27666
|
||||
wolfensteinet|Wolfenstein: Enemy Territory|quake3|port_query=27960
|
||||
xpandrally|Xpand Rally|ase|port=28015,port_query_offset=123
|
||||
zombiemaster|Zombie Master|valve
|
||||
zps|Zombie Panic: Source|valve
|
||||
zombiemaster|Zombie Master|valve|port=27015
|
||||
zps|Zombie Panic: Source|valve|port=27015
|
||||
|
|
|
@ -62,7 +62,8 @@ class QueryRunner {
|
|||
attempts.push({
|
||||
...defaultOptions,
|
||||
...gameOptions,
|
||||
...userOptions
|
||||
...userOptions,
|
||||
port: gameOptions.port + (gameQueryPortOffset || 0)
|
||||
});
|
||||
} else {
|
||||
throw new Error("Could not determine port to query. Did you provide a port or gameid?");
|
||||
|
|
|
@ -9,7 +9,7 @@ class BuildAndShoot extends Core {
|
|||
|
||||
let m;
|
||||
|
||||
m = body.match(/status server for (.*?)\r|\n/);
|
||||
m = body.match(/status server for (.*?)\.?(\r|\n)/);
|
||||
if(m) state.name = m[1];
|
||||
|
||||
m = body.match(/Current uptime: (\d+)/);
|
||||
|
@ -24,6 +24,11 @@ class BuildAndShoot extends Core {
|
|||
state.maxplayers = m[2];
|
||||
}
|
||||
|
||||
m = body.match(/aos:\/\/[0-9]+:[0-9]+/);
|
||||
if (m) {
|
||||
state.connect = m[0];
|
||||
}
|
||||
|
||||
const $ = cheerio.load(body);
|
||||
$('#playerlist tbody tr').each((i,tr) => {
|
||||
if (!$(tr).find('td').first().attr('colspan')) {
|
||||
|
|
|
@ -92,7 +92,7 @@ class Core extends EventEmitter {
|
|||
state.notes = this.options.notes;
|
||||
|
||||
// because lots of servers prefix with spaces to try to appear first
|
||||
state.name = state.name.trim();
|
||||
state.name = (state.name || '').trim();
|
||||
|
||||
state.duration = Date.now() - startMillis;
|
||||
if (!('connect' in state)) {
|
||||
|
@ -185,9 +185,9 @@ class Core extends EventEmitter {
|
|||
* @param {function(Socket):Promise<T>} fn
|
||||
* @returns {Promise<T>}
|
||||
*/
|
||||
async withTcp(fn) {
|
||||
async withTcp(fn, port) {
|
||||
const address = this.options.address;
|
||||
const port = this.options.port;
|
||||
if (!port) port = this.options.port;
|
||||
this.assertValidPort(port);
|
||||
|
||||
let socket, connectionTimeout;
|
||||
|
@ -342,10 +342,9 @@ class Core extends EventEmitter {
|
|||
log(() => params.uri + " HTTP-->");
|
||||
requestPromise
|
||||
.then((response) => log(params.uri + " <--HTTP " + response.statusCode))
|
||||
.catch(() => {
|
||||
});
|
||||
.catch(() => {});
|
||||
});
|
||||
const wrappedPromise = promise.then(response => response.body);
|
||||
const wrappedPromise = requestPromise.then(response => response.body);
|
||||
return await Promise.race([wrappedPromise, this.abortedPromise]);
|
||||
} finally {
|
||||
requestPromise && requestPromise.cancel();
|
||||
|
|
|
@ -71,7 +71,7 @@ class Doom3 extends Core {
|
|||
}
|
||||
|
||||
state.raw.osmask = reader.uint(4);
|
||||
if(isEtqw) {
|
||||
if (isEtqw) {
|
||||
state.raw.ranked = reader.uint(1);
|
||||
state.raw.timeleft = reader.uint(4);
|
||||
state.raw.gamestate = reader.uint(1);
|
||||
|
@ -85,10 +85,12 @@ class Doom3 extends Core {
|
|||
}
|
||||
}
|
||||
|
||||
if(state.raw.si_name) state.name = state.raw.si_name;
|
||||
if(state.raw.si_map) state.map = state.raw.si_map;
|
||||
if(state.raw.si_maxplayers) state.maxplayers = parseInt(state.raw.si_maxplayers);
|
||||
if(state.raw.si_usepass === '1') state.password = true;
|
||||
if (state.raw.si_name) state.name = state.raw.si_name;
|
||||
if (state.raw.si_map) state.map = state.raw.si_map;
|
||||
if (state.raw.si_maxplayers) state.maxplayers = parseInt(state.raw.si_maxplayers);
|
||||
if (state.raw.si_maxPlayers) state.maxplayers = parseInt(state.raw.si_maxplayers);
|
||||
if (state.raw.si_usepass === '1') state.password = true;
|
||||
if (state.raw.si_needPass === '1') state.password = true;
|
||||
if (this.options.port === 27733) state.gamePort = 3074; // etqw has a different query and game port
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ class Ffow extends Valve {
|
|||
state.raw.gamemode = reader.string();
|
||||
state.raw.description = reader.string();
|
||||
state.raw.version = reader.string();
|
||||
state.raw.port = reader.uint(2);
|
||||
state.gamePort = reader.uint(2);
|
||||
state.raw.numplayers = reader.uint(1);
|
||||
state.maxplayers = reader.uint(1);
|
||||
state.raw.listentype = String.fromCharCode(reader.uint(1));
|
||||
|
|
|
@ -15,6 +15,7 @@ class Gamespy1 extends Core {
|
|||
if ('mapname' in state.raw) state.map = state.raw.mapname;
|
||||
if (this.trueTest(state.raw.password)) state.password = true;
|
||||
if ('maxplayers' in state.raw) state.maxplayers = parseInt(state.raw.maxplayers);
|
||||
if ('hostport' in state.raw) state.gamePort = parseInt(state.raw.hostport);
|
||||
}
|
||||
{
|
||||
const data = await this.sendPacket('rules');
|
||||
|
|
|
@ -18,10 +18,11 @@ class Gamespy2 extends Core {
|
|||
if (!key) break;
|
||||
state.raw[key] = value;
|
||||
}
|
||||
if('hostname' in state.raw) state.name = state.raw.hostname;
|
||||
if('mapname' in state.raw) state.map = state.raw.mapname;
|
||||
if(this.trueTest(state.raw.password)) state.password = true;
|
||||
if('maxplayers' in state.raw) state.maxplayers = parseInt(state.raw.maxplayers);
|
||||
if ('hostname' in state.raw) state.name = state.raw.hostname;
|
||||
if ('mapname' in state.raw) state.map = state.raw.mapname;
|
||||
if (this.trueTest(state.raw.password)) state.password = true;
|
||||
if ('maxplayers' in state.raw) state.maxplayers = parseInt(state.raw.maxplayers);
|
||||
if ('hostport' in state.raw) state.gamePort = parseInt(state.raw.hostport);
|
||||
}
|
||||
|
||||
// Parse players
|
||||
|
@ -57,10 +58,6 @@ class Gamespy2 extends Core {
|
|||
player.name = stripColor(player.name);
|
||||
}
|
||||
}
|
||||
|
||||
if (state.raw.hostport) {
|
||||
state.gamePort = parseInt(state.raw.hostport);
|
||||
}
|
||||
}
|
||||
|
||||
async sendPacket(type) {
|
||||
|
|
|
@ -109,11 +109,12 @@ class Gamespy3 extends Core {
|
|||
|
||||
// Turn all that raw state into something useful
|
||||
|
||||
if('hostname' in state.raw) state.name = state.raw.hostname;
|
||||
if ('hostname' in state.raw) state.name = state.raw.hostname;
|
||||
else if('servername' in state.raw) state.name = state.raw.servername;
|
||||
if('mapname' in state.raw) state.map = state.raw.mapname;
|
||||
if(state.raw.password === '1') state.password = true;
|
||||
if('maxplayers' in state.raw) state.maxplayers = parseInt(state.raw.maxplayers);
|
||||
if ('mapname' in state.raw) state.map = state.raw.mapname;
|
||||
if (state.raw.password === '1') state.password = true;
|
||||
if ('maxplayers' in state.raw) state.maxplayers = parseInt(state.raw.maxplayers);
|
||||
if ('hostport' in state.raw) state.gamePort = parseInt(state.raw.hostport);
|
||||
|
||||
if('' in state.raw.playerTeamInfo) {
|
||||
for (const playerInfo of state.raw.playerTeamInfo['']) {
|
||||
|
|
|
@ -6,6 +6,10 @@ class Hexen2 extends Quake1 {
|
|||
this.sendHeader = '\xFFstatus\x0a';
|
||||
this.responseHeader = '\xffn';
|
||||
}
|
||||
async run(state) {
|
||||
await super.run(state);
|
||||
state.gamePort = this.options.port - 50;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Hexen2;
|
||||
|
|
|
@ -16,6 +16,7 @@ class Kspdmp extends Core {
|
|||
}
|
||||
state.name = json.server_name;
|
||||
state.maxplayers = json.max_players;
|
||||
state.gamePort = json.port;
|
||||
if (json.players) {
|
||||
const split = json.players.split(', ');
|
||||
for (const name of split) {
|
||||
|
|
|
@ -20,6 +20,7 @@ class M2mp extends Core {
|
|||
state.maxplayers = this.readString(reader);
|
||||
state.raw.gamemode = this.readString(reader);
|
||||
state.password = !!reader.uint(1);
|
||||
state.gamePort = this.options.port - 1;
|
||||
|
||||
while(!reader.done()) {
|
||||
const name = this.readString(reader);
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
const Core = require('./core');
|
||||
|
||||
class Mumble extends Core {
|
||||
constructor() {
|
||||
super();
|
||||
this.options.socketTimeout = 5000;
|
||||
}
|
||||
|
||||
async run(state) {
|
||||
const json = await this.withTcp(async socket => {
|
||||
return await this.tcpSend(socket, 'json', (buffer) => {
|
||||
|
@ -24,6 +19,7 @@ class Mumble extends Core {
|
|||
|
||||
state.raw = json;
|
||||
state.name = json.name;
|
||||
state.gamePort = json.x_gtmurmur_connectport || 64738;
|
||||
|
||||
let channelStack = [state.raw.root];
|
||||
while(channelStack.length) {
|
||||
|
|
|
@ -41,6 +41,10 @@ class Nadeo extends Core {
|
|||
state.raw.nextmapUid = results.UId;
|
||||
}
|
||||
|
||||
if (this.options.port === 5000) {
|
||||
state.gamePort = 2350;
|
||||
}
|
||||
|
||||
state.raw.players = await this.methodCall(client, 'GetPlayerList', 10000, 0);
|
||||
for (const player of state.raw.players) {
|
||||
state.players.push({
|
||||
|
|
|
@ -2,6 +2,8 @@ const Core = require('./core');
|
|||
|
||||
class Teamspeak2 extends Core {
|
||||
async run(state) {
|
||||
const queryPort = this.options.teamspeakQueryPort || 51234;
|
||||
|
||||
await this.withTcp(async socket => {
|
||||
{
|
||||
const data = await this.sendCommand(socket, 'sel '+this.options.port);
|
||||
|
@ -55,7 +57,7 @@ class Teamspeak2 extends Core {
|
|||
state.raw.channels.push(channel);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, queryPort);
|
||||
}
|
||||
|
||||
async sendCommand(socket,cmd) {
|
||||
|
|
|
@ -2,6 +2,8 @@ const Core = require('./core');
|
|||
|
||||
class Teamspeak3 extends Core {
|
||||
async run(state) {
|
||||
const queryPort = this.options.teamspeakQueryPort || 10011;
|
||||
|
||||
await this.withTcp(async socket => {
|
||||
{
|
||||
const data = await this.sendCommand(socket, 'use port='+this.options.port, true);
|
||||
|
@ -31,7 +33,7 @@ class Teamspeak3 extends Core {
|
|||
const data = await this.sendCommand(socket, 'channellist -topic');
|
||||
state.raw.channels = data;
|
||||
}
|
||||
});
|
||||
}, queryPort);
|
||||
}
|
||||
|
||||
async sendCommand(socket,cmd,raw) {
|
||||
|
|
|
@ -18,7 +18,7 @@ class Terraria extends Core {
|
|||
}
|
||||
|
||||
state.name = json.name;
|
||||
state.raw.port = json.port;
|
||||
state.gamePort = json.port;
|
||||
state.raw.numplayers = json.playercount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class Unreal2 extends Core {
|
|||
const reader = this.reader(b);
|
||||
state.raw.serverid = reader.uint(4);
|
||||
state.raw.ip = this.readUnrealString(reader);
|
||||
state.raw.port = reader.uint(4);
|
||||
state.gamePort = reader.uint(4);
|
||||
state.raw.queryport = reader.uint(4);
|
||||
state.name = this.readUnrealString(reader, true);
|
||||
state.map = this.readUnrealString(reader, true);
|
||||
|
|
|
@ -5,8 +5,6 @@ class Valve extends Core {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.options.port = 27015;
|
||||
|
||||
// legacy goldsrc info response -- basically not used by ANYTHING now,
|
||||
// as most (all?) goldsrc servers respond with the source info reponse
|
||||
// delete in a few years if nothing ends up using it anymore
|
||||
|
@ -28,6 +26,7 @@ class Valve extends Core {
|
|||
}
|
||||
|
||||
async run(state) {
|
||||
if (!this.options.port) this.options.port = 27015;
|
||||
await this.queryInfo(state);
|
||||
await this.queryChallenge();
|
||||
await this.queryPlayers(state);
|
||||
|
@ -93,7 +92,7 @@ class Valve extends Core {
|
|||
}
|
||||
state.raw.version = reader.string();
|
||||
const extraFlag = reader.uint(1);
|
||||
if(extraFlag & 0x80) state.raw.port = reader.uint(2);
|
||||
if(extraFlag & 0x80) state.gamePort = reader.uint(2);
|
||||
if(extraFlag & 0x10) state.raw.steamid = reader.uint(8);
|
||||
if(extraFlag & 0x40) {
|
||||
state.raw.sourcetvport = reader.uint(2);
|
||||
|
|
Loading…
Reference in a new issue