@elite-dangerous-almanac/core 0.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +48 -0
- package/PROVENANCE/SNAPSHOTS.md +36 -0
- package/PROVENANCE/astro/SOURCES.md +94 -0
- package/PROVENANCE/commodities/SOURCES.md +41 -0
- package/PROVENANCE/materials/SOURCES.md +69 -0
- package/PROVENANCE/ships/SOURCES.md +1580 -0
- package/README.md +148 -0
- package/THIRD_PARTY_NOTICES.md +202 -0
- package/dist/astro/codex-region-lookup.d.ts +169 -0
- package/dist/astro/codex-region-lookup.js +1 -0
- package/dist/astro/codex-region-lookup.js.map +1 -0
- package/dist/astro/codex-region.d.ts +149 -0
- package/dist/astro/codex-region.js +1 -0
- package/dist/astro/codex-region.js.map +1 -0
- package/dist/astro/galaxy-grid.d.ts +83 -0
- package/dist/astro/galaxy-grid.js +1 -0
- package/dist/astro/galaxy-grid.js.map +1 -0
- package/dist/astro/hand-authored-regions.d.ts +121 -0
- package/dist/astro/hand-authored-regions.js +1 -0
- package/dist/astro/hand-authored-regions.js.map +1 -0
- package/dist/astro/index.d.ts +140 -0
- package/dist/astro/index.js +1 -0
- package/dist/astro/index.js.map +1 -0
- package/dist/astro/mass-code.d.ts +55 -0
- package/dist/astro/mass-code.js +1 -0
- package/dist/astro/mass-code.js.map +1 -0
- package/dist/astro/naming-region-origins.d.ts +4 -0
- package/dist/astro/naming-region-origins.js +1 -0
- package/dist/astro/naming-region-origins.js.map +1 -0
- package/dist/astro/nebulae-all.d.ts +40 -0
- package/dist/astro/nebulae-all.js +1 -0
- package/dist/astro/nebulae-all.js.map +1 -0
- package/dist/astro/nebulae-planetary.d.ts +37 -0
- package/dist/astro/nebulae-planetary.js +1 -0
- package/dist/astro/nebulae-planetary.js.map +1 -0
- package/dist/astro/nebulae-procgen.d.ts +36 -0
- package/dist/astro/nebulae-procgen.js +1 -0
- package/dist/astro/nebulae-procgen.js.map +1 -0
- package/dist/astro/nebulae-real.d.ts +37 -0
- package/dist/astro/nebulae-real.js +1 -0
- package/dist/astro/nebulae-real.js.map +1 -0
- package/dist/astro/nebulae.d.ts +169 -0
- package/dist/astro/nebulae.js +1 -0
- package/dist/astro/nebulae.js.map +1 -0
- package/dist/astro/permit-locked-regions.d.ts +54 -0
- package/dist/astro/permit-locked-regions.js +1 -0
- package/dist/astro/permit-locked-regions.js.map +1 -0
- package/dist/astro/permit-locked-systems.d.ts +74 -0
- package/dist/astro/permit-locked-systems.js +1 -0
- package/dist/astro/permit-locked-systems.js.map +1 -0
- package/dist/astro/permit-locks.d.ts +130 -0
- package/dist/astro/permit-locks.js +1 -0
- package/dist/astro/permit-locks.js.map +1 -0
- package/dist/astro/procedural-system.d.ts +228 -0
- package/dist/astro/procedural-system.js +1 -0
- package/dist/astro/procedural-system.js.map +1 -0
- package/dist/astro/sector-name.d.ts +87 -0
- package/dist/astro/sector-name.js +1 -0
- package/dist/astro/sector-name.js.map +1 -0
- package/dist/astro/system-address-input.d.ts +76 -0
- package/dist/astro/system-address-input.js +1 -0
- package/dist/astro/system-address-input.js.map +1 -0
- package/dist/astro/system-address.d.ts +4 -0
- package/dist/astro/system-address.js +1 -0
- package/dist/astro/system-address.js.map +1 -0
- package/dist/astro/system-name.d.ts +187 -0
- package/dist/astro/system-name.js +1 -0
- package/dist/astro/system-name.js.map +1 -0
- package/dist/chunk-2FHHMYDC.js +1 -0
- package/dist/chunk-2FHHMYDC.js.map +1 -0
- package/dist/chunk-462OKHXR.js +1 -0
- package/dist/chunk-462OKHXR.js.map +1 -0
- package/dist/chunk-5H74FKY7.js +1 -0
- package/dist/chunk-5H74FKY7.js.map +1 -0
- package/dist/chunk-6LUEKHO5.js +1 -0
- package/dist/chunk-6LUEKHO5.js.map +1 -0
- package/dist/chunk-76XKY2Y2.js +1 -0
- package/dist/chunk-76XKY2Y2.js.map +1 -0
- package/dist/chunk-7EE5VIHR.js +1 -0
- package/dist/chunk-7EE5VIHR.js.map +1 -0
- package/dist/chunk-A3NM7SAJ.js +1 -0
- package/dist/chunk-A3NM7SAJ.js.map +1 -0
- package/dist/chunk-A6XPYSVR.js +1 -0
- package/dist/chunk-A6XPYSVR.js.map +1 -0
- package/dist/chunk-AA3K5XUE.js +1 -0
- package/dist/chunk-AA3K5XUE.js.map +1 -0
- package/dist/chunk-AVZI6VKA.js +1 -0
- package/dist/chunk-AVZI6VKA.js.map +1 -0
- package/dist/chunk-B5TT26XE.js +1 -0
- package/dist/chunk-B5TT26XE.js.map +1 -0
- package/dist/chunk-BNILZXJD.js +1 -0
- package/dist/chunk-BNILZXJD.js.map +1 -0
- package/dist/chunk-BRDQUJXV.js +1 -0
- package/dist/chunk-BRDQUJXV.js.map +1 -0
- package/dist/chunk-BTPV5CIF.js +1 -0
- package/dist/chunk-BTPV5CIF.js.map +1 -0
- package/dist/chunk-CI3ACMRA.js +1 -0
- package/dist/chunk-CI3ACMRA.js.map +1 -0
- package/dist/chunk-COE5ADYJ.js +1 -0
- package/dist/chunk-COE5ADYJ.js.map +1 -0
- package/dist/chunk-CWAX3BSH.js +1 -0
- package/dist/chunk-CWAX3BSH.js.map +1 -0
- package/dist/chunk-DACZE3HX.js +1 -0
- package/dist/chunk-DACZE3HX.js.map +1 -0
- package/dist/chunk-DURKO7JU.js +1 -0
- package/dist/chunk-DURKO7JU.js.map +1 -0
- package/dist/chunk-E45EDCYH.js +1 -0
- package/dist/chunk-E45EDCYH.js.map +1 -0
- package/dist/chunk-ELIZXUMI.js +1 -0
- package/dist/chunk-ELIZXUMI.js.map +1 -0
- package/dist/chunk-EYGVDJ2I.js +1 -0
- package/dist/chunk-EYGVDJ2I.js.map +1 -0
- package/dist/chunk-FGXWVFN6.js +1 -0
- package/dist/chunk-FGXWVFN6.js.map +1 -0
- package/dist/chunk-GJCB2Z72.js +1 -0
- package/dist/chunk-GJCB2Z72.js.map +1 -0
- package/dist/chunk-HI7FCS3G.js +1 -0
- package/dist/chunk-HI7FCS3G.js.map +1 -0
- package/dist/chunk-HKXXFIRI.js +1 -0
- package/dist/chunk-HKXXFIRI.js.map +1 -0
- package/dist/chunk-HTB52N6S.js +1 -0
- package/dist/chunk-HTB52N6S.js.map +1 -0
- package/dist/chunk-I7PIDRMU.js +1 -0
- package/dist/chunk-I7PIDRMU.js.map +1 -0
- package/dist/chunk-IH4NXKVW.js +1 -0
- package/dist/chunk-IH4NXKVW.js.map +1 -0
- package/dist/chunk-INNFH37U.js +1 -0
- package/dist/chunk-INNFH37U.js.map +1 -0
- package/dist/chunk-J2PNZQY4.js +1 -0
- package/dist/chunk-J2PNZQY4.js.map +1 -0
- package/dist/chunk-JQG4C67D.js +1 -0
- package/dist/chunk-JQG4C67D.js.map +1 -0
- package/dist/chunk-JTQVWIGL.js +1 -0
- package/dist/chunk-JTQVWIGL.js.map +1 -0
- package/dist/chunk-JWJ7RSZC.js +1 -0
- package/dist/chunk-JWJ7RSZC.js.map +1 -0
- package/dist/chunk-K3AMV27L.js +1 -0
- package/dist/chunk-K3AMV27L.js.map +1 -0
- package/dist/chunk-K7F6WC4T.js +1 -0
- package/dist/chunk-K7F6WC4T.js.map +1 -0
- package/dist/chunk-K7L7SMIR.js +1 -0
- package/dist/chunk-K7L7SMIR.js.map +1 -0
- package/dist/chunk-KG4EWDZZ.js +1 -0
- package/dist/chunk-KG4EWDZZ.js.map +1 -0
- package/dist/chunk-KMFUCORC.js +1 -0
- package/dist/chunk-KMFUCORC.js.map +1 -0
- package/dist/chunk-L2ZZXEZM.js +1 -0
- package/dist/chunk-L2ZZXEZM.js.map +1 -0
- package/dist/chunk-L747RVPO.js +1 -0
- package/dist/chunk-L747RVPO.js.map +1 -0
- package/dist/chunk-MFV4VZFP.js +1 -0
- package/dist/chunk-MFV4VZFP.js.map +1 -0
- package/dist/chunk-NWPK6Q3S.js +1 -0
- package/dist/chunk-NWPK6Q3S.js.map +1 -0
- package/dist/chunk-PMJG7PHU.js +1 -0
- package/dist/chunk-PMJG7PHU.js.map +1 -0
- package/dist/chunk-PP2VSA6M.js +1 -0
- package/dist/chunk-PP2VSA6M.js.map +1 -0
- package/dist/chunk-Q22LXT53.js +1 -0
- package/dist/chunk-Q22LXT53.js.map +1 -0
- package/dist/chunk-Q5MR36RW.js +1 -0
- package/dist/chunk-Q5MR36RW.js.map +1 -0
- package/dist/chunk-Q5XOGATC.js +1 -0
- package/dist/chunk-Q5XOGATC.js.map +1 -0
- package/dist/chunk-QTDBO7R2.js +1 -0
- package/dist/chunk-QTDBO7R2.js.map +1 -0
- package/dist/chunk-R4OD62HV.js +1 -0
- package/dist/chunk-R4OD62HV.js.map +1 -0
- package/dist/chunk-RD73TFGS.js +1 -0
- package/dist/chunk-RD73TFGS.js.map +1 -0
- package/dist/chunk-RIT6MOO5.js +1 -0
- package/dist/chunk-RIT6MOO5.js.map +1 -0
- package/dist/chunk-RVSXKQHE.js +1 -0
- package/dist/chunk-RVSXKQHE.js.map +1 -0
- package/dist/chunk-S4DBNX2B.js +1 -0
- package/dist/chunk-S4DBNX2B.js.map +1 -0
- package/dist/chunk-S4UWCHL6.js +1 -0
- package/dist/chunk-S4UWCHL6.js.map +1 -0
- package/dist/chunk-SQS7672E.js +1 -0
- package/dist/chunk-SQS7672E.js.map +1 -0
- package/dist/chunk-TLNHETGC.js +1 -0
- package/dist/chunk-TLNHETGC.js.map +1 -0
- package/dist/chunk-U6TMCYA6.js +1 -0
- package/dist/chunk-U6TMCYA6.js.map +1 -0
- package/dist/chunk-V4C6FIE2.js +1 -0
- package/dist/chunk-V4C6FIE2.js.map +1 -0
- package/dist/chunk-VXVUEF5U.js +1 -0
- package/dist/chunk-VXVUEF5U.js.map +1 -0
- package/dist/chunk-VZXL5KBR.js +1 -0
- package/dist/chunk-VZXL5KBR.js.map +1 -0
- package/dist/chunk-VZZ2XIRE.js +1 -0
- package/dist/chunk-VZZ2XIRE.js.map +1 -0
- package/dist/chunk-WV5YM7H5.js +1 -0
- package/dist/chunk-WV5YM7H5.js.map +1 -0
- package/dist/chunk-Y2MUIE5W.js +1 -0
- package/dist/chunk-Y2MUIE5W.js.map +1 -0
- package/dist/chunk-Z43DN4PY.js +1 -0
- package/dist/chunk-Z43DN4PY.js.map +1 -0
- package/dist/chunk-Z4GTTB7I.js +1 -0
- package/dist/chunk-Z4GTTB7I.js.map +1 -0
- package/dist/chunk-Z4OUB4SJ.js +1 -0
- package/dist/chunk-Z4OUB4SJ.js.map +1 -0
- package/dist/chunk-ZFT56QFR.js +1 -0
- package/dist/chunk-ZFT56QFR.js.map +1 -0
- package/dist/chunk-ZNCXENNB.js +1 -0
- package/dist/chunk-ZNCXENNB.js.map +1 -0
- package/dist/commodities/commodities-all.d.ts +25 -0
- package/dist/commodities/commodities-all.js +1 -0
- package/dist/commodities/commodities-all.js.map +1 -0
- package/dist/commodities/commodities-rare.d.ts +34 -0
- package/dist/commodities/commodities-rare.js +1 -0
- package/dist/commodities/commodities-rare.js.map +1 -0
- package/dist/commodities/commodities-standard.d.ts +34 -0
- package/dist/commodities/commodities-standard.js +1 -0
- package/dist/commodities/commodities-standard.js.map +1 -0
- package/dist/commodities/commodities.d.ts +142 -0
- package/dist/commodities/commodities.js +1 -0
- package/dist/commodities/commodities.js.map +1 -0
- package/dist/commodities/index.d.ts +30 -0
- package/dist/commodities/index.js +1 -0
- package/dist/commodities/index.js.map +1 -0
- package/dist/galactic-position-shLkm4Qg.d.ts +30 -0
- package/dist/materials/index.d.ts +47 -0
- package/dist/materials/index.js +1 -0
- package/dist/materials/index.js.map +1 -0
- package/dist/materials/materials-all.d.ts +26 -0
- package/dist/materials/materials-all.js +1 -0
- package/dist/materials/materials-all.js.map +1 -0
- package/dist/materials/materials-encoded.d.ts +31 -0
- package/dist/materials/materials-encoded.js +1 -0
- package/dist/materials/materials-encoded.js.map +1 -0
- package/dist/materials/materials-manufactured.d.ts +32 -0
- package/dist/materials/materials-manufactured.js +1 -0
- package/dist/materials/materials-manufactured.js.map +1 -0
- package/dist/materials/materials-raw.d.ts +31 -0
- package/dist/materials/materials-raw.js +1 -0
- package/dist/materials/materials-raw.js.map +1 -0
- package/dist/materials/materials.d.ts +277 -0
- package/dist/materials/materials.js +1 -0
- package/dist/materials/materials.js.map +1 -0
- package/dist/materials/micro-resources-all.d.ts +28 -0
- package/dist/materials/micro-resources-all.js +1 -0
- package/dist/materials/micro-resources-all.js.map +1 -0
- package/dist/materials/micro-resources-component.d.ts +29 -0
- package/dist/materials/micro-resources-component.js +1 -0
- package/dist/materials/micro-resources-component.js.map +1 -0
- package/dist/materials/micro-resources-consumable.d.ts +29 -0
- package/dist/materials/micro-resources-consumable.js +1 -0
- package/dist/materials/micro-resources-consumable.js.map +1 -0
- package/dist/materials/micro-resources-data.d.ts +29 -0
- package/dist/materials/micro-resources-data.js +1 -0
- package/dist/materials/micro-resources-data.js.map +1 -0
- package/dist/materials/micro-resources-item.d.ts +29 -0
- package/dist/materials/micro-resources-item.js +1 -0
- package/dist/materials/micro-resources-item.js.map +1 -0
- package/dist/materials/micro-resources.d.ts +136 -0
- package/dist/materials/micro-resources.js +1 -0
- package/dist/materials/micro-resources.js.map +1 -0
- package/dist/ship-loadout-Ba63RDf-.d.ts +1059 -0
- package/dist/ships/ammunition.d.ts +107 -0
- package/dist/ships/ammunition.js +1 -0
- package/dist/ships/ammunition.js.map +1 -0
- package/dist/ships/armour.d.ts +134 -0
- package/dist/ships/armour.js +1 -0
- package/dist/ships/armour.js.map +1 -0
- package/dist/ships/blueprint-costs.d.ts +128 -0
- package/dist/ships/blueprint-costs.js +1 -0
- package/dist/ships/blueprint-costs.js.map +1 -0
- package/dist/ships/blueprint-journal.d.ts +116 -0
- package/dist/ships/blueprint-journal.js +1 -0
- package/dist/ships/blueprint-journal.js.map +1 -0
- package/dist/ships/blueprints.d.ts +103 -0
- package/dist/ships/blueprints.js +1 -0
- package/dist/ships/blueprints.js.map +1 -0
- package/dist/ships/decorative-modifications.d.ts +176 -0
- package/dist/ships/decorative-modifications.js +1 -0
- package/dist/ships/decorative-modifications.js.map +1 -0
- package/dist/ships/engineering-options.d.ts +246 -0
- package/dist/ships/engineering-options.js +1 -0
- package/dist/ships/engineering-options.js.map +1 -0
- package/dist/ships/engineering.d.ts +229 -0
- package/dist/ships/engineering.js +1 -0
- package/dist/ships/engineering.js.map +1 -0
- package/dist/ships/experimental-effect-costs.d.ts +56 -0
- package/dist/ships/experimental-effect-costs.js +1 -0
- package/dist/ships/experimental-effect-costs.js.map +1 -0
- package/dist/ships/experimental-effects.d.ts +62 -0
- package/dist/ships/experimental-effects.js +1 -0
- package/dist/ships/experimental-effects.js.map +1 -0
- package/dist/ships/index.d.ts +205 -0
- package/dist/ships/index.js +1 -0
- package/dist/ships/index.js.map +1 -0
- package/dist/ships/jump-range.d.ts +115 -0
- package/dist/ships/jump-range.js +1 -0
- package/dist/ships/jump-range.js.map +1 -0
- package/dist/ships/loadout-calculations.d.ts +109 -0
- package/dist/ships/loadout-calculations.js +1 -0
- package/dist/ships/loadout-calculations.js.map +1 -0
- package/dist/ships/loadout-validation.d.ts +80 -0
- package/dist/ships/loadout-validation.js +1 -0
- package/dist/ships/loadout-validation.js.map +1 -0
- package/dist/ships/module-capabilities.d.ts +205 -0
- package/dist/ships/module-capabilities.js +1 -0
- package/dist/ships/module-capabilities.js.map +1 -0
- package/dist/ships/modules-all.d.ts +43 -0
- package/dist/ships/modules-all.js +1 -0
- package/dist/ships/modules-all.js.map +1 -0
- package/dist/ships/modules-core.d.ts +40 -0
- package/dist/ships/modules-core.js +1 -0
- package/dist/ships/modules-core.js.map +1 -0
- package/dist/ships/modules-hardpoint.d.ts +42 -0
- package/dist/ships/modules-hardpoint.js +1 -0
- package/dist/ships/modules-hardpoint.js.map +1 -0
- package/dist/ships/modules-internal.d.ts +40 -0
- package/dist/ships/modules-internal.js +1 -0
- package/dist/ships/modules-internal.js.map +1 -0
- package/dist/ships/modules-utility.d.ts +40 -0
- package/dist/ships/modules-utility.js +1 -0
- package/dist/ships/modules-utility.js.map +1 -0
- package/dist/ships/modules.d.ts +755 -0
- package/dist/ships/modules.js +1 -0
- package/dist/ships/modules.js.map +1 -0
- package/dist/ships/power.d.ts +168 -0
- package/dist/ships/power.js +1 -0
- package/dist/ships/power.js.map +1 -0
- package/dist/ships/pre-engineered-stats.d.ts +147 -0
- package/dist/ships/pre-engineered-stats.js +1 -0
- package/dist/ships/pre-engineered-stats.js.map +1 -0
- package/dist/ships/pre-engineered.d.ts +215 -0
- package/dist/ships/pre-engineered.js +1 -0
- package/dist/ships/pre-engineered.js.map +1 -0
- package/dist/ships/resistances.d.ts +208 -0
- package/dist/ships/resistances.js +1 -0
- package/dist/ships/resistances.js.map +1 -0
- package/dist/ships/shields.d.ts +221 -0
- package/dist/ships/shields.js +1 -0
- package/dist/ships/shields.js.map +1 -0
- package/dist/ships/ship-loadout.d.ts +16 -0
- package/dist/ships/ship-loadout.js +1 -0
- package/dist/ships/ship-loadout.js.map +1 -0
- package/dist/ships/ships.d.ts +191 -0
- package/dist/ships/ships.js +1 -0
- package/dist/ships/ships.js.map +1 -0
- package/dist/ships/slef.d.ts +318 -0
- package/dist/ships/slef.js +1 -0
- package/dist/ships/slef.js.map +1 -0
- package/dist/ships/slots.d.ts +418 -0
- package/dist/ships/slots.js +1 -0
- package/dist/ships/slots.js.map +1 -0
- package/dist/ships/source-purchase.d.ts +132 -0
- package/dist/ships/source-purchase.js +1 -0
- package/dist/ships/source-purchase.js.map +1 -0
- package/dist/ships/weapons.d.ts +380 -0
- package/dist/ships/weapons.js +1 -0
- package/dist/ships/weapons.js.map +1 -0
- package/dist/system-address-DYsN1qOT.d.ts +313 -0
- package/package.json +375 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **slot model** for a ship build — data-free types and helpers that describe
|
|
3
|
+
* where modules go on a hull and reconcile the two ways a slot is named.
|
|
4
|
+
*
|
|
5
|
+
* A hull offers a fixed set of mounts: seven core internals, a handful of weapon
|
|
6
|
+
* hardpoints, some tiny utility mounts, and a column of optional internals. Some of
|
|
7
|
+
* those mounts are **restricted** to one family of modules — military and
|
|
8
|
+
* planetary-approach optionals on most hulls, and, on three hulls, cargo-only,
|
|
9
|
+
* limpet-controller-only, vessel-hangar-only and passenger-cabin-only optionals and
|
|
10
|
+
* mining-only hardpoints (see {@link SlotRestriction}). This module gives
|
|
11
|
+
* each mount a stable **slot key** and a {@link BuildSlot} descriptor, and
|
|
12
|
+
* {@link parseSlotName} classifies a journal slot name (as it appears in a SLEF
|
|
13
|
+
* export) into the same shape — so a build loaded from SLEF and a build assembled from
|
|
14
|
+
* scratch speak one vocabulary.
|
|
15
|
+
*
|
|
16
|
+
* It holds no data; {@link enumerateSlots} takes a {@link ShipSlots} layout (from a
|
|
17
|
+
* hull's `Ship` record via `getShipSlots` in `./ships`) and expands it into keyed
|
|
18
|
+
* {@link BuildSlot}s. Most hulls number their mounts by rule; on ten the game does
|
|
19
|
+
* not, and a mount there carries its own `name` — see {@link enumerateSlots}.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
/** The kind of mount a slot is. */
|
|
24
|
+
type SlotKind = 'core' | 'hardpoint' | 'utility' | 'optional' | 'armour' | 'cargoHatch';
|
|
25
|
+
/**
|
|
26
|
+
* A restriction limiting which weapons a **hardpoint** accepts.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Only the Type-11 Prospector has any: four of its eight mounts take mining tools
|
|
30
|
+
* (mining lasers and the Mining Lance, abrasion blasters, seismic charge launchers,
|
|
31
|
+
* sub-surface displacement and extraction missiles, and the Mining Volley Repeater)
|
|
32
|
+
* and nothing else. The journal names such a mount with a `Mining` infix —
|
|
33
|
+
* `LargeMiningHardpoint1` — so {@link parseSlotName} recognises one on sight.
|
|
34
|
+
*/
|
|
35
|
+
type HardpointRestriction = 'mining';
|
|
36
|
+
/**
|
|
37
|
+
* A restriction limiting which **optional-internal** modules a slot accepts.
|
|
38
|
+
*
|
|
39
|
+
* - `military` — hull, module, shield and Guardian reinforcement packages and shield
|
|
40
|
+
* cell banks (journal `Military01`).
|
|
41
|
+
* - `planetaryApproachSuite` — the approach suite alone, which in turn fits nowhere
|
|
42
|
+
* else (journal `PlanetaryApproachSuite`).
|
|
43
|
+
* - `cargo` — cargo racks (ordinary, Mk II and corrosion-resistant) and fuel tanks;
|
|
44
|
+
* the Panther Clipper Mk II's first size-8 and first size-7 optionals (journal
|
|
45
|
+
* `Cargo01` and `Cargo02`).
|
|
46
|
+
* - `limpetController` — any limpet controller, single-purpose or multi (the Type-11
|
|
47
|
+
* Prospector's size-5 optional; journal `LimpetController01`).
|
|
48
|
+
* - `vesselHangar` — Mk I and Mk II vessel hangars (the Type-11 Prospector's other
|
|
49
|
+
* size-5 optional; journal `FighterBay01`).
|
|
50
|
+
* - `passenger` — passenger cabins, Mk I and Mk II, at every class either family
|
|
51
|
+
* offers (the Lynx Highliner's two size-6 and one size-5 optionals; journal
|
|
52
|
+
* `Passenger01`–`Passenger03`).
|
|
53
|
+
*/
|
|
54
|
+
type OptionalRestriction = 'military' | 'planetaryApproachSuite' | 'cargo' | 'limpetController' | 'vesselHangar' | 'passenger';
|
|
55
|
+
/**
|
|
56
|
+
* A restriction limiting which modules a slot accepts — every value either kind of
|
|
57
|
+
* restricted mount can carry.
|
|
58
|
+
*
|
|
59
|
+
* @remarks
|
|
60
|
+
* A {@link BuildSlot} is discriminated by `kind`: a `hardpoint` only carries a
|
|
61
|
+
* {@link HardpointRestriction}, an `optional` only an {@link OptionalRestriction}, and
|
|
62
|
+
* a `core` carries no restriction. Checking `slot.kind` narrows these fields.
|
|
63
|
+
*
|
|
64
|
+
* The list is complete. No hardpoint is restricted to one *mount* (fixed, gimballed or
|
|
65
|
+
* turret), and no utility mount is restricted.
|
|
66
|
+
*
|
|
67
|
+
* The journal spells two of these differently from the value: `vesselHangar` mounts
|
|
68
|
+
* are named `FighterBay01`, and
|
|
69
|
+
* `planetaryApproachSuite` is the only one whose key carries no number.
|
|
70
|
+
*/
|
|
71
|
+
type SlotRestriction = HardpointRestriction | OptionalRestriction;
|
|
72
|
+
/**
|
|
73
|
+
* What each restriction accepts, as a short phrase fit for an outfitting UI.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This is the same wording `ShipLoadout.setModule` uses when it refuses a module, so
|
|
77
|
+
* a label you show and the error a consumer sees cannot drift apart. It describes the
|
|
78
|
+
* module *families* a mount takes; for the actual fitting records, call
|
|
79
|
+
* `ShipLoadout.modulesForSlot`.
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
|
|
83
|
+
* import { SLOT_RESTRICTION_LABELS } from '@elite-dangerous-almanac/core/ships/slots';
|
|
84
|
+
*
|
|
85
|
+
* const slot = ShipLoadout.empty('LakonMiner').slots('hardpoint')[0]!;
|
|
86
|
+
* slot.restriction && SLOT_RESTRICTION_LABELS[slot.restriction]; // -> 'mining tools'
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
declare const SLOT_RESTRICTION_LABELS: Readonly<Record<SlotRestriction, string>>;
|
|
90
|
+
/**
|
|
91
|
+
* The seven fixed core-internal mounts, by function.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* These are **not** slot keys. A core mount has two names: this camelCase *function*
|
|
95
|
+
* (`BuildSlot.core`) and the journal's PascalCase *slot key* (`BuildSlot.key`), which
|
|
96
|
+
* is what every `slotKey` argument wants. Two of the pairs are not even the same word:
|
|
97
|
+
*
|
|
98
|
+
* | `core` (function) | `key` (journal slot) |
|
|
99
|
+
* | --- | --- |
|
|
100
|
+
* | `powerPlant` | `PowerPlant` |
|
|
101
|
+
* | `thrusters` | `MainEngines` |
|
|
102
|
+
* | `frameShiftDrive` | `FrameShiftDrive` |
|
|
103
|
+
* | `lifeSupport` | `LifeSupport` |
|
|
104
|
+
* | `powerDistributor` | `PowerDistributor` |
|
|
105
|
+
* | `sensors` | `Radar` |
|
|
106
|
+
* | `fuelTank` | `FuelTank` |
|
|
107
|
+
*/
|
|
108
|
+
type CoreSlotType = 'powerPlant' | 'thrusters' | 'frameShiftDrive' | 'lifeSupport' | 'powerDistributor' | 'sensors' | 'fuelTank';
|
|
109
|
+
/**
|
|
110
|
+
* The fixed mount a module is built for — {@link OutfittingModule.slot}.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* The eight core-internal mounts every hull has: the seven {@link CoreSlotType}
|
|
114
|
+
* functions plus `armour`, which is a fixed mount too but is sized per hull rather
|
|
115
|
+
* than by class, and so is not one of the seven.
|
|
116
|
+
*
|
|
117
|
+
* A module carries this when it fills one particular mount and nothing else. Most do
|
|
118
|
+
* not: a hardpoint weapon, a utility fitting and an optional internal each fit any
|
|
119
|
+
* mount of their kind that is big enough, so there is no one mount to name.
|
|
120
|
+
*
|
|
121
|
+
* Two records bend a rule each. A fuel tank bends this one — it is `fuelTank` and fits
|
|
122
|
+
* any optional slot as well, the one module built for two kinds of mount. The Guardian
|
|
123
|
+
* Hybrid power plants and distributors bend "a core module lives in `CORE_MODULES`":
|
|
124
|
+
* they carry `powerPlant` / `powerDistributor` from `INTERNAL_MODULES`, which is where
|
|
125
|
+
* Frontier's registry files them.
|
|
126
|
+
*/
|
|
127
|
+
type ModuleSlot = CoreSlotType | 'armour';
|
|
128
|
+
/**
|
|
129
|
+
* The stable identity and size shared by every hull mount.
|
|
130
|
+
*
|
|
131
|
+
* Use {@link BuildSlot} when the mount kind and its narrowed `core` or `restriction`
|
|
132
|
+
* field matter. This base is useful for consumers that only display or persist a slot
|
|
133
|
+
* key and size.
|
|
134
|
+
*/
|
|
135
|
+
interface BuildSlotBase {
|
|
136
|
+
/**
|
|
137
|
+
* Stable, journal-compatible slot key, e.g. `"PowerPlant"`, `"HugeHardpoint1"`,
|
|
138
|
+
* `"TinyHardpoint2"`, `"Slot01_Size6"`, `"Military01"`,
|
|
139
|
+
* `"PlanetaryApproachSuite"`, and on a restricted mount
|
|
140
|
+
* `"LargeMiningHardpoint1"`, `"Cargo01"`, `"LimpetController01"`,
|
|
141
|
+
* `"FighterBay01"`, `"Passenger01"`.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* This is the string every `slotKey` argument takes. It is matched
|
|
145
|
+
* **case-insensitively** and otherwise exactly — no surrounding whitespace, no
|
|
146
|
+
* abbreviation — because a SLEF producer may lower-case the game's own identifier,
|
|
147
|
+
* as the specification's own example does. Enumerate keys with
|
|
148
|
+
* `ShipLoadout.slots()` rather than typing them. Note a core {@link BuildSlot}'s
|
|
149
|
+
* `core` function name is a *different* string (`thrusters` vs the key
|
|
150
|
+
* `MainEngines`); see {@link CoreSlotType}.
|
|
151
|
+
*
|
|
152
|
+
* **Do not compute one.** The numbering looks regular and on ten hulls is
|
|
153
|
+
* not: the Anaconda's smallest optionals are `Slot13_Size2` and `Slot14_Size1`
|
|
154
|
+
* with no slots 11 or 12, the Type-9 Heavy starts at `Slot00_Size8`, the Type-7
|
|
155
|
+
* Transporter uses the number `09` twice, and the Keelback's `Slot03_Size3` sits
|
|
156
|
+
* on a size-**4** mount. Such a mount carries its own `name`; see
|
|
157
|
+
* {@link enumerateSlots}.
|
|
158
|
+
*/
|
|
159
|
+
readonly key: string;
|
|
160
|
+
/**
|
|
161
|
+
* Slot size (class). Core/optional/hardpoint slots are 1–8; utility and armour
|
|
162
|
+
* use `0` placeholders because their fit rules are not size-based, while the
|
|
163
|
+
* fixed cargo hatch uses `1`.
|
|
164
|
+
*/
|
|
165
|
+
readonly size: number;
|
|
166
|
+
}
|
|
167
|
+
/** A core-internal mount, which always names the one module function it accepts. */
|
|
168
|
+
interface CoreBuildSlot extends BuildSlotBase {
|
|
169
|
+
/** Discriminator for a core-internal mount. */
|
|
170
|
+
readonly kind: 'core';
|
|
171
|
+
/** The core module function this mount accepts. */
|
|
172
|
+
readonly core: CoreSlotType;
|
|
173
|
+
/** Core mounts are never family-restricted. */
|
|
174
|
+
readonly restriction?: never;
|
|
175
|
+
}
|
|
176
|
+
/** A weapon hardpoint, optionally restricted to a weapon family. */
|
|
177
|
+
interface HardpointBuildSlot extends BuildSlotBase {
|
|
178
|
+
/** Discriminator for a weapon hardpoint. */
|
|
179
|
+
readonly kind: 'hardpoint';
|
|
180
|
+
/** The weapon family this hardpoint requires, when restricted. */
|
|
181
|
+
readonly restriction?: HardpointRestriction;
|
|
182
|
+
/** Hardpoints never name a core module function. */
|
|
183
|
+
readonly core?: never;
|
|
184
|
+
}
|
|
185
|
+
/** An optional-internal mount, optionally restricted to a module family. */
|
|
186
|
+
interface OptionalBuildSlot extends BuildSlotBase {
|
|
187
|
+
/** Discriminator for an optional-internal mount. */
|
|
188
|
+
readonly kind: 'optional';
|
|
189
|
+
/** The module family this optional mount requires, when restricted. */
|
|
190
|
+
readonly restriction?: OptionalRestriction;
|
|
191
|
+
/** Optional internals never name a core module function. */
|
|
192
|
+
readonly core?: never;
|
|
193
|
+
}
|
|
194
|
+
/** A utility, armour, or cargo-hatch mount with no kind-specific fields. */
|
|
195
|
+
interface SimpleBuildSlot extends BuildSlotBase {
|
|
196
|
+
/** The exact simple mount kind. */
|
|
197
|
+
readonly kind: 'utility' | 'armour' | 'cargoHatch';
|
|
198
|
+
/** These mounts are never family-restricted. */
|
|
199
|
+
readonly restriction?: never;
|
|
200
|
+
/** These mounts never name a core module function. */
|
|
201
|
+
readonly core?: never;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* One mount on a hull — its stable key, kind-specific fields, and size.
|
|
205
|
+
*
|
|
206
|
+
* Checking `kind` narrows `core` and `restriction`: core mounts always name their
|
|
207
|
+
* {@link CoreSlotType}; hardpoint and optional restrictions cannot be mixed; utility,
|
|
208
|
+
* armour, and cargo-hatch mounts carry neither field.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* import { getShipSlots } from '@elite-dangerous-almanac/core/ships/ships';
|
|
213
|
+
* import { enumerateSlots } from '@elite-dangerous-almanac/core/ships/slots';
|
|
214
|
+
*
|
|
215
|
+
* const slot = enumerateSlots(getShipSlots('Anaconda')!)[0]!;
|
|
216
|
+
* if (slot.kind === 'hardpoint') {
|
|
217
|
+
* slot.restriction; // HardpointRestriction | undefined
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
type BuildSlot = CoreBuildSlot | HardpointBuildSlot | OptionalBuildSlot | SimpleBuildSlot;
|
|
222
|
+
/**
|
|
223
|
+
* The size of each of a hull's seven core-internal mounts.
|
|
224
|
+
*
|
|
225
|
+
* @remarks
|
|
226
|
+
* Each value is the mount's class (size), `1`–`8`: the largest module that fits it.
|
|
227
|
+
* Keys are the core *functions* ({@link CoreSlotType}), not journal slot keys.
|
|
228
|
+
*/
|
|
229
|
+
interface CoreSlots {
|
|
230
|
+
/** Power-plant mount size, 1–8. */
|
|
231
|
+
readonly powerPlant: number;
|
|
232
|
+
/** Thruster mount size, 1–8 (journal slot `MainEngines`). */
|
|
233
|
+
readonly thrusters: number;
|
|
234
|
+
/** Frame shift drive mount size, 1–8. */
|
|
235
|
+
readonly frameShiftDrive: number;
|
|
236
|
+
/** Life-support mount size, 1–8. */
|
|
237
|
+
readonly lifeSupport: number;
|
|
238
|
+
/** Power-distributor mount size, 1–8. */
|
|
239
|
+
readonly powerDistributor: number;
|
|
240
|
+
/** Sensor mount size, 1–8 (journal slot `Radar`). */
|
|
241
|
+
readonly sensors: number;
|
|
242
|
+
/** Main fuel-tank mount size, 1–8. */
|
|
243
|
+
readonly fuelTank: number;
|
|
244
|
+
}
|
|
245
|
+
/** One weapon hardpoint in a hull's layout. */
|
|
246
|
+
interface HardpointSlotSpec {
|
|
247
|
+
/** Mount size (class), `1` Small – `4` Huge. */
|
|
248
|
+
readonly size: number;
|
|
249
|
+
/**
|
|
250
|
+
* A restriction, if this mount only takes one family of weapons. Only the
|
|
251
|
+
* Type-11 Prospector has any; see {@link HardpointRestriction}.
|
|
252
|
+
*/
|
|
253
|
+
readonly restriction?: HardpointRestriction;
|
|
254
|
+
/**
|
|
255
|
+
* The mount's own journal slot key, when the numbering rules do not reproduce it
|
|
256
|
+
* — the Type-8 Transporter's `SmallHardpoint4`, the Caspian Explorer's
|
|
257
|
+
* out-of-order mediums. Absent when the rules are right; see
|
|
258
|
+
* {@link enumerateSlots} for which hulls carry names and why.
|
|
259
|
+
*/
|
|
260
|
+
readonly name?: string;
|
|
261
|
+
}
|
|
262
|
+
/** One optional-internal mount in a hull's layout. */
|
|
263
|
+
interface OptionalSlotSpec {
|
|
264
|
+
/** Slot size (class), 1–8. */
|
|
265
|
+
readonly size: number;
|
|
266
|
+
/**
|
|
267
|
+
* A restriction, if this mount only takes one family of modules; see
|
|
268
|
+
* {@link OptionalRestriction}.
|
|
269
|
+
*/
|
|
270
|
+
readonly restriction?: OptionalRestriction;
|
|
271
|
+
/**
|
|
272
|
+
* The mount's own journal slot key, when the numbering rules do not reproduce it
|
|
273
|
+
* — the Anaconda's `Slot14_Size1`, the Type-9 Heavy's `Slot00_Size8`, the
|
|
274
|
+
* Keelback's `Slot03_Size3`. Absent when the rules are right; see
|
|
275
|
+
* {@link enumerateSlots} for which hulls carry names and why.
|
|
276
|
+
*
|
|
277
|
+
* @remarks
|
|
278
|
+
* **The `_SizeN` in the key may disagree with {@link OptionalSlotSpec.size}**,
|
|
279
|
+
* which is always the mount's real class — the Keelback's `Slot03_Size3` names a
|
|
280
|
+
* size-4 mount. That is Frontier's own text, kept verbatim.
|
|
281
|
+
*/
|
|
282
|
+
readonly name?: string;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* A hull's full slot layout — the slot-bearing fields of a `Ship`, as `getShipSlots`
|
|
286
|
+
* returns.
|
|
287
|
+
*
|
|
288
|
+
* @remarks
|
|
289
|
+
* The armour mount is not listed here because it is not sized: a hull's armour options
|
|
290
|
+
* are ordinary modules in `CORE_MODULES`, tied to the hull by their
|
|
291
|
+
* {@link OutfittingModule.ship} field. List them with `getBulkheadsForShip`.
|
|
292
|
+
*/
|
|
293
|
+
interface ShipSlots {
|
|
294
|
+
/** Hull symbol, matching the registry's `Ship.symbol`. */
|
|
295
|
+
readonly symbol: string;
|
|
296
|
+
/** The seven core-internal sizes. */
|
|
297
|
+
readonly core: CoreSlots;
|
|
298
|
+
/** Weapon hardpoints, largest first. */
|
|
299
|
+
readonly hardpoints: readonly HardpointSlotSpec[];
|
|
300
|
+
/** Number of tiny utility mounts. */
|
|
301
|
+
readonly utility: number;
|
|
302
|
+
/** Optional-internal mounts, largest first. */
|
|
303
|
+
readonly optional: readonly OptionalSlotSpec[];
|
|
304
|
+
}
|
|
305
|
+
/** What a journal slot key says about the mount, as {@link parseSlotName} reads it. */
|
|
306
|
+
interface ParsedSlot {
|
|
307
|
+
/** Which kind of mount the key names. */
|
|
308
|
+
readonly kind: SlotKind;
|
|
309
|
+
/**
|
|
310
|
+
* Slot size (class), 1–8, or `null` when the key does not encode one and the mount
|
|
311
|
+
* has one to encode (`Radar`, `Military01`, `Cargo01`, …) — the hull's layout
|
|
312
|
+
* carries the size instead.
|
|
313
|
+
*
|
|
314
|
+
* @remarks
|
|
315
|
+
* `null` is not the only "no size here" answer. A mount whose fit rules are not
|
|
316
|
+
* size-based reads `0` rather than `null` — `TinyHardpoint1` and `Armour` both do,
|
|
317
|
+
* matching the `size` on a {@link BuildSlot} — and `CargoHatch` reads `1`. So test
|
|
318
|
+
* `parsed.size` for falsiness, or against the {@link ParsedSlot.kind} you expect;
|
|
319
|
+
* `=== null` alone treats a utility mount as a sized slot.
|
|
320
|
+
*/
|
|
321
|
+
readonly size: number | null;
|
|
322
|
+
/**
|
|
323
|
+
* The restriction the key implies (`Military01` → `military`,
|
|
324
|
+
* `LargeMiningHardpoint1` → `mining`). Frontier gives every restricted mount its
|
|
325
|
+
* own journal name, so a key alone is enough to tell.
|
|
326
|
+
*/
|
|
327
|
+
readonly restriction?: SlotRestriction;
|
|
328
|
+
/** For a core key, the core function it fills (`MainEngines` → `thrusters`). */
|
|
329
|
+
readonly core?: CoreSlotType;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Expand a hull's {@link ShipSlots} layout into keyed {@link BuildSlot}s, in
|
|
333
|
+
* outfitting-panel order: hardpoints, utility mounts, armour, the seven core
|
|
334
|
+
* internals, then the optional internals, then the cargo hatch.
|
|
335
|
+
*
|
|
336
|
+
* The keys are journal-compatible, so the same key identifies a mount whether the
|
|
337
|
+
* build was assembled from scratch or loaded from a SLEF export — SLEF being the
|
|
338
|
+
* journal's own `Loadout` event in an envelope, its `Slot` strings are these.
|
|
339
|
+
*
|
|
340
|
+
* @param layout - The hull's slot layout.
|
|
341
|
+
* @returns Every mount the hull offers, as {@link BuildSlot}s.
|
|
342
|
+
* @remarks
|
|
343
|
+
* Unrestricted optionals are numbered `Slot01_SizeN`, `Slot02_SizeN`, … with no gaps,
|
|
344
|
+
* and hardpoints `1, 2, 3` within each size class. **Ten hulls disagree**, and no
|
|
345
|
+
* rule derives what they do instead, so a mount on one of them carries its own
|
|
346
|
+
* {@link OptionalSlotSpec.name} / {@link HardpointSlotSpec.name} and that wins:
|
|
347
|
+
*
|
|
348
|
+
* | Hull | What the game names it |
|
|
349
|
+
* | --- | --- |
|
|
350
|
+
* | Anaconda | `Slot13_Size2`, `Slot14_Size1` — no 11 or 12 |
|
|
351
|
+
* | Type-9 Heavy | starts at `Slot00_Size8`; then jumps `Slot08` → `Slot11` |
|
|
352
|
+
* | Type-10 Defender, Federal Dropship, Vulture | a gap before the last mounts |
|
|
353
|
+
* | Type-7 Transporter | the number `09` twice, and five suffixes misreport the size |
|
|
354
|
+
* | Keelback, Asp Scout | one suffix misreports the size |
|
|
355
|
+
* | Type-8 Transporter | `SmallHardpoint2` then `SmallHardpoint4` |
|
|
356
|
+
* | Caspian Explorer | mediums run `6, 5, 1, 2, 3, 4` — out of order, not just gapped |
|
|
357
|
+
*
|
|
358
|
+
* The Panther Clipper Mk II, Type-11 Prospector and Lynx Highliner also carry explicit
|
|
359
|
+
* names that match the derived keys. The Lynx's `Slot02_Size5` follows three
|
|
360
|
+
* `PassengerNN` mounts because a restricted `passenger` mount consumes no `SlotNN`
|
|
361
|
+
* number.
|
|
362
|
+
* A hull that names any mount of a kind names all of them, so a derived key and a name
|
|
363
|
+
* never compete for the same string.
|
|
364
|
+
* @example
|
|
365
|
+
* ```ts
|
|
366
|
+
* import { getShipSlots } from '@elite-dangerous-almanac/core/ships/ships';
|
|
367
|
+
* import { enumerateSlots } from '@elite-dangerous-almanac/core/ships/slots';
|
|
368
|
+
*
|
|
369
|
+
* enumerateSlots(getShipSlots('Anaconda')!).filter((s) => s.kind === 'hardpoint');
|
|
370
|
+
* // -> [{ key: 'HugeHardpoint1', size: 4, ... }, { key: 'LargeHardpoint1', size: 3, ... }, ...]
|
|
371
|
+
* enumerateSlots(getShipSlots('Anaconda')!)
|
|
372
|
+
* .filter((s) => s.kind === 'optional' && !s.restriction)
|
|
373
|
+
* .at(-1)?.key; // -> 'Slot14_Size1', not 'Slot12_Size1'
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
declare function enumerateSlots(layout: ShipSlots): BuildSlot[];
|
|
377
|
+
/**
|
|
378
|
+
* Classify a journal slot name — the `Slot` field of a SLEF/journal module — into a
|
|
379
|
+
* {@link ParsedSlot}.
|
|
380
|
+
*
|
|
381
|
+
* @param slot - The journal slot name, e.g. `"FrameShiftDrive"`, `"MediumHardpoint2"`,
|
|
382
|
+
* `"Slot03_Size5"`, `"Military01"`, `"LargeMiningHardpoint1"`. Matched
|
|
383
|
+
* **case-insensitively** — see the remarks.
|
|
384
|
+
* @returns The classification, or `null` if the name is not a recognised slot. `size`
|
|
385
|
+
* is `null` for names that do not encode a size (a bare `Military01`).
|
|
386
|
+
* @remarks
|
|
387
|
+
* Every restricted mount has a journal name of its own, so the restriction is read
|
|
388
|
+
* off the name and needs no hull layout. The size still may: `Cargo01` says only
|
|
389
|
+
* that the mount takes cargo, and `getShipSlots` carries how big it is.
|
|
390
|
+
*
|
|
391
|
+
* **Casing is not significant.** Frontier writes `FrameShiftDrive`, but a SLEF
|
|
392
|
+
* producer may lower-case every slot key as the specification's own example does —
|
|
393
|
+
* Inara writes `powerplant` and `largemininghardpoint1` — and both name the same
|
|
394
|
+
* mount. The returned `core` and `restriction` values keep this library's own
|
|
395
|
+
* camelCase spelling whatever the input looked like.
|
|
396
|
+
*
|
|
397
|
+
* **A `_SizeN` suffix is what the name says, not what the mount is.** On three hulls
|
|
398
|
+
* the game's own key disagrees with the mount it names — the Keelback's
|
|
399
|
+
* `Slot03_Size3` is a size-4 mount, the Asp Scout's `Slot01_Size4` a size-5 one, and
|
|
400
|
+
* five of the Type-7 Transporter's ten are off. To size a mount, find it in the hull's
|
|
401
|
+
* layout ({@link enumerateSlots}) rather than trusting the number returned here.
|
|
402
|
+
* @throws {TypeError} If `slot` is present and not a string. A nullish `slot` is a miss,
|
|
403
|
+
* answered the way an unrecognised key is.
|
|
404
|
+
* @example
|
|
405
|
+
* ```ts
|
|
406
|
+
* import { parseSlotName } from '@elite-dangerous-almanac/core/ships/slots';
|
|
407
|
+
*
|
|
408
|
+
* parseSlotName('Slot03_Size5'); // -> { kind: 'optional', size: 5 }
|
|
409
|
+
* parseSlotName('HugeHardpoint1'); // -> { kind: 'hardpoint', size: 4 }
|
|
410
|
+
* parseSlotName('LargeMiningHardpoint1');
|
|
411
|
+
* // -> { kind: 'hardpoint', size: 3, restriction: 'mining' }
|
|
412
|
+
* parseSlotName('Radar'); // -> { kind: 'core', size: null, core: 'sensors' }
|
|
413
|
+
* parseSlotName('powerplant'); // -> { kind: 'core', size: null, core: 'powerPlant' }
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
declare function parseSlotName(slot: string): ParsedSlot | null;
|
|
417
|
+
|
|
418
|
+
export { type BuildSlot, type BuildSlotBase, type CoreBuildSlot, type CoreSlotType, type CoreSlots, type HardpointBuildSlot, type HardpointRestriction, type HardpointSlotSpec, type ModuleSlot, type OptionalBuildSlot, type OptionalRestriction, type OptionalSlotSpec, type ParsedSlot, SLOT_RESTRICTION_LABELS, type ShipSlots, type SimpleBuildSlot, type SlotKind, type SlotRestriction, enumerateSlots, parseSlotName };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{SLOT_RESTRICTION_LABELS,enumerateSlots,parseSlotName}from"../chunk-I7PIDRMU.js"; //# sourceMappingURL=slots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { LoadoutEvent } from './slef.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Frozen purchase snapshots and pure queries for credit figures carried by a journal
|
|
5
|
+
* `Loadout` event or SLEF export.
|
|
6
|
+
*
|
|
7
|
+
* A capture preserves figures from one commander's purchase history. They can combine
|
|
8
|
+
* station discounts, omit bought modules, and disagree with their own totals, so they
|
|
9
|
+
* remain separate from the catalogue-retail figures calculated for a live build.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** One slot's captured purchase price, exactly as the source stated it. */
|
|
15
|
+
interface SourceModuleValue {
|
|
16
|
+
/** The slot key, in the source's own spelling. */
|
|
17
|
+
readonly slot: string;
|
|
18
|
+
/** The module symbol, in the source's own casing. */
|
|
19
|
+
readonly item: string;
|
|
20
|
+
/** What the source says was paid for that module, in credits. */
|
|
21
|
+
readonly value: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An immutable snapshot of the credit figures carried by one captured loadout.
|
|
25
|
+
*
|
|
26
|
+
* Every top-level figure can be `null`: absence means the source stated no value, not
|
|
27
|
+
* that the hull or modules were free. Likewise, {@link moduleValues} contains only
|
|
28
|
+
* individually priced slots. The snapshot remains unchanged when its owning
|
|
29
|
+
* {@link ShipLoadout} is edited because it describes the source capture, not the live
|
|
30
|
+
* fit.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
|
|
35
|
+
* import {
|
|
36
|
+
* getSourceModuleValue,
|
|
37
|
+
* sumSourceModuleValues,
|
|
38
|
+
* } from '@elite-dangerous-almanac/core/ships/source-purchase';
|
|
39
|
+
*
|
|
40
|
+
* declare const slefJson: string;
|
|
41
|
+
*
|
|
42
|
+
* const build = ShipLoadout.fromSlef(slefJson);
|
|
43
|
+
* const paid = build.sourcePurchase;
|
|
44
|
+
* if (paid) {
|
|
45
|
+
* paid.hullValue; // captured hull price, or null
|
|
46
|
+
* getSourceModuleValue(paid, 'PowerPlant')?.value; // captured slot price
|
|
47
|
+
* sumSourceModuleValues(paid); // sum of individually priced modules
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
interface SourcePurchaseRecord {
|
|
52
|
+
/** Hull cost in credits as the source stated it, or `null` if it stated none. */
|
|
53
|
+
readonly hullValue: number | null;
|
|
54
|
+
/** Fitted-module cost in credits as the source stated it, or `null` if absent. */
|
|
55
|
+
readonly modulesValue: number | null;
|
|
56
|
+
/** Insurance rebuy in credits as the source stated it, or `null` if absent. */
|
|
57
|
+
readonly rebuy: number | null;
|
|
58
|
+
/** Individually priced slots, in capture order; unpriced slots are absent. */
|
|
59
|
+
readonly moduleValues: readonly SourceModuleValue[];
|
|
60
|
+
/** Total modules listed by the capture, including entries with no price. */
|
|
61
|
+
readonly moduleCount: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Capture the purchase figures from a journal `Loadout` event or SLEF data object.
|
|
65
|
+
*
|
|
66
|
+
* @param event - Source event to snapshot. No object in it is retained by reference.
|
|
67
|
+
* @returns A deeply frozen record, or `null` when the source states no credit figure at
|
|
68
|
+
* all.
|
|
69
|
+
* @remarks
|
|
70
|
+
* A malformed event that repeats an exactly spelled slot keeps the last entry.
|
|
71
|
+
* {@link ShipLoadout.fromLoadout} independently rejects duplicate mounts before
|
|
72
|
+
* constructing a usable build.
|
|
73
|
+
*
|
|
74
|
+
* No discount is inferred. One capture can mix purchases from several stations, omit
|
|
75
|
+
* module values, or state a total that differs from its priced parts. The snapshot keeps
|
|
76
|
+
* those facts visible instead of inventing one misleading percentage.
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* import type { LoadoutEvent } from '@elite-dangerous-almanac/core/ships/slef';
|
|
80
|
+
* import { sourcePurchaseFromLoadout } from '@elite-dangerous-almanac/core/ships/source-purchase';
|
|
81
|
+
*
|
|
82
|
+
* declare const event: LoadoutEvent;
|
|
83
|
+
* const paid = sourcePurchaseFromLoadout(event);
|
|
84
|
+
* paid?.rebuy; // captured rebuy, or null
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
declare function sourcePurchaseFromLoadout(event: LoadoutEvent): SourcePurchaseRecord | null;
|
|
88
|
+
/**
|
|
89
|
+
* Find the captured purchase entry for one slot.
|
|
90
|
+
*
|
|
91
|
+
* @param record - Purchase snapshot to query.
|
|
92
|
+
* @param slotKey - Slot key such as `"PowerPlant"`. An exact spelling wins; otherwise
|
|
93
|
+
* matching is case-insensitive so journal and lower-cased SLEF keys interoperate.
|
|
94
|
+
* @returns The frozen entry, or `null` when the source priced no module in that slot.
|
|
95
|
+
* `null` never means the module was free.
|
|
96
|
+
* @throws {TypeError} If `slotKey` is present and not a string. A nullish `slotKey` is a
|
|
97
|
+
* miss, answered the way a slot the source did not price is.
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import {
|
|
101
|
+
* getSourceModuleValue,
|
|
102
|
+
* type SourcePurchaseRecord,
|
|
103
|
+
* } from '@elite-dangerous-almanac/core/ships/source-purchase';
|
|
104
|
+
*
|
|
105
|
+
* declare const paid: SourcePurchaseRecord;
|
|
106
|
+
* getSourceModuleValue(paid, 'FrameShiftDrive')?.value; // captured credits
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function getSourceModuleValue(record: SourcePurchaseRecord, slotKey: string): SourceModuleValue | null;
|
|
110
|
+
/**
|
|
111
|
+
* Sum every per-slot price that the source stated.
|
|
112
|
+
*
|
|
113
|
+
* @param record - Purchase snapshot whose individually priced entries to add.
|
|
114
|
+
* @returns The stated total in credits, or `0` when no module was individually priced.
|
|
115
|
+
* @remarks
|
|
116
|
+
* This is deliberately not a replacement for {@link SourcePurchaseRecord.modulesValue}.
|
|
117
|
+
* A capture may omit individual prices or publish an inconsistent total; comparing the
|
|
118
|
+
* two is useful precisely because this function does not hide that discrepancy.
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* import {
|
|
122
|
+
* sumSourceModuleValues,
|
|
123
|
+
* type SourcePurchaseRecord,
|
|
124
|
+
* } from '@elite-dangerous-almanac/core/ships/source-purchase';
|
|
125
|
+
*
|
|
126
|
+
* declare const paid: SourcePurchaseRecord;
|
|
127
|
+
* const partsAgree = paid.modulesValue === sumSourceModuleValues(paid);
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
declare function sumSourceModuleValues(record: SourcePurchaseRecord): number;
|
|
131
|
+
|
|
132
|
+
export { type SourceModuleValue, type SourcePurchaseRecord, getSourceModuleValue, sourcePurchaseFromLoadout, sumSourceModuleValues };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{getSourceModuleValue,sourcePurchaseFromLoadout,sumSourceModuleValues}from"../chunk-QTDBO7R2.js"; //# sourceMappingURL=source-purchase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|