koishi-plugin-ggcevo-game 0.4.6 → 0.4.8
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 +22 -11
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -96,8 +96,13 @@ function apply(ctx, config) {
|
|
|
96
96
|
// 玩家名称
|
|
97
97
|
rank: "integer",
|
|
98
98
|
// rank分数(带正负)
|
|
99
|
-
matches: "unsigned"
|
|
99
|
+
matches: "unsigned",
|
|
100
100
|
// 比赛次数
|
|
101
|
+
Blacklist: {
|
|
102
|
+
type: "boolean",
|
|
103
|
+
// 该字段的默认值
|
|
104
|
+
initial: false
|
|
105
|
+
}
|
|
101
106
|
}, {
|
|
102
107
|
primary: ["regionId", "realmId", "profileId"]
|
|
103
108
|
// 复合主键
|
|
@@ -823,8 +828,8 @@ ID:${activity.id}
|
|
|
823
828
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
824
829
|
const offset = (pageNum - 1) * 10;
|
|
825
830
|
const [records, total] = await Promise.all([
|
|
826
|
-
ctx.database.select("ggcevo_rank").orderBy("rank", "desc").limit(10).offset(offset).execute(),
|
|
827
|
-
ctx.database.select("ggcevo_rank").execute((row) => import_koishi.$.count(row.profileId))
|
|
831
|
+
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").limit(10).offset(offset).execute(),
|
|
832
|
+
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).execute((row) => import_koishi.$.count(row.profileId))
|
|
828
833
|
]);
|
|
829
834
|
const pageSize = 10;
|
|
830
835
|
const totalPages = Math.ceil(total / pageSize);
|
|
@@ -839,11 +844,12 @@ ID:${activity.id}
|
|
|
839
844
|
(item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 参赛: ${item.matches} 次`
|
|
840
845
|
).join("\n");
|
|
841
846
|
return [
|
|
842
|
-
`🏆 GGCEvo 胜点榜
|
|
847
|
+
`🏆 GGCEvo 胜点榜 🏆`,
|
|
848
|
+
`第 ${pageNum} 页 共 ${totalPages} 页`,
|
|
843
849
|
"------------------------------",
|
|
844
850
|
rankingText,
|
|
845
851
|
"------------------------------",
|
|
846
|
-
pageNum < totalPages ?
|
|
852
|
+
pageNum < totalPages ? `输入 胜点榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
|
|
847
853
|
].join("\n");
|
|
848
854
|
});
|
|
849
855
|
ctx.command("ggcevo/排名 [player]", "查询个人排名").alias("rank").usage("输入“排名”查看自己的排名信息").action(async (argv, player) => {
|
|
@@ -860,7 +866,8 @@ ID:${activity.id}
|
|
|
860
866
|
profileId
|
|
861
867
|
});
|
|
862
868
|
if (!user) return "未找到您的排名信息。";
|
|
863
|
-
|
|
869
|
+
if (user.Blacklist) return "您已经被禁止参加胜点榜。";
|
|
870
|
+
const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
|
|
864
871
|
const userRank = allRanks.findIndex(
|
|
865
872
|
(u) => u.regionId === regionId && u.realmId === realmId && u.profileId === profileId
|
|
866
873
|
) + 1;
|
|
@@ -892,7 +899,8 @@ ID:${activity.id}
|
|
|
892
899
|
profileId
|
|
893
900
|
});
|
|
894
901
|
if (!user) return "未找到他/她的排名信息。";
|
|
895
|
-
|
|
902
|
+
if (user.Blacklist) return "他/她已经被禁止参加胜点榜。";
|
|
903
|
+
const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
|
|
896
904
|
const userRank = allRanks.findIndex(
|
|
897
905
|
(u) => u.regionId === regionId && u.realmId === realmId && u.profileId === profileId
|
|
898
906
|
) + 1;
|
|
@@ -929,8 +937,10 @@ ID:${activity.id}
|
|
|
929
937
|
return "操作失败,请稍后再试";
|
|
930
938
|
}
|
|
931
939
|
});
|
|
932
|
-
ctx.command("ggcevo/违规记录 [
|
|
940
|
+
ctx.command("ggcevo/违规记录 [user]", "违规记录查询").usage("输入 违规记录 [@用户] -p 页码 查看处罚记录,每页1条").option("p", "-p <page:number> 指定页码").action(async (argv) => {
|
|
933
941
|
const session = argv.session;
|
|
942
|
+
const pageNum = argv.options.p ? argv.options.p : 1;
|
|
943
|
+
const user = argv.args[0];
|
|
934
944
|
let handle;
|
|
935
945
|
if (!user) {
|
|
936
946
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
@@ -950,8 +960,8 @@ ID:${activity.id}
|
|
|
950
960
|
const { regionId, realmId, profileId } = profile;
|
|
951
961
|
handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
952
962
|
}
|
|
953
|
-
const pageNum = parseInt(page) || 1;
|
|
954
963
|
if (pageNum < 1) return "请输入有效的页码。";
|
|
964
|
+
const totalPages = await ctx.database.select("ggcevo_Punishment").where({ handle }).execute((row) => import_koishi.$.count(row.id));
|
|
955
965
|
const records = await ctx.database.select("ggcevo_Punishment").where({ handle }).orderBy("id", "desc").limit(1).offset(pageNum - 1).execute();
|
|
956
966
|
if (!records.length) {
|
|
957
967
|
return pageNum === 1 ? `【${handle}】暂无违规记录` : `【${handle}】第 ${pageNum} 条记录不存在`;
|
|
@@ -972,11 +982,12 @@ ID:${activity.id}
|
|
|
972
982
|
return finalText;
|
|
973
983
|
}).join("\n------------------------------\n");
|
|
974
984
|
return [
|
|
975
|
-
`🚨 违规记录
|
|
985
|
+
`🚨 违规记录 🚨`,
|
|
986
|
+
`第 ${pageNum} 条 共 ${totalPages} 条`,
|
|
976
987
|
"------------------------------",
|
|
977
988
|
recordText,
|
|
978
989
|
"------------------------------",
|
|
979
|
-
`输入 违规记录 ${pageNum + 1} 查看下一条`
|
|
990
|
+
pageNum < totalPages ? `输入 违规记录 -p ${pageNum + 1} 查看下一条` : "已是最后一页"
|
|
980
991
|
].join("\n");
|
|
981
992
|
});
|
|
982
993
|
const itemConfig = {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-ggcevo-game",
|
|
3
3
|
"description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.8",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"koishi": "^4.18.7",
|
|
19
19
|
"@koishijs/plugin-proxy-agent": "^0.3.3",
|
|
20
|
-
"koishi-plugin-sc2arcade-search": "^0.3
|
|
20
|
+
"koishi-plugin-sc2arcade-search": "^1.0.3"
|
|
21
21
|
},
|
|
22
22
|
"koishi": {
|
|
23
23
|
"service": {
|