koishi-plugin-warframe 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +6 -4
- package/lib/index.js +284 -54
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -5,9 +5,12 @@ import { Element, Argv, Context, Schema } from 'koishi';
|
|
|
5
5
|
export const fetchAsyncText: (url: string, method?: string) => Promise<string | null>;
|
|
6
6
|
export const fetchAsyncData: <T>(url: string, method?: string) => Promise<T | null>;
|
|
7
7
|
export const fullWidthToHalfWidth: (str: string) => string;
|
|
8
|
-
export const
|
|
8
|
+
export const listToDict: <T>(dict: T[], predict: (obj: T) => string[]) => {
|
|
9
9
|
[key: string]: T;
|
|
10
10
|
};
|
|
11
|
+
export const listToDictSpec: <TObj, TValue>(dict: TObj[], predict: (obj: TObj) => string[], value: (obj: TObj) => TValue) => {
|
|
12
|
+
[key: string]: TValue;
|
|
13
|
+
};
|
|
11
14
|
export const dictToKeyDict: <T>(dict: {
|
|
12
15
|
[key: string]: T;
|
|
13
16
|
}, predict: (obj: T) => string[]) => {
|
|
@@ -49,10 +52,9 @@ export const getHtmlImageBase64: (puppe: Puppeteer, html: string, type?: "png" |
|
|
|
49
52
|
export const OutputImage: (imgBase64: string) => Element;
|
|
50
53
|
export const ItemOrderOutput: (item: ItemShort, orders: OrderWithUser[]) => Element;
|
|
51
54
|
export const RivenOrderOutput: (item: RivenItem, orders: RivenOrder[]) => Element;
|
|
52
|
-
let
|
|
53
|
-
export { globalRivenAttributeList };
|
|
55
|
+
export let globalRivenAttributeDict: Record<string, RivenAttribute>;
|
|
54
56
|
export const wmOnReady: () => Promise<void>;
|
|
55
|
-
export const getItemOrders: (
|
|
57
|
+
export const getItemOrders: (input: string) => Promise<{
|
|
56
58
|
item: ItemShort;
|
|
57
59
|
orders: OrderWithUser[];
|
|
58
60
|
}>;
|
package/lib/index.js
CHANGED
|
@@ -79,6 +79,18 @@ var fullWidthToHalfWidth = /* @__PURE__ */ __name((str) => {
|
|
|
79
79
|
return String.fromCharCode(char.charCodeAt(0) - 65248);
|
|
80
80
|
}).replace(/\u3000/g, " ");
|
|
81
81
|
}, "fullWidthToHalfWidth");
|
|
82
|
+
var listToDict = /* @__PURE__ */ __name((dict, predict) => {
|
|
83
|
+
const result = {};
|
|
84
|
+
for (const obj of dict) {
|
|
85
|
+
const keys = predict(obj);
|
|
86
|
+
for (const key of keys) {
|
|
87
|
+
if (typeof key === "string" && key.length > 0) {
|
|
88
|
+
result[key] = obj;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}, "listToDict");
|
|
82
94
|
var dictToKeyDict = /* @__PURE__ */ __name((dict, predict) => {
|
|
83
95
|
const result = {};
|
|
84
96
|
for (const obj in dict) {
|
|
@@ -294,7 +306,6 @@ var ItemOrderOutput = /* @__PURE__ */ __name((item, orders) => {
|
|
|
294
306
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
|
|
295
307
|
th {
|
|
296
308
|
align-items: center;
|
|
297
|
-
width:33%;
|
|
298
309
|
font-size: 1.8rem;
|
|
299
310
|
}
|
|
300
311
|
|
|
@@ -317,16 +328,25 @@ var ItemOrderOutput = /* @__PURE__ */ __name((item, orders) => {
|
|
|
317
328
|
] }),
|
|
318
329
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { style: "width:100%;", children: [
|
|
319
330
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
320
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "玩家名" }),
|
|
321
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "状态" }),
|
|
322
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "价格" })
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: "width:40%;", children: "玩家名" }),
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: "width:30%;", children: "状态" }),
|
|
333
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: "width:10%;", children: "价格" }),
|
|
334
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: "width:10%;", children: "数量" }),
|
|
335
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { style: "width:10%;", children: "好评" })
|
|
323
336
|
] }),
|
|
324
337
|
orders.map((order) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
325
338
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.user.ingameName }),
|
|
326
339
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.user.status }),
|
|
327
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.platinum })
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.platinum }),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.quantity }),
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.user.reputation })
|
|
328
343
|
] }))
|
|
329
|
-
] })
|
|
344
|
+
] }),
|
|
345
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: "text-align: center; margin-top: 30px; font-size: 25px;", children: (() => {
|
|
346
|
+
const firstOrder = orders[0];
|
|
347
|
+
const comment = `/w ${firstOrder.user.ingameName} Hi! I want to buy: "${item.i18n["en"].name}${!item.maxRank || item.maxRank === 0 ? "" : ` (rank ${firstOrder.rank})`}" for ${firstOrder.platinum} platinum. (warframe.market)`;
|
|
348
|
+
return comment;
|
|
349
|
+
})() })
|
|
330
350
|
] });
|
|
331
351
|
}, "ItemOrderOutput");
|
|
332
352
|
var RivenOrderOutput = /* @__PURE__ */ __name((item, orders) => {
|
|
@@ -480,9 +500,7 @@ var RivenOrderComponent = /* @__PURE__ */ __name((item, order) => {
|
|
|
480
500
|
] });
|
|
481
501
|
}, "RivenOrderComponent");
|
|
482
502
|
var RivenAttributeComponent = /* @__PURE__ */ __name((attr, index) => {
|
|
483
|
-
const attrInfo =
|
|
484
|
-
(e) => e.slug == attr.url_name
|
|
485
|
-
);
|
|
503
|
+
const attrInfo = globalRivenAttributeDict[attr.url_name];
|
|
486
504
|
const attrName = attrInfo.i18n["zh-hans"].name;
|
|
487
505
|
const attrValuePrefix = attrInfo.unit === "multiply" ? "x" : "";
|
|
488
506
|
const unitSuffixMap = {
|
|
@@ -526,31 +544,59 @@ var RivenAttributeComponent = /* @__PURE__ */ __name((attr, index) => {
|
|
|
526
544
|
var globalItemList = [];
|
|
527
545
|
var globalRivenItemList = [];
|
|
528
546
|
var globalRivenAttributeList = [];
|
|
547
|
+
var globalItemDict = {};
|
|
548
|
+
var globalRivenItemDict = {};
|
|
549
|
+
var globalRivenAttributeDict = {};
|
|
550
|
+
var globalItemNameToIDDict = {};
|
|
529
551
|
var wmOnReady = /* @__PURE__ */ __name(async () => {
|
|
530
552
|
const data = await getWFMItemList();
|
|
531
553
|
if (!data) {
|
|
532
554
|
throw new Error("Failed to fetch items from Warframe Market API.");
|
|
533
555
|
}
|
|
534
|
-
globalItemList = data.data;
|
|
535
556
|
const rivenData = await getWFMRivenItemList();
|
|
536
557
|
if (!rivenData) {
|
|
537
558
|
throw new Error("Failed to fetch riven items from Warframe Market API.");
|
|
538
559
|
}
|
|
539
|
-
globalRivenItemList = rivenData.data;
|
|
540
560
|
const rivenAttributeData = await getWFMRivenAttributeList();
|
|
541
561
|
if (!rivenAttributeData) {
|
|
542
562
|
throw new Error(
|
|
543
563
|
"Failed to fetch riven attributes from Warframe Market API."
|
|
544
564
|
);
|
|
545
565
|
}
|
|
566
|
+
globalItemList = data.data;
|
|
567
|
+
globalRivenItemList = rivenData.data;
|
|
546
568
|
globalRivenAttributeList = rivenAttributeData.data;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
(item) => compareENOrderName(itemName, item.i18n["en"].name)
|
|
569
|
+
globalItemDict = listToDict(data.data, (i) => [i.slug]);
|
|
570
|
+
globalRivenItemDict = listToDict(rivenData.data, (i) => [i.slug]);
|
|
571
|
+
globalRivenAttributeDict = listToDict(
|
|
572
|
+
rivenAttributeData.data,
|
|
573
|
+
(a) => [a.slug]
|
|
553
574
|
);
|
|
575
|
+
globalItemNameToIDDict = ((list) => {
|
|
576
|
+
const result = {};
|
|
577
|
+
for (const item of list) {
|
|
578
|
+
if (item.i18n["zh-hans"]?.name) {
|
|
579
|
+
result[normalizeOrderName(item.i18n["zh-hans"].name)] = item.slug;
|
|
580
|
+
}
|
|
581
|
+
if (item.i18n["en"]?.name) {
|
|
582
|
+
result[normalizeOrderName(item.i18n["en"].name)] = item.slug;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return result;
|
|
586
|
+
})(globalItemList);
|
|
587
|
+
}, "wmOnReady");
|
|
588
|
+
var getItemOrders = /* @__PURE__ */ __name(async (input) => {
|
|
589
|
+
if (!input) return null;
|
|
590
|
+
input = normalizeOrderName(input);
|
|
591
|
+
const isFullLevel = /^满级|满级$/.test(input);
|
|
592
|
+
if (isFullLevel) {
|
|
593
|
+
if (input.match(/^满级/)) {
|
|
594
|
+
input = input.slice(2, input.length);
|
|
595
|
+
} else if (input.match(/满级$/)) {
|
|
596
|
+
input = input.slice(0, input.length - 2);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
const targetItem = inputToItem(input);
|
|
554
600
|
if (!targetItem) {
|
|
555
601
|
return null;
|
|
556
602
|
}
|
|
@@ -560,7 +606,7 @@ var getItemOrders = /* @__PURE__ */ __name(async (itemName) => {
|
|
|
560
606
|
return null;
|
|
561
607
|
}
|
|
562
608
|
const result = data.data.filter(
|
|
563
|
-
(order) => order.user.status === "ingame" && order.visible && order.type === "sell"
|
|
609
|
+
(order) => order.user.status === "ingame" && order.visible && order.type === "sell" && (!isFullLevel || order.rank == targetItem.maxRank)
|
|
564
610
|
).sort((a, b) => toTimeStamp(b.updatedAt) - toTimeStamp(a.updatedAt)).sort((a, b) => a.platinum - b.platinum).slice(0, 5);
|
|
565
611
|
return {
|
|
566
612
|
item: targetItem,
|
|
@@ -596,45 +642,229 @@ var generateRivenOrderOutput = /* @__PURE__ */ __name(async (puppe, item, orders
|
|
|
596
642
|
const imgBase64 = await getHtmlImageBase64(puppe, element.toString());
|
|
597
643
|
return OutputImage(imgBase64);
|
|
598
644
|
}, "generateRivenOrderOutput");
|
|
599
|
-
var
|
|
600
|
-
|
|
601
|
-
|
|
645
|
+
var warframeAlias = {
|
|
646
|
+
Volt: ["电", "电男", "伏特"],
|
|
647
|
+
Trinity: ["奶妈", "奶"],
|
|
648
|
+
Rhino: ["犀牛", "牛", "铁甲犀牛"],
|
|
649
|
+
Mag: ["磁妹", "磁力"],
|
|
650
|
+
Loki: ["洛基"],
|
|
651
|
+
Excalibur: ["咖喱棒", "圣剑", "咖喱"],
|
|
652
|
+
Ember: ["火鸡"],
|
|
653
|
+
Ash: ["灰烬", "灰烬之刃"],
|
|
654
|
+
Nyx: ["脑溢血"],
|
|
655
|
+
Frost: ["冰男", "冰雪寒霜", "冰队", "冰"],
|
|
656
|
+
Saryn: ["毒妈", "毒"],
|
|
657
|
+
Banshee: ["女妖", "女高音"],
|
|
658
|
+
Vauban: ["工程"],
|
|
659
|
+
Nova: ["诺娃", "加速", "加速娃"],
|
|
660
|
+
Nekros: ["摸尸", "摸"],
|
|
661
|
+
Valkyr: ["瓦尔基里", "瓦喵", "瓦"],
|
|
662
|
+
Oberon: ["奶爸", "龙王", "奥伯龙"],
|
|
663
|
+
Zephyr: ["鸟姐", "鸟"],
|
|
664
|
+
Hydroid: ["水男"],
|
|
665
|
+
Mirage: ["小丑", "丑"],
|
|
666
|
+
Limbo: ["小明", "李明博", "明"],
|
|
667
|
+
Mesa: ["女枪"],
|
|
668
|
+
Chroma: ["龙甲", "龙"],
|
|
669
|
+
Equinox: ["阴阳", "双子"],
|
|
670
|
+
Atlas: ["土石魔像", "土"],
|
|
671
|
+
Wukong: ["猴子", "齐天大圣", "悟空", "猴"],
|
|
672
|
+
Ivara: ["弓妹", "弓"],
|
|
673
|
+
Nezha: ["哪吒", "三太子"],
|
|
674
|
+
Inaros: ["沙"],
|
|
675
|
+
Titania: ["蝶妹"],
|
|
676
|
+
Nidus: ["蛆甲", "蛆"],
|
|
677
|
+
Octavia: ["DJ", "音乐"],
|
|
678
|
+
Harrow: ["主教"],
|
|
679
|
+
Gara: ["玻璃"],
|
|
680
|
+
Khora: ["猫"],
|
|
681
|
+
Revenant: ["夜灵"],
|
|
682
|
+
Garuda: ["血妈", "血"],
|
|
683
|
+
Baruuk: ["武僧"],
|
|
684
|
+
Hildryn: ["母牛"],
|
|
685
|
+
Wisp: ["花"],
|
|
686
|
+
Gauss: ["高斯"],
|
|
687
|
+
Grendel: ["肥宅"],
|
|
688
|
+
Protea: ["茶", "茶妹"],
|
|
689
|
+
Xaku: ["骨"],
|
|
690
|
+
Lavos: ["炼金", "药水", "药水哥", "蛇"],
|
|
691
|
+
Sevagoth: ["鬼", "鲨鱼"],
|
|
692
|
+
Yareli: ["水妹"],
|
|
693
|
+
Caliban: ["卡利班"],
|
|
694
|
+
Gyre: ["电妹"],
|
|
695
|
+
Styanax: ["斯巴达"],
|
|
696
|
+
Voruna: ["狼", "狼妹"],
|
|
697
|
+
Citrine: ["水晶", "宝石"],
|
|
698
|
+
Kullervo: ["刀哥"],
|
|
699
|
+
Dagath: ["马", "赛马娘", "马娘"],
|
|
700
|
+
Qorvex: ["暖气片"],
|
|
701
|
+
Dante: ["但丁"],
|
|
702
|
+
Jade: ["翡翠", "天使"],
|
|
703
|
+
Koumei: [],
|
|
704
|
+
"Cyte-09": ["Cyte09", "老九", "9", "九"],
|
|
705
|
+
Temple: ["吉他"],
|
|
706
|
+
Nokko: ["蘑菇"]
|
|
707
|
+
};
|
|
708
|
+
var warframeAliasDict = ((aliasObject) => {
|
|
709
|
+
const transformedObject = {};
|
|
710
|
+
for (const [key, aliases] of Object.entries(aliasObject)) {
|
|
711
|
+
for (const alias of aliases) {
|
|
712
|
+
if (typeof alias === "string" && alias.length > 0) {
|
|
713
|
+
transformedObject[alias] = key;
|
|
714
|
+
const warframeNameWithSuffix = `${alias}甲`;
|
|
715
|
+
transformedObject[warframeNameWithSuffix] = key;
|
|
716
|
+
}
|
|
717
|
+
transformedObject[key] = key;
|
|
718
|
+
}
|
|
602
719
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
720
|
+
return transformedObject;
|
|
721
|
+
})(warframeAlias);
|
|
722
|
+
var setSuffix = "一套";
|
|
723
|
+
var bpSuffix = "蓝图";
|
|
724
|
+
var primeSuffix = "prime";
|
|
725
|
+
var warframePartSuffix = ["系统", "头部神经光元", "机体"];
|
|
726
|
+
var weaponPartSuffix = [
|
|
727
|
+
"枪管",
|
|
728
|
+
"枪托",
|
|
729
|
+
"枪机",
|
|
730
|
+
"弓弦",
|
|
731
|
+
"上弓臂",
|
|
732
|
+
"下弓臂",
|
|
733
|
+
"刀刃",
|
|
734
|
+
"握柄",
|
|
735
|
+
"拳套",
|
|
736
|
+
"圆盘",
|
|
737
|
+
"连接器"
|
|
738
|
+
];
|
|
739
|
+
var removeNameSuffix = /* @__PURE__ */ __name((input) => {
|
|
740
|
+
if (input.endsWith(bpSuffix)) {
|
|
741
|
+
input = input.replace(new RegExp(`${bpSuffix}$`), "");
|
|
616
742
|
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
743
|
+
if (input.endsWith(setSuffix)) {
|
|
744
|
+
input = input.replace(new RegExp(`${setSuffix}$`), "");
|
|
745
|
+
}
|
|
746
|
+
if (input.endsWith(bpSuffix)) {
|
|
747
|
+
input = input.replace(new RegExp(`${bpSuffix}$`), "");
|
|
748
|
+
}
|
|
749
|
+
const suffix = warframePartSuffix.find((value) => input.endsWith(value)) ?? weaponPartSuffix.find((value) => input.endsWith(value)) ?? "";
|
|
750
|
+
if (suffix) {
|
|
751
|
+
const pure = input.replace(new RegExp(`${suffix}$`), "");
|
|
752
|
+
return {
|
|
753
|
+
pure,
|
|
754
|
+
suffix
|
|
755
|
+
};
|
|
756
|
+
} else {
|
|
757
|
+
return {
|
|
758
|
+
pure: input,
|
|
759
|
+
suffix
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
}, "removeNameSuffix");
|
|
763
|
+
var shortHandProcess = /* @__PURE__ */ __name((input) => {
|
|
764
|
+
const { pure: inputNoSuffix, suffix } = removeNameSuffix(input);
|
|
765
|
+
if (inputNoSuffix == input) {
|
|
766
|
+
const fixSet = input + setSuffix;
|
|
767
|
+
const fixSetRes = globalItemNameToIDDict[fixSet];
|
|
768
|
+
if (fixSetRes) return globalItemDict[fixSetRes];
|
|
769
|
+
const fixPrime = input.endsWith(primeSuffix) ? input : input.endsWith("p") ? input.slice(0, input.length - 1) + primeSuffix : input + primeSuffix;
|
|
770
|
+
const fixPrimeRes = globalItemNameToIDDict[fixPrime];
|
|
771
|
+
if (fixPrimeRes) return globalItemDict[fixPrimeRes];
|
|
772
|
+
const fixPrimeSet = fixPrime + setSuffix;
|
|
773
|
+
const fixPrimeSetRes = globalItemNameToIDDict[fixPrimeSet];
|
|
774
|
+
if (fixPrimeSetRes) return globalItemDict[fixPrimeSetRes];
|
|
775
|
+
const fixBP = input + bpSuffix;
|
|
776
|
+
const fixBPRes = globalItemNameToIDDict[fixBP];
|
|
777
|
+
if (fixBPRes) return globalItemDict[fixBPRes];
|
|
778
|
+
const fixPrimeBP = fixPrime + bpSuffix;
|
|
779
|
+
const fixPrimeBPRes = globalItemNameToIDDict[fixPrimeBP];
|
|
780
|
+
if (fixPrimeBPRes) return globalItemDict[fixPrimeBPRes];
|
|
781
|
+
} else {
|
|
782
|
+
const fixBP = inputNoSuffix + suffix + bpSuffix;
|
|
783
|
+
const fixBPRes = globalItemNameToIDDict[fixBP];
|
|
784
|
+
if (fixBPRes) return globalItemDict[fixBPRes];
|
|
785
|
+
const fixPrime = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix : inputNoSuffix.endsWith("p") ? inputNoSuffix.slice(0, inputNoSuffix.length - 1) + primeSuffix : inputNoSuffix + primeSuffix;
|
|
786
|
+
const fixPrimeRes = globalItemNameToIDDict[fixPrime + suffix];
|
|
787
|
+
if (fixPrimeRes) return globalItemDict[fixPrimeRes];
|
|
788
|
+
const fixPrimeBP = fixPrime + suffix + bpSuffix;
|
|
789
|
+
const fixPrimeBPRes = globalItemNameToIDDict[fixPrimeBP];
|
|
790
|
+
if (fixPrimeBPRes) return globalItemDict[fixPrimeBPRes];
|
|
791
|
+
}
|
|
792
|
+
}, "shortHandProcess");
|
|
793
|
+
var inputToItem = /* @__PURE__ */ __name((input) => {
|
|
794
|
+
const slug = globalItemNameToIDDict[normalizeOrderName(input)];
|
|
795
|
+
if (slug) return globalItemDict[slug];
|
|
796
|
+
const normalShortHandRes = shortHandProcess(input);
|
|
797
|
+
if (normalShortHandRes) return normalShortHandRes;
|
|
798
|
+
const { pure: inputNoSuffix, suffix } = removeNameSuffix(input);
|
|
799
|
+
const aliasHasEndP = inputNoSuffix.endsWith(primeSuffix) ? inputNoSuffix.replace(new RegExp(`${primeSuffix}$`), "") : inputNoSuffix;
|
|
800
|
+
const mappedAliasHasEndP = warframeAliasDict[aliasHasEndP];
|
|
801
|
+
if (mappedAliasHasEndP) {
|
|
802
|
+
const aliasHasEndPRes = shortHandProcess(
|
|
803
|
+
normalizeOrderName(mappedAliasHasEndP) + primeSuffix + suffix
|
|
804
|
+
);
|
|
805
|
+
if (aliasHasEndPRes) return aliasHasEndPRes;
|
|
806
|
+
}
|
|
807
|
+
if (inputNoSuffix.endsWith("p")) {
|
|
808
|
+
const aliasNoEndP = inputNoSuffix.replace(/p$/, "");
|
|
809
|
+
const mappedAliasNoEndP = warframeAliasDict[aliasNoEndP];
|
|
810
|
+
if (mappedAliasNoEndP) {
|
|
811
|
+
const aliasNoEndPRes = shortHandProcess(
|
|
812
|
+
normalizeOrderName(mappedAliasNoEndP) + primeSuffix + suffix
|
|
813
|
+
);
|
|
814
|
+
if (aliasNoEndPRes) return aliasNoEndPRes;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
const compareCNOrderName = /* @__PURE__ */ __name((input2, standard) => {
|
|
818
|
+
if (!input2 || !standard || typeof input2 !== "string" || typeof standard !== "string") {
|
|
819
|
+
return false;
|
|
820
|
+
}
|
|
821
|
+
const normalizedInput = normalizeOrderName(input2);
|
|
822
|
+
const normalizedStandard = normalizeOrderName(standard);
|
|
823
|
+
if (!normalizedInput || !normalizedStandard) return false;
|
|
824
|
+
const normalizedStandardNoSet = normalizedStandard.replace(/一套/g, "");
|
|
825
|
+
const normalizedStandardNoSetSimplifiedPrime = normalizedStandardNoSet.replace(/prime/g, "p");
|
|
826
|
+
const normalizedStandardNoBlueprint = normalizedStandard.replace(
|
|
827
|
+
/蓝图/g,
|
|
828
|
+
""
|
|
829
|
+
);
|
|
830
|
+
const normalizedStandardNoBlueprintSimplifiedPrime = normalizedStandardNoBlueprint.replace(/prime/g, "p");
|
|
831
|
+
const normalizedStandardNoNeu = normalizedStandardNoBlueprintSimplifiedPrime.replace(
|
|
832
|
+
/头部神经光元/g,
|
|
833
|
+
"头"
|
|
834
|
+
);
|
|
835
|
+
return normalizedInput === normalizedStandard || normalizedInput === normalizedStandardNoSet || normalizedInput === normalizedStandardNoSetSimplifiedPrime || normalizedInput === normalizedStandardNoBlueprintSimplifiedPrime || normalizedInput === normalizedStandardNoNeu;
|
|
836
|
+
}, "compareCNOrderName");
|
|
837
|
+
const compareENOrderName = /* @__PURE__ */ __name((input2, standard) => {
|
|
838
|
+
if (!input2 || !standard || typeof input2 !== "string" || typeof standard !== "string") {
|
|
839
|
+
return false;
|
|
840
|
+
}
|
|
841
|
+
const endWithSet = standard.toLowerCase().endsWith(" set");
|
|
842
|
+
const standardNoSet = endWithSet ? standard.slice(0, -4) : standard;
|
|
843
|
+
const endWithBlueprint = standard.toLocaleLowerCase().endsWith("blueprint");
|
|
844
|
+
const standardNoBlueprint = endWithBlueprint ? standard.slice(0, -10) : standard;
|
|
845
|
+
const standardSimplifiedPrime = standardNoSet.replace(/ Prime/g, "p");
|
|
846
|
+
const standardNoBlueprintSimplifiedPrime = standardNoBlueprint.replace(
|
|
847
|
+
/ Prime/g,
|
|
848
|
+
"p"
|
|
849
|
+
);
|
|
850
|
+
const normalizedInput = normalizeOrderName(input2);
|
|
851
|
+
const normalizedStandard = normalizeOrderName(standard);
|
|
852
|
+
if (!normalizedInput || !normalizedStandard) return false;
|
|
853
|
+
const normalizedStandardNoSet = normalizeOrderName(standardNoSet);
|
|
854
|
+
const normalizedStandardSimplifiedPrime = normalizeOrderName(
|
|
855
|
+
standardSimplifiedPrime
|
|
856
|
+
);
|
|
857
|
+
const normalizedStandardNoBlueprint = normalizeOrderName(
|
|
858
|
+
standardNoBlueprintSimplifiedPrime
|
|
859
|
+
);
|
|
860
|
+
return normalizedInput === normalizedStandard || normalizedInput === normalizedStandardNoSet || normalizedInput === normalizedStandardSimplifiedPrime || normalizedInput === normalizedStandardNoBlueprint;
|
|
861
|
+
}, "compareENOrderName");
|
|
862
|
+
return globalItemList.find(
|
|
863
|
+
(item) => compareCNOrderName(input, item.i18n["zh-hans"].name)
|
|
864
|
+
) ?? globalItemList.find(
|
|
865
|
+
(item) => compareENOrderName(input, item.i18n["en"].name)
|
|
635
866
|
);
|
|
636
|
-
|
|
637
|
-
}, "compareENOrderName");
|
|
867
|
+
}, "inputToItem");
|
|
638
868
|
var compareRivenItemName = /* @__PURE__ */ __name((input, standard) => {
|
|
639
869
|
if (!input || !standard || typeof input !== "string" || typeof standard !== "string") {
|
|
640
870
|
return false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-warframe",
|
|
3
3
|
"description": "WFMToolkit",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "yakumo build",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@koishijs/client": "^5.30.11",
|
|
52
52
|
"@koishijs/plugin-help": "^2.4.6",
|
|
53
53
|
"@satorijs/element": "^3.1.8",
|
|
54
|
-
"@types/node": "^
|
|
54
|
+
"@types/node": "^25.0.3",
|
|
55
55
|
"dtsc": "^3.1.0",
|
|
56
56
|
"esbuild": "^0.27.1",
|
|
57
57
|
"koishi": "^4.18.9",
|