jp.ms.common.modules 1.0.29 → 1.0.31
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/dto/app-screen/index.d.ts +1 -0
- package/dist/dto/app-screen/index.js +3 -1
- package/dist/dto/app-screen/index.js.map +1 -1
- package/dist/dto/{table-game/cards → app-table}/card.dto.d.ts +2 -2
- package/dist/dto/app-table/card.dto.js.map +1 -0
- package/dist/dto/app-table/cards-deck.dto.d.ts +6 -0
- package/dist/dto/app-table/cards-deck.dto.js +38 -0
- package/dist/dto/app-table/cards-deck.dto.js.map +1 -0
- package/dist/dto/{table-game/cards/card-pair-slot.dto.d.ts → app-table/cards-pair-slots-item.dto.d.ts} +2 -2
- package/dist/dto/{table-game/cards/card-pair-slot.dto.js → app-table/cards-pair-slots-item.dto.js} +9 -9
- package/dist/dto/app-table/cards-pair-slots-item.dto.js.map +1 -0
- package/dist/dto/app-table/cards-pair-slots.dto.d.ts +5 -0
- package/dist/dto/app-table/cards-pair-slots.dto.js +27 -0
- package/dist/dto/app-table/cards-pair-slots.dto.js.map +1 -0
- package/dist/dto/app-table/cards-panel.dto.d.ts +10 -0
- package/dist/dto/{table-game/cards → app-table}/cards-panel.dto.js +4 -4
- package/dist/dto/app-table/cards-panel.dto.js.map +1 -0
- package/dist/dto/app-table/cards-player.dto.d.ts +6 -0
- package/dist/dto/{table-game/cards/card-player.dto.js → app-table/cards-player.dto.js} +6 -6
- package/dist/dto/app-table/cards-player.dto.js.map +1 -0
- package/dist/dto/app-table/index.d.ts +11 -0
- package/dist/dto/app-table/index.js +26 -0
- package/dist/dto/app-table/index.js.map +1 -0
- package/dist/dto/app-table/moves-panel-button.dto.d.ts +5 -0
- package/dist/dto/{table-game/base/base-table-yours-action.dto.js → app-table/moves-panel-button.dto.js} +6 -6
- package/dist/dto/app-table/moves-panel-button.dto.js.map +1 -0
- package/dist/dto/app-table/moves-panel.dto.d.ts +6 -0
- package/dist/dto/{table-game/base/base-table-moves-panel.dto.js → app-table/moves-panel.dto.js} +9 -9
- package/dist/dto/app-table/moves-panel.dto.js.map +1 -0
- package/dist/dto/{table-game/base/game-player.dto.d.ts → app-table/player.dto.d.ts} +2 -2
- package/dist/dto/{table-game/base/game-player.dto.js → app-table/player.dto.js} +11 -11
- package/dist/dto/app-table/player.dto.js.map +1 -0
- package/dist/dto/app-table/summary-item.dto.d.ts +8 -0
- package/dist/dto/{table-game/base/base-table-summary-item.dto.js → app-table/summary-item.dto.js} +9 -9
- package/dist/dto/app-table/summary-item.dto.js.map +1 -0
- package/dist/dto/app-table/summary.dto.d.ts +5 -0
- package/dist/dto/{table-game/base/base-table-summary.dto.js → app-table/summary.dto.js} +7 -7
- package/dist/dto/app-table/summary.dto.js.map +1 -0
- package/dist/dto/games/fool/fool-player.dto.d.ts +3 -0
- package/dist/dto/games/fool/fool-player.dto.js +8 -0
- package/dist/dto/games/fool/fool-player.dto.js.map +1 -0
- package/dist/dto/games/fool/fool-table.dto.d.ts +18 -0
- package/dist/dto/games/fool/fool-table.dto.js +105 -0
- package/dist/dto/games/fool/fool-table.dto.js.map +1 -0
- package/dist/dto/games/index.d.ts +1 -0
- package/dist/dto/games/index.js +18 -0
- package/dist/dto/games/index.js.map +1 -0
- package/dist/dto/index.d.ts +2 -1
- package/dist/dto/index.js +2 -1
- package/dist/dto/index.js.map +1 -1
- package/dist/exception/error-code.enum.d.ts +4 -0
- package/dist/exception/error-code.enum.js +9 -0
- package/dist/exception/error-code.enum.js.map +1 -0
- package/dist/exception/global-exception-filter.d.ts +5 -0
- package/dist/exception/global-exception-filter.js +53 -0
- package/dist/exception/global-exception-filter.js.map +1 -0
- package/dist/exception/http-exception-wth-snackbar.d.ts +12 -0
- package/dist/exception/http-exception-wth-snackbar.js +17 -0
- package/dist/exception/http-exception-wth-snackbar.js.map +1 -0
- package/dist/exception/index.d.ts +4 -0
- package/dist/exception/index.js +12 -0
- package/dist/exception/index.js.map +1 -0
- package/dist/exception/not-enough-money-for-purchase.exception.d.ts +5 -0
- package/dist/exception/not-enough-money-for-purchase.exception.js +12 -0
- package/dist/exception/not-enough-money-for-purchase.exception.js.map +1 -0
- package/dist/exception/not-found-free-room-for-fast-game.exception.d.ts +5 -0
- package/dist/exception/not-found-free-room-for-fast-game.exception.js +12 -0
- package/dist/exception/not-found-free-room-for-fast-game.exception.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/events/events.gateway.js +1 -1
- package/dist/modules/events/events.gateway.js.map +1 -1
- package/dist/modules/main/main-tables-list-screen.view.d.ts +11 -1
- package/dist/modules/main/main-tables-list-screen.view.js +97 -14
- package/dist/modules/main/main-tables-list-screen.view.js.map +1 -1
- package/dist/modules/main/main.controller.d.ts +4 -3
- package/dist/modules/main/main.controller.js +15 -3
- package/dist/modules/main/main.controller.js.map +1 -1
- package/dist/modules/main/main.module.js +2 -2
- package/dist/modules/main/main.module.js.map +1 -1
- package/dist/modules/main/main.service.d.ts +5 -4
- package/dist/modules/main/main.service.js +38 -12
- package/dist/modules/main/main.service.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.d.ts +4 -0
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.js +56 -4
- package/dist/modules/many-tables-tournament/many-tables-tournament-status-screen.view.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.js +3 -3
- package/dist/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.d.ts +6 -7
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js +5 -17
- package/dist/modules/many-tables-tournament/many-tables-tournament.controller.js.map +1 -1
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.d.ts +6 -7
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js +20 -27
- package/dist/modules/many-tables-tournament/many-tables-tournament.service.js.map +1 -1
- package/dist/modules/menu/menu.service.js +1 -2
- package/dist/modules/menu/menu.service.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.d.ts +1 -0
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.js +18 -5
- package/dist/modules/one-table-tournament/one-table-tournament-status-screen.view.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.controller.d.ts +3 -3
- package/dist/modules/one-table-tournament/one-table-tournament.controller.js.map +1 -1
- package/dist/modules/one-table-tournament/one-table-tournament.service.d.ts +3 -3
- package/dist/modules/one-table-tournament/one-table-tournament.service.js +1 -2
- package/dist/modules/one-table-tournament/one-table-tournament.service.js.map +1 -1
- package/dist/modules/simple-rooms/simple-rooms.controller.d.ts +5 -5
- package/dist/modules/simple-rooms/simple-rooms.service.d.ts +5 -5
- package/dist/modules/simple-rooms-manager/simple-rooms-manager.service.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.d.ts +3 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.js +14 -3
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.js.map +1 -1
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.d.ts +4 -3
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.js +49 -25
- package/dist/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.js.map +1 -1
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.js +9 -6
- package/dist/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/game-table-result.d.ts +1 -2
- package/dist/utils/game-table-result.js +0 -13
- package/dist/utils/game-table-result.js.map +1 -1
- package/dist/views/index.d.ts +3 -0
- package/dist/views/index.js +7 -1
- package/dist/views/index.js.map +1 -1
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.d.ts +4 -0
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.js +11 -0
- package/dist/views/many-tables-tournament-conifrm-exit-dialog.view.js.map +1 -0
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.d.ts +4 -0
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.js +11 -0
- package/dist/views/one-table-tournament-conifrm-exit-dialog.view.js.map +1 -0
- package/dist/views/table-summary.view.d.ts +11 -0
- package/dist/views/table-summary.view.js +47 -0
- package/dist/views/table-summary.view.js.map +1 -0
- package/dist/views/tournament-buy-ticket-dialog.view.js +1 -1
- package/dist/views/tournament-buy-ticket-dialog.view.js.map +1 -1
- package/package.json +4 -4
- package/src/dto/app-screen/index.ts +1 -0
- package/src/dto/{table-game/cards → app-table}/card.dto.ts +2 -2
- package/src/dto/app-table/cards-deck.dto.ts +22 -0
- package/src/dto/{table-game/cards/card-pair-slot.dto.ts → app-table/cards-pair-slots-item.dto.ts} +2 -2
- package/src/dto/app-table/cards-pair-slots.dto.ts +13 -0
- package/src/dto/{table-game/cards → app-table}/cards-panel.dto.ts +5 -6
- package/src/dto/app-table/cards-player.dto.ts +14 -0
- package/src/dto/app-table/index.ts +11 -0
- package/src/dto/{table-game/base/base-table-yours-action.dto.ts → app-table/moves-panel-button.dto.ts} +2 -3
- package/src/dto/{table-game/base/base-table-moves-panel.dto.ts → app-table/moves-panel.dto.ts} +5 -5
- package/src/dto/{table-game/base/game-player.dto.ts → app-table/player.dto.ts} +2 -2
- package/src/dto/{table-game/base/base-table-summary-item.dto.ts → app-table/summary-item.dto.ts} +2 -3
- package/src/dto/app-table/summary.dto.ts +13 -0
- package/src/dto/games/fool/fool-player.dto.ts +3 -0
- package/src/dto/games/fool/fool-table.dto.ts +79 -0
- package/src/dto/games/index.ts +1 -0
- package/src/dto/index.ts +2 -1
- package/src/exception/error-code.enum.ts +4 -0
- package/src/exception/global-exception-filter.ts +50 -0
- package/src/exception/http-exception-wth-snackbar.ts +23 -0
- package/src/exception/index.ts +4 -0
- package/src/exception/not-enough-money-for-purchase.exception.ts +15 -0
- package/src/exception/not-found-free-room-for-fast-game.exception.ts +15 -0
- package/src/index.ts +2 -1
- package/src/modules/events/events.gateway.ts +1 -1
- package/src/modules/main/main-tables-list-screen.view.ts +177 -55
- package/src/modules/main/main.controller.ts +23 -10
- package/src/modules/main/main.module.ts +2 -2
- package/src/modules/main/main.service.ts +53 -19
- package/src/modules/many-tables-tournament/many-tables-tournament-status-screen.view.ts +97 -31
- package/src/modules/many-tables-tournament/many-tables-tournament-tables-list-screen.view.ts +25 -17
- package/src/modules/many-tables-tournament/many-tables-tournament.controller.ts +8 -17
- package/src/modules/many-tables-tournament/many-tables-tournament.service.ts +46 -58
- package/src/modules/menu/menu.service.ts +6 -9
- package/src/modules/one-table-tournament/one-table-tournament-status-screen.view.ts +43 -17
- package/src/modules/one-table-tournament/one-table-tournament.controller.ts +3 -4
- package/src/modules/one-table-tournament/one-table-tournament.service.ts +9 -12
- package/src/modules/simple-rooms/simple-rooms.controller.ts +5 -5
- package/src/modules/simple-rooms/simple-rooms.service.ts +5 -5
- package/src/modules/simple-rooms-manager/simple-rooms-manager.service.ts +0 -2
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.module.ts +17 -9
- package/src/modules/tournament-many-tables-rooms-manager/tournament-many-tables-rooms-manager.service.ts +57 -26
- package/src/modules/tournament-one-table-rooms-manager/tournament-one-table-rooms-manager.service.ts +10 -7
- package/src/utils/game-table-result.ts +1 -16
- package/src/views/index.ts +4 -1
- package/src/views/many-tables-tournament-conifrm-exit-dialog.view.ts +21 -0
- package/src/views/one-table-tournament-conifrm-exit-dialog.view.ts +21 -0
- package/src/views/table-summary.view.ts +87 -0
- package/src/views/tournament-buy-ticket-dialog.view.ts +4 -4
- package/dist/adapter/base-table-game-state-adapter.d.ts +0 -36
- package/dist/adapter/base-table-game-state-adapter.js +0 -183
- package/dist/adapter/base-table-game-state-adapter.js.map +0 -1
- package/dist/adapter/card-table-game-state-adapter.d.ts +0 -14
- package/dist/adapter/card-table-game-state-adapter.js +0 -51
- package/dist/adapter/card-table-game-state-adapter.js.map +0 -1
- package/dist/adapter/index.d.ts +0 -1
- package/dist/adapter/index.js +0 -6
- package/dist/adapter/index.js.map +0 -1
- package/dist/dto/table-game/base/base-table-game-state.dto.d.ts +0 -17
- package/dist/dto/table-game/base/base-table-game-state.dto.js +0 -128
- package/dist/dto/table-game/base/base-table-game-state.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-moves-panel.dto.d.ts +0 -6
- package/dist/dto/table-game/base/base-table-moves-panel.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-summary-item.dto.d.ts +0 -8
- package/dist/dto/table-game/base/base-table-summary-item.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-summary.dto.d.ts +0 -5
- package/dist/dto/table-game/base/base-table-summary.dto.js.map +0 -1
- package/dist/dto/table-game/base/base-table-yours-action.dto.d.ts +0 -5
- package/dist/dto/table-game/base/base-table-yours-action.dto.js.map +0 -1
- package/dist/dto/table-game/base/game-player.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card-pair-slot.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card-player.dto.d.ts +0 -6
- package/dist/dto/table-game/cards/card-player.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card-table-game-state.dto.d.ts +0 -16
- package/dist/dto/table-game/cards/card-table-game-state.dto.js +0 -68
- package/dist/dto/table-game/cards/card-table-game-state.dto.js.map +0 -1
- package/dist/dto/table-game/cards/card.dto.js.map +0 -1
- package/dist/dto/table-game/cards/cards-panel.dto.d.ts +0 -10
- package/dist/dto/table-game/cards/cards-panel.dto.js.map +0 -1
- package/dist/dto/table-game/index.d.ts +0 -1
- package/dist/dto/table-game/index.js +0 -6
- package/dist/dto/table-game/index.js.map +0 -1
- package/src/adapter/base-table-game-state-adapter.ts +0 -272
- package/src/adapter/card-table-game-state-adapter.ts +0 -78
- package/src/adapter/index.ts +0 -1
- package/src/dto/table-game/base/base-table-game-state.dto.ts +0 -95
- package/src/dto/table-game/base/base-table-summary.dto.ts +0 -13
- package/src/dto/table-game/cards/card-player.dto.ts +0 -15
- package/src/dto/table-game/cards/card-table-game-state.dto.ts +0 -50
- package/src/dto/table-game/index.ts +0 -2
- /package/dist/dto/{table-game/cards → app-table}/card.dto.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dto/table-game/index.ts"],"names":[],"mappings":";;;AAAA,+EAA0E;AAAjE,kIAAA,qBAAqB,OAAA"}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IBaseTableGameStateExtraButtons,
|
|
3
|
-
IBaseTableGameStatePlayer,
|
|
4
|
-
IBaseTableGameStateSummary,
|
|
5
|
-
IBaseTableGameState,
|
|
6
|
-
IBaseTableGameStateMovesPanel,
|
|
7
|
-
IBaseTableGameStateYoursActionItem,
|
|
8
|
-
BaseTableGameStateYoursAction,
|
|
9
|
-
BaseTablePlayerActionsEnum,
|
|
10
|
-
BaseTableGameStateExtraButtons,
|
|
11
|
-
BaseTableGameStatePlayer,
|
|
12
|
-
BaseTableGameStateSummary,
|
|
13
|
-
BaseTableGameSummaryItem,
|
|
14
|
-
BaseTableGameStateMovesPanel,
|
|
15
|
-
IAppScreenDialog,
|
|
16
|
-
} from 'jp.common.models';
|
|
17
|
-
import { GameMaster, GamePlayer } from 'jp.ms.common.engine';
|
|
18
|
-
import { formatChips, getPropsFromObject, replacePattern } from 'jp.common.utils';
|
|
19
|
-
|
|
20
|
-
import { SimpleRoomConfirmExitDialogView } from '../views'
|
|
21
|
-
|
|
22
|
-
export abstract class BaseTableGameStateAdapter {
|
|
23
|
-
private readonly _master: GameMaster;
|
|
24
|
-
private readonly _currentPlayer: GamePlayer;
|
|
25
|
-
|
|
26
|
-
constructor(master: GameMaster, currentPlayer: GamePlayer) {
|
|
27
|
-
this._master = master;
|
|
28
|
-
this._currentPlayer = currentPlayer;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
getMaster<T extends GameMaster> () {
|
|
32
|
-
return this._master as T;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getCurrentPlayer<T extends GamePlayer> () {
|
|
36
|
-
return this._currentPlayer as T;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get lang (): string {
|
|
40
|
-
return this._currentPlayer.language.replace('language__', '');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
t (key: string, options: object) {
|
|
44
|
-
const fullCommonKey = `common.${key}`;
|
|
45
|
-
const fullSpecificKey = `${this._master.getRoom().getGameType().replace('JUST_', '').toLowerCase()}.${key}`;
|
|
46
|
-
|
|
47
|
-
let resource = this._master.getRoom().getLocaleService().t(fullSpecificKey, { ...options, defaultValue: '' });
|
|
48
|
-
if (!resource) {
|
|
49
|
-
resource = this._master.getRoom().getLocaleService().t(fullCommonKey, { ...options, defaultValue: '' });
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return resource || key;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getRoomId (): string {
|
|
56
|
-
return this._master.getRoom().getId();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getTableTitle (): string {
|
|
60
|
-
return this._master.getTable().getTitleWithNumber(this.lang);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getTableId (): string {
|
|
64
|
-
return this._master.getTable().getId();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
getGameId (): string {
|
|
68
|
-
return this._master.getGameRound()?.getId() ?? '';
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
getTableSize (): number {
|
|
72
|
-
return this._master.getTable().getTableSize();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getPlayerTurnTimerRemain (): number | undefined {
|
|
76
|
-
return this._master.getPlayerTurnTimerRemain();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
getRestartTimerRemain (): number | undefined {
|
|
80
|
-
return this._master.getRestartTimerRemain();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
getYoursMessage (): string {
|
|
84
|
-
if (this._currentPlayer.isRoomQueuer()) {
|
|
85
|
-
if (this._master.getTable().isFull()) {
|
|
86
|
-
return this.t(`room.screen.info.message.title.WAITING_FREE_SEAT`, { lang: this.lang });
|
|
87
|
-
} else {
|
|
88
|
-
return this.t(`room.screen.info.message.title.WAITING_NEXT_GAME`, { lang: this.lang });
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return '';
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
getPlayerComment (player: GamePlayer): string {
|
|
96
|
-
if (this._master.isInProgress()) {
|
|
97
|
-
if (this._master.isActivePlayer(player.id)) {
|
|
98
|
-
return this.getPlayerCommentInProgressActive(player);
|
|
99
|
-
} else {
|
|
100
|
-
return this.getPlayerCommentInProgressNotActive(player);
|
|
101
|
-
}
|
|
102
|
-
} else if (this._master.isFinish()) {
|
|
103
|
-
return this.getPlayerCommentFinish(player)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return ''
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
getPlayerCommentInProgressActive (player: GamePlayer): string {
|
|
110
|
-
return this.t('room.screen.player.turn.timeout', { lang: this.lang });
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
getPlayerCommentInProgressNotActive (player: GamePlayer): string {
|
|
114
|
-
return this.t(
|
|
115
|
-
`room.screen.last.action.title.${player.getLastMove()?.action}`,
|
|
116
|
-
{ lang: this.lang, args: getPropsFromObject(player.getLastMove() ?? {}) },
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
getPlayerCommentFinish (player: GamePlayer): string {
|
|
121
|
-
const profit = formatChips(player.profit, this.lang, true);
|
|
122
|
-
|
|
123
|
-
return player.isWinner ? `+${profit}` : profit;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
getPlayer (item: GamePlayer): IBaseTableGameStatePlayer {
|
|
127
|
-
return new BaseTableGameStatePlayer({
|
|
128
|
-
id: item.id,
|
|
129
|
-
fullName: item.fullName,
|
|
130
|
-
avatarUrl: item.avatarUrl,
|
|
131
|
-
stack: formatChips(item.stack, this.lang, true),
|
|
132
|
-
seatNumber: item.seatNumber,
|
|
133
|
-
active: item.isWinner || item.isActivePlayer(),
|
|
134
|
-
comment: this.getPlayerComment(item),
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
getPlayers (): Array<IBaseTableGameStatePlayer> {
|
|
139
|
-
return this._master.getTable().getPlayers<GamePlayer>().map((item) => this.getPlayer(item));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
getPlayerActions (): Array<IBaseTableGameStateYoursActionItem> {
|
|
143
|
-
return this._master.getPossibleMoves(this._currentPlayer)
|
|
144
|
-
.map((action) => new BaseTableGameStateYoursAction(
|
|
145
|
-
action,
|
|
146
|
-
this.t(`room.screen.action.button.title.${action}`, { lang: this.lang }),
|
|
147
|
-
));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
getMovesPanelIsOpen (): boolean {
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
getMovesPanel (): IBaseTableGameStateMovesPanel {
|
|
155
|
-
return new BaseTableGameStateMovesPanel(this.getMovesPanelIsOpen(), this.getPlayerActions());
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
getExtraButtons (): IBaseTableGameStateExtraButtons | undefined {
|
|
159
|
-
const chat = this._master.hasPossibleMove(this._currentPlayer, BaseTablePlayerActionsEnum.ACTION_CHAT);
|
|
160
|
-
const react = this._master.hasPossibleMove(this._currentPlayer, BaseTablePlayerActionsEnum.ACTION_REACT);
|
|
161
|
-
|
|
162
|
-
return new BaseTableGameStateExtraButtons(
|
|
163
|
-
chat ?
|
|
164
|
-
new BaseTableGameStateYoursAction(
|
|
165
|
-
BaseTablePlayerActionsEnum.ACTION_CHAT,
|
|
166
|
-
this.t(`room.screen.action.button.title.${chat}`, { lang: this.lang }),
|
|
167
|
-
)
|
|
168
|
-
: undefined,
|
|
169
|
-
react ?
|
|
170
|
-
new BaseTableGameStateYoursAction(
|
|
171
|
-
BaseTablePlayerActionsEnum.ACTION_REACT,
|
|
172
|
-
this.t(`room.screen.action.button.title.${react}`, { lang: this.lang }),
|
|
173
|
-
)
|
|
174
|
-
: undefined,
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
getSummary (): IBaseTableGameStateSummary {
|
|
179
|
-
if (this._master.isInProgress()) {
|
|
180
|
-
return this.getSummaryPlaying();
|
|
181
|
-
} else if (this._master.isTechBreak()) {
|
|
182
|
-
return this.getSummaryTechBreak();
|
|
183
|
-
} else if (this._master.isWaiting()) {
|
|
184
|
-
return this.getSummaryWaiting();
|
|
185
|
-
} else if (this._master.isFinish()) {
|
|
186
|
-
return this.getSummaryEnd();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return new BaseTableGameStateSummary();
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
getSummaryTechBreak () {
|
|
193
|
-
const summary = new BaseTableGameStateSummary();
|
|
194
|
-
|
|
195
|
-
summary.list.push(BaseTableGameSummaryItem.newBodyMdItem(
|
|
196
|
-
'tech-break',
|
|
197
|
-
this.t('room.screen.tech.break.message', { lang: this.lang }),
|
|
198
|
-
));
|
|
199
|
-
|
|
200
|
-
return summary;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
getSummaryPlaying () {
|
|
204
|
-
const summary = new BaseTableGameStateSummary();
|
|
205
|
-
|
|
206
|
-
summary.list.push(BaseTableGameSummaryItem.newTitleMdItem(
|
|
207
|
-
'pot',
|
|
208
|
-
this.t('room.screen.summary.pot', {
|
|
209
|
-
lang: this.lang,
|
|
210
|
-
args: { POT: formatChips(this.getMaster()?.getGameRound()?.getPot() ?? 0, this.lang, true) },
|
|
211
|
-
},
|
|
212
|
-
),
|
|
213
|
-
));
|
|
214
|
-
|
|
215
|
-
return summary;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
getSummaryWaiting () {
|
|
219
|
-
const summary = new BaseTableGameStateSummary();
|
|
220
|
-
|
|
221
|
-
summary.list.push(BaseTableGameSummaryItem.newBodyMdItem(
|
|
222
|
-
'waiting',
|
|
223
|
-
this.t('room.screen.waiting.for.the.players', { lang: this.lang }),
|
|
224
|
-
));
|
|
225
|
-
|
|
226
|
-
return summary;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
getSummaryEnd () {
|
|
230
|
-
const summary = new BaseTableGameStateSummary();
|
|
231
|
-
|
|
232
|
-
summary.list.push(BaseTableGameSummaryItem.newBodySmItem(
|
|
233
|
-
'WINNER',
|
|
234
|
-
this.t('room.screen.summary.winner', { lang: this.lang }),
|
|
235
|
-
this._master.getGameResultHelper()?.getWinnersName() ?? '',
|
|
236
|
-
));
|
|
237
|
-
|
|
238
|
-
summary.list.push(BaseTableGameSummaryItem.newBodySmItem(
|
|
239
|
-
'NEW_GAME',
|
|
240
|
-
this.t('room.screen.summary.new.game', { lang: this.lang }),
|
|
241
|
-
this.t('room.screen.summary.new.game.value', { lang: this.lang }),
|
|
242
|
-
));
|
|
243
|
-
|
|
244
|
-
return summary;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
getConfirmExitDialog (): IAppScreenDialog | undefined {
|
|
248
|
-
if (this._currentPlayer.isPlayer()) {
|
|
249
|
-
return new SimpleRoomConfirmExitDialogView(
|
|
250
|
-
this._master.getRoom().getLocaleService(),
|
|
251
|
-
this.lang
|
|
252
|
-
).build();
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
getState (): IBaseTableGameState {
|
|
257
|
-
return {
|
|
258
|
-
roomId: this.getRoomId(),
|
|
259
|
-
tableId: this.getTableId(),
|
|
260
|
-
gameId: this.getGameId(),
|
|
261
|
-
tableSize: this.getTableSize(),
|
|
262
|
-
checkPlayersTurnTimerRemain: this.getPlayerTurnTimerRemain(),
|
|
263
|
-
restartTimerRemain: this.getRestartTimerRemain(),
|
|
264
|
-
yoursMessage: this.getYoursMessage(),
|
|
265
|
-
summary: this.getSummary(),
|
|
266
|
-
movesPanel: this.getMovesPanel(),
|
|
267
|
-
extraButtons: this.getExtraButtons(),
|
|
268
|
-
tableTitle: this.getTableTitle(),
|
|
269
|
-
confirmExitDialog: this.getConfirmExitDialog(),
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ICardTableGameState,
|
|
3
|
-
ICardPlayerState,
|
|
4
|
-
CardsPanelState,
|
|
5
|
-
ICardsPanelState,
|
|
6
|
-
ICardPairSlotState,
|
|
7
|
-
CardPairSlotState,
|
|
8
|
-
} from 'jp.common.models';
|
|
9
|
-
import { CardsGameMaster, CardsPlayer } from 'jp.ms.common.engine';
|
|
10
|
-
|
|
11
|
-
import { BaseTableGameStateAdapter } from './base-table-game-state-adapter';
|
|
12
|
-
|
|
13
|
-
export abstract class CardTableGameStateAdapter extends BaseTableGameStateAdapter {
|
|
14
|
-
override getPlayer (item: CardsPlayer): ICardPlayerState {
|
|
15
|
-
return {
|
|
16
|
-
...super.getPlayer(item),
|
|
17
|
-
cards: item.getCards(),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
override getPlayers (): Array<ICardPlayerState> {
|
|
22
|
-
return this.getMaster<CardsGameMaster>().getTable().getPlayers<CardsPlayer>().map((item) => this.getPlayer(item));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getPlayerCards () {
|
|
26
|
-
return this.getCurrentPlayer<CardsPlayer>().getCards();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getCardsPanelIsOpen (): boolean {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getCardsPanelEnableDragging (): boolean {
|
|
34
|
-
return this.getCurrentPlayer().isActivePlayer();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getCardsPanelDescription (): string {
|
|
38
|
-
if (this.getCurrentPlayer().isActivePlayer()) {
|
|
39
|
-
return this.t('room.screen.yours.player.turn.timeout', { lang: this.lang });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return '';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getCardsPanel (): ICardsPanelState {
|
|
46
|
-
return new CardsPanelState(
|
|
47
|
-
this.getCardsPanelIsOpen(),
|
|
48
|
-
this.getPlayerActions(),
|
|
49
|
-
this.getPlayerCards(),
|
|
50
|
-
this.getCardsPanelEnableDragging(),
|
|
51
|
-
this.getCardsPanelDescription(),
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
getSlots (): Array<ICardPairSlotState> {
|
|
56
|
-
const slots = this.getMaster<CardsGameMaster>().getGameCardPairSlots().getSlots()
|
|
57
|
-
.map((item) => new CardPairSlotState(
|
|
58
|
-
item.id,
|
|
59
|
-
item.bottom,
|
|
60
|
-
item.top,
|
|
61
|
-
item.activated,
|
|
62
|
-
this.getCurrentPlayer().isActivePlayer() ? item.disabled : true,
|
|
63
|
-
));
|
|
64
|
-
|
|
65
|
-
return slots;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
getState (): ICardTableGameState {
|
|
69
|
-
return {
|
|
70
|
-
...super.getState(),
|
|
71
|
-
players: this.getPlayers(),
|
|
72
|
-
baseCard: this.getMaster<CardsGameMaster>().getGameBaseCard(),
|
|
73
|
-
gameCards: this.getMaster<CardsGameMaster>().getGameCards(),
|
|
74
|
-
gameCardsPair: this.getSlots(),
|
|
75
|
-
cardsPanel: this.getCardsPanel(),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
}
|
package/src/adapter/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CardTableGameStateAdapter } from './card-table-game-state-adapter';
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Expose, Type } from 'class-transformer';
|
|
2
|
-
import { IsNumber, IsString, ValidateNested } from 'class-validator';
|
|
3
|
-
import { IBaseTableGameState } from 'jp.common.models';
|
|
4
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
5
|
-
|
|
6
|
-
import { AppScreenDialogDto } from '../../app-screen/app-screen-dialog.dto';
|
|
7
|
-
|
|
8
|
-
import { BaseTableSummaryDto } from './base-table-summary.dto';
|
|
9
|
-
import { BaseTableMovesPanelDto } from './base-table-moves-panel.dto';
|
|
10
|
-
|
|
11
|
-
export class BaseTableGameStateDto implements IBaseTableGameState {
|
|
12
|
-
@ApiProperty({
|
|
13
|
-
description: 'Room ID',
|
|
14
|
-
required: true,
|
|
15
|
-
type: String,
|
|
16
|
-
})
|
|
17
|
-
@Expose()
|
|
18
|
-
@IsString()
|
|
19
|
-
roomId: string;
|
|
20
|
-
|
|
21
|
-
@ApiProperty({
|
|
22
|
-
description: 'Table ID',
|
|
23
|
-
required: true,
|
|
24
|
-
type: String,
|
|
25
|
-
})
|
|
26
|
-
@Expose()
|
|
27
|
-
@IsString()
|
|
28
|
-
tableId: string;
|
|
29
|
-
|
|
30
|
-
@ApiProperty({
|
|
31
|
-
description: 'Game ID',
|
|
32
|
-
required: true,
|
|
33
|
-
type: String,
|
|
34
|
-
})
|
|
35
|
-
@Expose()
|
|
36
|
-
@IsString()
|
|
37
|
-
gameId: string;
|
|
38
|
-
|
|
39
|
-
@ApiProperty({
|
|
40
|
-
description: 'Table Size',
|
|
41
|
-
type: Number,
|
|
42
|
-
})
|
|
43
|
-
@IsNumber()
|
|
44
|
-
@Expose()
|
|
45
|
-
tableSize: number;
|
|
46
|
-
|
|
47
|
-
@ApiProperty({
|
|
48
|
-
description: 'Your message',
|
|
49
|
-
required: true,
|
|
50
|
-
type: String,
|
|
51
|
-
})
|
|
52
|
-
@Expose()
|
|
53
|
-
@IsString()
|
|
54
|
-
yoursMessage: string;
|
|
55
|
-
|
|
56
|
-
@ValidateNested()
|
|
57
|
-
@Type(() => BaseTableSummaryDto)
|
|
58
|
-
@Expose()
|
|
59
|
-
summary: BaseTableSummaryDto;
|
|
60
|
-
|
|
61
|
-
@ApiProperty({
|
|
62
|
-
description: 'Player Turn Timer Remain',
|
|
63
|
-
type: Number,
|
|
64
|
-
})
|
|
65
|
-
@IsNumber()
|
|
66
|
-
@Expose()
|
|
67
|
-
checkPlayersTurnTimerRemain?: number;
|
|
68
|
-
|
|
69
|
-
@ApiProperty({
|
|
70
|
-
description: 'Restart Timer Remain',
|
|
71
|
-
type: Number,
|
|
72
|
-
})
|
|
73
|
-
@IsNumber()
|
|
74
|
-
@Expose()
|
|
75
|
-
restartTimerRemain?: number;
|
|
76
|
-
|
|
77
|
-
@ValidateNested()
|
|
78
|
-
@Type(() => BaseTableMovesPanelDto)
|
|
79
|
-
@Expose()
|
|
80
|
-
movesPanel: BaseTableMovesPanelDto;
|
|
81
|
-
|
|
82
|
-
@ApiProperty({
|
|
83
|
-
description: 'Table title',
|
|
84
|
-
required: true,
|
|
85
|
-
type: String,
|
|
86
|
-
})
|
|
87
|
-
@Expose()
|
|
88
|
-
@IsString()
|
|
89
|
-
tableTitle: string;
|
|
90
|
-
|
|
91
|
-
@ValidateNested()
|
|
92
|
-
@Type(() => AppScreenDialogDto)
|
|
93
|
-
@Expose()
|
|
94
|
-
confirmExitDialog?: AppScreenDialogDto;
|
|
95
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Expose, Type } from 'class-transformer';
|
|
2
|
-
import { IsArray, ValidateNested } from 'class-validator';
|
|
3
|
-
import { IBaseTableGameStateSummary } from 'jp.common.models';
|
|
4
|
-
|
|
5
|
-
import { BaseTableSummaryItemDto } from './base-table-summary-item.dto';
|
|
6
|
-
|
|
7
|
-
export class BaseTableSummaryDto implements IBaseTableGameStateSummary {
|
|
8
|
-
@IsArray()
|
|
9
|
-
@ValidateNested({ each: true })
|
|
10
|
-
@Type(() => BaseTableSummaryItemDto)
|
|
11
|
-
@Expose()
|
|
12
|
-
list: Array<BaseTableSummaryItemDto>;
|
|
13
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Expose, Type } from 'class-transformer';
|
|
2
|
-
import { IsArray, IsBoolean, IsNumber, IsString, ValidateNested } from 'class-validator';
|
|
3
|
-
import { ICardPlayerState } from 'jp.common.models';
|
|
4
|
-
import { ApiProperty } from '@nestjs/swagger';
|
|
5
|
-
|
|
6
|
-
import { CardDto } from './card.dto';
|
|
7
|
-
import { GamePlayerDto } from '../base/game-player.dto';
|
|
8
|
-
|
|
9
|
-
export class CardPlayerDto extends GamePlayerDto implements ICardPlayerState {
|
|
10
|
-
@IsArray()
|
|
11
|
-
@ValidateNested({ each: true })
|
|
12
|
-
@Type(() => CardDto)
|
|
13
|
-
@Expose()
|
|
14
|
-
cards: Array<CardDto>;
|
|
15
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Expose, plainToInstance, Type } from 'class-transformer';
|
|
2
|
-
import { IsArray, ValidateNested } from 'class-validator';
|
|
3
|
-
import { ICardTableGameState } from 'jp.common.models';
|
|
4
|
-
|
|
5
|
-
import { CardTableGameStateAdapter } from '../../../adapter';
|
|
6
|
-
|
|
7
|
-
import { CardPlayerDto } from './card-player.dto';
|
|
8
|
-
import { CardPairSlotDto } from './card-pair-slot.dto';
|
|
9
|
-
import { CardDto } from './card.dto';
|
|
10
|
-
import { CardsPanelDto } from './cards-panel.dto';
|
|
11
|
-
import { BaseTableGameStateDto } from '../base/base-table-game-state.dto';
|
|
12
|
-
|
|
13
|
-
export class CardTableGameStateDto extends BaseTableGameStateDto implements ICardTableGameState {
|
|
14
|
-
@IsArray()
|
|
15
|
-
@ValidateNested({ each: true })
|
|
16
|
-
@Type(() => CardPlayerDto)
|
|
17
|
-
@Expose()
|
|
18
|
-
players: Array<CardPlayerDto>;
|
|
19
|
-
|
|
20
|
-
@IsArray()
|
|
21
|
-
@ValidateNested({ each: true })
|
|
22
|
-
@Type(() => CardDto)
|
|
23
|
-
@Expose()
|
|
24
|
-
gameCards: Array<CardDto>;
|
|
25
|
-
|
|
26
|
-
@IsArray()
|
|
27
|
-
@ValidateNested({ each: true })
|
|
28
|
-
@Type(() => CardPairSlotDto)
|
|
29
|
-
@Expose()
|
|
30
|
-
gameCardsPair: Array<CardPairSlotDto>;
|
|
31
|
-
|
|
32
|
-
@ValidateNested()
|
|
33
|
-
@Type(() => CardDto)
|
|
34
|
-
@Expose()
|
|
35
|
-
baseCard?: CardDto;
|
|
36
|
-
|
|
37
|
-
@ValidateNested()
|
|
38
|
-
@Type(() => CardsPanelDto)
|
|
39
|
-
@Expose()
|
|
40
|
-
cardsPanel: CardsPanelDto;
|
|
41
|
-
|
|
42
|
-
constructor(entity: ICardTableGameState) {
|
|
43
|
-
super();
|
|
44
|
-
return plainToInstance(CardTableGameStateDto, entity, { excludeExtraneousValues: true })
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
static fromAdapter (adapter: CardTableGameStateAdapter) {
|
|
48
|
-
return new CardTableGameStateDto(adapter.getState());
|
|
49
|
-
}
|
|
50
|
-
}
|
|
File without changes
|