@optolith/entity-descriptions 0.11.0 → 0.11.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 +11 -0
- package/lib/entities/activatable.d.ts +2 -1
- package/lib/entities/activatable.js +34 -13
- package/lib/entities/disease.d.ts +1 -1
- package/lib/entities/equipment.d.ts +1 -1
- package/lib/entities/partial/rated/activatable/cost.d.ts +2 -2
- package/lib/entities/partial/rated/activatable/targetCategory.js +2 -5
- package/lib/entities/partial/reader.d.ts +1 -1
- package/lib/entities/partial/responsiveText.d.ts +1 -1
- package/lib/index.d.ts +88 -88
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/entities/partial/prerequisites/single/anyActivatableOfGroup.d.ts +0 -7
- package/lib/entities/partial/prerequisites/single/anyActivatableOfGroup.js +0 -16
- package/lib/entities/partial/prerequisites/single/rated copy.d.ts +0 -8
- package/lib/entities/partial/prerequisites/single/rated copy.js +0 -17
- package/lib/entities/partial/prerequisites/single/tinyActivatable copy.d.ts +0 -7
- package/lib/entities/partial/prerequisites/single/tinyActivatable copy.js +0 -16
- package/lib/helpers/publicationOptions.d.ts +0 -42
- package/lib/helpers/publicationOptions.js +0 -64
package/package.json
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TinyActivatablePrerequisite } from "@optolith/database-schema/gen";
|
|
2
|
-
import { type StdReader } from "../../reader.js";
|
|
3
|
-
import type { PrerequisitePart } from "../part.js";
|
|
4
|
-
/**
|
|
5
|
-
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
-
*/
|
|
7
|
-
export declare const printTinyActivatablePrerequisite: (prerequisite: TinyActivatablePrerequisite) => StdReader<PrerequisitePart | undefined, "tm" | "ibi", "Blessing" | "Cantrip">;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { attributedCustomNameR } from "../../reader.js";
|
|
2
|
-
import { MISSING_VALUE } from "../../unknown.js";
|
|
3
|
-
import { printDisplayOptionR } from "../displayOption.js";
|
|
4
|
-
/**
|
|
5
|
-
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
-
*/
|
|
7
|
-
export const printTinyActivatablePrerequisite = (prerequisite) => {
|
|
8
|
-
if (prerequisite.display_option !== undefined) {
|
|
9
|
-
return printDisplayOptionR(prerequisite.display_option);
|
|
10
|
-
}
|
|
11
|
-
return attributedCustomNameR("prerequisite", (t) => t.abbreviation ?? t.name, prerequisite.id).map(name => ({
|
|
12
|
-
value: name ?? MISSING_VALUE,
|
|
13
|
-
sentenceType: undefined,
|
|
14
|
-
isMeta: false,
|
|
15
|
-
}));
|
|
16
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RatedPrerequisite } from "@optolith/database-schema/gen";
|
|
2
|
-
import { type GetInstanceById } from "../../../../helpers/getTypes.js";
|
|
3
|
-
import type { LocaleEnvironment } from "../../../../helpers/locale.js";
|
|
4
|
-
import type { PrerequisitePart } from "../part.js";
|
|
5
|
-
/**
|
|
6
|
-
* Get the translation of a blessed tradition prerequisite.
|
|
7
|
-
*/
|
|
8
|
-
export declare const printRatedPrerequisite: (getInstanceById: GetInstanceById<"Attribute" | "Skill" | "CloseCombatTechnique" | "RangedCombatTechnique" | "Spell" | "Ritual" | "LiturgicalChant" | "Ceremony">, locale: Pick<LocaleEnvironment, "translateMap">, prerequisite: RatedPrerequisite) => PrerequisitePart | undefined;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { attributedCustomName } from "../../markdown.js";
|
|
2
|
-
import { MISSING_VALUE } from "../../unknown.js";
|
|
3
|
-
import { printDisplayOption } from "../displayOption.js";
|
|
4
|
-
/**
|
|
5
|
-
* Get the translation of a blessed tradition prerequisite.
|
|
6
|
-
*/
|
|
7
|
-
export const printRatedPrerequisite = (getInstanceById, locale, prerequisite) => {
|
|
8
|
-
if (prerequisite.display_option !== undefined) {
|
|
9
|
-
return printDisplayOption(locale.translateMap, prerequisite.display_option);
|
|
10
|
-
}
|
|
11
|
-
const name = attributedCustomName(locale.translateMap, getInstanceById, "prerequisite", (t) => t.abbreviation ?? t.name, prerequisite.id) ?? MISSING_VALUE;
|
|
12
|
-
return {
|
|
13
|
-
value: prerequisite.value > 0 ? `${name} ${prerequisite.value.toFixed()}` : name,
|
|
14
|
-
sentenceType: undefined,
|
|
15
|
-
isMeta: false,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { TinyActivatablePrerequisite } from "@optolith/database-schema/gen";
|
|
2
|
-
import { type StdReader } from "../../reader.js";
|
|
3
|
-
import type { PrerequisitePart } from "../part.js";
|
|
4
|
-
/**
|
|
5
|
-
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
-
*/
|
|
7
|
-
export declare const printTinyActivatablePrerequisite: (prerequisite: TinyActivatablePrerequisite) => StdReader<PrerequisitePart | undefined, "tm" | "ibi", "Blessing" | "Cantrip">;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { attributedCustomNameR } from "../../reader.js";
|
|
2
|
-
import { MISSING_VALUE } from "../../unknown.js";
|
|
3
|
-
import { printDisplayOptionR } from "../displayOption.js";
|
|
4
|
-
/**
|
|
5
|
-
* Get the translation of a tiny activatable prerequisite.
|
|
6
|
-
*/
|
|
7
|
-
export const printTinyActivatablePrerequisite = (prerequisite) => {
|
|
8
|
-
if (prerequisite.display_option !== undefined) {
|
|
9
|
-
return printDisplayOptionR(prerequisite.display_option);
|
|
10
|
-
}
|
|
11
|
-
return attributedCustomNameR("prerequisite", (t) => t.abbreviation ?? t.name, prerequisite.id).map(name => ({
|
|
12
|
-
value: name ?? MISSING_VALUE,
|
|
13
|
-
sentenceType: undefined,
|
|
14
|
-
isMeta: false,
|
|
15
|
-
}));
|
|
16
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Publication, Publication_ID } from "@optolith/database-schema/gen";
|
|
2
|
-
import type { GetInstanceById } from "./getTypes.js";
|
|
3
|
-
/**
|
|
4
|
-
* Options for how to render information from different publications in entity descriptions.
|
|
5
|
-
*/
|
|
6
|
-
export type PublicationOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* A list of publications to include, identified by their ID. These will always be included no matter the settings in `showPublicationGroups`.
|
|
9
|
-
*/
|
|
10
|
-
publications: Publication_ID[];
|
|
11
|
-
/**
|
|
12
|
-
* Which publication groups to include, no matter if they are explicitly referenced or not.
|
|
13
|
-
*
|
|
14
|
-
* - `"none"`: No groups, only explicitly referenced publications
|
|
15
|
-
* - `"core"`: Core rules
|
|
16
|
-
* - `"playerOriented"`: Core rules and player-oriented supplements, excluding books with adult content and adventure books.
|
|
17
|
-
* - `"playerOrientedWithAdult"`: Core rules and player-oriented supplements, excluding adventure books but including books with adult content.
|
|
18
|
-
* - `"playerOrientedWithAdventures"`: Core rules and player-oriented supplements, including adventure books but excluding books with adult content.
|
|
19
|
-
* - `"all"`: All groups, including books with adult content and adventure books. Any explicit publication references will have no effect as all publications are included anyway.
|
|
20
|
-
*/
|
|
21
|
-
showPublicationGroups: "none" | "core" | "playerOriented" | "playerOrientedWithAdult" | "playerOrientedWithAdventures" | "all";
|
|
22
|
-
/**
|
|
23
|
-
* How to handle different printings of the same publication.
|
|
24
|
-
*
|
|
25
|
-
* - `"none"`: No handling, new and removed entries are treated equally.
|
|
26
|
-
* - `"latestOnly"`: Only the latest printing of a publication is included, older revisions are ignored.
|
|
27
|
-
* - `Record<Publication_ID, number>`: A custom handling for each publication, where the number indicates the printing to include.
|
|
28
|
-
*/
|
|
29
|
-
printingHandling: "none" | "latestOnly" | Record<Publication_ID, number>;
|
|
30
|
-
/**
|
|
31
|
-
* If true, only publication references to publications included via `publications` and `showPublicationGroups` will be shown.
|
|
32
|
-
*/
|
|
33
|
-
onlyShowReferencesToIncludedPublications: boolean;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export declare const isPublicationIncluded: (publicationOptions: PublicationOptions, publicationId: Publication_ID, publication: Publication) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
export declare const isPublicationIncludedById: (getInstanceById: GetInstanceById<"Publication">, publicationOptions: PublicationOptions, publicationId: Publication_ID) => boolean;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
2
|
-
const isPublicationIncludedInGroup = (publication, publicationOptions) => {
|
|
3
|
-
switch (publicationOptions.showPublicationGroups) {
|
|
4
|
-
case "none":
|
|
5
|
-
return false;
|
|
6
|
-
case "core":
|
|
7
|
-
switch (publication.category.kind) {
|
|
8
|
-
case "CoreRules":
|
|
9
|
-
return true;
|
|
10
|
-
case "ExpansionRules":
|
|
11
|
-
case "Sourcebook":
|
|
12
|
-
case "RegionalSourcebook":
|
|
13
|
-
case "Adventure":
|
|
14
|
-
return false;
|
|
15
|
-
default:
|
|
16
|
-
return assertExhaustive(publication.category);
|
|
17
|
-
}
|
|
18
|
-
case "playerOriented":
|
|
19
|
-
switch (publication.category.kind) {
|
|
20
|
-
case "CoreRules":
|
|
21
|
-
case "ExpansionRules":
|
|
22
|
-
case "Sourcebook":
|
|
23
|
-
case "RegionalSourcebook":
|
|
24
|
-
return !publication.containsAdultContent;
|
|
25
|
-
case "Adventure":
|
|
26
|
-
return false;
|
|
27
|
-
default:
|
|
28
|
-
return assertExhaustive(publication.category);
|
|
29
|
-
}
|
|
30
|
-
case "playerOrientedWithAdult":
|
|
31
|
-
switch (publication.category.kind) {
|
|
32
|
-
case "CoreRules":
|
|
33
|
-
case "ExpansionRules":
|
|
34
|
-
case "Sourcebook":
|
|
35
|
-
case "RegionalSourcebook":
|
|
36
|
-
return true;
|
|
37
|
-
case "Adventure":
|
|
38
|
-
return false;
|
|
39
|
-
default:
|
|
40
|
-
return assertExhaustive(publication.category);
|
|
41
|
-
}
|
|
42
|
-
case "playerOrientedWithAdventures":
|
|
43
|
-
return !publication.containsAdultContent;
|
|
44
|
-
case "all":
|
|
45
|
-
return true;
|
|
46
|
-
default:
|
|
47
|
-
return assertExhaustive(publicationOptions.showPublicationGroups);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
export const isPublicationIncluded = (publicationOptions, publicationId, publication) => publicationOptions.publications.includes(publicationId) ||
|
|
54
|
-
isPublicationIncludedInGroup(publication, publicationOptions);
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
export const isPublicationIncludedById = (getInstanceById, publicationOptions, publicationId) => {
|
|
59
|
-
const publication = getInstanceById("Publication", publicationId);
|
|
60
|
-
if (publication === undefined) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return isPublicationIncluded(publicationOptions, publicationId, publication);
|
|
64
|
-
};
|