ships.Interface.SourcePurchaseRecord - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / ships / 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.
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
}
readonlyhullValue: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.
readonlymoduleCount:number
Defined in: src/ships/source-purchase.ts:64
Total modules listed by the capture, including entries with no price.
readonlymodulesValue:number|null
Defined in: src/ships/source-purchase.ts:58
Fitted-module cost in credits as the source stated it, or null if absent.
readonlymoduleValues: readonlySourceModuleValue[]
Defined in: src/ships/source-purchase.ts:62
Individually priced slots, in capture order; unpriced slots are absent.
readonlyrebuy:number|null
Defined in: src/ships/source-purchase.ts:60
Insurance rebuy in credits as the source stated it, or null if absent.