koishi-plugin-ggcevo-game 1.2.40 → 1.2.41

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
@@ -121,6 +121,7 @@ export interface Achievement {
121
121
  }
122
122
  export interface PKRecord {
123
123
  handle: string;
124
+ name: string;
124
125
  total: number;
125
126
  wins: number;
126
127
  todayCount: number;
package/lib/index.js CHANGED
@@ -194,6 +194,7 @@ function apply(ctx, config) {
194
194
  });
195
195
  ctx.model.extend("ggcevo_pk", {
196
196
  handle: "string",
197
+ name: "string",
197
198
  total: "unsigned",
198
199
  wins: "unsigned",
199
200
  todayCount: "unsigned",
@@ -2326,9 +2327,18 @@ ${achievementList.join("\n")}`;
2326
2327
  if (!targetprofile) return "对方尚未绑定句柄。";
2327
2328
  const initiatorHandle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2328
2329
  const targetHandle = `${targetprofile.regionId}-S2-${targetprofile.realmId}-${targetprofile.profileId}`;
2329
- if (initiatorHandle === targetHandle) return "不能挑战自己。";
2330
+ if (initiatorHandle === targetHandle) return "抱歉,您不能挑战自己。";
2331
+ const [initiatorData, targetData] = await Promise.all([
2332
+ ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
2333
+ ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
2334
+ ]);
2335
+ const initiatorRank = initiatorData[0]?.rank || 0;
2336
+ const targetRank = targetData[0]?.rank || 0;
2337
+ const initiatorRankname = initiatorData[0]?.name || session.username;
2338
+ const targetRankname = targetData[0]?.name || (targetUsername.name || targetUsername.user.name);
2330
2339
  let initiatorPK = {
2331
2340
  handle: initiatorHandle,
2341
+ name: initiatorRankname,
2332
2342
  total: 0,
2333
2343
  wins: 0,
2334
2344
  todayCount: 0,
@@ -2341,6 +2351,7 @@ ${achievementList.join("\n")}`;
2341
2351
  };
2342
2352
  let targetPK = {
2343
2353
  handle: targetHandle,
2354
+ name: targetRankname,
2344
2355
  total: 0,
2345
2356
  wins: 0,
2346
2357
  todayCount: 0,
@@ -2392,14 +2403,6 @@ ${achievementList.join("\n")}`;
2392
2403
  return `该玩家今日已被挑战太多次(最多${config.maxDailyBeChallenged}次)。`;
2393
2404
  }
2394
2405
  }
2395
- const [initiatorData, targetData] = await Promise.all([
2396
- ctx.database.get("ggcevo_rank", { handle: initiatorHandle, rankseason: config.rankseason }),
2397
- ctx.database.get("ggcevo_rank", { handle: targetHandle, rankseason: config.rankseason })
2398
- ]);
2399
- const initiatorRank = initiatorData[0]?.rank || 0;
2400
- const targetRank = targetData[0]?.rank || 0;
2401
- const initiatorRankname = initiatorData[0]?.name || session.username;
2402
- const targetRankname = targetData[0]?.name || (targetUsername.name || targetUsername.user.name);
2403
2406
  const [initiatorSign, targetSign] = await Promise.all([
2404
2407
  ctx.database.get("ggcevo_sign", initiatorHandle),
2405
2408
  ctx.database.get("ggcevo_sign", targetHandle)
@@ -2424,6 +2427,7 @@ ${achievementList.join("\n")}`;
2424
2427
  // 发起者记录
2425
2428
  {
2426
2429
  handle: initiatorHandle,
2430
+ name: initiatorRankname,
2427
2431
  total: initiatorPK.total + 1,
2428
2432
  wins: isWin ? initiatorPK.wins + 1 : initiatorPK.wins,
2429
2433
  todayCount: initiatorPK.todayCount + 1,
@@ -2436,6 +2440,7 @@ ${achievementList.join("\n")}`;
2436
2440
  // 应战者记录(新增部分)
2437
2441
  {
2438
2442
  handle: targetHandle,
2443
+ name: targetRankname,
2439
2444
  total: targetPK.total + 1,
2440
2445
  wins: !isWin ? targetPK.wins + 1 : targetPK.wins,
2441
2446
  // 应战者胜利时增加
@@ -2492,8 +2497,9 @@ ${achievementList.join("\n")}`;
2492
2497
  if (!records.length) return "暂无PK记录";
2493
2498
  const rankingText = records.map((record, index) => {
2494
2499
  const winRate = record.total > 0 ? `${(record.wins / record.total * 100).toFixed(1)}%` : "N/A";
2500
+ const rankname = record.name || record.handle;
2495
2501
  return [
2496
- `${offset + index + 1}. ${record.handle}`,
2502
+ `${offset + index + 1}. ${rankname}`,
2497
2503
  `总PK: ${record.total}次`,
2498
2504
  `胜率: ${winRate}`
2499
2505
  ].join(" | ");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "《星际争霸2》咕咕虫-evolved地图的专属游戏助手插件,集成天梯排行、抽奖系统、签到福利、兑换商城等丰富功能。",
4
- "version": "1.2.40",
4
+ "version": "1.2.41",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [