koishi-plugin-ggcevo-game 0.3.23 → 0.4.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 CHANGED
@@ -6,6 +6,7 @@ export interface Config {
6
6
  ggcqun: string;
7
7
  signrequire: boolean;
8
8
  autorank: boolean;
9
+ ignoreGlobalLimit: boolean;
9
10
  }
10
11
  export declare const Config: Schema<Config>;
11
12
  export declare const inject: {
@@ -83,6 +84,7 @@ export interface exchange {
83
84
  item: string;
84
85
  type: string;
85
86
  date: Date;
87
+ GlobalLimit: boolean;
86
88
  }
87
89
  export interface adminbenefit {
88
90
  userId: string;
package/lib/index.js CHANGED
@@ -33,7 +33,8 @@ var Config = import_koishi.Schema.object({
33
33
  proxyAgent: import_koishi.Schema.string().description("代理服务器地址"),
34
34
  ggcqun: import_koishi.Schema.string().description("开启咕咕虫排行榜的群组").required(),
35
35
  signrequire: import_koishi.Schema.boolean().description("是否开启签到要求每日一场").default(true),
36
- autorank: import_koishi.Schema.boolean().description("是否开启每小时自动同步rank数据").default(true)
36
+ autorank: import_koishi.Schema.boolean().description("是否开启每小时自动同步rank数据").default(true),
37
+ ignoreGlobalLimit: import_koishi.Schema.boolean().description("是否开启无限制兑换").default(false)
37
38
  });
38
39
  var inject = {
39
40
  required: ["database"]
@@ -135,7 +136,8 @@ function apply(ctx, config) {
135
136
  item: "string",
136
137
  // 兑换物品
137
138
  type: "string",
138
- date: "timestamp"
139
+ date: "timestamp",
140
+ GlobalLimit: "boolean"
139
141
  }, {
140
142
  // 额外配置
141
143
  primary: ["handle", "item"]
@@ -1033,8 +1035,8 @@ ${items.join("、")}
1033
1035
  if (!configname) return "无效的物品名称,请重新输入";
1034
1036
  const userRecords = await ctx.database.get("ggcevo_exchange", { handle, item: name2 });
1035
1037
  if (userRecords.length > 0) return "您已经兑换过该物品";
1036
- if (configname.quantity !== void 0) {
1037
- const globalRecords = await ctx.database.get("ggcevo_exchange", { item: name2 });
1038
+ if (configname.quantity !== void 0 && config.ignoreGlobalLimit === false) {
1039
+ const globalRecords = await ctx.database.get("ggcevo_exchange", { item: name2, GlobalLimit: true });
1038
1040
  if (globalRecords.length >= configname.quantity) return "该物品已被兑换尽了";
1039
1041
  }
1040
1042
  const qualityMap = { "t3": 4, "t2": 5, "t1": 6, "t0": 7 };
@@ -1062,6 +1064,7 @@ ${items.join("、")}
1062
1064
  return `${requireMsg}
1063
1065
  当前持有:${coupon?.quantity || 0}个${couponName}`;
1064
1066
  }
1067
+ const isGlobal = config.ignoreGlobalLimit === false;
1065
1068
  await ctx.database.withTransaction(async () => {
1066
1069
  await ctx.database.set(
1067
1070
  "ggcevo_backpack",
@@ -1074,7 +1077,9 @@ ${items.join("、")}
1074
1077
  item: name2,
1075
1078
  type: configname.type,
1076
1079
  // 从配置中获取类型
1077
- date: /* @__PURE__ */ new Date()
1080
+ date: /* @__PURE__ */ new Date(),
1081
+ GlobalLimit: isGlobal
1082
+ // 关键字段设置
1078
1083
  });
1079
1084
  });
1080
1085
  return `兑换成功!消耗 ${cost} 个${couponName}获得【${name2}】`;
@@ -1186,7 +1191,7 @@ ${output}`;
1186
1191
  });
1187
1192
  return `✅ 用户 ${handle} 已被列入黑名单`;
1188
1193
  } catch (error) {
1189
- ctx.logger.error("黑名单操作失败:", error);
1194
+ console.error("黑名单操作失败:", error);
1190
1195
  return "操作失败,请稍后重试。错误详情已记录";
1191
1196
  }
1192
1197
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
- "description": "星际争霸2游戏大厅地图咕咕虫-evo小游戏",
4
- "version": "0.3.23",
3
+ "description": "星际争霸2游戏大厅咕咕虫-evolved地图专属插件",
4
+ "version": "0.4.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/koishi-plugin-ggcevo-game?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-ggcevo-game)
4
4
 
5
-
5
+ 2