koishi-plugin-ggcevo-game 1.0.1 → 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 CHANGED
@@ -65,6 +65,7 @@ export interface rank {
65
65
  handle: string;
66
66
  name: string;
67
67
  rank: number;
68
+ wins: number;
68
69
  matches: number;
69
70
  Blacklist: boolean;
70
71
  }
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: {
@@ -767,6 +769,7 @@ ID:${activity.id}
767
769
  handle,
768
770
  name: record.profile.name,
769
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
  }
@@ -826,6 +829,7 @@ ID:${activity.id}
826
829
  handle,
827
830
  name: record.profile.name,
828
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 pageSize = 10;
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} | 参赛: ${item.matches} 次`
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
- `本赛季至5月15日23点结算`,
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 {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [