koishi-plugin-ggcevo-game 1.0.9 → 1.0.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 CHANGED
@@ -4,6 +4,7 @@ export declare const name = "ggcevo-game";
4
4
  export interface Config {
5
5
  proxyAgent: string;
6
6
  ggcqun: string;
7
+ rankseason: string;
7
8
  signrequire: boolean;
8
9
  autorank: boolean;
9
10
  ignoreGlobalLimit: boolean;
@@ -87,6 +88,7 @@ export interface exchange {
87
88
  type: string;
88
89
  date: Date;
89
90
  GlobalLimit: boolean;
91
+ season: string;
90
92
  }
91
93
  export interface adminbenefit {
92
94
  userId: string;
package/lib/index.js CHANGED
@@ -32,6 +32,7 @@ var name = "ggcevo-game";
32
32
  var Config = import_koishi.Schema.object({
33
33
  proxyAgent: import_koishi.Schema.string().description("代理服务器地址"),
34
34
  ggcqun: import_koishi.Schema.string().description("开启咕咕虫排行榜的群组").required(),
35
+ rankseason: import_koishi.Schema.string().description("当前赛季").required(),
35
36
  signrequire: import_koishi.Schema.boolean().description("是否开启签到要求进行一场游戏").default(true),
36
37
  autorank: import_koishi.Schema.boolean().description("是否开启每小时自动同步rank数据").default(true),
37
38
  ignoreGlobalLimit: import_koishi.Schema.boolean().description("是否开启无限制兑换").default(false),
@@ -137,7 +138,9 @@ function apply(ctx, config) {
137
138
  // 兑换物品
138
139
  type: "string",
139
140
  date: "timestamp",
140
- GlobalLimit: "boolean"
141
+ GlobalLimit: "boolean",
142
+ season: "string"
143
+ // 新增赛季字段
141
144
  }, {
142
145
  primary: ["handle", "item"]
143
146
  });
@@ -452,16 +455,16 @@ ${itemDetails.join("\n")}`;
452
455
  let points = 10;
453
456
  if (monthlyDays === 7) {
454
457
  tickets = 4;
455
- points = 15;
458
+ points = 20;
456
459
  } else if (monthlyDays === 14) {
457
460
  tickets = 5;
458
- points = 20;
461
+ points = 30;
459
462
  } else if (monthlyDays === 21) {
460
463
  tickets = 6;
461
- points = 25;
464
+ points = 40;
462
465
  } else if (monthlyDays === 28) {
463
466
  tickets = 7;
464
- points = 30;
467
+ points = 50;
465
468
  }
466
469
  await ctx.database.upsert("ggcevo_sign", [{
467
470
  handle,
@@ -510,19 +513,19 @@ ${itemDetails.join("\n")}`;
510
513
  switch (newMonthlyDays) {
511
514
  case 7:
512
515
  tickets = 4;
513
- points = 15;
516
+ points = 10;
514
517
  break;
515
518
  case 14:
516
519
  tickets = 5;
517
- points = 20;
520
+ points = 10;
518
521
  break;
519
522
  case 21:
520
523
  tickets = 6;
521
- points = 25;
524
+ points = 10;
522
525
  break;
523
526
  case 28:
524
527
  tickets = 7;
525
- points = 30;
528
+ points = 10;
526
529
  break;
527
530
  }
528
531
  await ctx.database.set("ggcevo_sign", { handle }, {
@@ -1046,7 +1049,7 @@ ID:${activity.id}
1046
1049
  "合成人": { quality: "t2", type: "皮肤", cost: 4, isLimited: false },
1047
1050
  "阿斯塔特": { quality: "t1", type: "皮肤", cost: 5, isLimited: false },
1048
1051
  "皇家指挥官": { quality: "t1", type: "皮肤", cost: 5, isLimited: false },
1049
- "个性开场白": { quality: "t1", type: "“入场特效", cost: 5, quantity: 5, isLimited: false },
1052
+ "个性开场白": { quality: "t1", type: "入场特效", cost: 5, quantity: 5, isLimited: false },
1050
1053
  "史蒂夫": { quality: "t0", type: "皮肤", cost: 6, quantity: 1, isLimited: true },
1051
1054
  "ep4": { quality: "t0", type: "物品", cost: 6, quantity: 3, isLimited: false },
1052
1055
  "小狗": { quality: "t3", type: "宠物", cost: 3, quantity: 5, isLimited: false },
@@ -1066,14 +1069,36 @@ ID:${activity.id}
1066
1069
  try {
1067
1070
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
1068
1071
  if (!profile) return "您的 QQ 未绑定句柄";
1072
+ const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
1073
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1074
+ if (existingEntries.length > 0) {
1075
+ return `❌拒绝访问,您已被列入活动黑名单。`;
1076
+ }
1077
+ const currentSeason = config.rankseason;
1069
1078
  const qualityGroups = {};
1070
1079
  for (const [itemName, config2] of Object.entries(itemConfig)) {
1071
- const quality = config2.quality;
1080
+ const configname2 = config2;
1081
+ const quality = configname2.quality;
1072
1082
  if (!qualityGroups[quality]) qualityGroups[quality] = [];
1073
- qualityGroups[quality].push(itemName);
1083
+ let quantityText = "";
1084
+ if (configname2.quantity !== void 0) {
1085
+ const queryConditions = {
1086
+ item: itemName,
1087
+ GlobalLimit: true
1088
+ };
1089
+ if (itemName !== "史蒂夫") {
1090
+ queryConditions.season = currentSeason;
1091
+ }
1092
+ const records = await ctx.database.get("ggcevo_exchange", queryConditions);
1093
+ const remaining = Math.max(configname2.quantity - records.length, 0);
1094
+ quantityText = ` [${remaining}/${configname2.quantity}]`;
1095
+ } else {
1096
+ quantityText = " [无限]";
1097
+ }
1098
+ qualityGroups[quality].push(`${itemName}${quantityText}`);
1074
1099
  }
1075
1100
  const order = ["t0", "t1", "t2", "t3"];
1076
- let message = "请在30秒内输入要兑换的物品名称,可兑换物品(按品质分类):\n";
1101
+ let message = "请在30秒内输入可兑换物品(显示格式:物品名 [剩余/总量]):\n";
1077
1102
  for (const quality of order) {
1078
1103
  const items = qualityGroups[quality] || [];
1079
1104
  if (!items.length) continue;
@@ -1085,20 +1110,19 @@ ${items.join("、")}
1085
1110
  await session.send(message);
1086
1111
  const name2 = await session.prompt(3e4);
1087
1112
  if (!name2) return "输入超时,请重新输入指令。";
1088
- const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
1089
- const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1090
- if (existingEntries.length > 0) {
1091
- return `❌拒绝访问,您已被列入活动黑名单。`;
1092
- }
1093
1113
  const configname = itemConfig[name2];
1094
1114
  if (!configname) return "无效的物品名称,请重新输入";
1095
1115
  const userRecords = await ctx.database.get("ggcevo_exchange", { handle, item: name2 });
1096
1116
  if (userRecords.length > 0) return "您已经兑换过该物品";
1097
1117
  if (configname.quantity !== void 0 && (configname.isLimited || config.ignoreGlobalLimit === false)) {
1098
- const globalRecords = await ctx.database.get("ggcevo_exchange", {
1118
+ const queryConditions = {
1099
1119
  item: name2,
1100
1120
  GlobalLimit: true
1101
- });
1121
+ };
1122
+ if (name2 !== "史蒂夫") {
1123
+ queryConditions.season = currentSeason;
1124
+ }
1125
+ const globalRecords = await ctx.database.get("ggcevo_exchange", queryConditions);
1102
1126
  if (globalRecords.length >= configname.quantity) return "该物品已被兑换尽";
1103
1127
  }
1104
1128
  const qualityMap = { "t3": 4, "t2": 5, "t1": 6, "t0": 7 };
@@ -1140,8 +1164,9 @@ ${items.join("、")}
1140
1164
  type: configname.type,
1141
1165
  // 从配置中获取类型
1142
1166
  date: /* @__PURE__ */ new Date(),
1143
- GlobalLimit: isGlobal
1167
+ GlobalLimit: isGlobal,
1144
1168
  // 关键字段设置
1169
+ season: currentSeason
1145
1170
  });
1146
1171
  });
1147
1172
  return `兑换成功!消耗 ${cost} 个${couponName}获得【${name2}】`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅咕咕虫-Evo地图专属插件",
4
- "version": "1.0.9",
4
+ "version": "1.0.11",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -26,4 +26,4 @@
26
26
  ]
27
27
  }
28
28
  }
29
- }
29
+ }