koishi-plugin-warframe 1.15.1 → 1.16.1

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
@@ -58,9 +58,11 @@ Toolkit for Warframe. Provides Warframe Market prices, fissures, arbitrations, r
58
58
 
59
59
  | Command | Arguments | Aliases | Description |
60
60
  | -------------- | ------------------------------------------------------------ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
- | `riven` | `<img:image>` | | Analyze riven stats from a screenshot using OCR. |
61
+ | `riven` | `<img:image>` | | Analyze traditional and spliced riven stats from a screenshot using OCR. Kitguns require `-v primary` or `-v secondary`. |
62
62
  | `riven-weekly` | `[minPrice:number]` | `weeklyriven`, `周紫卡`, `周卡` | Query weekly high-value riven reference (unrolled median prices). |
63
- | `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 |
63
+ | `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), Kitgun(组合枪), Zaw(组合近战)<br>Stat types: 2, 3, 21, 31 |
64
+
65
+ Riven calculations use a bundled official Public Export snapshot. See [data sources and refresh instructions](docs/riven-data.md).
64
66
 
65
67
  ### Kuva/Tenet/Coda (In Development)
66
68
 
package/lib/index.d.ts CHANGED
@@ -34,7 +34,7 @@ declare module "warframe/types/ocr" {
34
34
  }
35
35
  }
36
36
  declare module "warframe/types/warframe-result" {
37
- export const warframeErrorCodes: readonly ["common.fetchFailed", "relic.invalidName", "relic.dataLoading", "relic.notFound", "arbitration.invalidDayRange", "bounty.unavailable", "invasion.unavailable", "alert.unavailable", "event.unavailable", "calendar.unavailable", "steelEssence.unavailable", "nightwave.unavailable", "sortie.unavailable", "voidTrader.drifting", "voidTrader.arriving", "riven.imageFetchFailed", "riven.imageParseFailed", "riven.weaponNotFound", "riven.dispositionError", "riven.weaponTypeError", "riven.statTypeError", "wfm.inputItemName", "wfm.itemNotFound", "wfm.itemAmbiguous", "wfm.orderFetchFailed", "wfm.noOnlineSeller", "wfm.rivenWeaponNotFound", "wfm.rivenOrderFetchFailed", "wfm.noOnlineRivenSeller", "miscs.hotRiven.noData", "miscs.hotRiven.fetchFailed"];
37
+ export const warframeErrorCodes: readonly ["common.fetchFailed", "relic.invalidName", "relic.dataLoading", "relic.notFound", "arbitration.invalidDayRange", "bounty.unavailable", "invasion.unavailable", "alert.unavailable", "event.unavailable", "calendar.unavailable", "steelEssence.unavailable", "nightwave.unavailable", "sortie.unavailable", "voidTrader.drifting", "voidTrader.arriving", "riven.imageFetchFailed", "riven.imageParseFailed", "riven.weaponNotFound", "riven.dispositionError", "riven.weaponTypeError", "riven.statTypeError", "riven.unverifiedStat", "riven.variantRequired", "riven.variantError", "wfm.inputItemName", "wfm.itemNotFound", "wfm.itemAmbiguous", "wfm.orderFetchFailed", "wfm.noOnlineSeller", "wfm.rivenWeaponNotFound", "wfm.rivenOrderFetchFailed", "wfm.noOnlineRivenSeller", "miscs.hotRiven.noData", "miscs.hotRiven.fetchFailed"];
38
38
  export type WarframeErrorCode = typeof warframeErrorCodes[number];
39
39
  export type WarframeErrorParams = Record<string, string | number>;
40
40
  export interface WarframeError {
@@ -472,10 +472,59 @@ declare module "warframe/types/wfm" {
472
472
  };
473
473
  };
474
474
  }
