koishi-plugin-ciyi 1.2.3 → 1.2.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/lib/index.js CHANGED
@@ -709,7 +709,7 @@ function renderWinCard(service, opts) {
709
709
  textLeft(ctx, stats[i].c, sx + s(14), y + s(44), `${s(10.5)}px ${FONT_SERIF}`, C.ink3);
710
710
  }
711
711
  const quip = opts.closest === null ? "一击即中,今日无需第二次落笔" : `从 #${opts.closest} 一步跨到 #1`;
712
- const footerTip = "明日零点换新题 · ciyi.排行榜";
712
+ const footerTip = opts.canStartToday ? "ciyi.猜 山水 · 开启今日新题" : "明日零点换新题 · ciyi.排行榜";
713
713
  drawFooter(
714
714
  ctx,
715
715
  ix,
@@ -1041,7 +1041,7 @@ function apply(ctx, cfg) {
1041
1041
  `累计 ${o.username} 已猜中 ${o.score} 次`,
1042
1042
  o.neighbors.length ? `近旁 ${o.neighbors.join(" · ")}` : null
1043
1043
  ].filter(Boolean),
1044
- "明日零点换新题 · ciyi.排行榜 看战绩"
1044
+ o.canStartToday ? "继续 ciyi.猜 山水 · 开启今日新题" : "明日零点换新题 · ciyi.排行榜 看战绩"
1045
1045
  );
1046
1046
  }
1047
1047
  __name(winText, "winText");
@@ -1119,7 +1119,7 @@ function apply(ctx, cfg) {
1119
1119
  __name(phb, "phb");
1120
1120
  async function getTodayGame(session) {
1121
1121
  const current = (await ctx.database.get("ciyi", { channelId: session.channelId }))[0];
1122
- if (current && isSameDayInChina(session.timestamp, current.lastStartTimestamp)) {
1122
+ if (current && (!current.isOver || isSameDayInChina(session.timestamp, current.lastStartTimestamp))) {
1123
1123
  return current;
1124
1124
  }
1125
1125
  const oldGuessedWords = current?.guessedWords ?? [];
@@ -1214,7 +1214,11 @@ function apply(ctx, cfg) {
1214
1214
  // 榜首是答案自己,紧随其后的几个才是「最像它的词」
1215
1215
  neighbors: gameInfo.rankList.slice(1, 6),
1216
1216
  username: session.username,
1217
- score
1217
+ score,
1218
+ canStartToday: !isSameDayInChina(
1219
+ session.timestamp,
1220
+ gameInfo.lastStartTimestamp
1221
+ )
1218
1222
  };
1219
1223
  return await sendCard(session, () => renderWinCard(ctx.canvas, win), winText(win));
1220
1224
  }
package/lib/view.d.ts CHANGED
@@ -38,6 +38,7 @@ export interface WinOptions {
38
38
  neighbors: string[];
39
39
  username: string;
40
40
  score: number;
41
+ canStartToday: boolean;
41
42
  }
42
43
  export interface RankEntry {
43
44
  username: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ciyi",
3
3
  "description": "Koishi 的词意(猜词游戏)插件。根据词语的含义相似程度,猜测正确的词语。",
4
- "version": "1.2.3",
4
+ "version": "1.2.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [