koishi-plugin-ggcevo-game 0.3.8 → 0.3.9

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
@@ -89,6 +89,7 @@ export interface exchange {
89
89
  userId: string;
90
90
  handle: string;
91
91
  item: string;
92
+ type: string;
92
93
  date: Date;
93
94
  }
94
95
  export interface adminbenefit {
package/lib/index.js CHANGED
@@ -46,9 +46,7 @@ function apply(ctx, config) {
46
46
  description: "text",
47
47
  effect: "json"
48
48
  }, {
49
- primary: "id",
50
- autoInc: true,
51
- unique: ["name"]
49
+ primary: "name"
52
50
  });
53
51
  ctx.model.extend("ggcevo_backpack", {
54
52
  handle: "string",
@@ -146,6 +144,7 @@ function apply(ctx, config) {
146
144
  // 句柄
147
145
  item: "string",
148
146
  // 兑换物品
147
+ type: "string",
149
148
  date: "timestamp"
150
149
  }, {
151
150
  // 额外配置
@@ -166,13 +165,13 @@ function apply(ctx, config) {
166
165
  });
167
166
  async function initDefaultItems() {
168
167
  const defaultItems = [
169
- { name: "咕咕币", type: "consumable", description: "用于进行抽奖" },
170
- { name: "兑换券", type: "material", description: "用于兑换赞助物品,输入 兑换图 查看详情" },
171
- { name: "扭蛋币", type: "consumable", description: "用于进行宠物扭蛋" },
172
- { name: "t3级宠物扭蛋", type: "material", description: "用于兑换t3系列宠物" },
173
- { name: "t2级宠物扭蛋", type: "material", description: "用于兑换t2系列宠物" },
174
- { name: "t1级宠物扭蛋", type: "material", description: "用于兑换t1系列宠物" },
175
- { name: "t0级宠物扭蛋", type: "material", description: "用于兑换t0系列宠物" }
168
+ { id: 1, name: "咕咕币", type: "consumable", description: "用于进行抽奖" },
169
+ { id: 2, name: "兑换券", type: "material", description: "用于兑换赞助物品,输入 兑换图 查看详情" },
170
+ { id: 3, name: "扭蛋币", type: "consumable", description: "用于进行宠物扭蛋" },
171
+ { id: 4, name: "t3级宠物扭蛋", type: "material", description: "用于兑换t3系列宠物" },
172
+ { id: 5, name: "t2级宠物扭蛋", type: "material", description: "用于兑换t2系列宠物" },
173
+ { id: 6, name: "t1级宠物扭蛋", type: "material", description: "用于兑换t1系列宠物" },
174
+ { id: 7, name: "t0级宠物扭蛋", type: "material", description: "用于兑换t0系列宠物" }
176
175
  ];
177
176
  await ctx.database.upsert("ggcevo_items", defaultItems, ["name"]);
178
177
  }
@@ -913,27 +912,27 @@ ID:${activity.id}
913
912
  ].join("\n");
914
913
  });
