koishi-plugin-ggcevo-game 1.2.30 → 1.2.31
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 +32 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1452,7 +1452,14 @@ ${itemDetails.join("\n")}`;
|
|
|
1452
1452
|
sort: { rank: "desc" },
|
|
1453
1453
|
limit: 20
|
|
1454
1454
|
});
|
|
1455
|
+
let report = `=== ${currentSeason}赛季结算报告 ===
|
|
1456
|
+
|
|
1457
|
+
`;
|
|
1458
|
+
const rewardDetails = [];
|
|
1459
|
+
let positiveCount = 0;
|
|
1460
|
+
let negativeCount = 0;
|
|
1455
1461
|
for (const [index, player] of rankedPlayers.entries()) {
|
|
1462
|
+
const rank = index + 1;
|
|
1456
1463
|
const { coins, gold } = getRewardByRank(index + 1);
|
|
1457
1464
|
const [backpack] = await ctx.database.get("ggcevo_backpack", {
|
|
1458
1465
|
handle: player.handle,
|
|
@@ -1471,6 +1478,9 @@ ${itemDetails.join("\n")}`;
|
|
|
1471
1478
|
const medalType = getMedalType(index + 1);
|
|
1472
1479
|
const medalName = requiredMedals[medalType];
|
|
1473
1480
|
const medalId = initDefaultItems[medalName].id;
|
|
1481
|
+
if (rank <= 3) {
|
|
1482
|
+
rewardDetails.push(`✦ 第${rank}名:${coins}枚咕咕币 + ${gold}枚金币 + ${requiredMedals[medalType]}`);
|
|
1483
|
+
}
|
|
1474
1484
|
const [medalData] = await ctx.database.get("ggcevo_backpack", {
|
|
1475
1485
|
handle: player.handle,
|
|
1476
1486
|
itemId: medalId
|
|
@@ -1481,6 +1491,13 @@ ${itemDetails.join("\n")}`;
|
|
|
1481
1491
|
quantity: (medalData?.quantity || 0) + 1
|
|
1482
1492
|
}], ["handle", "itemId"]);
|
|
1483
1493
|
}
|
|
1494
|
+
report += "🏆 精英奖励详情:\n";
|
|
1495
|
+
report += rewardDetails.join("\n") + "\n";
|
|
1496
|
+
report += `✦ 第4-10名:60枚咕咕币 + 750枚金币 + ${requiredMedals.top10}
|
|
1497
|
+
`;
|
|
1498
|
+
report += `✦ 第11-20名:40枚咕咕币 + 500枚金币 + ${requiredMedals.top20}
|
|
1499
|
+
|
|
1500
|
+
`;
|
|
1484
1501
|
const otherPlayers = await ctx.database.get("ggcevo_rank", {
|
|
1485
1502
|
Blacklist: false,
|
|
1486
1503
|
rankseason: currentSeason,
|
|
@@ -1488,6 +1505,8 @@ ${itemDetails.join("\n")}`;
|
|
|
1488
1505
|
rank: { $ne: 0 }
|
|
1489
1506
|
});
|
|
1490
1507
|
for (const player of otherPlayers) {
|
|
1508
|
+
if (player.rank > 0) positiveCount++;
|
|
1509
|
+
if (player.rank < 0) negativeCount++;
|
|
1491
1510
|
const gold = player.rank > 0 ? 250 : 100;
|
|
1492
1511
|
const [signData] = await ctx.database.get("ggcevo_sign", { handle: player.handle });
|
|
1493
1512
|
await ctx.database.upsert("ggcevo_sign", [{
|
|
@@ -1495,7 +1514,19 @@ ${itemDetails.join("\n")}`;
|
|
|
1495
1514
|
totalRewards: (signData?.totalRewards || 0) + gold
|
|
1496
1515
|
}], ["handle"]);
|
|
1497
1516
|
}
|
|
1498
|
-
|
|
1517
|
+
report += "🎉 参与奖励发放:\n";
|
|
1518
|
+
report += `✦ 积极玩家(分数>0):${positiveCount}人,每人获得250枚金币
|
|
1519
|
+
`;
|
|
1520
|
+
report += `✦ 奋斗玩家(分数<0):${negativeCount}人,每人获得100枚金币
|
|
1521
|
+
|
|
1522
|
+
`;
|
|
1523
|
+
report += `✅ 总计发放:
|
|
1524
|
+
`;
|
|
1525
|
+
report += `- 赛季奖励:${rankedPlayers.length}人
|
|
1526
|
+
`;
|
|
1527
|
+
report += `- 参与奖励:${otherPlayers.length}人`;
|
|
1528
|
+
await session.send(report);
|
|
1529
|
+
return `${currentSeason}赛季结算数据已更新!`;
|
|
1499
1530
|
function getRewardByRank(rank) {
|
|
1500
1531
|
return [
|
|
1501
1532
|
{ coins: 100, gold: 2e3 },
|