koishi-plugin-ggcevo-game 1.2.36 → 1.2.38
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 +33 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -2270,7 +2270,7 @@ ${achievementList.join("\n")}`;
|
|
|
2270
2270
|
`📊 胜率预测:${winRate.toFixed(1)}%`,
|
|
2271
2271
|
`🎰 金币变动:${stealPercentage}%`
|
|
2272
2272
|
];
|
|
2273
|
-
isWin ? result.push(`💰
|
|
2273
|
+
isWin ? result.push(`💰 您从对方的口袋里抢夺了${goldTransfer}枚金币`) : result.push(`💸 您从口袋里拿出了${goldTransfer}枚金币上交给对方`);
|
|
2274
2274
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
2275
2275
|
return result.join("\n");
|
|
2276
2276
|
} catch (error) {
|
|
@@ -2278,6 +2278,36 @@ ${achievementList.join("\n")}`;
|
|
|
2278
2278
|
return "对战功能暂时不可用,请稍后重试";
|
|
2279
2279
|
}
|
|
2280
2280
|
});
|
|
2281
|
+
ctx.command("ggcevo/pk榜 [page]", "查看玩家PK排行榜").usage("输入 pk榜 [页码] 查看对应页的排行榜,每页10条").action(async (_, page) => {
|
|
2282
|
+
const pageNum = parseInt(page) || 1;
|
|
2283
|
+
if (pageNum < 1) return "请输入有效的页码。";
|
|
2284
|
+
const offset = (pageNum - 1) * 10;
|
|
2285
|
+
const [records, total] = await Promise.all([
|
|
2286
|
+
// 获取当前页记录(仅显示启用PK功能的用户)
|
|
2287
|
+
ctx.database.select("ggcevo_pk").where({ enable: true }).orderBy("wins", "desc").limit(10).offset(offset).execute(),
|
|
2288
|
+
// 获取总记录数(启用PK的用户总数)
|
|
2289
|
+
ctx.database.select("ggcevo_pk").where({ enable: true }).execute((row) => import_koishi.$.count(row.handle))
|
|
2290
|
+
]);
|
|
2291
|
+
const totalPages = Math.ceil(total / 10);
|
|
2292
|
+
if (pageNum > totalPages) return `最多有 ${totalPages} 页`;
|
|
2293
|
+
if (!records.length) return "暂无PK记录";
|
|
2294
|
+
const rankingText = records.map((record, index) => {
|
|
2295
|
+
const winRate = record.total > 0 ? `${(record.wins / record.total * 100).toFixed(1)}%` : "N/A";
|
|
2296
|
+
return [
|
|
2297
|
+
`${offset + index + 1}. ${record.handle}`,
|
|
2298
|
+
`总PK: ${record.total}次`,
|
|
2299
|
+
`胜率: ${winRate}`
|
|
2300
|
+
].join(" | ");
|
|
2301
|
+
}).join("\n");
|
|
2302
|
+
return [
|
|
2303
|
+
"🏆 PK排行榜(已启用PK功能的玩家)",
|
|
2304
|
+
"────────────────",
|
|
2305
|
+
rankingText,
|
|
2306
|
+
"────────────────",
|
|
2307
|
+
`第 ${pageNum} 页 / 共 ${totalPages} 页`,
|
|
2308
|
+
pageNum < totalPages ? `输入 pk榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
|
|
2309
|
+
].join("\n");
|
|
2310
|
+
});
|
|
2281
2311
|
ctx.command("ggcevo/切换pk状态", "切换玩家对战状态").action(async ({ session }) => {
|
|
2282
2312
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2283
2313
|
if (!profile) return "您暂未绑定句柄。";
|
|
@@ -2478,7 +2508,7 @@ ${validTypes.join("、")}`;
|
|
|
2478
2508
|
});
|
|
2479
2509
|
return `已成功装备 ${weapon}!`;
|
|
2480
2510
|
});
|
|
2481
|
-
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器", "武器升级").action(async ({ session }, weapon) => {
|
|
2511
|
+
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器", "武器升级", "武器强化", "强化武器").action(async ({ session }, weapon) => {
|
|
2482
2512
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2483
2513
|
if (!profile) return "您暂未绑定句柄。";
|
|
2484
2514
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
@@ -2524,7 +2554,7 @@ ${validTypes.join("、")}`;
|
|
|
2524
2554
|
}
|
|
2525
2555
|
});
|
|
2526
2556
|
const newLevel = equipment.level + 1;
|
|
2527
|
-
const baseDamage = weaponConfig[weapon].damage * (1 + 0.1 * newLevel);
|
|
2557
|
+
const baseDamage = (weaponConfig[weapon].damage * (1 + 0.1 * newLevel)).toFixed(1);
|
|
2528
2558
|
const slots = Math.floor(newLevel / 3) + 1;
|
|
2529
2559
|
let message = `${weapon} 升级成功!花费${actualCost}枚金币${discountMessage}。`;
|
|
2530
2560
|
if (activeWish) {
|