-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.go
72 lines (62 loc) · 1.85 KB
/
data.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Package shared defines data structures that are used both by the server and
// by the web client.
// These are typically data types transferred as JSON.
package shared
// ModuleConfig is a list of configuration items.
type ModuleConfig []interface{}
// System describes a pen & paper roleplaying system.
type System struct {
Name string `json:"name"`
ID string `json:"id"`
}
// Hero describes a hero in a group.
type Hero struct {
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
}
// Scene describes a scene of a group.
type Scene struct {
Name string `json:"name"`
ID string `json:"id"`
Modules []bool `json:"modules"`
}
// Group describes a dataset for a pen & paper roleplaying group.
type Group struct {
Name string `json:"name"`
ID string `json:"id"`
SystemIndex int `json:"systemIndex"`
Heroes []Hero `json:"heroes"`
Scenes []Scene `json:"scenes"`
}
// Module describes a loaded module.
type Module struct {
Name string `json:"name"`
// <plugin-id>/<module-id>
Path string `json:"path"`
}
// TemplateDescr describes an available template for a system, group or scene.
type TemplateDescr struct {
Name, Description string
}
// Plugin describes a loaded plugin.
type Plugin struct {
Name string `json:"name"`
ID string `json:"id"`
SystemTemplates []TemplateDescr
GroupTemplates []TemplateDescr
SceneTemplates []TemplateDescr
}
// Data contains all systems and groups and is used for the server's "/data"
// endpoint
type Data struct {
Systems []System `json:"systems"`
Groups []Group `json:"groups"`
}
// State contains the current state, including currently active group and scene.
// The state of the modules is local to the session page and not available
// globally.
type State struct {
ActiveGroup int
ActiveScene int
}