koishi-plugin-ggcevo-game 1.0.0 → 1.0.2
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 +10 -6
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -93,6 +93,8 @@ function apply(ctx, config) {
|
|
|
93
93
|
// 玩家名称
|
|
94
94
|
rank: "integer",
|
|
95
95
|
// rank分数(带正负)
|
|
96
|
+
wins: "unsigned",
|
|
97
|
+
// 胜场
|
|
96
98
|
matches: "unsigned",
|
|
97
99
|
// 比赛次数
|
|
98
100
|
Blacklist: {
|
|
@@ -766,7 +768,8 @@ ID:${activity.id}
|
|
|
766
768
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
767
769
|
handle,
|
|
768
770
|
name: record.profile.name,
|
|
769
|
-
rank: record.decision === "win" ? (ggcrank?.rank || 0) +
|
|
771
|
+
rank: record.decision === "win" ? (ggcrank?.rank || 0) + 150 : (ggcrank?.rank || 0) - 50,
|
|
772
|
+
wins: (ggcrank?.wins || 0) + (record.decision === "win" ? 1 : 0),
|
|
770
773
|
matches: (ggcrank?.matches || 0) + 1
|
|
771
774
|
}]);
|
|
772
775
|
}
|
|
@@ -825,7 +828,8 @@ ID:${activity.id}
|
|
|
825
828
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
826
829
|
handle,
|
|
827
830
|
name: record.profile.name,
|
|
828
|
-
rank: record.decision === "win" ? (ggcrank?.rank || 0) +
|
|
831
|
+
rank: record.decision === "win" ? (ggcrank?.rank || 0) + 150 : (ggcrank?.rank || 0) - 50,
|
|
832
|
+
wins: (ggcrank?.wins || 0) + (record.decision === "win" ? 1 : 0),
|
|
829
833
|
matches: (ggcrank?.matches || 0) + 1
|
|
830
834
|
}]);
|
|
831
835
|
}
|
|
@@ -851,8 +855,7 @@ ID:${activity.id}
|
|
|
851
855
|
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").limit(10).offset(offset).execute(),
|
|
852
856
|
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).execute((row) => import_koishi.$.count(row.handle))
|
|
853
857
|
]);
|
|
854
|
-
const
|
|
855
|
-
const totalPages = Math.ceil(total / pageSize);
|
|
858
|
+
const totalPages = Math.ceil(total / 10);
|
|
856
859
|
if (pageNum > totalPages) return `最多有 ${totalPages} 页`;
|
|
857
860
|
const processedRecords = await Promise.all(
|
|
858
861
|
records.map(async (item) => ({
|
|
@@ -861,11 +864,11 @@ ID:${activity.id}
|
|
|
861
864
|
}))
|
|
862
865
|
);
|
|
863
866
|
const rankingText = processedRecords.map(
|
|
864
|
-
(item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} |
|
|
867
|
+
(item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 胜率: ${item.matches === 0 ? "0.00%" : (item.wins / item.matches * 100).toFixed(2) + "%"}`
|
|
865
868
|
).join("\n");
|
|
866
869
|
return [
|
|
867
870
|
`🏆 GGCEvo S1赛季胜点榜 🏆`,
|
|
868
|
-
|
|
871
|
+
`本赛季从4月1日至5月15日23点结算`,
|
|
869
872
|
`第 ${pageNum} 页 共 ${totalPages} 页`,
|
|
870
873
|
"------------------------------",
|
|
871
874
|
rankingText,
|
|
@@ -899,6 +902,7 @@ ID:${activity.id}
|
|
|
899
902
|
句柄:${user.handle}
|
|
900
903
|
当前积分:${user.rank}
|
|
901
904
|
参赛次数:${user.matches} 次
|
|
905
|
+
胜率: ${user.matches === 0 ? "0.00%" : (user.wins / user.matches * 100).toFixed(2) + "%"}
|
|
902
906
|
全服排名:第 ${userRank} 位
|
|
903
907
|
------------------------------`;
|
|
904
908
|
} else {
|