koishi-plugin-ggcevo-game 1.2.67 → 1.2.69
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.js +51 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -284,7 +284,7 @@ function apply(ctx, config) {
|
|
|
284
284
|
type: "爆破物",
|
|
285
285
|
description: "一种小型的机械装置,用于吸收空间站能量并进行爆破",
|
|
286
286
|
redCrystalCost: 30,
|
|
287
|
-
effects: "
|
|
287
|
+
effects: "当主宰为“空间站感染虫”时才能使用,对“空间站哨枪塔”造成其当前血量值的伤害(获得等同于伤害值的金币)",
|
|
288
288
|
// 确保结构兼容性
|
|
289
289
|
price: 0,
|
|
290
290
|
damage: 0,
|
|
@@ -1423,7 +1423,7 @@ function apply(ctx, config) {
|
|
|
1423
1423
|
return null;
|
|
1424
1424
|
}
|
|
1425
1425
|
let reduction = 0.2;
|
|
1426
|
-
let msg = "
|
|
1426
|
+
let msg = "常规武器减伤20%";
|
|
1427
1427
|
if (weaponData.type === "热能武器") {
|
|
1428
1428
|
reduction = 0.4;
|
|
1429
1429
|
msg = "热能武器减伤40%";
|
|
@@ -1758,12 +1758,13 @@ function apply(ctx, config) {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
}
|
|
1760
1760
|
__name(checkTransferRequirements, "checkTransferRequirements");
|
|
1761
|
-
async function applyItemEffect(handle, itemId) {
|
|
1761
|
+
async function applyItemEffect(session, handle, itemId) {
|
|
1762
1762
|
const itemConfig2 = Object.values(weaponConfig).find((v) => v.id === itemId);
|
|
1763
1763
|
if (!itemConfig2) return "该物品未配置效果";
|
|
1764
1764
|
if (itemId === 1e3) {
|
|
1765
1765
|
const [SentryTower] = await ctx.database.get("ggcevo_boss", { name: "空间站哨枪塔", isActive: true });
|
|
1766
1766
|
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
1767
|
+
const [existingRecord] = await ctx.database.get("ggcevo_boss_damage", { handle });
|
|
1767
1768
|
await ctx.database.set(
|
|
1768
1769
|
"ggcevo_boss",
|
|
1769
1770
|
{ name: "空间站哨枪塔" },
|
|
@@ -1772,11 +1773,18 @@ function apply(ctx, config) {
|
|
|
1772
1773
|
HP: 0
|
|
1773
1774
|
}
|
|
1774
1775
|
);
|
|
1776
|
+
await ctx.database.upsert("ggcevo_boss_damage", [{
|
|
1777
|
+
handle,
|
|
1778
|
+
playerName: session.username,
|
|
1779
|
+
totalDamage: (existingRecord?.totalDamage || 0) + SentryTower.HP,
|
|
1780
|
+
// 改为实际伤害
|
|
1781
|
+
attackCount: existingRecord?.attackCount || 0
|
|
1782
|
+
}], ["handle"]);
|
|
1775
1783
|
await ctx.database.upsert("ggcevo_sign", [{
|
|
1776
1784
|
handle,
|
|
1777
1785
|
totalRewards: (record?.totalRewards || 0) + SentryTower.HP
|
|
1778
1786
|
}], ["handle"]);
|
|
1779
|
-
return `您使用了E-2
|
|
1787
|
+
return `您使用了E-2能量炸弹,直接摧毁了“空间站哨枪塔”并且获得了${SentryTower.HP}金币。`;
|
|
1780
1788
|
}
|
|
1781
1789
|
}
|
|
1782
1790
|
__name(applyItemEffect, "applyItemEffect");
|
|
@@ -4174,6 +4182,43 @@ ${validTypes.join("、")}`;
|
|
|
4174
4182
|
});
|
|
4175
4183
|
return `成功使用${exchangeCount}张兑换券,获得${goldAmount}枚金币!`;
|
|
4176
4184
|
});
|
|
4185
|
+
ctx.command("兑换红晶", "使用金币兑换红晶").action(async ({ session }) => {
|
|
4186
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4187
|
+
if (!profile) return "您暂未绑定句柄。";
|
|
4188
|
+
const { regionId, realmId, profileId } = profile;
|
|
4189
|
+
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
4190
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
4191
|
+
if (existingEntries.length > 0) {
|
|
4192
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
4193
|
+
}
|
|
4194
|
+
await session.send(`请输入你想要兑换多少红晶?(请在30秒内回复数字,回复“0”为取消兑换)
|
|
4195
|
+
注意:每块红晶需要950金币。`);
|
|
4196
|
+
const exchangeInput = await session.prompt(3e4);
|
|
4197
|
+
if (!exchangeInput) return "输入超时,请重新输入。";
|
|
4198
|
+
const exchangeCount = parseInt(exchangeInput, 10);
|
|
4199
|
+
if (isNaN(exchangeCount)) return "请输入有效的数字!";
|
|
4200
|
+
if (exchangeCount < 0) return "兑换数量不能为负数!";
|
|
4201
|
+
if (exchangeCount === 0) return "已取消兑换。";
|
|
4202
|
+
const goldAmount = exchangeCount * 950;
|
|
4203
|
+
const [coin] = await ctx.database.get("ggcevo_sign", {
|
|
4204
|
+
handle
|
|
4205
|
+
});
|
|
4206
|
+
const [career] = await ctx.database.get("ggcevo_careers", {
|
|
4207
|
+
handle
|
|
4208
|
+
});
|
|
4209
|
+
if (!coin || coin.totalRewards < goldAmount) {
|
|
4210
|
+
return "您的金币不足,无法兑换红晶!";
|
|
4211
|
+
}
|
|
4212
|
+
await ctx.database.set("ggcevo_sign", {
|
|
4213
|
+
handle
|
|
4214
|
+
}, {
|
|
4215
|
+
totalRewards: coin.totalRewards - goldAmount
|
|
4216
|
+
});
|
|
4217
|
+
await ctx.database.set("ggcevo_careers", { handle }, {
|
|
4218
|
+
redcrystal: (career?.redcrystal || 0) + exchangeCount
|
|
4219
|
+
});
|
|
4220
|
+
return `成功使用${goldAmount}金币,获得${exchangeCount}红晶!`;
|
|
4221
|
+
});
|
|
4177
4222
|
ctx.command("ggcevo/加入 <faction>", "加入阵营").action(async ({ session }, faction) => {
|
|
4178
4223
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
4179
4224
|
if (!profile) return "您暂未绑定句柄。";
|
|
@@ -4424,7 +4469,7 @@ ${validTypes.join("、")}`;
|
|
|
4424
4469
|
}
|
|
4425
4470
|
const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
|
|
4426
4471
|
if (!careerData || careerData.group !== "辛迪加海盗") {
|
|
4427
|
-
return "🚫
|
|
4472
|
+
return "🚫 该功能需要【辛迪加海盗】阵营权限";
|
|
4428
4473
|
}
|
|
4429
4474
|
if (!item) return "请输入要订购的物品名称";
|
|
4430
4475
|
const config2 = weaponConfig[item];
|
|
@@ -4550,7 +4595,7 @@ ${validTypes.join("、")}`;
|
|
|
4550
4595
|
await ctx.database.set("ggcevo_warehouse", { handle, itemId: targetItem.itemId }, {
|
|
4551
4596
|
quantity: Math.max(targetItem.quantity - 1, 0)
|
|
4552
4597
|
});
|
|
4553
|
-
const effectResult = await applyItemEffect(handle, targetItem.itemId);
|
|
4598
|
+
const effectResult = await applyItemEffect(session, handle, targetItem.itemId);
|
|
4554
4599
|
return `使用成功!消耗 ${itemName} ×1
|
|
4555
4600
|
剩余数量:${targetItem.quantity - 1}
|
|
4556
4601
|
${effectResult}`;
|