coh-content-db 2.0.0-rc.1 → 2.0.0-rc.3
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/.editorconfig +10 -11
- package/.github/workflows/release.yml +1 -1
- package/README.md +13 -23
- package/dist/coh-content-db.d.ts +32 -43
- package/dist/coh-content-db.js +175 -177
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +175 -177
- package/dist/coh-content-db.mjs.map +1 -1
- package/package.json +1 -1
- package/src/main/api/{server-group-data.ts → content-bundle.ts} +8 -15
- package/src/main/changelog.ts +4 -2
- package/src/main/db/alternates.ts +10 -1
- package/src/main/db/bundle-metadata.ts +40 -0
- package/src/main/db/coh-content-database.ts +69 -16
- package/src/main/index.ts +2 -2
- package/src/test/api/badge-data.test.ts +1 -1
- package/src/test/api/{server-group-data.fixture.ts → content-bundle.fixture.ts} +3 -4
- package/src/test/api/{server-group-data.test.ts → content-bundle.test.ts} +4 -5
- package/src/test/changelog.test.ts +3 -3
- package/src/test/db/alternates.test.ts +21 -2
- package/src/test/db/badge.test.ts +1 -1
- package/src/test/db/bundle-metadata.test.ts +67 -0
- package/src/test/db/coh-content-database.test.ts +125 -24
- package/src/main/db/server-group.ts +0 -112
- package/src/test/db/server-group.test.ts +0 -124
package/dist/coh-content-db.mjs
CHANGED
|
@@ -62,25 +62,25 @@ const PLAQUE_TYPE = [
|
|
|
62
62
|
|
|
63
63
|
const SEX = ["M", "F"];
|
|
64
64
|
|
|
65
|
-
var __typeError$
|
|
65
|
+
var __typeError$3 = (msg) => {
|
|
66
66
|
throw TypeError(msg);
|
|
67
67
|
};
|
|
68
|
-
var __accessCheck$
|
|
69
|
-
var __privateGet$
|
|
70
|
-
var __privateAdd$
|
|
71
|
-
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$
|
|
72
|
-
var __privateMethod$1 = (obj, member, method) => (__accessCheck$
|
|
68
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
|
69
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
70
|
+
var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
71
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
72
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
|
73
73
|
var _value, _Key_instances, validateKey_fn;
|
|
74
74
|
const INVALID_KEY_PATTERN = /[^a-z0-9-]/;
|
|
75
75
|
class Key {
|
|
76
76
|
constructor(value) {
|
|
77
|
-
__privateAdd$
|
|
78
|
-
__privateAdd$
|
|
77
|
+
__privateAdd$3(this, _Key_instances);
|
|
78
|
+
__privateAdd$3(this, _value);
|
|
79
79
|
__privateMethod$1(this, _Key_instances, validateKey_fn).call(this, value);
|
|
80
80
|
__privateSet$1(this, _value, value);
|
|
81
81
|
}
|
|
82
82
|
get value() {
|
|
83
|
-
return __privateGet$
|
|
83
|
+
return __privateGet$3(this, _value);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
_value = new WeakMap();
|
|
@@ -89,37 +89,37 @@ validateKey_fn = function(key) {
|
|
|
89
89
|
if (INVALID_KEY_PATTERN.test(key)) throw new Error(`Invalid key: [${key}]; Keys can only contain lowercase characters, numbers and dashes.`);
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
var __defProp$
|
|
93
|
-
var __defNormalProp$
|
|
94
|
-
var __publicField$
|
|
92
|
+
var __defProp$7 = Object.defineProperty;
|
|
93
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
94
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
95
95
|
class Archetype {
|
|
96
96
|
constructor(data) {
|
|
97
|
-
__publicField$
|
|
98
|
-
__publicField$
|
|
99
|
-
__publicField$
|
|
97
|
+
__publicField$7(this, "key");
|
|
98
|
+
__publicField$7(this, "name");
|
|
99
|
+
__publicField$7(this, "description");
|
|
100
100
|
this.key = new Key(data.key).value;
|
|
101
101
|
this.name = data.name;
|
|
102
102
|
this.description = data.description;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
var __defProp$
|
|
107
|
-
var __defNormalProp$
|
|
108
|
-
var __publicField$
|
|
106
|
+
var __defProp$6 = Object.defineProperty;
|
|
107
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
108
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
109
109
|
class BadgePartial {
|
|
110
110
|
constructor(data) {
|
|
111
|
-
__publicField$
|
|
112
|
-
__publicField$
|
|
113
|
-
__publicField$
|
|
114
|
-
__publicField$
|
|
115
|
-
__publicField$
|
|
116
|
-
__publicField$
|
|
117
|
-
__publicField$
|
|
118
|
-
__publicField$
|
|
119
|
-
__publicField$
|
|
120
|
-
__publicField$
|
|
121
|
-
__publicField$
|
|
122
|
-
__publicField$
|
|
111
|
+
__publicField$6(this, "key");
|
|
112
|
+
__publicField$6(this, "type");
|
|
113
|
+
__publicField$6(this, "mapKey");
|
|
114
|
+
__publicField$6(this, "loc");
|
|
115
|
+
__publicField$6(this, "plaqueType");
|
|
116
|
+
__publicField$6(this, "inscription");
|
|
117
|
+
__publicField$6(this, "vidiotMapKey");
|
|
118
|
+
__publicField$6(this, "badgeKey");
|
|
119
|
+
__publicField$6(this, "inventionLevel");
|
|
120
|
+
__publicField$6(this, "inventionTypes");
|
|
121
|
+
__publicField$6(this, "inventionCount");
|
|
122
|
+
__publicField$6(this, "notes");
|
|
123
123
|
this.key = new Key(data.key).value;
|
|
124
124
|
this.type = data.type;
|
|
125
125
|
this.mapKey = data.mapKey;
|
|
@@ -135,42 +135,49 @@ class BadgePartial {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
var __typeError$
|
|
138
|
+
var __typeError$2 = (msg) => {
|
|
139
139
|
throw TypeError(msg);
|
|
140
140
|
};
|
|
141
|
-
var __accessCheck$
|
|
142
|
-
var __privateGet$
|
|
143
|
-
var __privateAdd$
|
|
144
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck$
|
|
145
|
-
var __privateMethod = (obj, member, method) => (__accessCheck$
|
|
141
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
142
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
143
|
+
var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
144
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
|
|
145
|
+
var __privateMethod = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
|
|
146
146
|
var _sortedValues, _Alternates_instances, compareAlternates_fn, compareAlignment_fn, compareSex_fn;
|
|
147
147
|
const ALIGNMENT_SORT = { H: 2, V: 1, P: 0 };
|
|
148
148
|
const SEX_SORT = { M: 1, F: 0 };
|
|
149
149
|
class Alternates {
|
|
150
150
|
constructor(values) {
|
|
151
|
-
__privateAdd$
|
|
152
|
-
__privateAdd$
|
|
151
|
+
__privateAdd$2(this, _Alternates_instances);
|
|
152
|
+
__privateAdd$2(this, _sortedValues, []);
|
|
153
153
|
__privateSet(this, _sortedValues, values.sort());
|
|
154
|
-
__privateGet$
|
|
154
|
+
__privateGet$2(this, _sortedValues).sort((a, b) => __privateMethod(this, _Alternates_instances, compareAlternates_fn).call(this, a, b));
|
|
155
155
|
}
|
|
156
156
|
getValue(alignment, sex) {
|
|
157
|
-
for (let index = __privateGet$
|
|
158
|
-
const entry = __privateGet$
|
|
157
|
+
for (let index = __privateGet$2(this, _sortedValues).length; index--; ) {
|
|
158
|
+
const entry = __privateGet$2(this, _sortedValues)[index];
|
|
159
159
|
if ((entry.alignment === void 0 || entry.alignment === alignment) && (entry.sex === void 0 || entry.sex === sex)) return entry.value;
|
|
160
160
|
}
|
|
161
|
-
return
|
|
161
|
+
return this.default;
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
|
|
165
165
|
*/
|
|
166
166
|
get default() {
|
|
167
|
-
return __privateGet$
|
|
167
|
+
return __privateGet$2(this, _sortedValues)[0]?.value;
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
|
|
171
171
|
*/
|
|
172
172
|
get canonical() {
|
|
173
|
-
return __privateGet$
|
|
173
|
+
return __privateGet$2(this, _sortedValues);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Create a joined string from the alternate values in canonical order.
|
|
177
|
+
* @param separator Separator to use. Default is ' / '
|
|
178
|
+
*/
|
|
179
|
+
toString(separator) {
|
|
180
|
+
return this.canonical.map((x) => x.value).join(separator);
|
|
174
181
|
}
|
|
175
182
|
}
|
|
176
183
|
_sortedValues = new WeakMap();
|
|
@@ -204,93 +211,93 @@ compareSex_fn = function(a, b) {
|
|
|
204
211
|
return a?.localeCompare(b ?? "") ?? 0;
|
|
205
212
|
};
|
|
206
213
|
|
|
207
|
-
var __defProp$
|
|
208
|
-
var __typeError$
|
|
214
|
+
var __defProp$5 = Object.defineProperty;
|
|
215
|
+
var __typeError$1 = (msg) => {
|
|
209
216
|
throw TypeError(msg);
|
|
210
217
|
};
|
|
211
|
-
var __defNormalProp$
|
|
212
|
-
var __publicField$
|
|
213
|
-
var __accessCheck$
|
|
214
|
-
var __privateGet$
|
|
215
|
-
var __privateAdd$
|
|
218
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
219
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
220
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
221
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
222
|
+
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
216
223
|
var _partialsIndex;
|
|
217
224
|
class Badge {
|
|
218
225
|
constructor(data) {
|
|
219
|
-
__privateAdd$
|
|
226
|
+
__privateAdd$1(this, _partialsIndex, {});
|
|
220
227
|
/**
|
|
221
228
|
* The database key for this badge.
|
|
222
229
|
*/
|
|
223
|
-
__publicField$
|
|
230
|
+
__publicField$5(this, "key");
|
|
224
231
|
/**
|
|
225
232
|
* The type of badge.
|
|
226
233
|
*/
|
|
227
|
-
__publicField$
|
|
234
|
+
__publicField$5(this, "type");
|
|
228
235
|
/**
|
|
229
236
|
* The name of this badge.
|
|
230
237
|
*
|
|
231
238
|
* May vary by character sex or alignment.
|
|
232
239
|
*/
|
|
233
|
-
__publicField$
|
|
240
|
+
__publicField$5(this, "name");
|
|
234
241
|
/**
|
|
235
242
|
* The character alignments that this badge is available to.
|
|
236
243
|
*/
|
|
237
|
-
__publicField$
|
|
244
|
+
__publicField$5(this, "alignment");
|
|
238
245
|
/**
|
|
239
246
|
* The badge text as it appears in-game. May vary by character sex or alignment.
|
|
240
247
|
*/
|
|
241
|
-
__publicField$
|
|
248
|
+
__publicField$5(this, "badgeText");
|
|
242
249
|
/**
|
|
243
250
|
* Description of how to acquire the badge.
|
|
244
251
|
*
|
|
245
252
|
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
246
253
|
*/
|
|
247
|
-
__publicField$
|
|
254
|
+
__publicField$5(this, "acquisition");
|
|
248
255
|
/**
|
|
249
256
|
* Absolute URL to this badge's icon.
|
|
250
257
|
*
|
|
251
258
|
* May vary by character sex or alignment.
|
|
252
259
|
*/
|
|
253
|
-
__publicField$
|
|
260
|
+
__publicField$5(this, "icon");
|
|
254
261
|
/**
|
|
255
262
|
* Freeform notes or tips about the badge.
|
|
256
263
|
*
|
|
257
264
|
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
258
265
|
*/
|
|
259
|
-
__publicField$
|
|
266
|
+
__publicField$5(this, "notes");
|
|
260
267
|
/**
|
|
261
268
|
* List of external links for this Badge. Wiki, forums, etc.
|
|
262
269
|
*/
|
|
263
|
-
__publicField$
|
|
270
|
+
__publicField$5(this, "links");
|
|
264
271
|
/**
|
|
265
272
|
* For exploration badges, the key of the {@link GameMap} that this badge is found on.
|
|
266
273
|
*/
|
|
267
|
-
__publicField$
|
|
274
|
+
__publicField$5(this, "mapKey");
|
|
268
275
|
/**
|
|
269
276
|
* For exploration badges, the `/loc` coordinates of the badge on the in-game map.
|
|
270
277
|
*/
|
|
271
|
-
__publicField$
|
|
278
|
+
__publicField$5(this, "loc");
|
|
272
279
|
/**
|
|
273
280
|
* For badges that appear on a Vidiot Map, the number or letter the badge appears as.
|
|
274
281
|
*/
|
|
275
|
-
__publicField$
|
|
282
|
+
__publicField$5(this, "vidiotMapKey");
|
|
276
283
|
/**
|
|
277
284
|
* ID used with the in-game `/settitle` command to apply the badge.
|
|
278
285
|
*/
|
|
279
|
-
__publicField$
|
|
286
|
+
__publicField$5(this, "setTitle");
|
|
280
287
|
/**
|
|
281
288
|
* A description of the effect the badge will have, such as a buff or granting a temporary power.
|
|
282
289
|
*
|
|
283
290
|
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
284
291
|
*/
|
|
285
|
-
__publicField$
|
|
292
|
+
__publicField$5(this, "effect");
|
|
286
293
|
/**
|
|
287
294
|
* 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.
|
|
288
295
|
*/
|
|
289
|
-
__publicField$
|
|
296
|
+
__publicField$5(this, "partials");
|
|
290
297
|
/**
|
|
291
298
|
* 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.
|
|
292
299
|
*/
|
|
293
|
-
__publicField$
|
|
300
|
+
__publicField$5(this, "ignoreInTotals");
|
|
294
301
|
this.key = new Key(data.key).value;
|
|
295
302
|
this.type = data.type;
|
|
296
303
|
this.name = new Alternates(data.name);
|
|
@@ -307,23 +314,23 @@ class Badge {
|
|
|
307
314
|
this.setTitle = data.setTitle;
|
|
308
315
|
this.ignoreInTotals = data.ignoreInTotals ?? false;
|
|
309
316
|
this.partials = data.partials?.map((data2) => {
|
|
310
|
-
if (__privateGet$
|
|
317
|
+
if (__privateGet$1(this, _partialsIndex)[data2.key] !== void 0) throw new Error(`Duplicate badge partial key [${data2.key}]`);
|
|
311
318
|
const badge = new BadgePartial(data2);
|
|
312
|
-
__privateGet$
|
|
319
|
+
__privateGet$1(this, _partialsIndex)[badge.key] = badge;
|
|
313
320
|
return badge;
|
|
314
321
|
});
|
|
315
322
|
}
|
|
316
323
|
getPartial(key) {
|
|
317
|
-
const result = __privateGet$
|
|
324
|
+
const result = __privateGet$1(this, _partialsIndex)[key];
|
|
318
325
|
if (result === void 0) throw new Error(`Unknown badge partial key [${key}]`);
|
|
319
326
|
return result;
|
|
320
327
|
}
|
|
321
328
|
}
|
|
322
329
|
_partialsIndex = new WeakMap();
|
|
323
330
|
|
|
324
|
-
var __defProp$
|
|
325
|
-
var __defNormalProp$
|
|
326
|
-
var __publicField$
|
|
331
|
+
var __defProp$4 = Object.defineProperty;
|
|
332
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
333
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
327
334
|
class VidiotMapPointOfInterest {
|
|
328
335
|
constructor(data) {
|
|
329
336
|
/**
|
|
@@ -331,25 +338,25 @@ class VidiotMapPointOfInterest {
|
|
|
331
338
|
*
|
|
332
339
|
* Screen-space, pixels from top-left `[0, 0]`.
|
|
333
340
|
*/
|
|
334
|
-
__publicField$
|
|
341
|
+
__publicField$4(this, "pos");
|
|
335
342
|
/**
|
|
336
343
|
* Freeform notes about the PoI.
|
|
337
344
|
*
|
|
338
345
|
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
339
346
|
*/
|
|
340
|
-
__publicField$
|
|
347
|
+
__publicField$4(this, "notes");
|
|
341
348
|
/**
|
|
342
349
|
* If the POI is a zone transfer, the map it transfers to.
|
|
343
350
|
*/
|
|
344
|
-
__publicField$
|
|
351
|
+
__publicField$4(this, "mapKey");
|
|
345
352
|
/**
|
|
346
353
|
* If the POI is a badge, the badge.
|
|
347
354
|
*/
|
|
348
|
-
__publicField$
|
|
355
|
+
__publicField$4(this, "badgeKey");
|
|
349
356
|
/**
|
|
350
357
|
* If the POI is a partial for a badge, the partial key.
|
|
351
358
|
*/
|
|
352
|
-
__publicField$
|
|
359
|
+
__publicField$4(this, "badgePartialKey");
|
|
353
360
|
this.pos = data.pos;
|
|
354
361
|
this.notes = data.notes;
|
|
355
362
|
this.mapKey = data.mapKey;
|
|
@@ -358,50 +365,50 @@ class VidiotMapPointOfInterest {
|
|
|
358
365
|
}
|
|
359
366
|
}
|
|
360
367
|
|
|
361
|
-
var __defProp$
|
|
362
|
-
var __defNormalProp$
|
|
363
|
-
var __publicField$
|
|
368
|
+
var __defProp$3 = Object.defineProperty;
|
|
369
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
370
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
364
371
|
class VidiotMap {
|
|
365
372
|
constructor(data) {
|
|
366
373
|
/**
|
|
367
374
|
* URL of the map image.
|
|
368
375
|
*/
|
|
369
|
-
__publicField$
|
|
376
|
+
__publicField$3(this, "imageUrl");
|
|
370
377
|
/**
|
|
371
378
|
* Name to display for the Vidiot map.
|
|
372
379
|
*/
|
|
373
|
-
__publicField$
|
|
380
|
+
__publicField$3(this, "name");
|
|
374
381
|
/**
|
|
375
382
|
* List of Points of Interest labelled on the image.
|
|
376
383
|
*/
|
|
377
|
-
__publicField$
|
|
384
|
+
__publicField$3(this, "pointsOfInterest");
|
|
378
385
|
this.imageUrl = data.imageUrl;
|
|
379
386
|
this.name = data.name;
|
|
380
387
|
this.pointsOfInterest = data.pointsOfInterest?.map((data2) => new VidiotMapPointOfInterest(data2));
|
|
381
388
|
}
|
|
382
389
|
}
|
|
383
390
|
|
|
384
|
-
var __defProp$
|
|
385
|
-
var __defNormalProp$
|
|
386
|
-
var __publicField$
|
|
391
|
+
var __defProp$2 = Object.defineProperty;
|
|
392
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
393
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
387
394
|
class GameMap {
|
|
388
395
|
constructor(data) {
|
|
389
396
|
/**
|
|
390
397
|
* The database key for this map.
|
|
391
398
|
*/
|
|
392
|
-
__publicField$
|
|
399
|
+
__publicField$2(this, "key");
|
|
393
400
|
/**
|
|
394
401
|
* The name of the map as it appears in-game.
|
|
395
402
|
*/
|
|
396
|
-
__publicField$
|
|
403
|
+
__publicField$2(this, "name");
|
|
397
404
|
/**
|
|
398
405
|
* List of external links for this Map. Wiki, forums, etc.
|
|
399
406
|
*/
|
|
400
|
-
__publicField$
|
|
407
|
+
__publicField$2(this, "links");
|
|
401
408
|
/**
|
|
402
409
|
* List of Vidiot Map assets for this map.
|
|
403
410
|
*/
|
|
404
|
-
__publicField$
|
|
411
|
+
__publicField$2(this, "vidiotMaps");
|
|
405
412
|
this.key = new Key(data.key).value;
|
|
406
413
|
this.name = data.name;
|
|
407
414
|
this.links = data.links;
|
|
@@ -409,43 +416,64 @@ class GameMap {
|
|
|
409
416
|
}
|
|
410
417
|
}
|
|
411
418
|
|
|
412
|
-
var __defProp = Object.defineProperty;
|
|
413
|
-
var
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
418
|
-
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
419
|
-
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
420
|
-
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
421
|
-
var _archetypeIndex, _mapIndex, _badgeIndex;
|
|
422
|
-
class ServerGroup {
|
|
423
|
-
constructor(data) {
|
|
424
|
-
__privateAdd$1(this, _archetypeIndex, {});
|
|
425
|
-
__privateAdd$1(this, _mapIndex, {});
|
|
426
|
-
__privateAdd$1(this, _badgeIndex, {});
|
|
427
|
-
/**
|
|
428
|
-
* The database key for this server group.
|
|
429
|
-
*/
|
|
430
|
-
__publicField(this, "key");
|
|
419
|
+
var __defProp$1 = Object.defineProperty;
|
|
420
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
421
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
422
|
+
class BundleMetadata {
|
|
423
|
+
constructor(bundle) {
|
|
431
424
|
/**
|
|
432
425
|
* Name of the server group.
|
|
433
426
|
*/
|
|
434
|
-
__publicField(this, "name");
|
|
427
|
+
__publicField$1(this, "name");
|
|
435
428
|
/**
|
|
436
429
|
* Description of the server group.
|
|
437
430
|
*
|
|
438
431
|
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
439
432
|
*/
|
|
440
|
-
__publicField(this, "description");
|
|
433
|
+
__publicField$1(this, "description");
|
|
441
434
|
/**
|
|
442
435
|
* Repository where the db content package is maintained.
|
|
443
436
|
*/
|
|
444
|
-
__publicField(this, "repository");
|
|
437
|
+
__publicField$1(this, "repository");
|
|
445
438
|
/**
|
|
446
439
|
* List of external links for this Server Group. Wiki, forums, etc.
|
|
447
440
|
*/
|
|
448
|
-
__publicField(this, "links");
|
|
441
|
+
__publicField$1(this, "links");
|
|
442
|
+
/**
|
|
443
|
+
* Change log for this data package.
|
|
444
|
+
*/
|
|
445
|
+
__publicField$1(this, "changelog");
|
|
446
|
+
this.name = bundle.name;
|
|
447
|
+
this.description = bundle.description;
|
|
448
|
+
this.repository = bundle.repository;
|
|
449
|
+
this.links = bundle.links ?? [];
|
|
450
|
+
this.changelog = bundle.changelog ?? [];
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
var __defProp = Object.defineProperty;
|
|
455
|
+
var __typeError = (msg) => {
|
|
456
|
+
throw TypeError(msg);
|
|
457
|
+
};
|
|
458
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
459
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
460
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
461
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
462
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
463
|
+
var _archetypeIndex, _mapIndex, _badgeIndex;
|
|
464
|
+
class CohContentDatabase {
|
|
465
|
+
/**
|
|
466
|
+
* Initialize the database with a content bundle.
|
|
467
|
+
* @param bundle The data to load.
|
|
468
|
+
*/
|
|
469
|
+
constructor(bundle) {
|
|
470
|
+
__privateAdd(this, _archetypeIndex, {});
|
|
471
|
+
__privateAdd(this, _mapIndex, {});
|
|
472
|
+
__privateAdd(this, _badgeIndex, {});
|
|
473
|
+
/**
|
|
474
|
+
* Metadata about the content bundle.
|
|
475
|
+
*/
|
|
476
|
+
__publicField(this, "metadata");
|
|
449
477
|
/**
|
|
450
478
|
* List of the game server names in this server group.
|
|
451
479
|
* Torchbearer, Excelsior, etc.
|
|
@@ -463,48 +491,39 @@ class ServerGroup {
|
|
|
463
491
|
* List of badges available on this server group.
|
|
464
492
|
*/
|
|
465
493
|
__publicField(this, "badges");
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
this.description = data.description;
|
|
473
|
-
this.repository = data.repository;
|
|
474
|
-
this.links = data.links;
|
|
475
|
-
this.servers = data.servers ?? [];
|
|
476
|
-
this.archetypes = data.archetypes?.map((data2) => {
|
|
477
|
-
if (__privateGet$1(this, _archetypeIndex)[data2.key] !== void 0) throw new Error(`Duplicate archetype key [${data2.key}]`);
|
|
478
|
-
const archetype = new Archetype(data2);
|
|
479
|
-
__privateGet$1(this, _archetypeIndex)[archetype.key] = archetype;
|
|
494
|
+
this.metadata = new BundleMetadata(bundle);
|
|
495
|
+
this.servers = bundle.servers ?? [];
|
|
496
|
+
this.archetypes = bundle.archetypes?.map((data) => {
|
|
497
|
+
if (__privateGet(this, _archetypeIndex)[data.key] !== void 0) throw new Error(`Duplicate archetype key [${data.key}]`);
|
|
498
|
+
const archetype = new Archetype(data);
|
|
499
|
+
__privateGet(this, _archetypeIndex)[archetype.key] = archetype;
|
|
480
500
|
return archetype;
|
|
481
501
|
}) ?? [];
|
|
482
|
-
this.maps =
|
|
483
|
-
if (__privateGet
|
|
484
|
-
const map = new GameMap(
|
|
485
|
-
__privateGet
|
|
502
|
+
this.maps = bundle.maps?.map((data) => {
|
|
503
|
+
if (__privateGet(this, _mapIndex)[data.key] !== void 0) throw new Error(`Duplicate map key [${data.key}]`);
|
|
504
|
+
const map = new GameMap(data);
|
|
505
|
+
__privateGet(this, _mapIndex)[map.key] = map;
|
|
486
506
|
return map;
|
|
487
507
|
}) ?? [];
|
|
488
|
-
this.badges =
|
|
489
|
-
if (__privateGet
|
|
490
|
-
const badge = new Badge(
|
|
491
|
-
__privateGet
|
|
508
|
+
this.badges = bundle.badges?.map((data) => {
|
|
509
|
+
if (__privateGet(this, _badgeIndex)[data.key] !== void 0) throw new Error(`Duplicate badge key [${data.key}]`);
|
|
510
|
+
const badge = new Badge(data);
|
|
511
|
+
__privateGet(this, _badgeIndex)[badge.key] = badge;
|
|
492
512
|
return badge;
|
|
493
513
|
}) ?? [];
|
|
494
|
-
this.changelog = data.changelog;
|
|
495
514
|
}
|
|
496
515
|
getArchetype(key) {
|
|
497
|
-
const result = __privateGet
|
|
516
|
+
const result = __privateGet(this, _archetypeIndex)[key];
|
|
498
517
|
if (result === void 0) throw new Error(`Unknown archetype key [${key}]`);
|
|
499
518
|
return result;
|
|
500
519
|
}
|
|
501
520
|
getMap(key) {
|
|
502
|
-
const result = __privateGet
|
|
521
|
+
const result = __privateGet(this, _mapIndex)[key];
|
|
503
522
|
if (result === void 0) throw new Error(`Unknown map key [${key}]`);
|
|
504
523
|
return result;
|
|
505
524
|
}
|
|
506
525
|
getBadge(key) {
|
|
507
|
-
const result = __privateGet
|
|
526
|
+
const result = __privateGet(this, _badgeIndex)[key];
|
|
508
527
|
if (result === void 0) throw new Error(`Unknown badge key [${key}]`);
|
|
509
528
|
return result;
|
|
510
529
|
}
|
|
@@ -513,45 +532,24 @@ _archetypeIndex = new WeakMap();
|
|
|
513
532
|
_mapIndex = new WeakMap();
|
|
514
533
|
_badgeIndex = new WeakMap();
|
|
515
534
|
|
|
516
|
-
var __typeError = (msg) => {
|
|
517
|
-
throw TypeError(msg);
|
|
518
|
-
};
|
|
519
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
520
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
521
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
522
|
-
var _serverGroups;
|
|
523
|
-
class CohContentDatabase {
|
|
524
|
-
constructor() {
|
|
525
|
-
__privateAdd(this, _serverGroups, {});
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Load a server group data package into the database.
|
|
529
|
-
* @param data The data to load.
|
|
530
|
-
*/
|
|
531
|
-
loadServerGroupData(data) {
|
|
532
|
-
__privateGet(this, _serverGroups)[data.key] = new ServerGroup(data);
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Get all the server groups currently loaded in the database.
|
|
536
|
-
*/
|
|
537
|
-
listServerGroups() {
|
|
538
|
-
return Object.values(__privateGet(this, _serverGroups));
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* get a server group by key.
|
|
542
|
-
* @param serverGroupKey The key.
|
|
543
|
-
*/
|
|
544
|
-
getServerGroup(serverGroupKey) {
|
|
545
|
-
return __privateGet(this, _serverGroups)[serverGroupKey];
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
_serverGroups = new WeakMap();
|
|
549
|
-
|
|
550
535
|
const CHANGELOG = [
|
|
551
536
|
{
|
|
552
537
|
version: "2.0.0",
|
|
553
538
|
date: /* @__PURE__ */ new Date("2025-03-12"),
|
|
554
|
-
description:
|
|
539
|
+
description: `* Replaced redundant interfaces with their concrete equivalents.
|
|
540
|
+
* Server groups are now referred to as 'forks'.
|
|
541
|
+
* Replaced enums with extensible union types; Forks with new badge types, enhancement types, etc. can now extend them locally.
|
|
542
|
+
* \`IServerGroupData\` is now \`ContentBundle\` and each database instance is now designed to accept only a single server group.
|
|
543
|
+
* Removed the \`serverGroup\` property from entities to simplify the object tree given that only a single context can exist per db now.
|
|
544
|
+
* Standardized pluralization of some field names (name, icon).
|
|
545
|
+
* Combined \`settitle\` ids into a single tuple field.
|
|
546
|
+
* Change from GNU to The Unlicense.
|
|
547
|
+
* Removed dependency on lodash. There are now no third-party runtime dependencies.
|
|
548
|
+
* Moved from webpack to rollup for packaging.
|
|
549
|
+
* Add eslint for linting.
|
|
550
|
+
* Add jest for unit tests.
|
|
551
|
+
* Added GitHub Actions for CI.
|
|
552
|
+
`
|
|
555
553
|
}
|
|
556
554
|
];
|
|
557
555
|
|
|
@@ -564,5 +562,5 @@ function createMapReference(target) {
|
|
|
564
562
|
return `[map:${key}]`;
|
|
565
563
|
}
|
|
566
564
|
|
|
567
|
-
export { ALIGNMENT, Archetype, BADGE_PARTIAL_TYPE, BADGE_TYPE, Badge, BadgePartial, CHANGELOG, CohContentDatabase, ENHANCEMENT_CATEGORY, GameMap, Key, PLAQUE_TYPE, SEX,
|
|
565
|
+
export { ALIGNMENT, Archetype, BADGE_PARTIAL_TYPE, BADGE_TYPE, Badge, BadgePartial, BundleMetadata, CHANGELOG, CohContentDatabase, ENHANCEMENT_CATEGORY, GameMap, Key, PLAQUE_TYPE, SEX, VidiotMap, VidiotMapPointOfInterest, createBadgeReference, createMapReference };
|
|
568
566
|
//# sourceMappingURL=coh-content-db.mjs.map
|