koishi-plugin-warframe 1.7.0 → 1.7.2

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.js CHANGED
@@ -4208,7 +4208,7 @@ function HotRivenComponent(data) {
4208
4208
  }
4209
4209
  __name(HotRivenComponent, "HotRivenComponent");
4210
4210
 
4211
- // src/messages.ts
4211
+ // src/i18n.ts
4212
4212
  var messages = {
4213
4213
  "common.fetchFailed": "内部错误,获取最新信息失败",
4214
4214
  "relic.invalidName": "请提供正确的遗物名称",
@@ -6413,6 +6413,77 @@ async function findRivenItemByName(input, globalRivenItemList) {
6413
6413
  }
6414
6414
  __name(findRivenItemByName, "findRivenItemByName");
6415
6415
 
6416
+ // src/warframe/services/wfm-service/wfm-service.statistics.ts
6417
+ var TREND_THRESHOLD = 0.02;
6418
+ var CHART_DAYS = 7;
6419
+ var RECENT_DAYS = 3;
6420
+ function medianOf(values) {
6421
+ const sorted = [...values].sort((a, b) => a - b);
6422
+ const mid = Math.floor(sorted.length / 2);
6423
+ return sorted[mid];
6424
+ }
6425
+ __name(medianOf, "medianOf");
6426
+ function computeItemStatistics(stats, targetRank, onlineMin) {
6427
+ const closed90 = stats.statistics_closed["90days"].filter(
6428
+ (e) => e.mod_rank === targetRank && e.volume > 0
6429
+ );
6430
+ let rangeMin;
6431
+ let rangeMax;
6432
+ for (const e of closed90) {
6433
+ if (rangeMin === void 0 || e.min_price < rangeMin)
6434
+ rangeMin = e.min_price;
6435
+ if (rangeMax === void 0 || e.max_price > rangeMax)
6436
+ rangeMax = e.max_price;
6437
+ }
6438
+ const chartSlice = closed90.slice(-CHART_DAYS);
6439
+ const chart = chartSlice.map((e) => ({
6440
+ datetime: e.datetime,
6441
+ median: e.median,
6442
+ waPrice: e.wa_price,
6443
+ volume: e.volume,
6444
+ donchTop: e.donch_top,
6445
+ donchBot: e.donch_bot
6446
+ }));
6447
+ let baselineMedian;
6448
+ if (chartSlice.length > 0) {
6449
+ baselineMedian = medianOf(chartSlice.map((e) => e.median));
6450
+ }
6451
+ const recentSlice = closed90.slice(-RECENT_DAYS);
6452
+ let recentAvg;
6453
+ let recentVolume = 0;
6454
+ if (recentSlice.length > 0) {
6455
+ let weightedSum = 0;
6456
+ let totalVolume = 0;
6457
+ for (const e of recentSlice) {
6458
+ weightedSum += e.wa_price * e.volume;
6459
+ totalVolume += e.volume;
6460
+ }
6461
+ recentVolume = totalVolume;
6462
+ if (totalVolume > 0) {
6463
+ recentAvg = Math.round(weightedSum / totalVolume * 10) / 10;
6464
+ }
6465
+ }
6466
+ let trend = "flat";
6467
+ if (recentAvg !== void 0 && baselineMedian !== void 0 && baselineMedian > 0) {
6468
+ const ratio = recentAvg / baselineMedian;
6469
+ if (ratio > 1 + TREND_THRESHOLD)
6470
+ trend = "up";
6471
+ else if (ratio < 1 - TREND_THRESHOLD)
6472
+ trend = "down";
6473
+ }
6474
+ return {
6475
+ chart,
6476
+ recentAvg,
6477
+ recentVolume,
6478
+ baselineMedian,
6479
+ trend,
6480
+ rangeMin,
6481
+ rangeMax,
6482
+ onlineMin
6483
+ };
6484
+ }
6485
+ __name(computeItemStatistics, "computeItemStatistics");
6486
+
6416
6487
  // src/warframe/services/wfm-service/index.ts
6417
6488
  async function updateCache() {
6418
6489
  const updateTasks = [
@@ -6451,7 +6522,11 @@ async function getItemOrders(input) {
6451
6522
  return failure("wfm.itemNotFound", false, { input });
6452
6523
  }
6453
6524
  const itemId = targetItem.slug;
6454
- const data = await wfmClient.items.getOrders(itemId);
6525
+ const targetRank = isFullLevel ? targetItem.maxRank : targetItem.maxRank === void 0 ? void 0 : 0;
6526
+ const [data, statsData] = await Promise.all([
6527
+ wfmClient.items.getOrders(itemId),
6528
+ wfmClient.items.getStatistics(itemId)
6529
+ ]);
6455
6530
  if (!data) {
6456
6531
  return failure("wfm.orderFetchFailed", true);
6457
6532
  }
@@ -6461,9 +6536,13 @@ async function getItemOrders(input) {
6461
6536
  if (result.length === 0) {
6462
6537
  return failure("wfm.noOnlineSeller");
6463
6538
  }
6539
+ let statistics;
6540
+ if (statsData) {
6541
+ statistics = computeItemStatistics(statsData, targetRank, result[0].platinum);
6542
+ }
6464
6543
  return {
6465
6544
  ok: true,
6466
- data: { item: targetItem, orders: result }
6545
+ data: { item: targetItem, orders: result, ...statistics ? { statistics } : {} }
6467
6546
  };
6468
6547
  }
6469
6548
  __name(getItemOrders, "getItemOrders");
@@ -8543,17 +8622,127 @@ __name(generateImageElementOutput, "generateImageElementOutput");
8543
8622
 
8544
8623
  // src/components/wfm.tsx
8545
8624
  var import_jsx_runtime3 = require("@satorijs/element/jsx-runtime");
8546
- function ItemOrderComponent(item, orders) {
8625
+ function formatShortDate(datetime) {
8626
+ const d = new Date(datetime);
8627
+ if (Number.isNaN(d.getTime()))
8628
+ return "";
8629
+ const month = String(d.getUTCMonth() + 1).padStart(2, "0");
8630
+ const day = String(d.getUTCDate()).padStart(2, "0");
8631
+ return `${month}-${day}`;
8632
+ }
8633
+ __name(formatShortDate, "formatShortDate");
8634
+ function trendArrow(trend) {
8635
+ return trend === "up" ? "↑" : trend === "down" ? "↓" : "≈";
8636
+ }
8637
+ __name(trendArrow, "trendArrow");
8638
+ function trendColor(trend) {
8639
+ return trend === "up" ? "#e0533a" : trend === "down" ? "#3a9e5a" : "#888";
8640
+ }
8641
+ __name(trendColor, "trendColor");
8642
+ function ItemStatisticsChart(stats) {
8643
+ const points = stats.chart;
8644
+ const W = 1600 - 2 * 12;
8645
+ const H = 240;
8646
+ const padL = 55;
8647
+ const padR = 25;
8648
+ const padT = 25;
8649
+ const padB = 45;
8650
+ const chartW = W - padL - padR;
8651
+ const chartH = H - padT - padB;
8652
+ let dataMin = Infinity;
8653
+ let dataMax = -Infinity;
8654
+ for (const p of points) {
8655
+ if (p.donchBot < dataMin)
8656
+ dataMin = p.donchBot;
8657
+ if (p.median < dataMin)
8658
+ dataMin = p.median;
8659
+ if (p.donchTop > dataMax)
8660
+ dataMax = p.donchTop;
8661
+ if (p.median > dataMax)
8662
+ dataMax = p.median;
8663
+ }
8664
+ const range = dataMax - dataMin;
8665
+ const pad = range > 0 ? range * 0.1 : 5;
8666
+ const yMin = dataMin - pad;
8667
+ const yMax = dataMax + pad;
8668
+ const yScale = yMax - yMin;
8669
+ const xPos = /* @__PURE__ */ __name((i) => padL + (points.length > 1 ? i * chartW / (points.length - 1) : 0), "xPos");
8670
+ const yPos = /* @__PURE__ */ __name((v) => padT + (1 - (v - yMin) / yScale) * chartH, "yPos");
8671
+ const bandTop = points.map((p, i) => `${xPos(i)},${yPos(p.donchTop)}`);
8672
+ const bandBot = points.map((p, i) => `${xPos(points.length - 1 - i)},${yPos(p.donchBot)}`);
8673
+ const bandPoints = [...bandTop, ...bandBot].join(" ");
8674
+ const linePoints = points.map((p, i) => `${xPos(i)},${yPos(p.median)}`).join(" ");
8675
+ const baselineY = stats.baselineMedian !== void 0 ? yPos(stats.baselineMedian) : null;
8676
+ const onlineYRaw = yPos(stats.onlineMin);
8677
+ const onlineY = Math.max(padT, Math.min(H - padB, onlineYRaw));
8678
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("svg", { width: W, height: H, style: "font-family: Arial, sans-serif; background: #eee;", children: [
8679
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polygon", { points: bandPoints, fill: "#5a95ff", fillOpacity: 0.12, stroke: "none" }),
8680
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: padL, y1: onlineY, x2: W - padR, y2: onlineY, stroke: "#ff6b35", strokeWidth: 1.5, strokeDasharray: "6 4" }),
8681
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { x: W - padR, y: onlineY - 6, textAnchor: "end", fontSize: 12, fill: "#ff6b35", children: [
8682
+ "在线最低",
8683
+ stats.onlineMin,
8684
+ "p"
8685
+ ] }),
8686
+ baselineY !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
8687
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: padL, y1: baselineY, x2: W - padR, y2: baselineY, stroke: "#999", strokeWidth: 1, strokeDasharray: "3 3" }),
8688
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("text", { x: padL + 4, y: baselineY - 5, textAnchor: "start", fontSize: 11, fill: "#999", children: [
8689
+ "7天中位",
8690
+ stats.baselineMedian,
8691
+ "p"
8692
+ ] })
8693
+ ] }) : null,
8694
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: linePoints, fill: "none", stroke: "#5a95ff", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }),
8695
+ points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: xPos(i), cy: yPos(p.median), r: 3.5, fill: "#5a95ff", stroke: "#fff", strokeWidth: 1 })),
8696
+ points.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { x: xPos(i), y: H - padB + 20, textAnchor: "middle", fontSize: 11, fill: "#666", children: formatShortDate(p.datetime) })),
8697
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { x: padL - 8, y: padT + 5, textAnchor: "end", fontSize: 11, fill: "#666", children: Math.round(dataMax) }),
8698
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("text", { x: padL - 8, y: H - padB, textAnchor: "end", fontSize: 11, fill: "#666", children: Math.round(dataMin) })
8699
+ ] });
8700
+ }
8701
+ __name(ItemStatisticsChart, "ItemStatisticsChart");
8702
+ function StatCard(label, value, accent) {
8703
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: "flex:1;min-width:0;border-radius:6px;padding:8px 10px;background:#f5f7fa;border:1px solid #e0e4e8;display:flex;flex-direction:column;align-items:center;gap:2px;", children: [
8704
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: "font-size:0.9rem;color:#888;", children: label }),
8705
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: `font-size:1.4rem;font-weight:700;color:${accent ?? "#1a1a1a"};`, children: value })
8706
+ ] });
8707
+ }
8708
+ __name(StatCard, "StatCard");
8709
+ function ItemStatisticsCards(stats) {
8710
+ const arrow = trendArrow(stats.trend);
8711
+ const tColor = trendColor(stats.trend);
8712
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: "display:flex;gap:8px;margin-top:12px;", children: [
8713
+ StatCard(
8714
+ "近7天中位",
8715
+ stats.baselineMedian !== void 0 ? `${stats.baselineMedian}p` : "—"
8716
+ ),
8717
+ StatCard(
8718
+ "近3天均价",
8719
+ stats.recentAvg !== void 0 ? `${stats.recentAvg}p ${arrow}` : "—",
8720
+ stats.recentAvg !== void 0 ? tColor : void 0
8721
+ ),
8722
+ StatCard("近3天成交", `${stats.recentVolume}笔`),
8723
+ StatCard(
8724
+ "90天区间",
8725
+ stats.rangeMin !== void 0 && stats.rangeMax !== void 0 ? `${stats.rangeMin}-${stats.rangeMax}p` : "—"
8726
+ ),
8727
+ StatCard("在线最低", `${stats.onlineMin}p`, "#ff6b35")
8728
+ ] });
8729
+ }
8730
+ __name(ItemStatisticsCards, "ItemStatisticsCards");
8731
+ function ItemStatisticsComponent(stats) {
8732
+ const hasData = stats.chart.length > 0 || stats.recentAvg !== void 0 || stats.baselineMedian !== void 0;
8733
+ if (!hasData) {
8734
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: "margin-top:16px;padding:12px;border-top:2px solid #e0e4e8;text-align:center;color:#999;font-size:1.2rem;", children: "暂无近期成交统计数据" });
8735
+ }
8736
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: "margin-top:16px;padding:12px;border-top:2px solid #e0e4e8;", children: [
8737
+ stats.chart.length >= 2 ? ItemStatisticsChart(stats) : null,
8738
+ ItemStatisticsCards(stats)
8739
+ ] });
8740
+ }
8741
+ __name(ItemStatisticsComponent, "ItemStatisticsComponent");
8742
+ function ItemOrderComponent(item, orders, statistics) {
8547
8743
  const itemNameCN = item.i18n["zh-hans"]?.name;
8548
8744
  const itemNameEN = item.i18n.en?.name;
8549
- let result = `物品: ${itemNameCN} / ${itemNameEN} (ID: ${item.slug})
8550
- `;
8551
- for (const order of orders) {
8552
- result += `玩家: ${order.user.ingameName} 状态: ${order.user.status} 价格: ${order.platinum}
8553
- `;
8554
- }
8555
- void result;
8556
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: "display:flex; flex-direction: column;", children: [
8745
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: "display:flex; flex-direction: column; width: 1600px;", children: [
8557
8746
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("style", { children: `
8558
8747
  th {
8559
8748
  align-items: center;
@@ -8596,7 +8785,8 @@ function ItemOrderComponent(item, orders) {
8596
8785
  item.maxRank && item.maxRank > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { children: order.rank }) : null,
8597
8786
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { children: order.user.reputation })
8598
8787
  ] }))
8599
- ] })
8788
+ ] }),
8789
+ statistics ? ItemStatisticsComponent(statistics) : null
8600
8790
  ] });
8601
8791
  }
8602
8792
  __name(ItemOrderComponent, "ItemOrderComponent");
@@ -9042,12 +9232,35 @@ __name(PrimedModHistoryComponent, "PrimedModHistoryComponent");
9042
9232
 
9043
9233
  // src/messages/wfm.tsx
9044
9234
  var import_jsx_runtime4 = require("@satorijs/element/jsx-runtime");
9045
- function wmMessage(img, item, orders) {
9235
+ function buildStatisticsTextLine(stats) {
9236
+ const parts = [];
9237
+ if (stats.recentAvg !== void 0) {
9238
+ parts.push(`近3天均价 ${stats.recentAvg}p`);
9239
+ if (stats.baselineMedian !== void 0) {
9240
+ const arrow = stats.trend === "up" ? "↑" : stats.trend === "down" ? "↓" : "≈";
9241
+ parts.push(`${arrow}7天${stats.baselineMedian}p`);
9242
+ }
9243
+ } else if (stats.baselineMedian !== void 0) {
9244
+ parts.push(`7天中位 ${stats.baselineMedian}p`);
9245
+ }
9246
+ if (stats.recentVolume > 0) {
9247
+ parts.push(`成交${stats.recentVolume}笔`);
9248
+ }
9249
+ return parts.length > 0 ? parts.join(" | ") : "";
9250
+ }
9251
+ __name(buildStatisticsTextLine, "buildStatisticsTextLine");
9252
+ function wmMessage(img, item, orders, statistics) {
9046
9253
  const lines = orders.slice(0, 3).map((order) => `
9047
9254
  /w ${order.user.ingameName} Hi! I want to buy: "${item.i18n.en?.name}${!item.maxRank || item.maxRank === 0 ? "" : ` (rank ${order.rank})`}" for ${order.platinum} platinum. (warframe.market)`);
9255
+ const statLine = statistics ? buildStatisticsTextLine(statistics) : "";
9048
9256
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("message", { children: [
9049
9257
  img,
9050
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children: lines.join("") })
9258
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
9259
+ statLine ? `
9260
+ ${statLine}
9261
+ ` : "",
9262
+ lines.join("")
9263
+ ] })
9051
9264
  ] });
9052
9265
  }
9053
9266
  __name(wmMessage, "wmMessage");
@@ -9062,10 +9275,10 @@ function createWfmCommands(deps) {
9062
9275
  return t(result);
9063
9276
  }
9064
9277
  if (!_action.session?.app.puppeteer) {
9065
- return render(ItemOrderComponent(result.data.item, result.data.orders));
9278
+ return render(ItemOrderComponent(result.data.item, result.data.orders, result.data.statistics));
9066
9279
  }
9067
- const component = await generateImageElementOutput(_action.session?.app.puppeteer, ItemOrderComponent(result.data.item, result.data.orders));
9068
- return wmMessage(component, result.data.item, result.data.orders);
9280
+ const component = await generateImageElementOutput(_action.session?.app.puppeteer, ItemOrderComponent(result.data.item, result.data.orders, result.data.statistics));
9281
+ return wmMessage(component, result.data.item, result.data.orders, result.data.statistics);
9069
9282
  }, "wmCommand"),
9070
9283
  wmrCommand: /* @__PURE__ */ __name(async (_action, input) => {
9071
9284
  const result = await getRivenOrders(input);
@@ -9085,6 +9298,77 @@ function createWfmCommands(deps) {
9085
9298
  }
9086
9299
  __name(createWfmCommands, "createWfmCommands");
9087
9300
 
9301
+ // src/commands/index.ts
9302
+ function setupCommands(ctx, deps) {
9303
+ const wf = createWfCommands(deps);
9304
+ const wfm = createWfmCommands(deps);
9305
+ const miscs = createMiscsCommands(deps);
9306
+ ctx.command("wm <item-name:text>", "请使用wmi替代").action(wfm.wmCommand);
9307
+ ctx.command("wmr <item-name:text>", "查询wm的紫卡价格").action(wfm.wmrCommand);
9308
+ ctx.command("wmi <item-name:text>", "查询wm的物品价格").action(wfm.wmCommand);
9309
+ ctx.command("wmu", "更新wm缓存数据").action(wfm.wmuCommand);
9310
+ ctx.command("arbitration [day:number]", "近期高价值仲裁任务").alias("arbi").alias("仲裁").alias("仲裁表").action(wf.arbitrationCommand);
9311
+ ctx.command("fissure", "当前虚空裂隙").alias("裂缝").alias("裂隙").action(wf.fissureCommand);
9312
+ ctx.command("fissure-sp", "当前钢铁之路虚空裂隙").alias("spfissure").alias("钢铁裂缝").alias("钢铁裂隙").action(wf.steelPathFissureCommand);
9313
+ ctx.command("fissure-rj", "当前九重天虚空裂隙").alias("rjfissure").alias("九重天裂缝").alias("九重天裂隙").action(wf.railjackFissureCommand);
9314
+ ctx.command("relic <relic-name:text>", "查询遗物内容").alias("遗物").alias("核桃").action(wf.relicCommand);
9315
+ ctx.command("environment", "当前各区域状态").alias("env").alias("平原").alias("地球").alias("金星").alias("夜灵").alias("夜灵平野").alias("奥布山谷").action(wf.environmentCommand);
9316
+ ctx.command("weekly", "周常任务").alias("周常").alias("科研").alias("时光科研").alias("深层科研").alias("执行官").action(wf.weeklyCommand);
9317
+ ctx.command("circuit", "本周回廊战甲及灵化之源").alias("灵化之源").alias("灵化").action(wf.circuitCommand);
9318
+ ctx.command("riven <img:image>", "分析紫卡截图").action(wf.rivenCommand);
9319
+ ctx.command(
9320
+ "riven-stat <weaponType:string> <statType:string> <disposition:number>",
9321
+ "获取紫卡数值范围"
9322
+ ).usage(
9323
+ "武器类型: 步枪, 手枪, 霰弹枪, 近战, Archwing枪械\n词条类型: 2, 3, 21, 31"
9324
+ ).example("riven-stat 步枪 31 0.7").alias("rivenstat").alias("紫卡数值").action(wf.rivenStatCommand);
9325
+ ctx.command("void-trader", "虚空商人").alias("voidtrader").alias("虚空商人").alias("奸商").action(wf.voidtraderCommand);
9326
+ ctx.command("lich-c", "c系玄骸武器", { hidden: true }).alias("lichc").action(miscs.inDevelopment);
9327
+ ctx.command("lich-i", "i系玄骸武器", { hidden: true }).alias("lichi").action(miscs.inDevelopment);
9328
+ ctx.command("riven-weekly [minPrice:number]", "每周高价值紫卡参考 (未洗中位价)").alias("weeklyriven").alias("周紫卡").alias("周卡").action(wf.weeklyRivenCommand);
9329
+ ctx.command("riven-hot", "热门紫卡").alias("hotriven").action(miscs.hotRivenCommand);
9330
+ ctx.command("pmod-history", "Primed MOD 历史").alias("pmodhistory").alias("pmod").alias("P卡").alias("p卡").alias("P卡历史").alias("p卡历史").action(wfm.pmodhistoryCommand);
9331
+ }
9332
+ __name(setupCommands, "setupCommands");
9333
+
9334
+ // src/hooks/index.ts
9335
+ function setupHooks(ctx, deps) {
9336
+ const { config, logger } = deps;
9337
+ ctx.on("message", (session) => {
9338
+ if (config.developerMode) {
9339
+ logger.info(
9340
+ `Koishi recieved message: ${session.content}
9341
+ Platform: ${session.platform}
9342
+ User: ${session.author.name}`
9343
+ );
9344
+ }
9345
+ });
9346
+ ctx.on("command/before-execute", (action) => {
9347
+ if (config.developerMode) {
9348
+ logger.info(
9349
+ `WFM Plugin received command ${action.command?.name}
9350
+ arguments: ${JSON.stringify(action.args)}`
9351
+ );
9352
+ }
9353
+ });
9354
+ }
9355
+ __name(setupHooks, "setupHooks");
9356
+
9357
+ // src/schedules/pmod-history.ts
9358
+ function setupPrimedModHistorySchedule(ctx, deps, refresh = async () => primedModHistory.update()) {
9359
+ const run = /* @__PURE__ */ __name(async () => {
9360
+ try {
9361
+ await refresh();
9362
+ } catch (error) {
9363
+ deps.logger.warn("刷新 Primed MOD 历史缓存失败", error);
9364
+ }
9365
+ }, "run");
9366
+ ctx.cron("0 0 0,6,12,18 * * *", () => {
9367
+ void run();
9368
+ });
9369
+ }
9370
+ __name(setupPrimedModHistorySchedule, "setupPrimedModHistorySchedule");
9371
+
9088
9372
  // src/messages/world-state.tsx
9089
9373
  var import_jsx_runtime5 = require("@satorijs/element/jsx-runtime");
9090
9374
  function formatExpiry(expiry) {
@@ -9164,6 +9448,7 @@ __name(setupWorldStateSchedule, "setupWorldStateSchedule");
9164
9448
  // src/schedules/index.ts
9165
9449
  function setupSchedules(ctx, deps) {
9166
9450
  setupWorldStateSchedule(ctx, deps);
9451
+ setupPrimedModHistorySchedule(ctx, deps);
9167
9452
  }
9168
9453
  __name(setupSchedules, "setupSchedules");
9169
9454
 
@@ -9192,58 +9477,6 @@ function apply(ctx) {
9192
9477
  setupSchedules(ctx, deps);
9193
9478
  }
9194
9479
  __name(apply, "apply");
9195
- function setupHooks(ctx, deps) {
9196
- const { config, logger } = deps;
9197
- ctx.on("message", (session) => {
9198
- if (config.developerMode) {
9199
- logger.info(
9200
- `Koishi recieved message: ${session.content}
9201
- Platform: ${session.platform}
9202
- User: ${session.author.name}`
9203
- );
9204
- }
9205
- });
9206
- ctx.on("command/before-execute", (action) => {
9207
- if (config.developerMode) {
9208
- logger.info(
9209
- `WFM Plugin received command ${action.command?.name}
9210
- arguments: ${JSON.stringify(action.args)}`
9211
- );
9212
- }
9213
- });
9214
- }
9215
- __name(setupHooks, "setupHooks");
9216
- function setupCommands(ctx, deps) {
9217
- const wf = createWfCommands(deps);
9218
- const wfm = createWfmCommands(deps);
9219
- const miscs = createMiscsCommands(deps);
9220
- ctx.command("wm <item-name:text>", "请使用wmi替代").action(wfm.wmCommand);
9221
- ctx.command("wmr <item-name:text>", "查询wm的紫卡价格").action(wfm.wmrCommand);
9222
- ctx.command("wmi <item-name:text>", "查询wm的物品价格").action(wfm.wmCommand);
9223
- ctx.command("wmu", "更新wm缓存数据").action(wfm.wmuCommand);
9224
- ctx.command("arbitration [day:number]", "近期高价值仲裁任务").alias("arbi").alias("仲裁").alias("仲裁表").action(wf.arbitrationCommand);
9225
- ctx.command("fissure", "当前虚空裂隙").alias("裂缝").alias("裂隙").action(wf.fissureCommand);
9226
- ctx.command("fissure-sp", "当前钢铁之路虚空裂隙").alias("spfissure").alias("钢铁裂缝").alias("钢铁裂隙").action(wf.steelPathFissureCommand);
9227
- ctx.command("fissure-rj", "当前九重天虚空裂隙").alias("rjfissure").alias("九重天裂缝").alias("九重天裂隙").action(wf.railjackFissureCommand);
9228
- ctx.command("relic <relic-name:text>", "查询遗物内容").alias("遗物").alias("核桃").action(wf.relicCommand);
9229
- ctx.command("environment", "当前各区域状态").alias("env").alias("平原").alias("地球").alias("金星").alias("夜灵").alias("夜灵平野").alias("奥布山谷").action(wf.environmentCommand);
9230
- ctx.command("weekly", "周常任务").alias("周常").alias("科研").alias("时光科研").alias("深层科研").alias("执行官").action(wf.weeklyCommand);
9231
- ctx.command("circuit", "本周回廊战甲及灵化之源").alias("灵化之源").alias("灵化").action(wf.circuitCommand);
9232
- ctx.command("riven <img:image>", "分析紫卡截图").action(wf.rivenCommand);
9233
- ctx.command(
9234
- "riven-stat <weaponType:string> <statType:string> <disposition:number>",
9235
- "获取紫卡数值范围"
9236
- ).usage(
9237
- "武器类型: 步枪, 手枪, 霰弹枪, 近战, Archwing枪械\n词条类型: 2, 3, 21, 31"
9238
- ).example("riven-stat 步枪 31 0.7").alias("rivenstat").alias("紫卡数值").action(wf.rivenStatCommand);
9239
- ctx.command("void-trader", "虚空商人").alias("voidtrader").alias("虚空商人").alias("奸商").action(wf.voidtraderCommand);
9240
- ctx.command("lich-c", "c系玄骸武器", { hidden: true }).alias("lichc").action(miscs.inDevelopment);
9241
- ctx.command("lich-i", "i系玄骸武器", { hidden: true }).alias("lichi").action(miscs.inDevelopment);
9242
- ctx.command("riven-weekly [minPrice:number]", "每周高价值紫卡参考 (未洗中位价)").alias("weeklyriven").alias("周紫卡").alias("周卡").action(wf.weeklyRivenCommand);
9243
- ctx.command("riven-hot", "热门紫卡").alias("hotriven").action(miscs.hotRivenCommand);
9244
- ctx.command("pmod-history", "Primed MOD 历史").alias("pmodhistory").alias("pmod").alias("P卡").alias("p卡").alias("P卡历史").alias("p卡历史").action(wfm.pmodhistoryCommand);
9245
- }
9246
- __name(setupCommands, "setupCommands");
9247
9480
  // Annotate the CommonJS export names for ESM import in node:
9248
9481
  0 && (module.exports = {
9249
9482
  Config,