diff --git a/README.md b/README.md index 4b0dc5b..d1ffbf4 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,6 @@ Gamedig.query( * **type**: One of the types from the protocols folder * **host** * **port**: (optional) Uses the protocol default if not set -* **login**: (optional) Used only by nadeo protocol -* **password**: (optional) Used only by nadeo protocol * **notes**: (optional) Passed through to output ###Callback Function @@ -60,31 +58,46 @@ Some servers may return an additional player count number, which may be present Supported Games --- -* Armagetron -* Gamespy 3 Protocol - * Minecraft - * Unreal Tournament 3 -* GoldSrc Engine - * Half Life: Death Match - * Ricochet - * Counter-Strike: 1.6 - * \+ others -* Nadeo Protocol - * Trackmania Forever - * Trackmania 2 - * Shootmania -* Quake 2 Protocol - * Quake 2 -* Quake 3 Protocol - * Quake 3 Arena - * Quake 3 Team Arena - * Warsow -* Source Engine - * Counter-Strike: Source - * Counter-Strike: Global Offensive - * Team Fortress 2 - * \+ others -* Terraria (tshock) -* Unreal 2 Protocol - * Killing Floor - * Unreal Tournament 2004 + +###Armagetron + +###Gamespy 3 Protocol +* Minecraft +* Unreal Tournament 3 + +###GoldSrc Engine +* Half Life: Death Match +* Ricochet +* Counter-Strike: 1.6 +* \+ others + +###Nadeo Protocol +``` +Requires additional parameters: login, password +``` +* Trackmania Forever +* Trackmania 2 +* Shootmania + +###Quake 2 Protocol +* Quake 2 + +###Quake 3 Protocol +* Quake 3 Arena +* Quake 3 Team Arena +* Warsow + +###Source Engine +* Counter-Strike: Source +* Counter-Strike: Global Offensive +* Team Fortress 2 +* \+ others + +###Terraria (tshock) +``` +Requires additional parameter: token +``` + +###Unreal 2 Protocol +* Killing Floor +* Unreal Tournament 2004 diff --git a/protocols/tshock.js b/protocols/tshock.js index 9425088..678f8d8 100644 --- a/protocols/tshock.js +++ b/protocols/tshock.js @@ -9,8 +9,12 @@ module.exports = require('./core').extend({ run: function(state) { var self = this; request({ - uri: 'http://'+this.options.address+':'+this.options.port+'/status', + uri: 'http://'+this.options.address+':'+this.options.port+'/v2/server/status', timeout: 3000, + qs: { + players: 'true', + token: this.options.token + } }, function(e,r,body) { if(e) return self.error('HTTP error'); var json; @@ -22,9 +26,8 @@ module.exports = require('./core').extend({ if(json.status != 200) return self.error('Invalid status'); - var split = json.players.split(','); - split.forEach(function(one) { - state.players.push({name:one}); + json.players.forEach(function(one) { + state.players.push({name:one.nickname,team:one.team}); }); state.name = json.name;