@optolith/entity-descriptions 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/lib/creator.d.ts +32 -0
- package/lib/creator.js +72 -0
- package/lib/entities/activatable.d.ts +52 -0
- package/lib/entities/activatable.js +609 -0
- package/lib/entities/alternativeRule.d.ts +7 -0
- package/lib/entities/alternativeRule.js +21 -0
- package/lib/entities/attribute.d.ts +6 -0
- package/lib/entities/attribute.js +15 -0
- package/lib/entities/combatTechnique.d.ts +5 -7
- package/lib/entities/combatTechnique.js +34 -24
- package/lib/entities/condition.d.ts +12 -0
- package/lib/entities/condition.js +63 -0
- package/lib/entities/culture.d.ts +8 -0
- package/lib/entities/culture.js +309 -0
- package/lib/entities/curriculum.d.ts +11 -0
- package/lib/entities/curriculum.js +266 -0
- package/lib/entities/derivedCharacteristic.d.ts +9 -0
- package/lib/entities/derivedCharacteristic.js +91 -0
- package/lib/entities/disease.d.ts +9 -0
- package/lib/entities/disease.js +88 -0
- package/lib/entities/elixir.d.ts +10 -0
- package/lib/entities/elixir.js +76 -0
- package/lib/entities/equipment.d.ts +24 -0
- package/lib/entities/equipment.js +613 -0
- package/lib/entities/equipmentPackage.d.ts +8 -0
- package/lib/entities/equipmentPackage.js +301 -0
- package/lib/entities/experienceLevel.d.ts +3 -2
- package/lib/entities/experienceLevel.js +33 -28
- package/lib/entities/focusRule.d.ts +3 -4
- package/lib/entities/focusRule.js +13 -5
- package/lib/entities/influence.d.ts +7 -0
- package/lib/entities/influence.js +35 -0
- package/lib/entities/liturgicalChant.d.ts +10 -23
- package/lib/entities/liturgicalChant.js +169 -131
- package/lib/entities/optionalRule.d.ts +3 -2
- package/lib/entities/optionalRule.js +4 -3
- package/lib/entities/partial/activatableNameChunks.d.ts +58 -0
- package/lib/entities/partial/activatableNameChunks.js +356 -0
- package/lib/entities/partial/adventurePointsValue.d.ts +9 -0
- package/lib/entities/partial/adventurePointsValue.js +243 -0
- package/lib/entities/partial/animalTypes.d.ts +11 -0
- package/lib/entities/partial/animalTypes.js +13 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +16 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +40 -0
- package/lib/entities/partial/dice.d.ts +10 -0
- package/lib/entities/partial/dice.js +13 -0
- package/lib/entities/partial/herbary.d.ts +28 -0
- package/lib/entities/partial/herbary.js +65 -0
- package/lib/entities/partial/map.d.ts +49 -0
- package/lib/entities/partial/map.js +43 -0
- package/lib/entities/partial/mathOperation.d.ts +36 -0
- package/lib/entities/partial/mathOperation.js +107 -0
- package/lib/entities/partial/prerequisites/displayOption.d.ts +7 -0
- package/lib/entities/partial/prerequisites/displayOption.js +19 -0
- package/lib/entities/partial/prerequisites/index.d.ts +67 -0
- package/lib/entities/partial/prerequisites/index.js +189 -0
- package/lib/entities/partial/prerequisites/part.d.ts +26 -0
- package/lib/entities/partial/prerequisites/part.js +88 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +65 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +269 -0
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +18 -0
- package/lib/entities/partial/prerequisites/single/activatable.js +40 -0
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/animistPower.js +23 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.js +32 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +19 -0
- package/lib/entities/partial/prerequisites/single/culture.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/culture.js +20 -0
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/enhancement.js +41 -0
- package/lib/entities/partial/prerequisites/single/influence.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/influence.js +17 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.js +27 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +8 -0
- package/lib/entities/partial/prerequisites/single/pact.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/pact.js +30 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.js +28 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.js +15 -0
- package/lib/entities/partial/prerequisites/single/publication.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/publication.js +19 -0
- package/lib/entities/partial/prerequisites/single/race.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/race.js +20 -0
- package/lib/entities/partial/prerequisites/single/rated.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/rated.js +41 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +89 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.js +21 -0
- package/lib/entities/partial/prerequisites/single/rule.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/rule.js +4 -0
- package/lib/entities/partial/prerequisites/single/sex.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sex.js +19 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +21 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.js +21 -0
- package/lib/entities/partial/prerequisites/single/state.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/state.js +20 -0
- package/lib/entities/partial/prerequisites/single/text.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/text.js +9 -0
- package/lib/entities/partial/professions.d.ts +15 -0
- package/lib/entities/partial/professions.js +19 -0
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +16 -7
- package/lib/entities/partial/rated/activatable/castingTime.js +35 -20
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +18 -3
- package/lib/entities/partial/rated/activatable/checkResultBased.js +18 -10
- package/lib/entities/partial/rated/activatable/cost.d.ts +88 -8
- package/lib/entities/partial/rated/activatable/cost.js +183 -115
- package/lib/entities/partial/rated/activatable/duration.d.ts +36 -13
- package/lib/entities/partial/rated/activatable/duration.js +72 -61
- package/lib/entities/partial/rated/activatable/effect.d.ts +4 -4
- package/lib/entities/partial/rated/activatable/effect.js +32 -25
- package/lib/entities/partial/rated/activatable/index.d.ts +31 -27
- package/lib/entities/partial/rated/activatable/index.js +63 -28
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +5 -6
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.js +8 -5
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +2 -4
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +7 -42
- package/lib/entities/partial/rated/activatable/range.d.ts +22 -14
- package/lib/entities/partial/rated/activatable/range.js +54 -54
- package/lib/entities/partial/rated/activatable/speed.d.ts +11 -2
- package/lib/entities/partial/rated/activatable/speed.js +14 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +4 -5
- package/lib/entities/partial/rated/activatable/targetCategory.js +19 -24
- package/lib/entities/partial/rated/improvementCost.d.ts +16 -4
- package/lib/entities/partial/rated/improvementCost.js +63 -4
- package/lib/entities/partial/rated/skillCheck.d.ts +20 -17
- package/lib/entities/partial/rated/skillCheck.js +56 -54
- package/lib/entities/partial/reader.d.ts +266 -0
- package/lib/entities/partial/reader.js +175 -0
- package/lib/entities/partial/responsiveText.d.ts +10 -5
- package/lib/entities/partial/responsiveText.js +19 -3
- package/lib/entities/partial/units/energy.d.ts +5 -8
- package/lib/entities/partial/units/energy.js +5 -23
- package/lib/entities/partial/units/length.d.ts +20 -2
- package/lib/entities/partial/units/length.js +24 -5
- package/lib/entities/partial/units/timeSpan.d.ts +25 -4
- package/lib/entities/partial/units/timeSpan.js +27 -15
- package/lib/entities/partial/unknown.d.ts +5 -1
- package/lib/entities/partial/unknown.js +5 -1
- package/lib/entities/personalityTrait.d.ts +7 -0
- package/lib/entities/personalityTrait.js +56 -0
- package/lib/entities/poison.d.ts +12 -0
- package/lib/entities/poison.js +356 -0
- package/lib/entities/profession.d.ts +12 -0
- package/lib/entities/profession.js +585 -0
- package/lib/entities/race.d.ts +9 -0
- package/lib/entities/race.js +146 -0
- package/lib/entities/sexPractice.d.ts +6 -0
- package/lib/entities/sexPractice.js +33 -0
- package/lib/entities/skill.d.ts +9 -9
- package/lib/entities/skill.js +124 -91
- package/lib/entities/spell.d.ts +83 -26
- package/lib/entities/spell.js +835 -147
- package/lib/entities/state.d.ts +6 -0
- package/lib/entities/state.js +17 -0
- package/lib/helpers/enums.d.ts +11 -0
- package/lib/helpers/enums.js +6 -0
- package/lib/helpers/getTypes.d.ts +12 -482
- package/lib/helpers/getTypes.js +1 -0
- package/lib/helpers/identifiers.d.ts +314 -0
- package/lib/helpers/identifiers.js +333 -0
- package/lib/helpers/locale.d.ts +21 -2
- package/lib/helpers/translate.d.ts +47 -5
- package/lib/helpers/translate.js +13 -6
- package/lib/index.d.ts +848 -21
- package/lib/index.js +182 -17
- package/lib/references/index.d.ts +6 -3
- package/lib/references/index.js +25 -33
- package/lib/references/page.d.ts +1 -1
- package/lib/references/page.js +14 -14
- package/lib/references/pageRange.d.ts +1 -5
- package/lib/references/pageRange.js +7 -16
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -10
- package/.prettierrc.yml +0 -1
- package/lib/entities/partial/rated/activatable/entity.d.ts +0 -11
- package/lib/entities/partial/rated/activatable/entity.js +0 -12
- package/lib/references/occurrence.d.ts +0 -4
- package/lib/references/occurrence.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,71 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.3.1](https://github.com/Optolith/entity-descriptions/compare/v0.3.0...v0.3.1) (2026-02-25)
|
|
6
|
+
|
|
7
|
+
## [0.3.0](https://github.com/Optolith/entity-descriptions/compare/v0.2.1...v0.3.0) (2026-02-25)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### ⚠ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
* stricter types for body sections
|
|
13
|
+
* migrate codebase to TSONDB database
|
|
14
|
+
|
|
15
|
+
* migrate codebase to TSONDB database ([e702883](https://github.com/Optolith/entity-descriptions/commit/e70288335ec8e837b1624ba7e9749921cc6dfad1))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add attribute description generators ([02f332e](https://github.com/Optolith/entity-descriptions/commit/02f332eea66a2d24dd8308e98ef41650909d305d))
|
|
21
|
+
* add derived characteristic description generator and main entrypoint ([5d47824](https://github.com/Optolith/entity-descriptions/commit/5d47824b4b4b95aaff5e6fd7c486dc7f87b8c555))
|
|
22
|
+
* add description generator for alternative rules ([6b2d0a9](https://github.com/Optolith/entity-descriptions/commit/6b2d0a9647725903e6e80c21c13f98c2a26675f7))
|
|
23
|
+
* add description generator for curricula ([7a9f8be](https://github.com/Optolith/entity-descriptions/commit/7a9f8be30c0d5425a923f780a0c0ff27a983ea27))
|
|
24
|
+
* add description generator for curses ([c686fe7](https://github.com/Optolith/entity-descriptions/commit/c686fe7d4c2e82d25b07249ff86498c958622b5e))
|
|
25
|
+
* add description generators for (dis)advantages, special abilities and tradition artifact enchantments ([f8664b9](https://github.com/Optolith/entity-descriptions/commit/f8664b9194a7f6855a865308d75f508aea6f8b32))
|
|
26
|
+
* add labeled sections and definition list styles ([92d175d](https://github.com/Optolith/entity-descriptions/commit/92d175dcac0c93245c11df6cec3a7a2d8f876c19))
|
|
27
|
+
* animist power description generator ([a048505](https://github.com/Optolith/entity-descriptions/commit/a0485059dad65b1e0fbbf0a65305f3b3b2897993))
|
|
28
|
+
* collect errata ([e0df04f](https://github.com/Optolith/entity-descriptions/commit/e0df04fdd7887660399d89747dbd8e98148ef14a))
|
|
29
|
+
* culture description generator ([d1fa45e](https://github.com/Optolith/entity-descriptions/commit/d1fa45ef4c289e5aee62ac9ee43277200f771386))
|
|
30
|
+
* disease description generator ([070afac](https://github.com/Optolith/entity-descriptions/commit/070afac3f32b7c13662060181204db6530d37c18))
|
|
31
|
+
* domination ritual description generator ([76f55c8](https://github.com/Optolith/entity-descriptions/commit/76f55c8019d8ce86b20966cc4f1d113e6383fe80))
|
|
32
|
+
* elixir description generator ([364b053](https://github.com/Optolith/entity-descriptions/commit/364b053c1d54f8c3311c0c5f9d4a1f346fa3b441))
|
|
33
|
+
* elven magical song description generator ([0bf136a](https://github.com/Optolith/entity-descriptions/commit/0bf136a171ebb046393d98312d8173ba82871d71))
|
|
34
|
+
* equipment description generators ([9847d2b](https://github.com/Optolith/entity-descriptions/commit/9847d2b1586206de10eb70d059e28fb3648d1fd7))
|
|
35
|
+
* familiar’s trick description generator ([931ba54](https://github.com/Optolith/entity-descriptions/commit/931ba5478ef009ee426e1794beb264a1f9aca194))
|
|
36
|
+
* geode ritual description generator ([2c4af0e](https://github.com/Optolith/entity-descriptions/commit/2c4af0eae6b6add22733b8583ae460a312662813))
|
|
37
|
+
* influence description generator ([5f253d3](https://github.com/Optolith/entity-descriptions/commit/5f253d3b9a24f4d2a347dfd679092545759c5169))
|
|
38
|
+
* jester trick description generator ([7170289](https://github.com/Optolith/entity-descriptions/commit/7170289dea3de8f1fd97240b58eafb6c21942882))
|
|
39
|
+
* magical dance and magical melody description generators ([e11f06b](https://github.com/Optolith/entity-descriptions/commit/e11f06b6cd62d14706f073653b953875a1a794f9))
|
|
40
|
+
* magical rune description generator ([7121a31](https://github.com/Optolith/entity-descriptions/commit/7121a31324450ba7a0442a2317527246384b3781))
|
|
41
|
+
* personality trait description generator ([11d856d](https://github.com/Optolith/entity-descriptions/commit/11d856d19ef9fa50cfa4218b0a853fbd3e0ec342))
|
|
42
|
+
* poison description generator ([1979cab](https://github.com/Optolith/entity-descriptions/commit/1979cabff94e219ae76d782e4d1e1c3d77b1a8f2))
|
|
43
|
+
* print prerequisites ([235f6eb](https://github.com/Optolith/entity-descriptions/commit/235f6eb08d9c6513d325e0bd4f8f7c88a29a6559))
|
|
44
|
+
* profession description generator ([cf9be74](https://github.com/Optolith/entity-descriptions/commit/cf9be74548bf0a98d682815d3389aba814b707ef))
|
|
45
|
+
* race description generator ([7a0d7ed](https://github.com/Optolith/entity-descriptions/commit/7a0d7edc69952fafa3728fec2bd7187fc6d8d856))
|
|
46
|
+
* sex practice description generator ([3d8d229](https://github.com/Optolith/entity-descriptions/commit/3d8d229e76ad231642571f7ae4e5226955ed3c5d))
|
|
47
|
+
* stricter types for body sections ([d3d747f](https://github.com/Optolith/entity-descriptions/commit/d3d747f75c2317aabb50576fbe59a99297ad3110))
|
|
48
|
+
* zibilja ritual description generator ([7ca36b9](https://github.com/Optolith/entity-descriptions/commit/7ca36b9af3505cf3e0c7b0f339dd024aab60dfd4))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* add missing alternative names and special ([546cc85](https://github.com/Optolith/entity-descriptions/commit/546cc852cd41526ccd0185bd1b94c9f3f03c41cb))
|
|
54
|
+
* missing familiar's trick LP cost ([00348aa](https://github.com/Optolith/entity-descriptions/commit/00348aaedfee61a023266aa9d1ffb96fe27a4d2a))
|
|
55
|
+
* missing note for cost by primary patron ([a10d785](https://github.com/Optolith/entity-descriptions/commit/a10d785a53fa64fe31f345065b3628be78e5bb55))
|
|
56
|
+
* poison application types and addiction ([03d8854](https://github.com/Optolith/entity-descriptions/commit/03d885404e31b4d610ff5bbf7a94fbfcb0fdd2aa))
|
|
57
|
+
* register magical rune descriptor correctly ([84705eb](https://github.com/Optolith/entity-descriptions/commit/84705eb75f96c0aa7986a16e02daa91699d19f52))
|
|
58
|
+
* register previously existing generators ([b3253e0](https://github.com/Optolith/entity-descriptions/commit/b3253e070ae8e49cf72efa430798f844cb37dffd))
|
|
59
|
+
* register sex practice descriptor ([7a7f9fe](https://github.com/Optolith/entity-descriptions/commit/7a7f9fef45da06e6a08dbbe54838d00afbd485e5))
|
|
60
|
+
* render errata ([763e7bf](https://github.com/Optolith/entity-descriptions/commit/763e7bf1542dd4f6cfc70f6a0915e1214c3d6d58))
|
|
61
|
+
* sort translated lists ([f1df86f](https://github.com/Optolith/entity-descriptions/commit/f1df86f7b941e7ea26677eedb0443566672cbe96))
|
|
62
|
+
|
|
63
|
+
## [0.2.1](https://github.com/Optolith/entity-descriptions/compare/v0.2.0...v0.2.1) (2024-10-07)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* default database accessors type always throws error when function is called ([31bcb85](https://github.com/Optolith/entity-descriptions/commit/31bcb850a7d962417a65c4517090fb9c9d581fef))
|
|
69
|
+
|
|
5
70
|
## [0.2.0](https://github.com/Optolith/entity-descriptions/compare/v0.1.1...v0.2.0) (2024-10-07)
|
|
6
71
|
|
|
7
72
|
|
package/lib/creator.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EntityMap } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetInstanceById } from "./helpers/getTypes.js";
|
|
3
|
+
import { LocaleEnvironment } from "./helpers/locale.js";
|
|
4
|
+
import { EntityDescription, RawEntityDescription } from "./index.js";
|
|
5
|
+
/**
|
|
6
|
+
* A union type of entities with their names as a discriminant property.
|
|
7
|
+
*/
|
|
8
|
+
export type TaggedEntity<ES extends keyof EntityMap> = {
|
|
9
|
+
[E in ES]: {
|
|
10
|
+
entity: E;
|
|
11
|
+
content: EntityMap[E];
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
}[ES];
|
|
15
|
+
/**
|
|
16
|
+
* Creates a function that creates the JSON representation of the rules text for
|
|
17
|
+
* a library entry.
|
|
18
|
+
*/
|
|
19
|
+
export declare const createEntityDescriptionCreator: <ES extends keyof EntityMap, A extends {
|
|
20
|
+
getInstanceById: GetInstanceById<"Publication">;
|
|
21
|
+
} = {
|
|
22
|
+
getInstanceById: GetInstanceById<"Publication">;
|
|
23
|
+
}>(fn: EntityDescriptionCreator<ES, A, RawEntityDescription>) => EntityDescriptionCreator<ES, A>;
|
|
24
|
+
/**
|
|
25
|
+
* A function that creates the JSON representation of the rules text for a
|
|
26
|
+
* library entry.
|
|
27
|
+
*/
|
|
28
|
+
export type EntityDescriptionCreator<ES extends keyof EntityMap = keyof EntityMap, A extends {
|
|
29
|
+
getInstanceById: GetInstanceById<"Publication">;
|
|
30
|
+
} = {
|
|
31
|
+
getInstanceById: GetInstanceById<"Publication">;
|
|
32
|
+
}, R = EntityDescription> = (databaseAccessors: A, locale: LocaleEnvironment, entry: TaggedEntity<ES>) => R | undefined;
|
package/lib/creator.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
2
|
+
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
3
|
+
import { getReferencesTranslation } from "./references/index.js";
|
|
4
|
+
const mapRawSectionContent = (mapDefinitionList, section) => {
|
|
5
|
+
switch (section.type) {
|
|
6
|
+
case "plain":
|
|
7
|
+
case "table":
|
|
8
|
+
return section;
|
|
9
|
+
case "definitionList":
|
|
10
|
+
return mapDefinitionList(section);
|
|
11
|
+
default:
|
|
12
|
+
return assertExhaustive(section);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const mapNestedDefinitionList = (definitionListSection) => ({
|
|
16
|
+
...definitionListSection,
|
|
17
|
+
items: definitionListSection.items.filter(isNotNullish).map(item => ({
|
|
18
|
+
...item,
|
|
19
|
+
value: typeof item.value === "string"
|
|
20
|
+
? item.value
|
|
21
|
+
: item.value
|
|
22
|
+
.filter(isNotNullish)
|
|
23
|
+
.map(subsection => mapRawSectionContent(mapNestedDefinitionList, subsection)),
|
|
24
|
+
})),
|
|
25
|
+
});
|
|
26
|
+
const mapDefinitionList = (section) => ({
|
|
27
|
+
...section,
|
|
28
|
+
items: section.items.filter(isNotNullish).map(item => ({
|
|
29
|
+
...item,
|
|
30
|
+
value: typeof item.value === "string"
|
|
31
|
+
? item.value
|
|
32
|
+
: item.value
|
|
33
|
+
.filter(isNotNullish)
|
|
34
|
+
.map(subsection => mapRawSectionContent(mapNestedDefinitionList, subsection)),
|
|
35
|
+
})),
|
|
36
|
+
});
|
|
37
|
+
const mapRawSection = (section) => {
|
|
38
|
+
switch (section.type) {
|
|
39
|
+
case "labeled":
|
|
40
|
+
return {
|
|
41
|
+
...section,
|
|
42
|
+
value: mapRawSectionContent(mapDefinitionList, section.value),
|
|
43
|
+
};
|
|
44
|
+
case "plain":
|
|
45
|
+
case "table":
|
|
46
|
+
case "definitionList":
|
|
47
|
+
return mapRawSectionContent(mapDefinitionList, section);
|
|
48
|
+
default:
|
|
49
|
+
return assertExhaustive(section);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Creates a function that creates the JSON representation of the rules text for
|
|
54
|
+
* a library entry.
|
|
55
|
+
*/
|
|
56
|
+
export const createEntityDescriptionCreator = (fn) => (databaseAccessors, locale, entry) => {
|
|
57
|
+
const rawEntry = fn(databaseAccessors, locale, entry);
|
|
58
|
+
if (rawEntry === undefined) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...rawEntry,
|
|
63
|
+
body: rawEntry.body.filter(isNotNullish).map(mapRawSection),
|
|
64
|
+
errata: rawEntry.errata?.map(({ date, description }) => ({
|
|
65
|
+
date: date.toLocaleDateString(locale.id),
|
|
66
|
+
description: description.trim(),
|
|
67
|
+
})),
|
|
68
|
+
references: rawEntry.references === undefined
|
|
69
|
+
? undefined
|
|
70
|
+
: getReferencesTranslation(databaseAccessors.getInstanceById, locale, rawEntry.references),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisites, AdventurePointsValue, ApplicableCombatTechniques, Aspect_ID, CombatSpecialAbilityUsageType, DaggerRitualCost, EnchantmentCost, Errata, GeneralPrerequisites, MagicalSignCost, Penalty, PropertyDeclaration, PublicationRefs, RatedIdentifier, SelectOptions, SpecialRule, Volume } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
|
+
import type { GetAllResolvedNewSkillApplications, GetAllResolvedSelectOptions, GetAllResolvedSkillUses } from "../index.js";
|
|
4
|
+
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
5
|
+
/**
|
|
6
|
+
* The base fields for a special ability entity in the database.
|
|
7
|
+
*/
|
|
8
|
+
export type BaseActivatable = {
|
|
9
|
+
levels?: number;
|
|
10
|
+
maximum?: number;
|
|
11
|
+
select_options?: SelectOptions;
|
|
12
|
+
usage_type?: CombatSpecialAbilityUsageType;
|
|
13
|
+
penalty?: Penalty;
|
|
14
|
+
combat_techniques?: ApplicableCombatTechniques;
|
|
15
|
+
volume?: Volume;
|
|
16
|
+
cost?: EnchantmentCost | DaggerRitualCost | MagicalSignCost | number;
|
|
17
|
+
property?: PropertyDeclaration;
|
|
18
|
+
aspect?: Aspect_ID;
|
|
19
|
+
prerequisites?: AdvantageDisadvantagePrerequisites | GeneralPrerequisites;
|
|
20
|
+
ap_value: AdventurePointsValue | number;
|
|
21
|
+
translations: {
|
|
22
|
+
[locale: string]: BaseActivatableTranslation;
|
|
23
|
+
};
|
|
24
|
+
src: PublicationRefs;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The base translation fields for a special ability.
|
|
28
|
+
*/
|
|
29
|
+
export type BaseActivatableTranslation = {
|
|
30
|
+
name: string;
|
|
31
|
+
name_in_library?: string;
|
|
32
|
+
rules?: string;
|
|
33
|
+
range?: string;
|
|
34
|
+
effect?: string;
|
|
35
|
+
special_rules?: SpecialRule[];
|
|
36
|
+
protective_circle?: string;
|
|
37
|
+
warding_circle?: string;
|
|
38
|
+
ap_value?: string;
|
|
39
|
+
ap_value_append?: string;
|
|
40
|
+
errata?: Errata;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Get a JSON representation of the rules text for a special ability.
|
|
44
|
+
*/
|
|
45
|
+
export declare const getActivatableEntityDescription: import("../creator.js").EntityDescriptionCreator<"Advantage" | "Disadvantage" | "AdvancedCombatSpecialAbility" | "AdvancedKarmaSpecialAbility" | "AdvancedMagicalSpecialAbility" | "AdvancedSkillSpecialAbility" | "AncestorGlyph" | "ArcaneOrbEnchantment" | "AttireEnchantment" | "Beutelzauber" | "BlessedTradition" | "BowlEnchantment" | "BrawlingSpecialAbility" | "CauldronEnchantment" | "CeremonialItemSpecialAbility" | "ChronicleEnchantment" | "CombatSpecialAbility" | "CombatStyleSpecialAbility" | "CommandSpecialAbility" | "DaggerRitual" | "FamiliarSpecialAbility" | "FatePointSexSpecialAbility" | "FatePointSpecialAbility" | "FoolsHatEnchantment" | "GeneralSpecialAbility" | "Haubenzauber" | "InstrumentEnchantment" | "KarmaSpecialAbility" | "Krallenkettenzauber" | "Kristallkugelzauber" | "LiturgicalStyleSpecialAbility" | "LycantropicGift" | "MagicalSign" | "MagicalSpecialAbility" | "MagicalTradition" | "MagicStyleSpecialAbility" | "OrbEnchantment" | "PactGift" | "ProtectiveWardingCircleSpecialAbility" | "RingEnchantment" | "Sermon" | "SexSpecialAbility" | "SickleRitual" | "SikaryanDrainSpecialAbility" | "SkillStyleSpecialAbility" | "SpellSwordEnchantment" | "StaffEnchantment" | "ToyEnchantment" | "Trinkhornzauber" | "VampiricGift" | "Vision" | "WandEnchantment" | "WeaponEnchantment", {
|
|
46
|
+
getInstanceById: GetInstanceById<"Publication" | "Subject" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "TradeSecret" | "Aspect" | "Property" | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Weapon">;
|
|
47
|
+
getAllInstances: GetAllInstances<"Script">;
|
|
48
|
+
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
49
|
+
getAllResolvedSelectOptions: GetAllResolvedSelectOptions;
|
|
50
|
+
getAllResolvedNewSkillApplications: GetAllResolvedNewSkillApplications;
|
|
51
|
+
getAllResolvedSkillUses: GetAllResolvedSkillUses;
|
|
52
|
+
}, import("../index.js").EntityDescription>;
|