koishi-plugin-warframe 1.6.2 → 1.6.4

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,28 +8,28 @@ 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-name:text>` | | Query Warframe Market item orders (medians, ducat values, etc.) Displayed as an image. |
14
+ | `wm` | `<item-name:text>` | | **Deprecated**, use `wmi` instead. |
15
+ | `wmr` | `<item-name:text>` | | Query Warframe Market riven orders. |
16
+ | `wmu` | | | Update Warframe Market cache. |
17
+ | `pmod-history` | | `pmodhistory`, `pmod`, `P卡`, `p卡`, `P卡历史`, `p卡历史` | Query Primed MOD price history. |
18
+ | `riven-hot` | | `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
+ | `fissure-sp` | | `spfissure`, `钢铁裂缝`, `钢铁裂隙` | List current steel path fissure missions. |
26
+ | `fissure-rj` | | `rjfissure`, `九重天裂缝`, `九重天裂隙` | List current railjack fissure missions. |
27
27
 
28
28
  ### Relics
29
29
 
30
- | Command | Arguments | Aliases | Description |
31
- | ------- | -------------- | -------------- | ---------------------------------------------------------------------------- |
32
- | `relic` | `<relic:text>` | `遗物`, `核桃` | Query relic contents with drop chances, WFM median prices, and ducat values. |
30
+ | Command | Arguments | Aliases | Description |
31
+ | ------- | ------------------ | -------------- | ---------------------------------------------------------------------------- |
32
+ | `relic` | `<relic-name:text>` | `遗物`, `核桃` | Query relic contents with drop chances, WFM median prices, and ducat values. |
33
33
 
34
34
  ### Weekly & Activities
35
35
 
@@ -47,25 +47,26 @@ Toolkit for Warframe. Provides Warframe Market prices, fissures, arbitrations, r
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
+ | `void-trader` | | `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. |
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 |
56
+ | Command | Arguments | Aliases | Description |
57
+ | -------------- | ------------------------------------------------------------ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
58
+ | `riven` | `<img:image>` | | Analyze riven stats from a screenshot using OCR. |
59
+ | `riven-weekly` | `[minPrice:number]` | `weeklyriven`, `周紫卡`, `周卡` | Query weekly high-value riven reference (unrolled median prices). |
60
+ | `riven-stat` | `<weaponType:string> <statType:string> <disposition:number>` | `rivenstat`, `紫卡数值` | 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
 
61
62
  ### Kuva/Tenet/Coda (In Development)
62
63
 
63
64
  The following commands are reserved but not yet implemented:
64
65
 
65
- | Command | Arguments | Aliases | Description |
66
- | ------- | --------- | ------- | ---------------------------------------------- |
67
- | `lichc` | | | Kuva weapons (hidden, in development) |
68
- | `lichi` | | | Infested/Coda weapons (hidden, in development) |
66
+ | Command | Arguments | Aliases | Description |
67
+ | -------- | --------- | ------- | ---------------------------------------------- |
68
+ | `lich-c` | | `lichc` | Kuva weapons (hidden, in development) |
69
+ | `lich-i` | | `lichi` | Infested/Coda weapons (hidden, in development) |
69
70
 
70
71
  ## Install
71
72
 
@@ -0,0 +1,67 @@
1
+ {
2
+ "Volt": ["电", "电男", "伏特"],
3
+ "Trinity": ["奶妈", "奶", "三位一体"],
4
+ "Rhino": ["犀牛", "牛", "牛牛"],
5
+ "Mag": ["磁妹", "磁力", "磁"],
6
+ "Loki": ["洛基"],
7
+ "Excalibur": ["咖喱棒", "圣剑", "咖喱"],
8
+ "Ember": ["火鸡", "火"],
9
+ "Ash": ["灰烬", "灰烬之刃", "轮椅", "轮椅哥"],
10
+ "Nyx": ["脑溢血"],
11
+ "Frost": ["冰男", "冰雪寒霜", "冰队", "冰"],
12
+ "Saryn": ["毒妈", "毒"],
13
+ "Banshee": ["女妖", "女高音", "音妈"],
14
+ "Vauban": ["工程"],
15
+ "Nova": ["诺娃", "加速", "加速娃", "娃"],
16
+ "Nekros": ["摸尸", "摸"],
17
+ "Valkyr": ["瓦尔基里", "瓦喵", "瓦"],
18
+ "Oberon": ["奶爸", "龙王", "奥伯龙", "驴"],
19
+ "Zephyr": ["鸟姐", "鸟"],
20
+ "Hydroid": ["水男"],
21
+ "Mirage": ["小丑", "丑"],
22
+ "Limbo": ["小明", "李明博", "明", "明神", "区"],
23
+ "Mesa": ["女枪", "弥撒", "圣枪弥撒"],
24
+ "Chroma": ["龙甲", "龙"],
25
+ "Equinox": ["阴阳", "双子", "扶她", "futa"],
26
+ "Atlas": ["土石魔像", "土"],
27
+ "Wukong": ["猴子", "齐天大圣", "悟空", "猴"],
28
+ "Ivara": ["弓妹", "弓"],
29
+ "Nezha": ["哪吒", "三太子"],
30
+ "Inaros": ["沙"],
31
+ "Titania": ["蝶妹"],
32
+ "Nidus": ["蛆甲", "蛆"],
33
+ "Octavia": ["DJ", "音乐"],
34
+ "Harrow": ["主教"],
35
+ "Gara": ["玻璃"],
36
+ "Khora": ["猫", "荒野猎手"],
37
+ "Revenant": ["夜灵", "大运"],
38
+ "Garuda": ["血妈", "血"],
39
+ "Baruuk": ["武僧"],
40
+ "Hildryn": ["母牛"],
41
+ "Wisp": ["花", "修女"],
42
+ "Gauss": ["高斯", "拍手"],
43
+ "Grendel": ["肥宅", "肥仔"],
44
+ "Protea": ["茶", "茶妹"],
45
+ "Xaku": ["骨", "虚空"],
46
+ "Lavos": ["炼金", "药水", "药水哥", "蛇"],
47
+ "Sevagoth": ["鬼", "鲨鱼"],
48
+ "Yareli": ["水妹", "鸭梨", "水母"],
49
+ "Caliban": ["卡利班"],
50
+ "Gyre": ["电妹"],
51
+ "Styanax": ["斯巴达"],
52
+ "Voruna": ["狼", "狼妹"],
53
+ "Citrine": ["水晶", "宝石"],
54
+ "Kullervo": ["刀哥", "刀"],
55
+ "Dagath": ["马", "赛马娘", "马娘"],
56
+ "Qorvex": ["暖气片"],
57
+ "Dante": ["但丁"],
58
+ "Jade": ["翡翠", "天使"],
59
+ "Koumei": ["小梅", "梅"],
60
+ "Cyte-09": ["Cyte09", "老九", "9", "九", "牢九"],
61
+ "Temple": ["吉他"],
62
+ "Oraxia": ["蜘蛛"],
63
+ "Nokko": ["蘑菇"],
64
+ "Uriel": ["恶魔"],
65
+ "Follie": ["墨水", "肥婆"],
66
+ "Sirius & Orion": []
67
+ }
package/lib/index.d.ts CHANGED
@@ -4,13 +4,52 @@ declare module "components/miscs" {
4
4
  export function HotRivenComponent(data: RivenWeaponItem[]): Element;
5
5
  }
6
6
  declare module "types/result" {
7
+ import type { MessageKey, MessageParams } from "messages";
8
+ export interface ServiceFailure {
9
+ ok: false;
10
+ message: MessageKey;
11
+ params?: MessageParams;
12
+ }
7
13
  export type ServiceResult<TData> = {
8
14
  ok: true;
9
15
  data: TData;
10
- } | {
11
- ok: false;
12
- message: string;
16
+ } | ServiceFailure;
17
+ }
18
+ declare module "messages" {
19
+ import type { ServiceFailure } from "types/result";
20
+ export const messages: {
21
+ readonly 'common.fetchFailed': "内部错误,获取最新信息失败";
22
+ readonly 'relic.invalidName': "请提供正确的遗物名称";
23
+ readonly 'relic.dataLoading': "遗物数据未加载完成,请稍后再试";
24
+ readonly 'relic.notFound': "未找到对应遗物信息";
25
+ readonly 'arbitration.invalidDayRange': "天数需小于等于14且大于0";
26
+ readonly 'voidTrader.drifting': "虚空商人仍在未知地带漂流...";
27
+ readonly 'voidTrader.arriving': "距离虚空商人到达还有: {time}";
28
+ readonly 'riven.imageNotFound': "未检测到图片";
29
+ readonly 'riven.ocrNotConfigured': "未配置 OCR,请在插件设置中配置。";
30
+ readonly 'riven.imageFetchFailed': "获取图片失败";
31
+ readonly 'riven.imageParseFailed': "解析图片失败";
32
+ readonly 'riven.weaponNotFound': "未找到武器: {weapon}";
33
+ readonly 'riven.dispositionError': "裂罅倾向错误";
34
+ readonly 'riven.weaponTypeError': "武器类型错误";
35
+ readonly 'riven.statTypeError': "词条类型错误";
36
+ readonly 'riven.invalidParams': "请输入正确参数";
37
+ readonly 'riven.noWeeklyData': "没有找到符合条件的紫卡参考数据";
38
+ readonly 'wfm.inputItemName': "请输入物品名称";
39
+ readonly 'wfm.itemNotFound': "未找到物品: {input}";
40
+ readonly 'wfm.orderFetchFailed': "订单获取失败,请稍后重试";
41
+ readonly 'wfm.noOnlineSeller': "当前没有在线游戏中的卖家";
42
+ readonly 'wfm.rivenWeaponNotFound': "未找到紫卡武器: {input}";
43
+ readonly 'wfm.rivenOrderFetchFailed': "紫卡订单获取失败,请稍后重试";
44
+ readonly 'wfm.noOnlineRivenSeller': "当前没有在线出售的紫卡";
45
+ readonly 'miscs.hotRiven.noData': "暂无热门紫卡数据";
46
+ readonly 'miscs.hotRiven.fetchFailed': "获取热门紫卡数据失败";
47
+ readonly 'miscs.inDevelopment': "功能暂未开放";
13
48
  };
49
+ export type MessageKey = keyof typeof messages;
50
+ export type MessageParams = Record<string, string | number>;
51
+ export function t(message: MessageKey, params?: MessageParams): string;
52
+ export function t(result: ServiceFailure): string;
14
53
  }
15
54
  declare module "utils/assets" {
16
55
  export function loadAssetJson<T>(path: string): T;
@@ -117,6 +156,7 @@ declare module "assets/index" {
117
156
  export const arbyRewards: ArbyRewards;
118
157
  export const Baro: string;
119
158
  export const BaroParsed: BaroParsedItem[];
159
+ export const warframeAlias: Record<string, string[]>;
120
160
  }
121
161
  declare module "data/wf/arbitrationSchedule" {
122
162
  export const arbitrationSchedule: ArbitrationShort[];
@@ -296,35 +336,87 @@ declare module "services/wf-service" {
296
336
  value: number;
297
337
  prefix: string;
298
338
  }[];
299
- }): RivenStatAnalyzeResult | string;
339
+ }): ServiceResult<RivenStatAnalyzeResult>;
300
340
  }
301
341
  declare module "data/wfm/globalDucatnator" {
302
342
  export const globalDucatnatorIDDict: AsyncCache<Record<string, import("wfm-api-client").Ducatnator> | undefined>;
303
343
  }
304
344
  declare module "data/wfm/globalItem" {
305
345
  import type { ItemShort } from '../../types/wfm';
346
+ export interface GlobalItemWordPrefixCandidate {
347
+ item: ItemShort;
348
+ normalizedName: string;
349
+ tokens: string[];
350
+ }
306
351
  export function globalItemDataFactory(response?: ItemShort[]): Promise<{
307
352
  globalItemList: ItemShort[];
308
353
  globalItemDict: Record<string, ItemShort>;
309
354
  globalItemNameToSlugDict: Record<string, string>;
310
355
  globalItemGameRefDict: Record<string, ItemShort>;
356
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
311
357
  }>;
312
358
  export let globalItemData: AsyncCache<{
313
359
  globalItemList: ItemShort[];
314
360
  globalItemDict: Record<string, ItemShort>;
315
361
  globalItemNameToSlugDict: Record<string, string>;
316
362
  globalItemGameRefDict: Record<string, ItemShort>;
363
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
317
364
  }>;
318
365
  export function overrideGlobalItemData(cache: AsyncCache<{
319
366
  globalItemList: ItemShort[];
320
367
  globalItemDict: Record<string, ItemShort>;
321
368
  globalItemNameToSlugDict: Record<string, string>;
322
369
  globalItemGameRefDict: Record<string, ItemShort>;
370
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
323
371
  }>): void;
324
372
  }
325
- declare module "services/wfm-service" {
373
+ declare module "services/wfm-service/wfm-service.item-matcher" {
374
+ import type { GlobalItemWordPrefixCandidate } from "data/wfm/globalItem";
375
+ import type { ItemShort } from '../../types/wfm';
376
+ interface WFMItemLookupData {
377
+ globalItemDict: Record<string, ItemShort>;
378
+ globalItemNameToSlugDict: Record<string, string>;
379
+ }
380
+ export const wfmItemMatcher: {
381
+ buildSuffixVariantCandidates: (input: string) => string[];
382
+ matchByShortHand: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
383
+ matchBySlugDict: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
384
+ matchBySuffixVariantLookup: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
385
+ matchByWordPrefixSequence: (input: string, lookup: WFMItemLookupData & {
386
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
387
+ }) => ItemShort | undefined;
388
+ removeNameSuffix: (input: string) => {
389
+ pure: string;
390
+ suffix: string;
391
+ };
392
+ splitWordPrefixTokens: (input: string) => string[];
393
+ shortHandProcess: (input: string, lookup: Pick<WFMItemLookupData, "globalItemDict" | "globalItemNameToSlugDict">) => ItemShort | undefined;
394
+ stringToWFMItem: (input: string) => Promise<ItemShort | undefined>;
395
+ transformByWarframeAlias: (input: string) => string | undefined;
396
+ normalizeWordPrefixName: (input: string) => string;
397
+ };
398
+ export const buildSuffixVariantCandidates: (input: string) => string[];
399
+ export const matchByShortHand: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
400
+ export const matchBySlugDict: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
401
+ export const matchBySuffixVariantLookup: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
402
+ export const matchByWordPrefixSequence: (input: string, lookup: WFMItemLookupData & {
403
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
404
+ }) => ItemShort | undefined;
405
+ export const normalizeWordPrefixName: (input: string) => string;
406
+ export const removeNameSuffix: (input: string) => {
407
+ pure: string;
408
+ suffix: string;
409
+ };
410
+ export const splitWordPrefixTokens: (input: string) => string[];
411
+ export const shortHandProcess: (input: string, lookup: Pick<WFMItemLookupData, "globalItemDict" | "globalItemNameToSlugDict">) => ItemShort | undefined;
412
+ export const stringToWFMItem: (input: string) => Promise<ItemShort | undefined>;
413
+ export const transformByWarframeAlias: (input: string) => string | undefined;
414
+ }
415
+ declare module "services/wfm-service/index" {
326
416
  import type { ServiceResult } from "types/result";
327
- import type { ItemShort, OrderWithUser, PrimedModHistoryItem, RivenItem, RivenOrderInternal } from '../types/wfm';
417
+ import type { ItemShort, OrderWithUser, PrimedModHistoryItem, RivenItem, RivenOrderInternal } from '../../types/wfm';
418
+ import { stringToWFMItem } from "services/wfm-service/wfm-service.item-matcher";
419
+ export { stringToWFMItem };
328
420
  export function updateCache(): Promise<string>;
329
421
  export function getItemOrders(input: string): Promise<ServiceResult<{
330
422
  item: ItemShort;
@@ -336,17 +428,18 @@ declare module "services/wfm-service" {
336
428
  }>>;
337
429
  export function applyRelicData(relic: Relic): Promise<OutputRelic>;
338
430
  export const primedModHistory: AsyncCache<PrimedModHistoryItem[]>;
339
- export function stringToWFMItem(input: string): Promise<ItemShort | undefined>;
340
431
  }
341
432
  declare module "services/index" {
342
433
  export * from "services/miscs-service";
343
434
  export * from "services/wf-service";
344
- export * from "services/wfm-service";
435
+ export * from "services/wfm-service/index";
345
436
  }
346
437
  declare module "commands/miscs" {
347
438
  import type { PluginDependencies } from '../types/config';
439
+ export function inDevelopment(): string;
348
440
  export function createMiscsCommands(deps: PluginDependencies): {
349
441
  hotRivenCommand: () => Promise<string>;
442
+ inDevelopment: () => string;
350
443
  };
351
444
  }
352
445
  declare module "components/wf" {