mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
Update tshock support for terraria 1.2
This commit is contained in:
parent
25e8d1bd48
commit
7b8ddfba8c
2 changed files with 50 additions and 34 deletions
35
README.md
35
README.md
|
|
@ -27,8 +27,6 @@ Gamedig.query(
|
||||||
* **type**: One of the types from the protocols folder
|
* **type**: One of the types from the protocols folder
|
||||||
* **host**
|
* **host**
|
||||||
* **port**: (optional) Uses the protocol default if not set
|
* **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
|
* **notes**: (optional) Passed through to output
|
||||||
|
|
||||||
###Callback Function
|
###Callback Function
|
||||||
|
|
@ -60,31 +58,46 @@ Some servers may return an additional player count number, which may be present
|
||||||
|
|
||||||
Supported Games
|
Supported Games
|
||||||
---
|
---
|
||||||
* Armagetron
|
|
||||||
* Gamespy 3 Protocol
|
###Armagetron
|
||||||
|
|
||||||
|
###Gamespy 3 Protocol
|
||||||
* Minecraft
|
* Minecraft
|
||||||
* Unreal Tournament 3
|
* Unreal Tournament 3
|
||||||
* GoldSrc Engine
|
|
||||||
|
###GoldSrc Engine
|
||||||
* Half Life: Death Match
|
* Half Life: Death Match
|
||||||
* Ricochet
|
* Ricochet
|
||||||
* Counter-Strike: 1.6
|
* Counter-Strike: 1.6
|
||||||
* \+ others
|
* \+ others
|
||||||
* Nadeo Protocol
|
|
||||||
|
###Nadeo Protocol
|
||||||
|
```
|
||||||
|
Requires additional parameters: login, password
|
||||||
|
```
|
||||||
* Trackmania Forever
|
* Trackmania Forever
|
||||||
* Trackmania 2
|
* Trackmania 2
|
||||||
* Shootmania
|
* Shootmania
|
||||||
* Quake 2 Protocol
|
|
||||||
|
###Quake 2 Protocol
|
||||||
* Quake 2
|
* Quake 2
|
||||||
* Quake 3 Protocol
|
|
||||||
|
###Quake 3 Protocol
|
||||||
* Quake 3 Arena
|
* Quake 3 Arena
|
||||||
* Quake 3 Team Arena
|
* Quake 3 Team Arena
|
||||||
* Warsow
|
* Warsow
|
||||||
* Source Engine
|
|
||||||
|
###Source Engine
|
||||||
* Counter-Strike: Source
|
* Counter-Strike: Source
|
||||||
* Counter-Strike: Global Offensive
|
* Counter-Strike: Global Offensive
|
||||||
* Team Fortress 2
|
* Team Fortress 2
|
||||||
* \+ others
|
* \+ others
|
||||||
* Terraria (tshock)
|
|
||||||
* Unreal 2 Protocol
|
###Terraria (tshock)
|
||||||
|
```
|
||||||
|
Requires additional parameter: token
|
||||||
|
```
|
||||||
|
|
||||||
|
###Unreal 2 Protocol
|
||||||
* Killing Floor
|
* Killing Floor
|
||||||
* Unreal Tournament 2004
|
* Unreal Tournament 2004
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,12 @@ module.exports = require('./core').extend({
|
||||||
run: function(state) {
|
run: function(state) {
|
||||||
var self = this;
|
var self = this;
|
||||||
request({
|
request({
|
||||||
uri: 'http://'+this.options.address+':'+this.options.port+'/status',
|
uri: 'http://'+this.options.address+':'+this.options.port+'/v2/server/status',
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
|
qs: {
|
||||||
|
players: 'true',
|
||||||
|
token: this.options.token
|
||||||
|
}
|
||||||
}, function(e,r,body) {
|
}, function(e,r,body) {
|
||||||
if(e) return self.error('HTTP error');
|
if(e) return self.error('HTTP error');
|
||||||
var json;
|
var json;
|
||||||
|
|
@ -22,9 +26,8 @@ module.exports = require('./core').extend({
|
||||||
|
|
||||||
if(json.status != 200) return self.error('Invalid status');
|
if(json.status != 200) return self.error('Invalid status');
|
||||||
|
|
||||||
var split = json.players.split(',');
|
json.players.forEach(function(one) {
|
||||||
split.forEach(function(one) {
|
state.players.push({name:one.nickname,team:one.team});
|
||||||
state.players.push({name:one});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
state.name = json.name;
|
state.name = json.name;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue