@optolith/entity-descriptions 0.2.1 → 0.3.2
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 +65 -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 +605 -0
- package/lib/entities/equipmentPackage.d.ts +8 -0
- package/lib/entities/equipmentPackage.js +300 -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 +11 -0
- package/lib/entities/influence.js +43 -0
- package/lib/entities/liturgicalChant.d.ts +13 -23
- package/lib/entities/liturgicalChant.js +171 -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/enhancements.d.ts +7 -0
- package/lib/entities/partial/enhancements.js +26 -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 +278 -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/profession.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/profession.js +19 -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 +8 -4
- package/lib/entities/partial/rated/improvementCost.js +9 -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 +368 -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 +86 -26
- package/lib/entities/spell.js +842 -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 +854 -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 +31 -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,300 @@
|
|
|
1
|
+
import { on } from "@elyukai/utils/function";
|
|
2
|
+
import { assertExhaustive } from "@elyukai/utils/typeSafety";
|
|
3
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
4
|
+
import { getEquipmentName } from "./equipment.js";
|
|
5
|
+
const sumAtomicEquipmentCost = (acc, current) => {
|
|
6
|
+
if (typeof acc === "string") {
|
|
7
|
+
return acc;
|
|
8
|
+
}
|
|
9
|
+
if (typeof current === "string") {
|
|
10
|
+
return current;
|
|
11
|
+
}
|
|
12
|
+
if (Array.isArray(current)) {
|
|
13
|
+
if (Array.isArray(acc)) {
|
|
14
|
+
return [acc[0] + current[0], acc[1] + current[1]];
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return [acc + current[0], acc + current[1]];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else if (Array.isArray(acc)) {
|
|
21
|
+
return [acc[0] + current, acc[1] + current];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return acc + current;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const sumAtomicEquipmentWeight = (acc, current) => {
|
|
28
|
+
if (Array.isArray(current)) {
|
|
29
|
+
if (Array.isArray(acc)) {
|
|
30
|
+
return [acc[0] + current[0], acc[1] + current[1]];
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return [acc + current[0], acc + current[1]];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else if (Array.isArray(acc)) {
|
|
37
|
+
return [acc[0] + current, acc[1] + current];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return acc + current;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const rangeAtomicEquipmentCost = (acc, current) => {
|
|
44
|
+
if (typeof acc === "string") {
|
|
45
|
+
return acc;
|
|
46
|
+
}
|
|
47
|
+
if (typeof current === "string") {
|
|
48
|
+
return current;
|
|
49
|
+
}
|
|
50
|
+
const normAcc = typeof acc === "number" ? [acc, acc] : acc;
|
|
51
|
+
const normCurrent = typeof current === "number" ? [current, current] : current;
|
|
52
|
+
return [Math.min(normAcc[0], normCurrent[0]), Math.max(normAcc[1], normCurrent[1])];
|
|
53
|
+
};
|
|
54
|
+
const getAtomicCost = (cost) => {
|
|
55
|
+
switch (cost.kind) {
|
|
56
|
+
case "Free":
|
|
57
|
+
return 0;
|
|
58
|
+
case "Various":
|
|
59
|
+
return "Various";
|
|
60
|
+
case "Invaluable":
|
|
61
|
+
return "Invaluable";
|
|
62
|
+
case "Fixed":
|
|
63
|
+
return cost.Fixed.value;
|
|
64
|
+
case "Range":
|
|
65
|
+
return [cost.Range.from, cost.Range.to];
|
|
66
|
+
default:
|
|
67
|
+
return assertExhaustive(cost);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const getAtomicEquipmentCost = (entry) => {
|
|
71
|
+
switch (entry.entity) {
|
|
72
|
+
case "AnimalCare":
|
|
73
|
+
switch (entry.content.type.kind) {
|
|
74
|
+
case "General":
|
|
75
|
+
return getAtomicCost(entry.content.type.General.cost);
|
|
76
|
+
case "Feed":
|
|
77
|
+
return entry.content.type.Feed.cost.PerWeek.value;
|
|
78
|
+
default:
|
|
79
|
+
return assertExhaustive(entry.content.type);
|
|
80
|
+
}
|
|
81
|
+
case "Book": {
|
|
82
|
+
switch (entry.content.cost.kind) {
|
|
83
|
+
case "Single":
|
|
84
|
+
switch (entry.content.cost.Single.kind) {
|
|
85
|
+
case "Definite":
|
|
86
|
+
return getAtomicCost(entry.content.cost.Single.Definite.cost);
|
|
87
|
+
case "Indefinite":
|
|
88
|
+
return "Various";
|
|
89
|
+
default:
|
|
90
|
+
return assertExhaustive(entry.content.cost.Single);
|
|
91
|
+
}
|
|
92
|
+
case "Multiple":
|
|
93
|
+
return (entry.content.cost.Multiple.reduce((acc, cost) => {
|
|
94
|
+
if (typeof acc === "string") {
|
|
95
|
+
return acc;
|
|
96
|
+
}
|
|
97
|
+
switch (cost.kind) {
|
|
98
|
+
case "Definite":
|
|
99
|
+
return acc === null
|
|
100
|
+
? getAtomicCost(cost.Definite.cost)
|
|
101
|
+
: rangeAtomicEquipmentCost(acc, getAtomicCost(cost.Definite.cost));
|
|
102
|
+
case "Indefinite":
|
|
103
|
+
return "Various";
|
|
104
|
+
default:
|
|
105
|
+
return assertExhaustive(cost);
|
|
106
|
+
}
|
|
107
|
+
}, null) ?? 0);
|
|
108
|
+
default:
|
|
109
|
+
return assertExhaustive(entry.content.cost);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
case "Jewelry": {
|
|
113
|
+
const costs = [
|
|
114
|
+
entry.content.cost.bronze,
|
|
115
|
+
entry.content.cost.silver,
|
|
116
|
+
entry.content.cost.gold,
|
|
117
|
+
];
|
|
118
|
+
return costs.map(getAtomicCost).reduce(rangeAtomicEquipmentCost);
|
|
119
|
+
}
|
|
120
|
+
case "Ammunition":
|
|
121
|
+
case "Animal":
|
|
122
|
+
case "Armor":
|
|
123
|
+
case "BandageOrRemedy":
|
|
124
|
+
case "CeremonialItem":
|
|
125
|
+
case "Clothes":
|
|
126
|
+
case "ClothingPackage":
|
|
127
|
+
case "Container":
|
|
128
|
+
case "EquipmentOfBlessedOnes":
|
|
129
|
+
case "GemOrPreciousStone":
|
|
130
|
+
case "IlluminationLightSource":
|
|
131
|
+
case "IlluminationRefillOrSupply":
|
|
132
|
+
case "Laboratory":
|
|
133
|
+
case "Liebesspielzeug":
|
|
134
|
+
case "LuxuryGood":
|
|
135
|
+
case "MagicalArtifact":
|
|
136
|
+
case "MusicalInstrument":
|
|
137
|
+
case "Newspaper":
|
|
138
|
+
case "OrienteeringAid":
|
|
139
|
+
case "RopeOrChain":
|
|
140
|
+
case "Stationery":
|
|
141
|
+
case "ThievesTool":
|
|
142
|
+
case "ToolOfTheTrade":
|
|
143
|
+
case "TravelGearOrTool":
|
|
144
|
+
case "Vehicle":
|
|
145
|
+
case "Weapon":
|
|
146
|
+
case "WeaponAccessory":
|
|
147
|
+
case "WorkingSupernaturalCreature":
|
|
148
|
+
return getAtomicCost(entry.content.cost);
|
|
149
|
+
case "Elixir":
|
|
150
|
+
return [entry.content.cost_per_ingredient_level, entry.content.cost_per_ingredient_level * 6];
|
|
151
|
+
case "Poison":
|
|
152
|
+
switch (entry.content.cost?.kind) {
|
|
153
|
+
case undefined:
|
|
154
|
+
case "CannotBeExtracted":
|
|
155
|
+
case "None":
|
|
156
|
+
return 0;
|
|
157
|
+
case "Constant":
|
|
158
|
+
return entry.content.cost.Constant;
|
|
159
|
+
case "Indefinite":
|
|
160
|
+
return "Various";
|
|
161
|
+
case "DependingOnPurchaseOrSale":
|
|
162
|
+
return entry.content.cost.DependingOnPurchaseOrSale.purchase;
|
|
163
|
+
default:
|
|
164
|
+
return assertExhaustive(entry.content.cost);
|
|
165
|
+
}
|
|
166
|
+
default:
|
|
167
|
+
return assertExhaustive(entry);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const getAtomicEquipmentWeight = (entry) => {
|
|
171
|
+
switch (entry.entity) {
|
|
172
|
+
case "Ammunition":
|
|
173
|
+
case "Animal":
|
|
174
|
+
case "ClothingPackage":
|
|
175
|
+
case "Elixir":
|
|
176
|
+
case "EquipmentOfBlessedOnes":
|
|
177
|
+
case "Newspaper":
|
|
178
|
+
case "Poison":
|
|
179
|
+
case "WorkingSupernaturalCreature":
|
|
180
|
+
return 0;
|
|
181
|
+
case "AnimalCare":
|
|
182
|
+
switch (entry.content.type.kind) {
|
|
183
|
+
case "General":
|
|
184
|
+
return entry.content.type.General.weight;
|
|
185
|
+
case "Feed":
|
|
186
|
+
return 0;
|
|
187
|
+
default:
|
|
188
|
+
return assertExhaustive(entry.content.type);
|
|
189
|
+
}
|
|
190
|
+
case "Jewelry": {
|
|
191
|
+
const values = Object.values(entry.content.weight);
|
|
192
|
+
return [Math.min(...values), Math.max(...values)];
|
|
193
|
+
}
|
|
194
|
+
case "Armor":
|
|
195
|
+
case "BandageOrRemedy":
|
|
196
|
+
case "Book":
|
|
197
|
+
case "CeremonialItem":
|
|
198
|
+
case "Clothes":
|
|
199
|
+
case "Container":
|
|
200
|
+
case "GemOrPreciousStone":
|
|
201
|
+
case "IlluminationLightSource":
|
|
202
|
+
case "IlluminationRefillOrSupply":
|
|
203
|
+
case "Laboratory":
|
|
204
|
+
case "Liebesspielzeug":
|
|
205
|
+
case "LuxuryGood":
|
|
206
|
+
case "MagicalArtifact":
|
|
207
|
+
case "MusicalInstrument":
|
|
208
|
+
case "OrienteeringAid":
|
|
209
|
+
case "RopeOrChain":
|
|
210
|
+
case "Stationery":
|
|
211
|
+
case "ThievesTool":
|
|
212
|
+
case "ToolOfTheTrade":
|
|
213
|
+
case "TravelGearOrTool":
|
|
214
|
+
case "Vehicle":
|
|
215
|
+
case "Weapon":
|
|
216
|
+
case "WeaponAccessory":
|
|
217
|
+
return entry.content.weight ?? 0;
|
|
218
|
+
default:
|
|
219
|
+
return assertExhaustive(entry);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
const renderAtomicCost = (translate, cost) => {
|
|
223
|
+
if (typeof cost === "number") {
|
|
224
|
+
return translate(".input {$value :number} {{{$value} silverthalers}}", {
|
|
225
|
+
value: cost,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
else if (typeof cost === "string") {
|
|
229
|
+
switch (cost) {
|
|
230
|
+
case "Various":
|
|
231
|
+
return translate("various");
|
|
232
|
+
case "Invaluable":
|
|
233
|
+
return translate("invaluable");
|
|
234
|
+
default:
|
|
235
|
+
return assertExhaustive(cost);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
return translate(".input {$from :number} .input {$to :number} {{{$from}–{$to} silverthalers}}", {
|
|
240
|
+
from: cost[0],
|
|
241
|
+
to: cost[1],
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const renderAtomicWeight = (translate, measurements, cost) => {
|
|
246
|
+
if (typeof cost === "number") {
|
|
247
|
+
return translate(".input {$value :number} {{{$value} pounds}}", {
|
|
248
|
+
value: measurements.stonesMultiplier * cost,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
return translate(".input {$from :number} .input {$to :number} {{{$from}–{$to} pounds}}", {
|
|
253
|
+
from: measurements.stonesMultiplier * cost[0],
|
|
254
|
+
to: measurements.stonesMultiplier * cost[1],
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Get a JSON representation of the rules text for an equipment package.
|
|
260
|
+
*/
|
|
261
|
+
export const getEquipmentPackageEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, locale, { content }) => {
|
|
262
|
+
const { translate, translateMap } = locale;
|
|
263
|
+
const translation = translateMap(content.translations);
|
|
264
|
+
if (translation === undefined) {
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
const actualItems = content.items
|
|
268
|
+
?.map(item => ({
|
|
269
|
+
...item,
|
|
270
|
+
content: { entity: item.id.kind, content: getInstanceById(item.id) },
|
|
271
|
+
}))
|
|
272
|
+
.filter((item) => item.content !== undefined) ?? [];
|
|
273
|
+
return {
|
|
274
|
+
title: translation.name,
|
|
275
|
+
className: "equipment-package",
|
|
276
|
+
body: [
|
|
277
|
+
{
|
|
278
|
+
type: "table",
|
|
279
|
+
header: [translation.name, translate("Weight"), translate("Cost")],
|
|
280
|
+
rows: actualItems
|
|
281
|
+
.map((item) => [
|
|
282
|
+
getEquipmentName(translate, translateMap, getInstanceById, item.content),
|
|
283
|
+
renderAtomicWeight(translate, locale.measurementAdjustments, getAtomicEquipmentWeight(item.content)),
|
|
284
|
+
renderAtomicCost(translate, getAtomicEquipmentCost(item.content)),
|
|
285
|
+
])
|
|
286
|
+
.toSorted(on(item => item[0], locale.compare)),
|
|
287
|
+
footer: [
|
|
288
|
+
translate("Total"),
|
|
289
|
+
renderAtomicWeight(translate, locale.measurementAdjustments, actualItems
|
|
290
|
+
.map(item => getAtomicEquipmentWeight(item.content))
|
|
291
|
+
.reduce(sumAtomicEquipmentWeight, 0)),
|
|
292
|
+
renderAtomicCost(translate, actualItems
|
|
293
|
+
.map(item => getAtomicEquipmentCost(item.content))
|
|
294
|
+
.reduce(sumAtomicEquipmentCost, 0)),
|
|
295
|
+
],
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
references: content.src,
|
|
299
|
+
};
|
|
300
|
+
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ExperienceLevel } from "optolith-database-schema/types/ExperienceLevel";
|
|
2
1
|
/**
|
|
3
2
|
* Get a JSON representation of the rules text for an experience level.
|
|
4
3
|
*/
|
|
5
|
-
export declare const getExperienceLevelEntityDescription: import("../
|
|
4
|
+
export declare const getExperienceLevelEntityDescription: import("../creator.js").EntityDescriptionCreator<"ExperienceLevel", {
|
|
5
|
+
getInstanceById: import("../helpers/getTypes.js").GetInstanceById<"Publication">;
|
|
6
|
+
}, import("../index.js").EntityDescription>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createEntityDescriptionCreator } from "../
|
|
1
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
2
2
|
/**
|
|
3
3
|
* Get a JSON representation of the rules text for an experience level.
|
|
4
4
|
*/
|
|
5
|
-
export const getExperienceLevelEntityDescription = createEntityDescriptionCreator((_, { translate, translateMap }, entry) => {
|
|
5
|
+
export const getExperienceLevelEntityDescription = createEntityDescriptionCreator((_, { translate, translateMap }, { content: entry }) => {
|
|
6
6
|
const translation = translateMap(entry.translations);
|
|
7
7
|
if (translation === undefined) {
|
|
8
8
|
return undefined;
|
|
@@ -12,32 +12,37 @@ export const getExperienceLevelEntityDescription = createEntityDescriptionCreato
|
|
|
12
12
|
className: "experience-level",
|
|
13
13
|
body: [
|
|
14
14
|
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
15
|
+
type: "definitionList",
|
|
16
|
+
items: [
|
|
17
|
+
{
|
|
18
|
+
label: translate("Adventure Points"),
|
|
19
|
+
value: entry.adventure_points.toString(),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: translate("Maximum Attribute Value"),
|
|
23
|
+
value: entry.max_attribute_value.toString(),
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: translate("Maximum Skill Value"),
|
|
27
|
+
value: entry.max_skill_rating.toString(),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: translate("Maximum Combat Technique"),
|
|
31
|
+
value: entry.max_combat_technique_rating.toString(),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: translate("Maximum Attribute Total"),
|
|
35
|
+
value: entry.max_attribute_total.toString(),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: translate("Number of Spells/Liturgical Chants"),
|
|
39
|
+
value: entry.max_number_of_spells_liturgical_chants.toString(),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
label: translate("Number from other Traditions"),
|
|
43
|
+
value: entry.max_number_of_unfamiliar_spells.toString(),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
41
46
|
},
|
|
42
47
|
],
|
|
43
48
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GetById } from "../helpers/getTypes.js";
|
|
1
|
+
import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
3
2
|
/**
|
|
4
3
|
* Get a JSON representation of the rules text for a focus rule.
|
|
5
4
|
*/
|
|
6
|
-
export declare const getFocusRuleEntityDescription: import("../
|
|
7
|
-
|
|
5
|
+
export declare const getFocusRuleEntityDescription: import("../creator.js").EntityDescriptionCreator<"FocusRule", {
|
|
6
|
+
getInstanceById: GetInstanceById<"Publication" | "Subject">;
|
|
8
7
|
}, import("../index.js").EntityDescription>;
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { romanize } from "@optolith/helpers/roman";
|
|
2
|
-
import { createEntityDescriptionCreator } from "../
|
|
2
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
3
3
|
/**
|
|
4
4
|
* Get a JSON representation of the rules text for a focus rule.
|
|
5
5
|
*/
|
|
6
|
-
export const getFocusRuleEntityDescription = createEntityDescriptionCreator(({
|
|
6
|
+
export const getFocusRuleEntityDescription = createEntityDescriptionCreator(({ getInstanceById }, { translate, translateMap }, { content: entry }) => {
|
|
7
7
|
const translation = translateMap(entry.translations);
|
|
8
|
-
|
|
8
|
+
const topicTranslation = translateMap(getInstanceById("Subject", entry.subject)?.translations);
|
|
9
|
+
if (translation === undefined || topicTranslation === undefined) {
|
|
9
10
|
return undefined;
|
|
10
11
|
}
|
|
11
12
|
return {
|
|
12
13
|
title: `${translation.name} (${romanize(entry.level)})`,
|
|
13
|
-
subtitle:
|
|
14
|
+
subtitle: topicTranslation.name,
|
|
14
15
|
className: "focus-rule",
|
|
15
|
-
body: [
|
|
16
|
+
body: [
|
|
17
|
+
{
|
|
18
|
+
type: "plain",
|
|
19
|
+
text: translate("The following rule is a Level {$level} focus rule for the topic {$topic}.", { level: romanize(entry.level), topic: topicTranslation.name }),
|
|
20
|
+
},
|
|
21
|
+
{ type: "plain", text: translation.description },
|
|
22
|
+
],
|
|
23
|
+
errata: translation.errata,
|
|
16
24
|
references: entry.src,
|
|
17
25
|
};
|
|
18
26
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ActivatableIdentifier } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
|
+
import type { GetResolvedSelectOptionById } from "./partial/prerequisites/single/activatable.js";
|
|
4
|
+
/**
|
|
5
|
+
* Get a JSON representation of the rules text for an influence.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getInfluenceEntityDescription: import("../creator.js").EntityDescriptionCreator<"Influence", {
|
|
8
|
+
getInstanceById: GetInstanceById<"Publication" | "Influence" | "Race" | ActivatableIdentifier["kind"] | "Aspect">;
|
|
9
|
+
getResolvedSelectOptionById: GetResolvedSelectOptionById;
|
|
10
|
+
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"ProfessionVersion">;
|
|
11
|
+
}, import("../index.js").EntityDescription>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createEntityDescriptionCreator } from "../creator.js";
|
|
2
|
+
import { printInfluencePrerequisites } from "./partial/prerequisites/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Get a JSON representation of the rules text for an influence.
|
|
5
|
+
*/
|
|
6
|
+
export const getInfluenceEntityDescription = createEntityDescriptionCreator(({ getInstanceById, getResolvedSelectOptionById, getChildInstancesForInstanceId }, locale, { content: entry }) => {
|
|
7
|
+
const { translate, translateMap } = locale;
|
|
8
|
+
const translation = translateMap(entry.translations);
|
|
9
|
+
if (translation === undefined) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
title: translation.name,
|
|
14
|
+
className: "influence",
|
|
15
|
+
body: [
|
|
16
|
+
translation.rules === undefined
|
|
17
|
+
? undefined
|
|
18
|
+
: {
|
|
19
|
+
type: "plain",
|
|
20
|
+
text: translation.rules,
|
|
21
|
+
},
|
|
22
|
+
translation.effects === undefined || translation.effects.length === 0
|
|
23
|
+
? undefined
|
|
24
|
+
: {
|
|
25
|
+
type: "definitionList",
|
|
26
|
+
items: [
|
|
27
|
+
...(translation.effects?.map(effect => ({
|
|
28
|
+
label: effect.label,
|
|
29
|
+
value: effect.text,
|
|
30
|
+
})) ?? []),
|
|
31
|
+
entry.prerequisites === undefined
|
|
32
|
+
? undefined
|
|
33
|
+
: {
|
|
34
|
+
label: translate("Prerequisites"),
|
|
35
|
+
value: printInfluencePrerequisites(getInstanceById, getResolvedSelectOptionById, getChildInstancesForInstanceId, locale, entry.prerequisites),
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
errata: translation.errata,
|
|
41
|
+
references: entry.src,
|
|
42
|
+
};
|
|
43
|
+
});
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { LiturgicalChant } from "optolith-database-schema/types/LiturgicalChant";
|
|
5
|
-
import { GetById } from "../helpers/getTypes.js";
|
|
1
|
+
import { type RatedIdentifier } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetAllChildInstancesForParent, GetInstanceById } from "../helpers/getTypes.js";
|
|
3
|
+
import { type IdMap } from "../index.js";
|
|
6
4
|
/**
|
|
7
5
|
* Get a JSON representation of the rules text for a blessing.
|
|
8
6
|
*/
|
|
9
|
-
export declare const getBlessingEntityDescription: import("../
|
|
10
|
-
|
|
7
|
+
export declare const getBlessingEntityDescription: import("../creator.js").EntityDescriptionCreator<"Blessing", {
|
|
8
|
+
getInstanceById: GetInstanceById<"Publication" | "TargetCategory">;
|
|
11
9
|
}, import("../index.js").EntityDescription>;
|
|
12
10
|
/**
|
|
13
11
|
* Get a JSON representation of the rules text for a liturgical chant.
|
|
14
12
|
*/
|
|
15
|
-
export declare const getLiturgicalChantEntityDescription: import("../
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
getSkillModificationLevelById: GetById.Static.SkillModificationLevel;
|
|
20
|
-
getTargetCategoryById: GetById.Static.TargetCategory;
|
|
21
|
-
getBlessedTraditionById: GetById.Static.BlessedTradition;
|
|
22
|
-
getAspectById: GetById.Static.Aspect;
|
|
13
|
+
export declare const getLiturgicalChantEntityDescription: import("../creator.js").EntityDescriptionCreator<"LiturgicalChant", {
|
|
14
|
+
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Aspect" | "BlessedTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement">;
|
|
15
|
+
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
16
|
+
idMap: IdMap;
|
|
23
17
|
}, import("../index.js").EntityDescription>;
|
|
24
18
|
/**
|
|
25
19
|
* Get a JSON representation of the rules text for a ceremony.
|
|
26
20
|
*/
|
|
27
|
-
export declare const getCeremonyEntityDescription: import("../
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
getSkillModificationLevelById: GetById.Static.SkillModificationLevel;
|
|
32
|
-
getTargetCategoryById: GetById.Static.TargetCategory;
|
|
33
|
-
getBlessedTraditionById: GetById.Static.BlessedTradition;
|
|
34
|
-
getAspectById: GetById.Static.Aspect;
|
|
21
|
+
export declare const getCeremonyEntityDescription: import("../creator.js").EntityDescriptionCreator<"Ceremony", {
|
|
22
|
+
getInstanceById: GetInstanceById<"Publication" | "Attribute" | "SkillModificationLevel" | "TargetCategory" | "Aspect" | "BlessedTradition" | "DerivedCharacteristic" | RatedIdentifier["kind"] | "Enhancement">;
|
|
23
|
+
getChildInstancesForInstanceId: GetAllChildInstancesForParent<"Enhancement">;
|
|
24
|
+
idMap: IdMap;
|
|
35
25
|
}, import("../index.js").EntityDescription>;
|