koishi-plugin-ggcevo-game 0.4.9 → 0.4.11
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 +6 -0
- package/lib/index.js +35 -10
- package/package.json +1 -1
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}`,
|
|
@@ -845,7 +849,8 @@ ID:${activity.id}
|
|
|
845
849
|
(item, index) => `${offset + index + 1}. ${item.displayName} | 积分: ${item.rank} | 参赛: ${item.matches} 次`
|
|
846
850
|
).join("\n");
|
|
847
851
|
return [
|
|
848
|
-
`🏆 GGCEvo
|
|
852
|
+
`🏆 GGCEvo S1赛季胜点榜 🏆`,
|
|
853
|
+
`本赛季至3月31日23点结算`,
|
|
849
854
|
`第 ${pageNum} 页 共 ${totalPages} 页`,
|
|
850
855
|
"------------------------------",
|
|
851
856
|
rankingText,
|
|
@@ -1111,11 +1116,7 @@ ${items.join("、")}
|
|
|
1111
1116
|
timeZone: "Asia/Shanghai",
|
|
1112
1117
|
year: "numeric",
|
|
1113
1118
|
month: "2-digit",
|
|
1114
|
-
day: "2-digit"
|
|
1115
|
-
hour: "2-digit",
|
|
1116
|
-
minute: "2-digit",
|
|
1117
|
-
second: "2-digit",
|
|
1118
|
-
hour12: false
|
|
1119
|
+
day: "2-digit"
|
|
1119
1120
|
});
|
|
1120
1121
|
return `${e.type}: ${e.item} | 时间: ${cnTime}`;
|
|
1121
1122
|
}).join("\n");
|
|
@@ -1242,6 +1243,30 @@ ${output}`;
|
|
|
1242
1243
|
return "操作失败,请稍后重试。错误详情已记录";
|
|
1243
1244
|
}
|
|
1244
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 `你已获得的成就:
|
|
1268
|
+
${achievementList.join("\n")}`;
|
|
1269
|
+
});
|
|
1245
1270
|
}
|
|
1246
1271
|
__name(apply, "apply");
|
|
1247
1272
|
function simpleDraw() {
|