koishi-plugin-ggcevo-game 1.0.13 → 1.0.14
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 -0
- package/lib/index.js +58 -5
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -36,7 +36,9 @@ var Config = import_koishi.Schema.object({
|
|
|
36
36
|
signrequire: import_koishi.Schema.boolean().description("是否开启签到要求进行一场游戏").default(true),
|
|
37
37
|
autorank: import_koishi.Schema.boolean().description("是否开启每小时自动同步rank数据").default(true),
|
|
38
38
|
ignoreGlobalLimit: import_koishi.Schema.boolean().description("是否开启无限制兑换").default(false),
|
|
39
|
-
admins: import_koishi.Schema.array(import_koishi.Schema.string()).description("管理员QQ号列表,支持配置多个").default([]).role("table")
|
|
39
|
+
admins: import_koishi.Schema.array(import_koishi.Schema.string()).description("管理员QQ号列表,支持配置多个").default([]).role("table"),
|
|
40
|
+
groupId: import_koishi.Schema.string().description("游戏大厅黑名单通知群组,例如 onebot:123456"),
|
|
41
|
+
checkInterval: import_koishi.Schema.number().default(60).description("检查间隔(秒)")
|
|
40
42
|
});
|
|
41
43
|
var inject = {
|
|
42
44
|
required: ["database"]
|
|
@@ -513,19 +515,19 @@ ${itemDetails.join("\n")}`;
|
|
|
513
515
|
switch (newMonthlyDays) {
|
|
514
516
|
case 7:
|
|
515
517
|
tickets = 4;
|
|
516
|
-
points =
|
|
518
|
+
points = getRandomInt(20, 30);
|
|
517
519
|
break;
|
|
518
520
|
case 14:
|
|
519
521
|
tickets = 5;
|
|
520
|
-
points =
|
|
522
|
+
points = getRandomInt(30, 50);
|
|
521
523
|
break;
|
|
522
524
|
case 21:
|
|
523
525
|
tickets = 6;
|
|
524
|
-
points =
|
|
526
|
+
points = getRandomInt(50, 70);
|
|
525
527
|
break;
|
|
526
528
|
case 28:
|
|
527
529
|
tickets = 7;
|
|
528
|
-
points =
|
|
530
|
+
points = getRandomInt(70, 100);
|
|
529
531
|
break;
|
|
530
532
|
}
|
|
531
533
|
await ctx.database.set("ggcevo_sign", { handle }, {
|
|
@@ -1424,6 +1426,57 @@ ${achievementList.join("\n")}`;
|
|
|
1424
1426
|
output.push(`📊 共查询到 ${existModules.length} 类信息`);
|
|
1425
1427
|
return output.join("\n");
|
|
1426
1428
|
});
|
|
1429
|
+
const processedLobbies = /* @__PURE__ */ new Set();
|
|
1430
|
+
ctx.setInterval(async () => {
|
|
1431
|
+
try {
|
|
1432
|
+
const response = await ctx.http("get", "https://api.sc2arcade.com/lobbies/history?regionId=3&mapId=165561&orderDirection=desc&includeMapInfo=false&includeSlots=true&includeSlotsProfile=true&includeSlotsJoinInfo=false&includeJoinHistory=false&includeMatchResult=false&includeMatchPlayers=false");
|
|
1433
|
+
const data = response.data;
|
|
1434
|
+
const openLobbies = data.results.filter(
|
|
1435
|
+
(lobby) => lobby.status === "open" && !processedLobbies.has(lobby.id)
|
|
1436
|
+
);
|
|
1437
|
+
const allHandles = openLobbies.flatMap(
|
|
1438
|
+
(lobby) => lobby.slots.filter((slot) => slot.kind === "human" && slot.profile).map((slot) => {
|
|
1439
|
+
const p = slot.profile;
|
|
1440
|
+
return `${p.regionId}-S2-${p.realmId}-${p.profileId}`;
|
|
1441
|
+
})
|
|
1442
|
+
);
|
|
1443
|
+
const records = await ctx.database.select("ggcevo_Punishment").where({
|
|
1444
|
+
$and: [
|
|
1445
|
+
{ handle: { $in: allHandles } },
|
|
1446
|
+
{ id: { $gte: 1889 } },
|
|
1447
|
+
{ level: { $in: ["B", "B+", "A", "S"] } }
|
|
1448
|
+
]
|
|
1449
|
+
}).execute().then((res) => res.map((r) => ({
|
|
1450
|
+
handle: r.handle,
|
|
1451
|
+
level: r.level
|
|
1452
|
+
})));
|
|
1453
|
+
const punishmentMap = new Map(records.map((r) => [r.handle, r]));
|
|
1454
|
+
for (const lobby of openLobbies) {
|
|
1455
|
+
const matchedSlots = lobby.slots.filter((slot) => slot.kind === "human" && slot.profile).map((slot) => {
|
|
1456
|
+
const p = slot.profile;
|
|
1457
|
+
const handle = `${p.regionId}-S2-${p.realmId}-${p.profileId}`;
|
|
1458
|
+
return { ...slot, handle };
|
|
1459
|
+
}).filter((slot) => punishmentMap.has(slot.handle));
|
|
1460
|
+
if (matchedSlots.length > 0) {
|
|
1461
|
+
const message = [
|
|
1462
|
+
`🏟️ 发现受监控玩家在开放大厅中!`,
|
|
1463
|
+
`大厅ID: ${lobby.id}`,
|
|
1464
|
+
`主机名称: ${lobby.hostName}`,
|
|
1465
|
+
`创建时间: ${new Date(lobby.createdAt).toLocaleString("zh-CN", { timeZone: "Asia/Shanghai" })}`,
|
|
1466
|
+
`玩家列表:`,
|
|
1467
|
+
...matchedSlots.map(
|
|
1468
|
+
(slot) => `· ${slot.name}(处罚等级:${punishmentMap.get(slot.handle).level})`
|
|
1469
|
+
),
|
|
1470
|
+
`玩家数量: ${lobby.slotsHumansTaken}/${lobby.slotsHumansTotal}`
|
|
1471
|
+
].join("\n");
|
|
1472
|
+
await ctx.broadcast([config.groupId], message);
|
|
1473
|
+
processedLobbies.add(lobby.id);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
} catch (error) {
|
|
1477
|
+
ctx.logger.error("SC2大厅监控失败:", error);
|
|
1478
|
+
}
|
|
1479
|
+
}, config.checkInterval * 1e3);
|
|
1427
1480
|
}
|
|
1428
1481
|
__name(apply, "apply");
|
|
1429
1482
|
function simpleDraw() {
|