koishi-plugin-warframe 1.5.1 → 1.5.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.
Files changed (4) hide show
  1. package/README.md +71 -34
  2. package/lib/index.d.ts +54 -54
  3. package/lib/index.js +1597 -1640
  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;
@@ -666,6 +620,51 @@ declare const _default: {
666
620
  SolNode42: number;
667
621
  ClanNode24: number;
668
622
  };
623
+ export const extractTextFromImage: (image: string | Blob, secret: OcrAPISecret) => Promise<string[] | undefined>;
624
+ export const regionToShort: (region: IRegion, dict: any) => {
625
+ name: any;
626
+ system: any;
627
+ type: any;
628
+ faction: any;
629
+ maxLevel: number;
630
+ minLevel: number;
631
+ };
632
+ export const relicQualityToName: (quality: string) => RelicQuality;
633
+ /** transform relic quality to translation key, return original if not matched.
634
+ *
635
+ * eg. "VPQ_BRONZE" => "/Lotus/Language/Relics/VoidProjectionQuality_Bronze".
636
+ * @param quality directly provided from `IRelic.quality` expected to start with "VPQ_".
637
+ */
638
+ export const relicQualityToTransKey: (quality: string) => string;
639
+ /** transform relic era to translation key.
640
+ *
641
+ * eg. "Lith" => "/Lotus/Language/Relics/Era_LITH".
642
+ * @param era directly provided from `IRelic.era`.
643
+ */
644
+ export const relicEraToTransKey: (era: string) => string;
645
+ export const fixRelicRewardKey: (item: string) => string;
646
+ export const getSolNodeKey: (name: string) => Promise<string>;
647
+ export const getMissionTypeKey: (name: string) => Promise<TMissionType>;
648
+ export const fissureTierName: {
649
+ 1: string;
650
+ 2: string;
651
+ 3: string;
652
+ 4: string;
653
+ 5: string;
654
+ 6: string;
655
+ 7: string;
656
+ };
657
+ export const fissureTierNumToNumber: (a: number | string) => number;
658
+ export const getVoidTraderItem: (i: {
659
+ item: string;
660
+ uniqueName: string;
661
+ ducats: number;
662
+ credits: number;
663
+ }) => {
664
+ name: string;
665
+ ducats: number;
666
+ credits: number;
667
+ };
669
668
  export const relics: Record<string, Relic>;
670
669
  export const globalWorldState: AsyncCache<{
671
670
  raw: import("warframe-worldstate-parser").WorldState;
@@ -715,6 +714,7 @@ export const analyzeRivenStat: (parseResult: {
715
714
  prefix: string;
716
715
  }[];
717
716
  }) => RivenStatAnalyzeResult | string;
717
+ export const generateImageOutput: (puppe: Puppeteer, element: Element) => Promise<string>;
718
718
  export const ArbitrationComponent: (arbi: Arbitration[]) => Element;
719
719
  export const CircuitComponent: (currentIncarnons: number, currentWarframes: number, allIncarnons: string[][], allWarframes: string[][]) => Element;
720
720
  export const FissureComponent: (fissures: Fissure[], type: "fissure" | "sp-fissure" | "rj-fissure") => Element;