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

EliteDangerousAlmanac / Ships / ShipLoadout

Class: ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:28

A fitted ship a caller holds and edits.

The edits a build accepts.

The engineering a build applies to what it holds.

What a build writes back out.

What a build answers about itself.

Remarks

Read one from a SLEF export or a journal loadout event, or start from a stock or an empty hull, then enumerate the mounts and fit modules. An edit changes the build in place and answers the same build, so read a query again after an edit rather than re-reading an earlier answer.

What a build calculates lives next door, on BuildMetrics over the same build.

A mount key is matched without regard to case, and with surrounding whitespace ignored. Frontier writes one spelling and a SLEF producer may write another, and both name the same mount. A build's own spelling is never rewritten, so re-exporting an import answers it untouched.

Properties

CargoCapacity

CargoCapacity: double

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:45

The cargo the build can hold, in tonnes.

Remarks

A capture's own figure stands on the same terms as the unladen mass.

FuelCapacity

FuelCapacity: LoadoutFuelCapacity

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:33

The main tank and the hull's reserve, in tonnes.

Remarks

A capture's own figures stand on the same terms as the unladen mass.

HullValue

HullValue: double?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:63

The hull price the build represents, in credits.

Remarks

This is the live figure, kept coherent with an edit. Read SourcePurchase for the capture's figure as captured, which no edit changes.

ImportOutcomes

ImportOutcomes: IReadOnlyList<LoadoutImportOutcome>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:84

What an import made of this build.

Remarks

The changes come in source order, then the mounts stocked from the hull defaults because the source named none, in the defaults' own order, then what the import made of each module's stated engineering. It is empty for a build assembled here, and for an import that needed no normalization and read every stated recipe unambiguously.

ModulesValue

ModulesValue: double?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:71

The fitted modules' price the build represents, in credits.

Remarks

It is absent after an edit or an import normalization discarded the capture's figure, because no catalogue records what a replaced module was bought for. Unlike the mass and the capacity it is not recomputed from what remains.

PassengerCapacity

PassengerCapacity: double

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:55

The berths the fitted cabins carry.

Remarks

This is always computed from the fit, unlike the cargo and the fuel: a journal states no passenger figure to prefer, so an imported build reports the cabins it lists. A berth is a seat rather than an occupant, and a passenger is massless, so filling one changes nothing a metric calculates.

Rebuy

Rebuy: double?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:75

The insurance rebuy the build represents, in credits.

Remarks

An edit discards it for the same reason it discards the modules price.

ShipIdent

ShipIdent: string?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:20

The ship's registered identifier, where the build carries one.

ShipName

ShipName: string?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:17

The commander's name for the ship, where the build carries one.

ShipSymbol

ShipSymbol: string

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:107

The hull's internal identifier.

SourcePurchase

SourcePurchase: SourcePurchaseRecord?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:114

The prices a capture stated, where it stated any.

Remarks

It is the commander's own purchase record, at whatever discount the station gave. Read BuildMetrics.BuildCost for the catalogue's retail prices instead.

UnladenMass

UnladenMass: double

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:29

The hull and modules mass with an empty tank and no cargo, in tonnes.

Remarks

A capture's own figure stands while the fit it described survives an import. Otherwise this is the hull's mass plus every fitted module's post-engineering mass, and ImportOutcomes is the only report that the figure is the normalized fit's rather than the capture's.

Methods

ApplyBlueprint()

ApplyBlueprint(slotKey, blueprintSymbol, options): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:37

Rolls a recipe onto one fitted module.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

blueprintSymbol

string

The recipe's symbol. A module family that renames a shared recipe is resolved, so the generic spelling and the module's own both answer.

options

ApplyBlueprintOptions

The grade, the quality roll and any experimental effect.

Returns

ShipLoadout

This build, so edits chain.

Remarks

The fitted module keeps its identity and gains an engineering block stating every stat the roll moves, in the labels a journal writes. A fixed pre-engineered article is rolled from the stock module behind it rather than from its own fixed figures, so replacing its engineering does not fold those figures in a second time. A Mercenary hardpoint keeps the experimental state it is sold with at every grade.

Exceptions

ArgumentNullException

An argument is null.

ArgumentOutOfRangeException

The mount holds no module, the recipe has no such grade, or the quality is not a roll from zero through one.

ArgumentException

No catalogue carries stats for the fitted module, the module's own menu does not offer the recipe or the effect, the article is final, the request changes a Mercenary hardpoint's fixed effect, the named recipe is a fixed article's identity, or a required stat is absent.

AvailableBlueprints()

AvailableBlueprints(slotKey): IReadOnlyList<AvailableBlueprint>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:247

