koishi-plugin-ggcevo-game 0.4.12 → 1.0.1
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 +2 -4
- package/lib/index.js +181 -122
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface backpack {
|
|
|
36
36
|
export interface sign {
|
|
37
37
|
handle: string;
|
|
38
38
|
lastSign: Date;
|
|
39
|
-
|
|
39
|
+
monthlyDays: number;
|
|
40
40
|
totalRewards: number;
|
|
41
41
|
}
|
|
42
42
|
export interface record {
|
|
@@ -62,9 +62,7 @@ export interface Activity {
|
|
|
62
62
|
status: '未开始' | '进行中' | '已结束';
|
|
63
63
|
}
|
|
64
64
|
export interface rank {
|
|
65
|
-
|
|
66
|
-
realmId: number;
|
|
67
|
-
profileId: number;
|
|
65
|
+
handle: string;
|
|
68
66
|
name: string;
|
|
69
67
|
rank: number;
|
|
70
68
|
matches: number;
|
package/lib/index.js
CHANGED
|
@@ -51,7 +51,8 @@ function apply(ctx, config) {
|
|
|
51
51
|
ctx.model.extend("ggcevo_sign", {
|
|
52
52
|
handle: "string",
|
|
53
53
|
lastSign: "timestamp",
|
|
54
|
-
|
|
54
|
+
monthlyDays: "unsigned",
|
|
55
|
+
// 当月累计签到天数
|
|
55
56
|
totalRewards: "unsigned"
|
|
56
57
|
}, {
|
|
57
58
|
primary: "handle"
|
|
@@ -87,12 +88,7 @@ function apply(ctx, config) {
|
|
|
87
88
|
autoInc: true
|
|
88
89
|
});
|
|
89
90
|
ctx.model.extend("ggcevo_rank", {
|
|
90
|
-
|
|
91
|
-
// 地区ID
|
|
92
|
-
realmId: "unsigned",
|
|
93
|
-
// 领域ID
|
|
94
|
-
profileId: "unsigned",
|
|
95
|
-
// 玩家唯一ID
|
|
91
|
+
handle: "string",
|
|
96
92
|
name: "string",
|
|
97
93
|
// 玩家名称
|
|
98
94
|
rank: "integer",
|
|
@@ -105,8 +101,7 @@ function apply(ctx, config) {
|
|
|
105
101
|
initial: false
|
|
106
102
|
}
|
|
107
103
|
}, {
|
|
108
|
-
primary:
|
|
109
|
-
// 复合主键
|
|
104
|
+
primary: "handle"
|
|
110
105
|
});
|
|
111
106
|
ctx.model.extend("ggcevo_Punishment", {
|
|
112
107
|
id: "unsigned",
|
|
@@ -172,7 +167,12 @@ function apply(ctx, config) {
|
|
|
172
167
|
"t3级宠物扭蛋": { id: 4, type: "宠物蛋", description: "用于兑换t3系列宠物" },
|
|
173
168
|
"t2级宠物扭蛋": { id: 5, type: "宠物蛋", description: "用于兑换t2系列宠物" },
|
|
174
169
|
"t1级宠物扭蛋": { id: 6, type: "宠物蛋", description: "用于兑换t1系列宠物" },
|
|
175
|
-
"t0级宠物扭蛋": { id: 7, type: "宠物蛋", description: "用于兑换t0系列宠物" }
|
|
170
|
+
"t0级宠物扭蛋": { id: 7, type: "宠物蛋", description: "用于兑换t0系列宠物" },
|
|
171
|
+
"🥇先行者赛季冠军勋章": { id: 101, type: "勋章", description: "先行者赛季胜点榜第一名奖励" },
|
|
172
|
+
"🥈先行者赛季亚军勋章": { id: 102, type: "勋章", description: "先行者赛季胜点榜第二名奖励" },
|
|
173
|
+
"🥉先行者赛季季军勋章": { id: 103, type: "勋章", description: "先行者赛季胜点榜第三名奖励" },
|
|
174
|
+
"🏅先行者赛季前十勋章": { id: 104, type: "勋章", description: "先行者赛季胜点榜第四名到第十名奖励" },
|
|
175
|
+
"🎖先行者赛季前二十勋章": { id: 105, type: "勋章", description: "先行者赛季胜点榜第十一名到第二十名奖励" }
|
|
176
176
|
};
|
|
177
177
|
async function gachaWithPity(handle) {
|
|
178
178
|
const [record] = await ctx.database.get("ggcevo_records", { handle });
|
|
@@ -369,10 +369,11 @@ function apply(ctx, config) {
|
|
|
369
369
|
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
370
370
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
371
371
|
const items = await ctx.database.get("ggcevo_backpack", { handle });
|
|
372
|
-
|
|
373
|
-
|
|
372
|
+
const validItems = items.filter((item) => item.quantity > 0);
|
|
373
|
+
if (!validItems.length) return "你的背包空空如也~";
|
|
374
|
+
const itemDetails = validItems.map((userItem) => {
|
|
374
375
|
const entry = Object.entries(initDefaultItems).find(
|
|
375
|
-
([
|
|
376
|
+
([, item]) => item.id === userItem.itemId
|
|
376
377
|
);
|
|
377
378
|
if (!entry) return `未知物品 × ${userItem.quantity}:数据异常,请联系管理员`;
|
|
378
379
|
const [itemName, itemData] = entry;
|
|
@@ -386,15 +387,13 @@ ${itemDetails.join("\n")}`;
|
|
|
386
387
|
const session = argv.session;
|
|
387
388
|
let latestTime;
|
|
388
389
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
389
|
-
if (!profile)
|
|
390
|
-
return "您的 QQ 未绑定句柄。";
|
|
391
|
-
}
|
|
390
|
+
if (!profile) return "您的 QQ 未绑定句柄。";
|
|
392
391
|
const { regionId, realmId, profileId } = profile;
|
|
393
392
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
394
393
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
395
|
-
if (existingEntries.length > 0)
|
|
396
|
-
|
|
397
|
-
|
|
394
|
+
if (existingEntries.length > 0) return "❌拒绝访问,您已被列入活动黑名单。";
|
|
395
|
+
const now = /* @__PURE__ */ new Date();
|
|
396
|
+
const currentChinaTime = convertUTCtoChinaTime(now);
|
|
398
397
|
if (config.signrequire) {
|
|
399
398
|
const getconfig = {
|
|
400
399
|
url: `https://api.sc2arcade.com/profiles/${regionId}/${realmId}/${profileId}/matches?orderDirection=desc`,
|
|
@@ -408,45 +407,50 @@ ${itemDetails.join("\n")}`;
|
|
|
408
407
|
}
|
|
409
408
|
latestTime = convertUTCtoChinaTime(getLatestGGCGameTime(response));
|
|
410
409
|
} else {
|
|
411
|
-
latestTime =
|
|
410
|
+
latestTime = currentChinaTime;
|
|
412
411
|
}
|
|
413
|
-
if (!latestTime)
|
|
414
|
-
|
|
412
|
+
if (!latestTime) return "您还没有游玩过 咕咕虫-evolved 地图";
|
|
413
|
+
const targetDateChina = new Date(latestTime);
|
|
414
|
+
targetDateChina.setDate(targetDateChina.getDate() + 1);
|
|
415
|
+
if (!isSameDate(latestTime, currentChinaTime) && !isSameDate(targetDateChina, currentChinaTime)) {
|
|
416
|
+
return "暂未查询到您最近两天内游玩过 咕咕虫-evolved 地图,请游玩1次后签到(对局记录上传有延迟)";
|
|
415
417
|
}
|
|
416
|
-
const now = /* @__PURE__ */ new Date();
|
|
417
|
-
const chinatime = convertUTCtoChinaTime(now);
|
|
418
418
|
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
419
419
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
420
420
|
if (record) {
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
423
|
-
return
|
|
421
|
+
const lastSignChina = convertUTCtoChinaTime(record.lastSign);
|
|
422
|
+
if (lastSignChina.getDate() === currentChinaTime.getDate()) {
|
|
423
|
+
return `您今天已经签到过了!本月累计签到 ${record.monthlyDays} 天`;
|
|
424
424
|
}
|
|
425
425
|
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
let monthlyDays = 1;
|
|
427
|
+
if (record) {
|
|
428
|
+
const lastSignChina = convertUTCtoChinaTime(record.lastSign);
|
|
429
|
+
if (currentChinaTime.getFullYear() !== lastSignChina.getFullYear() || currentChinaTime.getMonth() !== lastSignChina.getMonth()) {
|
|
430
|
+
monthlyDays = 1;
|
|
431
|
+
} else {
|
|
432
|
+
monthlyDays = record.monthlyDays + 1;
|
|
433
|
+
}
|
|
430
434
|
}
|
|
431
|
-
const consecutiveDays = record ? checkConsecutive(convertUTCtoChinaTime(record.lastSign), chinatime) ? record.consecutiveDays + 1 : 1 : 1;
|
|
432
|
-
const cycle = Math.floor((consecutiveDays - 1) / 30);
|
|
433
|
-
const currentCycleDay = consecutiveDays - cycle * 30;
|
|
434
|
-
let points = 10;
|
|
435
435
|
let tickets = 3;
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
tickets =
|
|
439
|
-
|
|
440
|
-
|
|
436
|
+
let points = 10;
|
|
437
|
+
if (monthlyDays === 7) {
|
|
438
|
+
tickets = 4;
|
|
439
|
+
points = 15;
|
|
440
|
+
} else if (monthlyDays === 14) {
|
|
441
|
+
tickets = 5;
|
|
442
|
+
points = 20;
|
|
443
|
+
} else if (monthlyDays === 21) {
|
|
441
444
|
tickets = 6;
|
|
442
|
-
|
|
443
|
-
|
|
445
|
+
points = 25;
|
|
446
|
+
} else if (monthlyDays === 28) {
|
|
444
447
|
tickets = 7;
|
|
448
|
+
points = 30;
|
|
445
449
|
}
|
|
446
450
|
await ctx.database.upsert("ggcevo_sign", [{
|
|
447
451
|
handle,
|
|
448
452
|
lastSign: now,
|
|
449
|
-
|
|
453
|
+
monthlyDays,
|
|
450
454
|
totalRewards: (record?.totalRewards || 0) + points
|
|
451
455
|
}]);
|
|
452
456
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
@@ -454,9 +458,9 @@ ${itemDetails.join("\n")}`;
|
|
|
454
458
|
itemId: 1,
|
|
455
459
|
quantity: (backpack?.quantity || 0) + tickets
|
|
456
460
|
}]);
|
|
457
|
-
return
|
|
461
|
+
return `签到成功!本月累计签到 ${monthlyDays} 天,获得 ${points} 金币和 ${tickets} 枚咕咕币`;
|
|
458
462
|
} catch (error) {
|
|
459
|
-
console.error("
|
|
463
|
+
console.error("签到命令时发生错误:", error);
|
|
460
464
|
return "服务器繁忙,请稍后尝试。";
|
|
461
465
|
}
|
|
462
466
|
});
|
|
@@ -468,48 +472,58 @@ ${itemDetails.join("\n")}`;
|
|
|
468
472
|
const { regionId, realmId, profileId } = profile;
|
|
469
473
|
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
470
474
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
471
|
-
if (existingEntries.length > 0)
|
|
472
|
-
return `❌拒绝访问,您已被列入活动黑名单。`;
|
|
473
|
-
}
|
|
475
|
+
if (existingEntries.length > 0) return "❌拒绝访问,您已被列入活动黑名单。";
|
|
474
476
|
const [record] = await ctx.database.get("ggcevo_sign", { handle });
|
|
475
477
|
if (!record) return "请先完成一次正常签到后再进行补签。";
|
|
476
|
-
const lastSignChina = convertUTCtoChinaTime(
|
|
478
|
+
const lastSignChina = convertUTCtoChinaTime(record.lastSign);
|
|
477
479
|
const targetDateChina = new Date(lastSignChina);
|
|
478
|
-
targetDateChina.setDate(targetDateChina.getDate() + 1);
|
|
479
|
-
const targetDateUTC = new Date(targetDateChina.getTime() - 8 * 60 * 60 * 1e3);
|
|
480
480
|
const nowChina = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
if (targetDateChina
|
|
481
|
+
const currentYear = nowChina.getFullYear();
|
|
482
|
+
const currentMonth = nowChina.getMonth();
|
|
483
|
+
const yesterday = new Date(targetDateChina).getDate() - 1;
|
|
484
|
+
if (targetDateChina.getFullYear() !== currentYear || targetDateChina.getMonth() !== currentMonth || // 必须当月
|
|
485
|
+
record.monthlyDays > yesterday) {
|
|
485
486
|
return "暂时没有可补签的日期。";
|
|
486
487
|
}
|
|
487
488
|
const costPoints = 50;
|
|
488
|
-
if (record.totalRewards < costPoints)
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
let
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
489
|
+
if (record.totalRewards < costPoints) {
|
|
490
|
+
return `补签需要消耗 ${costPoints} 金币,当前金币不足。`;
|
|
491
|
+
}
|
|
492
|
+
const newMonthlyDays = record.monthlyDays + 1;
|
|
493
|
+
let tickets = 3, points = 10;
|
|
494
|
+
switch (newMonthlyDays) {
|
|
495
|
+
case 7:
|
|
496
|
+
tickets = 4;
|
|
497
|
+
points = 15;
|
|
498
|
+
break;
|
|
499
|
+
case 14:
|
|
500
|
+
tickets = 5;
|
|
501
|
+
points = 20;
|
|
502
|
+
break;
|
|
503
|
+
case 21:
|
|
504
|
+
tickets = 6;
|
|
505
|
+
points = 25;
|
|
506
|
+
break;
|
|
507
|
+
case 28:
|
|
508
|
+
tickets = 7;
|
|
509
|
+
points = 30;
|
|
510
|
+
break;
|
|
502
511
|
}
|
|
503
512
|
await ctx.database.set("ggcevo_sign", { handle }, {
|
|
504
|
-
|
|
505
|
-
consecutiveDays: newConsecutiveDays,
|
|
513
|
+
monthlyDays: newMonthlyDays,
|
|
506
514
|
totalRewards: record.totalRewards - costPoints + points
|
|
507
515
|
});
|
|
508
516
|
const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
|
|
509
517
|
await ctx.database.set("ggcevo_backpack", { handle, itemId: 1 }, {
|
|
510
518
|
quantity: (backpack?.quantity || 0) + tickets
|
|
511
519
|
});
|
|
512
|
-
|
|
520
|
+
const formattedDate = targetDateChina.toLocaleString("zh-CN", {
|
|
521
|
+
timeZone: "Asia/Shanghai",
|
|
522
|
+
year: "numeric",
|
|
523
|
+
month: "2-digit",
|
|
524
|
+
day: "2-digit"
|
|
525
|
+
});
|
|
526
|
+
return `补签成功!本月累计签到 ${newMonthlyDays} 天,消耗 ${costPoints} 金币,获得 ${points} 金币和 ${tickets} 枚咕咕币`;
|
|
513
527
|
} catch (error) {
|
|
514
528
|
console.error("补签错误:", error);
|
|
515
529
|
return "补签失败,请稍后重试。";
|
|
@@ -536,7 +550,7 @@ ${itemDetails.join("\n")}`;
|
|
|
536
550
|
return [
|
|
537
551
|
`您的句柄:${handle}`,
|
|
538
552
|
`📅 最后签到时间:${chinaTime}`,
|
|
539
|
-
`🔥
|
|
553
|
+
`🔥 累计签到:${record.monthlyDays} 天`,
|
|
540
554
|
`💰 累计获得:${record.totalRewards} 金币`
|
|
541
555
|
].join("\n");
|
|
542
556
|
});
|
|
@@ -558,29 +572,32 @@ ${itemDetails.join("\n")}`;
|
|
|
558
572
|
}
|
|
559
573
|
const now = /* @__PURE__ */ new Date();
|
|
560
574
|
const chinatime = convertUTCtoChinaTime(now);
|
|
575
|
+
const currentYear = chinatime.getFullYear();
|
|
561
576
|
const currentMonth = chinatime.getMonth();
|
|
562
|
-
const [
|
|
563
|
-
|
|
577
|
+
const [adminRecord] = await ctx.database.get("ggcevo_adminbenefit", {
|
|
578
|
+
userId: session.userId
|
|
564
579
|
});
|
|
565
|
-
if (
|
|
566
|
-
const
|
|
567
|
-
|
|
580
|
+
if (adminRecord) {
|
|
581
|
+
const lastSignTime = convertUTCtoChinaTime(adminRecord.lastSign);
|
|
582
|
+
const lastYear = lastSignTime.getFullYear();
|
|
583
|
+
const lastMonth = lastSignTime.getMonth();
|
|
584
|
+
if (lastYear === currentYear && lastMonth === currentMonth) {
|
|
568
585
|
return `本月管理津贴已领取,${currentMonth + 2} 月1日可再次领取`;
|
|
569
586
|
}
|
|
570
587
|
}
|
|
571
|
-
await ctx.database.upsert("
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
588
|
+
await ctx.database.upsert("ggcevo_adminbenefit", [{
|
|
589
|
+
userId: session.userId,
|
|
590
|
+
handle,
|
|
591
|
+
signmonth: (adminRecord?.signmonth || 0) + 1,
|
|
592
|
+
// 累计月份+1
|
|
593
|
+
lastSign: now
|
|
577
594
|
}]);
|
|
578
595
|
await ctx.database.upsert("ggcevo_backpack", [{
|
|
579
596
|
handle,
|
|
580
597
|
itemId: 1,
|
|
581
598
|
quantity: (backpack.quantity || 0) + 50
|
|
582
599
|
}]);
|
|
583
|
-
return `[管理专属]
|
|
600
|
+
return `[管理专属] 成功领取本月津贴!累计领取 ${adminRecord ? adminRecord.signmonth + 1 : 1} 个月`;
|
|
584
601
|
});
|
|
585
602
|
ctx.command("ggcevo/领取福利").action(async (argv) => {
|
|
586
603
|
const session = argv.session;
|
|
@@ -744,13 +761,12 @@ ID:${activity.id}
|
|
|
744
761
|
if (recordDate > pageMaxDate) {
|
|
745
762
|
pageMaxDate = recordDate;
|
|
746
763
|
}
|
|
747
|
-
const
|
|
764
|
+
const handle = `${record.profile.regionId}-S2-${record.profile.realmId}-${record.profile.profileId}`;
|
|
765
|
+
const [ggcrank] = await ctx.database.get("ggcevo_rank", { handle });
|
|
748
766
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
749
|
-
|
|
750
|
-
realmId: record.profile.realmId,
|
|
751
|
-
profileId: record.profile.profileId,
|
|
767
|
+
handle,
|
|
752
768
|
name: record.profile.name,
|
|
753
|
-
rank: record.decision === "win" ? (ggcrank?.rank || 0) +
|
|
769
|
+
rank: record.decision === "win" ? (ggcrank?.rank || 0) + 150 : (ggcrank?.rank || 0) - 50,
|
|
754
770
|
matches: (ggcrank?.matches || 0) + 1
|
|
755
771
|
}]);
|
|
756
772
|
}
|
|
@@ -804,13 +820,12 @@ ID:${activity.id}
|
|
|
804
820
|
if (recordDate > pageMaxDate) {
|
|
805
821
|
pageMaxDate = recordDate;
|
|
806
822
|
}
|
|
807
|
-
const
|
|
823
|
+
const handle = `${record.profile.regionId}-S2-${record.profile.realmId}-${record.profile.profileId}`;
|
|
824
|
+
const [ggcrank] = await ctx.database.get("ggcevo_rank", { handle });
|
|
808
825
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
809
|
-
|
|
810
|
-
realmId: record.profile.realmId,
|
|
811
|
-
profileId: record.profile.profileId,
|
|
826
|
+
handle,
|
|
812
827
|
name: record.profile.name,
|
|
813
|
-
rank: record.decision === "win" ? (ggcrank?.rank || 0) +
|
|
828
|
+
rank: record.decision === "win" ? (ggcrank?.rank || 0) + 150 : (ggcrank?.rank || 0) - 50,
|
|
814
829
|
matches: (ggcrank?.matches || 0) + 1
|
|
815
830
|
}]);
|
|
816
831
|
}
|
|
@@ -834,7 +849,7 @@ ID:${activity.id}
|
|
|
834
849
|
const offset = (pageNum - 1) * 10;
|
|
835
850
|
const [records, total] = await Promise.all([
|
|
836
851
|
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").limit(10).offset(offset).execute(),
|
|
837
|
-
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).execute((row) => import_koishi.$.count(row.
|
|
852
|
+
ctx.database.select("ggcevo_rank").where({ Blacklist: false }).execute((row) => import_koishi.$.count(row.handle))
|
|
838
853
|
]);
|
|
839
854
|
const pageSize = 10;
|
|
840
855
|
const totalPages = Math.ceil(total / pageSize);
|
|
@@ -850,7 +865,7 @@ ID:${activity.id}
|
|
|
850
865
|
).join("\n");
|
|
851
866
|
return [
|
|
852
867
|
`🏆 GGCEvo S1赛季胜点榜 🏆`,
|
|
853
|
-
`本赛季至
|
|
868
|
+
`本赛季至5月15日23点结算`,
|
|
854
869
|
`第 ${pageNum} 页 共 ${totalPages} 页`,
|
|
855
870
|
"------------------------------",
|
|
856
871
|
rankingText,
|
|
@@ -866,23 +881,22 @@ ID:${activity.id}
|
|
|
866
881
|
return "您的 QQ 未绑定句柄。";
|
|
867
882
|
}
|
|
868
883
|
const { regionId, realmId, profileId } = profile;
|
|
884
|
+
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
869
885
|
const [user] = await ctx.database.get("ggcevo_rank", {
|
|
870
|
-
|
|
871
|
-
realmId,
|
|
872
|
-
profileId
|
|
886
|
+
handle
|
|
873
887
|
});
|
|
874
888
|
if (!user) return "未找到您的排名信息。";
|
|
875
889
|
if (user.Blacklist) return "❌您已经被禁止参加本赛季胜点榜。";
|
|
876
890
|
const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
|
|
877
891
|
const userRank = allRanks.findIndex(
|
|
878
|
-
(u) => u.
|
|
892
|
+
(u) => u.handle === handle
|
|
879
893
|
) + 1;
|
|
880
894
|
const isSafe = await checkSensitiveWord(user.name);
|
|
881
895
|
const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
|
|
882
896
|
return `🎮 您的 GGCEvo 排名信息 🎮
|
|
883
897
|
------------------------------
|
|
884
898
|
昵称:${displayName}
|
|
885
|
-
句柄:${user.
|
|
899
|
+
句柄:${user.handle}
|
|
886
900
|
当前积分:${user.rank}
|
|
887
901
|
参赛次数:${user.matches} 次
|
|
888
902
|
全服排名:第 ${userRank} 位
|
|
@@ -899,23 +913,22 @@ ID:${activity.id}
|
|
|
899
913
|
return "他/她的 QQ 未绑定句柄。";
|
|
900
914
|
}
|
|
901
915
|
const { regionId, realmId, profileId } = profile;
|
|
916
|
+
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
902
917
|
const [user] = await ctx.database.get("ggcevo_rank", {
|
|
903
|
-
|
|
904
|
-
realmId,
|
|
905
|
-
profileId
|
|
918
|
+
handle
|
|
906
919
|
});
|
|
907
920
|
if (!user) return "未找到他/她的排名信息。";
|
|
908
921
|
if (user.Blacklist) return "❌他/她已经被禁止参加本赛季胜点榜。";
|
|
909
922
|
const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false }).orderBy("rank", "desc").execute();
|
|
910
923
|
const userRank = allRanks.findIndex(
|
|
911
|
-
(u) => u.
|
|
924
|
+
(u) => u.handle === handle
|
|
912
925
|
) + 1;
|
|
913
926
|
const isSafe = await checkSensitiveWord(user.name);
|
|
914
927
|
const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
|
|
915
928
|
return `🎮 他/她的 GGCEvo 排名信息 🎮
|
|
916
929
|
------------------------------
|
|
917
930
|
昵称:${displayName}
|
|
918
|
-
句柄:${user.
|
|
931
|
+
句柄:${user.handle}
|
|
919
932
|
当前积分:${user.rank}
|
|
920
933
|
参赛次数:${user.matches} 次
|
|
921
934
|
全服排名:第 ${userRank} 位
|
|
@@ -1226,15 +1239,12 @@ ${output}`;
|
|
|
1226
1239
|
if (!handleRegex.test(handle)) {
|
|
1227
1240
|
return "句柄格式错误,请重新输入";
|
|
1228
1241
|
}
|
|
1229
|
-
const
|
|
1230
|
-
const existingEntries = await ctx.database.get("ggcevo_rank", { regionId, realmId, profileId, Blacklist: true });
|
|
1242
|
+
const existingEntries = await ctx.database.get("ggcevo_rank", { handle, Blacklist: true });
|
|
1231
1243
|
if (existingEntries.length > 0) {
|
|
1232
1244
|
return `${handle} 已在胜点榜黑名单中`;
|
|
1233
1245
|
}
|
|
1234
1246
|
await ctx.database.upsert("ggcevo_rank", [{
|
|
1235
|
-
|
|
1236
|
-
realmId,
|
|
1237
|
-
profileId,
|
|
1247
|
+
handle,
|
|
1238
1248
|
Blacklist: true
|
|
1239
1249
|
}]);
|
|
1240
1250
|
return `✅ 用户 ${handle} 已被列入胜点榜黑名单(仅限当前赛季)`;
|
|
@@ -1267,6 +1277,65 @@ ${output}`;
|
|
|
1267
1277
|
return `${regionId}-S2-${realmId}-${profileId} 已获得的成就:
|
|
1268
1278
|
${achievementList.join("\n")}`;
|
|
1269
1279
|
});
|
|
1280
|
+
ctx.command("个人信息").action(async (argv) => {
|
|
1281
|
+
const session = argv.session;
|
|
1282
|
+
const output = [];
|
|
1283
|
+
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
1284
|
+
if (!profile) return "您的 QQ 未绑定游戏句柄。";
|
|
1285
|
+
const { regionId, realmId, profileId } = profile;
|
|
1286
|
+
const handle = `${regionId}-S2-${realmId}-${profileId}`;
|
|
1287
|
+
output.push(`🎮 游戏句柄:${handle}
|
|
1288
|
+
──────────────`);
|
|
1289
|
+
const [sign] = await ctx.database.get("ggcevo_sign", { handle });
|
|
1290
|
+
if (sign) {
|
|
1291
|
+
const chinaTime = sign.lastSign.toLocaleString("zh-CN", {
|
|
1292
|
+
timeZone: "Asia/Shanghai",
|
|
1293
|
+
year: "numeric",
|
|
1294
|
+
month: "2-digit",
|
|
1295
|
+
day: "2-digit",
|
|
1296
|
+
hour: "2-digit",
|
|
1297
|
+
minute: "2-digit",
|
|
1298
|
+
hour12: false
|
|
1299
|
+
});
|
|
1300
|
+
output.push(
|
|
1301
|
+
"📅 签到记录:",
|
|
1302
|
+
`最后签到:${chinaTime}`,
|
|
1303
|
+
`本月累计:${sign.monthlyDays} 天`,
|
|
1304
|
+
`累计金币:${sign.totalRewards} 枚`,
|
|
1305
|
+
"──────────────"
|
|
1306
|
+
);
|
|
1307
|
+
}
|
|
1308
|
+
const [lottery] = await ctx.database.get("ggcevo_records", { handle });
|
|
1309
|
+
if (lottery) {
|
|
1310
|
+
output.push(
|
|
1311
|
+
"🎉 抽奖统计:",
|
|
1312
|
+
`总抽奖次数:${lottery.totalPulls}`,
|
|
1313
|
+
`距离保底剩余:${90 - lottery.pityCounter} 抽`,
|
|
1314
|
+
`已达成保底:${lottery.fullPityCount} 次`,
|
|
1315
|
+
...lottery.hiddenawards ? [`隐藏奖励次数:${lottery.hiddenawards}`] : [],
|
|
1316
|
+
"──────────────"
|
|
1317
|
+
);
|
|
1318
|
+
}
|
|
1319
|
+
const achievements = await ctx.database.get("ggcevo_achievements", { handle });
|
|
1320
|
+
if (achievements.length > 0) {
|
|
1321
|
+
output.push(
|
|
1322
|
+
"🏆 已获成就:",
|
|
1323
|
+
...achievements.map((a) => {
|
|
1324
|
+
const date = a.gaintime.toLocaleDateString("zh-CN", {
|
|
1325
|
+
timeZone: "Asia/Shanghai",
|
|
1326
|
+
year: "numeric",
|
|
1327
|
+
month: "2-digit",
|
|
1328
|
+
day: "2-digit"
|
|
1329
|
+
});
|
|
1330
|
+
return `${a.achievementname} (${date})`;
|
|
1331
|
+
}),
|
|
1332
|
+
"──────────────"
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
const sections = [sign, lottery, achievements].filter(Boolean).length;
|
|
1336
|
+
output.push(`共查询到 ${sections} 项个人信息`);
|
|
1337
|
+
return output.flat().join("\n");
|
|
1338
|
+
});
|
|
1270
1339
|
}
|
|
1271
1340
|
__name(apply, "apply");
|
|
1272
1341
|
function simpleDraw() {
|
|
@@ -1289,16 +1358,6 @@ function isSameDate(a, b) {
|
|
|
1289
1358
|
return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
|
|
1290
1359
|
}
|
|
1291
1360
|
__name(isSameDate, "isSameDate");
|
|
1292
|
-
function isSameMonth(a, b) {
|
|
1293
|
-
return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth();
|
|
1294
|
-
}
|
|
1295
|
-
__name(isSameMonth, "isSameMonth");
|
|
1296
|
-
function checkConsecutive(lastDate, currentDate) {
|
|
1297
|
-
const yesterday = new Date(currentDate);
|
|
1298
|
-
yesterday.setDate(yesterday.getDate() - 1);
|
|
1299
|
-
return isSameDate(lastDate, yesterday);
|
|
1300
|
-
}
|
|
1301
|
-
__name(checkConsecutive, "checkConsecutive");
|
|
1302
1361
|
function getLatestGGCGameTime(response) {
|
|
1303
1362
|
const targetMap = "咕咕虫-evolved";
|
|
1304
1363
|
const records = response.data.results.filter(
|