koishi-plugin-warframe 1.2.1 → 1.3.0

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/README.md CHANGED
@@ -8,14 +8,16 @@ Toolkit for warframe. **(In development)**
8
8
 
9
9
  | Command Name | Default Alias | Description |
10
10
  | ------------------------ | ---------------------- | ------------------------------------------------------------------------------------------- |
11
- | wmi | | Warframe market orders. |
12
- | wmr | | Warframe market orders. |
11
+ | wmi [name:string] | | Warframe market orders. |
12
+ | wmr [name:string] | | Warframe market orders. |
13
13
  | arbitration [day:number] | arbi, 仲裁, 仲裁表 | High-value arbitration schedule. The arg decide how long in days to display, defaults to 3. |
14
14
  | fissure | 裂缝, 裂隙 | Current fissures. |
15
15
  | spfissure | 钢铁裂缝, 钢铁裂隙 | Current steelpath fissures. |
16
16
  | rjfissure | 九重天裂缝, 九重天裂隙 | Current railjack fissures. |
17
17
  | circuit | 灵化, 灵化之源 | Weekly rewards of circuit, both warframe parts and incarnons. |
18
- | about | 关于 | About information. |
18
+ | relic [name:string] | 遗物, 核桃 | Relic rewards with corresponding data, including wfm medium price and ducats value. |
19
+ | weekly | 周常 | Weekly mission info (archon hunt, deep archimedea, temporal archimedea) |
20
+ | environment | env, 地球, 福尔图娜 | Region environment (time) |
19
21
 
20
22
  ## Install
21
23
 
package/lib/index.d.ts CHANGED
@@ -1,12 +1,35 @@
1
1
  import { IRegion } from 'warframe-public-export-plus';
2
2
  import Puppeteer from 'koishi-plugin-puppeteer';
3
3
  import Element from '@satorijs/element';
4
- import { Element, Argv, Context, Schema } from 'koishi';
4
+ import { Element, Dict, Argv, Context, Schema } from 'koishi';
5
5
  import WorldState from 'warframe-worldstate-parser';
6
+ import { GeneralBasicOCRResponse, GeneralAccurateOCRResponse } from 'tencentcloud-sdk-nodejs-ocr/tencentcloud/services/ocr/v20181119/ocr_models';
7
+ export const toTimeStamp: (timeStr: string) => number;
8
+ /**
9
+ * 毫秒转「X小时X分钟X秒」格式(0单位不显示)
10
+ * @param {number} ms - 待转换的毫秒数(非负)
11
+ * @returns {string} 示例:3661000ms → "1小时1分钟1秒";61000ms → "1分钟1秒";500ms → "0秒"
12
+ */
13
+ export const msToHumanReadable: (ms: number) => string;
14
+ /**
15
+ * Creates an async cache with a time-to-live (TTL).
16
+ * @param fetchFn Function to fetch fresh data.
17
+ * @param ttlMs Time-to-live in milliseconds.
18
+ * @returns
19
+ */
20
+ export function createAsyncCache<T>(fetchFn: () => Promise<T>, ttlMs: number): {
21
+ get: () => Promise<T>;
22
+ };
23
+ export const normalizeName: (text: string) => string;
24
+ export const fullWidthToHalfWidth: (text: string) => string;
25
+ export const removeSpace: (text: string) => string;
26
+ export const pascalToSpaced: (text: string) => string;
27
+ export const toPascalCase: (text: string) => string;
28
+ export function normalSimilarity(a: string, b: string): number;
29
+ export function tokenSimilarity(a: string, b: string): number;
6
30
  export const fetchAsyncText: (url: string, method?: string) => Promise<string | null>;
7
31
  export const fetchAsyncData: <T>(url: string, method?: string) => Promise<T | null>;
8
- export const fullWidthToHalfWidth: (str: string) => string;
9
- export const removeSpace: (text: string) => string;
32
+ export const fetchAsyncImage: (url: string, method?: string) => Promise<Blob | null>;
10
33
  export const listToDict: <T>(dict: T[], predict: (obj: T) => string[]) => {
11
34
  [key: string]: T;
12
35
  };
@@ -18,15 +41,13 @@ export const dictToKeyDict: <T>(dict: {
18
41
  }, predict: (obj: T) => string[]) => {
19
42
  [key: string]: string;
20
43
  };
21
- export const pascalToSpaced: (str: string) => string;
22
- export const toPascalCase: (str: string) => string;
23
- export const toTimeStamp: (timeStr: string) => number;
24
- /**
25
- * 毫秒转「X小时X分钟X秒」格式(0单位不显示)
26
- * @param {number} ms - 待转换的毫秒数(非负)
27
- * @returns {string} 示例:3661000ms "1小时1分钟1秒";61000ms "1分钟1秒";500ms "0秒"
28
- */
29
- export const msToHumanReadable: (ms: number) => string;
44
+ export const lerp: (start: number, end: number, t: number) => number;
45
+ export const hexToRgb: (hex: string) => {
46
+ r: number;
47
+ g: number;
48
+ b: number;
49
+ };
50
+ export const rgbToHex: (r: number, g: number, b: number) => string;
30
51
  export const getSolNodeKey: (name: string) => Promise<string>;
31
52
  export const getMissionTypeKey: (name: string) => Promise<string>;
32
53
  export const fissureTierName: {
@@ -75,9 +96,7 @@ export const getHtmlImageBase64: (puppe: Puppeteer, html: string, type?: "png" |
75
96
  export const OutputImage: (imgBase64: string) => Element;
76
97
  export const ItemOrderOutput: (item: ItemShort, orders: OrderWithUser[]) => Element;
77
98
  export const RivenOrderOutput: (item: RivenItem, orders: RivenOrder[]) => Element;
78
- export function createAsyncCache<T>(fetchFn: () => Promise<T>, ttlMs: number): {
79
- get: () => Promise<T>;
80
- };
99
+ export let globalRivenAttributeList: RivenAttribute[];
81
100
  export let globalRivenAttributeDict: Record<string, RivenAttribute>;
82
101
  export const wmOnReady: () => Promise<void>;
83
102
  export const setGlobalItem: (data: ItemShort[]) => void;
@@ -93,8 +112,8 @@ export const getRivenOrders: (input: string) => Promise<{
93
112
  orders: RivenOrder[];
94
113
  }>;
95
114
  export const generateRivenOrderOutput: (puppe: Puppeteer, item: RivenItem, orders: RivenOrder[]) => Promise<import("koishi").Element>;
96
- export const loadRelicData: (relic: Relic) => Promise<OutputRelic>;
97
- export const inputToItem: (input: string) => ItemShort | undefined;
115
+ export const applyRelicData: (relic: Relic) => Promise<OutputRelic>;
116
+ export const stringToWFMItem: (input: string) => ItemShort | undefined;
98
117
  declare const _default: {
99
118
  SolNode147: number;
100
119
  SolNode149: number;
@@ -113,7 +132,10 @@ export const CircuitTable: (incarnons: string[], warframes: string[]) => Element
113
132
  export const FissureTable: (fissures: Fissure[], type: "fissure" | "sp-fissure" | "rj-fissure") => Element;
114
133
  export const WeeklyTable: (archon: string, deepArchimedea: ArchiMedea, temporalArchimedea: ArchiMedea) => Promise<string>;
115
134
  export const RelicComponent: (relic: OutputRelic) => Element;
135
+ export const RivenComponent: (data: RivenStatAnalyzeResult) => Element;
116
136
  export const getWorldState: () => Promise<WorldState>;
137
+ export const extractTextFromImage: (image: string | Blob, secret: OcrAPISecret) => Promise<GeneralBasicOCRResponse | undefined>;
138
+ export const rivenAttrValueDict: Record<string, Record<string, number>>;
117
139
  export const wfOnReady: () => Promise<void>;
118
140
  export const getRelic: (input: string) => Promise<Relic | string>;
119
141
  export const generateRelicOutput: (puppe: Puppeteer, relic: OutputRelic) => Promise<import("koishi").Element>;
@@ -134,10 +156,41 @@ export const generateCircuitWeekOutput: (puppe: Puppeteer, data: {
134
156
  incarnons: string[];
135
157
  warframes: string[];
136
158
  }) => Promise<import("koishi").Element>;
137
- export const getFissures: () => Promise<Fissure[] | "内部错误,获取最新信息失败">;
138
- export const getSteelPathFissures: () => Promise<Fissure[] | "内部错误,获取最新信息失败">;
139
- export const getRailjackFissures: () => Promise<Fissure[] | "内部错误,获取最新信息失败">;
159
+ export const getFissures: () => Promise<any[] | "内部错误,获取最新信息失败">;
160
+ export const getSteelPathFissures: () => Promise<any[] | "内部错误,获取最新信息失败">;
161
+ export const getRailjackFissures: () => Promise<any[] | "内部错误,获取最新信息失败">;
140
162
  export const generateFissureOutput: (puppe: Puppeteer, fissures: Fissure[], type: "fissure" | "sp-fissure" | "rj-fissure") => Promise<import("koishi").Element>;
163
+ export const getWeaponRivenDisposition: (name: string) => {
164
+ name: {
165
+ en: string;
166
+ zh: string;
167
+ };
168
+ calc: {
169
+ disposition: number;
170
+ name: string;
171
+ texture: string;
172
+ riventype: string;
173
+ };
174
+ weapon: any;
175
+ };
176
+ export const getAnalyzedRiven: (secret: OcrAPISecret, dict: Dict) => Promise<string | RivenStatAnalyzeResult>;
177
+ export const generateAnalyzedRivenOutput: (puppe: Puppeteer, data: RivenStatAnalyzeResult) => Promise<import("koishi").Element>;
178
+ export const parseOCRResult: (ocrResult: GeneralAccurateOCRResponse) => {
179
+ name: string;
180
+ attributes: {
181
+ attr: RivenAttribute;
182
+ value: number;
183
+ prefix: string;
184
+ }[];
185
+ };
186
+ export const analyzeRivenStat: (parseResult: {
187
+ name: string;
188
+ attributes: {
189
+ attr: RivenAttribute;
190
+ value: number;
191
+ prefix: string;
192
+ }[];
193
+ }) => RivenStatAnalyzeResult | string;
141
194
  export const wmCommand: (action: Argv, input: string) => Promise<string | import("koishi").Element>;
142
195
  export const wmrCommand: (action: Argv, input: string) => Promise<string | import("koishi").Element>;
143
196
  export const aboutCommand: (action: Argv) => Promise<string>;
@@ -149,10 +202,12 @@ export const circuitCommand: (action: Argv) => Promise<import("koishi").Element>
149
202
  export const environmentCommand: () => Promise<string>;
150
203
  export const weeklyCommand: (action: Argv) => Promise<string>;
151
204
  export const relicCommand: (action: Argv, input: string) => Promise<string | import("koishi").Element>;
205
+ export const rivenCommand: (action: Argv, input: Dict, secret: OcrAPISecret) => Promise<string | import("koishi").Element>;
152
206
  export const onReadyHandler: () => Promise<void>;
153
207
  export const name = "warframe";
154
208
  export interface Config {
155
209
  developerMode: boolean;
210
+ ocrAPISecret: OcrAPISecret;
156
211
  }
157
212
  export const Config: Schema<Config>;
158
213
  export function apply(ctx: Context): void;