texas-poker-core 1.4.2 → 1.4.4
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/README.md +9 -1
- package/dist/Controller/index.js +40 -19
- package/dist/Player/index.js +11 -7
- package/dist/TexasError/codes.js +20 -1
- package/dist/TexasError/index.js +12 -0
- package/dist/index.js +14 -0
- package/package.json +1 -1
- package/types/Controller/index.d.ts +12 -3
- package/types/Player/index.d.ts +3 -1
- package/types/Texas/index.d.ts +2 -2
- package/types/TexasError/codes.d.ts +10 -0
- package/types/TexasError/index.d.ts +2 -1
- package/types/index.d.ts +2 -2
package/README.md
CHANGED
package/dist/Controller/index.js
CHANGED
|
@@ -63,6 +63,9 @@ var Controller = /*#__PURE__*/function () {
|
|
|
63
63
|
throw error;
|
|
64
64
|
};
|
|
65
65
|
_classCallCheck(this, Controller);
|
|
66
|
+
/**
|
|
67
|
+
* ① 仅剩一名玩家未弃牌(至少两人局才有「独赢」)
|
|
68
|
+
*/
|
|
66
69
|
_classPrivateMethodInitSpec(this, _Controller_brand);
|
|
67
70
|
_classPrivateFieldInitSpec(this, _status, 'idle');
|
|
68
71
|
_classPrivateFieldInitSpec(this, _stage, StageEnum.PRE_FLOP);
|
|
@@ -103,6 +106,22 @@ var Controller = /*#__PURE__*/function () {
|
|
|
103
106
|
get: function get() {
|
|
104
107
|
return _classPrivateFieldGet(_activePlayer, this);
|
|
105
108
|
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "shouldShowDown",
|
|
111
|
+
value:
|
|
112
|
+
/**
|
|
113
|
+
* ② 结束条件(没人还能操作):
|
|
114
|
+
* - 场上只剩 out / allIn(无 waiting)=> 直接结束(可能发生在任意街:多人全下)
|
|
115
|
+
* - 河牌圈且所有仍可行动玩家都不可 actionable(即便 status 仍为 waiting)=> 结束
|
|
116
|
+
*/
|
|
117
|
+
function shouldShowDown() {
|
|
118
|
+
var playersCanAct = _classPrivateFieldGet(_dealer, this).getPlayersCanAct();
|
|
119
|
+
|
|
120
|
+
// 只剩 1 名未弃牌玩家时由 `#isWinByExclusiveFold` 先结束,不会走到此处。
|
|
121
|
+
return playersCanAct.length === 0 || _classPrivateFieldGet(_stage, this) === StageEnum.RIVER && playersCanAct.every(function (player) {
|
|
122
|
+
return !player.actionable();
|
|
123
|
+
});
|
|
124
|
+
}
|
|
106
125
|
}, {
|
|
107
126
|
key: "transferControlTo",
|
|
108
127
|
value:
|
|
@@ -111,7 +130,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
111
130
|
* @param player
|
|
112
131
|
*/
|
|
113
132
|
function transferControlTo(player) {
|
|
114
|
-
if (_classPrivateFieldGet(_activePlayer, this) === player) return this.fail(new _TexasError.default(_TexasError.TexasCoreErrorCode.CTRL_DUPLICATE_CONTROL));
|
|
133
|
+
if (player !== null && _classPrivateFieldGet(_activePlayer, this) === player) return this.fail(new _TexasError.default(_TexasError.TexasCoreErrorCode.CTRL_DUPLICATE_CONTROL));
|
|
115
134
|
_classPrivateFieldSet(_activePlayer, this, player);
|
|
116
135
|
player === null || player === void 0 || player.getControl();
|
|
117
136
|
}
|
|
@@ -125,18 +144,14 @@ var Controller = /*#__PURE__*/function () {
|
|
|
125
144
|
}, {
|
|
126
145
|
key: "tryToEndGame",
|
|
127
146
|
value: function tryToEndGame() {
|
|
128
|
-
|
|
129
|
-
return player.getStatus() === 'out';
|
|
130
|
-
}).length === _classPrivateFieldGet(_dealer, this).count - 1;
|
|
131
|
-
|
|
132
|
-
// 其他玩家都弃牌了
|
|
133
|
-
if (otherPlayersFold) {
|
|
147
|
+
if (_assertClassBrand(_Controller_brand, this, _isWinByExclusiveFold).call(this)) {
|
|
134
148
|
var _classPrivateFieldGet2;
|
|
135
149
|
this.end();
|
|
136
150
|
_classPrivateFieldSet(_endAt, this, _classPrivateFieldGet(_stage, this));
|
|
137
151
|
(_classPrivateFieldGet2 = _classPrivateFieldGet(_callbackOfEnd, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.call(this, {
|
|
138
|
-
|
|
152
|
+
pokesToReveal: this.getCommonPokes(_classPrivateFieldGet(_stage, this), _classPrivateFieldGet(_endAt, this)),
|
|
139
153
|
currentStage: _classPrivateFieldGet(_stage, this),
|
|
154
|
+
endStage: _classPrivateFieldGet(_endAt, this),
|
|
140
155
|
showHandPokes: false
|
|
141
156
|
});
|
|
142
157
|
_TexasEngineContext.TexasEngineContext.emitTrace({
|
|
@@ -148,13 +163,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
148
163
|
});
|
|
149
164
|
return true;
|
|
150
165
|
}
|
|
151
|
-
|
|
152
|
-
// 可以行动的人数(非allIn & out) <= 1 && 可以行动的人采取了行动
|
|
153
|
-
var playersCanAct = _classPrivateFieldGet(_dealer, this).getPlayersCanAct();
|
|
154
|
-
var shouldEndGame = playersCanAct.length === 0 || playersCanAct.length === 1 && !playersCanAct[0].actionable() || _classPrivateFieldGet(_dealer, this).every(function (player) {
|
|
155
|
-
return !player.actionable();
|
|
156
|
-
}) && _classPrivateFieldGet(_stage, this) === StageEnum.RIVER;
|
|
157
|
-
if (shouldEndGame) {
|
|
166
|
+
if (this.shouldShowDown()) {
|
|
158
167
|
var _classPrivateFieldGet4;
|
|
159
168
|
this.end();
|
|
160
169
|
_classPrivateFieldSet(_endAt, this, this.stage);
|
|
@@ -162,11 +171,12 @@ var Controller = /*#__PURE__*/function () {
|
|
|
162
171
|
rankCategory = _classPrivateFieldGet3.rankCategory,
|
|
163
172
|
pokes = _classPrivateFieldGet3.pokes;
|
|
164
173
|
(_classPrivateFieldGet4 = _classPrivateFieldGet(_callbackOfEnd, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.call(this, {
|
|
174
|
+
bestPokes: pokes,
|
|
165
175
|
showHandPokes: true,
|
|
166
176
|
currentStage: _classPrivateFieldGet(_stage, this),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
177
|
+
endStage: StageEnum.RIVER,
|
|
178
|
+
bestRankCategory: rankCategory,
|
|
179
|
+
pokesToReveal: this.getCommonPokes(_classPrivateFieldGet(_stage, this), StageEnum.RIVER)
|
|
170
180
|
});
|
|
171
181
|
_TexasEngineContext.TexasEngineContext.emitTrace({
|
|
172
182
|
channel: 'controller',
|
|
@@ -196,6 +206,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
196
206
|
var index = stages.findIndex(function (stage) {
|
|
197
207
|
return stage === _classPrivateFieldGet(_stage, _this);
|
|
198
208
|
});
|
|
209
|
+
if (index < 0 || index >= stages.length - 1) return false;
|
|
199
210
|
var currentStage = _classPrivateFieldGet(_stage, this);
|
|
200
211
|
var nextStage = stages[index + 1];
|
|
201
212
|
_classPrivateFieldSet(_stage, this, nextStage);
|
|
@@ -205,7 +216,7 @@ var Controller = /*#__PURE__*/function () {
|
|
|
205
216
|
(_classPrivateFieldGet5 = _classPrivateFieldGet(_callbackOnNextStage, this)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.call(this, {
|
|
206
217
|
stage: nextStage,
|
|
207
218
|
lastStage: currentStage,
|
|
208
|
-
|
|
219
|
+
pokesToReveal: this.getCommonPokes(currentStage, nextStage)
|
|
209
220
|
});
|
|
210
221
|
_TexasEngineContext.TexasEngineContext.emitTrace({
|
|
211
222
|
channel: 'controller',
|
|
@@ -409,6 +420,16 @@ var Controller = /*#__PURE__*/function () {
|
|
|
409
420
|
}
|
|
410
421
|
}]);
|
|
411
422
|
}();
|
|
423
|
+
function _isWinByExclusiveFold() {
|
|
424
|
+
var n = _classPrivateFieldGet(_dealer, this).count;
|
|
425
|
+
if (n < 2) return this.fail(new _TexasError.default(_TexasError.TexasCoreErrorCode.CTRL_ENDGAME_INVARIANT_DEALER_LT_2, {
|
|
426
|
+
count: n
|
|
427
|
+
}));
|
|
428
|
+
var folded = _classPrivateFieldGet(_dealer, this).filter(function (p) {
|
|
429
|
+
return p.getStatus() === 'out';
|
|
430
|
+
}).length;
|
|
431
|
+
return folded === n - 1;
|
|
432
|
+
}
|
|
412
433
|
function _getPokeEndIndex(stage) {
|
|
413
434
|
if (stage === StageEnum.PRE_FLOP) return 0;
|
|
414
435
|
if (stage === StageEnum.FLOP) return 3;
|
package/dist/Player/index.js
CHANGED
|
@@ -1007,17 +1007,21 @@ var Player = exports.Player = /*#__PURE__*/function () {
|
|
|
1007
1007
|
}
|
|
1008
1008
|
|
|
1009
1009
|
/**
|
|
1010
|
-
* @description 获取行动前的min~max 下注金额范围
|
|
1010
|
+
* @description 获取行动前的 min~max 下注金额范围
|
|
1011
|
+
* - max:当前玩家剩余筹码(可全下上限)
|
|
1012
|
+
* - min:大盲、本家余额、当轮桌上「已下注额」正数最小值 三者取小(有人短码只下 300 时,后续玩家 min 可低至 300)
|
|
1011
1013
|
*/
|
|
1012
1014
|
}, {
|
|
1013
1015
|
key: "getRestrict",
|
|
1014
1016
|
value: function getRestrict() {
|
|
1015
|
-
var max =
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1017
|
+
var max = this.balance;
|
|
1018
|
+
var positiveStageTotals = _classPrivateFieldGet(_dealer, this).map(function (p) {
|
|
1019
|
+
return _classPrivateFieldGet(_currentStageTotalAmount, p);
|
|
1020
|
+
}).filter(function (n) {
|
|
1021
|
+
return n > 0;
|
|
1022
|
+
});
|
|
1023
|
+
var minBetOnTableThisRound = positiveStageTotals.length > 0 ? Math.min.apply(Math, _toConsumableArray(positiveStageTotals)) : _classPrivateFieldGet(_lowestBetAmount, this);
|
|
1024
|
+
var min = Math.min(_classPrivateFieldGet(_lowestBetAmount, this), this.balance, minBetOnTableThisRound);
|
|
1021
1025
|
return {
|
|
1022
1026
|
min: min,
|
|
1023
1027
|
max: max
|
package/dist/TexasError/codes.js
CHANGED
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TexasCoreErrorCode = void 0;
|
|
7
7
|
exports.formatTexasErrorMessage = formatTexasErrorMessage;
|
|
8
|
+
exports.getTexasErrorSeverity = getTexasErrorSeverity;
|
|
9
|
+
exports.isFatalTexasErrorCode = isFatalTexasErrorCode;
|
|
8
10
|
/**
|
|
9
11
|
* 错误码分段(建议业务按段做文案/i18n):
|
|
10
12
|
* 3100–3199 房间 / 座位
|
|
@@ -40,6 +42,8 @@ var TexasCoreErrorCode = exports.TexasCoreErrorCode = {
|
|
|
40
42
|
CTRL_END_NOT_IN_HAND: 3303,
|
|
41
43
|
CTRL_SB_BB_MISSING: 3305,
|
|
42
44
|
CTRL_START_NO_ACTIVE: 3306,
|
|
45
|
+
/** tryToEndGame:Dealer 人数不足 2,流程损坏 */
|
|
46
|
+
CTRL_ENDGAME_INVARIANT_DEALER_LT_2: 3307,
|
|
43
47
|
PLAYER_ACTION_INVALID: 3401,
|
|
44
48
|
PLAYER_CANNOT_CHECK: 3402,
|
|
45
49
|
PLAYER_CANNOT_FOLD: 3403,
|
|
@@ -68,8 +72,21 @@ var TexasCoreErrorCode = exports.TexasCoreErrorCode = {
|
|
|
68
72
|
DEALER_COUNT_OUT_OF_RANGE: 3605,
|
|
69
73
|
INTERNAL_NO_NEXT_PLAYER: 3901
|
|
70
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* 错误严重程度分级(用于 server 侧错误路由):
|
|
77
|
+
* - recoverable: 业务校验失败/重复请求/时序不匹配,可仅拒绝当前动作
|
|
78
|
+
* - fatal: 核心不变量或流程损坏,建议中止当前对局并广播异常
|
|
79
|
+
*/
|
|
80
|
+
function getTexasErrorSeverity(code) {
|
|
81
|
+
var fatalCodes = new Set([TexasCoreErrorCode.CTRL_SB_BB_MISSING, TexasCoreErrorCode.CTRL_START_NO_ACTIVE, TexasCoreErrorCode.CTRL_ENDGAME_INVARIANT_DEALER_LT_2, TexasCoreErrorCode.POOL_PAY_INVALID, TexasCoreErrorCode.INTERNAL_NO_NEXT_PLAYER, TexasCoreErrorCode.DEALER_BUTTON_HANDOFF_INVALID]);
|
|
82
|
+
if (fatalCodes.has(code)) return 'fatal';
|
|
83
|
+
return 'recoverable';
|
|
84
|
+
}
|
|
85
|
+
function isFatalTexasErrorCode(code) {
|
|
86
|
+
return getTexasErrorSeverity(code) === 'fatal';
|
|
87
|
+
}
|
|
71
88
|
function formatTexasErrorMessage(code, payload) {
|
|
72
|
-
var _p$min, _p$detail;
|
|
89
|
+
var _p$min, _p$count, _p$detail;
|
|
73
90
|
var p = payload !== null && payload !== void 0 ? payload : {};
|
|
74
91
|
switch (code) {
|
|
75
92
|
case TexasCoreErrorCode.ROOM_READY_MIN_SEATED:
|
|
@@ -118,6 +135,8 @@ function formatTexasErrorMessage(code, payload) {
|
|
|
118
135
|
return '游戏进程异常: 小盲或大盲玩家不存在';
|
|
119
136
|
case TexasCoreErrorCode.CTRL_START_NO_ACTIVE:
|
|
120
137
|
return '游戏进程异常';
|
|
138
|
+
case TexasCoreErrorCode.CTRL_ENDGAME_INVARIANT_DEALER_LT_2:
|
|
139
|
+
return "\u6E38\u620F\u8FDB\u7A0B\u5F02\u5E38: \u8FDB\u884C\u4E2D\u624B\u724C Dealer \u4EBA\u6570\u4E0D\u8DB3 (".concat((_p$count = p.count) !== null && _p$count !== void 0 ? _p$count : '?', ")");
|
|
121
140
|
case TexasCoreErrorCode.PLAYER_ACTION_INVALID:
|
|
122
141
|
return String((_p$detail = p.detail) !== null && _p$detail !== void 0 ? _p$detail : '玩家行为异常');
|
|
123
142
|
case TexasCoreErrorCode.PLAYER_CANNOT_CHECK:
|
package/dist/TexasError/index.js
CHANGED
|
@@ -16,6 +16,18 @@ Object.defineProperty(exports, "formatTexasErrorMessage", {
|
|
|
16
16
|
return _codes.formatTexasErrorMessage;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "getTexasErrorSeverity", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _codes.getTexasErrorSeverity;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "isFatalTexasErrorCode", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function get() {
|
|
28
|
+
return _codes.isFatalTexasErrorCode;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
19
31
|
Object.defineProperty(exports, "texasErrorCategory", {
|
|
20
32
|
enumerable: true,
|
|
21
33
|
get: function get() {
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,8 @@ var _exportNames = {
|
|
|
35
35
|
texasErrorMap: true,
|
|
36
36
|
TexasCoreErrorCode: true,
|
|
37
37
|
texasErrorCategory: true,
|
|
38
|
+
getTexasErrorSeverity: true,
|
|
39
|
+
isFatalTexasErrorCode: true,
|
|
38
40
|
formatTexasErrorMessage: true
|
|
39
41
|
};
|
|
40
42
|
Object.defineProperty(exports, "Action", {
|
|
@@ -199,6 +201,18 @@ Object.defineProperty(exports, "getStrengthFromRankSignature", {
|
|
|
199
201
|
return _core.getStrengthFromRankSignature;
|
|
200
202
|
}
|
|
201
203
|
});
|
|
204
|
+
Object.defineProperty(exports, "getTexasErrorSeverity", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function get() {
|
|
207
|
+
return _TexasError.getTexasErrorSeverity;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "isFatalTexasErrorCode", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function get() {
|
|
213
|
+
return _TexasError.isFatalTexasErrorCode;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
202
216
|
Object.defineProperty(exports, "roleMap", {
|
|
203
217
|
enumerable: true,
|
|
204
218
|
get: function get() {
|
package/package.json
CHANGED
|
@@ -10,14 +10,17 @@ export declare enum StageEnum {
|
|
|
10
10
|
}
|
|
11
11
|
export type Stage = StageEnum;
|
|
12
12
|
export type CallbackOfGameEnd = (params: {
|
|
13
|
-
|
|
13
|
+
/** 与 `onNextStage` 中 `pokesToReveal` 一致:`getCommonPokes(fromStage, toStage)` 本段新亮出的公牌 */
|
|
14
|
+
pokesToReveal: Poke[];
|
|
14
15
|
currentStage: Stage;
|
|
15
|
-
|
|
16
|
+
/** 本手结束所在街;摊牌结束为河牌 */
|
|
17
|
+
endStage: Stage;
|
|
16
18
|
bestPokes?: Poke[][];
|
|
17
19
|
bestRankCategory?: RankCategory;
|
|
20
|
+
showHandPokes: boolean;
|
|
18
21
|
}) => void;
|
|
19
22
|
export type CallbackOnNextStage = (params: {
|
|
20
|
-
|
|
23
|
+
pokesToReveal: Poke[];
|
|
21
24
|
stage: Stage;
|
|
22
25
|
lastStage: Stage;
|
|
23
26
|
}) => void;
|
|
@@ -43,6 +46,12 @@ declare class Controller implements GameComponent {
|
|
|
43
46
|
get stage(): StageEnum;
|
|
44
47
|
get endAt(): StageEnum;
|
|
45
48
|
get activePlayer(): Player | null;
|
|
49
|
+
/**
|
|
50
|
+
* ② 结束条件(没人还能操作):
|
|
51
|
+
* - 场上只剩 out / allIn(无 waiting)=> 直接结束(可能发生在任意街:多人全下)
|
|
52
|
+
* - 河牌圈且所有仍可行动玩家都不可 actionable(即便 status 仍为 waiting)=> 结束
|
|
53
|
+
*/
|
|
54
|
+
shouldShowDown(): boolean;
|
|
46
55
|
/**
|
|
47
56
|
* @description 将控制器移交给指定玩家
|
|
48
57
|
* @param player
|
package/types/Player/index.d.ts
CHANGED
|
@@ -142,7 +142,9 @@ export declare class Player implements GameComponent {
|
|
|
142
142
|
pause(): void;
|
|
143
143
|
removeControl(): void;
|
|
144
144
|
/**
|
|
145
|
-
* @description 获取行动前的min~max 下注金额范围
|
|
145
|
+
* @description 获取行动前的 min~max 下注金额范围
|
|
146
|
+
* - max:当前玩家剩余筹码(可全下上限)
|
|
147
|
+
* - min:大盲、本家余额、当轮桌上「已下注额」正数最小值 三者取小(有人短码只下 300 时,后续玩家 min 可低至 300)
|
|
146
148
|
*/
|
|
147
149
|
getRestrict(): {
|
|
148
150
|
min: number;
|
package/types/Texas/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import type { Poke } from '../Deck/constant';
|
|
1
2
|
import Pool from '../Pool';
|
|
2
3
|
import Room from '../Room';
|
|
3
4
|
import Dealer from '../Dealer';
|
|
4
5
|
import TexasError from '../TexasError';
|
|
5
|
-
import Player, { User, ActionType, CallbackOfAction
|
|
6
|
+
import Player, { User, Role, ActionType, CallbackOfAction } from '../Player';
|
|
6
7
|
import Controller, { CallbackOfGameEnd, CallbackOnNextStage } from '../Controller';
|
|
7
8
|
import { type TexasEngineGlobalOptions } from '../TexasEngineContext';
|
|
8
|
-
import type { Poke } from '../Deck/constant';
|
|
9
9
|
export interface CreateRoomInputArgs {
|
|
10
10
|
lowestBetAmount: number;
|
|
11
11
|
/** 单桌最大入座人数(不超过引擎支持上限) */
|
|
@@ -32,6 +32,8 @@ export declare const TexasCoreErrorCode: {
|
|
|
32
32
|
readonly CTRL_END_NOT_IN_HAND: 3303;
|
|
33
33
|
readonly CTRL_SB_BB_MISSING: 3305;
|
|
34
34
|
readonly CTRL_START_NO_ACTIVE: 3306;
|
|
35
|
+
/** tryToEndGame:Dealer 人数不足 2,流程损坏 */
|
|
36
|
+
readonly CTRL_ENDGAME_INVARIANT_DEALER_LT_2: 3307;
|
|
35
37
|
readonly PLAYER_ACTION_INVALID: 3401;
|
|
36
38
|
readonly PLAYER_CANNOT_CHECK: 3402;
|
|
37
39
|
readonly PLAYER_CANNOT_FOLD: 3403;
|
|
@@ -62,4 +64,12 @@ export declare const TexasCoreErrorCode: {
|
|
|
62
64
|
};
|
|
63
65
|
export type TexasErrorCode = (typeof TexasCoreErrorCode)[keyof typeof TexasCoreErrorCode];
|
|
64
66
|
export type TexasErrorPayload = Record<string, unknown>;
|
|
67
|
+
export type TexasErrorSeverity = 'recoverable' | 'fatal';
|
|
68
|
+
/**
|
|
69
|
+
* 错误严重程度分级(用于 server 侧错误路由):
|
|
70
|
+
* - recoverable: 业务校验失败/重复请求/时序不匹配,可仅拒绝当前动作
|
|
71
|
+
* - fatal: 核心不变量或流程损坏,建议中止当前对局并广播异常
|
|
72
|
+
*/
|
|
73
|
+
export declare function getTexasErrorSeverity(code: TexasErrorCode): TexasErrorSeverity;
|
|
74
|
+
export declare function isFatalTexasErrorCode(code: TexasErrorCode): boolean;
|
|
65
75
|
export declare function formatTexasErrorMessage(code: TexasErrorCode, payload?: TexasErrorPayload): string;
|
|
@@ -6,6 +6,7 @@ declare class TexasError extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
export default TexasError;
|
|
8
8
|
export type { TexasErrorCode, TexasErrorPayload };
|
|
9
|
-
export { TexasCoreErrorCode, formatTexasErrorMessage } from './codes';
|
|
9
|
+
export { TexasCoreErrorCode, formatTexasErrorMessage, getTexasErrorSeverity, isFatalTexasErrorCode } from './codes';
|
|
10
|
+
export type { TexasErrorSeverity } from './codes';
|
|
10
11
|
export { texasErrorCategory, texasErrorMap } from './constant';
|
|
11
12
|
export type { TexasErrorCodeLegacy } from './constant';
|
package/types/index.d.ts
CHANGED
|
@@ -8,9 +8,9 @@ import { Stage, StageEnum, HandLifecycle } from './Controller';
|
|
|
8
8
|
import { RoomStatus, default as Room, PlayerSeatStatus, type RoomCreateOptions } from './Room';
|
|
9
9
|
import { TexasEngineContext, type TexasTraceEvent, type TexasSimulationFlags, type TexasEngineGlobalOptions } from './TexasEngineContext';
|
|
10
10
|
import { User, Role, Action, RoleEnum, ActionType, OnlineStatus, ActionTypeEnum, default as Player, type PlayerActionPolicy } from './Player';
|
|
11
|
-
import TexasError, { texasErrorMap, TexasCoreErrorCode, texasErrorCategory, type TexasErrorCode, type TexasErrorPayload, formatTexasErrorMessage, type TexasErrorCodeLegacy } from './TexasError';
|
|
11
|
+
import TexasError, { texasErrorMap, TexasCoreErrorCode, texasErrorCategory, type TexasErrorCode, getTexasErrorSeverity, isFatalTexasErrorCode, type TexasErrorPayload, type TexasErrorSeverity, formatTexasErrorMessage, type TexasErrorCodeLegacy } from './TexasError';
|
|
12
12
|
export * from './Deck/constant';
|
|
13
13
|
export { getBestPokesRankSignature, compareRankSignature, getFiveCardsStrength, getStrengthFromRankSignature } from './Deck/core';
|
|
14
|
-
export { Player, User, ActionType, ActionTypeEnum, Role, RoleEnum, Action, roleMap, ActionTypeMap, Stage, StageEnum, HandLifecycle, stageMap, Dealer, Deck, Room, RoomStatus, PlayerSeatStatus, type RoomCreateOptions, formatterPoke, TexasError, TexasErrorCode, TexasErrorPayload, TexasCoreErrorCode, formatTexasErrorMessage, texasErrorMap, texasErrorCategory, TexasEngineContext, Texas, OnlineStatus, type PlayerActionPolicy, type TexasEngineGlobalOptions, type TexasSimulationFlags, type TexasTraceEvent,
|
|
14
|
+
export { Player, User, ActionType, ActionTypeEnum, Role, RoleEnum, Action, roleMap, ActionTypeMap, Stage, StageEnum, HandLifecycle, stageMap, Dealer, Deck, Room, RoomStatus, PlayerSeatStatus, type RoomCreateOptions, formatterPoke, TexasError, TexasErrorCode, TexasErrorPayload, TexasErrorSeverity, TexasCoreErrorCode, formatTexasErrorMessage, getTexasErrorSeverity, isFatalTexasErrorCode, texasErrorMap, texasErrorCategory, TexasEngineContext, Texas, OnlineStatus, type PlayerActionPolicy, type TexasEngineGlobalOptions, type TexasSimulationFlags, type TexasTraceEvent,
|
|
15
15
|
/** @deprecated 旧版宽泛 code 类型,请逐步迁移到 TexasErrorCode */
|
|
16
16
|
type TexasErrorCodeLegacy };
|