DotNet.Ships.Class.SourcePurchase - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

EliteDangerousAlmanac / Ships / SourcePurchase

Class: SourcePurchase

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/SourcePurchase.cs:58

Reads the credit figures a captured loadout carries.

Remarks

No discount is inferred. One capture can mix purchases from several stations, omit module values, or state a total that differs from its priced parts. These queries keep those facts visible instead of inventing one misleading percentage.

Methods

FindModuleValue()

static FindModuleValue(record, slotKey): SourceModuleValue?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/SourcePurchase.cs:121

Finds the captured purchase entry for one mount.

Parameters

record

SourcePurchaseRecord

The record to read.

slotKey

string?

The mount key, such as PowerPlant. An exact spelling wins; otherwise the match folds case and ignores the surrounding whitespace, as every identifier lookup in this library does, so a journal key and a lower-cased SLEF key both resolve.

Returns

SourceModuleValue?

The entry, or null when the source priced no module in that mount. A miss never means the module was free.

Exceptions

ArgumentNullException

record is null.

FromLoadout()

static FromLoadout(loadout): SourcePurchaseRecord?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/SourcePurchase.cs:71

Reads the purchase figures off a journal Loadout event.

Parameters

loadout

LoadoutEvent

The event to read. No object in it is kept by reference.

Returns

SourcePurchaseRecord?

The record, or null when the source states no credit figure at all. A record of nothing but absent figures would read as a source that priced the build at nothing.

Remarks

A malformed event that repeats an exactly spelled mount keeps the last entry.

Exceptions

ArgumentNullException

loadout is null.

SumModuleValues()

static SumModuleValues(record): double

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/SourcePurchase.cs:150

Adds up every per-mount price the source stated.

Parameters

record

SourcePurchaseRecord

The record whose individually priced entries to add.

Returns

double

The stated total in credits, or zero when no module was individually priced.

Remarks

This does not replace SourcePurchaseRecord.ModulesValue. A capture may omit individual prices or state an inconsistent total, and comparing the two figures is useful precisely because this one hides no such disagreement.

Exceptions

ArgumentNullException

record is null.

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