@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,228 @@
|
|
|
1
|
+
import { SystemNameParts } from './system-name.js';
|
|
2
|
+
import { G as GalacticPosition } from '../galactic-position-shLkm4Qg.js';
|
|
3
|
+
import { SystemAddressInput } from './system-address-input.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* {@link ProceduralSystem} — an immutable handle on a procedurally named Elite
|
|
7
|
+
* Dangerous system.
|
|
8
|
+
*
|
|
9
|
+
* This is a thin value object over the pure functions in this folder. Construct
|
|
10
|
+
* one from a name or a system address; read its canonical name, naming region, mass
|
|
11
|
+
* code, position and addresses back. Consumers who only need one calculation
|
|
12
|
+
* can import the underlying function directly and skip the class entirely — the
|
|
13
|
+
* algorithms do not live here, only the glue that composes them (including the
|
|
14
|
+
* hand-authored-sector override, which needs the sector, region-origin and
|
|
15
|
+
* HA-sphere lookups together).
|
|
16
|
+
*
|
|
17
|
+
* @packageDocumentation
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An Elite Dangerous star system, identified by its procedural name and/or
|
|
22
|
+
* system address. Hand-named systems such as Sol are deliberately outside this type.
|
|
23
|
+
*
|
|
24
|
+
* Instances are immutable. The normal system address is validated and computed by the
|
|
25
|
+
* factory, so reading a successfully constructed system never throws; the modulated
|
|
26
|
+
* form is `null` when its narrower sequence field cannot represent the system.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* **Failure model** — factory failures are deliberately
|
|
30
|
+
* split by cause:
|
|
31
|
+
* - {@link ProceduralSystem.fromName} returns `null` for a string that is not a
|
|
32
|
+
* well-formed system name (a parsing outcome, not an error).
|
|
33
|
+
* - {@link ProceduralSystem.fromSystemAddress} / {@link ProceduralSystem.fromModSystemAddress}
|
|
34
|
+
* throw `RangeError` for an `id64` outside the unsigned 64-bit range or one
|
|
35
|
+
* whose sector-grid slot has no assigned procedural name.
|
|
36
|
+
* - {@link ProceduralSystem.fromModSystemAddress} also throws `RangeError` when the
|
|
37
|
+
* modulated layout's sequence cannot fit the normal layout. Every constructed
|
|
38
|
+
* instance guarantees a normal {@link ProceduralSystem.systemAddress}.
|
|
39
|
+
* - {@link ProceduralSystem.fromName} throws `RangeError` immediately when a
|
|
40
|
+
* syntactically valid name cannot be encoded (unknown naming region, or an address
|
|
41
|
+
* field out of range).
|
|
42
|
+
* - {@link ProceduralSystem.fromName} throws `TypeError` when `name` is not a string at
|
|
43
|
+
* all, a missing one included — that is a caller bug, not a name the scheme does not
|
|
44
|
+
* cover, so it is not reported as `null`.
|
|
45
|
+
*
|
|
46
|
+
* For the galactic codex region of a system, pass its address to the standalone
|
|
47
|
+
* `findCodexRegionForBoxel` (from `./codex-region-lookup`) — kept off this facade so
|
|
48
|
+
* `ProceduralSystem` does not bundle the region grid.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import { ProceduralSystem } from '@elite-dangerous-almanac/core/astro/procedural-system';
|
|
53
|
+
*
|
|
54
|
+
* declare const id64: bigint;
|
|
55
|
+
* declare const x: number;
|
|
56
|
+
* declare const y: number;
|
|
57
|
+
* declare const z: number;
|
|
58
|
+
*
|
|
59
|
+
* // Name -> id64
|
|
60
|
+
* const sys = ProceduralSystem.fromName('Synuefe EN-H d11-96');
|
|
61
|
+
* if (sys) sys.systemAddress; // bigint
|
|
62
|
+
*
|
|
63
|
+
* // id64 -> name (pass coords so hand-authored regions render correctly)
|
|
64
|
+
* ProceduralSystem.fromSystemAddress(id64, { x, y, z }).name;
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
declare class ProceduralSystem {
|
|
68
|
+
#private;
|
|
69
|
+
/** Whether the name uses a hand-authored region instead of a procedural sector. */
|
|
70
|
+
readonly usesHandAuthoredRegion: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the system's **region** sits behind a permit lock (Col 70, Bleia,
|
|
73
|
+
* the Cone Sector, …).
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* This is a region-level flag only. Individually permit-locked systems — Sol,
|
|
77
|
+
* Shinrarta Dezhra, Achenar and 51 others — are not procedurally named, so they
|
|
78
|
+
* never reach a `ProceduralSystem`; check those with `permitLockForSystemName` from
|
|
79
|
+
* `./permit-locks`, which covers both kinds of lock from a name alone.
|
|
80
|
+
*/
|
|
81
|
+
readonly requiresRegionPermit: boolean;
|
|
82
|
+
private constructor();
|
|
83
|
+
/**
|
|
84
|
+
* Build a system from a procedural name.
|
|
85
|
+
*
|
|
86
|
+
* Procedural and catalogued hand-authored region names are re-cased canonically.
|
|
87
|
+
* Unknown naming regions and out-of-range address fields are rejected here rather
|
|
88
|
+
* than creating an object whose address getter fails later.
|
|
89
|
+
*
|
|
90
|
+
* @param name - A system name in any casing, e.g. `blae eock kc-c d0`.
|
|
91
|
+
* @returns The system, or `null` when `name` is not a **procedurally named**
|
|
92
|
+
* system. Hand-named systems (`Sol`, `Maia`, `Shinrarta Dezhra`) have no
|
|
93
|
+
* algorithmic address and so yield `null` too — that is a "not covered by the
|
|
94
|
+
* scheme" answer, not "your string was malformed".
|
|
95
|
+
* @throws {TypeError} If `name` is not a string. A missing or wrong-typed argument
|
|
96
|
+
* is a caller bug, not a name the scheme does not cover, so it is not reported as
|
|
97
|
+
* `null`.
|
|
98
|
+
* @throws {RangeError} If a syntactically valid name has no known naming-region
|
|
99
|
+
* origin, or a name field cannot fit the normal system-address layout.
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* import { ProceduralSystem } from '@elite-dangerous-almanac/core/astro/procedural-system';
|
|
103
|
+
*
|
|
104
|
+
* ProceduralSystem.fromName('blae eock kc-c d0')?.name; // -> 'Blae Eock KC-C d0'
|
|
105
|
+
* ProceduralSystem.fromName('Sol'); // -> null (hand-named system)
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
static fromName(name: string): ProceduralSystem | null;
|
|
109
|
+
/**
|
|
110
|
+
* Build a system from its 64-bit system address.
|
|
111
|
+
*
|
|
112
|
+
* When `position` is supplied and the system sits inside a hand-authored
|
|
113
|
+
* region, the name is overridden with the hand-authored one (as the game
|
|
114
|
+
* displays it). Without `position`, the procedural name is used.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* **Pass `position` if you can.** An `id64` alone encodes only the boxel, not the
|
|
118
|
+
* exact position, so it cannot tell whether the system falls inside a
|
|
119
|
+
* hand-authored region (Pleiades, Coalsack, …). Without `position`, such a system
|
|
120
|
+
* silently renders under its *procedural* name instead of the name the game
|
|
121
|
+
* shows. Coordinates come from an external source you already have the `id64`
|
|
122
|
+
* from — the player journal, EDSM or Spansh — in light-years with Sol at origin.
|
|
123
|
+
*
|
|
124
|
+
* @param id64 - The system address, as a `bigint`, a normally parsed journal
|
|
125
|
+
* `number` (`event.SystemAddress`), or a decimal `string` (see
|
|
126
|
+
* {@link SystemAddressInput}).
|
|
127
|
+
* @param position - Galactic position (light-years, Sol at origin). Optional, but
|
|
128
|
+
* required for correct hand-authored-region names.
|
|
129
|
+
* @returns The system at that address.
|
|
130
|
+
* @throws {TypeError} If the address is not a usable representation — a
|
|
131
|
+
* non-integer, or a `number` beyond `2^53 - 1` that has already been rounded.
|
|
132
|
+
* @throws {RangeError} If the address is outside 64 bits or its grid slot has no
|
|
133
|
+
* assigned procedural name.
|
|
134
|
+
* @example
|
|
135
|
+
* ```ts
|
|
136
|
+
* import { ProceduralSystem } from '@elite-dangerous-almanac/core/astro/procedural-system';
|
|
137
|
+
*
|
|
138
|
+
* ProceduralSystem.fromSystemAddress(3309179996515n).name;
|
|
139
|
+
* // -> 'Synuefe EN-H d11-96'
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
static fromSystemAddress(id64: SystemAddressInput, position?: GalacticPosition): ProceduralSystem;
|
|
143
|
+
/**
|
|
144
|
+
* Build a system from its 64-bit modulated system address.
|
|
145
|
+
*
|
|
146
|
+
* @param id64 - The modulated system address, as a `bigint`, a safe-integer
|
|
147
|
+
* `number`, or a decimal `string` (see {@link SystemAddressInput}). Modulated
|
|
148
|
+
* addresses routinely exceed `2^53`; those values must be supplied as a
|
|
149
|
+
* `bigint` or string because a JS `number` has already lost precision.
|
|
150
|
+
* @param position - Galactic position (light-years, Sol at origin). Optional,
|
|
151
|
+
* but required for correct hand-authored-region names.
|
|
152
|
+
* @returns The system at that address.
|
|
153
|
+
* @throws {TypeError} If the address is not a usable representation.
|
|
154
|
+
* @throws {RangeError} If the address is outside 64 bits or its grid slot has no
|
|
155
|
+
* assigned procedural name, or if its sequence cannot fit the normal address
|
|
156
|
+
* layout that every `ProceduralSystem` exposes.
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* import { ProceduralSystem } from '@elite-dangerous-almanac/core/astro/procedural-system';
|
|
160
|
+
*
|
|
161
|
+
* declare const modulatedAddress: bigint;
|
|
162
|
+
*
|
|
163
|
+
* const normal = ProceduralSystem.fromModSystemAddress(modulatedAddress);
|
|
164
|
+
* normal.systemAddress; // normal-layout id64
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
static fromModSystemAddress(id64: SystemAddressInput, position?: GalacticPosition): ProceduralSystem;
|
|
168
|
+
/** The canonical system name, e.g. `Synuefe EN-H d11-96`. */
|
|
169
|
+
get name(): string;
|
|
170
|
+
/**
|
|
171
|
+
* The region (sector) name — a procedural sector (`Synuefe`) or, when the
|
|
172
|
+
* system is inside a hand-authored region, that region's name
|
|
173
|
+
* (`Pleiades Sector`). See {@link ProceduralSystem.usesHandAuthoredRegion} to tell which.
|
|
174
|
+
*/
|
|
175
|
+
get namingRegionName(): string;
|
|
176
|
+
/** The mass-code letter `a`–`h`. */
|
|
177
|
+
get massCode(): string;
|
|
178
|
+
/** The system's sequence number (`N2`). */
|
|
179
|
+
get sequence(): number;
|
|
180
|
+
/**
|
|
181
|
+
* Galactic position (light-years, Sol at origin), if known.
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
* Only ever the position **you supplied** to
|
|
185
|
+
* {@link ProceduralSystem.fromSystemAddress} or
|
|
186
|
+
* {@link ProceduralSystem.fromModSystemAddress} — a name or an `id64` does not carry
|
|
187
|
+
* an exact position, so this is `null` for a system built from either alone. For an
|
|
188
|
+
* approximate position from an address, use `findCodexRegionForBoxel(id64)` from
|
|
189
|
+
* `./codex-region-lookup`, which returns the boxel corner in light-years.
|
|
190
|
+
* @returns A copy of the position, or `null` when none is known (`null`, not
|
|
191
|
+
* `undefined` — every "absent" result in this library is `null`).
|
|
192
|
+
*/
|
|
193
|
+
get position(): GalacticPosition | null;
|
|
194
|
+
/**
|
|
195
|
+
* A shallow copy of the parsed name parts.
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* Letters and mass code are **zero-based numeric indices**, not characters — the
|
|
199
|
+
* form the address encoder consumes (see {@link SystemNameParts}). Use
|
|
200
|
+
* {@link ProceduralSystem.name} / {@link ProceduralSystem.massCode} for the display strings.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* import { ProceduralSystem } from '@elite-dangerous-almanac/core/astro/procedural-system';
|
|
205
|
+
*
|
|
206
|
+
* ProceduralSystem.fromName('Synuefe EN-H d11-96')!.parts;
|
|
207
|
+
* // { regionName: 'Synuefe', l1: 4, l2: 13, l3: 7, massCode: 3, n1: 11, n2: 96 }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
get parts(): SystemNameParts;
|
|
211
|
+
/**
|
|
212
|
+
* The validated 64-bit system address.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* Construction validates the naming region and every normal-address field, so this
|
|
216
|
+
* getter has no deferred failure mode.
|
|
217
|
+
*/
|
|
218
|
+
get systemAddress(): bigint;
|
|
219
|
+
/**
|
|
220
|
+
* The 64-bit modulated system address, computed from the region origin, or `null`
|
|
221
|
+
* when the system sequence cannot fit the modulated layout.
|
|
222
|
+
*
|
|
223
|
+
* A `null` result is explicit and has no deferred failure mode.
|
|
224
|
+
*/
|
|
225
|
+
get modSystemAddress(): bigint | null;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export { ProceduralSystem, SystemAddressInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{ProceduralSystem}from"../chunk-VXVUEF5U.js"; //# sourceMappingURL=procedural-system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Procedural (boxel) sector naming for the Elite Dangerous galaxy.
|
|
3
|
+
*
|
|
4
|
+
* Most of the galaxy is not hand-named. Instead the game derives a sector's name
|
|
5
|
+
* algorithmically from its integer position on the 128×128×128 grid of 1280 ly
|
|
6
|
+
* sector cubes. Two schemes exist, chosen per sector by a hash of its position:
|
|
7
|
+
*
|
|
8
|
+
* - **Class 1 (C1)** — a single run-together word, e.g. `Synuefe`, `Pyroifoo`.
|
|
9
|
+
* Built as `prefix + infix(+ infix) + suffix`.
|
|
10
|
+
* - **Class 2 (C2)** — two words, e.g. `Blae Eock`, `Hypheasms Ni`.
|
|
11
|
+
* Built as `prefix₁suffix₁ prefix₂suffix₂`.
|
|
12
|
+
*
|
|
13
|
+
* This module implements the forward map ({@link sectorNameFromGridPosition}) and its
|
|
14
|
+
* inverse ({@link sectorGridPositionFromName}) as pure functions. The fragment tables
|
|
15
|
+
* and the run-length/offset lookups derived from them are computed once as module
|
|
16
|
+
* constants; nothing here mutates observable state between calls.
|
|
17
|
+
*
|
|
18
|
+
* Ported and restructured from the EDTS reference algorithm (`edtslib/pgdata.py`), via
|
|
19
|
+
* the canonn-signals TypeScript port. Credit and licence terms, including the BSD
|
|
20
|
+
* 3-Clause text EDTS requires be reproduced, are in [ATTRIBUTIONS.md](https://github.com/DarkSession/Elite-Dangerous-Almanac/blob/main/ATTRIBUTIONS.md).
|
|
21
|
+
*
|
|
22
|
+
* @packageDocumentation
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Integer position of a sector on the galaxy's sector grid.
|
|
26
|
+
*
|
|
27
|
+
* Each axis indexes a 1280 ly cube. `x` and `z` span the full 7-bit range
|
|
28
|
+
* (0–127); `y` only reaches 0–63 for real systems (the system-address format has
|
|
29
|
+
* a 6-bit y field), but the naming algorithm itself treats all three as 7-bit.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import type { SectorGridPosition } from '@elite-dangerous-almanac/core/astro/sector-name';
|
|
34
|
+
*
|
|
35
|
+
* const sector: SectorGridPosition = { sectorX: 39, sectorY: 31, sectorZ: 18 };
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
interface SectorGridPosition {
|
|
39
|
+
/** Sector index along the galactic X axis (0–127). */
|
|
40
|
+
readonly sectorX: number;
|
|
41
|
+
/** Sector index along the galactic Y axis (0–63 for addressable systems). */
|
|
42
|
+
readonly sectorY: number;
|
|
43
|
+
/** Sector index along the galactic Z axis (0–127). */
|
|
44
|
+
readonly sectorZ: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The procedural sector name for a grid position.
|
|
48
|
+
*
|
|
49
|
+
* @param position - Integer sector position on the galaxy grid. Each axis must be
|
|
50
|
+
* an integer in 0–127 (the 7-bit sector grid); the packed offset would
|
|
51
|
+
* otherwise bleed one axis into the next and produce a wrong or empty name.
|
|
52
|
+
* @returns The canonically-cased sector name (e.g. `Synuefe`, `Blae Eock`).
|
|
53
|
+
* @throws {RangeError} If any axis is not an integer in 0–127, or if the grid
|
|
54
|
+
* slot is outside the procedural generator's assigned name range.
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { sectorNameFromGridPosition } from '@elite-dangerous-almanac/core/astro/sector-name';
|
|
58
|
+
*
|
|
59
|
+
* sectorNameFromGridPosition({ sectorX: 39, sectorY: 30, sectorZ: 20 }); // -> a procedural name
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare function sectorNameFromGridPosition(position: SectorGridPosition): string;
|
|
63
|
+
/**
|
|
64
|
+
* The grid position a procedural sector name maps to, or `null` if the name is
|
|
65
|
+
* not a valid procedural sector name.
|
|
66
|
+
*
|
|
67
|
+
* Every assigned name produced by {@link sectorNameFromGridPosition} round-trips through
|
|
68
|
+
* this function. A valid fragment sequence that is not the canonical name emitted for
|
|
69
|
+
* its coordinates is rejected.
|
|
70
|
+
*
|
|
71
|
+
* @param name - A procedural sector name in any casing (e.g. `blae eock`).
|
|
72
|
+
* @returns The sector grid position, or `null` when the name is not procedural —
|
|
73
|
+
* including a nullish `name`, which the name parsers tolerate on this path too.
|
|
74
|
+
* @throws {TypeError} If `name` is present and not a string.
|
|
75
|
+
*/
|
|
76
|
+
declare function sectorGridPositionFromName(name: string): SectorGridPosition | null;
|
|
77
|
+
/**
|
|
78
|
+
* Re-derive a sector name's canonical casing by round-tripping it through the
|
|
79
|
+
* grid, e.g. `blae eock` → `Blae Eock`. Returns `null` for non-procedural names.
|
|
80
|
+
*
|
|
81
|
+
* @param name - A procedural sector name in any casing. A nullish one answers `null`,
|
|
82
|
+
* matching {@link sectorGridPositionFromName}.
|
|
83
|
+
* @throws {TypeError} If `name` is present and not a string.
|
|
84
|
+
*/
|
|
85
|
+
declare function canonicalizeSectorName(name: string): string | null;
|
|
86
|
+
|
|
87
|
+
export { type SectorGridPosition, canonicalizeSectorName, sectorGridPositionFromName, sectorNameFromGridPosition };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{canonicalizeSectorName,sectorGridPositionFromName,sectorNameFromGridPosition}from"../chunk-J2PNZQY4.js"; //# sourceMappingURL=sector-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accepting a system address (`id64`) from wherever the caller got it.
|
|
3
|
+
*
|
|
4
|
+
* The library works in `bigint` internally, because address fields reach bit 55
|
|
5
|
+
* and JS number bitwise operators truncate to 32 bits. Callers, however, rarely
|
|
6
|
+
* hold a `bigint`: `JSON.parse` of a journal event yields a `number`, persisted
|
|
7
|
+
* JSON and query strings yield a decimal `string`. Every public entry point that
|
|
8
|
+
* takes an address therefore accepts {@link SystemAddressInput} and funnels it
|
|
9
|
+
* through {@link toSystemAddress}.
|
|
10
|
+
*
|
|
11
|
+
* This module depends only on the shared argument-guard helper, so importing it (or any
|
|
12
|
+
* of the address entry points that use it) costs nothing but conversion and bounded
|
|
13
|
+
* error reporting. That helper carries no catalogue and no data of its own.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* A system address as a caller is likely to hold it.
|
|
19
|
+
*
|
|
20
|
+
* - `bigint` — the canonical form, and what this library returns.
|
|
21
|
+
* - `number` — a normally parsed journal event (`event.SystemAddress`). Accepted
|
|
22
|
+
* only when it is a non-negative safe integer, since a rounded address would
|
|
23
|
+
* silently identify the wrong system.
|
|
24
|
+
* - `string` — a decimal address from persisted JSON, a URL or a database column.
|
|
25
|
+
*/
|
|
26
|
+
type SystemAddressInput = bigint | number | string;
|
|
27
|
+
/**
|
|
28
|
+
* Convert a supported address representation to a `bigint`, without accepting a
|
|
29
|
+
* value that may already have lost precision.
|
|
30
|
+
*
|
|
31
|
+
* @param address - A `bigint`, a non-negative safe-integer `number` (a normally
|
|
32
|
+
* parsed journal address), or a decimal digit `string`.
|
|
33
|
+
* @returns The address as a `bigint`, or `null` when the input cannot be *converted*
|
|
34
|
+
* to one: a non-integer or unsafe `number` (beyond `2^53 - 1`, where the value has
|
|
35
|
+
* already been rounded), a negative `number`, or a string that is not all decimal
|
|
36
|
+
* digits. A `bigint` always passes through unchanged — whether it fits the 64-bit
|
|
37
|
+
* address layout is the decoder's `RangeError` to raise, not a conversion failure.
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* import { tryToSystemAddress } from '@elite-dangerous-almanac/core/astro/system-address-input';
|
|
41
|
+
*
|
|
42
|
+
* tryToSystemAddress(10477373803); // -> 10477373803n
|
|
43
|
+
* tryToSystemAddress('10477373803'); // -> 10477373803n
|
|
44
|
+
* tryToSystemAddress(1.5); // -> null
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function tryToSystemAddress(address: SystemAddressInput): bigint | null;
|
|
48
|
+
/**
|
|
49
|
+
* Convert a supported address representation to a `bigint`, or throw.
|
|
50
|
+
*
|
|
51
|
+
* Use this at the edge of your own code when you want the failure to be loud;
|
|
52
|
+
* the library's address entry points call it for you, so
|
|
53
|
+
* `decodeSystemAddress(event.SystemAddress)` and
|
|
54
|
+
* `ProceduralSystem.fromSystemAddress(event.SystemAddress)` accept a journal number
|
|
55
|
+
* directly.
|
|
56
|
+
*
|
|
57
|
+
* @param address - A `bigint`, a non-negative safe-integer `number` (a normally
|
|
58
|
+
* parsed journal address), or a decimal digit `string`.
|
|
59
|
+
* @returns The address as a `bigint`.
|
|
60
|
+
* @throws {TypeError} If the value cannot be converted: a non-integer, a negative
|
|
61
|
+
* `number`, a `number` beyond `2^53 - 1` (already rounded, so the identity is lost),
|
|
62
|
+
* or a non-numeric string. The message names the offending value. A `bigint` outside
|
|
63
|
+
* the 64-bit range is *not* a conversion failure — the decoder rejects it with a
|
|
64
|
+
* `RangeError`.
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* import { toSystemAddress } from '@elite-dangerous-almanac/core/astro/system-address-input';
|
|
68
|
+
* declare const event: { SystemAddress: number }; // an `FSDJump` line, parsed
|
|
69
|
+
*
|
|
70
|
+
* toSystemAddress(event.SystemAddress); // journal number -> bigint
|
|
71
|
+
* toSystemAddress('3309179996515'); // -> 3309179996515n
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
declare function toSystemAddress(address: SystemAddressInput): bigint;
|
|
75
|
+
|
|
76
|
+
export { type SystemAddressInput, toSystemAddress, tryToSystemAddress };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{toSystemAddress,tryToSystemAddress}from"../chunk-IH4NXKVW.js"; //# sourceMappingURL=system-address-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import './system-name.js';
|
|
2
|
+
export { A as AbsoluteBoxel, D as DecodedAddress, S as SECTOR_INTERNAL_SIZE, a as absoluteBoxelToBoxelCode, b as boxelCodeToAbsoluteBoxel, c as boxelInternalSize, d as decodeModSystemAddress, e as decodeSystemAddress, f as encodeModSystemAddress, g as encodeSystemAddress } from '../system-address-DYsN1qOT.js';
|
|
3
|
+
import './sector-name.js';
|
|
4
|
+
export { SystemAddressInput } from './system-address-input.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{SECTOR_INTERNAL_SIZE,absoluteBoxelToBoxelCode,boxelCodeToAbsoluteBoxel,boxelInternalSize,decodeModSystemAddress,decodeSystemAddress,encodeModSystemAddress,encodeSystemAddress}from"../chunk-BTPV5CIF.js"; //# sourceMappingURL=system-address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsing and formatting of Elite Dangerous procedural system names.
|
|
3
|
+
*
|
|
4
|
+
* A procedural system name has the shape `Region LL-L m[N1-]N2`, e.g.
|
|
5
|
+
* `Synuefe EN-H d11-96` or `Blae Eock KC-C d0`. Its parts are:
|
|
6
|
+
*
|
|
7
|
+
* - **Region** — the sector name (procedural, e.g. `Synuefe`, or hand-authored,
|
|
8
|
+
* e.g. `Pleiades Sector`).
|
|
9
|
+
* - **L1 L2 L3** — three letters (`EN-H`) giving the boxel's position within the
|
|
10
|
+
* sector, together with **N1**.
|
|
11
|
+
* - **Mass code** — the size class `a`–`h`.
|
|
12
|
+
* - **N1 / N2** — the boxel's high index and the system's sequence number. When
|
|
13
|
+
* N1 is zero the game omits it (and its hyphen), so `…d0`, not `…d0-0`.
|
|
14
|
+
*
|
|
15
|
+
* This module only handles the *textual* form. The bit-packed `id64`
|
|
16
|
+
* (system address) lives in `./system-address`.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* The parsed parts of a procedural system name. Letters and mass code are stored
|
|
22
|
+
* as zero-based indices, not characters, so they can feed the address encoder
|
|
23
|
+
* directly.
|
|
24
|
+
*/
|
|
25
|
+
interface SystemNameParts {
|
|
26
|
+
/** The region (sector) name, as written — casing is fixed up on canonicalize. */
|
|
27
|
+
readonly regionName: string;
|
|
28
|
+
/** First boxel letter, 0–25 (`A`–`Z`). */
|
|
29
|
+
readonly l1: number;
|
|
30
|
+
/** Second boxel letter, 0–25. */
|
|
31
|
+
readonly l2: number;
|
|
32
|
+
/** Third boxel letter, 0–25. */
|
|
33
|
+
readonly l3: number;
|
|
34
|
+
/** Mass code as a 0–7 size class (`a`–`h`). */
|
|
35
|
+
readonly massCode: number;
|
|
36
|
+
/** High boxel index (the `N1` before the hyphen); 0 when the name omits it. */
|
|
37
|
+
readonly n1: number;
|
|
38
|
+
/** System sequence number (`N2`). */
|
|
39
|
+
readonly n2: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Pack a boxel's `(l1, l2, l3, n1)` letter code into the single base-26 index the
|
|
43
|
+
* address format uses (the **boxel code**).
|
|
44
|
+
*
|
|
45
|
+
* @param l1 - First letter as a zero-based index, `0`–`25` (`A`–`Z`).
|
|
46
|
+
* @param l2 - Second letter as a zero-based index, `0`–`25`.
|
|
47
|
+
* @param l3 - Third letter as a zero-based index, `0`–`25`.
|
|
48
|
+
* @param n1 - The boxel number that follows the letters (`d11-96` → `11`), a
|
|
49
|
+
* non-negative integer small enough that the packed code stays exact.
|
|
50
|
+
* @returns The packed base-26 boxel code.
|
|
51
|
+
* @throws {RangeError} If any letter is not an integer in 0–25, or `n1` is not an
|
|
52
|
+
* integer between 0 and the largest value that still packs exactly. Such a field packs
|
|
53
|
+
* as a different boxel than the one asked for rather than failing.
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* import { lettersToBoxelCode } from '@elite-dangerous-almanac/core/astro/system-name';
|
|
57
|
+
*
|
|
58
|
+
* lettersToBoxelCode(4, 13, 7, 11); // the 'EN-H …11' boxel of a d-class sector
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare function lettersToBoxelCode(l1: number, l2: number, l3: number, n1: number): number;
|
|
62
|
+
/**
|
|
63
|
+
* A boxel's letter code unpacked — the `EN-H …11` half of a procedural name.
|
|
64
|
+
*
|
|
65
|
+
* @remarks
|
|
66
|
+
* The same four fields {@link SystemNameParts} carries, without the region name, mass
|
|
67
|
+
* code and sequence that complete a name.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { boxelCodeToLetters } from '@elite-dangerous-almanac/core/astro/system-name';
|
|
72
|
+
* import type { BoxelLetters } from '@elite-dangerous-almanac/core/astro/system-name';
|
|
73
|
+
*
|
|
74
|
+
* const code: BoxelLetters = boxelCodeToLetters(198_410);
|
|
75
|
+
* // -> { l1: 4, l2: 13, l3: 7, n1: 11 }, the 'EN-H …11' boxel
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
interface BoxelLetters {
|
|
79
|
+
/** First letter as a zero-based index, `0`–`25`. */
|
|
80
|
+
readonly l1: number;
|
|
81
|
+
/** Second letter as a zero-based index, `0`–`25`. */
|
|
82
|
+
readonly l2: number;
|
|
83
|
+
/** Third letter as a zero-based index, `0`–`25`. */
|
|
84
|
+
readonly l3: number;
|
|
85
|
+
/** The boxel number that follows the letters (`d11-96` → `11`). */
|
|
86
|
+
readonly n1: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Unpack a base-26 boxel code into its `(l1, l2, l3, n1)` letter code — the inverse
|
|
90
|
+
* of {@link lettersToBoxelCode}.
|
|
91
|
+
*
|
|
92
|
+
* @param boxelCode - The packed base-26 boxel code, as `decodeSystemAddress` returns.
|
|
93
|
+
* Must be a non-negative integer {@link lettersToBoxelCode} could have packed.
|
|
94
|
+
* @returns The three letter indices (`0`–`25` each) and the boxel number `n1`.
|
|
95
|
+
* @throws {RangeError} If `boxelCode` is not an integer between 0 and the largest
|
|
96
|
+
* exactly packable code — no such code can be packed, and a negative one would yield
|
|
97
|
+
* letters outside `0`–`25`.
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { boxelCodeToLetters, lettersToBoxelCode } from '@elite-dangerous-almanac/core/astro/system-name';
|
|
101
|
+
*
|
|
102
|
+
* boxelCodeToLetters(lettersToBoxelCode(4, 13, 7, 11)); // -> { l1: 4, l2: 13, l3: 7, n1: 11 }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare function boxelCodeToLetters(boxelCode: number): BoxelLetters;
|
|
106
|
+
/**
|
|
107
|
+
* Parse a procedural system name into its parts.
|
|
108
|
+
*
|
|
109
|
+
* The region name may itself contain digits (`Col 285 Sector`), so parsing walks
|
|
110
|
+
* the suffix backwards from the end. Returns `null` for anything that is not a
|
|
111
|
+
* well-formed procedural system name.
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* Parsing does **not** canonicalize casing: `regionName` is captured verbatim from
|
|
115
|
+
* the input (`parseSystemName('synuefe …').regionName === 'synuefe'`). The letters
|
|
116
|
+
* and mass code become numeric indices, so re-formatting them is always canonical,
|
|
117
|
+
* but the region is not — use {@link canonicalizeSystemName} (or build a
|
|
118
|
+
* {@link ProceduralSystem} via `ProceduralSystem.fromName`) if you need the region re-cased too.
|
|
119
|
+
*
|
|
120
|
+
* @param name - A system name in any casing, e.g. `blae eock kc-c d0`.
|
|
121
|
+
* @returns The parsed parts, or `null` if the name is malformed. A nullish `name`
|
|
122
|
+
* answers `null` too: this parser tolerates an absent name, deliberately, so a caller
|
|
123
|
+
* can hand it a field that may not be there. `ProceduralSystem.fromName` is the stricter
|
|
124
|
+
* factory over the same grammar — it throws `TypeError` for anything but a string.
|
|
125
|
+
* @throws {TypeError} If `name` is present and not a string. Tolerating an absent name is
|
|
126
|
+
* not tolerating any value at all: a number where a name belongs is a caller bug, and it
|
|
127
|
+
* is named rather than left to fail on a method it does not have.
|
|
128
|
+
*/
|
|
129
|
+
declare function parseSystemName(name: string): SystemNameParts | null;
|
|
130
|
+
/**
|
|
131
|
+
* Format parts back into a system name. N1 (and its hyphen) is omitted when zero,
|
|
132
|
+
* matching the in-game rendering.
|
|
133
|
+
*
|
|
134
|
+
* @remarks
|
|
135
|
+
* Letters and mass code are rendered from their numeric indices, so they always
|
|
136
|
+
* come out canonically cased. The `regionName`, however, is emitted **as stored** —
|
|
137
|
+
* `formatSystemName` does not re-case it. Round-tripping a lower-cased name through
|
|
138
|
+
* {@link parseSystemName} → `formatSystemName` therefore keeps the region's original
|
|
139
|
+
* casing (`synuefe EN-H d11-96`); for a fully canonical name use
|
|
140
|
+
* {@link canonicalizeSystemName} or `ProceduralSystem.fromName(...).name`.
|
|
141
|
+
*
|
|
142
|
+
* @param parts - The system-name parts to render.
|
|
143
|
+
* @returns The system name, e.g. `Synuefe EN-H d11-96`.
|
|
144
|
+
*/
|
|
145
|
+
declare function formatSystemName(parts: SystemNameParts): string;
|
|
146
|
+
/**
|
|
147
|
+
* Fix the casing of a system name. Procedural regions are round-tripped through
|
|
148
|
+
* the grid; catalogued hand-authored regions are looked up case-insensitively.
|
|
149
|
+
* Unknown region strings are left untouched so syntactic parsing remains separate
|
|
150
|
+
* from address encodability.
|
|
151
|
+
*
|
|
152
|
+
* @param name - A system name in any casing.
|
|
153
|
+
* @returns The canonically-cased name, or `null` if it is not a system name — including
|
|
154
|
+
* a nullish `name`, which {@link parseSystemName} tolerates on this path too.
|
|
155
|
+
* @throws {TypeError} If `name` is present and not a string.
|
|
156
|
+
*/
|
|
157
|
+
declare function canonicalizeSystemName(name: string): string | null;
|
|
158
|
+
/** Options for {@link isProceduralSystemName}. */
|
|
159
|
+
interface IsProceduralSystemNameOptions {
|
|
160
|
+
/**
|
|
161
|
+
* When `true`, also require the region to parse as a procedural sector, so
|
|
162
|
+
* hand-authored region names (e.g. `Pleiades Sector HR-W d1-79`) are rejected.
|
|
163
|
+
* Defaults to `false`.
|
|
164
|
+
*/
|
|
165
|
+
readonly strict?: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Whether a string is a well-formed procedural system name.
|
|
169
|
+
*
|
|
170
|
+
* @param name - The candidate name.
|
|
171
|
+
* @param options - See {@link IsProceduralSystemNameOptions}.
|
|
172
|
+
* @returns `true` when the name parses as a procedural system name. A hand-named
|
|
173
|
+
* system (`Sol`, `Maia`) is `false`: it is a real system, just not a procedural name. A
|
|
174
|
+
* nullish `name` is `false` as well, matching {@link parseSystemName}'s tolerance.
|
|
175
|
+
* @throws {TypeError} If `name` is present and not a string.
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* import { isProceduralSystemName } from '@elite-dangerous-almanac/core/astro/system-name';
|
|
179
|
+
*
|
|
180
|
+
* isProceduralSystemName('Blae Eock KC-C d0'); // -> true
|
|
181
|
+
* isProceduralSystemName('Pleiades Sector HR-W d1-79'); // -> true
|
|
182
|
+
* isProceduralSystemName('Pleiades Sector HR-W d1-79', { strict: true }); // -> false
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
declare function isProceduralSystemName(name: string, options?: IsProceduralSystemNameOptions): boolean;
|
|
186
|
+
|
|
187
|
+
export { type BoxelLetters, type IsProceduralSystemNameOptions, type SystemNameParts, boxelCodeToLetters, canonicalizeSystemName, formatSystemName, isProceduralSystemName, lettersToBoxelCode, parseSystemName };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{boxelCodeToLetters,canonicalizeSystemName,formatSystemName,isProceduralSystemName,lettersToBoxelCode,parseSystemName}from"../chunk-JWJ7RSZC.js"; //# sourceMappingURL=system-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"O"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{systemsResistance,mapDamageTypes,effectiveHitPoints,stackShieldResistance}from"./chunk-ZNCXENNB.js";function shieldMassCurveMultiplier(hullMass,generator){const{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:minMultiplier,optMultiplier:optMultiplier,maxMultiplier:maxMultiplier}=generator;if(minMass===void 0||optMass===void 0||maxMass===void 0||minMultiplier===void 0||optMultiplier===void 0||maxMultiplier===void 0){return 0}if(hullMass>maxMass)return 0;const span=maxMass-minMass;if(span<=0||maxMultiplier===minMultiplier)return optMultiplier;const normalised=Math.max(0,Math.min(1,(maxMass-hullMass)/span));const optNormalised=Math.min(1,(maxMass-optMass)/span);const exponent=Math.log((optMultiplier-minMultiplier)/(maxMultiplier-minMultiplier))/Math.log(optNormalised);if(!Number.isFinite(exponent))return optMultiplier;return minMultiplier+Math.pow(normalised,exponent)*(maxMultiplier-minMultiplier)}function shieldStrength(hullMass,baseShieldStrength,generator,boostMultiplier=1){return baseShieldStrength*shieldMassCurveMultiplier(hullMass,generator)*boostMultiplier}var boosterResistances=(boosters,type)=>boosters.map(booster=>booster[`${type}Resistance`]??0);function shieldMetrics(input){const boosters=input.boosters??[];const reinforcement=input.reinforcement??0;const pips=input.systemsPips??0;const sysResistance=systemsResistance(pips);const generator=input.generator??null;if(!generator){const none=mapDamageTypes(()=>0);return{strength:0,generator:0,boosters:0,reinforcement:0,massCurveMultiplier:0,boostMultiplier:1,resistances:none,effectiveHitPoints:effectiveHitPoints(0,none),systemsResistance:sysResistance}}const massCurveMultiplier=shieldMassCurveMultiplier(input.hullMass,generator);const boostMultiplier=1+boosters.reduce((sum,booster)=>sum+(booster.shieldBoost??0),0);const generatorStrength=input.baseShieldStrength*massCurveMultiplier;const boostersStrength=generatorStrength*(boostMultiplier-1);const strength=generatorStrength+boostersStrength+reinforcement;const withPips=resistance=>1-(1-resistance)*(1-sysResistance);const resistances=mapDamageTypes(type=>withPips(stackShieldResistance(generator[`${type}Resistance`]??0,boosterResistances(boosters,type))));return{strength:strength,generator:generatorStrength,boosters:boostersStrength,reinforcement:reinforcement,massCurveMultiplier:massCurveMultiplier,boostMultiplier:boostMultiplier,resistances:resistances,effectiveHitPoints:effectiveHitPoints(strength,resistances),systemsResistance:sysResistance}}export{shieldMassCurveMultiplier,shieldMetrics,shieldStrength};//# sourceMappingURL=chunk-2FHHMYDC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ships/shields.ts"],"names":["systemsResistance","mapDamageTypes","effectiveHitPoints","stackShieldResistance","shieldMassCurveMultiplier","hullMass","generator","minMass","optMass","maxMass","minMultiplier","optMultiplier","maxMultiplier","span","normalised","Math","max","min","optNormalised","exponent","log","Number","isFinite","pow","shieldStrength","baseShieldStrength","boostMultiplier","boosterResistances","boosters","type","map","booster","shieldMetrics","input","reinforcement","pips","systemsPips","sysResistance","none","strength","massCurveMultiplier","resistances","reduce","sum","shieldBoost","generatorStrength","boostersStrength","withPips","resistance"],"mappings":"O,oGA0LO,SAASI,0BACZC,SACAC,WAEA,MAAMC,QAAEA,QAAAC,QAASA,QAAAC,QAASA,QAAAC,cAASA,cAAAC,cAAeA,cAAAC,cAAeA,eAAkBN,UACnF,GACIC,eAAY,GACZC,eAAY,GACZC,eAAY,GACZC,qBAAkB,GAClBC,qBAAkB,GAClBC,qBAAkB,EACpB,CAGE,OAAO,CACX,CAEA,GAAIP,SAAWI,QAAS,OAAO,EAC/B,MAAMI,KAAOJ,QAAUF,QACvB,GAAIM,MAAQ,GAAKD,gBAAkBF,cAAe,OAAOC,cACzD,MAAMG,WAAaC,KAAKC,IAAI,EAAGD,KAAKE,IAAI,GAAIR,QAAUJ,UAAYQ,OAClE,MAAMK,cAAgBH,KAAKE,IAAI,GAAIR,QAAUD,SAAWK,MACxD,MAAMM,SACFJ,KAAKK,KAAKT,cAAgBD,gBAAkBE,cAAgBF,gBAC5DK,KAAKK,IAAIF,eACb,IAAKG,OAAOC,SAASH,UAAW,OAAOR,cACvC,OAAOD,cAAgBK,KAAKQ,IAAIT,WAAYK,WAAaP,cAAgBF,cAC7E,CAYO,SAASc,eACZnB,SACAoB,mBACAnB,UACAoB,gBAAkB,GAElB,OAAOD,mBAAqBrB,0BAA0BC,SAAUC,WAAaoB,eACjF,CAGA,IAAMC,mBAAqB,CAACC,SAA0CC,OAClED,SAASE,IAAKC,SAAYA,QAAQ,GAAGF,mBAAqB,GAmCvD,SAASG,cAAcC,OAC1B,MAAML,SAAWK,MAAML,UAAY,GACnC,MAAMM,cAAgBD,MAAMC,eAAiB,EAC7C,MAAMC,KAAOF,MAAMG,aAAe,EAClC,MAAMC,cAAgBrC,kBAAkBmC,MACxC,MAAM7B,UAAY2B,MAAM3B,WAAa,KAErC,IAAKA,UAAW,CACZ,MAAMgC,KAAOrC,eAAe,IAAM,GAClC,MAAO,CACHsC,SAAU,EACVjC,UAAW,EACXsB,SAAU,EACVM,cAAe,EACfM,oBAAqB,EACrBd,gBAAiB,EACjBe,YAAaH,KACbpC,mBAAoBA,mBAAmB,EAAGoC,MAC1CtC,kBAAmBqC,cAE3B,CAEA,MAAMG,oBAAsBpC,0BAA0B6B,MAAM5B,SAAUC,WACtE,MAAMoB,gBACF,EAAIE,SAASc,OAAO,CAACC,IAAKZ,UAAYY,KAAOZ,QAAQa,aAAe,GAAI,GAC5E,MAAMC,kBAAoBZ,MAAMR,mBAAqBe,oBACrD,MAAMM,iBAAmBD,mBAAqBnB,gBAAkB,GAChE,MAAMa,SAAWM,kBAAoBC,iBAAmBZ,cAGxD,MAAMa,SAAYC,YAA+B,GAAK,EAAIA,aAAe,EAAIX,eAC7E,MAAMI,YAAiCxC,eAAgB4B,MACnDkB,SACI5C,sBACIG,UAAU,GAAGuB,mBAAqB,EAClCF,mBAAmBC,SAAUC,SAKzC,MAAO,CACHU,kBACAjC,UAAWuC,kBACXjB,SAAUkB,iBACVZ,4BACAM,wCACAd,gCACAe,wBACAvC,mBAAoBA,mBAAmBqC,SAAUE,aACjDzC,kBAAmBqC,cAE3B,QAAAjC,0BAAA4B,cAAAR"}
|