trucoshi 8.1.0 → 8.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events.d.ts +8 -8
- package/dist/events.js +3 -1
- package/dist/types.d.ts +5 -0
- package/package.json +4 -2
package/dist/events.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EMatchState } from "@trucoshi/prisma";
|
|
2
2
|
import { SocketError } from "./server";
|
|
3
|
-
import { IAccountDetails, IChatMessage, ILobbyOptions, IMatchDetails, IPlayerRanking, IPublicChatRoom, IPublicMatch, IPublicMatchInfo, IUserData, IWaitingPlayData, IWaitingSayData } from "./types";
|
|
3
|
+
import { IAccountDetails, IChatMessage, ILobbyOptions, IMatchDetails, IPlayerRanking, IPublicChatRoom, IPublicMatch, IPublicMatchInfo, ITrucoshiStats, IUserData, IWaitingPlayData, IWaitingSayData } from "./types";
|
|
4
4
|
export type IEventCallback<T = {}> = (args: {
|
|
5
5
|
success: boolean;
|
|
6
6
|
error?: SocketError;
|
|
@@ -17,16 +17,12 @@ export declare enum EServerEvent {
|
|
|
17
17
|
UPDATE_ACTIVE_MATCHES = "UPDATE_ACTIVE_MATCHES",
|
|
18
18
|
WAITING_POSSIBLE_SAY = "WAITING_POSSIBLE_SAY",
|
|
19
19
|
UPDATE_CHAT = "UPDAET_CHAT",
|
|
20
|
-
|
|
20
|
+
UPDATE_STATS = "UPDATE_STATS"
|
|
21
21
|
}
|
|
22
22
|
export interface ServerToClientEvents {
|
|
23
23
|
[EServerEvent.PONG]: (serverTime: number, clientTime: number) => void;
|
|
24
|
-
[EServerEvent.ERROR]: (error: {
|
|
25
|
-
code: string;
|
|
26
|
-
message: string;
|
|
27
|
-
action: string;
|
|
28
|
-
}) => void;
|
|
29
24
|
[EServerEvent.UPDATE_CHAT]: (room: IPublicChatRoom) => void;
|
|
25
|
+
[EServerEvent.UPDATE_STATS]: (room: ITrucoshiStats) => void;
|
|
30
26
|
[EServerEvent.NEW_MESSAGE]: (roomId: string, message?: IChatMessage) => void;
|
|
31
27
|
[EServerEvent.UPDATE_ACTIVE_MATCHES]: (activeMatches: IPublicMatchInfo[]) => void;
|
|
32
28
|
[EServerEvent.UPDATE_MATCH]: (match: IPublicMatch, callback?: () => void) => void;
|
|
@@ -55,7 +51,9 @@ export declare enum EClientEvent {
|
|
|
55
51
|
KICK_PLAYER = "KICK_PLAYER",
|
|
56
52
|
CHAT = "CHAT",
|
|
57
53
|
PING = "PING",
|
|
58
|
-
SAY = "SAY"
|
|
54
|
+
SAY = "SAY",
|
|
55
|
+
JOIN_ROOM = "JOIN_ROOM",
|
|
56
|
+
LEAVE_ROOM = "LEAVE_ROOM"
|
|
59
57
|
}
|
|
60
58
|
export interface ClientToServerEvents {
|
|
61
59
|
[EClientEvent.LOGOUT]: (callback: IEventCallback<{}>) => void;
|
|
@@ -77,6 +75,8 @@ export interface ClientToServerEvents {
|
|
|
77
75
|
match?: IPublicMatch;
|
|
78
76
|
activeMatches?: IPublicMatchInfo[];
|
|
79
77
|
}>) => void;
|
|
78
|
+
[EClientEvent.JOIN_ROOM]: (roomId: string) => void;
|
|
79
|
+
[EClientEvent.LEAVE_ROOM]: (roomId: string) => void;
|
|
80
80
|
[EClientEvent.ADD_BOT]: (matchSessionId: string, teamIdx: 0 | 1 | undefined, callback: IEventCallback<{
|
|
81
81
|
match?: IPublicMatch;
|
|
82
82
|
}>) => void;
|
package/dist/events.js
CHANGED
|
@@ -11,7 +11,7 @@ export var EServerEvent;
|
|
|
11
11
|
EServerEvent["UPDATE_ACTIVE_MATCHES"] = "UPDATE_ACTIVE_MATCHES";
|
|
12
12
|
EServerEvent["WAITING_POSSIBLE_SAY"] = "WAITING_POSSIBLE_SAY";
|
|
13
13
|
EServerEvent["UPDATE_CHAT"] = "UPDAET_CHAT";
|
|
14
|
-
EServerEvent["
|
|
14
|
+
EServerEvent["UPDATE_STATS"] = "UPDATE_STATS";
|
|
15
15
|
})(EServerEvent || (EServerEvent = {}));
|
|
16
16
|
export var EClientEvent;
|
|
17
17
|
(function (EClientEvent) {
|
|
@@ -33,4 +33,6 @@ export var EClientEvent;
|
|
|
33
33
|
EClientEvent["CHAT"] = "CHAT";
|
|
34
34
|
EClientEvent["PING"] = "PING";
|
|
35
35
|
EClientEvent["SAY"] = "SAY";
|
|
36
|
+
EClientEvent["JOIN_ROOM"] = "JOIN_ROOM";
|
|
37
|
+
EClientEvent["LEAVE_ROOM"] = "LEAVE_ROOM";
|
|
36
38
|
})(EClientEvent || (EClientEvent = {}));
|
package/dist/types.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export interface ISaidCommand {
|
|
|
46
46
|
export interface IMatchFlorBattle {
|
|
47
47
|
matchSessionId: string;
|
|
48
48
|
playersWithFlor: {
|
|
49
|
+
team: 0 | 1;
|
|
49
50
|
idx: number;
|
|
50
51
|
cards?: ICard[];
|
|
51
52
|
points: number;
|
|
@@ -337,6 +338,7 @@ export interface IPlayer {
|
|
|
337
338
|
setSession(session: string): void;
|
|
338
339
|
setIsOwner(isOwner: boolean): void;
|
|
339
340
|
addDisconnectedTime(time: number): void;
|
|
341
|
+
rename(name: string): void;
|
|
340
342
|
enable(): void;
|
|
341
343
|
disable(): void;
|
|
342
344
|
abandon(): void;
|
|
@@ -374,3 +376,6 @@ export type IHandRoundLog = {
|
|
|
374
376
|
};
|
|
375
377
|
export type IPublicUser = Pick<User, "id" | "email" | "name" | "role">;
|
|
376
378
|
export declare const DANGEROUS_COMMANDS: ECommand[];
|
|
379
|
+
export type ITrucoshiStats = {
|
|
380
|
+
onlinePlayers: number[];
|
|
381
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trucoshi",
|
|
3
|
-
"version": "8.1
|
|
3
|
+
"version": "8.2.1",
|
|
4
4
|
"description": "Lightning Truco Server",
|
|
5
5
|
"main": "dist/types.js",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@prisma/client": "^4.14.1",
|
|
68
68
|
"@socket.io/redis-adapter": "^8.2.1",
|
|
69
69
|
"@types/jsonwebtoken": "^9.0.5",
|
|
70
|
+
"@types/lodash.debounce": "^4.0.9",
|
|
70
71
|
"@types/node-forge": "^1.3.11",
|
|
71
72
|
"@types/pino": "^7.0.5",
|
|
72
73
|
"@types/redis": "^4.0.11",
|
|
@@ -76,7 +77,8 @@
|
|
|
76
77
|
"dotenv-cli": "^7.3.0",
|
|
77
78
|
"form-data": "^4.0.0",
|
|
78
79
|
"jsonwebtoken": "^9.0.2",
|
|
79
|
-
"lightning-accounts": "4.3.
|
|
80
|
+
"lightning-accounts": "4.3.1",
|
|
81
|
+
"lodash.debounce": "^4.0.8",
|
|
80
82
|
"node-forge": "^1.3.1",
|
|
81
83
|
"path-scurry": "^1.9.2",
|
|
82
84
|
"pino": "^9.3.2",
|