koishi-plugin-xxck-1 0.2.49 → 0.2.51

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
@@ -5,15 +5,42 @@ export interface PluginConfig {
5
5
  masterQQ: string;
6
6
  signResetHour: number;
7
7
  signResetMinute: number;
8
+ dailyExchangeLimit: number;
9
+ exchangeVaporPerDraw: number;
10
+ eventExchangePrice6: number;
11
+ eventExchangePrice7: number;
12
+ normalStar7Threshold: number;
13
+ normalStar6Threshold: number;
14
+ normalStar6Prob: number;
15
+ eventStar6Threshold: number;
16
+ eventStar7Threshold: number;
8
17
  }
9
18
  export declare const Config: Schema<Schemastery.ObjectS<{
10
19
  masterQQ: Schema<string, string>;
11
20
  signResetHour: Schema<number, number>;
12
21
  signResetMinute: Schema<number, number>;
22
+ dailyExchangeLimit: Schema<number, number>;
23
+ exchangeVaporPerDraw: Schema<number, number>;
24
+ eventExchangePrice6: Schema<number, number>;
25
+ eventExchangePrice7: Schema<number, number>;
26
+ normalStar7Threshold: Schema<number, number>;
27
+ normalStar6Threshold: Schema<number, number>;
28
+ normalStar6Prob: Schema<number, number>;
29
+ eventStar6Threshold: Schema<number, number>;
30
+ eventStar7Threshold: Schema<number, number>;
13
31
  }>, Schemastery.ObjectT<{
14
32
  masterQQ: Schema<string, string>;
15
33
  signResetHour: Schema<number, number>;
16
34
  signResetMinute: Schema<number, number>;
35
+ dailyExchangeLimit: Schema<number, number>;
36
+ exchangeVaporPerDraw: Schema<number, number>;
37
+ eventExchangePrice6: Schema<number, number>;
38
+ eventExchangePrice7: Schema<number, number>;
39
+ normalStar7Threshold: Schema<number, number>;
40
+ normalStar6Threshold: Schema<number, number>;
41
+ normalStar6Prob: Schema<number, number>;
42
+ eventStar6Threshold: Schema<number, number>;
43
+ eventStar7Threshold: Schema<number, number>;
17
44
  }>>;
