@hieuzest/koishi-plugin-mahjongpub 0.3.9 → 0.3.10

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.
Files changed (2) hide show
  1. package/lib/index.js +11 -15
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -702,21 +702,16 @@ var ContestManager2 = class extends import_koishi2.Service {
702
702
  const round = Object.values(rounds).find((x) => x.round === (cextra.round ?? contest.c_round) && x.t_class === cls);
703
703
  const basePlayers = round.tids.map((tid) => getRowPlayer(contest, teams[tid], rowi, cextra.playerIndex));
704
704
  const players = basePlayers.map((x, i) => cextra.playerOverrides[cls]?.[i] ?? x);
705
- if (!players.every((x) => x)) {
706
- return {
707
- status: "error",
708
- rowi,
709
- msg: "名单未填写"
710
- };
711
- }
705
+ const hasEmptyPlayer = !players.every((x) => x);
712
706
  try {
713
707
  const overrides = cextra.pointOverrides[cls];
714
708
  if (cextra.type === "ti") {
715
709
  return {
716
- status: cextra.stopCls.has(cls) ? "suspended" : "pending",
710
+ status: cextra.stopCls.has(cls) ? "suspended" : hasEmptyPlayer ? "error" : "pending",
717
711
  rowi,
712
+ msg: hasEmptyPlayer ? "名单未填写" : void 0,
718
713
  next: players.map((x, i) => ({
719
- player: x,
714
+ player: x || "",
720
715
  point: overrides?.[i] ?? (lastRecord ? lastRecord.results?.[i].num : 1e5),
721
716
  tid: round.tids[i],
722
717
  teammates: teams[round.tids[i]]?.players
@@ -724,10 +719,11 @@ var ContestManager2 = class extends import_koishi2.Service {
724
719
  };
725
720
  } else if (cextra.type === "ssb") {
726
721
  return {
727
- status: cextra.stopCls.has(cls) ? "suspended" : "pending",
722
+ status: cextra.stopCls.has(cls) ? "suspended" : hasEmptyPlayer ? "error" : "pending",
728
723
  rowi,
724
+ msg: hasEmptyPlayer ? "名单未填写" : void 0,
729
725
  next: players.map((x, i) => ({
730
- player: x,
726
+ player: x || "",
731
727
  point: overrides?.[i] ?? 25e3,
732
728
  tid: round.tids[i],
733
729
  teammates: teams[round.tids[i]]?.players
@@ -1331,11 +1327,11 @@ var MahjongPub2 = class extends import_koishi4.Service {
1331
1327
  ctx.model.extend("mahjongpub.contests", {
1332
1328
  cid: "unsigned",
1333
1329
  type: "string",
1334
- round: "unsigned",
1330
+ round: { type: "unsigned", nullable: true },
1335
1331
  lobby: "string",
1336
- playerIndex: "unsigned",
1337
- ver: "unsigned",
1338
- maxRow: "unsigned",
1332
+ playerIndex: { type: "unsigned", nullable: true },
1333
+ ver: { type: "unsigned", initial: 0 },
1334
+ maxRow: { type: "unsigned", nullable: true },
1339
1335
  schedules: {
1340
1336
  type: "json",
1341
1337
  initial: []
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hieuzest/koishi-plugin-mahjongpub",
3
3
  "description": "Mahjong.pub API",
4
- "version": "0.3.9",
4
+ "version": "0.3.10",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [