WeaponParams
app/features/params/core/WeaponParams.tsNo overview comment at the top of the file.
- Imports
- no other modules
- Used by
- 1 loader3 components
Types
Shape of the committed all-version-*-params.json files.
export interface AllVersionParams { metadata: { versions: string[] }; weapons: Record<string, Record<string, Record<string, unknown>>>; specialPoints?: Record< string, { history: Array<{ version: string; value: number }> } >; }
Functions & values
Parses every given weapon id from an all-version data file, keyed by id string; ids with no data are skipped. toDataKey maps an id to the id its params are stored under (main weapons → base weapon).
export function parseMany<Id extends number>( ids: readonly Id[], data: AllVersionParams, toDataKey: (id: Id) => number = (id) => id, ): Record<string, ParsedWeaponParams>
Every distinct ${category}.${key} across the weapons, sorted, for the comparison table rows.
export function allParamKeys( weaponParams: Record<string, ParsedWeaponParams>, ): ParamDefinition[]
Base main weapon ids of the weapon's category (comparison columns); a non-base weapon is kept first.
export function categoryWeaponIds(weaponId: MainWeaponId): MainWeaponId[]
Main weapon ids sharing the base weapon (alternate kits, not alt skins), including the weapon itself.
export function kitSiblingIds(weaponId: MainWeaponId): MainWeaponId[]
Whether the given parameter has any tracked per-version history.
export function hasHistory(param: ParamValueWithHistory): boolean
Damage multiplier history per object target, keeping the most informative row (longest history, then highest rate) when several attacks share a target. Ordered like {@link DAMAGE_RECEIVERS}.
export function damageMultipliersForWeapon( rows: Record<string, DamageRateHistoryRow>, weaponId: number, kind: WeaponParamKind, ): DamageMultiplierWithHistory[]
Unit tests (4)
For a damageable sub/special: every other weapon's damage multiplier history against it, one entry per (attacker group, target) keeping the most informative. Ordered like {@link DAMAGE_RECEIVERS}.
export function incomingDamageMultipliersForWeapon( rows: Record<string, DamageRateHistoryRow>, weaponId: number, kind: "sub" | "special", ): IncomingDamageMultiplierWithHistory[]
Unit tests (3)
Descending patch history of one weapon. Pass specialPoints for main weapons to fold those changes in.
export function patchHistory( parsed: ParsedWeaponParams | undefined, versions: string[], specialPoints: SpecialPointWithHistory[] = [], damageMultipliers: DamageMultiplierWithHistory[] = [], incomingDamageMultipliers: IncomingDamageMultiplierWithHistory[] = [], ): WeaponPatch[]
Patch history per kit: shared main weapon changes + the kit's special points, sub and special. Changes are tagged by source.
export function kitPatchHistories({ mainParsed, versions, kits, specialPointsByKit, mainDamageMultipliers, subParams, subDamageMultipliers, subIncomingDamageMultipliers, specialParams, specialDamageMultipliers, specialIncomingDamageMultipliers, }: { mainParsed: ParsedWeaponParams | undefined; versions: string[]; kits: WeaponKitInfo[]; specialPointsByKit: Record<string, SpecialPointWithHistory>; mainDamageMultipliers: DamageMultiplierWithHistory[]; subParams: Record<string, ParsedWeaponParams | undefined>; subDamageMultipliers: Record<string, DamageMultiplierWithHistory[]>; subIncomingDamageMultipliers: Record< string, IncomingDamageMultiplierWithHistory[] >; specialParams: Record<string, ParsedWeaponParams | undefined>; specialDamageMultipliers: Record<string, DamageMultiplierWithHistory[]>; specialIncomingDamageMultipliers: Record< string, IncomingDamageMultiplierWithHistory[] >; }): KitPatchHistory[]
Unit tests (2)
Formats a parameter value for display, trimming trailing zeroes from non-integer numbers.
export function formatValue(value: number | string): string
Unit tests not about one export (13)
- patchHistory damage multipliers › attributes a change to the version after the recorded one and flags a higher rate as a buff
- patchHistory damage multipliers › flags a lower rate as a nerf
- patchHistory incoming damage multipliers › flags
- parse damage falloff curves › serializes a DistanceDamage array into a scaled damage @ distance string
- parse damage falloff curves › flattens nested breakpoint arrays
- parse damage falloff curves › tracks per-version history of a damage falloff curve
- classifyParamChange damage falloff curves › flags
- classifyParamChange damage falloff curves › is
Not shown, only used by tests: parse