koishi-plugin-warframe 1.5.1 → 1.5.3

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.
Files changed (4) hide show
  1. package/README.md +71 -34
  2. package/lib/index.d.ts +58 -54
  3. package/lib/index.js +1623 -1660
  4. package/package.json +3 -2
package/README.md CHANGED
@@ -8,67 +8,104 @@ Toolkit for Warframe. Provides Warframe Market prices, fissures, arbitrations, r
8
8
 
9
9
  ### Warframe Market
10
10
 
11
- | Command | Arguments | Aliases | Description |
12
- | ------- | --------- | ------- | ----------- |
13
- | `wmi` | `<item:text>` | | Query Warframe Market item orders (medians, ducat values, etc.) Displayed as an image. |
14
- | `wm` | `<item:text>` | | **Deprecated**, use `wmi` instead. |
15
- | `wmr` | `<item:text>` | | Query Warframe Market riven orders. |
16
- | `wmu` | | | Update Warframe Market cache. |
17
- | `pmodhistory` | | `pmod`, `P卡`, `p卡`, `P卡历史`, `p卡历史` | Query Primed MOD price history. |
18
- | `hotriven` | | | Query trending riven weapons ranking. |
11
+ | Command | Arguments | Aliases | Description |
12
+ | ------------- | ------------- | ------------------------------------------ | -------------------------------------------------------------------------------------- |
13
+ | `wmi` | `<item:text>` | | Query Warframe Market item orders (medians, ducat values, etc.) Displayed as an image. |
14
+ | `wm` | `<item:text>` | | **Deprecated**, use `wmi` instead. |
15
+ | `wmr` | `<item:text>` | | Query Warframe Market riven orders. |
16
+ | `wmu` | | | Update Warframe Market cache. |
17
+ | `pmodhistory` | | `pmod`, `P卡`, `p卡`, `P卡历史`, `p卡历史` | Query Primed MOD price history. |
18
+ | `hotriven` | | | Query trending riven weapons ranking. |
19
19
 
20
20
  ### Fissures
21
21
 
22
- | Command | Arguments | Aliases | Description |
23
- | ------- | --------- | ------- | ----------- |
24
- | `fissure` | | `裂缝`, `裂隙` | List current void fissure missions. |
25
- | `spfissure` | | `钢铁裂缝`, `钢铁裂隙` | List current steel path fissure missions. |
26
- | `rjfissure` | | `九重天裂缝`, `九重天裂隙` | List current railjack fissure missions. |
22
+ | Command | Arguments | Aliases | Description |
23
+ | ----------- | --------- | -------------------------- | ----------------------------------------- |
24
+ | `fissure` | | `裂缝`, `裂隙` | List current void fissure missions. |
25
+ | `spfissure` | | `钢铁裂缝`, `钢铁裂隙` | List current steel path fissure missions. |
26
+ | `rjfissure` | | `九重天裂缝`, `九重天裂隙` | List current railjack fissure missions. |
27
27
 
28
28
  ### Relics
29
29
 
30
- | Command | Arguments | Aliases | Description |
31
- | ------- | --------- | ------- | ----------- |
30
+ | Command | Arguments | Aliases | Description |
31
+ | ------- | -------------- | -------------- | ---------------------------------------------------------------------------- |
32
32
  | `relic` | `<relic:text>` | `遗物`, `核桃` | Query relic contents with drop chances, WFM median prices, and ducat values. |
33
33
 
34
34
  ### Weekly & Activities
35
35
 
36
- | Command | Arguments | Aliases | Description |
37
- | ------- | --------- | ------- | ----------- |
38
- | `arbitration` | `[day:number]` | `arbi`, `仲裁`, `仲裁表` | Query high-value arbitration missions. Optional `day` controls how many days to show (default: 3). |
39
- | `weekly` | | `周常`, `科研`, `时光科研`, `深层科研`, `执行官` | Query weekly missions (Archon Hunt, Deep Archimedea, Temporal Archimedea). |
40
- | `circuit` | | `灵化之源`, `灵化` | Query weekly circuit rewards (warframes and incarnon adapters). |
36
+ | Command | Arguments | Aliases | Description |
37
+ | ------------- | -------------- | ------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
38
+ | `arbitration` | `[day:number]` | `arbi`, `仲裁`, `仲裁表` | Query high-value arbitration missions. Optional `day` controls how many days to show (default: 3). |
39
+ | `weekly` | | `周常`, `科研`, `时光科研`, `深层科研`, `执行官` | Query weekly missions (Archon Hunt, Deep Archimedea, Temporal Archimedea). |
40
+ | `circuit` | | `灵化之源`, `灵化` | Query weekly circuit rewards (warframes and incarnon adapters). |
41
41
 
42
42
  ### Open World Cycles
43
43
 
44
- | Command | Arguments | Aliases | Description |
45
- | ------- | --------- | ------- | ----------- |
46
- | `environment` | | `env`, `平原`, `地球`, `金星`, `夜灵`, `夜灵平野`, `奥布山谷` | Query current open world cycles (Earth, Venus, Deimos, Duviri, Zariman). |
44
+ | Command | Arguments | Aliases | Description |
45
+ | ------------- | --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------ |
46
+ | `environment` | | `env`, `平原`, `地球`, `金星`, `夜灵`, `夜灵平野`, `奥布山谷` | Query current open world cycles (Earth, Venus, Deimos, Duviri, Zariman). |
47
47
 
48
48
  ### Void Trader
49
49
 
50
- | Command | Arguments | Aliases | Description |
51
- | ------- | --------- | ------- | ----------- |
52
- | `voidtrader` | | `虚空商人`, `奸商` | Query Baro Ki'Teer's current inventory and arrival/departure countdown. |
50
+ | Command | Arguments | Aliases | Description |
51
+ | ------------ | --------- | ------------------ | ----------------------------------------------------------------------- |
52
+ | `voidtrader` | | `虚空商人`, `奸商` | Query Baro Ki'Teer's current inventory and arrival/departure countdown. |
53
53
 
54
54
  ### Riven Mods
55
55
 
56
- | Command | Arguments | Aliases | Description |
57
- | ------- | --------- | ------- | ----------- |
58
- | `riven` | `<img:image>` | | Analyze riven stats from a screenshot using OCR. |
56
+ | Command | Arguments | Aliases | Description |
57
+ | ----------- | ------------------------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
+ | `riven` | `<img:image>` | | Analyze riven stats from a screenshot using OCR. |
59
59
  | `rivenstat` | `<weaponType:string> <statType:string> <disposition:number>` | `紫卡数值` | Query riven stat ranges by weapon type, stat type, and disposition.<br>Weapon types: 步枪(rifle), 手枪(pistol), 霰弹枪(shotgun), 近战(melee), Archwing枪械(archgun)<br>Stat types: 2, 3, 21, 31 |
60
60
 
61
61
  ### Kuva/Tenet/Coda (In Development)
62
62
 
63
63
  The following commands are reserved but not yet implemented:
64
64
 
65
- | Command | Arguments | Aliases | Description |
66
- | ------- | --------- | ------- | ----------- |
67
- | `lichc` | | | Kuva weapons (hidden, in development) |
68
- | `lichi` | | | Infested/Coda weapons (hidden, in development) |
65
+ | Command | Arguments | Aliases | Description |
66
+ | ------- | --------- | ------- | ---------------------------------------------- |
67
+ | `lichc` | | | Kuva weapons (hidden, in development) |
68
+ | `lichi` | | | Infested/Coda weapons (hidden, in development) |
69
69
 
70
70
  ## Install
71
71
 
72
72
  Search `koishi-plugin-warframe` in Koishi dependency manager (not plugin market) and install.
73
73
 
74
- It is recommended to set the npm registry to `https://registry.npmjs.com` before installing, because the dependency `warframe-public-export-plus` is unavailable on some mirrors.
74
+ It is recommended to set the npm registry to `https://registry.npmjs.com` before installing, because the dependency `warframe-public-export-plus` is unavailable on some mirrors.
75
+
76
+ ## Develop
77
+
78
+ ### Step 1: Setup koishi development environment
79
+
80
+ ```bash
81
+ # Install package manager
82
+ npm i -g yarn
83
+
84
+ # Create koishi project
85
+ yarn create koishi
86
+ ```
87
+
88
+ Follow the prompts and finalize the initialization process.
89
+
90
+ ### Step 2: Clone repository
91
+
92
+ ```bash
93
+ # Run the following in koishi root path
94
+ yarn clone CloudeaSoft/koishi-plugin-warframe
95
+ ```
96
+
97
+ The plugin source code is created in `./external/warframe`.
98
+
99
+ ### Step 3: Install dependencies
100
+
101
+ ```bash
102
+ yarn install
103
+ ```
104
+
105
+ ### Step 4: Setup typescript version (optional)
106
+
107
+ This step disables the typescript warning in `tsconfig.json` caused by ^6.x typescript.
108
+
109
+ Open any `.ts` file in this project. Select the language bar Status Bar item (`{ }`), and then click `Select Version`. A message box will appear asking you which version of TypeScript VS Code should use, where you choose `Use Workspace Version` to use the correct version.
110
+
111
+ For more details, see [TypeScript documentation](https://code.visualstudio.com/docs/typescript/typescript-transpiling#_using-newer-typescript-versions).
package/lib/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import 'reflect-metadata';
2
- import { IRegion, TMissionType } from 'warframe-public-export-plus';
3
- import Puppeteer from 'koishi-plugin-puppeteer';
4
- import { Element, Argv, Dict, Context, Schema } from 'koishi';
2
+ import { Logger, Element, Argv, Dict, Context, Schema } from 'koishi';
5
3
  import WorldState from 'warframe-worldstate-parser';
4
+ import { IRegion, TMissionType } from 'warframe-public-export-plus';
6
5
  import { RivenWeaponDisposition, RivenStatFixFactorMap } from '../../types/wf/riven';
7
6
  import { RivenStatAnalyzeResult, RivenStatResult } from '../types/wf/riven';
7
+ import Puppeteer from 'koishi-plugin-puppeteer';
8
8
  import Element from '@satorijs/element';
9
9
  import { RivenWeaponItem } from '../../types/miscs/lab';
10
10
  import { RivenWeaponItem } from '../types/miscs/lab';
11
+ export const logger: Logger;
11
12
  export const toTimeStamp: (timeStr: string) => number;
12
13
  /**
13
14
  * 毫秒转「X小时X分钟X秒」格式(0单位不显示)
@@ -56,9 +57,10 @@ export const pascalToSpaced: (text: string) => string;
56
57
  export const toPascalCase: (text: string) => string;
57
58
  export function normalSimilarity(a: string, b: string): number;
58
59
  export function tokenSimilarity(a: string, b: string): number;
59
- export const fetchAsyncText: (url: string, method?: string) => Promise<string | undefined>;
60
- export const fetchAsyncData: <T>(url: string, method?: string) => Promise<T | undefined>;
61
- export const fetchAsyncImage: (url: string, method?: string) => Promise<Blob | undefined>;
60
+ type HttpMethod = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD";
61
+ export const fetchAsyncText: (url: string, method?: HttpMethod) => Promise<string>;
62
+ export const fetchAsyncData: <T>(url: string, method?: HttpMethod) => Promise<T>;
63
+ export const fetchAsyncImage: (url: string, method?: HttpMethod) => Promise<Blob>;
62
64
  export const listToDict: <T>(dict: T[], predict: (obj: T) => string[]) => Record<string, T>;
63
65
  export const listToDictSpec: <TObj, TValue>(dict: TObj[], predict: (obj: TObj) => string[], value: (obj: TObj) => TValue) => Record<string, TValue>;
64
66
  export const dictToKeyDict: <T>(dict: Record<string, T>, predict: (obj: T) => string[]) => Record<string, string>;
@@ -69,54 +71,6 @@ export const hexToRgb: (hex: string) => {
69
71
  b: number;
70
72
  };
71
73
  export const rgbToHex: (r: number, g: number, b: number) => string;
72
- export const regionToShort: (region: IRegion, dict: any) => {
73
- name: any;
74
- system: any;
75
- type: any;
76
- faction: any;
77
- maxLevel: number;
78
- minLevel: number;
79
- };
80
- export const relicQualityToName: (quality: string) => RelicQuality;
81
- /** transform relic quality to translation key, return original if not matched.
82
- *
83
- * eg. "VPQ_BRONZE" => "/Lotus/Language/Relics/VoidProjectionQuality_Bronze".
84
- * @param quality directly provided from `IRelic.quality` expected to start with "VPQ_".
85
- */
86
- export const relicQualityToTransKey: (quality: string) => string;
87
- /** transform relic era to translation key.
88
- *
89
- * eg. "Lith" => "/Lotus/Language/Relics/Era_LITH".
90
- * @param era directly provided from `IRelic.era`.
91
- */
92
- export const relicEraToTransKey: (era: string) => string;
93
- export const fixRelicRewardKey: (item: string) => string;
94
- export const relicToFullNameZH: (tier: string, category: string) => string;
95
- export const extractTextFromImage: (image: string | Blob, secret: OcrAPISecret) => Promise<string[] | undefined>;
96
- export const generateImageOutput: (puppe: Puppeteer, element: Element) => Promise<string>;
97
- export const getSolNodeKey: (name: string) => Promise<string>;
98
- export const getMissionTypeKey: (name: string) => Promise<TMissionType>;
99
- export const fissureTierName: {
100
- 1: string;
101
- 2: string;
102
- 3: string;
103
- 4: string;
104
- 5: string;
105
- 6: string;
106
- 7: string;
107
- };
108
- export const fissureTierNumToNumber: (a: number | string) => number;
109
- export const getVoidTraderItem: (i: {
110
- item: string;
111
- uniqueName: string;
112
- ducats: number;
113
- credits: number;
114
- }) => {
115
- name: string;
116
- ducats: number;
117
- credits: number;
118
- };
119
- export * from "utils/output";
120
74
  export interface Ducatnator {
121
75
  datetime: Date;
122
76
  position_change_month: number;
@@ -211,6 +165,7 @@ declare interface ClosedStatisticsEntry {
211
165
  donch_top: number;
212
166
  donch_bot: number;
213
167
  id: string;
168
+ mod_rank: number;
214
169
  }
215
170
  declare interface LiveStatisticsEntry {
216
171
  datetime: string;
@@ -223,6 +178,7 @@ declare interface LiveStatisticsEntry {
223
178
  order_type: "buy" | "sell";
224
179
  moving_avg: number;
225
180
  id: string;
181
+ mod_rank: number;
226
182
  }
227
183
  export interface StatisticsCollection {
228
184
  statistics_closed: {
@@ -448,6 +404,7 @@ declare interface ClosedStatisticsEntryDTO {
448
404
  donch_top: number;
449
405
  donch_bot: number;
450
406
  id: string;
407
+ mod_rank: number;
451
408
  }
452
409
  declare interface LiveStatisticsEntryDTO {
453
410
  datetime: string;
@@ -460,6 +417,7 @@ declare interface LiveStatisticsEntryDTO {
460
417
  order_type: "buy" | "sell";
461
418
  moving_avg: number;
462
419
  id: string;
420
+ mod_rank: number;
463
421
  }
464
422
  export interface StatisticsCollectionDTO {
465
423
  statistics_closed: {
@@ -666,6 +624,51 @@ declare const _default: {
666
624
  SolNode42: number;
667
625
  ClanNode24: number;
668
626
  };
627
+ export const extractTextFromImage: (image: string | Blob, secret: OcrAPISecret) => Promise<string[] | undefined>;
628
+ export const regionToShort: (region: IRegion, dict: any) => {
629
+ name: any;
630
+ system: any;
631
+ type: any;
632
+ faction: any;
633
+ maxLevel: number;
634
+ minLevel: number;
635
+ };
636
+ export const relicQualityToName: (quality: string) => RelicQuality;
637
+ /** transform relic quality to translation key, return original if not matched.
638
+ *
639
+ * eg. "VPQ_BRONZE" => "/Lotus/Language/Relics/VoidProjectionQuality_Bronze".
640
+ * @param quality directly provided from `IRelic.quality` expected to start with "VPQ_".
641
+ */
642
+ export const relicQualityToTransKey: (quality: string) => string;
643
+ /** transform relic era to translation key.
644
+ *
645
+ * eg. "Lith" => "/Lotus/Language/Relics/Era_LITH".
646
+ * @param era directly provided from `IRelic.era`.
647
+ */
648
+ export const relicEraToTransKey: (era: string) => string;
649
+ export const fixRelicRewardKey: (item: string) => string;
650
+ export const getSolNodeKey: (name: string) => Promise<string>;
651
+ export const getMissionTypeKey: (name: string) => Promise<TMissionType>;
652
+ export const fissureTierName: {
653
+ 1: string;
654
+ 2: string;
655
+ 3: string;
656
+ 4: string;
657
+ 5: string;
658
+ 6: string;
659
+ 7: string;
660
+ };
661
+ export const fissureTierNumToNumber: (a: number | string) => number;
662
+ export const getVoidTraderItem: (i: {
663
+ item: string;
664
+ uniqueName: string;
665
+ ducats: number;
666
+ credits: number;
667
+ }) => {
668
+ name: string;
669
+ ducats: number;
670
+ credits: number;
671
+ };
669
672
  export const relics: Record<string, Relic>;
670
673
  export const globalWorldState: AsyncCache<{
671
674
  raw: import("warframe-worldstate-parser").WorldState;
@@ -715,6 +718,7 @@ export const analyzeRivenStat: (parseResult: {
715
718
  prefix: string;
716
719
  }[];
717
720
  }) => RivenStatAnalyzeResult | string;
721
+ export const generateImageOutput: (puppe: Puppeteer, element: Element) => Promise<string>;
718
722
  export const ArbitrationComponent: (arbi: Arbitration[]) => Element;
719
723
  export const CircuitComponent: (currentIncarnons: number, currentWarframes: number, allIncarnons: string[][], allWarframes: string[][]) => Element;
720
724
  export const FissureComponent: (fissures: Fissure[], type: "fissure" | "sp-fissure" | "rj-fissure") => Element;