475
+ declare module "warframe/types/wf/riven-export" {
476
+ export interface RivenExportEntry {
477
+ tag: string;
478
+ prefixTag?: string;
479
+ suffixTag?: string;
480
+ upgradeValues: {
481
+ value: number;
482
+ locTag?: string;
483
+ reverseValueSymbol?: boolean;
484
+ }[];
485
+ }
486
+ export interface RivenExportDefinition {
487
+ uniqueName: string;
488
+ upgradeEntries: RivenExportEntry[];
489
+ }
490
+ export interface RivenExportWeapon {
491
+ uniqueName: string;
492
+ name: string;
493
+ productCategory: string;
494
+ omegaAttenuation: number;
495
+ primeOmegaAttenuation?: number;
496
+ slot?: number;
497
+ }
498
+ export interface RivenPublicExport {
499
+ schemaVersion: number;
500
+ downloadedAt: string;
501
+ sources: Record<string, {
502
+ url: string;
503
+ sha256: string;
504
+ bytes: number;
505
+ }>;
506
+ upgrades: RivenExportDefinition[];
507
+ upgradesZh: RivenExportDefinition[];
508
+ weapons: RivenExportWeapon[];
509
+ weaponNamesZh: Record<string, string>;
510
+ }
511
+ }
475
512
  declare module "warframe/types/wf/riven" {
476
- import type { IWeapon } from 'warframe-public-export-plus';
477
513
  import type { RivenAttributeUnit } from "warframe/types/wfm";
478
- export type RivenWeaponType = 'Rifle' | 'Shotgun' | 'Pistol' | 'Archgun' | 'Melee';
514
+ import type { RivenExportWeapon } from "warframe/types/wf/riven-export";
515
+ export type RivenWeaponType = 'Rifle' | 'Shotgun' | 'Pistol' | 'Archgun' | 'Melee' | 'Kitgun' | 'Zaw';
516
+ export interface RivenCalculationAttribute {
517
+ gameRef?: string;
518
+ unit?: RivenAttributeUnit;
519
+ i18n?: {
520
+ 'en'?: {
521
+ name?: string;
522
+ };
523
+ 'zh-hans'?: {
524
+ name?: string;
525
+ };
526
+ };
527
+ }
479
528
  export type RivenStatCountType = '31' | '2' | '21' | '3';
480
529
  export interface RivenStatFixFactor {
481
530
  buffFactor: number;
@@ -493,6 +542,7 @@ declare module "warframe/types/wf/riven" {
493
542
  min: number;
494
543
  }
495
544
  export interface RivenStatAnalyzeResult {
545
+ notes?: string[];
496
546
  name: string;
497
547
  disposition: number;
498
548
  buffs: RivenStatAnalyzsis[];
@@ -509,9 +559,10 @@ declare module "warframe/types/wf/riven" {
509
559
  texture: string;
510
560
  riventype: string;
511
561
  };
512
- weapon: IWeapon;
562
+ weapon: RivenExportWeapon;
513
563
  }
514
564
  export interface RivenStatResult {
565
+ notes?: string[];
515
566
  positive: Record<string, {
516
567
  name: string;
517
568
  max: number;
@@ -716,7 +767,7 @@ declare module "warframe/services/miscs-service" {
716
767
  export function getHotRivenWeapons(): Promise<WarframeResult<RivenWeaponItem[]>>;
717
768
  }
718
769
  declare module "warframe/assets/index" {
719
- import type { RivenWeaponDisposition } from "warframe/types/index";
770
+ import type { RivenPublicExport } from "warframe/types/wf/riven-export";
720
771
  export interface BaroParsedItem {
721
772
  name: string;
722
773
  last: string;
@@ -724,10 +775,7 @@ declare module "warframe/assets/index" {
724
775
  }
725
776
  export type ArbyRewards = Record<string, number>;
726
777
  export const incarnons: string[][], warframes: string[][];
727
- export const rivenAttrValues: Record<string, Record<string, number>>;
728
- export const rivenCalc: {
729
- weapons: RivenWeaponDisposition["calc"][];
730
- };
778
+ export const rivenPublicExport: RivenPublicExport;
731
779
  export const dictEnExtra: Record<string, string>;
732
780
  export const dictZhExtra: Record<string, string>;
733
781
  export const arbitrationScheduleText: string;
@@ -970,15 +1018,37 @@ declare module "warframe/services/wf-service/wf-service.relic" {
970
1018
  import type { Relic, WarframeResult } from "warframe/types/index";
971
1019
  export function getRelic(input: string): Promise<WarframeResult<Relic>>;
972
1020
  }
1021
+ declare module "warframe/infrastructure/wf/riven-export-adapter" {
1022
+ import type { RivenCalculationAttribute, RivenWeaponType } from "warframe/types/wf/riven";
1023
+ import type { RivenExportDefinition } from "warframe/types/wf/riven-export";
1024
+ import type { RivenAttributeUnit } from "warframe/types/wfm";
1025
+ export const rivenDefinitionTypes: Record<string, RivenWeaponType>;
1026
+ export interface RivenCalculationStat extends RivenCalculationAttribute {
1027
+ gameRef: string;
1028
+ key: string;
1029
+ name: string;
1030
+ englishName: string;
1031
+ baseValue: number;
1032
+ unit: RivenAttributeUnit;
1033
+ spliced: boolean;
1034
+ canBeBuff: boolean;
1035
+ canBeCurse: boolean;
1036
+ verified: boolean;
1037
+ aliases: string[];
1038
+ }
1039
+ export function cleanRivenTemplate(template: string): string | undefined;
1040
+ export function adaptRivenDefinitions(definitions: RivenExportDefinition[]): Record<string, RivenCalculationStat[]>;
1041
+ }
973
1042
  declare module "warframe/data/wf/rivenBaseValues" {
974
1043
  export type RivenAttrValueDict = Record<string, Record<string, number>>;
975
- export function buildRivenAttrValueDict(source: RivenAttrValueDict): RivenAttrValueDict;
1044
+ export const rivenStatsByType: Record<string, import("warframe/infrastructure/wf/riven-export-adapter").RivenCalculationStat[]>;
1045
+ export const rivenAttributes: import("warframe/infrastructure/wf/riven-export-adapter").RivenCalculationStat[];
976
1046
  export const rivenAttrValueDict: RivenAttrValueDict;
977
1047
  }
978
1048
  declare module "warframe/data/wf/rivenDisposition" {
979
- import type { IWeapon } from 'warframe-public-export-plus';
980
1049
  import type { RivenWeaponDisposition } from "warframe/types/index";
981
- export function buildWeaponRivenDispositionDict(calcWeapons: RivenWeaponDisposition['calc'][], exportWeapons: Record<string, IWeapon>, dictEn: Record<string, string>, dictZh: Record<string, string>): Record<string, RivenWeaponDisposition>;
1050
+ import type { RivenExportWeapon } from "warframe/types/wf/riven-export";
1051
+ export function buildWeaponRivenDispositionDict(weapons: RivenExportWeapon[], namesZh: Record<string, string>, types: Record<string, string>): Record<string, RivenWeaponDisposition>;
982
1052
  export const weaponRivenDispositionDict: Record<string, RivenWeaponDisposition>;
983
1053
  }
984
1054
  declare module "warframe/data/wf/rivenStatData" {
@@ -1074,23 +1144,6 @@ declare module "warframe/infrastructure/wfm-client" {
1074
1144
  setAccessToken: (token: string | undefined) => void;
1075
1145
  };
1076
1146
  }
1077
- declare module "warframe/data/wfm/globalRivenAttribute" {
1078
- import type { AsyncCache, RivenAttribute } from "warframe/types/index";
1079
- export function globalRivenAttributeFactory(rivenAttributeData?: RivenAttribute[]): Promise<{
1080
- globalRivenAttributeList: RivenAttribute[];
1081
- globalRivenAttributeDict: Record<string, RivenAttribute>;
1082
- }>;
1083
- export let globalRivenAttribute: AsyncCache<{
1084
- globalRivenAttributeList: RivenAttribute[];
1085
- globalRivenAttributeDict: Record<string, RivenAttribute>;
1086
- }>;
1087
- export function overrideGlobalRivenAttribute(cache: AsyncCache<{
1088
- globalRivenAttributeList: RivenAttribute[];
1089
- globalRivenAttributeDict: {
1090
- [key: string]: RivenAttribute;
1091
- };
1092
- }>): void;
1093
- }
1094
1147
  declare module "warframe/data/wfm/globalRivenItem" {
1095
1148
  import type { AsyncCache, RivenItem } from "warframe/types/index";
1096
1149
  export interface GlobalRivenItemWordPrefixCandidate {
@@ -1123,9 +1176,10 @@ declare module "warframe/infrastructure/ocr-api" {
1123
1176
  }
1124
1177
  declare module "warframe/services/wf-service/wf-service.riven" {
1125
1178
  import type { WeeklyRiven } from 'warframe-weekly-rivens';
1126
- import type { OcrAPISecret, RivenAttribute, RivenStatAnalyzeResult, RivenStatResult, WarframeResult } from "warframe/types/index";
1179
+ import type { OcrAPISecret, RivenStatAnalyzeResult, RivenStatResult, WarframeResult } from "warframe/types/index";
1180
+ import type { RivenCalculationAttribute } from "warframe/types/wf/riven";
1127
1181
  import { weaponRivenDispositionDict } from "warframe/data/wf/rivenDisposition";
1128
- export function getAnalyzedRiven(secret: OcrAPISecret, url: string): Promise<WarframeResult<RivenStatAnalyzeResult>>;
1182
+ export function getAnalyzedRiven(secret: OcrAPISecret, url: string, variant?: string): Promise<WarframeResult<RivenStatAnalyzeResult>>;
1129
1183
  export function filterWeeklyRivens(data: WeeklyRiven[], minPrice: number, minPop?: number): WeeklyRiven[];
1130
1184
  export function getWeeklyRivens(minPrice: number): Promise<WeeklyRiven[]>;
1131
1185
  export function getStaticRivenStats(weaponType: string, statType: string, disposition: number): Promise<WarframeResult<RivenStatResult>>;
@@ -1133,7 +1187,7 @@ declare module "warframe/services/wf-service/wf-service.riven" {
1133
1187
  export function parseOCRResult(ocrResult: string[]): Promise<{
1134
1188
  name: string;
1135
1189
  attributes: {
1136
- attr: RivenAttribute;
1190
+ attr: RivenCalculationAttribute;
1137
1191
  value: number;
1138
1192
  prefix: string;
1139
1193
  }[];
@@ -1141,11 +1195,11 @@ declare module "warframe/services/wf-service/wf-service.riven" {
1141
1195
  export function analyzeRivenStat(parseResult: {
1142
1196
  name: string;
1143
1197
  attributes: {
1144
- attr: RivenAttribute;
1198
+ attr: RivenCalculationAttribute;
1145
1199
  value: number;
1146
1200
  prefix: string;
1147
1201
  }[];
1148
- }): WarframeResult<RivenStatAnalyzeResult>;
1202
+ }, variant?: string): WarframeResult<RivenStatAnalyzeResult>;
1149
1203
  }
1150
1204
  declare module "warframe/data/wf/sortie" {
1151
1205
  export function getSortieModeName(): string;
@@ -1311,6 +1365,23 @@ declare module "warframe/data/wfm/globalDucatnator" {
1311
1365
  export let globalDucatnatorIDDict: AsyncCache<Record<string, Ducatnator> | undefined>;
1312
1366
  export function overrideGlobalDucatnatorIDDict(cache: AsyncCache<Record<string, Ducatnator> | undefined>): void;
1313
1367
  }
1368
+ declare module "warframe/data/wfm/globalRivenAttribute" {
1369
+ import type { AsyncCache, RivenAttribute } from "warframe/types/index";
1370
+ export function globalRivenAttributeFactory(rivenAttributeData?: RivenAttribute[]): Promise<{
1371
+ globalRivenAttributeList: RivenAttribute[];
1372
+ globalRivenAttributeDict: Record<string, RivenAttribute>;
1373
+ }>;
1374
+ export let globalRivenAttribute: AsyncCache<{
1375
+ globalRivenAttributeList: RivenAttribute[];
1376
+ globalRivenAttributeDict: Record<string, RivenAttribute>;
1377
+ }>;
1378
+ export function overrideGlobalRivenAttribute(cache: AsyncCache<{
1379
+ globalRivenAttributeList: RivenAttribute[];
1380
+ globalRivenAttributeDict: {
1381
+ [key: string]: RivenAttribute;
1382
+ };
1383
+ }>): void;
1384
+ }
1314
1385
  declare module "warframe/services/wfm-service/wfm-service.riven-item-matcher" {
1315
1386
  import type { GlobalRivenItemWordPrefixCandidate } from "warframe/data/wfm/globalRivenItem";
1316
1387
  import type { RivenItem } from "warframe/types/index";
@@ -1433,6 +1504,9 @@ declare module "i18n" {
1433
1504
  readonly 'riven.dispositionError': "裂罅倾向错误";
1434
1505
  readonly 'riven.weaponTypeError': "武器类型错误";
1435
1506
  readonly 'riven.statTypeError': "词条类型错误";
1507
+ readonly 'riven.unverifiedStat': "{stat}的显示换算尚未确认,暂不提供数值分析。";
1508
+ readonly 'riven.variantRequired': "组合枪的主副武器倾向不同,请使用 riven -v primary 或 riven -v secondary 指定形态。";
1509
+ readonly 'riven.variantError': "组合枪形态应为 primary(主武器)或 secondary(副武器)。";
1436
1510
  readonly 'riven.invalidParams': "请输入正确参数";
1437
1511
  readonly 'riven.noWeeklyData': "没有找到符合条件的紫卡参考数据";
1438
1512
  readonly 'wfm.inputItemName': "请输入物品名称";
@@ -1520,7 +1594,9 @@ declare module "commands/wf" {
1520
1594
  steelPathFissureCommand: (_action: Argv) => Promise<string>;
1521
1595
  railjackFissureCommand: (_action: Argv) => Promise<string>;
1522
1596
  relicCommand: (_action: Argv, input: string) => Promise<string>;
1523
- rivenCommand: (_action: Argv, input: Dict) => Promise<string>;
1597
+ rivenCommand: (_action: Argv<never, never, unknown[], {
1598
+ variant?: string;
1599
+ }>, input: Dict) => Promise<string>;
1524
1600
  rivenStatCommand: (_action: Argv, weaponType: string, statType: string, disposition: number) => Promise<string>;
1525
1601
  weeklyCommand: (_action: Argv) => Promise<string>;
1526
1602
  nightwaveCommand: (_action: Argv) => Promise<string>;