koishi-plugin-warframe 1.5.0 → 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 +100 -18
  2. package/lib/index.d.ts +55 -54
  3. package/lib/index.js +2785 -1640
  4. package/package.json +3 -5
package/README.md CHANGED
@@ -2,28 +2,110 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/koishi-plugin-warframe?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-warframe)
4
4
 
5
- Toolkit for warframe. **(In development)**
5
+ Toolkit for Warframe. Provides Warframe Market prices, fissures, arbitrations, relics, weekly missions, open world cycles, riven analysis, and more.
6
6
 
7
7
  ## Commands
8
8
 
9
- | Command Name | Default Alias | Description |
10
- | -------------------------------------------------------------------- | ---------------------- | ------------------------------------------------------------------------------------------- |
11
- | wmi \<name:string\> | | Warframe market orders. |
12
- | wmr \<name:string\> | | Warframe market orders. |
13
- | arbitration [day:number] | arbi, 仲裁, 仲裁表 | High-value arbitration schedule. The arg decide how long in days to display, defaults to 3. |
14
- | fissure | 裂缝, 裂隙 | Current fissures. |
15
- | spfissure | 钢铁裂缝, 钢铁裂隙 | Current steelpath fissures. |
16
- | rjfissure | 九重天裂缝, 九重天裂隙 | Current railjack fissures. |
17
- | circuit | 灵化, 灵化之源 | Weekly rewards of circuit, both warframe parts and incarnons. |
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) |
21
- | voidtrader | 虚空商人, 奸商 | Void trader info |
22
- | riven | | Analyze riven stats |
23
- | rivenstat \<weaponType:string\> \<statType:string\> \<disposition:number\> | 紫卡数值 | Get riven stat range |
9
+ ### Warframe Market
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. |
19
+
20
+ ### Fissures
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. |
27
+
28
+ ### Relics
29
+
30
+ | Command | Arguments | Aliases | Description |
31
+ | ------- | -------------- | -------------- | ---------------------------------------------------------------------------- |
32
+ | `relic` | `<relic:text>` | `遗物`, `核桃` | Query relic contents with drop chances, WFM median prices, and ducat values. |
33
+
34
+ ### Weekly & Activities
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). |
41
+
42
+ ### Open World Cycles
43
+
44
+ | Command | Arguments | Aliases | Description |
45
+ | ------------- | --------- | ------------------------------------------------------------- | ------------------------------------------------------------------------ |
46
+ | `environment` | | `env`, `平原`, `地球`, `金星`, `夜灵`, `夜灵平野`, `奥布山谷` | Query current open world cycles (Earth, Venus, Deimos, Duviri, Zariman). |
47
+
48
+ ### Void Trader
49
+
50
+ | Command | Arguments | Aliases | Description |
51
+ | ------------ | --------- | ------------------ | ----------------------------------------------------------------------- |
52
+ | `voidtrader` | | `虚空商人`, `奸商` | Query Baro Ki'Teer's current inventory and arrival/departure countdown. |
53
+
54
+ ### Riven Mods
55
+
56
+ | Command | Arguments | Aliases | Description |
57
+ | ----------- | ------------------------------------------------------------ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
+ | `riven` | `<img:image>` | | Analyze riven stats from a screenshot using OCR. |
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
+
61
+ ### Kuva/Tenet/Coda (In Development)
62
+
63
+ The following commands are reserved but not yet implemented:
64
+
65
+ | Command | Arguments | Aliases | Description |
66
+ | ------- | --------- | ------- | ---------------------------------------------- |
67
+ | `lichc` | | | Kuva weapons (hidden, in development) |
68
+ | `lichi` | | | Infested/Coda weapons (hidden, in development) |
24
69
 
25
70
  ## Install
26
71
 
27
- Search `koishi-plugin-warframe` in koishi dependency manager, not in plugin market.
72
+ Search `koishi-plugin-warframe` in Koishi dependency manager (not plugin market) and install.
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.
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.
28
110
 
29
- The npm source is suggested to be the `https://registry.npmjs.com` before installing, because the package `warframe-public-export-plus` is unavailable on some mirrors.
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,12 +1,14 @@
1
- import { IRegion, TMissionType } from 'warframe-public-export-plus';
2
- import Puppeteer from 'koishi-plugin-puppeteer';
3
- import { Element, Argv, Dict, Context, Schema } from 'koishi';
1
+ import 'reflect-metadata';
2
+ import { Logger, Element, Argv, Dict, Context, Schema } from 'koishi';
4
3
  import WorldState from 'warframe-worldstate-parser';
4
+ import { IRegion, TMissionType } from 'warframe-public-export-plus';
5
5
  import { RivenWeaponDisposition, RivenStatFixFactorMap } from '../../types/wf/riven';
6
6
  import { RivenStatAnalyzeResult, RivenStatResult } from '../types/wf/riven';
7
+ import Puppeteer from 'koishi-plugin-puppeteer';
7
8
  import Element from '@satorijs/element';
8
9
  import { RivenWeaponItem } from '../../types/miscs/lab';
9
10
  import { RivenWeaponItem } from '../types/miscs/lab';
11
+ export const logger: Logger;
10
12
  export const toTimeStamp: (timeStr: string) => number;
11
13
  /**
12
14
  * 毫秒转「X小时X分钟X秒」格式(0单位不显示)
@@ -55,9 +57,10 @@ export const pascalToSpaced: (text: string) => string;
55
57
  export const toPascalCase: (text: string) => string;
56
58
  export function normalSimilarity(a: string, b: string): number;
57
59
  export function tokenSimilarity(a: string, b: string): number;
58
- export const fetchAsyncText: (url: string, method?: string) => Promise<string | undefined>;
59
- export const fetchAsyncData: <T>(url: string, method?: string) => Promise<T | undefined>;
60
- 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>;
61
64
  export const listToDict: <T>(dict: T[], predict: (obj: T) => string[]) => Record<string, T>;
62
65
  export const listToDictSpec: <TObj, TValue>(dict: TObj[], predict: (obj: TObj) => string[], value: (obj: TObj) => TValue) => Record<string, TValue>;
63
66
  export const dictToKeyDict: <T>(dict: Record<string, T>, predict: (obj: T) => string[]) => Record<string, string>;
@@ -68,54 +71,6 @@ export const hexToRgb: (hex: string) => {
68
71
  b: number;
69
72
  };
70
73
  export const rgbToHex: (r: number, g: number, b: number) => string;
71
- export const regionToShort: (region: IRegion, dict: any) => {
72
- name: any;
73
- system: any;
74
- type: any;
75
- faction: any;
76
- maxLevel: number;
77
- minLevel: number;
78
- };
79
- export const relicQualityToName: (quality: string) => RelicQuality;
80
- /** transform relic quality to translation key, return original if not matched.
81
- *
82
- * eg. "VPQ_BRONZE" => "/Lotus/Language/Relics/VoidProjectionQuality_Bronze".
83
- * @param quality directly provided from `IRelic.quality` expected to start with "VPQ_".
84
- */
85
- export const relicQualityToTransKey: (quality: string) => string;
86
- /** transform relic era to translation key.
87
- *
88
- * eg. "Lith" => "/Lotus/Language/Relics/Era_LITH".
89
- * @param era directly provided from `IRelic.era`.
90
- */
91
- export const relicEraToTransKey: (era: string) => string;
92
- export const fixRelicRewardKey: (item: string) => string;
93
- export const relicToFullNameZH: (tier: string, category: string) => string;
94
- export const extractTextFromImage: (image: string | Blob, secret: OcrAPISecret) => Promise<string[] | undefined>;
95
- export const generateImageOutput: (puppe: Puppeteer, element: Element) => Promise<string>;
96
- export const getSolNodeKey: (name: string) => Promise<string>;
97
- export const getMissionTypeKey: (name: string) => Promise<TMissionType>;
98
- export const fissureTierName: {
99
- 1: string;
100
- 2: string;
101
- 3: string;
102
- 4: string;
103
- 5: string;
104
- 6: string;
105
- 7: string;
106
- };
107
- export const fissureTierNumToNumber: (a: number | string) => number;
108
- export const getVoidTraderItem: (i: {
109
- item: string;
110
- uniqueName: string;
111
- ducats: number;
112
- credits: number;
113
- }) => {
114
- name: string;
115
- ducats: number;
116
- credits: number;
117
- };
118
- export * from "utils/output";
119
74
  export interface Ducatnator {
120
75
  datetime: Date;
121
76
  position_change_month: number;
@@ -665,6 +620,51 @@ declare const _default: {
665
620
  SolNode42: number;
666
621
  ClanNode24: number;
667
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
+ };
668
668
  export const relics: Record<string, Relic>;
669
669
  export const globalWorldState: AsyncCache<{
670
670
  raw: import("warframe-worldstate-parser").WorldState;
@@ -714,6 +714,7 @@ export const analyzeRivenStat: (parseResult: {
714
714
  prefix: string;
715
715
  }[];
716
716
  }) => RivenStatAnalyzeResult | string;
717
+ export const generateImageOutput: (puppe: Puppeteer, element: Element) => Promise<string>;
717
718
  export const ArbitrationComponent: (arbi: Arbitration[]) => Element;
718
719
  export const CircuitComponent: (currentIncarnons: number, currentWarframes: number, allIncarnons: string[][], allWarframes: string[][]) => Element;
719
720
  export const FissureComponent: (fissures: Fissure[], type: "fissure" | "sp-fissure" | "rj-fissure") => Element;