915
914
  const itemConfig = {
916
- "拾荒者": { quality: "t3", cost: 3 },
917
- "劳工": { quality: "t3", cost: 3 },
918
- "老兵": { quality: "t2", cost: 4 },
919
- "合成人": { quality: "t2", cost: 4 },
920
- "阿斯塔特": { quality: "t1", cost: 5 },
921
- "皇家指挥官": { quality: "t1", cost: 5 },
922
- "个性开场白": { quality: "t1", cost: 5, quantity: 5 },
923
- "史蒂夫": { quality: "t0", cost: 6, quantity: 1 },
924
- "ep4": { quality: "t0", cost: 6, quantity: 3 },
925
- "小狗": { quality: "t3", cost: 3, quantity: 5 },
926
- "小猫": { quality: "t3", cost: 3, quantity: 5 },
927
- "小黄鸭": { quality: "t3", cost: 3, quantity: 5 },
928
- "萌萌熊": { quality: "t2", cost: 4, quantity: 3 },
929
- "荆棘蜥蜴": { quality: "t2", cost: 4, quantity: 3 },
930
- "爆笑小狗": { quality: "t1", cost: 5, quantity: 2 },
931
- "熔岩蟹": { quality: "t1", cost: 5, quantity: 2 },
932
- "远古蝗虫": { quality: "t1", cost: 5, quantity: 2 },
933
- "绿毛虫": { quality: "t0", cost: 6, quantity: 1 },
934
- "妙蛙种子": { quality: "t0", cost: 6, quantity: 1 },
935
- "皮卡丘": { quality: "t0", cost: 6, quantity: 1 },
936
- "哆啦A梦": { quality: "t0", cost: 6, quantity: 1 }
915
+ "拾荒者": { quality: "t3", type: "皮肤", cost: 3 },
916
+ "劳工": { quality: "t3", type: "皮肤", cost: 3 },
917
+ "老兵": { quality: "t2", type: "皮肤", cost: 4 },
918
+ "合成人": { quality: "t2", type: "皮肤", cost: 4 },
919
+ "阿斯塔特": { quality: "t1", type: "皮肤", cost: 5 },
920
+ "皇家指挥官": { quality: "t1", type: "皮肤", cost: 5 },
921
+ "个性开场白": { quality: "t1", type: "“入场特效", cost: 5, quantity: 5 },
922
+ "史蒂夫": { quality: "t0", type: "皮肤", cost: 6, quantity: 1 },
923
+ "ep4": { quality: "t0", type: "物品", cost: 6, quantity: 3 },
924
+ "小狗": { quality: "t3", type: "宠物", cost: 3, quantity: 5 },
925
+ "小猫": { quality: "t3", type: "宠物", cost: 3, quantity: 5 },
926
+ "小黄鸭": { quality: "t3", type: "宠物", cost: 3, quantity: 5 },
927
+ "萌萌熊": { quality: "t2", type: "宠物", cost: 4, quantity: 3 },
928
+ "荆棘蜥蜴": { quality: "t2", type: "宠物", cost: 4, quantity: 3 },
929
+ "爆笑小狗": { quality: "t1", type: "宠物", cost: 5, quantity: 2 },
930
+ "熔岩蟹": { quality: "t1", type: "宠物", cost: 5, quantity: 2 },
931
+ "远古蝗虫": { quality: "t1", type: "宠物", cost: 5, quantity: 2 },
932
+ "绿毛虫": { quality: "t0", type: "宠物", cost: 6, quantity: 1 },
933
+ "妙蛙种子": { quality: "t0", type: "宠物", cost: 6, quantity: 1 },
934
+ "皮卡丘": { quality: "t0", type: "宠物", cost: 6, quantity: 1 },
935
+ "哆啦A梦": { quality: "t0", type: "宠物", cost: 6, quantity: 1 }
937
936
  };
938
937
  ctx.command("ggcevo/兑换", "兑换物品").action(async ({ session }) => {
939
938
  try {
@@ -967,8 +966,11 @@ ${items.join("、")}
967
966
  const globalRecords = await ctx.database.get("ggcevo_exchange", { item: name2 });
968
967
  if (globalRecords.length >= configname.quantity) return "该物品已兑尽";
969
968
  }
970
- const petItems = /* @__PURE__ */ new Set(["小狗", "小猫", "小黄鸭", "萌萌熊", "荆棘蜥蜴", "爆笑小狗", "熔岩蟹", "远古蝗虫", "绿毛虫", "妙蛙种子", "皮卡丘", "哆啦A梦"]);
971
969
  const qualityMap = { "t3": 4, "t2": 5, "t1": 6, "t0": 7 };
970
+ const petItems = new Set(
971
+ // 动态生成宠物集合
972
+ Object.entries(itemConfig).filter(([_, config2]) => config2.type === "宠物").map(([name3]) => name3)
973
+ );
972
974
  let cost = configname.cost;
973
975
  let itemId = 2;
974
976
  let couponName = "兑奖券";
@@ -999,6 +1001,8 @@ ${items.join("、")}
999
1001
  userId: session.userId,
1000
1002
  handle,
1001
1003
  item: name2,
1004
+ type: configname.type,
1005
+ // 从配置中获取类型
1002
1006
  date: /* @__PURE__ */ new Date()
1003
1007
  });
1004
1008
  });
@@ -1026,7 +1030,7 @@ ${items.join("、")}
1026
1030
  second: "2-digit",
1027
1031
  hour12: false
1028
1032
  });
1029
- return `物品: ${e.item} | 时间: ${cnTime}`;
1033
+ return `${e.type}: ${e.item} | 时间: ${cnTime}`;
1030
1034
  }).join("\n");
1031
1035
  return `${handle} 的兑换记录:
1032
1036
  ${output}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "星际争霸2游戏大厅地图咕咕虫-evo小游戏",
4
- "version": "0.3.8",
4
+ "version": "0.3.9",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [