koishi-plugin-ggcevo-game 0.3.13 → 0.3.15

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 +52 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -395,9 +395,6 @@ ${itemDetails.join("\n")}`;
395
395
  const now = /* @__PURE__ */ new Date();
396
396
  const chinatime = convertUTCtoChinaTime(now);
397
397
  const is23Hour = chinatime.getHours() === 23;
398
- if (!is23Hour && !isSameDate(latestTime, chinatime)) {
399
- return "暂未查询到您今天最近的20场战绩内游玩过 咕咕虫-evolved 地图,请游玩1次后签到(对局记录上传有延迟)";
400
- }
401
398
  const [record] = await ctx.database.get("ggcevo_sign", { handle });
402
399
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
403
400
  if (record) {
@@ -406,6 +403,9 @@ ${itemDetails.join("\n")}`;
406
403
  return `今天已经签到过了!连续签到 ${record.consecutiveDays} 天`;
407
404
  }
408
405
  }
406
+ if (!is23Hour && !isSameDate(latestTime, chinatime)) {
407
+ return "暂未查询到您今天最近的20场战绩内游玩过 咕咕虫-evolved 地图,请游玩1次后签到(对局记录上传有延迟)";
408
+ }
409
409
  const consecutiveDays = record ? checkConsecutive(convertUTCtoChinaTime(record.lastSign), chinatime) ? record.consecutiveDays + 1 : 1 : 1;
410
410
  const cycle = Math.floor((consecutiveDays - 1) / 30);
411
411
  const currentCycleDay = consecutiveDays - cycle * 30;
@@ -432,12 +432,59 @@ ${itemDetails.join("\n")}`;
432
432
  itemId: 1,
433
433
  quantity: (backpack?.quantity || 0) + tickets
434
434
  }]);
435
- return `签到成功!连续签到 ${consecutiveDays} 天,获得 ${points} 积分和 ${tickets} 枚咕咕币`;
435
+ return `签到成功!连续签到 ${consecutiveDays} 天,获得 ${points} 金币和 ${tickets} 枚咕咕币`;
436
436
  } catch (error) {
437
437
  console.error("查询房间命令时发生错误:", error);
438
438
  return "服务器繁忙,请稍后尝试。";
439
439
  }
440
440
  });
441
+ ctx.command("ggcevo/补签").action(async (argv) => {
442
+ try {
443
+ const session = argv.session;
444
+ const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
445
+ if (!profile) return "您的 QQ 未绑定句柄。";
446
+ const { regionId, realmId, profileId } = profile;
447
+ const handle = `${regionId}-S2-${realmId}-${profileId}`;
448
+ const [record] = await ctx.database.get("ggcevo_sign", { handle });
449
+ if (!record) return "请先完成一次正常签到后再进行补签。";
450
+ const lastSignChina = convertUTCtoChinaTime(new Date(record.lastSign));
451
+ const targetDateChina = new Date(lastSignChina);
452
+ targetDateChina.setDate(targetDateChina.getDate() + 1);
453
+ targetDateChina.setHours(0, 0, 0, 0);
454
+ const targetDateUTC = new Date(targetDateChina.getTime() - 8 * 60 * 60 * 1e3);
455
+ const nowChina = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
456
+ if (targetDateChina >= nowChina) return "暂时没有可补签的日期。";
457
+ const costPoints = 100;
458
+ if (record.totalRewards < costPoints) return `补签需要消耗 ${costPoints} 金币,当前金币不足。`;
459
+ const newConsecutiveDays = record.consecutiveDays + 1;
460
+ const cycle = Math.floor((newConsecutiveDays - 1) / 30);
461
+ const currentCycleDay = newConsecutiveDays - cycle * 30;
462
+ let points = 10, tickets = 3;
463
+ if (currentCycleDay === 7) {
464
+ points = 25;
465
+ tickets = 6;
466
+ } else if (currentCycleDay === 14) {
467
+ points = 50;
468
+ tickets = 6;
469
+ } else if (currentCycleDay === 30) {
470
+ points = 100;
471
+ tickets = 7;
472
+ }
473
+ await ctx.database.set("ggcevo_sign", { handle }, {
474
+ lastSign: targetDateUTC,
475
+ consecutiveDays: newConsecutiveDays,
476
+ totalRewards: record.totalRewards - costPoints + points
477
+ });
478
+ const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
479
+ await ctx.database.set("ggcevo_backpack", { handle, itemId: 1 }, {
480
+ quantity: (backpack?.quantity || 0) + tickets
481
+ });
482
+ return `补签成功!已为您补签 ${targetDateChina.toLocaleDateString("zh-CN")},连续签到 ${newConsecutiveDays} 天,消耗 ${costPoints} 金币,获得 ${points} 金币和 ${tickets} 枚咕咕币`;
483
+ } catch (error) {
484
+ console.error("补签错误:", error);
485
+ return "补签失败,请稍后重试。";
486
+ }
487
+ });
441
488
  ctx.command("ggcevo/签到记录").action(async (argv) => {
442
489
  const session = argv.session;
443
490
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
@@ -460,7 +507,7 @@ ${itemDetails.join("\n")}`;
460
507
  `您的句柄:${handle}`,
461
508
  `📅 最后签到时间:${chinaTime}`,
462
509
  `🔥 连续签到:${record.consecutiveDays} 天`,
463
- `💰 累计获得:${record.totalRewards} 积分`
510
+ `💰 累计获得:${record.totalRewards} 金币`
464
511
  ].join("\n");
465
512
  });
466
513
  ctx.guild().command("ggcevo/每月津贴").action(async (argv) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅地图咕咕虫-evo小游戏",
4
- "version": "0.3.13",
4
+ "version": "0.3.15",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [