koishi-plugin-ggcevo-game 1.3.55 → 1.3.56

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 +41 -53
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -491,7 +491,7 @@ function apply(ctx, config) {
491
491
  description: "一个小型辛迪加机器人,可以破坏电子银行账户",
492
492
  price: 0,
493
493
  redCrystalCost: 60,
494
- effects: "此物品存放于仓库,仅在处于辛迪加海盗阵营时生效。每日签到金币奖励+50%,每拥有100金币,增加1%(至多增加100%)"
494
+ effects: "此物品存放于仓库自动生效(阵营必须为辛迪加海盗)。每日签到金币奖励+50%,每拥有100金币,增加1%(至多增加100%)"
495
495
  },
496
496
  "脉冲手雷": {
497
497
  id: 4,
@@ -507,7 +507,7 @@ function apply(ctx, config) {
507
507
  description: "这是一款未来派音乐设备",
508
508
  price: 0,
509
509
  redCrystalCost: 10,
510
- effects: "主动PK对战结果失败时上交给对方的金币-50%"
510
+ effects: "此物品存放于仓库自动生效(阵营必须为辛迪加海盗)。主动发起的PK对战结果为失败时上交给对方的金币-50%"
511
511
  }
512
512
  };
513
513
  const modConfig = {
@@ -991,7 +991,7 @@ function apply(ctx, config) {
991
991
  },
992
992
  {
993
993
  professionName: "辛迪加财务经理",
994
- effect: "每日签到能额外获得红晶; 主动PK对战结果胜利时,额外奖励1红晶",
994
+ effect: "每日签到能额外获得红晶; 主动发起的PK对战结果为胜利时,额外奖励1红晶",
995
995
  requirements: "当月累计签到14天及以上",
996
996
  Jobtransfer: true,
997
997
  costcoins: 0,
@@ -999,7 +999,7 @@ function apply(ctx, config) {
999
999
  },
1000
1000
  {
1001
1001
  professionName: "计算机专家",
1002
- effect: "黑市订购设备工具类物品享有50%折扣; 被动PK对战结果失败时,不会损失金币",
1002
+ effect: "黑市订购设备工具类物品享有50%折扣; 被动应对的PK对战结果为失败时,不会损失金币",
1003
1003
  requirements: "仓库中拥有一个黑市订购的设备工具类物品",
1004
1004
  Jobtransfer: true,
1005
1005
  costcoins: 0,
@@ -2845,7 +2845,7 @@ function apply(ctx, config) {
2845
2845
  if (itemConfig2.id === 3 || itemConfig2.id === 5) {
2846
2846
  return {
2847
2847
  success: false,
2848
- message: `此物品无法使用,存放于仓库即刻生效。`
2848
+ message: `此物品无法使用。`
2849
2849
  };
2850
2850
  }
2851
2851
  if (itemConfig2.id === 4) {
@@ -4489,14 +4489,10 @@ ${items.join("、")}
4489
4489
  const initiatorHandle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
4490
4490
  const targetHandle = `${targetprofile.regionId}-S2-${targetprofile.realmId}-${targetprofile.profileId}`;
4491
4491
  if (initiatorHandle === targetHandle) return "抱歉,您不能挑战自己。";
4492
- const [initiatorData, targetData] = await Promise.all([
4493
- ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
4494
- ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
4495
- ]);
4496
4492
  const initiatorPower = await calculateTotalPower(initiatorHandle);
4497
4493
  const targetPower = await calculateTotalPower(targetHandle);
4498
- const initiatorRankname = initiatorData[0]?.name || session.username;
4499
- const targetRankname = targetData[0]?.name || (targetUsername.name || targetUsername.user.name);
4494
+ const initiatorRankname = session.username;
4495
+ const targetRankname = targetUsername.nick || targetUsername.name;
4500
4496
  const [initiatorCareer] = await ctx.database.get("ggcevo_careers", {
4501
4497
  handle: initiatorHandle
4502
4498
  });
@@ -4529,36 +4525,31 @@ ${items.join("、")}
4529
4525
  return `🛡️ 该玩家是人类联盟成员,尚在30天保护期内(剩余${30 - diffInDays}天),无法挑战`;
4530
4526
  }
4531
4527
  }
4532
- let initiatorPK = {
4533
- handle: initiatorHandle,
4534
- name: initiatorRankname,
4535
- total: 0,
4536
- wins: 0,
4537
- todayCount: 0,
4538
- lastPK: /* @__PURE__ */ new Date(0),
4539
- // 明确初始化 lastPK
4540
- enable: false,
4541
- // 新增默认值
4542
- lastToggle: /* @__PURE__ */ new Date(0)
4543
- // 新增默认值
4544
- };
4545
- let targetPK = {
4546
- handle: targetHandle,
4547
- name: targetRankname,
4548
- total: 0,
4549
- wins: 0,
4550
- todayCount: 0,
4551
- lastPK: /* @__PURE__ */ new Date(0),
4552
- enable: false,
4553
- // 新增默认值
4554
- lastToggle: /* @__PURE__ */ new Date(0)
4555
- // 新增默认值
4556
- };
4528
+ let initiatorPK;
4529
+ let targetPK;
4557
4530
  await ctx.database.withTransaction(async () => {
4558
4531
  const [dbInitiator] = await ctx.database.get("ggcevo_pk", { handle: initiatorHandle });
4559
- if (dbInitiator) Object.assign(initiatorPK, dbInitiator);
4560
4532
  const [dbTarget] = await ctx.database.get("ggcevo_pk", { handle: targetHandle });
4561
- if (dbTarget) Object.assign(targetPK, dbTarget);
4533
+ initiatorPK = Object.assign({
4534
+ handle: initiatorHandle,
4535
+ name: initiatorRankname,
4536
+ total: 0,
4537
+ wins: 0,
4538
+ todayCount: 0,
4539
+ lastPK: /* @__PURE__ */ new Date(0),
4540
+ enable: false,
4541
+ lastToggle: /* @__PURE__ */ new Date(0)
4542
+ }, dbInitiator || {});
4543
+ targetPK = Object.assign({
4544
+ handle: targetHandle,
4545
+ name: targetRankname,
4546
+ total: 0,
4547
+ wins: 0,
4548
+ todayCount: 0,
4549
+ lastPK: /* @__PURE__ */ new Date(0),
4550
+ enable: false,
4551
+ lastToggle: /* @__PURE__ */ new Date(0)
4552
+ }, dbTarget || {});
4562
4553
  });
4563
4554
  if (initiatorCareer.group === "人类联盟" && !initiatorPK.enable) {
4564
4555
  let joinDate;
@@ -4670,12 +4661,8 @@ ${items.join("、")}
4670
4661
  handle: targetHandle,
4671
4662
  name: targetRankname,
4672
4663
  total: targetPK.total + 1,
4673
- wins: !isWin ? targetPK.wins + 1 : targetPK.wins,
4664
+ wins: !isWin ? targetPK.wins + 1 : targetPK.wins
4674
4665
  // 应战者胜利时增加
4675
- todayCount: targetPK.todayCount,
4676
- // 不消耗应战者次数
4677
- lastPK: targetPK.lastPK
4678
- // 保留原有时间不更新
4679
4666
  }
4680
4667
  ]);
4681
4668
  await ctx.database.create("ggcevo_pk_logs", {
@@ -4729,23 +4716,23 @@ ${items.join("、")}
4729
4716
  `🎰 金币变动:${stealPercentage}%`
4730
4717
  ];
4731
4718
  if (targetCareer.group === "人类联盟" && isWin) {
4732
- result.push(`🛡️ 人类联盟保护:应战者失败仅损失1%金币`);
4719
+ result.push(`🛡️ 人类联盟保护:${targetRankname} 被动应对的PK失败时仅损失1%的金币`);
4733
4720
  }
4734
4721
  if (computerExpertProtection) {
4735
- result.push(`💻 计算机专家职业加成:被动PK失败不损失金币`);
4722
+ result.push(`💻 计算机专家职业加成:${targetRankname} 被动应对的PK失败时不损失金币`);
4736
4723
  } else if (isWin) {
4737
4724
  result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`);
4738
4725
  } else {
4739
4726
  result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
4740
4727
  }
4741
4728
  if (mp3Effect) {
4742
- result.push(`💿 MP3播放器生效:失败上交的金币减少50%`);
4729
+ result.push(`💿 MP3播放器生效:${initiatorRankname} 主动发起的PK失败时上交的金币减少50%`);
4743
4730
  }
4744
4731
  if (initiatorCareer?.group === "辛迪加海盗") {
4745
- result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`);
4732
+ result.push(`🔴 辛迪加海盗阵营加成:${initiatorRankname} 获得1枚红晶`);
4746
4733
  }
4747
4734
  if (isWin && initiatorCareer?.career === "辛迪加财务经理") {
4748
- result.push(`💰 辛迪加财务经理职业加成:胜利额外获得1枚红晶`);
4735
+ result.push(`💰 辛迪加财务经理职业加成:${initiatorRankname} 额外获得1枚红晶`);
4749
4736
  }
4750
4737
  result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
4751
4738
  return result.join("\n");
@@ -6110,7 +6097,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6110
6097
  infoCard.push("", "〓 科技研发 〓", ...activeTechs);
6111
6098
  }
