-
Notifications
You must be signed in to change notification settings - Fork 396
/
constants.go
541 lines (488 loc) · 14.5 KB
/
constants.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
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
// This file is automatically generated. Do not edit.
package pyx
import ()
// AjaxOperation
const (
AjaxOperation_NAMES = "gn"
AjaxOperation_SCORE = "SC"
AjaxOperation_LEAVE_GAME = "lg"
AjaxOperation_JOIN_GAME = "jg"
AjaxOperation_CHAT = "c"
AjaxOperation_GAME_LIST = "ggl"
AjaxOperation_CARDCAST_ADD_CARDSET = "cac"
AjaxOperation_CARDCAST_LIST_CARDSETS = "clc"
AjaxOperation_PLAY_CARD = "pc"
AjaxOperation_CHANGE_GAME_OPTIONS = "cgo"
AjaxOperation_GET_GAME_INFO = "ggi"
AjaxOperation_GET_CARDS = "gc"
AjaxOperation_ADMIN_SET_VERBOSE_LOG = "svl"
AjaxOperation_REGISTER = "r"
AjaxOperation_CARDCAST_REMOVE_CARDSET = "crc"
AjaxOperation_WHOIS = "Wi"
AjaxOperation_KICK = "K"
AjaxOperation_FIRST_LOAD = "fl"
AjaxOperation_START_GAME = "sg"
AjaxOperation_LOG_OUT = "lo"
AjaxOperation_BAN = "b"
AjaxOperation_CREATE_GAME = "cg"
AjaxOperation_STOP_GAME = "Sg"
AjaxOperation_GAME_CHAT = "GC"
AjaxOperation_SPECTATE_GAME = "vg"
AjaxOperation_JUDGE_SELECT = "js"
)
// AjaxRequest
const (
AjaxRequest_SERIAL = "s"
AjaxRequest_OP = "o"
AjaxRequest_WALL = "wall"
AjaxRequest_PERSISTENT_ID = "pid"
AjaxRequest_EMOTE = "me"
AjaxRequest_CARDCAST_ID = "cci"
AjaxRequest_GAME_ID = "gid"
AjaxRequest_GAME_OPTIONS = "go"
AjaxRequest_MESSAGE = "m"
AjaxRequest_NICKNAME = "n"
AjaxRequest_PASSWORD = "pw"
AjaxRequest_CARD_ID = "cid"
AjaxRequest_ID_CODE = "idc"
)
type AjaxRequest struct {
Serial int `json:"s"`
Op string `json:"o"`
Wall bool `json:"wall"`
PersistentId string `json:"pid"`
Emote bool `json:"me"`
CardcastId string `json:"cci"`
GameId int `json:"gid"`
GameOptions GameOptionData `json:"go"`
Message string `json:"m"`
Nickname string `json:"n"`
Password string `json:"pw"`
CardId int `json:"cid"`
IdCode string `json:"idc"`
}
// AjaxResponse
const (
AjaxResponse_NAMES = "nl"
AjaxResponse_CLIENT_NAME = "cn"
AjaxResponse_GAME_CHAT_ENABLED = "Gce"
AjaxResponse_PLAYER_INFO = "pi"
AjaxResponse_CONNECTED_AT = "ca"
AjaxResponse_WHITE_CARDS = "wc"
AjaxResponse_HAND = "h"
AjaxResponse_ERROR_CODE = "ec"
AjaxResponse_GLOBAL_CHAT_ENABLED = "gce"
AjaxResponse_SERVER_STARTED = "SS"
AjaxResponse_NEXT = "next"
AjaxResponse_GAME_INFO = "gi"
AjaxResponse_ERROR = "e"
AjaxResponse_GAME_STATE_DESCRIPTION = "gss"
AjaxResponse_ID_CODE = "idc"
AjaxResponse_CARD_SETS = "css"
AjaxResponse_SERIAL = "s"
AjaxResponse_PERSISTENT_ID = "pid"
AjaxResponse_USER_PERMALINK = "up"
AjaxResponse_GAMES = "gl"
AjaxResponse_SIGIL = "?"
AjaxResponse_GAME_ID = "gid"
AjaxResponse_MAX_GAMES = "mg"
AjaxResponse_IN_PROGRESS = "ip"
AjaxResponse_GAME_OPTIONS = "go"
AjaxResponse_NICKNAME = "n"
AjaxResponse_BLACK_CARD = "bc"
AjaxResponse_GAME_PERMALINK = "gp"
AjaxResponse_IDLE = "idl"
AjaxResponse_CARD_ID = "cid"
AjaxResponse_IP_ADDRESS = "IP"
AjaxResponse_SESSION_PERMALINK = "sP"
)
type AjaxResponse struct {
Names []string `json:"nl"`
ClientName string `json:"cn"`
GameChatEnabled bool `json:"Gce"`
PlayerInfo []GamePlayerInfo `json:"pi"`
ConnectedAt int64 `json:"ca"`
WhiteCards []int `json:"wc"`
Hand []int `json:"h"`
ErrorCode string `json:"ec"`
GlobalChatEnabled bool `json:"gce"`
ServerStarted int64 `json:"SS"`
Next string `json:"next"`
GameInfo GameInfo `json:"gi"`
Error bool `json:"e"`
GameStateDescription string `json:"gss"`
IdCode string `json:"idc"`
CardSets []CardSetData `json:"css"`
Serial int `json:"s"`
PersistentId string `json:"pid"`
UserPermalink string `json:"up"`
Games []GameInfo `json:"gl"`
Sigil string `json:"?"`
GameId *int `json:"gid"`
MaxGames int `json:"mg"`
InProgress bool `json:"ip"`
GameOptions GameOptionData `json:"go"`
Nickname string `json:"n"`
BlackCard int `json:"bc"`
GamePermalink string `json:"gp"`
Idle int64 `json:"idl"`
CardId int `json:"cid"`
IpAddress string `json:"IP"`
SessionPermalink string `json:"sP"`
}
// BlackCardData
const (
BlackCardData_DRAW = "D"
BlackCardData_PICK = "PK"
BlackCardData_TEXT = "T"
BlackCardData_ID = "cid"
BlackCardData_WATERMARK = "W"
)
type BlackCardData struct {
Draw int `json:"D"`
Pick int `json:"PK"`
Text string `json:"T"`
Id int `json:"cid"`
Watermark string `json:"W"`
}
// CardSetData
const (
CardSetData_WHITE_CARDS_IN_DECK = "wcid"
CardSetData_BLACK_CARDS_IN_DECK = "bcid"
CardSetData_CARD_SET_NAME = "csn"
CardSetData_CARD_SET_DESCRIPTION = "csd"
CardSetData_BASE_DECK = "bd"
CardSetData_ID = "cid"
CardSetData_WEIGHT = "w"
)
type CardSetData struct {
WhiteCardsInDeck int `json:"wcid"`
BlackCardsInDeck int `json:"bcid"`
CardSetName string `json:"csn"`
CardSetDescription string `json:"csd"`
BaseDeck bool `json:"bd"`
Id int `json:"cid"`
Weight int `json:"w"`
}
// DisconnectReason
const (
DisconnectReason_PING_TIMEOUT = "pt"
DisconnectReason_BANNED = "B&"
DisconnectReason_IDLE_TIMEOUT = "it"
DisconnectReason_KICKED = "k"
DisconnectReason_MANUAL = "man"
)
var DisconnectReasonMsgs = map[string]string{
"B&": "Banned",
"pt": "Ping timeout",
"it": "Kicked due to idle",
"k": "Kicked by server administrator",
"man": "Leaving",
}
// ErrorCode
const (
ErrorCode_INVALID_NICK = "in"
ErrorCode_TOO_MANY_USERS = "tmu"
ErrorCode_NOT_GAME_HOST = "ngh"
ErrorCode_MESSAGE_TOO_LONG = "mtl"
ErrorCode_NO_NICK_SPECIFIED = "nns"
ErrorCode_REPEATED_WORDS = "rW"
ErrorCode_BANNED = "B&"
ErrorCode_WRONG_PASSWORD = "wp"
ErrorCode_RESERVED_NICK = "rn"
ErrorCode_TOO_MANY_GAMES = "tmg"
ErrorCode_INVALID_ID_CODE = "iid"
ErrorCode_CANNOT_JOIN_ANOTHER_GAME = "cjag"
ErrorCode_NO_MSG_SPECIFIED = "nms"
ErrorCode_CAPSLOCK = "CL"
ErrorCode_ALREADY_STARTED = "as"
ErrorCode_NOT_ADMIN = "na"
ErrorCode_INVALID_GAME = "ig"
ErrorCode_NO_SESSION = "ns"
ErrorCode_ACCESS_DENIED = "ad"
ErrorCode_NICK_IN_USE = "niu"
ErrorCode_NOT_JUDGE = "nj"
ErrorCode_SERVER_ERROR = "serr"
ErrorCode_CARDCAST_INVALID_ID = "cii"
ErrorCode_TOO_FAST = "tf"
ErrorCode_NOT_ENOUGH_CARDS = "nec"
ErrorCode_NO_CARD_SPECIFIED = "ncs"
ErrorCode_REPEAT_MESSAGE = "rm"
ErrorCode_NO_GAME_SPECIFIED = "ngs"
ErrorCode_OP_NOT_SPECIFIED = "ons"
ErrorCode_TOO_MANY_SPECIAL_CHARACTERS = "tmsc"
ErrorCode_BAD_REQUEST = "br"
ErrorCode_NOT_ENOUGH_PLAYERS = "nep"
ErrorCode_CARDCAST_CANNOT_FIND = "ccf"
ErrorCode_NOT_IN_THAT_GAME = "nitg"
ErrorCode_NO_SUCH_USER = "nsu"
ErrorCode_NOT_REGISTERED = "nr"
ErrorCode_BAD_OP = "bo"
ErrorCode_DO_NOT_HAVE_CARD = "dnhc"
ErrorCode_NOT_YOUR_TURN = "nyt"
ErrorCode_PLAYED_ALL_CARDS = "pac"
ErrorCode_NOT_ENOUGH_SPACES = "nes"
ErrorCode_ALREADY_STOPPED = "aS"
ErrorCode_SESSION_EXPIRED = "se"
ErrorCode_GAME_FULL = "gf"
ErrorCode_INVALID_CARD = "ic"
)
var ErrorCodeMsgs = map[string]string{
"cii": "Invalid Cardcast ID. Must be exactly 5 characters.",
"nr": "Not registered. Refresh the page.",
"iid": "Identification code, if provided, must be between 8 and 100 characters, inclusive.",
"ns": "Session not detected. Make sure you have cookies enabled.",
"ccf": "Cannot find Cardcast deck with given ID. If you just added this deck to Cardcast, wait a few minutes and try again.",
"nyt": "It is not your turn to play a card.",
"bo": "Invalid operation.",
"nec": "You must add card sets containing at least 50 black cards and 20 times the player limit white cards.",
"ngh": "Only the game host can do that.",
"tmg": "There are too many games already in progress. Either join an existing game, or wait for one to become available.",
"br": "Bad request.",
"nsu": "No such user.",
"aS": "The game has already stopped.",
"se": "Your session has expired. Refresh the page.",
"pac": "You already played all the necessary cards!",
"nms": "No message specified.",
"nep": "There are not enough players to start the game.",
"wp": "That password is incorrect.",
"ic": "Invalid card specified.",
"niu": "Nickname is already in use.",
"ngs": "No game specified.",
"nes": "You must use more words in a message that long.",
"nitg": "You are not in that game.",
"tmu": "There are too many users connected. Either join another server, or wait for a user to disconnect.",
"ig": "Invalid game specified.",
"gf": "That game is full. Join another.",
"ncs": "No card specified.",
"ad": "Access denied.",
"cjag": "You cannot join another game.",
"B&": "Banned.",
"mtl": "Messages cannot be longer than 200 characters.",
"in": "Nickname must contain only upper and lower case letters, numbers, or underscores, must be 3 to 30 characters long, and must not start with a number.",
"rW": "You must use more unique words in your message.",
"serr": "An error occurred on the server.",
"CL": "Try turning caps lock off.",
"dnhc": "You don't have that card.",
"as": "The game has already started.",
"nns": "No nickname specified.",
"tf": "You are chatting too fast. Wait a few seconds and try again.",
"na": "You are not an administrator.",
"ons": "Operation not specified.",
"rm": "You can't repeat the same message multiple times in a row.",
"nj": "You are not the judge.",
"rn": "That nick is reserved.",
"tmsc": "You used too many special characters in that message.",
}
// ErrorInformation
const (
ErrorInformation_WHITE_CARDS_PRESENT = "wcp"
ErrorInformation_WHITE_CARDS_REQUIRED = "wcr"
ErrorInformation_BLACK_CARDS_REQUIRED = "bcr"
ErrorInformation_BLACK_CARDS_PRESENT = "bcp"
)
// GameInfo
const (
GameInfo_GAME_OPTIONS = "go"
GameInfo_CREATED = "gca"
GameInfo_PLAYERS = "P"
GameInfo_SPECTATORS = "V"
GameInfo_HOST = "H"
GameInfo_STATE = "S"
GameInfo_ID = "gid"
GameInfo_HAS_PASSWORD = "hp"
)
type GameInfo struct {
GameOptions GameOptionData `json:"go"`
Created int64 `json:"gca"`
Players []string `json:"P"`
Spectators []string `json:"V"`
Host string `json:"H"`
State string `json:"S"`
Id int `json:"gid"`
HasPassword bool `json:"hp"`
}
// GameOptionData
const (
GameOptionData_TIMER_MULTIPLIER = "tm"
GameOptionData_PASSWORD = "pw"
GameOptionData_SPECTATOR_LIMIT = "vL"
GameOptionData_SCORE_LIMIT = "sl"
GameOptionData_BLANKS_LIMIT = "bl"
GameOptionData_PLAYER_LIMIT = "pL"
GameOptionData_CARD_SETS = "css"
)
type GameOptionData struct {
TimerMultiplier string `json:"tm"`
Password string `json:"pw"`
SpectatorLimit int `json:"vL"`
ScoreLimit int `json:"sl"`
BlanksLimit int `json:"bl"`
PlayerLimit int `json:"pL"`
CardSets []int `json:"css"`
}
// GamePlayerInfo
const (
GamePlayerInfo_STATUS = "st"
GamePlayerInfo_SCORE = "sc"
GamePlayerInfo_NAME = "N"
)
type GamePlayerInfo struct {
Status string `json:"st"`
Score int `json:"sc"`
Name string `json:"N"`
}
// GamePlayerStatus
const (
GamePlayerStatus_SPECTATOR = "sv"
GamePlayerStatus_WINNER = "sw"
GamePlayerStatus_IDLE = "si"
GamePlayerStatus_HOST = "sh"
GamePlayerStatus_JUDGING = "sjj"
GamePlayerStatus_JUDGE = "sj"
GamePlayerStatus_PLAYING = "sp"
)
var GamePlayerStatusMsgs = map[string]string{
"sjj": "Selecting",
"sv": "Spectator",
"sw": "Winner!",
"sh": "Host",
"si": "",
"sj": "Card Czar",
"sp": "Playing",
}
var GamePlayerStatusMsgs2 = map[string]string{
"sjj": "Select a winning card.",
"sv": "You are just spectating.",
"sw": "You have won!",
"sh": "Wait for players then click Start Game.",
"si": "Waiting for players...",
"sj": "You are the Card Czar.",
"sp": "Select a card to play.",
}
// GameState
const (
GameState_ROUND_OVER = "ro"
GameState_LOBBY = "l"
GameState_JUDGING = "j"
GameState_PLAYING = "p"
)
var GameStateMsgs = map[string]string{
"p": "In Progress",
"j": "In Progress",
"l": "Not Started",
"ro": "In Progress",
}
// LongPollEvent
const (
LongPollEvent_GAME_ROUND_COMPLETE = "grc"
LongPollEvent_BANNED = "B&"
LongPollEvent_NOOP = "_"
LongPollEvent_CHAT = "c"
LongPollEvent_GAME_PLAYER_INFO_CHANGE = "gpic"
LongPollEvent_HAND_DEAL = "hd"
LongPollEvent_CARDCAST_ADD_CARDSET = "cac"
LongPollEvent_PLAYER_LEAVE = "pl"
LongPollEvent_GAME_BLACK_RESHUFFLE = "gbr"
LongPollEvent_GAME_JUDGE_SKIPPED = "gjs"
LongPollEvent_GAME_LIST_REFRESH = "glr"
LongPollEvent_NEW_PLAYER = "np"
LongPollEvent_GAME_PLAYER_SKIPPED = "gps"
LongPollEvent_GAME_PLAYER_JOIN = "gpj"
LongPollEvent_GAME_WHITE_RESHUFFLE = "gwr"
LongPollEvent_CARDCAST_REMOVE_CARDSET = "crc"
LongPollEvent_GAME_OPTIONS_CHANGED = "goc"
LongPollEvent_GAME_PLAYER_KICKED_IDLE = "gpki"
LongPollEvent_GAME_SPECTATOR_LEAVE = "gvl"
LongPollEvent_GAME_PLAYER_LEAVE = "gpl"
LongPollEvent_GAME_SPECTATOR_JOIN = "gvj"
LongPollEvent_HURRY_UP = "hu"
LongPollEvent_GAME_JUDGE_LEFT = "gjl"
LongPollEvent_KICKED = "k"
LongPollEvent_KICKED_FROM_GAME_IDLE = "kfgi"
LongPollEvent_FILTERED_CHAT = "FC"
LongPollEvent_GAME_STATE_CHANGE = "gsc"
)
// LongPollResponse
const (
LongPollResponse_PLAY_TIMER = "Pt"
LongPollResponse_PLAYER_INFO = "pi"
LongPollResponse_FROM = "f"
LongPollResponse_WHITE_CARDS = "wc"
LongPollResponse_EVENT = "E"
LongPollResponse_HAND = "h"
LongPollResponse_ERROR_CODE = "ec"
LongPollResponse_MESSAGE = "m"
LongPollResponse_WINNING_CARD = "WC"
LongPollResponse_FROM_ADMIN = "fa"
LongPollResponse_TIMESTAMP = "ts"
LongPollResponse_GAME_INFO = "gi"
LongPollResponse_ERROR = "e"
LongPollResponse_ID_CODE = "idc"
LongPollResponse_REASON = "qr"
LongPollResponse_WALL = "wall"
LongPollResponse_ROUND_WINNER = "rw"
LongPollResponse_SIGIL = "?"
LongPollResponse_EMOTE = "me"
LongPollResponse_CARDCAST_DECK_INFO = "cdi"
LongPollResponse_GAME_ID = "gid"
LongPollResponse_ROUND_PERMALINK = "rP"
LongPollResponse_NICKNAME = "n"
LongPollResponse_BLACK_CARD = "bc"
LongPollResponse_GAME_PERMALINK = "gp"
LongPollResponse_GAME_STATE = "gs"
LongPollResponse_INTERMISSION = "i"
)
type LongPollResponse struct {
PlayTimer int `json:"Pt"`
PlayerInfo []GamePlayerInfo `json:"pi"`
From string `json:"f"`
WhiteCards [][]WhiteCardData `json:"wc"`
Event string `json:"E"`
Hand []WhiteCardData `json:"h"`
ErrorCode string `json:"ec"`
Message string `json:"m"`
WinningCard int `json:"WC"`
FromAdmin bool `json:"fa"`
Timestamp int64 `json:"ts"`
GameInfo GameInfo `json:"gi"`
Error bool `json:"e"`
IdCode string `json:"idc"`
Reason string `json:"qr"`
Wall bool `json:"wall"`
RoundWinner string `json:"rw"`
Sigil string `json:"?"`
Emote bool `json:"me"`
CardcastDeckInfo string `json:"cdi"`
GameId *int `json:"gid"`
RoundPermalink string `json:"rP"`
Nickname string `json:"n"`
BlackCard BlackCardData `json:"bc"`
GamePermalink string `json:"gp"`
GameState string `json:"gs"`
Intermission int `json:"i"`
}
// ReconnectNextAction
const (
ReconnectNextAction_GAME = "game"
ReconnectNextAction_NONE = "none"
)
// Sigil
const (
Sigil_NORMAL_USER = ""
Sigil_ADMIN = "@"
Sigil_ID_CODE = "+"
)
// WhiteCardData
const (
WhiteCardData_WRITE_IN = "wi"
WhiteCardData_TEXT = "T"
WhiteCardData_ID = "cid"
WhiteCardData_WATERMARK = "W"
)
type WhiteCardData struct {
WriteIn bool `json:"wi"`
Text string `json:"T"`
Id int `json:"cid"`
Watermark string `json:"W"`
}