@archivist-gg/dnd5e 0.1.0
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 +21 -0
- package/LICENSES/SRD.md +37 -0
- package/README.md +65 -0
- package/dist/armor/armor.codec.d.ts +10 -0
- package/dist/armor/armor.codec.js +8 -0
- package/dist/armor/armor.entity-type.d.ts +2 -0
- package/dist/armor/armor.parser.d.ts +3 -0
- package/dist/armor/armor.parser.js +7 -0
- package/dist/armor/armor.schema.d.ts +25 -0
- package/dist/armor/armor.schema.js +6 -0
- package/dist/armor/armor.types.d.ts +26 -0
- package/dist/armor/armor.types.js +0 -0
- package/dist/background/background.codec.d.ts +9 -0
- package/dist/background/background.codec.js +11 -0
- package/dist/background/background.entity-type.d.ts +2 -0
- package/dist/background/background.parser.d.ts +3 -0
- package/dist/background/background.parser.js +10 -0
- package/dist/background/background.schema.d.ts +74 -0
- package/dist/background/background.schema.js +9 -0
- package/dist/background/background.types.d.ts +52 -0
- package/dist/background/background.types.js +0 -0
- package/dist/chunk-24GFQU7T.js +18 -0
- package/dist/chunk-3DZ74AKK.js +28 -0
- package/dist/chunk-3TM34RSJ.js +23 -0
- package/dist/chunk-3TRGRSCH.js +8 -0
- package/dist/chunk-4C2KOKLF.js +185 -0
- package/dist/chunk-4F6AIZ36.js +19 -0
- package/dist/chunk-4SSDYJS2.js +86 -0
- package/dist/chunk-4TIJKN6O.js +37 -0
- package/dist/chunk-537BHVSH.js +18 -0
- package/dist/chunk-5INR4NSL.js +18 -0
- package/dist/chunk-5XUXXAQJ.js +30 -0
- package/dist/chunk-656QCX4U.js +22 -0
- package/dist/chunk-66XXW2Z2.js +133 -0
- package/dist/chunk-6NK2MUD3.js +114 -0
- package/dist/chunk-6PXE7T7C.js +79 -0
- package/dist/chunk-7P65Q426.js +158 -0
- package/dist/chunk-A7T5L7SS.js +83 -0
- package/dist/chunk-AFKTJXRA.js +39 -0
- package/dist/chunk-B7UXKNLD.js +46 -0
- package/dist/chunk-BAXWWGFJ.js +45 -0
- package/dist/chunk-BH6AMZVY.js +25 -0
- package/dist/chunk-CDW7R2QT.js +62 -0
- package/dist/chunk-DABBCYTT.js +68 -0
- package/dist/chunk-DC74TZNA.js +46 -0
- package/dist/chunk-DNAJRMNN.js +68 -0
- package/dist/chunk-DRNZJNJP.js +19 -0
- package/dist/chunk-FEOB24KP.js +18 -0
- package/dist/chunk-FFULAF2P.js +63 -0
- package/dist/chunk-FUK7QSN5.js +19 -0
- package/dist/chunk-GIOH5JB5.js +19 -0
- package/dist/chunk-GJOI2GHP.js +25 -0
- package/dist/chunk-GZ46OVGZ.js +31 -0
- package/dist/chunk-HCP3GMHS.js +44 -0
- package/dist/chunk-IDTDACM6.js +19 -0
- package/dist/chunk-IKSMX4TN.js +0 -0
- package/dist/chunk-IXZXFFFW.js +269 -0
- package/dist/chunk-J2RYSZMQ.js +16 -0
- package/dist/chunk-JEYQU3JT.js +36 -0
- package/dist/chunk-LSLSG67V.js +31 -0
- package/dist/chunk-LWFTHJIE.js +24 -0
- package/dist/chunk-MDEJHMKK.js +52 -0
- package/dist/chunk-N2JE7BWL.js +81 -0
- package/dist/chunk-NAEPSZAM.js +88 -0
- package/dist/chunk-NXR3BD2V.js +90 -0
- package/dist/chunk-PKC77VZP.js +18 -0
- package/dist/chunk-PMADYMUI.js +19 -0
- package/dist/chunk-PTXBIDG7.js +63 -0
- package/dist/chunk-PZOWBI3B.js +49 -0
- package/dist/chunk-QQ5W2AZP.js +515 -0
- package/dist/chunk-QS5L5YTJ.js +24 -0
- package/dist/chunk-QYZV2MQA.js +97 -0
- package/dist/chunk-R2ZV233X.js +233 -0
- package/dist/chunk-RAWJTA45.js +271 -0
- package/dist/chunk-RSDRMH54.js +18 -0
- package/dist/chunk-RVYYKYFL.js +18 -0
- package/dist/chunk-SSXBYF3P.js +18 -0
- package/dist/chunk-TJCNX6UZ.js +521 -0
- package/dist/chunk-TZK36BU7.js +38 -0
- package/dist/chunk-UC4FE5X3.js +65 -0
- package/dist/chunk-WP2CX2JO.js +235 -0
- package/dist/chunk-WYGD2UGN.js +14 -0
- package/dist/chunk-XJNECUPT.js +31 -0
- package/dist/chunk-XURS6Q6Q.js +127 -0
- package/dist/chunk-Y4I74YEG.js +33 -0
- package/dist/chunk-Z4TL2V7S.js +18 -0
- package/dist/chunk-Z6GXV2GO.js +121 -0
- package/dist/chunk-ZLG6FQFB.js +237 -0
- package/dist/chunk-ZMR77DDL.js +18 -0
- package/dist/class/class.codec.d.ts +10 -0
- package/dist/class/class.codec.js +15 -0
- package/dist/class/class.entity-type.d.ts +2 -0
- package/dist/class/class.parser.d.ts +3 -0
- package/dist/class/class.parser.js +14 -0
- package/dist/class/class.schema.d.ts +202 -0
- package/dist/class/class.schema.js +13 -0
- package/dist/class/class.slug.d.ts +11 -0
- package/dist/class/class.slug.js +8 -0
- package/dist/class/class.types.d.ts +74 -0
- package/dist/class/class.types.js +0 -0
- package/dist/data-srd/index.generated.d.ts +7 -0
- package/dist/data-srd/index.generated.js +146 -0
- package/dist/dnd/constants.d.ts +16 -0
- package/dist/dnd/constants.js +36 -0
- package/dist/dnd/formula-tags.d.ts +16 -0
- package/dist/dnd/formula-tags.js +119 -0
- package/dist/dnd/math.d.ts +24 -0
- package/dist/dnd/math.js +35 -0
- package/dist/dnd/prose-tags.d.ts +16 -0
- package/dist/dnd/prose-tags.js +18 -0
- package/dist/dnd/resource-die.d.ts +6 -0
- package/dist/dnd/resource-die.js +17 -0
- package/dist/dnd/resource-formula.d.ts +41 -0
- package/dist/dnd/resource-formula.js +159 -0
- package/dist/dnd/srd-tag-converter.d.ts +44 -0
- package/dist/dnd/srd-tag-converter.js +12 -0
- package/dist/dnd/tag-grammar.d.ts +19 -0
- package/dist/dnd/tag-grammar.js +12 -0
- package/dist/encounter/encounter.ai-schema.d.ts +29 -0
- package/dist/encounter/encounter.ai-schema.js +8 -0
- package/dist/encounter/encounter.entity-type.d.ts +2 -0
- package/dist/encounter/encounter.generatable.d.ts +2 -0
- package/dist/entities/base-item-resolver.d.ts +21 -0
- package/dist/entities/base-item-resolver.js +9 -0
- package/dist/entities/slug.d.ts +5 -0
- package/dist/entities/slug.js +6 -0
- package/dist/feat/feat.codec.d.ts +9 -0
- package/dist/feat/feat.codec.js +10 -0
- package/dist/feat/feat.entity-type.d.ts +2 -0
- package/dist/feat/feat.parser.d.ts +3 -0
- package/dist/feat/feat.parser.js +9 -0
- package/dist/feat/feat.schema.d.ts +194 -0
- package/dist/feat/feat.schema.js +8 -0
- package/dist/feat/feat.types.d.ts +42 -0
- package/dist/feat/feat.types.js +0 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +139149 -0
- package/dist/inline-tag-parser.d.ts +11 -0
- package/dist/inline-tag-parser.js +6 -0
- package/dist/item/item.actions-map.d.ts +41 -0
- package/dist/item/item.actions-map.js +85 -0
- package/dist/item/item.ai-schema.d.ts +35 -0
- package/dist/item/item.ai-schema.js +6 -0
- package/dist/item/item.attunement.d.ts +18 -0
- package/dist/item/item.attunement.js +12 -0
- package/dist/item/item.bonuses.d.ts +2 -0
- package/dist/item/item.bonuses.js +7 -0
- package/dist/item/item.codec.d.ts +3 -0
- package/dist/item/item.codec.js +8 -0
- package/dist/item/item.conditions.d.ts +10 -0
- package/dist/item/item.conditions.js +8 -0
- package/dist/item/item.conditions.types.d.ts +28 -0
- package/dist/item/item.conditions.types.js +0 -0
- package/dist/item/item.enrichment.d.ts +4 -0
- package/dist/item/item.enrichment.js +9 -0
- package/dist/item/item.entity-type.d.ts +2 -0
- package/dist/item/item.generatable.d.ts +2 -0
- package/dist/item/item.parser.d.ts +3 -0
- package/dist/item/item.parser.js +7 -0
- package/dist/item/item.schema.d.ts +174 -0
- package/dist/item/item.schema.js +8 -0
- package/dist/item/item.types.d.ts +108 -0
- package/dist/item/item.types.js +0 -0
- package/dist/monster/monster.ai-schema.d.ts +67 -0
- package/dist/monster/monster.ai-schema.js +6 -0
- package/dist/monster/monster.codec.d.ts +13 -0
- package/dist/monster/monster.enrichment.d.ts +10 -0
- package/dist/monster/monster.enrichment.js +19 -0
- package/dist/monster/monster.entity-type.d.ts +2 -0
- package/dist/monster/monster.generatable.d.ts +2 -0
- package/dist/monster/monster.parser.d.ts +3 -0
- package/dist/monster/monster.parser.js +6 -0
- package/dist/monster/monster.resolve.d.ts +10 -0
- package/dist/monster/monster.types.d.ts +29 -0
- package/dist/monster/monster.types.js +1 -0
- package/dist/npc/npc.ai-schema.d.ts +6 -0
- package/dist/npc/npc.entity-type.d.ts +2 -0
- package/dist/npc/npc.generatable.d.ts +2 -0
- package/dist/optional-feature/optional-feature.codec.d.ts +14 -0
- package/dist/optional-feature/optional-feature.codec.js +11 -0
- package/dist/optional-feature/optional-feature.entity-type.d.ts +2 -0
- package/dist/optional-feature/optional-feature.parser.d.ts +3 -0
- package/dist/optional-feature/optional-feature.parser.js +10 -0
- package/dist/optional-feature/optional-feature.schema.d.ts +236 -0
- package/dist/optional-feature/optional-feature.schema.js +9 -0
- package/dist/pack.d.ts +11 -0
- package/dist/pc/conditions.constants.d.ts +3 -0
- package/dist/pc/conditions.constants.js +8 -0
- package/dist/pc/decision-recognizer.d.ts +4 -0
- package/dist/pc/decision-recognizer.js +8 -0
- package/dist/pc/pc.conditions.d.ts +3 -0
- package/dist/pc/pc.conditions.js +6 -0
- package/dist/pc/pc.decision-engine.d.ts +97 -0
- package/dist/pc/pc.decision-engine.js +19 -0
- package/dist/pc/pc.equipment.d.ts +12 -0
- package/dist/pc/pc.equipment.js +15 -0
- package/dist/pc/pc.feature-effects.d.ts +95 -0
- package/dist/pc/pc.feature-effects.js +9 -0
- package/dist/pc/pc.formula-context.d.ts +4 -0
- package/dist/pc/pc.formula-context.js +11 -0
- package/dist/pc/pc.parser.d.ts +3 -0
- package/dist/pc/pc.parser.js +41 -0
- package/dist/pc/pc.pools.d.ts +12 -0
- package/dist/pc/pc.pools.js +15 -0
- package/dist/pc/pc.proficiencies.d.ts +8 -0
- package/dist/pc/pc.proficiencies.js +47 -0
- package/dist/pc/pc.proficiency-query.d.ts +11 -0
- package/dist/pc/pc.proficiency-query.js +17 -0
- package/dist/pc/pc.recalc.d.ts +105 -0
- package/dist/pc/pc.recalc.js +662 -0
- package/dist/pc/pc.resolver.d.ts +34 -0
- package/dist/pc/pc.resolver.js +267 -0
- package/dist/pc/pc.resource-seed.d.ts +10 -0
- package/dist/pc/pc.resource-seed.js +40 -0
- package/dist/pc/pc.rest.d.ts +23 -0
- package/dist/pc/pc.rest.js +128 -0
- package/dist/pc/pc.schema.d.ts +294 -0
- package/dist/pc/pc.schema.js +7 -0
- package/dist/pc/pc.slotting.d.ts +22 -0
- package/dist/pc/pc.slotting.js +20 -0
- package/dist/pc/pc.spellcasting.d.ts +56 -0
- package/dist/pc/pc.spellcasting.js +16 -0
- package/dist/pc/pc.table-column.d.ts +12 -0
- package/dist/pc/pc.table-column.js +8 -0
- package/dist/pc/pc.types.d.ts +514 -0
- package/dist/pc/pc.types.js +0 -0
- package/dist/race/race.codec.d.ts +9 -0
- package/dist/race/race.codec.js +13 -0
- package/dist/race/race.entity-type.d.ts +2 -0
- package/dist/race/race.parser.d.ts +3 -0
- package/dist/race/race.parser.js +12 -0
- package/dist/race/race.schema.d.ts +67 -0
- package/dist/race/race.schema.js +11 -0
- package/dist/race/race.types.d.ts +44 -0
- package/dist/race/race.types.js +0 -0
- package/dist/schemas/attack-schema.d.ts +38 -0
- package/dist/schemas/choice-schema.d.ts +5 -0
- package/dist/schemas/choice-schema.js +7 -0
- package/dist/schemas/duration-schema.d.ts +13 -0
- package/dist/schemas/duration-schema.js +6 -0
- package/dist/schemas/equipment-grant-schema.d.ts +6 -0
- package/dist/schemas/equipment-grant-schema.js +12 -0
- package/dist/schemas/feature-effect-schema.d.ts +131 -0
- package/dist/schemas/feature-effect-schema.js +6 -0
- package/dist/schemas/feature-schema.d.ts +2 -0
- package/dist/schemas/feature-schema.js +10 -0
- package/dist/schemas/index.d.ts +6 -0
- package/dist/schemas/resource-schema.d.ts +95 -0
- package/dist/schemas/resource-schema.js +12 -0
- package/dist/schemas/selection-pool-schema.d.ts +34 -0
- package/dist/schemas/selection-pool-schema.js +10 -0
- package/dist/spell/spell.access.d.ts +15 -0
- package/dist/spell/spell.access.js +25 -0
- package/dist/spell/spell.ai-schema.d.ts +24 -0
- package/dist/spell/spell.ai-schema.js +6 -0
- package/dist/spell/spell.codec.d.ts +3 -0
- package/dist/spell/spell.codec.js +8 -0
- package/dist/spell/spell.enrichment.d.ts +2 -0
- package/dist/spell/spell.enrichment.js +9 -0
- package/dist/spell/spell.entity-type.d.ts +2 -0
- package/dist/spell/spell.filter.d.ts +15 -0
- package/dist/spell/spell.filter.js +87 -0
- package/dist/spell/spell.generatable.d.ts +2 -0
- package/dist/spell/spell.parser.d.ts +3 -0
- package/dist/spell/spell.parser.js +7 -0
- package/dist/spell/spell.scaling.d.ts +14 -0
- package/dist/spell/spell.scaling.js +28 -0
- package/dist/spell/spell.schema.d.ts +31 -0
- package/dist/spell/spell.schema.js +6 -0
- package/dist/spell/spell.types.d.ts +25 -0
- package/dist/spell/spell.types.js +0 -0
- package/dist/srd-store.d.ts +53 -0
- package/dist/subclass/subclass.codec.d.ts +11 -0
- package/dist/subclass/subclass.codec.js +14 -0
- package/dist/subclass/subclass.entity-type.d.ts +2 -0
- package/dist/subclass/subclass.parser.d.ts +3 -0
- package/dist/subclass/subclass.parser.js +13 -0
- package/dist/subclass/subclass.schema.d.ts +118 -0
- package/dist/subclass/subclass.schema.js +12 -0
- package/dist/subclass/subclass.types.d.ts +20 -0
- package/dist/subclass/subclass.types.js +0 -0
- package/dist/types/abilities.d.ts +8 -0
- package/dist/types/abilities.js +0 -0
- package/dist/types/ac.d.ts +5 -0
- package/dist/types/attack.d.ts +22 -0
- package/dist/types/attack.js +0 -0
- package/dist/types/casting-option.d.ts +14 -0
- package/dist/types/casting-option.js +0 -0
- package/dist/types/choice.d.ts +66 -0
- package/dist/types/choice.js +6 -0
- package/dist/types/edition.d.ts +4 -0
- package/dist/types/edition.js +0 -0
- package/dist/types/equipment-grant.d.ts +41 -0
- package/dist/types/equipment-grant.js +0 -0
- package/dist/types/feature-effect.d.ts +79 -0
- package/dist/types/feature-effect.js +0 -0
- package/dist/types/feature.d.ts +41 -0
- package/dist/types/feature.js +0 -0
- package/dist/types/formula-context.d.ts +7 -0
- package/dist/types/formula-context.js +0 -0
- package/dist/types/hp.d.ts +4 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/item-conditions.types.d.ts +63 -0
- package/dist/types/item-conditions.types.js +0 -0
- package/dist/types/optional-feature.types.d.ts +60 -0
- package/dist/types/optional-feature.types.js +0 -0
- package/dist/types/resource.d.ts +44 -0
- package/dist/types/resource.js +0 -0
- package/dist/types/selection-pool.d.ts +37 -0
- package/dist/types/selection-pool.js +0 -0
- package/dist/types/speed.d.ts +8 -0
- package/dist/weapon/weapon.codec.d.ts +12 -0
- package/dist/weapon/weapon.codec.js +8 -0
- package/dist/weapon/weapon.entity-type.d.ts +2 -0
- package/dist/weapon/weapon.parser.d.ts +3 -0
- package/dist/weapon/weapon.parser.js +7 -0
- package/dist/weapon/weapon.schema.d.ts +34 -0
- package/dist/weapon/weapon.schema.js +6 -0
- package/dist/weapon/weapon.types.d.ts +36 -0
- package/dist/weapon/weapon.types.js +0 -0
- package/package.json +32 -0
- package/src/data-srd/ATTRIBUTION.md +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Archivist
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/LICENSES/SRD.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SRD Attribution (CC-BY-4.0)
|
|
2
|
+
|
|
3
|
+
This repository bundles content from the Dungeons & Dragons **System Reference Document**,
|
|
4
|
+
both the 5.1 (2014) and 5.2 (2024) editions, released by Wizards of the Coast under the
|
|
5
|
+
Creative Commons Attribution 4.0 International License (CC-BY-4.0).
|
|
6
|
+
|
|
7
|
+
## Required attribution
|
|
8
|
+
|
|
9
|
+
This work includes material from the System Reference Document 5.1 ("SRD 5.1") by Wizards of
|
|
10
|
+
the Coast LLC and available at https://dnd.wizards.com/resources/systems-reference-document.
|
|
11
|
+
The SRD 5.1 is licensed under the Creative Commons Attribution 4.0 International License,
|
|
12
|
+
available at https://creativecommons.org/licenses/by/4.0/legalcode.
|
|
13
|
+
|
|
14
|
+
This work includes material from the System Reference Document 5.2 ("SRD 5.2") by Wizards of
|
|
15
|
+
the Coast LLC and available at https://www.dndbeyond.com/srd. The SRD 5.2 is licensed under
|
|
16
|
+
the Creative Commons Attribution 4.0 International License, available at
|
|
17
|
+
https://creativecommons.org/licenses/by/4.0/legalcode.
|
|
18
|
+
|
|
19
|
+
Copyright © Wizards of the Coast LLC. "Dungeons & Dragons" is a trademark of Wizards of the
|
|
20
|
+
Coast. This project is unofficial and not affiliated with or endorsed by Wizards of the Coast.
|
|
21
|
+
|
|
22
|
+
## Bundled SRD locations
|
|
23
|
+
|
|
24
|
+
- `src/srd/data/` — canonical structured SRD data (SRD 5.1 + 5.2)
|
|
25
|
+
- `src/data-srd/` — verbatim SRD prose (markdown: classes, species, subclasses, backgrounds, feats)
|
|
26
|
+
- `tools/srd-canonical/` — the SRD converter/build tooling
|
|
27
|
+
|
|
28
|
+
## Provenance and changes made (CC-BY "indicate if changes were made")
|
|
29
|
+
|
|
30
|
+
The shipped SRD data is a MERGE, assembled by `tools/srd-canonical/` from: the **Open5e** v2
|
|
31
|
+
API (the immediate redistribution source of the SRD content), a structured-rules dump, and
|
|
32
|
+
supplemental activation data, combined with a hand-curated overlay. Content is transformed
|
|
33
|
+
structurally (reformatted to this project's schema and to Markdown) and normalized; narrative
|
|
34
|
+
prose is preserved. **No non-SRD content is bundled** — every shipped entry's `source` field is
|
|
35
|
+
`SRD 5.1` or `SRD 5.2` (verified: see the repository's SRD-content assertion).
|
|
36
|
+
|
|
37
|
+
Credit to **Open5e** (https://open5e.com) as the immediate SRD-redistribution source.
|
package/README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# @archivist-gg/dnd5e
|
|
2
|
+
|
|
3
|
+
The D&D 5e (2014 & 2024) rules pack for Archivist: parsers, schemas, codecs, and
|
|
4
|
+
types for every entity type, the dice/formula/tag machinery, the player-character
|
|
5
|
+
engine, and the bundled SRD content. Built on [`@archivist-gg/core`](https://github.com/archivist-gg/archivist-core).
|
|
6
|
+
|
|
7
|
+
## What's inside
|
|
8
|
+
|
|
9
|
+
- **Entity types** — armor, background, class, subclass, race, feat,
|
|
10
|
+
optional-feature, item, weapon, monster, npc, and spell. Each has a parser, a
|
|
11
|
+
[zod](https://zod.dev) schema, a codec, and TypeScript types, exposed as
|
|
12
|
+
`@archivist-gg/dnd5e/<entity>/*` subpath exports.
|
|
13
|
+
- **Rules engine** (`dnd/*`) — ability math, proficiency/XP, the formula and
|
|
14
|
+
inline-tag grammar, resource dice, and SRD tag conversion.
|
|
15
|
+
- **Player characters** (`pc/*`) — parse → resolve → recalc a character into
|
|
16
|
+
derived stats (AC, saves, skills, attacks, spellcasting, resources, rest), plus
|
|
17
|
+
the decision engine, equipment/slotting, and conditions.
|
|
18
|
+
- **SRD data** — System Reference Document 5.1 and 5.2 as `.md` sources plus
|
|
19
|
+
canonical/runtime JSON, loadable through `srd-store`.
|
|
20
|
+
|
|
21
|
+
Common entry points are re-exported from the package root; everything else is
|
|
22
|
+
available via subpath exports.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Distributed as TypeScript source (no build step). It depends on `@archivist-gg/core`
|
|
27
|
+
via a sibling path dependency, so clone both repos side by side:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
archivist-core/
|
|
31
|
+
archivist-dnd5e/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```jsonc
|
|
35
|
+
// package.json
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@archivist-gg/core": "file:../archivist-core",
|
|
38
|
+
"@archivist-gg/dnd5e": "file:../archivist-dnd5e"
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Running `npm install` in `archivist-dnd5e` then resolves the sibling.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { parseMonster, dnd5ePack } from "@archivist-gg/dnd5e";
|
|
46
|
+
import { parsePC } from "@archivist-gg/dnd5e/pc/pc.parser";
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Scripts
|
|
50
|
+
|
|
51
|
+
- `npm run typecheck` — type-check the pack and its tools.
|
|
52
|
+
- `npm test` — run the test suite with vitest (regenerates the SRD md-index first).
|
|
53
|
+
- `npm run generate` — regenerate `src/data-srd/index.generated.ts` from the `.md` sources.
|
|
54
|
+
- `npm run build:srd-canonical[:refresh]` — dev tool that rebuilds the canonical SRD
|
|
55
|
+
JSON from an external 5etools structured-rules dump (`STRUCTURED_RULES_PATH`). Not
|
|
56
|
+
part of the test gate; the committed `src/srd/data/{canonical,runtime}` JSON is the
|
|
57
|
+
consumer contract.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
- **Code:** MIT — see [LICENSE](./LICENSE).
|
|
62
|
+
- **Bundled SRD data** (`src/srd/data/`, `src/data-srd/`): System Reference Document
|
|
63
|
+
5.1 and 5.2 by Wizards of the Coast LLC, licensed under
|
|
64
|
+
[CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode). See
|
|
65
|
+
[LICENSES/SRD.md](./LICENSES/SRD.md).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DocCodec } from "@archivist-gg/core";
|
|
2
|
+
import type { ArmorEntity } from "./armor.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Normalizing codec (0c.1a). `parse` delegates to `parseArmor`, which validates
|
|
5
|
+
* against `armorEntitySchema` (injecting the `ac.flat`/`ac.add_con`/`ac.add_wis`
|
|
6
|
+
* defaults) and captures any unknown top-level keys into `entity.raw`.
|
|
7
|
+
* `serialize` stays `yaml.dump` (the edit-save path uses obsidian's separate
|
|
8
|
+
* serializer; gate (d) verifies `yaml.dump` round-trips through `parseArmor`).
|
|
9
|
+
*/
|
|
10
|
+
export declare const armorCodec: DocCodec<ArmorEntity>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const armorEntitySchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
slug: z.ZodString;
|
|
5
|
+
category: z.ZodString;
|
|
6
|
+
ac: z.ZodObject<{
|
|
7
|
+
base: z.ZodNumber;
|
|
8
|
+
flat: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
add_dex: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
+
dex_max: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
add_con: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
add_wis: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
description: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
strength_requirement: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
stealth_disadvantage: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
weight: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
18
|
+
cost: z.ZodOptional<z.ZodString>;
|
|
19
|
+
rarity: z.ZodOptional<z.ZodString>;
|
|
20
|
+
source: z.ZodOptional<z.ZodString>;
|
|
21
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
edition: z.ZodOptional<z.ZodString>;
|
|
23
|
+
entries: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
24
|
+
raw: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
+
}, z.core.$loose>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type { Ability } from "@archivist-gg/dnd5e/types/choice";
|
|
2
|
+
export type ArmorCategory = "light" | "medium" | "heavy" | "shield" | "natural" | "feature" | "spell" | string;
|
|
3
|
+
export interface ArmorEntity {
|
|
4
|
+
name: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
category: ArmorCategory;
|
|
7
|
+
ac: {
|
|
8
|
+
base: number;
|
|
9
|
+
flat?: number;
|
|
10
|
+
add_dex: boolean;
|
|
11
|
+
dex_max?: number;
|
|
12
|
+
add_con: boolean;
|
|
13
|
+
add_wis: boolean;
|
|
14
|
+
description?: string;
|
|
15
|
+
};
|
|
16
|
+
strength_requirement?: number;
|
|
17
|
+
stealth_disadvantage?: boolean;
|
|
18
|
+
weight?: number | string;
|
|
19
|
+
cost?: string;
|
|
20
|
+
rarity?: string;
|
|
21
|
+
source?: string;
|
|
22
|
+
page?: number;
|
|
23
|
+
edition?: "2014" | "2024" | string;
|
|
24
|
+
entries?: unknown[];
|
|
25
|
+
raw?: Record<string, unknown>;
|
|
26
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DocCodec } from "@archivist-gg/core";
|
|
2
|
+
import type { BackgroundEntity } from "./background.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Normalizing codec (0c.1a). `parse` delegates to `parseBackground`, which seeds
|
|
5
|
+
* the `edition: "2014"` default and validates against `backgroundEntitySchema`.
|
|
6
|
+
* `serialize` stays `yaml.dump` (the edit-save path uses obsidian's separate
|
|
7
|
+
* serializer; gate (d) verifies `yaml.dump` round-trips through `parseBackground`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const backgroundCodec: DocCodec<BackgroundEntity>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
backgroundCodec
|
|
3
|
+
} from "../chunk-Z4TL2V7S.js";
|
|
4
|
+
import "../chunk-DRNZJNJP.js";
|
|
5
|
+
import "../chunk-A7T5L7SS.js";
|
|
6
|
+
import "../chunk-3DZ74AKK.js";
|
|
7
|
+
import "../chunk-CDW7R2QT.js";
|
|
8
|
+
import "../chunk-NXR3BD2V.js";
|
|
9
|
+
export {
|
|
10
|
+
backgroundCodec
|
|
11
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const backgroundEntitySchema: z.ZodObject<{
|
|
3
|
+
slug: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
edition: z.ZodEnum<{
|
|
6
|
+
2014: "2014";
|
|
7
|
+
2024: "2024";
|
|
8
|
+
}>;
|
|
9
|
+
source: z.ZodString;
|
|
10
|
+
description: z.ZodString;
|
|
11
|
+
skill_proficiencies: z.ZodArray<z.ZodEnum<{
|
|
12
|
+
acrobatics: "acrobatics";
|
|
13
|
+
"animal-handling": "animal-handling";
|
|
14
|
+
arcana: "arcana";
|
|
15
|
+
athletics: "athletics";
|
|
16
|
+
deception: "deception";
|
|
17
|
+
history: "history";
|
|
18
|
+
insight: "insight";
|
|
19
|
+
intimidation: "intimidation";
|
|
20
|
+
investigation: "investigation";
|
|
21
|
+
medicine: "medicine";
|
|
22
|
+
nature: "nature";
|
|
23
|
+
perception: "perception";
|
|
24
|
+
performance: "performance";
|
|
25
|
+
persuasion: "persuasion";
|
|
26
|
+
religion: "religion";
|
|
27
|
+
"sleight-of-hand": "sleight-of-hand";
|
|
28
|
+
stealth: "stealth";
|
|
29
|
+
survival: "survival";
|
|
30
|
+
}>>;
|
|
31
|
+
tool_proficiencies: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
kind: z.ZodLiteral<"fixed">;
|
|
33
|
+
items: z.ZodArray<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"choice">;
|
|
36
|
+
count: z.ZodNumber;
|
|
37
|
+
from: z.ZodArray<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>], "kind">>;
|
|
39
|
+
language_proficiencies: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
40
|
+
kind: z.ZodLiteral<"fixed">;
|
|
41
|
+
languages: z.ZodArray<z.ZodString>;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
kind: z.ZodLiteral<"choice">;
|
|
44
|
+
count: z.ZodNumber;
|
|
45
|
+
from: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
46
|
+
}, z.core.$strip>], "kind">>;
|
|
47
|
+
equipment: z.ZodArray<z.ZodType<import("../types/equipment-grant.js").StartingEquipmentEntry, unknown, z.core.$ZodTypeInternals<import("../types/equipment-grant.js").StartingEquipmentEntry, unknown>>>;
|
|
48
|
+
feature: z.ZodObject<{
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
description: z.ZodString;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
ability_score_increases: z.ZodNullable<z.ZodObject<{
|
|
53
|
+
pool: z.ZodArray<z.ZodEnum<{
|
|
54
|
+
str: "str";
|
|
55
|
+
dex: "dex";
|
|
56
|
+
con: "con";
|
|
57
|
+
int: "int";
|
|
58
|
+
wis: "wis";
|
|
59
|
+
cha: "cha";
|
|
60
|
+
}>>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
origin_feat: z.ZodNullable<z.ZodString>;
|
|
63
|
+
suggested_characteristics: z.ZodNullable<z.ZodObject<{
|
|
64
|
+
personality_traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
65
|
+
ideals: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
66
|
+
name: z.ZodOptional<z.ZodString>;
|
|
67
|
+
desc: z.ZodString;
|
|
68
|
+
alignment: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
70
|
+
bonds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
|
+
flaws: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
choices: z.ZodOptional<z.ZodArray<z.ZodType<import("../index.js").Choice, unknown, z.core.$ZodTypeInternals<import("../index.js").Choice, unknown>>>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Ability, SkillSlug, Choice } from "@archivist-gg/dnd5e";
|
|
2
|
+
import type { Edition } from "@archivist-gg/dnd5e/types/edition";
|
|
3
|
+
import type { Resource } from "@archivist-gg/dnd5e/types/resource";
|
|
4
|
+
import type { StartingEquipmentEntry } from "@archivist-gg/dnd5e/types/equipment-grant";
|
|
5
|
+
export type BackgroundToolProficiency = {
|
|
6
|
+
kind: "fixed";
|
|
7
|
+
items: string[];
|
|
8
|
+
} | {
|
|
9
|
+
kind: "choice";
|
|
10
|
+
count: number;
|
|
11
|
+
from: string[];
|
|
12
|
+
};
|
|
13
|
+
export type BackgroundLanguageProficiency = {
|
|
14
|
+
kind: "fixed";
|
|
15
|
+
languages: string[];
|
|
16
|
+
} | {
|
|
17
|
+
kind: "choice";
|
|
18
|
+
count: number;
|
|
19
|
+
from: string | string[];
|
|
20
|
+
};
|
|
21
|
+
export interface SuggestedCharacteristics {
|
|
22
|
+
personality_traits?: Record<string, string>;
|
|
23
|
+
ideals?: Record<string, {
|
|
24
|
+
name?: string;
|
|
25
|
+
desc: string;
|
|
26
|
+
alignment?: string;
|
|
27
|
+
}>;
|
|
28
|
+
bonds?: Record<string, string>;
|
|
29
|
+
flaws?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
export interface BackgroundEntity {
|
|
32
|
+
slug: string;
|
|
33
|
+
name: string;
|
|
34
|
+
edition: Edition;
|
|
35
|
+
source: string;
|
|
36
|
+
description: string;
|
|
37
|
+
skill_proficiencies: SkillSlug[];
|
|
38
|
+
tool_proficiencies: BackgroundToolProficiency[];
|
|
39
|
+
language_proficiencies: BackgroundLanguageProficiency[];
|
|
40
|
+
equipment: StartingEquipmentEntry[];
|
|
41
|
+
feature: {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
resources?: Resource[];
|
|
45
|
+
};
|
|
46
|
+
ability_score_increases: {
|
|
47
|
+
pool: Ability[];
|
|
48
|
+
} | null;
|
|
49
|
+
origin_feat: string | null;
|
|
50
|
+
suggested_characteristics: SuggestedCharacteristics | null;
|
|
51
|
+
choices?: Choice[];
|
|
52
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
parseSpell
|
|
3
|
+
} from "./chunk-N2JE7BWL.js";
|
|
4
|
+
|
|
5
|
+
// src/spell/spell.codec.ts
|
|
6
|
+
import yaml from "js-yaml";
|
|
7
|
+
var spellCodec = {
|
|
8
|
+
parse(doc) {
|
|
9
|
+
return parseSpell(doc.body);
|
|
10
|
+
},
|
|
11
|
+
serialize(spell) {
|
|
12
|
+
return yaml.dump(spell, { lineWidth: -1, sortKeys: false });
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
spellCodec
|
|
18
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// src/schemas/equipment-grant-schema.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var equipmentGrantSchema = z.union([
|
|
4
|
+
z.object({ item: z.string().min(1), qty: z.number().int().positive().optional() }).strict(),
|
|
5
|
+
z.object({ category: z.string().min(1), qty: z.number().int().positive().optional() }).strict(),
|
|
6
|
+
z.object({ gold: z.number().int().positive() }).strict()
|
|
7
|
+
]);
|
|
8
|
+
var equipmentOptionSchema = z.object({
|
|
9
|
+
label: z.string().min(1),
|
|
10
|
+
grants: z.array(equipmentGrantSchema)
|
|
11
|
+
}).strict();
|
|
12
|
+
var startingEquipmentEntrySchema = z.discriminatedUnion("kind", [
|
|
13
|
+
z.object({ kind: z.literal("choice"), options: z.array(equipmentOptionSchema).nonempty() }).strict(),
|
|
14
|
+
z.object({ kind: z.literal("fixed"), label: z.string().min(1).optional(), grants: z.array(equipmentGrantSchema) }).strict(),
|
|
15
|
+
z.object({ kind: z.literal("gold"), amount: z.number().int().positive() }).strict()
|
|
16
|
+
]);
|
|
17
|
+
var startingGoldSchema = z.object({
|
|
18
|
+
fixed: z.number().int().nonnegative().optional(),
|
|
19
|
+
dice: z.string().min(1).optional(),
|
|
20
|
+
multiplier: z.number().int().positive().optional()
|
|
21
|
+
}).strict();
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
equipmentGrantSchema,
|
|
25
|
+
equipmentOptionSchema,
|
|
26
|
+
startingEquipmentEntrySchema,
|
|
27
|
+
startingGoldSchema
|
|
28
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/inline-tag-parser.ts
|
|
2
|
+
var VALID_PREFIXES = ["dice", "damage", "dc", "atk", "mod", "check"];
|
|
3
|
+
var PREFIX_ALIASES = {
|
|
4
|
+
roll: "dice",
|
|
5
|
+
d: "dice",
|
|
6
|
+
attack: "atk",
|
|
7
|
+
dmg: "damage"
|
|
8
|
+
};
|
|
9
|
+
function parseInlineTag(text) {
|
|
10
|
+
var _a;
|
|
11
|
+
const colonIndex = text.indexOf(":");
|
|
12
|
+
if (colonIndex === -1) return null;
|
|
13
|
+
const prefix = text.slice(0, colonIndex).trim().toLowerCase();
|
|
14
|
+
const resolved = (_a = PREFIX_ALIASES[prefix]) != null ? _a : prefix;
|
|
15
|
+
if (!VALID_PREFIXES.includes(resolved)) return null;
|
|
16
|
+
const content = text.slice(colonIndex + 1).trim();
|
|
17
|
+
if (content.length === 0) return null;
|
|
18
|
+
return { type: resolved, content, formula: null };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
parseInlineTag
|
|
23
|
+
};
|