koishi-plugin-warframe 1.6.3 → 1.6.5
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/assets/warframeAlias.json +67 -0
- package/lib/index.d.ts +133 -10
- package/lib/index.js +617 -351
- package/lib/index.tsbuildinfo +1 -1
- package/package.json +4 -5
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(
|
|
696
|
+
yieldLoop(t2 = 0) {
|
|
697
697
|
return new this.Promise(function(resolve2, reject) {
|
|
698
|
-
return setTimeout(resolve2,
|
|
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,
|
|
4315
|
-
return Math.round(start + (end - start) *
|
|
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) => {
|
|
@@ -5176,8 +5219,48 @@ var globalRivenAttribute = createAsyncCache(
|
|
|
5176
5219
|
);
|
|
5177
5220
|
|
|
5178
5221
|
// src/data/wfm/globalRivenItem.ts
|
|
5179
|
-
|
|
5180
|
-
|
|
5222
|
+
function normalizeWordPrefixName(input) {
|
|
5223
|
+
return fullWidthToHalfWidth(input).toLowerCase().replace(/[·'()+【】[\]{},。!?;:_]/g, " ").replace(/[-/\\]/g, " ").replace(/\s+/g, " ").trim();
|
|
5224
|
+
}
|
|
5225
|
+
__name(normalizeWordPrefixName, "normalizeWordPrefixName");
|
|
5226
|
+
function splitWordPrefixTokens(input) {
|
|
5227
|
+
const normalized = normalizeWordPrefixName(input);
|
|
5228
|
+
if (!normalized) {
|
|
5229
|
+
return [];
|
|
5230
|
+
}
|
|
5231
|
+
return normalized.split(" ").filter(Boolean);
|
|
5232
|
+
}
|
|
5233
|
+
__name(splitWordPrefixTokens, "splitWordPrefixTokens");
|
|
5234
|
+
function buildGlobalRivenItemWordPrefixCandidates(globalRivenItemList) {
|
|
5235
|
+
const candidates = [];
|
|
5236
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5237
|
+
for (const item of globalRivenItemList) {
|
|
5238
|
+
const names = [
|
|
5239
|
+
item.i18n?.en?.name,
|
|
5240
|
+
item.i18n?.["zh-hans"]?.name
|
|
5241
|
+
].filter((name2) => typeof name2 === "string" && name2.length > 0);
|
|
5242
|
+
for (const name2 of names) {
|
|
5243
|
+
const normalizedName = normalizeWordPrefixName(name2);
|
|
5244
|
+
if (!normalizedName || seen.has(`${item.slug}:${normalizedName}`)) {
|
|
5245
|
+
continue;
|
|
5246
|
+
}
|
|
5247
|
+
const tokens = splitWordPrefixTokens(normalizedName);
|
|
5248
|
+
if (tokens.length === 0) {
|
|
5249
|
+
continue;
|
|
5250
|
+
}
|
|
5251
|
+
seen.add(`${item.slug}:${normalizedName}`);
|
|
5252
|
+
candidates.push({
|
|
5253
|
+
item,
|
|
5254
|
+
normalizedName,
|
|
5255
|
+
tokens
|
|
5256
|
+
});
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
return candidates;
|
|
5260
|
+
}
|
|
5261
|
+
__name(buildGlobalRivenItemWordPrefixCandidates, "buildGlobalRivenItemWordPrefixCandidates");
|
|
5262
|
+
async function globalRivenItemFactory(rivenData) {
|
|
5263
|
+
rivenData ??= await wfmClient.rivens.getItems();
|
|
5181
5264
|
if (!rivenData) {
|
|
5182
5265
|
throw new Error("Failed to fetch riven items from Warframe Market API.");
|
|
5183
5266
|
}
|
|
@@ -5198,11 +5281,17 @@ var globalRivenItemData = createAsyncCache(async () => {
|
|
|
5198
5281
|
}
|
|
5199
5282
|
return result;
|
|
5200
5283
|
})(data);
|
|
5284
|
+
const globalRivenItemWordPrefixCandidates = buildGlobalRivenItemWordPrefixCandidates(data);
|
|
5201
5285
|
return {
|
|
5202
5286
|
globalRivenItemList,
|
|
5203
5287
|
globalRivenItemDict,
|
|
5204
|
-
globalRivenItemNameToSlugDict
|
|
5288
|
+
globalRivenItemNameToSlugDict,
|
|
5289
|
+
globalRivenItemWordPrefixCandidates
|
|
5205
5290
|
};
|
|
5291
|
+
}
|
|
5292
|
+
__name(globalRivenItemFactory, "globalRivenItemFactory");
|
|
5293
|
+
var globalRivenItemData = createAsyncCache(async () => {
|
|
5294
|
+
return globalRivenItemFactory();
|
|
5206
5295
|
}, -1);
|
|
5207
5296
|
|
|
5208
5297
|
// src/infrastructure/ocr-api.ts
|
|
@@ -5242,7 +5331,7 @@ async function getTextFromTencentOCR(image, secret) {
|
|
|
5242
5331
|
const { TextDetections } = await client.GeneralAccurateOCR({
|
|
5243
5332
|
ImageBase64: image
|
|
5244
5333
|
});
|
|
5245
|
-
const result = TextDetections?.map((
|
|
5334
|
+
const result = TextDetections?.map((t2) => t2.DetectedText).filter(
|
|
5246
5335
|
Boolean
|
|
5247
5336
|
);
|
|
5248
5337
|
return result;
|
|
@@ -5266,14 +5355,14 @@ __name(extractTextFromImage, "extractTextFromImage");
|
|
|
5266
5355
|
// src/services/wf-service.ts
|
|
5267
5356
|
async function getRelic(input) {
|
|
5268
5357
|
if (!input) {
|
|
5269
|
-
return { ok: false, message: "
|
|
5358
|
+
return { ok: false, message: "relic.invalidName" };
|
|
5270
5359
|
}
|
|
5271
5360
|
input = normalizeName(input);
|
|
5272
5361
|
if (!input) {
|
|
5273
|
-
return { ok: false, message: "
|
|
5362
|
+
return { ok: false, message: "relic.invalidName" };
|
|
5274
5363
|
}
|
|
5275
5364
|
if (!relics) {
|
|
5276
|
-
return { ok: false, message: "
|
|
5365
|
+
return { ok: false, message: "relic.dataLoading" };
|
|
5277
5366
|
}
|
|
5278
5367
|
const tierListForMatch = [
|
|
5279
5368
|
"古纪",
|
|
@@ -5288,10 +5377,10 @@ async function getRelic(input) {
|
|
|
5288
5377
|
"Axi",
|
|
5289
5378
|
"Requiem",
|
|
5290
5379
|
"Vanguard"
|
|
5291
|
-
].map((
|
|
5292
|
-
const tier = tierListForMatch.find((
|
|
5380
|
+
].map((t2) => normalizeName(t2));
|
|
5381
|
+
const tier = tierListForMatch.find((t2) => input.startsWith(t2));
|
|
5293
5382
|
if (!tier) {
|
|
5294
|
-
return { ok: false, message: "
|
|
5383
|
+
return { ok: false, message: "relic.invalidName" };
|
|
5295
5384
|
}
|
|
5296
5385
|
const category = input.replace(new RegExp(`^${tier}`), "").replace(/遗物$|relic$/, "");
|
|
5297
5386
|
const zhTierMap = {
|
|
@@ -5304,12 +5393,12 @@ async function getRelic(input) {
|
|
|
5304
5393
|
};
|
|
5305
5394
|
const enTier = zhTierMap[tier] ?? tier;
|
|
5306
5395
|
const key = normalizeName(enTier + category);
|
|
5307
|
-
return relics[key] ? { ok: true, data: relics[key] } : { ok: false, message: "
|
|
5396
|
+
return relics[key] ? { ok: true, data: relics[key] } : { ok: false, message: "relic.notFound" };
|
|
5308
5397
|
}
|
|
5309
5398
|
__name(getRelic, "getRelic");
|
|
5310
5399
|
function getArbitrations(day = 3) {
|
|
5311
5400
|
if (day > 14 || day <= 0) {
|
|
5312
|
-
return { ok: false, message: "
|
|
5401
|
+
return { ok: false, message: "arbitration.invalidDayRange" };
|
|
5313
5402
|
}
|
|
5314
5403
|
const currentHourTimeStamp = Math.floor(
|
|
5315
5404
|
(/* @__PURE__ */ new Date()).setUTCMinutes(0, 0, 0) / 1e3
|
|
@@ -5348,7 +5437,7 @@ __name(getArbitrations, "getArbitrations");
|
|
|
5348
5437
|
async function getWeekly() {
|
|
5349
5438
|
const { raw: worldState } = await globalWorldState.get();
|
|
5350
5439
|
if (!worldState) {
|
|
5351
|
-
return { ok: false, message: "
|
|
5440
|
+
return { ok: false, message: "common.fetchFailed" };
|
|
5352
5441
|
}
|
|
5353
5442
|
const archon = {
|
|
5354
5443
|
name: import_warframe_public_export_plus6.dict_zh[`/Lotus/Language/Narmer/${removeSpace(worldState.archonHunt.boss)}`],
|
|
@@ -5485,45 +5574,44 @@ function getCircuitWeek() {
|
|
|
5485
5574
|
__name(getCircuitWeek, "getCircuitWeek");
|
|
5486
5575
|
async function getFissures() {
|
|
5487
5576
|
const { fissures } = await globalWorldState.get();
|
|
5488
|
-
return fissures ? { ok: true, data: fissures } : { ok: false, message: "
|
|
5577
|
+
return fissures ? { ok: true, data: fissures } : { ok: false, message: "common.fetchFailed" };
|
|
5489
5578
|
}
|
|
5490
5579
|
__name(getFissures, "getFissures");
|
|
5491
5580
|
async function getSteelPathFissures() {
|
|
5492
5581
|
const { spFissures } = await globalWorldState.get();
|
|
5493
|
-
return spFissures ? { ok: true, data: spFissures } : { ok: false, message: "
|
|
5582
|
+
return spFissures ? { ok: true, data: spFissures } : { ok: false, message: "common.fetchFailed" };
|
|
5494
5583
|
}
|
|
5495
5584
|
__name(getSteelPathFissures, "getSteelPathFissures");
|
|
5496
5585
|
async function getRailjackFissures() {
|
|
5497
5586
|
const { rjFissures } = await globalWorldState.get();
|
|
5498
|
-
return rjFissures ? { ok: true, data: rjFissures } : { ok: false, message: "
|
|
5587
|
+
return rjFissures ? { ok: true, data: rjFissures } : { ok: false, message: "common.fetchFailed" };
|
|
5499
5588
|
}
|
|
5500
5589
|
__name(getRailjackFissures, "getRailjackFissures");
|
|
5501
5590
|
async function getAnalyzedRiven(secret, url) {
|
|
5502
5591
|
const img = await fetchAsyncImage(url);
|
|
5503
5592
|
if (!img) {
|
|
5504
|
-
return { ok: false, message: "
|
|
5593
|
+
return { ok: false, message: "riven.imageFetchFailed" };
|
|
5505
5594
|
}
|
|
5506
5595
|
const extractResult = await extractTextFromImage(img, secret);
|
|
5507
5596
|
if (!extractResult) {
|
|
5508
|
-
return { ok: false, message: "
|
|
5597
|
+
return { ok: false, message: "riven.imageParseFailed" };
|
|
5509
5598
|
}
|
|
5510
5599
|
const parseResult = await parseOCRResult(extractResult);
|
|
5511
5600
|
if (!parseResult || parseResult.attributes.length < 2 || parseResult.attributes.length > 4) {
|
|
5512
|
-
return { ok: false, message: "
|
|
5601
|
+
return { ok: false, message: "riven.imageParseFailed" };
|
|
5513
5602
|
}
|
|
5514
|
-
|
|
5515
|
-
return typeof analyzed === "string" ? { ok: false, message: analyzed } : { ok: true, data: analyzed };
|
|
5603
|
+
return analyzeRivenStat(parseResult);
|
|
5516
5604
|
}
|
|
5517
5605
|
__name(getAnalyzedRiven, "getAnalyzedRiven");
|
|
5518
5606
|
async function getVoidTrader() {
|
|
5519
5607
|
const { raw: worldState } = await globalWorldState.get();
|
|
5520
5608
|
if (worldState.voidTraders.length === 0) {
|
|
5521
|
-
return { ok: false, message: "
|
|
5609
|
+
return { ok: false, message: "voidTrader.drifting" };
|
|
5522
5610
|
}
|
|
5523
5611
|
const trader = worldState.voidTraders[0];
|
|
5524
5612
|
if (trader && trader.activation && trader.activation.getTime() > Date.now()) {
|
|
5525
5613
|
const diff2 = trader.activation.getTime() - Date.now();
|
|
5526
|
-
return { ok: false, message:
|
|
5614
|
+
return { ok: false, message: "voidTrader.arriving", params: { time: msToHumanReadable(diff2) } };
|
|
5527
5615
|
}
|
|
5528
5616
|
const diff = trader.expiry.getTime() - Date.now();
|
|
5529
5617
|
const items = trader.inventory.map(getVoidTraderItem);
|
|
@@ -5566,7 +5654,7 @@ async function getWeeklyRivens(minPrice) {
|
|
|
5566
5654
|
__name(getWeeklyRivens, "getWeeklyRivens");
|
|
5567
5655
|
async function getStaticRivenStats(weaponType, statType, disposition) {
|
|
5568
5656
|
if (disposition > 1.55 || disposition < 0.5) {
|
|
5569
|
-
return { ok: false, message: "
|
|
5657
|
+
return { ok: false, message: "riven.dispositionError" };
|
|
5570
5658
|
}
|
|
5571
5659
|
const weaponTypes = [
|
|
5572
5660
|
"步枪",
|
|
@@ -5584,7 +5672,7 @@ async function getStaticRivenStats(weaponType, statType, disposition) {
|
|
|
5584
5672
|
(v) => normalizeName(v).startsWith(normalizeName(weaponType))
|
|
5585
5673
|
);
|
|
5586
5674
|
if (!matchedWeaponType) {
|
|
5587
|
-
return { ok: false, message: "
|
|
5675
|
+
return { ok: false, message: "riven.weaponTypeError" };
|
|
5588
5676
|
}
|
|
5589
5677
|
const weaponTypeKeys = {
|
|
5590
5678
|
步枪: "Rifle",
|
|
@@ -5596,7 +5684,7 @@ async function getStaticRivenStats(weaponType, statType, disposition) {
|
|
|
5596
5684
|
const weaponTypeKey = weaponTypeKeys[matchedWeaponType] ?? matchedWeaponType;
|
|
5597
5685
|
const statTypes = ["2", "3", "21", "31"];
|
|
5598
5686
|
if (!statTypes.includes(statType)) {
|
|
5599
|
-
return { ok: false, message: "
|
|
5687
|
+
return { ok: false, message: "riven.statTypeError" };
|
|
5600
5688
|
}
|
|
5601
5689
|
const rivenAttrValues2 = rivenAttrValueDict[weaponTypeKey];
|
|
5602
5690
|
const factor = rivenStatFixFactor[statType];
|
|
@@ -5671,20 +5759,20 @@ async function parseOCRResult(ocrResult) {
|
|
|
5671
5759
|
if (standard.includes(input) || input.includes(standard) || standard.split("/").some((x) => !!x && input.includes(x))) {
|
|
5672
5760
|
return 1;
|
|
5673
5761
|
}
|
|
5674
|
-
const
|
|
5762
|
+
const t2 = tokenSimilarity(standard, input);
|
|
5675
5763
|
const s = normalSimilarity(standard, input);
|
|
5676
|
-
return Math.max(
|
|
5764
|
+
return Math.max(t2, s);
|
|
5677
5765
|
}
|
|
5678
5766
|
__name(similarity, "similarity");
|
|
5679
5767
|
const texts = list;
|
|
5680
5768
|
const attributes = [];
|
|
5681
5769
|
const statLines = [];
|
|
5682
|
-
for (const
|
|
5683
|
-
if (!
|
|
5770
|
+
for (const t2 of texts) {
|
|
5771
|
+
if (!t2 || !/^[x+-]|^\d/.test(t2)) {
|
|
5684
5772
|
continue;
|
|
5685
5773
|
}
|
|
5686
|
-
const prefix = /^[x+-]/.test(
|
|
5687
|
-
const attrNamePart = removeSpace(
|
|
5774
|
+
const prefix = /^[x+-]/.test(t2) ? t2[0] : "";
|
|
5775
|
+
const attrNamePart = removeSpace(t2 ?? "").replace(/^[^\u4E00-\u9FA5]+/u, "");
|
|
5688
5776
|
const attr = globalRivenAttributeList.find((a) => {
|
|
5689
5777
|
if (!a)
|
|
5690
5778
|
return false;
|
|
@@ -5699,24 +5787,24 @@ async function parseOCRResult(ocrResult) {
|
|
|
5699
5787
|
if (!attr) {
|
|
5700
5788
|
continue;
|
|
5701
5789
|
}
|
|
5702
|
-
statLines.push(
|
|
5790
|
+
statLines.push(t2);
|
|
5703
5791
|
const value = (/* @__PURE__ */ __name((function extractStatValue(text) {
|
|
5704
|
-
const
|
|
5705
|
-
const multMatch =
|
|
5792
|
+
const t3 = text.replace(/\s+/g, "");
|
|
5793
|
+
const multMatch = t3.match(/x(\d+(?:\.\d+)?)/i);
|
|
5706
5794
|
if (multMatch) {
|
|
5707
5795
|
return {
|
|
5708
5796
|
value: Number.parseFloat(multMatch[1]),
|
|
5709
5797
|
type: "multiply"
|
|
5710
5798
|
};
|
|
5711
5799
|
}
|
|
5712
|
-
const percentMatch =
|
|
5800
|
+
const percentMatch = t3.match(/([+-]?\d+(?:\.\d+)?)%/);
|
|
5713
5801
|
if (percentMatch) {
|
|
5714
5802
|
return {
|
|
5715
5803
|
value: Number.parseFloat(percentMatch[1]),
|
|
5716
5804
|
type: "percent"
|
|
5717
5805
|
};
|
|
5718
5806
|
}
|
|
5719
|
-
const numMatch =
|
|
5807
|
+
const numMatch = t3.match(/([+-]?\d+(?:\.\d+)?)/);
|
|
5720
5808
|
if (numMatch) {
|
|
5721
5809
|
return {
|
|
5722
5810
|
value: Number.parseFloat(numMatch[1]),
|
|
@@ -5724,7 +5812,7 @@ async function parseOCRResult(ocrResult) {
|
|
|
5724
5812
|
};
|
|
5725
5813
|
}
|
|
5726
5814
|
return void 0;
|
|
5727
|
-
}), "extractStatValue"))(
|
|
5815
|
+
}), "extractStatValue"))(t2);
|
|
5728
5816
|
if (!value) {
|
|
5729
5817
|
return void 0;
|
|
5730
5818
|
}
|
|
@@ -5770,7 +5858,7 @@ async function parseOCRResult(ocrResult) {
|
|
|
5770
5858
|
}
|
|
5771
5859
|
__name(removeRivenSuffix, "removeRivenSuffix");
|
|
5772
5860
|
return merged ? removeRivenSuffix(merged) : null;
|
|
5773
|
-
}), "extractWeaponName"))(texts.filter((
|
|
5861
|
+
}), "extractWeaponName"))(texts.filter((t2) => !statLines.includes(t2)));
|
|
5774
5862
|
if (!weaponName || !attributes.length) {
|
|
5775
5863
|
return void 0;
|
|
5776
5864
|
}
|
|
@@ -5783,7 +5871,11 @@ __name(parseOCRResult, "parseOCRResult");
|
|
|
5783
5871
|
function analyzeRivenStat(parseResult) {
|
|
5784
5872
|
const weaponRiven = getWeaponRivenDisposition(parseResult.name);
|
|
5785
5873
|
if (!weaponRiven) {
|
|
5786
|
-
return
|
|
5874
|
+
return {
|
|
5875
|
+
ok: false,
|
|
5876
|
+
message: "riven.weaponNotFound",
|
|
5877
|
+
params: { weapon: parseResult.name }
|
|
5878
|
+
};
|
|
5787
5879
|
}
|
|
5788
5880
|
const disposition = weaponRiven.calc.disposition;
|
|
5789
5881
|
const weaponType = weaponRiven.calc.riventype;
|
|
@@ -5837,15 +5929,18 @@ function analyzeRivenStat(parseResult) {
|
|
|
5837
5929
|
}
|
|
5838
5930
|
}
|
|
5839
5931
|
return {
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5932
|
+
ok: true,
|
|
5933
|
+
data: {
|
|
5934
|
+
name: weaponRiven.name.zh,
|
|
5935
|
+
disposition,
|
|
5936
|
+
buffs,
|
|
5937
|
+
curses
|
|
5938
|
+
}
|
|
5844
5939
|
};
|
|
5845
5940
|
}
|
|
5846
5941
|
__name(analyzeRivenStat, "analyzeRivenStat");
|
|
5847
5942
|
|
|
5848
|
-
// src/services/wfm-service.ts
|
|
5943
|
+
// src/services/wfm-service/index.ts
|
|
5849
5944
|
var import_warframe_public_export_plus7 = require("warframe-public-export-plus");
|
|
5850
5945
|
|
|
5851
5946
|
// src/data/wfm/globalDucatnator.ts
|
|
@@ -5858,6 +5953,46 @@ var globalDucatnatorIDDict = createAsyncCache(async () => {
|
|
|
5858
5953
|
}, 36e5);
|
|
5859
5954
|
|
|
5860
5955
|
// src/data/wfm/globalItem.ts
|
|
5956
|
+
function normalizeWordPrefixName2(input) {
|
|
5957
|
+
return fullWidthToHalfWidth(input).toLowerCase().replace(/[·'()+【】[\]{},。!?;:_]/g, " ").replace(/[-/\\]/g, " ").replace(/\s+/g, " ").trim();
|
|
5958
|
+
}
|
|
5959
|
+
__name(normalizeWordPrefixName2, "normalizeWordPrefixName");
|
|
5960
|
+
function splitWordPrefixTokens2(input) {
|
|
5961
|
+
const normalized = normalizeWordPrefixName2(input);
|
|
5962
|
+
if (!normalized) {
|
|
5963
|
+
return [];
|
|
5964
|
+
}
|
|
5965
|
+
return normalized.split(" ").filter(Boolean);
|
|
5966
|
+
}
|
|
5967
|
+
__name(splitWordPrefixTokens2, "splitWordPrefixTokens");
|
|
5968
|
+
function buildGlobalItemWordPrefixCandidates(globalItemList) {
|
|
5969
|
+
const candidates = [];
|
|
5970
|
+
const seen = /* @__PURE__ */ new Set();
|
|
5971
|
+
for (const item of globalItemList) {
|
|
5972
|
+
const names = [
|
|
5973
|
+
item.i18n?.en?.name,
|
|
5974
|
+
item.i18n?.["zh-hans"]?.name
|
|
5975
|
+
].filter((name2) => typeof name2 === "string" && name2.length > 0);
|
|
5976
|
+
for (const name2 of names) {
|
|
5977
|
+
const normalizedName = normalizeWordPrefixName2(name2.toLowerCase());
|
|
5978
|
+
if (!normalizedName || seen.has(`${item.slug}:${normalizedName}`)) {
|
|
5979
|
+
continue;
|
|
5980
|
+
}
|
|
5981
|
+
const tokens = splitWordPrefixTokens2(normalizedName);
|
|
5982
|
+
if (tokens.length === 0) {
|
|
5983
|
+
continue;
|
|
5984
|
+
}
|
|
5985
|
+
seen.add(`${item.slug}:${normalizedName}`);
|
|
5986
|
+
candidates.push({
|
|
5987
|
+
item,
|
|
5988
|
+
normalizedName,
|
|
5989
|
+
tokens
|
|
5990
|
+
});
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5993
|
+
return candidates;
|
|
5994
|
+
}
|
|
5995
|
+
__name(buildGlobalItemWordPrefixCandidates, "buildGlobalItemWordPrefixCandidates");
|
|
5861
5996
|
async function globalItemDataFactory(response) {
|
|
5862
5997
|
response ??= await wfmClient.items.getList();
|
|
5863
5998
|
if (!response) {
|
|
@@ -5865,7 +6000,8 @@ async function globalItemDataFactory(response) {
|
|
|
5865
6000
|
globalItemList: [],
|
|
5866
6001
|
globalItemDict: {},
|
|
5867
6002
|
globalItemNameToSlugDict: {},
|
|
5868
|
-
globalItemGameRefDict: {}
|
|
6003
|
+
globalItemGameRefDict: {},
|
|
6004
|
+
globalItemWordPrefixCandidates: []
|
|
5869
6005
|
};
|
|
5870
6006
|
}
|
|
5871
6007
|
const data = response;
|
|
@@ -5887,111 +6023,409 @@ async function globalItemDataFactory(response) {
|
|
|
5887
6023
|
return result;
|
|
5888
6024
|
})(globalItemList);
|
|
5889
6025
|
const globalItemGameRefDict = listToDict(data, (i) => [i.gameRef]);
|
|
6026
|
+
const globalItemWordPrefixCandidates = buildGlobalItemWordPrefixCandidates(
|
|
6027
|
+
globalItemList
|
|
6028
|
+
);
|
|
5890
6029
|
return {
|
|
5891
6030
|
globalItemList,
|
|
5892
6031
|
globalItemDict,
|
|
5893
6032
|
globalItemNameToSlugDict,
|
|
5894
|
-
globalItemGameRefDict
|
|
6033
|
+
globalItemGameRefDict,
|
|
6034
|
+
globalItemWordPrefixCandidates
|
|
5895
6035
|
};
|
|
5896
6036
|
}
|
|
5897
6037
|
__name(globalItemDataFactory, "globalItemDataFactory");
|
|
5898
6038
|
var globalItemData = createAsyncCache(globalItemDataFactory, -1);
|
|
5899
6039
|
|
|
5900
|
-
// src/services/wfm-service.ts
|
|
5901
|
-
var
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
"
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
|
|
5939
|
-
|
|
5940
|
-
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
}
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
];
|
|
6040
|
+
// src/services/wfm-service/wfm-service.item-matcher.ts
|
|
6041
|
+
var wfmItemMatcher = (() => {
|
|
6042
|
+
const setSuffix = "一套";
|
|
6043
|
+
const bpSuffix = "蓝图";
|
|
6044
|
+
const primeSuffix = "prime";
|
|
6045
|
+
const warframePartSuffix = ["系统", "头部神经光元", "机体"];
|
|
6046
|
+
const weaponPartSuffix = [
|
|
6047
|
+
"枪管",
|
|
6048
|
+
"枪托",
|
|
6049
|
+
"枪机",
|
|
6050
|
+
"弓弦",
|
|
6051
|
+
"上弓臂",
|
|
6052
|
+
"下弓臂",
|
|
6053
|
+
"刀刃",
|
|
6054
|
+
"握柄",
|
|
6055
|
+
"拳套",
|
|
6056
|
+
"圆盘",
|
|
6057
|
+
"连接器"
|
|
6058
|
+
];
|
|
6059
|
+
const warframeAliasDict = ((aliasObject) => {
|
|
6060
|
+
const transformedObject = {};
|
|
6061
|
+
for (const [key, aliases] of Object.entries(aliasObject)) {
|
|
6062
|
+
const normalizedKey = normalizeName(key);
|
|
6063
|
+
transformedObject[normalizedKey] = normalizedKey;
|
|
6064
|
+
for (const alias of aliases) {
|
|
6065
|
+
if (typeof alias !== "string" || alias.length === 0) {
|
|
6066
|
+
continue;
|
|
6067
|
+
}
|
|
6068
|
+
const normalizedAlias = normalizeName(alias);
|
|
6069
|
+
transformedObject[normalizedAlias] = normalizedKey;
|
|
6070
|
+
const warframeNameWithSuffix = normalizeName(`${alias}甲`);
|
|
6071
|
+
transformedObject[warframeNameWithSuffix] = normalizedKey;
|
|
6072
|
+
}
|
|
6073
|
+
}
|
|
6074
|
+
return transformedObject;
|
|
6075
|
+
})(warframeAlias);
|
|
6076
|
+
function removeNameSuffix2(input) {
|
|
6077
|
+
let hasBPSuffix = false;
|
|
6078
|
+
if (input.endsWith(bpSuffix)) {
|
|
6079
|
+
input = input.replace(new RegExp(`${bpSuffix}$`), "");
|
|
6080
|
+
hasBPSuffix = true;
|
|
6081
|
+
}
|
|
6082
|
+
if (input.endsWith(setSuffix)) {
|
|
6083
|
+
input = input.replace(new RegExp(`${setSuffix}$`), "");
|
|
6084
|
+
}
|
|
6085
|
+
if (input.endsWith(bpSuffix)) {
|
|
6086
|
+
input = input.replace(new RegExp(`${bpSuffix}$`), "");
|
|
6087
|
+
hasBPSuffix = true;
|
|
6088
|
+
}
|
|
6089
|
+
const suffix = warframePartSuffix.find((value) => input.endsWith(value)) ?? weaponPartSuffix.find((value) => input.endsWith(value)) ?? (input.endsWith("头") ? "头部神经光元" : void 0) ?? (hasBPSuffix ? bpSuffix : void 0) ?? "";
|
|
6090
|
+
if (suffix) {
|
|
6091
|
+
input = input.endsWith("头") ? input.replace(/头$/, "") : input;
|
|
6092
|
+
const pure = input.replace(new RegExp(`${suffix}$`), "");
|
|
6093
|
+
return {
|
|
6094
|
+
pure,
|
|
6095
|
+
suffix
|
|
6096
|
+
};
|
|
6097
|
+
} else {
|
|
6098
|
+
return {
|
|
6099
|
+
pure: input,
|
|
6100
|
+
suffix
|
|
6101
|
+
};
|
|
6102
|
+
}
|
|
6103
|
+
}
|
|
6104
|
+
__name(removeNameSuffix2, "removeNameSuffix");
|
|
6105
|
+
function shortHandProcess3(input, lookup) {
|
|
6106
|
+
const { pure: inputNoSuffix, suffix } = removeNameSuffix2(input);
|
|
6107
|
+
if (inputNoSuffix === input) {
|
|
6108
|
+
const fixSet = input + setSuffix;
|
|
6109
|
+
const fixSetRes = lookup.globalItemNameToSlugDict[fixSet];
|
|
6110
|
+
if (fixSetRes)
|
|
6111
|
+
return lookup.globalItemDict[fixSetRes];
|
|
6112
|
+
const fixPrime = input.endsWith(primeSuffix) ? input : input.endsWith("p") ? input.slice(0, input.length - 1) + primeSuffix : input + primeSuffix;
|
|
6113
|
+
const fixPrimeRes = lookup.globalItemNameToSlugDict[fixPrime];
|
|
6114
|
+
if (fixPrimeRes)
|
|
6115
|
+
return lookup.globalItemDict[fixPrimeRes];
|
|
6116
|
+
const fixPrimeSet = fixPrime + setSuffix;
|
|
6117
|
+
const fixPrimeSetRes = lookup.globalItemNameToSlugDict[fixPrimeSet];
|
|
6118
|
+
if (fixPrimeSetRes)
|
|
6119
|
+
return lookup.globalItemDict[fixPrimeSetRes];
|
|
6120
|
+
const fixBP = input + bpSuffix;
|
|
6121
|
+
const fixBPRes = lookup.globalItemNameToSlugDict[fixBP];
|
|
6122
|
+
if (fixBPRes)
|
|
6123
|
+
return lookup.globalItemDict[fixBPRes];
|
|
6124
|
+
const fixPrimeBP = fixPrime + bpSuffix;
|
|
6125
|
+
const fixPrimeBPRes = lookup.globalItemNameToSlugDict[fixPrimeBP];
|
|
6126
|
+
if (fixPrimeBPRes)
|
|
6127
|
+
return lookup.globalItemDict[fixPrimeBPRes];
|
|
6128
|
+
} else {
|
|
6129
|
+
const fixBP = inputNoSuffix + suffix + bpSuffix;
|
|
6130
|
+
const fixBPRes = lookup.globalItemNameToSlugDict[fixBP];
|
|
6131
|
+
if (fixBPRes)
|
|
6132
|
+
return lookup.globalItemDict[fixBPRes];
|
|
6133
|
+
const fixPrime = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix : inputNoSuffix.endsWith("p") ? inputNoSuffix.slice(0, inputNoSuffix.length - 1) + primeSuffix : inputNoSuffix + primeSuffix;
|
|
6134
|
+
const fixPrimeRes = lookup.globalItemNameToSlugDict[fixPrime + suffix];
|
|
6135
|
+
if (fixPrimeRes)
|
|
6136
|
+
return lookup.globalItemDict[fixPrimeRes];
|
|
6137
|
+
const fixPrimeBP = fixPrime + suffix + bpSuffix;
|
|
6138
|
+
const fixPrimeBPRes = lookup.globalItemNameToSlugDict[fixPrimeBP];
|
|
6139
|
+
if (fixPrimeBPRes)
|
|
6140
|
+
return lookup.globalItemDict[fixPrimeBPRes];
|
|
6141
|
+
}
|
|
6142
|
+
}
|
|
6143
|
+
__name(shortHandProcess3, "shortHandProcess");
|
|
6144
|
+
function matchBySlugDict3(input, lookup) {
|
|
6145
|
+
const slug = lookup.globalItemNameToSlugDict[input];
|
|
6146
|
+
return slug ? lookup.globalItemDict[slug] : void 0;
|
|
6147
|
+
}
|
|
6148
|
+
__name(matchBySlugDict3, "matchBySlugDict");
|
|
6149
|
+
function matchByShortHand2(input, lookup) {
|
|
6150
|
+
return shortHandProcess3(input, lookup);
|
|
6151
|
+
}
|
|
6152
|
+
__name(matchByShortHand2, "matchByShortHand");
|
|
6153
|
+
function transformByWarframeAlias2(input) {
|
|
6154
|
+
const { pure: inputNoSuffix, suffix } = removeNameSuffix2(input);
|
|
6155
|
+
const aliasHasEndP = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix.replace(new RegExp(`${primeSuffix}$`), "") : inputNoSuffix;
|
|
6156
|
+
const mappedAliasHasEndP = warframeAliasDict[aliasHasEndP];
|
|
6157
|
+
if (mappedAliasHasEndP) {
|
|
6158
|
+
return normalizeName(mappedAliasHasEndP) + suffix;
|
|
6159
|
+
}
|
|
6160
|
+
if (inputNoSuffix.endsWith("p")) {
|
|
6161
|
+
const aliasNoEndP = inputNoSuffix.replace(/p$/, "");
|
|
6162
|
+
const mappedAliasNoEndP = warframeAliasDict[aliasNoEndP];
|
|
6163
|
+
if (mappedAliasNoEndP) {
|
|
6164
|
+
return normalizeName(mappedAliasNoEndP) + suffix;
|
|
6165
|
+
}
|
|
6166
|
+
}
|
|
6167
|
+
return void 0;
|
|
6168
|
+
}
|
|
6169
|
+
__name(transformByWarframeAlias2, "transformByWarframeAlias");
|
|
6170
|
+
function buildSuffixVariantCandidates2(input) {
|
|
6171
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
6172
|
+
const { pure, suffix } = removeNameSuffix2(input);
|
|
6173
|
+
candidates.add(input);
|
|
6174
|
+
candidates.add(input + bpSuffix);
|
|
6175
|
+
candidates.add(`${input}blueprint`);
|
|
6176
|
+
candidates.add(input + setSuffix);
|
|
6177
|
+
candidates.add(`${input}set`);
|
|
6178
|
+
if (suffix) {
|
|
6179
|
+
const base = pure + suffix;
|
|
6180
|
+
candidates.add(base);
|
|
6181
|
+
candidates.add(base + bpSuffix);
|
|
6182
|
+
candidates.add(`${base}blueprint`);
|
|
6183
|
+
candidates.add(base + setSuffix);
|
|
6184
|
+
candidates.add(`${base}set`);
|
|
6185
|
+
}
|
|
6186
|
+
return [...candidates];
|
|
6187
|
+
}
|
|
6188
|
+
__name(buildSuffixVariantCandidates2, "buildSuffixVariantCandidates");
|
|
6189
|
+
function matchBySuffixVariantLookup2(input, lookup) {
|
|
6190
|
+
for (const candidate of buildSuffixVariantCandidates2(input)) {
|
|
6191
|
+
const slug = lookup.globalItemNameToSlugDict[candidate];
|
|
6192
|
+
if (slug)
|
|
6193
|
+
return lookup.globalItemDict[slug];
|
|
6194
|
+
}
|
|
6195
|
+
return void 0;
|
|
6196
|
+
}
|
|
6197
|
+
__name(matchBySuffixVariantLookup2, "matchBySuffixVariantLookup");
|
|
6198
|
+
function normalizeWordPrefixName5(input) {
|
|
6199
|
+
return fullWidthToHalfWidth(input).toLowerCase().replace(/[·'()+【】[\]{},。!?;:_]/g, " ").replace(/[-/\\]/g, " ").replace(/\s+/g, " ").trim();
|
|
6200
|
+
}
|
|
6201
|
+
__name(normalizeWordPrefixName5, "normalizeWordPrefixName");
|
|
6202
|
+
function splitWordPrefixTokens5(input) {
|
|
6203
|
+
const normalized = normalizeWordPrefixName5(input);
|
|
6204
|
+
if (!normalized) {
|
|
6205
|
+
return [];
|
|
6206
|
+
}
|
|
6207
|
+
return normalized.split(" ").filter(Boolean);
|
|
6208
|
+
}
|
|
6209
|
+
__name(splitWordPrefixTokens5, "splitWordPrefixTokens");
|
|
6210
|
+
function compareWordPrefixCandidates2(left, right, inputTokens) {
|
|
6211
|
+
const leftExtraTokenCount = left.tokens.length - inputTokens.length;
|
|
6212
|
+
const rightExtraTokenCount = right.tokens.length - inputTokens.length;
|
|
6213
|
+
if (leftExtraTokenCount !== rightExtraTokenCount) {
|
|
6214
|
+
return leftExtraTokenCount - rightExtraTokenCount;
|
|
6215
|
+
}
|
|
6216
|
+
const leftRemainderKey = inputTokens.map((token, index) => left.tokens[index].slice(token.length)).join("\0");
|
|
6217
|
+
const rightRemainderKey = inputTokens.map((token, index) => right.tokens[index].slice(token.length)).join("\0");
|
|
6218
|
+
if (leftRemainderKey !== rightRemainderKey) {
|
|
6219
|
+
return leftRemainderKey.localeCompare(rightRemainderKey);
|
|
6220
|
+
}
|
|
6221
|
+
return left.normalizedName.localeCompare(right.normalizedName);
|
|
6222
|
+
}
|
|
6223
|
+
__name(compareWordPrefixCandidates2, "compareWordPrefixCandidates");
|
|
6224
|
+
function matchByWordPrefixSequence3(input, lookup) {
|
|
6225
|
+
const inputTokens = splitWordPrefixTokens5(input);
|
|
6226
|
+
if (inputTokens.length < 2) {
|
|
6227
|
+
return void 0;
|
|
6228
|
+
}
|
|
6229
|
+
const matchedCandidates = lookup.globalItemWordPrefixCandidates.filter((candidate) => {
|
|
6230
|
+
if (candidate.tokens.length < inputTokens.length) {
|
|
6231
|
+
return false;
|
|
6232
|
+
}
|
|
6233
|
+
return inputTokens.every(
|
|
6234
|
+
(token, index) => candidate.tokens[index].startsWith(token)
|
|
6235
|
+
);
|
|
6236
|
+
}).sort((left, right) => compareWordPrefixCandidates2(left, right, inputTokens));
|
|
6237
|
+
return matchedCandidates[0]?.item;
|
|
6238
|
+
}
|
|
6239
|
+
__name(matchByWordPrefixSequence3, "matchByWordPrefixSequence");
|
|
6240
|
+
async function stringToWFMItem2(input) {
|
|
6241
|
+
const { globalItemDict, globalItemNameToSlugDict, globalItemWordPrefixCandidates } = await globalItemData.get();
|
|
6242
|
+
const normalizedInput = normalizeName(input);
|
|
6243
|
+
const lookup = {
|
|
6244
|
+
globalItemDict,
|
|
6245
|
+
globalItemNameToSlugDict,
|
|
6246
|
+
globalItemWordPrefixCandidates
|
|
6247
|
+
};
|
|
6248
|
+
const slugMatchedItem = matchBySlugDict3(normalizedInput, lookup);
|
|
6249
|
+
if (slugMatchedItem)
|
|
6250
|
+
return slugMatchedItem;
|
|
6251
|
+
const shortHandMatchedItem = matchByShortHand2(normalizedInput, lookup);
|
|
6252
|
+
if (shortHandMatchedItem)
|
|
6253
|
+
return shortHandMatchedItem;
|
|
6254
|
+
const aliasInput = transformByWarframeAlias2(normalizedInput);
|
|
6255
|
+
if (aliasInput) {
|
|
6256
|
+
const aliasShortHandMatchedItem = matchByShortHand2(aliasInput, lookup);
|
|
6257
|
+
if (aliasShortHandMatchedItem)
|
|
6258
|
+
return aliasShortHandMatchedItem;
|
|
6259
|
+
}
|
|
6260
|
+
const suffixMatchedItem = matchBySuffixVariantLookup2(normalizedInput, lookup);
|
|
6261
|
+
if (suffixMatchedItem)
|
|
6262
|
+
return suffixMatchedItem;
|
|
6263
|
+
if (aliasInput) {
|
|
6264
|
+
const aliasSuffixMatchedItem = matchBySuffixVariantLookup2(aliasInput, lookup);
|
|
6265
|
+
if (aliasSuffixMatchedItem)
|
|
6266
|
+
return aliasSuffixMatchedItem;
|
|
6267
|
+
}
|
|
6268
|
+
const wordPrefixMatchedItem = matchByWordPrefixSequence3(input, lookup);
|
|
6269
|
+
if (wordPrefixMatchedItem)
|
|
6270
|
+
return wordPrefixMatchedItem;
|
|
6271
|
+
return void 0;
|
|
6272
|
+
}
|
|
6273
|
+
__name(stringToWFMItem2, "stringToWFMItem");
|
|
6274
|
+
return {
|
|
6275
|
+
buildSuffixVariantCandidates: buildSuffixVariantCandidates2,
|
|
6276
|
+
matchByShortHand: matchByShortHand2,
|
|
6277
|
+
matchBySlugDict: matchBySlugDict3,
|
|
6278
|
+
matchBySuffixVariantLookup: matchBySuffixVariantLookup2,
|
|
6279
|
+
matchByWordPrefixSequence: matchByWordPrefixSequence3,
|
|
6280
|
+
removeNameSuffix: removeNameSuffix2,
|
|
6281
|
+
splitWordPrefixTokens: splitWordPrefixTokens5,
|
|
6282
|
+
shortHandProcess: shortHandProcess3,
|
|
6283
|
+
stringToWFMItem: stringToWFMItem2,
|
|
6284
|
+
transformByWarframeAlias: transformByWarframeAlias2,
|
|
6285
|
+
normalizeWordPrefixName: normalizeWordPrefixName5
|
|
6286
|
+
};
|
|
6287
|
+
})();
|
|
6288
|
+
var buildSuffixVariantCandidates = wfmItemMatcher.buildSuffixVariantCandidates;
|
|
6289
|
+
var matchByShortHand = wfmItemMatcher.matchByShortHand;
|
|
6290
|
+
var matchBySlugDict = wfmItemMatcher.matchBySlugDict;
|
|
6291
|
+
var matchBySuffixVariantLookup = wfmItemMatcher.matchBySuffixVariantLookup;
|
|
6292
|
+
var matchByWordPrefixSequence = wfmItemMatcher.matchByWordPrefixSequence;
|
|
6293
|
+
var normalizeWordPrefixName3 = wfmItemMatcher.normalizeWordPrefixName;
|
|
6294
|
+
var removeNameSuffix = wfmItemMatcher.removeNameSuffix;
|
|
6295
|
+
var splitWordPrefixTokens3 = wfmItemMatcher.splitWordPrefixTokens;
|
|
6296
|
+
var shortHandProcess = wfmItemMatcher.shortHandProcess;
|
|
6297
|
+
var stringToWFMItem = wfmItemMatcher.stringToWFMItem;
|
|
6298
|
+
var transformByWarframeAlias = wfmItemMatcher.transformByWarframeAlias;
|
|
6299
|
+
|
|
6300
|
+
// src/services/wfm-service/wfm-service.riven-item-matcher.ts
|
|
6301
|
+
function normalizeWordPrefixName4(input) {
|
|
6302
|
+
return fullWidthToHalfWidth(input).toLowerCase().replace(/[·'()+【】[\]{},。!?;:_]/g, " ").replace(/[-/\\]/g, " ").replace(/\s+/g, " ").trim();
|
|
6303
|
+
}
|
|
6304
|
+
__name(normalizeWordPrefixName4, "normalizeWordPrefixName");
|
|
6305
|
+
function splitWordPrefixTokens4(input) {
|
|
6306
|
+
const normalized = normalizeWordPrefixName4(input);
|
|
6307
|
+
if (!normalized) {
|
|
6308
|
+
return [];
|
|
6309
|
+
}
|
|
6310
|
+
return normalized.split(" ").filter(Boolean);
|
|
6311
|
+
}
|
|
6312
|
+
__name(splitWordPrefixTokens4, "splitWordPrefixTokens");
|
|
6313
|
+
function buildRivenItemLookupData(globalRivenItemList) {
|
|
6314
|
+
const globalRivenItemDict = {};
|
|
6315
|
+
const globalRivenItemNameToSlugDict = {};
|
|
6316
|
+
const globalRivenItemWordPrefixCandidates = [];
|
|
6317
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6318
|
+
for (const item of globalRivenItemList) {
|
|
6319
|
+
globalRivenItemDict[item.slug] = item;
|
|
6320
|
+
const names = [
|
|
6321
|
+
item.i18n?.["zh-hans"]?.name,
|
|
6322
|
+
item.i18n?.en?.name
|
|
6323
|
+
].filter((name2) => typeof name2 === "string" && name2.length > 0);
|
|
6324
|
+
for (const name2 of names) {
|
|
6325
|
+
const normalizedName = normalizeName(name2);
|
|
6326
|
+
if (normalizedName && !globalRivenItemNameToSlugDict[normalizedName]) {
|
|
6327
|
+
globalRivenItemNameToSlugDict[normalizedName] = item.slug;
|
|
6328
|
+
}
|
|
6329
|
+
const normalizedWordPrefixName = normalizeWordPrefixName4(name2);
|
|
6330
|
+
if (!normalizedWordPrefixName || seen.has(`${item.slug}:${normalizedWordPrefixName}`)) {
|
|
6331
|
+
continue;
|
|
6332
|
+
}
|
|
6333
|
+
const tokens = splitWordPrefixTokens4(normalizedWordPrefixName);
|
|
6334
|
+
if (tokens.length === 0) {
|
|
6335
|
+
continue;
|
|
6336
|
+
}
|
|
6337
|
+
seen.add(`${item.slug}:${normalizedWordPrefixName}`);
|
|
6338
|
+
globalRivenItemWordPrefixCandidates.push({
|
|
6339
|
+
item,
|
|
6340
|
+
normalizedName: normalizedWordPrefixName,
|
|
6341
|
+
tokens
|
|
6342
|
+
});
|
|
6343
|
+
}
|
|
6344
|
+
}
|
|
6345
|
+
return {
|
|
6346
|
+
globalRivenItemDict,
|
|
6347
|
+
globalRivenItemNameToSlugDict,
|
|
6348
|
+
globalRivenItemWordPrefixCandidates
|
|
6349
|
+
};
|
|
6350
|
+
}
|
|
6351
|
+
__name(buildRivenItemLookupData, "buildRivenItemLookupData");
|
|
6352
|
+
function matchBySlugDict2(input, lookup) {
|
|
6353
|
+
const slug = lookup.globalRivenItemNameToSlugDict[input];
|
|
6354
|
+
return slug ? lookup.globalRivenItemDict[slug] : void 0;
|
|
6355
|
+
}
|
|
6356
|
+
__name(matchBySlugDict2, "matchBySlugDict");
|
|
6357
|
+
function shortHandProcess2(input, lookup) {
|
|
6358
|
+
const primeSuffix = "prime";
|
|
6359
|
+
const fixPrime = input.endsWith(primeSuffix) ? input : input.endsWith("p") ? input.slice(0, input.length - 1) + primeSuffix : input + primeSuffix;
|
|
6360
|
+
const fixPrimeRes = lookup.globalRivenItemNameToSlugDict[fixPrime];
|
|
6361
|
+
if (fixPrimeRes)
|
|
6362
|
+
return lookup.globalRivenItemDict[fixPrimeRes];
|
|
6363
|
+
const fixPrimeSpace = `${input} ${primeSuffix}`;
|
|
6364
|
+
const fixPrimeSpaceRes = lookup.globalRivenItemNameToSlugDict[fixPrimeSpace];
|
|
6365
|
+
if (fixPrimeSpaceRes)
|
|
6366
|
+
return lookup.globalRivenItemDict[fixPrimeSpaceRes];
|
|
6367
|
+
return void 0;
|
|
6368
|
+
}
|
|
6369
|
+
__name(shortHandProcess2, "shortHandProcess");
|
|
6370
|
+
function compareWordPrefixCandidates(left, right, inputTokens) {
|
|
6371
|
+
const leftExtraTokenCount = left.tokens.length - inputTokens.length;
|
|
6372
|
+
const rightExtraTokenCount = right.tokens.length - inputTokens.length;
|
|
6373
|
+
if (leftExtraTokenCount !== rightExtraTokenCount) {
|
|
6374
|
+
return leftExtraTokenCount - rightExtraTokenCount;
|
|
6375
|
+
}
|
|
6376
|
+
const leftRemainderKey = inputTokens.map((token, index) => left.tokens[index].slice(token.length)).join("\0");
|
|
6377
|
+
const rightRemainderKey = inputTokens.map((token, index) => right.tokens[index].slice(token.length)).join("\0");
|
|
6378
|
+
if (leftRemainderKey !== rightRemainderKey) {
|
|
6379
|
+
return leftRemainderKey.localeCompare(rightRemainderKey);
|
|
6380
|
+
}
|
|
6381
|
+
return left.normalizedName.localeCompare(right.normalizedName);
|
|
6382
|
+
}
|
|
6383
|
+
__name(compareWordPrefixCandidates, "compareWordPrefixCandidates");
|
|
6384
|
+
function matchByWordPrefixSequence2(input, lookup) {
|
|
6385
|
+
const inputTokens = splitWordPrefixTokens4(input);
|
|
6386
|
+
if (inputTokens.length < 2) {
|
|
6387
|
+
return void 0;
|
|
6388
|
+
}
|
|
6389
|
+
const matchedCandidates = lookup.globalRivenItemWordPrefixCandidates.filter((candidate) => {
|
|
6390
|
+
if (candidate.tokens.length < inputTokens.length) {
|
|
6391
|
+
return false;
|
|
6392
|
+
}
|
|
6393
|
+
return inputTokens.every(
|
|
6394
|
+
(token, index) => candidate.tokens[index].startsWith(token)
|
|
6395
|
+
);
|
|
6396
|
+
}).sort((left, right) => compareWordPrefixCandidates(left, right, inputTokens));
|
|
6397
|
+
return matchedCandidates[0]?.item;
|
|
6398
|
+
}
|
|
6399
|
+
__name(matchByWordPrefixSequence2, "matchByWordPrefixSequence");
|
|
6400
|
+
function findFromLookup(input, lookup) {
|
|
6401
|
+
const normalizedInput = normalizeName(input);
|
|
6402
|
+
if (!normalizedInput) {
|
|
6403
|
+
return void 0;
|
|
6404
|
+
}
|
|
6405
|
+
const slugMatchedItem = matchBySlugDict2(normalizedInput, lookup);
|
|
6406
|
+
if (slugMatchedItem) {
|
|
6407
|
+
return slugMatchedItem;
|
|
6408
|
+
}
|
|
6409
|
+
const shortHandMatchedItem = shortHandProcess2(normalizedInput, lookup);
|
|
6410
|
+
if (shortHandMatchedItem) {
|
|
6411
|
+
return shortHandMatchedItem;
|
|
6412
|
+
}
|
|
6413
|
+
const wordPrefixMatchedItem = matchByWordPrefixSequence2(input, lookup);
|
|
6414
|
+
if (wordPrefixMatchedItem) {
|
|
6415
|
+
return wordPrefixMatchedItem;
|
|
6416
|
+
}
|
|
6417
|
+
return void 0;
|
|
6418
|
+
}
|
|
6419
|
+
__name(findFromLookup, "findFromLookup");
|
|
6420
|
+
async function findRivenItemByName(input, globalRivenItemList) {
|
|
6421
|
+
if (globalRivenItemList) {
|
|
6422
|
+
return findFromLookup(input, buildRivenItemLookupData(globalRivenItemList));
|
|
6423
|
+
}
|
|
6424
|
+
return globalRivenItemData.get().then((lookup) => findFromLookup(input, lookup));
|
|
6425
|
+
}
|
|
6426
|
+
__name(findRivenItemByName, "findRivenItemByName");
|
|
6427
|
+
|
|
6428
|
+
// src/services/wfm-service/index.ts
|
|
5995
6429
|
async function updateCache() {
|
|
5996
6430
|
const updateTasks = [
|
|
5997
6431
|
{ name: "globalItemData", fn: globalItemData.update() },
|
|
@@ -6012,32 +6446,32 @@ async function updateCache() {
|
|
|
6012
6446
|
}
|
|
6013
6447
|
__name(updateCache, "updateCache");
|
|
6014
6448
|
async function getItemOrders(input) {
|
|
6449
|
+
input = input.trim();
|
|
6015
6450
|
if (!input) {
|
|
6016
|
-
return { ok: false, message: "
|
|
6451
|
+
return { ok: false, message: "wfm.inputItemName" };
|
|
6017
6452
|
}
|
|
6018
|
-
|
|
6019
|
-
const isFullLevel = /^满级|满级$/.test(input);
|
|
6453
|
+
const isFullLevel = /^满级|满级$/.test(normalizeName(input));
|
|
6020
6454
|
if (isFullLevel) {
|
|
6021
6455
|
if (input.startsWith("满级")) {
|
|
6022
|
-
input = input.slice(2, input.length);
|
|
6456
|
+
input = input.slice(2, input.length).trimStart();
|
|
6023
6457
|
} else if (input.endsWith("满级")) {
|
|
6024
|
-
input = input.slice(0, input.length - 2);
|
|
6458
|
+
input = input.slice(0, input.length - 2).trimEnd();
|
|
6025
6459
|
}
|
|
6026
6460
|
}
|
|
6027
6461
|
const targetItem = await stringToWFMItem(input);
|
|
6028
6462
|
if (!targetItem) {
|
|
6029
|
-
return { ok: false, message:
|
|
6463
|
+
return { ok: false, message: "wfm.itemNotFound", params: { input } };
|
|
6030
6464
|
}
|
|
6031
6465
|
const itemId = targetItem.slug;
|
|
6032
6466
|
const data = await wfmClient.items.getOrders(itemId);
|
|
6033
6467
|
if (!data) {
|
|
6034
|
-
return { ok: false, message: "
|
|
6468
|
+
return { ok: false, message: "wfm.orderFetchFailed" };
|
|
6035
6469
|
}
|
|
6036
6470
|
const result = data.filter(
|
|
6037
6471
|
(order) => order.user.status === "ingame" && order.visible && order.type === "sell" && (!isFullLevel || order.rank === targetItem.maxRank)
|
|
6038
6472
|
).sort((a, b) => toTimeStamp(b.updatedAt) - toTimeStamp(a.updatedAt)).sort((a, b) => a.platinum - b.platinum).slice(0, 5);
|
|
6039
6473
|
if (result.length === 0) {
|
|
6040
|
-
return { ok: false, message: "
|
|
6474
|
+
return { ok: false, message: "wfm.noOnlineSeller" };
|
|
6041
6475
|
}
|
|
6042
6476
|
return {
|
|
6043
6477
|
ok: true,
|
|
@@ -6046,26 +6480,21 @@ async function getItemOrders(input) {
|
|
|
6046
6480
|
}
|
|
6047
6481
|
__name(getItemOrders, "getItemOrders");
|
|
6048
6482
|
async function getRivenOrders(input) {
|
|
6049
|
-
const { globalRivenItemList } = await globalRivenItemData.get();
|
|
6050
6483
|
const { globalRivenAttributeDict } = await globalRivenAttribute.get();
|
|
6051
|
-
const targetItem =
|
|
6052
|
-
(item) => compareRivenItemName(input, item.i18n?.["zh-hans"]?.name ?? "")
|
|
6053
|
-
) ?? globalRivenItemList.find(
|
|
6054
|
-
(item) => compareRivenItemName(input, item.i18n?.en?.name ?? "")
|
|
6055
|
-
);
|
|
6484
|
+
const targetItem = await findRivenItemByName(input);
|
|
6056
6485
|
if (!targetItem) {
|
|
6057
|
-
return { ok: false, message:
|
|
6486
|
+
return { ok: false, message: "wfm.rivenWeaponNotFound", params: { input } };
|
|
6058
6487
|
}
|
|
6059
6488
|
const itemId = targetItem.slug;
|
|
6060
6489
|
const data = await wfmClient.rivens.getOrders(itemId);
|
|
6061
6490
|
if (!data) {
|
|
6062
|
-
return { ok: false, message: "
|
|
6491
|
+
return { ok: false, message: "wfm.rivenOrderFetchFailed" };
|
|
6063
6492
|
}
|
|
6064
6493
|
const top5 = data.filter(
|
|
6065
6494
|
(order) => order.owner.status === "ingame" && order.visible && !order.private && !order.closed && order.is_direct_sell
|
|
6066
6495
|
).sort((a, b) => toTimeStamp(b.updated) - toTimeStamp(a.updated)).sort((a, b) => a.starting_price - b.starting_price).slice(0, 5);
|
|
6067
6496
|
if (top5.length === 0) {
|
|
6068
|
-
return { ok: false, message: "
|
|
6497
|
+
return { ok: false, message: "wfm.noOnlineRivenSeller" };
|
|
6069
6498
|
}
|
|
6070
6499
|
const orders = top5.map((e) => {
|
|
6071
6500
|
const transformed = e.item.attributes.map(
|
|
@@ -6168,179 +6597,20 @@ var primedModHistory = createAsyncCache(async () => {
|
|
|
6168
6597
|
}
|
|
6169
6598
|
return result;
|
|
6170
6599
|
}, 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
|
-
function compareRivenItemName(input, standard) {
|
|
6325
|
-
if (!input || !standard || typeof input !== "string" || typeof standard !== "string") {
|
|
6326
|
-
return false;
|
|
6327
|
-
}
|
|
6328
|
-
const normalizedInput = normalizeName(input);
|
|
6329
|
-
const normalizedStandard = normalizeName(standard);
|
|
6330
|
-
if (!normalizedInput || !normalizedStandard)
|
|
6331
|
-
return false;
|
|
6332
|
-
return normalizedInput === normalizedStandard;
|
|
6333
|
-
}
|
|
6334
|
-
__name(compareRivenItemName, "compareRivenItemName");
|
|
6335
6600
|
|
|
6336
6601
|
// src/commands/miscs.ts
|
|
6602
|
+
function inDevelopment() {
|
|
6603
|
+
return t("miscs.inDevelopment");
|
|
6604
|
+
}
|
|
6605
|
+
__name(inDevelopment, "inDevelopment");
|
|
6337
6606
|
function createMiscsCommands(deps) {
|
|
6338
6607
|
const { render } = deps;
|
|
6339
6608
|
return {
|
|
6609
|
+
inDevelopment,
|
|
6340
6610
|
hotRivenCommand: /* @__PURE__ */ __name(async () => {
|
|
6341
6611
|
const result = await getHotRivenWeapons2();
|
|
6342
6612
|
if (!result.ok) {
|
|
6343
|
-
return result
|
|
6613
|
+
return t(result);
|
|
6344
6614
|
}
|
|
6345
6615
|
return render(
|
|
6346
6616
|
HotRivenComponent(result.data)
|
|
@@ -7947,7 +8217,7 @@ function createWfCommands(deps) {
|
|
|
7947
8217
|
arbitrationCommand: /* @__PURE__ */ __name(async (_action, input) => {
|
|
7948
8218
|
const result = getArbitrations(input);
|
|
7949
8219
|
if (!result.ok) {
|
|
7950
|
-
return result
|
|
8220
|
+
return t(result);
|
|
7951
8221
|
}
|
|
7952
8222
|
return render(ArbitrationComponent(result.data));
|
|
7953
8223
|
}, "arbitrationCommand"),
|
|
@@ -7965,69 +8235,69 @@ function createWfCommands(deps) {
|
|
|
7965
8235
|
voidtraderCommand: /* @__PURE__ */ __name(async (_action) => {
|
|
7966
8236
|
const result = await getVoidTrader();
|
|
7967
8237
|
if (!result.ok) {
|
|
7968
|
-
return result
|
|
8238
|
+
return t(result);
|
|
7969
8239
|
}
|
|
7970
8240
|
return render(VoidTraderComponent(result.data));
|
|
7971
8241
|
}, "voidtraderCommand"),
|
|
7972
8242
|
fissureCommand: /* @__PURE__ */ __name(async (_action) => {
|
|
7973
8243
|
const result = await getFissures();
|
|
7974
8244
|
if (!result.ok) {
|
|
7975
|
-
return result
|
|
8245
|
+
return t(result);
|
|
7976
8246
|
}
|
|
7977
8247
|
return render(FissureComponent(result.data, "fissure"));
|
|
7978
8248
|
}, "fissureCommand"),
|
|
7979
8249
|
steelPathFissureCommand: /* @__PURE__ */ __name(async (_action) => {
|
|
7980
8250
|
const result = await getSteelPathFissures();
|
|
7981
8251
|
if (!result.ok) {
|
|
7982
|
-
return result
|
|
8252
|
+
return t(result);
|
|
7983
8253
|
}
|
|
7984
8254
|
return render(FissureComponent(result.data, "sp-fissure"));
|
|
7985
8255
|
}, "steelPathFissureCommand"),
|
|
7986
8256
|
railjackFissureCommand: /* @__PURE__ */ __name(async (_action) => {
|
|
7987
8257
|
const result = await getRailjackFissures();
|
|
7988
8258
|
if (!result.ok) {
|
|
7989
|
-
return result
|
|
8259
|
+
return t(result);
|
|
7990
8260
|
}
|
|
7991
8261
|
return render(FissureComponent(result.data, "rj-fissure"));
|
|
7992
8262
|
}, "railjackFissureCommand"),
|
|
7993
8263
|
relicCommand: /* @__PURE__ */ __name(async (_action, input) => {
|
|
7994
8264
|
const result = await getRelic(input);
|
|
7995
8265
|
if (!result.ok) {
|
|
7996
|
-
return result
|
|
8266
|
+
return t(result);
|
|
7997
8267
|
}
|
|
7998
8268
|
const relic = await applyRelicData(result.data);
|
|
7999
8269
|
return render(RelicComponent(relic));
|
|
8000
8270
|
}, "relicCommand"),
|
|
8001
8271
|
rivenCommand: /* @__PURE__ */ __name(async (_action, input) => {
|
|
8002
8272
|
if (!input?.src) {
|
|
8003
|
-
return "
|
|
8273
|
+
return t("riven.imageNotFound");
|
|
8004
8274
|
}
|
|
8005
8275
|
if (!config.ocrAPISecret?.id || !config.ocrAPISecret?.key) {
|
|
8006
|
-
return "
|
|
8276
|
+
return t("riven.ocrNotConfigured");
|
|
8007
8277
|
}
|
|
8008
8278
|
const result = await getAnalyzedRiven(
|
|
8009
8279
|
config.ocrAPISecret,
|
|
8010
8280
|
input.src
|
|
8011
8281
|
);
|
|
8012
8282
|
if (!result.ok) {
|
|
8013
|
-
return result
|
|
8283
|
+
return t(result);
|
|
8014
8284
|
}
|
|
8015
8285
|
return render(RivenComponent(result.data));
|
|
8016
8286
|
}, "rivenCommand"),
|
|
8017
8287
|
rivenStatCommand: /* @__PURE__ */ __name(async (_action, weaponType, statType, disposition) => {
|
|
8018
8288
|
if (!weaponType || !statType || !disposition) {
|
|
8019
|
-
return "
|
|
8289
|
+
return t("riven.invalidParams");
|
|
8020
8290
|
}
|
|
8021
8291
|
const result = await getStaticRivenStats(weaponType, statType, disposition);
|
|
8022
8292
|
if (!result.ok) {
|
|
8023
|
-
return result
|
|
8293
|
+
return t(result);
|
|
8024
8294
|
}
|
|
8025
8295
|
return render(RivenStatComponent(result.data));
|
|
8026
8296
|
}, "rivenStatCommand"),
|
|
8027
8297
|
weeklyCommand: /* @__PURE__ */ __name(async (_action) => {
|
|
8028
8298
|
const result = await getWeekly();
|
|
8029
8299
|
if (!result.ok) {
|
|
8030
|
-
return result
|
|
8300
|
+
return t(result);
|
|
8031
8301
|
}
|
|
8032
8302
|
return render(
|
|
8033
8303
|
WeeklyComponent(
|
|
@@ -8041,7 +8311,7 @@ function createWfCommands(deps) {
|
|
|
8041
8311
|
const threshold = minPrice && minPrice > 0 ? minPrice : 100;
|
|
8042
8312
|
const result = await getWeeklyRivens(threshold);
|
|
8043
8313
|
if (result.length === 0) {
|
|
8044
|
-
return "
|
|
8314
|
+
return t("riven.noWeeklyData");
|
|
8045
8315
|
}
|
|
8046
8316
|
return render(WeeklyRivenComponent(result.slice(0, 20), threshold));
|
|
8047
8317
|
}, "weeklyRivenCommand"),
|
|
@@ -8561,14 +8831,14 @@ function createWfmCommands(deps) {
|
|
|
8561
8831
|
wmCommand: /* @__PURE__ */ __name(async (_action, input) => {
|
|
8562
8832
|
const result = await getItemOrders(input);
|
|
8563
8833
|
if (!result.ok) {
|
|
8564
|
-
return result
|
|
8834
|
+
return t(result);
|
|
8565
8835
|
}
|
|
8566
8836
|
return render(ItemOrderComponent(result.data.item, result.data.orders));
|
|
8567
8837
|
}, "wmCommand"),
|
|
8568
8838
|
wmrCommand: /* @__PURE__ */ __name(async (_action, input) => {
|
|
8569
8839
|
const result = await getRivenOrders(input);
|
|
8570
8840
|
if (!result.ok) {
|
|
8571
|
-
return result
|
|
8841
|
+
return t(result);
|
|
8572
8842
|
}
|
|
8573
8843
|
return render(RivenOrderComponent(result.data.item, result.data.orders));
|
|
8574
8844
|
}, "wmrCommand"),
|
|
@@ -8679,17 +8949,13 @@ function setupCommands(ctx, deps) {
|
|
|
8679
8949
|
"武器类型: 步枪, 手枪, 霰弹枪, 近战, Archwing枪械\n词条类型: 2, 3, 21, 31"
|
|
8680
8950
|
).example("riven-stat 步枪 31 0.7").alias("rivenstat").alias("紫卡数值").action(wf.rivenStatCommand);
|
|
8681
8951
|
ctx.command("void-trader", "虚空商人").alias("voidtrader").alias("虚空商人").alias("奸商").action(wf.voidtraderCommand);
|
|
8682
|
-
ctx.command("lich-c", "c系玄骸武器", { hidden: true }).alias("lichc").action(inDevelopment);
|
|
8683
|
-
ctx.command("lich-i", "i系玄骸武器", { hidden: true }).alias("lichi").action(inDevelopment);
|
|
8952
|
+
ctx.command("lich-c", "c系玄骸武器", { hidden: true }).alias("lichc").action(miscs.inDevelopment);
|
|
8953
|
+
ctx.command("lich-i", "i系玄骸武器", { hidden: true }).alias("lichi").action(miscs.inDevelopment);
|
|
8684
8954
|
ctx.command("riven-weekly [minPrice:number]", "每周高价值紫卡参考 (未洗中位价)").alias("weeklyriven").alias("周紫卡").alias("周卡").action(wf.weeklyRivenCommand);
|
|
8685
8955
|
ctx.command("riven-hot", "热门紫卡").alias("hotriven").action(miscs.hotRivenCommand);
|
|
8686
8956
|
ctx.command("pmod-history", "Primed MOD 历史").alias("pmodhistory").alias("pmod").alias("P卡").alias("p卡").alias("P卡历史").alias("p卡历史").action(wfm.pmodhistoryCommand);
|
|
8687
8957
|
}
|
|
8688
8958
|
__name(setupCommands, "setupCommands");
|
|
8689
|
-
function inDevelopment() {
|
|
8690
|
-
return "功能暂未开放";
|
|
8691
|
-
}
|
|
8692
|
-
__name(inDevelopment, "inDevelopment");
|
|
8693
8959
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8694
8960
|
0 && (module.exports = {
|
|
8695
8961
|
Config,
|