18
45
  declare module 'koishi' {
19
46
  interface Tables {
package/lib/index.js CHANGED
@@ -167,7 +167,16 @@ var inject = ["database", "canvas"];
167
167
  var Config = import_koishi.Schema.object({
168
168
  masterQQ: import_koishi.Schema.string().description("主人QQ号,拥有录入卡片、审核、开关功能等最高权限").required(),
169
169
  signResetHour: import_koishi.Schema.number().description("每日签到重置的小时数(0-23)").default(0).min(0).max(23),
170
- signResetMinute: import_koishi.Schema.number().description("每日签到重置的分钟数(0-59)").default(0).min(0).max(59)
170
+ signResetMinute: import_koishi.Schema.number().description("每日签到重置的分钟数(0-59)").default(0).min(0).max(59),
171
+ dailyExchangeLimit: import_koishi.Schema.number().description("每日水汽兑换抽数上限(默认80)").default(80).min(1).max(1e4),
172
+ exchangeVaporPerDraw: import_koishi.Schema.number().description("普通兑换每抽消耗的水汽量(默认100)").default(100).min(0).max(1e4),
173
+ eventExchangePrice6: import_koishi.Schema.number().description("限时卡池6星兑换每抽消耗的水汽量(默认300)").default(300).min(1).max(1e4),
174
+ eventExchangePrice7: import_koishi.Schema.number().description("限时卡池7星兑换每抽消耗的水汽量(默认450)").default(450).min(1).max(1e4),
175
+ normalStar7Threshold: import_koishi.Schema.number().description("普通卡池7星保底抽数(默认1500)").default(1500).min(1).max(1e4),
176
+ normalStar6Threshold: import_koishi.Schema.number().description("普通卡池6星保底抽数(默认300)").default(300).min(1).max(1e4),
177
+ normalStar6Prob: import_koishi.Schema.number().description("普通卡池6星保底抽出6星概率百分比(减去为抽出7星概率)").default(90).min(0).max(100),
178
+ eventStar6Threshold: import_koishi.Schema.number().description("限时卡池6星保底抽数(默认200)").default(200).min(1).max(1e4),
179
+ eventStar7Threshold: import_koishi.Schema.number().description("限时卡池7星保底抽数(默认400)").default(400).min(1).max(1e4)
171
180
  });
172
181
  function get_star_symbol(star) {
173
182
  star = Math.max(0, Math.min(7, parseInt(star.toString())));
@@ -410,6 +419,17 @@ async function _shop_draw_image(ctx, session, userName, date, disturbance, vapor
410
419
  }
411
420
  }
412
421
  __name(_shop_draw_image, "_shop_draw_image");
422
+ async function getUnifiedQQ(ctx, session) {
423
+ const userId = session.userId;
424
+ if (/^\d+$/.test(userId)) return userId;
425
+ const records = await ctx.database.get("user_platform_map", {
426
+ platform_user_id: userId
427
+ });
428
+ if (records.length) return records[0].qq;
429
+ ctx.logger.warn(`用户 ${userId} 未绑定QQ号,将使用原始ID`);
430
+ return userId;
431
+ }
432
+ __name(getUnifiedQQ, "getUnifiedQQ");
413
433
  async function _collection_draw_image(ctx, session, titleText, totalText, emptyText, categories, categoryGroup, totalCollected) {
414
434
  ctx.logger.info("开始绘制收藏图片(彻底隔离标题影响终极版)");
415
435
  try {
@@ -603,7 +623,7 @@ async function _ranking_draw_image(ctx, ranking_list, user_rank, user_collected,
603
623
  }
604
624
  __name(_ranking_draw_image, "_ranking_draw_image");
605
625
  async function _do_register(ctx, session, nickname, masterQQ) {
606
- const qq = session.unifiedQQ || session.userId;
626
+ const qq = await getUnifiedQQ(ctx, session);
607
627
  const exist = await ctx.database.get("gacha_user", { qq });
608
628
  if (!exist.length) {
609
629
  await ctx.database.create("gacha_user", { qq, nickname, status: 0, protect: 0 });
@@ -630,8 +650,17 @@ async function _do_register(ctx, session, nickname, masterQQ) {
630
650
  __name(_do_register, "_do_register");
631
651
  async function _do_check(ctx, session, check_qq, masterQQ, all) {
632
652
  ctx.logger.info("========== _do_check 被调用 ==========");
633
- const userQQ = session.unifiedQQ || session.userId;
634
- ctx.logger.info(`[DEBUG] userQQ=${userQQ}, masterQQ=${masterQQ}`);
653
+ const userId = session.userId;
654
+ const isNumeric = /^\d+$/.test(userId);
655
+ let userQQ = userId;
656
+ if (!isNumeric) {
657
+ const records = await ctx.database.get("user_platform_map", {
658
+ platform_user_id: userId
659
+ });
660
+ ctx.logger.info("[手动查询] 映射表结果: " + JSON.stringify(records));
661
+ if (records.length) userQQ = records[0].qq;
662
+ }
663
+ ctx.logger.info(`[手动查询] userQQ=${userQQ}, masterQQ=${masterQQ}`);
635
664
  if (userQQ !== masterQQ) {
636
665
  return await session.send(build_msg(session, session.text("error.common.noPermission")));
637
666
  }
@@ -668,7 +697,7 @@ ${nameList}`));
668
697
  }
669
698
  __name(_do_check, "_do_check");
670
699
  async function _do_sign(ctx, session, signResetHour, signResetMinute) {
671
- const qq = session.unifiedQQ || session.userId;
700
+ const qq = await getUnifiedQQ(ctx, session);
672
701
  const user = await ctx.database.get("gacha_user", { qq });
673
702
  if (!user.length) {
674
703
  await session.send(build_msg(session, session.text("error.common.notRegister")));
@@ -726,11 +755,10 @@ async function _do_sign(ctx, session, signResetHour, signResetMinute) {
726
755
  `${session.text("tip.sign.success")}
727
756
  ${session.text("tip.sign.getDraw", { count: SIGN_DRAW_COUNT, left: newDrawCount })}`
728
757
  ));
729
- await giveDailyBattleShard(ctx, qq);
730
758
  }
731
759
  __name(_do_sign, "_do_sign");
732
760
  async function _do_add_card(ctx, session, card_lines, masterQQ) {
733
- const userQQ = session.unifiedQQ || session.userId;
761
+ const userQQ = await getUnifiedQQ(ctx, session);
734
762
  if (userQQ !== masterQQ) {
735
763
  return await session.send(build_msg(session, session.text("error.common.noPermission")));
736
764
  }
@@ -763,9 +791,9 @@ async function _do_add_card(ctx, session, card_lines, masterQQ) {
763
791
  ));
764
792
  }
765
793
  __name(_do_add_card, "_do_add_card");
766
- async function _do_draw(ctx, session, draw_times) {
794
+ async function _do_draw(ctx, session, draw_times, star7Threshold, star6Threshold, star6Prob) {
767
795
  ctx.logger.info("执行抽卡,次数:", draw_times);
768
- const qq = session.unifiedQQ || session.userId;
796
+ const qq = await getUnifiedQQ(ctx, session);
769
797
  const user = await ctx.database.get("gacha_user", { qq });
770
798
  if (!user.length) return await session.send(build_msg(session, session.text("error.common.notRegister")));
771
799
  const showName = user[0].status === 1 ? user[0].nickname : qq;
@@ -807,9 +835,9 @@ async function _do_draw(ctx, session, draw_times) {
807
835
  const INIT_WATER_VAPOR = { 0: 50, 1: 100, 2: 150, 3: 200, 4: 500, 5: 1e3, 6: 2e3, 7: 5e3 };
808
836
  const UPGRADE_WATER_VAPOR = { 0: 25, 1: 50, 2: 75, 3: 100, 4: 200, 5: 500, 6: 1e3, 7: 2e3 };
809
837
  const GUARANTEE = {
810
- star7Threshold: 1500,
811
- star6Threshold: 300,
812
- star6Prob: 95
838
+ star7Threshold,
839
+ star6Threshold,
840
+ star6Prob
813
841
  };
814
842
  const drawResult = [];
815
843
  let disturbanceTotal = 0;
@@ -927,7 +955,7 @@ async function _do_draw(ctx, session, draw_times) {
927
955
  }
928
956
  __name(_do_draw, "_do_draw");
929
957
  async function _do_warehouse(ctx, session) {
930
- const qq = session.unifiedQQ || session.userId;
958
+ const qq = await getUnifiedQQ(ctx, session);
931
959
  const user = await ctx.database.get("gacha_user", { qq });
932
960
  if (!user.length) return await session.send(build_msg(session, session.text("error.common.notRegister")));
933
961
  const show_name = user[0].status === 1 ? user[0].nickname : qq;
@@ -955,7 +983,7 @@ async function _do_warehouse(ctx, session) {
955
983
  __name(_do_warehouse, "_do_warehouse");
956
984
  async function _do_upgrade(ctx, session, card_ids, signResetHour, signResetMinute) {
957
985
  ctx.logger.info("执行卡牌升格,请求卡片ID列表:", card_ids);
958
- const qq = session.unifiedQQ || session.userId;
986
+ const qq = await getUnifiedQQ(ctx, session);
959
987
  const user = await ctx.database.get("gacha_user", { qq });
960
988
  if (!user.length) return await session.send(build_msg(session, session.text("error.common.notRegister")));
961
989
  if (!card_ids.length) return await session.send(build_msg(session, session.text("error.upgrade.paramInvalid")));
@@ -1064,10 +1092,8 @@ async function _do_upgrade(ctx, session, card_ids, signResetHour, signResetMinut
1064
1092
  await session.send(build_msg(session, msg));
1065
1093
  }
1066
1094
  __name(_do_upgrade, "_do_upgrade");
1067
- async function _do_exchange(ctx, session, exchange_num) {
1068
- const qq = session.unifiedQQ || session.userId;
1069
- const RATIO = 100;
1070
- const DAILY_LIMIT = 80;
1095
+ async function _do_exchange(ctx, session, exchange_num, limit, vaporPerDraw) {
1096
+ const qq = await getUnifiedQQ(ctx, session);
1071
1097
  const todayStart = new Date((/* @__PURE__ */ new Date()).toLocaleDateString()).getTime();
1072
1098
  if (!Number.isInteger(exchange_num) || exchange_num < 1 || exchange_num > 40) {
1073
1099
  ctx.logger.warn(`[普通兑换抽数] 玩家${qq}兑换失败:次数非法(${exchange_num}抽)`);
@@ -1084,17 +1110,17 @@ async function _do_exchange(ctx, session, exchange_num) {
1084
1110
  });
1085
1111
  const usedToday = exchangeRecord.length ? exchangeRecord[0].count : 0;
1086
1112
  const totalApply = usedToday + exchange_num;
1087
- if (totalApply > DAILY_LIMIT) {
1088
- const left = DAILY_LIMIT - usedToday;
1089
- ctx.logger.warn(`[普通兑换抽数] 玩家${qq}兑换失败:今日超限(已兑${usedToday}抽,申请${exchange_num}抽,上限${DAILY_LIMIT}抽)`);
1113
+ if (totalApply > limit) {
1114
+ const left = limit - usedToday;
1115
+ ctx.logger.warn(`[普通兑换抽数] 玩家${qq}兑换失败:今日超限(已兑${usedToday}抽,申请${exchange_num}抽,上限${limit}抽)`);
1090
1116
  return await session.send(build_msg(
1091
1117
  session,
1092
- session.text("error.exchange.dailyLimit", { used: usedToday, apply: exchange_num, limit: DAILY_LIMIT, left })
1118
+ session.text("error.exchange.dailyLimit", { used: usedToday, apply: exchange_num, limit, left })
1093
1119
  ));
1094
1120
  }
1095
1121
  const asset = await ctx.database.get("gacha_user_draw_count", { qq });
1096
1122
  const currentVapor = asset[0]?.water_vapor ?? 0;
1097
- const totalCost = exchange_num * RATIO;
1123
+ const totalCost = exchange_num * vaporPerDraw;
1098
1124
  if (currentVapor < totalCost) {
1099
1125
  ctx.logger.warn(`[普通兑换抽数] 玩家${qq}兑换失败:水汽不足(拥有${currentVapor},需${totalCost})`);
1100
1126
  return await session.send(build_msg(
@@ -1119,7 +1145,7 @@ async function _do_exchange(ctx, session, exchange_num) {
1119
1145
  // 统一用今日0点时间戳作为分组键
1120
1146
  count: totalApply
1121
1147
  }]);
1122
- const leftToday = Math.max(0, DAILY_LIMIT - totalApply);
1148
+ const leftToday = Math.max(0, limit - totalApply);
1123
1149
  await session.send(build_msg(
1124
1150
  session,
1125
1151
  `${session.text("tip.exchange.success")}
@@ -1127,7 +1153,7 @@ ${session.text("tip.exchange.info", {
1127
1153
  count: exchange_num,
1128
1154
  cost: totalCost,
1129
1155
  used: totalApply,
1130
- limit: DAILY_LIMIT,
1156
+ limit,
1131
1157
  left: leftToday
1132
1158
  })}`
1133
1159
  ));
@@ -1137,7 +1163,7 @@ __name(_do_exchange, "_do_exchange");
1137
1163
  async function _do_collection(ctx, session) {
1138
1164
  ctx.logger.info("收到指令:WWC收藏(含限定卡+灰色占位)");
1139
1165
  try {
1140
- const qq = session.unifiedQQ || session.userId;
1166
+ const qq = await getUnifiedQQ(ctx, session);
1141
1167
  const user = await ctx.database.get("gacha_user", { qq });
1142
1168
  if (!user.length) return await session.send(import_koishi.h.text(session.text("error.common.notRegister")));
1143
1169
  const show_name = user[0].status === 1 ? user[0].nickname : qq;
@@ -1213,7 +1239,7 @@ __name(_do_collection, "_do_collection");
1213
1239
  async function _do_shop(ctx, session, signResetHour, signResetMinute) {
1214
1240
  ctx.logger.info("收到指令:WWC店铺(按签到时间刷新版)");
1215
1241
  try {
1216
- const qq = session.unifiedQQ || session.userId;
1242
+ const qq = await getUnifiedQQ(ctx, session);
1217
1243
  const user = await ctx.database.get("gacha_user", { qq });
1218
1244
  if (!user.length) return await session.send(import_koishi.h.text(session.text("error.common.notRegister")));
1219
1245
  const showName = user[0].status === 1 ? user[0].nickname : qq;
@@ -1308,7 +1334,7 @@ __name(_do_shop, "_do_shop");
1308
1334
  async function _do_ranking(ctx, session) {
1309
1335
  ctx.logger.info("WWC排名1 开始执行");
1310
1336
  try {
1311
- const qq = session.unifiedQQ || session.userId;
1337
+ const qq = await getUnifiedQQ(ctx, session);
1312
1338
  const user = await ctx.database.get("gacha_user", { qq });
1313
1339
  if (!user.length) {
1314
1340
  await session.send(build_msg(session, session.text("error.common.notRegister")));
@@ -1374,7 +1400,7 @@ async function _do_ranking(ctx, session) {
1374
1400
  }
1375
1401
  __name(_do_ranking, "_do_ranking");
1376
1402
  async function _do_switch(ctx, session, type, action, masterQQ) {
1377
- const userQQ = session.unifiedQQ || session.userId;
1403
+ const userQQ = await getUnifiedQQ(ctx, session);
1378
1404
  if (userQQ !== masterQQ) {
1379
1405
  ctx.logger.warn(`非主人QQ${session.unifiedQQ || session.userId}尝试操作开关,已拦截`);
1380
1406
  return await session.send(build_msg(session, session.text("error.common.noPermission")));
@@ -1471,8 +1497,8 @@ async function _do_event_status(ctx, session) {
1471
1497
  await session.send(build_msg(session, msg));
1472
1498
  }
1473
1499
  __name(_do_event_status, "_do_event_status");
1474
- async function _do_event_exchange(ctx, session, data) {
1475
- const qq = session.unifiedQQ || session.userId;
1500
+ async function _do_event_exchange(ctx, session, data, price6, price7) {
1501
+ const qq = await getUnifiedQQ(ctx, session);
1476
1502
  const { code, cnt } = data;
1477
1503
  const realCnt = Math.min(Math.max(cnt | 0, 1), 40);
1478
1504
  const user = await ctx.database.get("gacha_user", { qq });
@@ -1481,7 +1507,7 @@ async function _do_event_exchange(ctx, session, data) {
1481
1507
  const ev = events.find((e) => e.code === code);
1482
1508
  if (!ev) return await session.send(build_msg(session, session.text("error.eventExchange.pool.none")));
1483
1509
  const star = ev.card_star;
1484
- const price = star === 6 ? 300 : 450;
1510
+ const price = star === 6 ? price6 : price7;
1485
1511
  const total = price * realCnt;
1486
1512
  const asset = await ctx.database.get("gacha_user_draw_count", { qq });
1487
1513
  const vapor = asset[0]?.water_vapor ?? 0;
@@ -1498,8 +1524,8 @@ async function _do_event_exchange(ctx, session, data) {
1498
1524
  ));
1499
1525
  }
1500
1526
  __name(_do_event_exchange, "_do_event_exchange");
1501
- async function _do_event_draw(ctx, session, data) {
1502
- const qq = session.unifiedQQ || session.userId;
1527
+ async function _do_event_draw(ctx, session, data, event6Threshold, event7Threshold) {
1528
+ const qq = await getUnifiedQQ(ctx, session);
1503
1529
  let code = "";
1504
1530
  let count = 1;
1505
1531
  if (typeof data === "number") {
@@ -1551,8 +1577,7 @@ async function _do_event_draw(ctx, session, data) {
1551
1577
  pityCount: limitStar === 6 ? pityRecord[0].pity6 || 0 : pityRecord[0].pity7 || 0,
1552
1578
  hasGot: limitStar === 6 ? pityRecord[0].got6 || false : pityRecord[0].got7 || false
1553
1579
  };
1554
- const GUARANTEE_THRESHOLD = { 6: 200, 7: 400 };
1555
- const threshold = GUARANTEE_THRESHOLD[limitStar];
1580
+ const threshold = limitStar === 6 ? event6Threshold : event7Threshold;
1556
1581
  await ctx.database.upsert("gacha_user_event_draw", [{ qq, [key]: have - count }]);
1557
1582
  ctx.logger.info(`[限时抽卡] ${showName}(${qq}) 扣除${count}次${limitStar}星限时抽数,剩余${have - count}次`);
1558
1583
  const normalCards = await ctx.database.get("gacha_card_pool", {});
@@ -1753,7 +1778,7 @@ async function _do_event_draw(ctx, session, data) {
1753
1778
  }
1754
1779
  __name(_do_event_draw, "_do_event_draw");
1755
1780
  async function _do_broadcast(ctx, session, msg, masterQQ) {
1756
- const userQQ = session.unifiedQQ || session.userId;
1781
+ const userQQ = await getUnifiedQQ(ctx, session);
1757
1782
  if (userQQ !== masterQQ) return;
1758
1783
  const groups = await ctx.database.get("gacha_group_switch", { status: 1 });
1759
1784
  for (const g of groups) {
@@ -1768,7 +1793,7 @@ async function _do_broadcast(ctx, session, msg, masterQQ) {
1768
1793
  }
1769
1794
  __name(_do_broadcast, "_do_broadcast");
1770
1795
  async function _do_reject(ctx, session, rejectQQ, masterQQ) {
1771
- const userQQ = session.unifiedQQ || session.userId;
1796
+ const userQQ = await getUnifiedQQ(ctx, session);
1772
1797
  if (userQQ !== masterQQ) {
1773
1798
  return await session.send(build_msg(session, "你没有权限执行驳回操作"));
1774
1799
  }
@@ -1802,23 +1827,6 @@ async function _do_reject(ctx, session, rejectQQ, masterQQ) {
1802
1827
  }
1803
1828
  }
1804
1829
  __name(_do_reject, "_do_reject");
1805
- async function giveDailyBattleShard(ctx, qq) {
1806
- let user = await ctx.database.get("gacha_user_battle_shard", { qq });
1807
- let data = user[0] || { qq, target_card_id: "", shard: 0, awake_ticket: 0 };
1808
- const own = await ctx.database.get("gacha_user_card", { qq });
1809
- const pool = await ctx.database.get("gacha_battle_card", {});
1810
- const avail = own.filter(
1811
- (o) => pool.some((p) => p.card_id === o.card_id)
1812
- ).map((o) => o.card_id);
1813
- if (avail.length === 0) return;
1814
- let target = data.target_card_id;
1815
- if (!target || !avail.includes(target)) {
1816
- target = avail[Math.floor(Math.random() * avail.length)];
1817
- }
1818
- data.shard += 2;
1819
- await ctx.database.upsert("gacha_user_battle_shard", [data]);
1820
- }
1821
- __name(giveDailyBattleShard, "giveDailyBattleShard");
1822
1830
  async function _do_help(ctx, session) {
1823
1831
  const helpMsg = session.text("command.wwc.help.title") + "\n" + session.text("command.wwc.help.register") + "\n" + session.text("command.wwc.help.sign") + "\n" + session.text("command.wwc.help.draw") + "\n" + session.text("command.wwc.help.warehouse") + "\n" + session.text("command.wwc.help.shop") + "\n" + session.text("command.wwc.help.upgrade") + "\n" + session.text("command.wwc.help.exchange") + "\n" + session.text("command.wwc.help.collection") + "\n" + session.text("command.wwc.help.ranking") + "\n" + session.text("command.wwc.help.eventStatus") + "\n" + session.text("command.wwc.help.eventDraw") + "\n" + session.text("command.wwc.help.eventExchange") + "\n" + session.text("command.wwc.help.tip");
1824
1832
  await session.send(build_msg(session, helpMsg));
@@ -1974,13 +1982,18 @@ async function apply(ctx, config) {
1974
1982
  await _do_register(ctx, session, nickname, config.masterQQ);
1975
1983
  });
1976
1984
  ctx.command("WWC审核 [QQ]", "审核用户昵称,仅主人可用").option("-a, --all", "通过所有待审核用户").alias("wwc审核").alias("WWC通过").action(async (argv, qq) => {
1977
- ctx.logger.info("[WWC审核] action 被触发,argv.options=" + JSON.stringify(argv.options));
1978
- if (!argv.session) {
1979
- ctx.logger.info("[WWC审核] argv.session 为空,返回");
1980
- return;
1981
- }
1985
+ ctx.logger.info("[WWC审核] action 触发,argv.options=" + JSON.stringify(argv.options));
1986
+ if (!argv.session) return;
1982
1987
  const session = argv.session;
1983
- const isAll = !!argv.options?.["all"];
1988
+ let isAll = !!(argv.options?.["all"] || argv.options?.["a"] || argv.options?.["-a"] || argv.options?.["--all"] || argv.options?.["-a, --all"]);
1989
+ if (!isAll) {
1990
+ const raw = session.content || "";
1991
+ const hasAOption = /(?:^|\s)-a(?:\s|$)/.test(raw) || /(?:^|\s)--all(?:\s|$)/.test(raw);
1992
+ if (hasAOption) {
1993
+ isAll = true;
1994
+ ctx.logger.info("[WWC审核] 消息内容识别到 -a 或 --all");
1995
+ }
1996
+ }
1984
1997
  ctx.logger.info("[WWC审核] isAll=" + isAll + ", qq=" + qq);
1985
1998
  await _do_check(ctx, session, qq, config.masterQQ, isAll);
1986
1999
  });
@@ -2005,7 +2018,7 @@ async function apply(ctx, config) {
2005
2018
  const session = argv.session;
2006
2019
  const num = Number(count);
2007
2020
  const times = Number.isInteger(num) && num >= 1 && num <= 20 ? num : 1;
2008
- await _do_draw(ctx, session, times);
2021
+ await _do_draw(ctx, session, times, config.normalStar7Threshold, config.normalStar6Threshold, config.normalStar6Prob);
2009
2022
  });
2010
2023
  ctx.command("WWC仓库", "查看已拥有卡片,含等级/星级/限定标记,生成可视化图片").alias("wwc仓库").alias("WWC我的卡片").action(async (argv) => {
2011
2024
  if (!argv.session) return;
@@ -2023,11 +2036,11 @@ async function apply(ctx, config) {
2023
2036
  const validIds = cardIds.filter((id) => id.trim());
2024
2037
  await _do_upgrade(ctx, session, validIds, config.signResetHour, config.signResetMinute);
2025
2038
  });
2026
- ctx.command("WWC兑换 <次数>", "水汽兑换普通抽数,100水汽=1抽,每日上限80抽,单次1-40").alias("wwc兑换").alias("WWC水汽兑换").action(async (argv, count) => {
2039
+ ctx.command("WWC兑换 <次数>", "水汽兑换普通抽数,100水汽=1抽,每日上限由配置决定,单次1-40").alias("wwc兑换").alias("WWC水汽兑换").action(async (argv, count) => {
2027
2040
  if (!argv.session) return;
2028
2041
  const session = argv.session;
2029
2042
  const num = Number.isInteger(Number(count)) && Number(count) >= 1 && Number(count) <= 40 ? Number(count) : 1;
2030
- await _do_exchange(ctx, session, num);
2043
+ await _do_exchange(ctx, session, num, config.dailyExchangeLimit, config.exchangeVaporPerDraw);
2031
2044
  });
2032
2045
  ctx.command("WWC收藏", "查看卡片收藏进度,含限定卡,生成可视化收藏图").alias("wwc收藏").alias("WWC收集进度").action(async (argv) => {
2033
2046
  if (!argv.session) return;
@@ -2071,14 +2084,14 @@ async function apply(ctx, config) {
2071
2084
  const times = Number.isInteger(num) && num >= 1 && num <= 20 ? num : 1;
2072
2085
  let data = times;
2073
2086
  if (code) data = `${code} ${times}`;
2074
- await _do_event_draw(ctx, session, data);
2087
+ await _do_event_draw(ctx, session, data, config.eventStar6Threshold, config.eventStar7Threshold);
2075
2088
  });
2076
2089
  ctx.command("WWC限时兑换 <期数> [次数]", "水汽兑换限时抽数,6星300/抽,7星450/抽,单次1-40").alias("wwc限时兑换").alias("WWC限时换抽").action(async (argv, code, count) => {
2077
2090
  if (!argv.session || !code) return;
2078
2091
  const session = argv.session;
2079
2092
  const num = Number(count);
2080
2093
  const cnt = Number.isInteger(num) && num >= 1 && num <= 40 ? num : 1;
2081
- await _do_event_exchange(ctx, session, { code, cnt });
2094
+ await _do_event_exchange(ctx, session, { code, cnt }, config.eventExchangePrice6, config.eventExchangePrice7);
2082
2095
  });
2083
2096
  ctx.command("WWC限时录入 <参数...>", "录入限时卡池信息,仅主人可用(格式:期数 ID 名称 星级 类别 开始戳 结束戳)").alias("wwc限时录入").action(async (argv, ...params) => {
2084
2097
  if (!argv.session) return;
@@ -2108,6 +2121,14 @@ async function apply(ctx, config) {
2108
2121
  if (!/^\d+$/.test(qq)) {
2109
2122
  return session.send("请输入正确的QQ号(纯数字)。");
2110
2123
  }
2124
+ const existingQQ = await ctx.database.get("user_platform_map", {
2125
+ qq
2126
+ });
2127
+ if (existingQQ.length > 0) {
2128
+ if (existingQQ[0].platform_user_id !== userId) {
2129
+ return session.send(`❌ 该QQ号 ${qq} 已被其他用户绑定,无法重复绑定。`);
2130
+ }
2131
+ }
2111
2132
  const exist = await ctx.database.get("user_platform_map", {
2112
2133
  platform,
2113
2134
  platform_user_id: userId
@@ -2133,7 +2154,6 @@ async function apply(ctx, config) {
2133
2154
  if (!raw.startsWith("WWC")) return next();
2134
2155
  if (raw.startsWith("WWC绑定QQ")) return next();
2135
2156
  const userId = session.userId;
2136
- const platform = session.platform;
2137
2157
  const isNumeric = /^\d+$/.test(userId);
2138
2158
  let unifiedQQ = null;
2139
2159
  if (isNumeric) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-xxck-1",
3
3
  "description": "抽卡系统|完整指令说明见readme|建议使用skia-canvas",
4
- "version": "0.2.49",
4
+ "version": "0.2.51",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [