coh-content-db 2.0.0-rc.9 → 2.0.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.
- package/.github/workflows/build.yml +3 -1
- package/CHANGELOG.md +11 -2
- package/README.md +33 -19
- package/dist/coh-content-db.d.ts +230 -170
- package/dist/coh-content-db.js +495 -296
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +488 -294
- package/dist/coh-content-db.mjs.map +1 -1
- package/jest.config.mjs +1 -0
- package/package.json +14 -14
- package/src/main/api/badge-data.ts +13 -7
- package/src/main/api/bundle-data.ts +1 -1
- package/src/main/api/bundle-header-data.ts +13 -6
- package/src/main/api/contact-data.ts +2 -1
- package/src/main/api/level-range-data.ts +4 -0
- package/src/main/api/mission-data.ts +3 -29
- package/src/main/api/mission-flashback-data.ts +31 -0
- package/src/main/api/morality.ts +27 -9
- package/src/main/api/set-title-data.ts +4 -0
- package/src/main/api/variant-context.ts +11 -0
- package/src/main/api/{alternate-data.ts → variant-data.ts} +4 -4
- package/src/main/api/zone-data.ts +24 -0
- package/src/main/api/zone-type.ts +59 -0
- package/src/main/db/abstract-index.ts +12 -16
- package/src/main/db/badge-index.ts +53 -27
- package/src/main/db/badge-requirement.ts +1 -1
- package/src/main/db/badge-search-options.ts +15 -14
- package/src/main/db/badge.ts +46 -29
- package/src/main/db/bundle-header.ts +18 -10
- package/src/main/db/coh-content-database.ts +17 -17
- package/src/main/db/contact.ts +5 -4
- package/src/main/db/level-range.ts +15 -0
- package/src/main/db/mission.ts +11 -10
- package/src/main/db/paged.ts +7 -3
- package/src/main/db/set-title-ids.ts +10 -0
- package/src/main/db/variants.ts +84 -0
- package/src/main/db/zone.ts +29 -0
- package/src/main/index.ts +11 -4
- package/src/main/util/coalesce-to-array.ts +13 -0
- package/src/main/{util.ts → util/links.ts} +8 -22
- package/src/main/util/to-date.ts +9 -0
- package/src/test/api/alignment.test.ts +2 -2
- package/src/test/api/badge-data.fixture.ts +1 -0
- package/src/test/api/badge-data.test.ts +1 -0
- package/src/test/api/bundle-data.fixture.ts +3 -2
- package/src/test/api/bundle-header-data.fixture.ts +4 -2
- package/src/test/api/morality.test.ts +31 -0
- package/src/test/api/sex.test.ts +2 -2
- package/src/test/api/zone-data.fixture.ts +1 -0
- package/src/test/db/abstract-index.test.ts +12 -43
- package/src/test/db/badge-index.test.ts +197 -101
- package/src/test/db/badge.test.ts +122 -16
- package/src/test/db/bundle-header.test.ts +25 -12
- package/src/test/db/coh-content-database.test.ts +134 -175
- package/src/test/db/contact.test.ts +2 -1
- package/src/test/db/level-range.test.ts +47 -0
- package/src/test/db/mission.test.ts +8 -6
- package/src/test/db/morality-list.test.ts +1 -1
- package/src/test/db/set-title-ids.test.ts +19 -0
- package/src/test/db/{alternates.test.ts → variants.test.ts} +24 -24
- package/src/test/db/zone.test.ts +45 -0
- package/src/test/integration.test.ts +3 -3
- package/src/test/util/coalese-to-array.test.ts +17 -0
- package/src/test/{util.test.ts → util/links.test.ts} +5 -21
- package/src/test/util/to-date.test.ts +15 -0
- package/src/main/db/alternates.ts +0 -67
package/dist/coh-content-db.d.ts
CHANGED
|
@@ -11,28 +11,6 @@ type AlignmentExtended = Alignment
|
|
|
11
11
|
| 'all';
|
|
12
12
|
declare function compareAlignment(a?: Alignment, b?: Alignment): number;
|
|
13
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> {
|
|
22
|
-
/**
|
|
23
|
-
* The character alignment this alternate applies to.
|
|
24
|
-
*/
|
|
25
|
-
readonly alignment?: Alignment;
|
|
26
|
-
/**
|
|
27
|
-
* The character sex this alternate applies to.
|
|
28
|
-
*/
|
|
29
|
-
readonly sex?: Sex;
|
|
30
|
-
/**
|
|
31
|
-
* The value for this combination.
|
|
32
|
-
*/
|
|
33
|
-
readonly value: V;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
14
|
interface ArchetypeData {
|
|
37
15
|
readonly key: string;
|
|
38
16
|
readonly name: string;
|
|
@@ -131,37 +109,41 @@ interface BadgeRequirementData {
|
|
|
131
109
|
declare const BADGE_TYPE: readonly ["exploration", "history", "accomplishment", "achievement", "accolade", "gladiator", "veteran", "pvp", "invention", "defeat", "event", "ouroboros", "consignment", "day-job", "architect-entertainment"];
|
|
132
110
|
type BadgeType = typeof BADGE_TYPE[number];
|
|
133
111
|
|
|
134
|
-
declare const
|
|
135
|
-
type
|
|
136
|
-
|
|
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'
|
|
112
|
+
declare const SEX: readonly ["M", "F"];
|
|
113
|
+
type Sex = typeof SEX[number];
|
|
114
|
+
declare function compareSex(a?: Sex, b?: Sex): number;
|
|
115
|
+
|
|
153
116
|
/**
|
|
154
|
-
*
|
|
117
|
+
* Some badge values differ based on the alignment or sex of a character.
|
|
155
118
|
*/
|
|
156
|
-
|
|
119
|
+
interface VariantData<V> {
|
|
120
|
+
/**
|
|
121
|
+
* The character alignment this variant applies to.
|
|
122
|
+
*/
|
|
123
|
+
readonly alignment?: Alignment;
|
|
124
|
+
/**
|
|
125
|
+
* The character sex this variant applies to.
|
|
126
|
+
*/
|
|
127
|
+
readonly sex?: Sex;
|
|
128
|
+
/**
|
|
129
|
+
* The value for this combination.
|
|
130
|
+
*/
|
|
131
|
+
readonly value: V;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
declare const MORALITY: readonly ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist"];
|
|
135
|
+
declare const MORALITY_EXTENDED: readonly ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist", "primal", "praetorian", "heroic", "villainous", "paragon-city-access", "rogue-isles-access", "all"];
|
|
136
|
+
type Morality = typeof MORALITY[number];
|
|
137
|
+
type MoralityExtended = typeof MORALITY_EXTENDED[number];
|
|
157
138
|
/**
|
|
158
|
-
*
|
|
139
|
+
* Maps a morality to the underlying alignment
|
|
159
140
|
*/
|
|
160
|
-
|
|
|
141
|
+
declare const MoralityMap: Record<Morality | Alignment, Alignment>;
|
|
142
|
+
|
|
161
143
|
/**
|
|
162
|
-
*
|
|
144
|
+
* The id, or a pair of ids [primal, praetorian] that are used with the /settitle command to set a badge
|
|
163
145
|
*/
|
|
164
|
-
|
|
146
|
+
type SetTitleData = [number, number?];
|
|
165
147
|
|
|
166
148
|
interface BadgeData {
|
|
167
149
|
/**
|
|
@@ -177,9 +159,13 @@ interface BadgeData {
|
|
|
177
159
|
/**
|
|
178
160
|
* The name of this badge.
|
|
179
161
|
*
|
|
180
|
-
* If the value differs by sex or alignment, include an {@link
|
|
162
|
+
* If the value differs by sex or alignment, include an {@link VariantData} for each variant.
|
|
181
163
|
*/
|
|
182
|
-
readonly name: string |
|
|
164
|
+
readonly name: string | VariantData<string>[];
|
|
165
|
+
/**
|
|
166
|
+
* The date that the badge was added to the game.
|
|
167
|
+
*/
|
|
168
|
+
readonly releaseDate: string;
|
|
183
169
|
/**
|
|
184
170
|
* The {@link MoralityExtended|moralities} that this badge is available to. If undefined then all moralities will be assumed.
|
|
185
171
|
*/
|
|
@@ -187,7 +173,7 @@ interface BadgeData {
|
|
|
187
173
|
/**
|
|
188
174
|
* The badge text as it appears in-game. May vary by character sex or alignment.
|
|
189
175
|
*/
|
|
190
|
-
readonly badgeText?:
|
|
176
|
+
readonly badgeText?: VariantData<MarkdownString>[] | MarkdownString;
|
|
191
177
|
/**
|
|
192
178
|
* Short description of how to acquire the badge. Detailed instructions should go in the notes field.
|
|
193
179
|
*/
|
|
@@ -195,9 +181,9 @@ interface BadgeData {
|
|
|
195
181
|
/**
|
|
196
182
|
* List of absolute URLs for this badge's icons.
|
|
197
183
|
*
|
|
198
|
-
* If the value differs by sex or alignment, include an {@link
|
|
184
|
+
* If the value differs by sex or alignment, include an {@link VariantData} for each variant.
|
|
199
185
|
*/
|
|
200
|
-
readonly icon?: string |
|
|
186
|
+
readonly icon?: string | VariantData<string>[];
|
|
201
187
|
/**
|
|
202
188
|
* Freeform notes or tips about the badge.
|
|
203
189
|
*/
|
|
@@ -210,7 +196,7 @@ interface BadgeData {
|
|
|
210
196
|
* The id used with the in-game `/settitle` command to apply the badge.
|
|
211
197
|
* The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
|
|
212
198
|
*/
|
|
213
|
-
readonly setTitleId?:
|
|
199
|
+
readonly setTitleId?: SetTitleData;
|
|
214
200
|
/**
|
|
215
201
|
* A description of the effect the badge will have, such as a buff or granting a temporary power.
|
|
216
202
|
*/
|
|
@@ -225,6 +211,14 @@ interface BadgeData {
|
|
|
225
211
|
readonly ignoreInTotals?: boolean;
|
|
226
212
|
}
|
|
227
213
|
|
|
214
|
+
declare const ZONE_TYPE: readonly ["city", "echo", "tutorial", "trial", "hazard", "mayhem", "safeguard", "mission", "incarnate", "co-op", "pvp", "arena", "building", "other"];
|
|
215
|
+
type ZoneType = typeof ZONE_TYPE[number];
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Can be an array of [min, max], just the [min], or a number representing the minimum value
|
|
219
|
+
*/
|
|
220
|
+
type LevelRangeData = [number, number?] | number;
|
|
221
|
+
|
|
228
222
|
interface ZoneData {
|
|
229
223
|
/**
|
|
230
224
|
* Unique key used to reference this zone.
|
|
@@ -236,6 +230,22 @@ interface ZoneData {
|
|
|
236
230
|
* The name of the zone as it appears in-game.
|
|
237
231
|
*/
|
|
238
232
|
readonly name: string;
|
|
233
|
+
/**
|
|
234
|
+
* The type of zone.
|
|
235
|
+
*/
|
|
236
|
+
readonly type: ZoneType;
|
|
237
|
+
/**
|
|
238
|
+
* The character moralities that this zone is accessible by.
|
|
239
|
+
*/
|
|
240
|
+
readonly morality?: MoralityExtended | MoralityExtended[];
|
|
241
|
+
/**
|
|
242
|
+
* The level range this zone is recommended for.
|
|
243
|
+
*/
|
|
244
|
+
readonly levelRange?: LevelRangeData;
|
|
245
|
+
/**
|
|
246
|
+
* Freeform notes or tips about the zone.
|
|
247
|
+
*/
|
|
248
|
+
readonly notes?: MarkdownString;
|
|
239
249
|
/**
|
|
240
250
|
* List of external links. Wiki, forums, etc.
|
|
241
251
|
*/
|
|
@@ -268,7 +278,7 @@ interface ContactData {
|
|
|
268
278
|
/**
|
|
269
279
|
* The level range this contact will offer missions for.
|
|
270
280
|
*/
|
|
271
|
-
readonly levelRange?:
|
|
281
|
+
readonly levelRange?: LevelRangeData;
|
|
272
282
|
/**
|
|
273
283
|
* Freeform notes or tips about the contact.
|
|
274
284
|
*/
|
|
@@ -282,6 +292,29 @@ interface ContactData {
|
|
|
282
292
|
declare const MISSION_TYPE: readonly ["story-arc", "mission", "task-force", "strike-force", "trial", "personal-story"];
|
|
283
293
|
type MissionType = typeof MISSION_TYPE[number];
|
|
284
294
|
|
|
295
|
+
interface MissionFlashbackData {
|
|
296
|
+
/**
|
|
297
|
+
* The id of the mission as seen in the Flashback menu, i.e. '14.01'.
|
|
298
|
+
*/
|
|
299
|
+
readonly id: string;
|
|
300
|
+
/**
|
|
301
|
+
* The level range this mission appears under as a Flashback.
|
|
302
|
+
*/
|
|
303
|
+
readonly levelRange?: LevelRangeData;
|
|
304
|
+
/**
|
|
305
|
+
* The name as it appears in the Flashback list. Leave undefined if the same as the base mission.
|
|
306
|
+
*/
|
|
307
|
+
readonly name?: string;
|
|
308
|
+
/**
|
|
309
|
+
* The character moralities that the mission will appear for in the Flashback list. Leave undefined if the same as the base mission.
|
|
310
|
+
*/
|
|
311
|
+
readonly morality?: MoralityExtended | MoralityExtended[];
|
|
312
|
+
/**
|
|
313
|
+
* Freeform notes or tips about the Flashback version of the mission.
|
|
314
|
+
*/
|
|
315
|
+
readonly notes?: MarkdownString;
|
|
316
|
+
}
|
|
317
|
+
|
|
285
318
|
interface MissionData {
|
|
286
319
|
/**
|
|
287
320
|
* Unique key used to reference this mission.
|
|
@@ -310,7 +343,7 @@ interface MissionData {
|
|
|
310
343
|
/**
|
|
311
344
|
* The level range this mission is available for.
|
|
312
345
|
*/
|
|
313
|
-
readonly levelRange?:
|
|
346
|
+
readonly levelRange?: LevelRangeData;
|
|
314
347
|
/**
|
|
315
348
|
* Freeform notes or tips about the mission.
|
|
316
349
|
*/
|
|
@@ -324,28 +357,6 @@ interface MissionData {
|
|
|
324
357
|
*/
|
|
325
358
|
readonly flashback?: MissionFlashbackData;
|
|
326
359
|
}
|
|
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
360
|
|
|
350
361
|
/**
|
|
351
362
|
* Metadata about a content bundle.
|
|
@@ -354,7 +365,17 @@ interface BundleHeaderData {
|
|
|
354
365
|
/**
|
|
355
366
|
* Name of the fork this bundle contains data for.
|
|
356
367
|
*/
|
|
357
|
-
readonly name
|
|
368
|
+
readonly name: string;
|
|
369
|
+
/**
|
|
370
|
+
* Version number for this data package.
|
|
371
|
+
*/
|
|
372
|
+
readonly version: string;
|
|
373
|
+
/**
|
|
374
|
+
* The time this bundle was last updated.
|
|
375
|
+
*
|
|
376
|
+
* Must be an ISO-8601 string in UTC.
|
|
377
|
+
*/
|
|
378
|
+
readonly lastUpdateTime: string;
|
|
358
379
|
/**
|
|
359
380
|
* Description of the fork.
|
|
360
381
|
*/
|
|
@@ -371,10 +392,6 @@ interface BundleHeaderData {
|
|
|
371
392
|
* List of external links. Wiki, forums, etc.
|
|
372
393
|
*/
|
|
373
394
|
readonly links?: Link[];
|
|
374
|
-
/**
|
|
375
|
-
* Version number for this data package.
|
|
376
|
-
*/
|
|
377
|
-
readonly version?: string;
|
|
378
395
|
}
|
|
379
396
|
|
|
380
397
|
/**
|
|
@@ -384,7 +401,7 @@ interface BundleData {
|
|
|
384
401
|
/**
|
|
385
402
|
* Bundle header.
|
|
386
403
|
*/
|
|
387
|
-
readonly header
|
|
404
|
+
readonly header: BundleHeaderData;
|
|
388
405
|
/**
|
|
389
406
|
* List of the game server names in this fork.
|
|
390
407
|
* Torchbearer, Excelsior, etc.
|
|
@@ -412,6 +429,14 @@ interface BundleData {
|
|
|
412
429
|
readonly badges?: BadgeData[];
|
|
413
430
|
}
|
|
414
431
|
|
|
432
|
+
/**
|
|
433
|
+
* For badges, aspects like the name, icon, or badge text can vary depending on context, such as the alignment or sex of the character.
|
|
434
|
+
*/
|
|
435
|
+
interface VariantContext {
|
|
436
|
+
readonly morality?: Morality | Alignment;
|
|
437
|
+
readonly sex?: Sex;
|
|
438
|
+
}
|
|
439
|
+
|
|
415
440
|
declare class AlignmentList {
|
|
416
441
|
#private;
|
|
417
442
|
readonly hero: boolean;
|
|
@@ -424,29 +449,6 @@ declare class AlignmentList {
|
|
|
424
449
|
has(alignment?: AlignmentExtended): boolean;
|
|
425
450
|
}
|
|
426
451
|
|
|
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
452
|
declare class Archetype {
|
|
451
453
|
readonly key: string;
|
|
452
454
|
readonly name: string;
|
|
@@ -524,6 +526,38 @@ declare class BadgeRequirement {
|
|
|
524
526
|
constructor(data: BadgeRequirementData);
|
|
525
527
|
}
|
|
526
528
|
|
|
529
|
+
declare class Variants<T> {
|
|
530
|
+
#private;
|
|
531
|
+
/**
|
|
532
|
+
* Create a variant set from either a list of categorized values, or a single value when there are no variants.
|
|
533
|
+
* @param value List of variants, or a single value.
|
|
534
|
+
*/
|
|
535
|
+
constructor(value: VariantData<T>[] | T);
|
|
536
|
+
/**
|
|
537
|
+
* Get a variant by context
|
|
538
|
+
* @param context The context
|
|
539
|
+
*/
|
|
540
|
+
getVariant(context?: VariantContext): VariantData<T> | undefined;
|
|
541
|
+
/**
|
|
542
|
+
* Get a value by variant context
|
|
543
|
+
* @param context The context
|
|
544
|
+
*/
|
|
545
|
+
getValue(context?: VariantContext): T | undefined;
|
|
546
|
+
/**
|
|
547
|
+
* Get the default value for this list of variants, the value with the highest priority and lowest specificity.
|
|
548
|
+
*/
|
|
549
|
+
get default(): VariantData<T> | undefined;
|
|
550
|
+
/**
|
|
551
|
+
* Get the list of variants sorted in canonical order (alignment then sex, low to high specificity).
|
|
552
|
+
*/
|
|
553
|
+
get canonical(): VariantData<T>[];
|
|
554
|
+
/**
|
|
555
|
+
* Create a joined string from the variant values in canonical order.
|
|
556
|
+
* @param separator Separator to use. Default is ' / '
|
|
557
|
+
*/
|
|
558
|
+
toString(separator: string): string;
|
|
559
|
+
}
|
|
560
|
+
|
|
527
561
|
declare class MoralityList {
|
|
528
562
|
#private;
|
|
529
563
|
readonly hero: boolean;
|
|
@@ -544,6 +578,12 @@ declare class MoralityList {
|
|
|
544
578
|
has(morality?: MoralityExtended): boolean;
|
|
545
579
|
}
|
|
546
580
|
|
|
581
|
+
declare class SetTitleIds {
|
|
582
|
+
readonly primal: number;
|
|
583
|
+
readonly praetorian?: number;
|
|
584
|
+
constructor(value: SetTitleData);
|
|
585
|
+
}
|
|
586
|
+
|
|
547
587
|
declare class Badge {
|
|
548
588
|
#private;
|
|
549
589
|
/**
|
|
@@ -559,7 +599,11 @@ declare class Badge {
|
|
|
559
599
|
*
|
|
560
600
|
* May vary by character sex or alignment.
|
|
561
601
|
*/
|
|
562
|
-
readonly name:
|
|
602
|
+
readonly name: Variants<string>;
|
|
603
|
+
/**
|
|
604
|
+
* The date that the badge was added to the game.
|
|
605
|
+
*/
|
|
606
|
+
readonly releaseDate: Date;
|
|
563
607
|
/**
|
|
564
608
|
* The character moralities that this badge is available to.
|
|
565
609
|
*/
|
|
@@ -567,7 +611,7 @@ declare class Badge {
|
|
|
567
611
|
/**
|
|
568
612
|
* The badge text as it appears in-game. May vary by character sex or alignment.
|
|
569
613
|
*/
|
|
570
|
-
readonly badgeText:
|
|
614
|
+
readonly badgeText: Variants<MarkdownString>;
|
|
571
615
|
/**
|
|
572
616
|
* Short description of how to acquire the badge. Detailed instructions will be in the notes field.
|
|
573
617
|
*/
|
|
@@ -577,7 +621,7 @@ declare class Badge {
|
|
|
577
621
|
*
|
|
578
622
|
* May vary by character sex or alignment.
|
|
579
623
|
*/
|
|
580
|
-
readonly icon:
|
|
624
|
+
readonly icon: Variants<string>;
|
|
581
625
|
/**
|
|
582
626
|
* Freeform notes or tips about the badge.
|
|
583
627
|
*/
|
|
@@ -590,21 +634,21 @@ declare class Badge {
|
|
|
590
634
|
* The id used with the in-game `/settitle` command to apply the badge.
|
|
591
635
|
* The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
|
|
592
636
|
*/
|
|
593
|
-
readonly setTitleId?:
|
|
637
|
+
readonly setTitleId?: SetTitleIds;
|
|
594
638
|
/**
|
|
595
639
|
* A description of the effect the badge will have, such as a buff or granting a temporary power.
|
|
596
640
|
*/
|
|
597
641
|
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
642
|
/**
|
|
603
643
|
* 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
644
|
*/
|
|
605
645
|
readonly ignoreInTotals: boolean;
|
|
606
646
|
constructor(badgeData: BadgeData);
|
|
607
|
-
|
|
647
|
+
/**
|
|
648
|
+
* Represents the requirements for badges with multiple fulfillment steps, such as visiting monuments for history badges, completing missions, or collecting other badges.
|
|
649
|
+
*/
|
|
650
|
+
get requirements(): BadgeRequirement[];
|
|
651
|
+
getRequirement(key: string): BadgeRequirement | undefined;
|
|
608
652
|
/**
|
|
609
653
|
* Return a list of all the zone keys referenced by this badge.
|
|
610
654
|
*/
|
|
@@ -614,9 +658,12 @@ declare class Badge {
|
|
|
614
658
|
*/
|
|
615
659
|
get zoneKey(): string | undefined;
|
|
616
660
|
}
|
|
617
|
-
declare function
|
|
661
|
+
declare function compareByName(a?: Badge, b?: Badge, context?: VariantContext): number;
|
|
618
662
|
declare function compareByZoneKey(a?: Badge, b?: Badge): number;
|
|
663
|
+
declare function compareByReleaseDate(a?: Badge, b?: Badge): number;
|
|
619
664
|
|
|
665
|
+
type BadgeQueryableField = 'name' | 'badge-text' | 'acquisition' | 'notes' | 'effect' | 'set-title-id';
|
|
666
|
+
type BadgeSort = `${'canonical' | 'name' | 'zone-key' | 'release-date'}.${'asc' | 'desc'}`;
|
|
620
667
|
interface BadgeSearchOptions {
|
|
621
668
|
/**
|
|
622
669
|
* Text-based search.
|
|
@@ -625,14 +672,7 @@ interface BadgeSearchOptions {
|
|
|
625
672
|
*/
|
|
626
673
|
query?: {
|
|
627
674
|
str?: string;
|
|
628
|
-
|
|
629
|
-
name?: boolean;
|
|
630
|
-
badgeText?: boolean;
|
|
631
|
-
acquisition?: boolean;
|
|
632
|
-
notes?: boolean;
|
|
633
|
-
effect?: boolean;
|
|
634
|
-
setTitle?: boolean;
|
|
635
|
-
};
|
|
675
|
+
fields?: BadgeQueryableField[];
|
|
636
676
|
};
|
|
637
677
|
/**
|
|
638
678
|
* Filter results matching the given values.
|
|
@@ -640,17 +680,19 @@ interface BadgeSearchOptions {
|
|
|
640
680
|
filter?: {
|
|
641
681
|
type?: BadgeType;
|
|
642
682
|
zoneKey?: string;
|
|
643
|
-
morality?:
|
|
683
|
+
morality?: Morality;
|
|
684
|
+
predicate?: (badge: Badge) => boolean;
|
|
644
685
|
};
|
|
686
|
+
/**
|
|
687
|
+
* Adjust search results based on a given variant context (morality or sex of a character).
|
|
688
|
+
*/
|
|
689
|
+
context?: VariantContext;
|
|
645
690
|
/**
|
|
646
691
|
* Sort results.
|
|
647
692
|
*
|
|
648
693
|
* Badges are assumed to be in canonical order in the content bundle, and should match the in-game display order.
|
|
649
694
|
*/
|
|
650
|
-
sort?:
|
|
651
|
-
by?: 'canonical' | 'badge-name' | 'zone-key';
|
|
652
|
-
dir?: 'asc' | 'desc';
|
|
653
|
-
};
|
|
695
|
+
sort?: BadgeSort;
|
|
654
696
|
/**
|
|
655
697
|
* The page (1-based)
|
|
656
698
|
*/
|
|
@@ -663,29 +705,30 @@ interface BadgeSearchOptions {
|
|
|
663
705
|
|
|
664
706
|
interface Paged<T> {
|
|
665
707
|
items: T[];
|
|
666
|
-
|
|
708
|
+
matchedItemCount: number;
|
|
709
|
+
totalItemCount: number;
|
|
667
710
|
pageSize?: number;
|
|
668
|
-
|
|
669
|
-
|
|
711
|
+
pageIndex: number;
|
|
712
|
+
pageNumber: number;
|
|
713
|
+
totalPageCount: number;
|
|
670
714
|
}
|
|
671
715
|
|
|
672
716
|
type KeysOfType<T, V> = {
|
|
673
717
|
[P in keyof T]: T[P] extends V ? P : never;
|
|
674
718
|
}[keyof T];
|
|
675
719
|
declare class AbstractIndex<T> {
|
|
676
|
-
#private;
|
|
677
720
|
protected _values: T[];
|
|
678
721
|
protected _hashTable: Record<string, T>;
|
|
679
|
-
constructor(keyField: KeysOfType<T, string>);
|
|
680
722
|
/**
|
|
681
|
-
*
|
|
723
|
+
* Create a new index.
|
|
724
|
+
* @param keyField The field of the values that will act as the key.
|
|
725
|
+
* @param values Values to index.
|
|
682
726
|
*/
|
|
683
|
-
|
|
727
|
+
constructor(keyField: KeysOfType<T, string>, values: T[] | undefined);
|
|
684
728
|
/**
|
|
685
|
-
*
|
|
686
|
-
* @param values List of values.
|
|
729
|
+
* Return all indexed values
|
|
687
730
|
*/
|
|
688
|
-
|
|
731
|
+
get values(): T[];
|
|
689
732
|
/**
|
|
690
733
|
* Get a value from the index
|
|
691
734
|
* @param key Key string
|
|
@@ -695,15 +738,23 @@ declare class AbstractIndex<T> {
|
|
|
695
738
|
|
|
696
739
|
declare class BadgeIndex extends AbstractIndex<Badge> {
|
|
697
740
|
#private;
|
|
698
|
-
constructor();
|
|
741
|
+
constructor(values: Badge[] | undefined);
|
|
699
742
|
search(options?: BadgeSearchOptions): Paged<Badge>;
|
|
700
743
|
}
|
|
701
744
|
|
|
702
745
|
declare class BundleHeader {
|
|
703
746
|
/**
|
|
704
|
-
* Name of the
|
|
747
|
+
* Name of the fork this bundle contains data for.
|
|
705
748
|
*/
|
|
706
|
-
readonly name
|
|
749
|
+
readonly name: string;
|
|
750
|
+
/**
|
|
751
|
+
* Version number for this data package.
|
|
752
|
+
*/
|
|
753
|
+
readonly version: string;
|
|
754
|
+
/**
|
|
755
|
+
* The time this bundle was last updated.
|
|
756
|
+
*/
|
|
757
|
+
readonly lastUpdateTime: Date;
|
|
707
758
|
/**
|
|
708
759
|
* Description of the fork.
|
|
709
760
|
*/
|
|
@@ -720,11 +771,13 @@ declare class BundleHeader {
|
|
|
720
771
|
* List of external links. Wiki, forums, etc.
|
|
721
772
|
*/
|
|
722
773
|
readonly links?: Link[];
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
774
|
+
constructor(data: BundleHeaderData);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
declare class LevelRange {
|
|
778
|
+
readonly min: number;
|
|
779
|
+
readonly max?: number;
|
|
780
|
+
constructor(value: LevelRangeData);
|
|
728
781
|
}
|
|
729
782
|
|
|
730
783
|
declare class Zone {
|
|
@@ -738,6 +791,22 @@ declare class Zone {
|
|
|
738
791
|
* The name of the zone as it appears in-game.
|
|
739
792
|
*/
|
|
740
793
|
readonly name: string;
|
|
794
|
+
/**
|
|
795
|
+
* The type of zone.
|
|
796
|
+
*/
|
|
797
|
+
readonly type: ZoneType;
|
|
798
|
+
/**
|
|
799
|
+
* The character moralities that this zone is accessible by.
|
|
800
|
+
*/
|
|
801
|
+
readonly morality: MoralityList;
|
|
802
|
+
/**
|
|
803
|
+
* The level range this zone is recommended for.
|
|
804
|
+
*/
|
|
805
|
+
readonly levelRange?: LevelRange;
|
|
806
|
+
/**
|
|
807
|
+
* Freeform notes or tips about the zone.
|
|
808
|
+
*/
|
|
809
|
+
readonly notes?: MarkdownString;
|
|
741
810
|
/**
|
|
742
811
|
* List of external links. Wiki, forums, etc.
|
|
743
812
|
*/
|
|
@@ -763,7 +832,7 @@ declare class Contact {
|
|
|
763
832
|
/**
|
|
764
833
|
* The character moralities that this contact will interact with.
|
|
765
834
|
*/
|
|
766
|
-
readonly morality
|
|
835
|
+
readonly morality: MoralityList;
|
|
767
836
|
/**
|
|
768
837
|
* The location of this contact.
|
|
769
838
|
*/
|
|
@@ -771,7 +840,7 @@ declare class Contact {
|
|
|
771
840
|
/**
|
|
772
841
|
* The level range this contact will offer missions for.
|
|
773
842
|
*/
|
|
774
|
-
readonly levelRange?:
|
|
843
|
+
readonly levelRange?: LevelRange;
|
|
775
844
|
/**
|
|
776
845
|
* Freeform notes or tips about the contact.
|
|
777
846
|
*/
|
|
@@ -811,7 +880,7 @@ declare class Mission {
|
|
|
811
880
|
/**
|
|
812
881
|
* The level range this mission is available for.
|
|
813
882
|
*/
|
|
814
|
-
readonly levelRange?:
|
|
883
|
+
readonly levelRange?: LevelRange;
|
|
815
884
|
/**
|
|
816
885
|
* Freeform notes or tips about the mission.
|
|
817
886
|
*/
|
|
@@ -829,17 +898,17 @@ declare class Mission {
|
|
|
829
898
|
*/
|
|
830
899
|
readonly id: string;
|
|
831
900
|
/**
|
|
832
|
-
* The level range this mission appears under as a Flashback.
|
|
901
|
+
* The level range this mission appears under as a Flashback.
|
|
833
902
|
*/
|
|
834
|
-
readonly levelRange?:
|
|
903
|
+
readonly levelRange?: LevelRange;
|
|
835
904
|
/**
|
|
836
|
-
* The name as it appears in the Flashback list.
|
|
905
|
+
* The name as it appears in the Flashback list.
|
|
837
906
|
*/
|
|
838
|
-
readonly name
|
|
907
|
+
readonly name: string;
|
|
839
908
|
/**
|
|
840
|
-
* The character moralities that the mission will appear for in the Flashback list.
|
|
909
|
+
* The character moralities that the mission will appear for in the Flashback list.
|
|
841
910
|
*/
|
|
842
|
-
readonly morality
|
|
911
|
+
readonly morality: MoralityList;
|
|
843
912
|
/**
|
|
844
913
|
* Freeform notes or tips about the Flashback version of the mission.
|
|
845
914
|
*/
|
|
@@ -851,14 +920,14 @@ declare class Mission {
|
|
|
851
920
|
declare class CohContentDatabase {
|
|
852
921
|
#private;
|
|
853
922
|
/**
|
|
854
|
-
*
|
|
923
|
+
* Create a db instance from the given content bundle.
|
|
855
924
|
* @param bundle The bundle to load.
|
|
856
925
|
*/
|
|
857
|
-
|
|
926
|
+
constructor(bundle: BundleData);
|
|
858
927
|
/**
|
|
859
928
|
* Header information about the content bundle.
|
|
860
929
|
*/
|
|
861
|
-
get header(): BundleHeader
|
|
930
|
+
get header(): BundleHeader;
|
|
862
931
|
/**
|
|
863
932
|
* List of the game server names.
|
|
864
933
|
*
|
|
@@ -989,15 +1058,6 @@ declare function zoneUri(target: string | Zone | ZoneData): string;
|
|
|
989
1058
|
* @param target The {@link Zone} or zone key to target.
|
|
990
1059
|
*/
|
|
991
1060
|
declare function zoneLink(target: string | Zone | ZoneData): string;
|
|
992
|
-
/**
|
|
993
|
-
* For fields that accept either an array of values or a single value, coalesces the value to an array.
|
|
994
|
-
*
|
|
995
|
-
* Arrays are returned as-is.
|
|
996
|
-
* Single values are returned as a single-value array.
|
|
997
|
-
* Undefined values are returned as undefined.
|
|
998
|
-
*
|
|
999
|
-
* @param value The value to coalesce.
|
|
1000
|
-
*/
|
|
1001
|
-
declare function coalesceToArray<T>(value?: T | T[]): T[] | undefined;
|
|
1002
1061
|
|
|
1003
|
-
export { ALIGNMENT,
|
|
1062
|
+
export { ALIGNMENT, AlignmentList, Archetype, BADGE_REQUIREMENT_TYPE, BADGE_TYPE, Badge, BadgeIndex, BadgeRequirement, BundleHeader, CohContentDatabase, Contact, ENHANCEMENT_CATEGORY, Key, LevelRange, Location, MISSION_TYPE, MORALITY, MORALITY_EXTENDED, Mission, MoralityList, MoralityMap, SEX, SetTitleIds, Variants, ZONE_TYPE, Zone, badgeLink, badgeUri, compareAlignment, compareByName, compareByReleaseDate, compareByZoneKey, compareSex, contactLink, contactUri, missionLink, missionUri, zoneLink, zoneUri };
|
|
1063
|
+
export type { Alignment, AlignmentExtended, ArchetypeData, BadgeData, BadgeQueryableField, BadgeRequirementData, BadgeRequirementType, BadgeSearchOptions, BadgeSort, BadgeType, BundleData, BundleHeaderData, ContactData, Coords, EnhancementCategory, LevelRangeData, Link, LocationData, LocationIcon, MarkdownString, MissionData, MissionFlashbackData, MissionType, Morality, MoralityExtended, Paged, SetTitleData, Sex, VariantContext, VariantData, ZoneData, ZoneType };
|