koishi-plugin-warframe 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +13 -1
- package/lib/index.js +43 -9
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -58,12 +58,13 @@ export const getItemOrders: (input: string) => Promise<{
|
|
|
58
58
|
item: ItemShort;
|
|
59
59
|
orders: OrderWithUser[];
|
|
60
60
|
}>;
|
|
61
|
-
export const generateItemOrderOutput: (puppe: Puppeteer, item: ItemShort, orders: OrderWithUser[]) => Promise<
|
|
61
|
+
export const generateItemOrderOutput: (puppe: Puppeteer, item: ItemShort, orders: OrderWithUser[]) => Promise<import("koishi").Element>;
|
|
62
62
|
export const getRivenOrders: (input: string) => Promise<{
|
|
63
63
|
item: RivenItem;
|
|
64
64
|
orders: RivenOrder[];
|
|
65
65
|
}>;
|
|
66
66
|
export const generateRivenOrderOutput: (puppe: Puppeteer, item: RivenItem, orders: RivenOrder[]) => Promise<import("koishi").Element>;
|
|
67
|
+
export const inputToItem: (input: string) => ItemShort | undefined;
|
|
67
68
|
declare const _default: {
|
|
68
69
|
SolNode147: number;
|
|
69
70
|
SolNode149: number;
|
|
@@ -97,6 +98,17 @@ export const getRailjackFissures: () => Promise<Fissure[] | "内部错误,获
|
|
|
97
98
|
export const generateFissureOutput: (puppe: Puppeteer, fissures: Fissure[], type: "fissure" | "sp-fissure" | "rj-fissure") => Promise<import("koishi").Element>;
|
|
98
99
|
export const wmCommand: (action: Argv, input: string) => Promise<string | import("koishi").Element>;
|
|
99
100
|
export const wmrCommand: (action: Argv, input: string) => Promise<string | import("koishi").Element>;
|
|
101
|
+
export const inputToItemTestCases: {
|
|
102
|
+
a: string;
|
|
103
|
+
b: string;
|
|
104
|
+
}[];
|
|
105
|
+
export const inputToItemTest: (input: string, predict: string | undefined) => {
|
|
106
|
+
status: boolean;
|
|
107
|
+
msg?: undefined;
|
|
108
|
+
} | {
|
|
109
|
+
status: boolean;
|
|
110
|
+
msg: string;
|
|
111
|
+
};
|
|
100
112
|
export const aboutCommand: () => string;
|
|
101
113
|
export const arbitrationCommand: (action: Argv, input?: number) => string | Promise<import("koishi").Element>;
|
|
102
114
|
export const fissureCommand: (action: Argv) => Promise<import("koishi").Element | "内部错误,获取最新信息失败" | "内部错误">;
|
package/lib/index.js
CHANGED
|
@@ -341,7 +341,12 @@ var ItemOrderOutput = /* @__PURE__ */ __name((item, orders) => {
|
|
|
341
341
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.quantity }),
|
|
342
342
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: order.user.reputation })
|
|
343
343
|
] }))
|
|
344
|
-
] })
|
|
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
|
+
})() })
|
|
345
350
|
] });
|
|
346
351
|
}, "ItemOrderOutput");
|
|
347
352
|
var RivenOrderOutput = /* @__PURE__ */ __name((item, orders) => {
|
|
@@ -611,12 +616,7 @@ var getItemOrders = /* @__PURE__ */ __name(async (input) => {
|
|
|
611
616
|
var generateItemOrderOutput = /* @__PURE__ */ __name(async (puppe, item, orders) => {
|
|
612
617
|
const element = ItemOrderOutput(item, orders);
|
|
613
618
|
const imgBase64 = await getHtmlImageBase64(puppe, element.toString());
|
|
614
|
-
|
|
615
|
-
return OutputImage(imgBase64);
|
|
616
|
-
}
|
|
617
|
-
const firstOrder = orders[0];
|
|
618
|
-
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)`;
|
|
619
|
-
return OutputImage(imgBase64) + comment;
|
|
619
|
+
return OutputImage(imgBase64);
|
|
620
620
|
}, "generateItemOrderOutput");
|
|
621
621
|
var getRivenOrders = /* @__PURE__ */ __name(async (input) => {
|
|
622
622
|
const targetItem = globalRivenItemList.find(
|
|
@@ -737,17 +737,21 @@ var weaponPartSuffix = [
|
|
|
737
737
|
"连接器"
|
|
738
738
|
];
|
|
739
739
|
var removeNameSuffix = /* @__PURE__ */ __name((input) => {
|
|
740
|
+
let hasBPSuffix = false;
|
|
740
741
|
if (input.endsWith(bpSuffix)) {
|
|
741
742
|
input = input.replace(new RegExp(`${bpSuffix}$`), "");
|
|
743
|
+
hasBPSuffix = true;
|
|
742
744
|
}
|
|
743
745
|
if (input.endsWith(setSuffix)) {
|
|
744
746
|
input = input.replace(new RegExp(`${setSuffix}$`), "");
|
|
745
747
|
}
|
|
746
748
|
if (input.endsWith(bpSuffix)) {
|
|
747
749
|
input = input.replace(new RegExp(`${bpSuffix}$`), "");
|
|
750
|
+
hasBPSuffix = true;
|
|
748
751
|
}
|
|
749
|
-
const suffix = warframePartSuffix.find((value) => input.endsWith(value)) ?? weaponPartSuffix.find((value) => input.endsWith(value)) ?? "";
|
|
752
|
+
const suffix = warframePartSuffix.find((value) => input.endsWith(value)) ?? weaponPartSuffix.find((value) => input.endsWith(value)) ?? (input.endsWith("头") ? "头部神经光元" : void 0) ?? (hasBPSuffix ? bpSuffix : void 0) ?? "";
|
|
750
753
|
if (suffix) {
|
|
754
|
+
input = input.endsWith("头") ? input.replace(/头$/, "") : input;
|
|
751
755
|
const pure = input.replace(new RegExp(`${suffix}$`), "");
|
|
752
756
|
return {
|
|
753
757
|
pure,
|
|
@@ -762,7 +766,7 @@ var removeNameSuffix = /* @__PURE__ */ __name((input) => {
|
|
|
762
766
|
}, "removeNameSuffix");
|
|
763
767
|
var shortHandProcess = /* @__PURE__ */ __name((input) => {
|
|
764
768
|
const { pure: inputNoSuffix, suffix } = removeNameSuffix(input);
|
|
765
|
-
if (inputNoSuffix
|
|
769
|
+
if (inputNoSuffix === input) {
|
|
766
770
|
const fixSet = input + setSuffix;
|
|
767
771
|
const fixSetRes = globalItemNameToIDDict[fixSet];
|
|
768
772
|
if (fixSetRes) return globalItemDict[fixSetRes];
|
|
@@ -45361,9 +45365,39 @@ var wmrCommand = /* @__PURE__ */ __name(async (action, input) => {
|
|
|
45361
45365
|
);
|
|
45362
45366
|
}, "wmrCommand");
|
|
45363
45367
|
|
|
45368
|
+
// src/tests/wfm-tests.ts
|
|
45369
|
+
var inputToItemTestCases = [
|
|
45370
|
+
{ a: "瓦喵蓝图", b: "Valkyr Prime 蓝图" },
|
|
45371
|
+
{ a: "ashp", b: "Ash Prime 一套" },
|
|
45372
|
+
{ a: "牛P", b: "Rhino Prime 一套" },
|
|
45373
|
+
{ a: "膛室", b: "膛室 Prime" }
|
|
45374
|
+
];
|
|
45375
|
+
var inputToItemTest = /* @__PURE__ */ __name((input, predict) => {
|
|
45376
|
+
const test1Res = inputToItem(input);
|
|
45377
|
+
if (typeof test1Res === "undefined" && predict === void 0) {
|
|
45378
|
+
return {
|
|
45379
|
+
status: true
|
|
45380
|
+
};
|
|
45381
|
+
}
|
|
45382
|
+
if (test1Res.i18n["zh-hans"].name === predict) {
|
|
45383
|
+
return {
|
|
45384
|
+
status: true
|
|
45385
|
+
};
|
|
45386
|
+
}
|
|
45387
|
+
return {
|
|
45388
|
+
status: false,
|
|
45389
|
+
msg: `Mismatch: "${test1Res.i18n["zh-hans"].name}" != "${predict}"`
|
|
45390
|
+
};
|
|
45391
|
+
}, "inputToItemTest");
|
|
45392
|
+
|
|
45364
45393
|
// src/commands/about.ts
|
|
45365
45394
|
var aboutCommand = /* @__PURE__ */ __name(() => {
|
|
45366
45395
|
return "Authored by CloudeaSoft.";
|
|
45396
|
+
return JSON.stringify(
|
|
45397
|
+
inputToItemTestCases.map((e) => inputToItemTest(e.a, e.b)),
|
|
45398
|
+
null,
|
|
45399
|
+
2
|
|
45400
|
+
);
|
|
45367
45401
|
}, "aboutCommand");
|
|
45368
45402
|
|
|
45369
45403
|
// src/commands/wf/arbitration.ts
|