@optolith/entity-descriptions 0.2.1 → 0.3.1
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 +58 -0
- package/lib/creator.d.ts +32 -0
- package/lib/creator.js +72 -0
- package/lib/entities/activatable.d.ts +52 -0
- package/lib/entities/activatable.js +609 -0
- package/lib/entities/alternativeRule.d.ts +7 -0
- package/lib/entities/alternativeRule.js +21 -0
- package/lib/entities/attribute.d.ts +6 -0
- package/lib/entities/attribute.js +15 -0
- package/lib/entities/combatTechnique.d.ts +5 -7
- package/lib/entities/combatTechnique.js +34 -24
- package/lib/entities/condition.d.ts +12 -0
- package/lib/entities/condition.js +63 -0
- package/lib/entities/culture.d.ts +8 -0
- package/lib/entities/culture.js +309 -0
- package/lib/entities/curriculum.d.ts +11 -0
- package/lib/entities/curriculum.js +266 -0
- package/lib/entities/derivedCharacteristic.d.ts +9 -0
- package/lib/entities/derivedCharacteristic.js +91 -0
- package/lib/entities/disease.d.ts +9 -0
- package/lib/entities/disease.js +88 -0
- package/lib/entities/elixir.d.ts +10 -0
- package/lib/entities/elixir.js +76 -0
- package/lib/entities/equipment.d.ts +24 -0
- package/lib/entities/equipment.js +613 -0
- package/lib/entities/equipmentPackage.d.ts +8 -0
- package/lib/entities/equipmentPackage.js +301 -0
- package/lib/entities/experienceLevel.d.ts +3 -2
- package/lib/entities/experienceLevel.js +33 -28
- package/lib/entities/focusRule.d.ts +3 -4
- package/lib/entities/focusRule.js +13 -5
- package/lib/entities/influence.d.ts +7 -0
- package/lib/entities/influence.js +35 -0
- package/lib/entities/liturgicalChant.d.ts +10 -23
- package/lib/entities/liturgicalChant.js +169 -131
- package/lib/entities/optionalRule.d.ts +3 -2
- package/lib/entities/optionalRule.js +4 -3
- package/lib/entities/partial/activatableNameChunks.d.ts +58 -0
- package/lib/entities/partial/activatableNameChunks.js +356 -0
- package/lib/entities/partial/adventurePointsValue.d.ts +9 -0
- package/lib/entities/partial/adventurePointsValue.js +243 -0
- package/lib/entities/partial/animalTypes.d.ts +11 -0
- package/lib/entities/partial/animalTypes.js +13 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +16 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +40 -0
- package/lib/entities/partial/dice.d.ts +10 -0
- package/lib/entities/partial/dice.js +13 -0
- package/lib/entities/partial/herbary.d.ts +28 -0
- package/lib/entities/partial/herbary.js +65 -0
- package/lib/entities/partial/map.d.ts +49 -0
- package/lib/entities/partial/map.js +43 -0
- package/lib/entities/partial/mathOperation.d.ts +36 -0
- package/lib/entities/partial/mathOperation.js +107 -0
- package/lib/entities/partial/prerequisites/displayOption.d.ts +7 -0
- package/lib/entities/partial/prerequisites/displayOption.js +19 -0
- package/lib/entities/partial/prerequisites/index.d.ts +67 -0
- package/lib/entities/partial/prerequisites/index.js +189 -0
- package/lib/entities/partial/prerequisites/part.d.ts +26 -0
- package/lib/entities/partial/prerequisites/part.js +88 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +65 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +269 -0
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +18 -0
- package/lib/entities/partial/prerequisites/single/activatable.js +40 -0
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/animistPower.js +23 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.js +32 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +19 -0
- package/lib/entities/partial/prerequisites/single/culture.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/culture.js +20 -0
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/enhancement.js +41 -0
- package/lib/entities/partial/prerequisites/single/influence.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/influence.js +17 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.js +27 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +8 -0
- package/lib/entities/partial/prerequisites/single/pact.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/pact.js +30 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.js +28 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.js +15 -0
- package/lib/entities/partial/prerequisites/single/publication.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/publication.js +19 -0
- package/lib/entities/partial/prerequisites/single/race.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/race.js +20 -0
- package/lib/entities/partial/prerequisites/single/rated.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/rated.js +41 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +89 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.js +21 -0
- package/lib/entities/partial/prerequisites/single/rule.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/rule.js +4 -0
- package/lib/entities/partial/prerequisites/single/sex.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sex.js +19 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +21 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.js +21 -0
- package/lib/entities/partial/prerequisites/single/state.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/state.js +20 -0
- package/lib/entities/partial/prerequisites/single/text.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/text.js +9 -0
- package/lib/entities/partial/professions.d.ts +15 -0
- package/lib/entities/partial/professions.js +19 -0
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +16 -7
- package/lib/entities/partial/rated/activatable/castingTime.js +35 -20
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +18 -3
- package/lib/entities/partial/rated/activatable/checkResultBased.js +18 -10
- package/lib/entities/partial/rated/activatable/cost.d.ts +88 -8
- package/lib/entities/partial/rated/activatable/cost.js +183 -115
- package/lib/entities/partial/rated/activatable/duration.d.ts +36 -13
- package/lib/entities/partial/rated/activatable/duration.js +72 -61
- package/lib/entities/partial/rated/activatable/effect.d.ts +4 -4
- package/lib/entities/partial/rated/activatable/effect.js +32 -25
- package/lib/entities/partial/rated/activatable/index.d.ts +31 -27
- package/lib/entities/partial/rated/activatable/index.js +63 -28
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +5 -6
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.js +8 -5
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +2 -4
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +7 -42
- package/lib/entities/partial/rated/activatable/range.d.ts +22 -14
- package/lib/entities/partial/rated/activatable/range.js +54 -54
- package/lib/entities/partial/rated/activatable/speed.d.ts +11 -2
- package/lib/entities/partial/rated/activatable/speed.js +14 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +4 -5
- package/lib/entities/partial/rated/activatable/targetCategory.js +19 -24
- package/lib/entities/partial/rated/improvementCost.d.ts +16 -4
- package/lib/entities/partial/rated/improvementCost.js +63 -4
- package/lib/entities/partial/rated/skillCheck.d.ts +20 -17
- package/lib/entities/partial/rated/skillCheck.js +56 -54
- package/lib/entities/partial/reader.d.ts +266 -0
- package/lib/entities/partial/reader.js +175 -0
- package/lib/entities/partial/responsiveText.d.ts +10 -5
- package/lib/entities/partial/responsiveText.js +19 -3
- package/lib/entities/partial/units/energy.d.ts +5 -8
- package/lib/entities/partial/units/energy.js +5 -23
- package/lib/entities/partial/units/length.d.ts +20 -2
- package/lib/entities/partial/units/length.js +24 -5
- package/lib/entities/partial/units/timeSpan.d.ts +25 -4
- package/lib/entities/partial/units/timeSpan.js +27 -15
- package/lib/entities/partial/unknown.d.ts +5 -1
- package/lib/entities/partial/unknown.js +5 -1
- package/lib/entities/personalityTrait.d.ts +7 -0
- package/lib/entities/personalityTrait.js +56 -0
- package/lib/entities/poison.d.ts +12 -0
- package/lib/entities/poison.js +356 -0
- package/lib/entities/profession.d.ts +12 -0
- package/lib/entities/profession.js +585 -0
- package/lib/entities/race.d.ts +9 -0
- package/lib/entities/race.js +146 -0
- package/lib/entities/sexPractice.d.ts +6 -0
- package/lib/entities/sexPractice.js +33 -0
- package/lib/entities/skill.d.ts +9 -9
- package/lib/entities/skill.js +124 -91
- package/lib/entities/spell.d.ts +83 -26
- package/lib/entities/spell.js +835 -147
- package/lib/entities/state.d.ts +6 -0
- package/lib/entities/state.js +17 -0
- package/lib/helpers/enums.d.ts +11 -0
- package/lib/helpers/enums.js +6 -0
- package/lib/helpers/getTypes.d.ts +12 -482
- package/lib/helpers/getTypes.js +1 -0
- package/lib/helpers/identifiers.d.ts +314 -0
- package/lib/helpers/identifiers.js +333 -0
- package/lib/helpers/locale.d.ts +21 -2
- package/lib/helpers/translate.d.ts +47 -5
- package/lib/helpers/translate.js +13 -6
- package/lib/index.d.ts +848 -21
- package/lib/index.js +182 -17
- package/lib/references/index.d.ts +6 -3
- package/lib/references/index.js +25 -33
- package/lib/references/page.d.ts +1 -1
- package/lib/references/page.js +14 -14
- package/lib/references/pageRange.d.ts +1 -5
- package/lib/references/pageRange.js +7 -16
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -10
- package/.prettierrc.yml +0 -1
- package/lib/entities/partial/rated/activatable/entity.d.ts +0 -11
- package/lib/entities/partial/rated/activatable/entity.js +0 -12
- package/lib/references/occurrence.d.ts +0 -4
- package/lib/references/occurrence.js +0 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isNotNullish } from "@optolith/helpers/nullable";
|
|
2
|
+
import { printDisplayOption } from "../displayOption.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get the translation of a rated sum prerequisite.
|
|
5
|
+
*/
|
|
6
|
+
export const printRatedSumPrerequisite = (getInstanceById, locale, prerequisite) => {
|
|
7
|
+
if (prerequisite.display_option !== undefined) {
|
|
8
|
+
return printDisplayOption(locale.translateMap, prerequisite.display_option);
|
|
9
|
+
}
|
|
10
|
+
const skills = prerequisite.targets
|
|
11
|
+
.map(skillId => locale.translateMap(getInstanceById("Skill", skillId)?.translations)?.name)
|
|
12
|
+
.filter(isNotNullish);
|
|
13
|
+
return {
|
|
14
|
+
value: locale.translate("the SR for {$skill} combined must add up to at least {$minRating}", {
|
|
15
|
+
skill: locale.join(skills, "conjunction"),
|
|
16
|
+
minRating: prerequisite.sum,
|
|
17
|
+
}),
|
|
18
|
+
sentenceType: undefined,
|
|
19
|
+
isMeta: false,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RulePrerequisite } from "optolith-database-schema/gen";
|
|
2
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
3
|
+
import { PrerequisitePart } from "../part.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a rule prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printRulePrerequisite: (_locale: LocaleEnvironment, _prerequisite: RulePrerequisite) => PrerequisitePart | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SexPrerequisite } from "optolith-database-schema/gen";
|
|
2
|
+
import type { Translate } from "../../../../helpers/translate.js";
|
|
3
|
+
import { PrerequisitePart } from "../part.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a (binary) sex prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printBinarySexPrerequisite: (translate: Translate, prerequisite: SexPrerequisite) => PrerequisitePart | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
2
|
+
const printId = (translate, id) => {
|
|
3
|
+
switch (id.kind) {
|
|
4
|
+
case "Male":
|
|
5
|
+
return translate("Male");
|
|
6
|
+
case "Female":
|
|
7
|
+
return translate("Female");
|
|
8
|
+
default:
|
|
9
|
+
return assertExhaustive(id);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Get the translation of a (binary) sex prerequisite.
|
|
14
|
+
*/
|
|
15
|
+
export const printBinarySexPrerequisite = (translate, prerequisite) => ({
|
|
16
|
+
value: printId(translate, prerequisite.id),
|
|
17
|
+
sentenceType: undefined,
|
|
18
|
+
isMeta: false,
|
|
19
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SexualCharacteristicPrerequisite } from "optolith-database-schema/gen";
|
|
2
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
3
|
+
import { PrerequisitePart } from "../part.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a sexual characteristic prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printSexualCharacteristicPrerequisite: (locale: LocaleEnvironment, prerequisite: SexualCharacteristicPrerequisite) => PrerequisitePart | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
2
|
+
const printId = (locale, id) => {
|
|
3
|
+
switch (id.kind) {
|
|
4
|
+
case "Penis":
|
|
5
|
+
return locale.translate("Penis");
|
|
6
|
+
case "Vagina":
|
|
7
|
+
return locale.translate("Vagina");
|
|
8
|
+
default:
|
|
9
|
+
return assertExhaustive(id);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Get the translation of a sexual characteristic prerequisite.
|
|
14
|
+
*/
|
|
15
|
+
export const printSexualCharacteristicPrerequisite = (locale, prerequisite) => ({
|
|
16
|
+
value: locale.translate("Person with {$sexualCharacteristic}", {
|
|
17
|
+
sexualCharacteristic: printId(locale, prerequisite.id),
|
|
18
|
+
}),
|
|
19
|
+
sentenceType: undefined,
|
|
20
|
+
isMeta: false,
|
|
21
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SocialStatusPrerequisite } from "optolith-database-schema/gen";
|
|
2
|
+
import { type GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
3
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
|
+
import { PrerequisitePart } from "../part.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get the translation of a social status prerequisite.
|
|
7
|
+
*/
|
|
8
|
+
export declare const printSocialStatusPrerequisite: (getInstanceById: GetInstanceById<"SocialStatus">, locale: LocaleEnvironment, prerequisite: SocialStatusPrerequisite) => PrerequisitePart | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { printDisplayOption } from "../displayOption.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get the translation of a social status prerequisite.
|
|
4
|
+
*/
|
|
5
|
+
export const printSocialStatusPrerequisite = (getInstanceById, locale, prerequisite) => {
|
|
6
|
+
if (prerequisite.display_option !== undefined) {
|
|
7
|
+
return printDisplayOption(locale.translateMap, prerequisite.display_option);
|
|
8
|
+
}
|
|
9
|
+
const socialStatus = getInstanceById("SocialStatus", prerequisite.id);
|
|
10
|
+
const socialStatusTranslation = locale.translateMap(socialStatus?.translations);
|
|
11
|
+
if (socialStatusTranslation === undefined) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
value: `${locale.translate("Social Status {$minStatus} or higher", {
|
|
16
|
+
minStatus: `*${socialStatusTranslation.name}*`,
|
|
17
|
+
})} `,
|
|
18
|
+
sentenceType: undefined,
|
|
19
|
+
isMeta: false,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StatePrerequisite } from "optolith-database-schema/gen";
|
|
2
|
+
import { type GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
3
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
|
+
import { PrerequisitePart } from "../part.js";
|
|
5
|
+
/**
|
|
6
|
+
* Get the translation of a state prerequisite.
|
|
7
|
+
*/
|
|
8
|
+
export declare const printStatePrerequisite: (getInstanceById: GetInstanceById<"State">, locale: LocaleEnvironment, prerequisite: StatePrerequisite) => PrerequisitePart | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { printDisplayOption } from "../displayOption.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get the translation of a state prerequisite.
|
|
4
|
+
*/
|
|
5
|
+
export const printStatePrerequisite = (getInstanceById, locale, prerequisite) => {
|
|
6
|
+
if (prerequisite.display_option !== undefined) {
|
|
7
|
+
return printDisplayOption(locale.translateMap, prerequisite.display_option);
|
|
8
|
+
}
|
|
9
|
+
const state = getInstanceById("State", prerequisite.id);
|
|
10
|
+
const stateTranslation = locale.translateMap(state?.translations);
|
|
11
|
+
if (stateTranslation === undefined) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
label: `${locale.translate("State")} `,
|
|
16
|
+
value: `*${stateTranslation.name}*`,
|
|
17
|
+
sentenceType: undefined,
|
|
18
|
+
isMeta: false,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextPrerequisite } from "optolith-database-schema/gen";
|
|
2
|
+
import { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
3
|
+
import { PrerequisitePart } from "../part.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get the translation of a text prerequisite.
|
|
6
|
+
*/
|
|
7
|
+
export declare const printTextPrerequisite: (locale: LocaleEnvironment, prerequisite: TextPrerequisite) => PrerequisitePart;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MISSING_VALUE } from "../../unknown.js";
|
|
2
|
+
/**
|
|
3
|
+
* Get the translation of a text prerequisite.
|
|
4
|
+
*/
|
|
5
|
+
export const printTextPrerequisite = (locale, prerequisite) => ({
|
|
6
|
+
value: locale.translateMap(prerequisite.translations)?.text ?? MISSING_VALUE,
|
|
7
|
+
sentenceType: prerequisite.sentence_type,
|
|
8
|
+
isMeta: prerequisite.is_meta ?? false,
|
|
9
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Profession_ID, ProfessionPackage } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetAllChildInstancesForParent, GetAllInstances } from "../../helpers/getTypes.js";
|
|
3
|
+
import type { TranslateMap } from "../../helpers/translate.js";
|
|
4
|
+
import type { IdMap } from "../../index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Finds the base profession package for a given curriculum.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getBaseProfessionPackageForCurriculum: (getAllInstances: GetAllInstances<"Profession">, getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionVersion" | "ProfessionPackage">, idMap: IdMap, curriculumId: string) => {
|
|
9
|
+
id: string;
|
|
10
|
+
content: ProfessionPackage;
|
|
11
|
+
} | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Gets the name of a profession, regardless of the profession version.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getProfessionName: (translateMap: TranslateMap, getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionVersion">, professionId: Profession_ID) => string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { reduceWhile } from "@elyukai/utils/array/reductions";
|
|
2
|
+
import { isNotNullish } from "@elyukai/utils/nullable";
|
|
3
|
+
/**
|
|
4
|
+
* Finds the base profession package for a given curriculum.
|
|
5
|
+
*/
|
|
6
|
+
export const getBaseProfessionPackageForCurriculum = (getAllInstances, getChildInstancesForInstanceId, idMap, curriculumId) => {
|
|
7
|
+
const baseProfession = getAllInstances("Profession").find(profession => profession.content.group.kind === "Magical" &&
|
|
8
|
+
profession.content.group.Magical.curriculum === curriculumId);
|
|
9
|
+
if (baseProfession === undefined) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return reduceWhile(getChildInstancesForInstanceId("ProfessionVersion", baseProfession.id), (_acc, version) => getChildInstancesForInstanceId("ProfessionPackage", version.id).find(professionPackage => professionPackage.content.experience_level ===
|
|
13
|
+
idMap.ExperienceLevel.Experienced), isNotNullish, undefined);
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Gets the name of a profession, regardless of the profession version.
|
|
17
|
+
*/
|
|
18
|
+
export const getProfessionName = (translateMap, getChildInstancesForInstanceId, professionId) => translateMap(getChildInstancesForInstanceId("ProfessionVersion", professionId)[0]
|
|
19
|
+
?.content.translations)?.name.default;
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import { FastCastingTime, SlowCastingTime } from "optolith-database-schema/
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CastingTime, FastCastingTime, FastSkillNonModifiableCastingTime, SlowCastingTime, SlowSkillNonModifiableCastingTime } from "optolith-database-schema/gen";
|
|
2
|
+
import { type StdReader } from "../../reader.js";
|
|
3
|
+
/**
|
|
4
|
+
* Renders the text for a non-modifiable casting time of a fast activatable skill.
|
|
5
|
+
*/
|
|
6
|
+
export declare const renderFastSkillNonModifiableCastingTime: (value: FastSkillNonModifiableCastingTime) => StdReader<string, "t" | "rts">;
|
|
7
|
+
/**
|
|
8
|
+
* Get the text for a non-modifiable casting time of a slow activatable skill.
|
|
9
|
+
*/
|
|
10
|
+
export declare const renderSlowSkillNonModifiableCastingTime: (value: SlowSkillNonModifiableCastingTime) => StdReader<string, "t" | "rts">;
|
|
11
|
+
/**
|
|
12
|
+
* Translate casting time.
|
|
13
|
+
*/
|
|
14
|
+
export declare const renderCastingTime: <NonModifiable extends object>(renderNonModifiableCastingTime: (value: NonModifiable) => StdReader<string, "t" | "rts" | "s" | "nms">, value: CastingTime<NonModifiable>) => StdReader<string, "t" | "rts" | "s" | "nms" | "ibi", "SkillModificationLevel">;
|
|
6
15
|
/**
|
|
7
16
|
* Get the text for the casting time of a fast activatable skill.
|
|
8
17
|
*/
|
|
9
|
-
export declare const
|
|
18
|
+
export declare const renderFastCastingTime: (value: FastCastingTime) => StdReader<string, "t" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
|
|
10
19
|
/**
|
|
11
20
|
* Get the text for the casting time of a slow activatable skill.
|
|
12
21
|
*/
|
|
13
|
-
export declare const
|
|
22
|
+
export declare const renderSlowCastingTime: (value: SlowCastingTime) => StdReader<string, "t" | "rts" | "nms" | "ibi", "SkillModificationLevel">;
|
|
@@ -1,35 +1,50 @@
|
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
1
2
|
import { isNotNullish, mapNullable } from "@optolith/helpers/nullable";
|
|
2
3
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
-
import {
|
|
4
|
+
import { Case } from "../../../../helpers/enums.js";
|
|
5
|
+
import { getInstanceByIdFnR, modifiableBySpeedR, } from "../../reader.js";
|
|
6
|
+
import { formatCombinedTimeSpanR, formatTimeSpanR, } from "../../units/timeSpan.js";
|
|
4
7
|
import { MISSING_VALUE } from "../../unknown.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
import { appendNonModifiableSuffix, ModifiableParameter, } from "./nonModifiableSuffix.js";
|
|
9
|
+
import { Speed } from "./speed.js";
|
|
10
|
+
const deriveModifiableCastingTime = (modificationLevelId) => getInstanceByIdFnR().thenW(getInstanceById => mapNullable(getInstanceById("SkillModificationLevel", modificationLevelId), modificationLevel => modifiableBySpeedR("casting_time", modificationLevel).map(castingTime => typeof castingTime === "number"
|
|
11
|
+
? { value: castingTime, unit: Case("Actions") }
|
|
12
|
+
: castingTime)) ?? Reader.of(undefined));
|
|
13
|
+
const renderModifiableCastingTime = (value) => deriveModifiableCastingTime(value.initial_modification_level).thenW(castingTime => castingTime === undefined
|
|
14
|
+
? Reader.of(MISSING_VALUE)
|
|
15
|
+
: formatCombinedTimeSpanR(castingTime));
|
|
16
|
+
const renderCastingTimeDuringLovemaking = (value) => formatCombinedTimeSpanR(value);
|
|
17
|
+
/**
|
|
18
|
+
* Renders the text for a non-modifiable casting time of a fast activatable skill.
|
|
19
|
+
*/
|
|
20
|
+
export const renderFastSkillNonModifiableCastingTime = (value) => formatTimeSpanR(Case("Actions"), value.actions);
|
|
21
|
+
/**
|
|
22
|
+
* Get the text for a non-modifiable casting time of a slow activatable skill.
|
|
23
|
+
*/
|
|
24
|
+
export const renderSlowSkillNonModifiableCastingTime = (value) => formatCombinedTimeSpanR(value);
|
|
25
|
+
/**
|
|
26
|
+
* Translate casting time.
|
|
27
|
+
*/
|
|
28
|
+
export const renderCastingTime = (renderNonModifiableCastingTime, value) => {
|
|
29
|
+
switch (value.kind) {
|
|
12
30
|
case "Modifiable":
|
|
13
|
-
return
|
|
31
|
+
return renderModifiableCastingTime(value.Modifiable);
|
|
14
32
|
case "NonModifiable":
|
|
15
|
-
return (
|
|
16
|
-
getNonModifiableSuffixTranslation(locale, entity, ModifiableParameter.CastingTime, responsiveTextSize));
|
|
33
|
+
return renderNonModifiableCastingTime(value.NonModifiable).then(base => appendNonModifiableSuffix(ModifiableParameter.CastingTime, base));
|
|
17
34
|
default:
|
|
18
35
|
return assertExhaustive(value);
|
|
19
36
|
}
|
|
20
37
|
};
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
mapNullable(value.
|
|
24
|
-
|
|
25
|
-
]
|
|
26
|
-
.filter(isNotNullish)
|
|
27
|
-
.join(" / ");
|
|
38
|
+
const renderCastingTimeIncludingLovemaking = (renderNonModifiableCastingTime, value) => Reader.sequence([
|
|
39
|
+
mapNullable(value.default, def => renderCastingTime(renderNonModifiableCastingTime, def)) ?? Reader.of(undefined),
|
|
40
|
+
mapNullable(value.during_lovemaking, renderCastingTimeDuringLovemaking) ??
|
|
41
|
+
Reader.of(undefined),
|
|
42
|
+
]).map(texts => texts.filter(isNotNullish).join(" / "));
|
|
28
43
|
/**
|
|
29
44
|
* Get the text for the casting time of a fast activatable skill.
|
|
30
45
|
*/
|
|
31
|
-
export const
|
|
46
|
+
export const renderFastCastingTime = (value) => renderCastingTimeIncludingLovemaking(renderFastSkillNonModifiableCastingTime, value).with(env => ({ ...env, speed: Speed.Fast }));
|
|
32
47
|
/**
|
|
33
48
|
* Get the text for the casting time of a slow activatable skill.
|
|
34
49
|
*/
|
|
35
|
-
export const
|
|
50
|
+
export const renderSlowCastingTime = (value) => renderCastingTimeIncludingLovemaking(renderSlowSkillNonModifiableCastingTime, value).with(env => ({ ...env, speed: Speed.Slow }));
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CheckResultBasedModifier, CheckResultValue } from "optolith-database-schema/gen";
|
|
2
|
+
import { type StdReader } from "../../reader.js";
|
|
3
|
+
interface CheckResultBased {
|
|
4
|
+
/**
|
|
5
|
+
* The base value that is derived from the check result.
|
|
6
|
+
*/
|
|
7
|
+
base: CheckResultValue;
|
|
8
|
+
/**
|
|
9
|
+
* If defined, it modifies the base value.
|
|
10
|
+
*/
|
|
11
|
+
modifier?: CheckResultBasedModifier;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Appends the modifier of a check-result-based parameter of an activatable skill to the base value, using the appropriate arithmetic formatter.
|
|
15
|
+
*/
|
|
16
|
+
export declare const appendCheckResultModifier: (left: string, modifier: CheckResultBasedModifier) => string;
|
|
3
17
|
/**
|
|
4
18
|
* Returns the value text for a check-result-based parameter of an activatable
|
|
5
19
|
* skill.
|
|
6
20
|
*/
|
|
7
|
-
export declare const
|
|
21
|
+
export declare const renderCheckResultBasedValue: (value: CheckResultBased) => StdReader<string, "t">;
|
|
22
|
+
export {};
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
import { mapNullableDefault } from "@optolith/helpers/nullable";
|
|
2
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { divisionFormatter, multiplicationFormatter, } from "../../mathOperation.js";
|
|
4
|
+
import { translateR } from "../../reader.js";
|
|
5
|
+
const renderCheckResultBaseValue = (baseValue) => {
|
|
6
|
+
switch (baseValue.kind) {
|
|
5
7
|
case "QualityLevels":
|
|
6
|
-
return
|
|
8
|
+
return translateR("QL");
|
|
7
9
|
case "SkillPoints":
|
|
8
|
-
return
|
|
10
|
+
return translateR("SP");
|
|
9
11
|
default:
|
|
10
12
|
return assertExhaustive(baseValue);
|
|
11
13
|
}
|
|
12
14
|
};
|
|
13
|
-
const
|
|
14
|
-
switch (arithmetic) {
|
|
15
|
+
const getArithmeticFormatter = (arithmetic) => {
|
|
16
|
+
switch (arithmetic.kind) {
|
|
15
17
|
case "Divide":
|
|
16
|
-
return
|
|
18
|
+
return divisionFormatter;
|
|
17
19
|
case "Multiply":
|
|
18
|
-
return
|
|
20
|
+
return multiplicationFormatter;
|
|
19
21
|
default:
|
|
20
22
|
return assertExhaustive(arithmetic);
|
|
21
23
|
}
|
|
22
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Appends the modifier of a check-result-based parameter of an activatable skill to the base value, using the appropriate arithmetic formatter.
|
|
27
|
+
*/
|
|
28
|
+
export const appendCheckResultModifier = (left, modifier) => {
|
|
29
|
+
const formatter = getArithmeticFormatter(modifier.arithmetic);
|
|
30
|
+
return formatter(left, modifier.value);
|
|
31
|
+
};
|
|
23
32
|
/**
|
|
24
33
|
* Returns the value text for a check-result-based parameter of an activatable
|
|
25
34
|
* skill.
|
|
26
35
|
*/
|
|
27
|
-
export const
|
|
28
|
-
mapNullableDefault(value.modifier, (modifier) => getArithmeticSymbol(modifier.arithmetic) + modifier.value, "");
|
|
36
|
+
export const renderCheckResultBasedValue = (value) => renderCheckResultBaseValue(value.base).map(base => mapNullableDefault(value.modifier, modifier => appendCheckResultModifier(base, modifier), base));
|
|
@@ -1,14 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Reader } from "@elyukai/utils/reader";
|
|
2
|
+
import { NonModifiableSustainedCost, OneTimeCost, SustainedCost, type CheckResultBasedModifier, type DurationUnitValue, type ElvenMagicalSongPermanentCost, type FirstPersonMagicalMelodyCost, type NonModifiableOneTimeCostPerCountable, type OneTimeCostMap, type ResponsiveText, type ResponsiveTextOptional, type ResponsiveTextReplace, type SkillModificationLevel_ID } from "optolith-database-schema/gen";
|
|
3
|
+
import { type LocaleMap } from "../../../../helpers/translate.js";
|
|
4
|
+
import { type StdEnv, type StdReader } from "../../reader.js";
|
|
5
|
+
/**
|
|
6
|
+
* Returns the text for the modifiable one-time cost of an activatable skill.
|
|
7
|
+
*/
|
|
8
|
+
export declare const renderModifiableOneTimeCost: (value: {
|
|
9
|
+
initial_modification_level: SkillModificationLevel_ID;
|
|
10
|
+
permanent_value?: number;
|
|
11
|
+
translations?: LocaleMap<{
|
|
12
|
+
replacement?: ResponsiveTextReplace;
|
|
13
|
+
additional?: ResponsiveText;
|
|
14
|
+
}>;
|
|
15
|
+
}) => StdReader<string, "t" | "tm" | "rts" | "eu" | "s" | "ibi", "SkillModificationLevel">;
|
|
16
|
+
type NonModifiableOneTimeCost = {
|
|
17
|
+
is_minimum?: boolean;
|
|
18
|
+
value: number;
|
|
19
|
+
lp_value?: number;
|
|
20
|
+
permanent_value?: number;
|
|
21
|
+
interval?: DurationUnitValue;
|
|
22
|
+
permanent?: ElvenMagicalSongPermanentCost;
|
|
23
|
+
per?: NonModifiableOneTimeCostPerCountable;
|
|
24
|
+
translations?: LocaleMap<{
|
|
25
|
+
note?: ResponsiveTextOptional;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Returns the text for a non-modifiable one-time cost of an activatable skill.
|
|
30
|
+
*/
|
|
31
|
+
export declare const renderNonModifiableOneTimeCost: (value: NonModifiableOneTimeCost, shouldAppendNonModifiableSuffix: boolean) => StdReader<string, "t" | "tm" | "rts" | "eu" | "nms" | "lj">;
|
|
32
|
+
type IndefiniteCost = {
|
|
33
|
+
modifier?: CheckResultBasedModifier;
|
|
34
|
+
translations: LocaleMap<{
|
|
35
|
+
description: ResponsiveText;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Returns the text for the indefinite cost of an activatable skill.
|
|
40
|
+
*/
|
|
41
|
+
export declare const renderIndefiniteCost: (value: IndefiniteCost, shouldAppendNonModifiableSuffix: boolean) => StdReader<string, "t" | "tm" | "rts" | "eu" | "nms">;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the text for a one-time cost map of an activatable skill.
|
|
44
|
+
*/
|
|
45
|
+
export declare const renderOneTimeCostMap: (value: OneTimeCostMap) => StdReader<string, "t" | "tm" | "rts" | "nms" | "eu">;
|
|
7
46
|
/**
|
|
8
47
|
* Returns the text for the cost of a one-time activatable skill.
|
|
9
48
|
*/
|
|
10
|
-
export declare const
|
|
49
|
+
export declare const renderOneTimeCost: (value: OneTimeCost) => StdReader<string, "t" | "tm" | "lj" | "rts" | "eu" | "s" | "nms" | "ibi", "SkillModificationLevel">;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the text for the non-modifiable cost of a sustained activatable skill.
|
|
52
|
+
*/
|
|
53
|
+
export declare const renderNonModifiableSustainedCost: (value: NonModifiableSustainedCost) => Reader<{
|
|
54
|
+
translate: import("../../../../helpers/translate.js").Translate;
|
|
55
|
+
energyUnit: import("../../units/energy.js").EnergyUnit;
|
|
56
|
+
} & {
|
|
57
|
+
translate: import("../../../../helpers/translate.js").Translate;
|
|
58
|
+
responsiveTextSize: import("../../responsiveText.js").ResponsiveTextSize;
|
|
59
|
+
} & StdEnv<"t" | "rts" | "tm" | "eu", never, never, never>, string>;
|
|
11
60
|
/**
|
|
12
61
|
* Returns the text for the cost of a sustained activatable skill.
|
|
13
62
|
*/
|
|
14
|
-
export declare const
|
|
63
|
+
export declare const renderSustainedCost: (value: SustainedCost) => StdReader<string, "t" | "tm" | "rts" | "eu" | "s" | "nms" | "ibi", "SkillModificationLevel">;
|
|
64
|
+
type MagicalActionCost = {
|
|
65
|
+
kind: "Fixed";
|
|
66
|
+
Fixed: NonModifiableOneTimeCost;
|
|
67
|
+
} | {
|
|
68
|
+
kind: "Indefinite";
|
|
69
|
+
Indefinite: IndefiniteCost;
|
|
70
|
+
} | {
|
|
71
|
+
kind: "FirstPerson";
|
|
72
|
+
FirstPerson: FirstPersonMagicalMelodyCost;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "ByPrimaryPatron";
|
|
75
|
+
ByPrimaryPatron?: {
|
|
76
|
+
interval?: DurationUnitValue;
|
|
77
|
+
translations?: LocaleMap<{
|
|
78
|
+
note: ResponsiveTextOptional;
|
|
79
|
+
}>;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
kind: "All";
|
|
83
|
+
All: {
|
|
84
|
+
minimum?: number;
|
|
85
|
+
};
|
|
86
|
+
} | {
|
|
87
|
+
kind: "Map";
|
|
88
|
+
Map: OneTimeCostMap;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Generates the text for the cost specific to a magical action.
|
|
92
|
+
*/
|
|
93
|
+
export declare const renderMagicalActionCost: (cost: MagicalActionCost) => StdReader<string, "t" | "tm" | "rts" | "eu" | "nms" | "lj">;
|
|
94
|
+
export {};
|