coh-content-db 2.0.0-rc.4 → 2.0.0-rc.6

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 (64) hide show
  1. package/README.md +31 -7
  2. package/dist/coh-content-db.d.ts +353 -185
  3. package/dist/coh-content-db.js +460 -300
  4. package/dist/coh-content-db.js.map +1 -1
  5. package/dist/coh-content-db.mjs +448 -294
  6. package/dist/coh-content-db.mjs.map +1 -1
  7. package/package.json +1 -4
  8. package/src/main/api/alternate-data.ts +2 -2
  9. package/src/main/api/badge-data.ts +21 -19
  10. package/src/main/api/badge-requirement-data.ts +82 -0
  11. package/src/main/api/badge-requirement-type.ts +11 -0
  12. package/src/main/api/change.ts +5 -2
  13. package/src/main/api/contact-data.ts +46 -0
  14. package/src/main/api/content-bundle.ts +12 -7
  15. package/src/main/api/markdown-string.ts +4 -0
  16. package/src/main/api/zone-data.ts +20 -0
  17. package/src/main/changelog.ts +7 -2
  18. package/src/main/db/alignments.ts +17 -0
  19. package/src/main/db/alternates.ts +8 -14
  20. package/src/main/db/badge-index.ts +93 -0
  21. package/src/main/db/badge-requirement.ts +102 -0
  22. package/src/main/db/badge-search-options.ts +51 -0
  23. package/src/main/db/badge.ts +55 -48
  24. package/src/main/db/bundle-metadata.ts +5 -6
  25. package/src/main/db/coh-content-database.ts +65 -40
  26. package/src/main/db/contact.ts +59 -0
  27. package/src/main/db/paged.ts +7 -0
  28. package/src/main/db/zone.ts +28 -0
  29. package/src/main/index.ts +15 -11
  30. package/src/main/util.ts +68 -7
  31. package/src/test/api/alignments.test.ts +40 -0
  32. package/src/test/api/badge-data.fixture.ts +9 -7
  33. package/src/test/api/badge-requirement-data.fixture.ts +17 -0
  34. package/src/test/api/badge-requirement-type.test.ts +31 -0
  35. package/src/test/api/contact-data.fixture.ts +13 -0
  36. package/src/test/api/content-bundle.fixture.ts +2 -2
  37. package/src/test/api/content-bundle.test.ts +1 -1
  38. package/src/test/api/zone-data.fixture.ts +8 -0
  39. package/src/test/db/alternates.test.ts +16 -74
  40. package/src/test/db/badge-index.test.ts +520 -0
  41. package/src/test/db/badge-requirement.test.ts +180 -0
  42. package/src/test/db/badge.test.ts +190 -15
  43. package/src/test/db/coh-content-database.test.ts +125 -18
  44. package/src/test/db/contact.test.ts +96 -0
  45. package/src/test/db/zone.test.ts +36 -0
  46. package/src/test/index.test.ts +6 -2
  47. package/src/test/util.test.ts +91 -18
  48. package/src/main/api/badge-partial-data.ts +0 -65
  49. package/src/main/api/badge-partial-type.ts +0 -8
  50. package/src/main/api/game-map-data.ts +0 -26
  51. package/src/main/api/vidiot-map-data.ts +0 -18
  52. package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
  53. package/src/main/db/badge-partial.ts +0 -35
  54. package/src/main/db/badge-search-document.ts +0 -16
  55. package/src/main/db/game-map.ts +0 -33
  56. package/src/main/db/vidiot-map-point-of-interest.ts +0 -40
  57. package/src/main/db/vidiot-map.ts +0 -25
  58. package/src/test/api/badge-partial-data.fixture.ts +0 -17
  59. package/src/test/api/badge-partial-type.test.ts +0 -31
  60. package/src/test/api/game-map-data.fixture.ts +0 -10
  61. package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
  62. package/src/test/api/vidiot-map.fixture.ts +0 -9
  63. package/src/test/db/badge-search-document.test.ts +0 -35
  64. package/src/test/db/coh-content-database-search.test.ts +0 -119
