2013-07-10 12:02:48 +02:00
|
|
|
node-GameDig - Game Server Query Library
|
2013-07-10 12:07:12 +02:00
|
|
|
---
|
2013-07-10 12:02:48 +02:00
|
|
|
|
|
|
|
Usage
|
|
|
|
---
|
|
|
|
|
2013-07-10 14:23:18 +02:00
|
|
|
```bash
|
|
|
|
npm install gamedig
|
|
|
|
```
|
|
|
|
|
2013-07-10 12:02:48 +02:00
|
|
|
```javascript
|
|
|
|
var Gamedig = require('gamedig');
|
2013-07-10 14:23:18 +02:00
|
|
|
Gamedig.query(
|
|
|
|
{
|
|
|
|
type: 'minecraft',
|
|
|
|
host: 'mc.example.com'
|
|
|
|
},
|
|
|
|
function(state) {
|
2013-07-10 12:02:48 +02:00
|
|
|
if(state.error) console.log("Server is offline");
|
|
|
|
else console.log(state);
|
|
|
|
}
|
2013-07-10 14:23:18 +02:00
|
|
|
);
|
2013-07-10 12:02:48 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
State Object
|
|
|
|
---
|
2013-07-10 12:06:44 +02:00
|
|
|
The callback function is "guaranteed" to be called exactly once, indicating either a query error or timeout
|
|
|
|
(in the state's error key), or with a state object containg the successful results.
|
|
|
|
|
2013-07-11 11:13:39 +02:00
|
|
|
The returned state object may contain some or all of the following keys:
|
2013-07-10 12:02:48 +02:00
|
|
|
|
|
|
|
* error
|
2013-07-11 11:13:39 +02:00
|
|
|
|
|
|
|
* name
|
2013-07-10 12:02:48 +02:00
|
|
|
* numplayers
|
|
|
|
* maxplayers
|
|
|
|
* players
|
2013-07-10 12:44:18 +02:00
|
|
|
* name
|
|
|
|
* ping
|
|
|
|
* score
|
2013-07-10 12:02:48 +02:00
|
|
|
* map
|
|
|
|
* gametype
|
2013-07-11 11:13:39 +02:00
|
|
|
|
|
|
|
Many other keys will also be available will be available on a game by game basis.
|
2013-07-10 12:02:48 +02:00
|
|
|
|
|
|
|
Supported Games
|
|
|
|
---
|
|
|
|
* Armagetron
|
|
|
|
* Gamespy 3 Protocol
|
2013-07-10 12:44:18 +02:00
|
|
|
* Minecraft
|
2013-07-11 11:13:39 +02:00
|
|
|
* Unreal Tournament 3
|
2013-07-10 12:02:48 +02:00
|
|
|
* GoldSrc Engine
|
2013-07-10 12:44:18 +02:00
|
|
|
* Half Life: Death Match
|
|
|
|
* Ricochet
|
|
|
|
* Counter-Strike: 1.6
|
|
|
|
* + others
|
2013-07-11 11:13:39 +02:00
|
|
|
* Nadeo Protocol
|
|
|
|
* Trackmania Forever
|
|
|
|
* Trackmania 2
|
|
|
|
* Shootmania
|
|
|
|
* (requires additional 'login' and 'password' parameters for User login on server)
|
|
|
|
* 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
|
|
|
|
* Tshock Protocol
|
|
|
|
* Terraria
|
|
|
|
* Unreal 2 Protocol
|
|
|
|
* Killing Floor
|
|
|
|
* Unreal Tournament 2004
|
2013-07-10 12:02:48 +02:00
|
|
|
|
|
|
|
Unstable API
|
|
|
|
---
|
|
|
|
The contents of the returned state object may change slightly from build to build, as the API
|
|
|
|
is still being formed.
|