texas-poker-core 1.3.2 → 1.4.1

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 CHANGED
@@ -383,17 +383,26 @@ bufix
383
383
  修复行动前下注金额错误计算逻辑
384
384
 
385
385
  ## 1.2.7
386
- 不使用core.js
386
+
387
+ 不使用 core.js
387
388
 
388
389
  ## 1.2.8
389
- 增加deck.core下部分函数导出
390
+
391
+ 增加 deck.core 下部分函数导出
390
392
 
391
393
  ## 1.2.9
392
- 使用枚举值重构action&stage; 调整presentation的计算方式, 增加转换Int的方法, 便于以后数据库索引
394
+
395
+ 使用枚举值重构 action&stage; 调整 presentation 的计算方式, 增加转换 Int 的方法, 便于以后数据库索引
393
396
 
394
397
  ## 1.3.0
395
398
 
396
399
  ## 1.3.1
400
+
397
401
  重命名不合理的变量名称, 以防后期使用使混淆
402
+
398
403
  ## 1.3.2
399
- 新增角色枚举
404
+
405
+ 新增角色枚举
406
+
407
+ ## 1.4.1
408
+ 重命名变量
@@ -146,15 +146,15 @@ var Controller = /*#__PURE__*/function () {
146
146
  var _classPrivateFieldGet4;
147
147
  this.end();
148
148
  _classPrivateFieldSet(_endAt, this, this.stage);
149
- var _classPrivateFieldGet3 = _classPrivateFieldGet(_dealer, this).deck.getMaxRankSignatureAndPokes(),
150
- rankSignature = _classPrivateFieldGet3.rankSignature,
149
+ var _classPrivateFieldGet3 = _classPrivateFieldGet(_dealer, this).deck.getBestRankInfo(),
150
+ rankCategory = _classPrivateFieldGet3.rankCategory,
151
151
  pokes = _classPrivateFieldGet3.pokes;
152
152
  (_classPrivateFieldGet4 = _classPrivateFieldGet(_callbackOfEnd, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.call(this, {
153
153
  showHandPokes: true,
154
154
  currentStage: _classPrivateFieldGet(_stage, this),
155
155
  restCommonPokes: this.getCommonPokes(_classPrivateFieldGet(_stage, this), StageEnum.RIVER),
156
- maxPokes: pokes,
157
- maxRankCategory: rankSignature[0]
156
+ bestPokes: pokes,
157
+ bestRankCategory: rankCategory
158
158
  });
159
159
  console.log('游戏结束(shouldEndGame):', _classPrivateFieldGet(_endAt, this));
160
160
  return true;
@@ -14,14 +14,10 @@ var _core = require("../Deck/core");
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
16
16
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
17
18
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
18
19
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
19
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
20
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
21
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
22
20
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
23
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
24
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
25
21
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
26
22
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
27
23
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
@@ -126,27 +122,17 @@ var Dealer = /*#__PURE__*/function () {
126
122
  * @description 获取场上最大的牌力签名(用于比较/展示)
127
123
  */
128
124
  }, {
129
- key: "getMaxRankSignature",
130
- value: function getMaxRankSignature() {
131
- var _this$filter$map$filt = this.filter(function (player) {
132
- return player.getStatus() !== 'out';
133
- }).map(function (player) {
134
- return player.rankSignature;
135
- }).filter(Boolean).sort(function (a, b) {
136
- return (0, _core.compareRankSignature)(a, b);
137
- }),
138
- _this$filter$map$filt2 = _slicedToArray(_this$filter$map$filt, 1),
139
- max = _this$filter$map$filt2[0];
140
- return max;
125
+ key: "getBestRankSignature",
126
+ value: function getBestRankSignature() {
127
+ return _classPrivateFieldGet(_deck, this).getBestRankSignature();
141
128
  }
142
129
  /**
143
130
  * @description 获取最大牌型 category(首字符)
144
131
  */
145
132
  }, {
146
- key: "getMaxRankCategory",
147
- value: function getMaxRankCategory() {
148
- var maxRankSig = this.getMaxRankSignature();
149
- return maxRankSig[0];
133
+ key: "getBestRankCategory",
134
+ value: function getBestRankCategory() {
135
+ return _classPrivateFieldGet(_deck, this).getBestRankCategory();
150
136
  }
151
137
 
152
138
  /** 获取场上最大的牌型组合(可能多玩家并列) */
package/dist/Deck/core.js CHANGED
@@ -6,9 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.formatterPoke = exports.compareRankSignature = exports.compareFn = void 0;
7
7
  exports.getBestFiveCards = getBestFiveCards;
8
8
  exports.getBestPokesRankSignature = getBestPokesRankSignature;
9
+ exports.getBestRankCategory = getBestRankCategory;
10
+ exports.getBestRankInfo = getBestRankInfo;
9
11
  exports.getFiveCardsRankSignature = getFiveCardsRankSignature;
10
12
  exports.getFiveCardsStrength = getFiveCardsStrength;
11
- exports.getMaxRankSignatureAndPokes = getMaxRankSignatureAndPokes;
12
13
  exports.getSortedAllHandPokesCombinations = getSortedAllHandPokesCombinations;
13
14
  exports.getStrengthFromRankSignature = getStrengthFromRankSignature;
14
15
  exports.isStraight = exports.getWinners = void 0;
@@ -302,24 +303,32 @@ function getBestPokesRankSignature(handPokes, commonPokes) {
302
303
  maxOne = _getSortedAllHandPoke2[0];
303
304
  return getFiveCardsRankSignature(maxOne);
304
305
  }
306
+ function getBestRankCategory(handPokes, commonPokes) {
307
+ var _getBestPokesRankSign = getBestPokesRankSignature(handPokes, commonPokes),
308
+ _getBestPokesRankSign2 = _slicedToArray(_getBestPokesRankSign, 1),
309
+ bestRankSignature = _getBestPokesRankSign2[0];
310
+ return bestRankSignature[0];
311
+ }
305
312
 
306
- /** 获取多组手牌与公共牌组合中的最大牌型签名及其对应的五张牌 */
307
- function getMaxRankSignatureAndPokes(handPokes, commonPokes) {
313
+ /** 获取多组手牌与公共牌组合中的最佳牌型信息(签名 + 类别)及其对应的五张牌 */
314
+ function getBestRankInfo(handPokes, commonPokes) {
308
315
  var allCombinations = getSortedAllHandPokesCombinations(handPokes, commonPokes);
309
- var maxRankSignature = getFiveCardsRankSignature(allCombinations[0]);
310
- var maxPokes = allCombinations.map(function (combination) {
316
+ var rankSignature = getFiveCardsRankSignature(allCombinations[0]);
317
+ var rankCategory = rankSignature[0];
318
+ var pokes = allCombinations.map(function (combination) {
311
319
  return {
312
320
  rankSignature: getFiveCardsRankSignature(combination),
313
321
  pokes: combination
314
322
  };
315
323
  }).filter(function (item) {
316
- return item.rankSignature === maxRankSignature;
324
+ return item.rankSignature === rankSignature;
317
325
  }).map(function (item) {
318
326
  return item.pokes;
319
327
  });
320
328
  return {
321
- rankSignature: maxRankSignature,
322
- pokes: maxPokes
329
+ rankSignature: rankSignature,
330
+ rankCategory: rankCategory,
331
+ pokes: pokes
323
332
  };
324
333
  }
325
334
  /**
@@ -122,20 +122,25 @@ var Deck = /*#__PURE__*/function () {
122
122
  return _classPrivateFieldGet(_deck, this);
123
123
  }
124
124
  }, {
125
- key: "getMaxRankCategory",
126
- value: function getMaxRankCategory() {
125
+ key: "getBestRankCategory",
126
+ value: function getBestRankCategory() {
127
127
  var rankSignature = (0, _core.getBestPokesRankSignature)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this));
128
128
  return rankSignature[0];
129
129
  }
130
130
  }, {
131
- key: "getMaxPokeCombinations",
132
- value: function getMaxPokeCombinations() {
133
- return (0, _core.getMaxRankSignatureAndPokes)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this)).pokes;
131
+ key: "getBestRankSignature",
132
+ value: function getBestRankSignature() {
133
+ return (0, _core.getBestRankCategory)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this));
134
134
  }
135
135
  }, {
136
- key: "getMaxRankSignatureAndPokes",
137
- value: function getMaxRankSignatureAndPokes() {
138
- return (0, _core.getMaxRankSignatureAndPokes)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this));
136
+ key: "getBestRankInfo",
137
+ value: function getBestRankInfo() {
138
+ return (0, _core.getBestRankInfo)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this));
139
+ }
140
+ }, {
141
+ key: "getBestPokeCombinations",
142
+ value: function getBestPokeCombinations() {
143
+ return (0, _core.getBestRankInfo)(_classPrivateFieldGet(_handPokes, this), _classPrivateFieldGet(_commonPokes, this)).pokes;
139
144
  }
140
145
  }]);
