koishi-plugin-ggcevo-game 0.4.10 → 0.4.12

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
@@ -25,6 +25,7 @@ declare module 'koishi' {
25
25
  ggcevo_exchange: exchange;
26
26
  ggcevo_adminbenefit: adminbenefit;
27
27
  ggcevo_blacklist: blacklist;
28
+ ggcevo_achievements: Achievement;
28
29
  }
29
30
  }
30
31
  export interface backpack {
@@ -98,4 +99,9 @@ export interface blacklist {
98
99
  handle: string;
99
100
  createdAt: Date;
100
101
  }
102
+ export interface Achievement {
103
+ handle: string;
104
+ achievementname: string;
105
+ gaintime: Date;
106
+ }
101
107
  export declare function apply(ctx: Context, config: Config): void;
package/lib/index.js CHANGED
@@ -158,6 +158,13 @@ function apply(ctx, config) {
158
158
  }, {
159
159
  primary: "handle"
160
160
  });
161
+ ctx.model.extend("ggcevo_achievements", {
162
+ handle: "string",
163
+ achievementname: "string",
164
+ gaintime: "timestamp"
165
+ }, {
166
+ primary: ["handle", "achievementname"]
167
+ });
161
168
  const initDefaultItems = {
162
169
  "咕咕币": { id: 1, type: "抽奖道具", description: "用于进行抽奖" },
163
170
  "兑换券": { id: 2, type: "兑换货币", description: "用于兑换赞助物品" },
@@ -668,10 +675,7 @@ ID:${activity.id}
668
675
  timeZone: "Asia/Shanghai",
669
676
  year: "numeric",
670
677
  month: "2-digit",
671
- day: "2-digit",
672
- hour: "2-digit",
673
- minute: "2-digit",
674
- hour12: false
678
+ day: "2-digit"
675
679
  }), "formatTime");
676
680
  const output = activities.map((activity) => [
677
681
  `活动: ${activity.name}`,
@@ -1112,11 +1116,7 @@ ${items.join("、")}
1112
1116
  timeZone: "Asia/Shanghai",
1113
1117
  year: "numeric",
1114
1118
  month: "2-digit",
1115
- day: "2-digit",
1116
- hour: "2-digit",
1117
- minute: "2-digit",
1118
- second: "2-digit",
1119
- hour12: false
1119
+ day: "2-digit"
1120
1120
  });
1121
1121
  return `${e.type}: ${e.item} | 时间: ${cnTime}`;
1122
1122
  }).join("\n");
@@ -1243,6 +1243,30 @@ ${output}`;
1243
1243
  return "操作失败,请稍后重试。错误详情已记录";
1244
1244
  }
1245
1245
  });
1246
+ ctx.command("成就").action(async ({ session }) => {
1247
+ const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
1248
+ if (!profile) {
1249
+ return "您的 QQ 未绑定句柄。";
1250
+ }
1251
+ const { regionId, realmId, profileId } = profile;
1252
+ const achievements = await ctx.database.get("ggcevo_achievements", {
1253
+ handle: `${regionId}-S2-${realmId}-${profileId}`
1254
+ });
1255
+ if (!achievements.length) {
1256
+ return "你还没有获得任何成就哦~";
1257
+ }
1258
+ const achievementList = achievements.map((achievement) => {
1259
+ const date = new Date(achievement.gaintime);
1260
+ return `${achievement.achievementname} (获得于 ${date.toLocaleDateString("zh-CN", {
1261
+ timeZone: "Asia/Shanghai",
1262
+ year: "numeric",
1263
+ month: "2-digit",
1264
+ day: "2-digit"
1265
+ })})`;
1266
+ });
1267
+ return `${regionId}-S2-${realmId}-${profileId} 已获得的成就:
1268
+ ${achievementList.join("\n")}`;
1269
+ });
1246
1270
  }
1247
1271
  __name(apply, "apply");
1248
1272
  function simpleDraw() {
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.10",
4
+ "version": "0.4.12",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [