-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathactionHandlers.ts
More file actions
841 lines (736 loc) · 20.1 KB
/
actionHandlers.ts
File metadata and controls
841 lines (736 loc) · 20.1 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
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
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
import type Client from "./Client.js";
import GameModes from "./GameMode.js";
import { InsaneInt } from "./InsaneInt.js";
import Lobby, { getEnemy } from "./Lobby.js";
import type {
ActionCreateLobby,
ActionEatPizza,
ActionHandlerArgs,
ActionHandlers,
ActionJoinLobby,
ActionRejoinLobby,
ActionMagnet,
ActionMagnetResponse,
ActionPlayHand,
ActionReceiveEndGameJokersRequest,
ActionReceiveNemesisDeckRequest,
ActionReceiveNemesisStatsRequest,
ActionRemovePhantom,
ActionSendPhantom,
ActionSetAnte,
ActionSetLocation,
ActionSetFurthestBlind,
ActionSkip,
ActionSpentLastShop,
ActionStartAnteTimer,
ActionPauseAnteTimer,
ActionSyncClient,
ActionUsername,
ActionVersion,
ActionTcgServerVersion,
ActionTcgBet,
ActionTcgPlayerStatusRequest,
ActionTcgEndTurn,
ActionModded,
ActionModdedRequest,
ActionHandyMPExtensionEnable,
ActionHandyMPExtensionDisable,
} from "./actions.js";
import { generateSeed } from "./utils.js";
/** Current TCG server version - clients must match this to use TCG features */
const TCG_SERVER_VERSION = 1;
const usernameAction = (
{ username, modHash }: ActionHandlerArgs<ActionUsername>,
client: Client,
) => {
client.setUsername(username);
client.setModHash(modHash);
};
const createLobbyAction = (
{ gameMode }: ActionHandlerArgs<ActionCreateLobby>,
client: Client,
) => {
/** Also sets the client lobby to this newly created one */
new Lobby(client, gameMode);
};
const joinLobbyAction = (
{ code }: ActionHandlerArgs<ActionJoinLobby>,
client: Client,
) => {
const newLobby = Lobby.get(code);
if (!newLobby) {
client.sendAction({
action: "error",
message: "Lobby does not exist.",
});
return;
}
newLobby.join(client);
};
const leaveLobbyAction = (client: Client) => {
client.lobby?.leave(client);
};
/** Called when a client's TCP connection drops (not voluntary) */
const disconnectFromLobbyAction = (client: Client) => {
client.lobby?.disconnect(client);
};
const rejoinLobbyAction = (
{ code, reconnectToken }: ActionHandlerArgs<ActionRejoinLobby>,
client: Client,
): Client | undefined => {
const lobby = Lobby.get(code);
if (!lobby) {
client.sendAction({
action: "error",
message: "Lobby no longer exists.",
});
return;
}
const restoredClient = lobby.rejoin(client, reconnectToken);
if (!restoredClient) {
client.sendAction({
action: "error",
message: "Could not rejoin lobby. Token invalid or slot expired.",
});
return;
}
return restoredClient;
};
const lobbyInfoAction = (client: Client) => {
client.lobby?.broadcastLobbyInfo();
};
const readyLobbyAction = (client: Client) => {
client.isReadyLobby = true;
client.lobby?.broadcastLobbyInfo();
};
const unreadyLobbyAction = (client: Client) => {
client.isReadyLobby = false;
client.lobby?.broadcastLobbyInfo();
};
const keepAliveAction = (client: Client) => {
// Send an ack back to the received keepAlive
client.sendAction({ action: "keepAliveAck" });
};
const startGameAction = (client: Client) => {
const lobby = client.lobby;
// Only allow the host to start the game
if (!lobby || lobby.host?.id !== client.id) {
return;
}
// Only start the game if guest is ready
// TODO: Uncomment this when Client ready is released in the mod
// if (!lobby.guest?.isReadyLobby) {
// return;
// }
const lives = lobby.options.starting_lives
? Number.parseInt(lobby.options.starting_lives)
: GameModes[lobby.gameMode].startingLives;
lobby.isInGame = true;
lobby.broadcastAction({
action: "startGame",
deck: "c_multiplayer_1",
seed: lobby.options.different_seeds ? undefined : generateSeed(),
});
// Reset players' lives
lobby.setPlayersLives(lives);
// Unready guest for next game
if (lobby.guest) {
lobby.guest.isReadyLobby = false;
}
};
const readyBlindAction = (client: Client) => {
client.isReady = true;
const [lobby, enemy] = getEnemy(client);
if (!client.firstReady && !enemy?.isReady && !enemy?.firstReady) {
client.firstReady = true;
if (lobby) lobby.firstReadyAt = Date.now();
client.sendAction({ action: "speedrun" });
}
// TODO: Refactor for more than two players
if (client.lobby?.host?.isReady && client.lobby.guest?.isReady) {
// Grant speedrun to second player if within 30s of the first
if (lobby?.firstReadyAt && (Date.now() - lobby.firstReadyAt) <= 30000) {
client.sendAction({ action: "speedrun" });
}
lobby!.firstReadyAt = null;
// Reset ready status for next blind
client.lobby.host.isReady = false;
client.lobby.guest.isReady = false;
// Reset scores for next blind
client.lobby.host.score = new InsaneInt(0, 0, 0);
client.lobby.guest.score = new InsaneInt(0, 0, 0);
// Reset hands left for next blind
client.lobby.host.handsLeft = 4;
client.lobby.guest.handsLeft = 4;
client.lobby.broadcastAction({ action: "startBlind" });
}
};
const unreadyBlindAction = (client: Client) => {
client.isReady = false;
};
const playHandAction = (
{ handsLeft, score }: ActionHandlerArgs<ActionPlayHand>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (
lobby === null ||
enemy === null ||
lobby.host === null ||
lobby.guest === null
) {
stopGameAction(client);
return;
}
client.score = InsaneInt.fromString(String(score));
client.handsLeft =
typeof handsLeft === "number" ? handsLeft : Number(handsLeft);
enemy.sendAction({
action: "enemyInfo",
handsLeft,
score: client.score.toString(),
skips: client.skips,
lives: client.lives,
});
// This info is only sent on a boss blind, so it shouldn't
// affect other blinds
if (
(lobby.guest.handsLeft === 0 &&
lobby.guest.score.lessThan(lobby.host.score)) ||
(lobby.host.handsLeft === 0 &&
lobby.host.score.lessThan(lobby.guest.score)) ||
(lobby.host.handsLeft === 0 && lobby.guest.handsLeft === 0)
) {
const roundWinner = lobby.guest.score.lessThan(lobby.host.score)
? lobby.host
: lobby.guest;
const roundLoser =
roundWinner.id === lobby.host.id ? lobby.guest : lobby.host;
if (!lobby.host.score.equalTo(lobby.guest.score)) {
roundLoser.loseLife();
// If no lives are left, we end the game
if (lobby.host.lives === 0 || lobby.guest.lives === 0) {
const gameWinner =
lobby.host.lives > lobby.guest.lives ? lobby.host : lobby.guest;
const gameLoser =
gameWinner.id === lobby.host.id ? lobby.guest : lobby.host;
gameWinner?.sendAction({ action: "winGame" });
gameLoser?.sendAction({ action: "loseGame" });
roundWinner.firstReady = false;
roundLoser.firstReady = false;
return;
}
}
roundWinner.firstReady = false;
roundLoser.firstReady = false;
roundWinner.sendAction({ action: "endPvP", lost: false });
roundLoser.sendAction({
action: "endPvP",
lost: !lobby.guest.score.equalTo(lobby.host.score),
});
}
};
const stopGameAction = (client: Client) => {
if (!client.lobby) {
return;
}
client.lobby.broadcastAction({ action: "stopGame" });
client.lobby.resetPlayers();
};
// Deprecated
const gameInfoAction = (client: Client) => {
client.lobby?.sendGameInfo(client);
};
const lobbyOptionsAction = (
options: Record<string, string>,
client: Client,
) => {
client.lobby?.setOptions(options);
};
const failRoundAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
if (lobby.options.death_on_round_loss) {
client.loseLife();
}
if (client.lives === 0) {
if (lobby.gameMode === "survival") {
if (enemy.lives === 0) {
if (client.furthestBlind === enemy.furthestBlind) {
//Survival draw behavior, both players win by default
client.sendAction({ action: "winGame" });
enemy.sendAction({ action: "winGame" });
} else if (client.furthestBlind < enemy.furthestBlind) {
client.sendAction({ action: "loseGame" });
enemy.sendAction({ action: "winGame" });
}
//Otherwise do nothing
} else {
if (client.furthestBlind < enemy.furthestBlind) {
client.sendAction({ action: "loseGame" });
enemy.sendAction({ action: "winGame" });
}
//Otherwise do nothing
}
} else {
let gameLoser = null;
let gameWinner = null;
if (client.id === lobby.host?.id) {
gameLoser = lobby.host;
gameWinner = lobby.guest;
} else {
gameLoser = lobby.guest;
gameWinner = lobby.host;
}
gameWinner?.sendAction({ action: "winGame" });
gameLoser?.sendAction({ action: "loseGame" });
}
}
};
const setAnteAction = (
{ ante }: ActionHandlerArgs<ActionSetAnte>,
client: Client,
) => {
client.ante = ante;
};
// TODO: Fix this
const serverVersion = "0.3.0-MULTIPLAYER";
/** Verifies the client version and allows connection if it matches the server's */
const versionAction = (
{ version }: ActionHandlerArgs<ActionVersion>,
client: Client,
) => {
const versionMatch = version.match(/^(\d+\.\d+\.\d+)/);
if (versionMatch) {
const clientVersion = versionMatch[1];
const serverVersionNumber = serverVersion.split("-")[0];
const [clientMajor, clientMinor, clientPatch] = clientVersion
.split(".")
.map(Number);
const [serverMajor, serverMinor, serverPatch] = serverVersionNumber
.split(".")
.map(Number);
if (
clientMajor < serverMajor ||
(clientMajor === serverMajor && clientMinor < serverMinor) ||
(clientMajor === serverMajor &&
clientMinor === serverMinor &&
clientPatch < serverPatch)
) {
client.sendAction({
action: "error",
message: `[WARN] Server expecting version ${serverVersion}`,
});
}
}
};
const setLocationAction = (
{ location }: ActionHandlerArgs<ActionSetLocation>,
client: Client,
) => {
client.setLocation(location);
};
const newRoundAction = (client: Client) => {
client.resetBlocker();
};
const setFurthestBlindAction = (
{ furthestBlind }: ActionHandlerArgs<ActionSetFurthestBlind>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
client.furthestBlind = furthestBlind;
if (!lobby || !enemy) return;
//If enemy died and client.furthestBlind is bigger, client wins
if (
lobby.gameMode === "survival" &&
enemy.lives === 0 &&
client.furthestBlind > enemy.furthestBlind
) {
client.sendAction({ action: "winGame" });
enemy.sendAction({ action: "loseGame" });
}
};
const skipAction = (
{ skips }: ActionHandlerArgs<ActionSkip>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
client.setSkips(skips);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "enemyInfo",
handsLeft: client.handsLeft,
score: client.score.toString(),
skips: client.skips,
lives: client.lives,
});
};
const sendPhantomAction = (
{ key }: ActionHandlerArgs<ActionSendPhantom>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "sendPhantom",
key,
});
};
const removePhantomAction = (
{ key }: ActionHandlerArgs<ActionRemovePhantom>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "removePhantom",
key,
});
};
const asteroidAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "asteroid",
});
};
const letsGoGamblingNemesisAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "letsGoGamblingNemesis",
});
};
const eatPizzaAction = (
{ whole }: ActionHandlerArgs<ActionEatPizza>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "eatPizza",
whole,
});
};
const soldJokerAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "soldJoker",
});
};
const spentLastShopAction = (
{ amount }: ActionHandlerArgs<ActionSpentLastShop>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "spentLastShop",
amount,
});
};
const magnetAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "magnet",
});
};
const magnetResponseAction = (
{ key }: ActionHandlerArgs<ActionMagnetResponse>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "magnetResponse",
key,
});
};
const getEndGameJokersAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "getEndGameJokers",
});
};
const receiveEndGameJokersAction = (
{ keys }: ActionHandlerArgs<ActionReceiveEndGameJokersRequest>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "receiveEndGameJokers",
keys,
});
};
const getNemesisDeckAction = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "getNemesisDeck",
});
};
const receiveNemesisDeckAction = (
{ cards }: ActionHandlerArgs<ActionReceiveNemesisDeckRequest>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "receiveNemesisDeck",
cards,
});
};
const requestNemesisStatsActionHandler = (client: Client) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "endGameStatsRequested",
});
};
const receiveNemesisStatsActionHandler = (
stats: ActionHandlerArgs<ActionReceiveNemesisStatsRequest>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "nemesisEndGameStats",
...stats,
});
};
const startAnteTimerAction = (
{ time }: ActionHandlerArgs<ActionStartAnteTimer>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "startAnteTimer",
time,
});
};
const pauseAnteTimerAction = (
{ time }: ActionHandlerArgs<ActionPauseAnteTimer>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
enemy.sendAction({
action: "pauseAnteTimer",
time,
});
};
const failTimerAction = (client: Client) => {
const lobby = client.lobby;
client.loseLife();
if (!lobby) return;
if (client.lives === 0) {
let gameLoser = null;
let gameWinner = null;
if (client.id === lobby.host?.id) {
gameLoser = lobby.host;
gameWinner = lobby.guest;
} else {
gameLoser = lobby.guest;
gameWinner = lobby.host;
}
gameWinner?.sendAction({ action: "winGame" });
gameLoser?.sendAction({ action: "loseGame" });
}
};
const syncClientAction = (
{ isCached }: ActionHandlerArgs<ActionSyncClient>,
client: Client,
) => {
client.isCached = isCached;
};
// TCG Action Handlers
const tcgServerVersionAction = (
{ version }: ActionHandlerArgs<ActionTcgServerVersion>,
client: Client,
) => {
// Only send tcg_compatible if the client's version is compatible (>= server version)
if (version >= TCG_SERVER_VERSION) {
client.sendAction({ action: "tcg_compatible" });
}
};
const startTcgBettingAction = (client: Client) => {
const lobby = client.lobby;
// Only allow the host to start the TCG game
if (!lobby || lobby.host?.id !== client.id) {
return;
}
// Clear any existing bets
lobby.tcgBets.clear();
// Broadcast startGame with seed to both players
lobby.broadcastAction({
action: "startGame",
deck: "c_multiplayer_1",
seed: generateSeed(),
});
};
const tcgBetAction = (
{ bet }: ActionHandlerArgs<ActionTcgBet>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
// Store this client's bet
lobby.tcgBets.set(client.id, bet);
// Check if both players have bet
if (!lobby.host || !lobby.guest) return;
if (!lobby.tcgBets.has(lobby.host.id) || !lobby.tcgBets.has(lobby.guest.id)) {
return;
}
// Both players have bet, determine winner
const hostBet = lobby.tcgBets.get(lobby.host.id) ?? 0;
const guestBet = lobby.tcgBets.get(lobby.guest.id) ?? 0;
let winner: Client;
let loser: Client;
if (hostBet > guestBet) {
winner = lobby.host;
loser = lobby.guest;
} else if (guestBet > hostBet) {
winner = lobby.guest;
loser = lobby.host;
} else {
// Equal bets - flip a coin
if (Math.random() < 0.5) {
winner = lobby.host;
loser = lobby.guest;
} else {
winner = lobby.guest;
loser = lobby.host;
}
}
const winnerBet = lobby.tcgBets.get(winner.id) ?? 0;
// Winner receives their bet as damage and starts first
winner.sendAction({
action: "tcgStartGame",
damage: winnerBet,
starting: true,
});
// Loser receives 0 damage and doesn't start
loser.sendAction({
action: "tcgStartGame",
damage: 0,
starting: false,
});
// Clear bets for next round
lobby.tcgBets.clear();
};
const tcgPlayerStatusAction = (
args: ActionHandlerArgs<ActionTcgPlayerStatusRequest>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
// Echo the action to the other player
enemy.sendAction({
action: "tcgPlayerStatus",
...args,
});
};
const tcgEndTurnAction = (
args: ActionHandlerArgs<ActionTcgEndTurn>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
// Send tcgStartTurn to the other player with the same parameters
enemy.sendAction({
action: "tcgStartTurn",
...args,
});
};
const moddedAction = (
args: ActionHandlerArgs<ActionModdedRequest>,
client: Client,
) => {
const [lobby, enemy] = getEnemy(client);
if (!lobby || !enemy) return;
const target = args.target as string | undefined;
const { target: _, ...rest } = args;
const from = lobby.host?.id === client.id ? "host" : "guest";
const message = { action: "moddedAction" as const, from, ...rest } as ActionModded;
const relayTarget = target ?? "nemesis";
if (relayTarget === "all") {
lobby.broadcastAction(message);
} else {
enemy.sendAction(message);
}
};
const handyMPExtensionEnable = (
args: ActionHandlerArgs<ActionHandyMPExtensionEnable>,
client: Client,
) => {
if (!client.lobby) return
client.lobby.handyAllowMPExtension.set(client.id, true)
client.lobby.broadcastLobbyInfo()
}
const handyMPExtensionDisable = (
args: ActionHandlerArgs<ActionHandyMPExtensionDisable>,
client: Client,
) => {
if (!client.lobby) return
client.lobby.handyAllowMPExtension.set(client.id, false)
client.lobby.broadcastLobbyInfo()
}
export const actionHandlers = {
username: usernameAction,
createLobby: createLobbyAction,
joinLobby: joinLobbyAction,
rejoinLobby: rejoinLobbyAction,
lobbyInfo: lobbyInfoAction,
leaveLobby: leaveLobbyAction,
readyLobby: readyLobbyAction,
unreadyLobby: unreadyLobbyAction,
keepAlive: keepAliveAction,
startGame: startGameAction,
readyBlind: readyBlindAction,
unreadyBlind: unreadyBlindAction,
playHand: playHandAction,
stopGame: stopGameAction,
gameInfo: gameInfoAction,
lobbyOptions: lobbyOptionsAction,
failRound: failRoundAction,
setAnte: setAnteAction,
version: versionAction,
setLocation: setLocationAction,
newRound: newRoundAction,
setFurthestBlind: setFurthestBlindAction,
skip: skipAction,
sendPhantom: sendPhantomAction,
removePhantom: removePhantomAction,
asteroid: asteroidAction,
letsGoGamblingNemesis: letsGoGamblingNemesisAction,
eatPizza: eatPizzaAction,
soldJoker: soldJokerAction,
spentLastShop: spentLastShopAction,
magnet: magnetAction,
magnetResponse: magnetResponseAction,
getEndGameJokers: getEndGameJokersAction,
receiveEndGameJokers: receiveEndGameJokersAction,
getNemesisDeck: getNemesisDeckAction,
receiveNemesisDeck: receiveNemesisDeckAction,
endGameStatsRequested: requestNemesisStatsActionHandler,
nemesisEndGameStats: receiveNemesisStatsActionHandler,
startAnteTimer: startAnteTimerAction,
pauseAnteTimer: pauseAnteTimerAction,
failTimer: failTimerAction,
syncClient: syncClientAction,
tcgServerVersion: tcgServerVersionAction,
startTcgBetting: startTcgBettingAction,
tcgBet: tcgBetAction,
tcgPlayerStatus: tcgPlayerStatusAction,
tcgEndTurn: tcgEndTurnAction,
moddedAction: moddedAction,
handyMPExtensionEnable: handyMPExtensionEnable,
handyMPExtensionDisable: handyMPExtensionDisable,
} satisfies Partial<ActionHandlers>;
/** Server-internal handler for connection drops (not a client action) */
export { disconnectFromLobbyAction };