koishi-plugin-ggcevo-game 1.6.31 → 1.6.32

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
@@ -16,6 +16,7 @@ export interface Config {
16
16
  maxDailyBeChallenged: number;
17
17
  unlimitedBossAttack: boolean;
18
18
  pointBonusEnabled: boolean;
19
+ enableViolationAlert: boolean;
19
20
  }
20
21
  export declare const Config: Schema<Config>;
21
22
  export declare function apply(ctx: Context, config: Config): void;
package/lib/index.js CHANGED
@@ -6368,7 +6368,7 @@ async function calculateCrit(ctx, handle, equippedWeapon, weaponName, careerData
6368
6368
  }
6369
6369
  if (careerData?.career === "能量武器专家" && weaponType === "能量武器") {
6370
6370
  critRate += 10;
6371
- critSources.push("⚔️ 能量武器专家职业:暴击率+10%");
6371
+ critSources.push("⚔️ 能量武器专家职业:能量武器暴击率+10%");
6372
6372
  }
6373
6373
  if (equippedWeapon.installedMods?.includes("棱镜水晶")) {
6374
6374
  critRate += 10;
@@ -7324,10 +7324,12 @@ var Config = import_koishi.Schema.intersect([
7324
7324
  maxDailyBeChallenged: import_koishi.Schema.number().description("最大被挑战次数(0=无限制)").default(5),
7325
7325
  unlimitedBossAttack: import_koishi.Schema.boolean().description("开启无限制PVE攻击").default(false)
7326
7326
  }).description("对战限制"),
7327
- // 通知系统配置组
7327
+ // 通知系统配置组 - 新增违规提醒开关
7328
7328
  import_koishi.Schema.object({
7329
7329
  groupId: import_koishi.Schema.array(import_koishi.Schema.string()).description("广播通知群组").default([]),
7330
- checkInterval: import_koishi.Schema.number().description("大厅监控检查间隔(秒)").default(60)
7330
+ checkInterval: import_koishi.Schema.number().description("大厅监控检查间隔(秒)").default(60),
7331
+ enableViolationAlert: import_koishi.Schema.boolean().description("启用违规玩家房间提醒").default(false)
7332
+ // 新增配置项
7331
7333
  }).description("通知设置").collapse()
7332
7334
  ]);
7333
7335
  function apply(ctx, config) {
@@ -7771,70 +7773,72 @@ function apply(ctx, config) {
7771
7773
  }
7772
7774
  }, 60 * 60 * 1e3);
7773
7775
  ctx.setInterval(async () => {
7774
- try {
7775
- 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");
7776
- const data = response.data;
7777
- const openLobbies = data.results.filter(
7778
- (lobby) => lobby.status === "open" && !processedLobbies.has(lobby.id)
7779
- );
7780
- const allPlayers = openLobbies.flatMap(
7781
- (lobby) => lobby.slots.filter((slot) => slot.kind === "human" && slot.profile).map((slot) => ({
7782
- regionId: slot.profile.regionId,
7783
- realmId: slot.profile.realmId,
7784
- profileId: slot.profile.profileId,
7785
- handle: `${slot.profile.regionId}-S2-${slot.profile.realmId}-${slot.profile.profileId}`,
7786
- name: slot.name
7787
- // 保留名称用于后续展示
7788
- }))
7789
- );
7790
- const punishmentRecords = await ctx.database.select("ggcevo_punishment").where({
7791
- $and: [
7792
- { handle: { $in: allPlayers.map((p) => p.handle) } },
7793
- { id: { $gte: 1889 } },
7794
- { level: { $in: ["B", "B+", "A"] } }
7795
- ]
7796
- }).execute();
7797
- const punishedHandles = new Set(punishmentRecords.map((r) => r.handle));
7798
- for (const lobby of openLobbies) {
7799
- const lobbyPlayers = lobby.slots.filter((slot) => slot.kind === "human" && slot.profile).map((slot) => ({
7800
- regionId: slot.profile.regionId,
7801
- realmId: slot.profile.realmId,
7802
- profileId: slot.profile.profileId,
7803
- handle: `${slot.profile.regionId}-S2-${slot.profile.realmId}-${slot.profile.profileId}`,
7804
- name: slot.name
7805
- }));
7806
- const violators = lobbyPlayers.filter((p) => punishedHandles.has(p.handle));
7807
- if (violators.length > 0) {
7808
- const unpunishedPlayersData = lobbyPlayers.filter(
7809
- (p) => !punishedHandles.has(p.handle)
7810
- );
7811
- const queryConditions = unpunishedPlayersData.map((p) => ({
7812
- regionId: p.regionId,
7813
- realmId: p.realmId,
7814
- profileId: p.profileId
7776
+ if (config.enableViolationAlert) {
7777
+ try {
7778
+ 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");
7779
+ const data = response.data;
7780
+ const openLobbies = data.results.filter(
7781
+ (lobby) => lobby.status === "open" && !processedLobbies.has(lobby.id)
7782
+ );
7783
+ const allPlayers = openLobbies.flatMap(
7784
+ (lobby) => lobby.slots.filter((slot) => slot.kind === "human" && slot.profile).map((slot) => ({
7785
+ regionId: slot.profile.regionId,
7786
+ realmId: slot.profile.realmId,
7787
+ profileId: slot.profile.profileId,
7788
+ handle: `${slot.profile.regionId}-S2-${slot.profile.realmId}-${slot.profile.profileId}`,
7789
+ name: slot.name
7790
+ // 保留名称用于后续展示
7791
+ }))
7792
+ );
7793
+ const punishmentRecords = await ctx.database.select("ggcevo_punishment").where({
7794
+ $and: [
7795
+ { handle: { $in: allPlayers.map((p) => p.handle) } },
7796
+ { id: { $gte: 1889 } },
7797
+ { level: { $in: ["B", "B+", "A"] } }
7798
+ ]
7799
+ }).execute();
7800
+ const punishedHandles = new Set(punishmentRecords.map((r) => r.handle));
7801
+ for (const lobby of openLobbies) {
7802
+ const lobbyPlayers = lobby.slots.filter((slot) => slot.kind === "human" && slot.profile).map((slot) => ({
7803
+ regionId: slot.profile.regionId,
7804
+ realmId: slot.profile.realmId,
7805
+ profileId: slot.profile.profileId,
7806
+ handle: `${slot.profile.regionId}-S2-${slot.profile.realmId}-${slot.profile.profileId}`,
7807
+ name: slot.name
7815
7808
  }));
7816
- const safePlayers = await ctx.database.select("sc2arcade_player").where({ $or: queryConditions }).execute().then((res) => res.map((r) => r.userId));
7817
- const atElements = safePlayers.map((userId) => `<at id="${userId}"/>`).join(" ");
7818
- const message = [
7819
- `📺 监测到违规玩家正在房间中!`,
7820
- `创建时间: ${new Date(lobby.createdAt).toLocaleString("zh-CN")}`,
7821
- `🚨 违规玩家(${violators.length} 人):`,
7822
- ...violators.map((v) => {
7823
- const record = punishmentRecords.find((r) => r.handle === v.handle);
7824
- return `· ${v.name}(${record?.level}级处罚)`;
7825
- }),
7826
- `房主: ${lobby.hostName}`,
7827
- `玩家数: ${lobby.slotsHumansTaken}/${lobby.slotsHumansTotal}`,
7828
- "──────────────",
7829
- `请以下玩家通知房主踢人:${atElements || "无"}`
7830
- ].join("\n");
7831
- const groupId = [...config.groupId];
7832
- await ctx.broadcast(groupId, message);
7833
- processedLobbies.add(lobby.id);
7809
+ const violators = lobbyPlayers.filter((p) => punishedHandles.has(p.handle));
7810
+ if (violators.length > 0) {
7811
+ const unpunishedPlayersData = lobbyPlayers.filter(
7812
+ (p) => !punishedHandles.has(p.handle)
7813
+ );
7814
+ const queryConditions = unpunishedPlayersData.map((p) => ({
7815
+ regionId: p.regionId,
7816
+ realmId: p.realmId,
7817
+ profileId: p.profileId
7818
+ }));
7819
+ const safePlayers = await ctx.database.select("sc2arcade_player").where({ $or: queryConditions }).execute().then((res) => res.map((r) => r.userId));
7820
+ const atElements = safePlayers.map((userId) => `<at id="${userId}"/>`).join(" ");
7821
+ const message = [
7822
+ `📺 监测到违规玩家正在房间中!`,
7823
+ `创建时间: ${new Date(lobby.createdAt).toLocaleString("zh-CN")}`,
7824
+ `🚨 违规玩家(${violators.length} 人):`,
7825
+ ...violators.map((v) => {
7826
+ const record = punishmentRecords.find((r) => r.handle === v.handle);
7827
+ return `· ${v.name}(${record?.level}级处罚)`;
7828
+ }),
7829
+ `房主: ${lobby.hostName}`,
7830
+ `玩家数: ${lobby.slotsHumansTaken}/${lobby.slotsHumansTotal}`,
7831
+ "──────────────",
7832
+ `请以下玩家通知房主踢人:${atElements || "无"}`
7833
+ ].join("\n");
7834
+ const groupId = [...config.groupId];
7835
+ await ctx.broadcast(groupId, message);
7836
+ processedLobbies.add(lobby.id);
7837
+ }
7834
7838
  }
7839
+ } catch (error) {
7840
+ ctx.logger.error("监控失败:", error);
7835
7841
  }
7836
- } catch (error) {
7837
- ctx.logger.error("监控失败:", error);
7838
7842
  }
7839
7843
  }, config.checkInterval * 1e3);
7840
7844
  ctx.setInterval(async () => {
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.6.31",
4
+ "version": "1.6.32",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [