ships.Interface.SourcePurchaseRecord - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

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

Interface: SourcePurchaseRecord

Defined in: src/ships/source-purchase.ts:54

An immutable snapshot of the credit figures carried by one captured loadout.

Every top-level figure can be null: absence means the source stated no value, not that the hull or modules were free. Likewise, moduleValues contains only individually priced slots. The snapshot remains unchanged when its owning ShipLoadout is edited because it describes the source capture, not the live fit.

Example

import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
import {
    getSourceModuleValue,
    sumSourceModuleValues,
} from '@elite-dangerous-almanac/core/ships/source-purchase';

declare const slefJson: string;

const build = ShipLoadout.fromSlef(slefJson);
const paid = build.sourcePurchase;
if (paid) {
    paid.hullValue; // captured hull price, or null
    getSourceModuleValue(paid, 'PowerPlant')?.value; // captured slot price
    sumSourceModuleValues(paid); // sum of individually priced modules
}

Properties

hullValue

readonly hullValue: number | null

Defined in: src/ships/source-purchase.ts:56

Hull cost in credits as the source stated it, or null if it stated none.


moduleCount

readonly moduleCount: number

Defined in: src/ships/source-purchase.ts:64

Total modules listed by the capture, including entries with no price.


modulesValue

readonly modulesValue: number | null

Defined in: src/ships/source-purchase.ts:58

Fitted-module cost in credits as the source stated it, or null if absent.


moduleValues

readonly moduleValues: readonly SourceModuleValue[]

Defined in: src/ships/source-purchase.ts:62

Individually priced slots, in capture order; unpriced slots are absent.


rebuy

readonly rebuy: number | null

Defined in: src/ships/source-purchase.ts:60

Insurance rebuy in credits as the source stated it, or null if absent.

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