@optolith/entity-descriptions 0.4.11 → 0.4.13
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 +24 -0
- package/lib/creator.d.ts +1 -1
- package/lib/entities/activatable.d.ts +1 -1
- package/lib/entities/activatable.js +68 -0
- 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/disease.d.ts +1 -1
- package/lib/entities/elixir.d.ts +1 -1
- package/lib/entities/equipment.d.ts +2 -2
- 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 +1 -1
- package/lib/entities/partial/prerequisites/part.d.ts +1 -1
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +1 -1
- 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/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/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 +7 -1
- package/lib/entities/partial/reader.js +4 -0
- package/lib/entities/partial/responsiveText.d.ts +1 -1
- package/lib/entities/poison.d.ts +1 -1
- package/lib/entities/profession.d.ts +1 -1
- package/lib/entities/profession.js +19 -16
- package/lib/entities/race.d.ts +2 -0
- package/lib/entities/race.js +71 -52
- package/lib/entities/skill.d.ts +1 -1
- package/lib/entities/spell.d.ts +1 -1
- 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 +128 -126
- 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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
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.4.13](https://github.com/Optolith/entity-descriptions/compare/v0.4.12...v0.4.13) (2026-06-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* always display max SR for skill distributions ([248e706](https://github.com/Optolith/entity-descriptions/commit/248e7068b880eb820b60c2c36c0d8157abba1c7e))
|
|
11
|
+
* hide variants term for multi-EL professions without variants ([25331f9](https://github.com/Optolith/entity-descriptions/commit/25331f9e9232081a4d4110e273b7096c4dfacdfd))
|
|
12
|
+
* invalid markdown syntax for enhancement in profession ([0be5077](https://github.com/Optolith/entity-descriptions/commit/0be5077332a126061ca2618d5474d88e096594e4))
|
|
13
|
+
|
|
14
|
+
## [0.4.12](https://github.com/Optolith/entity-descriptions/compare/v0.4.11...v0.4.12) (2026-05-31)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add ap and fix minor issues to/with lesson packages ([cf4d0ec](https://github.com/Optolith/entity-descriptions/commit/cf4d0ec0cc615cbd5390919dff79cfe3c409d190))
|
|
20
|
+
* adjust race for schema change and improve commonness rating display ([480f004](https://github.com/Optolith/entity-descriptions/commit/480f004e6e82995c2d651702521a289584360c76))
|
|
21
|
+
* generate favored skills and primary attribute tradition rules ([9bee3c1](https://github.com/Optolith/entity-descriptions/commit/9bee3c1728d11f196f09bfd93afb03033564aa34))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* add maximum skill rating appendix ([7be6362](https://github.com/Optolith/entity-descriptions/commit/7be63623b6bbf7fe3f307f17a41efd72b119fd1d))
|
|
27
|
+
* equipment translation type mismatch ([a594c7c](https://github.com/Optolith/entity-descriptions/commit/a594c7cc5f44c7b52c3886dbce10ba37ed8d5f76))
|
|
28
|
+
|
|
5
29
|
## [0.4.11](https://github.com/Optolith/entity-descriptions/compare/v0.4.10...v0.4.11) (2026-03-23)
|
|
6
30
|
|
|
7
31
|
|
package/lib/creator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntityMap } from "optolith
|
|
1
|
+
import type { EntityMap } 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 { EntityDescription, RawEntityDescription } from "./index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier, AdvancedSpecialAbility, AdvantageDisadvantagePrerequisites, AdventurePointsValue, ApplicableCombatTechniques, Aspect_ID, CombatSpecialAbilityUsageType, DaggerRitualCost, EnchantmentCost, Errata, GeneralPrerequisites, MagicalSignCost, Penalty, PropertyDeclaration, PublicationRefs, RatedIdentifier, SelectOptions, SpecialRule, Volume } from "optolith
|
|
1
|
+
import type { ActivatableIdentifier, AdvancedSpecialAbility, AdvantageDisadvantagePrerequisites, AdventurePointsValue, ApplicableCombatTechniques, Aspect_ID, CombatSpecialAbilityUsageType, 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
3
|
import type { GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
4
4
|
import type { GetAllResolvedNewSkillApplications, GetAllResolvedSelectOptions, GetAllResolvedSkillUses } from "../index.js";
|
|
@@ -3,6 +3,7 @@ import { count } from "@elyukai/utils/array/reductions";
|
|
|
3
3
|
import { deepEqual } from "@elyukai/utils/equality";
|
|
4
4
|
import { on } from "@elyukai/utils/function";
|
|
5
5
|
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
6
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
6
7
|
import { numAsc } from "@optolith/helpers/compare";
|
|
7
8
|
import { sign } from "@optolith/helpers/math";
|
|
8
9
|
import { mapNullable, mapNullableDefault } from "@optolith/helpers/nullable";
|
|
@@ -18,6 +19,7 @@ import { additionFormatter } from "./partial/mathOperation.js";
|
|
|
18
19
|
import { printAdvantageDisadvantagePrerequisites, printGeneralPrerequisites, } from "./partial/prerequisites/index.js";
|
|
19
20
|
import { printActivatableName, } from "./partial/prerequisites/single/activatable.js";
|
|
20
21
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
22
|
+
import { attributedNameR, localeSortR, translateR, } from "./partial/reader.js";
|
|
21
23
|
import { getResponsiveText, getResponsiveTextOptional, ResponsiveTextSize, } from "./partial/responsiveText.js";
|
|
22
24
|
import { formatTimeSpan } from "./partial/units/timeSpan.js";
|
|
23
25
|
import { MISSING_VALUE } from "./partial/unknown.js";
|
|
@@ -626,6 +628,60 @@ const renderTrailingAdvancedPrerequisitesNote = (translate, entityName) => {
|
|
|
626
628
|
}
|
|
627
629
|
return undefined;
|
|
628
630
|
};
|
|
631
|
+
const renderFavoredCombatTechniques = (favoredCombatTechniques) => {
|
|
632
|
+
if (favoredCombatTechniques === undefined) {
|
|
633
|
+
return Reader.of([]);
|
|
634
|
+
}
|
|
635
|
+
switch (favoredCombatTechniques.kind) {
|
|
636
|
+
case "All":
|
|
637
|
+
return translateR("All Combat Techniques").map(text => [text]);
|
|
638
|
+
case "AllClose":
|
|
639
|
+
return translateR("All Close Combat Techniques").map(text => [text]);
|
|
640
|
+
case "AllUsedInHunting":
|
|
641
|
+
return translateR("All Combat Techniques used in hunting").map(text => [text]);
|
|
642
|
+
case "Specific":
|
|
643
|
+
return Reader.traverse(favoredCombatTechniques.Specific.list, id => attributedNameR("favored-skills", id)
|
|
644
|
+
.map(name => name ?? MISSING_VALUE)
|
|
645
|
+
.thenW(name => translateR("Combat Technique {$name}", { name }))).thenW(localeSortR);
|
|
646
|
+
default:
|
|
647
|
+
return assertExhaustive(favoredCombatTechniques);
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
const renderFavoredSkillsBaseList = (combatTechniques, favoredSkills) => Reader.traverse(favoredSkills, id => attributedNameR("favored-skills", "Skill", id).map(name => name ?? MISSING_VALUE))
|
|
651
|
+
.thenW(localeSortR)
|
|
652
|
+
.map(favoredSkillNames => combatTechniques.concat(favoredSkillNames).join(", "));
|
|
653
|
+
const renderFavoredSkillsSelection = (baseList, favoredSkillsSelection) => favoredSkillsSelection === undefined
|
|
654
|
+
? Reader.of(baseList)
|
|
655
|
+
: Reader.traverse(favoredSkillsSelection.options, id => attributedNameR("favored-skills", "Skill", id)).thenW(names => translateR(".input {$count :number} {{{$baseList}, and {$count} of your choice from the following list: {$selection}}}", {
|
|
656
|
+
count: favoredSkillsSelection.number,
|
|
657
|
+
baseList,
|
|
658
|
+
selection: names.join(", "),
|
|
659
|
+
}));
|
|
660
|
+
const renderFavoredSkillsSpecialRule = (favoredCombatTechniques, favoredSkills, favoredSkillsSelection) => translateR("Favored Skills").thenW(label => renderFavoredCombatTechniques(favoredCombatTechniques)
|
|
661
|
+
.thenW(favoredCombatTechniquesText => renderFavoredSkillsBaseList(favoredCombatTechniquesText, favoredSkills))
|
|
662
|
+
.thenW(list => renderFavoredSkillsSelection(list, favoredSkillsSelection))
|
|
663
|
+
.map(text => ({
|
|
664
|
+
label,
|
|
665
|
+
text,
|
|
666
|
+
})));
|
|
667
|
+
const renderPrimaryAttributeSpecialRule = (traditionName, nameOfPeopleWithThisTradition, primaryAttribute) => (primaryAttribute === undefined
|
|
668
|
+
? translateR("Tradition ({$name}) has no associated primary attribute, meaning {$casters} receive no bonus to the AE pool and cannot purchase additional AE.", { name: traditionName, casters: nameOfPeopleWithThisTradition })
|
|
669
|
+
: attributedNameR("rules", "Attribute", typeof primaryAttribute === "string" ? primaryAttribute : primaryAttribute.id).thenW(attr => typeof primaryAttribute !== "string" && primaryAttribute.use_half_for_arcane_energy
|
|
670
|
+
? translateR("This primary attribute of this Tradition is {$attr}; however, {$casters} use only half of this stat (rounded up) to calculate their base AE pool or purchase AE.", {
|
|
671
|
+
casters: nameOfPeopleWithThisTradition,
|
|
672
|
+
attr: attr ?? MISSING_VALUE,
|
|
673
|
+
})
|
|
674
|
+
: translateR("The primary attribute of this Tradition is {$attr}.", {
|
|
675
|
+
attr: attr ?? MISSING_VALUE,
|
|
676
|
+
}))).map(description => ({
|
|
677
|
+
text: description,
|
|
678
|
+
}));
|
|
679
|
+
const renderAdditionalSpecialRules = (traditionName, nameOfPeopleWithThisTradition, favoredCombatTechniques, favoredSkills, favoredSkillsSelection, primaryAttribute) => Reader.sequence([
|
|
680
|
+
favoredSkills === undefined
|
|
681
|
+
? Reader.of(undefined)
|
|
682
|
+
: renderFavoredSkillsSpecialRule(favoredCombatTechniques, favoredSkills, favoredSkillsSelection),
|
|
683
|
+
renderPrimaryAttributeSpecialRule(traditionName, nameOfPeopleWithThisTradition, primaryAttribute),
|
|
684
|
+
]).map(specialRules => specialRules.filter(isNotNullish));
|
|
629
685
|
/**
|
|
630
686
|
* Get a JSON representation of the rules text for a special ability.
|
|
631
687
|
*/
|
|
@@ -636,8 +692,19 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
636
692
|
if (translation === undefined) {
|
|
637
693
|
return undefined;
|
|
638
694
|
}
|
|
695
|
+
const env = {
|
|
696
|
+
translate,
|
|
697
|
+
translateMap,
|
|
698
|
+
getInstanceById,
|
|
699
|
+
localeCompare: locale.compare,
|
|
700
|
+
};
|
|
639
701
|
const baseEntry = entry;
|
|
640
702
|
const wrappedId = Case(entityName, id);
|
|
703
|
+
const additionalSpecialRules = entityName === "BlessedTradition"
|
|
704
|
+
? renderAdditionalSpecialRules(translation.name, translation.nameOfBlessedOnes, entry.favored_combat_techniques, entry.favored_skills, entry.favored_skills_selection, entry.primary).run(env)
|
|
705
|
+
: entityName === "MagicalTradition"
|
|
706
|
+
? renderAdditionalSpecialRules(translation.name, translation.nameOfSpellcasters, undefined, undefined, undefined, entry.primary).run(env)
|
|
707
|
+
: [];
|
|
641
708
|
return {
|
|
642
709
|
title: (translation.name_in_library ?? translation.name) +
|
|
643
710
|
(baseEntry.levels !== undefined ? ` I–${romanize(baseEntry.levels)}` : ""),
|
|
@@ -658,6 +725,7 @@ export const getActivatableEntityDescription = createEntityDescriptionCreator(({
|
|
|
658
725
|
mapNullable(translation.special_rules, specialRules => ({
|
|
659
726
|
type: "plain",
|
|
660
727
|
text: specialRules
|
|
728
|
+
.concat(additionalSpecialRules)
|
|
661
729
|
.map(specialRule => specialRule.label === undefined
|
|
662
730
|
? `- ${specialRule.text}`
|
|
663
731
|
: `- *${specialRule.label}*: ${specialRule.text}`)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
2
|
+
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
2
3
|
/**
|
|
3
4
|
* Get a JSON representation of the rules text for a culture.
|
|
4
5
|
*/
|
|
5
6
|
export declare const getCultureEntityDescription: import("../creator.js").EntityDescriptionCreator<"Culture", {
|
|
6
7
|
getInstanceById: GetInstanceById<"Publication" | "Advantage" | "Disadvantage" | "Skill" | "Language" | "LanguageSpecialization" | "Script" | "SocialStatus" | "ProfessionVariant" | "MagicalTradition" | "BlessedTradition">;
|
|
7
8
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionVersion">;
|
|
9
|
+
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
8
10
|
}, import("../index.js").EntityDescription>;
|
package/lib/entities/culture.js
CHANGED
|
@@ -10,10 +10,18 @@ import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
|
10
10
|
import { getAdventurePointsForRatingRange } from "@optolith/adventure-points/improvement-cost";
|
|
11
11
|
import { createEntityDescriptionCreator } from "../creator.js";
|
|
12
12
|
import { renderCommonnessRatedAdvantagesOrDisadvantages, renderValueWithPossibleTranslation, } from "./partial/commonnessRatedAdvantagesAndDisadvantages.js";
|
|
13
|
+
import { attributedCustomName, attributedName, attributedNameFromSafeTranslation, } from "./partial/markdown.js";
|
|
13
14
|
import { getProfessionName } from "./partial/professions.js";
|
|
14
15
|
import { parensIf } from "./partial/rated/activatable/parensIf.js";
|
|
15
16
|
import { translateR } from "./partial/reader.js";
|
|
16
17
|
import { MISSING_VALUE } from "./partial/unknown.js";
|
|
18
|
+
const getAttributedProfessionName = (translateMap, getChildInstancesForInstanceId, professionId, context) => {
|
|
19
|
+
const baseName = getProfessionName(translateMap, getChildInstancesForInstanceId, professionId);
|
|
20
|
+
if (baseName === undefined) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return attributedNameFromSafeTranslation({ name: baseName }, context, "Profession", professionId);
|
|
24
|
+
};
|
|
17
25
|
const renderListOperation = (operation, list) => {
|
|
18
26
|
switch (operation.kind) {
|
|
19
27
|
case "Intersection":
|
|
@@ -69,26 +77,23 @@ const renderWeighted = (weightedVariants, getName) => {
|
|
|
69
77
|
}
|
|
70
78
|
});
|
|
71
79
|
};
|
|
72
|
-
const renderProfessionConstraint = (getChildInstancesForInstanceId, constraint) => Reader.asks(({ translateMap }) =>
|
|
80
|
+
const renderProfessionConstraint = (getChildInstancesForInstanceId, constraint) => Reader.asks(({ translateMap }) => getAttributedProfessionName(translateMap, getChildInstancesForInstanceId, constraint.id, "common-professions")).thenW(baseName => baseName === undefined
|
|
73
81
|
? Reader.of(undefined)
|
|
74
82
|
: Reader.sequence([
|
|
75
83
|
renderRarity(constraint.rarity),
|
|
76
84
|
Reader.asks(({ translateMap, getInstanceById }) => renderWeighted(constraint.weighted_variants, variantId => translateMap(getInstanceById("ProfessionVariant", variantId)?.translations)
|
|
77
85
|
?.name.default)).thenW(identity),
|
|
78
86
|
]).map(notes => baseName + parensIf(ensureNonEmpty(notes.filter(isNotNullish))?.join("; "))));
|
|
79
|
-
const renderTraditionConstraint = (getChildInstancesForInstanceId, entity, constraint) => Reader.asks(({ translateMap, getInstanceById }) =>
|
|
80
|
-
const translation = translateMap(getInstanceById(entity, constraint.id)?.translations);
|
|
81
|
-
return translation?.nameOfBlessedOnes ?? translation?.name;
|
|
82
|
-
}).thenW(baseName => baseName === undefined
|
|
87
|
+
const renderTraditionConstraint = (getChildInstancesForInstanceId, entity, constraint) => Reader.asks(({ translateMap, getInstanceById }) => attributedCustomName(translateMap, getInstanceById, "common-professions", (translation) => translation.nameOfBlessedOnes ?? translation.name, entity, constraint.id)).thenW(baseName => baseName === undefined
|
|
83
88
|
? Reader.of(undefined)
|
|
84
89
|
: Reader.sequence([
|
|
85
90
|
renderRarity(constraint.rarity),
|
|
86
|
-
Reader.asks(({ translateMap }) => renderWeighted(constraint.weighted_professions, profId =>
|
|
91
|
+
Reader.asks(({ translateMap }) => renderWeighted(constraint.weighted_professions, profId => getAttributedProfessionName(translateMap, getChildInstancesForInstanceId, profId, "common-professions"))).thenW(identity),
|
|
87
92
|
]).map(notes => baseName + parensIf(ensureNonEmpty(notes.filter(isNotNullish))?.join("; "))));
|
|
88
93
|
const renderCommonProfessions = (getChildInstancesForInstanceId, commonProfessions) => {
|
|
89
94
|
switch (commonProfessions.kind) {
|
|
90
95
|
case "Plain":
|
|
91
|
-
return renderCommonProfessionConstraints(commonProfessions.Plain, profId => Reader.asks(({ translateMap }) =>
|
|
96
|
+
return renderCommonProfessionConstraints(commonProfessions.Plain, profId => Reader.asks(({ translateMap }) => getAttributedProfessionName(translateMap, getChildInstancesForInstanceId, profId, "common-professions")));
|
|
92
97
|
case "Grouped":
|
|
93
98
|
return renderCommonProfessionGroup("Mundane Professions", commonProfessions.Grouped.mundane, constraint =>
|
|
94
99
|
// switch (constraint.kind) {
|
|
@@ -118,7 +123,7 @@ const renderCommonProfessions = (getChildInstancesForInstanceId, commonProfessio
|
|
|
118
123
|
const renderCommonSkills = (items) => Reader.asks(({ translate, translateMap, getInstanceById, localeCompare }) => items === undefined || !isNotEmpty(items)
|
|
119
124
|
? translate("none")
|
|
120
125
|
: items
|
|
121
|
-
.map(itemId => translateMap
|
|
126
|
+
.map(itemId => attributedName(translateMap, getInstanceById, "common-skills", "Skill", itemId))
|
|
122
127
|
.filter(isNotNullish)
|
|
123
128
|
.toSorted(localeCompare)
|
|
124
129
|
.join(", "));
|
|
@@ -157,7 +162,7 @@ const renderCulturalPackage = (items) => Reader.asks(({ translate, translateMap,
|
|
|
157
162
|
return [MISSING_VALUE, 0];
|
|
158
163
|
}
|
|
159
164
|
return [
|
|
160
|
-
`${instanceTranslation.
|
|
165
|
+
`${attributedNameFromSafeTranslation(instanceTranslation, "cultural-package", "Skill", item.id)} ${sign(item.points)}`,
|
|
161
166
|
getAdventurePointsForRatingRange(instance.improvement_cost.kind, 0, item.points),
|
|
162
167
|
];
|
|
163
168
|
});
|
|
@@ -172,7 +177,7 @@ const renderCulturalPackage = (items) => Reader.asks(({ translate, translateMap,
|
|
|
172
177
|
/**
|
|
173
178
|
* Get a JSON representation of the rules text for a culture.
|
|
174
179
|
*/
|
|
175
|
-
export const getCultureEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getChildInstancesForInstanceId }, { translate, translateMap, compare: localeCompare, join: localeJoin }, { content: entry }) => {
|
|
180
|
+
export const getCultureEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getChildInstancesForInstanceId, getResolvedSelectOptionById }, { translate, translateMap, compare: localeCompare, join: localeJoin }, { content: entry }) => {
|
|
176
181
|
const translation = translateMap(entry.translations);
|
|
177
182
|
if (translation === undefined) {
|
|
178
183
|
return undefined;
|
|
@@ -182,6 +187,7 @@ export const getCultureEntityDescription = createEntityDescriptionCreator(({ get
|
|
|
182
187
|
translateMap,
|
|
183
188
|
localeCompare,
|
|
184
189
|
getInstanceById,
|
|
190
|
+
getResolvedSelectOptionById,
|
|
185
191
|
};
|
|
186
192
|
const { text: culturePackageText, apValue: culturalPackageApValue } = renderCulturalPackage(entry.cultural_package).run(env);
|
|
187
193
|
return {
|
|
@@ -266,10 +272,10 @@ export const getCultureEntityDescription = createEntityDescriptionCreator(({ get
|
|
|
266
272
|
label: translate("Common Professions"),
|
|
267
273
|
value: renderCommonProfessions(getChildInstancesForInstanceId, entry.common_professions).run(env),
|
|
268
274
|
},
|
|
269
|
-
renderValueWithPossibleTranslation("Common Advantages", entry.common_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values).run(env), translation.common_advantages).run(env),
|
|
270
|
-
renderValueWithPossibleTranslation("Common Disadvantages", entry.common_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values).run(env), translation.common_disadvantages).run(env),
|
|
271
|
-
renderValueWithPossibleTranslation("Uncommon Advantages", entry.uncommon_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values).run(env), translation.uncommon_advantages).run(env),
|
|
272
|
-
renderValueWithPossibleTranslation("Uncommon Disadvantages", entry.uncommon_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values).run(env), translation.uncommon_disadvantages).run(env),
|
|
275
|
+
renderValueWithPossibleTranslation("Common Advantages", entry.common_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values, translate("none")).run(env), translation.common_advantages).run(env),
|
|
276
|
+
renderValueWithPossibleTranslation("Common Disadvantages", entry.common_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values, translate("none")).run(env), translation.common_disadvantages).run(env),
|
|
277
|
+
renderValueWithPossibleTranslation("Uncommon Advantages", entry.uncommon_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values, translate("none")).run(env), translation.uncommon_advantages).run(env),
|
|
278
|
+
renderValueWithPossibleTranslation("Uncommon Disadvantages", entry.uncommon_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values, translate("none")).run(env), translation.uncommon_disadvantages).run(env),
|
|
273
279
|
{
|
|
274
280
|
label: translate("Common Skills"),
|
|
275
281
|
value: renderCommonSkills(entry.common_skills).run(env),
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { partition } from "@elyukai/utils/array/groups";
|
|
2
|
+
import { ensureNonEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
3
|
+
import { sumWith } from "@elyukai/utils/array/reductions";
|
|
2
4
|
import { Dictionary } from "@elyukai/utils/dictionary";
|
|
3
5
|
import { deepEqual } from "@elyukai/utils/equality";
|
|
6
|
+
import { on } from "@elyukai/utils/function";
|
|
4
7
|
import { sign } from "@elyukai/utils/string/number";
|
|
5
8
|
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
9
|
+
import { getAdventurePointsForActivation, getAdventurePointsForRatingRange, } from "@optolith/adventure-points/improvement-cost";
|
|
6
10
|
import { isNotNullish, mapNullable } from "@optolith/helpers/nullable";
|
|
7
11
|
import { createEntityDescriptionCreator } from "../creator.js";
|
|
8
12
|
import { attributedName } from "./partial/markdown.js";
|
|
@@ -43,7 +47,8 @@ const renderRestrictedSpellworks = (translate, translateMap, localeCompare, loca
|
|
|
43
47
|
}
|
|
44
48
|
const translatedSpellworks = excludedSpellworks
|
|
45
49
|
.map(excludedSpellwork => attributedName(translateMap, getInstanceById, "curriculum", excludedSpellwork))
|
|
46
|
-
.filter(isNotNullish)
|
|
50
|
+
.filter(isNotNullish)
|
|
51
|
+
.toSorted(localeCompare);
|
|
47
52
|
if (translatedSpellworks.length === 0) {
|
|
48
53
|
return "";
|
|
49
54
|
}
|
|
@@ -60,7 +65,7 @@ const renderRestrictedSpellworks = (translate, translateMap, localeCompare, loca
|
|
|
60
65
|
?.map(restriction => {
|
|
61
66
|
switch (restriction.kind) {
|
|
62
67
|
case "Property":
|
|
63
|
-
return attributedName(translateMap, getInstanceById, "curriculum", "Property", restriction.Property.id);
|
|
68
|
+
return ((attributedName(translateMap, getInstanceById, "curriculum", "Property", restriction.Property.id) ?? MISSING_VALUE) + addExclusion(restriction.Property.exclude));
|
|
64
69
|
case "DemonSummoning":
|
|
65
70
|
return translate("Demon Summoning");
|
|
66
71
|
default:
|
|
@@ -101,9 +106,9 @@ const renderRestrictedSpellworks = (translate, translateMap, localeCompare, loca
|
|
|
101
106
|
}) ?? [];
|
|
102
107
|
return [...restrictedProperties, ...properties, ...others, ...spellworks].join("; ");
|
|
103
108
|
};
|
|
104
|
-
const renderSpellworkAdjustment = (translateMap, getInstanceById, adjustment) => `${attributedName(translateMap, getInstanceById, "curriculum", adjustment.id) ?? MISSING_VALUE}
|
|
109
|
+
const renderSpellworkAdjustment = (translateMap, getInstanceById, adjustment) => `${attributedName(translateMap, getInstanceById, "curriculum", adjustment.id) ?? MISSING_VALUE}${parensIf(adjustment.tradition === undefined
|
|
105
110
|
? undefined
|
|
106
|
-
: attributedName(translateMap, getInstanceById, "curriculum", "MagicalTradition", adjustment.tradition))}`;
|
|
111
|
+
: attributedName(translateMap, getInstanceById, "curriculum", "MagicalTradition", adjustment.tradition))} ${typeof adjustment.points === "number" ? adjustment.points.toFixed() : adjustment.points}`;
|
|
107
112
|
const renderAbilityAdjustmentName = (translateMap, getInstanceById, abilityAdjustment) => {
|
|
108
113
|
switch (abilityAdjustment.kind) {
|
|
109
114
|
case "Skill":
|
|
@@ -133,6 +138,18 @@ const renderAbilityAdjustmentBaseValue = (baseProfessionPackage, abilityAdjustme
|
|
|
133
138
|
return assertExhaustive(abilityAdjustment);
|
|
134
139
|
}
|
|
135
140
|
};
|
|
141
|
+
const renderPrintedAbilityAdjustmentBaseValue = (abilityAdjustment) => {
|
|
142
|
+
switch (abilityAdjustment.kind) {
|
|
143
|
+
case "Skill":
|
|
144
|
+
return abilityAdjustment.Skill.basePoints;
|
|
145
|
+
case "CombatTechnique":
|
|
146
|
+
return abilityAdjustment.CombatTechnique.basePoints;
|
|
147
|
+
case "Spellwork":
|
|
148
|
+
return abilityAdjustment.Spellwork.basePoints;
|
|
149
|
+
default:
|
|
150
|
+
return assertExhaustive(abilityAdjustment);
|
|
151
|
+
}
|
|
152
|
+
};
|
|
136
153
|
const renderAbilityAdjustmentModifierValue = (abilityAdjustment) => {
|
|
137
154
|
switch (abilityAdjustment.kind) {
|
|
138
155
|
case "Skill":
|
|
@@ -160,17 +177,58 @@ const renderAbilityAdjustmentDefaultValue = (abilityAdjustment) => {
|
|
|
160
177
|
const renderAbilityAdjustment = (translate, translateMap, getInstanceById, baseProfessionPackage) => baseProfessionPackage === undefined
|
|
161
178
|
? abilityAdjustment => `${renderAbilityAdjustmentName(translateMap, getInstanceById, abilityAdjustment)} ${sign(renderAbilityAdjustmentModifierValue(abilityAdjustment))}`
|
|
162
179
|
: abilityAdjustment => {
|
|
180
|
+
const defaultValue = renderAbilityAdjustmentDefaultValue(abilityAdjustment);
|
|
163
181
|
const basePoints = (renderAbilityAdjustmentBaseValue(baseProfessionPackage, abilityAdjustment) ?? 0) +
|
|
164
|
-
|
|
182
|
+
defaultValue;
|
|
183
|
+
const printedBaseValue = mapNullable(renderPrintedAbilityAdjustmentBaseValue(abilityAdjustment), value => value + defaultValue);
|
|
165
184
|
return translate("{$replacement} instead of {$base}", {
|
|
166
|
-
base: basePoints
|
|
185
|
+
base: printedBaseValue === basePoints
|
|
186
|
+
? basePoints
|
|
187
|
+
: `<ins>${basePoints.toFixed()}</ins><del>${printedBaseValue?.toFixed() ?? "n/a"}</del>`,
|
|
167
188
|
replacement: `${renderAbilityAdjustmentName(translateMap, getInstanceById, abilityAdjustment)} ${(basePoints + renderAbilityAdjustmentModifierValue(abilityAdjustment)).toFixed()}`,
|
|
168
189
|
});
|
|
169
190
|
};
|
|
170
|
-
const renderAbilityAdjustments = (translate, translateMap, localeCompare, getInstanceById, baseProfessionPackage, list) => list
|
|
191
|
+
const renderAbilityAdjustments = (translate, translateMap, localeCompare, getInstanceById, baseProfessionPackage, list) => ensureNonEmpty(list
|
|
171
192
|
.map(renderAbilityAdjustment(translate, translateMap, getInstanceById, baseProfessionPackage))
|
|
172
|
-
.toSorted(localeCompare)
|
|
173
|
-
|
|
193
|
+
.toSorted(localeCompare))?.join(", ") ?? "—";
|
|
194
|
+
const calculateApForSpellworkAdjustment = (getInstanceById, adjustment, includeActivation = false) => {
|
|
195
|
+
const instance = getInstanceById(adjustment.id);
|
|
196
|
+
if (instance === undefined) {
|
|
197
|
+
return 0;
|
|
198
|
+
}
|
|
199
|
+
return ((getAdventurePointsForRatingRange(instance.improvement_cost.kind, 0, Math.abs(adjustment.points)) +
|
|
200
|
+
(includeActivation ? getAdventurePointsForActivation(instance.improvement_cost.kind) : 0)) *
|
|
201
|
+
(adjustment.points > 0 ? 1 : -1));
|
|
202
|
+
};
|
|
203
|
+
const calculateApForSpellworkChanges = (getInstanceById, spellworkChanges) => sumWith(spellworkChanges ?? [], change => calculateApForSpellworkAdjustment(getInstanceById, change.replacement, true) -
|
|
204
|
+
calculateApForSpellworkAdjustment(getInstanceById, change.base, true));
|
|
205
|
+
const calculateApForAbilityAdjustments = (getInstanceById, baseProfessionPackage, abilityAdjustments) => sumWith(abilityAdjustments, adjustment => {
|
|
206
|
+
switch (adjustment.kind) {
|
|
207
|
+
case "CombatTechnique": {
|
|
208
|
+
const instance = getInstanceById(adjustment.CombatTechnique.id);
|
|
209
|
+
if (instance === undefined) {
|
|
210
|
+
return 0;
|
|
211
|
+
}
|
|
212
|
+
return (getAdventurePointsForRatingRange(instance.improvement_cost.kind, 0, Math.abs(adjustment.CombatTechnique.points)) * (adjustment.CombatTechnique.points > 0 ? 1 : -1));
|
|
213
|
+
}
|
|
214
|
+
case "Skill": {
|
|
215
|
+
const instance = getInstanceById("Skill", adjustment.Skill.id);
|
|
216
|
+
if (instance === undefined) {
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
219
|
+
return (getAdventurePointsForRatingRange(instance.improvement_cost.kind, 0, Math.abs(adjustment.Skill.points)) * (adjustment.Skill.points > 0 ? 1 : -1));
|
|
220
|
+
}
|
|
221
|
+
case "Spellwork": {
|
|
222
|
+
const baseValue = baseProfessionPackage &&
|
|
223
|
+
renderAbilityAdjustmentBaseValue(baseProfessionPackage, adjustment);
|
|
224
|
+
const includeActivation = baseValue === undefined ||
|
|
225
|
+
baseValue + renderAbilityAdjustmentDefaultValue(adjustment) === 0;
|
|
226
|
+
return calculateApForSpellworkAdjustment(getInstanceById, adjustment.Spellwork, includeActivation);
|
|
227
|
+
}
|
|
228
|
+
default:
|
|
229
|
+
return assertExhaustive(adjustment);
|
|
230
|
+
}
|
|
231
|
+
});
|
|
174
232
|
/**
|
|
175
233
|
* Get a JSON representation of the rules text for a curriculum.
|
|
176
234
|
*/
|
|
@@ -219,36 +277,62 @@ export const getCurriculumEntityDescription = createEntityDescriptionCreator(({
|
|
|
219
277
|
return assertExhaustive(adjustment);
|
|
220
278
|
}
|
|
221
279
|
});
|
|
280
|
+
const apValueBase = baseProfessionPackage?.ap_value;
|
|
281
|
+
const apValueForSpellworkChanges = calculateApForSpellworkChanges(getInstanceById, lessonPackage.content.spellwork_changes);
|
|
282
|
+
const apValueForBoni = calculateApForAbilityAdjustments(getInstanceById, baseProfessionPackage, boni);
|
|
283
|
+
const apValueForMali = calculateApForAbilityAdjustments(getInstanceById, baseProfessionPackage, mali);
|
|
284
|
+
const totalApValue = (apValueBase ?? 0) + apValueForSpellworkChanges + apValueForBoni + apValueForMali;
|
|
285
|
+
const derivedApValueText = `^[${totalApValue.toFixed()}](base: ${baseProfessionPackage?.ap_value.toFixed() ?? '"n/a"'}, changes: ${calculateApForSpellworkChanges(getInstanceById, lessonPackage.content.spellwork_changes).toFixed()}, boni: ${calculateApForAbilityAdjustments(getInstanceById, baseProfessionPackage, boni).toFixed()}, mali: ${calculateApForAbilityAdjustments(getInstanceById, baseProfessionPackage, mali).toFixed()})`;
|
|
222
286
|
return {
|
|
223
287
|
type: "labeled",
|
|
224
|
-
label: lessonPackageTranslation.name
|
|
288
|
+
label: lessonPackageTranslation.name +
|
|
289
|
+
parensIf(translate("{$value} AP", {
|
|
290
|
+
value: lessonPackage.content.apValue === totalApValue
|
|
291
|
+
? derivedApValueText
|
|
292
|
+
: `<ins>${derivedApValueText}</ins><del>${lessonPackage.content.apValue?.toFixed() ?? "n/a"}</del>`,
|
|
293
|
+
})),
|
|
225
294
|
value: {
|
|
226
295
|
type: "definitionList",
|
|
227
296
|
items: [
|
|
228
297
|
{
|
|
229
298
|
label: translate("Spellwork Changes"),
|
|
230
299
|
value: lessonPackageTranslation.spellwork_changes ??
|
|
231
|
-
lessonPackage.content.spellwork_changes
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
300
|
+
ensureNonEmpty((lessonPackage.content.spellwork_changes?.map(change => {
|
|
301
|
+
const baseValueFromProfession = baseProfessionPackage
|
|
302
|
+
? renderAbilityAdjustmentBaseValue(baseProfessionPackage, {
|
|
303
|
+
kind: "Spellwork",
|
|
304
|
+
Spellwork: change.base,
|
|
305
|
+
})
|
|
306
|
+
: undefined;
|
|
307
|
+
return translate("{$replacement} instead of {$base}", {
|
|
308
|
+
base: renderSpellworkAdjustment(translateMap, getInstanceById, {
|
|
309
|
+
...change.base,
|
|
310
|
+
points: baseValueFromProfession === change.base.points
|
|
311
|
+
? change.base.points
|
|
312
|
+
: `<ins>${baseValueFromProfession?.toFixed() ?? "n/a"}</ins><del>${change.base.points.toFixed()}</del>`,
|
|
313
|
+
}),
|
|
314
|
+
replacement: renderSpellworkAdjustment(translateMap, getInstanceById, change.replacement),
|
|
315
|
+
});
|
|
316
|
+
}) ?? []).concat(lessonPackage.content.skills
|
|
317
|
+
?.filter(abilityAdjustment => abilityAdjustment.kind === "Spellwork")
|
|
318
|
+
.map(renderAbilityAdjustment(translate, translateMap, getInstanceById, baseProfessionPackage))
|
|
319
|
+
.toSorted(localeCompare) ?? []))?.join(", ") ??
|
|
237
320
|
translate("none"),
|
|
238
321
|
},
|
|
239
322
|
{
|
|
240
323
|
label: translate("Skills (+)"),
|
|
241
|
-
value: renderAbilityAdjustments(translate, translateMap, localeCompare, getInstanceById, baseProfessionPackage, boni),
|
|
324
|
+
value: renderAbilityAdjustments(translate, translateMap, localeCompare, getInstanceById, baseProfessionPackage, boni.filter(abilityAdjustment => abilityAdjustment.kind !== "Spellwork")),
|
|
242
325
|
},
|
|
243
326
|
{
|
|
244
327
|
label: translate("Skills (−)"),
|
|
245
|
-
value: renderAbilityAdjustments(translate, translateMap, localeCompare, getInstanceById, baseProfessionPackage, mali),
|
|
328
|
+
value: renderAbilityAdjustments(translate, translateMap, localeCompare, getInstanceById, baseProfessionPackage, mali.filter(abilityAdjustment => abilityAdjustment.kind !== "Spellwork")),
|
|
246
329
|
},
|
|
247
330
|
],
|
|
248
331
|
},
|
|
249
332
|
};
|
|
250
333
|
}))
|
|
251
|
-
.filter(isNotNullish)
|
|
334
|
+
.filter(isNotNullish)
|
|
335
|
+
.toSorted(on(packageDescription => packageDescription.label, localeCompare)),
|
|
252
336
|
],
|
|
253
337
|
errata: translation.errata,
|
|
254
338
|
references: entry.src,
|
|
@@ -3,7 +3,7 @@ import type { IdMap } from "../index.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Get a JSON representation of the rules text for an optional rule.
|
|
5
5
|
*/
|
|
6
|
-
export declare const getDiseaseEntityDescription: import("../creator.js").EntityDescriptionCreator<"
|
|
6
|
+
export declare const getDiseaseEntityDescription: import("../creator.js").EntityDescriptionCreator<"Disease" | "AnimalDisease", {
|
|
7
7
|
getInstanceById: GetInstanceById<"Publication" | "AnimalType" | "DerivedCharacteristic">;
|
|
8
8
|
idMap: IdMap;
|
|
9
9
|
}, import("../index.js").EntityDescription>;
|
package/lib/entities/elixir.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier, RatedIdentifier } from "optolith
|
|
1
|
+
import type { ActivatableIdentifier, RatedIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { 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 { AmmunitionishIdentifier, 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
4
|
import type { LocaleJoin } from "../helpers/locale.js";
|
|
@@ -19,7 +19,7 @@ export declare const renderRangedWeapon: <Damage>(translate: Translate, translat
|
|
|
19
19
|
/**
|
|
20
20
|
* Get a JSON representation of the rules text for equipment.
|
|
21
21
|
*/
|
|
22
|
-
export declare const getEquipmentEntityDescription: import("../creator.js").EntityDescriptionCreator<"
|
|
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
23
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Reach" | "SocialStatus" | "CloseCombatTechnique" | "RangedCombatTechnique" | "MagicalTradition" | "BlessedTradition" | "DerivedCharacteristic" | AmmunitionishIdentifier["kind"] | "Race" | "Culture" | "Profession" | "Skill">;
|
|
24
24
|
idMap: IdMap;
|
|
25
25
|
}, import("../index.js").EntityDescription>;
|
|
@@ -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
|
*/
|