@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,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **SLEF** — the Ship Loadout Export Format — types, a strict parser and a tolerant
|
|
3
|
+
* inspector.
|
|
4
|
+
*
|
|
5
|
+
* SLEF is the community interchange format for a fitted ship, used by EDSY,
|
|
6
|
+
* Coriolis, Inara and others. It is nothing more than the game journal's `Loadout`
|
|
7
|
+
* event wrapped in an envelope that records which app exported it:
|
|
8
|
+
*
|
|
9
|
+
* ```json
|
|
10
|
+
* [{ "header": { "appName": "EDSY", "appVersion": "..." },
|
|
11
|
+
* "data": { "event": "Loadout", "Ship": "explorer_nx", "Modules": [ ... ] } }]
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The top level is an **array** so several builds can travel together. This module
|
|
15
|
+
* is **data-free** — just the record shapes, {@link parseSlef} / {@link getLoadoutModifier}
|
|
16
|
+
* to read, and {@link toSlef} / {@link stringifySlef} to write. To turn a parsed build
|
|
17
|
+
* into jump-range and fuel numbers, or to produce the `Loadout` event {@link toSlef}
|
|
18
|
+
* wraps, hand it to {@link ShipLoadout} (`./ship-loadout`).
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const build = ShipLoadout.fromSlef(exported); // in
|
|
22
|
+
* const text = stringifySlef(
|
|
23
|
+
* build.toSlef({ header: { appName: 'MyApp', appVersion: '1.0.0' } }),
|
|
24
|
+
* ); // and back out
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* Reference: the Inara SLEF specification, <https://inara.cz/elite/inara-impexp-slef/>.
|
|
28
|
+
*
|
|
29
|
+
* @packageDocumentation
|
|
30
|
+
*/
|
|
31
|
+
/** The envelope header — which app produced the export. */
|
|
32
|
+
interface SlefHeader {
|
|
33
|
+
/** Exporting app's name, e.g. `"EDSY"`. */
|
|
34
|
+
readonly appName: string;
|
|
35
|
+
/**
|
|
36
|
+
* Exporting app's version. The spec calls for a string; some apps emit a
|
|
37
|
+
* number, so both are accepted.
|
|
38
|
+
*/
|
|
39
|
+
readonly appVersion: string | number;
|
|
40
|
+
/** A link back to the build in the exporting app, when given. */
|
|
41
|
+
readonly appURL?: string;
|
|
42
|
+
/** App-specific extra fields, when given. */
|
|
43
|
+
readonly appCustomProperties?: Readonly<Record<string, unknown>>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One engineering modifier — how a blueprint changed a single stat.
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* `Value` is the post-engineering figure, `OriginalValue` the stock one. Some
|
|
50
|
+
* modifiers carry a string (`ValueStr`) instead of a number — generated Anti-Guardian
|
|
51
|
+
* Zone Resistance uses `"Active"`. **Do not trust `LessIsGood`** — Frontier is known to
|
|
52
|
+
* set it wrongly for some stats; decide a stat's direction yourself.
|
|
53
|
+
*/
|
|
54
|
+
interface EngineeringModifier {
|
|
55
|
+
/** The stat's journal name, e.g. `"FSDOptimalMass"`, `"Mass"`, `"PowerDraw"`. */
|
|
56
|
+
readonly Label: string;
|
|
57
|
+
/** The modified value, when the stat is numeric. */
|
|
58
|
+
readonly Value?: number;
|
|
59
|
+
/** The stock value before engineering, when the stat is numeric. */
|
|
60
|
+
readonly OriginalValue?: number;
|
|
61
|
+
/** A string-valued modifier's value (rare; used for non-numeric stats). */
|
|
62
|
+
readonly ValueStr?: string;
|
|
63
|
+
/** `1` if a lower value is better — unreliable; see the remark above. */
|
|
64
|
+
readonly LessIsGood?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The durable engineering applied to one module.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* A journal capture may also name `Engineer`, `EngineerID` and `BlueprintID`.
|
|
71
|
+
* They are deliberately outside this type: the engineer fields record who applied a
|
|
72
|
+
* modification, while the numeric blueprint id is redundant with {@link BlueprintName};
|
|
73
|
+
* none changes the fitted module. {@link ShipLoadout.fromLoadout} therefore drops them
|
|
74
|
+
* and subsequent loadout/SLEF exports never write them.
|
|
75
|
+
*/
|
|
76
|
+
interface ModuleEngineering {
|
|
77
|
+
/** The blueprint's journal name, e.g. `"FSD_LongRange"`. */
|
|
78
|
+
readonly BlueprintName: string;
|
|
79
|
+
/** The blueprint grade, 1–5. */
|
|
80
|
+
readonly Level: number;
|
|
81
|
+
/** The roll quality, 0–1. */
|
|
82
|
+
readonly Quality: number;
|
|
83
|
+
/** The experimental effect's journal name, when one is applied. */
|
|
84
|
+
readonly ExperimentalEffect?: string;
|
|
85
|
+
/** The experimental effect's display name, when present. */
|
|
86
|
+
readonly ExperimentalEffect_Localised?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Every stat this engineering changed.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* **Optional.** A journal `Loadout` event always writes it, but SLEF requires only
|
|
92
|
+
* `BlueprintName`, `Level` and `Quality` — the specification's own example omits it —
|
|
93
|
+
* so an export from another app may name the blueprint and its roll without spelling
|
|
94
|
+
* out the resulting stats. Treat a missing array as "not stated", not as "nothing was
|
|
95
|
+
* changed": the blueprint's effect can be recomputed with `computeModifiers` from
|
|
96
|
+
* `./engineering`.
|
|
97
|
+
*/
|
|
98
|
+
readonly Modifiers?: readonly EngineeringModifier[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* One fitted module in a `Loadout` event.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* **Ammunition state is not carried.** A journal writes `AmmoInClip` and `AmmoInHopper`
|
|
105
|
+
* on every weapon that takes ammunition; both are dropped on import and never written
|
|
106
|
+
* back out, because they are the ship's rearm state at the instant of capture rather than
|
|
107
|
+
* part of the build — the same reason a re-export recomputes a build's credit figures by
|
|
108
|
+
* default instead of echoing the ones the capture carried. What a fitted weapon *can*
|
|
109
|
+
* hold is a property of the build, and `./ammunition` answers it: `ammunitionCapacity`,
|
|
110
|
+
* or `FittedModule.ammunition` for a fitted one, post-engineering.
|
|
111
|
+
*/
|
|
112
|
+
interface LoadoutModule {
|
|
113
|
+
/** The slot it occupies, e.g. `"FrameShiftDrive"`, `"Slot07_Size5"`. */
|
|
114
|
+
readonly Slot: string;
|
|
115
|
+
/** The module's internal id, e.g. `"int_hyperdrive_size5_class5"` (lower-cased). */
|
|
116
|
+
readonly Item: string;
|
|
117
|
+
/** Whether the module is powered on. Absent means on. */
|
|
118
|
+
readonly On?: boolean;
|
|
119
|
+
/** The module's power-priority group (0–4). */
|
|
120
|
+
readonly Priority?: number;
|
|
121
|
+
/** Module health, 0–1. */
|
|
122
|
+
readonly Health?: number;
|
|
123
|
+
/**
|
|
124
|
+
* What the capture says was paid for this module, in credits — net of whatever
|
|
125
|
+
* discount its owner had, and not the catalogue's list price. Absent where the
|
|
126
|
+
* capture said nothing, which is not the same as free.
|
|
127
|
+
* `ShipLoadout.sourcePurchase` keeps these figures as a stable record; the library's
|
|
128
|
+
* own exports quote list price.
|
|
129
|
+
*/
|
|
130
|
+
readonly Value?: number;
|
|
131
|
+
/** Engineering, present only when the module is modified. */
|
|
132
|
+
readonly Engineering?: ModuleEngineering;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* A journal `Loadout` event — the `data` half of a SLEF entry.
|
|
136
|
+
*
|
|
137
|
+
* @remarks
|
|
138
|
+
* Only `Ship` and `Modules` are strictly required by SLEF; every other field is
|
|
139
|
+
* optional. Masses are in tonnes, ranges in light-years, values in credits.
|
|
140
|
+
*
|
|
141
|
+
* `timestamp`, `ShipID`, `HullHealth` and `Hot` are deliberately outside the durable
|
|
142
|
+
* loadout shape. They describe the capture or the ship instance/state rather than its
|
|
143
|
+
* fit, so {@link ShipLoadout.fromLoadout} drops them and subsequent loadout/SLEF exports
|
|
144
|
+
* never write them. A tolerant parse still accepts an input object carrying those keys.
|
|
145
|
+
*/
|
|
146
|
+
interface LoadoutEvent {
|
|
147
|
+
/** Always `"Loadout"`. */
|
|
148
|
+
readonly event?: string;
|
|
149
|
+
/** The hull's internal id, e.g. `"explorer_nx"` (lower-cased). */
|
|
150
|
+
readonly Ship: string;
|
|
151
|
+
/** The player-given ship name. */
|
|
152
|
+
readonly ShipName?: string;
|
|
153
|
+
/** The player-given ship ID plate. */
|
|
154
|
+
readonly ShipIdent?: string;
|
|
155
|
+
/** Hull cost in credits. */
|
|
156
|
+
readonly HullValue?: number;
|
|
157
|
+
/** Fitted-modules cost in credits. */
|
|
158
|
+
readonly ModulesValue?: number;
|
|
159
|
+
/** Hull + modules mass with an empty tank and no cargo, in tonnes. */
|
|
160
|
+
readonly UnladenMass?: number;
|
|
161
|
+
/** Cargo rack capacity, in tonnes. */
|
|
162
|
+
readonly CargoCapacity?: number;
|
|
163
|
+
/** The exporter's own best single-jump range, in light-years. */
|
|
164
|
+
readonly MaxJumpRange?: number;
|
|
165
|
+
/** Fuel-tank capacities, in tonnes. */
|
|
166
|
+
readonly FuelCapacity?: {
|
|
167
|
+
readonly Main: number;
|
|
168
|
+
readonly Reserve: number;
|
|
169
|
+
};
|
|
170
|
+
/** Insurance rebuy cost in credits. */
|
|
171
|
+
readonly Rebuy?: number;
|
|
172
|
+
/** Every fitted module. */
|
|
173
|
+
readonly Modules: readonly LoadoutModule[];
|
|
174
|
+
}
|
|
175
|
+
/** One `{ header, data }` pair in a SLEF export. */
|
|
176
|
+
interface SlefEntry {
|
|
177
|
+
/** Which app produced this entry. */
|
|
178
|
+
readonly header: SlefHeader;
|
|
179
|
+
/** The fitted-ship loadout. */
|
|
180
|
+
readonly data: LoadoutEvent;
|
|
181
|
+
}
|
|
182
|
+
/** A whole SLEF export — one or more {@link SlefEntry entries}. */
|
|
183
|
+
type Slef = readonly SlefEntry[];
|
|
184
|
+
/** Stable machine-readable reason an entry was rejected. */
|
|
185
|
+
type SlefDiagnosticCode = 'invalidHeader' | 'invalidLoadout' | 'invalidModule' | 'invalidEngineering' | 'duplicateSlot';
|
|
186
|
+
/** One entry rejected by {@link inspectSlef}. */
|
|
187
|
+
interface SlefDiagnostic {
|
|
188
|
+
/** Zero-based entry index in the top-level array. */
|
|
189
|
+
readonly index: number;
|
|
190
|
+
/** Stable machine-readable category. */
|
|
191
|
+
readonly code: SlefDiagnosticCode;
|
|
192
|
+
/** Property path to the rejected value, including entry and module indexes. */
|
|
193
|
+
readonly path: string;
|
|
194
|
+
/** Human-readable reason the entry was rejected. */
|
|
195
|
+
readonly message: string;
|
|
196
|
+
}
|
|
197
|
+
/** Tolerant SLEF inspection result. */
|
|
198
|
+
interface SlefInspection {
|
|
199
|
+
/** Valid entries, retaining their input order. */
|
|
200
|
+
readonly entries: readonly SlefEntry[];
|
|
201
|
+
/** Rejected entries, retaining their input order. */
|
|
202
|
+
readonly diagnostics: readonly SlefDiagnostic[];
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Inspect a potentially mixed SLEF payload without silently losing malformed entries.
|
|
206
|
+
*
|
|
207
|
+
* @param input - A JSON string, SLEF envelope/array, or bare `Loadout` event.
|
|
208
|
+
* @returns Every valid entry and an indexed diagnostic for every rejected entry.
|
|
209
|
+
* @throws {SyntaxError} If a string is not valid JSON.
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* import { inspectSlef } from '@elite-dangerous-almanac/core/ships/slef';
|
|
213
|
+
*
|
|
214
|
+
* const result = inspectSlef([{ Ship: 'sidewinder', Modules: [{ Slot: 'PowerPlant' }] }]);
|
|
215
|
+
* result.diagnostics[0]?.path; // -> 'entries[0].Modules[0].Item'
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
declare function inspectSlef(input: unknown): SlefInspection;
|
|
219
|
+
/**
|
|
220
|
+
* Parse a SLEF export into its entries.
|
|
221
|
+
*
|
|
222
|
+
* @param input - Either the SLEF JSON **string** or an already-parsed object.
|
|
223
|
+
* Accepted shapes, in order of leniency:
|
|
224
|
+
* - the standard array `[{ header, data }, ...]`;
|
|
225
|
+
* - a single `{ header, data }` object;
|
|
226
|
+
* - a bare journal `Loadout` event (`{ Ship, Modules, ... }`) — wrapped in an entry
|
|
227
|
+
* with an empty synthetic header.
|
|
228
|
+
* Every returned header, loadout, module and engineering modifier is runtime-checked
|
|
229
|
+
* against the public record shape. Parsing is strict: one malformed entry rejects the
|
|
230
|
+
* whole payload. Use {@link inspectSlef} to recover valid entries from a mixed payload.
|
|
231
|
+
* @returns The entries, in export order — never empty (a parse that finds no valid
|
|
232
|
+
* entry throws instead).
|
|
233
|
+
* @throws {SyntaxError} If `input` is a string that is not valid JSON.
|
|
234
|
+
* @throws {TypeError} If the payload is empty or any entry, header, loadout, module or
|
|
235
|
+
* engineering field is malformed.
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* import { parseSlef } from '@elite-dangerous-almanac/core/ships/slef';
|
|
239
|
+
*
|
|
240
|
+
* declare const slefJsonString: string;
|
|
241
|
+
*
|
|
242
|
+
* const [entry] = parseSlef(slefJsonString);
|
|
243
|
+
* entry?.data.Ship; // -> 'explorer_nx'
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
declare function parseSlef(input: unknown): SlefEntry[];
|
|
247
|
+
/** Options for {@link stringifySlef}. */
|
|
248
|
+
interface SlefStringifyOptions {
|
|
249
|
+
/**
|
|
250
|
+
* Spaces per indent level. `0` — the default — emits compact JSON, which is what
|
|
251
|
+
* the clipboard-and-paste exchange these exports travel by wants.
|
|
252
|
+
*/
|
|
253
|
+
readonly indent?: number;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Wrap one or more loadouts in SLEF envelopes.
|
|
257
|
+
*
|
|
258
|
+
* @param data - A single `Loadout` event or several. Several travel in one export as
|
|
259
|
+
* separate entries, which is what the format's array top level is for.
|
|
260
|
+
* @param header - Which exporting app to credit. SLEF attribution belongs to the
|
|
261
|
+
* application producing the export, so callers must provide its name and version.
|
|
262
|
+
* @returns The export, one entry per loadout, in the order given.
|
|
263
|
+
* @throws {TypeError} If `data` is empty, or the header or any loadout does not match
|
|
264
|
+
* the record shape. Every entry is checked with the same guards {@link parseSlef}
|
|
265
|
+
* applies, so anything this returns is guaranteed to parse back.
|
|
266
|
+
* @example
|
|
267
|
+
* ```ts
|
|
268
|
+
* import type { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
|
|
269
|
+
* import { stringifySlef, toSlef } from '@elite-dangerous-almanac/core/ships/slef';
|
|
270
|
+
*
|
|
271
|
+
* declare const build: ShipLoadout;
|
|
272
|
+
*
|
|
273
|
+
* const slef = toSlef(build.toLoadoutEvent(), { appName: 'MyApp', appVersion: '1.2.0' });
|
|
274
|
+
* stringifySlef(slef); // -> '[{"header":{...},"data":{...}}]'
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
declare function toSlef(data: LoadoutEvent | readonly LoadoutEvent[], header: SlefHeader): Slef;
|
|
278
|
+
/**
|
|
279
|
+
* Serialise a SLEF export to its JSON string.
|
|
280
|
+
*
|
|
281
|
+
* @param slef - The entries, as {@link toSlef} returns them.
|
|
282
|
+
* @param options - Formatting. Compact by default.
|
|
283
|
+
* @returns The JSON text.
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* import { stringifySlef } from '@elite-dangerous-almanac/core/ships/slef';
|
|
287
|
+
* import type { Slef } from '@elite-dangerous-almanac/core/ships/slef';
|
|
288
|
+
*
|
|
289
|
+
* declare const slef: Slef;
|
|
290
|
+
*
|
|
291
|
+
* stringifySlef(slef, { indent: 2 }); // human-readable, for writing to a file
|
|
292
|
+
* ```
|
|
293
|
+
*/
|
|
294
|
+
declare function stringifySlef(slef: Slef, options?: SlefStringifyOptions): string;
|
|
295
|
+
/**
|
|
296
|
+
* Read one engineering modifier off a module by its journal label.
|
|
297
|
+
*
|
|
298
|
+
* @param module - The fitted module.
|
|
299
|
+
* @param label - The stat's journal name, e.g. `"FSDOptimalMass"`. Matched
|
|
300
|
+
* case-insensitively.
|
|
301
|
+
* @returns The modifier's numeric `Value`, or `null` if the module is not
|
|
302
|
+
* engineered, states no modifiers at all, carries no such modifier, or the modifier is
|
|
303
|
+
* non-numeric.
|
|
304
|
+
* @throws {TypeError} If `label` is present and not a string. A nullish
|
|
305
|
+
* `label` is a miss, answered the way an unrecognised one is.
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* import { getLoadoutModifier } from '@elite-dangerous-almanac/core/ships/slef';
|
|
309
|
+
* import type { LoadoutModule } from '@elite-dangerous-almanac/core/ships/slef';
|
|
310
|
+
*
|
|
311
|
+
* declare const fsdModule: LoadoutModule;
|
|
312
|
+
*
|
|
313
|
+
* getLoadoutModifier(fsdModule, 'FSDOptimalMass'); // -> 7528.04, or null if stock
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
declare function getLoadoutModifier(module: LoadoutModule, label: string): number | null;
|
|
317
|
+
|
|
318
|
+
export { type EngineeringModifier, type LoadoutEvent, type LoadoutModule, type ModuleEngineering, type Slef, type SlefDiagnostic, type SlefDiagnosticCode, type SlefEntry, type SlefHeader, type SlefInspection, type SlefStringifyOptions, getLoadoutModifier, inspectSlef, parseSlef, stringifySlef, toSlef };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{getLoadoutModifier,inspectSlef,parseSlef,stringifySlef,toSlef}from"../chunk-R4OD62HV.js"; //# sourceMappingURL=slef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|