@optolith/database-schema 0.77.1 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/gen/types.d.ts +217 -3
  3. package/lib/cache/activatableSelectOptions.d.ts +2 -2
  4. package/lib/cache/activatableSelectOptions.js +2 -58
  5. package/lib/types/Advantage.d.ts +29 -0
  6. package/lib/types/Advantage.js +2 -1
  7. package/lib/types/Culture.d.ts +1 -0
  8. package/lib/types/Culture.js +5 -1
  9. package/lib/types/Disadvantage.d.ts +29 -0
  10. package/lib/types/Disadvantage.js +2 -1
  11. package/lib/types/Locale.d.ts +10 -0
  12. package/lib/types/Locale.js +11 -0
  13. package/lib/types/Profession.d.ts +178 -154
  14. package/lib/types/Profession.js +40 -1
  15. package/lib/types/Race.d.ts +1 -0
  16. package/lib/types/Race.js +10 -0
  17. package/lib/types/_ActivatableSelectOptions.d.ts +939 -0
  18. package/lib/types/_ActivatableSelectOptions.js +178 -117
  19. package/lib/types/equipment/item/EquipmentCategory.d.ts +15 -0
  20. package/lib/types/equipment/item/EquipmentCategory.js +5 -0
  21. package/lib/types/equipment/item/IlluminationLightSource.d.ts +9 -0
  22. package/lib/types/equipment/item/IlluminationLightSource.js +1 -1
  23. package/lib/types/equipment/item/Item.d.ts +9 -0
  24. package/lib/types/equipment/item/Item.js +6 -0
  25. package/lib/types/prerequisites/single/ActivatablePrerequisite.js +2 -0
  26. package/lib/types/specialAbility/AdvancedCombatSpecialAbility.d.ts +29 -0
  27. package/lib/types/specialAbility/AdvancedCombatSpecialAbility.js +2 -1
  28. package/lib/types/specialAbility/AdvancedKarmaSpecialAbility.d.ts +29 -0
  29. package/lib/types/specialAbility/AdvancedKarmaSpecialAbility.js +2 -1
  30. package/lib/types/specialAbility/AdvancedMagicalSpecialAbility.d.ts +29 -0
  31. package/lib/types/specialAbility/AdvancedMagicalSpecialAbility.js +2 -1
  32. package/lib/types/specialAbility/AdvancedSkillSpecialAbility.d.ts +29 -0
  33. package/lib/types/specialAbility/AdvancedSkillSpecialAbility.js +2 -1
  34. package/lib/types/specialAbility/AncestorGlyph.d.ts +29 -0
  35. package/lib/types/specialAbility/AncestorGlyph.js +2 -1
  36. package/lib/types/specialAbility/BlessedTradition.d.ts +29 -0
  37. package/lib/types/specialAbility/BlessedTradition.js +2 -1
  38. package/lib/types/specialAbility/BrawlingSpecialAbility.d.ts +29 -0
  39. package/lib/types/specialAbility/BrawlingSpecialAbility.js +2 -1
  40. package/lib/types/specialAbility/CeremonialItemSpecialAbility.d.ts +29 -0
  41. package/lib/types/specialAbility/CeremonialItemSpecialAbility.js +2 -1
  42. package/lib/types/specialAbility/CombatSpecialAbility.d.ts +29 -0
  43. package/lib/types/specialAbility/CombatSpecialAbility.js +2 -1
  44. package/lib/types/specialAbility/CombatStyleSpecialAbility.d.ts +29 -0
  45. package/lib/types/specialAbility/CombatStyleSpecialAbility.js +3 -2
  46. package/lib/types/specialAbility/CommandSpecialAbility.d.ts +29 -0
  47. package/lib/types/specialAbility/CommandSpecialAbility.js +2 -1
  48. package/lib/types/specialAbility/FamiliarSpecialAbility.d.ts +29 -0
  49. package/lib/types/specialAbility/FamiliarSpecialAbility.js +2 -1
  50. package/lib/types/specialAbility/FatePointSexSpecialAbility.d.ts +29 -0
  51. package/lib/types/specialAbility/FatePointSexSpecialAbility.js +2 -1
  52. package/lib/types/specialAbility/FatePointSpecialAbility.d.ts +29 -0
  53. package/lib/types/specialAbility/FatePointSpecialAbility.js +2 -1
  54. package/lib/types/specialAbility/GeneralSpecialAbility.d.ts +29 -0
  55. package/lib/types/specialAbility/GeneralSpecialAbility.js +2 -1
  56. package/lib/types/specialAbility/KarmaSpecialAbility.d.ts +29 -0
  57. package/lib/types/specialAbility/KarmaSpecialAbility.js +2 -1
  58. package/lib/types/specialAbility/LiturgicalStyleSpecialAbility.d.ts +29 -0
  59. package/lib/types/specialAbility/LiturgicalStyleSpecialAbility.js +2 -1
  60. package/lib/types/specialAbility/LycantropicGift.d.ts +29 -0
  61. package/lib/types/specialAbility/LycantropicGift.js +2 -1
  62. package/lib/types/specialAbility/MagicStyleSpecialAbility.d.ts +29 -0
  63. package/lib/types/specialAbility/MagicStyleSpecialAbility.js +2 -1
  64. package/lib/types/specialAbility/MagicalSpecialAbility.d.ts +29 -0
  65. package/lib/types/specialAbility/MagicalSpecialAbility.js +2 -1
  66. package/lib/types/specialAbility/MagicalTradition.d.ts +29 -0
  67. package/lib/types/specialAbility/MagicalTradition.js +2 -1
  68. package/lib/types/specialAbility/PactGift.d.ts +29 -0
  69. package/lib/types/specialAbility/PactGift.js +2 -1
  70. package/lib/types/specialAbility/ProtectiveWardingCircleSpecialAbility.d.ts +29 -0
  71. package/lib/types/specialAbility/ProtectiveWardingCircleSpecialAbility.js +2 -1
  72. package/lib/types/specialAbility/Sermon.d.ts +29 -0
  73. package/lib/types/specialAbility/Sermon.js +2 -1
  74. package/lib/types/specialAbility/SexSpecialAbility.d.ts +29 -0
  75. package/lib/types/specialAbility/SexSpecialAbility.js +2 -1
  76. package/lib/types/specialAbility/SikaryanDrainSpecialAbility.d.ts +29 -0
  77. package/lib/types/specialAbility/SikaryanDrainSpecialAbility.js +2 -1
  78. package/lib/types/specialAbility/SkillStyleSpecialAbility.d.ts +29 -0
  79. package/lib/types/specialAbility/SkillStyleSpecialAbility.js +2 -1
  80. package/lib/types/specialAbility/VampiricGift.d.ts +29 -0
  81. package/lib/types/specialAbility/VampiricGift.js +2 -1
  82. package/lib/types/specialAbility/Vision.d.ts +29 -0
  83. package/lib/types/specialAbility/Vision.js +2 -1
  84. package/lib/types/traditionArtifacts/ArcaneOrbEnchantment.d.ts +1 -1493
  85. package/lib/types/traditionArtifacts/ArcaneOrbEnchantment.js +2 -34
  86. package/lib/types/traditionArtifacts/AttireEnchantment.d.ts +1 -1493
  87. package/lib/types/traditionArtifacts/AttireEnchantment.js +2 -34
  88. package/lib/types/traditionArtifacts/Beutelzauber.d.ts +1 -1493
  89. package/lib/types/traditionArtifacts/Beutelzauber.js +2 -34
  90. package/lib/types/traditionArtifacts/BowlEnchantment.d.ts +1 -1493
  91. package/lib/types/traditionArtifacts/BowlEnchantment.js +2 -34
  92. package/lib/types/traditionArtifacts/CauldronEnchantment.d.ts +1 -1493
  93. package/lib/types/traditionArtifacts/CauldronEnchantment.js +5 -36
  94. package/lib/types/traditionArtifacts/ChronicleEnchantment.d.ts +1 -1493
  95. package/lib/types/traditionArtifacts/ChronicleEnchantment.js +2 -34
  96. package/lib/types/traditionArtifacts/DaggerRitual.d.ts +1 -1499
  97. package/lib/types/traditionArtifacts/DaggerRitual.js +5 -34
  98. package/lib/types/traditionArtifacts/FoolsHatEnchantment.d.ts +1 -1493
  99. package/lib/types/traditionArtifacts/FoolsHatEnchantment.js +2 -34
  100. package/lib/types/traditionArtifacts/Haubenzauber.d.ts +1 -1493
  101. package/lib/types/traditionArtifacts/Haubenzauber.js +2 -34
  102. package/lib/types/traditionArtifacts/Hauerkettenzauber.d.ts +1 -464
  103. package/lib/types/traditionArtifacts/Hauerkettenzauber.js +2 -31
  104. package/lib/types/traditionArtifacts/InstrumentEnchantment.d.ts +1 -1493
  105. package/lib/types/traditionArtifacts/InstrumentEnchantment.js +2 -34
  106. package/lib/types/traditionArtifacts/Keulenzauber.d.ts +1 -464
  107. package/lib/types/traditionArtifacts/Keulenzauber.js +2 -31
  108. package/lib/types/traditionArtifacts/Krallenkettenzauber.d.ts +1 -1493
  109. package/lib/types/traditionArtifacts/Krallenkettenzauber.js +2 -34
  110. package/lib/types/traditionArtifacts/Kristallkugelzauber.d.ts +1 -1493
  111. package/lib/types/traditionArtifacts/Kristallkugelzauber.js +2 -34
  112. package/lib/types/traditionArtifacts/OrbEnchantment.d.ts +1 -1493
  113. package/lib/types/traditionArtifacts/OrbEnchantment.js +2 -34
  114. package/lib/types/traditionArtifacts/RingEnchantment.d.ts +1 -1493
  115. package/lib/types/traditionArtifacts/RingEnchantment.js +2 -34
  116. package/lib/types/traditionArtifacts/Schweinetrommelzauber.d.ts +1 -464
  117. package/lib/types/traditionArtifacts/Schweinetrommelzauber.js +2 -31
  118. package/lib/types/traditionArtifacts/SickleRitual.d.ts +1 -1493
  119. package/lib/types/traditionArtifacts/SickleRitual.js +2 -34
  120. package/lib/types/traditionArtifacts/SpellSwordEnchantment.d.ts +1 -1493
  121. package/lib/types/traditionArtifacts/SpellSwordEnchantment.js +2 -34
  122. package/lib/types/traditionArtifacts/StaffEnchantment.d.ts +1 -1493
  123. package/lib/types/traditionArtifacts/StaffEnchantment.js +2 -34
  124. package/lib/types/traditionArtifacts/ToyEnchantment.d.ts +1 -1493
  125. package/lib/types/traditionArtifacts/ToyEnchantment.js +2 -34
  126. package/lib/types/traditionArtifacts/Trinkhornzauber.d.ts +1 -1493
  127. package/lib/types/traditionArtifacts/Trinkhornzauber.js +2 -34
  128. package/lib/types/traditionArtifacts/WandEnchantment.d.ts +1 -1455
  129. package/lib/types/traditionArtifacts/WandEnchantment.js +3 -33
  130. package/lib/types/traditionArtifacts/WeaponEnchantment.d.ts +1 -1493
  131. package/lib/types/traditionArtifacts/WeaponEnchantment.js +2 -34
  132. package/lib/types/traditionArtifacts/_shared.d.ts +10 -0
  133. package/lib/types/traditionArtifacts/_shared.js +40 -3
  134. package/package.json +1 -1
@@ -1,4 +1,6 @@
1
+ import { isEmpty, isNotEmpty } from "@elyukai/utils/array/nonEmpty";
1
2
  import * as DB from "tsondb/schema/dsl";
3
+ import { Case, fromUniformCase, } from "tsondb/schema/gen";
2
4
  import { NestedTranslationMap } from "./Locale.js";
3
5
  import { SelectOptionCategory } from "./_ActivatableSelectOptionCategory.js";
4
6
  import { NewSkillApplication, SkillUse } from "./_ActivatableSkillApplicationsAndUses.js";
@@ -16,6 +18,10 @@ Note that this is only a full definition of options for simple logic that can be
16
18
  comment: `An entry category with optional further configuration. All available entries from the specified categories will be included as separate select options. You can also specify a set of groups that should only be included. Groups not mentioned will be excluded then.`,
17
19
  type: DB.IncludeIdentifier(SelectOptionCategory),
18
20
  }),
21
+ rules: DB.Optional({
22
+ comment: `Rules for how options can be selected and relate to each other. Defaults to a single predefined option if the entry has select options defined, otherwise undefined.`,
23
+ type: DB.IncludeIdentifier(SelectOptionRules),
24
+ }),
19
25
  }, { minProperties: 1 }),
20
26
  });
21
27
  export const select_options = DB.Optional({
@@ -99,120 +105,175 @@ export const explicit_select_options = DB.Required({
99
105
  Note that this is only a full definition of options for simple logic that can be made explicit using the more detailed configuration for both derived categories and explicit options. There are quite a few entries whose option logic cannot be fully represented here, so that it needs to be implemented manually.`,
100
106
  type: DB.ChildEntities(GeneralSelectOption),
101
107
  });
102
- // "Options": {
103
- // "$comment": "Unfinished generalized options handling.",
104
- // "type": "array",
105
- // "minItems": 1,
106
- // "items": {
107
- // "oneOf": [
108
- // {
109
- // "type": "object",
110
- // "properties": {
111
- // "type": { "const": "List" },
112
- // "value": {
113
- // "type": "object",
114
- // "properties": {
115
- // "list": {
116
- // "oneOf": [
117
- // {
118
- // "type": "object",
119
- // "properties": {
120
- // "type": { "const": "Generate" },
121
- // "value": { "$ref": "#/definitions/SelectOptionCategories" }
122
- // },
123
- // "required": ["type", "value"],
124
- // "additionalProperties": false
125
- // },
126
- // {
127
- // "type": "object",
128
- // "properties": {
129
- // "type": { "const": "Explicit" },
130
- // "value": { "$ref": "#/definitions/SelectOptions" }
131
- // },
132
- // "required": ["type", "value"],
133
- // "additionalProperties": false
134
- // }
135
- // ]
136
- // },
137
- // "multiple": {
138
- // "description": "Sometimes, multiple options from a single list have to or can be chosen. Its possible to define a number of options that have to be selected or a range of numbers of options that can be selected.",
139
- // "oneOf": [
140
- // {
141
- // "type": "object",
142
- // "properties": {
143
- // "type": { "const": "Fixed" },
144
- // "value": {
145
- // "description": "The number of options that have to be selected.",
146
- // "type": "integer",
147
- // "minimum": 2
148
- // }
149
- // },
150
- // "required": ["type", "value"],
151
- // "additionalProperties": false
152
- // },
153
- // {
154
- // "type": "object",
155
- // "properties": {
156
- // "type": { "const": "Range" },
157
- // "value": {
158
- // "type": "object",
159
- // "properties": {
160
- // "min": {
161
- // "description": "The minimum number of options that need to be selected. If left empty it defaults to 1.",
162
- // "type": "integer",
163
- // "minimum": 2
164
- // },
165
- // "max": {
166
- // "description": "The maximum number of options that need to be selected.",
167
- // "type": "integer",
168
- // "minimum": 2
169
- // }
170
- // },
171
- // "required": ["max"],
172
- // "additionalProperties": false
173
- // }
174
- // },
175
- // "required": ["type", "value"],
176
- // "additionalProperties": false
177
- // }
178
- // ]
179
- // }
180
- // },
181
- // "required": ["list"],
182
- // "additionalProperties": false
183
- // }
184
- // },
185
- // "required": ["type", "value"],
186
- // "additionalProperties": false
187
- // },
188
- // {
189
- // "type": "object",
190
- // "properties": {
191
- // "type": { "const": "TextInput" },
192
- // "value": {
193
- // "type": "object",
194
- // "properties": {
195
- // "label": {
196
- // "type": "object",
197
- // "description": "All translations for the entry, identified by IETF language tag (BCP47).",
198
- // "patternProperties": {
199
- // "^[a-z]{2}-[A-Z]{2}$": {
200
- // "description": "The text input label.",
201
- // "type": "string",
202
- // "minLength": 1
203
- // }
204
- // },
205
- // "minProperties": 1,
206
- // "additionalProperties": false
207
- // }
208
- // },
209
- // "required": ["label"],
210
- // "additionalProperties": false
211
- // }
212
- // },
213
- // "required": ["type", "value"],
214
- // "additionalProperties": false
215
- // }
216
- // ]
217
- // }
218
- // },
108
+ const ChildEntityForSelectOption = DB.Enum(import.meta.url, {
109
+ name: "ChildEntityForSelectOption",
110
+ comment: `The possible child entities for select options.`,
111
+ values: () => ({
112
+ SkillApplication: DB.EnumCase({ type: null }),
113
+ }),
114
+ });
115
+ const ChildSelectOptionRuleValue = DB.TypeAlias(import.meta.url, {
116
+ name: "ChildSelectOptionRuleValue",
117
+ type: () => DB.Object({
118
+ parentIndex: DB.Required({
119
+ comment: "The index of the parent select option in the list of selected options.",
120
+ type: DB.Integer({ minimum: 0 }),
121
+ }),
122
+ entity: DB.Required({
123
+ comment: "The entity you can choose from.",
124
+ type: DB.IncludeIdentifier(ChildEntityForSelectOption),
125
+ }),
126
+ }),
127
+ });
128
+ const PredefinedOrTextInputSelectOptionRuleValue = DB.TypeAlias(import.meta.url, {
129
+ name: "PredefinedOrTextInputSelectOptionRuleValue",
130
+ type: () => DB.Object({
131
+ translations: NestedTranslationMap(DB.Required, "PredefinedOrTextInputSelectOptionRuleValue", DB.Object({
132
+ inputLabel: DB.Required({
133
+ comment: "The label for the text input field.",
134
+ type: DB.String({ minLength: 1 }),
135
+ }),
136
+ optionLabel: DB.Required({
137
+ comment: "The label for the extra option in the list of select options that unlocks the text input field.",
138
+ type: DB.String({ minLength: 1 }),
139
+ }),
140
+ })),
141
+ }),
142
+ });
143
+ const TextInputSelectOptionRuleValue = DB.TypeAlias(import.meta.url, {
144
+ name: "TextInputSelectOptionRuleValue",
145
+ type: () => DB.Object({
146
+ translations: NestedTranslationMap(DB.Required, "TextInputSelectOptionRuleValue", DB.Object({
147
+ inputLabel: DB.Required({
148
+ comment: "The label for the text input field.",
149
+ type: DB.String({ minLength: 1 }),
150
+ }),
151
+ })),
152
+ }),
153
+ });
154
+ const SelectOptionRuleValue = DB.Enum(import.meta.url, {
155
+ name: "SelectOptionRuleValue",
156
+ comment: `The possible values for select option rules.`,
157
+ values: () => ({
158
+ Predefined: DB.EnumCase({
159
+ comment: "An entry that has been defined explicitly or derived from a category.",
160
+ type: null,
161
+ }),
162
+ PredefinedOrTextInput: DB.EnumCase({
163
+ comment: "An entry that has been defined explicitly or derived from a category, or a text input if the user sees none of the predefined options fit.",
164
+ type: DB.IncludeIdentifier(PredefinedOrTextInputSelectOptionRuleValue),
165
+ }),
166
+ Child: DB.EnumCase({
167
+ comment: "A child instance of a selected entry, e.g. a skill application for a skill.",
168
+ type: DB.IncludeIdentifier(ChildSelectOptionRuleValue),
169
+ }),
170
+ TextInput: DB.EnumCase({
171
+ comment: "A text input field that can be filled in by the user.",
172
+ type: DB.IncludeIdentifier(TextInputSelectOptionRuleValue),
173
+ }),
174
+ }),
175
+ });
176
+ const SelectOptionRuleMultiple = DB.Enum(import.meta.url, {
177
+ name: "SelectOptionRuleMultiple",
178
+ values: () => ({
179
+ Constant: DB.EnumCase({
180
+ comment: "A fixed number of options that have to be selected.",
181
+ type: DB.Integer({ minimum: 2 }),
182
+ }),
183
+ Range: DB.EnumCase({
184
+ comment: "A range of numbers of options that can be selected.",
185
+ type: DB.Object({
186
+ min: DB.Optional({
187
+ comment: "The minimum number of options that need to be selected. If left empty it defaults to 1.",
188
+ type: DB.Integer({ minimum: 2 }),
189
+ }),
190
+ max: DB.Required({
191
+ comment: "The maximum number of options that need to be selected.",
192
+ type: DB.Integer({ minimum: 2 }),
193
+ }),
194
+ }),
195
+ }),
196
+ }),
197
+ });
198
+ const SelectOptionRule = DB.TypeAlias(import.meta.url, {
199
+ name: "SelectOptionRule",
200
+ comment: `A rule for how options can be selected and relate to each other.`,
201
+ type: () => DB.Object({
202
+ value: DB.Required({
203
+ comment: "The value of the rule.",
204
+ type: DB.IncludeIdentifier(SelectOptionRuleValue),
205
+ }),
206
+ multiple: DB.Optional({
207
+ comment: "Sometimes, multiple options from a single list have to or can be chosen.",
208
+ type: DB.IncludeIdentifier(SelectOptionRuleMultiple),
209
+ }),
210
+ }),
211
+ });
212
+ export const SelectOptionRules = DB.TypeAlias(import.meta.url, {
213
+ name: "SelectOptionRules",
214
+ comment: `Rules for how options can be selected and relate to each other. Defaults to a single predefined option if the entry has select options defined, otherwise undefined.`,
215
+ type: () => DB.Array(DB.IncludeIdentifier(SelectOptionRule), { minItems: 1 }),
216
+ });
217
+ export const verifySelectOptionRules = (_entity, deps) => {
218
+ const errorMessages = [];
219
+ const rules = deps.instanceContent.select_options?.rules;
220
+ if (rules) {
221
+ const normalizedRules = rules.flatMap(rule => rule.multiple
222
+ ? Array.from({
223
+ length: rule.multiple.kind === "Constant"
224
+ ? rule.multiple.Constant
225
+ : rule.multiple.Range.max,
226
+ }, () => rule)
227
+ : [rule]);
228
+ for (const [ruleIndex, rule] of rules.entries()) {
229
+ if (rule.multiple?.kind === "Range" && ruleIndex !== rules.length - 1) {
230
+ errorMessages.push("A select option rule with a range of multiple options can only be the last rule in the list.");
231
+ }
232
+ if (rule.value.kind === "Child") {
233
+ const parentRule = normalizedRules[rule.value.Child.parentIndex];
234
+ if (!parentRule || parentRule.value.kind !== "Predefined") {
235
+ errorMessages.push("A child select option rule must reference a predefined select option rule as its parent.");
236
+ }
237
+ }
238
+ }
239
+ }
240
+ return errorMessages;
241
+ };
242
+ /**
243
+ * Stub for once option rules are formalized in the database schema.
244
+ */
245
+ export const verifyOptionsForActivatableEntry = (value, getInstanceById, getAllChildInstancesForParent) => {
246
+ if (value.id.kind === "Enhancement") {
247
+ return [];
248
+ }
249
+ const referencedInstance = getInstanceById(value.id);
250
+ if (!referencedInstance) {
251
+ return [
252
+ `Referenced instance of entity ${value.id.kind} with id ${fromUniformCase(value.id)} not found.`,
253
+ ];
254
+ }
255
+ const generalSelectOptions = getAllChildInstancesForParent("GeneralSelectOption", value.id);
256
+ const errorMessages = [];
257
+ if (!("levels" in referencedInstance && typeof referencedInstance.levels === "number") &&
258
+ value.level !== undefined) {
259
+ errorMessages.push(`The referenced instance of entity ${value.id.kind} with id ${fromUniformCase(value.id)} does not have levels, but a level was specified in the prerequisite.`);
260
+ }
261
+ if ((("select_options" in referencedInstance &&
262
+ referencedInstance.select_options?.derived !== undefined) ||
263
+ isNotEmpty(generalSelectOptions)) &&
264
+ (value.options === undefined || isEmpty(value.options))) {
265
+ errorMessages.push(`The referenced instance of entity ${value.id.kind} with id ${fromUniformCase(value.id)} has select options, but no options were specified in the prerequisite.`);
266
+ }
267
+ for (const option of value.options ?? []) {
268
+ if (option.kind === "General") {
269
+ const referencedOption = getInstanceById(Case("GeneralSelectOption", option.General));
270
+ if (!referencedOption) {
271
+ errorMessages.push(`Referenced select option of entity GeneralSelectOption with id ${fromUniformCase(option)} not found.`);
272
+ }
273
+ if (referencedOption?.parent !== value.id) {
274
+ errorMessages.push(`Referenced select option of entity GeneralSelectOption with id ${fromUniformCase(option)} does not belong to the instance of entity ${value.id.kind} with id ${fromUniformCase(value.id)}.`);
275
+ }
276
+ }
277
+ }
278
+ return [];
279
+ };
@@ -33,6 +33,11 @@ declare const EquipmentCategoryType: DB.Enum<"EquipmentCategoryType", {
33
33
  Optional: DB.EnumCase<null>;
34
34
  Prohibited: DB.EnumCase<null>;
35
35
  }, []>>, true>;
36
+ burningTime: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"ValueRule", {
37
+ Required: DB.EnumCase<null>;
38
+ Optional: DB.EnumCase<null>;
39
+ Prohibited: DB.EnumCase<null>;
40
+ }, []>>, true>;
36
41
  }>, []>>>;
37
42
  Special: DB.EnumCase<DB.IncludeIdentifier<[], DB.Enum<"SpecialEquipmentCategoryEntity", {
38
43
  AnimalCare: DB.EnumCase<null>;
@@ -69,6 +74,11 @@ declare const DefaultEquipmentCategoryTypeRules: DB.TypeAlias<"DefaultEquipmentC
69
74
  Optional: DB.EnumCase<null>;
70
75
  Prohibited: DB.EnumCase<null>;
71
76
  }, []>>, true>;
77
+ burningTime: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"ValueRule", {
78
+ Required: DB.EnumCase<null>;
79
+ Optional: DB.EnumCase<null>;
80
+ Prohibited: DB.EnumCase<null>;
81
+ }, []>>, true>;
72
82
  }>, []>;
73
83
  export declare const EquipmentCategory: DB.Entity<"EquipmentCategory", {
74
84
  position: DB.MemberDecl<DB.Integer, true>;
@@ -98,6 +108,11 @@ export declare const EquipmentCategory: DB.Entity<"EquipmentCategory", {
98
108
  Optional: DB.EnumCase<null>;
99
109
  Prohibited: DB.EnumCase<null>;
100
110
  }, []>>, true>;
111
+ burningTime: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"ValueRule", {
112
+ Required: DB.EnumCase<null>;
113
+ Optional: DB.EnumCase<null>;
114
+ Prohibited: DB.EnumCase<null>;
115
+ }, []>>, true>;
101
116
  }>, []>>>;
102
117
  Special: DB.EnumCase<DB.IncludeIdentifier<[], DB.Enum<"SpecialEquipmentCategoryEntity", {
103
118
  AnimalCare: DB.EnumCase<null>;
@@ -68,6 +68,10 @@ const DefaultEquipmentCategoryTypeRules = DB.TypeAlias(import.meta.url, {
68
68
  comment: "Presence of complexity to certain groups for items in this category.",
69
69
  type: DB.IncludeIdentifier(ValueRule),
70
70
  }),
71
+ burningTime: DB.Required({
72
+ comment: "Presence of burning time to certain groups for items in this category.",
73
+ type: DB.IncludeIdentifier(ValueRule),
74
+ }),
71
75
  }),
72
76
  });
73
77
  const SpecialEquipmentCategoryEntity = DB.Enum(import.meta.url, {
@@ -128,4 +132,5 @@ export const mergeAllValueRules = (categories) => ({
128
132
  structurePoints: { kind: mergeValueRules(categories.map(category => category.structurePoints)) },
129
133
  weight: { kind: mergeValueRules(categories.map(category => category.weight)) },
130
134
  complexity: { kind: mergeValueRules(categories.map(category => category.complexity)) },
135
+ burningTime: { kind: mergeValueRules(categories.map(category => category.burningTime)) },
131
136
  });
@@ -249,3 +249,12 @@ export declare const IlluminationLightSource: DB.Entity<"IlluminationLightSource
249
249
  }>, []>>>, []>>, false>;
250
250
  }>, true>;
251
251
  }, undefined>;
252
+ export declare const BurningTime: DB.Enum<"BurningTime", {
253
+ Unlimited: DB.EnumCase<null>;
254
+ Limited: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"LimitedBurningTime", DB.Object<{
255
+ value: DB.MemberDecl<DB.Float, true>;
256
+ unit: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"LimitedBurningTimeUnit", {
257
+ Hours: DB.EnumCase<null>;
258
+ }, []>>, true>;
259
+ }>, []>>>;
260
+ }, []>;
@@ -50,7 +50,7 @@ export const IlluminationLightSource = DB.Entity(import.meta.url, {
50
50
  return [];
51
51
  },
52
52
  });
53
- const BurningTime = DB.Enum(import.meta.url, {
53
+ export const BurningTime = DB.Enum(import.meta.url, {
54
54
  name: "BurningTime",
55
55
  values: () => ({
56
56
  Unlimited: DB.EnumCase({ type: null }),
@@ -71,6 +71,15 @@ export declare const Item: DB.Entity<"Item", {
71
71
  structurePoints: DB.MemberDecl<DB.IncludeIdentifier<[], DB.TypeAlias<"StructurePoints", DB.Array<DB.IncludeIdentifier<[], DB.TypeAlias<"StructurePointsComponent", DB.Object<{
72
72
  points: DB.MemberDecl<DB.Integer, true>;
73
73
  }>, []>>>, []>>, true>;
74
+ burningTime: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"BurningTime", {
75
+ Unlimited: DB.EnumCase<null>;
76
+ Limited: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"LimitedBurningTime", DB.Object<{
77
+ value: DB.MemberDecl<DB.Float, true>;
78
+ unit: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"LimitedBurningTimeUnit", {
79
+ Hours: DB.EnumCase<null>;
80
+ }, []>>, true>;
81
+ }>, []>>>;
82
+ }, []>>, false>;
74
83
  meleeUses: DB.MemberDecl<DB.NestedEntityMap<string, {
75
84
  damage: DB.MemberDecl<DB.TypeArgument<DB.Param<"Damage", DB.Type>>, true>;
76
85
  damage_threshold: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"PrimaryAttributeDamageThreshold", {
@@ -12,6 +12,7 @@ import { RangedWeapon } from "./_RangedWeapon.js";
12
12
  import { checkWeaponCombatTechniqueIntegrity } from "./_Weapon.js";
13
13
  import { SecondaryArmor } from "./Armor.js";
14
14
  import { isEquipmentCategoryOfDefaultType, mergeAllValueRules } from "./EquipmentCategory.js";
15
+ import { BurningTime } from "./IlluminationLightSource.js";
15
16
  export const Item = DB.Entity(import.meta.url, {
16
17
  name: "Item",
17
18
  namePlural: "Items",
@@ -36,6 +37,10 @@ export const Item = DB.Entity(import.meta.url, {
36
37
  comment: "The structure points of the item. Use an array if the item consists of multiple components that have individual structure points.",
37
38
  type: DB.IncludeIdentifier(StructurePoints),
38
39
  }),
40
+ burningTime: DB.Optional({
41
+ comment: "The burning time is the time how long the light source can be lit. After that time you have to use a new light source.",
42
+ type: DB.IncludeIdentifier(BurningTime),
43
+ }),
39
44
  meleeUses: DB.Optional({
40
45
  comment: "A list of stat blocks for each close combat technique this weapon can be used with.",
41
46
  type: DB.NestedEntityMap({
@@ -149,6 +154,7 @@ const checkEquipmentCategoryConstraintsWithItem = (item, getInstanceById) => {
149
154
  applyValueRule(mergedRules.restrictedTo, item.restrictedTo, "Restriction are");
150
155
  applyValueRule(mergedRules.structurePoints, item.structurePoints, "Structure points are");
151
156
  applyValueRule(mergedRules.weight, item.weight, "A weight is");
157
+ applyValueRule(mergedRules.burningTime, item.burningTime, "A burning time is");
152
158
  return errors;
153
159
  }
154
160
  else {
@@ -1,4 +1,5 @@
1
1
  import * as DB from "tsondb/schema/dsl";
2
+ import { verifyOptionsForActivatableEntry } from "../../_ActivatableSelectOptions.js";
2
3
  import { ActivatableIdentifier, RequirableSelectOptionIdentifier } from "../../_IdentifierGroup.js";
3
4
  import { Preconditions } from "../ConditionalPrerequisites.js";
4
5
  import { DisplayOption } from "../DisplayOption.js";
@@ -29,4 +30,5 @@ export const ActivatablePrerequisite = DB.TypeAlias(import.meta.url, {
29
30
  type: DB.IncludeIdentifier(Preconditions),
30
31
  }),
31
32
  }),
33
+ customConstraints: ({ instanceContent, getInstanceById, getAllChildInstancesForParent }) => verifyOptionsForActivatableEntry(instanceContent, getInstanceById, getAllChildInstancesForParent),
32
34
  });
@@ -850,6 +850,35 @@ export declare const AdvancedCombatSpecialAbility: DB.Entity<"AdvancedCombatSpec
850
850
  }>, []>>>, true>;
851
851
  }>, []>>>;
852
852
  }, []>>, false>;
853
+ rules: DB.MemberDecl<DB.IncludeIdentifier<[], DB.TypeAlias<"SelectOptionRules", DB.Array<DB.IncludeIdentifier<[], DB.TypeAlias<"SelectOptionRule", DB.Object<{
854
+ value: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionRuleValue", {
855
+ Predefined: DB.EnumCase<null>;
856
+ PredefinedOrTextInput: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"PredefinedOrTextInputSelectOptionRuleValue", DB.Object<{
857
+ translations: DB.MemberDecl<DB.NestedEntityMap<"PredefinedOrTextInputSelectOptionRuleValueTranslation", {
858
+ inputLabel: DB.MemberDecl<DB.String, true>;
859
+ optionLabel: DB.MemberDecl<DB.String, true>;
860
+ }>, true>;
861
+ }>, []>>>;
862
+ Child: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"ChildSelectOptionRuleValue", DB.Object<{
863
+ parentIndex: DB.MemberDecl<DB.Integer, true>;
864
+ entity: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"ChildEntityForSelectOption", {
865
+ SkillApplication: DB.EnumCase<null>;
866
+ }, []>>, true>;
867
+ }>, []>>>;
868
+ TextInput: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"TextInputSelectOptionRuleValue", DB.Object<{
869
+ translations: DB.MemberDecl<DB.NestedEntityMap<"TextInputSelectOptionRuleValueTranslation", {
870
+ inputLabel: DB.MemberDecl<DB.String, true>;
871
+ }>, true>;
872
+ }>, []>>>;
873
+ }, []>>, true>;
874
+ multiple: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionRuleMultiple", {
875
+ Constant: DB.EnumCase<DB.Integer>;
876
+ Range: DB.EnumCase<DB.Object<{
877
+ min: DB.MemberDecl<DB.Integer, false>;
878
+ max: DB.MemberDecl<DB.Integer, true>;
879
+ }>>;
880
+ }, []>>, false>;
881
+ }>, []>>>, []>>, false>;
853
882
  }>, []>>, false>;
854
883
  explicit_select_options: DB.MemberDecl<DB.ChildEntities<DB.Entity<"GeneralSelectOption", {
855
884
  parent: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionParentIdentifier", {
@@ -3,7 +3,7 @@ import { input, levels, maximum, name, name_in_library, rules } from "../_Activa
3
3
  import { ap_value, ap_value_append, ap_value_l10n } from "../_ActivatableAdventurePointsValue.js";
4
4
  import { combat_techniques, penalty, special_ability_usage_type, type, } from "../_ActivatableCombat.js";
5
5
  import { activatableDisplayNameCustomizer, nameBuilderRules } from "../_ActivatableNames.js";
6
- import { explicit_select_options, select_options } from "../_ActivatableSelectOptions.js";
6
+ import { explicit_select_options, select_options, verifySelectOptionRules, } from "../_ActivatableSelectOptions.js";
7
7
  import { skill_applications, skill_uses } from "../_ActivatableSkillApplicationsAndUses.js";
8
8
  import { GeneralPrerequisites } from "../_Prerequisite.js";
9
9
  import { NestedTranslationMap } from "../Locale.js";
@@ -51,4 +51,5 @@ export const AdvancedCombatSpecialAbility = DB.Entity(import.meta.url, {
51
51
  keyPathInEntityMapFallback: "name",
52
52
  },
53
53
  ],
54
+ customConstraints: deps => verifySelectOptionRules("AdvancedCombatSpecialAbility", deps),
54
55
  });
@@ -841,6 +841,35 @@ export declare const AdvancedKarmaSpecialAbility: DB.Entity<"AdvancedKarmaSpecia
841
841
  }>, []>>>, true>;
842
842
  }>, []>>>;
843
843
  }, []>>, false>;
844
+ rules: DB.MemberDecl<DB.IncludeIdentifier<[], DB.TypeAlias<"SelectOptionRules", DB.Array<DB.IncludeIdentifier<[], DB.TypeAlias<"SelectOptionRule", DB.Object<{
845
+ value: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionRuleValue", {
846
+ Predefined: DB.EnumCase<null>;
847
+ PredefinedOrTextInput: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"PredefinedOrTextInputSelectOptionRuleValue", DB.Object<{
848
+ translations: DB.MemberDecl<DB.NestedEntityMap<"PredefinedOrTextInputSelectOptionRuleValueTranslation", {
849
+ inputLabel: DB.MemberDecl<DB.String, true>;
850
+ optionLabel: DB.MemberDecl<DB.String, true>;
851
+ }>, true>;
852
+ }>, []>>>;
853
+ Child: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"ChildSelectOptionRuleValue", DB.Object<{
854
+ parentIndex: DB.MemberDecl<DB.Integer, true>;
855
+ entity: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"ChildEntityForSelectOption", {
856
+ SkillApplication: DB.EnumCase<null>;
857
+ }, []>>, true>;
858
+ }>, []>>>;
859
+ TextInput: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"TextInputSelectOptionRuleValue", DB.Object<{
860
+ translations: DB.MemberDecl<DB.NestedEntityMap<"TextInputSelectOptionRuleValueTranslation", {
861
+ inputLabel: DB.MemberDecl<DB.String, true>;
862
+ }>, true>;
863
+ }>, []>>>;
864
+ }, []>>, true>;
865
+ multiple: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionRuleMultiple", {
866
+ Constant: DB.EnumCase<DB.Integer>;
867
+ Range: DB.EnumCase<DB.Object<{
868
+ min: DB.MemberDecl<DB.Integer, false>;
869
+ max: DB.MemberDecl<DB.Integer, true>;
870
+ }>>;
871
+ }, []>>, false>;
872
+ }>, []>>>, []>>, false>;
844
873
  }>, []>>, false>;
845
874
  explicit_select_options: DB.MemberDecl<DB.ChildEntities<DB.Entity<"GeneralSelectOption", {
846
875
  parent: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionParentIdentifier", {
@@ -2,7 +2,7 @@ import * as DB from "tsondb/schema/dsl";
2
2
  import { levels, maximum, name, name_in_library, rules } from "../_Activatable.js";
3
3
  import { ap_value, ap_value_append, ap_value_l10n } from "../_ActivatableAdventurePointsValue.js";
4
4
  import { activatableDisplayNameCustomizer, nameBuilderRules } from "../_ActivatableNames.js";
5
- import { explicit_select_options, select_options } from "../_ActivatableSelectOptions.js";
5
+ import { explicit_select_options, select_options, verifySelectOptionRules, } from "../_ActivatableSelectOptions.js";
6
6
  import { skill_applications, skill_uses } from "../_ActivatableSkillApplicationsAndUses.js";
7
7
  import { GeneralPrerequisites } from "../_Prerequisite.js";
8
8
  import { NestedTranslationMap } from "../Locale.js";
@@ -45,4 +45,5 @@ export const AdvancedKarmaSpecialAbility = DB.Entity(import.meta.url, {
45
45
  keyPathInEntityMapFallback: "name",
46
46
  },
47
47
  ],
48
+ customConstraints: deps => verifySelectOptionRules("AdvancedKarmaSpecialAbility", deps),
48
49
  });
@@ -841,6 +841,35 @@ export declare const AdvancedMagicalSpecialAbility: DB.Entity<"AdvancedMagicalSp
841
841
  }>, []>>>, true>;
842
842
  }>, []>>>;
843
843
  }, []>>, false>;
844
+ rules: DB.MemberDecl<DB.IncludeIdentifier<[], DB.TypeAlias<"SelectOptionRules", DB.Array<DB.IncludeIdentifier<[], DB.TypeAlias<"SelectOptionRule", DB.Object<{
845
+ value: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionRuleValue", {
846
+ Predefined: DB.EnumCase<null>;
847
+ PredefinedOrTextInput: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"PredefinedOrTextInputSelectOptionRuleValue", DB.Object<{
848
+ translations: DB.MemberDecl<DB.NestedEntityMap<"PredefinedOrTextInputSelectOptionRuleValueTranslation", {
849
+ inputLabel: DB.MemberDecl<DB.String, true>;
850
+ optionLabel: DB.MemberDecl<DB.String, true>;
851
+ }>, true>;
852
+ }>, []>>>;
853
+ Child: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"ChildSelectOptionRuleValue", DB.Object<{
854
+ parentIndex: DB.MemberDecl<DB.Integer, true>;
855
+ entity: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"ChildEntityForSelectOption", {
856
+ SkillApplication: DB.EnumCase<null>;
857
+ }, []>>, true>;
858
+ }>, []>>>;
859
+ TextInput: DB.EnumCase<DB.IncludeIdentifier<[], DB.TypeAlias<"TextInputSelectOptionRuleValue", DB.Object<{
860
+ translations: DB.MemberDecl<DB.NestedEntityMap<"TextInputSelectOptionRuleValueTranslation", {
861
+ inputLabel: DB.MemberDecl<DB.String, true>;
862
+ }>, true>;
863
+ }>, []>>>;
864
+ }, []>>, true>;
865
+ multiple: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionRuleMultiple", {
866
+ Constant: DB.EnumCase<DB.Integer>;
867
+ Range: DB.EnumCase<DB.Object<{
868
+ min: DB.MemberDecl<DB.Integer, false>;
869
+ max: DB.MemberDecl<DB.Integer, true>;
870
+ }>>;
871
+ }, []>>, false>;
872
+ }>, []>>>, []>>, false>;
844
873
  }>, []>>, false>;
845
874
  explicit_select_options: DB.MemberDecl<DB.ChildEntities<DB.Entity<"GeneralSelectOption", {
846
875
  parent: DB.MemberDecl<DB.IncludeIdentifier<[], DB.Enum<"SelectOptionParentIdentifier", {
@@ -2,7 +2,7 @@ import * as DB from "tsondb/schema/dsl";
2
2
  import { levels, maximum, name, name_in_library, rules } from "../_Activatable.js";
3
3
  import { ap_value, ap_value_append, ap_value_l10n } from "../_ActivatableAdventurePointsValue.js";
4
4
  import { activatableDisplayNameCustomizer, nameBuilderRules } from "../_ActivatableNames.js";
5
- import { explicit_select_options, select_options } from "../_ActivatableSelectOptions.js";
5
+ import { explicit_select_options, select_options, verifySelectOptionRules, } from "../_ActivatableSelectOptions.js";
6
6
  import { skill_applications, skill_uses } from "../_ActivatableSkillApplicationsAndUses.js";
7
7
  import { GeneralPrerequisites } from "../_Prerequisite.js";
8
8
  import { NestedTranslationMap } from "../Locale.js";
@@ -45,4 +45,5 @@ export const AdvancedMagicalSpecialAbility = DB.Entity(import.meta.url, {
45
45
  keyPathInEntityMapFallback: "name",
46
46
  },
47
47
  ],
48
+ customConstraints: deps => verifySelectOptionRules("AdvancedMagicalSpecialAbility", deps),
48
49
  });