coh-content-db 1.4.1 → 2.0.0-rc.10

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 (101) hide show
  1. package/.editorconfig +24 -0
  2. package/.github/workflows/build.yml +38 -0
  3. package/.github/workflows/pull-request.yml +32 -0
  4. package/.github/workflows/release.yml +52 -0
  5. package/CHANGELOG.md +42 -0
  6. package/LICENSE +24 -674
  7. package/README.md +101 -16
  8. package/dist/coh-content-db.d.ts +988 -22
  9. package/dist/coh-content-db.js +1044 -2
  10. package/dist/coh-content-db.js.map +1 -0
  11. package/dist/coh-content-db.mjs +1009 -0
  12. package/dist/coh-content-db.mjs.map +1 -0
  13. package/eslint.config.mjs +31 -0
  14. package/jest.config.mjs +7 -0
  15. package/package.json +31 -23
  16. package/rollup.config.mjs +27 -0
  17. package/src/main/api/alignment.ts +19 -0
  18. package/src/main/api/alternate-data.ts +22 -0
  19. package/src/main/api/archetype-data.ts +5 -0
  20. package/src/main/api/badge-data.ts +81 -0
  21. package/src/main/api/badge-requirement-data.ts +64 -0
  22. package/src/main/api/badge-requirement-type.ts +32 -0
  23. package/src/main/api/badge-type.ts +19 -0
  24. package/src/main/api/bundle-data.ts +47 -0
  25. package/src/main/api/bundle-header-data.ts +37 -0
  26. package/src/main/api/contact-data.ts +48 -0
  27. package/src/main/api/enhancement-category.ts +30 -0
  28. package/src/main/api/link.ts +4 -0
  29. package/src/main/api/location-data.ts +28 -0
  30. package/src/main/api/markdown-string.ts +4 -0
  31. package/src/main/api/mission-data.ts +83 -0
  32. package/src/main/api/mission-type.ts +2 -0
  33. package/src/main/api/morality.ts +31 -0
  34. package/src/main/api/sex.ts +10 -0
  35. package/src/main/api/zone-data.ts +20 -0
  36. package/src/main/db/abstract-index.ts +37 -0
  37. package/src/main/db/alignment-list.ts +54 -0
  38. package/src/main/db/alternates.ts +67 -0
  39. package/src/main/db/archetype.ts +14 -0
  40. package/src/main/db/badge-index.ts +57 -0
  41. package/src/main/db/badge-requirement.ts +81 -0
  42. package/src/main/db/badge-search-options.ts +51 -0
  43. package/src/main/db/badge.ts +147 -0
  44. package/src/main/db/bundle-header.ts +44 -0
  45. package/src/main/db/coh-content-database.ts +138 -0
  46. package/src/main/db/contact.ts +62 -0
  47. package/src/main/db/key.ts +18 -0
  48. package/src/main/db/location.ts +30 -0
  49. package/src/main/db/mission.ts +107 -0
  50. package/src/main/db/morality-list.ts +99 -0
  51. package/src/main/db/paged.ts +7 -0
  52. package/src/main/db/zone.ts +28 -0
  53. package/src/main/index.ts +41 -0
  54. package/src/main/util.ts +118 -0
  55. package/src/test/api/alignment.test.ts +65 -0
  56. package/src/test/api/archetype-data.fixture.ts +8 -0
  57. package/src/test/api/badge-data.fixture.ts +8 -0
  58. package/src/test/api/badge-data.test.ts +15 -0
  59. package/src/test/api/badge-requirement-data.fixture.ts +7 -0
  60. package/src/test/api/badge-requirement-type.test.ts +31 -0
  61. package/src/test/api/badge-type.test.ts +35 -0
  62. package/src/test/api/bundle-data.fixture.ts +6 -0
  63. package/src/test/api/bundle-header-data.fixture.ts +6 -0
  64. package/src/test/api/contact-data.fixture.ts +7 -0
  65. package/src/test/api/enhancement-category.test.ts +35 -0
  66. package/src/test/api/mission-data.fixture.ts +12 -0
  67. package/src/test/api/sex.test.ts +63 -0
  68. package/src/test/api/zone-data.fixture.ts +8 -0
  69. package/src/test/db/abstract-index.test.ts +55 -0
  70. package/src/test/db/alignment-list.test.ts +200 -0
  71. package/src/test/db/alternates.test.ts +188 -0
  72. package/src/test/db/archetype.test.ts +38 -0
  73. package/src/test/db/badge-index.test.ts +519 -0
  74. package/src/test/db/badge-requirement.test.ts +145 -0
  75. package/src/test/db/badge.test.ts +337 -0
  76. package/src/test/db/bundle-header.test.ts +76 -0
  77. package/src/test/db/coh-content-database.test.ts +282 -0
  78. package/src/test/db/contact.test.ts +97 -0
  79. package/src/test/db/key.test.ts +22 -0
  80. package/src/test/db/location.test.ts +51 -0
  81. package/src/test/db/mission.test.ts +171 -0
  82. package/src/test/db/morality-list.test.ts +457 -0
  83. package/src/test/db/zone.test.ts +36 -0
  84. package/src/test/integration.test.ts +16 -0
  85. package/src/test/util.test.ts +165 -0
  86. package/tsconfig.json +117 -0
  87. package/dist/_changelog.d.ts +0 -3
  88. package/dist/coh-content-db.nomin.js +0 -635
  89. package/dist/content-refence-utils.d.ts +0 -4
  90. package/dist/index.d.ts +0 -8
  91. package/dist/internal/_common.d.ts +0 -4
  92. package/dist/internal/archetype.d.ts +0 -10
  93. package/dist/internal/badge.d.ts +0 -44
  94. package/dist/internal/game-map.d.ts +0 -33
  95. package/dist/internal/server-group.d.ts +0 -24
  96. package/dist/types/archetype.d.ts +0 -9
  97. package/dist/types/badge.d.ts +0 -192
  98. package/dist/types/enhancement.d.ts +0 -28
  99. package/dist/types/game-map.d.ts +0 -47
  100. package/dist/types/link.d.ts +0 -4
  101. package/dist/types/server-group.d.ts +0 -75
@@ -1,36 +1,1002 @@
1
- import { IServerGroup, IServerGroupData } from "./types/server-group";
2
- interface ICohContentDb {
1
+ declare const ALIGNMENT: readonly ["hero", "villain", "praetorian"];
2
+ type Alignment = typeof ALIGNMENT[number];
3
+ type AlignmentExtended = Alignment
4
+ /**
5
+ * The alignments available for Primal Earth characters - Hero and Villain.
6
+ */
7
+ | 'primal'
8
+ /**
9
+ * All the alignments.
10
+ */
11
+ | 'all';
12
+ declare function compareAlignment(a?: Alignment, b?: Alignment): number;
13
+
14
+ declare const SEX: readonly ["M", "F"];
15
+ type Sex = typeof SEX[number];
16
+ declare function compareSex(a?: Sex, b?: Sex): number;
17
+
18
+ /**
19
+ * Some badge values differ based on the alignment or sex of the character.
20
+ */
21
+ interface AlternateData<V> {
3
22
  /**
4
- * Load server group data package into the database.
5
- * @param data The data to load.
23
+ * The character alignment this alternate applies to.
6
24
  */
7
- load(data: IServerGroupData): void;
25
+ readonly alignment?: Alignment;
8
26
  /**
9
- * Get all the server groups currently loaded in the database.
27
+ * The character sex this alternate applies to.
10
28
  */
11
- getServerGroups(): IServerGroup[];
29
+ readonly sex?: Sex;
12
30
  /**
13
- * get a server group by key.
14
- * @param serverGroupKey The key.
31
+ * The value for this combination.
15
32
  */
16
- getServerGroup(serverGroupKey: string): IServerGroup | null;
33
+ readonly value: V;
17
34
  }
18
- export declare class CohContentDb implements ICohContentDb {
19
- private readonly serverGroups;
35
+
36
+ interface ArchetypeData {
37
+ readonly key: string;
38
+ readonly name: string;
39
+ readonly description?: string;
40
+ }
41
+
42
+ 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"];
43
+ type EnhancementCategory = typeof ENHANCEMENT_CATEGORY[number];
44
+
45
+ declare const BADGE_REQUIREMENT_TYPE: readonly ["badge", "invention", "invention-plus-one", "location", "monument", "mission", "task"];
46
+ type BadgeRequirementType = typeof BADGE_REQUIREMENT_TYPE[number];
47
+
48
+ /**
49
+ * Tage type to indicate that a string will accept {@link https://www.markdownguide.org/|Markdown} format.
50
+ */
51
+ type MarkdownString = string;
52
+
53
+ interface Link {
54
+ title: string;
55
+ href: string;
56
+ }
57
+
58
+ interface LocationData {
59
+ /**
60
+ * Key of the {@link Zone} that the location references.
61
+ */
62
+ readonly zoneKey?: string;
63
+ /**
64
+ * In-game `/loc` coordinates of the location.
65
+ */
66
+ readonly coords?: Coords;
67
+ /**
68
+ * The type of icon to use if the location appears on a map. (Typically the Vidiot map icon).
69
+ */
70
+ readonly icon?: LocationIcon;
71
+ /**
72
+ * The text that should appear in the location icon. (Typically a number or symbol from the Vidiot map).
73
+ */
74
+ readonly iconText?: string;
75
+ }
76
+ /**
77
+ * Coordinates as they appear using the in-game `/loc` command.
78
+ */
79
+ type Coords = [number, number, number];
80
+ type LocationIcon = 'badge' | 'plaque' | 'pedestal' | 'object';
81
+
82
+ interface BadgeRequirementData {
83
+ /**
84
+ * Unique key used to reference this badge requirement.
85
+ *
86
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
87
+ */
88
+ readonly key: string;
89
+ /**
90
+ * The requirement type.
91
+ */
92
+ readonly type: BadgeRequirementType;
93
+ /**
94
+ * If the requirement involves a location, where it is.
95
+ */
96
+ readonly location?: LocationData | LocationData[];
97
+ /**
98
+ * If the requirement involves a badge, the badge key.
99
+ */
100
+ readonly badgeKey?: string;
101
+ /**
102
+ * If the requirement involves a mission, the mission key.
103
+ */
104
+ readonly missionKey?: string;
105
+ /**
106
+ * If the requirement involves a monument, the text that is displayed thereon.
107
+ */
108
+ readonly monumentText?: string;
109
+ /**
110
+ * If the requirement involves crafting an invention, the Level of the invention required.
111
+ */
112
+ readonly inventionLevel?: number;
113
+ /**
114
+ * If the requirement involves crafting an invention, the types of enhancements that will qualify.
115
+ */
116
+ readonly inventionTypes?: EnhancementCategory[];
117
+ /**
118
+ * Number of times the task needs to be repeated.
119
+ */
120
+ readonly count?: number;
121
+ /**
122
+ * Additional information about the requirement.
123
+ */
124
+ readonly notes?: MarkdownString;
125
+ /**
126
+ * List of external links. Wiki, forums, etc.
127
+ */
128
+ readonly links?: Link[];
129
+ }
130
+
131
+ declare const BADGE_TYPE: readonly ["exploration", "history", "accomplishment", "achievement", "accolade", "gladiator", "veteran", "pvp", "invention", "defeat", "event", "ouroboros", "consignment", "day-job", "architect-entertainment"];
132
+ type BadgeType = typeof BADGE_TYPE[number];
133
+
134
+ declare const MORALITY: readonly ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist"];
135
+ type Morality = typeof MORALITY[number];
136
+ type MoralityExtended = Morality
137
+ /**
138
+ * Any of the Primal Earth moralities - Hero, Vigilante, Villain, Rogue.
139
+ */
140
+ | 'primal'
141
+ /**
142
+ * Either of the Praetorian Earth moralities - Resistance or Loyalist.
143
+ */
144
+ | 'praetorian'
145
+ /**
146
+ * The moralities that roll up to the Hero {@link Alignment} - Hero and Vigilante.
147
+ */
148
+ | 'heroic'
149
+ /**
150
+ * The moralities that roll up to the Villain {@link Alignment} - Villain and Rogue.
151
+ */
152
+ | 'villainous'
153
+ /**
154
+ * Moralities with access to Paragon City - Hero, Vigilante and Rogue.
155
+ */
156
+ | 'paragon-city-access'
157
+ /**
158
+ * Moralities with access to the Rogue Isles - Villain, Rogue and Vigilante.
159
+ */
160
+ | 'rogue-isles-access'
161
+ /**
162
+ * All the moralities.
163
+ */
164
+ | 'all';
165
+
166
+ interface BadgeData {
167
+ /**
168
+ * Unique key used to reference this badge.
169
+ *
170
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
171
+ */
172
+ readonly key: string;
173
+ /**
174
+ * The type of badge.
175
+ */
176
+ readonly type: BadgeType;
177
+ /**
178
+ * The name of this badge.
179
+ *
180
+ * If the value differs by sex or alignment, include an {@link AlternateData} for each variant.
181
+ */
182
+ readonly name: string | AlternateData<string>[];
183
+ /**
184
+ * The {@link MoralityExtended|moralities} that this badge is available to. If undefined then all moralities will be assumed.
185
+ */
186
+ readonly morality?: MoralityExtended | MoralityExtended[];
187
+ /**
188
+ * The badge text as it appears in-game. May vary by character sex or alignment.
189
+ */
190
+ readonly badgeText?: AlternateData<MarkdownString>[] | MarkdownString;
191
+ /**
192
+ * Short description of how to acquire the badge. Detailed instructions should go in the notes field.
193
+ */
194
+ readonly acquisition?: MarkdownString;
195
+ /**
196
+ * List of absolute URLs for this badge's icons.
197
+ *
198
+ * If the value differs by sex or alignment, include an {@link AlternateData} for each variant.
199
+ */
200
+ readonly icon?: string | AlternateData<string>[];
201
+ /**
202
+ * Freeform notes or tips about the badge.
203
+ */
204
+ readonly notes?: MarkdownString;
205
+ /**
206
+ * List of external links. Wiki, forums, etc.
207
+ */
208
+ readonly links?: Link[];
209
+ /**
210
+ * The id used with the in-game `/settitle` command to apply the badge.
211
+ * The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
212
+ */
213
+ readonly setTitleId?: [number, number?];
214
+ /**
215
+ * A description of the effect the badge will have, such as a buff or granting a temporary power.
216
+ */
217
+ readonly effect?: MarkdownString;
218
+ /**
219
+ * Represents the requirements for badges with multiple fulfillment steps, such as visiting monuments for history badges, completing missions, or collecting other badges.
220
+ */
221
+ readonly requirements?: BadgeRequirementData[];
222
+ /**
223
+ * 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.
224
+ */
225
+ readonly ignoreInTotals?: boolean;
226
+ }
227
+
228
+ interface ZoneData {
229
+ /**
230
+ * Unique key used to reference this zone.
231
+ *
232
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
233
+ */
234
+ readonly key: string;
235
+ /**
236
+ * The name of the zone as it appears in-game.
237
+ */
238
+ readonly name: string;
239
+ /**
240
+ * List of external links. Wiki, forums, etc.
241
+ */
242
+ readonly links?: Link[];
243
+ }
244
+
245
+ interface ContactData {
246
+ /**
247
+ * Unique key used to reference this contact.
248
+ *
249
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
250
+ */
251
+ readonly key: string;
252
+ /**
253
+ * The name of this contact.
254
+ */
255
+ readonly name: string;
256
+ /**
257
+ * The contact's title.
258
+ */
259
+ readonly title?: string;
260
+ /**
261
+ * The character moralities that this contact will interact with.
262
+ */
263
+ readonly morality?: MoralityExtended | MoralityExtended[];
264
+ /**
265
+ * The location of this contact.
266
+ */
267
+ readonly location?: LocationData;
268
+ /**
269
+ * The level range this contact will offer missions for.
270
+ */
271
+ readonly levelRange?: [number, number?];
20
272
  /**
21
- * @inheritDoc
22
- * @override
273
+ * Freeform notes or tips about the contact.
23
274
  */
24
- load(data: IServerGroupData): void;
275
+ readonly notes?: MarkdownString;
25
276
  /**
26
- * @inheritDoc
27
- * @override
277
+ * List of external links. Wiki, forums, etc.
28
278
  */
29
- getServerGroups(): IServerGroup[];
279
+ readonly links?: Link[];
280
+ }
281
+
282
+ declare const MISSION_TYPE: readonly ["story-arc", "mission", "task-force", "strike-force", "trial", "personal-story"];
283
+ type MissionType = typeof MISSION_TYPE[number];
284
+
285
+ interface MissionData {
286
+ /**
287
+ * Unique key used to reference this mission.
288
+ *
289
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
290
+ */
291
+ readonly key: string;
292
+ /**
293
+ * The name of the mission as it appears from the contact.
294
+ *
295
+ * The name may be different when viewed in Ouroboros as a Flashback.
296
+ */
297
+ readonly name: string;
298
+ /**
299
+ * The type of mission... Story arc, task force, trial, etc.
300
+ */
301
+ readonly type: MissionType;
302
+ /**
303
+ * The character moralities that may accept the mission.
304
+ */
305
+ readonly morality?: MoralityExtended | MoralityExtended[];
306
+ /**
307
+ * The keys of any contacts that provide this mission.
308
+ */
309
+ readonly contactKeys?: string | string[];
310
+ /**
311
+ * The level range this mission is available for.
312
+ */
313
+ readonly levelRange?: [number, number?];
314
+ /**
315
+ * Freeform notes or tips about the mission.
316
+ */
317
+ readonly notes?: MarkdownString;
318
+ /**
319
+ * List of external links. Wiki, forums, etc.
320
+ */
321
+ readonly links?: Link[];
322
+ /**
323
+ * If the mission is available in Ouroboros as a Flashback.
324
+ */
325
+ readonly flashback?: MissionFlashbackData;
326
+ }
327
+ interface MissionFlashbackData {
328
+ /**
329
+ * The id of the mission as seen in the Flashback menu, i.e. '14.01'.
330
+ */
331
+ readonly id: string;
332
+ /**
333
+ * The level range this mission appears under as a Flashback. Leave undefined if the same as the base mission.
334
+ */
335
+ readonly levelRange?: [number, number?];
336
+ /**
337
+ * The name as it appears in the Flashback list. Leave undefined if the same as the base mission.
338
+ */
339
+ readonly name?: string;
340
+ /**
341
+ * The character moralities that the mission will appear for in the Flashback list. Leave undefined if the same as the base mission.
342
+ */
343
+ readonly morality?: MoralityExtended | MoralityExtended[];
344
+ /**
345
+ * Freeform notes or tips about the Flashback version of the mission.
346
+ */
347
+ readonly notes?: MarkdownString;
348
+ }
349
+
350
+ /**
351
+ * Metadata about a content bundle.
352
+ */
353
+ interface BundleHeaderData {
354
+ /**
355
+ * Name of the fork this bundle contains data for.
356
+ */
357
+ readonly name?: string;
358
+ /**
359
+ * Description of the fork.
360
+ */
361
+ readonly description?: MarkdownString;
362
+ /**
363
+ * Url for the repository where the bundle is maintained.
364
+ */
365
+ readonly repositoryUrl?: string;
366
+ /**
367
+ * Url for the location of the changelog.
368
+ */
369
+ readonly changelogUrl?: string;
370
+ /**
371
+ * List of external links. Wiki, forums, etc.
372
+ */
373
+ readonly links?: Link[];
374
+ /**
375
+ * Version number for this data package.
376
+ */
377
+ readonly version?: string;
378
+ }
379
+
380
+ /**
381
+ * A bundle of game data from a forked instance of the game, such as Homecoming (https://forums.homecomingservers.com/).
382
+ */
383
+ interface BundleData {
384
+ /**
385
+ * Bundle header.
386
+ */
387
+ readonly header?: BundleHeaderData;
388
+ /**
389
+ * List of the game server names in this fork.
390
+ * Torchbearer, Excelsior, etc.
391
+ */
392
+ readonly servers?: string[];
393
+ /**
394
+ * List of archetypes available in this fork.
395
+ */
396
+ readonly archetypes?: ArchetypeData[];
397
+ /**
398
+ * List of zones supported by this fork.
399
+ */
400
+ readonly zones?: ZoneData[];
401
+ /**
402
+ * List of contacts available in this fork.
403
+ */
404
+ readonly contacts?: ContactData[];
405
+ /**
406
+ * List of missions available in this fork.
407
+ */
408
+ readonly missions?: MissionData[];
409
+ /**
410
+ * List of badges available on this fork.
411
+ */
412
+ readonly badges?: BadgeData[];
413
+ }
414
+
415
+ declare class AlignmentList {
416
+ #private;
417
+ readonly hero: boolean;
418
+ readonly villain: boolean;
419
+ readonly praetorian: boolean;
420
+ readonly primal: boolean;
421
+ readonly all: boolean;
422
+ constructor(items?: AlignmentExtended[]);
423
+ get items(): Alignment[];
424
+ has(alignment?: AlignmentExtended): boolean;
425
+ }
426
+
427
+ declare class Alternates<T> {
428
+ #private;
429
+ /**
430
+ * Create an alternate set from either a list of categorized values, or a single value when there are no alternates.
431
+ * @param value List of alternates, or a single value.
432
+ */
433
+ constructor(value: AlternateData<T>[] | T);
434
+ getValue(alignment?: Alignment, sex?: Sex): T | undefined;
435
+ /**
436
+ * Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
437
+ */
438
+ get default(): AlternateData<T> | undefined;
439
+ /**
440
+ * Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
441
+ */
442
+ get canonical(): AlternateData<T>[];
443
+ /**
444
+ * Create a joined string from the alternate values in canonical order.
445
+ * @param separator Separator to use. Default is ' / '
446
+ */
447
+ toString(separator: string): string;
448
+ }
449
+
450
+ declare class Archetype {
451
+ readonly key: string;
452
+ readonly name: string;
453
+ readonly description?: string;
454
+ constructor(data: ArchetypeData);
455
+ }
456
+
457
+ declare class Location {
458
+ /**
459
+ * Key of the {@link Zone} that the location references.
460
+ */
461
+ readonly zoneKey?: string;
462
+ /**
463
+ * In-game `/loc` coordinates of the location.
464
+ */
465
+ readonly coords?: Coords;
466
+ /**
467
+ * The type of icon to use if the location appears on a map. (Typically the Vidiot map icon).
468
+ */
469
+ readonly icon?: LocationIcon;
470
+ /**
471
+ * The text that should appear in the location icon. (Typically a number or symbol from the Vidiot map).
472
+ */
473
+ readonly iconText?: string;
474
+ constructor(data: LocationData);
475
+ }
476
+
477
+ declare class BadgeRequirement {
30
478
  /**
31
- * @inheritDoc
32
- * @override
479
+ * Unique key used to reference this badge requirement.
480
+ *
481
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
33
482
  */
34
- getServerGroup(serverGroupKey: string): IServerGroup | null;
483
+ readonly key: string;
484
+ /**
485
+ * The requirement type.
486
+ */
487
+ readonly type: BadgeRequirementType;
488
+ /**
489
+ * If the requirement involves a location, where it is.
490
+ */
491
+ readonly location?: Location[];
492
+ /**
493
+ * If the requirement involves a badge, the badge key.
494
+ */
495
+ readonly badgeKey?: string;
496
+ /**
497
+ * If the requirement involves a mission, the mission key.
498
+ */
499
+ readonly missionKey?: string;
500
+ /**
501
+ * If the requirement involves a monument, the text that is displayed thereon.
502
+ */
503
+ readonly monumentText?: string;
504
+ /**
505
+ * If the requirement involves crafting an invention, the Level of the invention required.
506
+ */
507
+ readonly inventionLevel?: number;
508
+ /**
509
+ * If the requirement involves crafting an invention, the types of enhancements that will qualify.
510
+ */
511
+ readonly inventionTypes?: EnhancementCategory[];
512
+ /**
513
+ * Number of times the task needs to be repeated.
514
+ */
515
+ readonly count?: number;
516
+ /**
517
+ * Additional information about the requirement.
518
+ */
519
+ readonly notes?: MarkdownString;
520
+ /**
521
+ * List of external links. Wiki, forums, etc.
522
+ */
523
+ readonly links: Link[];
524
+ constructor(data: BadgeRequirementData);
525
+ }
526
+
527
+ declare class MoralityList {
528
+ #private;
529
+ readonly hero: boolean;
530
+ readonly vigilante: boolean;
531
+ readonly villain: boolean;
532
+ readonly rogue: boolean;
533
+ readonly resistance: boolean;
534
+ readonly loyalist: boolean;
535
+ readonly primal: boolean;
536
+ readonly praetorian: boolean;
537
+ readonly heroic: boolean;
538
+ readonly villainous: boolean;
539
+ readonly paragonCityAccess: boolean;
540
+ readonly rogueIslesAccess: boolean;
541
+ readonly all: boolean;
542
+ constructor(items?: MoralityExtended[]);
543
+ get items(): Morality[];
544
+ has(morality?: MoralityExtended): boolean;
545
+ }
546
+
547
+ declare class Badge {
548
+ #private;
549
+ /**
550
+ * The database key for this badge.
551
+ */
552
+ readonly key: string;
553
+ /**
554
+ * The type of badge.
555
+ */
556
+ readonly type: BadgeType;
557
+ /**
558
+ * The name of this badge.
559
+ *
560
+ * May vary by character sex or alignment.
561
+ */
562
+ readonly name: Alternates<string>;
563
+ /**
564
+ * The character moralities that this badge is available to.
565
+ */
566
+ readonly morality: MoralityList;
567
+ /**
568
+ * The badge text as it appears in-game. May vary by character sex or alignment.
569
+ */
570
+ readonly badgeText: Alternates<MarkdownString>;
571
+ /**
572
+ * Short description of how to acquire the badge. Detailed instructions will be in the notes field.
573
+ */
574
+ readonly acquisition?: MarkdownString;
575
+ /**
576
+ * Absolute URL to this badge's icon.
577
+ *
578
+ * May vary by character sex or alignment.
579
+ */
580
+ readonly icon: Alternates<string>;
581
+ /**
582
+ * Freeform notes or tips about the badge.
583
+ */
584
+ readonly notes?: MarkdownString;
585
+ /**
586
+ * List of external links. Wiki, forums, etc.
587
+ */
588
+ readonly links: Link[];
589
+ /**
590
+ * The id used with the in-game `/settitle` command to apply the badge.
591
+ * The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
592
+ */
593
+ readonly setTitleId?: [number, number?];
594
+ /**
595
+ * A description of the effect the badge will have, such as a buff or granting a temporary power.
596
+ */
597
+ readonly effect?: MarkdownString;
598
+ /**
599
+ * Represents the requirements for badges with multiple fulfillment steps, such as visiting monuments for history badges, completing missions, or collecting other badges.
600
+ */
601
+ readonly requirements?: BadgeRequirement[];
602
+ /**
603
+ * 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.
604
+ */
605
+ readonly ignoreInTotals: boolean;
606
+ constructor(badgeData: BadgeData);
607
+ getRequirement(key: string): BadgeRequirement;
608
+ /**
609
+ * Return a list of all the zone keys referenced by this badge.
610
+ */
611
+ get zoneKeys(): string[];
612
+ /**
613
+ * The zone key if this badge relates to a single zone.
614
+ */
615
+ get zoneKey(): string | undefined;
616
+ }
617
+ declare function compareByDefaultName(a?: Badge, b?: Badge): number;
618
+ declare function compareByZoneKey(a?: Badge, b?: Badge): number;
619
+
620
+ interface BadgeSearchOptions {
621
+ /**
622
+ * Text-based search.
623
+ *
624
+ * Case-insensitive. Defaults to searching on name only.
625
+ */
626
+ query?: {
627
+ str?: string;
628
+ on?: {
629
+ name?: boolean;
630
+ badgeText?: boolean;
631
+ acquisition?: boolean;
632
+ notes?: boolean;
633
+ effect?: boolean;
634
+ setTitle?: boolean;
635
+ };
636
+ };
637
+ /**
638
+ * Filter results matching the given values.
639
+ */
640
+ filter?: {
641
+ type?: BadgeType;
642
+ zoneKey?: string;
643
+ morality?: MoralityExtended;
644
+ };
645
+ /**
646
+ * Sort results.
647
+ *
648
+ * Badges are assumed to be in canonical order in the content bundle, and should match the in-game display order.
649
+ */
650
+ sort?: {
651
+ by?: 'canonical' | 'badge-name' | 'zone-key';
652
+ dir?: 'asc' | 'desc';
653
+ };
654
+ /**
655
+ * The page (1-based)
656
+ */
657
+ page?: number;
658
+ /**
659
+ * How many results per page
660
+ */
661
+ pageSize?: number;
662
+ }
663
+
664
+ interface Paged<T> {
665
+ items: T[];
666
+ page: number;
667
+ pageSize?: number;
668
+ totalItems: number;
669
+ totalPages: number;
670
+ }
671
+
672
+ type KeysOfType<T, V> = {
673
+ [P in keyof T]: T[P] extends V ? P : never;
674
+ }[keyof T];
675
+ declare class AbstractIndex<T> {
676
+ protected _values: T[];
677
+ protected _hashTable: Record<string, T>;
678
+ /**
679
+ * Create a new index.
680
+ * @param keyField The field of the values that will act as the key.
681
+ * @param values Values to index.
682
+ */
683
+ constructor(keyField: KeysOfType<T, string>, values: T[] | undefined);
684
+ /**
685
+ * Return all indexed values
686
+ */
687
+ get values(): T[];
688
+ /**
689
+ * Get a value from the index
690
+ * @param key Key string
691
+ */
692
+ get(key: string | undefined): T | undefined;
693
+ }
694
+
695
+ declare class BadgeIndex extends AbstractIndex<Badge> {
696
+ #private;
697
+ constructor(values: Badge[] | undefined);
698
+ search(options?: BadgeSearchOptions): Paged<Badge>;
699
+ }
700
+
701
+ declare class BundleHeader {
702
+ /**
703
+ * Name of the content bundle.
704
+ */
705
+ readonly name?: string;
706
+ /**
707
+ * Description of the fork.
708
+ */
709
+ readonly description?: MarkdownString;
710
+ /**
711
+ * Url for the repository where the bundle is maintained.
712
+ */
713
+ readonly repositoryUrl?: string;
714
+ /**
715
+ * Url for the location of the changelog.
716
+ */
717
+ readonly changelogUrl?: string;
718
+ /**
719
+ * List of external links. Wiki, forums, etc.
720
+ */
721
+ readonly links?: Link[];
722
+ /**
723
+ * The current version of the data package.
724
+ */
725
+ readonly version?: string;
726
+ constructor(data: BundleHeaderData | undefined);
727
+ }
728
+
729
+ declare class Zone {
730
+ /**
731
+ * Unique key used to reference this zone.
732
+ *
733
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
734
+ */
735
+ readonly key: string;
736
+ /**
737
+ * The name of the zone as it appears in-game.
738
+ */
739
+ readonly name: string;
740
+ /**
741
+ * List of external links. Wiki, forums, etc.
742
+ */
743
+ readonly links: Link[];
744
+ constructor(data: ZoneData);
745
+ }
746
+
747
+ declare class Contact {
748
+ /**
749
+ * Unique key used to reference this contact.
750
+ *
751
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
752
+ */
753
+ readonly key: string;
754
+ /**
755
+ * The name of this contact.
756
+ */
757
+ readonly name: string;
758
+ /**
759
+ * The contact's title.
760
+ */
761
+ readonly title?: string;
762
+ /**
763
+ * The character moralities that this contact will interact with.
764
+ */
765
+ readonly morality?: MoralityList;
766
+ /**
767
+ * The location of this contact.
768
+ */
769
+ readonly location?: Location;
770
+ /**
771
+ * The level range this contact will offer missions for.
772
+ */
773
+ readonly levelRange?: [number, number?];
774
+ /**
775
+ * Freeform notes or tips about the contact.
776
+ */
777
+ readonly notes?: MarkdownString;
778
+ /**
779
+ * List of external links. Wiki, forums, etc.
780
+ */
781
+ readonly links: Link[];
782
+ constructor(data: ContactData);
783
+ }
784
+
785
+ declare class Mission {
786
+ /**
787
+ * Unique key used to reference this mission.
788
+ *
789
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
790
+ */
791
+ readonly key: string;
792
+ /**
793
+ * The name of the mission as it appears from the contact.
794
+ *
795
+ * The name may be different when viewed in Ouroboros as a Flashback.
796
+ */
797
+ readonly name: string;
798
+ /**
799
+ * The type of mission... Story arc, task force, trial, etc.
800
+ */
801
+ readonly type: MissionType;
802
+ /**
803
+ * The character moralities that may accept the mission.
804
+ */
805
+ readonly morality: MoralityList;
806
+ /**
807
+ * The keys of any contacts that provide this mission.
808
+ */
809
+ readonly contactKeys?: string[];
810
+ /**
811
+ * The level range this mission is available for.
812
+ */
813
+ readonly levelRange?: [number, number?];
814
+ /**
815
+ * Freeform notes or tips about the mission.
816
+ */
817
+ readonly notes?: MarkdownString;
818
+ /**
819
+ * List of external links. Wiki, forums, etc.
820
+ */
821
+ readonly links: Link[];
822
+ /**
823
+ * If the mission is available in Ouroboros as a Flashback.
824
+ */
825
+ readonly flashback?: {
826
+ /**
827
+ * The id of the mission as seen in the Flashback menu, i.e. '14.01'.
828
+ */
829
+ readonly id: string;
830
+ /**
831
+ * The level range this mission appears under as a Flashback. Leave undefined if the same as the base mission.
832
+ */
833
+ readonly levelRange?: [number, number?];
834
+ /**
835
+ * The name as it appears in the Flashback list. Leave undefined if the same as the base mission.
836
+ */
837
+ readonly name?: string;
838
+ /**
839
+ * The character moralities that the mission will appear for in the Flashback list. Leave undefined if the same as the base mission.
840
+ */
841
+ readonly morality?: MoralityList;
842
+ /**
843
+ * Freeform notes or tips about the Flashback version of the mission.
844
+ */
845
+ readonly notes?: MarkdownString;
846
+ };
847
+ constructor(data: MissionData);
848
+ }
849
+
850
+ declare class CohContentDatabase {
851
+ #private;
852
+ /**
853
+ * Create a db instance from the given content bundle.
854
+ * @param bundle The bundle to load.
855
+ */
856
+ constructor(bundle: BundleData);
857
+ /**
858
+ * Header information about the content bundle.
859
+ */
860
+ get header(): BundleHeader;
861
+ /**
862
+ * List of the game server names.
863
+ *
864
+ * Torchbearer, Excelsior, etc.
865
+ */
866
+ get servers(): string[];
867
+ /**
868
+ * List of archetypes.
869
+ */
870
+ get archetypes(): Archetype[];
871
+ /**
872
+ * Get archetype by key.
873
+ * @param key The key.
874
+ */
875
+ getArchetype(key: string | undefined): Archetype | undefined;
876
+ /**
877
+ * List of game zones.
878
+ */
879
+ get zones(): Zone[];
880
+ /**
881
+ * Get zone by key.
882
+ * @param key The key.
883
+ */
884
+ getZone(key: string | undefined): Zone | undefined;
885
+ /**
886
+ * List of contacts.
887
+ */
888
+ get contacts(): Contact[];
889
+ /**
890
+ * Get contact by key.
891
+ * @param key The key.
892
+ */
893
+ getContact(key: string | undefined): Contact | undefined;
894
+ /**
895
+ * List of missions.
896
+ */
897
+ get missions(): Mission[];
898
+ /**
899
+ * Get mission by key.
900
+ * @param key The key.
901
+ */
902
+ getMission(key: string | undefined): Mission | undefined;
903
+ /**
904
+ * List of badges.
905
+ */
906
+ get badges(): Badge[];
907
+ /**
908
+ * Get badge by key.
909
+ * @param key The key.
910
+ */
911
+ getBadge(key: string | undefined): Badge | undefined;
912
+ /**
913
+ * Search, sort and filter the badge list.
914
+ * This is a fairly brute-forced approach and will not be as performant as loading the badge data into a traditional
915
+ * database engine, but is sufficient for most operations.
916
+ * @param options {@link BadgeSearchOptions}
917
+ */
918
+ searchBadges(options?: BadgeSearchOptions): Paged<Badge>;
919
+ }
920
+
921
+ declare class Key {
922
+ #private;
923
+ constructor(value: string);
924
+ get value(): string;
35
925
  }
36
- export {};
926
+
927
+ /**
928
+ * Returns the URI of the given badge that can be used in {@link MarkdownString} fields.
929
+ *
930
+ * URI format: `badge://<key>`
931
+ *
932
+ * @param target The badge or badge key to target.
933
+ */
934
+ declare function badgeUri(target: string | Badge | BadgeData): string;
935
+ /**
936
+ * Returns a {@link MarkdownString} link to the given badge.
937
+ *
938
+ * Link format: `[<key>](badge://<key>)`
939
+ *
940
+ * @param target The {@link Badge} or badge key to target.
941
+ */
942
+ declare function badgeLink(target: string | Badge | BadgeData): string;
943
+ /**
944
+ * Returns the URI of the given contact that can be used in {@link MarkdownString} fields.
945
+ *
946
+ * URI format: `contact://<key>`
947
+ *
948
+ * @param target The {@link Contact} or contact key to target.
949
+ */
950
+ declare function contactUri(target: string | Contact | ContactData): string;
951
+ /**
952
+ * Returns a {@link MarkdownString} link to the given contact.
953
+ *
954
+ * Link format: `[<key>](contact://<key>)`
955
+ *
956
+ * @param target The {@link Contact} or contact key to target.
957
+ */
958
+ declare function contactLink(target: string | Contact | ContactData): string;
959
+ /**
960
+ * Returns the URI of the given mission that can be used in {@link MarkdownString} fields.
961
+ *
962
+ * URI format: `mission://<key>`
963
+ *
964
+ * @param target The {@link Mission} or mission key to target.
965
+ */
966
+ declare function missionUri(target: string | Mission | MissionData): string;
967
+ /**
968
+ * Returns a {@link MarkdownString} link to the given mission.
969
+ *
970
+ * Link format: `[<key>](mission://<key>)`
971
+ *
972
+ * @param target The {@link Mission} or mission key to target.
973
+ */
974
+ declare function missionLink(target: string | Mission | MissionData): string;
975
+ /**
976
+ * Returns the URI of the given zone that can be used in {@link MarkdownString} fields.
977
+ *
978
+ * URI format: `zone://<key>`
979
+ *
980
+ * @param target The {@link Zone} or zone key to target.
981
+ */
982
+ declare function zoneUri(target: string | Zone | ZoneData): string;
983
+ /**
984
+ * Returns a {@link MarkdownString} link to the given zone.
985
+ *
986
+ * Link format: `[<key>](zone://<key>)`
987
+ *
988
+ * @param target The {@link Zone} or zone key to target.
989
+ */
990
+ declare function zoneLink(target: string | Zone | ZoneData): string;
991
+ /**
992
+ * For fields that accept either an array of values or a single value, coalesces the value to an array.
993
+ *
994
+ * Arrays are returned as-is.
995
+ * Single values are returned as a single-value array.
996
+ * Undefined values are returned as undefined.
997
+ *
998
+ * @param value The value to coalesce.
999
+ */
1000
+ declare function coalesceToArray<T>(value?: T | T[]): T[] | undefined;
1001
+
1002
+ export { ALIGNMENT, type Alignment, type AlignmentExtended, AlignmentList, type AlternateData, Alternates, Archetype, type ArchetypeData, BADGE_REQUIREMENT_TYPE, BADGE_TYPE, Badge, type BadgeData, BadgeIndex, BadgeRequirement, type BadgeRequirementData, type BadgeRequirementType, type BadgeSearchOptions, type BadgeType, type BundleData, BundleHeader, type BundleHeaderData, CohContentDatabase, Contact, type ContactData, type Coords, ENHANCEMENT_CATEGORY, type EnhancementCategory, Key, type Link, Location, type LocationData, type LocationIcon, MISSION_TYPE, MORALITY, type MarkdownString, Mission, type MissionData, type MissionFlashbackData, type MissionType, type Morality, type MoralityExtended, MoralityList, type Paged, SEX, type Sex, Zone, type ZoneData, badgeLink, badgeUri, coalesceToArray, compareAlignment, compareByDefaultName, compareByZoneKey, compareSex, contactLink, contactUri, missionLink, missionUri, zoneLink, zoneUri };