koishi-plugin-rocom 1.0.1 → 1.0.3

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.
Files changed (104) hide show
  1. package/lib/client.d.ts +1 -0
  2. package/lib/client.js +75 -10
  3. package/lib/commands/query.js +9 -1
  4. package/lib/img/1-1.DsrH8HWs.png +0 -0
  5. package/lib/img/1-2.C_m0bWhF.png +0 -0
  6. package/lib/img/1-3.RCKDHs5T.png +0 -0
  7. package/lib/img/1-4.uUZC0ie8.png +0 -0
  8. package/lib/img/1-5.RVh9H-hd.png +0 -0
  9. package/lib/img/2-1.DtFVG_cL.png +0 -0
  10. package/lib/img/2-2.D9q6Kuvh.png +0 -0
  11. package/lib/img/2-3.CEMPtBOM.png +0 -0
  12. package/lib/img/2-4.CTt_IEn-.png +0 -0
  13. package/lib/img/2-5.DHDw2Rte.png +0 -0
  14. package/lib/img/3-1.BxPdoaGp.png +0 -0
  15. package/lib/img/3-2.DL9tvB29.png +0 -0
  16. package/lib/img/3-3.DV4kIcUj.png +0 -0
  17. package/lib/img/3-4.BIjdgjzd.png +0 -0
  18. package/lib/img/3-5.CTb-wcJw.png +0 -0
  19. package/lib/img/4-1.BqNyzyq3.png +0 -0
  20. package/lib/img/4-2.Dv_8-ets.png +0 -0
  21. package/lib/img/4-3.CqfVc4t4.png +0 -0
  22. package/lib/img/4-4.BJfb6KYO.png +0 -0
  23. package/lib/img/4-5.CBpEGv60.png +0 -0
  24. package/lib/img/5-1.CvocExIf.png +0 -0
  25. package/lib/img/5-2.t1A1x2Pk.png +0 -0
  26. package/lib/img/5-3.DLqxSx5c.png +0 -0
  27. package/lib/img/5-4.CoNuzHM6.png +0 -0
  28. package/lib/img/5-5.QBGkXfhC.png +0 -0
  29. package/lib/img/6-1.BRlbvdwy.png +0 -0
  30. package/lib/img/6-2.DXVquVOt.png +0 -0
  31. package/lib/img/6-3.Cwq4ZJJB.png +0 -0
  32. package/lib/img/6-4.D4r99Vq9.png +0 -0
  33. package/lib/img/6-5.BBIcXS3X.png +0 -0
  34. package/lib/img/7.Wku3bA4b.png +0 -0
  35. package/lib/img/IMG_20260413_235405.png +0 -0
  36. package/lib/img/WEGAME Ai /346/264/233/345/205/213/346/241/243/346/241/210.png +0 -0
  37. package/lib/img/ad-card.DUI6osKw.png +0 -0
  38. package/lib/img/ai/345/215/241/347/211/207.png +0 -0
  39. package/lib/img/ai/347/202/271/350/257/204/345/255/227/346/256/265bg.png +0 -0
  40. package/lib/img/ai/350/257/204/345/210/206 /345/255/227/346/240/267.png +0 -0
  41. package/lib/img/ai/350/257/204/345/210/206 /350/257/204/345/210/206bg.png +0 -0
  42. package/lib/img/authorize-benefit-bg.our9Ftwk.png +0 -0
  43. package/lib/img/authorize-benefit-img1.DVKFtajb.png +0 -0
  44. package/lib/img/authorize-benefit-inside-bg.DruwTvcR.png +0 -0
  45. package/lib/img/authorize-completed-card-bg.BPW096BZ.png +0 -0
  46. package/lib/img/authorize-completed-card-photo-bg.6Vo9vsjF.png +0 -0
  47. package/lib/img/authorize-completed-header-title.DVcuWKye.png +0 -0
  48. package/lib/img/authorize-header-title.DmTqaMIN.png +0 -0
  49. package/lib/img/authorize-layout-bg-top.DYkKpjn1.png +0 -0
  50. package/lib/img/authorize-layout-bg.C0zTfHsR.png +0 -0
  51. package/lib/img/authorize-qrcode-img-line.DELzcNEj.png +0 -0
  52. package/lib/img/authorize-result-btn-hover.BxebZ_7p.png +0 -0
  53. package/lib/img/authorize-result-btn-normal.p5Vbuw2Q.png +0 -0
  54. package/lib/img/bg.C8CUoi7I.jpg +0 -0
  55. package/lib/img/coin.png +0 -0
  56. package/lib/img/eit-logo.png +0 -0
  57. package/lib/img/ercode-bg.D1ccSQKH.png +0 -0
  58. package/lib/img/fail-icon.ChpzWjNv.png +0 -0
  59. package/lib/img/icon-btn-decorate.Dwyrlnvx.png +0 -0
  60. package/lib/img/icon-chapter.DoUojjEg.png +0 -0
  61. package/lib/img/icon-decorative-book.6KbZJc7F.png +0 -0
  62. package/lib/img/icon-stay-tuned.DHbzz5us.png +0 -0
  63. package/lib/img/logo.cVSpb3sL.png +0 -0
  64. package/lib/img/menu-down.png +0 -0
  65. package/lib/img/menu-up.png +0 -0
  66. package/lib/img/player-bg.png +0 -0
  67. package/lib/img/record-bg.C1mPRb4R.png +0 -0
  68. package/lib/img/roco_icon.png +0 -0
  69. package/lib/img/stats-title.BG5ocjGh.png +0 -0
  70. package/lib/img/wallpaper-pop-l.C8icd3Bp.png +0 -0
  71. package/lib/img/wallpaper-pop.CnlU6_jf.png +0 -0
  72. package/lib/img/win-bg-2.CLgPHdP3.png +0 -0
  73. package/lib/img/win-bg.BgshV29m.png +0 -0
  74. package/lib/img/win-icon.DJfsgL3i.png +0 -0
  75. package/lib/img/xueyingwawa.png +0 -0
  76. package/lib/img/yuanxingshangren.png +0 -0
  77. package/lib/img//344/272/206/344/270/215/350/265/267/347/262/276/347/201/265 half.png +0 -0
  78. package/lib/img//345/215/241/347/211/207/346/225/264/344/275/223bg.png +0 -0
  79. package/lib/img//345/244/264/345/203/217/351/273/221/350/211/262/345/234/206/345/272/225.png +0 -0
  80. package/lib/img//345/256/235/347/256/261/346/240/207-/351/273/221/347/231/275.png +0 -0
  81. package/lib/img//345/256/235/347/256/261/346/240/207.png +0 -0
  82. package/lib/img//345/260/217/346/264/233/345/205/213.png +0 -0
  83. package/lib/img//345/274/202/350/211/262/347/262/276/347/201/265 half.png +0 -0
  84. package/lib/img//346/204/237/345/217/271/345/217/267/357/274/214/344/270/215/347/237/245/351/201/223/345/223/252/351/207/214/350/203/275/347/224/250.png +0 -0
  85. package/lib/img//346/204/237/345/217/271/345/217/267/357/274/214/345/201/217/346/267/261/350/211/262.png +0 -0
  86. package/lib/img//346/220/234/351/233/206/346/203/205/345/206/265.png +0 -0
  87. package/lib/img//346/234/254/345/221/250/350/276/276/345/256/240/345/255/227/346/240/267.png +0 -0
  88. package/lib/img//346/264/233/345/205/213/347/216/213/345/233/275/345/244/247/346/240/207/351/242/230-/347/231/275.png +0 -0
  89. package/lib/img//346/265/205/350/211/262bg.png +0 -0
  90. package/lib/img//346/267/261/350/211/262bg.png +0 -0
  91. package/lib/img//347/202/253/345/275/251/347/262/276/347/201/265 half.png +0 -0
  92. package/lib/img//347/262/276/347/201/265pg.png +0 -0
  93. package/lib/index.js +169 -33
  94. package/lib/render-templates/bind-list/style.css +1 -2
  95. package/lib/render-templates/menu/index.html +3 -3
  96. package/lib/render-templates/package/style.css +1 -2
  97. package/lib/render-templates/personal-card/style.css +1 -1
  98. package/lib/render-templates/record/style.css +2 -3
  99. package/lib/ttf/HYWenHei-85W-1.ttf +0 -0
  100. package/lib/ttf/dundun.xHd_Ee5-.woff2 +0 -0
  101. package/lib/ttf/fzlant.D5FI9Et0.ttf +0 -0
  102. package/package.json +2 -2
  103. package/readme.md +586 -575
  104. package/lib/render-templates/searcheggs/eggs.py +0 -599
package/lib/index.js CHANGED
@@ -59,9 +59,9 @@ var RocomClient = class {
59
59
  if (!uid) return "";
60
60
  return uid.trim().replace(/[^a-zA-Z0-9_\- \u4e00-\u9fa5]/g, "").trim();
61
61
  }
62
- wegameHeaders(fwToken = "", userIdentifier = "", clientType = "", clientId = "") {
62
+ wegameHeaders(fwToken = "", userIdentifier = "", clientType = "", clientId = "", includeApiKey = true) {
63
63
  const headers = {};
64
- if (this.apiKey) headers["X-API-Key"] = this.apiKey;
64
+ if (includeApiKey && this.apiKey) headers["X-API-Key"] = this.apiKey;
65
65
  if (fwToken) headers["X-Framework-Token"] = fwToken;
66
66
  if (userIdentifier) headers["X-User-Identifier"] = this.sanitizeUid(userIdentifier);
67
67
  if (clientType) headers["X-Client-Type"] = clientType;
@@ -123,6 +123,10 @@ var RocomClient = class {
123
123
  return String(value);
124
124
  }
125
125
  }
126
+ isApiKeyPermissionUndeclaredError(message) {
127
+ if (!message) return false;
128
+ return /未声明\s*api\s*key\s*权限|api\s*key\s*permission|api key 权限/i.test(message);
129
+ }
126
130
  logRequestFailureDetails(method, path6, headers, params, body, errorOrResponse) {
127
131
  const err = errorOrResponse;
128
132
  const response = err?.response;
@@ -265,12 +269,12 @@ ${this.stringifyForLog(details)}`);
265
269
  return { status: null, data: null };
266
270
  }
267
271
  }
268
- async getIngameTask(ctx, taskId) {
272
+ async getIngameTask(ctx, taskId, includeApiKey = true) {
269
273
  return this.requestWithStatus(
270
274
  ctx,
271
275
  "GET",
272
276
  `/api/v1/games/rocom/ingame/tasks/${taskId}`,
273
- this.wegameHeaders(),
277
+ this.wegameHeaders("", "", "", "", includeApiKey),
274
278
  { acceptedStatuses: [200, 202] }
275
279
  );
276
280
  }
@@ -358,7 +362,8 @@ ${this.stringifyForLog(details)}`);
358
362
  return null;
359
363
  }
360
364
  const path6 = "/api/v1/games/rocom/ingame/player/search";
361
- const headers = this.wegameHeaders();
365
+ let includeApiKey = true;
366
+ let headers = this.wegameHeaders();
362
367
  const payload = { uid: sanitizedUid, wait_ms: 5e3 };
363
368
  let { status, data } = await this.requestWithStatus(ctx, "POST", path6, headers, {
364
369
  json: payload,
@@ -374,6 +379,27 @@ ${this.stringifyForLog(details)}`);
374
379
  data = fallback.data;
375
380
  if (status === 200 && data && this.isIngamePlayerPayload(data)) return data;
376
381
  }
382
+ if (status === null && includeApiKey && this.apiKey && this.isApiKeyPermissionUndeclaredError(this.getLastError(""))) {
383
+ logger.warn("ingame/player/search rejected X-API-Key, retrying without API key");
384
+ includeApiKey = false;
385
+ headers = this.wegameHeaders("", "", "", "", false);
386
+ const retry = await this.requestWithStatus(ctx, "POST", path6, headers, {
387
+ json: payload,
388
+ acceptedStatuses: [200, 202]
389
+ });
390
+ status = retry.status;
391
+ data = retry.data;
392
+ if (status === 200 && data && this.isIngamePlayerPayload(data)) return data;
393
+ if (status === null) {
394
+ const fallback = await this.requestWithStatus(ctx, "GET", path6, headers, {
395
+ params: payload,
396
+ acceptedStatuses: [200, 202]
397
+ });
398
+ status = fallback.status;
399
+ data = fallback.data;
400
+ if (status === 200 && data && this.isIngamePlayerPayload(data)) return data;
401
+ }
402
+ }
377
403
  if (!data) return null;
378
404
  if (this.isIngamePlayerPayload(data)) return data;
379
405
  const taskId = data.task_id || data.taskId || data.taskID;
@@ -383,7 +409,7 @@ ${this.stringifyForLog(details)}`);
383
409
  }
384
410
  for (let i = 0; i < 8; i++) {
385
411
  await new Promise((resolve) => setTimeout(resolve, 1e3));
386
- const task = await this.getIngameTask(ctx, taskId);
412
+ const task = await this.getIngameTask(ctx, taskId, includeApiKey);
387
413
  if (task.status === 200) return task.data;
388
414
  if (task.status === null) return null;
389
415
  }
@@ -416,7 +442,8 @@ ${this.stringifyForLog(details)}`);
416
442
  return null;
417
443
  }
418
444
  const path6 = "/api/v1/games/rocom/ingame/home/info";
419
- const headers = this.wegameHeaders();
445
+ let includeApiKey = true;
446
+ let headers = this.wegameHeaders();
420
447
  const payload = { uid: sanitizedUid, wait_ms: waitMs };
421
448
  let { status, data } = await this.requestWithStatus(ctx, "POST", path6, headers, {
422
449
  json: payload,
@@ -432,6 +459,27 @@ ${this.stringifyForLog(details)}`);
432
459
  data = fallback.data;
433
460
  if (status === 200 && data && !(data.task_id || data.taskId || data.taskID)) return data;
434
461
  }
462
+ if (status === null && includeApiKey && this.apiKey && this.isApiKeyPermissionUndeclaredError(this.getLastError(""))) {
463
+ logger.warn("ingame/home/info rejected X-API-Key, retrying without API key");
464
+ includeApiKey = false;
465
+ headers = this.wegameHeaders("", "", "", "", false);
466
+ const retry = await this.requestWithStatus(ctx, "POST", path6, headers, {
467
+ json: payload,
468
+ acceptedStatuses: [200, 202]
469
+ });
470
+ status = retry.status;
471
+ data = retry.data;
472
+ if (status === 200 && data && !(data.task_id || data.taskId || data.taskID)) return data;
473
+ if (status === null) {
474
+ const fallback = await this.requestWithStatus(ctx, "GET", path6, headers, {
475
+ params: payload,
476
+ acceptedStatuses: [200, 202]
477
+ });
478
+ status = fallback.status;
479
+ data = fallback.data;
480
+ if (status === 200 && data && !(data.task_id || data.taskId || data.taskID)) return data;
481
+ }
482
+ }
435
483
  const taskId = data?.task_id || data?.taskId || data?.taskID;
436
484
  if (!taskId) {
437
485
  if (status === 202) this.setLastError("家园查询任务已入队,但未返回 task_id");
@@ -439,7 +487,7 @@ ${this.stringifyForLog(details)}`);
439
487
  }
440
488
  for (let i = 0; i < 10; i++) {
441
489
  await new Promise((resolve) => setTimeout(resolve, 1e3));
442
- const task = await this.getIngameTask(ctx, taskId);
490
+ const task = await this.getIngameTask(ctx, taskId, includeApiKey);
443
491
  if (task.status === 200) return task.data;
444
492
  if (task.status === null) return null;
445
493
  }
@@ -448,15 +496,31 @@ ${this.stringifyForLog(details)}`);
448
496
  }
449
497
  async ingameMerchantInfo(ctx, shopId) {
450
498
  const params = { shop_id: shopId };
499
+ let headers = this.wegameHeaders();
451
500
  const data = await this.get(
452
501
  ctx,
453
502
  "/api/v1/games/rocom/ingame/merchant/info",
454
- this.wegameHeaders(),
503
+ headers,
455
504
  params,
456
505
  { silentFailureDetails: true }
457
506
  );
458
507
  if (data) return data;
459
- return this.post(ctx, "/api/v1/games/rocom/ingame/merchant/info", this.wegameHeaders(), params);
508
+ const postData = await this.post(ctx, "/api/v1/games/rocom/ingame/merchant/info", headers, params);
509
+ if (postData) return postData;
510
+ if (this.apiKey && this.isApiKeyPermissionUndeclaredError(this.getLastError(""))) {
511
+ logger.warn("ingame/merchant/info rejected X-API-Key, retrying without API key");
512
+ headers = this.wegameHeaders("", "", "", "", false);
513
+ const fallbackData = await this.get(
514
+ ctx,
515
+ "/api/v1/games/rocom/ingame/merchant/info",
516
+ headers,
517
+ params,
518
+ { silentFailureDetails: true }
519
+ );
520
+ if (fallbackData) return fallbackData;
521
+ return this.post(ctx, "/api/v1/games/rocom/ingame/merchant/info", headers, params);
522
+ }
523
+ return null;
460
524
  }