The blueprints one fitted module accepts whose modifiers can be computed.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

IReadOnlyList<AvailableBlueprint>

The ordinary engineering menu first, then any bespoke Mercenary recipe. It is empty where the mount is empty, unresolved or final, or the module has neither route.

Exceptions

ArgumentNullException

slotKey is null.

AvailableExperimentalEffects()

AvailableExperimentalEffects(slotKey): IReadOnlyList<string>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:265

The experimental effects one fitted module offers.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

IReadOnlyList<string>

The effect symbols in engineering-menu order. It is empty where the mount is empty, unresolved or final, the module has no experimental menu, or a Mercenary hardpoint has a fixed experimental state.

Exceptions

ArgumentNullException

slotKey is null.

ClearEngineering()

ClearEngineering(slotKey): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:537

Strips the engineering from one fitted module, restoring its base stats.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

ShipLoadout

This build, so edits chain. An empty or unengineered mount changes nothing.

Remarks

Clearing a Mercenary article removes the purchase-exclusive identity with it, so the module then answers to no catalogued article.

Exceptions

ArgumentNullException

slotKey is null.

ArgumentException

The fitted article is final and its baked engineering cannot be removed.

CompleteEngineeringGrade()

CompleteEngineeringGrade(slotKey): EngineeringGradeEdit

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:350

Recomputes one fitted module's stated engineering at the best quality roll.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

EngineeringGradeEdit

The outcome. A refusal leaves the build unchanged.

Remarks

The modifier values an import states stay authoritative until this is called. An ordinary or a Mercenary recipe is rerolled through the calculator, and a fixed reward rebuilds its hand-set modifiers and any effect without losing its purchase identity.

A block that names a recipe and a grade but states no modifiers at all is rolled here too, even at the best quality, so a completed roll cannot stay stock. A stated modifier list, empty or partial, is left alone at the best quality.

Exceptions

ArgumentNullException

slotKey is null.

Default()

static Default(shipSymbol): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:269

Starts a build carrying the modules a stock ship is supplied with.

Parameters

shipSymbol

string

The hull's symbol. Case and surrounding whitespace are ignored.

Returns

ShipLoadout

A complete, ready-to-edit stock build.

Exceptions

ArgumentException

The catalogue carries no such hull.

Empty()

static Empty(shipSymbol): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:245

Starts a build on a hull carrying only the modules it cannot fly without.

Parameters

shipSymbol

string

The hull's symbol. Case and surrounding whitespace are ignored.

Returns

ShipLoadout

A build on the hull's stock bulkhead, core internals and cargo hatch, with every hardpoint, utility mount and optional internal left open.

Remarks

Read Default for a build that also carries the stock fit.

Exceptions

ArgumentException

The catalogue carries no such hull.

FittedModuleAt()

FittedModuleAt(slotKey): FittedModule?

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:202

The module one mount holds.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

FittedModule?

The module, or null where the mount is empty or unknown.

Exceptions

ArgumentNullException

slotKey is null.

FittedModules()

FittedModules(): IReadOnlyList<FittedModule>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:229

Every fitted module, in the order the build carries them.

Returns

IReadOnlyList<FittedModule>

The modules.

FromLoadout()

static FromLoadout(capture): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:193

Reads a build from a journal loadout event.

Parameters

capture

LoadoutEvent

The event.

Returns

ShipLoadout

The build.

Remarks

Capture and instance state stay out of the durable build, as does engineering provenance. A pre-engineered article is identified where the capture's evidence names one, and the catalogue's stat block then supplies the values the capture leaves out; the capture's own modifiers stay authoritative over it.

A recipe stated without modifiers is rolled. A journal writes the modifier block beside the recipe, and SLEF permits stating the recipe alone, so such a block is spelled out here at the grade and the quality it states. Otherwise the module would report that it is engineered while publishing the figures of one that is not.

A stated modifier block that moves nothing is replaced by the roll. A block naming only stats the module has no value for describes some other module. Every block that moves at least one stat this module carries stays exactly as the source wrote it: a capture's own figures are what the game reported, and outrank anything recomputed here.

Normalization makes the captured figures untrustworthy, so they are dropped and recomputed from the fit that remains. A mount stocked from absence is the exception and every figure stands.

Exceptions

ArgumentNullException

A field a build is assembled from is absent.

ArgumentException

Two modules name one mount.

FormatException

The event names a hull the catalogue does not carry.

FromSlef()

static FromSlef(json, index?): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:129

Reads a build from a SLEF export.

Parameters

json

string

The SLEF JSON text.

index

int = 0

Which entry to take where the export holds several builds.

Returns

ShipLoadout

The build for that entry.

Remarks

Module normalization follows FromLoadout. Read ImportOutcomes for the mounts that were emptied or stocked, and for the engineering the import could not resolve.

Exceptions

JsonException

The text is not valid JSON.

ArgumentNullException

json is null.

ArgumentOutOfRangeException

The export holds no entry at that index.

FormatException

The entry names a hull the catalogue does not carry.

FromSlef()

static FromSlef(slef, index?): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:139

Reads a build from an already-read SLEF export.

Parameters

slef

IReadOnlyList<SlefEntry>

The export entries.

index

int = 0

Which entry to take where the export holds several builds.

Returns

ShipLoadout

The build for that entry.

Exceptions

ArgumentNullException

slef is null.

ArgumentOutOfRangeException

The export holds no entry at that index.

FormatException

The entry names a hull the catalogue does not carry.

ModulesForSlot()

ModulesForSlot(slotKey): IReadOnlyList<OutfittingModule>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:293

The modules one mount takes.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

IReadOnlyList<OutfittingModule>

The fitting modules, in catalogue order.

Remarks

This is the outfitting offer, so an article the game does not sell separately is never in it: each is a second identity for a module the game already sells, and listing both puts the same article on the screen twice. A build that already carries one keeps it; only the choices are filtered. A candidate that would worsen a one-per-ship or a module-count allowance is left out too.

Exceptions

ArgumentNullException

slotKey is null.

ArgumentOutOfRangeException

The hull has no mount with that key.

RemoveModule()

RemoveModule(slotKey): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:276

Empties a mount.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

ShipLoadout

This build, so edits chain. Clearing an already-empty mount changes nothing.

Exceptions

ArgumentNullException

slotKey is null.

LoadoutEditException

The mount is the cargo hatch, or armour or a core internal an operational build keeps filled, or emptying it would worsen a per-ship module-count excess. A required mount takes a replacement but cannot be emptied.

RepairFixedMount()

RepairFixedMount(slotKey): FixedMountRepair

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:30

Refits one mount an operational build keeps filled, from the hull's stock.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

Returns

FixedMountRepair

The outcome. A refusal leaves the build unchanged.

Remarks

This is the repair path for the mounts an ordinary edit does not expose, which in practice is the built-in cargo hatch. The stock article keeps the mount's enabled flag, its power band and its health, and none of the replaced module's engineering or captured price, as an import does. Every entry point already fills these mounts, so a build this library produced answers that nothing changed.

Exceptions

ArgumentNullException

slotKey is null.

ArgumentOutOfRangeException

The hull has no mount with that key.

SetExperimentalEffect()

SetExperimentalEffect(slotKey, experimentalEffectSymbol): ExperimentalEffectEdit

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:236

Adds, replaces or removes one fitted module's experimental effect alone.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

experimentalEffectSymbol

string?

The effect's symbol, or null to remove the effect.

Returns

ExperimentalEffectEdit

The outcome. A refusal leaves the build unchanged.

Remarks

Ordinary engineering is recomputed at the recipe, the grade and the quality the module already states. A fixed reward instead keeps its hand-set modifiers and its purchase identity while the requested effect composes with them.

A Mercenary hardpoint keeps the experimental state it is sold with. An effect cannot be added, removed or replaced at any grade. Re-stating the same state changes nothing.

Exceptions

ArgumentNullException

slotKey is null.

SetModule()

SetModule(slotKey, module): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:124

Fits a module into a mount, replacing whatever it holds.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored. An occupied mount keeps the key the build already spells it with, so fitting into an import never renames a mount.

module

OutfittingModule

The module to fit. The complete record is kept, so a resolved fixed article or a record a caller adjusted keeps its stats. It must name an article the catalogue carries, and it may not drop a stat every build sums, nor state one as anything but a finite number.

Returns

ShipLoadout

This build, so edits chain.

Remarks

This is an incremental editor: every call must avoid worsening the build's current module-count excess, so fit an allowance-increasing module before the weapons it permits. Read a complete capture with FromLoadout instead, where order does not matter.

Fitting is a fresh mount, so the enabled flag, the power band and the health are reset. Set them again where a screen keeps a power band across a swap.

Exceptions

ArgumentNullException

An argument is null.

ArgumentOutOfRangeException

The hull has no mount with that key.

ArgumentException

The catalogue carries no such article, or the record drops or misstates a stat every build sums.

LoadoutEditException

The module does not fit the mount, conflicts with a one-per-ship family already fitted elsewhere, or worsens a per-ship module-count excess.

SetModuleEnabled()

SetModuleEnabled(slotKey, on): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:357

Switches one fitted module on or off.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

on

bool

Whether the module runs.

Returns

ShipLoadout

This build, so edits chain.

Exceptions

ArgumentNullException

slotKey is null.

ArgumentOutOfRangeException

The mount is empty or unknown.

SetModulePriority()

SetModulePriority(slotKey, priority): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:376

Sets one fitted module's power band.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

priority

int

The band the journal writes, counted from zero. The outfitting panel numbers the same five groups from one.

Returns

ShipLoadout

This build, so edits chain.

Exceptions

ArgumentNullException

slotKey is null.

ArgumentOutOfRangeException

The mount is empty or unknown, or the band is not one of the five groups.

SetPreEngineeredVariant()

SetPreEngineeredVariant(slotKey, variant): ShipLoadout

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:461

Fits a catalogued pre-engineered article, replacing whatever the mount holds.

Parameters

slotKey

string

The mount key. Case and surrounding whitespace are ignored.

variant

PreEngineeredVariant

The article to fit.

Returns

ShipLoadout

This build, so edits chain.

Remarks

The article's fixed stats and its journal engineering block are resolved together. It carries its grade, the best quality roll, any baked experimental effect and its fixed modifiers. Because the article names the module it fits as, a decorative identity cannot reach an unrelated weapon. A Mercenary article uses its observed fixed stat block when one is available. Otherwise, it keeps the stock stats apart from its baked effect and states only that effect's modifiers. An article that moves no stat states no modifiers at all, rather than an empty list claiming it changes none.

Exceptions

ArgumentNullException

An argument is null.

ArgumentOutOfRangeException

No catalogued article matches the module, the recipe, the grade, the effect and the route.

ArgumentException

The catalogues carry no base stat one of the article's own modifiers needs.

LoadoutEditException

The article's base module does not fit the mount, or fitting it breaks a module limit.

Slots()

Slots(kind?): IReadOnlyList<LoadoutSlot>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:165

The hull's mounts in outfitting-panel order.

Parameters

kind

SlotKind? = null

One mount kind to keep, or nothing for every mount.

Returns

IReadOnlyList<LoadoutSlot>

The mounts, each with the module it holds. Repeated reads for the same kind answer the same views until an edit changes the build.

ToLoadoutEvent()

ToLoadoutEvent(options?): LoadoutEvent

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Export.cs:29

This build as a journal loadout event, which is the data half of a SLEF entry.

Parameters

options

LoadoutExportOptions? = null

The module order, how sparse to be about power, and which prices. An absent value takes the defaults.

Returns

LoadoutEvent

A new event.

Remarks

Every top-level figure is computed from the hull and the fitted modules rather than echoed from what an import supplied, the credits being the one exception a caller can ask for. A figure the build cannot work out is left out rather than written as a stale or a zero value, because SLEF requires nothing beyond the hull and the modules.

Prices are quoted at retail: the bare hull's price plus every fitted module's catalogue price, with the rebuy a twentieth of the two. A capture's own figures record one commander's purchase history rather than a property of the build, so they are quoted only where the options ask for them, as provenance rather than as a price.

ToSlef()

ToSlef(options): IReadOnlyList<SlefEntry>

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Export.cs:64

This build as a one-entry SLEF export.

Parameters

options

SlefExportOptions

The envelope header, the module order and which prices.

Returns

IReadOnlyList<SlefEntry>

The export.

Remarks

Several builds travel together in one export. Wrap their events with Slef.Wrap instead.

Exceptions

ArgumentNullException

options is null.

ToSlefString()

ToSlefString(options): string

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Export.cs:75

This build as SLEF text, ready to write to a file or put on the clipboard.

Parameters

options

SlefExportOptions

As the export, plus the indent. It is compact by default.

Returns

string

The export as text.

Exceptions

ArgumentNullException

options is null.

ArgumentOutOfRangeException

The indent is outside 0 to 127 spaces.

Validation()

Validation(): LoadoutValidation

Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:108

The structural validity and the operational completeness of this build.

Returns

LoadoutValidation

The report, recomputed from the current fit on every call.

Remarks

Validity asks whether the fit is legal. Completeness asks that and whether armour and the seven core mounts are filled. Neither question reports an import normalization, so read ImportOutcomes beside them.

The thruster rule weighs the fitted thrusters' post-engineering maximum mass against what the ship comes to at each load it can reach without being refitted. A ship that cannot move on a full tank is an error; one that only fails with the hold full is a warning, and leaves the build valid and complete.

A capture may state a mass nobody can weigh. That is not refused here: this method reports a build rather than rejecting one, so an unweighable figure is left out and the rule it feeds does not run. The figure is still reported, as a thrown one, by whichever metric reads it.

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