ships.Function.getMenuBlueprintForModule - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / ships / getMenuBlueprintForModule
getMenuBlueprintForModule(
moduleSymbol,blueprintSymbol):string|null
Defined in: src/ships/blueprint-menu.ts:74
The id a module's ordinary engineering menu lists for the recipe a fitted
BlueprintName names, or null when the menu lists no such recipe.
A fitted module and its menu can spell one recipe two ways, so comparing the two ids as written misses a match. This settles both cases where that happens:
-
A journal collision. The game writes
Sensor_LongRangeon a wake scanner, and the scanner menu listsScanner_LongRange. resolveBlueprintForModule reads that id against the module first. -
A generic spelling. Where a modification applies to several module families, the
menu lists the family's own id and a build authored elsewhere can carry the generic
Misc_*id. A life support's Lightweight isLifeSupport_LightWeightin the menu andMisc_LightWeightin an EDSY-authored build. A generic id matches the menu entry that is not itself generic and has the same name, grades and modified stats.
The match ignores magnitudes on purpose. LifeSupport_Shielded G5 draws +112% power
where Misc_Shielded draws +100%, and the two are still one menu entry. So use the
returned id to find the menu entry, and keep the fitted id for the numbers: a build's
engineering already rolls under the recipe it names.
A generic id never matches another generic id, and never matches a family recipe that
changes different stats. Misc_LightWeight on a pulse laser is null, because a
weapon's Lightweight also cuts distributor draw. Misc_ChaffCapacity on a heat sink
launcher is null: that menu lists Misc_HeatSinkCapacity, which is generic too, and
the two roll different ammunition.
Only the ordinary menu of ships/engineering-options is read. A Mercenary recipe sold
with a module (ships/pre-engineered) is not on that menu, so it is null here; it is
the same id in ShipLoadout.availableBlueprints and needs no matching.
string
A module symbol, e.g. "Int_LifeSupport_Size4_Class2". Case and
leading/trailing whitespace are ignored. An unknown or nullish symbol has no menu.
string
A blueprint catalogue or journal id, e.g. "Misc_LightWeight".
Case and leading/trailing whitespace are ignored. A nullish id is a miss.
string | null
The menu's id in the catalogue's own spelling, which joins to BLUEPRINTS and
equals one entry of getBlueprintsForModule; or null when the menu lists no
entry for this recipe.
If moduleSymbol or blueprintSymbol is present and not a string.
import { getMenuBlueprintForModule } from '@elite-dangerous-almanac/core/ships/blueprint-menu';
// An EDSY-authored build spells a life support's Lightweight generically.
getMenuBlueprintForModule('Int_LifeSupport_Size4_Class2', 'Misc_LightWeight');
// -> 'LifeSupport_LightWeight'
// A wake scanner's journal Long Range is the scanner recipe.
getMenuBlueprintForModule('Hpt_CloudScanner_Size0_Class5', 'Sensor_LongRange');
// -> 'Scanner_LongRange'
// A weapon's Lightweight is a different recipe from the generic one.
getMenuBlueprintForModule('Hpt_PulseLaser_Fixed_Small', 'Misc_LightWeight');
// -> null