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