@optolith/entity-descriptions 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/creator.d.ts +17 -12
- package/lib/creator.js +89 -17
- package/lib/entities/activatable.d.ts +5 -2
- package/lib/entities/activatable.js +7 -1
- package/lib/entities/alternativeRule.d.ts +1 -1
- package/lib/entities/attribute.d.ts +1 -3
- package/lib/entities/combatTechnique.d.ts +2 -2
- package/lib/entities/condition.d.ts +2 -6
- package/lib/entities/culture.d.ts +2 -1
- package/lib/entities/curriculum.d.ts +1 -1
- package/lib/entities/derivedCharacteristic.d.ts +1 -1
- package/lib/entities/disease.d.ts +1 -1
- package/lib/entities/disease.js +5 -6
- package/lib/entities/elixir.d.ts +1 -1
- package/lib/entities/elixir.js +2 -2
- package/lib/entities/equipment.d.ts +6 -8
- package/lib/entities/equipment.js +517 -213
- package/lib/entities/equipmentPackage.d.ts +1 -1
- package/lib/entities/experienceLevel.d.ts +1 -3
- package/lib/entities/focusRule.d.ts +1 -1
- package/lib/entities/influence.d.ts +1 -1
- package/lib/entities/liturgicalChant.d.ts +3 -3
- package/lib/entities/optionalRule.d.ts +1 -3
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +1 -1
- package/lib/entities/partial/enhancements.d.ts +1 -1
- package/lib/entities/partial/herbary.d.ts +6 -3
- package/lib/entities/partial/herbary.js +5 -3
- package/lib/entities/partial/prerequisites/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/effect.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +1 -1
- package/lib/entities/partial/rated/improvementCost.d.ts +1 -1
- package/lib/entities/partial/units/simple.d.ts +55 -0
- package/lib/entities/partial/units/simple.js +56 -0
- package/lib/entities/personalityTrait.d.ts +1 -1
- package/lib/entities/poison.d.ts +1 -1
- package/lib/entities/poison.js +2 -2
- package/lib/entities/profession.d.ts +2 -1
- package/lib/entities/race.d.ts +2 -2
- package/lib/entities/sexPractice.d.ts +1 -3
- package/lib/entities/skill.d.ts +1 -1
- package/lib/entities/spell.d.ts +17 -16
- package/lib/entities/state.d.ts +1 -3
- package/lib/entities/tradeSecret.d.ts +4 -0
- package/lib/entities/tradeSecret.js +77 -0
- package/lib/entityDescription.d.ts +118 -0
- package/lib/entityDescription.js +1 -0
- package/lib/env.d.ts +9 -2
- package/lib/helpers/locale.d.ts +4 -0
- package/lib/index.d.ts +247 -423
- package/lib/index.js +9 -1
- package/lib/rawEntityDescription.d.ts +144 -0
- package/lib/rawEntityDescription.js +1 -0
- package/lib/references/index.d.ts +2 -3
- package/lib/references/index.js +11 -16
- package/lib/references/page.d.ts +4 -2
- package/lib/references/page.js +6 -4
- package/lib/references/pageRange.d.ts +3 -3
- package/lib/references/pageRange.js +6 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
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.16.0](https://github.com/Optolith/entity-descriptions/compare/v0.15.0...v0.16.0) (2026-09-27)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* extract raw and final description types into separate files and exports
|
|
10
|
+
|
|
11
|
+
* extract raw and final description types into separate files and exports ([4566a3e](https://github.com/Optolith/entity-descriptions/commit/4566a3e47b4635a39fc2a84394bb64e322de7885))
|
|
12
|
+
## [0.15.0](https://github.com/Optolith/entity-descriptions/compare/v0.14.0...v0.15.0) (2026-09-26)
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* tabular descriptions for most equipment
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add trade secret entity description ([6379f7d](https://github.com/Optolith/entity-descriptions/commit/6379f7d5fb111ad5960db15b16a17e9d3600bf71))
|
|
21
|
+
* tabular descriptions for most equipment ([3c53e81](https://github.com/Optolith/entity-descriptions/commit/3c53e81d8ca55b47c16ebd4727aa34531f42f965))
|
|
5
22
|
## [0.14.0](https://github.com/Optolith/entity-descriptions/compare/v0.13.2...v0.14.0) (2026-09-24)
|
|
6
23
|
|
|
7
24
|
### ⚠ BREAKING CHANGES
|
package/lib/creator.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { type AnyNonNullish } from "@elyukai/utils/nullable";
|
|
2
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
1
3
|
import type { EntityMap } from "@optolith/database-schema/gen";
|
|
2
|
-
import type {
|
|
4
|
+
import type { EntityDescription } from "./entityDescription.js";
|
|
5
|
+
import type { StdEnv } from "./env.js";
|
|
3
6
|
import type { LocaleEnvironment } from "./helpers/locale.js";
|
|
4
|
-
import type {
|
|
7
|
+
import type { RawEntityDescription } from "./rawEntityDescription.js";
|
|
5
8
|
import { type PublicationOptions } from "./references/publicationOptions.js";
|
|
6
9
|
/**
|
|
7
10
|
* A union type of entities with their names as a discriminant property.
|
|
@@ -17,19 +20,21 @@ export type TaggedEntity<ES extends keyof EntityMap> = {
|
|
|
17
20
|
* Creates a function that creates the JSON representation of the rules text for
|
|
18
21
|
* a library entry.
|
|
19
22
|
*/
|
|
20
|
-
export declare const createEntityDescriptionCreator: <ES extends keyof EntityMap, A extends
|
|
21
|
-
getInstanceById: GetInstanceById<"Publication">;
|
|
22
|
-
} = {
|
|
23
|
-
getInstanceById: GetInstanceById<"Publication">;
|
|
24
|
-
}>(fn: EntityDescriptionCreator<ES, A, RawEntityDescription>) => EntityDescriptionCreator<ES, A>;
|
|
23
|
+
export declare const createEntityDescriptionCreator: <ES extends keyof EntityMap, A = AnyNonNullish, Cols extends string = never>(fn: EntityDescriptionCreator<ES, A, RawEntityDescription<Cols, A>>) => EntityDescriptionCreator<ES, A & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">>;
|
|
25
24
|
/**
|
|
26
25
|
* A function that creates the JSON representation of the rules text for a
|
|
27
26
|
* library entry.
|
|
28
27
|
*/
|
|
29
|
-
export type EntityDescriptionCreator<ES extends keyof EntityMap = keyof EntityMap, A
|
|
30
|
-
getInstanceById: GetInstanceById<"Publication">;
|
|
31
|
-
} = {
|
|
32
|
-
getInstanceById: GetInstanceById<"Publication">;
|
|
33
|
-
}, R = EntityDescription> = (databaseAccessors: A, locale: LocaleEnvironment, entry: TaggedEntity<ES>, options: {
|
|
28
|
+
export type EntityDescriptionCreator<ES extends keyof EntityMap = keyof EntityMap, A = AnyNonNullish, R = EntityDescription<string>> = (databaseAccessors: A, locale: LocaleEnvironment, entry: TaggedEntity<ES>, options: {
|
|
34
29
|
publications: PublicationOptions;
|
|
35
30
|
}) => R | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Bridge between Reader and plain string instances in a definition list item.
|
|
33
|
+
*/
|
|
34
|
+
export declare const combatDLItem: <T, E>(item: {
|
|
35
|
+
label: Reader<E, string>;
|
|
36
|
+
value: Reader<E, T>;
|
|
37
|
+
} | undefined, env: E) => {
|
|
38
|
+
label: string;
|
|
39
|
+
value: T;
|
|
40
|
+
} | undefined;
|
package/lib/creator.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { ensureNonEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
1
2
|
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
3
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
4
|
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
3
5
|
import { getReferencesTranslation } from "./references/index.js";
|
|
4
6
|
import { isEntryFromIncludedPublication, } from "./references/publicationOptions.js";
|
|
5
|
-
const mapRawSectionContent = (mapDefinitionList, section) => {
|
|
7
|
+
const mapRawSectionContent = (mapDefinitionList, section, env) => {
|
|
6
8
|
switch (section.type) {
|
|
7
9
|
case "plain":
|
|
8
10
|
case "table":
|
|
9
11
|
return section;
|
|
10
12
|
case "definitionList":
|
|
11
|
-
return mapDefinitionList(section);
|
|
13
|
+
return mapDefinitionList(section, env);
|
|
12
14
|
default:
|
|
13
15
|
return assertExhaustive(section);
|
|
14
16
|
}
|
|
@@ -21,54 +23,124 @@ const mapNestedDefinitionList = (definitionListSection) => ({
|
|
|
21
23
|
? item.value
|
|
22
24
|
: item.value
|
|
23
25
|
.filter(isNotNullish)
|
|
24
|
-
.map(subsection => mapRawSectionContent(mapNestedDefinitionList, subsection)),
|
|
26
|
+
.map(subsection => mapRawSectionContent(mapNestedDefinitionList, subsection, null)),
|
|
25
27
|
})),
|
|
26
28
|
});
|
|
27
|
-
const mapDefinitionList = (section) => ({
|
|
29
|
+
const mapDefinitionList = (section, env) => ({
|
|
28
30
|
...section,
|
|
29
|
-
items: section.items.filter(isNotNullish).map(item =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
: item.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
items: section.items.filter(isNotNullish).map(item => {
|
|
32
|
+
const normalizedValue = item.value instanceof Reader ? item.value.run(env) : item.value;
|
|
33
|
+
return {
|
|
34
|
+
...item,
|
|
35
|
+
label: typeof item.label === "string" ? item.label : item.label.run(env),
|
|
36
|
+
value: typeof normalizedValue === "string"
|
|
37
|
+
? normalizedValue
|
|
38
|
+
: normalizedValue
|
|
39
|
+
.filter(isNotNullish)
|
|
40
|
+
.map(subsection => mapRawSectionContent(mapNestedDefinitionList, subsection, env)),
|
|
41
|
+
};
|
|
42
|
+
}),
|
|
37
43
|
});
|
|
38
|
-
const mapRawSection = (section) => {
|
|
44
|
+
const mapRawSection = (section, env) => {
|
|
39
45
|
switch (section.type) {
|
|
40
46
|
case "labeled":
|
|
41
47
|
return {
|
|
42
48
|
...section,
|
|
43
|
-
value: mapRawSectionContent(mapDefinitionList, section.value),
|
|
49
|
+
value: mapRawSectionContent(mapDefinitionList, section.value, env),
|
|
44
50
|
};
|
|
45
51
|
case "plain":
|
|
46
52
|
case "table":
|
|
47
53
|
case "definitionList":
|
|
48
|
-
return mapRawSectionContent(mapDefinitionList, section);
|
|
54
|
+
return mapRawSectionContent(mapDefinitionList, section, env);
|
|
49
55
|
default:
|
|
50
56
|
return assertExhaustive(section);
|
|
51
57
|
}
|
|
52
58
|
};
|
|
59
|
+
const mapRawTabular = (raw, env, options) => ({
|
|
60
|
+
...raw,
|
|
61
|
+
category: raw.category === undefined
|
|
62
|
+
? undefined
|
|
63
|
+
: {
|
|
64
|
+
label: raw.category.label.run(env),
|
|
65
|
+
value: raw.category.value.run(env),
|
|
66
|
+
},
|
|
67
|
+
labels: Object.fromEntries(Object.entries(raw.labels).map(([col, label]) => [col, label.run(env)])),
|
|
68
|
+
values: Object.fromEntries(Object.entries(raw.values).map(([col, value]) => [col, value.run(env)])),
|
|
69
|
+
additionalInformation: raw.additionalInformation === undefined
|
|
70
|
+
? undefined
|
|
71
|
+
: raw.additionalInformation
|
|
72
|
+
.map(info => {
|
|
73
|
+
if (info === undefined) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
const { label: labelR, id, value: valueR } = info;
|
|
77
|
+
const value = valueR.run(env);
|
|
78
|
+
if (value === undefined) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
label: labelR.run(env),
|
|
83
|
+
id,
|
|
84
|
+
value,
|
|
85
|
+
};
|
|
86
|
+
})
|
|
87
|
+
.filter(isNotNullish),
|
|
88
|
+
errata: raw.errata?.map(({ date, description }) => ({
|
|
89
|
+
date: env.formatDate(new Date(date)),
|
|
90
|
+
description: description.trim(),
|
|
91
|
+
})),
|
|
92
|
+
references: raw.references === undefined
|
|
93
|
+
? undefined
|
|
94
|
+
: getReferencesTranslation(options.publications, raw.references).run(env),
|
|
95
|
+
});
|
|
53
96
|
/**
|
|
54
97
|
* Creates a function that creates the JSON representation of the rules text for
|
|
55
98
|
* a library entry.
|
|
56
99
|
*/
|
|
57
100
|
export const createEntityDescriptionCreator = (fn) => (databaseAccessors, locale, entry, options) => {
|
|
58
101
|
const rawEntry = fn(databaseAccessors, locale, entry, options);
|
|
102
|
+
if (Array.isArray(rawEntry)) {
|
|
103
|
+
const results = rawEntry
|
|
104
|
+
.filter(e => isEntryFromIncludedPublication({ src: e.references }, databaseAccessors.getInstanceById, locale.translateMap, options.publications))
|
|
105
|
+
.map(e => mapRawTabular(e, databaseAccessors, options));
|
|
106
|
+
return ensureNonEmpty(results);
|
|
107
|
+
}
|
|
59
108
|
if (rawEntry === undefined ||
|
|
60
109
|
!isEntryFromIncludedPublication({ src: rawEntry.references }, databaseAccessors.getInstanceById, locale.translateMap, options.publications)) {
|
|
61
110
|
return undefined;
|
|
62
111
|
}
|
|
112
|
+
if (rawEntry.type === "tabular") {
|
|
113
|
+
return mapRawTabular(rawEntry, databaseAccessors, options);
|
|
114
|
+
}
|
|
63
115
|
return {
|
|
64
116
|
...rawEntry,
|
|
65
|
-
|
|
117
|
+
category: rawEntry.category === undefined
|
|
118
|
+
? undefined
|
|
119
|
+
: {
|
|
120
|
+
label: rawEntry.category.label.run(databaseAccessors),
|
|
121
|
+
value: rawEntry.category.value.run(databaseAccessors),
|
|
122
|
+
},
|
|
123
|
+
body: rawEntry.body
|
|
124
|
+
.filter(isNotNullish)
|
|
125
|
+
.map(section => mapRawSection(section, databaseAccessors)),
|
|
66
126
|
errata: rawEntry.errata?.map(({ date, description }) => ({
|
|
67
127
|
date: locale.formatDate(new Date(date)),
|
|
68
128
|
description: description.trim(),
|
|
69
129
|
})),
|
|
70
130
|
references: rawEntry.references === undefined
|
|
71
131
|
? undefined
|
|
72
|
-
: getReferencesTranslation(
|
|
132
|
+
: getReferencesTranslation(options.publications, rawEntry.references).run({
|
|
133
|
+
...databaseAccessors,
|
|
134
|
+
...locale,
|
|
135
|
+
}),
|
|
73
136
|
};
|
|
74
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Bridge between Reader and plain string instances in a definition list item.
|
|
140
|
+
*/
|
|
141
|
+
export const combatDLItem = (item, env) => item === undefined
|
|
142
|
+
? undefined
|
|
143
|
+
: {
|
|
144
|
+
label: item.label.run(env),
|
|
145
|
+
value: item.value.run(env),
|
|
146
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ActivatableIdentifier, ActivatableNameBuilderRules, AdvancedSpecialAbility, AdvantageDisadvantagePrerequisites, AdvantageDisadvantageSubtype, AdventurePointsValue, ApplicableCombatTechniques, Aspect_ID, Brew_ID, DaggerRitualCost, EnchantmentCost, Errata, GeneralPrerequisites, MagicalSignCost, Penalty, PropertyDeclaration, PublicationRefs, RatedIdentifier, SelectOptions, SpecialRule, Volume } from "@optolith/database-schema/gen";
|
|
2
2
|
import { Case } from "tsondb/schema/gen";
|
|
3
|
+
import type { StdEnv } from "../env.js";
|
|
3
4
|
import type { GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
5
|
+
import type { TranslateMap } from "../helpers/translate.js";
|
|
4
6
|
import type { GetAllResolvedNewSkillApplications, GetAllResolvedSelectOptions, GetAllResolvedSkillUses } from "../index.js";
|
|
5
7
|
import { type GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
6
8
|
type AdvancedSpecialAbilityKind = "AdvancedSkillSpecialAbility" | "AdvancedCombatSpecialAbility" | "AdvancedMagicalSpecialAbility" | "AdvancedKarmaSpecialAbility";
|
|
@@ -51,11 +53,12 @@ export type BaseActivatableTranslation = {
|
|
|
51
53
|
* Get a JSON representation of the rules text for a special ability.
|
|
52
54
|
*/
|
|
53
55
|
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" | "Hauerkettenzauber" | "InstrumentEnchantment" | "KarmaSpecialAbility" | "Keulenzauber" | "Krallenkettenzauber" | "Kristallkugelzauber" | "LiturgicalStyleSpecialAbility" | "LycantropicGift" | "MagicalSign" | "MagicalSpecialAbility" | "MagicalTradition" | "MagicStyleSpecialAbility" | "OrbEnchantment" | "PactGift" | "ProtectiveWardingCircleSpecialAbility" | "RingEnchantment" | "Schweinetrommelzauber" | "Sermon" | "SexSpecialAbility" | "SickleRitual" | "SikaryanDrainSpecialAbility" | "SkillStyleSpecialAbility" | "SpellSwordEnchantment" | "StaffEnchantment" | "ToyEnchantment" | "Trinkhornzauber" | "VampiricGift" | "Vision" | "WandEnchantment" | "WeaponEnchantment", {
|
|
54
|
-
getInstanceById: GetInstanceById<"Publication" | "Subject" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "TradeSecret" | "Aspect" | "Property" | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Weapon" | "Patron" | "PersonalityTrait" | "Brew" | "Blessing" | "Cantrip" | "FocusRule">;
|
|
56
|
+
getInstanceById: GetInstanceById<"Publication" | "Subject" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "TradeSecret" | "Aspect" | "Property" | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Weapon" | "Patron" | "PersonalityTrait" | "Brew" | "Blessing" | "Cantrip" | "FocusRule" | "CeremonialItemSpecialAbilityGroup">;
|
|
55
57
|
getAllInstances: GetAllInstances<"Script">;
|
|
56
58
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
57
59
|
getAllResolvedSelectOptions: GetAllResolvedSelectOptions;
|
|
58
60
|
getAllResolvedNewSkillApplications: GetAllResolvedNewSkillApplications;
|
|
59
61
|
getAllResolvedSkillUses: GetAllResolvedSkillUses;
|
|
60
|
-
|
|
62
|
+
translateMap: TranslateMap;
|
|
63
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
61
64
|
export {};
|
|
@@ -22,7 +22,7 @@ import { getDerivedFocusRuleBadgeFromPrerequisites, printAdvantageDisadvantagePr
|
|
|
22
22
|
import { printActivatableName, } from "./partial/prerequisites/single/activatable.js";
|
|
23
23
|
import { renderStandaloneCostMap } from "./partial/rated/activatable/cost.js";
|
|
24
24
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
25
|
-
import { attributedNameR, localeSortR, nameR, translateR } from "./partial/reader.js";
|
|
25
|
+
import { attributedNameR, customNameR, localeSortR, nameR, translateR } from "./partial/reader.js";
|
|
26
26
|
import { getResponsiveText, getResponsiveTextOptional, ResponsiveTextSize, } from "./partial/responsiveText.js";
|
|
27
27
|
import { formatTimeSpan } from "./partial/units/timeSpan.js";
|
|
28
28
|
import { MISSING_VALUE } from "./partial/unknown.js";
|
|
@@ -831,6 +831,12 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
831
831
|
}
|
|
832
832
|
: name => `${name} I–${romanize(levels)}`;
|
|
833
833
|
return {
|
|
834
|
+
category: entityName === "CeremonialItemSpecialAbility" && entry.associatedItem !== undefined
|
|
835
|
+
? {
|
|
836
|
+
label: attributedNameR("category", "CeremonialItemSpecialAbilityGroup", entry.associatedItem).map(name => name ?? MISSING_VALUE),
|
|
837
|
+
value: customNameR(t => t.nameForSorting, "CeremonialItemSpecialAbilityGroup", entry.associatedItem).map(name => name ?? MISSING_VALUE),
|
|
838
|
+
}
|
|
839
|
+
: undefined,
|
|
834
840
|
title: addLevels(makeTraditionName(translation.name_in_library ?? translation.name + parensIf(translation.additionalName))),
|
|
835
841
|
subtitle: mapNullable(baseEntry.subtype, subtype => renderAdvantageDisadvantageSubtype(subtype).run(env)) ??
|
|
836
842
|
mapNullable(baseEntry.usage_type, usageType => renderCombatSpecialAbilityType(usageType).run(env)),
|
|
@@ -4,4 +4,4 @@ import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const getAlternativeRuleEntityDescription: import("../creator.js").EntityDescriptionCreator<"AlternativeRule", {
|
|
6
6
|
getInstanceById: GetInstanceById<"Publication" | "PlayerType">;
|
|
7
|
-
}, import("../
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for an attribute.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getAttributeEntityDescription: import("../creator.js").EntityDescriptionCreator<"Attribute",
|
|
5
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
-
}, import("../index.js").EntityDescription>;
|
|
4
|
+
export declare const getAttributeEntityDescription: import("../creator.js").EntityDescriptionCreator<"Attribute", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -4,10 +4,10 @@ import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const getCloseCombatTechniqueEntityDescription: import("../creator.js").EntityDescriptionCreator<"CloseCombatTechnique", {
|
|
6
6
|
getInstanceById: GetInstanceById<"Publication" | "Attribute">;
|
|
7
|
-
}, import("../
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
8
8
|
/**
|
|
9
9
|
* Get a JSON representation of the rules text for a ranged combat technique.
|
|
10
10
|
*/
|
|
11
11
|
export declare const getRangedCombatTechniqueEntityDescription: import("../creator.js").EntityDescriptionCreator<"RangedCombatTechnique", {
|
|
12
12
|
getInstanceById: GetInstanceById<"Publication" | "Attribute">;
|
|
13
|
-
}, import("../
|
|
13
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for a condition.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getConditionEntityDescription: import("../creator.js").EntityDescriptionCreator<"Condition",
|
|
5
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
-
}, import("../index.js").EntityDescription>;
|
|
4
|
+
export declare const getConditionEntityDescription: import("../creator.js").EntityDescriptionCreator<"Condition", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
7
5
|
/**
|
|
8
6
|
* Get a JSON representation of the rules text for a meta condition.
|
|
9
7
|
*/
|
|
10
|
-
export declare const getMetaConditionEntityDescription: import("../creator.js").EntityDescriptionCreator<"MetaCondition",
|
|
11
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
12
|
-
}, import("../index.js").EntityDescription>;
|
|
8
|
+
export declare const getMetaConditionEntityDescription: import("../creator.js").EntityDescriptionCreator<"MetaCondition", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StdEnv } from "../env.js";
|
|
1
2
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
2
3
|
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
3
4
|
/**
|
|
@@ -7,4 +8,4 @@ export declare const getCultureEntityDescription: import("../creator.js").Entity
|
|
|
7
8
|
getInstanceById: GetInstanceById<"Publication" | "Advantage" | "Disadvantage" | "Skill" | "Language" | "LanguageSpecialization" | "Script" | "SocialStatus" | "ProfessionVariant" | "MagicalTradition" | "BlessedTradition">;
|
|
8
9
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionVersion">;
|
|
9
10
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
10
|
-
}, import("../
|
|
11
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -8,4 +8,4 @@ export declare const getCurriculumEntityDescription: import("../creator.js").Ent
|
|
|
8
8
|
getAllInstances: GetAllInstances<"Profession">;
|
|
9
9
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"LessonPackage" | "ProfessionVersion" | "ProfessionPackage">;
|
|
10
10
|
idMap: IdMap;
|
|
11
|
-
}, import("../
|
|
11
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -4,4 +4,4 @@ import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const getDerivedCharacteristicEntityDescription: import("../creator.js").EntityDescriptionCreator<"DerivedCharacteristic", {
|
|
6
6
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "DerivedCharacteristic">;
|
|
7
|
-
}, import("../
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -6,4 +6,4 @@ import type { IdMap } from "../index.js";
|
|
|
6
6
|
export declare const getDiseaseEntityDescription: import("../creator.js").EntityDescriptionCreator<"Disease" | "AnimalDisease", {
|
|
7
7
|
getInstanceById: GetInstanceById<"Publication" | "AnimalType" | "DerivedCharacteristic">;
|
|
8
8
|
idMap: IdMap;
|
|
9
|
-
}, import("../
|
|
9
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/disease.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ensureNonEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
2
2
|
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
3
|
-
import { createEntityDescriptionCreator } from "../creator.js";
|
|
3
|
+
import { combatDLItem, createEntityDescriptionCreator } from "../creator.js";
|
|
4
4
|
import { renderAnimalTypesSection } from "./partial/animalTypes.js";
|
|
5
5
|
import { renderAlternativeNames, renderChance, renderResistance } from "./partial/herbary.js";
|
|
6
6
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
@@ -18,7 +18,8 @@ const renderCauses = (translate, translateMap, causes) => causes
|
|
|
18
18
|
/**
|
|
19
19
|
* Get a JSON representation of the rules text for an optional rule.
|
|
20
20
|
*/
|
|
21
|
-
export const getDiseaseEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap },
|
|
21
|
+
export const getDiseaseEntityDescription = createEntityDescriptionCreator(({ getInstanceById, idMap }, locale, { entity, content: entry }) => {
|
|
22
|
+
const { translate, translateMap, compare: localeCompare } = locale;
|
|
22
23
|
const baseEntry = entry;
|
|
23
24
|
const translation = translateMap(baseEntry.translations);
|
|
24
25
|
if (translation === undefined) {
|
|
@@ -38,7 +39,7 @@ export const getDiseaseEntityDescription = createEntityDescriptionCreator(({ get
|
|
|
38
39
|
{
|
|
39
40
|
type: "definitionList",
|
|
40
41
|
items: [
|
|
41
|
-
renderAlternativeNames(
|
|
42
|
+
combatDLItem(renderAlternativeNames(translation.alternative_names), locale),
|
|
42
43
|
{ label: translate("Level"), value: baseEntry.level.toFixed() },
|
|
43
44
|
{ label: translate("Progress"), value: translation.progress },
|
|
44
45
|
{
|
|
@@ -52,9 +53,7 @@ export const getDiseaseEntityDescription = createEntityDescriptionCreator(({ get
|
|
|
52
53
|
{
|
|
53
54
|
label: translate("Damage"),
|
|
54
55
|
value: translation.damage.default +
|
|
55
|
-
(translation.damage.reduced === undefined
|
|
56
|
-
? ""
|
|
57
|
-
: ` / ${translation.damage.reduced}`),
|
|
56
|
+
(translation.damage.reduced === undefined ? "" : ` / ${translation.damage.reduced}`),
|
|
58
57
|
},
|
|
59
58
|
{
|
|
60
59
|
label: translate("Duration"),
|
package/lib/entities/elixir.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single
|
|
|
7
7
|
export declare const getElixirEntityDescription: import("../creator.js").EntityDescriptionCreator<"Elixir", {
|
|
8
8
|
getInstanceById: GetInstanceById<"Publication" | "DerivedCharacteristic" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Aspect" | "Property" | "PersonalityTrait" | "Blessing" | "Cantrip">;
|
|
9
9
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
10
|
-
}, import("../
|
|
10
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/elixir.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mapNullable } from "@elyukai/utils/nullable";
|
|
2
2
|
import { sign } from "@elyukai/utils/string/number";
|
|
3
|
-
import { createEntityDescriptionCreator } from "../creator.js";
|
|
3
|
+
import { combatDLItem, createEntityDescriptionCreator } from "../creator.js";
|
|
4
4
|
import { renderAlternativeNames, renderLaboratoryLevel } from "./partial/herbary.js";
|
|
5
5
|
import { printPlainGeneralPrerequisites } from "./partial/prerequisites/index.js";
|
|
6
6
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
@@ -28,7 +28,7 @@ export const getElixirEntityDescription = createEntityDescriptionCreator(({ getI
|
|
|
28
28
|
{
|
|
29
29
|
type: "definitionList",
|
|
30
30
|
items: [
|
|
31
|
-
renderAlternativeNames(
|
|
31
|
+
combatDLItem(renderAlternativeNames(translation.alternative_names), locale),
|
|
32
32
|
{
|
|
33
33
|
label: translate("Typical Ingredients"),
|
|
34
34
|
value: translation.typical_ingredients.join(", "),
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AmmunitionishIdentifier, EquipmentIdentifier, GenMeleeWeapon, GenRangedWeapon, LocaleMeasurementAdjustments } from "@optolith/database-schema/gen";
|
|
2
2
|
import { type TaggedEntity } from "../creator.js";
|
|
3
|
+
import type { StdEnv } from "../env.js";
|
|
3
4
|
import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
4
5
|
import type { LocaleJoin } from "../helpers/locale.js";
|
|
5
|
-
import type
|
|
6
|
-
import
|
|
6
|
+
import { type Format, type Translate, type TranslateMap } from "../helpers/translate.js";
|
|
7
|
+
import { type RawLabeledEntityDescriptionSection } from "../rawEntityDescription.js";
|
|
7
8
|
/**
|
|
8
9
|
* Get the name of an equipment item.
|
|
9
10
|
*/
|
|
@@ -11,15 +12,12 @@ export declare const getEquipmentName: (translate: Translate, translateMap: Tran
|
|
|
11
12
|
/**
|
|
12
13
|
* Render combat values of a melee weapon.
|
|
13
14
|
*/
|
|
14
|
-
export declare const renderMeleeWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, localeJoin: LocaleJoin, getInstanceById: GetInstanceById<"Attribute" | "CloseCombatTechnique" | "Reach">, measurements: Required<LocaleMeasurementAdjustments>, renderDamage: (damage: Damage) => string, closeCombatTechniqueId: string, use: GenMeleeWeapon<Damage>) =>
|
|
15
|
+
export declare const renderMeleeWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, localeJoin: LocaleJoin, getInstanceById: GetInstanceById<"Attribute" | "CloseCombatTechnique" | "Reach">, measurements: Required<LocaleMeasurementAdjustments>, renderDamage: (damage: Damage) => string, closeCombatTechniqueId: string, use: GenMeleeWeapon<Damage>) => RawLabeledEntityDescriptionSection;
|
|
15
16
|
/**
|
|
16
17
|
* Render combat values of a ranged weapon.
|
|
17
18
|
*/
|
|
18
|
-
export declare const renderRangedWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, format: Format, getInstanceById: GetInstanceById<"RangedCombatTechnique" | AmmunitionishIdentifier["kind"]>, measurements: Required<LocaleMeasurementAdjustments>, renderDamage: (damage: Damage) => string, rangedCombatTechniqueId: string, use: GenRangedWeapon<Damage>) =>
|
|
19
|
+
export declare const renderRangedWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, format: Format, getInstanceById: GetInstanceById<"RangedCombatTechnique" | AmmunitionishIdentifier["kind"]>, measurements: Required<LocaleMeasurementAdjustments>, renderDamage: (damage: Damage) => string, rangedCombatTechniqueId: string, use: GenRangedWeapon<Damage>) => RawLabeledEntityDescriptionSection;
|
|
19
20
|
/**
|
|
20
21
|
* Get a JSON representation of the rules text for equipment.
|
|
21
22
|
*/
|
|
22
|
-
export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"Weapon" | "Ammunition" | "Armor" | "Animal" | "AnimalCare" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "WeaponAccessory" | "WorkingSupernaturalCreature",
|
|
23
|
-
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Reach" | "SocialStatus" | "CloseCombatTechnique" | "RangedCombatTechnique" | "MagicalTradition" | "BlessedTradition" | "DerivedCharacteristic" | AmmunitionishIdentifier["kind"] | "Race" | "Culture" | "Profession" | "Skill">;
|
|
24
|
-
idMap: IdMap;
|
|
25
|
-
}, import("../index.js").EntityDescription>;
|
|
23
|
+
export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"Weapon" | "Ammunition" | "Armor" | "Animal" | "AnimalCare" | "BandageOrRemedy" | "Book" | "CeremonialItem" | "Clothes" | "ClothingPackage" | "Container" | "EquipmentOfBlessedOnes" | "GemOrPreciousStone" | "IlluminationLightSource" | "IlluminationRefillOrSupply" | "Jewelry" | "Laboratory" | "Liebesspielzeug" | "LuxuryGood" | "MagicalArtifact" | "MusicalInstrument" | "Newspaper" | "OrienteeringAid" | "RopeOrChain" | "Stationery" | "ThievesTool" | "ToolOfTheTrade" | "TravelGearOrTool" | "Vehicle" | "WeaponAccessory" | "WorkingSupernaturalCreature", StdEnv<"f" | "fn" | "t" | "tm" | "lj" | "lc" | "rts" | "ibi" | "ma" | "idm", "BlessedTradition" | "MagicalTradition" | "Publication" | "Race" | "Culture" | "SocialStatus" | "Attribute" | "Skill" | "CloseCombatTechnique" | "RangedCombatTechnique" | "Weapon" | "Profession" | "Ammunition" | "DerivedCharacteristic" | "Reach"> & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|