141
146
  }();
@@ -21,8 +21,8 @@ exports.default = void 0;
21
21
  var _TexasError = _interopRequireDefault(require("../TexasError"));
22
22
  var _utils = require("../utils");
23
23
  var _config = require("../config");
24
- var _constant = require("./constant");
25
24
  var _Controller = require("../Controller");
25
+ var _constant = require("./constant");
26
26
  var _Player;
27
27
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
28
28
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
@@ -71,6 +71,7 @@ var _handPokes = /*#__PURE__*/new WeakMap();
71
71
  var _bestFiveCards = /*#__PURE__*/new WeakMap();
72
72
  var _rankSignature = /*#__PURE__*/new WeakMap();
73
73
  var _rankStrength = /*#__PURE__*/new WeakMap();
74
+ var _rankCategory = /*#__PURE__*/new WeakMap();
74
75
  var _callback = /*#__PURE__*/new WeakMap();
75
76
  var _callbackOfAction = /*#__PURE__*/new WeakMap();
76
77
  var _Player_brand = /*#__PURE__*/new WeakSet();
@@ -151,9 +152,10 @@ var Player = exports.Player = /*#__PURE__*/function () {
151
152
  /**
152
153
  * 与公共牌组合后的最佳五张牌(best 5-card combination)
153
154
  */
154
- _classPrivateFieldInitSpec(this, _bestFiveCards, undefined);
155
+ _classPrivateFieldInitSpec(this, _bestFiveCards, void 0);
155
156
  _classPrivateFieldInitSpec(this, _rankSignature, void 0);
156
157
  _classPrivateFieldInitSpec(this, _rankStrength, 0);
158
+ _classPrivateFieldInitSpec(this, _rankCategory, void 0);
157
159
  _classPrivateFieldInitSpec(this, _callback, void 0);
158
160
  /**
159
161
  * 用户采取行动
@@ -252,6 +254,7 @@ var Player = exports.Player = /*#__PURE__*/function () {
252
254
  },
253
255
  set: function set(value) {
254
256
  _classPrivateFieldSet(_rankSignature, this, value);
257
+ _classPrivateFieldSet(_rankCategory, this, value[0]);
255
258
  }
256
259
  }, {
257
260
  key: "getNextPlayer",
package/dist/index.js CHANGED
@@ -27,8 +27,8 @@ var _exportNames = {
27
27
  PlayerSeatStatus: true,
28
28
  User: true,
29
29
  Role: true,
30
- RoleEnum: true,
31
30
  Action: true,
31
+ RoleEnum: true,
32
32
  ActionType: true,
33
33
  OnlineStatus: true,
34
34
  ActionTypeEnum: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "texas-poker-core",
3
- "version": "1.3.2",
3
+ "version": "1.4.1",
4
4
  "description": "德州扑克核心功能",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "build:core": "babel src --out-dir dist --extensions \".ts\"",
17
17
  "build": "cross-env PROJECT_ENV=prd pnpm run build:types && pnpm run build:core",
18
18
  "push": "ts-node ./publish",
19
- "push-local": "pnpm run test && pnpm run build && pnpm run cp",
19
+ "push-local": "pnpm run build && pnpm run test && pnpm run build && pnpm run cp",
20
20
  "cp:types": "cp -r ./dist /Users/yangxuanjing/Desktop/coding/wish_mono_server/node_modules/texas-poker-core",
21
21
  "cp:js": "cp -r ./types /Users/yangxuanjing/Desktop/coding/wish_mono_server/node_modules/texas-poker-core",
22
22
  "cp": "pnpm run cp:types && pnpm run cp:js",
@@ -13,8 +13,8 @@ export type CallbackOfGameEnd = (params: {
13
13
  restCommonPokes: Poke[];
14
14
  currentStage: Stage;
15
15
  showHandPokes: boolean;
16
- maxPokes?: Poke[][];
17
- maxRankCategory?: RankCategory;
16
+ bestPokes?: Poke[][];
17
+ bestRankCategory?: RankCategory;
18
18
  }) => void;
19
19
  export type CallbackOnNextStage = (params: {
20
20
  commonPokes: Poke[];
@@ -1,6 +1,5 @@
1
1
  import Deck from '../Deck';
2
2
  import { Player } from '../Player';
3
- import { RankCategory } from '../Deck/constant';
4
3
  import { GameComponent, TexasErrorCallback } from '../Texas';
5
4
  /**
6
5
  * 荷官, 控制游戏进行
@@ -21,11 +20,11 @@ declare class Dealer implements GameComponent {
21
20
  /**
22
21
  * @description 获取场上最大的牌力签名(用于比较/展示)
23
22
  */
24
- getMaxRankSignature(): `s${string}` | `t${string}` | `q${string}` | `z${string}` | `y${string}` | `x${string}` | `w${string}` | `v${string}` | `u${string}` | `r${string}`;
23
+ getBestRankSignature(): import("..").RankCategory;
25
24
  /**
26
25
  * @description 获取最大牌型 category(首字符)
27
26
  */
28
- getMaxRankCategory(): RankCategory;
27
+ getBestRankCategory(): import("..").RankCategory;
29
28
  /** 获取场上最大的牌型组合(可能多玩家并列) */
30
29
  getTableBestFiveCards(): (("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[] | undefined)[];
31
30
  logPlayers(): void;
@@ -1,5 +1,5 @@
1
1
  import { Player } from '../Player';
2
- import { Poke, Rank, RankSignature } from './constant';
2
+ import { Poke, Rank, RankCategory, RankSignature } from './constant';
3
3
  /**
4
4
  * @description 判断是否为顺子, 并且返回最大顺子的值
5
5
  * @param values
@@ -51,9 +51,11 @@ export declare function getSortedAllHandPokesCombinations(handPokes: Poke[][], c
51
51
  * @param commonPokes 公共牌
52
52
  */
53
53
  export declare function getBestPokesRankSignature(handPokes: Poke[][], commonPokes: Poke[]): `s${string}` | `t${string}` | `q${string}` | `z${string}` | `y${string}` | `x${string}` | `w${string}` | `v${string}` | `u${string}` | `r${string}`;
54
- /** 获取多组手牌与公共牌组合中的最大牌型签名及其对应的五张牌 */
55
- export declare function getMaxRankSignatureAndPokes(handPokes: Poke[][], commonPokes: Poke[]): {
54
+ export declare function getBestRankCategory(handPokes: Poke[][], commonPokes: Poke[]): RankCategory;
55
+ /** 获取多组手牌与公共牌组合中的最佳牌型信息(签名 + 类别)及其对应的五张牌 */
56
+ export declare function getBestRankInfo(handPokes: Poke[][], commonPokes: Poke[]): {
56
57
  rankSignature: `s${string}` | `t${string}` | `q${string}` | `z${string}` | `y${string}` | `x${string}` | `w${string}` | `v${string}` | `u${string}` | `r${string}`;
58
+ rankCategory: RankCategory;
57
59
  pokes: ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
58
60
  };
59
61
  /**
@@ -21,11 +21,13 @@ declare class Deck {
21
21
  commonPokes: ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[];
22
22
  };
23
23
  getCards(): ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[];
24
- getMaxRankCategory(): RankCategory;
25
- getMaxPokeCombinations(): ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
26
- getMaxRankSignatureAndPokes(): {
24
+ getBestRankCategory(): RankCategory;
25
+ getBestRankSignature(): RankCategory;
26
+ getBestRankInfo(): {
27
27
  rankSignature: `s${string}` | `t${string}` | `q${string}` | `z${string}` | `y${string}` | `x${string}` | `w${string}` | `v${string}` | `u${string}` | `r${string}`;
28
+ rankCategory: RankCategory;
28
29
  pokes: ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
29
30
  };
31
+ getBestPokeCombinations(): ("h2" | "h3" | "h4" | "h5" | "h6" | "h7" | "h8" | "h9" | "ht" | "hj" | "hq" | "hk" | "ha" | "s2" | "s3" | "s4" | "s5" | "s6" | "s7" | "s8" | "s9" | "st" | "sj" | "sq" | "sk" | "sa" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "dt" | "dj" | "dq" | "dk" | "da" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ct" | "cj" | "cq" | "ck" | "ca")[][];
30
32
  }
31
33
  export default Deck;
@@ -1,9 +1,9 @@
1
1
  import Pool from '../Pool';
2
2
  import Dealer from '../Dealer';
3
- import { ActionTypeEnum, RoleEnum, type Role } from './constant';
4
3
  import Controller from '../Controller';
5
4
  import { Poke, RankSignature } from '../Deck/constant';
6
5
  import { PreAction, GameComponent, TexasErrorCallback } from '../Texas';
6
+ import { RoleEnum, type Role, ActionTypeEnum } from './constant';
7
7
  export { ActionTypeEnum };
8
8
  type PlayerStatus = 'allIn' | 'active' | 'waiting' | 'out';
9
9
  export type OnlineStatus = 'online' | 'offline';
package/types/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { roleMap, ActionTypeMap } from './Player/constant';
8
8
  import { Stage, StageEnum, ControllerStatus } from './Controller';
9
9
  import { texasErrorMap, TexasErrorCode } from './TexasError/constant';
10
10
  import { RoomStatus, default as Room, PlayerSeatStatus } from './Room';
11
- import { User, Role, RoleEnum, Action, ActionType, OnlineStatus, ActionTypeEnum, default as Player } from './Player';
11
+ import { User, Role, Action, RoleEnum, ActionType, OnlineStatus, ActionTypeEnum, default as Player } from './Player';
12
12
  export * from './Deck/constant';
13
13
  export { getBestPokesRankSignature, compareRankSignature, getFiveCardsStrength, getStrengthFromRankSignature } from './Deck/core';
14
14
  export { Player, User, ActionType, ActionTypeEnum, Role, RoleEnum, Action, roleMap, ActionTypeMap, Stage, StageEnum, ControllerStatus, stageMap, Dealer, Deck, Room, RoomStatus, PlayerSeatStatus, formatterPoke, TexasError, TexasErrorCode, texasErrorMap, Texas, OnlineStatus };
@@ -1,25 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.texasErrorMap = void 0;
7
- require("core-js/modules/es.array.iterator.js");
8
- require("core-js/modules/es.map.js");
9
- require("core-js/modules/es.object.to-string.js");
10
- require("core-js/modules/es.string.iterator.js");
11
- require("core-js/modules/esnext.map.delete-all.js");
12
- require("core-js/modules/esnext.map.every.js");
13
- require("core-js/modules/esnext.map.filter.js");
14
- require("core-js/modules/esnext.map.find.js");
15
- require("core-js/modules/esnext.map.find-key.js");
16
- require("core-js/modules/esnext.map.includes.js");
17
- require("core-js/modules/esnext.map.key-of.js");
18
- require("core-js/modules/esnext.map.map-keys.js");
19
- require("core-js/modules/esnext.map.map-values.js");
20
- require("core-js/modules/esnext.map.merge.js");
21
- require("core-js/modules/esnext.map.reduce.js");
22
- require("core-js/modules/esnext.map.some.js");
23
- require("core-js/modules/esnext.map.update.js");
24
- require("core-js/modules/web.dom-collections.iterator.js");
25
- var texasErrorMap = exports.texasErrorMap = new Map([[2000, '游戏进程异常'], [2001, '游戏数据异常'], [2003, '玩家行为异常'], [2100, '其他异常']]);
@@ -1,65 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.js");
4
- require("core-js/modules/es.symbol.description.js");
5
- require("core-js/modules/es.symbol.iterator.js");
6
- require("core-js/modules/es.array.iterator.js");
7
- require("core-js/modules/es.map.js");
8
- require("core-js/modules/es.object.get-prototype-of.js");
9
- require("core-js/modules/es.object.to-string.js");
10
- require("core-js/modules/es.reflect.construct.js");
11
- require("core-js/modules/es.regexp.to-string.js");
12
- require("core-js/modules/es.string.iterator.js");
13
- require("core-js/modules/esnext.map.delete-all.js");
14
- require("core-js/modules/esnext.map.every.js");
15
- require("core-js/modules/esnext.map.filter.js");
16
- require("core-js/modules/esnext.map.find.js");
17
- require("core-js/modules/esnext.map.find-key.js");
18
- require("core-js/modules/esnext.map.includes.js");
19
- require("core-js/modules/esnext.map.key-of.js");
20
- require("core-js/modules/esnext.map.map-keys.js");
21
- require("core-js/modules/esnext.map.map-values.js");
22
- require("core-js/modules/esnext.map.merge.js");
23
- require("core-js/modules/esnext.map.reduce.js");
24
- require("core-js/modules/esnext.map.some.js");
25
- require("core-js/modules/esnext.map.update.js");
26
- require("core-js/modules/web.dom-collections.iterator.js");
27
- Object.defineProperty(exports, "__esModule", {
28
- value: true
29
- });
30
- exports.default = void 0;
31
- require("core-js/modules/es.symbol.to-primitive.js");
32
- require("core-js/modules/es.date.to-primitive.js");
33
- require("core-js/modules/es.function.name.js");
34
- require("core-js/modules/es.number.constructor.js");
35
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
36
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
37
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
38
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
39
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
40
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
41
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
42
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
43
- function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
44
- function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
45
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
46
- function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
47
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
48
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
49
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
50
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
51
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
52
- var TexasError = /*#__PURE__*/function (_Error) {
53
- function TexasError(code, message) {
54
- var _this;
55
- _classCallCheck(this, TexasError);
56
- _this = _callSuper(this, TexasError, [message]);
57
- _defineProperty(_this, "code", void 0);
58
- _this.code = code;
59
- _this.name = 'Texas Error';
60
- return _this;
61
- }
62
- _inherits(TexasError, _Error);
63
- return _createClass(TexasError);
64
- }(/*#__PURE__*/_wrapNativeSuper(Error));
65
- var _default = exports.default = TexasError;
@@ -1,2 +0,0 @@
1
- export declare const texasErrorMap: Map<2000 | 2001 | 2003 | 2100, "游戏进程异常" | "游戏数据异常" | "玩家行为异常" | "其他异常">;
2
- export type TexasErrorCode = Parameters<typeof texasErrorMap.get>[0];
@@ -1,6 +0,0 @@
1
- import { TexasErrorCode } from './constant';
2
- declare class TexasError extends Error {
3
- code: TexasErrorCode;
4
- constructor(code: TexasErrorCode, message: string);
5
- }
6
- export default TexasError;