trucoshi 0.0.18 → 0.0.19
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IPlayer } from "../types";
|
|
2
|
-
export type IPublicPlayer = Pick<IPlayer, "id" | "disabled" | "ready" | "hand" | "usedHand" | "teamIdx" | "session">;
|
|
2
|
+
export type IPublicPlayer = Pick<IPlayer, "id" | "disabled" | "ready" | "hand" | "usedHand" | "prevHand" | "teamIdx" | "session">;
|
|
3
3
|
export declare function Player(id: string, teamIdx: number): IPlayer;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.Player = void 0;
|
|
4
13
|
function Player(id, teamIdx) {
|
|
@@ -9,6 +18,7 @@ function Player(id, teamIdx) {
|
|
|
9
18
|
hand: [],
|
|
10
19
|
commands: [],
|
|
11
20
|
usedHand: [],
|
|
21
|
+
prevHand: [],
|
|
12
22
|
disabled: false,
|
|
13
23
|
ready: false,
|
|
14
24
|
setSession: function (session) {
|
|
@@ -24,6 +34,7 @@ function Player(id, teamIdx) {
|
|
|
24
34
|
player.ready = ready;
|
|
25
35
|
},
|
|
26
36
|
setHand: function (hand) {
|
|
37
|
+
player.prevHand = __spreadArray([], player.usedHand, true);
|
|
27
38
|
player.hand = hand;
|
|
28
39
|
player.usedHand = [];
|
|
29
40
|
return hand;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -52,9 +52,9 @@ function MatchTable(matchSessionId, teamSize) {
|
|
|
52
52
|
var lobby = matchTable.lobby;
|
|
53
53
|
var winner = ((_a = lobby.gameLoop) === null || _a === void 0 ? void 0 : _a.winner) || null;
|
|
54
54
|
var lastHandIdx = (((_b = lobby.gameLoop) === null || _b === void 0 ? void 0 : _b.hands.length) || 1) - 1;
|
|
55
|
-
var rounds = (_d = (_c = lobby.gameLoop) === null || _c === void 0 ? void 0 : _c.hands[lastHandIdx]) === null || _d === void 0 ? void 0 : _d.rounds.map(function (round) { return round.cards; });
|
|
55
|
+
var rounds = ((_d = (_c = lobby.gameLoop) === null || _c === void 0 ? void 0 : _c.hands[lastHandIdx]) === null || _d === void 0 ? void 0 : _d.rounds.map(function (round) { return round.cards; })) || [];
|
|
56
56
|
var prevHandIdx = lastHandIdx - 1;
|
|
57
|
-
var prevRounds = prevHandIdx !== -1
|
|
57
|
+
var prevRounds = prevHandIdx !== -1 && rounds[0].length === 0
|
|
58
58
|
? (_f = (_e = lobby.gameLoop) === null || _e === void 0 ? void 0 : _e.hands[prevHandIdx]) === null || _f === void 0 ? void 0 : _f.rounds.map(function (round) { return round.cards; })
|
|
59
59
|
: null;
|
|
60
60
|
var players = lobby.players.filter(function (player) { return Boolean(player); });
|
package/dist/server/index.js
CHANGED
|
@@ -115,19 +115,8 @@ io.on("connection", function (_socket) {
|
|
|
115
115
|
return __generator(this, function (_a) {
|
|
116
116
|
switch (_a.label) {
|
|
117
117
|
case 0: return [4 /*yield*/, getTableSockets(table, function (playerSocket) { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
|
-
var tmp, save;
|
|
119
118
|
return __generator(this, function (_a) {
|
|
120
|
-
|
|
121
|
-
save = function () { return playerSocket.emit(types_1.EServerEvent.UPDATE_MATCH, tmp); };
|
|
122
|
-
// if (tmp.prevRounds && tmp.rounds[0].length === 0) {
|
|
123
|
-
// playerSocket.emit(EServerEvent.UPDATE_MATCH, {
|
|
124
|
-
// ...tmp,
|
|
125
|
-
// rounds: tmp.prevRounds,
|
|
126
|
-
// })
|
|
127
|
-
// setTimeout(save, 4500)
|
|
128
|
-
// return
|
|
129
|
-
// }
|
|
130
|
-
save();
|
|
119
|
+
playerSocket.emit(types_1.EServerEvent.UPDATE_MATCH, table.getPublicMatch(playerSocket.session));
|
|
131
120
|
return [2 /*return*/];
|
|
132
121
|
});
|
|
133
122
|
}); })];
|