koishi-plugin-warframe 1.6.2 → 1.6.4

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
@@ -693,9 +693,9 @@ var require_LocalDatastore = __commonJS({
693
693
  return _this2.Promise.resolve();
694
694
  })();
695
695
  }
696
- yieldLoop(t = 0) {
696
+ yieldLoop(t2 = 0) {
697
697
  return new this.Promise(function(resolve2, reject) {
698
- return setTimeout(resolve2, t);
698
+ return setTimeout(resolve2, t2);
699
699
  });
700
700
  }
701
701
  computePenalty() {
@@ -4208,6 +4208,48 @@ function HotRivenComponent(data) {
4208
4208
  }
4209
4209
  __name(HotRivenComponent, "HotRivenComponent");
4210
4210
 
4211
+ // src/messages.ts
4212
+ var messages = {
4213
+ "common.fetchFailed": "内部错误,获取最新信息失败",
4214
+ "relic.invalidName": "请提供正确的遗物名称",
4215
+ "relic.dataLoading": "遗物数据未加载完成,请稍后再试",
4216
+ "relic.notFound": "未找到对应遗物信息",
4217
+ "arbitration.invalidDayRange": "天数需小于等于14且大于0",
4218
+ "voidTrader.drifting": "虚空商人仍在未知地带漂流...",
4219
+ "voidTrader.arriving": "距离虚空商人到达还有: {time}",
4220
+ "riven.imageNotFound": "未检测到图片",
4221
+ "riven.ocrNotConfigured": "未配置 OCR,请在插件设置中配置。",
4222
+ "riven.imageFetchFailed": "获取图片失败",
4223
+ "riven.imageParseFailed": "解析图片失败",
4224
+ "riven.weaponNotFound": "未找到武器: {weapon}",
4225
+ "riven.dispositionError": "裂罅倾向错误",
4226
+ "riven.weaponTypeError": "武器类型错误",
4227
+ "riven.statTypeError": "词条类型错误",
4228
+ "riven.invalidParams": "请输入正确参数",
4229
+ "riven.noWeeklyData": "没有找到符合条件的紫卡参考数据",
4230
+ "wfm.inputItemName": "请输入物品名称",
4231
+ "wfm.itemNotFound": "未找到物品: {input}",
4232
+ "wfm.orderFetchFailed": "订单获取失败,请稍后重试",
4233
+ "wfm.noOnlineSeller": "当前没有在线游戏中的卖家",
4234
+ "wfm.rivenWeaponNotFound": "未找到紫卡武器: {input}",
4235
+ "wfm.rivenOrderFetchFailed": "紫卡订单获取失败,请稍后重试",
4236
+ "wfm.noOnlineRivenSeller": "当前没有在线出售的紫卡",
4237
+ "miscs.hotRiven.noData": "暂无热门紫卡数据",
4238
+ "miscs.hotRiven.fetchFailed": "获取热门紫卡数据失败",
4239
+ "miscs.inDevelopment": "功能暂未开放"
4240
+ };
4241
+ function t(messageOrResult, params) {
4242
+ if (typeof messageOrResult !== "string") {
4243
+ return t(messageOrResult.message, messageOrResult.params);
4244
+ }
4245
+ let text = messages[messageOrResult];
4246
+ for (const [key, value] of Object.entries(params ?? {})) {
4247
+ text = text.replaceAll(`{${key}}`, String(value));
4248
+ }
4249
+ return text;
4250
+ }
4251
+ __name(t, "t");
4252
+
4211
4253
  // src/utils/assets.ts
4212
4254
  var import_node_fs = require("node:fs");
4213
4255
  var import_node_path = require("node:path");
@@ -4311,8 +4353,8 @@ var dictToKeyDict = /* @__PURE__ */ __name((dict, predict) => {
4311
4353
  }, "dictToKeyDict");
4312
4354
 
4313
4355
  // src/utils/color.ts
4314
- function lerp(start, end, t) {
4315
- return Math.round(start + (end - start) * t);
4356
+ function lerp(start, end, t2) {
4357
+ return Math.round(start + (end - start) * t2);
4316
4358
  }
4317
4359
  __name(lerp, "lerp");
4318
4360
  function hexToRgb(hex) {
@@ -4484,11 +4526,11 @@ async function getHotRivenWeapons2() {
4484
4526
  try {
4485
4527
  const result = await globalHotRivenWeapons.get();
4486
4528
  if (!result || result.length === 0) {
4487
- return { ok: false, message: "暂无热门紫卡数据" };
4529
+ return { ok: false, message: "miscs.hotRiven.noData" };
4488
4530
  }
4489
4531
  return { ok: true, data: result };
4490
4532
  } catch {
4491
- return { ok: false, message: "获取热门紫卡数据失败" };
4533
+ return { ok: false, message: "miscs.hotRiven.fetchFailed" };
4492
4534
  }
4493
4535
  }
4494
4536
  __name(getHotRivenWeapons2, "getHotRivenWeapons");
@@ -4509,6 +4551,7 @@ var arbitrationScheduleText = loadAssetText("arbys.txt");
4509
4551
  var arbyRewards = loadAssetJson("arbyRewards.json");
4510
4552
  var Baro = loadAssetText("baro.txt");
4511
4553
  var BaroParsed = loadAssetJson("baroParsed.json");
4554
+ var warframeAlias = loadAssetJson("warframeAlias.json");
4512
4555
 
4513
4556
  // src/data/wf/arbitrationSchedule.ts
4514
4557
  var arbitrationSchedule = arbitrationScheduleText.split("\n").map((line) => line.split(",")).filter((arr) => arr.length === 2).map((arr) => {
@@ -5242,7 +5285,7 @@ async function getTextFromTencentOCR(image, secret) {
5242
5285
  const { TextDetections } = await client.GeneralAccurateOCR({
5243
5286
  ImageBase64: image
5244
5287
  });
5245
- const result = TextDetections?.map((t) => t.DetectedText).filter(
5288
+ const result = TextDetections?.map((t2) => t2.DetectedText).filter(
5246
5289
  Boolean
5247
5290
  );
5248
5291
  return result;
@@ -5266,14 +5309,14 @@ __name(extractTextFromImage, "extractTextFromImage");
5266
5309
  // src/services/wf-service.ts
5267
5310
  async function getRelic(input) {
5268
5311
  if (!input) {
5269
- return { ok: false, message: "请提供正确的遗物名称" };
5312
+ return { ok: false, message: "relic.invalidName" };
5270
5313
  }
5271
5314
  input = normalizeName(input);
5272
5315
  if (!input) {
5273
- return { ok: false, message: "请提供正确的遗物名称" };
5316
+ return { ok: false, message: "relic.invalidName" };
5274
5317
  }
5275
5318
  if (!relics) {
5276
- return { ok: false, message: "遗物数据未加载完成,请稍后再试" };
5319
+ return { ok: false, message: "relic.dataLoading" };
5277
5320
  }
5278
5321
  const tierListForMatch = [
5279
5322
  "古纪",
@@ -5288,10 +5331,10 @@ async function getRelic(input) {
5288
5331
  "Axi",
5289
5332
  "Requiem",
5290
5333
  "Vanguard"
5291
- ].map((t) => normalizeName(t));
5292
- const tier = tierListForMatch.find((t) => input.startsWith(t));
5334
+ ].map((t2) => normalizeName(t2));
5335
+ const tier = tierListForMatch.find((t2) => input.startsWith(t2));
5293
5336
  if (!tier) {
5294
- return { ok: false, message: "请提供正确的遗物名称" };
5337
+ return { ok: false, message: "relic.invalidName" };
5295
5338
  }
5296
5339
  const category = input.replace(new RegExp(`^${tier}`), "").replace(/遗物$|relic$/, "");
5297
5340
  const zhTierMap = {
@@ -5304,12 +5347,12 @@ async function getRelic(input) {
5304
5347
  };
5305
5348
  const enTier = zhTierMap[tier] ?? tier;
5306
5349
  const key = normalizeName(enTier + category);
5307
- return relics[key] ? { ok: true, data: relics[key] } : { ok: false, message: "未找到对应遗物信息" };
5350
+ return relics[key] ? { ok: true, data: relics[key] } : { ok: false, message: "relic.notFound" };
5308
5351
  }
5309
5352
  __name(getRelic, "getRelic");
5310
5353
  function getArbitrations(day = 3) {
5311
5354
  if (day > 14 || day <= 0) {
5312
- return { ok: false, message: "天数需小于等于14且大于0" };
5355
+ return { ok: false, message: "arbitration.invalidDayRange" };
5313
5356
  }
5314
5357
  const currentHourTimeStamp = Math.floor(
5315
5358
  (/* @__PURE__ */ new Date()).setUTCMinutes(0, 0, 0) / 1e3
@@ -5348,7 +5391,7 @@ __name(getArbitrations, "getArbitrations");
5348
5391
  async function getWeekly() {
5349
5392
  const { raw: worldState } = await globalWorldState.get();
5350
5393
  if (!worldState) {
5351
- return { ok: false, message: "内部错误,获取最新信息失败" };
5394
+ return { ok: false, message: "common.fetchFailed" };
5352
5395
  }
5353
5396
  const archon = {
5354
5397
  name: import_warframe_public_export_plus6.dict_zh[`/Lotus/Language/Narmer/${removeSpace(worldState.archonHunt.boss)}`],
@@ -5485,45 +5528,44 @@ function getCircuitWeek() {
5485
5528
  __name(getCircuitWeek, "getCircuitWeek");
5486
5529
  async function getFissures() {
5487
5530
  const { fissures } = await globalWorldState.get();
5488
- return fissures ? { ok: true, data: fissures } : { ok: false, message: "内部错误,获取最新信息失败" };
5531
+ return fissures ? { ok: true, data: fissures } : { ok: false, message: "common.fetchFailed" };
5489
5532
  }
5490
5533
  __name(getFissures, "getFissures");
5491
5534
  async function getSteelPathFissures() {
5492
5535
  const { spFissures } = await globalWorldState.get();
5493
- return spFissures ? { ok: true, data: spFissures } : { ok: false, message: "内部错误,获取最新信息失败" };
5536
+ return spFissures ? { ok: true, data: spFissures } : { ok: false, message: "common.fetchFailed" };
5494
5537
  }
5495
5538
  __name(getSteelPathFissures, "getSteelPathFissures");
5496
5539
  async function getRailjackFissures() {
5497
5540
  const { rjFissures } = await globalWorldState.get();
5498
- return rjFissures ? { ok: true, data: rjFissures } : { ok: false, message: "内部错误,获取最新信息失败" };
5541
+ return rjFissures ? { ok: true, data: rjFissures } : { ok: false, message: "common.fetchFailed" };
5499
5542
  }
5500
5543
  __name(getRailjackFissures, "getRailjackFissures");
5501
5544
  async function getAnalyzedRiven(secret, url) {
5502
5545
  const img = await fetchAsyncImage(url);
5503
5546
  if (!img) {
5504
- return { ok: false, message: "获取图片失败" };
5547
+ return { ok: false, message: "riven.imageFetchFailed" };
5505
5548
  }
5506
5549
  const extractResult = await extractTextFromImage(img, secret);
5507
5550
  if (!extractResult) {
5508
- return { ok: false, message: "解析图片失败" };
5551
+ return { ok: false, message: "riven.imageParseFailed" };
5509
5552
  }
5510
5553
  const parseResult = await parseOCRResult(extractResult);
5511
5554
  if (!parseResult || parseResult.attributes.length < 2 || parseResult.attributes.length > 4) {
5512
- return { ok: false, message: "解析图片失败" };
5555
+ return { ok: false, message: "riven.imageParseFailed" };
5513
5556
  }
5514
- const analyzed = analyzeRivenStat(parseResult);
5515
- return typeof analyzed === "string" ? { ok: false, message: analyzed } : { ok: true, data: analyzed };
5557
+ return analyzeRivenStat(parseResult);
5516
5558
  }
5517
5559
  __name(getAnalyzedRiven, "getAnalyzedRiven");
5518
5560
  async function getVoidTrader() {
5519
5561
  const { raw: worldState } = await globalWorldState.get();
5520
5562
  if (worldState.voidTraders.length === 0) {
5521
- return { ok: false, message: "虚空商人仍在未知地带漂流..." };
5563
+ return { ok: false, message: "voidTrader.drifting" };
5522
5564
  }
5523
5565
  const trader = worldState.voidTraders[0];
5524
5566
  if (trader && trader.activation && trader.activation.getTime() > Date.now()) {
5525
5567
  const diff2 = trader.activation.getTime() - Date.now();
5526
- return { ok: false, message: `距离虚空商人到达还有: ${msToHumanReadable(diff2)}` };
5568
+ return { ok: false, message: "voidTrader.arriving", params: { time: msToHumanReadable(diff2) } };
5527
5569
  }
5528
5570
  const diff = trader.expiry.getTime() - Date.now();
5529
5571
  const items = trader.inventory.map(getVoidTraderItem);
@@ -5566,7 +5608,7 @@ async function getWeeklyRivens(minPrice) {
5566
5608
  __name(getWeeklyRivens, "getWeeklyRivens");
5567
5609
  async function getStaticRivenStats(weaponType, statType, disposition) {
5568
5610
  if (disposition > 1.55 || disposition < 0.5) {
5569
- return { ok: false, message: "裂罅倾向错误" };
5611
+ return { ok: false, message: "riven.dispositionError" };
5570
5612
  }
5571
5613
  const weaponTypes = [
5572
5614
  "步枪",
@@ -5584,7 +5626,7 @@ async function getStaticRivenStats(weaponType, statType, disposition) {
5584
5626
  (v) => normalizeName(v).startsWith(normalizeName(weaponType))
5585
5627
  );
5586
5628
  if (!matchedWeaponType) {
5587
- return { ok: false, message: "武器类型错误" };
5629
+ return { ok: false, message: "riven.weaponTypeError" };
5588
5630
  }
5589
5631
  const weaponTypeKeys = {
5590
5632
  步枪: "Rifle",
@@ -5596,7 +5638,7 @@ async function getStaticRivenStats(weaponType, statType, disposition) {
5596
5638
  const weaponTypeKey = weaponTypeKeys[matchedWeaponType] ?? matchedWeaponType;
5597
5639
  const statTypes = ["2", "3", "21", "31"];
5598
5640
  if (!statTypes.includes(statType)) {
5599
- return { ok: false, message: "词条类型错误" };
5641
+ return { ok: false, message: "riven.statTypeError" };
5600
5642
  }
5601
5643
  const rivenAttrValues2 = rivenAttrValueDict[weaponTypeKey];
5602
5644
  const factor = rivenStatFixFactor[statType];
@@ -5671,20 +5713,20 @@ async function parseOCRResult(ocrResult) {
5671
5713
  if (standard.includes(input) || input.includes(standard) || standard.split("/").some((x) => !!x && input.includes(x))) {
5672
5714
  return 1;
5673
5715
  }
5674
- const t = tokenSimilarity(standard, input);
5716
+ const t2 = tokenSimilarity(standard, input);
5675
5717
  const s = normalSimilarity(standard, input);
5676
- return Math.max(t, s);
5718
+ return Math.max(t2, s);
5677
5719
  }
5678
5720
  __name(similarity, "similarity");
5679
5721
  const texts = list;
5680
5722
  const attributes = [];
5681
5723
  const statLines = [];
5682
- for (const t of texts) {
5683
- if (!t || !/^[x+-]|^\d/.test(t)) {
5724
+ for (const t2 of texts) {
5725
+ if (!t2 || !/^[x+-]|^\d/.test(t2)) {
5684
5726
  continue;
5685
5727
  }
5686
- const prefix = /^[x+-]/.test(t) ? t[0] : "";
5687
- const attrNamePart = removeSpace(t ?? "").replace(/^[^\u4E00-\u9FA5]+/u, "");
5728
+ const prefix = /^[x+-]/.test(t2) ? t2[0] : "";
5729
+ const attrNamePart = removeSpace(t2 ?? "").replace(/^[^\u4E00-\u9FA5]+/u, "");
5688
5730
  const attr = globalRivenAttributeList.find((a) => {
5689
5731
  if (!a)
5690
5732
  return false;
@@ -5699,24 +5741,24 @@ async function parseOCRResult(ocrResult) {
5699
5741
  if (!attr) {
5700
5742
  continue;
5701
5743
  }
5702
- statLines.push(t);
5744
+ statLines.push(t2);
5703
5745
  const value = (/* @__PURE__ */ __name((function extractStatValue(text) {
5704
- const t2 = text.replace(/\s+/g, "");
5705
- const multMatch = t2.match(/x(\d+(?:\.\d+)?)/i);
5746
+ const t3 = text.replace(/\s+/g, "");
5747
+ const multMatch = t3.match(/x(\d+(?:\.\d+)?)/i);
5706
5748
  if (multMatch) {
5707
5749
  return {
5708
5750
  value: Number.parseFloat(multMatch[1]),
5709
5751
  type: "multiply"
5710
5752
  };
5711
5753
  }
5712
- const percentMatch = t2.match(/([+-]?\d+(?:\.\d+)?)%/);
5754
+ const percentMatch = t3.match(/([+-]?\d+(?:\.\d+)?)%/);
5713
5755
  if (percentMatch) {
5714
5756
  return {
5715
5757
  value: Number.parseFloat(percentMatch[1]),
5716
5758
  type: "percent"
5717
5759
  };
5718
5760
  }
5719
- const numMatch = t2.match(/([+-]?\d+(?:\.\d+)?)/);
5761
+ const numMatch = t3.match(/([+-]?\d+(?:\.\d+)?)/);
5720
5762
  if (numMatch) {
5721
5763
  return {
5722
5764
  value: Number.parseFloat(numMatch[1]),
@@ -5724,7 +5766,7 @@ async function parseOCRResult(ocrResult) {
5724
5766
  };
5725
5767
  }
5726
5768
  return void 0;
5727
- }), "extractStatValue"))(t);
5769
+ }), "extractStatValue"))(t2);
5728
5770
  if (!value) {
5729
5771
  return void 0;
5730
5772
  }
@@ -5770,7 +5812,7 @@ async function parseOCRResult(ocrResult) {
5770
5812
  }
5771
5813
  __name(removeRivenSuffix, "removeRivenSuffix");
5772
5814
  return merged ? removeRivenSuffix(merged) : null;
5773
- }), "extractWeaponName"))(texts.filter((t) => !statLines.includes(t)));
5815
+ }), "extractWeaponName"))(texts.filter((t2) => !statLines.includes(t2)));
5774
5816
  if (!weaponName || !attributes.length) {
5775
5817
  return void 0;
5776
5818
  }
@@ -5783,7 +5825,11 @@ __name(parseOCRResult, "parseOCRResult");
5783
5825
  function analyzeRivenStat(parseResult) {
5784
5826
  const weaponRiven = getWeaponRivenDisposition(parseResult.name);
5785
5827
  if (!weaponRiven) {
5786
- return `未找到武器: ${parseResult.name}`;
5828
+ return {
5829
+ ok: false,
5830
+ message: "riven.weaponNotFound",
5831
+ params: { weapon: parseResult.name }
5832
+ };
5787
5833
  }
5788
5834
  const disposition = weaponRiven.calc.disposition;
5789
5835
  const weaponType = weaponRiven.calc.riventype;
@@ -5837,15 +5883,18 @@ function analyzeRivenStat(parseResult) {
5837
5883
  }
5838
5884
  }
5839
5885
  return {
5840
- name: weaponRiven.name.zh,
5841
- disposition,
5842
- buffs,
5843
- curses
5886
+ ok: true,
5887
+ data: {
5888
+ name: weaponRiven.name.zh,
5889
+ disposition,
5890
+ buffs,
5891
+ curses
5892
+ }
5844
5893
  };
5845
5894
  }
5846
5895
  __name(analyzeRivenStat, "analyzeRivenStat");
5847
5896
 
5848
- // src/services/wfm-service.ts
5897
+ // src/services/wfm-service/index.ts
5849
5898
  var import_warframe_public_export_plus7 = require("warframe-public-export-plus");
5850
5899
 
5851
5900
  // src/data/wfm/globalDucatnator.ts
@@ -5858,6 +5907,46 @@ var globalDucatnatorIDDict = createAsyncCache(async () => {
5858
5907
  }, 36e5);
5859
5908
 
5860
5909
  // src/data/wfm/globalItem.ts
5910
+ function normalizeWordPrefixName(input) {
5911
+ return fullWidthToHalfWidth(input).toLowerCase().replace(/[·'()+【】[\]{},。!?;:_]/g, " ").replace(/[-/\\]/g, " ").replace(/\s+/g, " ").trim();
5912
+ }
5913
+ __name(normalizeWordPrefixName, "normalizeWordPrefixName");
5914
+ function splitWordPrefixTokens(input) {
5915
+ const normalized = normalizeWordPrefixName(input);
5916
+ if (!normalized) {
5917
+ return [];
5918
+ }
5919
+ return normalized.split(" ").filter(Boolean);
5920
+ }
5921
+ __name(splitWordPrefixTokens, "splitWordPrefixTokens");
5922
+ function buildGlobalItemWordPrefixCandidates(globalItemList) {
5923
+ const candidates = [];
5924
+ const seen = /* @__PURE__ */ new Set();
5925
+ for (const item of globalItemList) {
5926
+ const names = [
5927
+ item.i18n?.en?.name,
5928
+ item.i18n?.["zh-hans"]?.name
5929
+ ].filter((name2) => typeof name2 === "string" && name2.length > 0);
5930
+ for (const name2 of names) {
5931
+ const normalizedName = normalizeWordPrefixName(name2.toLowerCase());
5932
+ if (!normalizedName || seen.has(`${item.slug}:${normalizedName}`)) {
5933
+ continue;
5934
+ }
5935
+ const tokens = splitWordPrefixTokens(normalizedName);
5936
+ if (tokens.length === 0) {
5937
+ continue;
5938
+ }
5939
+ seen.add(`${item.slug}:${normalizedName}`);
5940
+ candidates.push({
5941
+ item,
5942
+ normalizedName,
5943
+ tokens
5944
+ });
5945
+ }
5946
+ }
5947
+ return candidates;
5948
+ }
5949
+ __name(buildGlobalItemWordPrefixCandidates, "buildGlobalItemWordPrefixCandidates");
5861
5950
  async function globalItemDataFactory(response) {
5862
5951
  response ??= await wfmClient.items.getList();
5863
5952
  if (!response) {
@@ -5865,7 +5954,8 @@ async function globalItemDataFactory(response) {
5865
5954
  globalItemList: [],
5866
5955
  globalItemDict: {},
5867
5956
  globalItemNameToSlugDict: {},
5868
- globalItemGameRefDict: {}
5957
+ globalItemGameRefDict: {},
5958
+ globalItemWordPrefixCandidates: []
5869
5959
  };
5870
5960
  }
5871
5961
  const data = response;
@@ -5887,111 +5977,281 @@ async function globalItemDataFactory(response) {
5887
5977
  return result;
5888
5978
  })(globalItemList);
5889
5979
  const globalItemGameRefDict = listToDict(data, (i) => [i.gameRef]);
5980
+ const globalItemWordPrefixCandidates = buildGlobalItemWordPrefixCandidates(
5981
+ globalItemList
5982
+ );
5890
5983
  return {
5891
5984
  globalItemList,
5892
5985
  globalItemDict,
5893
5986
  globalItemNameToSlugDict,
5894
- globalItemGameRefDict
5987
+ globalItemGameRefDict,
5988
+ globalItemWordPrefixCandidates
5895
5989
  };
5896
5990
  }
5897
5991
  __name(globalItemDataFactory, "globalItemDataFactory");
5898
5992
  var globalItemData = createAsyncCache(globalItemDataFactory, -1);
5899
5993
 
5900
- // src/services/wfm-service.ts
5901
- var warframeAlias = {
5902
- "Volt": ["电", "电男", "伏特"],
5903
- "Trinity": ["奶妈", "奶"],
5904
- "Rhino": ["犀牛", "牛"],
5905
- "Mag": ["磁妹", "磁力"],
5906
- "Loki": ["洛基"],
5907
- "Excalibur": ["咖喱棒", "圣剑", "咖喱"],
5908
- "Ember": ["火鸡"],
5909
- "Ash": ["灰烬", "灰烬之刃"],
5910
- "Nyx": ["脑溢血"],
5911
- "Frost": ["冰男", "冰雪寒霜", "冰队", "冰"],
5912
- "Saryn": ["毒妈", "毒"],
5913
- "Banshee": ["女妖", "女高音"],
5914
- "Vauban": ["工程"],
5915
- "Nova": ["诺娃", "加速", "加速娃"],
5916
- "Nekros": ["摸尸", "摸"],
5917
- "Valkyr": ["瓦尔基里", "瓦喵", "瓦"],
5918
- "Oberon": ["奶爸", "龙王", "奥伯龙"],
5919
- "Zephyr": ["鸟姐", "鸟"],
5920
- "Hydroid": ["水男"],
5921
- "Mirage": ["小丑", "丑"],
5922
- "Limbo": ["小明", "李明博", "明"],
5923
- "Mesa": ["女枪"],
5924
- "Chroma": ["龙甲", "龙"],
5925
- "Equinox": ["阴阳", "双子"],
5926
- "Atlas": ["土石魔像", "土"],
5927
- "Wukong": ["猴子", "齐天大圣", "悟空", "猴"],
5928
- "Ivara": ["弓妹", "弓"],
5929
- "Nezha": ["哪吒", "三太子"],
5930
- "Inaros": ["沙"],
5931
- "Titania": ["蝶妹"],
5932
- "Nidus": ["蛆甲", "蛆"],
5933
- "Octavia": ["DJ", "音乐"],
5934
- "Harrow": ["主教"],
5935
- "Gara": ["玻璃"],
5936
- "Khora": ["猫"],
5937
- "Revenant": ["夜灵"],
5938
- "Garuda": ["血妈", "血"],
5939
- "Baruuk": ["武僧"],
5940
- "Hildryn": ["母牛"],
5941
- "Wisp": ["花"],
5942
- "Gauss": ["高斯"],
5943
- "Grendel": ["肥宅"],
5944
- "Protea": ["茶", "茶妹"],
5945
- "Xaku": ["骨"],
5946
- "Lavos": ["炼金", "药水", "药水哥", "蛇"],
5947
- "Sevagoth": ["鬼", "鲨鱼"],
5948
- "Yareli": ["水妹"],
5949
- "Caliban": ["卡利班"],
5950
- "Gyre": ["电妹"],
5951
- "Styanax": ["斯巴达"],
5952
- "Voruna": ["狼", "狼妹"],
5953
- "Citrine": ["水晶", "宝石"],
5954
- "Kullervo": ["刀哥"],
5955
- "Dagath": ["马", "赛马娘", "马娘"],
5956
- "Qorvex": ["暖气片"],
5957
- "Dante": ["但丁"],
5958
- "Jade": ["翡翠", "天使"],
5959
- "Koumei": [],
5960
- "Cyte-09": ["Cyte09", "老九", "9", "九"],
5961
- "Temple": ["吉他"],
5962
- "Nokko": ["蘑菇"]
5963
- };
5964
- var warframeAliasDict = ((aliasObject) => {
5965
- const transformedObject = {};
5966
- for (const [key, aliases] of Object.entries(aliasObject)) {
5967
- transformedObject[key] = key;
5968
- for (const alias of aliases) {
5969
- if (typeof alias === "string" && alias.length > 0) {
5970
- transformedObject[alias] = key;
5971
- const warframeNameWithSuffix = `${alias}甲`;
5972
- transformedObject[warframeNameWithSuffix] = key;
5994
+ // src/services/wfm-service/wfm-service.item-matcher.ts
5995
+ var wfmItemMatcher = (() => {
5996
+ const setSuffix = "一套";
5997
+ const bpSuffix = "蓝图";
5998
+ const primeSuffix = "prime";
5999
+ const warframePartSuffix = ["系统", "头部神经光元", "机体"];
6000
+ const weaponPartSuffix = [
6001
+ "枪管",
6002
+ "枪托",
6003
+ "枪机",
6004
+ "弓弦",
6005
+ "上弓臂",
6006
+ "下弓臂",
6007
+ "刀刃",
6008
+ "握柄",
6009
+ "拳套",
6010
+ "圆盘",
6011
+ "连接器"
6012
+ ];
6013
+ const warframeAliasDict = ((aliasObject) => {
6014
+ const transformedObject = {};
6015
+ for (const [key, aliases] of Object.entries(aliasObject)) {
6016
+ const normalizedKey = normalizeName(key);
6017
+ transformedObject[normalizedKey] = normalizedKey;
6018
+ for (const alias of aliases) {
6019
+ if (typeof alias !== "string" || alias.length === 0) {
6020
+ continue;
6021
+ }
6022
+ const normalizedAlias = normalizeName(alias);
6023
+ transformedObject[normalizedAlias] = normalizedKey;
6024
+ const warframeNameWithSuffix = normalizeName(`${alias}甲`);
6025
+ transformedObject[warframeNameWithSuffix] = normalizedKey;
6026
+ }
6027
+ }
6028
+ return transformedObject;
6029
+ })(warframeAlias);
6030
+ function removeNameSuffix2(input) {
6031
+ let hasBPSuffix = false;
6032
+ if (input.endsWith(bpSuffix)) {
6033
+ input = input.replace(new RegExp(`${bpSuffix}$`), "");
6034
+ hasBPSuffix = true;
6035
+ }
6036
+ if (input.endsWith(setSuffix)) {
6037
+ input = input.replace(new RegExp(`${setSuffix}$`), "");
6038
+ }
6039
+ if (input.endsWith(bpSuffix)) {
6040
+ input = input.replace(new RegExp(`${bpSuffix}$`), "");
6041
+ hasBPSuffix = true;
6042
+ }
6043
+ const suffix = warframePartSuffix.find((value) => input.endsWith(value)) ?? weaponPartSuffix.find((value) => input.endsWith(value)) ?? (input.endsWith("头") ? "头部神经光元" : void 0) ?? (hasBPSuffix ? bpSuffix : void 0) ?? "";
6044
+ if (suffix) {
6045
+ input = input.endsWith("头") ? input.replace(/头$/, "") : input;
6046
+ const pure = input.replace(new RegExp(`${suffix}$`), "");
6047
+ return {
6048
+ pure,
6049
+ suffix
6050
+ };
6051
+ } else {
6052
+ return {
6053
+ pure: input,
6054
+ suffix
6055
+ };
6056
+ }
6057
+ }
6058
+ __name(removeNameSuffix2, "removeNameSuffix");
6059
+ function shortHandProcess2(input, lookup) {
6060
+ const { pure: inputNoSuffix, suffix } = removeNameSuffix2(input);
6061
+ if (inputNoSuffix === input) {
6062
+ const fixSet = input + setSuffix;
6063
+ const fixSetRes = lookup.globalItemNameToSlugDict[fixSet];
6064
+ if (fixSetRes)
6065
+ return lookup.globalItemDict[fixSetRes];
6066
+ const fixPrime = input.endsWith(primeSuffix) ? input : input.endsWith("p") ? input.slice(0, input.length - 1) + primeSuffix : input + primeSuffix;
6067
+ const fixPrimeRes = lookup.globalItemNameToSlugDict[fixPrime];
6068
+ if (fixPrimeRes)
6069
+ return lookup.globalItemDict[fixPrimeRes];
6070
+ const fixPrimeSet = fixPrime + setSuffix;
6071
+ const fixPrimeSetRes = lookup.globalItemNameToSlugDict[fixPrimeSet];
6072
+ if (fixPrimeSetRes)
6073
+ return lookup.globalItemDict[fixPrimeSetRes];
6074
+ const fixBP = input + bpSuffix;
6075
+ const fixBPRes = lookup.globalItemNameToSlugDict[fixBP];
6076
+ if (fixBPRes)
6077
+ return lookup.globalItemDict[fixBPRes];
6078
+ const fixPrimeBP = fixPrime + bpSuffix;
6079
+ const fixPrimeBPRes = lookup.globalItemNameToSlugDict[fixPrimeBP];
6080
+ if (fixPrimeBPRes)
6081
+ return lookup.globalItemDict[fixPrimeBPRes];
6082
+ } else {
6083
+ const fixBP = inputNoSuffix + suffix + bpSuffix;
6084
+ const fixBPRes = lookup.globalItemNameToSlugDict[fixBP];
6085
+ if (fixBPRes)
6086
+ return lookup.globalItemDict[fixBPRes];
6087
+ const fixPrime = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix : inputNoSuffix.endsWith("p") ? inputNoSuffix.slice(0, inputNoSuffix.length - 1) + primeSuffix : inputNoSuffix + primeSuffix;
6088
+ const fixPrimeRes = lookup.globalItemNameToSlugDict[fixPrime + suffix];
6089
+ if (fixPrimeRes)
6090
+ return lookup.globalItemDict[fixPrimeRes];
6091
+ const fixPrimeBP = fixPrime + suffix + bpSuffix;
6092
+ const fixPrimeBPRes = lookup.globalItemNameToSlugDict[fixPrimeBP];
6093
+ if (fixPrimeBPRes)
6094
+ return lookup.globalItemDict[fixPrimeBPRes];
6095
+ }
6096
+ }
6097
+ __name(shortHandProcess2, "shortHandProcess");
6098
+ function matchBySlugDict2(input, lookup) {
6099
+ const slug = lookup.globalItemNameToSlugDict[input];
6100
+ return slug ? lookup.globalItemDict[slug] : void 0;
6101
+ }
6102
+ __name(matchBySlugDict2, "matchBySlugDict");
6103
+ function matchByShortHand2(input, lookup) {
6104
+ return shortHandProcess2(input, lookup);
6105
+ }
6106
+ __name(matchByShortHand2, "matchByShortHand");
6107
+ function transformByWarframeAlias2(input) {
6108
+ const { pure: inputNoSuffix, suffix } = removeNameSuffix2(input);
6109
+ const aliasHasEndP = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix.replace(new RegExp(`${primeSuffix}$`), "") : inputNoSuffix;
6110
+ const mappedAliasHasEndP = warframeAliasDict[aliasHasEndP];
6111
+ if (mappedAliasHasEndP) {
6112
+ return normalizeName(mappedAliasHasEndP) + suffix;
6113
+ }
6114
+ if (inputNoSuffix.endsWith("p")) {
6115
+ const aliasNoEndP = inputNoSuffix.replace(/p$/, "");
6116
+ const mappedAliasNoEndP = warframeAliasDict[aliasNoEndP];
6117
+ if (mappedAliasNoEndP) {
6118
+ return normalizeName(mappedAliasNoEndP) + suffix;
6119
+ }
6120
+ }
6121
+ return void 0;
6122
+ }
6123
+ __name(transformByWarframeAlias2, "transformByWarframeAlias");
6124
+ function buildSuffixVariantCandidates2(input) {
6125
+ const candidates = /* @__PURE__ */ new Set();
6126
+ const { pure, suffix } = removeNameSuffix2(input);
6127
+ candidates.add(input);
6128
+ candidates.add(input + bpSuffix);
6129
+ candidates.add(`${input}blueprint`);
6130
+ candidates.add(input + setSuffix);
6131
+ candidates.add(`${input}set`);
6132
+ if (suffix) {
6133
+ const base = pure + suffix;
6134
+ candidates.add(base);
6135
+ candidates.add(base + bpSuffix);
6136
+ candidates.add(`${base}blueprint`);
6137
+ candidates.add(base + setSuffix);
6138
+ candidates.add(`${base}set`);
6139
+ }
6140
+ return [...candidates];
6141
+ }
6142
+ __name(buildSuffixVariantCandidates2, "buildSuffixVariantCandidates");
6143
+ function matchBySuffixVariantLookup2(input, lookup) {
6144
+ for (const candidate of buildSuffixVariantCandidates2(input)) {
6145
+ const slug = lookup.globalItemNameToSlugDict[candidate];
6146
+ if (slug)
6147
+ return lookup.globalItemDict[slug];
6148
+ }
6149
+ return void 0;
6150
+ }
6151
+ __name(matchBySuffixVariantLookup2, "matchBySuffixVariantLookup");
6152
+ function normalizeWordPrefixName3(input) {
6153
+ return fullWidthToHalfWidth(input).toLowerCase().replace(/[·'()+【】[\]{},。!?;:_]/g, " ").replace(/[-/\\]/g, " ").replace(/\s+/g, " ").trim();
6154
+ }
6155
+ __name(normalizeWordPrefixName3, "normalizeWordPrefixName");
6156
+ function splitWordPrefixTokens3(input) {
6157
+ const normalized = normalizeWordPrefixName3(input);
6158
+ if (!normalized) {
6159
+ return [];
6160
+ }
6161
+ return normalized.split(" ").filter(Boolean);
6162
+ }
6163
+ __name(splitWordPrefixTokens3, "splitWordPrefixTokens");
6164
+ function compareWordPrefixCandidates(left, right, inputTokens) {
6165
+ const leftExtraTokenCount = left.tokens.length - inputTokens.length;
6166
+ const rightExtraTokenCount = right.tokens.length - inputTokens.length;
6167
+ if (leftExtraTokenCount !== rightExtraTokenCount) {
6168
+ return leftExtraTokenCount - rightExtraTokenCount;
6169
+ }
6170
+ const leftRemainderKey = inputTokens.map((token, index) => left.tokens[index].slice(token.length)).join("\0");
6171
+ const rightRemainderKey = inputTokens.map((token, index) => right.tokens[index].slice(token.length)).join("\0");
6172
+ if (leftRemainderKey !== rightRemainderKey) {
6173
+ return leftRemainderKey.localeCompare(rightRemainderKey);
6174
+ }
6175
+ return left.normalizedName.localeCompare(right.normalizedName);
6176
+ }
6177
+ __name(compareWordPrefixCandidates, "compareWordPrefixCandidates");
6178
+ function matchByWordPrefixSequence2(input, lookup) {
6179
+ const inputTokens = splitWordPrefixTokens3(input);
6180
+ if (inputTokens.length < 2) {
6181
+ return void 0;
6182
+ }
6183
+ const matchedCandidates = lookup.globalItemWordPrefixCandidates.filter((candidate) => {
6184
+ if (candidate.tokens.length < inputTokens.length) {
6185
+ return false;
5973
6186
  }
6187
+ return inputTokens.every(
6188
+ (token, index) => candidate.tokens[index].startsWith(token)
6189
+ );
6190
+ }).sort((left, right) => compareWordPrefixCandidates(left, right, inputTokens));
6191
+ return matchedCandidates[0]?.item;
6192
+ }
6193
+ __name(matchByWordPrefixSequence2, "matchByWordPrefixSequence");
6194
+ async function stringToWFMItem2(input) {
6195
+ const { globalItemDict, globalItemNameToSlugDict, globalItemWordPrefixCandidates } = await globalItemData.get();
6196
+ const normalizedInput = normalizeName(input);
6197
+ const lookup = {
6198
+ globalItemDict,
6199
+ globalItemNameToSlugDict,
6200
+ globalItemWordPrefixCandidates
6201
+ };
6202
+ const slugMatchedItem = matchBySlugDict2(normalizedInput, lookup);
6203
+ if (slugMatchedItem)
6204
+ return slugMatchedItem;
6205
+ const shortHandMatchedItem = matchByShortHand2(normalizedInput, lookup);
6206
+ if (shortHandMatchedItem)
6207
+ return shortHandMatchedItem;
6208
+ const aliasInput = transformByWarframeAlias2(normalizedInput);
6209
+ if (aliasInput) {
6210
+ const aliasShortHandMatchedItem = matchByShortHand2(aliasInput, lookup);
6211
+ if (aliasShortHandMatchedItem)
6212
+ return aliasShortHandMatchedItem;
6213
+ }
6214
+ const suffixMatchedItem = matchBySuffixVariantLookup2(normalizedInput, lookup);
6215
+ if (suffixMatchedItem)
6216
+ return suffixMatchedItem;
6217
+ if (aliasInput) {
6218
+ const aliasSuffixMatchedItem = matchBySuffixVariantLookup2(aliasInput, lookup);
6219
+ if (aliasSuffixMatchedItem)
6220
+ return aliasSuffixMatchedItem;
5974
6221
  }
6222
+ const wordPrefixMatchedItem = matchByWordPrefixSequence2(input, lookup);
6223
+ if (wordPrefixMatchedItem)
6224
+ return wordPrefixMatchedItem;
6225
+ return void 0;
5975
6226
  }
5976
- return transformedObject;
5977
- })(warframeAlias);
5978
- var setSuffix = "一套";
5979
- var bpSuffix = "蓝图";
5980
- var primeSuffix = "prime";
5981
- var warframePartSuffix = ["系统", "头部神经光元", "机体"];
5982
- var weaponPartSuffix = [
5983
- "枪管",
5984
- "枪托",
5985
- "枪机",
5986
- "弓弦",
5987
- "上弓臂",
5988
- "下弓臂",
5989
- "刀刃",
5990
- "握柄",
5991
- "拳套",
5992
- "圆盘",
5993
- "连接器"
5994
- ];
6227
+ __name(stringToWFMItem2, "stringToWFMItem");
6228
+ return {
6229
+ buildSuffixVariantCandidates: buildSuffixVariantCandidates2,
6230
+ matchByShortHand: matchByShortHand2,
6231
+ matchBySlugDict: matchBySlugDict2,
6232
+ matchBySuffixVariantLookup: matchBySuffixVariantLookup2,
6233
+ matchByWordPrefixSequence: matchByWordPrefixSequence2,
6234
+ removeNameSuffix: removeNameSuffix2,
6235
+ splitWordPrefixTokens: splitWordPrefixTokens3,
6236
+ shortHandProcess: shortHandProcess2,
6237
+ stringToWFMItem: stringToWFMItem2,
6238
+ transformByWarframeAlias: transformByWarframeAlias2,
6239
+ normalizeWordPrefixName: normalizeWordPrefixName3
6240
+ };
6241
+ })();
6242
+ var buildSuffixVariantCandidates = wfmItemMatcher.buildSuffixVariantCandidates;
6243
+ var matchByShortHand = wfmItemMatcher.matchByShortHand;
6244
+ var matchBySlugDict = wfmItemMatcher.matchBySlugDict;
6245
+ var matchBySuffixVariantLookup = wfmItemMatcher.matchBySuffixVariantLookup;
6246
+ var matchByWordPrefixSequence = wfmItemMatcher.matchByWordPrefixSequence;
6247
+ var normalizeWordPrefixName2 = wfmItemMatcher.normalizeWordPrefixName;
6248
+ var removeNameSuffix = wfmItemMatcher.removeNameSuffix;
6249
+ var splitWordPrefixTokens2 = wfmItemMatcher.splitWordPrefixTokens;
6250
+ var shortHandProcess = wfmItemMatcher.shortHandProcess;
6251
+ var stringToWFMItem = wfmItemMatcher.stringToWFMItem;
6252
+ var transformByWarframeAlias = wfmItemMatcher.transformByWarframeAlias;
6253
+
6254
+ // src/services/wfm-service/index.ts
5995
6255
  async function updateCache() {
5996
6256
  const updateTasks = [
5997
6257
  { name: "globalItemData", fn: globalItemData.update() },
@@ -6012,32 +6272,32 @@ async function updateCache() {
6012
6272
  }
6013
6273
  __name(updateCache, "updateCache");
6014
6274
  async function getItemOrders(input) {
6275
+ input = input.trim();
6015
6276
  if (!input) {
6016
- return { ok: false, message: "请输入物品名称" };
6277
+ return { ok: false, message: "wfm.inputItemName" };
6017
6278
  }
6018
- input = normalizeName(input);
6019
- const isFullLevel = /^满级|满级$/.test(input);
6279
+ const isFullLevel = /^满级|满级$/.test(normalizeName(input));
6020
6280
  if (isFullLevel) {
6021
6281
  if (input.startsWith("满级")) {
6022
- input = input.slice(2, input.length);
6282
+ input = input.slice(2, input.length).trimStart();
6023
6283
  } else if (input.endsWith("满级")) {
6024
- input = input.slice(0, input.length - 2);
6284
+ input = input.slice(0, input.length - 2).trimEnd();
6025
6285
  }
6026
6286
  }
6027
6287
  const targetItem = await stringToWFMItem(input);
6028
6288
  if (!targetItem) {
6029
- return { ok: false, message: `未找到物品: ${input}` };
6289
+ return { ok: false, message: "wfm.itemNotFound", params: { input } };
6030
6290
  }
6031
6291
  const itemId = targetItem.slug;
6032
6292
  const data = await wfmClient.items.getOrders(itemId);
6033
6293
  if (!data) {
6034
- return { ok: false, message: "订单获取失败,请稍后重试" };
6294
+ return { ok: false, message: "wfm.orderFetchFailed" };
6035
6295
  }
6036
6296
  const result = data.filter(
6037
6297
  (order) => order.user.status === "ingame" && order.visible && order.type === "sell" && (!isFullLevel || order.rank === targetItem.maxRank)
6038
6298
  ).sort((a, b) => toTimeStamp(b.updatedAt) - toTimeStamp(a.updatedAt)).sort((a, b) => a.platinum - b.platinum).slice(0, 5);
6039
6299
  if (result.length === 0) {
6040
- return { ok: false, message: "当前没有在线游戏中的卖家" };
6300
+ return { ok: false, message: "wfm.noOnlineSeller" };
6041
6301
  }
6042
6302
  return {
6043
6303
  ok: true,
@@ -6054,18 +6314,18 @@ async function getRivenOrders(input) {
6054
6314
  (item) => compareRivenItemName(input, item.i18n?.en?.name ?? "")
6055
6315
  );
6056
6316
  if (!targetItem) {
6057
- return { ok: false, message: `未找到紫卡武器: ${input}` };
6317
+ return { ok: false, message: "wfm.rivenWeaponNotFound", params: { input } };
6058
6318
  }
6059
6319
  const itemId = targetItem.slug;
6060
6320
  const data = await wfmClient.rivens.getOrders(itemId);
6061
6321
  if (!data) {
6062
- return { ok: false, message: "紫卡订单获取失败,请稍后重试" };
6322
+ return { ok: false, message: "wfm.rivenOrderFetchFailed" };
6063
6323
  }
6064
6324
  const top5 = data.filter(
6065
6325
  (order) => order.owner.status === "ingame" && order.visible && !order.private && !order.closed && order.is_direct_sell
6066
6326
  ).sort((a, b) => toTimeStamp(b.updated) - toTimeStamp(a.updated)).sort((a, b) => a.starting_price - b.starting_price).slice(0, 5);
6067
6327
  if (top5.length === 0) {
6068
- return { ok: false, message: "当前没有在线出售的紫卡" };
6328
+ return { ok: false, message: "wfm.noOnlineRivenSeller" };
6069
6329
  }
6070
6330
  const orders = top5.map((e) => {
6071
6331
  const transformed = e.item.attributes.map(
@@ -6168,159 +6428,6 @@ var primedModHistory = createAsyncCache(async () => {
6168
6428
  }
6169
6429
  return result;
6170
6430
  }, 432e5);
6171
- async function stringToWFMItem(input) {
6172
- const { globalItemList, globalItemDict, globalItemNameToSlugDict } = await globalItemData.get();
6173
- input = normalizeName(input);
6174
- const slug = globalItemNameToSlugDict[input];
6175
- if (slug)
6176
- return globalItemDict[slug];
6177
- const normalShortHandRes = await shortHandProcess(input);
6178
- if (normalShortHandRes)
6179
- return normalShortHandRes;
6180
- const { pure: inputNoSuffix, suffix } = removeNameSuffix(input);
6181
- const aliasHasEndP = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix.replace(new RegExp(`${primeSuffix}$`), "") : inputNoSuffix;
6182
- const mappedAliasHasEndP = warframeAliasDict[aliasHasEndP];
6183
- if (mappedAliasHasEndP) {
6184
- const aliasHasEndPRes = await shortHandProcess(
6185
- normalizeName(mappedAliasHasEndP) + primeSuffix + suffix
6186
- );
6187
- if (aliasHasEndPRes)
6188
- return aliasHasEndPRes;
6189
- }
6190
- if (inputNoSuffix.endsWith("p")) {
6191
- const aliasNoEndP = inputNoSuffix.replace(/p$/, "");
6192
- const mappedAliasNoEndP = warframeAliasDict[aliasNoEndP];
6193
- if (mappedAliasNoEndP) {
6194
- const aliasNoEndPRes = await shortHandProcess(
6195
- normalizeName(mappedAliasNoEndP) + primeSuffix + suffix
6196
- );
6197
- if (aliasNoEndPRes)
6198
- return aliasNoEndPRes;
6199
- }
6200
- }
6201
- const compareCNOrderName = /* @__PURE__ */ __name((input2, standard) => {
6202
- if (!input2 || !standard || typeof input2 !== "string" || typeof standard !== "string") {
6203
- return false;
6204
- }
6205
- const normalizedInput = normalizeName(input2);
6206
- const normalizedStandard = normalizeName(standard);
6207
- if (!normalizedInput || !normalizedStandard)
6208
- return false;
6209
- const normalizedStandardNoSet = normalizedStandard.replace(/一套/g, "");
6210
- const normalizedStandardNoSetSimplifiedPrime = normalizedStandardNoSet.replace(/prime/g, "p");
6211
- const normalizedStandardNoBlueprint = normalizedStandard.replace(
6212
- /蓝图/g,
6213
- ""
6214
- );
6215
- const normalizedStandardNoBlueprintSimplifiedPrime = normalizedStandardNoBlueprint.replace(/prime/g, "p");
6216
- const normalizedStandardNoNeu = normalizedStandardNoBlueprintSimplifiedPrime.replace(
6217
- /头部神经光元/g,
6218
- "头"
6219
- );
6220
- return normalizedInput === normalizedStandard || normalizedInput === normalizedStandardNoSet || normalizedInput === normalizedStandardNoSetSimplifiedPrime || normalizedInput === normalizedStandardNoBlueprintSimplifiedPrime || normalizedInput === normalizedStandardNoNeu;
6221
- }, "compareCNOrderName");
6222
- const compareENOrderName = /* @__PURE__ */ __name((input2, standard) => {
6223
- if (!input2 || !standard || typeof input2 !== "string" || typeof standard !== "string") {
6224
- return false;
6225
- }
6226
- const endWithSet = standard.toLowerCase().endsWith(" set");
6227
- const standardNoSet = endWithSet ? standard.slice(0, -4) : standard;
6228
- const endWithBlueprint = standard.toLocaleLowerCase().endsWith("blueprint");
6229
- const standardNoBlueprint = endWithBlueprint ? standard.slice(0, -10) : standard;
6230
- const standardSimplifiedPrime = standardNoSet.replace(/ Prime/g, "p");
6231
- const standardNoBlueprintSimplifiedPrime = standardNoBlueprint.replace(
6232
- / Prime/g,
6233
- "p"
6234
- );
6235
- const normalizedInput = normalizeName(input2);
6236
- const normalizedStandard = normalizeName(standard);
6237
- if (!normalizedInput || !normalizedStandard)
6238
- return false;
6239
- const normalizedStandardNoSet = normalizeName(standardNoSet);
6240
- const normalizedStandardSimplifiedPrime = normalizeName(
6241
- standardSimplifiedPrime
6242
- );
6243
- const normalizedStandardNoBlueprint = normalizeName(
6244
- standardNoBlueprintSimplifiedPrime
6245
- );
6246
- return normalizedInput === normalizedStandard || normalizedInput === normalizedStandardNoSet || normalizedInput === normalizedStandardSimplifiedPrime || normalizedInput === normalizedStandardNoBlueprint;
6247
- }, "compareENOrderName");
6248
- return globalItemList.find(
6249
- (item) => compareCNOrderName(input, item.i18n?.["zh-hans"]?.name ?? "")
6250
- ) ?? globalItemList.find(
6251
- (item) => compareENOrderName(input, item.i18n?.en?.name ?? "")
6252
- );
6253
- }
6254
- __name(stringToWFMItem, "stringToWFMItem");
6255
- function removeNameSuffix(input) {
6256
- let hasBPSuffix = false;
6257
- if (input.endsWith(bpSuffix)) {
6258
- input = input.replace(new RegExp(`${bpSuffix}$`), "");
6259
- hasBPSuffix = true;
6260
- }
6261
- if (input.endsWith(setSuffix)) {
6262
- input = input.replace(new RegExp(`${setSuffix}$`), "");
6263
- }
6264
- if (input.endsWith(bpSuffix)) {
6265
- input = input.replace(new RegExp(`${bpSuffix}$`), "");
6266
- hasBPSuffix = true;
6267
- }
6268
- const suffix = warframePartSuffix.find((value) => input.endsWith(value)) ?? weaponPartSuffix.find((value) => input.endsWith(value)) ?? (input.endsWith("头") ? "头部神经光元" : void 0) ?? (hasBPSuffix ? bpSuffix : void 0) ?? "";
6269
- if (suffix) {
6270
- input = input.endsWith("头") ? input.replace(/头$/, "") : input;
6271
- const pure = input.replace(new RegExp(`${suffix}$`), "");
6272
- return {
6273
- pure,
6274
- suffix
6275
- };
6276
- } else {
6277
- return {
6278
- pure: input,
6279
- suffix
6280
- };
6281
- }
6282
- }
6283
- __name(removeNameSuffix, "removeNameSuffix");
6284
- async function shortHandProcess(input) {
6285
- const { globalItemDict, globalItemNameToSlugDict } = await globalItemData.get();
6286
- const { pure: inputNoSuffix, suffix } = removeNameSuffix(input);
6287
- if (inputNoSuffix === input) {
6288
- const fixSet = input + setSuffix;
6289
- const fixSetRes = globalItemNameToSlugDict[fixSet];
6290
- if (fixSetRes)
6291
- return globalItemDict[fixSetRes];
6292
- const fixPrime = input.endsWith(primeSuffix) ? input : input.endsWith("p") ? input.slice(0, input.length - 1) + primeSuffix : input + primeSuffix;
6293
- const fixPrimeRes = globalItemNameToSlugDict[fixPrime];
6294
- if (fixPrimeRes)
6295
- return globalItemDict[fixPrimeRes];
6296
- const fixPrimeSet = fixPrime + setSuffix;
6297
- const fixPrimeSetRes = globalItemNameToSlugDict[fixPrimeSet];
6298
- if (fixPrimeSetRes)
6299
- return globalItemDict[fixPrimeSetRes];
6300
- const fixBP = input + bpSuffix;
6301
- const fixBPRes = globalItemNameToSlugDict[fixBP];
6302
- if (fixBPRes)
6303
- return globalItemDict[fixBPRes];
6304
- const fixPrimeBP = fixPrime + bpSuffix;
6305
- const fixPrimeBPRes = globalItemNameToSlugDict[fixPrimeBP];
6306
- if (fixPrimeBPRes)
6307
- return globalItemDict[fixPrimeBPRes];
6308
- } else {
6309
- const fixBP = inputNoSuffix + suffix + bpSuffix;
6310
- const fixBPRes = globalItemNameToSlugDict[fixBP];
6311
- if (fixBPRes)
6312
- return globalItemDict[fixBPRes];
6313
- const fixPrime = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix : inputNoSuffix.endsWith("p") ? inputNoSuffix.slice(0, inputNoSuffix.length - 1) + primeSuffix : inputNoSuffix + primeSuffix;
6314
- const fixPrimeRes = globalItemNameToSlugDict[fixPrime + suffix];
6315
- if (fixPrimeRes)
6316
- return globalItemDict[fixPrimeRes];
6317
- const fixPrimeBP = fixPrime + suffix + bpSuffix;
6318
- const fixPrimeBPRes = globalItemNameToSlugDict[fixPrimeBP];
6319
- if (fixPrimeBPRes)
6320
- return globalItemDict[fixPrimeBPRes];
6321
- }
6322
- }
6323
- __name(shortHandProcess, "shortHandProcess");
6324
6431
  function compareRivenItemName(input, standard) {
6325
6432
  if (!input || !standard || typeof input !== "string" || typeof standard !== "string") {
6326
6433
  return false;
@@ -6334,13 +6441,18 @@ function compareRivenItemName(input, standard) {
6334
6441
  __name(compareRivenItemName, "compareRivenItemName");
6335
6442
 
6336
6443
  // src/commands/miscs.ts
6444
+ function inDevelopment() {
6445
+ return t("miscs.inDevelopment");
6446
+ }
6447
+ __name(inDevelopment, "inDevelopment");
6337
6448
  function createMiscsCommands(deps) {
6338
6449
  const { render } = deps;
6339
6450
  return {
6451
+ inDevelopment,
6340
6452
  hotRivenCommand: /* @__PURE__ */ __name(async () => {
6341
6453
  const result = await getHotRivenWeapons2();
6342
6454
  if (!result.ok) {
6343
- return result.message;
6455
+ return t(result);
6344
6456
  }
6345
6457
  return render(
6346
6458
  HotRivenComponent(result.data)
@@ -7947,7 +8059,7 @@ function createWfCommands(deps) {
7947
8059
  arbitrationCommand: /* @__PURE__ */ __name(async (_action, input) => {
7948
8060
  const result = getArbitrations(input);
7949
8061
  if (!result.ok) {
7950
- return result.message;
8062
+ return t(result);
7951
8063
  }
7952
8064
  return render(ArbitrationComponent(result.data));
7953
8065
  }, "arbitrationCommand"),
@@ -7965,69 +8077,69 @@ function createWfCommands(deps) {
7965
8077
  voidtraderCommand: /* @__PURE__ */ __name(async (_action) => {
7966
8078
  const result = await getVoidTrader();
7967
8079
  if (!result.ok) {
7968
- return result.message;
8080
+ return t(result);
7969
8081
  }
7970
8082
  return render(VoidTraderComponent(result.data));
7971
8083
  }, "voidtraderCommand"),
7972
8084
  fissureCommand: /* @__PURE__ */ __name(async (_action) => {
7973
8085
  const result = await getFissures();
7974
8086
  if (!result.ok) {
7975
- return result.message;
8087
+ return t(result);
7976
8088
  }
7977
8089
  return render(FissureComponent(result.data, "fissure"));
7978
8090
  }, "fissureCommand"),
7979
8091
  steelPathFissureCommand: /* @__PURE__ */ __name(async (_action) => {
7980
8092
  const result = await getSteelPathFissures();
7981
8093
  if (!result.ok) {
7982
- return result.message;
8094
+ return t(result);
7983
8095
  }
7984
8096
  return render(FissureComponent(result.data, "sp-fissure"));
7985
8097
  }, "steelPathFissureCommand"),
7986
8098
  railjackFissureCommand: /* @__PURE__ */ __name(async (_action) => {
7987
8099
  const result = await getRailjackFissures();
7988
8100
  if (!result.ok) {
7989
- return result.message;
8101
+ return t(result);
7990
8102
  }
7991
8103
  return render(FissureComponent(result.data, "rj-fissure"));
7992
8104
  }, "railjackFissureCommand"),
7993
8105
  relicCommand: /* @__PURE__ */ __name(async (_action, input) => {
7994
8106
  const result = await getRelic(input);
7995
8107
  if (!result.ok) {
7996
- return result.message;
8108
+ return t(result);
7997
8109
  }
7998
8110
  const relic = await applyRelicData(result.data);
7999
8111
  return render(RelicComponent(relic));
8000
8112
  }, "relicCommand"),
8001
8113
  rivenCommand: /* @__PURE__ */ __name(async (_action, input) => {
8002
8114
  if (!input?.src) {
8003
- return "未检测到图片";
8115
+ return t("riven.imageNotFound");
8004
8116
  }
8005
8117
  if (!config.ocrAPISecret?.id || !config.ocrAPISecret?.key) {
8006
- return "未配置 OCR,请在插件设置中配置。";
8118
+ return t("riven.ocrNotConfigured");
8007
8119
  }
8008
8120
  const result = await getAnalyzedRiven(
8009
8121
  config.ocrAPISecret,
8010
8122
  input.src
8011
8123
  );
8012
8124
  if (!result.ok) {
8013
- return result.message;
8125
+ return t(result);
8014
8126
  }
8015
8127
  return render(RivenComponent(result.data));
8016
8128
  }, "rivenCommand"),
8017
8129
  rivenStatCommand: /* @__PURE__ */ __name(async (_action, weaponType, statType, disposition) => {
8018
8130
  if (!weaponType || !statType || !disposition) {
8019
- return "请输入正确参数";
8131
+ return t("riven.invalidParams");
8020
8132
  }
8021
8133
  const result = await getStaticRivenStats(weaponType, statType, disposition);
8022
8134
  if (!result.ok) {
8023
- return result.message;
8135
+ return t(result);
8024
8136
  }
8025
8137
  return render(RivenStatComponent(result.data));
8026
8138
  }, "rivenStatCommand"),
8027
8139
  weeklyCommand: /* @__PURE__ */ __name(async (_action) => {
8028
8140
  const result = await getWeekly();
8029
8141
  if (!result.ok) {
8030
- return result.message;
8142
+ return t(result);
8031
8143
  }
8032
8144
  return render(
8033
8145
  WeeklyComponent(
@@ -8041,7 +8153,7 @@ function createWfCommands(deps) {
8041
8153
  const threshold = minPrice && minPrice > 0 ? minPrice : 100;
8042
8154
  const result = await getWeeklyRivens(threshold);
8043
8155
  if (result.length === 0) {
8044
- return "没有找到符合条件的紫卡参考数据";
8156
+ return t("riven.noWeeklyData");
8045
8157
  }
8046
8158
  return render(WeeklyRivenComponent(result.slice(0, 20), threshold));
8047
8159
  }, "weeklyRivenCommand"),
@@ -8561,14 +8673,14 @@ function createWfmCommands(deps) {
8561
8673
  wmCommand: /* @__PURE__ */ __name(async (_action, input) => {
8562
8674
  const result = await getItemOrders(input);
8563
8675
  if (!result.ok) {
8564
- return result.message;
8676
+ return t(result);
8565
8677
  }
8566
8678
  return render(ItemOrderComponent(result.data.item, result.data.orders));
8567
8679
  }, "wmCommand"),
8568
8680
  wmrCommand: /* @__PURE__ */ __name(async (_action, input) => {
8569
8681
  const result = await getRivenOrders(input);
8570
8682
  if (!result.ok) {
8571
- return result.message;
8683
+ return t(result);
8572
8684
  }
8573
8685
  return render(RivenOrderComponent(result.data.item, result.data.orders));
8574
8686
  }, "wmrCommand"),
@@ -8659,37 +8771,33 @@ function setupCommands(ctx, deps) {
8659
8771
  const wf = createWfCommands(deps);
8660
8772
  const wfm = createWfmCommands(deps);
8661
8773
  const miscs = createMiscsCommands(deps);
8662
- ctx.command("wm <itemId:text>", "请使用wmi替代").action(wfm.wmCommand);
8663
- ctx.command("wmr <itemId:text>", "查询wm的紫卡价格").action(wfm.wmrCommand);
8664
- ctx.command("wmi <msg:text>", "查询wm的物品价格").action(wfm.wmCommand);
8774
+ ctx.command("wm <item-name:text>", "请使用wmi替代").action(wfm.wmCommand);
8775
+ ctx.command("wmr <item-name:text>", "查询wm的紫卡价格").action(wfm.wmrCommand);
8776
+ ctx.command("wmi <item-name:text>", "查询wm的物品价格").action(wfm.wmCommand);
8665
8777
  ctx.command("wmu", "更新wm缓存数据").action(wfm.wmuCommand);
8666
8778
  ctx.command("arbitration [day:number]", "近期高价值仲裁任务").alias("arbi").alias("仲裁").alias("仲裁表").action(wf.arbitrationCommand);
8667
8779
  ctx.command("fissure", "当前虚空裂隙").alias("裂缝").alias("裂隙").action(wf.fissureCommand);
8668
- ctx.command("spfissure", "当前钢铁之路虚空裂隙").alias("钢铁裂缝").alias("钢铁裂隙").action(wf.steelPathFissureCommand);
8669
- ctx.command("rjfissure", "当前九重天虚空裂隙").alias("九重天裂缝").alias("九重天裂隙").action(wf.railjackFissureCommand);
8670
- ctx.command("relic <input:text>", "查询遗物内容").alias("遗物").alias("核桃").action(wf.relicCommand);
8780
+ ctx.command("fissure-sp", "当前钢铁之路虚空裂隙").alias("spfissure").alias("钢铁裂缝").alias("钢铁裂隙").action(wf.steelPathFissureCommand);
8781
+ ctx.command("fissure-rj", "当前九重天虚空裂隙").alias("rjfissure").alias("九重天裂缝").alias("九重天裂隙").action(wf.railjackFissureCommand);
8782
+ ctx.command("relic <relic-name:text>", "查询遗物内容").alias("遗物").alias("核桃").action(wf.relicCommand);
8671
8783
  ctx.command("environment", "当前各区域状态").alias("env").alias("平原").alias("地球").alias("金星").alias("夜灵").alias("夜灵平野").alias("奥布山谷").action(wf.environmentCommand);
8672
8784
  ctx.command("weekly", "周常任务").alias("周常").alias("科研").alias("时光科研").alias("深层科研").alias("执行官").action(wf.weeklyCommand);
8673
8785
  ctx.command("circuit", "本周回廊战甲及灵化之源").alias("灵化之源").alias("灵化").action(wf.circuitCommand);
8674
8786
  ctx.command("riven <img:image>", "分析紫卡截图").action(wf.rivenCommand);
8675
8787
  ctx.command(
8676
- "rivenstat <weaponType:string> <statType:string> <disposition:number>",
8788
+ "riven-stat <weaponType:string> <statType:string> <disposition:number>",
8677
8789
  "获取紫卡数值范围"
8678
8790
  ).usage(
8679
8791
  "武器类型: 步枪, 手枪, 霰弹枪, 近战, Archwing枪械\n词条类型: 2, 3, 21, 31"
8680
- ).example("rivenstat 步枪 31 0.7").alias("紫卡数值").action(wf.rivenStatCommand);
8681
- ctx.command("voidtrader", "虚空商人").alias("虚空商人").alias("奸商").action(wf.voidtraderCommand);
8682
- ctx.command("lichc", "c系玄骸武器", { hidden: true }).action(inDevelopment);
8683
- ctx.command("lichi", "i系玄骸武器", { hidden: true }).action(inDevelopment);
8684
- ctx.command("weeklyriven [minPrice:number]", "每周高价值紫卡参考 (未洗中位价)").alias("周紫卡").alias("周卡").action(wf.weeklyRivenCommand);
8685
- ctx.command("hotriven", "热门紫卡").action(miscs.hotRivenCommand);
8686
- ctx.command("pmodhistory", "Primed MOD 历史").alias("pmod").alias("P卡").alias("p卡").alias("P卡历史").alias("p卡历史").action(wfm.pmodhistoryCommand);
8792
+ ).example("riven-stat 步枪 31 0.7").alias("rivenstat").alias("紫卡数值").action(wf.rivenStatCommand);
8793
+ ctx.command("void-trader", "虚空商人").alias("voidtrader").alias("虚空商人").alias("奸商").action(wf.voidtraderCommand);
8794
+ ctx.command("lich-c", "c系玄骸武器", { hidden: true }).alias("lichc").action(miscs.inDevelopment);
8795
+ ctx.command("lich-i", "i系玄骸武器", { hidden: true }).alias("lichi").action(miscs.inDevelopment);
8796
+ ctx.command("riven-weekly [minPrice:number]", "每周高价值紫卡参考 (未洗中位价)").alias("weeklyriven").alias("周紫卡").alias("周卡").action(wf.weeklyRivenCommand);
8797
+ ctx.command("riven-hot", "热门紫卡").alias("hotriven").action(miscs.hotRivenCommand);
8798
+ ctx.command("pmod-history", "Primed MOD 历史").alias("pmodhistory").alias("pmod").alias("P卡").alias("p卡").alias("P卡历史").alias("p卡历史").action(wfm.pmodhistoryCommand);
8687
8799
  }
8688
8800
  __name(setupCommands, "setupCommands");
8689
- function inDevelopment() {
8690
- return "功能暂未开放";
8691
- }
8692
- __name(inDevelopment, "inDevelopment");
8693
8801
  // Annotate the CommonJS export names for ESM import in node:
8694
8802
  0 && (module.exports = {
8695
8803
  Config,