DotNet.Ships.Class.ShipLoadout - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
EliteDangerousAlmanac / Ships / 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.
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.
CargoCapacity:
double
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:45
The cargo the build can hold, in tonnes.
A capture's own figure stands on the same terms as the unladen mass.
FuelCapacity:
LoadoutFuelCapacity
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:33
The main tank and the hull's reserve, in tonnes.
A capture's own figures stand on the same terms as the unladen mass.
HullValue:
double?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:63
The hull price the build represents, in credits.
This is the live figure, kept coherent with an edit. Read SourcePurchase for the capture's figure as captured, which no edit changes.
ImportOutcomes:
IReadOnlyList<LoadoutImportOutcome>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:84
What an import made of this build.
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:
double?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:71
The fitted modules' price the build represents, in credits.
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:
double
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:55
The berths the fitted cabins carry.
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:
double?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:75
The insurance rebuy the build represents, in credits.
An edit discards it for the same reason it discards the modules price.
ShipIdent:
string?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:20
The ship's registered identifier, where the build carries one.
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:
string
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:107
The hull's internal identifier.
SourcePurchase:
SourcePurchaseRecord?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:114
The prices a capture stated, where it stated any.
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:
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.
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.
ApplyBlueprint(
slotKey,blueprintSymbol,options):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:37
Rolls a recipe onto one fitted module.
string
The mount key. Case and surrounding whitespace are ignored.
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.
The grade, the quality roll and any experimental effect.
This build, so edits chain.
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.
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(
slotKey):IReadOnlyList<AvailableBlueprint>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:247
The blueprints one fitted module accepts whose modifiers can be computed.
string
The mount key. Case and surrounding whitespace are ignored.
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.
ArgumentNullException
slotKey is null.
AvailableExperimentalEffects(
slotKey):IReadOnlyList<string>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:265
The experimental effects one fitted module offers.
string
The mount key. Case and surrounding whitespace are ignored.
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.
ArgumentNullException
slotKey is null.
ClearEngineering(
slotKey):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Engineering.cs:537
Strips the engineering from one fitted module, restoring its base stats.
string
The mount key. Case and surrounding whitespace are ignored.
This build, so edits chain. An empty or unengineered mount changes nothing.
Clearing a Mercenary article removes the purchase-exclusive identity with it, so the module then answers to no catalogued article.
ArgumentNullException
slotKey is null.
ArgumentException
The fitted article is final and its baked engineering cannot be removed.
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.
string
The mount key. Case and surrounding whitespace are ignored.
The outcome. A refusal leaves the build unchanged.
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.
ArgumentNullException
slotKey is null.
staticDefault(shipSymbol):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:269
Starts a build carrying the modules a stock ship is supplied with.
string
The hull's symbol. Case and surrounding whitespace are ignored.
A complete, ready-to-edit stock build.
ArgumentException
The catalogue carries no such hull.
staticEmpty(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.
string
The hull's symbol. Case and surrounding whitespace are ignored.
A build on the hull's stock bulkhead, core internals and cargo hatch, with every hardpoint, utility mount and optional internal left open.
Read Default for a build that also carries the stock fit.
ArgumentException
The catalogue carries no such hull.
FittedModuleAt(
slotKey):FittedModule?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:202
The module one mount holds.
string
The mount key. Case and surrounding whitespace are ignored.
The module, or null where the mount is empty or unknown.
ArgumentNullException
slotKey is null.
FittedModules():
IReadOnlyList<FittedModule>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:229
Every fitted module, in the order the build carries them.
IReadOnlyList<FittedModule>
The modules.
staticFromLoadout(capture):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:193
Reads a build from a journal loadout event.
The event.
The build.
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.
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.
staticFromSlef(json,index?):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:129
Reads a build from a SLEF export.
string
The SLEF JSON text.
int = 0
Which entry to take where the export holds several builds.
The build for that entry.
Module normalization follows FromLoadout. Read ImportOutcomes for the mounts that were emptied or stocked, and for the engineering the import could not resolve.
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.
staticFromSlef(slef,index?):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.cs:139
Reads a build from an already-read SLEF export.
IReadOnlyList<SlefEntry>
The export entries.
int = 0
Which entry to take where the export holds several builds.
The build for that entry.
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(
slotKey):IReadOnlyList<OutfittingModule>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:293
The modules one mount takes.
string
The mount key. Case and surrounding whitespace are ignored.
IReadOnlyList<OutfittingModule>
The fitting modules, in catalogue order.
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.
ArgumentNullException
slotKey is null.
ArgumentOutOfRangeException
The hull has no mount with that key.
RemoveModule(
slotKey):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:276
Empties a mount.
string
The mount key. Case and surrounding whitespace are ignored.
This build, so edits chain. Clearing an already-empty mount changes nothing.
ArgumentNullException
slotKey is null.
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(
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.
string
The mount key. Case and surrounding whitespace are ignored.
The outcome. A refusal leaves the build unchanged.
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.
ArgumentNullException
slotKey is null.
ArgumentOutOfRangeException
The hull has no mount with that key.
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.
string
The mount key. Case and surrounding whitespace are ignored.
string?
The effect's symbol, or null to remove the effect.
The outcome. A refusal leaves the build unchanged.
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.
ArgumentNullException
slotKey is null.
SetModule(
slotKey,module):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:124
Fits a module into a mount, replacing whatever it holds.
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.
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.
This build, so edits chain.
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.
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.
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(
slotKey,on):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:357
Switches one fitted module on or off.
string
The mount key. Case and surrounding whitespace are ignored.
bool
Whether the module runs.
This build, so edits chain.
ArgumentNullException
slotKey is null.
ArgumentOutOfRangeException
The mount is empty or unknown.
SetModulePriority(
slotKey,priority):ShipLoadout
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Editing.cs:376
Sets one fitted module's power band.
string
The mount key. Case and surrounding whitespace are ignored.
int
The band the journal writes, counted from zero. The outfitting panel numbers the same five groups from one.
This build, so edits chain.
ArgumentNullException
slotKey is null.
ArgumentOutOfRangeException
The mount is empty or unknown, or the band is not one of the five groups.
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.
string
The mount key. Case and surrounding whitespace are ignored.
The article to fit.
This build, so edits chain.
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.
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.
The article's base module does not fit the mount, or fitting it breaks a module limit.
Slots(
kind?):IReadOnlyList<LoadoutSlot>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:165
The hull's mounts in outfitting-panel order.
SlotKind? = null
One mount kind to keep, or nothing for every mount.
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(
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.
LoadoutExportOptions? = null
The module order, how sparse to be about power, and which prices. An absent value takes the defaults.
A new event.
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(
options):IReadOnlyList<SlefEntry>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Export.cs:64
This build as a one-entry SLEF export.
The envelope header, the module order and which prices.
IReadOnlyList<SlefEntry>
The export.
Several builds travel together in one export. Wrap their events with Slef.Wrap instead.
ArgumentNullException
options is null.
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.
As the export, plus the indent. It is compact by default.
string
The export as text.
ArgumentNullException
options is null.
ArgumentOutOfRangeException
The indent is outside 0 to 127 spaces.
Validation():
LoadoutValidation
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/ShipLoadout.Reading.cs:108
The structural validity and the operational completeness of this build.
The report, recomputed from the current fit on every call.
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.