coh-content-db 2.0.0-rc.4 → 2.0.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -7
- package/dist/coh-content-db.d.ts +353 -185
- package/dist/coh-content-db.js +460 -300
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +448 -294
- package/dist/coh-content-db.mjs.map +1 -1
- package/package.json +1 -4
- package/src/main/api/alternate-data.ts +2 -2
- package/src/main/api/badge-data.ts +21 -19
- package/src/main/api/badge-requirement-data.ts +82 -0
- package/src/main/api/badge-requirement-type.ts +11 -0
- package/src/main/api/change.ts +5 -2
- package/src/main/api/contact-data.ts +46 -0
- package/src/main/api/content-bundle.ts +12 -7
- package/src/main/api/markdown-string.ts +4 -0
- package/src/main/api/zone-data.ts +20 -0
- package/src/main/changelog.ts +7 -2
- package/src/main/db/alignments.ts +17 -0
- package/src/main/db/alternates.ts +8 -14
- package/src/main/db/badge-index.ts +93 -0
- package/src/main/db/badge-requirement.ts +102 -0
- package/src/main/db/badge-search-options.ts +51 -0
- package/src/main/db/badge.ts +55 -48
- package/src/main/db/bundle-metadata.ts +5 -6
- package/src/main/db/coh-content-database.ts +65 -40
- package/src/main/db/contact.ts +59 -0
- package/src/main/db/paged.ts +7 -0
- package/src/main/db/zone.ts +28 -0
- package/src/main/index.ts +15 -11
- package/src/main/util.ts +68 -7
- package/src/test/api/alignments.test.ts +40 -0
- package/src/test/api/badge-data.fixture.ts +9 -7
- package/src/test/api/badge-requirement-data.fixture.ts +17 -0
- package/src/test/api/badge-requirement-type.test.ts +31 -0
- package/src/test/api/contact-data.fixture.ts +13 -0
- package/src/test/api/content-bundle.fixture.ts +2 -2
- package/src/test/api/content-bundle.test.ts +1 -1
- package/src/test/api/zone-data.fixture.ts +8 -0
- package/src/test/db/alternates.test.ts +16 -74
- package/src/test/db/badge-index.test.ts +520 -0
- package/src/test/db/badge-requirement.test.ts +180 -0
- package/src/test/db/badge.test.ts +190 -15
- package/src/test/db/coh-content-database.test.ts +125 -18
- package/src/test/db/contact.test.ts +96 -0
- package/src/test/db/zone.test.ts +36 -0
- package/src/test/index.test.ts +6 -2
- package/src/test/util.test.ts +91 -18
- package/src/main/api/badge-partial-data.ts +0 -65
- package/src/main/api/badge-partial-type.ts +0 -8
- package/src/main/api/game-map-data.ts +0 -26
- package/src/main/api/vidiot-map-data.ts +0 -18
- package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
- package/src/main/db/badge-partial.ts +0 -35
- package/src/main/db/badge-search-document.ts +0 -16
- package/src/main/db/game-map.ts +0 -33
- package/src/main/db/vidiot-map-point-of-interest.ts +0 -40
- package/src/main/db/vidiot-map.ts +0 -25
- package/src/test/api/badge-partial-data.fixture.ts +0 -17
- package/src/test/api/badge-partial-type.test.ts +0 -31
- package/src/test/api/game-map-data.fixture.ts +0 -10
- package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
- package/src/test/api/vidiot-map.fixture.ts +0 -9
- package/src/test/db/badge-search-document.test.ts +0 -35
- package/src/test/db/coh-content-database-search.test.ts +0 -119
package/dist/coh-content-db.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var MiniSearch = require('minisearch');
|
|
4
|
-
|
|
5
3
|
const ALIGNMENT = ["H", "V", "P"];
|
|
6
4
|
|
|
7
|
-
const
|
|
5
|
+
const BADGE_REQUIREMENT_TYPE = [
|
|
8
6
|
"PLAQUE",
|
|
9
7
|
"BADGE",
|
|
10
8
|
"INVENTION",
|
|
9
|
+
"MISSION",
|
|
10
|
+
// Complete a mission
|
|
11
|
+
"ARC",
|
|
12
|
+
// Complete a story arc
|
|
13
|
+
"TASK_FORCE",
|
|
14
|
+
// Complete a task force
|
|
11
15
|
"INVENTION_PLUS_ONE"
|
|
12
16
|
// Some invention badges require you to build x of two different invention levels, 'plus one of either level'.
|
|
13
17
|
];
|
|
@@ -66,115 +70,60 @@ const PLAQUE_TYPE = [
|
|
|
66
70
|
|
|
67
71
|
const SEX = ["M", "F"];
|
|
68
72
|
|
|
69
|
-
var __typeError$3 = (msg) => {
|
|
70
|
-
throw TypeError(msg);
|
|
71
|
-
};
|
|
72
|
-
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
|
73
|
-
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
74
|
-
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);
|
|
75
|
-
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
76
|
-
var __privateMethod$1 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
|
77
|
-
var _value, _Key_instances, validateKey_fn;
|
|
78
|
-
const INVALID_KEY_PATTERN = /[^a-z0-9-]/;
|
|
79
|
-
class Key {
|
|
80
|
-
constructor(value) {
|
|
81
|
-
__privateAdd$3(this, _Key_instances);
|
|
82
|
-
__privateAdd$3(this, _value);
|
|
83
|
-
__privateMethod$1(this, _Key_instances, validateKey_fn).call(this, value);
|
|
84
|
-
__privateSet$2(this, _value, value);
|
|
85
|
-
}
|
|
86
|
-
get value() {
|
|
87
|
-
return __privateGet$3(this, _value);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
_value = new WeakMap();
|
|
91
|
-
_Key_instances = new WeakSet();
|
|
92
|
-
validateKey_fn = function(key) {
|
|
93
|
-
if (INVALID_KEY_PATTERN.test(key)) throw new Error(`Invalid key: [${key}]; Keys can only contain lowercase characters, numbers and dashes.`);
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
var __defProp$8 = Object.defineProperty;
|
|
97
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
98
|
-
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
99
|
-
class Archetype {
|
|
100
|
-
constructor(data) {
|
|
101
|
-
__publicField$8(this, "key");
|
|
102
|
-
__publicField$8(this, "name");
|
|
103
|
-
__publicField$8(this, "description");
|
|
104
|
-
this.key = new Key(data.key).value;
|
|
105
|
-
this.name = data.name;
|
|
106
|
-
this.description = data.description;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
73
|
var __defProp$7 = Object.defineProperty;
|
|
111
74
|
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
112
75
|
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
113
|
-
class
|
|
114
|
-
constructor(
|
|
115
|
-
__publicField$7(this, "
|
|
116
|
-
__publicField$7(this, "
|
|
117
|
-
__publicField$7(this, "
|
|
118
|
-
__publicField$7(this, "
|
|
119
|
-
__publicField$7(this, "
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
__publicField$7(this, "inventionCount");
|
|
126
|
-
__publicField$7(this, "notes");
|
|
127
|
-
this.key = new Key(data.key).value;
|
|
128
|
-
this.type = data.type;
|
|
129
|
-
this.mapKey = data.mapKey;
|
|
130
|
-
this.loc = data.loc;
|
|
131
|
-
this.plaqueType = data.plaqueType;
|
|
132
|
-
this.inscription = data.inscription;
|
|
133
|
-
this.vidiotMapKey = data.vidiotMapKey;
|
|
134
|
-
this.badgeKey = data.badgeKey;
|
|
135
|
-
this.inventionLevel = data.inventionLevel;
|
|
136
|
-
this.inventionTypes = data.inventionTypes;
|
|
137
|
-
this.inventionCount = data.inventionCount;
|
|
138
|
-
this.notes = data.notes;
|
|
76
|
+
class Alignments {
|
|
77
|
+
constructor(raw) {
|
|
78
|
+
__publicField$7(this, "items");
|
|
79
|
+
__publicField$7(this, "hero");
|
|
80
|
+
__publicField$7(this, "villain");
|
|
81
|
+
__publicField$7(this, "praetorian");
|
|
82
|
+
__publicField$7(this, "primal");
|
|
83
|
+
this.items = raw;
|
|
84
|
+
this.hero = raw.includes("H");
|
|
85
|
+
this.villain = raw.includes("V");
|
|
86
|
+
this.praetorian = raw.includes("P");
|
|
87
|
+
this.primal = !this.praetorian && (this.hero || this.villain);
|
|
139
88
|
}
|
|
140
89
|
}
|
|
141
90
|
|
|
142
|
-
var __typeError$
|
|
91
|
+
var __typeError$4 = (msg) => {
|
|
143
92
|
throw TypeError(msg);
|
|
144
93
|
};
|
|
145
|
-
var __accessCheck$
|
|
146
|
-
var __privateGet$
|
|
147
|
-
var __privateAdd$
|
|
148
|
-
var __privateSet$
|
|
149
|
-
var __privateMethod = (obj, member, method) => (__accessCheck$
|
|
94
|
+
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
|
95
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
96
|
+
var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
97
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
|
98
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
|
150
99
|
var _sortedValues, _Alternates_instances, compareAlternates_fn, compareAlignment_fn, compareSex_fn;
|
|
151
100
|
const ALIGNMENT_SORT = { H: 2, V: 1, P: 0 };
|
|
152
101
|
const SEX_SORT = { M: 1, F: 0 };
|
|
153
102
|
class Alternates {
|
|
154
103
|
constructor(values) {
|
|
155
|
-
__privateAdd$
|
|
156
|
-
__privateAdd$
|
|
157
|
-
__privateSet$
|
|
158
|
-
__privateGet$
|
|
104
|
+
__privateAdd$4(this, _Alternates_instances);
|
|
105
|
+
__privateAdd$4(this, _sortedValues, []);
|
|
106
|
+
__privateSet$3(this, _sortedValues, values.sort());
|
|
107
|
+
__privateGet$4(this, _sortedValues).sort((a, b) => __privateMethod$2(this, _Alternates_instances, compareAlternates_fn).call(this, a, b));
|
|
159
108
|
}
|
|
160
109
|
getValue(alignment, sex) {
|
|
161
|
-
for (let index = __privateGet$
|
|
162
|
-
const entry = __privateGet$
|
|
110
|
+
for (let index = __privateGet$4(this, _sortedValues).length; index--; ) {
|
|
111
|
+
const entry = __privateGet$4(this, _sortedValues)[index];
|
|
163
112
|
if ((entry.alignment === void 0 || entry.alignment === alignment) && (entry.sex === void 0 || entry.sex === sex)) return entry.value;
|
|
164
113
|
}
|
|
165
|
-
return this.default;
|
|
114
|
+
return this.default?.value;
|
|
166
115
|
}
|
|
167
116
|
/**
|
|
168
117
|
* Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
|
|
169
118
|
*/
|
|
170
119
|
get default() {
|
|
171
|
-
return __privateGet$
|
|
120
|
+
return __privateGet$4(this, _sortedValues)[0];
|
|
172
121
|
}
|
|
173
122
|
/**
|
|
174
123
|
* Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
|
|
175
124
|
*/
|
|
176
125
|
get canonical() {
|
|
177
|
-
return __privateGet$
|
|
126
|
+
return __privateGet$4(this, _sortedValues);
|
|
178
127
|
}
|
|
179
128
|
/**
|
|
180
129
|
* Create a joined string from the alternate values in canonical order.
|
|
@@ -190,9 +139,9 @@ compareAlternates_fn = function(a, b) {
|
|
|
190
139
|
const aSpecificity = (a.alignment ? 2 : 0) + (a.sex ? 1 : 0);
|
|
191
140
|
const bSpecificity = (b.alignment ? 2 : 0) + (b.sex ? 1 : 0);
|
|
192
141
|
if (aSpecificity !== bSpecificity) return aSpecificity - bSpecificity;
|
|
193
|
-
const alignmentComparison = __privateMethod(this, _Alternates_instances, compareAlignment_fn).call(this, a.alignment, b.alignment);
|
|
142
|
+
const alignmentComparison = __privateMethod$2(this, _Alternates_instances, compareAlignment_fn).call(this, a.alignment, b.alignment);
|
|
194
143
|
if (alignmentComparison !== 0) return alignmentComparison;
|
|
195
|
-
const sexComparison = __privateMethod(this, _Alternates_instances, compareSex_fn).call(this, a.sex, b.sex);
|
|
144
|
+
const sexComparison = __privateMethod$2(this, _Alternates_instances, compareSex_fn).call(this, a.sex, b.sex);
|
|
196
145
|
if (sexComparison !== 0) return sexComparison;
|
|
197
146
|
return String(a.value).localeCompare(String(b.value));
|
|
198
147
|
};
|
|
@@ -202,8 +151,7 @@ compareAlignment_fn = function(a, b) {
|
|
|
202
151
|
if (b === void 0 && a !== void 0) return 1;
|
|
203
152
|
const aSort = a === void 0 ? -1 : ALIGNMENT_SORT[a] ?? -1;
|
|
204
153
|
const bSort = b === void 0 ? -1 : ALIGNMENT_SORT[b] ?? -1;
|
|
205
|
-
|
|
206
|
-
return a?.localeCompare(b ?? "") ?? 0;
|
|
154
|
+
return bSort - aSort;
|
|
207
155
|
};
|
|
208
156
|
compareSex_fn = function(a, b) {
|
|
209
157
|
if (a === b) return 0;
|
|
@@ -211,242 +159,353 @@ compareSex_fn = function(a, b) {
|
|
|
211
159
|
if (b === void 0 && a !== void 0) return 1;
|
|
212
160
|
const aSort = SEX_SORT[a ?? -1] ?? -1;
|
|
213
161
|
const bSort = SEX_SORT[b ?? -1] ?? -1;
|
|
214
|
-
|
|
215
|
-
return a?.localeCompare(b ?? "") ?? 0;
|
|
162
|
+
return bSort - aSort;
|
|
216
163
|
};
|
|
217
164
|
|
|
218
|
-
var
|
|
219
|
-
var __typeError$1 = (msg) => {
|
|
165
|
+
var __typeError$3 = (msg) => {
|
|
220
166
|
throw TypeError(msg);
|
|
221
167
|
};
|
|
168
|
+
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
|
169
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
170
|
+
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);
|
|
171
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
172
|
+
var __privateMethod$1 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
|
|
173
|
+
var _value, _Key_instances, validateKey_fn;
|
|
174
|
+
const INVALID_KEY_PATTERN = /[^a-z0-9-]/;
|
|
175
|
+
class Key {
|
|
176
|
+
constructor(value) {
|
|
177
|
+
__privateAdd$3(this, _Key_instances);
|
|
178
|
+
__privateAdd$3(this, _value);
|
|
179
|
+
__privateMethod$1(this, _Key_instances, validateKey_fn).call(this, value);
|
|
180
|
+
__privateSet$2(this, _value, value);
|
|
181
|
+
}
|
|
182
|
+
get value() {
|
|
183
|
+
return __privateGet$3(this, _value);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
_value = new WeakMap();
|
|
187
|
+
_Key_instances = new WeakSet();
|
|
188
|
+
validateKey_fn = function(key) {
|
|
189
|
+
if (INVALID_KEY_PATTERN.test(key)) throw new Error(`Invalid key: [${key}]; Keys can only contain lowercase characters, numbers and dashes.`);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
var __defProp$6 = Object.defineProperty;
|
|
222
193
|
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
223
194
|
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
224
|
-
|
|
225
|
-
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
226
|
-
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);
|
|
227
|
-
var _partialsIndex;
|
|
228
|
-
class Badge {
|
|
195
|
+
class Archetype {
|
|
229
196
|
constructor(data) {
|
|
230
|
-
__privateAdd$1(this, _partialsIndex, {});
|
|
231
|
-
/**
|
|
232
|
-
* The database key for this badge.
|
|
233
|
-
*/
|
|
234
197
|
__publicField$6(this, "key");
|
|
198
|
+
__publicField$6(this, "name");
|
|
199
|
+
__publicField$6(this, "description");
|
|
200
|
+
this.key = new Key(data.key).value;
|
|
201
|
+
this.name = data.name;
|
|
202
|
+
this.description = data.description;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var __defProp$5 = Object.defineProperty;
|
|
207
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
208
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
209
|
+
class BadgeRequirement {
|
|
210
|
+
constructor(data) {
|
|
235
211
|
/**
|
|
236
|
-
*
|
|
212
|
+
* Key.
|
|
237
213
|
*/
|
|
238
|
-
__publicField$
|
|
214
|
+
__publicField$5(this, "key");
|
|
239
215
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
* May vary by character sex or alignment.
|
|
216
|
+
* Type of requirement.
|
|
243
217
|
*/
|
|
244
|
-
__publicField$
|
|
218
|
+
__publicField$5(this, "type");
|
|
245
219
|
/**
|
|
246
|
-
*
|
|
220
|
+
* Zone the requirement is located in.
|
|
247
221
|
*/
|
|
248
|
-
__publicField$
|
|
222
|
+
__publicField$5(this, "zoneKey");
|
|
249
223
|
/**
|
|
250
|
-
*
|
|
224
|
+
* /loc coordinates.
|
|
251
225
|
*/
|
|
252
|
-
__publicField$
|
|
226
|
+
__publicField$5(this, "loc");
|
|
253
227
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
228
|
+
* Is it a wall plaque or a physical monument?
|
|
257
229
|
*/
|
|
258
|
-
__publicField$
|
|
230
|
+
__publicField$5(this, "plaqueType");
|
|
259
231
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* May vary by character sex or alignment.
|
|
232
|
+
* Plaque inscription.
|
|
263
233
|
*/
|
|
264
|
-
__publicField$
|
|
234
|
+
__publicField$5(this, "plaqueInscription");
|
|
265
235
|
/**
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
236
|
+
* The number or letter the plaque appears as on Vidiot Maps.
|
|
269
237
|
*/
|
|
270
|
-
__publicField$
|
|
238
|
+
__publicField$5(this, "vidiotMapKey");
|
|
271
239
|
/**
|
|
272
|
-
*
|
|
240
|
+
* The key of the badge for this requirement.
|
|
273
241
|
*/
|
|
274
|
-
__publicField$
|
|
242
|
+
__publicField$5(this, "badgeKey");
|
|
275
243
|
/**
|
|
276
|
-
*
|
|
244
|
+
* Mission name.
|
|
277
245
|
*/
|
|
278
|
-
__publicField$
|
|
246
|
+
__publicField$5(this, "missionName");
|
|
279
247
|
/**
|
|
280
|
-
*
|
|
248
|
+
* {@link Contact} key for the story arc.
|
|
281
249
|
*/
|
|
282
|
-
__publicField$
|
|
250
|
+
__publicField$5(this, "contactKey");
|
|
283
251
|
/**
|
|
284
|
-
*
|
|
252
|
+
* Level of the invention required.
|
|
285
253
|
*/
|
|
286
|
-
__publicField$
|
|
254
|
+
__publicField$5(this, "inventionLevel");
|
|
287
255
|
/**
|
|
288
|
-
*
|
|
256
|
+
* The types of enhancements required to be crafted.
|
|
289
257
|
*/
|
|
290
|
-
__publicField$
|
|
258
|
+
__publicField$5(this, "inventionTypes");
|
|
291
259
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
260
|
+
* Number of invention crafts required.
|
|
295
261
|
*/
|
|
296
|
-
__publicField$
|
|
262
|
+
__publicField$5(this, "inventionCount");
|
|
297
263
|
/**
|
|
298
|
-
*
|
|
264
|
+
* Any additional notes.
|
|
299
265
|
*/
|
|
300
|
-
__publicField$
|
|
266
|
+
__publicField$5(this, "notes");
|
|
301
267
|
/**
|
|
302
|
-
*
|
|
268
|
+
* List of external links. Wiki, forums, etc.
|
|
303
269
|
*/
|
|
304
|
-
__publicField$
|
|
270
|
+
__publicField$5(this, "links");
|
|
305
271
|
this.key = new Key(data.key).value;
|
|
306
272
|
this.type = data.type;
|
|
307
|
-
this.
|
|
308
|
-
this.alignment = data.alignment;
|
|
309
|
-
this.badgeText = new Alternates(data.badgeText ?? []);
|
|
310
|
-
this.acquisition = data.acquisition;
|
|
311
|
-
this.icon = new Alternates(data.icon ?? []);
|
|
312
|
-
this.notes = data.notes;
|
|
313
|
-
this.links = data.links;
|
|
314
|
-
this.mapKey = data.mapKey;
|
|
273
|
+
this.zoneKey = data.zoneKey;
|
|
315
274
|
this.loc = data.loc;
|
|
316
|
-
this.
|
|
275
|
+
this.plaqueType = data.plaqueType;
|
|
276
|
+
this.plaqueInscription = data.plaqueInscription;
|
|
317
277
|
this.vidiotMapKey = data.vidiotMapKey;
|
|
318
|
-
this.
|
|
319
|
-
this.
|
|
320
|
-
this.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
getPartial(key) {
|
|
328
|
-
const result = __privateGet$1(this, _partialsIndex)[key];
|
|
329
|
-
if (result === void 0) throw new Error(`Unknown badge partial key [${key}]`);
|
|
330
|
-
return result;
|
|
278
|
+
this.badgeKey = data.badgeKey;
|
|
279
|
+
this.missionName = data.missionName;
|
|
280
|
+
this.contactKey = data.contactKey;
|
|
281
|
+
this.inventionLevel = data.inventionLevel;
|
|
282
|
+
this.inventionTypes = data.inventionTypes;
|
|
283
|
+
this.inventionCount = data.inventionCount;
|
|
284
|
+
this.notes = data.notes;
|
|
285
|
+
this.links = data.links ?? [];
|
|
331
286
|
}
|
|
332
287
|
}
|
|
333
|
-
_partialsIndex = new WeakMap();
|
|
334
288
|
|
|
335
|
-
var __defProp$
|
|
336
|
-
var
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
289
|
+
var __defProp$4 = Object.defineProperty;
|
|
290
|
+
var __typeError$2 = (msg) => {
|
|
291
|
+
throw TypeError(msg);
|
|
292
|
+
};
|
|
293
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
294
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
295
|
+
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
296
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
297
|
+
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);
|
|
298
|
+
var _requirementsIndex;
|
|
299
|
+
class Badge {
|
|
300
|
+
constructor(badgeData) {
|
|
301
|
+
__privateAdd$2(this, _requirementsIndex, {});
|
|
340
302
|
/**
|
|
341
|
-
* The
|
|
342
|
-
*
|
|
343
|
-
* Screen-space, pixels from top-left `[0, 0]`.
|
|
303
|
+
* The database key for this badge.
|
|
344
304
|
*/
|
|
345
|
-
__publicField$
|
|
305
|
+
__publicField$4(this, "key");
|
|
346
306
|
/**
|
|
347
|
-
*
|
|
307
|
+
* The type of badge.
|
|
308
|
+
*/
|
|
309
|
+
__publicField$4(this, "type");
|
|
310
|
+
/**
|
|
311
|
+
* The name of this badge.
|
|
348
312
|
*
|
|
349
|
-
*
|
|
313
|
+
* May vary by character sex or alignment.
|
|
350
314
|
*/
|
|
351
|
-
__publicField$
|
|
315
|
+
__publicField$4(this, "name");
|
|
352
316
|
/**
|
|
353
|
-
*
|
|
317
|
+
* The character alignments that this badge is available to.
|
|
354
318
|
*/
|
|
355
|
-
__publicField$
|
|
319
|
+
__publicField$4(this, "alignment");
|
|
356
320
|
/**
|
|
357
|
-
*
|
|
321
|
+
* The badge text as it appears in-game. May vary by character sex or alignment.
|
|
358
322
|
*/
|
|
359
|
-
__publicField$
|
|
323
|
+
__publicField$4(this, "badgeText");
|
|
360
324
|
/**
|
|
361
|
-
*
|
|
325
|
+
* Short description of how to acquire the badge. Detailed instructions will be in the notes field.
|
|
362
326
|
*/
|
|
363
|
-
__publicField$
|
|
364
|
-
this.pos = data.pos;
|
|
365
|
-
this.notes = data.notes;
|
|
366
|
-
this.mapKey = data.mapKey;
|
|
367
|
-
this.badgeKey = data.badgeKey;
|
|
368
|
-
this.badgePartialKey = data.badgePartialKey;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
var __defProp$4 = Object.defineProperty;
|
|
373
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
374
|
-
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
375
|
-
class VidiotMap {
|
|
376
|
-
constructor(data) {
|
|
327
|
+
__publicField$4(this, "acquisition");
|
|
377
328
|
/**
|
|
378
|
-
* URL
|
|
329
|
+
* Absolute URL to this badge's icon.
|
|
330
|
+
*
|
|
331
|
+
* May vary by character sex or alignment.
|
|
379
332
|
*/
|
|
380
|
-
__publicField$4(this, "
|
|
333
|
+
__publicField$4(this, "icon");
|
|
381
334
|
/**
|
|
382
|
-
*
|
|
335
|
+
* Freeform notes or tips about the badge.
|
|
383
336
|
*/
|
|
384
|
-
__publicField$4(this, "
|
|
337
|
+
__publicField$4(this, "notes");
|
|
385
338
|
/**
|
|
386
|
-
* List of
|
|
339
|
+
* List of external links. Wiki, forums, etc.
|
|
387
340
|
*/
|
|
388
|
-
__publicField$4(this, "
|
|
389
|
-
this.imageUrl = data.imageUrl;
|
|
390
|
-
this.name = data.name;
|
|
391
|
-
this.pointsOfInterest = data.pointsOfInterest?.map((data2) => new VidiotMapPointOfInterest(data2));
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
var __defProp$3 = Object.defineProperty;
|
|
396
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
397
|
-
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
398
|
-
class GameMap {
|
|
399
|
-
constructor(data) {
|
|
341
|
+
__publicField$4(this, "links");
|
|
400
342
|
/**
|
|
401
|
-
*
|
|
343
|
+
* For exploration badges, the key of the {@link Zone} that this badge is found on.
|
|
402
344
|
*/
|
|
403
|
-
__publicField$
|
|
345
|
+
__publicField$4(this, "zoneKey");
|
|
404
346
|
/**
|
|
405
|
-
*
|
|
347
|
+
* For exploration badges, the `/loc` coordinates of the badge.
|
|
406
348
|
*/
|
|
407
|
-
__publicField$
|
|
349
|
+
__publicField$4(this, "loc");
|
|
408
350
|
/**
|
|
409
|
-
*
|
|
351
|
+
* For plaques that appear on a Vidiot Map, the number or letter the badge appears as.
|
|
410
352
|
*/
|
|
411
|
-
__publicField$
|
|
353
|
+
__publicField$4(this, "vidiotMapKey");
|
|
412
354
|
/**
|
|
413
|
-
*
|
|
355
|
+
* ID used with the in-game `/settitle` command to apply the badge.
|
|
414
356
|
*/
|
|
415
|
-
__publicField$
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
this
|
|
357
|
+
__publicField$4(this, "setTitle");
|
|
358
|
+
/**
|
|
359
|
+
* A description of the effect the badge will have, such as a buff or granting a temporary power.
|
|
360
|
+
*/
|
|
361
|
+
__publicField$4(this, "effect");
|
|
362
|
+
/**
|
|
363
|
+
* Represents the layered requirements for badges with multiple fulfillment steps,
|
|
364
|
+
* such as visiting plaques for history badges or collecting other badges.
|
|
365
|
+
*
|
|
366
|
+
* The outer array represents groups of requirements evaluated with OR logic —
|
|
367
|
+
* fulfilling any group satisfies the badge.
|
|
368
|
+
*
|
|
369
|
+
* Each inner array represents individual requirements evaluated with AND logic —
|
|
370
|
+
* all conditions in the group must be met.
|
|
371
|
+
*/
|
|
372
|
+
__publicField$4(this, "requirements");
|
|
373
|
+
/**
|
|
374
|
+
* 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.
|
|
375
|
+
*/
|
|
376
|
+
__publicField$4(this, "ignoreInTotals");
|
|
377
|
+
this.key = new Key(badgeData.key).value;
|
|
378
|
+
this.type = badgeData.type;
|
|
379
|
+
this.name = new Alternates(badgeData.name);
|
|
380
|
+
this.alignment = new Alignments(badgeData.alignment);
|
|
381
|
+
this.badgeText = new Alternates(badgeData.badgeText ?? []);
|
|
382
|
+
this.acquisition = badgeData.acquisition;
|
|
383
|
+
this.icon = new Alternates(badgeData.icon ?? []);
|
|
384
|
+
this.notes = badgeData.notes;
|
|
385
|
+
this.links = badgeData.links ?? [];
|
|
386
|
+
this.zoneKey = badgeData.zoneKey;
|
|
387
|
+
this.loc = badgeData.loc;
|
|
388
|
+
this.effect = badgeData.effect;
|
|
389
|
+
this.vidiotMapKey = badgeData.vidiotMapKey;
|
|
390
|
+
this.setTitle = badgeData.setTitle;
|
|
391
|
+
this.ignoreInTotals = badgeData.ignoreInTotals ?? false;
|
|
392
|
+
this.requirements = badgeData.requirements?.map((groups, index) => {
|
|
393
|
+
const existingKeysInGroup = /* @__PURE__ */ new Set();
|
|
394
|
+
return groups.map((requirementData) => {
|
|
395
|
+
if (existingKeysInGroup.has(requirementData.key)) throw new Error(`Duplicate badge requirement key [${badgeData.key}:${requirementData.key}] in group [${index + 1}]`);
|
|
396
|
+
existingKeysInGroup.add(requirementData.key);
|
|
397
|
+
const badge = new BadgeRequirement(requirementData);
|
|
398
|
+
__privateGet$2(this, _requirementsIndex)[badge.key] = badge;
|
|
399
|
+
return badge;
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
getRequirement(key) {
|
|
404
|
+
const result = __privateGet$2(this, _requirementsIndex)[key];
|
|
405
|
+
if (result === void 0) throw new Error(`Unknown badge requirement key [${key}]`);
|
|
406
|
+
return result;
|
|
420
407
|
}
|
|
421
408
|
}
|
|
409
|
+
_requirementsIndex = new WeakMap();
|
|
422
410
|
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
411
|
+
var __typeError$1 = (msg) => {
|
|
412
|
+
throw TypeError(msg);
|
|
413
|
+
};
|
|
414
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
415
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
416
|
+
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);
|
|
417
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
418
|
+
var __privateMethod = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
419
|
+
var _badges, _badgeIndex$1, _zoneOrder, _BadgeIndex_instances, satisfiesQueryPredicate_fn, satisfiesFilterPredicate_fn, sort_fn;
|
|
420
|
+
class BadgeIndex {
|
|
421
|
+
constructor(badges, zones) {
|
|
422
|
+
__privateAdd$1(this, _BadgeIndex_instances);
|
|
423
|
+
__privateAdd$1(this, _badges, []);
|
|
424
|
+
__privateAdd$1(this, _badgeIndex$1, {});
|
|
425
|
+
__privateAdd$1(this, _zoneOrder, {});
|
|
426
|
+
__privateSet$1(this, _zoneOrder, Object.fromEntries(
|
|
427
|
+
zones?.sort((a, b) => a.name.localeCompare(b.name))?.map((x, index) => [x.key, index]) ?? []
|
|
428
|
+
));
|
|
429
|
+
__privateSet$1(this, _badges, badges);
|
|
430
|
+
for (const badge of badges) {
|
|
431
|
+
if (__privateGet$1(this, _badgeIndex$1)[badge.key] !== void 0) throw new Error(`Duplicate badge key [${badge.key}]`);
|
|
432
|
+
__privateGet$1(this, _badgeIndex$1)[badge.key] = badge;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
getBadge(key) {
|
|
436
|
+
const result = __privateGet$1(this, _badgeIndex$1)[key];
|
|
437
|
+
if (result === void 0) throw new Error(`Unknown badge key [${key}]`);
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
440
|
+
badgeExists(key) {
|
|
441
|
+
return !!__privateGet$1(this, _badgeIndex$1)[key];
|
|
442
|
+
}
|
|
443
|
+
searchBadges(options) {
|
|
444
|
+
const filtered = options?.query || options?.filter ? __privateGet$1(this, _badges).filter((badge) => __privateMethod(this, _BadgeIndex_instances, satisfiesQueryPredicate_fn).call(this, badge, options?.query) && __privateMethod(this, _BadgeIndex_instances, satisfiesFilterPredicate_fn).call(this, badge, options?.filter)) : __privateGet$1(this, _badges);
|
|
445
|
+
const totalPages = options?.pageSize ? Math.ceil(filtered.length / options?.pageSize) : 1;
|
|
446
|
+
const page = Math.max(1, Math.min(totalPages, options?.page ?? 1));
|
|
447
|
+
const paged = options?.pageSize ? filtered.slice((page - 1) * options.pageSize, page * options?.pageSize) : filtered;
|
|
448
|
+
const sorted = __privateMethod(this, _BadgeIndex_instances, sort_fn).call(this, paged, options?.sort);
|
|
449
|
+
return {
|
|
450
|
+
items: sorted,
|
|
451
|
+
page,
|
|
452
|
+
pageSize: options?.pageSize,
|
|
453
|
+
totalItems: filtered.length,
|
|
454
|
+
totalPages
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
_badges = new WeakMap();
|
|
459
|
+
_badgeIndex$1 = new WeakMap();
|
|
460
|
+
_zoneOrder = new WeakMap();
|
|
461
|
+
_BadgeIndex_instances = new WeakSet();
|
|
462
|
+
satisfiesQueryPredicate_fn = function(badge, query) {
|
|
463
|
+
const queryString = query?.str?.toLowerCase() ?? "";
|
|
464
|
+
return !!((query?.on?.name ?? true) && badge.name.canonical.some((x) => x.value.toLowerCase().includes(queryString)) || query?.on?.badgeText && badge.badgeText.canonical.some((x) => x.value.toLowerCase().includes(queryString)) || query?.on?.acquisition && badge.acquisition?.toLowerCase().includes(queryString) || query?.on?.effect && badge.effect?.toLowerCase().includes(queryString) || query?.on?.notes && badge.notes?.toLowerCase().includes(queryString) || query?.on?.setTitle && (badge.setTitle?.id?.toString().includes(queryString) || badge.setTitle?.praetorianId?.toString().includes(queryString)));
|
|
465
|
+
};
|
|
466
|
+
satisfiesFilterPredicate_fn = function(badge, filter) {
|
|
467
|
+
return (!filter?.type || badge.type === filter.type) && (!filter?.zoneKey || badge.zoneKey === filter.zoneKey) && (!filter?.alignment || badge.alignment.items.includes(filter.alignment));
|
|
468
|
+
};
|
|
469
|
+
sort_fn = function(badges, sort) {
|
|
470
|
+
if (!sort) return badges;
|
|
471
|
+
const ascending = sort.dir !== "DESC";
|
|
472
|
+
if (!sort.by || sort.by === "CANONICAL") return sort.dir === "DESC" ? badges.reverse() : badges;
|
|
473
|
+
if (sort.by === "BADGE_NAME") return ascending ? badges.sort((a, b) => a.name.default?.value.localeCompare(b.name.default?.value ?? "") ?? 0) : badges.sort((a, b) => b.name.default?.value.localeCompare(a.name.default?.value ?? "") ?? 0);
|
|
474
|
+
return badges.sort((a, b) => {
|
|
475
|
+
const aIndex = __privateGet$1(this, _zoneOrder)[a.zoneKey ?? ""];
|
|
476
|
+
const bIndex = __privateGet$1(this, _zoneOrder)[b.zoneKey ?? ""];
|
|
477
|
+
if (aIndex === bIndex) return 0;
|
|
478
|
+
if (aIndex === void 0) return ascending ? 1 : -1;
|
|
479
|
+
if (bIndex === void 0) return ascending ? -1 : 1;
|
|
480
|
+
return ascending ? aIndex - bIndex : bIndex - aIndex;
|
|
481
|
+
});
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
var __defProp$3 = Object.defineProperty;
|
|
485
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
486
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
426
487
|
class BundleMetadata {
|
|
427
488
|
constructor(bundle) {
|
|
428
489
|
/**
|
|
429
|
-
* Name of the
|
|
490
|
+
* Name of the content bundle.
|
|
430
491
|
*/
|
|
431
|
-
__publicField$
|
|
492
|
+
__publicField$3(this, "name");
|
|
432
493
|
/**
|
|
433
|
-
* Description of the
|
|
434
|
-
*
|
|
435
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
494
|
+
* Description of the fork.
|
|
436
495
|
*/
|
|
437
|
-
__publicField$
|
|
496
|
+
__publicField$3(this, "description");
|
|
438
497
|
/**
|
|
439
498
|
* Repository where the db content package is maintained.
|
|
440
499
|
*/
|
|
441
|
-
__publicField$
|
|
500
|
+
__publicField$3(this, "repository");
|
|
442
501
|
/**
|
|
443
|
-
* List of external links
|
|
502
|
+
* List of external links. Wiki, forums, etc.
|
|
444
503
|
*/
|
|
445
|
-
__publicField$
|
|
504
|
+
__publicField$3(this, "links");
|
|
446
505
|
/**
|
|
447
506
|
* Change log for this data package.
|
|
448
507
|
*/
|
|
449
|
-
__publicField$
|
|
508
|
+
__publicField$3(this, "changelog");
|
|
450
509
|
this.name = bundle.name;
|
|
451
510
|
this.description = bundle.description;
|
|
452
511
|
this.repository = bundle.repository;
|
|
@@ -455,20 +514,78 @@ class BundleMetadata {
|
|
|
455
514
|
}
|
|
456
515
|
}
|
|
457
516
|
|
|
517
|
+
var __defProp$2 = Object.defineProperty;
|
|
518
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
519
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
520
|
+
class Zone {
|
|
521
|
+
constructor(data) {
|
|
522
|
+
/**
|
|
523
|
+
* Unique key used to reference this zone.
|
|
524
|
+
*
|
|
525
|
+
* Keys can only contain lowercase letters, numbers and hyphens (`-`).
|
|
526
|
+
*/
|
|
527
|
+
__publicField$2(this, "key");
|
|
528
|
+
/**
|
|
529
|
+
* The name of the zone as it appears in-game.
|
|
530
|
+
*/
|
|
531
|
+
__publicField$2(this, "name");
|
|
532
|
+
/**
|
|
533
|
+
* List of external links. Wiki, forums, etc.
|
|
534
|
+
*/
|
|
535
|
+
__publicField$2(this, "links");
|
|
536
|
+
this.key = new Key(data.key).value;
|
|
537
|
+
this.name = data.name;
|
|
538
|
+
this.links = data.links ?? [];
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
458
542
|
var __defProp$1 = Object.defineProperty;
|
|
459
543
|
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
460
544
|
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
461
|
-
class
|
|
462
|
-
constructor(
|
|
463
|
-
|
|
545
|
+
class Contact {
|
|
546
|
+
constructor(contactData) {
|
|
547
|
+
/**
|
|
548
|
+
* Unique key used to reference this contact.
|
|
549
|
+
*
|
|
550
|
+
* Keys can only contain lowercase letters, numbers and hyphens (`-`).
|
|
551
|
+
*/
|
|
464
552
|
__publicField$1(this, "key");
|
|
553
|
+
/**
|
|
554
|
+
* The name of this contact.
|
|
555
|
+
*/
|
|
465
556
|
__publicField$1(this, "name");
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
this
|
|
470
|
-
|
|
471
|
-
|
|
557
|
+
/**
|
|
558
|
+
* The contact's title.
|
|
559
|
+
*/
|
|
560
|
+
__publicField$1(this, "title");
|
|
561
|
+
/**
|
|
562
|
+
* The zone this character is located in.
|
|
563
|
+
*/
|
|
564
|
+
__publicField$1(this, "zoneKey");
|
|
565
|
+
/**
|
|
566
|
+
* The `/loc` coordinates of the contact.
|
|
567
|
+
*/
|
|
568
|
+
__publicField$1(this, "loc");
|
|
569
|
+
/**
|
|
570
|
+
* The level range this contact will offer missions for.
|
|
571
|
+
*/
|
|
572
|
+
__publicField$1(this, "levelRange");
|
|
573
|
+
/**
|
|
574
|
+
* Freeform notes or tips about the contact.
|
|
575
|
+
*/
|
|
576
|
+
__publicField$1(this, "notes");
|
|
577
|
+
/**
|
|
578
|
+
* List of external links. Wiki, forums, etc.
|
|
579
|
+
*/
|
|
580
|
+
__publicField$1(this, "links");
|
|
581
|
+
this.key = new Key(contactData.key).value;
|
|
582
|
+
this.name = contactData.name;
|
|
583
|
+
this.title = contactData.title;
|
|
584
|
+
this.zoneKey = contactData.zoneKey;
|
|
585
|
+
this.loc = contactData.loc;
|
|
586
|
+
this.levelRange = contactData.levelRange;
|
|
587
|
+
this.notes = contactData.notes;
|
|
588
|
+
this.links = contactData.links ?? [];
|
|
472
589
|
}
|
|
473
590
|
}
|
|
474
591
|
|
|
@@ -482,7 +599,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
482
599
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
483
600
|
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);
|
|
484
601
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
485
|
-
var _archetypeIndex,
|
|
602
|
+
var _archetypeIndex, _zoneIndex, _contactIndex, _badgeIndex;
|
|
486
603
|
class CohContentDatabase {
|
|
487
604
|
/**
|
|
488
605
|
* Initialize the database with a content bundle.
|
|
@@ -490,83 +607,99 @@ class CohContentDatabase {
|
|
|
490
607
|
*/
|
|
491
608
|
constructor(bundle) {
|
|
492
609
|
__privateAdd(this, _archetypeIndex, {});
|
|
493
|
-
__privateAdd(this,
|
|
494
|
-
__privateAdd(this,
|
|
495
|
-
__privateAdd(this,
|
|
610
|
+
__privateAdd(this, _zoneIndex, {});
|
|
611
|
+
__privateAdd(this, _contactIndex, {});
|
|
612
|
+
__privateAdd(this, _badgeIndex);
|
|
496
613
|
/**
|
|
497
614
|
* Metadata about the content bundle.
|
|
498
615
|
*/
|
|
499
616
|
__publicField(this, "metadata");
|
|
500
617
|
/**
|
|
501
|
-
* List of the game server names
|
|
618
|
+
* List of the game server names.
|
|
619
|
+
*
|
|
502
620
|
* Torchbearer, Excelsior, etc.
|
|
503
621
|
*/
|
|
504
622
|
__publicField(this, "servers");
|
|
505
623
|
/**
|
|
506
|
-
* List of archetypes
|
|
624
|
+
* List of archetypes.
|
|
507
625
|
*/
|
|
508
626
|
__publicField(this, "archetypes");
|
|
509
627
|
/**
|
|
510
|
-
* List of game
|
|
628
|
+
* List of game zones.
|
|
629
|
+
*/
|
|
630
|
+
__publicField(this, "zones");
|
|
631
|
+
/**
|
|
632
|
+
* List of contacts.
|
|
511
633
|
*/
|
|
512
|
-
__publicField(this, "
|
|
634
|
+
__publicField(this, "contacts");
|
|
513
635
|
/**
|
|
514
|
-
* List of badges
|
|
636
|
+
* List of badges.
|
|
515
637
|
*/
|
|
516
638
|
__publicField(this, "badges");
|
|
517
639
|
this.metadata = new BundleMetadata(bundle);
|
|
518
640
|
this.servers = bundle.servers ?? [];
|
|
519
641
|
this.archetypes = bundle.archetypes?.map((data) => {
|
|
520
|
-
if (__privateGet(this, _archetypeIndex)[data.key] !== void 0) throw new Error(`Duplicate archetype key
|
|
642
|
+
if (__privateGet(this, _archetypeIndex)[data.key] !== void 0) throw new Error(`Duplicate archetype key '${data.key}'`);
|
|
521
643
|
const archetype = new Archetype(data);
|
|
522
644
|
__privateGet(this, _archetypeIndex)[archetype.key] = archetype;
|
|
523
645
|
return archetype;
|
|
524
646
|
}) ?? [];
|
|
525
|
-
this.
|
|
526
|
-
if (__privateGet(this,
|
|
527
|
-
const
|
|
528
|
-
__privateGet(this,
|
|
529
|
-
return
|
|
647
|
+
this.zones = bundle.zones?.map((data) => {
|
|
648
|
+
if (__privateGet(this, _zoneIndex)[data.key] !== void 0) throw new Error(`Duplicate zone key '${data.key}'`);
|
|
649
|
+
const zone = new Zone(data);
|
|
650
|
+
__privateGet(this, _zoneIndex)[zone.key] = zone;
|
|
651
|
+
return zone;
|
|
530
652
|
}) ?? [];
|
|
531
|
-
this.
|
|
532
|
-
if (__privateGet(this,
|
|
533
|
-
const
|
|
534
|
-
__privateGet(this,
|
|
535
|
-
return
|
|
653
|
+
this.contacts = bundle.contacts?.map((data) => {
|
|
654
|
+
if (__privateGet(this, _contactIndex)[data.key] !== void 0) throw new Error(`Duplicate contact key '${data.key}'`);
|
|
655
|
+
const contact = new Contact(data);
|
|
656
|
+
__privateGet(this, _contactIndex)[contact.key] = contact;
|
|
657
|
+
return contact;
|
|
536
658
|
}) ?? [];
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
storeFields: ["key"]
|
|
540
|
-
}));
|
|
541
|
-
for (const badge of this.badges) {
|
|
542
|
-
__privateGet(this, _badgeSearch).add(new BadgeSearchDocument(badge));
|
|
543
|
-
}
|
|
659
|
+
this.badges = bundle.badges?.map((data) => new Badge(data)) ?? [];
|
|
660
|
+
__privateSet(this, _badgeIndex, new BadgeIndex(this.badges, this.zones));
|
|
544
661
|
}
|
|
545
662
|
getArchetype(key) {
|
|
546
663
|
const result = __privateGet(this, _archetypeIndex)[key];
|
|
547
|
-
if (result === void 0) throw new Error(`Unknown archetype key
|
|
664
|
+
if (result === void 0) throw new Error(`Unknown archetype key '${key}'`);
|
|
548
665
|
return result;
|
|
549
666
|
}
|
|
550
|
-
|
|
551
|
-
const result = __privateGet(this,
|
|
552
|
-
if (result === void 0) throw new Error(`Unknown
|
|
667
|
+
getZone(key) {
|
|
668
|
+
const result = __privateGet(this, _zoneIndex)[key];
|
|
669
|
+
if (result === void 0) throw new Error(`Unknown zone key '${key}'`);
|
|
553
670
|
return result;
|
|
554
671
|
}
|
|
555
|
-
|
|
556
|
-
const result = __privateGet(this,
|
|
557
|
-
if (result === void 0) throw new Error(`Unknown
|
|
672
|
+
getContact(key) {
|
|
673
|
+
const result = __privateGet(this, _contactIndex)[key];
|
|
674
|
+
if (result === void 0) throw new Error(`Unknown contact key '${key}'`);
|
|
558
675
|
return result;
|
|
559
676
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
677
|
+
zoneExists(key) {
|
|
678
|
+
return !!__privateGet(this, _zoneIndex)[key];
|
|
679
|
+
}
|
|
680
|
+
contactExists(key) {
|
|
681
|
+
return !!__privateGet(this, _contactIndex)[key];
|
|
682
|
+
}
|
|
683
|
+
getBadge(key) {
|
|
684
|
+
return __privateGet(this, _badgeIndex).getBadge(key);
|
|
685
|
+
}
|
|
686
|
+
badgeExists(key) {
|
|
687
|
+
return __privateGet(this, _badgeIndex).badgeExists(key);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Search, sort and filter the badge list.
|
|
691
|
+
* This is a fairly brute-forced approach and will not be as performant as loading the badge data into a traditional
|
|
692
|
+
* database engine, but is sufficient for most operations.
|
|
693
|
+
* @param options {@link BadgeSearchOptions}
|
|
694
|
+
*/
|
|
695
|
+
searchBadges(options) {
|
|
696
|
+
return __privateGet(this, _badgeIndex).searchBadges(options);
|
|
564
697
|
}
|
|
565
698
|
}
|
|
566
699
|
_archetypeIndex = new WeakMap();
|
|
567
|
-
|
|
700
|
+
_zoneIndex = new WeakMap();
|
|
701
|
+
_contactIndex = new WeakMap();
|
|
568
702
|
_badgeIndex = new WeakMap();
|
|
569
|
-
_badgeSearch = new WeakMap();
|
|
570
703
|
|
|
571
704
|
const CHANGELOG = [
|
|
572
705
|
{
|
|
@@ -574,14 +707,19 @@ const CHANGELOG = [
|
|
|
574
707
|
date: /* @__PURE__ */ new Date("2025-03-12"),
|
|
575
708
|
description: `* Replaced redundant interfaces with their concrete equivalents.
|
|
576
709
|
* Server groups are now referred to as 'forks'.
|
|
577
|
-
* Replaced enums with
|
|
710
|
+
* Replaced enums with union types.
|
|
578
711
|
* \`IServerGroupData\` is now \`ContentBundle\` and each database instance is now designed to accept only a single server group.
|
|
712
|
+
* \`GameMap\` is now \`Zone\`.
|
|
579
713
|
* Removed the \`serverGroup\` property from entities to simplify the object tree given that only a single context can exist per db now.
|
|
580
714
|
* Added a simple indexing and search function for badge names, text and acquisition info.
|
|
715
|
+
* Zone and badge references now follow a standard Markdown link format with a \`badge://\` or \`map://\` protocol.
|
|
716
|
+
* Badge partials are now known as badge requirements and support both AND and OR groups of requirements.
|
|
717
|
+
* Removed the \`VidiotMap\` API as it was never used or fleshed out properly.
|
|
718
|
+
* Added support for story arcs to badge requirements including a link to the contact.
|
|
581
719
|
* Standardized pluralization of some field names (name, icon).
|
|
582
720
|
* Combined \`settitle\` ids into a single tuple field.
|
|
583
721
|
* Change from GNU to The Unlicense.
|
|
584
|
-
* Removed
|
|
722
|
+
* Removed all third-party dependencies.
|
|
585
723
|
* Moved from webpack to rollup for packaging.
|
|
586
724
|
* Add eslint for linting.
|
|
587
725
|
* Add jest for unit tests.
|
|
@@ -590,31 +728,53 @@ const CHANGELOG = [
|
|
|
590
728
|
}
|
|
591
729
|
];
|
|
592
730
|
|
|
593
|
-
function
|
|
731
|
+
function badgeUri(target) {
|
|
732
|
+
const key = typeof target === "string" ? target : target.key;
|
|
733
|
+
return `badge://${key}`;
|
|
734
|
+
}
|
|
735
|
+
function badgeLink(target) {
|
|
736
|
+
const key = typeof target === "string" ? target : target.key;
|
|
737
|
+
return `[${key}](${badgeUri(target)})`;
|
|
738
|
+
}
|
|
739
|
+
function contactUri(target) {
|
|
740
|
+
const key = typeof target === "string" ? target : target.key;
|
|
741
|
+
return `contact://${key}`;
|
|
742
|
+
}
|
|
743
|
+
function contactLink(target) {
|
|
744
|
+
const key = typeof target === "string" ? target : target.key;
|
|
745
|
+
return `[${key}](${contactUri(target)})`;
|
|
746
|
+
}
|
|
747
|
+
function zoneUri(target) {
|
|
594
748
|
const key = typeof target === "string" ? target : target.key;
|
|
595
|
-
return `
|
|
749
|
+
return `zone://${key}`;
|
|
596
750
|
}
|
|
597
|
-
function
|
|
751
|
+
function zoneLink(target) {
|
|
598
752
|
const key = typeof target === "string" ? target : target.key;
|
|
599
|
-
return `[
|
|
753
|
+
return `[${key}](${zoneUri(target)})`;
|
|
600
754
|
}
|
|
601
755
|
|
|
602
756
|
exports.ALIGNMENT = ALIGNMENT;
|
|
757
|
+
exports.Alignments = Alignments;
|
|
758
|
+
exports.Alternates = Alternates;
|
|
603
759
|
exports.Archetype = Archetype;
|
|
604
|
-
exports.
|
|
760
|
+
exports.BADGE_REQUIREMENT_TYPE = BADGE_REQUIREMENT_TYPE;
|
|
605
761
|
exports.BADGE_TYPE = BADGE_TYPE;
|
|
606
762
|
exports.Badge = Badge;
|
|
607
|
-
exports.
|
|
763
|
+
exports.BadgeIndex = BadgeIndex;
|
|
764
|
+
exports.BadgeRequirement = BadgeRequirement;
|
|
608
765
|
exports.BundleMetadata = BundleMetadata;
|
|
609
766
|
exports.CHANGELOG = CHANGELOG;
|
|
610
767
|
exports.CohContentDatabase = CohContentDatabase;
|
|
768
|
+
exports.Contact = Contact;
|
|
611
769
|
exports.ENHANCEMENT_CATEGORY = ENHANCEMENT_CATEGORY;
|
|
612
|
-
exports.GameMap = GameMap;
|
|
613
770
|
exports.Key = Key;
|
|
614
771
|
exports.PLAQUE_TYPE = PLAQUE_TYPE;
|
|
615
772
|
exports.SEX = SEX;
|
|
616
|
-
exports.
|
|
617
|
-
exports.
|
|
618
|
-
exports.
|
|
619
|
-
exports.
|
|
773
|
+
exports.Zone = Zone;
|
|
774
|
+
exports.badgeLink = badgeLink;
|
|
775
|
+
exports.badgeUri = badgeUri;
|
|
776
|
+
exports.contactLink = contactLink;
|
|
777
|
+
exports.contactUri = contactUri;
|
|
778
|
+
exports.zoneLink = zoneLink;
|
|
779
|
+
exports.zoneUri = zoneUri;
|
|
620
780
|
//# sourceMappingURL=coh-content-db.js.map
|