@optolith/entity-descriptions 0.4.10 → 0.4.12
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 +28 -0
- package/lib/creator.d.ts +1 -1
- package/lib/entities/activatable.d.ts +1 -1
- package/lib/entities/activatable.js +69 -1
- package/lib/entities/culture.d.ts +2 -0
- package/lib/entities/culture.js +20 -14
- package/lib/entities/curriculum.js +103 -19
- package/lib/entities/derivedCharacteristic.d.ts +0 -2
- package/lib/entities/derivedCharacteristic.js +5 -10
- package/lib/entities/disease.d.ts +1 -1
- package/lib/entities/disease.js +5 -1
- package/lib/entities/elixir.d.ts +1 -1
- package/lib/entities/elixir.js +12 -10
- package/lib/entities/equipment.d.ts +6 -5
- package/lib/entities/equipment.js +19 -6
- package/lib/entities/equipmentPackage.d.ts +1 -1
- package/lib/entities/influence.d.ts +1 -1
- package/lib/entities/liturgicalChant.d.ts +1 -1
- package/lib/entities/partial/activatableNameChunks.d.ts +11 -3
- package/lib/entities/partial/activatableNameChunks.js +27 -12
- package/lib/entities/partial/adventurePointsValue.d.ts +2 -2
- package/lib/entities/partial/animalTypes.d.ts +1 -1
- package/lib/entities/partial/animalTypes.js +2 -1
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +4 -4
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +56 -13
- package/lib/entities/partial/dice.d.ts +1 -1
- package/lib/entities/partial/enhancements.d.ts +1 -1
- package/lib/entities/partial/herbary.d.ts +1 -1
- package/lib/entities/partial/map.d.ts +1 -1
- package/lib/entities/partial/map.js +1 -1
- package/lib/entities/partial/markdown.d.ts +2 -2
- package/lib/entities/partial/markdown.js +4 -1
- package/lib/entities/partial/mathOperation.d.ts +1 -1
- package/lib/entities/partial/prerequisites/displayOption.d.ts +1 -1
- package/lib/entities/partial/prerequisites/index.d.ts +3 -3
- package/lib/entities/partial/prerequisites/index.js +1 -1
- package/lib/entities/partial/prerequisites/part.d.ts +1 -1
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +2 -2
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +10 -7
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +2 -2
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/culture.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/influence.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/pact.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/profession.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/publication.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/race.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/rated.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/rated.js +2 -2
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/rule.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/sex.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/state.d.ts +1 -1
- package/lib/entities/partial/prerequisites/single/text.d.ts +1 -1
- package/lib/entities/partial/professions.d.ts +1 -1
- package/lib/entities/partial/professions.js +2 -4
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/checkResultBased.js +3 -1
- package/lib/entities/partial/rated/activatable/cost.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/duration.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/range.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/speed.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/rated/skillCheck.d.ts +1 -1
- package/lib/entities/partial/rated/skillCheck.js +5 -3
- package/lib/entities/partial/reader.d.ts +1 -1
- package/lib/entities/partial/responsiveText.d.ts +1 -1
- package/lib/entities/poison.d.ts +1 -1
- package/lib/entities/poison.js +20 -9
- package/lib/entities/profession.d.ts +2 -2
- package/lib/entities/profession.js +116 -21
- package/lib/entities/race.d.ts +3 -1
- package/lib/entities/race.js +89 -68
- package/lib/entities/skill.d.ts +1 -1
- package/lib/entities/spell.d.ts +4 -2
- package/lib/entities/spell.js +4 -4
- package/lib/helpers/getTypes.d.ts +1 -1
- package/lib/helpers/locale.d.ts +1 -1
- package/lib/helpers/translate.d.ts +1 -1
- package/lib/index.d.ts +131 -129
- package/lib/references/index.d.ts +1 -1
- package/lib/references/page.d.ts +1 -1
- package/lib/references/pageRange.d.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { EquipmentIdentifier, GenMeleeWeapon, GenRangedWeapon, LocaleMeasurementAdjustments } from "optolith
|
|
1
|
+
import type { AmmunitionishIdentifier, EquipmentIdentifier, GenMeleeWeapon, GenRangedWeapon, LocaleMeasurementAdjustments } from "@optolith/database-schema/gen";
|
|
2
2
|
import { type TaggedEntity } from "../creator.js";
|
|
3
3
|
import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
4
|
+
import type { LocaleJoin } from "../helpers/locale.js";
|
|
4
5
|
import type { Translate, TranslateMap } from "../helpers/translate.js";
|
|
5
6
|
import type { IdMap, LabeledEntityDescriptionSection, RawEntityDescriptionSectionContent } from "../index.js";
|
|
6
7
|
/**
|
|
@@ -10,15 +11,15 @@ export declare const getEquipmentName: (translate: Translate, translateMap: Tran
|
|
|
10
11
|
/**
|
|
11
12
|
* Render combat values of a melee weapon.
|
|
12
13
|
*/
|
|
13
|
-
export declare const renderMeleeWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, getInstanceById: GetInstanceById<"Attribute" | "CloseCombatTechnique" | "Reach">, measurements: Required<LocaleMeasurementAdjustments>, renderDamage: (damage: Damage) => string, closeCombatTechniqueId: string, use: GenMeleeWeapon<Damage>) => LabeledEntityDescriptionSection<RawEntityDescriptionSectionContent>;
|
|
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>) => LabeledEntityDescriptionSection<RawEntityDescriptionSectionContent>;
|
|
14
15
|
/**
|
|
15
16
|
* Render combat values of a ranged weapon.
|
|
16
17
|
*/
|
|
17
|
-
export declare const renderRangedWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, getInstanceById: GetInstanceById<"RangedCombatTechnique" | "
|
|
18
|
+
export declare const renderRangedWeapon: <Damage>(translate: Translate, translateMap: TranslateMap, getInstanceById: GetInstanceById<"RangedCombatTechnique" | AmmunitionishIdentifier["kind"]>, measurements: Required<LocaleMeasurementAdjustments>, renderDamage: (damage: Damage) => string, rangedCombatTechniqueId: string, use: GenRangedWeapon<Damage>) => LabeledEntityDescriptionSection<RawEntityDescriptionSectionContent>;
|
|
18
19
|
/**
|
|
19
20
|
* Get a JSON representation of the rules text for equipment.
|
|
20
21
|
*/
|
|
21
|
-
export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"Weapon" | "
|
|
22
|
-
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Reach" | "SocialStatus" | "CloseCombatTechnique" | "RangedCombatTechnique" | "MagicalTradition" | "BlessedTradition" | "DerivedCharacteristic" | "
|
|
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">;
|
|
23
24
|
idMap: IdMap;
|
|
24
25
|
}, import("../index.js").EntityDescription>;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { ensureNonEmpty, isNotEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
2
|
+
import { on } from "@elyukai/utils/function";
|
|
2
3
|
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
4
|
+
import { compareNumber } from "@elyukai/utils/ordering";
|
|
3
5
|
import { romanize } from "@elyukai/utils/roman";
|
|
4
6
|
import { sign } from "@elyukai/utils/string/number";
|
|
5
7
|
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
6
8
|
import { mapNullable } from "@optolith/helpers/nullable";
|
|
7
9
|
import { createEntityDescriptionCreator } from "../creator.js";
|
|
8
10
|
import { renderDice, renderDiceAndFlat } from "./partial/dice.js";
|
|
11
|
+
import { attributedName, attributedNameFromInstance } from "./partial/markdown.js";
|
|
9
12
|
import { additionFormatter, subtractionFormatter } from "./partial/mathOperation.js";
|
|
10
13
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
11
14
|
import { ResponsiveTextSize } from "./partial/responsiveText.js";
|
|
@@ -91,9 +94,19 @@ const renderPrimaryAttributeAndDamageThreshold = (translateMap, getInstanceById,
|
|
|
91
94
|
const renderAttackParryModifier = (attackModifier, parryModifier) => attackModifier === undefined && parryModifier === undefined
|
|
92
95
|
? "—"
|
|
93
96
|
: `${attackModifier === undefined ? "—" : sign(attackModifier)}/${parryModifier === undefined ? "—" : sign(parryModifier)}`;
|
|
94
|
-
const renderReach = (translateMap, getInstanceById,
|
|
97
|
+
const renderReach = (translateMap, localeJoin, getInstanceById, reaches) => reaches === undefined
|
|
95
98
|
? "—"
|
|
96
|
-
: (
|
|
99
|
+
: localeJoin(reaches
|
|
100
|
+
.map((reach) => {
|
|
101
|
+
const instance = getInstanceById("Reach", reach);
|
|
102
|
+
return [
|
|
103
|
+
instance?.position ?? 0,
|
|
104
|
+
attributedNameFromInstance(translateMap, instance, "equipment", "Reach", reach) ??
|
|
105
|
+
MISSING_VALUE,
|
|
106
|
+
];
|
|
107
|
+
})
|
|
108
|
+
.toSorted(on(e => e[0], compareNumber))
|
|
109
|
+
.map(e => e[1]), "conjunction");
|
|
97
110
|
const renderLength = (translate, measurements, length) => length === undefined
|
|
98
111
|
? "—"
|
|
99
112
|
: translate(".input {$value :number} {{{$value} inches}}", {
|
|
@@ -102,7 +115,7 @@ const renderLength = (translate, measurements, length) => length === undefined
|
|
|
102
115
|
/**
|
|
103
116
|
* Render combat values of a melee weapon.
|
|
104
117
|
*/
|
|
105
|
-
export const renderMeleeWeapon = (translate, translateMap, getInstanceById, measurements, renderDamage, closeCombatTechniqueId, use) => {
|
|
118
|
+
export const renderMeleeWeapon = (translate, translateMap, localeJoin, getInstanceById, measurements, renderDamage, closeCombatTechniqueId, use) => {
|
|
106
119
|
const combatTechnique = getInstanceById("CloseCombatTechnique", closeCombatTechniqueId);
|
|
107
120
|
const fields = combatTechnique?.special ?? {
|
|
108
121
|
can_parry: { kind: "Prohibited" },
|
|
@@ -137,7 +150,7 @@ export const renderMeleeWeapon = (translate, translateMap, getInstanceById, meas
|
|
|
137
150
|
? undefined
|
|
138
151
|
: {
|
|
139
152
|
label: translate("Reach"),
|
|
140
|
-
value: renderReach(translateMap, getInstanceById, use.reach),
|
|
153
|
+
value: renderReach(translateMap, localeJoin, getInstanceById, use.reach),
|
|
141
154
|
},
|
|
142
155
|
fields.has_length.kind === "Prohibited"
|
|
143
156
|
? undefined
|
|
@@ -159,7 +172,7 @@ const renderReloadTime = (translate, reloadTime) => isNotEmpty(reloadTime)
|
|
|
159
172
|
const renderRangeBrackets = (rangeBrackets) => `${rangeBrackets.close.toFixed()}/${rangeBrackets.medium.toFixed()}/${rangeBrackets.far.toFixed()}`;
|
|
160
173
|
const renderAmmunition = (translateMap, getInstanceById, ammunition) => ammunition === undefined
|
|
161
174
|
? "—"
|
|
162
|
-
: (translateMap
|
|
175
|
+
: (attributedName(translateMap, getInstanceById, "equipment", ammunition) ?? MISSING_VALUE);
|
|
163
176
|
const renderMeleeDamage = (translate) => (damage) => renderDiceAndFlat(translate, damage.dice, damage.flat);
|
|
164
177
|
/**
|
|
165
178
|
* Render combat values of a ranged weapon.
|
|
@@ -713,7 +726,7 @@ export const getEquipmentEntityDescription = createEntityDescriptionCreator(({ g
|
|
|
713
726
|
className: "equipment",
|
|
714
727
|
body: [
|
|
715
728
|
...(combatValues?.type === "Weapon"
|
|
716
|
-
? Object.entries(combatValues.values.melee_uses ?? {}).map(([combatTechniqueId, use]) => renderMeleeWeapon(translate, translateMap, getInstanceById, locale.measurementAdjustments, renderMeleeDamage(translate), combatTechniqueId, use))
|
|
729
|
+
? Object.entries(combatValues.values.melee_uses ?? {}).map(([combatTechniqueId, use]) => renderMeleeWeapon(translate, translateMap, locale.join, getInstanceById, locale.measurementAdjustments, renderMeleeDamage(translate), combatTechniqueId, use))
|
|
717
730
|
: []),
|
|
718
731
|
...(combatValues?.type === "Weapon"
|
|
719
732
|
? Object.entries(combatValues.values.ranged_uses ?? {}).map(([combatTechniqueId, use]) => renderRangedWeapon(translate, translateMap, getInstanceById, locale.measurementAdjustments, renderRangedDamage(translate), combatTechniqueId, use))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EquipmentIdentifier } from "optolith
|
|
1
|
+
import type { EquipmentIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
3
3
|
/**
|
|
4
4
|
* Get a JSON representation of the rules text for an equipment package.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier } from "optolith
|
|
1
|
+
import type { ActivatableIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
3
|
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RatedIdentifier } from "optolith
|
|
1
|
+
import { type RatedIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
3
|
import type { IdMap } from "../index.js";
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier, ActivatableNameBuilderRules, RequirableSelectOptionIdentifier } from "optolith
|
|
1
|
+
import type { ActivatableIdentifier, ActivatableNameBuilderRules, RequirableSelectOptionIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { LocaleMap, Translate, TranslateMap } from "../../helpers/translate.js";
|
|
3
3
|
import type { GetResolvedSelectOptionById } from "./prerequisites/single/activatable.js";
|
|
4
4
|
/**
|
|
@@ -8,7 +8,7 @@ export type ActivatableNameComponents = {
|
|
|
8
8
|
id: ActivatableIdentifier;
|
|
9
9
|
base: ActivatableNameChunk;
|
|
10
10
|
options: ActivatableNameChunk | [ActivatableNameChunk, ActivatableNameChunk] | undefined;
|
|
11
|
-
level: number | undefined;
|
|
11
|
+
level: number | [start: number, end: number] | undefined;
|
|
12
12
|
nameBuilderRules: Required<ActivatableNameBuilderRules>;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
@@ -18,7 +18,7 @@ export type CombinedActivatableNameComponents = {
|
|
|
18
18
|
id: ActivatableIdentifier;
|
|
19
19
|
base: ActivatableNameChunk;
|
|
20
20
|
options: (ActivatableNameChunk | [ActivatableNameChunk, ActivatableNameChunk])[];
|
|
21
|
-
level: number | undefined;
|
|
21
|
+
level: number | [start: number, end: number] | undefined;
|
|
22
22
|
nameBuilderRules: Required<ActivatableNameBuilderRules>;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -52,6 +52,14 @@ export declare const renderMultipleStandaloneActivatableNameComponents: (transla
|
|
|
52
52
|
* Renders the name components of multiple activatable entries, combining parts if possible.
|
|
53
53
|
*/
|
|
54
54
|
export declare const renderActivatableNameComponentsCombinedIfPossible: (translateMap: TranslateMap, components: ActivatableNameComponents[], formatAsPrerequisite: boolean, join?: (list: string[]) => string) => string;
|
|
55
|
+
/**
|
|
56
|
+
* Renders the options of an activatable entry, combining them if necessary.
|
|
57
|
+
*/
|
|
58
|
+
export declare const renderNameComponentsOptions: (displayedInProfession: boolean, getResolvedSelectOptionById: GetResolvedSelectOptionById, id: ActivatableIdentifier, options: RequirableSelectOptionIdentifier[] | undefined) => ActivatableNameChunk | [ActivatableNameChunk, ActivatableNameChunk] | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Provides default values for name builder rules and ensures that all properties are present.
|
|
61
|
+
*/
|
|
62
|
+
export declare const makeNameBuilderRulesWithDefaults: (input: ActivatableNameBuilderRules | undefined) => Required<ActivatableNameBuilderRules>;
|
|
55
63
|
/**
|
|
56
64
|
* Gets the name components for an activatable entry.
|
|
57
65
|
*/
|
|
@@ -60,9 +60,11 @@ const zipChunks = (chunks) => chunks
|
|
|
60
60
|
.reduce((acc, chunk) => (acc === "" ? chunk : combineChunks(acc, chunk, (a, b) => `${a}, ${b}`)), "");
|
|
61
61
|
const renderLevel = (formatAsPrerequisite, id, level) => level === undefined
|
|
62
62
|
? undefined
|
|
63
|
-
:
|
|
64
|
-
? romanize(level)
|
|
65
|
-
:
|
|
63
|
+
: Array.isArray(level)
|
|
64
|
+
? `${romanize(level[0])}–${romanize(level[1])}`
|
|
65
|
+
: formatAsPrerequisite || id.kind === "Advantage" || id.kind === "Disadvantage" || level === 1
|
|
66
|
+
? romanize(level)
|
|
67
|
+
: `I–${romanize(level)}`;
|
|
66
68
|
/**
|
|
67
69
|
* Converts a name chunk to a displayable string.
|
|
68
70
|
*/
|
|
@@ -83,7 +85,9 @@ const renderActivatableNameChunk = (translateMap, chunk) => {
|
|
|
83
85
|
*/
|
|
84
86
|
export const renderActivatableNameComponentsWithoutLevel = (translateMap, components) => {
|
|
85
87
|
const { levelPlacement, useParenthesis } = components.nameBuilderRules;
|
|
86
|
-
const wrapParens = useParenthesis
|
|
88
|
+
const wrapParens = useParenthesis
|
|
89
|
+
? str => (str.length > 0 ? `(${str})` : undefined)
|
|
90
|
+
: identity;
|
|
87
91
|
const base = renderActivatableNameChunk(translateMap, components.base);
|
|
88
92
|
const options = components.options === undefined
|
|
89
93
|
? undefined
|
|
@@ -125,6 +129,10 @@ export const combineNameComponents = (elements) => {
|
|
|
125
129
|
*/
|
|
126
130
|
export const renderCombinedActivatableNameComponents = (translateMap, components, formatAsPrerequisite, join = list => list.join(", ")) => renderActivatableNameComponents(translateMap, {
|
|
127
131
|
...components,
|
|
132
|
+
nameBuilderRules: {
|
|
133
|
+
...components.nameBuilderRules,
|
|
134
|
+
useParenthesis: true,
|
|
135
|
+
},
|
|
128
136
|
options: join(components.options.map(chunk => renderActivatableNameChunk(translateMap, normalizeChunks(chunk)))),
|
|
129
137
|
}, formatAsPrerequisite);
|
|
130
138
|
/**
|
|
@@ -306,7 +314,10 @@ export const renderActivatableNameComponentsCombinedIfPossible = (translateMap,
|
|
|
306
314
|
// ),
|
|
307
315
|
// )(staticData)
|
|
308
316
|
// }
|
|
309
|
-
|
|
317
|
+
/**
|
|
318
|
+
* Renders the options of an activatable entry, combining them if necessary.
|
|
319
|
+
*/
|
|
320
|
+
export const renderNameComponentsOptions = (displayedInProfession, getResolvedSelectOptionById, id, options) => {
|
|
310
321
|
const arr = options?.map(optionId => {
|
|
311
322
|
const optTranslations = getResolvedSelectOptionById(id, optionId)?.content.translations;
|
|
312
323
|
return optTranslations === undefined
|
|
@@ -319,18 +330,22 @@ const renderOptions = (displayedInProfession, getResolvedSelectOptionById, id, o
|
|
|
319
330
|
}
|
|
320
331
|
return arr[0];
|
|
321
332
|
};
|
|
333
|
+
/**
|
|
334
|
+
* Provides default values for name builder rules and ensures that all properties are present.
|
|
335
|
+
*/
|
|
336
|
+
export const makeNameBuilderRulesWithDefaults = (input) => ({
|
|
337
|
+
levelPlacement: input?.levelPlacement ?? {
|
|
338
|
+
kind: "AfterOptions",
|
|
339
|
+
},
|
|
340
|
+
useParenthesis: input?.useParenthesis ?? true,
|
|
341
|
+
});
|
|
322
342
|
/**
|
|
323
343
|
* Gets the name components for an activatable entry.
|
|
324
344
|
*/
|
|
325
345
|
export const getNameComponents = (translate, id, options, level, nameBuilderRules, translations, getBaseName, getResolvedSelectOptionById, displayedInProfession) => {
|
|
326
|
-
const nameBuilderRulesWithDefaults =
|
|
327
|
-
levelPlacement: nameBuilderRules?.levelPlacement ?? {
|
|
328
|
-
kind: "AfterOptions",
|
|
329
|
-
},
|
|
330
|
-
useParenthesis: nameBuilderRules?.useParenthesis ?? true,
|
|
331
|
-
};
|
|
346
|
+
const nameBuilderRulesWithDefaults = makeNameBuilderRulesWithDefaults(nameBuilderRules);
|
|
332
347
|
const renderedBase = mapObject(translations, getBaseName);
|
|
333
|
-
const renderedOptions =
|
|
348
|
+
const renderedOptions = renderNameComponentsOptions(displayedInProfession, getResolvedSelectOptionById, id, options);
|
|
334
349
|
const isTradition = id.kind === "MagicalTradition" || id.kind === "BlessedTradition";
|
|
335
350
|
const actualBase = isTradition ? translate("Tradition") : renderedBase;
|
|
336
351
|
const actualOptions = isTradition
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ResolvedSelectOption, ResolvedSelectOptionIdentifier } from "optolith
|
|
2
|
-
import type { ActivatableIdentifier, AdventurePointsValue } from "optolith
|
|
1
|
+
import type { ResolvedSelectOption, ResolvedSelectOptionIdentifier } from "@optolith/database-schema/cache";
|
|
2
|
+
import type { ActivatableIdentifier, AdventurePointsValue } from "@optolith/database-schema/gen";
|
|
3
3
|
import type { GetAllInstances } from "../../helpers/getTypes.js";
|
|
4
4
|
import type { LocaleEnvironment } from "../../helpers/locale.js";
|
|
5
5
|
import type { BaseActivatable, BaseActivatableTranslation } from "../activatable.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnimalType_ID } from "optolith
|
|
1
|
+
import type { AnimalType_ID } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetInstanceById } from "../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleCompare } from "../../helpers/locale.js";
|
|
4
4
|
import type { Translate, TranslateMap } from "../../helpers/translate.js";
|
|
@@ -7,7 +7,8 @@ export const renderAnimalTypesSection = (translate, translateMap, localeCompare,
|
|
|
7
7
|
value: animalTypes.length === 0
|
|
8
8
|
? translate("All")
|
|
9
9
|
: animalTypes
|
|
10
|
-
.map(animalTypeId => translateMap(getInstanceById("AnimalType", animalTypeId)?.translations)?.name ??
|
|
10
|
+
.map(animalTypeId => translateMap(getInstanceById("AnimalType", animalTypeId)?.translations)?.name ??
|
|
11
|
+
MISSING_VALUE)
|
|
11
12
|
.toSorted(localeCompare)
|
|
12
13
|
.join(", "),
|
|
13
14
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { CommonnessRatedAdvantageDisadvantage } from "optolith
|
|
1
|
+
import type { CommonnessRatedAdvantageDisadvantage } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { TranslationKeysWithoutParams } from "../../helpers/translate.js";
|
|
3
3
|
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../index.js";
|
|
4
4
|
import type { StdReader } from "./reader.js";
|
|
5
5
|
/**
|
|
6
6
|
* Render the names of either commonness-rated advantages or commonness-rated disadvantages.
|
|
7
7
|
*/
|
|
8
|
-
export declare const renderCommonnessRatedAdvantagesOrDisadvantages: <E extends "Advantage" | "Disadvantage">(entity: E, items: CommonnessRatedAdvantageDisadvantage<string>[] | undefined) => StdReader<string, "
|
|
8
|
+
export declare const renderCommonnessRatedAdvantagesOrDisadvantages: <E extends "Advantage" | "Disadvantage", T extends string | undefined>(entity: E, items: CommonnessRatedAdvantageDisadvantage<string>[] | undefined, emptyString: T) => StdReader<string | T, "tm" | "lc" | "ibi" | "rso", E>;
|
|
9
9
|
/**
|
|
10
10
|
* Render the names of commonness-rated advantages and disadvantages together.
|
|
11
11
|
*/
|
|
12
|
-
export declare const renderCommonnessRatedAdvantagesAndDisadvantages: (advantages: CommonnessRatedAdvantageDisadvantage<string>[] | undefined, disadvantages: CommonnessRatedAdvantageDisadvantage<string>[] | undefined) => StdReader<string, "
|
|
12
|
+
export declare const renderCommonnessRatedAdvantagesAndDisadvantages: <T extends string | undefined>(advantages: CommonnessRatedAdvantageDisadvantage<string>[] | undefined, disadvantages: CommonnessRatedAdvantageDisadvantage<string>[] | undefined, emptyString: T) => StdReader<string | T, "tm" | "lc" | "ibi" | "rso", "Advantage" | "Disadvantage">;
|
|
13
13
|
/**
|
|
14
14
|
* Render a value with a possible translation, falling back to explicity rendering the value if no translation is available.
|
|
15
15
|
*/
|
|
16
|
-
export declare const renderValueWithPossibleTranslation: <T>(label: TranslationKeysWithoutParams, value: T, renderValue: (value: T) => string,
|
|
16
|
+
export declare const renderValueWithPossibleTranslation: <T>(label: TranslationKeysWithoutParams, value: T, renderValue: (value: T) => string, _valueTranslation: string | undefined) => StdReader<RawDefinitionListEntityDescriptionSectionItem, "t">;
|
|
@@ -1,36 +1,79 @@
|
|
|
1
1
|
import { isNotEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
2
2
|
import { mapNullable } from "@elyukai/utils/nullable";
|
|
3
3
|
import { Reader } from "@elyukai/utils/reader";
|
|
4
|
+
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
4
5
|
import { ensureNonEmpty } from "@optolith/helpers/array";
|
|
6
|
+
import { Case } from "tsondb/schema/gen";
|
|
7
|
+
import { makeNameBuilderRulesWithDefaults, renderCombinedActivatableNameComponents, renderNameComponentsOptions, } from "./activatableNameChunks.js";
|
|
5
8
|
import { attributedCustomName } from "./markdown.js";
|
|
6
|
-
import { parensIf } from "./rated/activatable/parensIf.js";
|
|
7
9
|
import { MISSING_VALUE } from "./unknown.js";
|
|
8
|
-
const
|
|
10
|
+
const convertCommonnessRatedAdvantageOrDisadvantageLevel = (level) => {
|
|
11
|
+
switch (level.kind) {
|
|
12
|
+
case "Range":
|
|
13
|
+
return [level.Range.min, level.Range.max];
|
|
14
|
+
case "Constant":
|
|
15
|
+
return level.Constant;
|
|
16
|
+
default:
|
|
17
|
+
return assertExhaustive(level);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const makeActivatableIdentifierForCommonnessRatedAdvantageOrDisadvantage = (entity, id) => {
|
|
21
|
+
switch (entity) {
|
|
22
|
+
case "Advantage":
|
|
23
|
+
return Case("Advantage", id);
|
|
24
|
+
case "Disadvantage":
|
|
25
|
+
return Case("Disadvantage", id);
|
|
26
|
+
default:
|
|
27
|
+
return assertExhaustive(entity);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const renderCommonnessRatedAdvantageOrDisadvantageName = (translateMap, getInstanceById, getResolvedSelectOptionById, entity, item) => {
|
|
9
31
|
const customTranslation = translateMap(item.translations);
|
|
10
|
-
return (attributedCustomName(translateMap, getInstanceById, entity, translation => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
32
|
+
return (attributedCustomName(translateMap, getInstanceById, entity, (translation, instance) => {
|
|
33
|
+
if (customTranslation?.full !== undefined) {
|
|
34
|
+
return customTranslation.full;
|
|
35
|
+
}
|
|
36
|
+
const id = makeActivatableIdentifierForCommonnessRatedAdvantageOrDisadvantage(entity, item.id);
|
|
37
|
+
const level = item.level === undefined
|
|
38
|
+
? undefined
|
|
39
|
+
: convertCommonnessRatedAdvantageOrDisadvantageLevel(item.level);
|
|
40
|
+
const options = customTranslation?.options === undefined
|
|
41
|
+
? (item.options?.map(option => renderNameComponentsOptions(false, getResolvedSelectOptionById, id, [option]) ??
|
|
42
|
+
MISSING_VALUE) ?? [])
|
|
43
|
+
: [customTranslation.options];
|
|
44
|
+
const name = translation.name_in_library !== undefined && options.length === 0
|
|
45
|
+
? translation.name_in_library
|
|
46
|
+
: translation.name;
|
|
47
|
+
return renderCombinedActivatableNameComponents(translateMap, {
|
|
48
|
+
id,
|
|
49
|
+
base: name,
|
|
50
|
+
level,
|
|
51
|
+
nameBuilderRules: makeNameBuilderRulesWithDefaults(instance.nameBuilderRules),
|
|
52
|
+
options: customTranslation?.options === undefined
|
|
53
|
+
? (item.options?.map(option => renderNameComponentsOptions(false, getResolvedSelectOptionById, id, [
|
|
54
|
+
option,
|
|
55
|
+
]) ?? MISSING_VALUE) ?? [])
|
|
56
|
+
: [customTranslation.options],
|
|
57
|
+
}, false);
|
|
15
58
|
}, entity, item.id) ?? MISSING_VALUE);
|
|
16
59
|
};
|
|
17
60
|
/**
|
|
18
61
|
* Render the names of either commonness-rated advantages or commonness-rated disadvantages.
|
|
19
62
|
*/
|
|
20
|
-
export const renderCommonnessRatedAdvantagesOrDisadvantages = (entity, items) => Reader.asks(({
|
|
21
|
-
?
|
|
63
|
+
export const renderCommonnessRatedAdvantagesOrDisadvantages = (entity, items, emptyString) => Reader.asks(({ translateMap, getInstanceById, getResolvedSelectOptionById, localeCompare }) => items === undefined || !isNotEmpty(items)
|
|
64
|
+
? emptyString
|
|
22
65
|
: items
|
|
23
|
-
.map(item => renderCommonnessRatedAdvantageOrDisadvantageName(translateMap, getInstanceById, entity, item))
|
|
66
|
+
.map(item => renderCommonnessRatedAdvantageOrDisadvantageName(translateMap, getInstanceById, getResolvedSelectOptionById, entity, item))
|
|
24
67
|
.toSorted(localeCompare)
|
|
25
68
|
.join(", "));
|
|
26
69
|
/**
|
|
27
70
|
* Render the names of commonness-rated advantages and disadvantages together.
|
|
28
71
|
*/
|
|
29
|
-
export const renderCommonnessRatedAdvantagesAndDisadvantages = (advantages, disadvantages) => Reader.asks(({
|
|
72
|
+
export const renderCommonnessRatedAdvantagesAndDisadvantages = (advantages, disadvantages, emptyString) => Reader.asks(({ translateMap, getInstanceById, getResolvedSelectOptionById, localeCompare }) => mapNullable(ensureNonEmpty([["Advantage", advantages], ["Disadvantage", disadvantages]].flatMap(([entity, items]) => items?.map(item => renderCommonnessRatedAdvantageOrDisadvantageName(translateMap, getInstanceById, getResolvedSelectOptionById, entity, item)) ?? [])), renderedItems => renderedItems.toSorted(localeCompare).join(", ")) ?? emptyString);
|
|
30
73
|
/**
|
|
31
74
|
* Render a value with a possible translation, falling back to explicity rendering the value if no translation is available.
|
|
32
75
|
*/
|
|
33
|
-
export const renderValueWithPossibleTranslation = (label, value, renderValue,
|
|
76
|
+
export const renderValueWithPossibleTranslation = (label, value, renderValue, _valueTranslation) => Reader.asks(({ translate }) => ({
|
|
34
77
|
label: translate(label),
|
|
35
|
-
value: valueTranslation ?? renderValue(value),
|
|
78
|
+
value: /* valueTranslation ?? */ renderValue(value),
|
|
36
79
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImprovementCost, RatedIdentifier, SkillWithEnhancementsIdentifier } from "optolith
|
|
1
|
+
import type { ImprovementCost, RatedIdentifier, SkillWithEnhancementsIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { RawEntityDescriptionSection } from "../../index.js";
|
|
3
3
|
import { type StdReader } from "./reader.js";
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AlternativeName, LaboratoryLevel, Resistance } from "optolith
|
|
1
|
+
import type { AlternativeName, LaboratoryLevel, Resistance } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetInstanceById } from "../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleMap, Translate, TranslateMap } from "../../helpers/translate.js";
|
|
4
4
|
import type { IdMap } from "../../index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MapStyle, ResponsiveTextOptional } from "optolith
|
|
1
|
+
import type { MapStyle, ResponsiveTextOptional } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { LocaleMap, Translate, TranslateMap } from "../../helpers/translate.js";
|
|
3
3
|
import { type StdReader } from "./reader.js";
|
|
4
4
|
/**
|
|
@@ -9,7 +9,7 @@ import { MISSING_VALUE } from "./unknown.js";
|
|
|
9
9
|
export const renderMap = (translate, translateMap, map, getValue, surroundValues = values => values, getLabel, getListPrefix, getListSuffix, getReplacement, ...moreToAppend) => {
|
|
10
10
|
const translation = translateMap(map.translations);
|
|
11
11
|
const replacement = mapNullable(translation, t => getReplacement(t));
|
|
12
|
-
if (replacement
|
|
12
|
+
if (isNotNullish(replacement)) {
|
|
13
13
|
return replacement;
|
|
14
14
|
}
|
|
15
15
|
if (map.style?.kind === "Verbose") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Some helpers to create Markdown content.
|
|
3
3
|
*/
|
|
4
|
-
import type { EntityMap } from "optolith
|
|
4
|
+
import type { EntityMap } from "@optolith/database-schema/gen";
|
|
5
5
|
import { type IdArgsVariant } from "tsondb/schema/gen";
|
|
6
6
|
import type { GetInstanceById } from "../../helpers/getTypes.js";
|
|
7
7
|
import type { LocaleMap, TranslateMap } from "../../helpers/translate.js";
|
|
@@ -32,7 +32,7 @@ export declare const customName: <E extends { [K in keyof EntityMap]: EntityMap[
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const attributedCustomName: <E extends { [K in keyof EntityMap]: EntityMap[K] extends {
|
|
34
34
|
translations: LocaleMap<object>;
|
|
35
|
-
} ? K : never; }[keyof EntityMap]>(translateMap: TranslateMap, getInstanceById: GetInstanceById<E>, context: string, fn: (translation: EntityMap[E]["translations"][string]) => string, ...args: IdArgsVariant<EntityMap, E>) => string | undefined;
|
|
35
|
+
} ? K : never; }[keyof EntityMap]>(translateMap: TranslateMap, getInstanceById: GetInstanceById<E>, context: string, fn: (translation: EntityMap[E]["translations"][string], instance: EntityMap[E]) => string, ...args: IdArgsVariant<EntityMap, E>) => string | undefined;
|
|
36
36
|
/**
|
|
37
37
|
* Renders the name of an instance in an attributed string.
|
|
38
38
|
*/
|
|
@@ -34,7 +34,10 @@ export const customName = (translateMap, getInstanceById, fn, ...args) => mapNul
|
|
|
34
34
|
*/
|
|
35
35
|
export const attributedCustomName = (translateMap, getInstanceById, context, fn, ...args) => {
|
|
36
36
|
const id = normalizedIdArgs(args);
|
|
37
|
-
|
|
37
|
+
const instance = getInstanceById(...args);
|
|
38
|
+
return mapNullable(translateMap(instance?.translations), translation => attributedInstance(
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- instance must be non-nullish if translation is non-nullish
|
|
40
|
+
fn(translation, instance), id.entityName, id.id, { context: `"${context}"` }));
|
|
38
41
|
};
|
|
39
42
|
/**
|
|
40
43
|
* Renders the name of an instance in an attributed string.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MathOperation } from "optolith
|
|
1
|
+
import type { MathOperation } from "@optolith/database-schema/gen";
|
|
2
2
|
type UnaryFormatter = (value: string | number) => string;
|
|
3
3
|
type BinaryFormatter = (left: string | number, right: string | number) => string;
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisites, AnimistPowerPrerequisites, ArcaneTraditionPrerequisites, DerivedCharacteristicPrerequisites, EnhancementPrerequisites, GeneralPrerequisites, GeodeRitualPrerequisites, InfluencePrerequisites, LanguagePrerequisites, LiturgyPrerequisites, PersonalityTraitPrerequisites, PlainGeneralPrerequisites, ProfessionPrerequisites, PublicationPrerequisites, RatedIdentifier,
|
|
1
|
+
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisites, AnimistPowerPrerequisites, ArcaneTraditionPrerequisites, DerivedCharacteristicPrerequisites, EnhancementPrerequisites, GeneralPrerequisites, GeodeRitualPrerequisites, InfluencePrerequisites, LanguagePrerequisites, LiturgyPrerequisites, PersonalityTraitPrerequisites, PlainGeneralPrerequisites, ProfessionPrerequisites, PublicationPrerequisites, RatedIdentifier, SpellworkPrerequisites } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleEnvironment } from "../../../helpers/locale.js";
|
|
4
4
|
import type { GetResolvedSelectOptionById } from "./single/activatable.js";
|
|
@@ -18,7 +18,7 @@ export declare const printPlainGeneralPrerequisites: (getInstanceById: GetInstan
|
|
|
18
18
|
* Print general prerequisites as a string.
|
|
19
19
|
*/
|
|
20
20
|
export declare const printGeneralPrerequisites: (getInstanceById: GetInstanceById<"Race" | "Culture" | "PactCategory" | "PactDomain" | "SocialStatus" | "State" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Property" | "Aspect" | "Enhancement">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: GeneralPrerequisites, printPreviousLevelPrerequisites?: {
|
|
21
|
-
id:
|
|
21
|
+
id: ActivatableIdentifier;
|
|
22
22
|
levels: number;
|
|
23
23
|
}, trailingText?: string) => string;
|
|
24
24
|
/**
|
|
@@ -60,7 +60,7 @@ export declare const printAnimistPowerPrerequisites: (getInstanceById: GetInstan
|
|
|
60
60
|
/**
|
|
61
61
|
* Print geode ritual prerequisites as a string.
|
|
62
62
|
*/
|
|
63
|
-
export declare const printGeodeRitualPrerequisites: (getInstanceById: GetInstanceById<"Influence">, locale: LocaleEnvironment, value: GeodeRitualPrerequisites) => string;
|
|
63
|
+
export declare const printGeodeRitualPrerequisites: (getInstanceById: GetInstanceById<"Influence" | ActivatableIdentifier["kind"] | "Aspect">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, value: GeodeRitualPrerequisites) => string;
|
|
64
64
|
/**
|
|
65
65
|
* Print enhancement prerequisites as a string.
|
|
66
66
|
*/
|
|
@@ -201,7 +201,7 @@ export const printAnimistPowerPrerequisites = (getInstanceById, locale, value) =
|
|
|
201
201
|
/**
|
|
202
202
|
* Print geode ritual prerequisites as a string.
|
|
203
203
|
*/
|
|
204
|
-
export const printGeodeRitualPrerequisites = (getInstanceById, locale, value) => printPlainPrerequisites(prerequisite => printGeodeRitualPrerequisiteGroup(getInstanceById, locale, prerequisite), locale, value);
|
|
204
|
+
export const printGeodeRitualPrerequisites = (getInstanceById, getResolvedSelectOptionById, locale, value) => printPlainPrerequisites(prerequisite => printGeodeRitualPrerequisiteGroup(getInstanceById, getResolvedSelectOptionById, locale, prerequisite), locale, value);
|
|
205
205
|
/**
|
|
206
206
|
* Print enhancement prerequisites as a string.
|
|
207
207
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SentenceType } from "optolith
|
|
1
|
+
import type { SentenceType } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { LocaleCompare } from "../../../helpers/locale.js";
|
|
3
3
|
import type { Translate, TranslateMap } from "../../../helpers/translate.js";
|
|
4
4
|
import { type ActivatableNameComponents } from "../activatableNameChunks.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisiteGroup, AnimistPowerPrerequisiteGroup, ArcaneTraditionPrerequisiteGroup, DerivedCharacteristicPrerequisiteGroup, EnhancementPrerequisiteGroup, GeneralPrerequisiteGroup, GeodeRitualPrerequisiteGroup, InfluencePrerequisiteGroup, LanguagePrerequisiteGroup, LiturgyPrerequisiteGroup, PersonalityTraitPrerequisiteGroup, PreconditionGroup, ProfessionPrerequisiteGroup, PublicationPrerequisiteGroup, RatedIdentifier, SpellworkPrerequisiteGroup } from "optolith
|
|
1
|
+
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisiteGroup, AnimistPowerPrerequisiteGroup, ArcaneTraditionPrerequisiteGroup, DerivedCharacteristicPrerequisiteGroup, EnhancementPrerequisiteGroup, GeneralPrerequisiteGroup, GeodeRitualPrerequisiteGroup, InfluencePrerequisiteGroup, LanguagePrerequisiteGroup, LiturgyPrerequisiteGroup, PersonalityTraitPrerequisiteGroup, PreconditionGroup, ProfessionPrerequisiteGroup, PublicationPrerequisiteGroup, RatedIdentifier, SpellworkPrerequisiteGroup } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleEnvironment } from "../../../helpers/locale.js";
|
|
4
4
|
import type { PrerequisitePart } from "./part.js";
|
|
@@ -54,7 +54,7 @@ export declare const printAnimistPowerPrerequisiteGroup: (getInstanceById: GetIn
|
|
|
54
54
|
/**
|
|
55
55
|
* Print the translation of a geode ritual prerequisite group.
|
|
56
56
|
*/
|
|
57
|
-
export declare const printGeodeRitualPrerequisiteGroup: (getInstanceById: GetInstanceById<"Influence">, locale: LocaleEnvironment, prerequisite: GeodeRitualPrerequisiteGroup) => PrerequisitePart | undefined;
|
|
57
|
+
export declare const printGeodeRitualPrerequisiteGroup: (getInstanceById: GetInstanceById<"Influence" | ActivatableIdentifier["kind"] | "Aspect">, getResolvedSelectOptionById: GetResolvedSelectOptionById, locale: LocaleEnvironment, prerequisite: GeodeRitualPrerequisiteGroup) => PrerequisitePart | undefined;
|
|
58
58
|
/**
|
|
59
59
|
* Print the translation of an enhancement prerequisite group.
|
|
60
60
|
*/
|
|
@@ -241,13 +241,16 @@ printAnimistPowerPrerequisite(getInstanceById, locale, prerequisite.AnimistPower
|
|
|
241
241
|
/**
|
|
242
242
|
* Print the translation of a geode ritual prerequisite group.
|
|
243
243
|
*/
|
|
244
|
-
export const printGeodeRitualPrerequisiteGroup = (getInstanceById, locale, prerequisite) =>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
244
|
+
export const printGeodeRitualPrerequisiteGroup = (getInstanceById, getResolvedSelectOptionById, locale, prerequisite) => {
|
|
245
|
+
switch (prerequisite.kind) {
|
|
246
|
+
case "Activatable":
|
|
247
|
+
return printActivatablePrerequisite(getInstanceById, getResolvedSelectOptionById, locale, prerequisite.Activatable, false);
|
|
248
|
+
case "Influence":
|
|
249
|
+
return printInfluencePrerequisite(getInstanceById, locale, prerequisite.Influence);
|
|
250
|
+
default:
|
|
251
|
+
return assertExhaustive(prerequisite);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
251
254
|
/**
|
|
252
255
|
* Print the translation of an enhancement prerequisite group.
|
|
253
256
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ResolvedSelectOption, ResolvedSelectOptionIdentifier } from "optolith
|
|
2
|
-
import type { ActivatableIdentifier, ActivatablePrerequisite, RequirableSelectOptionIdentifier } from "optolith
|
|
1
|
+
import type { ResolvedSelectOption, ResolvedSelectOptionIdentifier } from "@optolith/database-schema/cache";
|
|
2
|
+
import type { ActivatableIdentifier, ActivatablePrerequisite, RequirableSelectOptionIdentifier } from "@optolith/database-schema/gen";
|
|
3
3
|
import type { GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
4
4
|
import type { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
5
5
|
import type { Translate } from "../../../../helpers/translate.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnimistPowerPrerequisite } from "optolith
|
|
1
|
+
import type { AnimistPowerPrerequisite } from "@optolith/database-schema/gen";
|
|
2
2
|
import { type GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
4
|
import type { PrerequisitePart } from "../part.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BlessedTraditionPrerequisite } from "optolith
|
|
1
|
+
import type { BlessedTraditionPrerequisite } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
3
3
|
import type { PrerequisitePart } from "../part.js";
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CulturePrerequisite } from "optolith
|
|
1
|
+
import type { CulturePrerequisite } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
4
|
import type { PrerequisitePart } from "../part.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EnhancementPrerequisite } from "optolith
|
|
1
|
+
import type { EnhancementPrerequisite } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
3
3
|
import type { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
4
|
import type { PrerequisitePart } from "../part.js";
|