@@ -11,11 +11,11 @@ interface AlternateData<V> {
11
11
  /**
12
12
  * The character alignment this alternate applies to.
13
13
  */
14
- readonly alignment?: Alignment | string;
14
+ readonly alignment?: Alignment;
15
15
  /**
16
16
  * The character sex this alternate applies to.
17
17
  */
18
- readonly sex?: Sex | string;
18
+ readonly sex?: Sex;
19
19
  /**
20
20
  * The value for this combination.
21
21
  */
@@ -31,25 +31,35 @@ interface ArchetypeData {
31
31
  declare const ENHANCEMENT_CATEGORY: readonly ["DEFENSE_DEBUFF", "TO_HIT_DEBUFF", "TAUNT", "CONFUSE", "HEALING", "DEFENSE_BUFF", "RESIST_DAMAGE", "INTANGIBILITY", "SLEEP", "SLOW", "HOLD", "STUN", "IMMOBILIZE", "FEAR", "ENDURANCE_MODIFICATION", "ENDURANCE_REDUCTION", "RECHARGE_REDUCTION", "INTERRUPT_DURATION", "ACCURACY", "TO_HIT_BUFF", "DAMAGE", "KNOCKBACK", "RUN_SPEED", "JUMP", "FLY_SPEED", "RANGE"];
32
32
  type EnhancementCategory = typeof ENHANCEMENT_CATEGORY[number];
33
33
 
34
- declare const BADGE_PARTIAL_TYPE: readonly ["PLAQUE", "BADGE", "INVENTION", "INVENTION_PLUS_ONE"];
35
- type BadgePartialType = typeof BADGE_PARTIAL_TYPE[number];
34
+ declare const BADGE_REQUIREMENT_TYPE: readonly ["PLAQUE", "BADGE", "INVENTION", "MISSION", "ARC", "TASK_FORCE", "INVENTION_PLUS_ONE"];
35
+ type BadgeRequirementType = typeof BADGE_REQUIREMENT_TYPE[number];
36
36
 
37
37
  declare const PLAQUE_TYPE: string[];
38
38
  type PlaqueType = typeof PLAQUE_TYPE[number];
39
39
 
40
- interface BadgePartialData {
40
+ /**
41
+ * Tage type to indicate that a string will accept {@link https://www.markdownguide.org/|Markdown} format.
42
+ */
43
+ type MarkdownString = string;
44
+
45
+ interface Link {
46
+ title: string;
47
+ href: string;
48
+ }
49
+
50
+ interface BadgeRequirementData {
41
51
  /**
42
52
  * Key.
43
53
  */
44
54
  readonly key: string;
45
55
  /**
46
- * Type of partial.
56
+ * Type of requirement.
47
57
  */
48
- readonly type: BadgePartialType | string;
58
+ readonly type: BadgeRequirementType;
49
59
  /**
50
- * Map the partial is located on.
60
+ * Zone the requirement is located in.
51
61
  */
52
- readonly mapKey?: string;
62
+ readonly zoneKey?: string;
53
63
  /**
54
64
  * /loc coordinates.
55
65
  */
@@ -57,19 +67,27 @@ interface BadgePartialData {
57
67
  /**
58
68
  * Is it a wall plaque or a physical monument?
59
69
  */
60
- readonly plaqueType?: PlaqueType | string;
70
+ readonly plaqueType?: PlaqueType;
61
71
  /**
62
72
  * Plaque inscription.
63
73
  */
64
- readonly inscription?: string;
74
+ readonly plaqueInscription?: string;
65
75
  /**
66
- * The number or letter the partial appears as on Vidiot Maps.
76
+ * The number or letter the plaque appears as on Vidiot Maps.
67
77
  */
68
78
  readonly vidiotMapKey?: string;
69
79
  /**
70
- * The badge required for this partial.
80
+ * The key of the badge for this requirement.
71
81
  */
72
82
  readonly badgeKey?: string;
83
+ /**
84
+ * Mission name.
85
+ */
86
+ readonly missionName?: string;
87
+ /**
88
+ * {@link Contact} key for the story arc.
89
+ */
90
+ readonly contactKey?: string;
73
91
  /**
74
92
  * Level of the invention required.
75
93
  */
@@ -77,7 +95,7 @@ interface BadgePartialData {
77
95
  /**
78
96
  * The types of enhancements required to be crafted.
79
97
  */
80
- readonly inventionTypes?: (EnhancementCategory | string)[];
98
+ readonly inventionTypes?: EnhancementCategory[];
81
99
  /**
82
100
  * Number of invention crafts required.
83
101
  */
@@ -85,12 +103,11 @@ interface BadgePartialData {
85
103
  /**
86
104
  * Any additional notes.
87
105
  */
88
- readonly notes?: string;
89
- }
90
-
91
- interface Link {
92
- title: string;
93
- href: string;
106
+ readonly notes?: MarkdownString;
107
+ /**
108
+ * List of external links. Wiki, forums, etc.
109
+ */
110
+ readonly links?: Link[];
94
111
  }
95
112
 
96
113
  declare const BADGE_TYPE: readonly ["EXPLORATION", "HISTORY", "ACCOMPLISHMENT", "ACHIEVEMENT", "ACCOLADE", "GLADIATOR", "VETERAN", "PVP", "INVENTION", "DEFEAT", "EVENT", "OUROBOROS", "CONSIGNMENT", "DAY_JOB", "AE"];
@@ -106,7 +123,7 @@ interface BadgeData {
106
123
  /**
107
124
  * The type of badge.
108
125
  */
109
- readonly type: BadgeType | string;
126
+ readonly type: BadgeType;
110
127
  /**
111
128
  * The name of this badge.
112
129
  *
@@ -122,11 +139,9 @@ interface BadgeData {
122
139
  */
123
140
  readonly badgeText?: AlternateData<string>[];
124
141
  /**
125
- * Description of how to acquire the badge.
126
- *
127
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
142
+ * Short description of how to acquire the badge. Detailed instructions should go in the notes field.
128
143
  */
129
- readonly acquisition?: string;
144
+ readonly acquisition?: MarkdownString;
130
145
  /**
131
146
  * List of absolute URLs for this badge's icons.
132
147
  *
@@ -135,24 +150,22 @@ interface BadgeData {
135
150
  readonly icon?: AlternateData<string>[];
136
151
  /**
137
152
  * Freeform notes or tips about the badge.
138
- *
139
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
140
153
  */
141
- readonly notes?: string;
154
+ readonly notes?: MarkdownString;
142
155
  /**
143
- * List of external links for this Badge. Wiki, forums, etc.
156
+ * List of external links. Wiki, forums, etc.
144
157
  */
145
158
  readonly links?: Link[];
146
159
  /**
147
- * For exploration badges, the key of the {@link GameMapData|GameMap} that this badge is found on.
160
+ * For exploration badges, the key of the {@link ZoneData|Zone} that this badge is found on.
148
161
  */
149
- readonly mapKey?: string;
162
+ readonly zoneKey?: string;
150
163
  /**
151
- * For exploration badges, the `/loc` coordinates of the badge on the in-game map.
164
+ * For exploration badges, the `/loc` coordinates of the badge.
152
165
  */
153
166
  readonly loc?: [number, number, number];
154
167
  /**
155
- * For badges that appear on a Vidiot Map, the number or letter the badge appears as.
168
+ * For plaques that appear on a Vidiot Map, the number or letter the badge appears as.
156
169
  */
157
170
  readonly vidiotMapKey?: string;
158
171
  /**
@@ -170,14 +183,19 @@ interface BadgeData {
170
183
  };
171
184
  /**
172
185
  * A description of the effect the badge will have, such as a buff or granting a temporary power.
173
- *
174
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
175
186
  */
176
- readonly effect?: string;
187
+ readonly effect?: MarkdownString;
177
188
  /**
178
- * A list of requirements for badges that have partial fulfilment steps, such as visiting plaques for history badges, or collecting other badges for meta-badges like accolades.
189
+ * Represents the layered requirements for badges with multiple fulfillment steps,
190
+ * such as visiting plaques for history badges or collecting other badges.
191
+ *
192
+ * The outer array represents groups of requirements evaluated with OR logic —
193
+ * fulfilling any group satisfies the badge.
194
+ *
195
+ * Each inner array represents individual requirements evaluated with AND logic —
196
+ * all conditions in the group must be met.
179
197
  */
180
- readonly partials?: BadgePartialData[];
198
+ readonly requirements?: BadgeRequirementData[][];
181
199
  /**
182
200
  * Some badges are not included in the badge total count... such as Flames of Prometheus, which can be removed by redeeming it for a Notice of the Well.
183
201
  */
@@ -194,72 +212,63 @@ interface Change {
194
212
  */
195
213
  date: Date;
196
214
  /**
197
- * Description of the change in {@link https://www.markdownguide.org/|Markdown} format.
215
+ * Description of the change.
198
216
  */
199
- description: string;
217
+ description: MarkdownString;
200
218
  }
201
219
 
202
- interface VidiotMapPointOfInterestData {
220
+ interface ContactData {
203
221
  /**
204
- * The pixel-space position of the PoI on the map graphic.
222
+ * Unique key used to reference this contact.
205
223
  *
206
- * Screen-space, pixels from top-left `[0, 0]`.
224
+ * Keys can only contain lowercase letters, numbers and hyphens (`-`).
207
225
  */
208
- readonly pos?: [number, number];
226
+ readonly key: string;
209
227
  /**
210
- * Freeform notes about the PoI.
211
- *
212
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
228
+ * The name of this contact.
213
229
  */
214
- readonly notes?: string;
230
+ readonly name: string;
215
231
  /**
216
- * If the POI is a zone transfer, the map it transfers to.
232
+ * The contact's title.
217
233
  */
218
- readonly mapKey?: string;
234
+ readonly title?: string;
219
235
  /**
220
- * If the POI is a badge, the badge.
236
+ * The zone this character is located in.
221
237
  */
222
- readonly badgeKey?: string;
238
+ readonly zoneKey?: string;
223
239
  /**
224
- * If the POI is a partial for a badge, the partial key.
240
+ * The `/loc` coordinates of the contact.
225
241
  */
226
- readonly badgePartialKey?: string;
227
- }
228
-
229
- interface VidiotMapData {
242
+ readonly loc?: [number, number, number];
230
243
  /**
231
- * URL of the map image.
244
+ * The level range this contact will offer missions for.
232
245
  */
233
- readonly imageUrl: string;
246
+ readonly levelRange?: [number, number?];
234
247
  /**
235
- * Name to display for the Vidiot map.
248
+ * Freeform notes or tips about the contact.
236
249
  */
237
- readonly name?: string;
250
+ readonly notes?: MarkdownString;
238
251
  /**
239
- * List of Points of Interest labelled on the image.
252
+ * List of external links. Wiki, forums, etc.
240
253
  */
241
- readonly pointsOfInterest?: VidiotMapPointOfInterestData[];
254
+ readonly links?: Link[];
242
255
  }
243
256
 
244
- interface GameMapData {
257
+ interface ZoneData {
245
258
  /**
246
- * Unique key used to reference this badge.
259
+ * Unique key used to reference this zone.
247
260
  *
248
261
  * Keys can only contain lowercase letters, numbers and hyphens (`-`).
249
262
  */
250
263
  readonly key: string;
251
264
  /**
252
- * The name of the map as it appears in-game.
265
+ * The name of the zone as it appears in-game.
253
266
  */
254
267
  readonly name: string;
255
268
  /**
256
- * List of external links for this Map. Wiki, forums, etc.
269
+ * List of external links. Wiki, forums, etc.
257
270
  */
258
271
  readonly links?: Link[];
259
- /**
260
- * List of Vidiot Map assets for this map.
261
- */
262
- readonly vidiotMaps?: VidiotMapData[];
263
272
  }
264
273
 
265
274
  /**
@@ -272,16 +281,14 @@ interface ContentBundle {
272
281
  readonly name: string;
273
282
  /**
274
283
  * Description of the fork.
275
- *
276
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
277
284
  */
278
- readonly description?: string;
285
+ readonly description?: MarkdownString;
279
286
  /**
280
287
  * Repository where the db content package is maintained.
281
288
  */
282
289
  readonly repository?: string;
283
290
  /**
284
- * List of external links for this Badge. Wiki, forums, etc.
291
+ * List of external links. Wiki, forums, etc.
285
292
  */
286
293
  readonly links?: Link[];
287
294
  /**
@@ -294,9 +301,13 @@ interface ContentBundle {
294
301
  */
295
302
  readonly archetypes?: ArchetypeData[];
296
303
  /**
297
- * List of game maps supported by this fork.
304
+ * List of zones supported by this fork.
298
305
  */
299
- readonly maps?: GameMapData[];
306
+ readonly zones?: ZoneData[];
307
+ /**
308
+ * List of contacts available in this fork.
309
+ */
310
+ readonly contacts?: ContactData[];
300
311
  /**
301
312
  * List of badges available on this fork.
302
313
  */
@@ -307,6 +318,34 @@ interface ContentBundle {
307
318
  readonly changelog?: Change[];
308
319
  }
309
320
 
321
+ declare class Alignments {
322
+ readonly items: Alignment[];
323
+ readonly hero: boolean;
324
+ readonly villain: boolean;
325
+ readonly praetorian: boolean;
326
+ readonly primal: boolean;
327
+ constructor(raw: Alignment[]);
328
+ }
329
+
330
+ declare class Alternates<T> {
331
+ #private;
332
+ constructor(values: AlternateData<T>[]);
333
+ getValue(alignment?: Alignment, sex?: Sex): T | undefined;
334
+ /**
335
+ * Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
336
+ */
337
+ get default(): AlternateData<T> | undefined;
338
+ /**
339
+ * Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
340
+ */
341
+ get canonical(): AlternateData<T>[];
342
+ /**
343
+ * Create a joined string from the alternate values in canonical order.
344
+ * @param separator Separator to use. Default is ' / '
345
+ */
346
+ toString(separator: string): string;
347
+ }
348
+
310
349
  declare class Archetype {
311
350
  readonly key: string;
312
351
  readonly name: string;
@@ -314,39 +353,68 @@ declare class Archetype {
314
353
  constructor(data: ArchetypeData);
315
354
  }
316
355
 
317
- declare class BadgePartial {
356
+ declare class BadgeRequirement {
357
+ /**
358
+ * Key.
359
+ */
318
360
  readonly key: string;
319
- readonly type: BadgePartialType | string;
320
- readonly mapKey?: string;
361
+ /**
362
+ * Type of requirement.
363
+ */
364
+ readonly type: BadgeRequirementType;
365
+ /**
366
+ * Zone the requirement is located in.
367
+ */
368
+ readonly zoneKey?: string;
369
+ /**
370
+ * /loc coordinates.
371
+ */
321
372
  readonly loc?: number[];
322
- readonly plaqueType?: PlaqueType | string;
323
- readonly inscription?: string;
373
+ /**
374
+ * Is it a wall plaque or a physical monument?
375
+ */
376
+ readonly plaqueType?: PlaqueType;
377
+ /**
378
+ * Plaque inscription.
379
+ */
380
+ readonly plaqueInscription?: string;
381
+ /**
382
+ * The number or letter the plaque appears as on Vidiot Maps.
383
+ */
324
384
  readonly vidiotMapKey?: string;
385
+ /**
386
+ * The key of the badge for this requirement.
387
+ */
325
388
  readonly badgeKey?: string;
389
+ /**
390
+ * Mission name.
391
+ */
392
+ readonly missionName?: string;
393
+ /**
394
+ * {@link Contact} key for the story arc.
395
+ */
396
+ readonly contactKey?: string;
397
+ /**
398
+ * Level of the invention required.
399
+ */
326
400
  readonly inventionLevel?: number;
327
- readonly inventionTypes?: (EnhancementCategory | string)[];
328
- readonly inventionCount?: number;
329
- readonly notes?: string;
330
- constructor(data: BadgePartialData);
331
- }
332
-
333
- declare class Alternates<T> {
334
- #private;
335
- constructor(values: AlternateData<T>[]);
336
- getValue(alignment?: Alignment | string, sex?: Sex | string): T | undefined;
337
401
  /**
338
- * Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
402
+ * The types of enhancements required to be crafted.
339
403
  */
340
- get default(): T | undefined;
404
+ readonly inventionTypes?: EnhancementCategory[];
341
405
  /**
342
- * Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
406
+ * Number of invention crafts required.
343
407
  */
344
- get canonical(): AlternateData<T>[];
408
+ readonly inventionCount?: number;
345
409
  /**
346
- * Create a joined string from the alternate values in canonical order.
347
- * @param separator Separator to use. Default is ' / '
410
+ * Any additional notes.
348
411
  */
349
- toString(separator: string): string;
412
+ readonly notes?: MarkdownString;
413
+ /**
414
+ * List of external links. Wiki, forums, etc.
415
+ */
416
+ readonly links: Link[];
417
+ constructor(data: BadgeRequirementData);
350
418
  }
351
419
 
352
420
  declare class Badge {
@@ -358,7 +426,7 @@ declare class Badge {
358
426
  /**
359
427
  * The type of badge.
360
428
  */
361
- readonly type: BadgeType | string;
429
+ readonly type: BadgeType;
362
430
  /**
363
431
  * The name of this badge.
364
432
  *
@@ -368,17 +436,15 @@ declare class Badge {
368
436
  /**
369
437
  * The character alignments that this badge is available to.
370
438
  */
371
- readonly alignment: Alignment[];
439
+ readonly alignment: Alignments;
372
440
  /**
373
441
  * The badge text as it appears in-game. May vary by character sex or alignment.
374
442
  */
375
443
  readonly badgeText: Alternates<string>;
376
444
  /**
377
- * Description of how to acquire the badge.
378
- *
379
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
445
+ * Short description of how to acquire the badge. Detailed instructions will be in the notes field.
380
446
  */
381
- readonly acquisition?: string;
447
+ readonly acquisition?: MarkdownString;
382
448
  /**
383
449
  * Absolute URL to this badge's icon.
384
450
  *
@@ -387,24 +453,22 @@ declare class Badge {
387
453
  readonly icon: Alternates<string>;
388
454
  /**
389
455
  * Freeform notes or tips about the badge.
390
- *
391
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
392
456
  */
393
- readonly notes?: string;
457
+ readonly notes?: MarkdownString;
394
458
  /**
395
- * List of external links for this Badge. Wiki, forums, etc.
459
+ * List of external links. Wiki, forums, etc.
396
460
  */
397
- readonly links?: Link[];
461
+ readonly links: Link[];
398
462
  /**
399
- * For exploration badges, the key of the {@link GameMap} that this badge is found on.
463
+ * For exploration badges, the key of the {@link Zone} that this badge is found on.
400
464
  */
401
- readonly mapKey?: string;
465
+ readonly zoneKey?: string;
402
466
  /**
403
- * For exploration badges, the `/loc` coordinates of the badge on the in-game map.
467
+ * For exploration badges, the `/loc` coordinates of the badge.
404
468
  */
405
469
  readonly loc?: [number, number, number];
406
470
  /**
407
- * For badges that appear on a Vidiot Map, the number or letter the badge appears as.
471
+ * For plaques that appear on a Vidiot Map, the number or letter the badge appears as.
408
472
  */
409
473
  readonly vidiotMapKey?: string;
410
474
  /**
@@ -422,110 +486,165 @@ declare class Badge {
422
486
  };
423
487
  /**
424
488
  * A description of the effect the badge will have, such as a buff or granting a temporary power.
425
- *
426
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
427
489
  */
428
- readonly effect?: string;
490
+ readonly effect?: MarkdownString;
429
491
  /**
430
- * A list of requirements for badges that have partial fulfilment steps, such as visiting plaques for history badges, or collecting other badges for meta-badges like accolades.
492
+ * Represents the layered requirements for badges with multiple fulfillment steps,
493
+ * such as visiting plaques for history badges or collecting other badges.
494
+ *
495
+ * The outer array represents groups of requirements evaluated with OR logic —
496
+ * fulfilling any group satisfies the badge.
497
+ *
498
+ * Each inner array represents individual requirements evaluated with AND logic —
499
+ * all conditions in the group must be met.
431
500
  */
432
- readonly partials?: BadgePartial[];
501
+ readonly requirements?: BadgeRequirement[][];
433
502
  /**
434
503
  * Some badges are not included in the badge total count... such as Flames of Prometheus, which can be removed by redeeming it for a Notice of the Well.
435
504
  */
436
505
  readonly ignoreInTotals: boolean;
437
- constructor(data: BadgeData);
438
- getPartial(key: string): BadgePartial;
506
+ constructor(badgeData: BadgeData);
507
+ getRequirement(key: string): BadgeRequirement;
439
508
  }
440
509
 
441
- declare class VidiotMapPointOfInterest {
510
+ interface BadgeSearchOptions {
442
511
  /**
443
- * The pixel-space position of the PoI on the map graphic.
512
+ * Text-based search.
444
513
  *
445
- * Screen-space, pixels from top-left `[0, 0]`.
446
- */
447
- readonly pos?: [number, number];
514
+ * Case-insensitive. Defaults to searching on name only.
515
+ */
516
+ query?: {
517
+ str?: string;
518
+ on?: {
519
+ name?: boolean;
520
+ badgeText?: boolean;
521
+ acquisition?: boolean;
522
+ notes?: boolean;
523
+ effect?: boolean;
524
+ setTitle?: boolean;
525
+ };
526
+ };
448
527
  /**
449
- * Freeform notes about the PoI.
450
- *
451
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
528
+ * Filter results matching the given values.
452
529
  */
453
- readonly notes?: string;
530
+ filter?: {
531
+ type?: BadgeType;
532
+ zoneKey?: string;
533
+ alignment?: Alignment;
534
+ };
454
535
  /**
455
- * If the POI is a zone transfer, the map it transfers to.
536
+ * Sort results.
537
+ *
538
+ * Badges are assumed to be in canonical order in the content bundle, and should match the in-game display order.
456
539
  */
457
- readonly mapKey?: string;
540
+ sort?: {
541
+ by?: 'CANONICAL' | 'BADGE_NAME' | 'ZONE_NAME';
542
+ dir?: 'ASC' | 'DESC';
543
+ };
458
544
  /**
459
- * If the POI is a badge, the badge.
545
+ * The page (1-based)
460
546
  */
461
- readonly badgeKey?: string;
547
+ page?: number;
462
548
  /**
463
- * If the POI is a partial for a badge, the partial key.
549
+ * How many results per page
464
550
  */
465
- readonly badgePartialKey?: string;
466
- constructor(data: VidiotMapPointOfInterestData);
551
+ pageSize?: number;
467
552
  }
468
553
 
469
- declare class VidiotMap {
554
+ declare class Zone {
470
555
  /**
471
- * URL of the map image.
556
+ * Unique key used to reference this zone.
557
+ *
558
+ * Keys can only contain lowercase letters, numbers and hyphens (`-`).
472
559
  */
473
- readonly imageUrl: string;
560
+ readonly key: string;
474
561
  /**
475
- * Name to display for the Vidiot map.
562
+ * The name of the zone as it appears in-game.
476
563
  */
477
- readonly name?: string;
564
+ readonly name: string;
478
565
  /**
479
- * List of Points of Interest labelled on the image.
566
+ * List of external links. Wiki, forums, etc.
480
567
  */
481
- readonly pointsOfInterest?: VidiotMapPointOfInterest[];
482
- constructor(data: VidiotMapData);
568
+ readonly links: Link[];
569
+ constructor(data: ZoneData);
570
+ }
571
+
572
+ interface Paged<T> {
573
+ items: T[];
574
+ page: number;
575
+ pageSize?: number;
576
+ totalItems: number;
577
+ totalPages: number;
483
578
  }
484
579
 
485
- declare class GameMap {
580
+ declare class BadgeIndex {
581
+ #private;
582
+ constructor(badges: Badge[], zones?: Zone[]);
583
+ getBadge(key: string): Badge;
584
+ badgeExists(key: string): boolean;
585
+ searchBadges(options?: BadgeSearchOptions): Paged<Badge>;
586
+ }
587
+
588
+ declare class BundleMetadata {
486
589
  /**
487
- * The database key for this map.
590
+ * Name of the content bundle.
488
591
  */
489
- readonly key: string;
592
+ readonly name: string;
490
593
  /**
491
- * The name of the map as it appears in-game.
594
+ * Description of the fork.
492
595
  */
493
- readonly name: string;
596
+ readonly description?: MarkdownString;
494
597
  /**
495
- * List of external links for this Map. Wiki, forums, etc.
598
+ * Repository where the db content package is maintained.
496
599
  */
497
- readonly links?: Link[];
600
+ readonly repository?: string;
498
601
  /**
499
- * List of Vidiot Map assets for this map.
602
+ * List of external links. Wiki, forums, etc.
500
603
  */
501
- readonly vidiotMaps?: VidiotMap[];
502
- constructor(data: GameMapData);
604
+ readonly links: Link[];
605
+ /**
606
+ * Change log for this data package.
607
+ */
608
+ readonly changelog: Change[];
609
+ constructor(bundle: ContentBundle);
503
610
  }
504
611
 
505
- declare class BundleMetadata {
612
+ declare class Contact {
613
+ /**
614
+ * Unique key used to reference this contact.
615
+ *
616
+ * Keys can only contain lowercase letters, numbers and hyphens (`-`).
617
+ */
618
+ readonly key: string;
506
619
  /**
507
- * Name of the server group.
620
+ * The name of this contact.
508
621
  */
509
622
  readonly name: string;
510
623
  /**
511
- * Description of the server group.
512
- *
513
- * Supports {@link https://www.markdownguide.org/|Markdown} format.
624
+ * The contact's title.
514
625
  */
515
- readonly description?: string;
626
+ readonly title?: string;
516
627
  /**
517
- * Repository where the db content package is maintained.
628
+ * The zone this character is located in.
518
629
  */
519
- readonly repository?: string;
630
+ readonly zoneKey?: string;
520
631
  /**
521
- * List of external links for this Server Group. Wiki, forums, etc.
632
+ * The `/loc` coordinates of the contact.
522
633
  */
523
- readonly links: Link[];
634
+ readonly loc?: [number, number, number];
524
635
  /**
525
- * Change log for this data package.
636
+ * The level range this contact will offer missions for.
526
637
  */
527
- readonly changelog: Change[];
528
- constructor(bundle: ContentBundle);
638
+ readonly levelRange?: [number, number?];
639
+ /**
640
+ * Freeform notes or tips about the contact.
641
+ */
642
+ readonly notes?: MarkdownString;
643
+ /**
644
+ * List of external links. Wiki, forums, etc.
645
+ */
646
+ readonly links: Link[];
647
+ constructor(contactData: ContactData);
529
648
  }
530
649
 
531
650
  declare class CohContentDatabase {
@@ -535,20 +654,25 @@ declare class CohContentDatabase {
535
654
  */
536
655
  readonly metadata: BundleMetadata;
537
656
  /**
538
- * List of the game server names in this server group.
657
+ * List of the game server names.
658
+ *
539
659
  * Torchbearer, Excelsior, etc.
540
660
  */
541
661
  readonly servers: string[];
542
662
  /**
543
- * List of archetypes available in this server group.
663
+ * List of archetypes.
544
664
  */
545
665
  readonly archetypes: Archetype[];
546
666
  /**
547
- * List of game maps supported by this server group.
667
+ * List of game zones.
668
+ */
669
+ readonly zones: Zone[];
670
+ /**
671
+ * List of contacts.
548
672
  */
549
- readonly maps: GameMap[];
673
+ readonly contacts: Contact[];
550
674
  /**
551
- * List of badges available on this server group.
675
+ * List of badges.
552
676
  */
553
677
  readonly badges: Badge[];
554
678
  /**
@@ -557,9 +681,19 @@ declare class CohContentDatabase {
557
681
  */
558
682
  constructor(bundle: ContentBundle);
559
683
  getArchetype(key: string): Archetype;
560
- getMap(key: string): GameMap;
684
+ getZone(key: string): Zone;
685
+ getContact(key: string): Contact;
686
+ zoneExists(key: string): boolean;
687
+ contactExists(key: string): boolean;
561
688
  getBadge(key: string): Badge;
562
- searchBadges(query?: string): Badge[];
689
+ badgeExists(key: string): boolean;
690
+ /**
691
+ * Search, sort and filter the badge list.
692
+ * This is a fairly brute-forced approach and will not be as performant as loading the badge data into a traditional
693
+ * database engine, but is sufficient for most operations.
694
+ * @param options {@link BadgeSearchOptions}
695
+ */
696
+ searchBadges(options?: BadgeSearchOptions): Paged<Badge>;
563
697
  }
564
698
 
565
699
  declare class Key {
@@ -571,18 +705,52 @@ declare class Key {
571
705
  declare const CHANGELOG: Change[];
572
706
 
573
707
  /**
574
- * Create a reference string that can be used in most text strings to display a link to the given badge.
708
+ * Returns the URI of the given badge that can be used in {@link MarkdownString} links.
709
+ *
710
+ * URI format: `badge://<key>`
711
+ *
575
712
  * @param target The badge or badge key to target.
576
713
  */
577
- declare function createBadgeReference(target: string | {
578
- key: string;
579
- }): string;
714
+ declare function badgeUri(target: string | Badge | BadgeData): string;
715
+ /**
716
+ * Returns a {@link MarkdownString} link to the given badge.
717
+ *
718
+ * Link format: `[<key>](badge://<key>)`
719
+ *
720
+ * @param target The {@link Badge} or badge key to target.
721
+ */
722
+ declare function badgeLink(target: string | Badge | BadgeData): string;
723
+ /**
724
+ * Returns the URI of the given contact that can be used in {@link MarkdownString} links.
725
+ *
726
+ * URI format: `contact://<key>`
727
+ *
728
+ * @param target The {@link Contact} or contact key to target.
729
+ */
730
+ declare function contactUri(target: string | Contact | ContactData): string;
731
+ /**
732
+ * Returns a {@link MarkdownString} link to the given contact.
733
+ *
734
+ * Link format: `[<key>](contact://<key>)`
735
+ *
736
+ * @param target The {@link Contact} or contact key to target.
737
+ */
738
+ declare function contactLink(target: string | Contact | ContactData): string;
739
+ /**
740
+ * Returns the URI of the given zone that can be used in {@link MarkdownString} links.
741
+ *
742
+ * URI format: `zone://<key>`
743
+ *
744
+ * @param target The {@link Zone} or zone key to target.
745
+ */
746
+ declare function zoneUri(target: string | Zone | ZoneData): string;
580
747
  /**
581
- * Create a reference string that can be used in most text strings to display a link to the given map.
582
- * @param target The {@link GameMap} or map key to target.
748
+ * Returns a {@link MarkdownString} link to the given zone.
749
+ *
750
+ * Link format: `[<key>](zone://<key>)`
751
+ *
752
+ * @param target The {@link Zone} or zone key to target.
583
753
  */
584
- declare function createMapReference(target: string | {
585
- key: string;
586
- }): string;
754
+ declare function zoneLink(target: string | Zone | ZoneData): string;
587
755
 
588
- export { ALIGNMENT, type Alignment, type AlternateData, Archetype, type ArchetypeData, BADGE_PARTIAL_TYPE, BADGE_TYPE, Badge, type BadgeData, BadgePartial, type BadgePartialData, type BadgePartialType, type BadgeType, BundleMetadata, CHANGELOG, type Change, CohContentDatabase, type ContentBundle, ENHANCEMENT_CATEGORY, type EnhancementCategory, GameMap, type GameMapData, Key, type Link, PLAQUE_TYPE, type PlaqueType, SEX, type Sex, VidiotMap, type VidiotMapData, VidiotMapPointOfInterest, type VidiotMapPointOfInterestData, createBadgeReference, createMapReference };
756
+ export { ALIGNMENT, type Alignment, Alignments, type AlternateData, Alternates, Archetype, type ArchetypeData, BADGE_REQUIREMENT_TYPE, BADGE_TYPE, Badge, type BadgeData, BadgeIndex, BadgeRequirement, type BadgeRequirementData, type BadgeRequirementType, type BadgeSearchOptions, type BadgeType, BundleMetadata, CHANGELOG, type Change, CohContentDatabase, Contact, type ContactData, type ContentBundle, ENHANCEMENT_CATEGORY, type EnhancementCategory, Key, type Link, type MarkdownString, PLAQUE_TYPE, type Paged, type PlaqueType, SEX, type Sex, Zone, type ZoneData, badgeLink, badgeUri, contactLink, contactUri, zoneLink, zoneUri };