ships - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / ships

ships

Ship and outfitting data for Elite Dangerous — Frontier's shipyard and outfitting registries.

This entry point re-exports the ships feature area. Every symbol is also reachable from its own module, so bundlers can drop anything you do not use.

Working with a whole build? Start with ShipLoadout — it reads a SLEF export (ShipLoadout.fromSlef) or a journal Loadout event (ShipLoadout.fromLoadout), writes either back out (ShipLoadout.toSlefString, ShipLoadout.toLoadoutEvent), fits modules and applies engineering, and carries the figures a capture stated (unladenMass, rebuy) — keeping what a capture said it paid apart from what the build is worth at retail (ShipLoadout.sourcePurchase). BuildMetrics is the other half: BuildMetrics.of(build) answers the questions apps actually ask (BuildMetrics.maxJumpRange, BuildMetrics.powerBudget, BuildMetrics.shieldMetricsResult), so an editor need not import the calculations nor a viewer the editors. Together they are the batteries-included facade and pull in every catalogue; everything below is what they are built from, so drop to the pieces when you need one answer rather than a whole ship.

The area has five layers:

The registries use two distinct Frontier identity spaces. symbol identifies an item — a hull, module, material, micro-resource or commodity — and is what item and journal Item lookups accept. Engineering catalogues carry ids of their own: blueprintSymbol names a recipe, a fixed variant's identity included, and experimentalEffectSymbol names an effect. Those two are what the journal writes in Engineering.BlueprintName and Engineering.ExperimentalEffect respectively; the few colliding blueprint aliases are resolved for their module by resolveBlueprintForModule. Pre-engineered variants are found from the base module's symbol with getPreEngineeredVariants.

Entity catalogues (SHIPS, the module catalogues, PRE_ENGINEERED_MODULES) are readonly arrays whose values carry their own identity; engineering catalogues (BLUEPRINTS, EXPERIMENTAL_EFFECTS, ENGINEERING_OPTION_GROUPS) are keyed by that identity instead — enumerate them with Object.values(). Prefer the case-insensitive lookups (getBlueprint, getExperimentalEffect, getBlueprintCosts, getExperimentalEffectCost) to indexing a map with caller- or journal-supplied text.

Identity primarily from EDCD FDevIDs (shipyard.csv, outfitting.csv), with supplemental module identities documented in the source record; stats and slot layouts from EDCD/coriolis-data and EDSY. See data/ships/SOURCES.md.

Examples

The whole-build layer. ShipLoadout reads a capture and answers the questions an outfitting screen asks. This is the one to start from, and the one that pulls in every catalogue.

import { BuildMetrics } from '@elite-dangerous-almanac/core/ships/build-metrics';
import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
import type { LoadoutEvent } from '@elite-dangerous-almanac/core/ships/slef';

declare const event: LoadoutEvent;

// Figures below are one build's — a Krait Phantom explorer.
const metrics = BuildMetrics.of(ShipLoadout.fromLoadout(event));
metrics.maxJumpRange(); // -> 60.5478  (ly)
metrics.powerBudget().withinBudget; // -> true
metrics.shieldMetricsResult().value?.strength; // -> 743.12   (MJ)
metrics.weaponMetrics().total.damagePerSecond; // -> 34

The lookup layer. One small hull catalogue, and the outfitting modules split by Frontier's four categories. Lookups ignore case and surrounding whitespace.

import { getShipBySymbol } from '@elite-dangerous-almanac/core/ships/ships';
import { getModuleBySymbol } from '@elite-dangerous-almanac/core/ships/modules';
import { CORE_MODULES } from '@elite-dangerous-almanac/core/ships/modules-core';

getShipBySymbol('empire_trader')?.name; // -> 'Imperial Clipper'

// Pass a category to bound what you bundle; omit it to search every module.
getModuleBySymbol('Int_Hyperdrive_Size6_Class5', CORE_MODULES)?.name;
// -> 'Frame Shift Drive'

The data-free layer. Each calculation is its own module over plain constants, so it costs nothing but the function — no catalogue, no build. ./power, ./shields, ./shield-capacitor, ./armour, ./weapons, ./weapons-capacitor, ./mobility, ./mobility-capacitor, ./ammunition and ./resistances are the same shape.

import { singleJumpRange } from '@elite-dangerous-almanac/core/ships/jump-range';

singleJumpRange(1237.3, 6.8, {
    optMass: 7528.04,
    maxFuel: 6.8,
    fuelMul: 0.011,
    fuelPower: 2.5025,
    jumpBoost: 10.5, // Guardian FSD Booster
}); // -> 89.4147  (ly)

Classes

Interfaces

Type Aliases

Variables

Functions

⚠️ **GitHub.com Fallback** ⚠️