@optolith/entity-descriptions 0.4.11 → 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 +15 -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 +1 -1
- 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 +7 -7
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImprovementCost } from "optolith
|
|
1
|
+
import type { ImprovementCost } from "@optolith/database-schema/gen";
|
|
2
2
|
import { type RawDefinitionListEntityDescriptionSectionItem } from "../../../index.js";
|
|
3
3
|
import { type StdReader } from "../reader.js";
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SkillCheckPenalty as GeneralSkillCheckPenalty, MagicalRuneCombatTechniqueCheckPenalty, SkillCheck } from "optolith
|
|
1
|
+
import type { SkillCheckPenalty as GeneralSkillCheckPenalty, MagicalRuneCombatTechniqueCheckPenalty, SkillCheck } from "@optolith/database-schema/gen";
|
|
2
2
|
import { type IdMap } from "../../../index.js";
|
|
3
3
|
import { type StdReader } from "../reader.js";
|
|
4
4
|
/**
|
|
@@ -8,8 +8,8 @@ import { MISSING_VALUE } from "../unknown.js";
|
|
|
8
8
|
export const renderSkillCheck = (check) => Reader.asks(({ translate, translateMap, getInstanceById }) => ({
|
|
9
9
|
label: translate("Check"),
|
|
10
10
|
value: check
|
|
11
|
-
.map(id => translateMap(getInstanceById("Attribute", id)?.translations)
|
|
12
|
-
|
|
11
|
+
.map(id => translateMap(getInstanceById("Attribute", id)?.translations)?.abbreviation ??
|
|
12
|
+
MISSING_VALUE)
|
|
13
13
|
.join("/"),
|
|
14
14
|
}));
|
|
15
15
|
const renderSkillCheckPenalty = (idMap, penalty) => {
|
|
@@ -53,7 +53,9 @@ const renderSkillCheckPenalty = (idMap, penalty) => {
|
|
|
53
53
|
export const renderSkillCheckWithPenalty = (check, checkPenalty, idMap) => checkPenalty === undefined
|
|
54
54
|
? renderSkillCheck(check)
|
|
55
55
|
: renderSkillCheck(check).thenW(checkText => renderSkillCheckPenalty(idMap, checkPenalty)
|
|
56
|
-
.then(penaltyText => responsiveTranslateR(" (modified by {$modifier})", " (−{$modifier})", {
|
|
56
|
+
.then(penaltyText => responsiveTranslateR(" (modified by {$modifier})", " (−{$modifier})", {
|
|
57
|
+
modifier: penaltyText,
|
|
58
|
+
}))
|
|
57
59
|
.map(penaltyText => ({
|
|
58
60
|
...checkText,
|
|
59
61
|
value: checkText.value + penaltyText,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
-
import type { ChildEntityMap, EntityMap, FastSkillModificationLevelConfig, ResponsiveText, ResponsiveTextOptional, SkillModificationLevel, SlowSkillModificationLevelConfig } from "optolith
|
|
2
|
+
import type { ChildEntityMap, EntityMap, FastSkillModificationLevelConfig, ResponsiveText, ResponsiveTextOptional, SkillModificationLevel, SlowSkillModificationLevelConfig } from "@optolith/database-schema/gen";
|
|
3
3
|
import type { IdArgsVariant } from "tsondb/schema/gen";
|
|
4
4
|
import type { GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "../../helpers/getTypes.js";
|
|
5
5
|
import type { FormatNumber, LocaleCompare, LocaleJoin, LocaleJoinType } from "../../helpers/locale.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
-
import type { ResponsiveText, ResponsiveTextOptional, ResponsiveTextReplace } from "optolith
|
|
2
|
+
import type { ResponsiveText, ResponsiveTextOptional, ResponsiveTextReplace } from "@optolith/database-schema/gen";
|
|
3
3
|
import { type LocaleMap } from "../../helpers/translate.js";
|
|
4
4
|
import { type StdEnv } from "./reader.js";
|
|
5
5
|
/**
|
package/lib/entities/poison.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 { IdMap } from "../index.js";
|
|
4
4
|
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MagicalActionIdentifier, ProfessionSpecialAbilityIdentifier, RatedIdentifier } from "optolith
|
|
1
|
+
import type { MagicalActionIdentifier, ProfessionSpecialAbilityIdentifier, RatedIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
3
|
import { type GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
4
4
|
/**
|
|
@@ -148,10 +148,10 @@ const renderSkillsOption = (professionPackages, skillGroup) => allSame(professio
|
|
|
148
148
|
})
|
|
149
149
|
: Reader.traverse(skillsOption.specific, id => attributedNameR("profession", "Skill", id).map(name => name ?? MISSING_VALUE))
|
|
150
150
|
.thenW(localeSortR)
|
|
151
|
-
.thenW(list => translateR("{$apValue} AP to distribute among the following skills: {$list}", {
|
|
151
|
+
.thenW(list => translateR("maximum SR per skill: {$maxSR}", { maxSR: 8 }).then(maxSRText => translateR("{$apValue} AP to distribute among the following skills: {$list}", {
|
|
152
152
|
apValue: skillsOption.ap_value,
|
|
153
|
-
list: list.join(", "),
|
|
154
|
-
}));
|
|
153
|
+
list: list.join(", ") + parensIf(maxSRText),
|
|
154
|
+
})));
|
|
155
155
|
}).map(list => list.join(" / "));
|
|
156
156
|
const renderCantripList = (cantripIds) => Reader.traverse(cantripIds, id => attributedNameR("profession", "Cantrip", id).map(name => name ?? MISSING_VALUE))
|
|
157
157
|
.thenW(localeSortR)
|
|
@@ -707,10 +707,10 @@ export const getProfessionVersionEntityDescription = createEntityDescriptionCrea
|
|
|
707
707
|
value,
|
|
708
708
|
})
|
|
709
709
|
.run(env),
|
|
710
|
-
renderValueWithPossibleTranslation("Suggested Advantages", entry.suggested_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values).run(env), translation.suggested_advantages).run(env),
|
|
711
|
-
renderValueWithPossibleTranslation("Suggested Disadvantages", entry.suggested_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values).run(env), translation.suggested_disadvantages).run(env),
|
|
712
|
-
renderValueWithPossibleTranslation("Unsuitable Advantages", entry.unsuitable_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values).run(env), translation.unsuitable_advantages).run(env),
|
|
713
|
-
renderValueWithPossibleTranslation("Unsuitable Disadvantages", entry.unsuitable_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values).run(env), translation.unsuitable_disadvantages).run(env),
|
|
710
|
+
renderValueWithPossibleTranslation("Suggested Advantages", entry.suggested_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values, translate("none")).run(env), translation.suggested_advantages).run(env),
|
|
711
|
+
renderValueWithPossibleTranslation("Suggested Disadvantages", entry.suggested_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values, translate("none")).run(env), translation.suggested_disadvantages).run(env),
|
|
712
|
+
renderValueWithPossibleTranslation("Unsuitable Advantages", entry.unsuitable_advantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", values, translate("none")).run(env), translation.unsuitable_advantages).run(env),
|
|
713
|
+
renderValueWithPossibleTranslation("Unsuitable Disadvantages", entry.unsuitable_disadvantages, values => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", values, translate("none")).run(env), translation.unsuitable_disadvantages).run(env),
|
|
714
714
|
renderProfessionVariants(professionPackages)
|
|
715
715
|
.map(value => value === undefined
|
|
716
716
|
? undefined
|
package/lib/entities/race.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CountInstances, 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 race.
|
|
4
5
|
*/
|
|
@@ -6,4 +7,5 @@ export declare const getRaceEntityDescription: import("../creator.js").EntityDes
|
|
|
6
7
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Advantage" | "Disadvantage" | "Culture" | "DerivedCharacteristic">;
|
|
7
8
|
countInstances: CountInstances<"Attribute">;
|
|
8
9
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"RaceVariant">;
|
|
10
|
+
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
9
11
|
}, import("../index.js").EntityDescription>;
|
package/lib/entities/race.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { anySameIndices } from "@elyukai/utils/array/filters";
|
|
2
|
-
import { isNotEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
2
|
+
import { ensureNonEmpty, isNotEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
3
3
|
import { deepEqual } from "@elyukai/utils/equality";
|
|
4
4
|
import { on } from "@elyukai/utils/function";
|
|
5
|
-
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
5
|
+
import { isNotNullish, mapNullable } from "@elyukai/utils/nullable";
|
|
6
6
|
import { compareNumber } from "@elyukai/utils/ordering";
|
|
7
7
|
import { Reader } from "@elyukai/utils/reader";
|
|
8
8
|
import { sign } from "@elyukai/utils/string/number";
|
|
9
9
|
import { createEntityDescriptionCreator } from "../creator.js";
|
|
10
|
-
import { renderCommonnessRatedAdvantagesAndDisadvantages, renderCommonnessRatedAdvantagesOrDisadvantages,
|
|
11
|
-
import { attributedCustomName, attributedName } from "./partial/markdown.js";
|
|
10
|
+
import { renderCommonnessRatedAdvantagesAndDisadvantages, renderCommonnessRatedAdvantagesOrDisadvantages, } from "./partial/commonnessRatedAdvantagesAndDisadvantages.js";
|
|
11
|
+
import { attributedCustomName, attributedName, attributedNameFromTranslation, } from "./partial/markdown.js";
|
|
12
12
|
import { getInstanceByIdR, translateMapR, } from "./partial/reader.js";
|
|
13
13
|
import { MISSING_VALUE } from "./partial/unknown.js";
|
|
14
14
|
const renderBaseValues = (values) => Reader.traverse(Object.entries(values), ([id, { value }]) => getInstanceByIdR("DerivedCharacteristic", id).thenW(derivedCharacteristic => translateMapR(derivedCharacteristic?.translations).thenW(translation => Reader.asks(({ translate }) => [
|
|
15
15
|
derivedCharacteristic?.position ?? 0,
|
|
16
16
|
{
|
|
17
17
|
label: translate("{$derivedCharacteristic} Base Value", {
|
|
18
|
-
derivedCharacteristic: translation
|
|
18
|
+
derivedCharacteristic: attributedNameFromTranslation(translation, "base-values", "DerivedCharacteristic", id) ?? MISSING_VALUE,
|
|
19
19
|
}),
|
|
20
20
|
value: value < 0 ? sign(value) : value.toFixed(),
|
|
21
21
|
},
|
|
@@ -28,7 +28,7 @@ const renderAttributeAdjustmentsItem = (totalAttributesCount, adjustments) => Re
|
|
|
28
28
|
...(adjustments.selectable?.map(adj => `${adj.list.length === totalAttributesCount ? translate("one attribute of your choice") : localeJoin(adj.list.map(getAttributeAbbreviation), "disjunction")} ${sign(adj.value)}`) ?? []),
|
|
29
29
|
].join("; ");
|
|
30
30
|
});
|
|
31
|
-
const renderVariantValues = (label, variants, selector, renderValue, translationSelector) => Reader.asks(({ translate, translateMap, localeCompare, localeJoin, }) => {
|
|
31
|
+
const renderVariantValues = (label, variants, selector, renderValue, translationSelector, allowEmpty = false, textPrefix) => Reader.asks(({ translate, translateMap, localeCompare, localeJoin, }) => {
|
|
32
32
|
const values = variants.map(variant => {
|
|
33
33
|
const translation = translateMap(variant.translations);
|
|
34
34
|
return {
|
|
@@ -39,37 +39,52 @@ const renderVariantValues = (label, variants, selector, renderValue, translation
|
|
|
39
39
|
: undefined,
|
|
40
40
|
};
|
|
41
41
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
if (isNotEmpty(values)) {
|
|
43
|
+
const sameValues = anySameIndices(values, on(value => [value.value, value.valueTranslation], deepEqual));
|
|
44
|
+
if (values.length === 1 ||
|
|
45
|
+
(isNotEmpty(sameValues) &&
|
|
46
|
+
sameValues.length === 1 &&
|
|
47
|
+
sameValues[0].length === values.length)) {
|
|
48
|
+
return values[0].value === undefined &&
|
|
49
|
+
values[0].valueTranslation === undefined &&
|
|
50
|
+
allowEmpty
|
|
51
|
+
? undefined
|
|
52
|
+
: mapNullable(
|
|
53
|
+
/* values[0].valueTranslation ?? */ renderValue(values[0].value, false), renderedValue => ({
|
|
54
|
+
label: translate(label),
|
|
55
|
+
value: (textPrefix ?? "") + renderedValue,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return {
|
|
60
|
+
label: translate(label),
|
|
61
|
+
value: [
|
|
62
|
+
...(textPrefix !== undefined ? [{ type: "plain", text: textPrefix }] : []),
|
|
63
|
+
{
|
|
64
|
+
type: "definitionList",
|
|
65
|
+
style: "nested",
|
|
66
|
+
items: Map.groupBy(values
|
|
67
|
+
.toSorted(on(item => item.name, localeCompare))
|
|
68
|
+
.map(value => mapNullable(
|
|
69
|
+
/* value.valueTranslation ?? */ renderValue(value.value, true), renderedValue => ({
|
|
70
|
+
label: value.name,
|
|
71
|
+
value: renderedValue,
|
|
72
|
+
})))
|
|
73
|
+
.filter(isNotNullish), item => item.value)
|
|
74
|
+
.entries()
|
|
75
|
+
.map(([value, items]) => ({
|
|
76
|
+
label: localeJoin(items.map(item => item.label), "conjunction"),
|
|
77
|
+
value,
|
|
78
|
+
}))
|
|
79
|
+
.toArray(),
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
}
|
|
52
84
|
}
|
|
53
85
|
else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
value: [
|
|
57
|
-
{
|
|
58
|
-
type: "definitionList",
|
|
59
|
-
style: "nested",
|
|
60
|
-
items: Map.groupBy(values.toSorted(on(item => item.name, localeCompare)).map(value => ({
|
|
61
|
-
label: value.name,
|
|
62
|
-
value: value.valueTranslation ?? renderValue(value.value),
|
|
63
|
-
})), item => item.value)
|
|
64
|
-
.entries()
|
|
65
|
-
.map(([value, items]) => ({
|
|
66
|
-
label: localeJoin(items.map(item => item.label), "conjunction"),
|
|
67
|
-
value,
|
|
68
|
-
}))
|
|
69
|
-
.toArray(),
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
};
|
|
86
|
+
// at least one value and thus one variant is required
|
|
87
|
+
return undefined;
|
|
73
88
|
}
|
|
74
89
|
});
|
|
75
90
|
const renderAutomaticAdvantagesOrDisadvantages = (entity, items) => Reader.asks(({ translate, translateMap, getInstanceById, localeCompare }) => items === undefined || !isNotEmpty(items)
|
|
@@ -88,7 +103,7 @@ const renderCommonCultures = (items) => Reader.asks(({ translate, translateMap,
|
|
|
88
103
|
/**
|
|
89
104
|
* Get a JSON representation of the rules text for a race.
|
|
90
105
|
*/
|
|
91
|
-
export const getRaceEntityDescription = createEntityDescriptionCreator(({ getInstanceById, countInstances, getChildInstancesForInstanceId }, { translate, translateMap, join: localeJoin, compare: localeCompare }, { id, content: entry }) => {
|
|
106
|
+
export const getRaceEntityDescription = createEntityDescriptionCreator(({ getInstanceById, countInstances, getChildInstancesForInstanceId, getResolvedSelectOptionById, }, { translate, translateMap, join: localeJoin, compare: localeCompare }, { id, content: entry }) => {
|
|
92
107
|
const translation = translateMap(entry.translations);
|
|
93
108
|
if (translation === undefined) {
|
|
94
109
|
return undefined;
|
|
@@ -100,6 +115,7 @@ export const getRaceEntityDescription = createEntityDescriptionCreator(({ getIns
|
|
|
100
115
|
translateMap,
|
|
101
116
|
localeJoin,
|
|
102
117
|
localeCompare,
|
|
118
|
+
getResolvedSelectOptionById,
|
|
103
119
|
getInstanceById,
|
|
104
120
|
};
|
|
105
121
|
return {
|
|
@@ -118,23 +134,26 @@ export const getRaceEntityDescription = createEntityDescriptionCreator(({ getIns
|
|
|
118
134
|
...renderBaseValues(entry.base_values).run(env),
|
|
119
135
|
renderVariantValues("Attribute Adjustments", raceVariants, v => v.attribute_adjustments, attrs => renderAttributeAdjustmentsItem(totalAttributesCount, attrs).run(env)).run(env),
|
|
120
136
|
renderVariantValues("Common Cultures", raceVariants, v => v.common_cultures, cultures => renderCommonCultures(cultures).run(env)).run(env),
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
? undefined
|
|
126
|
-
: renderValueWithPossibleTranslation("Automatic Disadvantages", entry.automatic_disadvantages, v => renderAutomaticAdvantagesOrDisadvantages("Disadvantage", v).run(env), translation.automatic_disadvantages).run(env),
|
|
127
|
-
entry.strongly_recommended_advantages === undefined &&
|
|
128
|
-
entry.strongly_recommended_disadvantages === undefined
|
|
137
|
+
renderVariantValues("Automatic Advantages", raceVariants, v => v.automatic_advantages, advs => renderAutomaticAdvantagesOrDisadvantages("Advantage", advs).run(env), vt => vt.automatic_advantages, true).run(env),
|
|
138
|
+
renderVariantValues("Automatic Disadvantages", raceVariants, v => v.automatic_disadvantages, advs => renderAutomaticAdvantagesOrDisadvantages("Disadvantage", advs).run(env), vt => vt.automatic_disadvantages, true).run(env),
|
|
139
|
+
renderVariantValues("Strongly recommended Advantages and Disadvantages", raceVariants, v => v.strongly_recommended_advantages === undefined &&
|
|
140
|
+
v.strongly_recommended_disadvantages === undefined
|
|
129
141
|
? undefined
|
|
130
|
-
:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
: [
|
|
143
|
+
v.strongly_recommended_advantages,
|
|
144
|
+
v.strongly_recommended_disadvantages,
|
|
145
|
+
], (advsDisadvs, isSplit) => advsDisadvs === undefined
|
|
146
|
+
? isSplit
|
|
147
|
+
? undefined
|
|
148
|
+
: translate("none")
|
|
149
|
+
: renderCommonnessRatedAdvantagesAndDisadvantages(...advsDisadvs, isSplit ? undefined : translate("none")).run(env), vt => ensureNonEmpty([
|
|
150
|
+
vt.strongly_recommended_advantages,
|
|
151
|
+
vt.strongly_recommended_disadvantages,
|
|
152
|
+
].filter(isNotNullish))?.join("; "), true, `${translate("The following advantages and disadvantages distinguish Aventurian {$race}. You should choose these advantages and disadvantages. If you don’t want to take them, talk to your GM.", { race: translation.name })} `).run(env),
|
|
153
|
+
renderVariantValues("Common Advantages", raceVariants, v => v.common_advantages, (advs, isSplit) => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", advs, isSplit ? undefined : translate("none")).run(env), vt => vt.common_advantages).run(env),
|
|
154
|
+
renderVariantValues("Common Disadvantages", raceVariants, v => v.common_disadvantages, (advs, isSplit) => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", advs, isSplit ? undefined : translate("none")).run(env), vt => vt.common_disadvantages).run(env),
|
|
155
|
+
renderVariantValues("Uncommon Advantages", raceVariants, v => v.uncommon_advantages, (advs, isSplit) => renderCommonnessRatedAdvantagesOrDisadvantages("Advantage", advs, isSplit ? undefined : translate("none")).run(env), vt => vt.uncommon_advantages).run(env),
|
|
156
|
+
renderVariantValues("Uncommon Disadvantages", raceVariants, v => v.uncommon_disadvantages, (advs, isSplit) => renderCommonnessRatedAdvantagesOrDisadvantages("Disadvantage", advs, isSplit ? undefined : translate("none")).run(env), vt => vt.uncommon_disadvantages).run(env),
|
|
138
157
|
],
|
|
139
158
|
},
|
|
140
159
|
],
|
package/lib/entities/skill.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActivatableIdentifier } from "optolith
|
|
1
|
+
import type { ActivatableIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
3
|
import type { GetAllResolvedNewSkillApplications, GetAllResolvedSkillUses } from "../index.js";
|
|
4
4
|
/**
|
package/lib/entities/spell.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActivatableIdentifier, type RatedIdentifier } from "optolith
|
|
1
|
+
import { type ActivatableIdentifier, 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
|
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as Database from "optolith
|
|
1
|
+
import type * as Database from "@optolith/database-schema/gen";
|
|
2
2
|
import type { IdArgsVariant } from "tsondb/schema/gen";
|
|
3
3
|
export type GetInstanceById<in T extends Extract<keyof Database.EntityMap, string>> = <U extends T>(...args: IdArgsVariant<Database.EntityMap, U>) => Database.EntityMap[U] | undefined;
|
|
4
4
|
export type GetAllInstances<T extends keyof Database.EntityMap> = <U extends T>(entity: U) => {
|
package/lib/helpers/locale.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { LocaleMeasurementAdjustments } from "@optolith/database-schema/gen";
|
|
1
2
|
import type { Compare } from "@optolith/helpers/compare";
|
|
2
|
-
import type { LocaleMeasurementAdjustments } from "optolith-database-schema/gen";
|
|
3
3
|
import type { Format, Translate, TranslateMap } from "./translate.js";
|
|
4
4
|
/**
|
|
5
5
|
* The type of list to join in a locale-aware way.
|