trucoshi 9.1.0 → 9.3.0

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.
@@ -6,6 +6,9 @@ export function Deck() {
6
6
  random: Random(),
7
7
  usedCards: [],
8
8
  takeCard() {
9
+ if (deck.cards.length <= 0) {
10
+ throw new Error("No cards left in deck");
11
+ }
9
12
  const card = deck.cards.shift();
10
13
  deck.usedCards.push(card);
11
14
  return card;
@@ -46,17 +49,12 @@ export function dealCards(table, deck) {
46
49
  }
47
50
  }
48
51
  if (cheat_cards) {
49
- try {
50
- const new_cards = JSON.parse(cheat_cards);
51
- deck.shuffle(players[0].idx);
52
- for (const [key, player] of players.entries()) {
53
- playerHands[player.idx] = new_cards[key]
54
- ? new_cards[key].map((c) => deck.pick(c) || deck.takeCard())
55
- : deck.takeThree();
56
- }
57
- }
58
- catch (_a) {
59
- //noop
52
+ const new_cards = JSON.parse(cheat_cards);
53
+ deck.shuffle(players[0].idx);
54
+ for (const [key, player] of players.entries()) {
55
+ playerHands[player.idx] = new_cards[key]
56
+ ? new_cards[key].map((c) => deck.pick(c) || deck.takeCard())
57
+ : deck.takeThree();
60
58
  }
61
59
  }
62
60
  if (cheat_lots_of_flowers) {
package/dist/types.d.ts CHANGED
@@ -204,7 +204,7 @@ export declare enum GAME_ERROR {
204
204
  TEAM_NOT_READY = "TEAM_NOT_READY",
205
205
  TEAM_IS_FULL = "TEAM_IS_FULL",
206
206
  ENVIDO_NOT_ACCEPTED = "ENVIDO_NOT_ACCEPTED",
207
- INVALID_COMAND = "INVALID_COMAND",
207
+ INVALID_COMMAND = "INVALID_COMMAND",
208
208
  INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
209
209
  GAME_REQUIRES_ACCOUNT = "GAME_REQUIRES_ACCOUNT",
210
210
  NO_FLOR = "NO_FLOR",
@@ -219,7 +219,6 @@ export interface EnvidoState {
219
219
  }
220
220
  export type IEnvidoCalculatorResult = {
221
221
  accept: number;
222
- decline: number;
223
222
  replace?: number;
224
223
  next: Array<ECommand>;
225
224
  };
@@ -229,7 +228,6 @@ export type IFaltaEnvidoCalculatorArgs = {
229
228
  };
230
229
  export type IEnvidoCalculatorArgs = {
231
230
  stake: number;
232
- declineStake: number;
233
231
  } & (IFaltaEnvidoCalculatorArgs | never);
234
232
  export type IEnvidoCalculator = {
235
233
  [key in EEnvidoCommand]: (args?: IEnvidoCalculatorArgs) => IEnvidoCalculatorResult;
package/dist/types.js CHANGED
@@ -69,7 +69,7 @@ export var GAME_ERROR;
69
69
  GAME_ERROR["TEAM_NOT_READY"] = "TEAM_NOT_READY";
70
70
  GAME_ERROR["TEAM_IS_FULL"] = "TEAM_IS_FULL";
71
71
  GAME_ERROR["ENVIDO_NOT_ACCEPTED"] = "ENVIDO_NOT_ACCEPTED";
72
- GAME_ERROR["INVALID_COMAND"] = "INVALID_COMAND";
72
+ GAME_ERROR["INVALID_COMMAND"] = "INVALID_COMMAND";
73
73
  GAME_ERROR["INSUFFICIENT_BALANCE"] = "INSUFFICIENT_BALANCE";
74
74
  GAME_ERROR["GAME_REQUIRES_ACCOUNT"] = "GAME_REQUIRES_ACCOUNT";
75
75
  GAME_ERROR["NO_FLOR"] = "NO_FLOR";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "trucoshi",
3
- "version": "9.1.0",
4
- "description": "Lightning Truco Server",
3
+ "version": "9.3.0",
4
+ "description": "Truco Game Server",
5
5
  "main": "dist/types.js",
6
6
  "license": "GPL-3.0",
7
7
  "author": "Fran <jfrader.com>",
@@ -77,7 +77,7 @@
77
77
  "dotenv-cli": "^7.3.0",
78
78
  "form-data": "^4.0.0",
79
79
  "jsonwebtoken": "^9.0.2",
80
- "lightning-accounts": "6.1.2",
80
+ "lightning-accounts": "6.2.1",
81
81
  "lodash.debounce": "^4.0.8",
82
82
  "lodash.memoize": "^4.1.2",
83
83
  "lodash.partialright": "^4.2.1",