@optolith/entity-descriptions 0.14.0 → 0.15.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 +10 -0
- package/lib/creator.d.ts +4 -11
- package/lib/creator.js +57 -1
- 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/elixir.d.ts +1 -1
- package/lib/entities/equipment.d.ts +4 -6
- 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/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/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/env.d.ts +9 -2
- package/lib/helpers/locale.d.ts +4 -0
- package/lib/index.d.ts +320 -293
- package/lib/index.js +9 -1
- 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 +2 -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("../index.js").EntityDescription
|
|
8
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.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("../index.js").EntityDescription
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
11
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
10
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
18
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
26
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription<string>>;
|
|
@@ -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("../index.js").EntityDescription
|
|
7
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
12
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.js").EntityDescription<string>>;
|
|
@@ -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("../index.js").EntityDescription
|
|
13
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
17
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.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("../index.js").EntityDescription
|
|
13
|
+
} & import("../env.js").StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
11
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
19
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
27
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
34
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
41
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
48
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
54
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
60
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
66
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
73
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
80
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
87
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
94
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
101
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
108
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.js").EntityDescription
|
|
116
|
+
} & StdEnv<"fd" | "t" | "tm" | "ibi", "Publication">, import("../index.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("../index.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("../index.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
|
+
});
|
package/lib/env.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { AnyNonNullish } from "@elyukai/utils/nullable";
|
|
2
2
|
import type { Reader } from "@elyukai/utils/reader";
|
|
3
|
-
import type { ChildEntityMap, EntityMap } from "@optolith/database-schema/gen";
|
|
3
|
+
import type { ChildEntityMap, EntityMap, LocaleMeasurementAdjustments } from "@optolith/database-schema/gen";
|
|
4
4
|
import type { GetResolvedSelectOptionById } from "./entities/partial/prerequisites/single/activatable.js";
|
|
5
5
|
import type { ModifiableParameter } from "./entities/partial/rated/activatable/nonModifiableSuffix.js";
|
|
6
6
|
import type { Speed } from "./entities/partial/rated/activatable/speed.js";
|
|
7
7
|
import type { ResponsiveTextSize } from "./entities/partial/responsiveText.js";
|
|
8
8
|
import { type EnergyUnit } from "./entities/partial/units/energy.js";
|
|
9
9
|
import type { GetAllChildInstancesForParent, GetAllInstances, GetInstanceById } from "./helpers/getTypes.js";
|
|
10
|
-
import type { FormatNumber, LocaleCompare, LocaleJoin } from "./helpers/locale.js";
|
|
10
|
+
import type { FormatDate, FormatNumber, LocaleCompare, LocaleJoin } from "./helpers/locale.js";
|
|
11
11
|
import type { Format, Translate, TranslateMap, TranslationKeysWithoutParams } from "./helpers/translate.js";
|
|
12
|
+
import type { IdMap } from "./index.js";
|
|
12
13
|
import type { PublicationOptions } from "./references/publicationOptions.js";
|
|
13
14
|
/**
|
|
14
15
|
* The standard set of environment properties for readers in this project.
|
|
@@ -16,6 +17,7 @@ import type { PublicationOptions } from "./references/publicationOptions.js";
|
|
|
16
17
|
export type EnvMap<E extends keyof EntityMap = never, AE extends keyof EntityMap = never, CE extends keyof ChildEntityMap = never> = {
|
|
17
18
|
format: Format;
|
|
18
19
|
formatNumber: FormatNumber;
|
|
20
|
+
formatDate: FormatDate;
|
|
19
21
|
translate: Translate;
|
|
20
22
|
translateMap: TranslateMap;
|
|
21
23
|
localeJoin: LocaleJoin;
|
|
@@ -30,6 +32,8 @@ export type EnvMap<E extends keyof EntityMap = never, AE extends keyof EntityMap
|
|
|
30
32
|
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
31
33
|
publicationOptions: PublicationOptions;
|
|
32
34
|
displayedInProfession: boolean;
|
|
35
|
+
measurementAdjustments: Required<LocaleMeasurementAdjustments>;
|
|
36
|
+
idMap: IdMap;
|
|
33
37
|
};
|
|
34
38
|
/**
|
|
35
39
|
* Shortcuts for selecting keys of the shared environment map type.
|
|
@@ -37,6 +41,7 @@ export type EnvMap<E extends keyof EntityMap = never, AE extends keyof EntityMap
|
|
|
37
41
|
export type EnvMapAbbr = {
|
|
38
42
|
f: "format";
|
|
39
43
|
fn: "formatNumber";
|
|
44
|
+
fd: "formatDate";
|
|
40
45
|
t: "translate";
|
|
41
46
|
tm: "translateMap";
|
|
42
47
|
lj: "localeJoin";
|
|
@@ -51,6 +56,8 @@ export type EnvMapAbbr = {
|
|
|
51
56
|
rso: "getResolvedSelectOptionById";
|
|
52
57
|
po: "publicationOptions";
|
|
53
58
|
dip: "displayedInProfession";
|
|
59
|
+
ma: "measurementAdjustments";
|
|
60
|
+
idm: "idMap";
|
|
54
61
|
};
|
|
55
62
|
/**
|
|
56
63
|
* The standard set of environment properties for readers in this project.
|
package/lib/helpers/locale.d.ts
CHANGED
|
@@ -31,3 +31,7 @@ export type LocaleJoin = (list: string[], type: LocaleJoinType) => string;
|
|
|
31
31
|
* A function that formats a number according to the locale’s rules.
|
|
32
32
|
*/
|
|
33
33
|
export type FormatNumber = (value: number) => string;
|
|
34
|
+
/**
|
|
35
|
+
* A function that formats a date according to the locale’s rules.
|
|
36
|
+
*/
|
|
37
|
+
export type FormatDate = (date: Date) => string;
|