-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy patheventtypes.go
More file actions
213 lines (169 loc) · 4.35 KB
/
eventtypes.go
File metadata and controls
213 lines (169 loc) · 4.35 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package events
import (
"time"
"github.com/volte6/gomud/internal/configs"
"github.com/volte6/gomud/internal/connections"
"github.com/volte6/gomud/internal/items"
"github.com/volte6/gomud/internal/stats"
)
// Used to apply or remove buffs
type Buff struct {
UserId int
MobInstanceId int
BuffId int
}
func (b Buff) Type() string { return `Buff` }
// Used for giving/taking quest progress
type Quest struct {
UserId int
QuestToken string
}
func (q Quest) Type() string { return `Quest` }
// For special room-targetting actions
type RoomAction struct {
RoomId int
SourceUserId int
SourceMobId int
Action string
Details any
ReadyTurn uint64
}
func (r RoomAction) Type() string { return `RoomAction` }
// Used for Input from players/mobs
type Input struct {
UserId int
MobInstanceId int
InputText string
ReadyTurn uint64
Flags EventFlag
}
func (i Input) Type() string { return `Input` }
// Messages that are intended to reach all users on the system
type Broadcast struct {
Text string
SkipLineRefresh bool
}
func (b Broadcast) Type() string { return `Broadcast` }
type Message struct {
UserId int
ExcludeUserIds []int
RoomId int
Text string
IsQuiet bool // whether it can only be heard by superior "hearing"
IsCommunication bool // If true, this is a communication such as "say" or "emote"
}
func (m Message) Type() string { return `Message` }
// Special commands that only the webclient is equipped to handle
type WebClientCommand struct {
ConnectionId uint64
Text string
}
func (w WebClientCommand) Type() string { return `WebClientCommand` }
// GMCP Commands from clients to server
type GMCPIn struct {
ConnectionId uint64
Command string
Json []byte
}
func (g GMCPIn) Type() string { return `GMCPIn` }
// GMCP Commands from server to client
type GMCPOut struct {
UserId int
Payload any
}
func (g GMCPOut) Type() string { return `GMCPOut` }
// Messages that are intended to reach all users on the system
type System struct {
Command string
Data any
}
func (s System) Type() string { return `System` }
// Payloads describing sound/music to play
type MSP struct {
UserId int
SoundType string // SOUND or MUSIC
SoundFile string
Volume int // 1-100
Category string // special category/type for MSP string
}
func (m MSP) Type() string { return `MSP` }
// Fired whenever a mob or player changes rooms
type RoomChange struct {
UserId int
MobInstanceId int
FromRoomId int
ToRoomId int
}
func (r RoomChange) Type() string { return `RoomChange` }
// Fired every new round
type NewRound struct {
RoundNumber uint64
TimeNow time.Time
Config configs.Config
}
func (n NewRound) Type() string { return `NewRound` }
// Each new turn (TurnMs in config.yaml)
type NewTurn struct {
TurnNumber uint64
TimeNow time.Time
Config configs.Config
}
func (n NewTurn) Type() string { return `NewTurn` }
// Gained or lost an item
type ItemOwnership struct {
UserId int
MobInstanceId int
Item items.Item
Gained bool
}
func (i ItemOwnership) Type() string { return `ItemOwnership` }
// Triggered by a script
type ScriptedEvent struct {
Name string
Data map[string]any
}
func (s ScriptedEvent) Type() string { return `ScriptedEvent` }
// Entered the world
type PlayerSpawn struct {
UserId int
RoomId int
Username string
CharacterName string
}
func (p PlayerSpawn) Type() string { return `PlayerSpawn` }
// Left the world
type PlayerDespawn struct {
UserId int
RoomId int
Username string
CharacterName string
}
func (p PlayerDespawn) Type() string { return `PlayerDespawn` }
type Log struct {
FollowAdd connections.ConnectionId
FollowRemove connections.ConnectionId
Level string
Data []any
}
func (l Log) Type() string { return `Log` }
type LevelUp struct {
UserId int
RoomId int
Username string
CharacterName string
NewLevel int
StatsDelta stats.Statistics
TrainingPoints int
StatPoints int
LivesGained int
}
func (l LevelUp) Type() string { return `LevelUp` }
type PlayerDeath struct {
UserId int
RoomId int
Username string
CharacterName string
Permanent bool
KilledByUsers []int
}
func (l PlayerDeath) Type() string { return `PlayerDeath` }