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