-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.go
426 lines (374 loc) · 13.7 KB
/
models.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
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
package got5
// https://splewis.github.io/get5/latest/events_and_forwards/#sourcemod-forwards
// All Events
// OnEventPayload Called when any event is fired. This forward takes two parameters (while all others take only one); the event object itself and a string representing the encoded JSON object. If you use this forward, you should fetch the event name and switch on it, casting the object to its correct subclass using
type OnEventPayload map[string]any
type Event struct {
Event string `json:"event"`
}
type MatchEvent struct {
Event
MatchID int `json:"matchid"`
}
type MapEvent struct {
MatchEvent
MapNumber int `json:"map_number"`
}
// Series Flow
// OnGameStateChangedPayload Events the occur in relation to setting up a match or series.
type OnGameStateChangedPayload struct {
Event
NewState string `json:"new_state"`
OldState string `json:"old_state"`
}
// OnPreLoadMatchConfigPayload Fired when the server attempts to load a match config.
type OnPreLoadMatchConfigPayload struct {
Event
Filename string `json:"filename"`
}
// OnLoadMatchConfigFailedPayload Fired when a match config fails to load.
type OnLoadMatchConfigFailedPayload struct {
Event
Reason string `json:"reason"`
}
// OnSeriesInitPayload Fired when a series is started after loading a match config.
type OnSeriesInitPayload struct {
MatchEvent
NumMaps int `json:"num_maps"`
Team1 struct {
ID string `json:"id"`
Name string `json:"name"`
} `json:"team1"`
Team2 struct {
ID string `json:"id"`
Name string `json:"name"`
} `json:"team2"`
}
// OnMapResultPayload Fired when the map ends.
type OnMapResultPayload struct {
MatchEvent
MapNumber int `json:"map_number"`
Team1 Get5StatsTeam `json:"team1"`
Team2 Get5StatsTeam `json:"team2"`
Winner Winner `json:"winner"`
}
type Get5StatsTeam struct {
ID string `json:"id"`
Name string `json:"name"`
SeriesScore int `json:"series_score"`
Score int `json:"score"`
ScoreCt int `json:"score_ct"`
ScoreT int `json:"score_t"`
Players []Get5StatsPlayer `json:"players"`
Side string `json:"side"`
StartingSide string `json:"starting_side"`
}
type Get5StatsPlayer struct {
SteamID string `json:"steamid"`
Name string `json:"name"`
Stats struct {
Kills int `json:"kills"`
Deaths int `json:"deaths"`
Assists int `json:"assists"`
FlashAssists int `json:"flash_assists"`
TeamKills int `json:"team_kills"`
Suicides int `json:"suicides"`
Damage int `json:"damage"`
UtilityDamage int `json:"utility_damage"`
EnemiesFlashed int `json:"enemies_flashed"`
FriendliesFlashed int `json:"friendlies_flashed"`
KnifeKills int `json:"knife_kills"`
HeadshotKills int `json:"headshot_kills"`
RoundsPlayed int `json:"rounds_played"`
BombDefuses int `json:"bomb_defuses"`
BombPlants int `json:"bomb_plants"`
OneK int `json:"1k"`
TwoK int `json:"2k"`
ThreeK int `json:"3k"`
FourK int `json:"4k"`
FiveK int `json:"5k"`
OneV1 int `json:"1v1"`
OneV2 int `json:"1v2"`
OneV3 int `json:"1v3"`
OneV4 int `json:"1v4"`
OneV5 int `json:"1v5"`
FirstKillsT int `json:"first_kills_t"`
FirstKillsCt int `json:"first_kills_ct"`
FirstDeathsT int `json:"first_deaths_t"`
FirstDeathsCt int `json:"first_deaths_ct"`
TradeKills int `json:"trade_kills"`
KAST int `json:"kast"`
Score int `json:"score"`
Mvp int `json:"mvp"`
} `json:"stats"`
}
// OnSeriesResultPayload Fired when a series is over. winner indicates team and side 0 if there was no winner in cases of a draw or if the series was forcefully canceled.
type OnSeriesResultPayload struct {
MatchEvent
Team1SeriesScore int `json:"team1_series_score"`
Team2SeriesScore int `json:"team2_series_score"`
Winner Winner `json:"winner"`
TimeUntilRestore int `json:"time_until_restore"`
}
// OnSidePickedPayload Fired when a side is picked by a team.
type OnSidePickedPayload struct {
MatchEvent
Team string `json:"team"`
MapName string `json:"map_name"`
Side string `json:"side"`
MapNumber int `json:"map_number"`
}
// OnMapPickedPayload Fired when a team picks a map.
type OnMapPickedPayload struct {
MatchEvent
Team string `json:"team"`
MapName string `json:"map_name"`
MapNumber int `json:"map_number"`
}
// OnMapVetoedPayload Fired when a team vetos a map.
type OnMapVetoedPayload struct {
MatchEvent
Team string `json:"team"`
MapName string `json:"map_name"`
}
// OnBackupRestorePayload Fired when a round is restored from a backup. Note that the map and round numbers indicate the round being restored to, not the round the backup was requested during.
type OnBackupRestorePayload struct {
MapEvent
RoundNumber int `json:"round_number"`
Filename string `json:"filename"`
}
// OnDemoFinishedPayload Fired when the GOTV recording has ended. This event does not fire if no demo was recorded.
type OnDemoFinishedPayload struct {
MapEvent
Filename string `json:"filename"`
}
// OnDemoUploadEndedPayload Fired when the request to upload a demo ends, regardless if it succeeds or fails. If you upload demos, you should not shut down a server until this event has fired.
type OnDemoUploadEndedPayload struct {
MapEvent
Filename string `json:"filename"`
Success bool `json:"success"`
}
// Map Flow
// OnMatchPausedPayload Fired when the match is paused.
type OnMatchPausedPayload struct {
MapEvent
Team string `json:"team"`
PauseType string `json:"pause_type"`
}
// OnMatchUnpausedPayload Fired when the match is unpaused.
type OnMatchUnpausedPayload struct {
MapEvent
Team string `json:"team"`
PauseType string `json:"pause_type"`
}
type OnPauseBeganPayload struct {
MapEvent
MapNumber int `json:"map_number"`
Team string `json:"team"`
PauseType string `json:"pause_type"`
}
// OnKnifeRoundStartedPayload Fired when the knife round starts.
type OnKnifeRoundStartedPayload struct {
MapEvent
}
// OnKnifeRoundWonPayload Fired when the knife round is over and the teams have elected to swap or stay. side represents the chosen side of the winning team, not the side that won the knife round.
type OnKnifeRoundWonPayload struct {
MapEvent
Team string `json:"team"`
Side string `json:"side"`
Swapped bool `json:"swapped"`
}
// OnTeamReadyStatusChangedPayload Fired when a team's ready status changes.
type OnTeamReadyStatusChangedPayload struct {
MatchEvent
Team *string `json:"team"` // nullable
Ready bool `json:"ready"`
GameState string `json:"game_state"`
}
// OnGoingLivePayload Fired when a map is going live.
type OnGoingLivePayload struct {
MapEvent
}
// OnRoundStartPayload Fired when a round starts (when freezetime begins).
type OnRoundStartPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
}
// OnRoundEndPayload Fired when a round ends - when the result is in; not when the round stops. Game activity can occur after this.
type OnRoundEndPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Reason int `json:"reason"`
Winner Winner `json:"winner"`
Team1 Get5StatsTeam `json:"team1"`
Team2 Get5StatsTeam `json:"team2"`
}
// Winner Winner team
type Winner struct {
Side string `json:"side"`
Team string `json:"team"`
}
// OnRoundStatsUpdatedPayload Fired after the stats update on round end.
type OnRoundStatsUpdatedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
}
// OnPlayerBecameMVPPayload Fired when a player is elected the MVP of the round.
type OnPlayerBecameMVPPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
Player Player `json:"player"`
Reason int `json:"reason"`
}
// Player player
type Player struct {
UserID int `json:"user_id"`
SteamID string `json:"SteamID"`
Side string `json:"side"`
Name string `json:"name"`
IsBot bool `json:"is_bot"`
}
// OnGrenadeThrownPayload Fired whenever a grenade is thrown by a player. The weapon property reflects the grenade used.
type OnGrenadeThrownPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
}
// Weapon Weapon
type Weapon struct {
Name string `json:"name"`
ID int `json:"id"`
}
// OnPlayerDeathPayload Fired when a player dies.
type OnPlayerDeathPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
Bomb bool `json:"bomb"`
Headshot bool `json:"headshot"`
ThruSmoke bool `json:"thru_smoke"`
Penetrated float64 `json:"penetrated"` // Potentially bool
AttackerBlind bool `json:"attacker_blind"`
NoScope bool `json:"no_scope"`
Suicide bool `json:"suicide"`
FriendlyFire bool `json:"friendly_fire"`
Attacker *Attacker `json:"attacker"` // nullable
Assist *Assist `json:"assist"` // nullable
}
// Attacker attacker player
type Attacker struct {
UserID int `json:"user_id"`
SteamID string `json:"SteamID"`
Side string `json:"side"`
Name string `json:"name"`
IsBot bool `json:"is_bot"`
}
// Assist assister data
type Assist struct {
Player Player `json:"player"`
FriendlyFire bool `json:"friendly_fire"`
FlashAssist bool `json:"flash_assist"`
}
// OnHEGrenadeDetonatedPayload Fired when an HE grenade detonates. player describes who threw the HE and victims who were affected. weapon is always an HE grenade.
type OnHEGrenadeDetonatedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
Victims []Victim `json:"victims"`
DamageEnemies int `json:"damage_enemies"`
DamageFriendlies int `json:"damage_friendlies"`
}
// Victim Victim Player
type Victim struct {
Player Player `json:"player"`
FriendlyFire bool `json:"friendly_fire"`
BlindDuration float64 `json:"blind_duration,omitempty"`
}
// OnMolotovDetonatedPayload Fired when a molotov grenade expires. player describes who threw the molotov and victims who were affected. weapon is always a molotov grenade. Note that round_time reflects the time at which the grenade detonated (started burning).
type OnMolotovDetonatedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
Victims []Victim `json:"victims"`
DamageEnemies int `json:"damage_enemies"`
DamageFriendlies int `json:"damage_friendlies"`
}
// OnFlashbangDetonatedPayload Fired when a flash bang grenade detonates. player describes who threw the flash bang and victims who were affected. weapon is always a flash bang grenade.
type OnFlashbangDetonatedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
Victims []Victim `json:"victims"`
}
// OnSmokeGrenadeDetonatedPayload Fired when an smoke grenade expires. player describes who threw the grenade. weapon is always a smoke grenade.
type OnSmokeGrenadeDetonatedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
ExtinguishedMolotov bool `json:"extinguished_molotov"`
}
// OnDecoyStartedPayload Fired when a decoy starts making noise. player describes who threw the grenade. weapon is always a decoy grenade.
type OnDecoyStartedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Weapon Weapon `json:"weapon"`
}
// OnBombPlantedPayload Fired when the bomb is planted. player describes who planted the bomb.
type OnBombPlantedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Site string `json:"site"`
}
// OnBombDefusedPayload Fired when the bomb is defused. player describes who defused the bomb.
type OnBombDefusedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Site string `json:"site"`
BombTimeRemaining int `json:"bomb_time_remaining"`
}
// OnBombExplodedPayload Fired when the bomb explodes.
type OnBombExplodedPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Site string `json:"site"`
}
// OnPlayerConnectedPayload Fired when a player connects to the server.
type OnPlayerConnectedPayload struct {
MatchEvent
Player Player `json:"player"`
IPAddress string `json:"ip_address"`
}
// OnPlayerDisconnectedPayload Fired when a player disconnects from the server.
type OnPlayerDisconnectedPayload struct {
MatchEvent
Player Player `json:"player"`
}
// OnPlayerSayPayload Fired when a player types in chat.
type OnPlayerSayPayload struct {
MapEvent
RoundNumber int `json:"round_number"`
RoundTime int `json:"round_time"`
Player Player `json:"player"`
Command string `json:"command"`
Message string `json:"message"`
}