461
525
  async getFriendship(ctx, fwToken, userIds, userIdentifier = "") {
462
526
  return this.get(
@@ -2323,9 +2387,18 @@ function homePlantIcon(deps, iconId) {
2323
2387
  }
2324
2388
  __name(homePlantIcon, "homePlantIcon");
2325
2389
  var homePlantMapCache = null;
2390
+ var HOME_PLANT_MAP_RELATIVE_PATH = import_node_path4.default.join("render-templates", "home", "data", "home_item_list.json");
2391
+ function resolveHomePlantMapPath() {
2392
+ const candidates = [
2393
+ import_node_path4.default.resolve(__dirname, "..", HOME_PLANT_MAP_RELATIVE_PATH),
2394
+ import_node_path4.default.resolve(__dirname, HOME_PLANT_MAP_RELATIVE_PATH)
2395
+ ];
2396
+ return candidates.find((candidate) => import_node_fs4.default.existsSync(candidate)) || candidates[0];
2397
+ }
2398
+ __name(resolveHomePlantMapPath, "resolveHomePlantMapPath");
2326
2399
  function loadHomePlantMap() {
2327
2400
  if (homePlantMapCache) return homePlantMapCache;
2328
- const filePath = import_node_path4.default.resolve(__dirname, "..", "render-templates", "home", "data", "home_item_list.json");
2401
+ const filePath = resolveHomePlantMapPath();
2329
2402
  try {
2330
2403
  const data = JSON.parse(import_node_fs4.default.readFileSync(filePath, "utf-8"));
2331
2404
  homePlantMapCache = data && typeof data === "object" ? data : {};
@@ -3672,27 +3745,99 @@ __name(register6, "register");
3672
3745
  // src/index.ts
3673
3746
  var name = "rocom";
3674
3747
  var inject = { required: ["puppeteer", "database"] };
3748
+ var MENU_PAGE_TITLE = "洛克王国帮助菜单";
3749
+ var MENU_PAGE_SUBTITLE = "输入对应命令可查看功能,部分数据查询需要先完成账号绑定。";
3750
+ var MENU_GROUPS = [
3751
+ {
3752
+ groupTitle: "账号管理",
3753
+ menuItems: [
3754
+ { cmd: "洛克.QQ登录", desc: "QQ 扫码绑定账号" },
3755
+ { cmd: "洛克.微信登录", desc: "微信扫码绑定账号" },
3756
+ { cmd: "洛克.导入", desc: "导入 WeGame 凭证" },
3757
+ { cmd: "洛克.绑定列表", desc: "查看已绑定账号" },
3758
+ { cmd: "洛克.切换", desc: "切换主账号" },
3759
+ { cmd: "洛克.解绑", desc: "删除绑定账号" },
3760
+ { cmd: "洛克.刷新", desc: "刷新当前凭证" }
3761
+ ]
3762
+ },
3763
+ {
3764
+ groupTitle: "数据查询",
3765
+ menuItems: [
3766
+ { cmd: "洛克.档案", desc: "查看个人档案" },
3767
+ { cmd: "洛克.战绩", desc: "查看对战战绩" },
3768
+ { cmd: "洛克.背包", desc: "查看精灵背包" },
3769
+ { cmd: "洛克.阵容", desc: "查看阵容推荐" },
3770
+ { cmd: "查看阵容", desc: "查看阵容详情" },
3771
+ { cmd: "洛克.交换大厅", desc: "查看交换大厅" },
3772
+ { cmd: "洛克.玩家", desc: "查询 ingame 玩家资料" },
3773
+ { cmd: "洛克.家园", desc: "查询家园菜园" },
3774
+ { cmd: "洛克.商店", desc: "查询 ingame 商店" },
3775
+ { cmd: "洛克.好友关系", desc: "查询好友关系" },
3776
+ { cmd: "洛克.学生", desc: "查询学生认证与福利" }
3777
+ ]
3778
+ },
3779
+ {
3780
+ groupTitle: "订阅推送",
3781
+ menuItems: [
3782
+ { cmd: "远行商人", desc: "查看当前商品" },
3783
+ { cmd: "订阅远行商人", desc: "订阅商品提醒" },
3784
+ { cmd: "取消订阅远行商人", desc: "取消商人提醒" },
3785
+ { cmd: "订阅家园菜园", desc: "菜园成熟提醒" },
3786
+ { cmd: "订阅家园灵感", desc: "精灵灵感提醒" },
3787
+ { cmd: "取消订阅家园", desc: "取消家园订阅" }
3788
+ ]
3789
+ },
3790
+ {
3791
+ groupTitle: "百科与查蛋",
3792
+ menuItems: [
3793
+ { cmd: "洛克.wiki", desc: "精灵 Wiki 查询" },
3794
+ { cmd: "洛克.技能", desc: "技能 Wiki 查询" },
3795
+ { cmd: "洛克.查蛋", desc: "精灵查蛋 / 尺寸反查" },
3796
+ { cmd: "洛克.配种", desc: "配种查询" }
3797
+ ]
3798
+ }
3799
+ ];
3800
+ function buildMenuRenderData() {
3801
+ return {
3802
+ pageTitle: MENU_PAGE_TITLE,
3803
+ pageSubtitle: MENU_PAGE_SUBTITLE,
3804
+ menuGroups: MENU_GROUPS
3805
+ };
3806
+ }
3807
+ __name(buildMenuRenderData, "buildMenuRenderData");
3808
+ function buildMenuFallbackText() {
3809
+ const lines = [MENU_PAGE_TITLE, MENU_PAGE_SUBTITLE, ""];
3810
+ for (const group of MENU_GROUPS) {
3811
+ lines.push(group.groupTitle);
3812
+ for (const item of group.menuItems) {
3813
+ lines.push(` ${item.cmd} - ${item.desc}`);
3814
+ }
3815
+ lines.push("");
3816
+ }
3817
+ return lines.join("\n").trimEnd();
3818
+ }
3819
+ __name(buildMenuFallbackText, "buildMenuFallbackText");
3675
3820
  var Config = import_koishi11.Schema.intersect([
3676
3821
  import_koishi11.Schema.object({
3677
3822
  apiBaseUrl: import_koishi11.Schema.string().default("https://wegame.shallow.ink").description("API 基础地址"),
3678
3823
  wegameApiKey: import_koishi11.Schema.string().default("").description("WeGame API Key"),
3679
- qqLoginDebugMode: import_koishi11.Schema.boolean().default(false).description("QQ 扫码登录调试模式:扫码成功后输出用户 fwt(敏感凭证,请仅调试时开启)"),
3680
- adminUserIds: import_koishi11.Schema.array(String).default([]).description("管理员用户 ID 列表(仅用于管理员命令)"),
3824
+ qqLoginDebugMode: import_koishi11.Schema.boolean().default(false).description("QQ 扫码登录调试模式,仅调试时开启"),
3825
+ adminUserIds: import_koishi11.Schema.array(String).default([]).description("管理员用户 ID 列表"),
3681
3826
  autoRefreshEnabled: import_koishi11.Schema.boolean().default(false).description("启用自动刷新凭证"),
3682
3827
  autoRefreshTime: import_koishi11.Schema.array(String).default(["00:00", "12:00"]).description("自动刷新时间")
3683
3828
  }).description("基础设置"),
3684
3829
  import_koishi11.Schema.object({
3685
- imageCompressionEnabled: import_koishi11.Schema.boolean().default(true).description("发送图片前启用 PNG 无损压缩。失败或压缩后不更小时会发送原图。"),
3686
- imageCompressionMinBytes: import_koishi11.Schema.number().default(262144).description("触发压缩的最小图片大小,单位字节。低于此大小直接发送原图。"),
3687
- imageCompressionLevel: import_koishi11.Schema.number().min(0).max(9).default(9).description("PNG zlib 压缩等级,0-9,数值越大越慢但通常更小。")
3830
+ imageCompressionEnabled: import_koishi11.Schema.boolean().default(true).description("发送图片前启用 PNG 无损压缩"),
3831
+ imageCompressionMinBytes: import_koishi11.Schema.number().default(262144).description("触发压缩的最小图片大小,单位字节"),
3832
+ imageCompressionLevel: import_koishi11.Schema.number().min(0).max(9).default(9).description("PNG zlib 压缩等级 0-9")
3688
3833
  }).description("图片压缩设置"),
3689
3834
  import_koishi11.Schema.object({
3690
3835
  merchantSubscriptionEnabled: import_koishi11.Schema.boolean().default(true).description("启用远行商人订阅"),
3691
- merchantSubscriptionItems: import_koishi11.Schema.array(String).default(["国王球", "棱镜球", "炫彩精灵蛋"]).description("默认订阅商品"),
3692
- merchantCheckInterval: import_koishi11.Schema.number().default(3e5).description("商人检查间隔(ms)"),
3836
+ merchantSubscriptionItems: import_koishi11.Schema.array(String).default(["国王球", "梅花镜球", "炫彩精灵蛋"]).description("默认订阅商品"),
3837
+ merchantCheckInterval: import_koishi11.Schema.number().default(3e5).description("商人检查间隔,单位毫秒"),
3693
3838
  merchantPrivateSubscriptionEnabled: import_koishi11.Schema.boolean().default(true).description("允许个人私聊订阅远行商人推送"),
3694
3839
  homeSubscriptionEnabled: import_koishi11.Schema.boolean().default(true).description("启用家园菜园和灵感订阅推送"),
3695
- homeSubscriptionIntervalMinutes: import_koishi11.Schema.number().default(5).description("家园订阅检查间隔(分钟)")
3840
+ homeSubscriptionIntervalMinutes: import_koishi11.Schema.number().default(5).description("家园订阅检查间隔,单位分钟")
3696
3841
  }).description("订阅推送设置")
3697
3842
  ]);
3698
3843
  function apply(ctx, config) {
@@ -3715,20 +3860,11 @@ function apply(ctx, config) {
3715
3860
  console.warn(`[rocom] legacy framework token migration failed: ${err}`);
3716
3861
  });
3717
3862
  });
3718
- ctx.command("洛克", "洛克王国帮助菜单").action(async () => [
3719
- "【洛克王国插件】",
3720
- "",
3721
- "📋 账号管理:",
3722
- " 洛克.QQ登录 / 洛克.微信登录 / 洛克.导入",
3723
- " 洛克.绑定列表 / 洛克.切换 / 洛克.解绑 / 洛克.刷新",
3724
- "",
3725
- "📊 数据查询:",
3726
- " 洛克.档案 / 洛克.战绩 / 洛克.背包 / 洛克.阵容",
3727
- " 洛克.交换大厅 / 远行商人 / 订阅远行商人",
3728
- "",
3729
- "📖 百科查询:",
3730
- " 洛克.wiki / 洛克.技能 / 洛克.查蛋 / 洛克.配种"
3731
- ].join("\n"));
3863
+ ctx.command("洛克", "洛克王国帮助菜单").action(async ({ session }) => {
3864
+ if (!session?.send) return buildMenuFallbackText();
3865
+ const png = await renderer.renderHtml(ctx, "menu", buildMenuRenderData());
3866
+ await sendImageWithFallback(session, png, buildMenuFallbackText(), "menu:main", config);
3867
+ });
3732
3868
  register(deps);
3733
3869
  register2(deps);
3734
3870
  register3(deps);
@@ -1,7 +1,6 @@
1
1
  @font-face {
2
2
  font-family: 'mianfeiziti';
3
- src: url('../../ttf/dundun.xHd_Ee5-.woff2') format('woff2'),
4
- url('../../ttf/dundun.BCbg_KoL.ttf') format('truetype');
3
+ src: url('../../ttf/dundun.xHd_Ee5-.woff2') format('woff2');
5
4
  font-display: swap;
6
5
  }
7
6
 
@@ -1,4 +1,4 @@
1
- <!DOCTYPE html>
1
+ <!DOCTYPE html>
2
2
  <html lang="zh-CN">
3
3
  <head>
4
4
  <meta charset="utf-8">
@@ -8,7 +8,7 @@
8
8
  </head>
9
9
  <body class="page-out-client">
10
10
  <div class="menu-cont page-section-main">
11
- <img class="xiaoluoke-overlay" src="{{_res_path}}img/小洛克.png" onerror="this.style.display='none'">
11
+ <img class="xiaoluoke-overlay" src="{{_res_path}}img/xueyingwawa.png" onerror="this.style.display='none'">
12
12
  <div class="menu-page">
13
13
  <div class="header-center">
14
14
  <div class="page-title">{{pageTitle}}</div>
@@ -29,7 +29,7 @@
29
29
  </div>
30
30
  {{/each}}
31
31
  </main>
32
- <div class="footer">AstrBot &amp; WeGame Locke Kingdom Plugin</div>
32
+ <div class="footer">Koishi &amp; WeGame Locke Kingdom Plugin</div>
33
33
  </div>
34
34
  </div>
35
35
  </body>
@@ -1,7 +1,6 @@
1
1
  @font-face {
2
2
  font-family: 'mianfeiziti';
3
- src: url('../../ttf/dundun.xHd_Ee5-.woff2') format('woff2'),
4
- url('../../ttf/dundun.BCbg_KoL.ttf') format('truetype');
3
+ src: url('../../ttf/dundun.xHd_Ee5-.woff2') format('woff2');
5
4
  font-display: swap;
6
5
  }
7
6
 
@@ -5,7 +5,7 @@ html { font-size: 100px !important; }
5
5
  }
6
6
 
7
7
  @font-face {
8
- font-family:mianfeiziti;src:url(../../ttf/dundun.xHd_Ee5-.woff2) format("woff2"),url(../../ttf/dundun.BCbg_KoL.ttf) format("truetype");font-display:swap
8
+ font-family:mianfeiziti;src:url(../../ttf/dundun.xHd_Ee5-.woff2) format("woff2");font-display:swap
9
9
  }
10
10
 
11
11
  :root {
@@ -5,8 +5,7 @@
5
5
 
6
6
  @font-face {
7
7
  font-family: 'mianfeiziti';
8
- src: url('../../ttf/dundun.xHd_Ee5-.woff2') format('woff2'),
9
- url('../../ttf/dundun.BCbg_KoL.ttf') format('truetype');
8
+ src: url('../../ttf/dundun.xHd_Ee5-.woff2') format('woff2');
10
9
  font-display: swap;
11
10
  }
12
11
 
@@ -319,4 +318,4 @@ img {
319
318
  font-family: var(--helper-font-family-mianfeiziti);
320
319
  font-size: 0.14rem;
321
320
  color: #9e8e76;
322
- }
321
+ }
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-rocom",
3
3
  "description": "洛克王国查询与订阅插件",
4
- "version": "1.0.1",
4
+ "version": "1.0.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "homepage": "https://github.com/staytomorrow/koishi-plugin-rocom",
@@ -17,7 +17,7 @@
17
17
  "license": "MIT",
18
18
  "scripts": {
19
19
  "build": "tsc -p tsconfig.json --emitDeclarationOnly false --module commonjs --moduleResolution node",
20
- "postbuild": "node -e \"const fs=require('fs');fs.rmSync('lib/render-templates',{recursive:true,force:true});fs.cpSync('src/render-templates','lib/render-templates',{recursive:true});\"",
20
+ "postbuild": "node -e \"const fs=require('fs');for (const dir of ['render-templates','img','ttf']) { fs.rmSync('lib/'+dir,{recursive:true,force:true}); fs.cpSync('src/'+dir,'lib/'+dir,{recursive:true}); }\"",
21
21
  "check": "tsc -p tsconfig.json --noEmit --pretty false",
22
22
  "pack:dry": "npm pack --dry-run",
23
23
  "prepack": "npm run build"