koishi-plugin-ggcevo-game 1.2.35 → 1.2.37
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 +40 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1094,7 +1094,7 @@ ${itemDetails.join("\n")}`;
|
|
|
1094
1094
|
`您的句柄:${handle}`,
|
|
1095
1095
|
`📅 最后签到时间:${chinaTime}`,
|
|
1096
1096
|
`🔥 累计签到:${record.monthlyDays}天`,
|
|
1097
|
-
`💰
|
|
1097
|
+
`💰 拥有金币:${record.totalRewards}枚金币`
|
|
1098
1098
|
].join("\n");
|
|
1099
1099
|
});
|
|
1100
1100
|
ctx.guild().command("ggcevo/每月津贴").action(async (argv) => {
|
|
@@ -1938,13 +1938,14 @@ ${output}`;
|
|
|
1938
1938
|
if (!handleRegex.test(handle)) {
|
|
1939
1939
|
return "句柄格式错误,请重新输入。";
|
|
1940
1940
|
}
|
|
1941
|
-
const existingEntries = await ctx.database.get("ggcevo_rank", { handle, Blacklist: true });
|
|
1941
|
+
const existingEntries = await ctx.database.get("ggcevo_rank", { handle, Blacklist: true, rankseason: config.rankseason });
|
|
1942
1942
|
if (existingEntries.length > 0) {
|
|
1943
1943
|
return `${handle}已被标记在咕咕胜点榜黑名单中。`;
|
|
1944
1944
|
}
|
|
1945
1945
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
1946
1946
|
handle,
|
|
1947
|
-
Blacklist: true
|
|
1947
|
+
Blacklist: true,
|
|
1948
|
+
rankseason: config.rankseason
|
|
1948
1949
|
}]);
|
|
1949
1950
|
return `✅ 用户${handle}已被标记在咕咕胜点榜黑名单。`;
|
|
1950
1951
|
} catch (error) {
|
|
@@ -2000,7 +2001,7 @@ ${achievementList.join("\n")}`;
|
|
|
2000
2001
|
"📅 签到记录:",
|
|
2001
2002
|
`最后签到:${chinaTime}`,
|
|
2002
2003
|
`本月累计:${sign.monthlyDays} 天`,
|
|
2003
|
-
|
|
2004
|
+
`拥有金币:${sign.totalRewards} 枚`,
|
|
2004
2005
|
"──────────────"
|
|
2005
2006
|
);
|
|
2006
2007
|
}
|
|
@@ -2193,8 +2194,8 @@ ${achievementList.join("\n")}`;
|
|
|
2193
2194
|
}
|
|
2194
2195
|
}
|
|
2195
2196
|
const [initiatorData, targetData] = await Promise.all([
|
|
2196
|
-
ctx.database.get("ggcevo_rank", initiatorHandle),
|
|
2197
|
-
ctx.database.get("ggcevo_rank", targetHandle)
|
|
2197
|
+
ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
|
|
2198
|
+
ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
|
|
2198
2199
|
]);
|
|
2199
2200
|
const initiatorRank = initiatorData[0]?.rank || 0;
|
|
2200
2201
|
const targetRank = targetData[0]?.rank || 0;
|
|
@@ -2277,6 +2278,36 @@ ${achievementList.join("\n")}`;
|
|
|
2277
2278
|
return "对战功能暂时不可用,请稍后重试";
|
|
2278
2279
|
}
|
|
2279
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
|
+
});
|
|
2280
2311
|
ctx.command("ggcevo/切换pk状态", "切换玩家对战状态").action(async ({ session }) => {
|
|
2281
2312
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2282
2313
|
if (!profile) return "您暂未绑定句柄。";
|
|
@@ -2451,7 +2482,7 @@ ${validTypes.join("、")}`;
|
|
|
2451
2482
|
ctx.command("ggcevo/装备 <weapon>").action(async ({ session }, weapon) => {
|
|
2452
2483
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2453
2484
|
if (!profile) return "未绑定句柄";
|
|
2454
|
-
if (!weaponConfig[weapon]) return "
|
|
2485
|
+
if (!weaponConfig[weapon]) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
|
|
2455
2486
|
const config2 = weaponConfig[weapon];
|
|
2456
2487
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2457
2488
|
const [owned] = await ctx.database.get("ggcevo_equipment", {
|
|
@@ -2477,7 +2508,7 @@ ${validTypes.join("、")}`;
|
|
|
2477
2508
|
});
|
|
2478
2509
|
return `已成功装备 ${weapon}!`;
|
|
2479
2510
|
});
|
|
2480
|
-
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器", "武器升级").action(async ({ session }, weapon) => {
|
|
2511
|
+
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器", "武器升级", "武器强化", "强化武器").action(async ({ session }, weapon) => {
|
|
2481
2512
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2482
2513
|
if (!profile) return "您暂未绑定句柄。";
|
|
2483
2514
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
@@ -2523,7 +2554,7 @@ ${validTypes.join("、")}`;
|
|
|
2523
2554
|
}
|
|
2524
2555
|
});
|
|
2525
2556
|
const newLevel = equipment.level + 1;
|
|
2526
|
-
const baseDamage = weaponConfig[weapon].damage * (1 + 0.1 * newLevel);
|
|
2557
|
+
const baseDamage = (weaponConfig[weapon].damage * (1 + 0.1 * newLevel)).toFixed(1);
|
|
2527
2558
|
const slots = Math.floor(newLevel / 3) + 1;
|
|
2528
2559
|
let message = `${weapon} 升级成功!花费${actualCost}枚金币${discountMessage}。`;
|
|
2529
2560
|
if (activeWish) {
|