koishi-plugin-ggcevo-game 1.3.51 → 1.3.53
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 +69 -41
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2417,46 +2417,48 @@ function apply(ctx, config) {
|
|
|
2417
2417
|
const top20 = damageRecords.slice(0, 20);
|
|
2418
2418
|
top20.forEach((record, index) => {
|
|
2419
2419
|
const rank = index + 1;
|
|
2420
|
-
let guguCoins =
|
|
2420
|
+
let guguCoins = 10, gold = 1e3;
|
|
2421
2421
|
switch (true) {
|
|
2422
2422
|
case rank === 1:
|
|
2423
|
-
guguCoins =
|
|
2424
|
-
gold =
|
|
2423
|
+
guguCoins = 30;
|
|
2424
|
+
gold = 3e3;
|
|
2425
2425
|
break;
|
|
2426
2426
|
case rank === 2:
|
|
2427
|
-
guguCoins =
|
|
2428
|
-
gold =
|
|
2427
|
+
guguCoins = 25;
|
|
2428
|
+
gold = 2500;
|
|
2429
2429
|
break;
|
|
2430
2430
|
case rank === 3:
|
|
2431
|
-
guguCoins =
|
|
2432
|
-
gold =
|
|
2431
|
+
guguCoins = 20;
|
|
2432
|
+
gold = 2e3;
|
|
2433
2433
|
break;
|
|
2434
2434
|
case rank <= 10:
|
|
2435
|
-
guguCoins =
|
|
2436
|
-
gold =
|
|
2435
|
+
guguCoins = 15;
|
|
2436
|
+
gold = 1500;
|
|
2437
2437
|
break;
|
|
2438
2438
|
}
|
|
2439
|
-
|
|
2439
|
+
const isCleaner = cleanerHandles.has(record.handle);
|
|
2440
|
+
const hasDoubleWish = doubleWishHandles.has(record.handle);
|
|
2441
|
+
if (hasDoubleWish) {
|
|
2440
2442
|
guguCoins *= 2;
|
|
2441
2443
|
gold *= 2;
|
|
2442
2444
|
}
|
|
2443
2445
|
let redCrystal = 0;
|
|
2444
|
-
if (
|
|
2446
|
+
if (isCleaner) {
|
|
2445
2447
|
switch (true) {
|
|
2446
2448
|
case rank === 1:
|
|
2447
|
-
redCrystal =
|
|
2449
|
+
redCrystal = 30;
|
|
2448
2450
|
break;
|
|
2449
2451
|
case rank === 2:
|
|
2450
|
-
redCrystal =
|
|
2452
|
+
redCrystal = 25;
|
|
2451
2453
|
break;
|
|
2452
2454
|
case rank === 3:
|
|
2453
|
-
redCrystal =
|
|
2455
|
+
redCrystal = 20;
|
|
2454
2456
|
break;
|
|
2455
2457
|
case rank <= 10:
|
|
2456
|
-
redCrystal =
|
|
2458
|
+
redCrystal = 15;
|
|
2457
2459
|
break;
|
|
2458
2460
|
case rank <= 20:
|
|
2459
|
-
redCrystal =
|
|
2461
|
+
redCrystal = 10;
|
|
2460
2462
|
break;
|
|
2461
2463
|
}
|
|
2462
2464
|
}
|
|
@@ -2467,29 +2469,47 @@ function apply(ctx, config) {
|
|
|
2467
2469
|
playerName: record.playerName
|
|
2468
2470
|
};
|
|
2469
2471
|
rewardMap.set(record.handle, reward);
|
|
2472
|
+
let bonusNote = "";
|
|
2473
|
+
if (isCleaner && hasDoubleWish) {
|
|
2474
|
+
bonusNote = " (清洁工职业加成+精灵双倍祈愿)";
|
|
2475
|
+
} else if (isCleaner) {
|
|
2476
|
+
bonusNote = " (清洁工职业加成)";
|
|
2477
|
+
} else if (hasDoubleWish) {
|
|
2478
|
+
bonusNote = " (精灵双倍祈愿)";
|
|
2479
|
+
}
|
|
2470
2480
|
rewardMessages.push(
|
|
2471
2481
|
`${rank}. ${record.playerName}`,
|
|
2472
|
-
` 获得奖励: ${guguCoins} 咕咕币 + ${gold} 金币` + (redCrystal > 0 ? ` + ${redCrystal} 红晶` : "")
|
|
2482
|
+
` 获得奖励: ${guguCoins} 咕咕币 + ${gold} 金币` + (redCrystal > 0 ? ` + ${redCrystal} 红晶` : "") + bonusNote
|
|
2473
2483
|
);
|
|
2474
2484
|
});
|
|
2475
2485
|
const others = damageRecords.slice(20);
|
|
2476
2486
|
if (others.length > 0) {
|
|
2487
|
+
const otherRewardNotes = [];
|
|
2488
|
+
if (cleanerHandles.size > 0) {
|
|
2489
|
+
otherRewardNotes.push("清洁工职业加成额外+3红晶");
|
|
2490
|
+
}
|
|
2491
|
+
if (doubleWishHandles.size > 0) {
|
|
2492
|
+
otherRewardNotes.push("精灵双倍祈愿金币和咕咕币奖励翻倍");
|
|
2493
|
+
}
|
|
2494
|
+
const noteText = otherRewardNotes.length > 0 ? ` (${otherRewardNotes.join(", ")})` : "";
|
|
2477
2495
|
others.forEach((record) => {
|
|
2478
2496
|
let guguCoins = 3;
|
|
2479
|
-
let gold =
|
|
2480
|
-
|
|
2497
|
+
let gold = 500;
|
|
2498
|
+
const isCleaner = cleanerHandles.has(record.handle);
|
|
2499
|
+
const hasDoubleWish = doubleWishHandles.has(record.handle);
|
|
2500
|
+
if (hasDoubleWish) {
|
|
2481
2501
|
guguCoins *= 2;
|
|
2482
2502
|
gold *= 2;
|
|
2483
2503
|
}
|
|
2484
2504
|
const baseReward = {
|
|
2485
2505
|
guguCoins,
|
|
2486
2506
|
gold,
|
|
2487
|
-
redCrystal:
|
|
2507
|
+
redCrystal: isCleaner ? 3 : 0,
|
|
2488
2508
|
playerName: record.playerName
|
|
2489
2509
|
};
|
|
2490
2510
|
rewardMap.set(record.handle, baseReward);
|
|
2491
2511
|
});
|
|
2492
|
-
rewardMessages.push(`其他参与者各获得: 3 咕咕币 +
|
|
2512
|
+
rewardMessages.push(`其他参与者各获得: 3 咕咕币 + 500 金币${noteText}`);
|
|
2493
2513
|
}
|
|
2494
2514
|
await ctx2.database.withTransaction(async () => {
|
|
2495
2515
|
for (const [handle, reward] of rewardMap) {
|
|
@@ -3797,7 +3817,7 @@ ${itemDetails.join("\n")}`;
|
|
|
3797
3817
|
].join("\n");
|
|
3798
3818
|
});
|
|
3799
3819
|
ctx.command("ggcevo/赛季结算", "进行赛季结算并发放奖励", { authority: 3 }).action(async ({ session }) => {
|
|
3800
|
-
await session.send(`确定要进行赛季结算吗?(请在30
|
|
3820
|
+
await session.send(`确定要进行赛季结算吗?(请在30秒内回复"是"确认)`);
|
|
3801
3821
|
const confirm = await session.prompt(3e4);
|
|
3802
3822
|
if (confirm !== "是") return "已取消操作。";
|
|
3803
3823
|
const currentSeason = config.rankseason;
|
|
@@ -3858,31 +3878,39 @@ ${itemDetails.join("\n")}`;
|
|
|
3858
3878
|
}
|
|
3859
3879
|
report += "🏆 精英奖励详情:\n";
|
|
3860
3880
|
report += rewardDetails.join("\n") + "\n";
|
|
3861
|
-
report += `✦ 第4-10名:60枚咕咕币 +
|
|
3881
|
+
report += `✦ 第4-10名:60枚咕咕币 + 3000枚金币 + ${requiredMedals.top10}
|
|
3862
3882
|
`;
|
|
3863
|
-
report += `✦ 第11-20名:40枚咕咕币 +
|
|
3883
|
+
report += `✦ 第11-20名:40枚咕咕币 + 2000枚金币 + ${requiredMedals.top20}
|
|
3864
3884
|
|
|
3865
3885
|
`;
|
|
3866
3886
|
const otherPlayers = await ctx.database.get("ggcevo_rank", {
|
|
3867
3887
|
Blacklist: false,
|
|
3868
3888
|
rankseason: currentSeason,
|
|
3869
|
-
handle: { $nin: rankedPlayers.map((p) => p.handle) }
|
|
3870
|
-
rank: { $ne: 0 }
|
|
3889
|
+
handle: { $nin: rankedPlayers.map((p) => p.handle) }
|
|
3871
3890
|
});
|
|
3872
3891
|
for (const player of otherPlayers) {
|
|
3873
|
-
if (player.rank > 0)
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3892
|
+
if (player.rank > 0) {
|
|
3893
|
+
positiveCount++;
|
|
3894
|
+
const gold = 1e3;
|
|
3895
|
+
const [signData] = await ctx.database.get("ggcevo_sign", { handle: player.handle });
|
|
3896
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
3897
|
+
handle: player.handle,
|
|
3898
|
+
totalRewards: (signData?.totalRewards || 0) + gold
|
|
3899
|
+
}], ["handle"]);
|
|
3900
|
+
} else if (player.rank <= 0) {
|
|
3901
|
+
negativeCount++;
|
|
3902
|
+
const gold = 500;
|
|
3903
|
+
const [signData] = await ctx.database.get("ggcevo_sign", { handle: player.handle });
|
|
3904
|
+
await ctx.database.upsert("ggcevo_sign", [{
|
|
3905
|
+
handle: player.handle,
|
|
3906
|
+
totalRewards: (signData?.totalRewards || 0) + gold
|
|
3907
|
+
}], ["handle"]);
|
|
3908
|
+
}
|
|
3881
3909
|
}
|
|
3882
3910
|
report += "🎉 参与奖励发放:\n";
|
|
3883
|
-
report += `✦ 积极玩家(分数>0):${positiveCount}人,每人获得
|
|
3911
|
+
report += `✦ 积极玩家(分数>0):${positiveCount}人,每人获得1000枚金币
|
|
3884
3912
|
`;
|
|
3885
|
-
report += `✦ 奋斗玩家(
|
|
3913
|
+
report += `✦ 奋斗玩家(分数≤0):${negativeCount}人,每人获得500枚金币
|
|
3886
3914
|
|
|
3887
3915
|
`;
|
|
3888
3916
|
report += `✅ 总计发放:
|
|
@@ -3894,15 +3922,15 @@ ${itemDetails.join("\n")}`;
|
|
|
3894
3922
|
return `${currentSeason}赛季结算数据已更新!`;
|
|
3895
3923
|
function getRewardByRank(rank) {
|
|
3896
3924
|
return [
|
|
3897
|
-
{ coins: 100, gold:
|
|
3925
|
+
{ coins: 100, gold: 5e3 },
|
|
3898
3926
|
// 第1名
|
|
3899
|
-
{ coins: 90, gold:
|
|
3927
|
+
{ coins: 90, gold: 4500 },
|
|
3900
3928
|
// 第2名
|
|
3901
|
-
{ coins: 80, gold:
|
|
3929
|
+
{ coins: 80, gold: 4e3 },
|
|
3902
3930
|
// 第3名
|
|
3903
|
-
...Array(7).fill({ coins: 60, gold:
|
|
3931
|
+
...Array(7).fill({ coins: 60, gold: 3e3 }),
|
|
3904
3932
|
//4-10
|
|
3905
|
-
...Array(10).fill({ coins: 40, gold:
|
|
3933
|
+
...Array(10).fill({ coins: 40, gold: 2e3 })
|
|
3906
3934
|
//11-20
|
|
3907
3935
|
][rank - 1] || { coins: 0, gold: 0 };
|
|
3908
3936
|
}
|