@optolith/entity-descriptions 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/lib/creator.d.ts +17 -12
- package/lib/creator.js +89 -17
- package/lib/entities/activatable.d.ts +5 -2
- package/lib/entities/activatable.js +7 -1
- package/lib/entities/alternativeRule.d.ts +1 -1
- package/lib/entities/attribute.d.ts +1 -3
- package/lib/entities/combatTechnique.d.ts +2 -2
- package/lib/entities/condition.d.ts +2 -6
- package/lib/entities/culture.d.ts +2 -1
- package/lib/entities/curriculum.d.ts +1 -1
- package/lib/entities/derivedCharacteristic.d.ts +1 -1
- package/lib/entities/disease.d.ts +1 -1
- package/lib/entities/disease.js +5 -6
- package/lib/entities/elixir.d.ts +1 -1
- package/lib/entities/elixir.js +2 -2
- package/lib/entities/equipment.d.ts +6 -8
- package/lib/entities/equipment.js +517 -213
- package/lib/entities/equipmentPackage.d.ts +1 -1
- package/lib/entities/experienceLevel.d.ts +1 -3
- package/lib/entities/focusRule.d.ts +1 -1
- package/lib/entities/influence.d.ts +1 -1
- package/lib/entities/liturgicalChant.d.ts +3 -3
- package/lib/entities/optionalRule.d.ts +1 -3
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +1 -1
- package/lib/entities/partial/enhancements.d.ts +1 -1
- package/lib/entities/partial/herbary.d.ts +6 -3
- package/lib/entities/partial/herbary.js +5 -3
- package/lib/entities/partial/prerequisites/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/effect.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/index.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +1 -1
- package/lib/entities/partial/rated/improvementCost.d.ts +1 -1
- package/lib/entities/partial/units/simple.d.ts +55 -0
- package/lib/entities/partial/units/simple.js +56 -0
- package/lib/entities/personalityTrait.d.ts +1 -1
- package/lib/entities/poison.d.ts +1 -1
- package/lib/entities/poison.js +2 -2
- package/lib/entities/profession.d.ts +2 -1
- package/lib/entities/race.d.ts +2 -2
- package/lib/entities/sexPractice.d.ts +1 -3
- package/lib/entities/skill.d.ts +1 -1
- package/lib/entities/spell.d.ts +17 -16
- package/lib/entities/state.d.ts +1 -3
- package/lib/entities/tradeSecret.d.ts +4 -0
- package/lib/entities/tradeSecret.js +77 -0
- package/lib/entityDescription.d.ts +118 -0
- package/lib/entityDescription.js +1 -0
- package/lib/env.d.ts +9 -2
- package/lib/helpers/locale.d.ts +4 -0
- package/lib/index.d.ts +247 -423
- package/lib/index.js +9 -1
- package/lib/rawEntityDescription.d.ts +144 -0
- package/lib/rawEntityDescription.js +1 -0
- package/lib/references/index.d.ts +2 -3
- package/lib/references/index.js +11 -16
- package/lib/references/page.d.ts +4 -2
- package/lib/references/page.js +6 -4
- package/lib/references/pageRange.d.ts +3 -3
- package/lib/references/pageRange.js +6 -4
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -5,4 +5,4 @@ import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const getEquipmentPackageEntityDescription: import("../creator.js").EntityDescriptionCreator<"EquipmentPackage", {
|
|
7
7
|
getInstanceById: GetInstanceById<"Publication" | EquipmentIdentifier["kind"] | "SocialStatus">;
|
|
8
|
-
}, import("../
|
|
8
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for an experience level.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getExperienceLevelEntityDescription: import("../creator.js").EntityDescriptionCreator<"ExperienceLevel",
|
|
5
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
-
}, import("../index.js").EntityDescription>;
|
|
4
|
+
export declare const getExperienceLevelEntityDescription: import("../creator.js").EntityDescriptionCreator<"ExperienceLevel", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -4,4 +4,4 @@ import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const getFocusRuleEntityDescription: import("../creator.js").EntityDescriptionCreator<"FocusRule", {
|
|
6
6
|
getInstanceById: GetInstanceById<"Publication" | "Subject">;
|
|
7
|
-
}, import("../
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -8,4 +8,4 @@ export declare const getInfluenceEntityDescription: import("../creator.js").Enti
|
|
|
8
8
|
getInstanceById: GetInstanceById<"Publication" | "Influence" | "Race" | ActivatableIdentifier["kind"] | "Aspect">;
|
|
9
9
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
10
10
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionVersion">;
|
|
11
|
-
}, import("../
|
|
11
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -7,7 +7,7 @@ import type { IdMap } from "../index.js";
|
|
|
7
7
|
export declare const getBlessingEntityDescription: import("../creator.js").EntityDescriptionCreator<"Blessing", {
|
|
8
8
|
getInstanceById: GetInstanceById<"Publication" | "TargetCategory">;
|
|
9
9
|
getAllInstances: GetAllInstances<"BlessedTradition">;
|
|
10
|
-
}, import("../
|
|
10
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
11
11
|
/**
|
|
12
12
|
* Get a JSON representation of the rules text for a liturgical chant.
|
|
13
13
|
*/
|
|
@@ -15,7 +15,7 @@ export declare const getLiturgicalChantEntityDescription: import("../creator.js"
|
|
|
15
15
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Aspect" | "BlessedTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement" | "FocusRule">;
|
|
16
16
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
17
17
|
idMap: IdMap;
|
|
18
|
-
}, import("../
|
|
18
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
19
19
|
/**
|
|
20
20
|
* Get a JSON representation of the rules text for a ceremony.
|
|
21
21
|
*/
|
|
@@ -23,4 +23,4 @@ export declare const getCeremonyEntityDescription: import("../creator.js").Entit
|
|
|
23
23
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Aspect" | "BlessedTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement" | "FocusRule">;
|
|
24
24
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
25
25
|
idMap: IdMap;
|
|
26
|
-
}, import("../
|
|
26
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for an optional rule.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getOptionalRuleEntityDescription: import("../creator.js").EntityDescriptionCreator<"OptionalRule",
|
|
5
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
-
}, import("../index.js").EntityDescription>;
|
|
4
|
+
export declare const getOptionalRuleEntityDescription: import("../creator.js").EntityDescriptionCreator<"OptionalRule", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonnessRatedAdvantageDisadvantage } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { StdReader } from "../../env.js";
|
|
3
3
|
import type { TranslationKeysWithoutParams } from "../../helpers/translate.js";
|
|
4
|
-
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../
|
|
4
|
+
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../rawEntityDescription.js";
|
|
5
5
|
/**
|
|
6
6
|
* Render the names of either commonness-rated advantages or commonness-rated disadvantages.
|
|
7
7
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImprovementCost, RatedIdentifier, SkillWithEnhancementsIdentifier } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { StdReader } from "../../env.js";
|
|
3
|
-
import type { RawEntityDescriptionSection } from "../../
|
|
3
|
+
import type { RawEntityDescriptionSection } from "../../rawEntityDescription.js";
|
|
4
4
|
/**
|
|
5
5
|
* Render the enhancements section for an entity description, if applicable.
|
|
6
6
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
1
2
|
import type { AlternativeName, LaboratoryLevel, Resistance } from "@optolith/database-schema/gen";
|
|
2
3
|
import type { GetInstanceById } from "../../helpers/getTypes.js";
|
|
3
4
|
import type { LocaleMap, Translate, TranslateMap } from "../../helpers/translate.js";
|
|
@@ -22,7 +23,9 @@ export declare const renderChance: (translate: Translate, translateMap: Translat
|
|
|
22
23
|
/**
|
|
23
24
|
* Renders a list of alternative names into a localized string, or returns undefined if there are no alternative names.
|
|
24
25
|
*/
|
|
25
|
-
export declare const renderAlternativeNames: (
|
|
26
|
-
label:
|
|
27
|
-
|
|
26
|
+
export declare const renderAlternativeNames: (alternativeNames: AlternativeName[] | undefined) => {
|
|
27
|
+
label: Reader<{
|
|
28
|
+
translate: Translate;
|
|
29
|
+
}, string>;
|
|
30
|
+
value: Reader<unknown, string>;
|
|
28
31
|
} | undefined;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { isNotEmpty } from "@elyukai/utils/array/nonEmpty";
|
|
2
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
3
|
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
3
4
|
import { renderDice } from "./dice.js";
|
|
4
5
|
import { attributedName } from "./markdown.js";
|
|
5
6
|
import { parensIf } from "./rated/activatable/parensIf.js";
|
|
7
|
+
import { translateR } from "./reader.js";
|
|
6
8
|
import { MISSING_VALUE } from "./unknown.js";
|
|
7
9
|
/**
|
|
8
10
|
* Renders a laboratory level into a localized string.
|
|
@@ -56,11 +58,11 @@ export const renderChance = (translate, translateMap, item, includePercentage =
|
|
|
56
58
|
/**
|
|
57
59
|
* Renders a list of alternative names into a localized string, or returns undefined if there are no alternative names.
|
|
58
60
|
*/
|
|
59
|
-
export const renderAlternativeNames = (
|
|
61
|
+
export const renderAlternativeNames = (alternativeNames) => alternativeNames === undefined || !isNotEmpty(alternativeNames)
|
|
60
62
|
? undefined
|
|
61
63
|
: {
|
|
62
|
-
label:
|
|
64
|
+
label: translateR(".input {$hiddenCount :number} {{Alternative Names}}", {
|
|
63
65
|
hiddenCount: alternativeNames.length,
|
|
64
66
|
}),
|
|
65
|
-
value: alternativeNames.map(name => name.name + parensIf(name.region)).join(", "),
|
|
67
|
+
value: Reader.of(alternativeNames.map(name => name.name + parensIf(name.region)).join(", ")),
|
|
66
68
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Reader } from "@elyukai/utils/reader";
|
|
2
2
|
import type { ActivatableIdentifier, AdvantageDisadvantagePrerequisites, AnimistPowerPrerequisites, ArcaneTraditionPrerequisites, DerivedCharacteristicPrerequisites, EnhancementPrerequisites, GeneralPrerequisites, GeodeRitualPrerequisites, InfluencePrerequisites, LanguagePrerequisites, LiturgyPrerequisites, PersonalityTraitPrerequisites, PlainGeneralPrerequisites, ProfessionPrerequisites, ProfessionVariantPrerequisites, PublicationPrerequisites, SpellworkPrerequisites } from "@optolith/database-schema/gen";
|
|
3
3
|
import type { StdEnv, StdReader } from "../../../env.js";
|
|
4
|
-
import type { RawEntityDescriptionBadge } from "../../../
|
|
4
|
+
import type { RawEntityDescriptionBadge } from "../../../rawEntityDescription.js";
|
|
5
5
|
import { printAdvantageDisadvantagePrerequisiteGroup, printAnimistPowerPrerequisiteGroup, printArcaneTraditionPrerequisiteGroup, printDerivedCharacteristicPrerequisiteGroup, printEnhancementPrerequisiteGroup, printGeneralPrerequisiteGroup, printGeodeRitualPrerequisiteGroup, printInfluencePrerequisiteGroup, printLanguagePrerequisiteGroup, printLiturgyPrerequisiteGroup, printPersonalityTraitPrerequisiteGroup, printProfessionPrerequisiteGroup, printPublicationPrerequisiteGroup, printSpellworkPrerequisiteGroup } from "./prerequisiteGroups.js";
|
|
6
6
|
type DeriveEnvF<T extends (...args: any[]) => any> = ReturnType<T> extends Reader<infer E, unknown> ? E : never;
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ActivatableSkillEffect } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { StdReader } from "../../../../env.js";
|
|
3
|
-
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../../../
|
|
3
|
+
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../../../rawEntityDescription.js";
|
|
4
4
|
/**
|
|
5
5
|
* Gets the text for the effect of an activatable skill.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FastOneTimePerformanceParameters, FastSustainedPerformanceParameters, OneTimePerformanceParameters, ResponsiveTextOptional, SlowOneTimePerformanceParameters, SlowSustainedPerformanceParameters } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { StdReader } from "../../../../env.js";
|
|
3
|
-
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../../../
|
|
3
|
+
import type { RawDefinitionListEntityDescriptionSectionItem } from "../../../../rawEntityDescription.js";
|
|
4
4
|
type RenderedPerformanceParameters = {
|
|
5
5
|
castingTime: string;
|
|
6
6
|
cost: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AffectedTargetCategories } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { StdReader } from "../../../../env.js";
|
|
3
|
-
import { type RawDefinitionListEntityDescriptionSectionItem } from "../../../../
|
|
3
|
+
import { type RawDefinitionListEntityDescriptionSectionItem } from "../../../../rawEntityDescription.js";
|
|
4
4
|
/**
|
|
5
5
|
* Get the text for the target category.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImprovementCost } from "@optolith/database-schema/gen";
|
|
2
2
|
import type { StdReader } from "../../../env.js";
|
|
3
|
-
import { type RawDefinitionListEntityDescriptionSectionItem } from "../../../
|
|
3
|
+
import { type RawDefinitionListEntityDescriptionSectionItem } from "../../../rawEntityDescription.js";
|
|
4
4
|
/**
|
|
5
5
|
* Renders an improvement cost value as a string.
|
|
6
6
|
*/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
+
import type { StdEnv } from "../../../env.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the text for numeric silverthaler cost.
|
|
5
|
+
*/
|
|
6
|
+
export declare const formatSilverthalers: (value: number) => Reader<StdEnv<"fn", never, never, never> & import("@elyukai/utils/nullable").AnyNonNullish & {
|
|
7
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
8
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
9
|
+
}, string>;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the text for silverthaler cost.
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatArbitrarySilverthalers: (value: string | number) => Reader<StdEnv<"fn", never, never, never> & import("@elyukai/utils/nullable").AnyNonNullish & {
|
|
14
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
15
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
16
|
+
}, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the text for weight in the weight unit of the locale.
|
|
19
|
+
*/
|
|
20
|
+
export declare const formatWeight: (value: number) => Reader<{
|
|
21
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
22
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
23
|
+
}, string>;
|
|
24
|
+
/**
|
|
25
|
+
* Adjusts a weight value according to the locale's measurement adjustments.
|
|
26
|
+
*/
|
|
27
|
+
export declare const adjustWeight: (value: number) => Reader<StdEnv<"ma">, number>;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the text for weight in the weight unit of the locale.
|
|
30
|
+
*/
|
|
31
|
+
export declare const formatAdjustedWeight: (value: number) => Reader<StdEnv<"ma"> & {
|
|
32
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
33
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
34
|
+
}, string>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns the text for arbitrary weight in the weight unit of the locale.
|
|
37
|
+
*/
|
|
38
|
+
export declare const formatArbitraryWeight: (value: string | number) => Reader<{
|
|
39
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
40
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
41
|
+
}, string>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the text for adventure points.
|
|
44
|
+
*/
|
|
45
|
+
export declare const formatAdventurePoints: (value: number) => Reader<StdEnv<"fn", never, never, never> & import("@elyukai/utils/nullable").AnyNonNullish & {
|
|
46
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
47
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
48
|
+
}, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the text for arbitrary adventure points.
|
|
51
|
+
*/
|
|
52
|
+
export declare const formatArbitraryAdventurePoints: (value: string | number) => Reader<StdEnv<"fn", never, never, never> & import("@elyukai/utils/nullable").AnyNonNullish & {
|
|
53
|
+
translate: import("../../../helpers/translate.js").Translate;
|
|
54
|
+
responsiveTextSize: import("../responsiveText.js").ResponsiveTextSize;
|
|
55
|
+
}, string>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
+
import { formatNumber, responsiveTranslateR, responsiveTranslateSplitR } from "../reader.js";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the text for numeric silverthaler cost.
|
|
5
|
+
*/
|
|
6
|
+
export const formatSilverthalers = (value) => formatNumber(value).thenW(valueStr => responsiveTranslateSplitR(".input {$value :number} {{{$value} silverthalers}}", "{$value} S", {
|
|
7
|
+
value,
|
|
8
|
+
}, {
|
|
9
|
+
value: valueStr,
|
|
10
|
+
}));
|
|
11
|
+
/**
|
|
12
|
+
* Returns the text for silverthaler cost.
|
|
13
|
+
*/
|
|
14
|
+
export const formatArbitrarySilverthalers = (value) => typeof value === "number"
|
|
15
|
+
? formatSilverthalers(value)
|
|
16
|
+
: responsiveTranslateR("{$value} silverthalers", "{$value} S", {
|
|
17
|
+
value,
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* Returns the text for weight in the weight unit of the locale.
|
|
21
|
+
*/
|
|
22
|
+
export const formatWeight = (value) => responsiveTranslateR(".input {$value :number} {{{$value} pounds}}", ".input {$value :number} {{{$value} lbs}}", {
|
|
23
|
+
value,
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Adjusts a weight value according to the locale's measurement adjustments.
|
|
27
|
+
*/
|
|
28
|
+
export const adjustWeight = (value) => Reader.asks((env) => env.measurementAdjustments.stonesMultiplier * value);
|
|
29
|
+
/**
|
|
30
|
+
* Returns the text for weight in the weight unit of the locale.
|
|
31
|
+
*/
|
|
32
|
+
export const formatAdjustedWeight = (value) => adjustWeight(value).thenW(formatWeight);
|
|
33
|
+
/**
|
|
34
|
+
* Returns the text for arbitrary weight in the weight unit of the locale.
|
|
35
|
+
*/
|
|
36
|
+
export const formatArbitraryWeight = (value) => typeof value === "number"
|
|
37
|
+
? formatWeight(value)
|
|
38
|
+
: responsiveTranslateR("{$value} pounds", "{$value} lbs", {
|
|
39
|
+
value,
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Returns the text for adventure points.
|
|
43
|
+
*/
|
|
44
|
+
export const formatAdventurePoints = (value) => formatNumber(value).thenW(valueStr => responsiveTranslateSplitR(".input {$value :number} {{{$value} Adventure Points}}", "{$value} AP", {
|
|
45
|
+
value,
|
|
46
|
+
}, {
|
|
47
|
+
value: valueStr,
|
|
48
|
+
}));
|
|
49
|
+
/**
|
|
50
|
+
* Returns the text for arbitrary adventure points.
|
|
51
|
+
*/
|
|
52
|
+
export const formatArbitraryAdventurePoints = (value) => typeof value === "number"
|
|
53
|
+
? formatAdventurePoints(value)
|
|
54
|
+
: responsiveTranslateR("{$value} Adventure Points", "{$value} AP", {
|
|
55
|
+
value,
|
|
56
|
+
});
|
|
@@ -4,4 +4,4 @@ import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const getPersonalityTraitEntityDescription: import("../creator.js").EntityDescriptionCreator<"PersonalityTrait", {
|
|
6
6
|
getInstanceById: GetInstanceById<"Publication" | "Race" | "Culture" | "PersonalityTrait">;
|
|
7
|
-
}, import("../
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/poison.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export declare const getPoisonEntityDescription: import("../creator.js").EntityD
|
|
|
9
9
|
getInstanceById: GetInstanceById<"Publication" | "DerivedCharacteristic" | "Disease" | ActivatableIdentifier["kind"] | RatedIdentifier["kind"] | "Race" | "Culture" | "State" | "Enhancement" | "PactCategory" | "PactDomain" | "SocialStatus" | "Aspect" | "Property" | "PersonalityTrait" | "Blessing" | "Cantrip">;
|
|
10
10
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
11
11
|
idMap: IdMap;
|
|
12
|
-
}, import("../
|
|
12
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/poison.js
CHANGED
|
@@ -3,7 +3,7 @@ import { isNotNullish, mapNullable } from "@elyukai/utils/nullable";
|
|
|
3
3
|
import { Reader } from "@elyukai/utils/reader";
|
|
4
4
|
import { sign } from "@elyukai/utils/string/number";
|
|
5
5
|
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
6
|
-
import { createEntityDescriptionCreator } from "../creator.js";
|
|
6
|
+
import { combatDLItem, createEntityDescriptionCreator } from "../creator.js";
|
|
7
7
|
import { renderDice, renderDiceR } from "./partial/dice.js";
|
|
8
8
|
import { renderAlternativeNames, renderChance, renderLaboratoryLevel, renderResistance, } from "./partial/herbary.js";
|
|
9
9
|
import { renderMathOperationR } from "./partial/mathOperation.js";
|
|
@@ -277,7 +277,7 @@ export const getPoisonEntityDescription = createEntityDescriptionCreator(({ getI
|
|
|
277
277
|
{
|
|
278
278
|
type: "definitionList",
|
|
279
279
|
items: [
|
|
280
|
-
renderAlternativeNames(
|
|
280
|
+
combatDLItem(renderAlternativeNames(translation.alternative_names), locale),
|
|
281
281
|
{
|
|
282
282
|
label: translate("Level"),
|
|
283
283
|
value: typeof level === "number" ? level.toFixed() : level,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MagicalActionIdentifier, ProfessionSpecialAbilityIdentifier, RatedIdentifier } from "@optolith/database-schema/gen";
|
|
2
|
+
import type { StdEnv } from "../env.js";
|
|
2
3
|
import type { GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
4
|
import { type GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
4
5
|
/**
|
|
@@ -9,4 +10,4 @@ export declare const getProfessionVersionEntityDescription: import("../creator.j
|
|
|
9
10
|
getAllInstances: GetAllInstances<"SkillGroup">;
|
|
10
11
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionPackage" | "ProfessionVariant">;
|
|
11
12
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
12
|
-
}, import("../
|
|
13
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/race.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ActivatableIdentifier, AutomaticAdvantageDisadvantage } from "@optolith/database-schema/gen";
|
|
2
|
-
import type { StdReader } from "../env.js";
|
|
2
|
+
import type { StdEnv, StdReader } from "../env.js";
|
|
3
3
|
import type { CountInstances, GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
4
4
|
import { type GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
5
5
|
/**
|
|
@@ -14,4 +14,4 @@ export declare const getRaceEntityDescription: import("../creator.js").EntityDes
|
|
|
14
14
|
countInstances: CountInstances<"Attribute">;
|
|
15
15
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"RaceVariant">;
|
|
16
16
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
17
|
-
}, import("../
|
|
17
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for a sex practice.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getSexPracticeEntityDescription: import("../creator.js").EntityDescriptionCreator<"SexPractice",
|
|
5
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
-
}, import("../index.js").EntityDescription>;
|
|
4
|
+
export declare const getSexPracticeEntityDescription: import("../creator.js").EntityDescriptionCreator<"SexPractice", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/skill.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare const getSkillEntityDescription: import("../creator.js").EntityDe
|
|
|
10
10
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"SkillApplication">;
|
|
11
11
|
getAllResolvedNewSkillApplications: GetAllResolvedNewSkillApplications;
|
|
12
12
|
getAllResolvedSkillUses: GetAllResolvedSkillUses;
|
|
13
|
-
}, import("../
|
|
13
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/spell.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ActivatableIdentifier, type RatedIdentifier } from "@optolith/database-schema/gen";
|
|
2
|
+
import type { StdEnv } from "../env.js";
|
|
2
3
|
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
4
|
import { type IdMap } from "../index.js";
|
|
4
5
|
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
@@ -7,7 +8,7 @@ import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single
|
|
|
7
8
|
*/
|
|
8
9
|
export declare const getCantripEntityDescription: import("../creator.js").EntityDescriptionCreator<"Cantrip", {
|
|
9
10
|
getInstanceById: GetInstanceById<"Publication" | "TargetCategory" | "Property" | "MagicalTradition" | "Curriculum">;
|
|
10
|
-
}, import("../
|
|
11
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
11
12
|
/**
|
|
12
13
|
* Get a JSON representation of the rules text for a skill.
|
|
13
14
|
*/
|
|
@@ -15,7 +16,7 @@ export declare const getSpellEntityDescription: import("../creator.js").EntityDe
|
|
|
15
16
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement" | "FocusRule">;
|
|
16
17
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
17
18
|
idMap: IdMap;
|
|
18
|
-
}, import("../
|
|
19
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
19
20
|
/**
|
|
20
21
|
* Get a JSON representation of the rules text for a ritual.
|
|
21
22
|
*/
|
|
@@ -23,88 +24,88 @@ export declare const getRitualEntityDescription: import("../creator.js").EntityD
|
|
|
23
24
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement" | "FocusRule">;
|
|
24
25
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
25
26
|
idMap: IdMap;
|
|
26
|
-
}, import("../
|
|
27
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
27
28
|
/**
|
|
28
29
|
* Get a JSON representation of the rules text for a curse.
|
|
29
30
|
*/
|
|
30
31
|
export declare const getCurseEntityDescription: import("../creator.js").EntityDescriptionCreator<"Curse", {
|
|
31
32
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic">;
|
|
32
33
|
idMap: IdMap;
|
|
33
|
-
}, import("../
|
|
34
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
34
35
|
/**
|
|
35
36
|
* Get a JSON representation of the rules text for an Elven magical song.
|
|
36
37
|
*/
|
|
37
38
|
export declare const getElvenMagicalSongEntityDescription: import("../creator.js").EntityDescriptionCreator<"ElvenMagicalSong", {
|
|
38
39
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "Skill">;
|
|
39
40
|
idMap: IdMap;
|
|
40
|
-
}, import("../
|
|
41
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
41
42
|
/**
|
|
42
43
|
* Get a JSON representation of the rules text for a domination ritual.
|
|
43
44
|
*/
|
|
44
45
|
export declare const getDominationRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"DominationRitual", {
|
|
45
46
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "SkillModificationLevel">;
|
|
46
47
|
idMap: IdMap;
|
|
47
|
-
}, import("../
|
|
48
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
48
49
|
/**
|
|
49
50
|
* Get a JSON representation of the rules text for a magical dance.
|
|
50
51
|
*/
|
|
51
52
|
export declare const getMagicalDanceEntityDescription: import("../creator.js").EntityDescriptionCreator<"MagicalDance", {
|
|
52
53
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "ArcaneBardTradition" | "ArcaneDancerTradition">;
|
|
53
|
-
}, import("../
|
|
54
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
54
55
|
/**
|
|
55
56
|
* Get a JSON representation of the rules text for a magical melody.
|
|
56
57
|
*/
|
|
57
58
|
export declare const getMagicalMelodyEntityDescription: import("../creator.js").EntityDescriptionCreator<"MagicalMelody", {
|
|
58
59
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "Skill" | "ArcaneBardTradition" | "ArcaneDancerTradition">;
|
|
59
|
-
}, import("../
|
|
60
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
60
61
|
/**
|
|
61
62
|
* Get a JSON representation of the rules text for a familiar’s trick.
|
|
62
63
|
*/
|
|
63
64
|
export declare const getFamiliarsTrickEntityDescription: import("../creator.js").EntityDescriptionCreator<"FamiliarsTrick", {
|
|
64
65
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "AnimalType">;
|
|
65
|
-
}, import("../
|
|
66
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
66
67
|
/**
|
|
67
68
|
* Get a JSON representation of the rules text for a animist power.
|
|
68
69
|
*/
|
|
69
70
|
export declare const getAnimistPowerEntityDescription: import("../creator.js").EntityDescriptionCreator<"AnimistPower", {
|
|
70
71
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | "AnimistPower" | "Tribe">;
|
|
71
72
|
idMap: IdMap;
|
|
72
|
-
}, import("../
|
|
73
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
73
74
|
/**
|
|
74
75
|
* Get a JSON representation of the rules text for a Goede ritual.
|
|
75
76
|
*/
|
|
76
77
|
export declare const getGeodeRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"GeodeRitual", {
|
|
77
78
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic" | "Influence" | ActivatableIdentifier["kind"] | "Aspect">;
|
|
78
79
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
79
|
-
}, import("../
|
|
80
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
80
81
|
/**
|
|
81
82
|
* Get a JSON representation of the rules text for a jester trick.
|
|
82
83
|
*/
|
|
83
84
|
export declare const getJesterTrickEntityDescription: import("../creator.js").EntityDescriptionCreator<"JesterTrick", {
|
|
84
85
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic">;
|
|
85
86
|
idMap: IdMap;
|
|
86
|
-
}, import("../
|
|
87
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
87
88
|
/**
|
|
88
89
|
* Get a JSON representation of the rules text for a goblin ritual.
|
|
89
90
|
*/
|
|
90
91
|
export declare const getGoblinRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"GoblinRitual", {
|
|
91
92
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic">;
|
|
92
93
|
idMap: IdMap;
|
|
93
|
-
}, import("../
|
|
94
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
94
95
|
/**
|
|
95
96
|
* Get a JSON representation of the rules text for a Zibilja ritual.
|
|
96
97
|
*/
|
|
97
98
|
export declare const getZibiljaRitualEntityDescription: import("../creator.js").EntityDescriptionCreator<"ZibiljaRitual", {
|
|
98
99
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Property" | "MagicalTradition" | "DerivedCharacteristic">;
|
|
99
100
|
idMap: IdMap;
|
|
100
|
-
}, import("../
|
|
101
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
101
102
|
/**
|
|
102
103
|
* Get a JSON representation of the rules text for a Bannzeichen.
|
|
103
104
|
*/
|
|
104
105
|
export declare const getBannzeichenEntityDescription: import("../creator.js").EntityDescriptionCreator<"Bannzeichen", {
|
|
105
106
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic">;
|
|
106
107
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"BannzeichenOption">;
|
|
107
|
-
}, import("../
|
|
108
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
108
109
|
/**
|
|
109
110
|
* Get a JSON representation of the rules text for a magical rune.
|
|
110
111
|
*/
|
|
@@ -112,4 +113,4 @@ export declare const getMagicalRuneEntityDescription: import("../creator.js").En
|
|
|
112
113
|
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "Property" | "DerivedCharacteristic" | "Skill">;
|
|
113
114
|
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"MagicalRuneOption">;
|
|
114
115
|
idMap: IdMap;
|
|
115
|
-
}, import("../
|
|
116
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
package/lib/entities/state.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Get a JSON representation of the rules text for a state.
|
|
3
3
|
*/
|
|
4
|
-
export declare const getStateEntityDescription: import("../creator.js").EntityDescriptionCreator<"State",
|
|
5
|
-
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
-
}, import("../index.js").EntityDescription>;
|
|
4
|
+
export declare const getStateEntityDescription: import("../creator.js").EntityDescriptionCreator<"State", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get a JSON representation of the rules text for a state.
|
|
3
|
+
*/
|
|
4
|
+
export declare const getTradeSecretEntityDescription: import("../creator.js").EntityDescriptionCreator<"TradeSecret", import("@elyukai/utils/nullable").AnyNonNullish & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../entityDescription.js").EntityDescription<string>>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
+
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
3
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
4
|
+
import { renderDefaultValueMapLabel, renderValueMap } from "./partial/map.js";
|
|
5
|
+
import { evaluateMathOperation } from "./partial/mathOperation.js";
|
|
6
|
+
import { printPlainGeneralPrerequisites } from "./partial/prerequisites/index.js";
|
|
7
|
+
import { translateR } from "./partial/reader.js";
|
|
8
|
+
import { formatAdventurePoints, formatArbitraryAdventurePoints } from "./partial/units/simple.js";
|
|
9
|
+
const renderAdventurePointsValue = (value) => {
|
|
10
|
+
switch (value.kind) {
|
|
11
|
+
case "Fixed": {
|
|
12
|
+
return formatAdventurePoints(value.Fixed);
|
|
13
|
+
}
|
|
14
|
+
case "DependingOnActiveInstances":
|
|
15
|
+
switch (value.DependingOnActiveInstances.kind) {
|
|
16
|
+
case "Threshold":
|
|
17
|
+
return formatAdventurePoints(value.DependingOnActiveInstances.Threshold.normal);
|
|
18
|
+
case "Expression": {
|
|
19
|
+
const { expression, customLabels } = value.DependingOnActiveInstances.Expression;
|
|
20
|
+
const values = Array.from({
|
|
21
|
+
length: customLabels === undefined ? 3 : customLabels.options.length,
|
|
22
|
+
}, (_, index) => evaluateMathOperation(expression, exprValue => {
|
|
23
|
+
switch (exprValue.kind) {
|
|
24
|
+
case "Constant":
|
|
25
|
+
return exprValue.Constant;
|
|
26
|
+
case "Active":
|
|
27
|
+
return index;
|
|
28
|
+
default:
|
|
29
|
+
return assertExhaustive(exprValue);
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
if (customLabels !== undefined) {
|
|
33
|
+
return renderValueMap(customLabels,
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- customLabels.options is guaranteed to have at least as many entries as values
|
|
35
|
+
(_, index) => Reader.of(values[index]), renderDefaultValueMapLabel, formatArbitraryAdventurePoints);
|
|
36
|
+
}
|
|
37
|
+
const labels = Array.from({ length: 3 }, (_, index) => `${(index + 1).toFixed()}.`).join("/");
|
|
38
|
+
return translateR("{$values}/and so on Adventure Points for the {$labels}/and so on purchase", {
|
|
39
|
+
values: values.join("/"),
|
|
40
|
+
labels,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
default:
|
|
44
|
+
return assertExhaustive(value.DependingOnActiveInstances);
|
|
45
|
+
}
|
|
46
|
+
default:
|
|
47
|
+
return assertExhaustive(value);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Get a JSON representation of the rules text for a state.
|
|
52
|
+
*/
|
|
53
|
+
export const getTradeSecretEntityDescription = createEntityDescriptionCreator((_, env, { content: entry }) => {
|
|
54
|
+
const translation = env.translateMap(entry.translations);
|
|
55
|
+
if (translation === undefined) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
type: "tabular",
|
|
60
|
+
title: translation.name,
|
|
61
|
+
className: "trade-secret",
|
|
62
|
+
labels: {
|
|
63
|
+
name: translateR("Name"),
|
|
64
|
+
prerequisites: translateR("Prerequisites"),
|
|
65
|
+
apValue: translateR("AP Value"),
|
|
66
|
+
},
|
|
67
|
+
values: {
|
|
68
|
+
name: Reader.of(translation.name),
|
|
69
|
+
prerequisites: entry.prerequisites === undefined
|
|
70
|
+
? translateR("none")
|
|
71
|
+
: printPlainGeneralPrerequisites(entry.prerequisites),
|
|
72
|
+
apValue: renderAdventurePointsValue(entry.ap_value),
|
|
73
|
+
},
|
|
74
|
+
errata: translation.errata,
|
|
75
|
+
references: entry.src,
|
|
76
|
+
};
|
|
77
|
+
});
|