koishi-plugin-ggcevo-game 1.2.20 → 1.2.22

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.d.ts CHANGED
@@ -38,6 +38,7 @@ declare module 'koishi' {
38
38
  ggcevo_equipment: equipment;
39
39
  ggcevo_boss: Boss;
40
40
  ggcevo_boss_damage: BossDamageRecord;
41
+ ggcevo_Wish_Record: WishRecord;
41
42
  }
42
43
  }
43
44
  export interface backpack {
@@ -156,4 +157,12 @@ export interface BossDamageRecord {
156
157
  bossGroupId: number;
157
158
  lastattackDate: Date;
158
159
  }
160
+ export interface WishRecord {
161
+ id: number;
162
+ handle: string;
163
+ wishname: string;
164
+ startTime: Date;
165
+ endTime: Date;
166
+ isused: boolean;
167
+ }
159
168
  export declare function apply(ctx: Context, config: Config): void;
package/lib/index.js CHANGED
@@ -245,6 +245,17 @@ function apply(ctx, config) {
245
245
  }, {
246
246
  primary: "handle"
247
247
  });
248
+ ctx.model.extend("ggcevo_Wish_Record", {
249
+ id: "unsigned",
250
+ handle: "string",
251
+ wishname: "string",
252
+ startTime: "timestamp",
253
+ endTime: "timestamp",
254
+ isused: "boolean"
255
+ }, {
256
+ primary: "id",
257
+ autoInc: true
258
+ });
248
259
  const weaponConfig = {
249
260
  // 武器配置
250
261
  "高斯步枪": {
@@ -338,6 +349,54 @@ function apply(ctx, config) {
338
349
  isExclusive: true
339
350
  }
340
351
  };
352
+ const wishConfig = {
353
+ // 普通祈愿(总概率 5 * 19=95%)
354
+ common: [
355
+ {
356
+ name: "蚱蜢优购",
357
+ effect: "下一次购买武器价格变为80%"
358
+ },
359
+ {
360
+ name: "灵狐升运",
361
+ effect: "下一次升级武器价格变为80%"
362
+ },
363
+ {
364
+ name: "王权增幅",
365
+ effect: "攻击伤害+10%"
366
+ },
367
+ {
368
+ name: "金柚赐福",
369
+ effect: "立即获得250枚金币"
370
+ },
371
+ {
372
+ name: "夜市赠礼",
373
+ effect: "立即获得5枚咕咕币"
374
+ }
375
+ ],
376
+ // 稀有祈愿(总概率 5 * 1=5%)
377
+ rare: [
378
+ {
379
+ name: "悲鸣之锋",
380
+ effect: "基于武器等级的伤害加成(0级为10%,每等级增加10%)"
381
+ },
382
+ {
383
+ name: "精灵双倍",
384
+ effect: "下一次击败首领时获得双倍奖励"
385
+ },
386
+ {
387
+ name: "喵喵财源",
388
+ effect: "签到奖励翻倍"
389
+ },
390
+ {
391
+ name: "暴击韵律",
392
+ effect: "攻击时,暴击率+20%"
393
+ },
394
+ {
395
+ name: "酥手空空",
396
+ effect: "失去50枚金币"
397
+ }
398
+ ]
399
+ };
341
400
  const passiveConfig = {
342
401
  "弱化形态": {
343
402
  effect: 0.1,
@@ -375,7 +434,7 @@ function apply(ctx, config) {
375
434
  ]
376
435
  }
377
436
  ];
378
- function calculateModifiers(equippedWeapon, weaponName) {
437
+ function calculateModifiers(equippedWeapon, weaponName, hasCritRhythm) {
379
438
  let totalModAdd = 0;
380
439
  let hasCrit = false;
381
440
  let hasCrystal = false;
@@ -392,7 +451,10 @@ function apply(ctx, config) {
392
451
  hasOverload = true;
393
452
  }
394
453
  });
395
- const totalCritRate = (hasCrystal ? 20 : 0) + (hasOverload ? 80 : 0);
454
+ let totalCritRate = (hasCrystal ? 20 : 0) + (hasOverload ? 80 : 0);
455
+ if (hasCritRhythm) {
456
+ totalCritRate = Math.min(totalCritRate + 20, 100);
457
+ }
396
458
  if (totalCritRate > 0 && Math.random() < totalCritRate / 100) {
397
459
  hasCrit = true;
398
460
  totalModAdd += 1;
@@ -444,11 +506,28 @@ function apply(ctx, config) {
444
506
  }
445
507
  __name(calculateRankBonus, "calculateRankBonus");
446
508
  async function calculateTotalDamage(ctx2, session, equippedWeapon, targetBoss) {
509
+ let effectMessage = [];
510
+ const [profile] = await ctx2.database.get("sc2arcade_player", { userId: session.userId });
511
+ const { regionId, realmId, profileId } = profile;
512
+ const handle = `${regionId}-S2-${realmId}-${profileId}`;
447
513
  const weaponConfigEntry = Object.entries(weaponConfig).find(([_, c]) => c.id === equippedWeapon.weaponId);
448
514
  const [weaponName, weaponData] = weaponConfigEntry;
449
515
  let damage = weaponData.damage * (1 + 0.1 * equippedWeapon.level);
450
- const { totalModAdd, hasCrit } = calculateModifiers(equippedWeapon, weaponName);
516
+ const [critRhythmEffect] = await ctx2.database.get("ggcevo_Wish_Record", {
517
+ handle,
518
+ wishname: "暴击韵律",
519
+ startTime: { $lte: /* @__PURE__ */ new Date() },
520
+ endTime: { $gte: /* @__PURE__ */ new Date() }
521
+ });
522
+ const { totalModAdd, hasCrit } = calculateModifiers(
523
+ equippedWeapon,
524
+ weaponName,
525
+ !!critRhythmEffect
526
+ );
451
527
  damage *= 1 + totalModAdd;
528
+ if (critRhythmEffect) {
529
+ effectMessage.push("🎵 暴击韵律祈愿生效(暴击率+20%)");
530
+ }
452
531
  const targetBossConfig = targetBoss.type === "主宰" ? bossPool.find((g) => g.main.name === targetBoss.name).main : bossPool.find((g) => g.minions.some((m) => m.name === targetBoss.name)).minions[0];
453
532
  const tagMultiplier = calculateTagEffects(weaponData, targetBossConfig, equippedWeapon);
454
533
  damage *= 1 + tagMultiplier;
@@ -459,10 +538,35 @@ function apply(ctx, config) {
459
538
  });
460
539
  const passiveMultiplier = calculatePassiveEffects(targetBossConfig, activeMinions.length);
461
540
  damage *= 1 + passiveMultiplier;
541
+ const [sovereignEffect] = await ctx2.database.get("ggcevo_Wish_Record", {
542
+ handle,
543
+ wishname: "王权增幅",
544
+ startTime: { $lte: /* @__PURE__ */ new Date() },
545
+ endTime: { $gte: /* @__PURE__ */ new Date() }
546
+ });
547
+ const [lamentEffect] = await ctx2.database.get("ggcevo_Wish_Record", {
548
+ handle,
549
+ wishname: "悲鸣之锋",
550
+ startTime: { $lte: /* @__PURE__ */ new Date() },
551
+ endTime: { $gte: /* @__PURE__ */ new Date() }
552
+ });
553
+ if (sovereignEffect) {
554
+ damage *= 1.1;
555
+ effectMessage.push(`👑 王权增幅祈愿生效(攻击伤害+10%)`);
556
+ }
557
+ if (lamentEffect) {
558
+ const levelBonus = 0.1 * (equippedWeapon.level + 1);
559
+ damage *= 1 + levelBonus;
560
+ effectMessage.push(`🗡️ 悲鸣之锋祈愿触发(+${(levelBonus * 100).toFixed(0)}%等级加成)`);
561
+ }
462
562
  const [rankRecord] = await ctx2.database.get("ggcevo_rank", { handle: session.handle });
463
563
  const rankBonus = calculateRankBonus(rankRecord);
464
564
  damage *= 1 + rankBonus;
465
- return { damage: Math.round(damage), hasCrit };
565
+ return {
566
+ damage: Math.round(damage),
567
+ hasCrit,
568
+ effectMessage
569
+ };
466
570
  }
467
571
  __name(calculateTotalDamage, "calculateTotalDamage");
468
572
  const initDefaultItems = {
@@ -614,12 +718,6 @@ function apply(ctx, config) {
614
718
  return mainBoss;
615
719
  }
616
720
  __name(activateNextBossGroup, "activateNextBossGroup");
617
- function createHpBar(current, max) {
618
- const ratio = current / max;
619
- const filled = Math.floor(ratio * 20);
620
- return "▰".repeat(filled) + "▱".repeat(20 - filled);
621
- }
622
- __name(createHpBar, "createHpBar");
623
721
  ctx.setInterval(async () => {
624
722
  const now = /* @__PURE__ */ new Date();
625
723
  const expiredGroups = await ctx.database.select("ggcevo_boss").where({
@@ -835,8 +933,16 @@ ${itemDetails.join("\n")}`;
835
933
  monthlyDays = record.monthlyDays + 1;
836
934
  }
837
935
  }
936
+ const [meowEffect] = await ctx.database.get("ggcevo_Wish_Record", {
937
+ handle,
938
+ wishname: "喵喵财源",
939
+ startTime: { $lte: now },
940
+ endTime: { $gte: now },
941
+ isused: false
942
+ });
838
943
  let tickets = 3;
839
944
  let points = getRandomInt(20, 40);
945
+ let effectMessage = "";
840
946
  if (monthlyDays === 7) {
841
947
  tickets = 4;
842
948
  } else if (monthlyDays === 14) {
@@ -855,6 +961,11 @@ ${itemDetails.join("\n")}`;
855
961
  } else if (monthlyDays >= 28) {
856
962
  points = getRandomInt(100, 200);
857
963
  }
964
+ if (meowEffect) {
965
+ tickets *= 2;
966
+ points *= 2;
967
+ effectMessage = "\n🐾 喵喵财源祈愿生效,获得双倍奖励!";
968
+ }
858
969
  await ctx.database.upsert("ggcevo_sign", [{
859
970
  handle,
860
971
  lastSign: now,
@@ -866,7 +977,9 @@ ${itemDetails.join("\n")}`;
866
977
  itemId: 1,
867
978
  quantity: (backpack?.quantity || 0) + tickets
868
979
  }]);
869
- return `签到成功!本月累计签到${monthlyDays}天,获得${points}枚金币和${tickets}枚咕咕币`;
980
+ return `签到成功!本月累计签到${monthlyDays}天,获得:
981
+ 💰 金币 ×${points}
982
+ 🪙 咕咕币 ×${tickets}` + effectMessage;
870
983
  } catch (error) {
871
984
  console.error("签到命令时发生错误:", error);
872
985
  return "服务器繁忙,请稍后尝试。";
@@ -2098,21 +2211,41 @@ ${validTypes.join("、")}`;
2098
2211
  if (!profile) return "您暂未绑定句柄";
2099
2212
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2100
2213
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
2101
- if (!weaponConfig[weapon]) return "无效的武器名称";
2214
+ if (!weapon) return "如果您想购买武器,请输入“购买 武器名称”。";
2215
+ if (!weaponConfig[weapon]) return "无效的武器名称,请重新输入。";
2102
2216
  const config2 = weaponConfig[weapon];
2103
2217
  const existingWeapons = await ctx.database.get("ggcevo_equipment", {
2104
2218
  handle,
2105
2219
  weaponId: config2.id
2106
2220
  });
2107
2221
  if (existingWeapons.length > 0) {
2108
- return `你已经拥有${weapon},无法重复购买`;
2222
+ return `你已经拥有${weapon},无法重复购买。`;
2223
+ }
2224
+ const activeWish = await ctx.database.get("ggcevo_Wish_Record", {
2225
+ handle,
2226
+ wishname: "蚱蜢优购",
2227
+ startTime: { $lte: /* @__PURE__ */ new Date() },
2228
+ endTime: { $gte: /* @__PURE__ */ new Date() },
2229
+ isused: false
2230
+ }).then((records) => records[0]);
2231
+ let actualPrice = config2.price;
2232
+ let discountMessage = "";
2233
+ if (activeWish) {
2234
+ actualPrice = Math.floor(config2.price * 0.8);
2235
+ discountMessage = ` (祈愿优惠价,原价${config2.price})`;
2236
+ }
2237
+ if ((signInfo?.totalRewards || 0) < actualPrice) {
2238
+ return `金币不足,需要${actualPrice}枚金币${discountMessage}。`;
2109
2239
  }
2110
- if ((signInfo?.totalRewards || 0) < config2.price)
2111
- return `金币不足,需要${config2.price}金币`;
2112
2240
  await ctx.database.withTransaction(async () => {
2113
2241
  await ctx.database.set("ggcevo_sign", { handle }, {
2114
- totalRewards: signInfo.totalRewards - config2.price
2242
+ totalRewards: signInfo.totalRewards - actualPrice
2115
2243
  });
2244
+ if (activeWish) {
2245
+ await ctx.database.set("ggcevo_Wish_Record", { id: activeWish.id }, {
2246
+ isused: true
2247
+ });
2248
+ }
2116
2249
  await ctx.database.upsert("ggcevo_equipment", [{
2117
2250
  handle,
2118
2251
  weaponId: config2.id,
@@ -2121,7 +2254,12 @@ ${validTypes.join("、")}`;
2121
2254
  equipped: false
2122
2255
  }], ["handle", "weaponId"]);
2123
2256
  });
2124
- return `成功购买 ${weapon}!输入“武器列表”查看你的武器库`;
2257
+ let message = `成功购买 ${weapon}!花费 ${actualPrice}枚金币${discountMessage}。`;
2258
+ if (activeWish) {
2259
+ message += `
2260
+ 🦗 蚱蜢优购祈愿已使用,下次购买将恢复原价。`;
2261
+ }
2262
+ return message + "\n输入“武器列表”查看你的武器库。";
2125
2263
  });
2126
2264
  ctx.command("ggcevo/武器列表").action(async ({ session }) => {
2127
2265
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
@@ -2186,7 +2324,7 @@ ${validTypes.join("、")}`;
2186
2324
  });
2187
2325
  ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器").action(async ({ session }, weapon) => {
2188
2326
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2189
- if (!profile) return "您暂未绑定句柄";
2327
+ if (!profile) return "您暂未绑定句柄。";
2190
2328
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2191
2329
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
2192
2330
  const [equipment] = await ctx.database.get("ggcevo_equipment", {
@@ -2194,25 +2332,51 @@ ${validTypes.join("、")}`;
2194
2332
  weaponId: weaponConfig[weapon]?.id
2195
2333
  });
2196
2334
  if (!weapon) return "您没有输入需要升级的武器名称。";
2197
- if (!equipment) return "尚未获得该武器";
2198
- if (equipment.level >= 6) return "该武器已达最大升级等级";
2199
- const upgradeCost = [1050, 1450, 1850, 2250, 2650, 3050][equipment.level];
2200
- if ((signInfo?.totalRewards || 0) < upgradeCost)
2201
- return `需要${upgradeCost}金币,当前持有:${signInfo?.totalRewards || 0}`;
2202
- await ctx.database.set("ggcevo_equipment", {
2335
+ if (!equipment) return "尚未获得该武器。";
2336
+ if (equipment.level >= 6) return "该武器已达最大升级等级。";
2337
+ const activeWish = await ctx.database.get("ggcevo_Wish_Record", {
2203
2338
  handle,
2204
- weaponId: weaponConfig[weapon].id
2205
- }, {
2206
- level: equipment.level + 1,
2207
- modificationSlots: Math.floor((equipment.level + 1) / 3) + 1
2208
- });
2209
- await ctx.database.set("ggcevo_sign", { handle }, {
2210
- totalRewards: signInfo.totalRewards - upgradeCost
2339
+ wishname: "灵狐升运",
2340
+ startTime: { $lte: /* @__PURE__ */ new Date() },
2341
+ endTime: { $gte: /* @__PURE__ */ new Date() },
2342
+ isused: false
2343
+ }).then((records) => records[0]);
2344
+ let baseCost = [1050, 1450, 1850, 2250, 2650, 3050][equipment.level];
2345
+ let actualCost = baseCost;
2346
+ let discountMessage = "";
2347
+ if (activeWish) {
2348
+ actualCost = Math.floor(baseCost * 0.8);
2349
+ discountMessage = ` (祈愿优惠价,原价${baseCost})`;
2350
+ }
2351
+ if ((signInfo?.totalRewards || 0) < actualCost)
2352
+ return `需要${actualCost}枚金币${discountMessage},当前持有:${signInfo?.totalRewards || 0}。`;
2353
+ await ctx.database.withTransaction(async () => {
2354
+ await ctx.database.set("ggcevo_sign", { handle }, {
2355
+ totalRewards: signInfo.totalRewards - actualCost
2356
+ });
2357
+ await ctx.database.set("ggcevo_equipment", {
2358
+ handle,
2359
+ weaponId: weaponConfig[weapon].id
2360
+ }, {
2361
+ level: equipment.level + 1,
2362
+ modificationSlots: Math.floor((equipment.level + 1) / 3) + 1
2363
+ });
2364
+ if (activeWish) {
2365
+ await ctx.database.set("ggcevo_Wish_Record", { id: activeWish.id }, {
2366
+ isused: true
2367
+ });
2368
+ }
2211
2369
  });
2212
- const baseDamage = weaponConfig[weapon].damage * (1 + 0.1 * (equipment.level + 1));
2213
2370
  const newLevel = equipment.level + 1;
2371
+ const baseDamage = weaponConfig[weapon].damage * (1 + 0.1 * newLevel);
2214
2372
  const slots = Math.floor(newLevel / 3) + 1;
2215
- return `${weapon} 升级成功!当前等级:${newLevel},伤害:${baseDamage},可用改装槽:${slots}个`;
2373
+ let message = `${weapon} 升级成功!花费${actualCost}枚金币${discountMessage}。`;
2374
+ if (activeWish) {
2375
+ message += `
2376
+ 🦊 灵狐升运祈愿已生效,下次升级将恢复原价。`;
2377
+ }
2378
+ return `${message}
2379
+ 当前等级:${newLevel},伤害:${baseDamage},可用改装槽:${slots}个。`;
2216
2380
  });
2217
2381
  ctx.command("ggcevo/改装 <weapon> [mod]", "安装武器模块").alias("改装武器").action(async ({ session }, weapon, mod) => {
2218
2382
  const isValidWeapon = weapon && weaponConfig[weapon]?.id !== void 0;
@@ -2329,7 +2493,7 @@ ${validTypes.join("、")}`;
2329
2493
  if (!bossGroup) return "无法获取BOSS组信息,请联系管理员。";
2330
2494
  const weaponConfigEntry = Object.entries(weaponConfig).find(([_, c]) => c.id === equippedWeapon.weaponId);
2331
2495
  const [weaponName, weaponData] = weaponConfigEntry;
2332
- const { damage: baseDamage, hasCrit } = await calculateTotalDamage(ctx, session, equippedWeapon, targetBoss);
2496
+ const { damage: baseDamage, hasCrit, effectMessage } = await calculateTotalDamage(ctx, session, equippedWeapon, targetBoss);
2333
2497
  const actualDamage = Math.min(baseDamage, targetBoss.HP);
2334
2498
  const updatedHP = targetBoss.HP - actualDamage;
2335
2499
  const isDefeated = updatedHP <= 0;
@@ -2377,7 +2541,7 @@ ${validTypes.join("、")}`;
2377
2541
  { respawnTime }
2378
2542
  );
2379
2543
  const damageRecords = await ctx.database.select("ggcevo_boss_damage").where({ bossGroupId: targetBoss.groupId }).orderBy("totalDamage", "desc").execute();
2380
- const rewardMessages = [];
2544
+ let rewardMessages = [];
2381
2545
  const updatePromises = [];
2382
2546
  const rewardMap = /* @__PURE__ */ new Map();
2383
2547
  if (damageRecords.length > 0) {
@@ -2424,6 +2588,52 @@ ${validTypes.join("、")}`;
2424
2588
  });
2425
2589
  rewardMessages.push(`其他参与者各获得: 5 咕咕币 + 200 金币`);
2426
2590
  }
2591
+ const doubleRewardPlayers = /* @__PURE__ */ new Map();
2592
+ for (const record of damageRecords) {
2593
+ const [elfEffect] = await ctx.database.get("ggcevo_Wish_Record", {
2594
+ handle: record.handle,
2595
+ wishname: "精灵双倍",
2596
+ isused: false,
2597
+ startTime: { $lte: /* @__PURE__ */ new Date() },
2598
+ endTime: { $gte: /* @__PURE__ */ new Date() }
2599
+ });
2600
+ if (elfEffect) {
2601
+ doubleRewardPlayers.set(record.handle, {
2602
+ effect: elfEffect,
2603
+ originalReward: {
2604
+ guguCoins: rewardMap.get(record.handle)?.guguCoins || 0,
2605
+ gold: rewardMap.get(record.handle)?.gold || 0
2606
+ }
2607
+ });
2608
+ }
2609
+ }
2610
+ if (doubleRewardPlayers.size > 0) {
2611
+ await ctx.database.withTransaction(async () => {
2612
+ for (const [handle2, data] of doubleRewardPlayers) {
2613
+ const reward = rewardMap.get(handle2);
2614
+ reward.guguCoins = data.originalReward.guguCoins * 2;
2615
+ reward.gold = data.originalReward.gold * 2;
2616
+ await ctx.database.set(
2617
+ "ggcevo_Wish_Record",
2618
+ { id: data.effect.id },
2619
+ { isused: true }
2620
+ );
2621
+ }
2622
+ });
2623
+ rewardMessages = rewardMessages.map((msg) => {
2624
+ const match = msg.match(/(\d+\.) (.+?) 获得奖励/);
2625
+ if (match) {
2626
+ const playerName = match[2];
2627
+ const targetHandle = [...rewardMap.keys()].find(
2628
+ (key) => rewardMap.get(key).playerName === playerName
2629
+ );
2630
+ if (targetHandle && doubleRewardPlayers.has(targetHandle)) {
2631
+ return `${match[1]} ${playerName} 🧚 获得奖励: ${rewardMap.get(targetHandle).guguCoins} 咕咕币 + ${rewardMap.get(targetHandle).gold} 金币 (双倍生效)`;
2632
+ }
2633
+ }
2634
+ return msg;
2635
+ });
2636
+ }
2427
2637
  for (const [handle2, reward] of rewardMap) {
2428
2638
  const signPromise = (async () => {
2429
2639
  const [existingSign2] = await ctx.database.get("ggcevo_sign", { handle: handle2 });
@@ -2509,6 +2719,10 @@ ${validTypes.join("、")}`;
2509
2719
  }
2510
2720
  const resultMessage = [
2511
2721
  `🔥 ${session.username} 使用武器 ${weaponName} 对 ${targetBoss.name} 发起攻击!`,
2722
+ ...effectMessage.length > 0 ? [
2723
+ // 新增效果反馈
2724
+ `💫 祈愿效果:${effectMessage.join(" | ")}`
2725
+ ] : [],
2512
2726
  `造成伤害:${actualDamage}${hasCrit ? "(✨ 暴击!)" : ""}`,
2513
2727
  `获得金币:${actualDamage}`,
2514
2728
  `目标剩余HP:${isDefeated ? 0 : updatedHP}/${targetBoss.type === "主宰" ? bossGroup.main.maxHP : bossGroup.minions[0].maxHP}`,
@@ -2613,6 +2827,81 @@ ${validTypes.join("、")}`;
2613
2827
  }
2614
2828
  return result.join("\n");
2615
2829
  });
2830
+ ctx.command("ggcevo/祈愿").action(async (argv) => {
2831
+ const session = argv.session;
2832
+ const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2833
+ if (!profile) return "您暂未绑定句柄。";
2834
+ const { regionId, realmId, profileId } = profile;
2835
+ const handle = `${regionId}-S2-${realmId}-${profileId}`;
2836
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
2837
+ if (existingEntries.length > 0) return "❌ 拒绝访问,您已被列入黑名单。";
2838
+ const [sign] = await ctx.database.get("ggcevo_sign", { handle });
2839
+ if (!sign || sign.totalRewards < 50) return "需要50金币进行祈愿,当前金币不足。";
2840
+ const now = /* @__PURE__ */ new Date();
2841
+ const [latestWish] = await ctx.database.get("ggcevo_Wish_Record", { handle }, {
2842
+ sort: { endTime: "desc" },
2843
+ limit: 1
2844
+ });
2845
+ if (latestWish?.endTime > now) {
2846
+ const allEffects = [...wishConfig.common, ...wishConfig.rare];
2847
+ const currentEffect = allEffects.find((e) => e.name === latestWish.wishname) ?? {
2848
+ name: "未知效果",
2849
+ effect: "效果信息暂不可用"
2850
+ };
2851
+ const endTime2 = latestWish.endTime.toLocaleString("zh-CN", {
2852
+ timeZone: "Asia/Shanghai",
2853
+ hour12: false,
2854
+ year: "numeric",
2855
+ month: "2-digit",
2856
+ day: "2-digit",
2857
+ hour: "2-digit",
2858
+ minute: "2-digit"
2859
+ });
2860
+ return `当前祈愿效果:【${currentEffect.name}】${currentEffect.effect}
2861
+ 🕒 祈愿冷却中,下次可祈愿时间:${endTime2}`;
2862
+ }
2863
+ let newGold = sign.totalRewards - 50;
2864
+ const isRare = Math.random() < 0.05;
2865
+ const pool = isRare ? wishConfig.rare : wishConfig.common;
2866
+ const effect = pool[Math.floor(Math.random() * pool.length)];
2867
+ switch (effect.name) {
2868
+ case "金柚赐福":
2869
+ newGold += 250;
2870
+ break;
2871
+ case "酥手空空":
2872
+ newGold = Math.max(0, newGold - 50);
2873
+ break;
2874
+ case "夜市赠礼":
2875
+ const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
2876
+ await ctx.database.upsert("ggcevo_backpack", [{
2877
+ handle,
2878
+ itemId: 1,
2879
+ quantity: (backpack?.quantity || 0) + 5
2880
+ }]);
2881
+ break;
2882
+ }
2883
+ await ctx.database.set("ggcevo_sign", { handle }, { totalRewards: newGold });
2884
+ const startTime = /* @__PURE__ */ new Date();
2885
+ const endTime = new Date(startTime.getTime() + 7 * 24 * 60 * 60 * 1e3);
2886
+ await ctx.database.create("ggcevo_Wish_Record", {
2887
+ handle,
2888
+ wishname: effect.name,
2889
+ startTime,
2890
+ endTime,
2891
+ isused: false
2892
+ });
2893
+ const formattedEndTime = endTime.toLocaleString("zh-CN", {
2894
+ timeZone: "Asia/Shanghai",
2895
+ hour12: false,
2896
+ year: "numeric",
2897
+ month: "2-digit",
2898
+ day: "2-digit",
2899
+ hour: "2-digit",
2900
+ minute: "2-digit"
2901
+ });
2902
+ return `✨ 祈愿成功!获得【${effect.name}】效果:${effect.effect}
2903
+ ⏳ 效果持续至 ${formattedEndTime}`;
2904
+ });
2616
2905
  }
2617
2906
  __name(apply, "apply");
2618
2907
  function simpleDraw() {
@@ -2681,6 +2970,12 @@ function formatDate(d) {
2681
2970
  });
2682
2971
  }
2683
2972
  __name(formatDate, "formatDate");
2973
+ function createHpBar(current, max) {
2974
+ const ratio = current / max;
2975
+ const filled = Math.floor(ratio * 20);
2976
+ return "▰".repeat(filled) + "▱".repeat(20 - filled);
2977
+ }
2978
+ __name(createHpBar, "createHpBar");
2684
2979
  // Annotate the CommonJS export names for ESM import in node:
2685
2980
  0 && (module.exports = {
2686
2981
  Config,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "《星际争霸2》咕咕虫-evolved地图的专属游戏助手插件,集成天梯排行、抽奖系统、签到福利、兑换商城等丰富功能。",
4
- "version": "1.2.20",
4
+ "version": "1.2.22",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [