ships.Function.identifyPreEngineeredVariant - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / ships / identifyPreEngineeredVariant

Function: identifyPreEngineeredVariant()

identifyPreEngineeredVariant(module): PreEngineeredVariant | null

Defined in: src/ships/pre-engineered-stats.ts:280

Identify the fixed pre-engineered/reward variant described by a fitted loadout module.

Reward matching uses the reported post-engineering stat values rather than trusting the blueprint tuple alone: reward variants carry hand-set values that an ordinary roll of the named blueprint does not reproduce. A captured experimental effect is composed with each candidate before comparison, because some fixed articles accept an effect after purchase (the V1 frame-shift drives are the common example).

Mercenary articles are the exception: their bespoke blueprint is available only after buying the article, while their unpublished purchase modifier block cannot identify it. The module symbol and blueprint therefore identify the purchase at grade 1 and after upgrading it through grades 2–5. The fitted grade and experimental effect remain the loadout's current engineering state; the returned variant carries the original purchase grade, Merc Coin price and, on the rows sold with one, the effect the shop bakes in. So a capture that states a different effect, or none, still identifies the article it was bought as: read the capture for what is fitted now, the variant for what was bought.

A locked fixed article is also identified by its unique symbol/blueprint/grade/experimental tuple when a SLEF capture omits the Modifiers key entirely: being final, no ordinary roll could have written that tuple. A present empty or partial array does not use this shortcut: older library exports can carry an ordinary roll with the same tuple, and its values must not be replaced by reward stats. A third- party export can omit the array from such a roll; that record is indistinguishable from the fixed article, so the catalogue identity wins.

An unlocked article that shares a blueprint with no craftable recipe of its base module is identified the same way, but by ShipLoadout.fromLoadout rather than here — that reading needs each module's engineering menu, a catalogue this module deliberately does not carry into a consumer's bundle.

Frontier journals and captures may omit a derived modifier, so one predicted value may be absent. Every stated predicted value must agree to within one part in ten thousand of the stat's unmodified base — wide enough for a producer that stores the multiplier and re-derives the value, narrow enough that no other candidate fits — and all but at most one must be present. Ambiguous or incomplete evidence returns null rather than guessing. Other variants without a published stat block cannot be identified.

Parameters

module

LoadoutModule

A module from a journal Loadout event or SLEF export.

Returns

PreEngineeredVariant | null

The uniquely matching catalogue variant, or null when the stats do not identify one.

Throws

If a field it reads is present and not a string — module.Item, a modifier's Label, or the block's BlueprintName or ExperimentalEffect. A module with no engineering block answers null before any of them is read.

Example

import { identifyPreEngineeredVariant } from '@elite-dangerous-almanac/core/ships/pre-engineered-stats';
import type { LoadoutEvent } from '@elite-dangerous-almanac/core/ships/slef';

declare const loadoutEvent: LoadoutEvent;

const fitted = loadoutEvent.Modules.find((m) => m.Slot === 'FrameShiftDrive')!;
identifyPreEngineeredVariant(fitted)?.acquisition; // -> 'techBroker', or null
⚠️ **GitHub.com Fallback** ⚠️