6112
6099
  }
6113
- const promptMessage = careerData.group === "辛迪加海盗" ? "💡 提示:红晶可通过主动PK获得(无论胜负)" : "💡 提示:使用「转职」指令可变更职业";
6100
+ const promptMessage = careerData.group === "辛迪加海盗" ? "💡 提示:红晶可通过主动发起PK获得(无论胜负)" : "💡 提示:使用「转职」指令可变更职业";
6114
6101
  return [
6115
6102
  `〓 职业档案 〓`,
6116
6103
  ...infoCard,
@@ -6325,7 +6312,10 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6325
6312
  const redcrystal = careerData[0]?.redcrystal || 0;
6326
6313
  const message = [`【${handle}的仓库】`];
6327
6314
  message.push(`💰 金币:${totalRewards}`);
6328
- if (redcrystal > 0) message.push(`🔴 红晶:${redcrystal}`);
6315
+ if (redcrystal > 0) {
6316
+ message.push(`🔴 红晶:${redcrystal}`);
6317
+ message.push("――――――――――――――");
6318
+ }
6329
6319
  const validItems = items.filter(
6330
6320
  (item) => Object.values(SyndicatedItems).some(
6331
6321
  (specialItem) => specialItem.id === item.itemId
@@ -6342,14 +6332,12 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6342
6332
  const [itemName, itemData] = entry;
6343
6333
  return [
6344
6334
  `${itemName}`,
6345
- // 移除数量显示在标题
6346
6335
  `类型:${itemData.type} | 持有数量:${warehouseItem.quantity}`,
6347
- // 从warehouse表读取实际数量
6348
6336
  `效果:${itemData.effects}`,
6349
6337
  `描述:${itemData.description}`,
6350
6338
  "――――――――――――――"
6351
6339
  ].join("\n");
6352
- }).join("\n\n")
6340
+ }).join("\n")
6353
6341
  );
6354
6342
  }
6355
6343
  return message.join("\n");
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.3.55",
4
+ "version": "1.3.56",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [