@archivist-gg/dnd5e 0.3.19 → 0.3.26
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 -21
- package/README.md +26 -48
- package/dist/armor/armor.codec.d.ts +0 -7
- package/dist/armor/armor.codec.js +1 -9
- package/dist/armor/armor.parser.js +1 -8
- package/dist/armor/armor.schema.js +1 -7
- package/dist/armor/armor.types.d.ts +0 -3
- package/dist/background/background.codec.d.ts +0 -6
- package/dist/background/background.codec.js +1 -12
- package/dist/background/background.parser.js +1 -11
- package/dist/background/background.schema.js +1 -12
- package/dist/background/background.types.d.ts +0 -5
- package/dist/chunk-2EOGK6R6.js +1 -0
- package/dist/chunk-2HRRH3WL.js +1 -0
- package/dist/chunk-2NUDWOFG.js +1 -0
- package/dist/chunk-3LWOVRLA.js +1 -0
- package/dist/chunk-3QQOATV3.js +1 -0
- package/dist/chunk-4E2GIWJE.js +1 -0
- package/dist/chunk-4GN3GYMP.js +1 -0
- package/dist/chunk-4IAMSRHD.js +1 -0
- package/dist/chunk-4JEF3CET.js +1 -0
- package/dist/chunk-4KVVAENP.js +1 -0
- package/dist/chunk-4SYAKWY4.js +1 -0
- package/dist/chunk-56JK6VCL.js +1 -0
- package/dist/chunk-5XDCM6YK.js +1 -0
- package/dist/chunk-63YJPWTM.js +1 -0
- package/dist/chunk-6R46KYGU.js +1 -0
- package/dist/chunk-6W253VHH.js +1 -0
- package/dist/chunk-72PRMZRD.js +1 -0
- package/dist/chunk-757KM22B.js +1 -0
- package/dist/chunk-7EL3GWWJ.js +1 -0
- package/dist/chunk-7FPQJDFD.js +1 -0
- package/dist/chunk-AINRPPLH.js +1 -0
- package/dist/chunk-BC52J4LA.js +1 -0
- package/dist/chunk-BCXGB4HP.js +1 -0
- package/dist/chunk-BREHZNTL.js +1 -0
- package/dist/chunk-BZ6BGGZS.js +1 -0
- package/dist/chunk-CAPYNIGK.js +1 -0
- package/dist/chunk-CCAVZANF.js +1 -0
- package/dist/chunk-CCFIINBA.js +1 -0
- package/dist/chunk-CEHL7PPC.js +1 -0
- package/dist/chunk-CMIEZQL4.js +1 -0
- package/dist/chunk-CNMHADNV.js +1 -0
- package/dist/chunk-CSTAQQGX.js +1 -0
- package/dist/chunk-DTB7YBMZ.js +1 -0
- package/dist/chunk-DVUXUIPV.js +1 -0
- package/dist/chunk-DZITM5AG.js +1 -0
- package/dist/chunk-E3MS4M3N.js +1 -0
- package/dist/chunk-E7KFJLDR.js +1 -0
- package/dist/chunk-EAARMPCW.js +1 -0
- package/dist/chunk-EPA24PVZ.js +1 -0
- package/dist/chunk-ETDMOGFO.js +1 -0
- package/dist/chunk-EVT7MGAC.js +1 -0
- package/dist/chunk-FOLHTMSC.js +1 -0
- package/dist/chunk-GCYUCIDN.js +1 -0
- package/dist/chunk-GD7WRCNH.js +1 -0
- package/dist/chunk-GGQDQSIF.js +1 -0
- package/dist/chunk-GIQLIBC7.js +1 -0
- package/dist/chunk-HX7WBOKR.js +1 -0
- package/dist/chunk-I26FHSI6.js +1 -0
- package/dist/chunk-IHPLT2ZT.js +1 -0
- package/dist/chunk-J3RP5C7L.js +1 -0
- package/dist/chunk-J5GL6FLP.js +1 -0
- package/dist/chunk-JXDX2DKF.js +1 -0
- package/dist/chunk-KEXSF3CH.js +1 -0
- package/dist/chunk-KM75CC6Q.js +1 -0
- package/dist/chunk-L2DXF7YS.js +1 -0
- package/dist/chunk-LHH5XSEA.js +1 -0
- package/dist/chunk-LJNT3PJP.js +1 -0
- package/dist/chunk-LR6UMA5V.js +1 -0
- package/dist/chunk-M6RPOLKS.js +1 -0
- package/dist/chunk-MGGKZGLG.js +1 -0
- package/dist/chunk-NEMX7QGG.js +1 -0
- package/dist/chunk-NIWLD33X.js +1 -0
- package/dist/chunk-NU2Z7MTS.js +1 -0
- package/dist/chunk-NYPH7RQN.js +1 -0
- package/dist/chunk-NYTR6NJS.js +1 -0
- package/dist/chunk-O2QZ73GA.js +1 -0
- package/dist/chunk-O776WL7O.js +1 -0
- package/dist/chunk-ONCXJMJM.js +1 -0
- package/dist/chunk-OTRH62HY.js +1 -0
- package/dist/chunk-PFQPP77Q.js +1 -0
- package/dist/chunk-PKIMOVQG.js +1 -0
- package/dist/chunk-PZ3ZZ5H5.js +1 -0
- package/dist/chunk-PZ4L2EEG.js +1 -0
- package/dist/chunk-QMEKQTUT.js +1 -0
- package/dist/chunk-QVWT67WA.js +1 -0
- package/dist/chunk-RE5Z5RNK.js +1 -0
- package/dist/chunk-RHIEOYDX.js +1 -0
- package/dist/chunk-RQZCGXUZ.js +1 -0
- package/dist/chunk-S5UCI27C.js +1 -0
- package/dist/chunk-SEOASDO4.js +1 -0
- package/dist/chunk-SFK57JAA.js +1 -0
- package/dist/chunk-SU4MEZ5P.js +1 -0
- package/dist/chunk-T55DELVL.js +1 -0
- package/dist/chunk-TKIEPC6F.js +1 -0
- package/dist/chunk-UBUKCRZ3.js +1 -0
- package/dist/chunk-VA3ZWV7C.js +1 -0
- package/dist/chunk-VIP3FH2O.js +1 -0
- package/dist/chunk-VTQ4RWEG.js +1 -0
- package/dist/chunk-VVJXZZ4Z.js +1 -0
- package/dist/chunk-WAUNLUFQ.js +1 -0
- package/dist/chunk-X22SISGM.js +1 -0
- package/dist/chunk-XKJXT2PN.js +1 -0
- package/dist/chunk-XPF53K54.js +1 -0
- package/dist/chunk-YGH7S5ZF.js +1 -0
- package/dist/chunk-ZE46ADXS.js +1 -0
- package/dist/chunk-ZI3FEUX3.js +1 -0
- package/dist/chunk-ZS5BMNXC.js +1 -0
- package/dist/chunk-ZVL5FXXO.js +1 -0
- package/dist/class/class.codec.d.ts +0 -7
- package/dist/class/class.codec.js +1 -18
- package/dist/class/class.parser.js +1 -17
- package/dist/class/class.schema.d.ts +4 -3
- package/dist/class/class.schema.js +1 -15
- package/dist/class/class.slug.d.ts +0 -11
- package/dist/class/class.slug.js +1 -8
- package/dist/class/class.standard-array.d.ts +0 -7
- package/dist/class/class.standard-array.js +1 -20
- package/dist/class/class.types.d.ts +0 -20
- package/dist/condition/condition.codec.d.ts +0 -6
- package/dist/condition/condition.parser.d.ts +0 -10
- package/dist/condition/condition.parser.js +1 -7
- package/dist/condition/condition.schema.d.ts +0 -16
- package/dist/condition/condition.types.d.ts +0 -3
- package/dist/data-srd/index.generated.js +1 -146
- package/dist/dnd/amount-text.d.ts +3 -30
- package/dist/dnd/amount-text.js +1 -15
- package/dist/dnd/constants.d.ts +0 -18
- package/dist/dnd/constants.js +1 -42
- package/dist/dnd/formula-tags.d.ts +0 -2
- package/dist/dnd/formula-tags.js +1 -119
- package/dist/dnd/math.d.ts +0 -26
- package/dist/dnd/math.js +1 -45
- package/dist/dnd/prose-tags.d.ts +1 -15
- package/dist/dnd/prose-tags.js +1 -18
- package/dist/dnd/resource-die.d.ts +0 -4
- package/dist/dnd/resource-die.js +1 -17
- package/dist/dnd/resource-formula.d.ts +0 -43
- package/dist/dnd/resource-formula.js +1 -14
- package/dist/dnd/resource-words.d.ts +0 -2
- package/dist/dnd/resource-words.js +1 -30
- package/dist/dnd/srd-tag-converter.d.ts +0 -21
- package/dist/dnd/srd-tag-converter.js +1 -12
- package/dist/dnd/tag-grammar.js +1 -12
- package/dist/dnd/warn-once.js +1 -8
- package/dist/encounter/encounter.ai-schema.js +1 -8
- package/dist/entities/base-item-resolver.d.ts +0 -26
- package/dist/entities/base-item-resolver.js +1 -11
- package/dist/entities/registry-revision.d.ts +0 -15
- package/dist/entities/registry-revision.js +1 -10
- package/dist/entities/slug.d.ts +1 -31
- package/dist/entities/slug.js +1 -12
- package/dist/entities/wikilink-display.d.ts +0 -2
- package/dist/entities/wikilink-display.js +1 -10
- package/dist/feat/feat.category-codes.d.ts +1 -26
- package/dist/feat/feat.category-codes.js +1 -14
- package/dist/feat/feat.codec.d.ts +0 -6
- package/dist/feat/feat.codec.js +1 -12
- package/dist/feat/feat.parser.js +1 -11
- package/dist/feat/feat.schema.d.ts +46 -4
- package/dist/feat/feat.schema.js +1 -10
- package/dist/feat/feat.types.d.ts +0 -6
- package/dist/index.js +45 -141495
- package/dist/inline-tag-parser.js +1 -6
- package/dist/item/item.actions-map.d.ts +4 -63
- package/dist/item/item.actions-map.js +1 -10
- package/dist/item/item.ai-schema.js +1 -6
- package/dist/item/item.attunement.d.ts +0 -14
- package/dist/item/item.attunement.js +1 -6
- package/dist/item/item.bonuses.js +1 -10
- package/dist/item/item.codec.js +1 -9
- package/dist/item/item.conditions.d.ts +0 -7
- package/dist/item/item.conditions.js +1 -11
- package/dist/item/item.conditions.types.d.ts +0 -2
- package/dist/item/item.cost.js +1 -29
- package/dist/item/item.enrichment.js +1 -9
- package/dist/item/item.icon.d.ts +0 -8
- package/dist/item/item.icon.js +1 -211
- package/dist/item/item.parser.js +1 -8
- package/dist/item/item.schema.d.ts +5 -0
- package/dist/item/item.schema.js +1 -11
- package/dist/item/item.types.d.ts +5 -28
- package/dist/monster/monster.ai-schema.js +1 -6
- package/dist/monster/monster.codec.d.ts +0 -10
- package/dist/monster/monster.enrichment.js +1 -19
- package/dist/monster/monster.format.d.ts +0 -69
- package/dist/monster/monster.format.js +1 -78
- package/dist/monster/monster.parser.d.ts +0 -4
- package/dist/monster/monster.parser.js +1 -15
- package/dist/monster/monster.resolve.d.ts +0 -4
- package/dist/monster/monster.schema.d.ts +0 -9
- package/dist/monster/monster.schema.js +1 -34
- package/dist/monster/monster.types.d.ts +0 -3
- package/dist/monster/monster.types.js +1 -1
- package/dist/optional-feature/optional-feature.codec.d.ts +0 -11
- package/dist/optional-feature/optional-feature.codec.js +1 -13
- package/dist/optional-feature/optional-feature.parser.js +1 -12
- package/dist/optional-feature/optional-feature.schema.d.ts +44 -3
- package/dist/optional-feature/optional-feature.schema.js +1 -15
- package/dist/pack.d.ts +0 -9
- package/dist/pc/conditions.constants.js +1 -6
- package/dist/pc/decision-recognizer.js +1 -8
- package/dist/pc/pc.additional-spells.d.ts +0 -24
- package/dist/pc/pc.additional-spells.js +1 -26
- package/dist/pc/pc.amount-bindings.d.ts +3 -28
- package/dist/pc/pc.amount-bindings.js +1 -28
- package/dist/pc/pc.asi-flatten.d.ts +0 -59
- package/dist/pc/pc.asi-flatten.js +1 -16
- package/dist/pc/pc.conditions.d.ts +1 -0
- package/dist/pc/pc.conditions.js +1 -6
- package/dist/pc/pc.containment.d.ts +0 -5
- package/dist/pc/pc.containment.js +1 -24
- package/dist/pc/pc.decision-engine.d.ts +6 -145
- package/dist/pc/pc.decision-engine.js +1 -55
- package/dist/pc/pc.defense-normalize.d.ts +0 -10
- package/dist/pc/pc.defense-normalize.js +1 -6
- package/dist/pc/pc.entry-overrides.d.ts +19 -58
- package/dist/pc/pc.entry-overrides.js +1 -41
- package/dist/pc/pc.equipment.d.ts +2 -22
- package/dist/pc/pc.equipment.js +1 -34
- package/dist/pc/pc.feature-effects.d.ts +27 -281
- package/dist/pc/pc.feature-effects.js +1 -39
- package/dist/pc/pc.formula-context.js +1 -11
- package/dist/pc/pc.infusions.d.ts +0 -65
- package/dist/pc/pc.infusions.js +1 -65
- package/dist/pc/pc.item-effects.d.ts +19 -0
- package/dist/pc/pc.item-effects.js +1 -0
- package/dist/pc/pc.member-choices.d.ts +3 -66
- package/dist/pc/pc.member-choices.js +1 -39
- package/dist/pc/pc.parser.js +1 -58
- package/dist/pc/pc.pools.d.ts +7 -10
- package/dist/pc/pc.pools.js +1 -27
- package/dist/pc/pc.proficiencies.d.ts +0 -40
- package/dist/pc/pc.proficiencies.js +1 -156
- package/dist/pc/pc.proficiency-grants.d.ts +3 -27
- package/dist/pc/pc.proficiency-normalize.d.ts +0 -35
- package/dist/pc/pc.proficiency-normalize.js +1 -18
- package/dist/pc/pc.proficiency-query.d.ts +0 -13
- package/dist/pc/pc.proficiency-query.js +1 -27
- package/dist/pc/pc.recalc.d.ts +8 -131
- package/dist/pc/pc.recalc.js +1 -1042
- package/dist/pc/pc.resolver.d.ts +9 -107
- package/dist/pc/pc.resolver.js +1 -60
- package/dist/pc/pc.resource-seed.d.ts +0 -8
- package/dist/pc/pc.resource-seed.js +1 -42
- package/dist/pc/pc.resources.d.ts +1 -59
- package/dist/pc/pc.resources.js +1 -23
- package/dist/pc/pc.rest.d.ts +1 -20
- package/dist/pc/pc.rest.js +1 -231
- package/dist/pc/pc.schema.d.ts +20 -2
- package/dist/pc/pc.schema.js +1 -9
- package/dist/pc/pc.slotting.d.ts +0 -29
- package/dist/pc/pc.slotting.js +1 -28
- package/dist/pc/pc.speeds.d.ts +36 -0
- package/dist/pc/pc.spell-scope.d.ts +0 -16
- package/dist/pc/pc.spellcasting.d.ts +0 -70
- package/dist/pc/pc.spellcasting.js +1 -28
- package/dist/pc/pc.table-column.d.ts +3 -22
- package/dist/pc/pc.table-column.js +1 -18
- package/dist/pc/pc.tool-picks.d.ts +0 -27
- package/dist/pc/pc.tool-picks.js +1 -18
- package/dist/pc/pc.types.d.ts +59 -374
- package/dist/pc/pc.weapon-grant.d.ts +0 -6
- package/dist/pc/pool-layout.d.ts +0 -39
- package/dist/pc/pool-layout.js +1 -18
- package/dist/pc/resource-equivalents.d.ts +2 -40
- package/dist/pc/roll-scope.js +1 -8
- package/dist/pc/roll-tag-labels.d.ts +0 -32
- package/dist/pc/roll-tag-labels.js +1 -17
- package/dist/pc/spell-source.d.ts +0 -11
- package/dist/pc/spell-source.js +1 -8
- package/dist/race/race.codec.d.ts +0 -6
- package/dist/race/race.codec.js +1 -15
- package/dist/race/race.parser.js +1 -14
- package/dist/race/race.schema.d.ts +0 -8
- package/dist/race/race.schema.js +1 -14
- package/dist/race/race.structural.d.ts +0 -6
- package/dist/race/race.structural.js +1 -6
- package/dist/race/race.types.d.ts +0 -8
- package/dist/schemas/attack-schema.d.ts +5 -0
- package/dist/schemas/caster-type-schema.d.ts +1 -6
- package/dist/schemas/caster-type-schema.js +1 -6
- package/dist/schemas/choice-schema.js +1 -7
- package/dist/schemas/duration-schema.d.ts +0 -2
- package/dist/schemas/duration-schema.js +1 -6
- package/dist/schemas/entity-extras-schema.d.ts +0 -30
- package/dist/schemas/entity-extras-schema.js +1 -10
- package/dist/schemas/equipment-grant-schema.d.ts +0 -2
- package/dist/schemas/equipment-grant-schema.js +1 -12
- package/dist/schemas/feature-alias.d.ts +0 -27
- package/dist/schemas/feature-effect-schema.d.ts +44 -3
- package/dist/schemas/feature-effect-schema.js +1 -6
- package/dist/schemas/feature-schema.d.ts +0 -6
- package/dist/schemas/feature-schema.js +1 -12
- package/dist/schemas/resource-schema.d.ts +1 -34
- package/dist/schemas/resource-schema.js +1 -12
- package/dist/schemas/selection-pool-schema.js +1 -10
- package/dist/spell/casting-time.d.ts +0 -15
- package/dist/spell/casting-time.js +1 -6
- package/dist/spell/spell.access.d.ts +0 -6
- package/dist/spell/spell.access.js +1 -45
- package/dist/spell/spell.ai-schema.js +1 -6
- package/dist/spell/spell.codec.js +1 -9
- package/dist/spell/spell.enrichment.js +1 -9
- package/dist/spell/spell.filter.d.ts +0 -5
- package/dist/spell/spell.filter.js +1 -75
- package/dist/spell/spell.parser.d.ts +0 -31
- package/dist/spell/spell.parser.js +1 -16
- package/dist/spell/spell.scaling.d.ts +0 -46
- package/dist/spell/spell.scaling.js +1 -79
- package/dist/spell/spell.schema.js +1 -7
- package/dist/spell/spell.types.d.ts +0 -7
- package/dist/srd/retired-items.d.ts +0 -4
- package/dist/srd/retired-items.js +1 -11
- package/dist/srd-store.d.ts +0 -33
- package/dist/subclass/subclass.codec.d.ts +0 -8
- package/dist/subclass/subclass.codec.js +1 -17
- package/dist/subclass/subclass.parser.js +1 -16
- package/dist/subclass/subclass.schema.d.ts +2 -1
- package/dist/subclass/subclass.schema.js +1 -14
- package/dist/subclass/subclass.types.d.ts +0 -3
- package/dist/types/attack.d.ts +2 -0
- package/dist/types/casting-option.d.ts +0 -4
- package/dist/types/choice.d.ts +1 -72
- package/dist/types/choice.js +1 -24
- package/dist/types/edition.d.ts +0 -3
- package/dist/types/equipment-grant.d.ts +1 -27
- package/dist/types/equipment-grant.js +1 -12
- package/dist/types/feature-effect.d.ts +11 -23
- package/dist/types/feature.d.ts +0 -22
- package/dist/types/optional-feature.types.d.ts +1 -31
- package/dist/types/resource.d.ts +1 -21
- package/dist/types/selection-pool.d.ts +0 -24
- package/dist/weapon/weapon-mastery.d.ts +0 -1
- package/dist/weapon/weapon.classify.d.ts +0 -11
- package/dist/weapon/weapon.classify.js +1 -7
- package/dist/weapon/weapon.codec.d.ts +0 -9
- package/dist/weapon/weapon.codec.js +1 -9
- package/dist/weapon/weapon.parser.js +1 -8
- package/dist/weapon/weapon.schema.js +1 -7
- package/dist/weapon/weapon.types.d.ts +0 -3
- package/package.json +3 -3
- package/src/data-srd/ATTRIBUTION.md +1 -1
- package/dist/chunk-2FRUSVZS.js +0 -489
- package/dist/chunk-2LULMQTF.js +0 -14
- package/dist/chunk-3LWMFYKS.js +0 -57
- package/dist/chunk-3SFGWFVQ.js +0 -19
- package/dist/chunk-3SIUAFDQ.js +0 -18
- package/dist/chunk-3TM34RSJ.js +0 -23
- package/dist/chunk-4J6DS3EJ.js +0 -30
- package/dist/chunk-4U55VNC7.js +0 -22
- package/dist/chunk-5GKJAUMX.js +0 -59
- package/dist/chunk-5JXFJ5AU.js +0 -26
- package/dist/chunk-64VNLMSG.js +0 -375
- package/dist/chunk-656QCX4U.js +0 -22
- package/dist/chunk-6GNXYAYP.js +0 -25
- package/dist/chunk-6PXTNCBP.js +0 -133
- package/dist/chunk-6X2NV665.js +0 -33
- package/dist/chunk-7Q2VPKCD.js +0 -181
- package/dist/chunk-7XJHI5H5.js +0 -709
- package/dist/chunk-A54HHCWW.js +0 -67
- package/dist/chunk-B2QHP6UF.js +0 -159
- package/dist/chunk-B3DP42OM.js +0 -55
- package/dist/chunk-BJGOSM76.js +0 -18
- package/dist/chunk-BJWSOQUC.js +0 -133
- package/dist/chunk-CJYCVNW2.js +0 -7
- package/dist/chunk-CM5CWO4K.js +0 -735
- package/dist/chunk-DEEHHLAP.js +0 -271
- package/dist/chunk-DPUJDOKV.js +0 -365
- package/dist/chunk-EJD47JHL.js +0 -1838
- package/dist/chunk-EJP263OP.js +0 -186
- package/dist/chunk-EVMUJYUD.js +0 -195
- package/dist/chunk-EYX4JMAU.js +0 -101
- package/dist/chunk-FC4IGH5Y.js +0 -18
- package/dist/chunk-FJYBLXV7.js +0 -89
- package/dist/chunk-FMUD3LDV.js +0 -19
- package/dist/chunk-FMYWORTP.js +0 -93
- package/dist/chunk-FVXLP7P3.js +0 -18
- package/dist/chunk-G6MHJDVT.js +0 -41
- package/dist/chunk-GVWEFECG.js +0 -18
- package/dist/chunk-HHBD4SQ6.js +0 -24
- package/dist/chunk-HS6FIOLP.js +0 -52
- package/dist/chunk-HY2SRSVM.js +0 -23
- package/dist/chunk-IHE6KVC3.js +0 -13
- package/dist/chunk-IN4M4X7P.js +0 -34
- package/dist/chunk-IUAAXXNO.js +0 -58
- package/dist/chunk-JXWNXIIZ.js +0 -219
- package/dist/chunk-K5NJBTE2.js +0 -18
- package/dist/chunk-KR6JF3BF.js +0 -14
- package/dist/chunk-KSTV7J2U.js +0 -112
- package/dist/chunk-KU3YLF6D.js +0 -106
- package/dist/chunk-LBEXLN6I.js +0 -91
- package/dist/chunk-LHZXYFBU.js +0 -94
- package/dist/chunk-LICYHPI3.js +0 -237
- package/dist/chunk-LNT64X7C.js +0 -81
- package/dist/chunk-LSLSG67V.js +0 -31
- package/dist/chunk-LVQLWRCU.js +0 -15
- package/dist/chunk-MYY2C5MB.js +0 -233
- package/dist/chunk-NKZMQV2C.js +0 -19
- package/dist/chunk-NTU2DXNG.js +0 -355
- package/dist/chunk-NXUY5XQN.js +0 -1062
- package/dist/chunk-NZO7M5GV.js +0 -18
- package/dist/chunk-OOL4KMG2.js +0 -71
- package/dist/chunk-OOSRUJBI.js +0 -19
- package/dist/chunk-PDJSUH24.js +0 -110
- package/dist/chunk-PTXBIDG7.js +0 -63
- package/dist/chunk-PVCEA4HZ.js +0 -6
- package/dist/chunk-QA3YCOML.js +0 -101
- package/dist/chunk-QFWQKS3M.js +0 -110
- package/dist/chunk-QS5L5YTJ.js +0 -24
- package/dist/chunk-QYZV2MQA.js +0 -97
- package/dist/chunk-RD2MID3M.js +0 -292
- package/dist/chunk-S3YUXDSC.js +0 -278
- package/dist/chunk-S7REMWW4.js +0 -21
- package/dist/chunk-TOM66P2P.js +0 -38
- package/dist/chunk-TRBGC4ZG.js +0 -112
- package/dist/chunk-UA5KS2PL.js +0 -26
- package/dist/chunk-UJCK5IW4.js +0 -187
- package/dist/chunk-UNYR5GLI.js +0 -23
- package/dist/chunk-UZXG6QSY.js +0 -58
- package/dist/chunk-VN5DLURA.js +0 -158
- package/dist/chunk-VP5TIXDK.js +0 -178
- package/dist/chunk-VPYBK2MG.js +0 -18
- package/dist/chunk-VTTA2ALZ.js +0 -16
- package/dist/chunk-W6GC6OKK.js +0 -16
- package/dist/chunk-WELIKLZF.js +0 -256
- package/dist/chunk-WOHX7YTH.js +0 -165
- package/dist/chunk-WSVMLNTO.js +0 -31
- package/dist/chunk-WYGD2UGN.js +0 -14
- package/dist/chunk-XCFC7LGF.js +0 -122
- package/dist/chunk-XJ2F2WO6.js +0 -8
- package/dist/chunk-XTEFPUSN.js +0 -23
- package/dist/chunk-YBLDE5CG.js +0 -42
- package/dist/chunk-YDGMBMYI.js +0 -25
- package/dist/chunk-YHYTW5QA.js +0 -20
- package/dist/chunk-ZCTUYGNV.js +0 -26
- package/dist/chunk-ZDAEGJH4.js +0 -102
- package/dist/chunk-ZJXSXVFP.js +0 -58
- package/dist/chunk-ZOWKWMD2.js +0 -18
- package/dist/chunk-ZUQW5VBZ.js +0 -89
package/LICENSE
CHANGED
|
@@ -1,21 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-2026
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
@archivist-gg/dnd5e Freeware Licence
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Shinoobi. All rights reserved.
|
|
4
|
+
|
|
5
|
+
This licence applies to the @archivist-gg/dnd5e package as published to the npm registry:
|
|
6
|
+
its dist folder and the documentation that comes with it, from version 0.3.24 on ("the
|
|
7
|
+
Software"). Versions released before 0.3.24 stay under the licence they were released with
|
|
8
|
+
(0.3.19 and earlier: the MIT License for the code).
|
|
9
|
+
|
|
10
|
+
1. What you may do
|
|
11
|
+
|
|
12
|
+
You may download, install and use the Software free of charge, for any lawful purpose, on
|
|
13
|
+
as many devices as you like. You may keep backup copies for your own use.
|
|
14
|
+
|
|
15
|
+
2. What you may not do
|
|
16
|
+
|
|
17
|
+
Unless the copyright holder has given you written permission, you may not:
|
|
18
|
+
|
|
19
|
+
(a) modify, adapt or translate the Software, or build other works on it;
|
|
20
|
+
(b) sell, rent, lease or sublicense the Software, or charge anyone for it;
|
|
21
|
+
(c) redistribute, publish or host copies of the Software, on their own or as part of
|
|
22
|
+
anything else. Point people to the official download instead.
|
|
23
|
+
|
|
24
|
+
3. Third-party material
|
|
25
|
+
|
|
26
|
+
The Software contains content from the System Reference Document 5.1 and 5.2 by Wizards of
|
|
27
|
+
the Coast LLC, licensed under the Creative Commons Attribution 4.0 International License
|
|
28
|
+
(CC-BY-4.0); see LICENSES/SRD.md for the attribution. The libraries the package depends on
|
|
29
|
+
(@archivist-gg/core, js-yaml, zod) are installed separately, under their own licences. That
|
|
30
|
+
material stays under its own licence. Nothing in this licence limits the rights that licence
|
|
31
|
+
gives you, and where the two differ for that material, its own licence applies.
|
|
32
|
+
|
|
33
|
+
4. No warranty
|
|
34
|
+
|
|
35
|
+
The Software is provided "as is", without warranty of any kind, express or implied,
|
|
36
|
+
including the warranties of merchantability, fitness for a particular purpose and
|
|
37
|
+
non-infringement.
|
|
38
|
+
|
|
39
|
+
5. Limitation of liability
|
|
40
|
+
|
|
41
|
+
In no event shall the copyright holder be liable for any claim, damages or other liability,
|
|
42
|
+
whether in an action of contract, tort or otherwise, arising from, out of or in connection
|
|
43
|
+
with the Software or its use.
|
|
44
|
+
|
|
45
|
+
6. End of this permission
|
|
46
|
+
|
|
47
|
+
This permission ends automatically if you break these terms. When it ends, you must stop
|
|
48
|
+
using the Software and delete your copies.
|
package/README.md
CHANGED
|
@@ -1,65 +1,43 @@
|
|
|
1
1
|
# @archivist-gg/dnd5e
|
|
2
2
|
|
|
3
|
-
The D&D 5e (2014
|
|
4
|
-
types for every entity type, the dice
|
|
5
|
-
engine, and the bundled SRD content. Built on
|
|
3
|
+
The D&D 5e (2014 and 2024) rules pack of Archivist, the D&D toolkit for Obsidian: parsers,
|
|
4
|
+
schemas, codecs and types for every entity type, the dice, formula and tag machinery, the
|
|
5
|
+
player-character engine, and the bundled SRD content. Built on `@archivist-gg/core`.
|
|
6
6
|
|
|
7
7
|
## What's inside
|
|
8
8
|
|
|
9
|
-
- **Entity types
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **SRD data** — System Reference Document 5.1 and 5.2 as `.md` sources plus
|
|
19
|
-
canonical/runtime JSON, loadable through `srd-store`.
|
|
9
|
+
- **Entity types**: armor, background, class, subclass, race, feat, optional-feature, item,
|
|
10
|
+
weapon, monster, npc and spell. Each has a parser, a [zod](https://zod.dev) schema, a codec and
|
|
11
|
+
TypeScript types, exposed as `@archivist-gg/dnd5e/<entity>/*` subpath exports.
|
|
12
|
+
- **Rules engine** (`dnd/*`): ability math, proficiency and XP, the formula and inline-tag
|
|
13
|
+
grammar, resource dice, and brace-tag conversion.
|
|
14
|
+
- **Player characters** (`pc/*`): parse, resolve and recalc a character into derived stats (AC,
|
|
15
|
+
saves, skills, speeds, attacks, spellcasting, resources, rests), plus the decision engine,
|
|
16
|
+
equipment and slotting, item benefits and conditions.
|
|
17
|
+
- **SRD data**: the System Reference Document 5.1 and 5.2, loadable through `srd-store`.
|
|
20
18
|
|
|
21
|
-
Common entry points are re-exported from the package root; everything else is
|
|
22
|
-
|
|
19
|
+
Common entry points are re-exported from the package root; everything else is available through
|
|
20
|
+
subpath exports.
|
|
23
21
|
|
|
24
|
-
##
|
|
22
|
+
## Install
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
}
|
|
24
|
+
```sh
|
|
25
|
+
npm install @archivist-gg/dnd5e
|
|
40
26
|
```
|
|
41
27
|
|
|
42
|
-
|
|
28
|
+
It brings `@archivist-gg/core`, `js-yaml` and `zod` with it.
|
|
43
29
|
|
|
44
30
|
```ts
|
|
45
31
|
import { parseMonster, dnd5ePack } from "@archivist-gg/dnd5e";
|
|
46
32
|
import { parsePC } from "@archivist-gg/dnd5e/pc/pc.parser";
|
|
47
33
|
```
|
|
48
34
|
|
|
49
|
-
##
|
|
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
|
|
35
|
+
## Licence
|
|
60
36
|
|
|
61
|
-
- **
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
[
|
|
37
|
+
- **The package:** from version 0.3.24 on, freeware: copyright Shinoobi, all rights reserved, free
|
|
38
|
+
to download and use, but you may not modify, sell or redistribute it. See [LICENSE](./LICENSE).
|
|
39
|
+
Versions up to 0.3.19 were published under the MIT License. The source code is not public.
|
|
40
|
+
- **The bundled SRD data:** System Reference Document 5.1 and 5.2 by Wizards of the Coast LLC,
|
|
41
|
+
licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode). The
|
|
42
|
+
package's licence does not restrict it. See [LICENSES/SRD.md](./LICENSES/SRD.md) for the
|
|
43
|
+
attribution.
|
|
@@ -1,10 +1,3 @@
|
|
|
1
1
|
import type { DocCodec } from "@archivist-gg/core";
|
|
2
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
3
|
export declare const armorCodec: DocCodec<ArmorEntity>;
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
armorCodec
|
|
3
|
-
} from "../chunk-FC4IGH5Y.js";
|
|
4
|
-
import "../chunk-UZXG6QSY.js";
|
|
5
|
-
import "../chunk-HS6FIOLP.js";
|
|
6
|
-
import "../chunk-UA5KS2PL.js";
|
|
7
|
-
export {
|
|
8
|
-
armorCodec
|
|
9
|
-
};
|
|
1
|
+
import{armorCodec}from"../chunk-AINRPPLH.js";import"../chunk-O2QZ73GA.js";import"../chunk-RE5Z5RNK.js";import"../chunk-I26FHSI6.js";export{armorCodec};
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
parseArmor
|
|
3
|
-
} from "../chunk-UZXG6QSY.js";
|
|
4
|
-
import "../chunk-HS6FIOLP.js";
|
|
5
|
-
import "../chunk-UA5KS2PL.js";
|
|
6
|
-
export {
|
|
7
|
-
parseArmor
|
|
8
|
-
};
|
|
1
|
+
import{parseArmor}from"../chunk-O2QZ73GA.js";import"../chunk-RE5Z5RNK.js";import"../chunk-I26FHSI6.js";export{parseArmor};
|
|
@@ -24,13 +24,10 @@ export interface ArmorEntity {
|
|
|
24
24
|
page?: number;
|
|
25
25
|
edition?: "2014" | "2024" | string;
|
|
26
26
|
entries?: unknown[];
|
|
27
|
-
/** Carried as the empty string on every converter armor carrier today (27). */
|
|
28
27
|
rendering_hint?: string;
|
|
29
|
-
/** The icon key (I3): a key of the renderer's icon set or a Lucide name. */
|
|
30
28
|
icon?: string;
|
|
31
29
|
has_fluff?: boolean;
|
|
32
30
|
has_fluff_images?: boolean;
|
|
33
|
-
/** One wikilink, or an array for >= 2 fluff images (images-ON emit). */
|
|
34
31
|
image?: z.infer<typeof imageField>;
|
|
35
32
|
raw?: Record<string, unknown>;
|
|
36
33
|
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import type { DocCodec } from "@archivist-gg/core";
|
|
2
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
3
|
export declare const backgroundCodec: DocCodec<BackgroundEntity>;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
backgroundCodec
|
|
3
|
-
} from "../chunk-3SIUAFDQ.js";
|
|
4
|
-
import "../chunk-NKZMQV2C.js";
|
|
5
|
-
import "../chunk-QFWQKS3M.js";
|
|
6
|
-
import "../chunk-IN4M4X7P.js";
|
|
7
|
-
import "../chunk-OOL4KMG2.js";
|
|
8
|
-
import "../chunk-JXWNXIIZ.js";
|
|
9
|
-
import "../chunk-UA5KS2PL.js";
|
|
10
|
-
export {
|
|
11
|
-
backgroundCodec
|
|
12
|
-
};
|
|
1
|
+
import{backgroundCodec}from"../chunk-NYTR6NJS.js";import"../chunk-VVJXZZ4Z.js";import"../chunk-L2DXF7YS.js";import"../chunk-TKIEPC6F.js";import"../chunk-LHH5XSEA.js";import"../chunk-ZVL5FXXO.js";import"../chunk-I26FHSI6.js";export{backgroundCodec};
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
parseBackground
|
|
3
|
-
} from "../chunk-NKZMQV2C.js";
|
|
4
|
-
import "../chunk-QFWQKS3M.js";
|
|
5
|
-
import "../chunk-IN4M4X7P.js";
|
|
6
|
-
import "../chunk-OOL4KMG2.js";
|
|
7
|
-
import "../chunk-JXWNXIIZ.js";
|
|
8
|
-
import "../chunk-UA5KS2PL.js";
|
|
9
|
-
export {
|
|
10
|
-
parseBackground
|
|
11
|
-
};
|
|
1
|
+
import{parseBackground}from"../chunk-VVJXZZ4Z.js";import"../chunk-L2DXF7YS.js";import"../chunk-TKIEPC6F.js";import"../chunk-LHH5XSEA.js";import"../chunk-ZVL5FXXO.js";import"../chunk-I26FHSI6.js";export{parseBackground};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
backgroundEntitySchema,
|
|
3
|
-
langProfSchema
|
|
4
|
-
} from "../chunk-QFWQKS3M.js";
|
|
5
|
-
import "../chunk-IN4M4X7P.js";
|
|
6
|
-
import "../chunk-OOL4KMG2.js";
|
|
7
|
-
import "../chunk-JXWNXIIZ.js";
|
|
8
|
-
import "../chunk-UA5KS2PL.js";
|
|
9
|
-
export {
|
|
10
|
-
backgroundEntitySchema,
|
|
11
|
-
langProfSchema
|
|
12
|
-
};
|
|
1
|
+
import{backgroundEntitySchema,langProfSchema}from"../chunk-L2DXF7YS.js";import"../chunk-TKIEPC6F.js";import"../chunk-LHH5XSEA.js";import"../chunk-ZVL5FXXO.js";import"../chunk-I26FHSI6.js";export{backgroundEntitySchema,langProfSchema};
|
|
@@ -50,11 +50,8 @@ export interface BackgroundEntity {
|
|
|
50
50
|
origin_feat: string | null;
|
|
51
51
|
suggested_characteristics: SuggestedCharacteristics | null;
|
|
52
52
|
choices?: Choice[];
|
|
53
|
-
/** Converter/bundle extras declared by background.schema.ts §2.6; all optional, none read today. */
|
|
54
53
|
rendering_hint?: string;
|
|
55
54
|
has_fluff_images?: boolean;
|
|
56
|
-
/** 88 roll tables over 67 docs; `roll` is a STRING on every row ("1", "2-3"). Render is G3b's
|
|
57
|
-
* (the 2026-09-02 G3 split; G3a renders no background tables). */
|
|
58
55
|
tables?: Array<{
|
|
59
56
|
name: string;
|
|
60
57
|
dice: string;
|
|
@@ -64,11 +61,9 @@ export interface BackgroundEntity {
|
|
|
64
61
|
}>;
|
|
65
62
|
}>;
|
|
66
63
|
additional_spells?: AdditionalSpellsEntry[];
|
|
67
|
-
/** The kind is CLOSED at the converter's only push site (background-mapper.ts). */
|
|
68
64
|
prerequisites?: Array<{
|
|
69
65
|
kind: "campaign";
|
|
70
66
|
slug: string;
|
|
71
67
|
}>;
|
|
72
|
-
/** One wikilink, or an array of them for the multi-fluff-image emit. */
|
|
73
68
|
image?: string | string[];
|
|
74
69
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function isCategoryGrant(g){return!!g&&typeof g==="object"&&typeof g.category==="string"&&g.category.length>0}var equipmentCategoryKey=(i,j,k)=>`equipment-${i}-opt-${j}-cat-${k}`;var equipmentCategoryKeys=(grants,i,j)=>grants.flatMap((g,k)=>isCategoryGrant(g)?[equipmentCategoryKey(i,j,k)]:[]);var isStartingEquipmentKey=key=>key.startsWith("equipment-");export{isCategoryGrant,equipmentCategoryKey,equipmentCategoryKeys,isStartingEquipmentKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var TAG_TYPE_ALIASES={atk:"atk",attack:"atk",dmg:"dmg",damage:"dmg",dc:"dc",dice:"dice"};function normalizeTagType(input){var _a;const lower=input.toLowerCase().trim();return(_a=TAG_TYPE_ALIASES[lower])!=null?_a:null}var ABILITY_RE=/^(str|dex|con|int|wis|cha)$/i;var PB_RE=/^pb$/i;var DICE_RE=/^(\d+)d(\d+)$/;var LITERAL_RE=/^([+-]?\d+)$/;var SLUG_RE=/^\[\[([^[\]]+)\]\]$/;function parseTagTerms(content){const out={pbTerm:false,literalTerms:[],diceTerms:[],slugTerms:[]};const trimmed=content.trim();if(trimmed.length===0)return{error:"empty content"};const tokens=[];let i=0;const advancePastTerm=start=>{let j=start;while(j<trimmed.length&&trimmed[j]!=="+"&&trimmed[j]!=="-"){if(trimmed[j]==="["&&trimmed[j+1]==="["){const close=trimmed.indexOf("]]",j+2);if(close===-1)return trimmed.length;j=close+2;continue}j++}return j};while(i<trimmed.length){if(trimmed[i]==="+"||trimmed[i]==="-"){const j=advancePastTerm(i+1);tokens.push(trimmed.slice(i,j));i=j}else{const j=advancePastTerm(i);tokens.push(trimmed.slice(i,j));i=j}}for(let raw of tokens){raw=raw.trim();if(raw.length===0)return{error:"empty term"};let signed=raw;let body=raw;if(raw[0]==="+"||raw[0]==="-"){body=raw.slice(1).trim()}else{signed="+"+raw}if(DICE_RE.test(body)){const m=body.match(DICE_RE);out.diceTerms.push({count:Number.parseInt(m[1],10),sides:Number.parseInt(m[2],10)});continue}if(ABILITY_RE.test(body)){if(out.abilityTerm)return{error:`multiple ability terms (${out.abilityTerm}, ${body.toLowerCase()})`};out.abilityTerm=body.toLowerCase();continue}if(PB_RE.test(body)){if(out.pbTerm)return{error:"duplicate PB term"};out.pbTerm=true;continue}const slugMatch=body.match(SLUG_RE);if(slugMatch){out.slugTerms.push(slugMatch[1]);continue}if(LITERAL_RE.test(signed)){out.literalTerms.push(Number.parseInt(signed,10));continue}return{error:`unrecognized term: ${raw}`}}return out}export{normalizeTagType,parseTagTerms};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{STATIC_FALLBACK_CONTEXT,convertDescToTags}from"./chunk-MGGKZGLG.js";function enrichSpell(raw){var _a,_b,_c,_d;const duration=raw.duration;const concentration=(_b=raw.concentration)!=null?_b:(_a=duration==null?void 0:duration.toLowerCase().includes("concentration"))!=null?_a:false;const classes=((_c=raw.classes)==null?void 0:_c.length)?raw.classes:["Wizard","Sorcerer"];const enriched={...raw,concentration,ritual:(_d=raw.ritual)!=null?_d:false,classes};if(typeof enriched.description==="string"){enriched.description=convertDescToTags(enriched.description,STATIC_FALLBACK_CONTEXT)}if(Array.isArray(enriched.at_higher_levels)){enriched.at_higher_levels=enriched.at_higher_levels.map(p=>convertDescToTags(p,STATIC_FALLBACK_CONTEXT))}return enriched}export{enrichSpell};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var DECISION_SIGNAL=[/\bchoose (one|two|three|a|an)\b/i,/\bof your choice\b/i,/\byour choice of\b/i];var ASI_FEAT={kind:"select-entity",id:"feat",entity_type:"feat",count:1};var TABLE={"ability-score-improvement":[ASI_FEAT],"expertise":[{kind:"select-proficiency",id:"expertise",count:2,domain:"skill",from_proficient:true,expertise:true}],"fighting-style":[{kind:"select-entity",id:"fighting-style",count:1,entity_type:"optional-feature",where:{feature_type:"fighting_style",available_to:"self"}}]};function recognizeDecision(feature){var _a,_b;const slug=((_a=feature.id)!=null?_a:feature.name).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"");if(TABLE[slug])return TABLE[slug];const desc=(_b=feature.description)!=null?_b:"";return DECISION_SIGNAL.some(re=>re.test(desc))?"informational":null}export{DECISION_SIGNAL,recognizeDecision};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var FEAT_CATEGORY_CODE_LABELS={D:"Dragonmark",G:"General",O:"Origin",FS:"Fighting Style",EB:"Epic Boon",DG:"Dark Gift","FS:P":"Fighting Style","FS:R":"Fighting Style"};function featCategoryLabel(code){var _a;return(_a=FEAT_CATEGORY_CODE_LABELS[code])!=null?_a:code}var FEAT_PROGRESSION_CATEGORY={FS:"fighting-style","FS:P":"fighting-style","FS:R":"fighting-style",EB:"epic-boon",O:"origin",G:"general"};function featCategoryOf(value){const v=value.trim();if(Object.prototype.hasOwnProperty.call(FEAT_PROGRESSION_CATEGORY,v))return FEAT_PROGRESSION_CATEGORY[v];const upper=v.toUpperCase();if(Object.prototype.hasOwnProperty.call(FEAT_PROGRESSION_CATEGORY,upper))return FEAT_PROGRESSION_CATEGORY[upper];return v.toLowerCase()}var FEATURE_TYPE_FOR_CATEGORY={"fighting-style":"fighting_style"};function featProgressionCategory(codes){for(const code of codes!=null?codes:[]){if(Object.prototype.hasOwnProperty.call(FEAT_PROGRESSION_CATEGORY,code)){return FEAT_PROGRESSION_CATEGORY[code]}}return void 0}export{FEAT_CATEGORY_CODE_LABELS,featCategoryLabel,FEAT_PROGRESSION_CATEGORY,featCategoryOf,FEATURE_TYPE_FOR_CATEGORY,featProgressionCategory};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveBaseItem}from"./chunk-PZ4L2EEG.js";import{bareEntitySlug,slugify,wikilinkTailSlug}from"./chunk-63YJPWTM.js";function nonEmptyRef(v){return typeof v==="string"&&v.length>0?v:null}function isContainerItem(entity){if(!entity||typeof entity!=="object")return false;const c=entity.container;if(!c||typeof c!=="object")return false;const container=c;if(typeof container.holds_items==="boolean")return container.holds_items;if(typeof container.capacity_weight==="number"&&container.capacity_weight>0)return true;const cap=container.capacity;if(!cap||typeof cap!=="object")return false;const k=cap;if(Array.isArray(k.weight)&&k.weight.length>0)return true;if(Array.isArray(k.item)&&k.item.length>0)return true;return k.weightless===true}function idOwners(equipment){const ownerOfId=new Map;const duplicateIds=[];equipment.forEach((entry,i)=>{const id=nonEmptyRef(entry.id);if(id===null)return;if(ownerOfId.has(id))duplicateIds.push(i);else ownerOfId.set(id,i)});return{ownerOfId,duplicateIds}}function entityOfEntry(entry,registry){var _a,_b;if(!registry)return null;return(_b=(_a=resolveBaseItem(entry.item,registry))==null?void 0:_a.data)!=null?_b:null}function resolveContainment(equipment,registry){const n=equipment.length;const{ownerOfId,duplicateIds}=idOwners(equipment);const entities=equipment.map(entry=>entityOfEntry(entry,registry));const isContainer=entities.map(entity=>isContainerItem(entity));const parentOf=new Array(n).fill(null);const broken=[];const closesCycle=(child,owner)=>{for(let cur=owner;cur!==null;cur=parentOf[cur])if(cur===child)return true;return false};for(let i=0;i<n;i++){const target=nonEmptyRef(equipment[i].in);if(target===null)continue;const owner=ownerOfId.get(target);let reason=null;if(equipment[i].equipped===true)reason="equipped";else if(owner===void 0)reason="missing";else if(owner===i)reason="self";else if(entities[owner]===null)reason="unresolved";else if(!isContainer[owner])reason="not-container";else if(closesCycle(i,owner))reason="cycle";if(reason!==null){broken.push({index:i,reason});continue}parentOf[i]=owner}const childrenOf=Array.from({length:n},()=>[]);parentOf.forEach((p,i)=>{if(p!==null)childrenOf[p].push(i)});return{parentOf,childrenOf,isContainer,ownerOfId,duplicateIds,broken}}function mintBase(entry,registry){var _a,_b,_c;const found=registry?resolveBaseItem(entry.item,registry):null;const byName=found?slugify((_a=found.name)!=null?_a:""):"";if(byName)return byName;const inner=(_c=(_b=/^\[\[(.+?)\]\]$/.exec(entry.item.trim()))==null?void 0:_b[1])!=null?_c:entry.item.trim();const ref=inner.split("|")[0].trim();const byRef=ref.includes("/")?wikilinkTailSlug(ref):slugify(bareEntitySlug(ref));return byRef||"item"}function ensureEntryId(equipment,index,registry){const{ownerOfId}=idOwners(equipment);const own=nonEmptyRef(equipment[index].id);if(own!==null&&ownerOfId.get(own)===index)return own;const taken=new Set;for(const entry of equipment){const a=nonEmptyRef(entry.id);if(a!==null)taken.add(a);const b=nonEmptyRef(entry.in);if(b!==null)taken.add(b)}const base=mintBase(equipment[index],registry);let id=base;for(let k=2;taken.has(id);k++)id=`${base}-${k}`;equipment[index].id=id;return id}function canMoveInto(equipment,index,target,registry){var _a;const inRange=i=>Number.isInteger(i)&&i>=0&&i<equipment.length;if(!inRange(index)||target!==null&&!inRange(target))return{ok:false,reason:"out-of-range"};if(target===null)return{ok:true};if(equipment[index].equipped===true)return{ok:false,reason:"equipped"};if(target===index)return{ok:false,reason:"self"};const view=resolveContainment(equipment,registry);const unresolvedLink=new Set(view.broken.filter(b=>b.reason==="unresolved").map(b=>b.index));const seen=new Set;for(let cur=target;cur!==null&&!seen.has(cur);){if(cur===index)return{ok:false,reason:"descendant"};seen.add(cur);const up=view.parentOf[cur];if(up!==null){cur=up;continue}if(unresolvedLink.has(cur)){const raw=nonEmptyRef(equipment[cur].in);cur=raw===null?null:(_a=view.ownerOfId.get(raw))!=null?_a:null;continue}cur=null}const entity=entityOfEntry(equipment[target],registry);if(entity===null)return{ok:false,reason:"unresolved"};if(!isContainerItem(entity))return{ok:false,reason:"not-container"};return{ok:true}}function moveInto(equipment,index,target,registry){const check=canMoveInto(equipment,index,target,registry);if(!check.ok)return check;const entry=equipment[index];if(target===null){const had=entry.in!==void 0;delete entry.in;return{ok:true,changed:had}}const wasHonoured=resolveContainment(equipment,registry).parentOf[index]===target;const idBefore=equipment[target].id;const id=ensureEntryId(equipment,target,registry);entry.in=id;return{ok:true,changed:idBefore!==id||!wasHonoured}}function repairContainment(equipment,registry){if(!registry)return 0;let removed=0;for(const entry of equipment){if(entry.id===""){delete entry.id;removed++}if(entry.in===""){delete entry.in;removed++}}const view=resolveContainment(equipment,registry);for(const b of view.broken){if(b.reason==="unresolved")continue;delete equipment[b.index].in;removed++}for(const i of view.duplicateIds){delete equipment[i].id;removed++}return removed}export{nonEmptyRef,isContainerItem,idOwners,entityOfEntry,resolveContainment,ensureEntryId,canMoveInto,moveInto,repairContainment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseWeapon}from"./chunk-BZ6BGGZS.js";import yaml from"js-yaml";var weaponCodec={parse(doc){return parseWeapon(doc.body)},serialize(entity){return yaml.dump(entity,{lineWidth:-1,sortKeys:false})}};export{weaponCodec};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveBaseItem}from"./chunk-PZ4L2EEG.js";function isItemEntity(e){return!!e&&typeof e==="object"&&"rarity"in e}function isWeaponEntity(e){if(!e||typeof e!=="object")return false;if(!("damage"in e)||!("category"in e))return false;const cat=e.category;return typeof cat==="string"&&/melee|ranged/.test(cat)}function isArmorEntity(e){return!!e&&typeof e==="object"&&"ac"in e&&"category"in e&&!("damage"in e)}function resolveEntityForEntry(item,registry){const found=resolveBaseItem(item,registry);if(!found)return{entity:null,entityType:null};return{entity:found.data,entityType:found.entityType}}function isShieldArmor(armor){var _a,_b;if(armor.category==="shield")return true;const slug=((_a=armor.slug)!=null?_a:"").toLowerCase();if(slug==="shield"||slug.endsWith("_shield")||slug.endsWith("-shield"))return true;return((_b=armor.name)!=null?_b:"").trim().toLowerCase()==="shield"}function effectiveArmor(entity,registry){if(isArmorEntity(entity))return entity;if(isItemEntity(entity)&&typeof entity.base_item==="string"){const base=resolveBaseItem(entity.base_item,registry);if((base==null?void 0:base.entityType)==="armor")return base.data}return null}function effectiveWeapon(entity,registry){if(isWeaponEntity(entity))return entity;if(isItemEntity(entity)&&typeof entity.base_item==="string"){const base=resolveBaseItem(entity.base_item,registry);if((base==null?void 0:base.entityType)==="weapon"&&isWeaponEntity(base.data))return base.data}return null}function isTwoHandedWeapon(entity,registry){if(!entity||typeof entity!=="object")return false;const own=entity.properties;if(Array.isArray(own)&&own.length>0)return own.some(p=>p==="two_handed");if(!registry)return false;const weapon=effectiveWeapon(entity,registry);return!!weapon&&Array.isArray(weapon.properties)&&weapon.properties.some(p=>p==="two_handed")}function armorAcTerm(armor){var _a;return armor.ac.base+((_a=armor.ac.flat)!=null?_a:0)}function slotAcTerms(armor,entry){var _a;const bonus=(_a=entry==null?void 0:entry.overrides)==null?void 0:_a.ac_bonus;return{armor:armor?armorAcTerm(armor):null,override:typeof bonus==="number"?bonus:0}}function defaultSlotForType(entityType,entity,registry){if(entityType==="weapon")return"mainhand";if(entityType==="armor"){return isArmorEntity(entity)&&isShieldArmor(entity)?"shield":"armor"}if(entityType==="item"&&isItemEntity(entity)&&typeof entity.base_item==="string"){const base=resolveBaseItem(entity.base_item,registry);if((base==null?void 0:base.entityType)==="weapon")return"mainhand";if((base==null?void 0:base.entityType)==="armor"){const armorData=base.data;return isShieldArmor(armorData)?"shield":"armor"}}return null}export{isItemEntity,isWeaponEntity,isArmorEntity,resolveEntityForEntry,isShieldArmor,effectiveArmor,effectiveWeapon,isTwoHandedWeapon,armorAcTerm,slotAcTerms,defaultSlotForType};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ALL_SKILL_SLUGS=["acrobatics","animal-handling","arcana","athletics","deception","history","insight","intimidation","investigation","medicine","nature","perception","performance","persuasion","religion","sleight-of-hand","stealth","survival"];var STANDARD_LANGUAGES=["common","dwarvish","elvish","giant","gnomish","goblin","halfling","orc"];var EXOTIC_LANGUAGES=["abyssal","celestial","deep-speech","draconic","infernal","primordial","sylvan","undercommon"];var SECRET_LANGUAGES=["druidic","thieves'-cant"];var ALL_LANGUAGES=[...STANDARD_LANGUAGES,...EXOTIC_LANGUAGES,...SECRET_LANGUAGES];var ARTISANS_TOOLS=["alchemist's-supplies","brewer's-supplies","calligrapher's-supplies","carpenter's-tools","cartographer's-tools","cobbler's-tools","cook's-utensils","glassblower's-tools","jeweler's-tools","leatherworker's-tools","mason's-tools","painter's-supplies","potter's-tools","smith's-tools","tinker's-tools","weaver's-tools","woodcarver's-tools"];var MUSICAL_INSTRUMENTS=["bagpipes","drum","dulcimer","flute","horn","lute","lyre","pan-flute","shawm","viol"];var GAMING_SETS=["dice-set","playing-cards"];var OTHER_TOOLS=["disguise-kit","forgery-kit","herbalism-kit","navigator's-tools","poisoner's-kit","thieves'-tools"];var ALL_TOOLS=[...ARTISANS_TOOLS,...MUSICAL_INSTRUMENTS,...GAMING_SETS,...OTHER_TOOLS];export{ALL_SKILL_SLUGS,STANDARD_LANGUAGES,EXOTIC_LANGUAGES,SECRET_LANGUAGES,ALL_LANGUAGES,ARTISANS_TOOLS,MUSICAL_INSTRUMENTS,GAMING_SETS,OTHER_TOOLS,ALL_TOOLS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spellEntitySchema}from"./chunk-7EL3GWWJ.js";import{parseYaml,toStringSafe}from"@archivist-gg/core";var KNOWN_KEYS=new Set(["name","level","school","casting_time","range","components","duration","concentration","ritual","classes","description","at_higher_levels","damage","damage_roll","saving_throw","casting_options","rendering_hint","misc_tags","area_tags","condition_inflict","affects_creature_type","spell_attack","ability_check","damage_resist","damage_immune","condition_immune","damage_vulnerable","has_fluff","image","has_fluff_images","slug","edition","source"]);var DURATION_END_WORDS={dispel:"dispelled",trigger:"triggered"};function normalizeSpellComponents(value){if(typeof value==="string")return value;if(value==null||typeof value!=="object"||Array.isArray(value))return toStringSafe(value);const c=value;const parts=[];if(c.v===true)parts.push("V");if(c.s===true)parts.push("S");if(typeof c.m==="string")parts.push(`M (${c.m})`);else if(c.m===true)parts.push("M");else if(c.m!=null&&typeof c.m==="object"){const text=c.m.text;parts.push(typeof text==="string"?`M (${text})`:"M")}if(c.r===true)parts.push("R");return parts.join(", ")}function spellMaterialOf(value){if(value==null||typeof value!=="object"||Array.isArray(value))return void 0;const m=value.m;if(m==null||typeof m!=="object"||Array.isArray(m))return void 0;const{text,cost,consume}=m;if(typeof text!=="string")return void 0;return{text,...typeof cost==="number"?{cost}:{},...typeof consume==="boolean"||typeof consume==="string"?{consume}:{}}}function normalizeSpellDurationEntry(entry){if(entry==null||typeof entry!=="object")return toStringSafe(entry);const e=entry;if(e.type==="permanent"&&Array.isArray(e.ends)){return"until "+e.ends.map(w=>{var _a;return(_a=DURATION_END_WORDS[String(w)])!=null?_a:String(w)}).join(" or ")}if(e.type==="timed"&&e.duration!=null){const unit=e.duration.type;const amount=e.duration.amount;if(typeof unit==="string"&&typeof amount==="number"){const prefix=e.duration.up_to===true?"up to ":"";return`${prefix}${amount} ${unit}${amount>1?"s":""}`}}return toStringSafe(entry)}function normalizeSpellDuration(value){if(typeof value==="string")return value;if(!Array.isArray(value))return toStringSafe(value);return value.map(entry=>normalizeSpellDurationEntry(entry)).join("; ")}function mirrorSpellShapes(entity){const material=spellMaterialOf(entity.components);return{...entity,...entity.components!=null?{components:normalizeSpellComponents(entity.components)}:{},...material?{material}:{},...entity.duration!=null?{duration:normalizeSpellDuration(entity.duration)}:{}}}function parseSpell(source){const result=parseYaml(source,["name"]);if(!result.success)return result;const meta={};if(typeof result.data.source==="string")meta.source=result.data.source;if(typeof result.data.edition==="string")meta.edition=result.data.edition;const filtered={};for(const[k,v]of Object.entries(result.data)){if(k==="slug"||k==="edition"||k==="source")continue;if(!KNOWN_KEYS.has(k)){return{success:false,error:`Unknown spell field: ${k}`}}filtered[k]=v}const parsed=spellEntitySchema.safeParse(filtered);if(!parsed.success){return{success:false,error:`spell schema validation failed: ${parsed.error.message}`}}const raw=parsed.data;const spell={name:raw.name};if(raw.level!=null)spell.level=raw.level;if(raw.school!=null)spell.school=toStringSafe(raw.school);if(raw.casting_time!=null)spell.casting_time=toStringSafe(raw.casting_time);if(raw.range!=null)spell.range=toStringSafe(raw.range);if(raw.components!=null)spell.components=normalizeSpellComponents(raw.components);if(raw.duration!=null)spell.duration=normalizeSpellDuration(raw.duration);const material=spellMaterialOf(raw.components);if(material)spell.material=material;if(raw.concentration!=null)spell.concentration=Boolean(raw.concentration);if(raw.ritual!=null)spell.ritual=Boolean(raw.ritual);if(raw.classes)spell.classes=raw.classes.map(String);if(raw.description)spell.description=raw.description;if(raw.at_higher_levels)spell.at_higher_levels=raw.at_higher_levels.map(String);if(raw.damage)spell.damage={types:raw.damage.types.map(String)};if(raw.damage_roll!=null)spell.damage_roll=raw.damage_roll;if(raw.saving_throw)spell.saving_throw={ability:raw.saving_throw.ability};if(raw.casting_options){spell.casting_options=raw.casting_options.map(opt=>{const co={type:opt.type};if(opt.damage_roll!==void 0)co.damage_roll=opt.damage_roll;if(opt.target_count!==void 0)co.target_count=opt.target_count;if(opt.duration!==void 0)co.duration=opt.duration;if(opt.range!==void 0)co.range=opt.range;if(opt.concentration!==void 0)co.concentration=opt.concentration;if(opt.shape_size!==void 0)co.shape_size=opt.shape_size;if(opt.desc!==void 0)co.desc=opt.desc;return co})}if(raw.rendering_hint!=null)spell.rendering_hint=raw.rendering_hint;if(raw.misc_tags!=null)spell.misc_tags=raw.misc_tags;if(raw.area_tags!=null)spell.area_tags=raw.area_tags;if(raw.condition_inflict!=null)spell.condition_inflict=raw.condition_inflict;if(raw.affects_creature_type!=null)spell.affects_creature_type=raw.affects_creature_type;if(raw.spell_attack!=null)spell.spell_attack=raw.spell_attack;if(raw.ability_check!=null)spell.ability_check=raw.ability_check;if(raw.damage_resist!=null)spell.damage_resist=raw.damage_resist;if(raw.damage_immune!=null)spell.damage_immune=raw.damage_immune;if(raw.condition_immune!=null)spell.condition_immune=raw.condition_immune;if(raw.damage_vulnerable!=null)spell.damage_vulnerable=raw.damage_vulnerable;if(raw.has_fluff!=null)spell.has_fluff=raw.has_fluff;if(raw.image!=null)spell.image=raw.image;if(raw.has_fluff_images!=null)spell.has_fluff_images=raw.has_fluff_images;if(meta.source)spell.source=meta.source;if(meta.edition)spell.edition=meta.edition;return{success:true,data:spell}}export{normalizeSpellComponents,spellMaterialOf,normalizeSpellDuration,mirrorSpellShapes,parseSpell};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{featureSchema}from"./chunk-NIWLD33X.js";import{choiceSchema}from"./chunk-LHH5XSEA.js";import{additionalSpellsEntrySchema,imageField}from"./chunk-I26FHSI6.js";import{z}from"zod";var abilityEnum=z.enum(["str","dex","con","int","wis","cha"]);var editionEnum=z.enum(["2014","2024"]);var sizeEnum=z.enum(["tiny","small","medium","large","huge"]);var wikilinkRegex=/^\[\[[^[\]]+\]\]$/;var speedSchema=z.object({walk:z.number().int().nonnegative().optional(),fly:z.number().int().nonnegative().optional(),swim:z.number().int().nonnegative().optional(),climb:z.number().int().nonnegative().optional(),burrow:z.number().int().nonnegative().optional(),hover:z.boolean().optional()});var visionSchema=z.object({darkvision:z.number().int().nonnegative().optional(),blindsight:z.number().int().nonnegative().optional(),tremorsense:z.number().int().nonnegative().optional(),truesight:z.number().int().nonnegative().optional()});var fixedAsiSchema=z.object({ability:abilityEnum,amount:z.number().int()});var choiceAsiSchema=z.object({choose:z.number().int().positive(),pool:z.array(abilityEnum).nonempty(),amount:z.number().int()});var asiSchema=z.union([fixedAsiSchema,choiceAsiSchema]);var languagesSchema=z.object({fixed:z.array(z.string()),choice:z.object({count:z.number().int().positive(),from:z.union([z.string(),z.array(z.string())])}).optional()});var raceEntitySchema=z.object({slug:z.string().min(1),name:z.string().min(1),edition:editionEnum,source:z.string().min(1),description:z.string(),size:sizeEnum,speed:speedSchema,ability_score_increases:z.array(asiSchema),age:z.string(),alignment:z.string(),vision:visionSchema,languages:languagesSchema,variant_label:z.string().min(1),traits:z.array(featureSchema),choices:z.array(choiceSchema).optional(),subspecies_of:z.string().regex(wikilinkRegex).optional(),rendering_hint:z.string().optional(),has_fluff:z.boolean().optional(),has_fluff_images:z.boolean().optional(),creature_type:z.array(z.string().min(1)).optional(),creature_type_tags:z.array(z.string().min(1)).optional(),additional_spells:z.union([z.array(additionalSpellsEntrySchema),additionalSpellsEntrySchema]).optional(),trait_tags:z.unknown().optional(),lineage:z.unknown().optional(),height_and_weight:z.unknown().optional(),sound_clip:z.unknown().optional(),image:imageField});export{fixedAsiSchema,raceEntitySchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isTwoHandedWeapon}from"./chunk-4IAMSRHD.js";function unwrapSlug(maybeWiki){if(!maybeWiki)return"";const m=/^\[\[([^\]]+)\]\]$/.exec(maybeWiki);return(m?m[1]:maybeWiki).toLowerCase()}function evaluateCondition(cond,ctx){var _a;switch(cond.kind){case"no_armor":return ctx.derived.equippedSlots.armor===void 0?"true":"false";case"no_shield":return ctx.derived.equippedSlots.shield===void 0?"true":"false";case"wielding_two_handed":return isTwoHandedWeapon((_a=ctx.derived.equippedSlots.mainhand)==null?void 0:_a.entity,ctx.registry)?"true":"false";case"is_class":{const target=cond.value.toLowerCase();return ctx.classList.some(c=>unwrapSlug(c.name)===target)?"true":"false"}case"is_race":return unwrapSlug(ctx.race)===cond.value.toLowerCase()?"true":"false";case"is_subclass":return ctx.subclasses.some(s=>s.toLowerCase()===cond.value.toLowerCase())?"true":"false";case"vs_creature_type":case"vs_attack_type":case"on_attack_type":case"with_weapon_property":case"vs_spell_save":case"lighting":case"underwater":case"movement_state":case"has_condition":case"is_concentrating":case"bloodied":return"informational";case"raw":return"informational";case"any_of":{let sawInformational=false;for(const branch of cond.conditions){const o=evaluateCondition(branch,ctx);if(o==="true")return"true";if(o==="informational")sawInformational=true}return sawInformational?"informational":"false"}}}function evaluateConditions(conds,ctx){let sawInformational=false;for(const c of conds){const o=evaluateCondition(c,ctx);if(o==="false")return"false";if(o==="informational")sawInformational=true}return sawInformational?"informational":"true"}export{evaluateCondition,evaluateConditions};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{imageField}from"./chunk-I26FHSI6.js";import{z}from"zod";var tier1Conditions=[z.object({kind:z.literal("no_armor")}),z.object({kind:z.literal("no_shield")}),z.object({kind:z.literal("wielding_two_handed")}),z.object({kind:z.literal("is_class"),value:z.string()}),z.object({kind:z.literal("is_race"),value:z.string()}),z.object({kind:z.literal("is_subclass"),value:z.string()})];var tier2Conditions=[z.object({kind:z.literal("vs_creature_type"),value:z.string()}),z.object({kind:z.literal("vs_attack_type"),value:z.enum(["ranged","melee"])}),z.object({kind:z.literal("on_attack_type"),value:z.enum(["ranged","melee"])}),z.object({kind:z.literal("with_weapon_property"),value:z.string()}),z.object({kind:z.literal("vs_spell_save")})];var tier3Conditions=[z.object({kind:z.literal("lighting"),value:z.enum(["dim","bright","daylight","darkness"])}),z.object({kind:z.literal("underwater")}),z.object({kind:z.literal("movement_state"),value:z.enum(["flying","swimming","climbing","mounted"])})];var tier4Conditions=[z.object({kind:z.literal("has_condition"),value:z.string()}),z.object({kind:z.literal("is_concentrating")}),z.object({kind:z.literal("bloodied")})];var rawCondition=z.object({kind:z.literal("raw"),text:z.string()});var conditionSchema=z.lazy(()=>z.discriminatedUnion("kind",[...tier1Conditions,...tier2Conditions,...tier3Conditions,...tier4Conditions,rawCondition,z.object({kind:z.literal("any_of"),conditions:z.array(conditionSchema)})]));var conditionalBonusSchema=z.object({value:z.number().int(),when:z.array(conditionSchema)});var numberOrConditional=z.union([z.number().int(),conditionalBonusSchema]);var abilityEnum=z.enum(["str","dex","con","int","wis","cha"]);var bonusesSchema=z.object({ac:numberOrConditional.optional(),weapon_attack:numberOrConditional.optional(),weapon_damage:numberOrConditional.optional(),spell_attack:numberOrConditional.optional(),spell_save_dc:numberOrConditional.optional(),saving_throws:numberOrConditional.optional(),spell_damage:numberOrConditional.optional(),ability_check:numberOrConditional.optional(),proficiency_bonus:numberOrConditional.optional(),saving_throw_concentration:numberOrConditional.optional(),ability_scores:z.object({static:z.object({str:z.number().int().optional(),dex:z.number().int().optional(),con:z.number().int().optional(),int:z.number().int().optional(),wis:z.number().int().optional(),cha:z.number().int().optional()}).optional(),bonus:z.object({str:numberOrConditional.optional(),dex:numberOrConditional.optional(),con:numberOrConditional.optional(),int:numberOrConditional.optional(),wis:numberOrConditional.optional(),cha:numberOrConditional.optional()}).optional(),choose:z.array(z.strictObject({from:z.array(abilityEnum),count:z.number().int().positive(),amount:z.number().int().optional()})).optional()}).optional(),speed:z.object({walk:numberOrConditional.optional(),fly:z.union([numberOrConditional,z.literal("walk")]).optional(),swim:numberOrConditional.optional(),climb:numberOrConditional.optional()}).optional()});var chargesSchema=z.object({max:z.number().int(),dice:z.string().optional(),recharge:z.string().optional(),recharge_amount:z.string().optional(),destroy_on_empty:z.object({roll:z.string(),threshold:z.number().int(),effect:z.string().optional()}).optional()});var attachedSpellsSchema=z.object({charges:z.record(z.string(),z.array(z.string())).optional(),daily:z.record(z.string(),z.array(z.string())).optional(),will:z.array(z.string()).optional(),rest:z.record(z.string(),z.array(z.string())).optional(),limited:z.record(z.string(),z.array(z.string())).optional(),other:z.array(z.string()).optional(),ability:z.string().optional(),ritual:z.array(z.string()).optional()});var attunementTagSchema=z.union([z.object({class:z.string(),subclass:z.string().optional(),alignment:z.union([z.string(),z.array(z.string())]).optional()}),z.object({alignment:z.union([z.string(),z.array(z.string())]),race:z.string().optional()}),z.object({race:z.string(),alignment:z.union([z.string(),z.array(z.string())]).optional()}),z.object({creature_type:z.string(),size:z.string().optional()}),z.object({spellcasting:z.boolean()}),z.object({background:z.string()}),z.object({psionics:z.boolean()}),z.object({int:z.number().int()}),z.object({skill_proficiency:z.array(z.string())}),z.object({language_proficiency:z.array(z.string())})]);var attunementCanonicalSchema=z.object({required:z.boolean(),restriction:z.string().optional(),tags:z.array(attunementTagSchema).optional()});var grantsSchema=z.object({proficiency:z.boolean().optional(),languages:z.union([z.boolean(),z.array(z.string())]).optional(),senses:z.object({darkvision:z.number().optional(),tremorsense:z.number().optional(),truesight:z.number().optional(),blindsight:z.number().optional()}).optional()});var containerCapacitySchema=z.strictObject({weight:z.array(z.number()).optional(),item:z.array(z.record(z.string(),z.number())).optional(),weightless:z.boolean().optional(),volume:z.array(z.number()).optional()});var containerSchema=z.object({capacity_weight:z.number().optional(),holds_items:z.boolean().optional(),pack_contents:z.array(z.string()).optional(),pack_atomic:z.boolean().optional(),capacity:containerCapacitySchema.optional()});var lightSchema=z.object({bright_radius:z.number(),dim_radius:z.number()});var lightEntrySchema=z.strictObject({bright:z.number().optional(),dim:z.number().optional(),shape:z.string().optional()});var itemEntitySchema=z.object({name:z.string().min(1),slug:z.string().optional(),type:z.string().optional(),rarity:z.string().optional(),base_item:z.string().optional(),bonuses:bonusesSchema.optional(),resist:z.array(z.string()).optional(),immune:z.array(z.string()).optional(),vulnerable:z.array(z.string()).optional(),condition_immune:z.array(z.string()).optional(),charges:z.union([chargesSchema,z.number().int().nonnegative()]).optional(),attached_spells:attachedSpellsSchema.optional(),attunement:z.union([attunementCanonicalSchema,z.boolean(),z.string()]).optional(),grants:grantsSchema.optional(),container:containerSchema.optional(),light:z.union([lightSchema,z.array(lightEntrySchema).nonempty()]).optional(),cursed:z.boolean().optional(),sentient:z.boolean().optional(),tattoo:z.boolean().optional(),focus:z.union([z.boolean(),z.string(),z.array(z.string())]).optional(),tier:z.enum(["major","minor"]).optional(),damage:z.union([z.object({dice:z.string(),type:z.string(),versatile_dice:z.string().optional()}),z.string()]).optional(),weapon_category:z.string().optional(),armor_category:z.string().optional(),weight:z.union([z.number(),z.string()]).optional(),cost:z.string().optional(),source:z.string().optional(),page:z.number().int().optional(),edition:z.string().optional(),description:z.string().optional(),entries:z.array(z.unknown()).optional(),effects:z.array(z.unknown()).optional(),damage_riders:z.array(z.object({amount:z.string(),damage_type:z.string(),applies_to:z.enum(["weapon","spell","all"]).optional(),condition:z.string().optional()})).optional(),scroll_level:z.number().optional(),spell_charge_cost:z.number().int().nonnegative().optional(),spell_save_dc:z.number().int().positive().optional(),spell_attack_bonus:z.number().int().optional(),unidentified:z.boolean().optional(),masked_category:z.string().optional(),modify_speed:z.strictObject({equal:z.record(z.string(),z.string()).optional(),static:z.record(z.string(),z.number()).optional(),multiply:z.record(z.string(),z.number()).optional(),bonus:z.record(z.string(),z.number()).optional()}).optional(),speed_on_use:z.boolean().optional(),rendering_hint:z.string().optional(),icon:z.string().optional(),has_fluff:z.boolean().optional(),has_fluff_images:z.boolean().optional(),image:imageField,raw:z.record(z.string(),z.unknown()).optional(),damage_dice:z.string().optional(),damage_type:z.string().optional(),properties:z.array(z.string()).optional(),mastery:z.array(z.string().min(1)).optional(),recharge:z.string().optional(),curse:z.boolean().optional()});export{conditionSchema,containerSchema,itemEntitySchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function slugify(name){return name.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/[\s]+/g,"-").replace(/-{2,}/g,"-").replace(/^-+|-+$/g,"")}function bareEntitySlug(slug){if(!slug)return"";const p=slug.split("_");return p.length>=3?p.slice(2).join("_"):p[p.length-1]}var STORED_SLUG=/^[a-z0-9-]+(?:_[a-z0-9-]+)+$/;function isStoredSlug(tail){return STORED_SLUG.test(tail)}function wikilinkTailSlug(link){var _a;const inner=link.replace(/^\[\[/,"").replace(/\]\]$/,"");const tail=((_a=inner.split("/").pop())!=null?_a:inner).trim();return isStoredSlug(tail)?bareEntitySlug(tail):slugify(tail)}function twinKey(slug){return bareEntitySlug(slug).replace(/-/g,"")}export{slugify,bareEntitySlug,isStoredSlug,wikilinkTailSlug,twinKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseRace}from"./chunk-CNMHADNV.js";import yaml from"js-yaml";var raceCodec={parse(doc){return parseRace(doc.body)},serialize(entity){return yaml.dump(entity,{lineWidth:-1,sortKeys:false})}};export{raceCodec};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";var abilitiesSchema=z.object({str:z.number().min(1).max(30),dex:z.number().min(1).max(30),con:z.number().min(1).max(30),int:z.number().min(1).max(30),wis:z.number().min(1).max(30),cha:z.number().min(1).max(30)});var acSchema=z.object({ac:z.number(),from:z.array(z.string()).optional(),condition:z.string().optional()});var hpSchema=z.object({average:z.number(),formula:z.string()});var speedSchema=z.object({walk:z.number().optional(),fly:z.number().optional(),swim:z.number().optional(),climb:z.number().optional(),burrow:z.number().optional()});var featureSchema=z.object({name:z.string(),entries:z.array(z.string().describe("Inline tag forms: `atk:ABILITY` for non-proficient attacks (ability mod alone), `atk:ABILITY+PB` for proficient attacks (ability mod + proficiency), `atk:+N` for literal attack bonuses, `dmg:DICE+ABILITY` for damage rolls (PB never added to damage), `dc:ABILITY` for save DCs (proficiency always included implicitly)."))});var monsterInputSchema=z.object({name:z.string().describe("Monster name"),size:z.enum(["Tiny","Small","Medium","Large","Huge","Gargantuan"]),type:z.string().describe("Creature type (e.g., aberration, beast, dragon)"),subtype:z.string().optional(),alignment:z.string(),cr:z.string().describe('Challenge rating (e.g., "0", "1/8", "1/4", "1/2", "1" through "30")'),abilities:abilitiesSchema,ac:z.array(acSchema),hp:hpSchema,speed:speedSchema,saves:z.record(z.string(),z.number()).optional(),skills:z.record(z.string(),z.number()).optional(),damage_vulnerabilities:z.array(z.string()).optional(),damage_resistances:z.array(z.string()).optional(),damage_immunities:z.array(z.string()).optional(),condition_immunities:z.array(z.string()).optional(),senses:z.array(z.string()).optional(),passive_perception:z.number().optional(),languages:z.array(z.string()).optional(),traits:z.array(featureSchema).optional(),actions:z.array(featureSchema).optional(),reactions:z.array(featureSchema).optional(),legendary_actions:z.array(featureSchema).optional(),legendary_action_uses:z.number().optional(),legendary_resistance:z.number().optional()});export{monsterInputSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseItem}from"./chunk-757KM22B.js";import yaml from"js-yaml";var itemCodec={parse(doc){return parseItem(doc.body)},serialize(item){return yaml.dump(item,{lineWidth:-1,sortKeys:false})}};export{itemCodec};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{itemEntitySchema}from"./chunk-5XDCM6YK.js";import{parseYaml}from"@archivist-gg/core";var KNOWN_KEYS=new Set(["name","slug","type","rarity","base_item","bonuses","resist","immune","vulnerable","condition_immune","charges","attached_spells","attunement","grants","container","light","cursed","sentient","focus","tier","tattoo","damage","weapon_category","armor_category","weight","cost","source","page","edition","description","entries","effects","damage_riders","raw","scroll_level","spell_charge_cost","spell_save_dc","spell_attack_bonus","unidentified","masked_category","modify_speed","rendering_hint","icon","has_fluff","has_fluff_images","image","speed_on_use","mastery","damage_dice","damage_type","properties","recharge","curse"]);function migrateAttunement(raw){const legacy=raw.requires_attunement;if(raw.attunement===void 0&&typeof legacy==="boolean"){raw.attunement={required:legacy}}if(legacy!==void 0){delete raw.requires_attunement}const v=raw.attunement;if(v===void 0||v===null)return;if(typeof v==="object"&&!Array.isArray(v))return;if(typeof v==="boolean"){raw.attunement={required:v}}else if(typeof v==="string"){raw.attunement={required:true,restriction:v}}}function parseItem(source){var _a;const raw=parseYaml(source,["name"]);if(!raw.success)return raw;migrateAttunement(raw.data);const result=itemEntitySchema.safeParse(raw.data);if(!result.success){return{success:false,error:`item schema validation failed: ${result.error.message}`}}const entity=result.data;const extras={};for(const[k,v]of Object.entries(raw.data)){if(!KNOWN_KEYS.has(k))extras[k]=v}if(Object.keys(extras).length>0){entity.raw={...(_a=entity.raw)!=null?_a:{},...extras}}return{success:true,data:entity}}export{parseItem};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{imageField}from"./chunk-I26FHSI6.js";import{z}from"zod";var castingOptionSchema=z.object({type:z.string(),damage_roll:z.string().optional(),target_count:z.number().optional(),duration:z.string().optional(),range:z.number().optional(),concentration:z.boolean().optional(),shape_size:z.number().optional(),desc:z.string().optional()});var spellMaterialSchema=z.union([z.boolean(),z.string(),z.strictObject({text:z.string(),cost:z.number().optional(),consume:z.union([z.boolean(),z.string()]).optional()})]);var spellComponentsObjectSchema=z.strictObject({v:z.boolean().optional(),s:z.boolean().optional(),m:spellMaterialSchema.optional(),r:z.boolean().optional()});var spellDurationEntrySchema=z.discriminatedUnion("type",[z.strictObject({type:z.literal("permanent"),ends:z.array(z.enum(["dispel","trigger"])).nonempty()}),z.strictObject({type:z.literal("timed"),duration:z.strictObject({type:z.enum(["minute","hour"]),amount:z.number().int().positive(),up_to:z.boolean().optional()})})]);var spellEntitySchema=z.object({name:z.string().min(1),level:z.number().int().min(0).optional(),school:z.string().optional(),casting_time:z.string().optional(),range:z.string().optional(),components:z.union([z.string(),spellComponentsObjectSchema]).optional(),duration:z.union([z.string(),z.array(spellDurationEntrySchema).nonempty()]).optional(),concentration:z.boolean().optional(),ritual:z.boolean().optional(),classes:z.array(z.string()).optional(),description:z.string().optional(),at_higher_levels:z.array(z.string()).optional(),damage:z.object({types:z.array(z.string())}).optional(),damage_roll:z.string().optional(),saving_throw:z.object({ability:z.string()}).optional(),casting_options:z.array(castingOptionSchema).optional(),rendering_hint:z.string().optional(),misc_tags:z.array(z.string()).optional(),area_tags:z.array(z.string()).optional(),condition_inflict:z.array(z.string()).optional(),affects_creature_type:z.array(z.string()).optional(),spell_attack:z.enum(["melee","ranged"]).optional(),ability_check:z.array(z.string()).optional(),damage_resist:z.array(z.string()).optional(),damage_immune:z.array(z.string()).optional(),condition_immune:z.array(z.string()).optional(),damage_vulnerable:z.array(z.string()).optional(),has_fluff:z.boolean().optional(),image:imageField,has_fluff_images:z.boolean().optional()}).strict();export{spellEntitySchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ABILITY_KEYS,CR_PROFICIENCY,CR_XP,DAMAGE_TYPES,SIZE_HIT_DICE}from"./chunk-EVT7MGAC.js";function abilityModifier(score){return Math.floor((score-10)/2)}function formatModifier(mod){return mod>=0?`+${mod}`:`${mod}`}function proficiencyBonusFromCR(cr){var _a;return(_a=CR_PROFICIENCY[cr])!=null?_a:2}function proficiencyFromLevel(level){if(level<5)return 2;if(level<9)return 3;if(level<13)return 4;if(level<17)return 5;return 6}function crToXP(cr){var _a;return(_a=CR_XP[cr])!=null?_a:0}function hitDiceSizeFromCreatureSize(size){var _a;return(_a=SIZE_HIT_DICE[size.toLowerCase()])!=null?_a:8}function hpFromHitDice(hitDiceCount,hitDiceSize,conMod){const avg=Math.floor(hitDiceCount*(hitDiceSize+1)/2+hitDiceCount*conMod);return Math.max(1,avg)}function parseHitDiceFormula(formula){const match=formula.match(/^(\d+)d(\d+)/i);if(!match)return null;return{count:parseInt(match[1],10),size:parseInt(match[2],10)}}function savingThrow(abilityScore,isProficient,profBonus){return abilityModifier(abilityScore)+(isProficient?profBonus:0)}function skillBonus(abilityScore,proficiency,profBonus){const mod=abilityModifier(abilityScore);if(proficiency==="expertise")return mod+profBonus*2;if(proficiency==="proficient")return mod+profBonus;return mod}function passive(abilityScore,proficiency,profBonus){return 10+skillBonus(abilityScore,proficiency,profBonus)}function passivePerception(wisScore,perceptionProf,profBonus){return passive(wisScore,perceptionProf,profBonus)}function attackBonus(abilityScore,profBonus){return abilityModifier(abilityScore)+profBonus}function saveDC(abilityScore,profBonus){return 8+profBonus+abilityModifier(abilityScore)}function abilityNameToKey(name){const lower=name.toLowerCase();if(ABILITY_KEYS.includes(lower)){return lower}return null}var CANONICAL_DAMAGE_TYPES=new Set(DAMAGE_TYPES.map(t=>t.toLowerCase()));function isCanonicalDamageType(type){return CANONICAL_DAMAGE_TYPES.has(type.trim().toLowerCase())}var CHOSEN_DAMAGE_TYPE="chosen";var CHOSEN_DAMAGE_TYPE_NOTE="damage type of your choice";function isChosenDamageType(type){return type!==void 0&&type.trim().toLowerCase()===CHOSEN_DAMAGE_TYPE}function isRenderableDamageText(text){var _a;const m=/^(?:\d*d\d+(?:\s*[+-]\s*\d+)?|[+-]?\d+)(?:\s+(.*))?$/i.exec(text.trim());if(!m)return false;const type=((_a=m[1])!=null?_a:"").trim();return type===""||isCanonicalDamageType(type)}export{abilityModifier,formatModifier,proficiencyBonusFromCR,proficiencyFromLevel,crToXP,hitDiceSizeFromCreatureSize,hpFromHitDice,parseHitDiceFormula,savingThrow,skillBonus,passive,passivePerception,attackBonus,saveDC,abilityNameToKey,isCanonicalDamageType,CHOSEN_DAMAGE_TYPE,CHOSEN_DAMAGE_TYPE_NOTE,isChosenDamageType,isRenderableDamageText};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{parseArmor}from"./chunk-O2QZ73GA.js";import yaml from"js-yaml";var armorCodec={parse(doc){return parseArmor(doc.body)},serialize(entity){return yaml.dump(entity,{lineWidth:-1,sortKeys:false})}};export{armorCodec};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{imageField}from"./chunk-I26FHSI6.js";import{parseYaml}from"@archivist-gg/core";import{z}from"zod";var conditionEntitySchema=z.object({slug:z.string().min(1),name:z.string().min(1),edition:z.enum(["2014","2024"]),source:z.string().min(1),description:z.string(),has_fluff_images:z.boolean().optional(),image:imageField});function parseCondition(source){const raw=parseYaml(source,["name","slug"]);if(!raw.success)return raw;const result=conditionEntitySchema.safeParse({edition:"2014",...raw.data});if(!result.success){return{success:false,error:`condition schema validation failed: ${result.error.message}`}}return{success:true,data:result.data}}export{parseCondition};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CR_TO_XP,getProficiencyBonus}from"./chunk-JXDX2DKF.js";import{abilityModifier}from"./chunk-7FPQJDFD.js";import{ALL_SKILLS}from"./chunk-EVT7MGAC.js";function capitalizeWords(str){return str.replace(/\b\w/g,c=>c.toUpperCase())}function capitalizeOutsideLinks(str){return str.replace(/\[\[([^\]|]+)(?:\|([^\]]*))?\]\]|([^[]+|\[)/g,(m,target,alias,plain)=>{if(target!==void 0)return alias!==void 0?`[[${target}|${capitalizeWords(alias)}]]`:`[[${target}]]`;return capitalizeWords(plain!=null?plain:m)})}var SIZE_CODES={T:"Tiny",S:"Small",M:"Medium",L:"Large",H:"Huge",G:"Gargantuan"};function sizeWords(size){if(size===void 0)return[];const arr=Array.isArray(size)?size:[size];return arr.map(s=>{var _a;return(_a=SIZE_CODES[s])!=null?_a:capitalizeWords(s)})}function joinOr(words){if(words.length<=1)return words.join("");if(words.length===2)return`${words[0]} or ${words[1]}`;return`${words.slice(0,-1).join(", ")}, or ${words[words.length-1]}`}function formatSize(size,note){const text=joinOr(sizeWords(size));return note?`${text} ${note}`:text}function sizeWord(size){const first=sizeWords(size)[0];return(first!=null?first:"Medium").toLowerCase()}var ALIGNMENT_CODES={L:"lawful",N:"neutral",NX:"neutral",NY:"neutral",C:"chaotic",G:"good",E:"evil",U:"unaligned",A:"any alignment"};var ALIGNMENT_SETS={"C,E,L,NX,NY":"any non-good alignment","C,E,G,NX,NY":"any non-lawful alignment","C,E,L,NX":"any evil alignment","C,E,G,NY":"any chaotic alignment","N,NX,NY":"any neutral alignment"};function decodeCodes(codes){const key=[...codes].sort().join(",");if(ALIGNMENT_SETS[key])return ALIGNMENT_SETS[key];return codes.map(c=>{var _a;return(_a=ALIGNMENT_CODES[c])!=null?_a:c}).join(" ")}function alignmentText(alignment,prefix){if(alignment===void 0)return"";let body;if(typeof alignment==="string")body=alignment;else if(alignment.every(a=>typeof a==="string"))body=decodeCodes(alignment);else{body=alignment.map(a=>{var _a,_b;if(typeof a==="string")return(_a=ALIGNMENT_CODES[a])!=null?_a:a;if(a.special)return a.special;let t=decodeCodes((_b=a.alignment)!=null?_b:[]);if(a.chance!==void 0)t+=` (${a.chance}%)`;if(a.note)t+=` (${a.note})`;return t}).join(" or ")}return`${prefix!=null?prefix:""}${body}`}function formatAlignment(alignment,prefix){return capitalizeWords(alignmentText(alignment,prefix))}function alignmentWords(alignment){return alignmentText(alignment).toLowerCase()}var IRREGULAR_PLURALS={fey:"fey",undead:"undead"};function plural(word){var _a;return(_a=IRREGULAR_PLURALS[word.toLowerCase()])!=null?_a:`${word}s`}function formatType(type,level){var _a,_b;if(type===void 0)return"";if(typeof type==="string")return capitalizeWords(type);const baseText=typeof type.type==="string"?capitalizeWords(type.type):type.type.choose.map(capitalizeWords).join(" or ");let text=type.swarm_size!==void 0?`Swarm of ${(_a=SIZE_CODES[type.swarm_size])!=null?_a:capitalizeWords(type.swarm_size)} ${capitalizeWords(plural(typeof type.type==="string"?type.type:type.type.choose.join(" or ")))}`:baseText;const tags=((_b=type.tags)!=null?_b:[]).map(t=>typeof t==="string"?t:t.prefix_hidden?t.tag:`${t.prefix} ${t.tag}`);if(tags.length>0)text+=` (${tags.map(capitalizeWords).join(", ")})`;if(type.sidekick_type&&!type.sidekick_hidden){text+=`, ${capitalizeWords(type.sidekick_type)} Sidekick`;if(type.sidekick_tags&&type.sidekick_tags.length>0)text+=` (${type.sidekick_tags.map(capitalizeWords).join(", ")})`;if(level!==void 0)text+=` (level ${level})`}return text}var CR_DECIMAL_KEYS={"0.125":"1/8","0.25":"1/4","0.5":"1/2"};function hasOwn(table,key){return Object.prototype.hasOwnProperty.call(table,key)}function crKey(text){return hasOwn(CR_DECIMAL_KEYS,text)?CR_DECIMAL_KEYS[text]:text}function xpFor(cr){const key=crKey(cr);return hasOwn(CR_TO_XP,key)?CR_TO_XP[key]:0}function formatCR(cr){var _a;if(cr===void 0||cr===null)return void 0;const obj=typeof cr==="object"?cr:{cr:String(cr)};const text=String(obj.cr);const key=crKey(text);const tableMiss=!hasOwn(CR_TO_XP,key);return{crText:text,xp:(_a=obj.xp)!=null?_a:xpFor(text),pb:getProficiencyBonus(key),tableMiss,lair:obj.lair,coven:obj.coven,xpLair:obj.xp_lair,xpOverride:obj.xp}}function formatXP(xp){return String(xp).replace(/\B(?=(\d{3})+(?!\d))/g,",")}function crString(cr){var _a;return(_a=formatCR(cr))==null?void 0:_a.crText}function challengeLine(cr,pbNote){const f=formatCR(cr);if(!f)return void 0;const pbText=pbNote?`PB ${pbNote}`:`PB +${f.pb}`;if(f.tableMiss&&f.xpOverride===void 0)return`${f.crText} (${pbText})`;const xpText=`${formatXP(f.xp)} XP`;if(f.xpLair!==void 0)return`${f.crText} (${xpText}, or ${formatXP(f.xpLair)} XP in its lair; ${pbText})`;let line=`${f.crText} (${xpText}; ${pbText})`;if(f.lair!==void 0)line+=`, or ${f.lair} (${formatXP(xpFor(f.lair))} XP) in its lair`;if(f.coven!==void 0)line+=`, or ${f.coven} (${formatXP(xpFor(f.coven))} XP) as a coven`;return line}function formatAC(ac){const parts=[];for(const entry of ac!=null?ac:[]){if(entry.special!==void 0){parts.push({text:entry.special,braced:false});continue}if(entry.ac===void 0)continue;let text=String(entry.ac);if(entry.from&&entry.from.length>0)text+=` (${entry.from.map(capitalizeOutsideLinks).join(", ")})`;if(entry.condition)text+=` ${entry.condition}`;parts.push(entry.braces?{text:`(${text})`,braced:true}:{text,braced:false})}if(parts.length===0)return"10";return parts.reduce((acc,p,i)=>i===0?p.text:`${acc}${p.braced?" ":", "}${p.text}`,"")}function formatHP(hp){if(!hp)return{text:"0"};if(hp.special!==void 0)return{text:hp.special};if(hp.average===void 0)return{text:"0"};return hp.formula?{text:String(hp.average),formula:hp.formula}:{text:String(hp.average)}}var SPEED_MODES=["walk","fly","swim","climb","burrow"];function speedEntry(mode,value,hoverAppend){if(value===void 0||value===null)return void 0;const n=typeof value==="number"?value:value.number;if(!n)return void 0;let text=`${capitalizeWords(mode)} ${n} ft.`;const cond=typeof value==="number"?void 0:value.condition;if(cond)text+=` ${cond}`;if(hoverAppend&&!(cond!=null?cond:"").toLowerCase().includes("hover"))text+=" (hover)";return text}function formatSpeed(speed){var _a;if(!speed)return"0 ft.";const parts=[];for(const mode of SPEED_MODES){const e=speedEntry(mode,speed[mode],mode==="fly"&&speed.can_hover===true);if(e)parts.push(e)}for(const[mode,entries]of Object.entries((_a=speed.alternate)!=null?_a:{})){for(const alt of entries){const e=speedEntry(mode,alt,false);if(e)parts.push(e)}}if(speed.choose){let t=`${speed.choose.amount} ft. ${speed.choose.from.join(" or ")}`;if(speed.choose.note)t+=` ${speed.choose.note}`;parts.push(t)}return parts.join(", ")}function speedNumber(speed,mode){const v=speed==null?void 0:speed[mode];if(v===void 0||v===null)return 0;return typeof v==="number"?v:v.number}function qualifierText(q){var _a;if(typeof q==="string")return capitalizeWords(q);if(q.special!==void 0)return q.special;const inner=((_a=q.types)!=null?_a:[]).map(qualifierText).join(", ");let text=inner;if(q.pre_note)text=`${q.pre_note} ${text}`;if(q.note)text=`${text} ${q.note}`;return text}function formatQualifiers(list){return(list!=null?list:[]).map(qualifierText)}function qualifierStrings(list){return(list!=null?list:[]).filter(q=>typeof q==="string")}var INITIATIVE_MODES={advantage:"advantage",adv:"advantage",disadvantage:"disadvantage",dis:"disadvantage"};function formatInitiative(initiative,abilities,pb){var _a;if(initiative===void 0||initiative===null)return void 0;const dex=abilities?abilityModifier(abilities.dex):0;const bonus=typeof initiative==="number"?initiative:dex+((_a=initiative.proficiency)!=null?_a:0)*pb;const sign=bonus>=0?`+${bonus}`:`${bonus}`;let text=`${sign} (${10+bonus})`;const mode=typeof initiative==="number"?void 0:initiative.advantage_mode;if(mode&&INITIATIVE_MODES[mode])text+=` (${INITIATIVE_MODES[mode]})`;return text}function itemName(uid){return capitalizeWords(uid.split("|")[0])}function formatGear(gear){return(gear!=null?gear:[]).map(g=>{var _a;if(typeof g==="string")return itemName(g);const name=(_a=g.displayName)!=null?_a:itemName(g.item);return g.quantity!==void 0&&g.quantity>1?`${name} \xD7 ${g.quantity}`:name}).join(", ")}function formatLanguages(list){return(list!=null?list:[]).map(entry=>entry.replace(/([\d,]*\d[\d,]*\s+)?\b(\w)/g,(m,amount,ch)=>amount?m:ch.toUpperCase())).join(", ")}var SKILL_DISPLAY=new Map(ALL_SKILLS.map(s=>[s.toLowerCase(),s]));function skillDisplayName(key){var _a;return(_a=SKILL_DISPLAY.get(key.replace(/[_-]+/g," ").trim().toLowerCase()))!=null?_a:capitalizeWords(key)}function formatSkillsOther(list){if(!list||list.length===0)return void 0;const parts=[];for(const entry of list){const oneOf=entry==null?void 0:entry.one_of;if(!oneOf)continue;parts.push(Object.entries(oneOf).map(([k,v])=>`${skillDisplayName(k)} ${String(v)}`).join(", "))}return parts.length>0?`plus one of: ${parts.join("; ")}`:void 0}function shortNameOfNamed(name){return name.includes(",")?name.split(",")[0].trim():name}function legendaryIntro(m,count){const subject=m.is_named_creature?typeof m.short_name==="string"?m.short_name:m.short_name===void 0?shortNameOfNamed(m.name):m.name:`the ${m.name.toLowerCase()}`;const Subject=m.is_named_creature?subject:`The ${m.name.toLowerCase()}`;const lair=m.legendary_actions_lair_count!==void 0?` (${m.legendary_actions_lair_count} in its lair)`:"";return`${Subject} can take ${count} legendary actions${lair}, choosing from the options below. Only one legendary action option can be used at a time and only at the end of another creature's turn. ${Subject} regains spent legendary actions at the start of its turn.`}function sectionHeader(m,section){var _a;const entry=((_a=m.section_headers)!=null?_a:[]).find(h=>h.section===section);if(entry)return entry.header;if(section==="mythic"&&m.mythic_header&&m.mythic_header.length>0)return m.mythic_header;return void 0}var DISPLAY_AS_SECTION={action:"actions",bonus:"bonus_actions",reaction:"reactions",legendary:"legendary_actions"};function displayAsSection(displayAs){return displayAs!==void 0&&DISPLAY_AS_SECTION[displayAs]||"traits"}var GROUP_ORDER=["will","daily","rest","restLong","recharge","legendary","charges","ritual"];var SPELLCASTING_LABELS={will:{plain:"At Will:"},daily:{plain:"N/Day:",each:"N/Day Each:"},rest:{plain:"N/Rest:",each:"N/Rest Each:"},restLong:{plain:"N/Long Rest:",each:"N/Long Rest Each:"},recharge:{plain:"Recharge N-6:",six:"Recharge 6:"},legendary:{plain:"N/Legendary Action:",each:"N/Legendary Action Each:"},charges:{plain:"N Charges",each:"N Charges Each"},ritual:{plain:"Rituals:"}};function spellText(e){if(typeof e==="string")return e;if(!e||typeof e!=="object")return void 0;return e.hidden?void 0:e.entry}function spellsOf(list){return(Array.isArray(list)?list:[]).map(spellText).filter(s=>s!==void 0).join(", ")}function sortedKeys(record){return Object.keys(record).sort((a,b)=>{const na=parseInt(a,10),nb=parseInt(b,10);if(na!==nb)return nb-na;return(a.endsWith("e")?1:0)-(b.endsWith("e")?1:0)})}function ordinal(n){var _a,_b;const s=["th","st","nd","rd"],v=n%100;return`${n}${(_b=(_a=s[(v-20)%10])!=null?_a:s[v])!=null?_b:s[0]}`}function spellcastingLines(block){var _a,_b,_c,_d;const hidden=new Set(Array.isArray(block.hidden)?block.hidden:[]);const lines=Array.isArray(block.headerEntries)?[...block.headerEntries]:[];for(const group of GROUP_ORDER){if(hidden.has(group))continue;const label=SPELLCASTING_LABELS[group];if(group==="will"||group==="ritual"){const s=spellsOf(group==="will"?block.will:block.ritual);if(s)lines.push(`${label.plain} ${s}`);continue}if(group==="recharge"){for(const k of sortedKeys((_a=block.recharge)!=null?_a:{})){const s=spellsOf(block.recharge[k]);if(!s)continue;lines.push(`${(k==="6"?(_b=label.six)!=null?_b:label.plain:label.plain).replace("N",k)} ${s}`)}continue}const record=(_c=block[group])!=null?_c:{};for(const k of sortedKeys(record)){const s=spellsOf(record[k]);if(!s)continue;const text=(k.endsWith("e")?(_d=label.each)!=null?_d:label.plain:label.plain).replace("N",String(parseInt(k,10)));lines.push(group==="charges"?`${text}${block.chargesItem?` (${block.chargesItem})`:""}: ${s}`:`${text} ${s}`)}}if(!hidden.has("spells")&&block.spells){const levelKeys=Object.keys(block.spells).filter(k=>String(Number(k))===k).sort((a,b)=>Number(a)-Number(b));for(const key of levelKeys){const level=block.spells[key];if(!level||!Array.isArray(level.spells))continue;const lvl=Number(key);const s=level.spells.join(", ");if(!s)continue;if(lvl===0){lines.push(`Cantrips (At Will): ${s}`);continue}const plural2=level.slots===1?"Slot":"Slots";const slots=level.slots!==void 0?level.lower!==void 0?`${level.slots} ${ordinal(level.lower)}-Level ${plural2}`:`${level.slots} ${plural2}`:void 0;lines.push(`${ordinal(lvl)} Level${slots?` (${slots})`:""}: ${s}`)}}if(Array.isArray(block.footerEntries))lines.push(...block.footerEntries);return lines}function inline(v){if(typeof v==="string")return v;if(Array.isArray(v))return v.map(inline).filter(Boolean).join(" ");if(v&&typeof v==="object"){const n=v;const parts=[];if(typeof n.name==="string")parts.push(`**${n.name}.**`);if(n.entry!==void 0)parts.push(inline(n.entry));if(n.entries!==void 0)parts.push(inline(n.entries));if(n.items!==void 0)parts.push(inline(n.items));return parts.join(" ")}return v===void 0||v===null?"":String(v)}function blocksOf(v){if(typeof v==="string")return[v];if(Array.isArray(v))return v.flatMap(blocksOf);if(!v||typeof v!=="object")return[];const n=v;const type=typeof n.type==="string"?n.type:"entries";switch(type){case"entries":case"section":{const body=blocksOf(n.entries);if(typeof n.name==="string"&&body.length>0)body[0]=`**${n.name}.** ${body[0]}`;else if(typeof n.name==="string")body.push(`**${n.name}.**`);return body}case"list":{const items=Array.isArray(n.items)?n.items:[];return[items.map(it=>`- ${inline(it)}`).join("\n")]}case"item":return[inline(n)];case"table":{const out=[];if(typeof n.caption==="string")out.push(`**${n.caption}**`);const cell=v2=>inline(v2).replace(/\\?\|/g,"\\|");const styles=Array.isArray(n.colStyles)?n.colStyles.map(x=>String(x)):[];const alignment=i=>{var _a;const s=(_a=styles[i])!=null?_a:"";if(/\btext-center\b/.test(s))return":---:";if(/\btext-right\b/.test(s))return"---:";return"---"};const cols=Array.isArray(n.colLabels)?n.colLabels.map(cell):[];const rows=Array.isArray(n.rows)?n.rows:[];const table=[`| ${cols.join(" | ")} |`,`| ${cols.map((_,i)=>alignment(i)).join(" | ")} |`];for(const r of rows)table.push(`| ${(Array.isArray(r)?r:[r]).map(cell).join(" | ")} |`);out.push(table.join("\n"));return out}case"inset":case"variant":case"variantInner":case"variantSub":{const body=blocksOf(n.entries).map(b=>b.split("\n").map(l=>`> ${l}`).join("\n"));const head=typeof n.name==="string"?[`> **${n.name}**`]:[];return[[...head,...body].join("\n>\n")]}case"spellcasting":return[spellcastingLines(n).join("\n")];default:return[...blocksOf(n.entries),...blocksOf(n.items),...blocksOf(n.entry)]}}function entriesToMarkdown(tree){return blocksOf(tree).filter(b=>b.length>0).join("\n\n")}export{capitalizeWords,capitalizeOutsideLinks,SIZE_CODES,formatSize,sizeWord,ALIGNMENT_CODES,ALIGNMENT_SETS,formatAlignment,alignmentWords,IRREGULAR_PLURALS,formatType,formatCR,formatXP,crString,challengeLine,formatAC,formatHP,SPEED_MODES,formatSpeed,speedNumber,formatQualifiers,qualifierStrings,INITIATIVE_MODES,formatInitiative,formatGear,formatLanguages,skillDisplayName,formatSkillsOther,legendaryIntro,sectionHeader,DISPLAY_AS_SECTION,displayAsSection,SPELLCASTING_LABELS,spellcastingLines,entriesToMarkdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var VALID_PREFIXES=["dice","damage","dc","atk","mod","check"];var PREFIX_ALIASES={roll:"dice",d:"dice",attack:"atk",dmg:"damage"};function parseInlineTag(text){var _a;const colonIndex=text.indexOf(":");if(colonIndex===-1)return null;const prefix=text.slice(0,colonIndex).trim().toLowerCase();const resolved=(_a=PREFIX_ALIASES[prefix])!=null?_a:prefix;if(!VALID_PREFIXES.includes(resolved))return null;const content=text.slice(colonIndex+1).trim();if(content.length===0)return null;return{type:resolved,content,formula:null}}export{parseInlineTag};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{weaponEntitySchema}from"./chunk-LJNT3PJP.js";import{parseYaml}from"@archivist-gg/core";var KNOWN_KEYS=new Set(["name","slug","category","damage","properties","range","reload","mastery","type_tags","ammo_type","weight","cost","source","page","edition","entries","raw","rendering_hint","icon","has_fluff","has_fluff_images","image"]);var FLAG_PROPERTIES=new Set(["finesse","light","heavy","two_handed","reach","special","thrown","ammunition","versatile","loading"]);var VERSATILE_RE=/^versatile\s*\(\s*(\d+d\d+)\s*\)$/i;var THROWN_RE=/^thrown\s*\(\s*range\s+(\d+)\s*\/\s*(\d+)\s*\)$/i;var AMMUNITION_RE=/^ammunition\s*\(\s*range\s+(\d+)\s*\/\s*(\d+)\s*\)$/i;function extractFromPropertyStrings(input){const out={properties:[],unparsed:[]};if(!Array.isArray(input))return out;for(const raw of input){if(typeof raw!=="string"){out.properties.push(raw);continue}const lower=raw.toLowerCase().trim();if(FLAG_PROPERTIES.has(lower)){out.properties.push(lower);continue}const v=lower.match(VERSATILE_RE);if(v){out.properties.push("versatile");out.versatile_dice=v[1];continue}const t=lower.match(THROWN_RE);if(t){out.properties.push("thrown");out.range={normal:Number.parseInt(t[1],10),long:Number.parseInt(t[2],10)};continue}const a=lower.match(AMMUNITION_RE);if(a){out.properties.push("ammunition");out.range={normal:Number.parseInt(a[1],10),long:Number.parseInt(a[2],10)};continue}out.unparsed.push(raw)}return out}function parseWeapon(source){var _a,_b;const raw=parseYaml(source,["name","slug","category","damage"]);if(!raw.success)return raw;const propsInput=raw.data.properties;if(Array.isArray(propsInput)){const extracted=extractFromPropertyStrings(propsInput);raw.data.properties=extracted.properties;if(extracted.versatile_dice&&raw.data.damage&&typeof raw.data.damage==="object"){const dmg=raw.data.damage;if(dmg.versatile_dice===void 0)dmg.versatile_dice=extracted.versatile_dice}if(extracted.range&&raw.data.range===void 0){raw.data.range=extracted.range}if(extracted.unparsed.length>0){const existingRaw=(_a=raw.data.raw)!=null?_a:{};existingRaw.unparsed_properties=extracted.unparsed;raw.data.raw=existingRaw}}const result=weaponEntitySchema.safeParse(raw.data);if(!result.success){return{success:false,error:`weapon schema validation failed: ${result.error.message}`}}const entity=result.data;const extras={};for(const[k,v]of Object.entries(raw.data)){if(!KNOWN_KEYS.has(k))extras[k]=v}if(Object.keys(extras).length>0){entity.raw={...(_b=entity.raw)!=null?_b:{},...extras}}return{success:true,data:entity}}export{parseWeapon};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function bareSlug(ref){if(typeof ref!=="string")return"";const m=ref.match(/^\[\[(.+?)\]\]$/);return(m?m[1]:ref).toLowerCase()}function baseClassName(ref){const bare=bareSlug(ref);const p=bare.split("_");return p.length>=3?p.slice(2).join("_"):p[p.length-1]}export{bareSlug,baseClassName};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{spellSource}from"./chunk-PZ3ZZ5H5.js";import{resourceLevelFor}from"./chunk-KEXSF3CH.js";import{addToRoll}from"./chunk-VIP3FH2O.js";import{baseClassName}from"./chunk-CAPYNIGK.js";function ownerClassSlug(source,resolved){var _a,_b,_c;if(!source)return null;if(source.kind==="class")return source.slug;if(source.kind==="subclass")return(_c=(_b=(_a=resolved.classes.find(c=>{var _a2;return((_a2=c.subclass)==null?void 0:_a2.slug)===source.slug}))==null?void 0:_a.entity)==null?void 0:_b.slug)!=null?_c:null;if(source.kind==="feat"&&source.via){if(source.via.kind==="class")return source.via.slug;if(source.via.kind==="pool")return source.via.classSlug}return null}function casterRow(classSlug,derived){var _a,_b;const rows=(_a=derived.spellcastingClasses)!=null?_a:[];const own=classSlug?rows.find(c=>baseClassName(c.classSlug)===baseClassName(classSlug)):void 0;return(_b=own!=null?own:rows[0])!=null?_b:null}function amountBindingsFor(owner,resolved,derived){var _a,_b;const classSlug=ownerClassSlug(owner,resolved);const classSource=classSlug?{kind:"class",slug:classSlug,level:0}:owner;const classLevel=classSource?resourceLevelFor(classSource,resolved):resolved.totalLevel;const row=casterRow(classSlug,derived);const className=classSlug?(_b=(_a=resolved.classes.find(c=>{var _a2;return((_a2=c.entity)==null?void 0:_a2.slug)===classSlug}))==null?void 0:_a.entity)==null?void 0:_b.name:void 0;const classNames=resolved.classes.map(c=>{var _a2;return(_a2=c.entity)==null?void 0:_a2.name}).filter(n=>typeof n==="string"&&n.length>0);return{level:resolved.totalLevel,class_level:classLevel,prof:derived.proficiencyBonus,str_mod:derived.mods.str,dex_mod:derived.mods.dex,con_mod:derived.mods.con,int_mod:derived.mods.int,wis_mod:derived.mods.wis,cha_mod:derived.mods.cha,columns:{},...row?{spell_mod:derived.mods[row.ability],spell_dc:row.saveDC}:{},...className?{class_name:className}:{},...classNames.length>0?{class_names:classNames}:{}}}function spellcastingFor(spell,derived){var _a,_b,_c,_d,_e;const caster=casterOf(spell,derived);const own=spell.itemCasting;if(!own)return caster;return{ability:(_a=caster==null?void 0:caster.ability)!=null?_a:null,saveDC:(_c=(_b=own.saveDC)!=null?_b:caster==null?void 0:caster.saveDC)!=null?_c:0,attackBonus:(_e=(_d=own.attackBonus)!=null?_d:caster==null?void 0:caster.attackBonus)!=null?_e:0}}function casterOf(spell,derived){var _a,_b;if((spellSource(spell).ownAbility||spell.classSlug==null)&&spell.ability){const own=(_a=derived.abilitySpellcasting)==null?void 0:_a[spell.ability];if(own)return{ability:spell.ability,saveDC:own.saveDC,attackBonus:own.attackBonus}}const row=casterRow((_b=spell.classSlug)!=null?_b:null,derived);return row?{ability:row.ability,saveDC:row.saveDC,attackBonus:row.attackBonus}:null}function spellAmountBindings(spell,resolved,derived){const cast=spellcastingFor(spell,derived);const base=amountBindingsFor(spell.classSlug?{kind:"class",slug:spell.classSlug,level:0}:void 0,resolved,derived);const out={...base};delete out.spell_mod;delete out.spell_dc;if(!cast)return out;return cast.ability?{...out,spell_mod:derived.mods[cast.ability],spell_dc:cast.saveDC}:{...out,spell_dc:cast.saveDC}}function spellRollBonus(spell){var _a;const roll=(_a=spell.damage_roll)==null?void 0:_a.trim();const text=spell.description;if(!roll||!text)return null;const esc=roll.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const re=new RegExp(`(?<![\\w])${esc}\`?\\s*(?:plus|\\+)\\s*your\\s+spellcasting\\s+(?:ability\\s+)?modifier`,"i");return re.test(text)?"{spell_mod}":null}function foldsIntoRoll(rider,spell){var _a,_b;const own=((_b=(_a=spell.entity.damage)==null?void 0:_a.types)!=null?_b:[]).map(t=>t.toLowerCase());return!rider.condition&&(!rider.damage_type||own.includes(rider.damage_type.toLowerCase()))}var reaching=(spell,derived)=>{var _a;return((_a=derived.spellDamageRiders)!=null?_a:[]).filter(r=>{var _a2;return(_a2=r.spells)==null?void 0:_a2.includes(spell.slug)})};function addSpellDamageRiders(roll,spell,derived){return addToRoll(roll,reaching(spell,derived).filter(r=>foldsIntoRoll(r,spell)).map(r=>r.amount))}function spellDamageRiderLines(spell,derived){return reaching(spell,derived).filter(r=>!foldsIntoRoll(r,spell)).map(r=>({amount:r.amount,...r.damage_type?{damage_type:r.damage_type}:{},...r.source?{source:r.source}:{},...r.condition?{condition:r.condition}:{}}))}export{ownerClassSlug,amountBindingsFor,spellcastingFor,spellAmountBindings,spellRollBonus,addSpellDamageRiders,spellDamageRiderLines};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z}from"zod";var resetTriggerEnum=z.enum(["short-rest","long-rest","either","dawn","dusk","turn","round","custom"]);var actionCostEnum=z.enum(["action","bonus-action","reaction","free","special"]);var resourceSchema=z.object({id:z.string().min(1),name:z.string().min(1),max_formula:z.string().min(1),scales_at:z.array(z.object({level:z.number().int().positive(),max:z.string().min(1)}).strict()).optional(),die:z.object({base:z.string().min(1),scaling:z.record(z.string(),z.string()).optional()}).optional(),reset:resetTriggerEnum,consumes:z.object({resource:z.string().min(1),amount:z.number().int().positive()}).optional(),rendering_hint:z.string().optional(),surface:z.enum(["band","tab"]).optional(),equivalent_ids:z.array(z.string().min(1)).optional(),recovery:z.array(z.object({id:z.string().min(1),name:z.string().min(1),amount:z.union([z.number(),z.string()]),action:actionCostEnum.optional(),uses:z.number().int().nonnegative().optional(),reset:resetTriggerEnum,restores:z.enum(["uses","spell-slots"]).optional()})).optional()});var resourceConsumptionSchema=z.object({source:z.enum(["resource","class-column","attack-dice","spell-slots"]).optional(),resource:z.string().optional(),column:z.string().optional(),amount:z.number().int().positive(),amount_max:z.number().int().positive().optional(),expend_condition:z.enum(["roll_succeeds","roll_fails","target_takes_damage","always"]).optional(),free_uses:z.object({amount:z.number().int().positive(),reset:resetTriggerEnum,state_key:z.string().optional()}).optional()}).refine(c=>c.amount_max===void 0||c.amount_max>=c.amount,{path:["amount_max"],message:"amount_max must be >= amount"});export{resetTriggerEnum,actionCostEnum,resourceSchema,resourceConsumptionSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{RACE_STRUCTURAL_PSEUDO}from"./chunk-UBUKCRZ3.js";import{heldPicks}from"./chunk-PKIMOVQG.js";import{warnOnce}from"./chunk-DZITM5AG.js";import{memoByRevision}from"./chunk-QMEKQTUT.js";import{slugify}from"./chunk-63YJPWTM.js";import{mirrorSpellShapes}from"./chunk-4KVVAENP.js";import{ABILITY_KEYS}from"./chunk-EVT7MGAC.js";var entriesOf=a=>Array.isArray(a)?a:a&&typeof a==="object"?[a]:[];var editionOf=x=>{const e=x==null?void 0:x.edition;return typeof e==="string"?e:void 0};var prefixOf=slug=>{var _a;return(_a=slug.split("_")[0])!=null?_a:slug};function normalizeSpellRef(ref){var _a,_b,_c;if(typeof ref!=="string")return null;let s=ref.trim();const wl=/^\[\[(.+)\]\]$/.exec(s);if(wl){const target=(_a=wl[1].split("|")[0])!=null?_a:"";const tail=(_b=target.split("/").pop())!=null?_b:target;const w=slugify(tail.replace(/#.*$/,"").trim());return w.length>0?w:null}s=s.replace(/#.*$/,"");s=(_c=s.split("|")[0])!=null?_c:"";const out=slugify(s.trim());return out.length>0?out:null}function buildSpellNameIndex(entities){return memoByRevision(SPELL_NAME_INDEX,entities,()=>spellNameIndexOf(entities))}var SPELL_NAME_INDEX=new WeakMap;function spellNameIndexOf(entities){var _a;const byName=new Map;for(const e of entities.search("","spell",Number.POSITIVE_INFINITY)){const raw=e.data.name;const key=slugify(typeof raw==="string"?raw:e.name);const list=(_a=byName.get(key))!=null?_a:[];list.push(e);byName.set(key,list)}return{byName}}function resolveSpellByName(opts){var _a;const{entities,index,nameSlug,carrierSlug,carrierEdition,alreadyCollected}=opts;const own=alreadyCollected.find(s=>{var _a2;return slugify(String((_a2=s.entity.name)!=null?_a2:""))===nameSlug});if(own)return{entity:own.entity,slug:own.slug};const exact=entities.getByTypeAndSlug("spell",`${prefixOf(carrierSlug)}_spell_${nameSlug}`);if(exact)return{entity:mirrorSpellShapes(exact.data),slug:exact.slug};const cands=(_a=index.byName.get(nameSlug))!=null?_a:[];if(cands.length===0){warnOnce(`addspells:miss:${nameSlug}`,`archivist: additional_spells ref "${nameSlug}" matches no spell in the compendium`);return null}const prefix=prefixOf(carrierSlug);let pool=cands.filter(e=>prefixOf(e.slug)===prefix);if(pool.length===0)pool=cands;if(carrierEdition!==void 0){const same=pool.filter(e=>editionOf(e.data)===carrierEdition);if(same.length>0)pool=same}pool=[...pool].sort((a,b)=>a.slug<b.slug?-1:a.slug>b.slug?1:0);if(pool.length>1)warnOnce(`addspells:multi:${nameSlug}`,`archivist: additional_spells ref "${nameSlug}" matches ${cands.length} spells; using "${pool[0].slug}"`);return{entity:mirrorSpellShapes(pool[0].data),slug:pool[0].slug}}var hasContentSelectInline=choices=>Array.isArray(choices)&&choices.some(c=>(c==null?void 0:c.kind)==="select-inline"&&typeof c.id==="string"&&!RACE_STRUCTURAL_PSEUDO.has(c.id)||Array.isArray(c==null?void 0:c.options)&&c.options.some(o=>hasContentSelectInline(o==null?void 0:o.choices)));function raceIsUngated(race){var _a;const r=race;if(hasContentSelectInline(r.choices))return false;return!((_a=r.traits)!=null?_a:[]).some(t=>hasContentSelectInline(t==null?void 0:t.choices))}var readAbility=(v,own)=>{if(v&&typeof v==="object"&&"choose"in v)return"choose";if(typeof v!=="string")return void 0;if(v==="inherit")return own!=null?own:void 0;return ABILITY_KEYS.includes(v)?v:void 0};var entryHasInSliceLeaf=(e,comparand,own)=>readAbility(e.ability,own)!=="choose"&&["known","prepared"].some(b=>{const lv=e[b];return!!lv&&typeof lv==="object"&&!Array.isArray(lv)&&Object.entries(lv).some(([k,v])=>(k==="_"||Number(k)<=comparand)&&Array.isArray(v)&&v.some(x=>typeof x==="string"))});function chosenRaceOptionKeys(race,read){var _a;const out=new Set;const r=race;const lists=[r.choices,...((_a=r.traits)!=null?_a:[]).map(t=>t==null?void 0:t.choices)];for(const list of lists){for(const c of Array.isArray(list)?list:[]){if((c==null?void 0:c.kind)!=="select-inline"||typeof c.id!=="string"||RACE_STRUCTURAL_PSEUDO.has(c.id))continue;const v=read(c.id);for(const value of Array.isArray(v)?v:typeof v==="string"?[v]:[]){if(typeof value!=="string")continue;out.add(slugify(value));const opt=(Array.isArray(c.options)?c.options:[]).find(o=>(o==null?void 0:o.value)===value);if(typeof(opt==null?void 0:opt.label)==="string")out.add(slugify(opt.label))}}}return out}function innateLeaves(innate,comparand){if(!innate||typeof innate!=="object"||Array.isArray(innate))return[];const strings=v=>Array.isArray(v)?v.filter(x=>typeof x==="string"):v&&typeof v==="object"?Object.values(v).flatMap(strings):[];return Object.entries(innate).filter(([k])=>k==="_"||Number(k)<=comparand).flatMap(([,v])=>strings(v))}function memberAtWillLeaves(innate,comparand,slug){if(!innate||typeof innate!=="object"||Array.isArray(innate))return[];const out=[];for(const[k,v]of Object.entries(innate)){if(!(k==="_"||Number(k)<=comparand))continue;if(Array.isArray(v)){out.push(...v);continue}for(const[usage,list]of v&&typeof v==="object"?Object.entries(v):[]){if(usage==="will"&&Array.isArray(list))out.push(...list);else warnOnce(`addspells:usage:${slug}:innate:${k}:${usage}`,`archivist: additional_spells on "${slug}" innate.${k}.${usage} is a usage economy (skipped; G8)`)}}return out}function collectAdditionalSpells(args){var _a,_b;const{race,feats,classes,totalLevel,ownAbility,alreadyCollected,entities,warnings}=args;const raceChoice=(_a=args.raceChoice)!=null?_a:(()=>void 0);let index=null;const indexOf=()=>index!=null?index:index=buildSpellNameIndex(entities);const out=[];const carriers=[];const asRaw=x=>x==null?void 0:x.additional_spells;if(race&&raceIsUngated(race))carriers.push({root:"race",slug:race.slug,edition:editionOf(race),entries:entriesOf(asRaw(race)),comparand:totalLevel,classSlug:null});else if(race){const chosen=chosenRaceOptionKeys(race,raceChoice);for(const e of entriesOf(asRaw(race))){if(typeof e.name==="string"&&chosen.has(slugify(e.name))){carriers.push({root:"race",slug:race.slug,edition:editionOf(race),entries:[e],comparand:totalLevel,classSlug:null})}}}for(const f of feats)carriers.push({root:"feat",slug:f.slug,edition:editionOf(f),entries:entriesOf(asRaw(f)),comparand:totalLevel,classSlug:null});for(const c of classes){if(!c.entity)continue;carriers.push({root:"class",slug:c.entity.slug,edition:editionOf(c.entity),entries:entriesOf(asRaw(c.entity)),comparand:c.level,classSlug:c.entity.slug});if(c.subclass)carriers.push({root:"subclass",slug:c.subclass.slug,edition:editionOf(c.subclass),entries:entriesOf(asRaw(c.subclass)),comparand:c.level,classSlug:c.entity.slug})}for(const pool of(_b=args.pools)!=null?_b:[]){const c=classes[pool.classIndex];if(!(c==null?void 0:c.entity))continue;for(const m of[...heldPicks(pool),...pool.grants]){if(m.itemBound===true)continue;carriers.push({root:"member",slug:m.slug,edition:editionOf(m.entity),entries:entriesOf(asRaw(m.entity)),comparand:c.level,classSlug:c.entity.slug})}}for(const car of carriers){if(car.entries.length===0)continue;if(car.entries.length>1){if(car.entries.some(e=>entryHasInSliceLeaf(e,car.comparand,ownAbility)))warnOnce(`addspells:siblings:${car.slug}`,`archivist: additional_spells on "${car.slug}" has ${car.entries.length} sibling entries (a choose-one grant); skipped`);continue}const entry=car.entries[0];let ability=readAbility(entry.ability,ownAbility);if(ability==="choose"&&car.root==="race"){const pick=raceChoice("spellcasting-ability");const allowed=entry.ability.choose;ability=typeof pick==="string"&&Array.isArray(allowed)&&allowed.includes(pick)?pick:"choose"}if(ability==="choose")continue;const buckets=["known","prepared"].map(bucket=>{const levels=entry[bucket];return[bucket,!levels||typeof levels!=="object"||Array.isArray(levels)?[]:Object.entries(levels)]});if(car.root==="race")buckets.push(["innate",[["_",innateLeaves(entry.innate,car.comparand)]]]);if(car.root==="member")buckets.push(["at-will",[["_",memberAtWillLeaves(entry.innate,car.comparand,car.slug)]]]);for(const[bucket,levelEntries]of buckets){for(const[k,v]of levelEntries){if(!(k==="_"||Number(k)<=car.comparand))continue;if(!Array.isArray(v)){warnOnce(`addspells:usage:${car.slug}:${bucket}:${k}`,`archivist: additional_spells on "${car.slug}" ${bucket}.${k} is a usage economy (skipped; G8)`);continue}for(const leaf of v){const nameSlug=normalizeSpellRef(leaf);if(!nameSlug)continue;const hit=resolveSpellByName({entities,index:indexOf(),nameSlug,carrierSlug:car.slug,carrierEdition:car.edition,alreadyCollected:[...alreadyCollected,...out]});if(!hit){warnings.push(`additional_spells ref "${String(leaf)}" on ${car.slug} not found in compendium.`);continue}out.push({entity:hit.entity,slug:hit.slug,classSlug:car.classSlug,source:car.root==="race"?"race":car.root==="feat"?"feat":"class",prepared:true,alwaysPrepared:true,...ability?{ability}:{},...bucket==="at-will"?{atWill:true}:{}})}}}}return out}export{prefixOf,normalizeSpellRef,buildSpellNameIndex,resolveSpellByName,raceIsUngated,chosenRaceOptionKeys,collectAdditionalSpells};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function parseCastingTime(token){var _a;const t=(_a=token==null?void 0:token.trim())!=null?_a:"";if(!t)return null;if(/^(?:1\s*)?reaction\b/i.test(t))return{kind:"reaction",count:1};if(/^(?:1\s*)?bonus(?:[\s-]*action)?\b/i.test(t))return{kind:"bonus",count:1};if(/^(?:1\s*)?action\b/i.test(t))return{kind:"action",count:1};const m=/^(\d+)?[\s-]*(minute|min|hour|hr)s?\b/i.exec(t);if(m)return{kind:"time",count:m[1]?Number(m[1]):1,unit:/^h/i.test(m[2])?"hour":"minute"};return null}export{parseCastingTime};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{raceEntitySchema}from"./chunk-4SYAKWY4.js";import{aliasFeatureListActionCost}from"./chunk-S5UCI27C.js";import{parseYaml}from"@archivist-gg/core";function parseRace(source){const raw=parseYaml(source,["name","slug"]);if(!raw.success)return raw;aliasFeatureListActionCost(raw.data.traits);const result=raceEntitySchema.safeParse({edition:"2014",...raw.data});if(!result.success){return{success:false,error:`race schema validation failed: ${result.error.message}`}}return{success:true,data:result.data}}export{parseRace};
|