Update tshock support for terraria 1.2

This commit is contained in:
Michael Morrison 2013-10-12 01:43:16 -05:00
parent 25e8d1bd48
commit 7b8ddfba8c
2 changed files with 50 additions and 34 deletions

View File

@ -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

View File

@ -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;