-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.go
43 lines (38 loc) · 1.14 KB
/
game.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package opennoxcontrol
// Player represents information about a specific player.
type Player struct {
Name string `json:"name"`
Class string `json:"class"`
}
// PlayerInfo lists information about all players on a server.
type PlayerInfo struct {
Cur int `json:"cur"`
Max int `json:"max"`
List []Player `json:"list"`
}
// Info represents current game info.
type Info struct {
Name string `json:"name"`
Map string `json:"map"`
Mode string `json:"mode"`
Vers string `json:"vers"`
PlayerInfo PlayerInfo `json:"players"`
}
// Map represent information about a Nox map.
type Map struct {
Name string `json:"name"`
Summary string `json:"summary"`
Flags int `json:"flags"`
MinPlayers int `json:"min_players"`
MaxPlayers int `json:"max_players"`
}
type Game interface {
// GameInfo returns current game info, see Info.
GameInfo() (Info, error)
// ListMaps lists maps available on the server.
ListMaps() ([]Map, error)
// ChangeMap stops current game and loads a given map instead.
ChangeMap(name string) error
// Command executes a server command.
Command(cmd string) error
}