koishi-plugin-ggcevo-game 1.3.46 → 1.3.48

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 +114 -36
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -500,6 +500,14 @@ function apply(ctx, config) {
500
500
  price: 75,
501
501
  redCrystalCost: 0,
502
502
  effects: "对目标使用后,消耗其500点能量"
503
+ },
504
+ "MP3播放器": {
505
+ id: 5,
506
+ type: "设备工具",
507
+ description: "这是一款未来派音乐设备",
508
+ price: 0,
509
+ redCrystalCost: 10,
510
+ effects: "主动PK对战结果失败时上交给对方的金币-50%"
503
511
  }
504
512
  };
505
513
  const modConfig = {
@@ -991,11 +999,11 @@ function apply(ctx, config) {
991
999
  },
992
1000
  {
993
1001
  professionName: "计算机专家",
994
- effect: "每日pk次数翻倍,pk的胜率提高10%",
995
- requirements: "",
996
- Jobtransfer: false,
997
- costcoins: 2e3,
998
- costredcrystal: 10
1002
+ effect: "黑市订购设备工具类物品享有50%折扣",
1003
+ requirements: "仓库中拥有一个黑市订购的设备工具类物品",
1004
+ Jobtransfer: true,
1005
+ costcoins: 0,
1006
+ costredcrystal: 40
999
1007
  },
1000
1008
  {
1001
1009
  professionName: "指挥官",
@@ -2731,6 +2739,17 @@ function apply(ctx, config) {
2731
2739
  success: signData?.monthlyDays >= 14,
2732
2740
  message: `需要当月累计签到14天及以上(当前${signData?.monthlyDays || 0}天)`
2733
2741
  };
2742
+ case "计算机专家": {
2743
+ const warehouseItems = await ctx2.database.get("ggcevo_warehouse", { handle });
2744
+ const blackMarketDeviceTools = Object.values(SyndicatedItems).filter((item) => item.type === "设备工具" && item.redCrystalCost > 0).map((item) => item.id);
2745
+ const hasDeviceTool = warehouseItems.some(
2746
+ (item) => blackMarketDeviceTools.includes(item.itemId) && item.quantity > 0
2747
+ );
2748
+ return {
2749
+ success: hasDeviceTool,
2750
+ message: hasDeviceTool ? "" : "需要仓库中拥有一个从黑市订购的设备工具物品"
2751
+ };
2752
+ }
2734
2753
  default:
2735
2754
  return { success: false, message: "未知职业要求" };
2736
2755
  }
@@ -2803,10 +2822,10 @@ function apply(ctx, config) {
2803
2822
  message: `成功使用 ${itemName},已重置 ${target} 的技能计数`
2804
2823
  };
2805
2824
  }
2806
- if (itemConfig2.id === 3) {
2825
+ if (itemConfig2.id === 3 || itemConfig2.id === 5) {
2807
2826
  return {
2808
2827
  success: false,
2809
- message: `此物品无需使用,存放于仓库即刻生效。`
2828
+ message: `此物品无法使用,存放于仓库即刻生效。`
2810
2829
  };
2811
2830
  }
2812
2831
  if (itemConfig2.id === 4) {
@@ -4503,14 +4522,27 @@ ${items.join("、")}
4503
4522
  const targetGold = targetSign[0]?.totalRewards || 0;
4504
4523
  if (initiatorGold < 100) return "发起者需要至少100金币才能发起挑战。";
4505
4524
  if (targetGold < 100) return "对方金币不足100,无法应战。";
4525
+ let hasMP3 = false;
4526
+ const [mp3Item] = await ctx.database.get("ggcevo_warehouse", {
4527
+ handle: initiatorHandle,
4528
+ itemId: 5
4529
+ // MP3播放器的物品ID
4530
+ });
4531
+ hasMP3 = mp3Item && mp3Item.quantity > 0;
4506
4532
  const powerDiff = initiatorPower - targetPower;
4507
4533
  let winRate = 50 + powerDiff / 50 * 0.1;
4508
4534
  winRate = Math.min(Math.max(winRate, 5), 95);
4509
4535
  const isWin = Math.random() * 100 < winRate;
4510
- const stealPercentage = getRandomInt(1, 5);
4511
- const goldTransfer = Math.floor(
4536
+ let stealPercentage = getRandomInt(1, 5);
4537
+ let goldTransfer = Math.floor(
4512
4538
  (isWin ? targetGold : initiatorGold) * stealPercentage / 100
4513
4539
  );
4540
+ let mp3Effect = false;
4541
+ if (!isWin && hasMP3) {
4542
+ const reducedGold = Math.floor(goldTransfer * 0.5);
4543
+ mp3Effect = true;
4544
+ goldTransfer = reducedGold;
4545
+ }
4514
4546
  if ((isWin ? targetGold : initiatorGold) < goldTransfer) {
4515
4547
  return `${isWin ? "对方" : "你"}的金币不足以完成交易`;
4516
4548
  }
@@ -4572,13 +4604,16 @@ ${items.join("、")}
4572
4604
  handle: initiatorHandle
4573
4605
  });
4574
4606
  const result = [
4575
- `⚔️【对战结果】${isWin ? "胜利" : "失败"}`,
4607
+ `⚔️【对战结果】${isWin ? "胜利" : "失败"}${mp3Effect ? " (MP3减免)" : ""}`,
4576
4608
  `🏅 挑战者:${initiatorRankname}(战斗力 ${initiatorPower})`,
4577
4609
  `🛡️ 应战者:${targetRankname}(战斗力 ${targetPower})`,
4578
4610
  `📊 胜率预测:${winRate.toFixed(1)}%`,
4579
4611
  `🎰 金币变动:${stealPercentage}%`
4580
4612
  ];
4581
4613
  isWin ? result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`) : result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
4614
+ if (mp3Effect) {
4615
+ result.push(`💿 MP3播放器生效:上缴金币减少50%`);
4616
+ }
4582
4617
  initiatorCareer?.group === "辛迪加海盗" ? result.push(`🔴 辛迪加海盗阵营加成:获得1枚红晶`) : "";
4583
4618
  result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
4584
4619
  return result.join("\n");
@@ -4727,10 +4762,10 @@ ${Object.keys(typeStats).join("、")}`;
4727
4762
  `类型:${config2.type}`,
4728
4763
  `基础伤害:${config2.damage}`,
4729
4764
  `价格:${actualPrice}金币${totalDiscount > 0 ? ` (原价${config2.price})` : ""}`,
4730
- "特性:",
4731
- tagEffectsDesc,
4732
4765
  specialEffect,
4733
4766
  // 新增特殊效果显示
4767
+ "特性:",
4768
+ tagEffectsDesc,
4734
4769
  `描述:${config2.description}`
4735
4770
  ].filter(Boolean).join("\n");
4736
4771
  });
@@ -5559,10 +5594,14 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
5559
5594
  if (bossGroup.main.energy > 0) {
5560
5595
  result.push(`⚡ 能量:${mainBoss.energy}/1000`);
5561
5596
  }
