Skip to content

Params · Modules

1 module · 11 exports · 0 repositories · 2 e2e tests · 1 route

Who imports who · hover a node
Depends onParams modulesUsed byWeaponParams11 exportsLoaders1 fileComponents3 files

WeaponParams

app/features/params/core/WeaponParams.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 loader3 components

Types

interface

AllVersionParams

:33

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

function

parseMany

:204

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>
function

allParamKeys

:222

Every distinct ${category}.${key} across the weapons, sorted, for the comparison table rows.

export function allParamKeys(
	weaponParams: Record<string, ParsedWeaponParams>,
): ParamDefinition[]
function

categoryWeaponIds

:257

Base main weapon ids of the weapon's category (comparison columns); a non-base weapon is kept first.

export function categoryWeaponIds(weaponId: MainWeaponId): MainWeaponId[]
function

kitSiblingIds

:276

Main weapon ids sharing the base weapon (alternate kits, not alt skins), including the weapon itself.

export function kitSiblingIds(weaponId: MainWeaponId): MainWeaponId[]
function

hasHistory

:286

Whether the given parameter has any tracked per-version history.

export function hasHistory(param: ParamValueWithHistory): boolean
function

damageMultipliersForWeapon

:322

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)
function

incomingDamageMultipliersForWeapon

:367

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)
function

patchHistory

:598

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[]
function

kitPatchHistories

:623

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)
function

formatValue

:710

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)

Not shown, only used by tests: parse