koishi-plugin-ggcevo-game 1.2.39 → 1.2.41
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.d.ts +1 -0
- package/lib/index.js +55 -30
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -194,6 +194,7 @@ function apply(ctx, config) {
|
|
|
194
194
|
});
|
|
195
195
|
ctx.model.extend("ggcevo_pk", {
|
|
196
196
|
handle: "string",
|
|
197
|
+
name: "string",
|
|
197
198
|
total: "unsigned",
|
|
198
199
|
wins: "unsigned",
|
|
199
200
|
todayCount: "unsigned",
|
|
@@ -337,6 +338,7 @@ function apply(ctx, config) {
|
|
|
337
338
|
description: "用于隐秘射击的最佳武器,但是无法穿透护甲",
|
|
338
339
|
price: 550,
|
|
339
340
|
tagEffects: {
|
|
341
|
+
"护盾": 0.8,
|
|
340
342
|
"轻甲": 0.5,
|
|
341
343
|
"重甲": 0.2
|
|
342
344
|
}
|
|
@@ -396,7 +398,7 @@ function apply(ctx, config) {
|
|
|
396
398
|
},
|
|
397
399
|
{
|
|
398
400
|
name: "王权增幅",
|
|
399
|
-
effect: "攻击伤害+
|
|
401
|
+
effect: "攻击伤害+5%"
|
|
400
402
|
},
|
|
401
403
|
{
|
|
402
404
|
name: "金柚赐福",
|
|
@@ -768,8 +770,8 @@ function apply(ctx, config) {
|
|
|
768
770
|
endTime: { $gte: /* @__PURE__ */ new Date() }
|
|
769
771
|
});
|
|
770
772
|
if (sovereignEffect) {
|
|
771
|
-
damage *= 1.
|
|
772
|
-
effectMessage.push(`👑 王权增幅祈愿生效(攻击伤害+
|
|
773
|
+
damage *= 1.05;
|
|
774
|
+
effectMessage.push(`👑 王权增幅祈愿生效(攻击伤害+5%)`);
|
|
773
775
|
}
|
|
774
776
|
if (lamentEffect) {
|
|
775
777
|
const levelBonus = 0.1 * (equippedWeapon.level + 1);
|
|
@@ -941,7 +943,7 @@ function apply(ctx, config) {
|
|
|
941
943
|
const totalBosses = await ctx.database.select("ggcevo_boss").execute((row) => import_koishi.$.count(row.name));
|
|
942
944
|
if (totalBosses === 0) {
|
|
943
945
|
await activateNextBossGroup();
|
|
944
|
-
ctx.broadcast(config.groupId, `🔄
|
|
946
|
+
await ctx.broadcast(config.groupId, [`🔄 咕咕PVE系统已初始化,首个主宰已登场!`]);
|
|
945
947
|
return;
|
|
946
948
|
}
|
|
947
949
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -955,9 +957,9 @@ function apply(ctx, config) {
|
|
|
955
957
|
groupId: group.groupId
|
|
956
958
|
});
|
|
957
959
|
await activateNextBossGroup(group.groupId);
|
|
958
|
-
ctx.broadcast(
|
|
960
|
+
await ctx.broadcast(
|
|
959
961
|
config.groupId,
|
|
960
|
-
`🔄 新的主宰已刷新,快去挑战吧!`
|
|
962
|
+
[`🔄 新的主宰已刷新,快去挑战吧!`]
|
|
961
963
|
);
|
|
962
964
|
}
|
|
963
965
|
}, 60 * 1e3);
|
|
@@ -1305,7 +1307,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1305
1307
|
if (!backpack) return "您还没有签到。";
|
|
1306
1308
|
const memberInfo = await session.event?.member?.roles;
|
|
1307
1309
|
if (memberInfo?.includes("member")) {
|
|
1308
|
-
return "
|
|
1310
|
+
return "❌ 拒绝访问,仅限管理员和群主领取每月津贴。";
|
|
1309
1311
|
}
|
|
1310
1312
|
const now = /* @__PURE__ */ new Date();
|
|
1311
1313
|
const chinatime = convertUTCtoChinaTime(now);
|
|
@@ -1523,7 +1525,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1523
1525
|
}
|
|
1524
1526
|
}
|
|
1525
1527
|
}, 60 * 60 * 1e3);
|
|
1526
|
-
ctx.command("ggcevo
|
|
1528
|
+
ctx.command("ggcevo/胜点榜数据同步", { authority: 3 }).action(async () => {
|
|
1527
1529
|
try {
|
|
1528
1530
|
const ggcmap = await ctx.database.get("sc2arcade_map", { guildId: config.ggcqun });
|
|
1529
1531
|
const lastdate = ggcmap[0].lastdate;
|
|
@@ -1579,7 +1581,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1579
1581
|
lastdate: new Date(currentMaxDate.toISOString())
|
|
1580
1582
|
});
|
|
1581
1583
|
}
|
|
1582
|
-
return "✅
|
|
1584
|
+
return "✅ 胜点榜数据同步成功!";
|
|
1583
1585
|
} catch (err) {
|
|
1584
1586
|
console.error("错误:", err);
|
|
1585
1587
|
return "服务器繁忙,请稍后尝试。";
|
|
@@ -2037,6 +2039,9 @@ ${output}`;
|
|
|
2037
2039
|
if (existingEntries.length > 0) {
|
|
2038
2040
|
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
2039
2041
|
}
|
|
2042
|
+
await session.send(`您确定要使用3张兑换券换取一枚扭蛋币吗?(请在30秒内回复“是”确认)`);
|
|
2043
|
+
const confirm = await session.prompt(3e4);
|
|
2044
|
+
if (confirm !== "是") return "已取消操作。";
|
|
2040
2045
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
|
|
2041
2046
|
const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
|
|
2042
2047
|
if (!coupon || coupon.quantity < 3) {
|
|
@@ -2103,7 +2108,7 @@ ${output}`;
|
|
|
2103
2108
|
try {
|
|
2104
2109
|
const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
|
|
2105
2110
|
if (!handleRegex.test(handle)) {
|
|
2106
|
-
return "
|
|
2111
|
+
return "句柄格式错误,请重新输入。";
|
|
2107
2112
|
}
|
|
2108
2113
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2109
2114
|
if (existingEntries.length > 0) {
|
|
@@ -2317,14 +2322,23 @@ ${achievementList.join("\n")}`;
|
|
|
2317
2322
|
const parsedUser = import_koishi.h.parse(user)[0];
|
|
2318
2323
|
if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) return "参数格式错误,请输入“pk @指定pk玩家”。";
|
|
2319
2324
|
const targetUserId = parsedUser.attrs.id;
|
|
2320
|
-
const targetUsername = session.bot.getGuildMember(config.ggcqun, targetUserId);
|
|
2325
|
+
const targetUsername = await session.bot.getGuildMember(config.ggcqun, targetUserId);
|
|
2321
2326
|
const [targetprofile] = await ctx.database.get("sc2arcade_player", { userId: targetUserId });
|
|
2322
2327
|
if (!targetprofile) return "对方尚未绑定句柄。";
|
|
2323
2328
|
const initiatorHandle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2324
2329
|
const targetHandle = `${targetprofile.regionId}-S2-${targetprofile.realmId}-${targetprofile.profileId}`;
|
|
2325
|
-
if (initiatorHandle === targetHandle) return "
|
|
2330
|
+
if (initiatorHandle === targetHandle) return "抱歉,您不能挑战自己。";
|
|
2331
|
+
const [initiatorData, targetData] = await Promise.all([
|
|
2332
|
+
ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
|
|
2333
|
+
ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
|
|
2334
|
+
]);
|
|
2335
|
+
const initiatorRank = initiatorData[0]?.rank || 0;
|
|
2336
|
+
const targetRank = targetData[0]?.rank || 0;
|
|
2337
|
+
const initiatorRankname = initiatorData[0]?.name || session.username;
|
|
2338
|
+
const targetRankname = targetData[0]?.name || (targetUsername.name || targetUsername.user.name);
|
|
2326
2339
|
let initiatorPK = {
|
|
2327
2340
|
handle: initiatorHandle,
|
|
2341
|
+
name: initiatorRankname,
|
|
2328
2342
|
total: 0,
|
|
2329
2343
|
wins: 0,
|
|
2330
2344
|
todayCount: 0,
|
|
@@ -2337,6 +2351,7 @@ ${achievementList.join("\n")}`;
|
|
|
2337
2351
|
};
|
|
2338
2352
|
let targetPK = {
|
|
2339
2353
|
handle: targetHandle,
|
|
2354
|
+
name: targetRankname,
|
|
2340
2355
|
total: 0,
|
|
2341
2356
|
wins: 0,
|
|
2342
2357
|
todayCount: 0,
|
|
@@ -2388,14 +2403,6 @@ ${achievementList.join("\n")}`;
|
|
|
2388
2403
|
return `该玩家今日已被挑战太多次(最多${config.maxDailyBeChallenged}次)。`;
|
|
2389
2404
|
}
|
|
2390
2405
|
}
|
|
2391
|
-
const [initiatorData, targetData] = await Promise.all([
|
|
2392
|
-
ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
|
|
2393
|
-
ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
|
|
2394
|
-
]);
|
|
2395
|
-
const initiatorRank = initiatorData[0]?.rank || 0;
|
|
2396
|
-
const targetRank = targetData[0]?.rank || 0;
|
|
2397
|
-
const initiatorRankname = initiatorData[0]?.name || session.username;
|
|
2398
|
-
const targetRankname = targetData[0]?.name || (await targetUsername).name;
|
|
2399
2406
|
const [initiatorSign, targetSign] = await Promise.all([
|
|
2400
2407
|
ctx.database.get("ggcevo_sign", initiatorHandle),
|
|
2401
2408
|
ctx.database.get("ggcevo_sign", targetHandle)
|
|
@@ -2420,6 +2427,7 @@ ${achievementList.join("\n")}`;
|
|
|
2420
2427
|
// 发起者记录
|
|
2421
2428
|
{
|
|
2422
2429
|
handle: initiatorHandle,
|
|
2430
|
+
name: initiatorRankname,
|
|
2423
2431
|
total: initiatorPK.total + 1,
|
|
2424
2432
|
wins: isWin ? initiatorPK.wins + 1 : initiatorPK.wins,
|
|
2425
2433
|
todayCount: initiatorPK.todayCount + 1,
|
|
@@ -2432,6 +2440,7 @@ ${achievementList.join("\n")}`;
|
|
|
2432
2440
|
// 应战者记录(新增部分)
|
|
2433
2441
|
{
|
|
2434
2442
|
handle: targetHandle,
|
|
2443
|
+
name: targetRankname,
|
|
2435
2444
|
total: targetPK.total + 1,
|
|
2436
2445
|
wins: !isWin ? targetPK.wins + 1 : targetPK.wins,
|
|
2437
2446
|
// 应战者胜利时增加
|
|
@@ -2488,8 +2497,9 @@ ${achievementList.join("\n")}`;
|
|
|
2488
2497
|
if (!records.length) return "暂无PK记录";
|
|
2489
2498
|
const rankingText = records.map((record, index) => {
|
|
2490
2499
|
const winRate = record.total > 0 ? `${(record.wins / record.total * 100).toFixed(1)}%` : "N/A";
|
|
2500
|
+
const rankname = record.name || record.handle;
|
|
2491
2501
|
return [
|
|
2492
|
-
`${offset + index + 1}. ${
|
|
2502
|
+
`${offset + index + 1}. ${rankname}`,
|
|
2493
2503
|
`总PK: ${record.total}次`,
|
|
2494
2504
|
`胜率: ${winRate}`
|
|
2495
2505
|
].join(" | ");
|
|
@@ -2503,7 +2513,7 @@ ${achievementList.join("\n")}`;
|
|
|
2503
2513
|
pageNum < totalPages ? `输入 pk榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
|
|
2504
2514
|
].join("\n");
|
|
2505
2515
|
});
|
|
2506
|
-
ctx.command("ggcevo/切换pk状态", "切换玩家对战状态").action(async ({ session }) => {
|
|
2516
|
+
ctx.command("ggcevo/切换pk状态", "切换玩家对战状态").alias("切换pk").action(async ({ session }) => {
|
|
2507
2517
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2508
2518
|
if (!profile) return "您暂未绑定句柄。";
|
|
2509
2519
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
@@ -2591,6 +2601,10 @@ ${validTypes.join("、")}`;
|
|
|
2591
2601
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2592
2602
|
if (!profile) return "您暂未绑定句柄";
|
|
2593
2603
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2604
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2605
|
+
if (existingEntries.length > 0) {
|
|
2606
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
2607
|
+
}
|
|
2594
2608
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2595
2609
|
if (!weapon) return "如果您想购买武器,请输入“购买 武器名称”。";
|
|
2596
2610
|
if (!weaponConfig[weapon]) return "无效的武器名称,请重新输入。";
|
|
@@ -2680,6 +2694,10 @@ ${validTypes.join("、")}`;
|
|
|
2680
2694
|
if (!weaponConfig[weapon]) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
2681
2695
|
const config2 = weaponConfig[weapon];
|
|
2682
2696
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2697
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2698
|
+
if (existingEntries.length > 0) {
|
|
2699
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
2700
|
+
}
|
|
2683
2701
|
const [owned] = await ctx.database.get("ggcevo_equipment", {
|
|
2684
2702
|
handle,
|
|
2685
2703
|
weaponId: config2.id
|
|
@@ -2707,6 +2725,10 @@ ${validTypes.join("、")}`;
|
|
|
2707
2725
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2708
2726
|
if (!profile) return "您暂未绑定句柄。";
|
|
2709
2727
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2728
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2729
|
+
if (existingEntries.length > 0) {
|
|
2730
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
2731
|
+
}
|
|
2710
2732
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2711
2733
|
const [equipment] = await ctx.database.get("ggcevo_equipment", {
|
|
2712
2734
|
handle,
|
|
@@ -2785,6 +2807,10 @@ ${validTypes.join("、")}`;
|
|
|
2785
2807
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2786
2808
|
if (!profile) return "您暂未绑定句柄";
|
|
2787
2809
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2810
|
+
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2811
|
+
if (existingEntries.length > 0) {
|
|
2812
|
+
return `❌ 拒绝访问,您已被列入黑名单。`;
|
|
2813
|
+
}
|
|
2788
2814
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2789
2815
|
const [equipment] = await ctx.database.get("ggcevo_equipment", {
|
|
2790
2816
|
handle,
|
|
@@ -2865,7 +2891,7 @@ ${validTypes.join("、")}`;
|
|
|
2865
2891
|
handle,
|
|
2866
2892
|
equipped: true
|
|
2867
2893
|
});
|
|
2868
|
-
if (!equippedWeapon) return "
|
|
2894
|
+
if (!equippedWeapon) return "请先装备武器再攻击。";
|
|
2869
2895
|
const activeBosses = await ctx.database.get("ggcevo_boss", { isActive: true });
|
|
2870
2896
|
if (!activeBosses.length) return "当前没有存活的主宰。";
|
|
2871
2897
|
const targetBoss = normalizedTarget === "主宰" ? activeBosses.find((b) => b.type === "主宰") : activeBosses.find((b) => b.type === "子代");
|
|
@@ -2874,7 +2900,7 @@ ${validTypes.join("、")}`;
|
|
|
2874
2900
|
const [weaponName, weaponData] = weaponConfigEntry;
|
|
2875
2901
|
const { damage: baseDamage, hasCrit, effectMessage } = await calculateTotalDamage(ctx, session, equippedWeapon, targetBoss);
|
|
2876
2902
|
const bossGroup = bossPool.find((g) => g.main.id === targetBoss.groupId);
|
|
2877
|
-
if (!bossGroup) return "无法获取BOSS
|
|
2903
|
+
if (!bossGroup) return "无法获取BOSS组配置。";
|
|
2878
2904
|
const maxHP = targetBoss.type === "主宰" ? bossGroup.main.maxHP : bossGroup.minions.find((m) => m.name === targetBoss.name)?.maxHP || 0;
|
|
2879
2905
|
let initialDamage = Math.min(baseDamage, targetBoss.HP);
|
|
2880
2906
|
let currentHP = targetBoss.HP - initialDamage;
|
|
@@ -2923,8 +2949,8 @@ ${validTypes.join("、")}`;
|
|
|
2923
2949
|
});
|
|
2924
2950
|
await ctx.database.upsert("ggcevo_boss", updates, ["name"]);
|
|
2925
2951
|
healMessages.push(
|
|
2926
|
-
`❄️ ${targetBoss.name}
|
|
2927
|
-
`🌪️
|
|
2952
|
+
`❄️ ${targetBoss.name} 触发【冰霜环绕】,自身回复45%最大生命值(+${healAmount}HP)`,
|
|
2953
|
+
`🌪️ 【寒霜地狱】降临!所有存活的主宰和子代将获得30%减伤效果`
|
|
2928
2954
|
);
|
|
2929
2955
|
}
|
|
2930
2956
|
if (targetBoss.type === "子代" && targetBoss.skills.includes("冰霜回复") && hpPercentage <= 0.3) {
|
|
@@ -2945,7 +2971,7 @@ ${validTypes.join("、")}`;
|
|
|
2945
2971
|
);
|
|
2946
2972
|
}
|
|
2947
2973
|
triggeredSkills.push("冰霜回复");
|
|
2948
|
-
healMessages.push(`❄️ ${targetBoss.name}
|
|
2974
|
+
healMessages.push(`❄️ ${targetBoss.name} 触发【冰霜回复】,自身回复20%最大生命值(+${selfHeal}HP),主宰回复20%最大生命值(+${mainHeal}HP)`);
|
|
2949
2975
|
}
|
|
2950
2976
|
}
|
|
2951
2977
|
const isDefeated = currentHP <= 0;
|
|
@@ -3200,8 +3226,7 @@ ${validTypes.join("、")}`;
|
|
|
3200
3226
|
] : [],
|
|
3201
3227
|
// 冰霜进化特殊处理(新增条件判断)
|
|
3202
3228
|
...targetBoss.skills.includes("冰霜进化") && weaponName === "零度之下" ? [
|
|
3203
|
-
`❄️ ${targetBoss.name}
|
|
3204
|
-
`🩹 反而恢复 ${baseDamage} 生命值`
|
|
3229
|
+
`❄️ ${targetBoss.name} 触发【冰霜进化】免疫冰霜伤害!并且回复 ${baseDamage} 生命值`
|
|
3205
3230
|
] : [
|
|
3206
3231
|
`造成伤害:${initialDamage}${hasCrit ? "(✨ 暴击)" : ""}`,
|
|
3207
3232
|
...healMessages
|
|
@@ -3215,7 +3240,7 @@ ${validTypes.join("、")}`;
|
|
|
3215
3240
|
if (broadcastMessage) {
|
|
3216
3241
|
const finalBroadcast = Array.isArray(broadcastMessage) ? broadcastMessage.join("\n") : broadcastMessage;
|
|
3217
3242
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
3218
|
-
ctx.broadcast(config2.groupId, finalBroadcast);
|
|
3243
|
+
await ctx.broadcast(config2.groupId, finalBroadcast);
|
|
3219
3244
|
}
|
|
3220
3245
|
return;
|
|
3221
3246
|
});
|