koishi-plugin-ggcevo-game 1.2.3 → 1.2.5

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 +45 -17
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -275,15 +275,11 @@ function apply(ctx, config) {
275
275
  const modConfig = {
276
276
  "动能增幅": {
277
277
  cost: 1250,
278
- effect: "伤害+20%",
279
- description: "动能增幅(伤害+20%)"
280
- // 新增描述字段
278
+ effect: "伤害+20%"
281
279
  },
282
280
  "棱镜水晶": {
283
281
  cost: 1750,
284
- effect: "20%暴击率",
285
- description: "棱镜水晶(20%暴击率)"
286
- // 新增描述字段
282
+ effect: "暴击率+20%"
287
283
  }
288
284
  };
289
285
  const bossPool = [
@@ -1674,7 +1670,8 @@ ${achievementList.join("\n")}`;
1674
1670
  const message = [
1675
1671
  `📺 监测到违规大厅 ID: ${lobby.id}`,
1676
1672
  `创建时间: ${new Date(lobby.createdAt).toLocaleString("zh-CN")}`,
1677
- `🏆 安全玩家:${atElements || "无"}`,
1673
+ `🏆 安全玩家:${atElements || "无"}
1674
+ `,
1678
1675
  `🚨 违规玩家(${violators.length} 人):`,
1679
1676
  ...violators.map((v) => {
1680
1677
  const record = punishmentRecords.find((r) => r.handle === v.handle);
@@ -1932,11 +1929,18 @@ ${achievementList.join("\n")}`;
1932
1929
  });
1933
1930
  ctx.command("ggcevo/购买 <weapon>").action(async ({ session }, weapon) => {
1934
1931
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
1935
- if (!profile) return "未绑定句柄";
1932
+ if (!profile) return "您暂未绑定句柄";
1936
1933
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
1937
1934
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
1938
1935
  if (!weaponConfig[weapon]) return "无效的武器名称";
1939
1936
  const config2 = weaponConfig[weapon];
1937
+ const existingWeapons = await ctx.database.get("ggcevo_equipment", {
1938
+ handle,
1939
+ weaponId: config2.id
1940
+ });
1941
+ if (existingWeapons.length > 0) {
1942
+ return `你已经拥有${weapon},无法重复购买`;
1943
+ }
1940
1944
  if ((signInfo?.totalRewards || 0) < config2.price)
1941
1945
  return `金币不足,需要${config2.price}金币`;
1942
1946
  await ctx.database.withTransaction(async () => {
@@ -1947,9 +1951,7 @@ ${achievementList.join("\n")}`;
1947
1951
  handle,
1948
1952
  weaponId: config2.id,
1949
1953
  level: 0,
1950
- // 初始等级为0
1951
1954
  modificationSlots: 1,
1952
- // 初始改装槽为1
1953
1955
  equipped: false
1954
1956
  }], ["handle", "weaponId"]);
1955
1957
  });
@@ -1968,7 +1970,7 @@ ${achievementList.join("\n")}`;
1968
1970
  const statusIcon = w.equipped ? "⚡" : "・";
1969
1971
  const statusText = w.equipped ? "[已装备]" : "";
1970
1972
  const currentDamage = config2.damage * (1 + 0.1 * w.level);
1971
- const mods = w.installedMods.map((m) => modConfig[m].description).join(" | ") || "无";
1973
+ const mods = w.installedMods.map((m) => m).join(" | ") || "无";
1972
1974
  return [
1973
1975
  `${statusIcon} ${weaponName} ${statusText}`,
1974
1976
  `等级:Lv.${w.level} | 改装槽:${w.modificationSlots}`,
@@ -2045,9 +2047,24 @@ ${achievementList.join("\n")}`;
2045
2047
  return `${weapon} 升级成功!当前等级:${equipment.level + 1},伤害:${baseDamage}`;
2046
2048
  });
2047
2049
  ctx.command("ggcevo/改装 <weapon> <mod>", "安装武器改装件").action(async ({ session }, weapon, mod) => {
2048
- if (!modConfig[mod]) return "可用改装:动能增幅(1250)、棱镜水晶(1750)";
2050
+ const generateModList = /* @__PURE__ */ __name(() => {
2051
+ return Object.entries(modConfig).map(([name2, config2]) => [
2052
+ `【${name2}】`,
2053
+ `价格:${config2.cost}金币`,
2054
+ "效果:",
2055
+ config2.effect.replace(/▸/g, "▸ ")
2056
+ ].join("\n")).join("\n\n");
2057
+ }, "generateModList");
2058
+ if (!modConfig[mod]) {
2059
+ return [
2060
+ "🛠️ 可用武器改装件 🛠️",
2061
+ "使用“改装 武器名称 改装件名称”进行安装",
2062
+ "====================",
2063
+ generateModList()
2064
+ ].join("\n\n");
2065
+ }
2049
2066
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2050
- if (!profile) return "未绑定游戏账号";
2067
+ if (!profile) return "您暂未绑定句柄";
2051
2068
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2052
2069
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
2053
2070
  const [equipment] = await ctx.database.get("ggcevo_equipment", {
@@ -2070,10 +2087,21 @@ ${achievementList.join("\n")}`;
2070
2087
  await ctx.database.set("ggcevo_sign", { handle }, {
2071
2088
  totalRewards: signInfo.totalRewards - modConfig[mod].cost
2072
2089
  });
2073
- const installedModsWithDesc = [...equipment.installedMods, mod].map(
2074
- (m) => modConfig[m].description
2075
- );
2076
- return `${weapon} 成功安装 ${modConfig[mod].description}!当前改装:${installedModsWithDesc.join(" | ")}`;
2090
+ const installedModsList = [...equipment.installedMods, mod].map((m) => {
2091
+ const config2 = modConfig[m];
2092
+ return [
2093
+ `【${m}】`,
2094
+ `安装费用:${config2.cost}金币`,
2095
+ "效果:",
2096
+ config2.description
2097
+ ].join("\n");
2098
+ }).join("\n\n");
2099
+ return [
2100
+ `✅ ${weapon} 成功安装 ${mod}!`,
2101
+ "当前改装配置:",
2102
+ installedModsList,
2103
+ `剩余金币:${signInfo.totalRewards - modConfig[mod].cost}`
2104
+ ].join("\n\n");
2077
2105
  });
2078
2106
  ctx.command("ggcevo/攻击 <targetType>").usage("使用 攻击 主宰/zz 或 攻击 子代/zd 来选择攻击目标").action(async (argv, targetType) => {
2079
2107
  const session = argv.session;
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.3",
4
+ "version": "1.2.5",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [