koishi-plugin-warframe 1.6.3 → 1.6.5

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.
@@ -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[];
@@ -241,10 +281,23 @@ declare module "data/wfm/globalRivenAttribute" {
241
281
  }>): void;
242
282
  }
243
283
  declare module "data/wfm/globalRivenItem" {
284
+ import type { RivenItem } from '../../types/wfm';
285
+ export interface GlobalRivenItemWordPrefixCandidate {
286
+ item: RivenItem;
287
+ normalizedName: string;
288
+ tokens: string[];
289
+ }
290
+ export function globalRivenItemFactory(rivenData?: RivenItem[]): Promise<{
291
+ globalRivenItemList: RivenItem[];
292
+ globalRivenItemDict: Record<string, RivenItem>;
293
+ globalRivenItemNameToSlugDict: Record<string, string>;
294
+ globalRivenItemWordPrefixCandidates: GlobalRivenItemWordPrefixCandidate[];
295
+ }>;
244
296
  export const globalRivenItemData: AsyncCache<{
245
- globalRivenItemList: import("wfm-api-client").RivenItem[];
246
- globalRivenItemDict: Record<string, import("wfm-api-client").RivenItem>;
297
+ globalRivenItemList: RivenItem[];
298
+ globalRivenItemDict: Record<string, RivenItem>;
247
299
  globalRivenItemNameToSlugDict: Record<string, string>;
300
+ globalRivenItemWordPrefixCandidates: GlobalRivenItemWordPrefixCandidate[];
248
301
  }>;
249
302
  }
250
303
  declare module "infrastructure/ocr-api" {
@@ -296,35 +349,104 @@ declare module "services/wf-service" {
296
349
  value: number;
297
350
  prefix: string;
298
351
  }[];
299
- }): RivenStatAnalyzeResult | string;
352
+ }): ServiceResult<RivenStatAnalyzeResult>;
300
353
  }
301
354
  declare module "data/wfm/globalDucatnator" {
302
355
  export const globalDucatnatorIDDict: AsyncCache<Record<string, import("wfm-api-client").Ducatnator> | undefined>;
303
356
  }
304
357
  declare module "data/wfm/globalItem" {
305
358
  import type { ItemShort } from '../../types/wfm';
359
+ export interface GlobalItemWordPrefixCandidate {
360
+ item: ItemShort;
361
+ normalizedName: string;
362
+ tokens: string[];
363
+ }
306
364
  export function globalItemDataFactory(response?: ItemShort[]): Promise<{
307
365
  globalItemList: ItemShort[];
308
366
  globalItemDict: Record<string, ItemShort>;
309
367
  globalItemNameToSlugDict: Record<string, string>;
310
368
  globalItemGameRefDict: Record<string, ItemShort>;
369
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
311
370
  }>;
312
371
  export let globalItemData: AsyncCache<{
313
372
  globalItemList: ItemShort[];
314
373
  globalItemDict: Record<string, ItemShort>;
315
374
  globalItemNameToSlugDict: Record<string, string>;
316
375
  globalItemGameRefDict: Record<string, ItemShort>;
376
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
317
377
  }>;
318
378
  export function overrideGlobalItemData(cache: AsyncCache<{
319
379
  globalItemList: ItemShort[];
320
380
  globalItemDict: Record<string, ItemShort>;
321
381
  globalItemNameToSlugDict: Record<string, string>;
322
382
  globalItemGameRefDict: Record<string, ItemShort>;
383
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
323
384
  }>): void;
324
385
  }
325
- declare module "services/wfm-service" {
386
+ declare module "services/wfm-service/wfm-service.item-matcher" {
387
+ import type { GlobalItemWordPrefixCandidate } from "data/wfm/globalItem";
388
+ import type { ItemShort } from '../../types/wfm';
389
+ interface WFMItemLookupData {
390
+ globalItemDict: Record<string, ItemShort>;
391
+ globalItemNameToSlugDict: Record<string, string>;
392
+ }
393
+ export const wfmItemMatcher: {
394
+ buildSuffixVariantCandidates: (input: string) => string[];
395
+ matchByShortHand: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
396
+ matchBySlugDict: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
397
+ matchBySuffixVariantLookup: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
398
+ matchByWordPrefixSequence: (input: string, lookup: WFMItemLookupData & {
399
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
400
+ }) => ItemShort | undefined;
401
+ removeNameSuffix: (input: string) => {
402
+ pure: string;
403
+ suffix: string;
404
+ };
405
+ splitWordPrefixTokens: (input: string) => string[];
406
+ shortHandProcess: (input: string, lookup: Pick<WFMItemLookupData, "globalItemDict" | "globalItemNameToSlugDict">) => ItemShort | undefined;
407
+ stringToWFMItem: (input: string) => Promise<ItemShort | undefined>;
408
+ transformByWarframeAlias: (input: string) => string | undefined;
409
+ normalizeWordPrefixName: (input: string) => string;
410
+ };
411
+ export const buildSuffixVariantCandidates: (input: string) => string[];
412
+ export const matchByShortHand: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
413
+ export const matchBySlugDict: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
414
+ export const matchBySuffixVariantLookup: (input: string, lookup: WFMItemLookupData) => ItemShort | undefined;
415
+ export const matchByWordPrefixSequence: (input: string, lookup: WFMItemLookupData & {
416
+ globalItemWordPrefixCandidates: GlobalItemWordPrefixCandidate[];
417
+ }) => ItemShort | undefined;
418
+ export const normalizeWordPrefixName: (input: string) => string;
419
+ export const removeNameSuffix: (input: string) => {
420
+ pure: string;
421
+ suffix: string;
422
+ };
423
+ export const splitWordPrefixTokens: (input: string) => string[];
424
+ export const shortHandProcess: (input: string, lookup: Pick<WFMItemLookupData, "globalItemDict" | "globalItemNameToSlugDict">) => ItemShort | undefined;
425
+ export const stringToWFMItem: (input: string) => Promise<ItemShort | undefined>;
426
+ export const transformByWarframeAlias: (input: string) => string | undefined;
427
+ }
428
+ declare module "services/wfm-service/wfm-service.riven-item-matcher" {
429
+ import type { GlobalRivenItemWordPrefixCandidate } from "data/wfm/globalRivenItem";
430
+ import type { RivenItem } from '../../types/wfm';
431
+ interface WFMRivenItemLookupData {
432
+ globalRivenItemDict: Record<string, RivenItem>;
433
+ globalRivenItemNameToSlugDict: Record<string, string>;
434
+ globalRivenItemWordPrefixCandidates: GlobalRivenItemWordPrefixCandidate[];
435
+ }
436
+ export function normalizeWordPrefixName(input: string): string;
437
+ export function splitWordPrefixTokens(input: string): string[];
438
+ export function matchBySlugDict(input: string, lookup: Pick<WFMRivenItemLookupData, 'globalRivenItemDict' | 'globalRivenItemNameToSlugDict'>): RivenItem | undefined;
439
+ export function shortHandProcess(input: string, lookup: Pick<WFMRivenItemLookupData, 'globalRivenItemDict' | 'globalRivenItemNameToSlugDict'>): RivenItem | undefined;
440
+ export function matchByWordPrefixSequence(input: string, lookup: Pick<WFMRivenItemLookupData, 'globalRivenItemWordPrefixCandidates'>): RivenItem | undefined;
441
+ export function findRivenItemByName(input: string, globalRivenItemList?: RivenItem[]): Promise<RivenItem | undefined>;
442
+ export const matchByShortHand: typeof shortHandProcess;
443
+ export const stringToWFMItem: typeof findRivenItemByName;
444
+ }
445
+ declare module "services/wfm-service/index" {
326
446
  import type { ServiceResult } from "types/result";
327
- import type { ItemShort, OrderWithUser, PrimedModHistoryItem, RivenItem, RivenOrderInternal } from '../types/wfm';
447
+ import type { ItemShort, OrderWithUser, PrimedModHistoryItem, RivenItem, RivenOrderInternal } from '../../types/wfm';
448
+ import { stringToWFMItem } from "services/wfm-service/wfm-service.item-matcher";
449
+ export { stringToWFMItem };
328
450
  export function updateCache(): Promise<string>;
329
451
  export function getItemOrders(input: string): Promise<ServiceResult<{
330
452
  item: ItemShort;
@@ -336,17 +458,18 @@ declare module "services/wfm-service" {
336
458
  }>>;
337
459
  export function applyRelicData(relic: Relic): Promise<OutputRelic>;
338
460
  export const primedModHistory: AsyncCache<PrimedModHistoryItem[]>;
339
- export function stringToWFMItem(input: string): Promise<ItemShort | undefined>;
340
461
  }
341
462
  declare module "services/index" {
342
463
  export * from "services/miscs-service";
343
464
  export * from "services/wf-service";
344
- export * from "services/wfm-service";
465
+ export * from "services/wfm-service/index";
345
466
  }
346
467
  declare module "commands/miscs" {
347
468
  import type { PluginDependencies } from '../types/config';
469
+ export function inDevelopment(): string;
348
470
  export function createMiscsCommands(deps: PluginDependencies): {
349
471
  hotRivenCommand: () => Promise<string>;
472
+ inDevelopment: () => string;
350
473
  };
351
474
  }
352
475
  declare module "components/wf" {