koishi-plugin-ggcevo-game 1.2.68 → 1.2.70

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 +44 -0
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -4182,6 +4182,46 @@ ${validTypes.join("、")}`;
4182
4182
  });
4183
4183
  return `成功使用${exchangeCount}张兑换券,获得${goldAmount}枚金币!`;
4184
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 handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
4189
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
4190
+ if (existingEntries.length > 0) {
4191
+ return `❌ 拒绝访问,您已被列入黑名单。`;
4192
+ }
4193
+ const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
4194
+ if (!careerData || careerData.group !== "辛迪加海盗") {
4195
+ return "🚫 该功能需要【辛迪加海盗】阵营权限";
4196
+ }
4197
+ await session.send(`请输入你想要兑换多少红晶?(请在30秒内回复数字,回复“0”为取消兑换)
4198
+ 注意:每块红晶需要950金币。`);
4199
+ const exchangeInput = await session.prompt(3e4);
4200
+ if (!exchangeInput) return "输入超时,请重新输入。";
4201
+ const exchangeCount = parseInt(exchangeInput, 10);
4202
+ if (isNaN(exchangeCount)) return "请输入有效的数字!";
4203
+ if (exchangeCount < 0) return "兑换数量不能为负数!";
4204
+ if (exchangeCount === 0) return "已取消兑换。";
4205
+ const goldAmount = exchangeCount * 950;
4206
+ const [coin] = await ctx.database.get("ggcevo_sign", {
4207
+ handle
4208
+ });
4209
+ const [career] = await ctx.database.get("ggcevo_careers", {
4210
+ handle
4211
+ });
4212
+ if (!coin || coin.totalRewards < goldAmount) {
4213
+ return "您的金币不足,无法兑换红晶!";
4214
+ }
4215
+ await ctx.database.set("ggcevo_sign", {
4216
+ handle
4217
+ }, {
4218
+ totalRewards: coin.totalRewards - goldAmount
4219
+ });
4220
+ await ctx.database.set("ggcevo_careers", { handle }, {
4221
+ redcrystal: (career?.redcrystal || 0) + exchangeCount
4222
+ });
4223
+ return `成功使用${goldAmount}金币,获得${exchangeCount}红晶!`;
4224
+ });
4185
4225
  ctx.command("ggcevo/加入 <faction>", "加入阵营").action(async ({ session }, faction) => {
4186
4226
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
4187
4227
  if (!profile) return "您暂未绑定句柄。";
@@ -4539,6 +4579,10 @@ ${validTypes.join("、")}`;
4539
4579
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
4540
4580
  if (!profile) return "您暂未绑定句柄。";
4541
4581
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
4582
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
4583
+ if (existingEntries.length > 0) {
4584
+ return "❌ 拒绝访问,您已被列入黑名单";
4585
+ }
4542
4586
  try {
4543
4587
  const items = await ctx.database.get("ggcevo_warehouse", { handle });
4544
4588
  const targetItem = items.find((warehouseItem) => {
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.68",
4
+ "version": "1.2.70",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [