trucoshi 0.4.3 → 0.4.6

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.
@@ -40,4 +40,46 @@ export declare const CARDS: {
40
40
  "4b": number;
41
41
  "4c": number;
42
42
  };
43
+ export declare const CARDS_HUMAN_READABLE: {
44
+ "1e": string;
45
+ "1b": string;
46
+ "7e": string;
47
+ "7o": string;
48
+ "3e": string;
49
+ "3o": string;
50
+ "3b": string;
51
+ "3c": string;
52
+ "2e": string;
53
+ "2o": string;
54
+ "2b": string;
55
+ "2c": string;
56
+ "1o": string;
57
+ "1c": string;
58
+ re: string;
59
+ ro: string;
60
+ rb: string;
61
+ rc: string;
62
+ ce: string;
63
+ co: string;
64
+ cb: string;
65
+ cc: string;
66
+ pe: string;
67
+ po: string;
68
+ pb: string;
69
+ pc: string;
70
+ "7b": string;
71
+ "7c": string;
72
+ "6e": string;
73
+ "6o": string;
74
+ "6b": string;
75
+ "6c": string;
76
+ "5e": string;
77
+ "5o": string;
78
+ "5b": string;
79
+ "5c": string;
80
+ "4e": string;
81
+ "4o": string;
82
+ "4b": string;
83
+ "4c": string;
84
+ };
43
85
  export declare const TEAM_SIZE_VALUES: number[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TEAM_SIZE_VALUES = exports.CARDS = void 0;
3
+ exports.TEAM_SIZE_VALUES = exports.CARDS_HUMAN_READABLE = exports.CARDS = void 0;
4
4
  exports.CARDS = {
5
5
  "1e": 13,
6
6
  "1b": 12,
@@ -43,4 +43,46 @@ exports.CARDS = {
43
43
  "4b": 0,
44
44
  "4c": 0,
45
45
  };
46
+ exports.CARDS_HUMAN_READABLE = {
47
+ "1e": "1🗡️",
48
+ "1b": "1🌵",
49
+ "7e": "7🗡️",
50
+ "7o": "7💰",
51
+ "3e": "3🗡️",
52
+ "3o": "3💰",
53
+ "3b": "3🌵",
54
+ "3c": "3🍷",
55
+ "2e": "2🗡️",
56
+ "2o": "2💰",
57
+ "2b": "2🌵",
58
+ "2c": "2🍷",
59
+ "1o": "1💰",
60
+ "1c": "1🍷",
61
+ re: "12🗡️",
62
+ ro: "12💰",
63
+ rb: "12🌵",
64
+ rc: "12🍷",
65
+ ce: "11🗡️",
66
+ co: "11💰",
67
+ cb: "11🌵",
68
+ cc: "11🍷",
69
+ pe: "10🗡️",
70
+ po: "10💰",
71
+ pb: "10🌵",
72
+ pc: "10🍷",
73
+ "7b": "7🌵",
74
+ "7c": "7🍷",
75
+ "6e": "6🗡️",
76
+ "6o": "6💰",
77
+ "6b": "6🌵",
78
+ "6c": "6🍷",
79
+ "5e": "5🗡️",
80
+ "5o": "5💰",
81
+ "5b": "5🌵",
82
+ "5c": "5🍷",
83
+ "4e": "4🗡️",
84
+ "4o": "4💰",
85
+ "4b": "4🌵",
86
+ "4c": "4🍷",
87
+ };
46
88
  exports.TEAM_SIZE_VALUES = [1, 2, 3];
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { CARDS } from "./lib/constants";
1
+ import { CARDS, CARDS_HUMAN_READABLE } from "./lib/constants";
2
+ export { CARDS, CARDS_HUMAN_READABLE };
2
3
  export interface ISaidCommand {
3
4
  player: IPlayer | IPublicPlayer;
4
5
  command: ECommand | number;
@@ -98,6 +99,7 @@ export declare enum EServerEvent {
98
99
  PREVIOUS_HAND = "PREVIOUS_HAND",
99
100
  UPDATE_MATCH = "UPDATE_MATCH",
100
101
  WAITING_PLAY = "WAITING_PLAY",
102
+ UPDATE_ACTIVE_MATCHES = "UPDATE_ACTIVE_MATCHES",
101
103
  PLAYER_USED_CARD = "PLAYER_USED_CARD",
102
104
  PLAYER_SAID_COMMAND = "PLAYER_SAID_COMMAND",
103
105
  WAITING_POSSIBLE_SAY = "WAITING_POSSIBLE_SAY",
@@ -124,6 +126,7 @@ export interface ServerToClientEvents {
124
126
  [EServerEvent.WAITING_POSSIBLE_SAY]: (match: IPublicMatch, callback: (data: IWaitingSayData) => void) => void;
125
127
  [EServerEvent.PREVIOUS_HAND]: (value: IMatchPreviousHand, callback: () => void) => void;
126
128
  [EServerEvent.UPDATE_CHAT]: (room: IPublicChatRoom, message?: IChatMessage) => void;
129
+ [EServerEvent.UPDATE_ACTIVE_MATCHES]: (activeMatches: IPublicMatchInfo[]) => void;
127
130
  [EServerEvent.UPDATE_MATCH]: (match: IPublicMatch) => void;
128
131
  [EServerEvent.PLAYER_USED_CARD]: (match: IPublicMatch, card: IPlayedCard) => void;
129
132
  [EServerEvent.PLAYER_SAID_COMMAND]: (match: IPublicMatch, command: ISaidCommand) => void;
@@ -150,6 +153,7 @@ export interface ClientToServerEvents {
150
153
  }>) => void;
151
154
  [EClientEvent.SET_SESSION]: (id: string | null, session: string | null, callback?: IEventCallback<{
152
155
  session?: string;
156
+ serverVersion: string;
153
157
  activeMatches: Array<IPublicMatchInfo>;
154
158
  }>) => void;
155
159
  [EClientEvent.JOIN_MATCH]: (matchSessionId: string, teamIdx: 0 | 1 | undefined, callback: IEventCallback<{
@@ -224,9 +228,17 @@ export interface IHandPoints {
224
228
  0: number;
225
229
  1: number;
226
230
  }
227
- export type IPublicPlayer = Pick<IPlayer, "id" | "key" | "disabled" | "ready" | "hand" | "envido" | "usedHand" | "prevHand" | "teamIdx" | "session" | "hasFlor" | "isTurn" | "isEnvidoTurn" | "isOwner"> & {
228
- commands: Array<ECommand>;
229
- };
231
+ export type IPublicPlayer = Pick<IPlayer, "id" | "key" | "disabled" | "ready" | "hand" | "usedHand" | "prevHand" | "teamIdx" | "isTurn" | "isEnvidoTurn" | "isOwner"> & ({
232
+ isMe?: true;
233
+ commands: IPlayer["commands"];
234
+ hasFlor: IPlayer["hasFlor"];
235
+ envido: IPlayer["envido"];
236
+ } | {
237
+ isMe?: false;
238
+ commands?: undefined;
239
+ hasFlor?: undefined;
240
+ envido?: undefined;
241
+ });
230
242
  export type IPublicTeam = Pick<ITeam, "points"> & {
231
243
  players: Array<IPublicPlayer>;
232
244
  };
@@ -251,7 +263,7 @@ export interface IPlayer {
251
263
  calculateEnvido(): Array<number>;
252
264
  setTurn(turn: boolean): void;
253
265
  setEnvidoTurn(turn: boolean): void;
254
- getPublicPlayer(): IPublicPlayer;
266
+ getPublicPlayer(session?: string): IPublicPlayer;
255
267
  setSession(session: string): void;
256
268
  setIsOwner(isOwner: boolean): void;
257
269
  enable(): void;
package/dist/types.js CHANGED
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GAME_ERROR = exports.TMap = exports.ETrucoshiMatchState = exports.EClientEvent = exports.EServerEvent = exports.EHandState = exports.EEnvidoCommand = exports.EEnvidoAnswerCommand = exports.EAnswerCommand = exports.ETrucoCommand = exports.EFlorCommand = exports.ESayCommand = exports.EMatchTableState = exports.EChatSystem = void 0;
3
+ exports.GAME_ERROR = exports.TMap = exports.ETrucoshiMatchState = exports.EClientEvent = exports.EServerEvent = exports.EHandState = exports.EEnvidoCommand = exports.EEnvidoAnswerCommand = exports.EAnswerCommand = exports.ETrucoCommand = exports.EFlorCommand = exports.ESayCommand = exports.EMatchTableState = exports.EChatSystem = exports.CARDS_HUMAN_READABLE = exports.CARDS = void 0;
4
+ const constants_1 = require("./lib/constants");
5
+ Object.defineProperty(exports, "CARDS", { enumerable: true, get: function () { return constants_1.CARDS; } });
6
+ Object.defineProperty(exports, "CARDS_HUMAN_READABLE", { enumerable: true, get: function () { return constants_1.CARDS_HUMAN_READABLE; } });
4
7
  var EChatSystem;
5
8
  (function (EChatSystem) {
6
9
  EChatSystem[EChatSystem["TEAM_0"] = 0] = "TEAM_0";
@@ -58,6 +61,7 @@ var EServerEvent;
58
61
  EServerEvent["PREVIOUS_HAND"] = "PREVIOUS_HAND";
59
62
  EServerEvent["UPDATE_MATCH"] = "UPDATE_MATCH";
60
63
  EServerEvent["WAITING_PLAY"] = "WAITING_PLAY";
64
+ EServerEvent["UPDATE_ACTIVE_MATCHES"] = "UPDATE_ACTIVE_MATCHES";
61
65
  EServerEvent["PLAYER_USED_CARD"] = "PLAYER_USED_CARD";
62
66
  EServerEvent["PLAYER_SAID_COMMAND"] = "PLAYER_SAID_COMMAND";
63
67
  EServerEvent["WAITING_POSSIBLE_SAY"] = "WAITING_POSSIBLE_SAY";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trucoshi",
3
- "version": "0.4.3",
3
+ "version": "0.4.6",
4
4
  "main": "dist/types.js",
5
5
  "license": "GPL-3.0",
6
6
  "scripts": {