5562
- result.push(
5563
- `🏷️ 标签:${mainBoss.tags?.join("、") || "无"}`,
5564
- `✨ 被动:`
5565
- );
5597
+ result.push(`🏷️ 标签:${mainBoss.tags?.join("、") || "无"}`);
5598
+ if (mainBoss.Vulnerability > 0) {
5599
+ result.push(`☢️ 辐射:${mainBoss.Vulnerability}层`);
5600
+ }
5601
+ if (mainBoss.freezing > 0) {
5602
+ result.push(`❄️ 寒冷:${mainBoss.freezing}层`);
5603
+ }
5604
+ result.push(`✨ 被动:`);
5566
5605
  if (mainBoss.skills.length > 0) {
5567
5606
  result.push(...mainBoss.skills.map((p) => `➤ ${p}:${passiveConfig[p]?.description}`));
5568
5607
  } else {
@@ -5585,10 +5624,14 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
5585
5624
  if (minionConfig && minionConfig.energy > 0) {
5586
5625
  minionInfo.push(`⚡ 能量:${minion.energy}/1000`);
5587
5626
  }
5588
- minionInfo.push(
5589
- `🏷️ 标签:${minion.tags?.join("、") || "无"}`,
5590
- `✨ 被动:`
5591
- );
5627
+ minionInfo.push(`🏷️ 标签:${minion.tags?.join("、") || "无"}`);
5628
+ if (minion.Vulnerability > 0) {
5629
+ minionInfo.push(`☢️ 辐射:${minion.Vulnerability}层`);
5630
+ }
5631
+ if (minion.freezing > 0) {
5632
+ minionInfo.push(`❄️ 寒冷:${minion.freezing}层`);
5633
+ }
5634
+ minionInfo.push(`✨ 被动:`);
5592
5635
  if (minion.skills.length > 0) {
5593
5636
  minionInfo.push(...minion.skills.map((p) => `➤ ${p}:${passiveConfig[p]?.description}`));
5594
5637
  } else {
@@ -5996,6 +6039,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
5996
6039
  if (!careerData || careerData.group !== "辛迪加海盗") {
5997
6040
  return "🚫 该功能需要【辛迪加海盗】阵营权限";
5998
6041
  }
6042
+ const isComputerExpert = careerData.career === "计算机专家";
5999
6043
  const typeStats = {};
6000
6044
  Object.values(weaponConfig).filter((config2) => config2.redCrystalCost > 0).forEach((weapon) => {
6001
6045
  typeStats[weapon.type] = (typeStats[weapon.type] || 0) + 1;
@@ -6009,7 +6053,9 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6009
6053
  '使用 "黑市 类型名称" 查看详细信息',
6010
6054
  "====================",
6011
6055
  ...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
6012
- "===================="
6056
+ "====================",
6057
+ // 添加计算机专家提示
6058
+ isComputerExpert ? "💳 计算机专家可享受设备工具类物品50%折扣!" : ""
6013
6059
  ].join("\n");
6014
6060
  }
6015
6061
  const normalizedType = Object.keys(typeStats).find((t) => t === type);
@@ -6021,10 +6067,11 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6021
6067
  const infoBlocks = [
6022
6068
  `【${name2}】`,
6023
6069
  `类型:${config2.type}`,
6024
- ...config2.damage ? [`基础伤害:${config2.damage}`] : [],
6025
6070
  `订购价:${config2.redCrystalCost}红晶`
6026
- // 只显示红晶价格
6027
6071
  ];
6072
+ if (config2.specialeffect) {
6073
+ infoBlocks.push(`特殊效果:${config2.specialeffect}`);
6074
+ }
6028
6075
  if (Object.keys(config2.tagEffects).length > 0) {
6029
6076
  const tagEffectsDesc = Object.entries(config2.tagEffects).map(([tag, mul]) => `▸ 对${tag}目标造成${(mul * 100).toFixed(0)}%伤害`).join("\n");
6030
6077
  infoBlocks.push("特性:", tagEffectsDesc);
@@ -6038,24 +6085,36 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6038
6085
  ...Object.entries(SyndicatedItems).filter(
6039
6086
  ([_, item]) => item.type === normalizedType && item.redCrystalCost > 0
6040
6087
  ).map(([name2, item]) => {
6088
+ const finalPrice = isComputerExpert && normalizedType === "设备工具" ? Math.floor(item.redCrystalCost * 0.5) : item.redCrystalCost;
6041
6089
  const infoBlocks = [
6042
6090
  `【${name2}】`,
6043
- `类型:${item.type}`,
6044
- `订购价:${item.redCrystalCost}红晶`,
6045
- // 只显示红晶价格
6046
- `效果:${item.effects}`,
6091
+ `类型:${item.type}`
6092
+ ];
6093
+ if (isComputerExpert && normalizedType === "设备工具") {
6094
+ infoBlocks.push(
6095
+ `订购价:${finalPrice}红晶 (原价${item.redCrystalCost})`
6096
+ );
6097
+ } else {
6098
+ infoBlocks.push(
6099
+ `订购价:${item.redCrystalCost}红晶`
6100
+ );
6101
+ }
6102
+ infoBlocks.push(
6103
+ `特殊效果:${item.effects}`,
6047
6104
  `描述:${item.description}`,
6048
6105
  "──────────────"
6049
- ];
6106
+ );
6050
6107
  return infoBlocks.join("\n");
6051
6108
  })
6052
6109
  ];
6053
6110
  return [
6054
6111
  `🏴☠️ 辛迪加黑市 - ${normalizedType} 🏴☠️`,
6055
6112
  "使用“订购 物品名称”进行购买(仅消耗红晶)",
6113
+ // 计算机专家专属提示
6114
+ isComputerExpert && normalizedType === "设备工具" ? "💳 计算机专家可享受50%折扣!" : "",
6056
6115
  "====================",
6057
6116
  ...items
6058
- ].join("\n\n");
6117
+ ].filter(Boolean).join("\n\n");
6059
6118
  });
6060
6119
  ctx.command("ggcevo/订购 <item>").action(async ({ session }, item) => {
6061
6120
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
@@ -6074,6 +6133,19 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6074
6133
  if (!isWeapon && !isSyndicatedItem) return "❌ 无效物品名称";
6075
6134
  const itemConfig2 = isWeapon ? weaponConfig[item] : SyndicatedItems[item];
6076
6135
  if (!itemConfig2.redCrystalCost) return "⛔ 该物品不可订购";
6136
+ let isComputerExpertDiscount = false;
6137
+ let originalPrice = itemConfig2.redCrystalCost;
6138
+ let finalCost = originalPrice;
6139
+ let discountApplied = false;
6140
+ if (!isWeapon && itemConfig2.type === "设备工具" && careerData.career === "计算机专家") {
6141
+ finalCost = Math.floor(originalPrice * 0.5);
6142
+ isComputerExpertDiscount = true;
6143
+ discountApplied = true;
6144
+ }
6145
+ if ((careerData.redcrystal || 0) < finalCost) {
6146
+ const discountMessage = isComputerExpertDiscount ? `(原价${originalPrice})` : "";
6147
+ return `❌ 红晶不足!需要:${finalCost}${discountMessage} 当前拥有红晶:${careerData.redcrystal}`;
6148
+ }
6077
6149
  if (isWeapon) {
6078
6150
  const existing = await ctx.database.get("ggcevo_equipment", {
6079
6151
  handle,
@@ -6081,13 +6153,9 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6081
6153
  });
6082
6154
  if (existing.length) return "您已经拥有该武器。";
6083
6155
  }
6084
- const requiredRed = itemConfig2.redCrystalCost;
6085
- if ((careerData.redcrystal || 0) < requiredRed) {
6086
- return `❌ 红晶不足!需要:${requiredRed} 当前:${careerData.redcrystal}`;
6087
- }
6088
6156
  await ctx.database.withTransaction(async () => {
6089
6157
  await ctx.database.set("ggcevo_careers", { handle }, {
6090
- redcrystal: careerData.redcrystal - requiredRed
6158
+ redcrystal: careerData.redcrystal - finalCost
6091
6159
  });
6092
6160
  if (isWeapon) {
6093
6161
  await ctx.database.create("ggcevo_equipment", {
@@ -6118,6 +6186,11 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6118
6186
  }], ["handle", "itemId"]);
6119
6187
  }
6120
6188
  });
6189
+ let discountInfo = "";
6190
+ if (discountApplied) {
6191
+ discountInfo = `
6192
+ 💳 计算机专家职业加成:设备工具类物品50%折扣`;
6193
+ }
6121
6194
  if (isWeapon) {
6122
6195
  const equippedStatus = await ctx.database.get("ggcevo_equipment", {
6123
6196
  handle,
@@ -6125,7 +6198,7 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6125
6198
  }).then((r) => r[0]?.equipped ? "已自动装备武器" : "需手动装备武器");
6126
6199
  return [
6127
6200
  `✅ 成功订购【${item}】!`,
6128
- `消耗红晶:${requiredRed}`,
6201
+ `消耗红晶:${finalCost}${discountInfo}`,
6129
6202
  `装备状态:${equippedStatus}`,
6130
6203
  '输入 "武器仓库" 管理武器'
6131
6204
  ].join("\n");
@@ -6134,9 +6207,14 @@ ${scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`
6134
6207
  handle,
6135
6208
  itemId: itemConfig2.id
6136
6209
  }).then((r) => r[0]?.quantity || 1);
6210
+ let priceInfo = `消耗红晶:${finalCost}`;
6211
+ if (isComputerExpertDiscount) {
6212
+ priceInfo += `(原价${originalPrice})`;
6213
+ }
6214
+ priceInfo += discountInfo;
6137
6215
  return [
6138
6216
  `✅ 成功订购【${item}】x1!`,
6139
- `消耗红晶:${requiredRed}`,
6217
+ priceInfo,
6140
6218
  `当前库存:${currentStock}件`,
6141
6219
  '输入 "仓库" 查看所有物品'
6142
6220
  ].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.46",
4
+ "version": "1.3.48",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [