koishi-plugin-ggcevo-game 1.0.6 → 1.0.8

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 +59 -20
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -195,16 +195,12 @@ function apply(ctx, config) {
195
195
  async function gachaWithHiddenAward(handle) {
196
196
  const backpackItems = await ctx.database.get("ggcevo_backpack", {
197
197
  handle,
198
- itemId: { $in: [1, 2, 3] }
198
+ itemId: { $in: [2, 3] }
199
199
  });
200
200
  const itemMap = new Map(backpackItems.map((item) => [item.itemId, item]));
201
201
  const isWin = HiddenAward();
202
202
  if (isWin) {
203
203
  const updates = [
204
- {
205
- itemId: 1,
206
- addAmount: 100
207
- },
208
204
  {
209
205
  itemId: 2,
210
206
  addAmount: 1
@@ -293,7 +289,7 @@ function apply(ctx, config) {
293
289
  `🎰 您使用了 ${quantity} 枚咕咕币`,
294
290
  winCount > 0 ? `🎉 其中获得 ${winCount} 张兑换券!` : "💔 本次未获得任何兑换券",
295
291
  `📊 当前保底进度:${record.pityCounter}/90`,
296
- ...hiddenWinCount > 0 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 ${hiddenWinCount * 100} 枚咕咕币, ${hiddenWinCount} 张兑换券,以及 ${hiddenWinCount} 枚扭蛋币!`] : []
292
+ ...hiddenWinCount > 0 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 ${hiddenWinCount} 张兑换券和 ${hiddenWinCount} 枚扭蛋币!`] : []
297
293
  ].join("\n");
298
294
  });
299
295
  ctx.command("ggcevo/单抽").action(async (argv) => {
@@ -325,7 +321,7 @@ function apply(ctx, config) {
325
321
  const [record] = await ctx.database.get("ggcevo_records", { handle });
326
322
  return [
327
323
  `${result ? "🎉 获得兑换券!" : "❌ 未中奖"} 保底进度:${record.pityCounter}/90`,
328
- ...HiddenAward2 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 100 枚咕咕币, 1 张兑换券,以及 1 枚扭蛋币!`] : []
324
+ ...HiddenAward2 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 1 张兑换券和 1 枚扭蛋币!`] : []
329
325
  ].join("\n");
330
326
  });
331
327
  ctx.command("ggcevo/十连抽").action(async (argv) => {
@@ -364,7 +360,7 @@ function apply(ctx, config) {
364
360
  "十连抽结果:",
365
361
  ...results.map((r) => r ? "⭐获得兑换券" : "❌未中奖"),
366
362
  `保底进度:${record.pityCounter}/90`,
367
- ...hiddenWinCount > 0 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 ${hiddenWinCount * 100} 枚咕咕币, ${hiddenWinCount} 张兑换券,以及 ${hiddenWinCount} 枚扭蛋币!`] : []
363
+ ...hiddenWinCount > 0 ? [`🎉 恭喜你抽中隐藏奖励,额外获得 ${hiddenWinCount} 张兑换券和 ${hiddenWinCount} 枚扭蛋币!`] : []
368
364
  ].join("\n");
369
365
  });
370
366
  ctx.command("ggcevo/抽奖记录").action(async (argv) => {
@@ -881,16 +877,27 @@ ID:${activity.id}
881
877
  displayName: await checkSensitiveWord(item.name) ? item.name : (item.name[0] || "") + "***"
882
878
  }))
883
879
  );
880
+ const ggcmap = await ctx.database.get("sc2arcade_map", { guildId: config.ggcqun });
881
+ const lastdate = ggcmap[0].lastdate;
884
882
  const rankingText = processedRecords.map(
885
883
  (item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 胜率: ${item.matches === 0 ? "0.00%" : (item.wins / item.matches * 100).toFixed(2) + "%"}`
886
884
  ).join("\n");
887
885
  return [
888
886
  `🏆 GGCEvo S1赛季胜点榜 🏆`,
889
- `本赛季从4月1日至5月15日23点结算`,
890
- `第 ${pageNum} 页 共 ${totalPages} 页`,
887
+ `本赛季从4月1日至5月15日23点`,
888
+ `数据同步时间: ${lastdate.toLocaleString("zh-CN", {
889
+ timeZone: "Asia/Shanghai",
890
+ year: "numeric",
891
+ month: "2-digit",
892
+ day: "2-digit",
893
+ hour: "2-digit",
894
+ minute: "2-digit",
895
+ hour12: false
896
+ })}`,
891
897
  "------------------------------",
892
898
  rankingText,
893
899
  "------------------------------",
900
+ `第 ${pageNum} 页 / 共 ${totalPages} 页`,
894
901
  pageNum < totalPages ? `输入 胜点榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
895
902
  ].join("\n");
896
903
  });
@@ -1311,7 +1318,7 @@ ${achievementList.join("\n")}`;
1311
1318
  ──────────────`);
1312
1319
  const [sign] = await ctx.database.get("ggcevo_sign", { handle });
1313
1320
  if (sign) {
1314
- const chinaTime = sign.lastSign.toLocaleString("zh-CN", {
1321
+ const chinaTime = new Date(sign.lastSign).toLocaleString("zh-CN", {
1315
1322
  timeZone: "Asia/Shanghai",
1316
1323
  year: "numeric",
1317
1324
  month: "2-digit",
@@ -1339,22 +1346,54 @@ ${achievementList.join("\n")}`;
1339
1346
  "──────────────"
1340
1347
  );
1341
1348
  }
1342
- const [achievements] = await ctx.database.get("ggcevo_achievements", { handle });
1343
- if (achievements) {
1344
- output.push(
1345
- "🏆 已获成就:",
1346
- `${achievements.achievementname} (${achievements.gaintime.toLocaleDateString("zh-CN", {
1349
+ const achievements = await ctx.database.get("ggcevo_achievements", { handle });
1350
+ if (achievements.length) {
1351
+ output.push("🏆 最近成就:");
1352
+ achievements.sort((a, b) => {
1353
+ const aTime = new Date(a.gaintime).getTime();
1354
+ const bTime = new Date(b.gaintime).getTime();
1355
+ return bTime - aTime;
1356
+ }).slice(0, 3).forEach((ach) => {
1357
+ const time = new Date(ach.gaintime).toLocaleDateString("zh-CN", {
1347
1358
  timeZone: "Asia/Shanghai",
1348
1359
  year: "numeric",
1349
1360
  month: "2-digit",
1350
1361
  day: "2-digit"
1351
- })})`,
1362
+ });
1363
+ output.push(`├ ${ach.achievementname} (${time})`);
1364
+ });
1365
+ output.push(
1366
+ `└ 共获得 ${achievements.length} 个成就`,
1352
1367
  "──────────────"
1353
1368
  );
1354
1369
  }
1355
- const sections = [sign, lottery, achievements].filter(Boolean).length;
1356
- output.push(`共查询到 ${sections} 项个人信息`);
1357
- return output.flat().join("\n");
1370
+ const exchanges = await ctx.database.get("ggcevo_exchange", { handle });
1371
+ if (exchanges.length) {
1372
+ output.push("📜 兑换记录:");
1373
+ exchanges.sort((a, b) => {
1374
+ const aTime = new Date(a.date).getTime();
1375
+ const bTime = new Date(b.date).getTime();
1376
+ return bTime - aTime;
1377
+ }).forEach((e, index) => {
1378
+ const date = new Date(e.date).toLocaleString("zh-CN", {
1379
+ timeZone: "Asia/Shanghai",
1380
+ year: "numeric",
1381
+ month: "2-digit",
1382
+ day: "2-digit"
1383
+ });
1384
+ const symbol = index === exchanges.length - 1 ? "└" : "├";
1385
+ output.push(`${symbol} [${e.type}] ${e.item} (${date})`);
1386
+ });
1387
+ output.push("──────────────");
1388
+ }
1389
+ const existModules = [
1390
+ sign && "签到",
1391
+ lottery && "抽奖",
1392
+ achievements.length && "成就",
1393
+ exchanges.length && "兑换"
1394
+ ].filter(Boolean);
1395
+ output.push(`📊 共查询到 ${existModules.length} 类信息`);
1396
+ return output.join("\n");
1358
1397
  });
1359
1398
  }
1360
1399
  __name(apply, "apply");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [