coh-content-db 2.0.0-rc.1 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +10 -11
- package/.github/workflows/build.yml +1 -1
- package/.github/workflows/pull-request.yml +1 -1
- package/.github/workflows/release.yml +2 -2
- package/CHANGELOG.md +42 -0
- package/README.md +52 -24
- package/dist/coh-content-db.d.ts +683 -279
- package/dist/coh-content-db.js +834 -377
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +809 -368
- package/dist/coh-content-db.mjs.map +1 -1
- package/eslint.config.mjs +1 -0
- package/package.json +1 -1
- package/src/main/api/alignment.ts +18 -2
- package/src/main/api/alternate-data.ts +2 -2
- package/src/main/api/badge-data.ts +20 -48
- package/src/main/api/badge-requirement-data.ts +64 -0
- package/src/main/api/badge-requirement-type.ts +32 -0
- package/src/main/api/badge-type.ts +15 -15
- package/src/main/api/bundle-data.ts +47 -0
- package/src/main/api/bundle-header-data.ts +37 -0
- package/src/main/api/contact-data.ts +48 -0
- package/src/main/api/enhancement-category.ts +26 -26
- package/src/main/api/location-data.ts +28 -0
- package/src/main/api/markdown-string.ts +4 -0
- package/src/main/api/mission-data.ts +83 -0
- package/src/main/api/mission-type.ts +2 -0
- package/src/main/api/morality.ts +31 -0
- package/src/main/api/sex.ts +8 -1
- package/src/main/api/zone-data.ts +20 -0
- package/src/main/db/abstract-index.ts +37 -0
- package/src/main/db/alignment-list.ts +54 -0
- package/src/main/db/alternates.ts +28 -42
- package/src/main/db/badge-index.ts +57 -0
- package/src/main/db/badge-requirement.ts +81 -0
- package/src/main/db/badge-search-options.ts +51 -0
- package/src/main/db/badge.ts +77 -71
- package/src/main/db/bundle-header.ts +44 -0
- package/src/main/db/coh-content-database.ts +123 -14
- package/src/main/db/contact.ts +62 -0
- package/src/main/db/location.ts +30 -0
- package/src/main/db/mission.ts +107 -0
- package/src/main/db/morality-list.ts +99 -0
- package/src/main/db/paged.ts +7 -0
- package/src/main/db/zone.ts +28 -0
- package/src/main/index.ts +23 -15
- package/src/main/util.ts +108 -7
- package/src/test/api/alignment.test.ts +38 -4
- package/src/test/api/badge-data.fixture.ts +1 -15
- package/src/test/api/badge-data.test.ts +4 -4
- package/src/test/api/badge-requirement-data.fixture.ts +7 -0
- package/src/test/api/badge-requirement-type.test.ts +31 -0
- package/src/test/api/badge-type.test.ts +5 -5
- package/src/test/api/bundle-data.fixture.ts +6 -0
- package/src/test/api/bundle-header-data.fixture.ts +6 -0
- package/src/test/api/contact-data.fixture.ts +7 -0
- package/src/test/api/enhancement-category.test.ts +5 -5
- package/src/test/api/mission-data.fixture.ts +12 -0
- package/src/test/api/sex.test.ts +33 -1
- package/src/test/api/zone-data.fixture.ts +8 -0
- package/src/test/db/abstract-index.test.ts +55 -0
- package/src/test/db/alignment-list.test.ts +200 -0
- package/src/test/db/alternates.test.ts +82 -117
- package/src/test/db/badge-index.test.ts +519 -0
- package/src/test/db/badge-requirement.test.ts +145 -0
- package/src/test/db/badge.test.ts +310 -14
- package/src/test/db/bundle-header.test.ts +76 -0
- package/src/test/db/coh-content-database.test.ts +264 -24
- package/src/test/db/contact.test.ts +97 -0
- package/src/test/db/location.test.ts +51 -0
- package/src/test/db/mission.test.ts +171 -0
- package/src/test/db/morality-list.test.ts +457 -0
- package/src/test/db/zone.test.ts +36 -0
- package/src/test/integration.test.ts +16 -0
- package/src/test/util.test.ts +144 -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/change.ts +0 -14
- package/src/main/api/game-map-data.ts +0 -26
- package/src/main/api/plaque-type.ts +0 -6
- package/src/main/api/server-group-data.ts +0 -65
- 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/changelog.ts +0 -20
- package/src/main/db/badge-partial.ts +0 -35
- package/src/main/db/game-map.ts +0 -33
- package/src/main/db/server-group.ts +0 -112
- 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/plaque-type.test.ts +0 -31
- package/src/test/api/server-group-data.fixture.ts +0 -23
- package/src/test/api/server-group-data.test.ts +0 -15
- 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/changelog.test.ts +0 -36
- package/src/test/db/server-group.test.ts +0 -124
- package/src/test/index.test.ts +0 -10
package/dist/coh-content-db.mjs
CHANGED
|
@@ -1,74 +1,230 @@
|
|
|
1
|
-
const ALIGNMENT = ["
|
|
1
|
+
const ALIGNMENT = ["hero", "villain", "praetorian"];
|
|
2
|
+
const ALIGNMENT_ORDER = Object.fromEntries(ALIGNMENT.map((x, index) => [x, index]));
|
|
3
|
+
function compareAlignment(a, b) {
|
|
4
|
+
const orderA = a ? ALIGNMENT_ORDER[a] : -1;
|
|
5
|
+
const orderB = b ? ALIGNMENT_ORDER[b] : -1;
|
|
6
|
+
return orderA - orderB;
|
|
7
|
+
}
|
|
2
8
|
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
+
const BADGE_REQUIREMENT_TYPE = [
|
|
10
|
+
/**
|
|
11
|
+
* Collect a badge.
|
|
12
|
+
*/
|
|
13
|
+
"badge",
|
|
14
|
+
/**
|
|
15
|
+
* Craft an invention.
|
|
16
|
+
*/
|
|
17
|
+
"invention",
|
|
18
|
+
/**
|
|
19
|
+
* Some invention badges require you to build x of two different invention levels, 'plus one of either level'.
|
|
20
|
+
*/
|
|
21
|
+
"invention-plus-one",
|
|
22
|
+
/**
|
|
23
|
+
* Visit a location.
|
|
24
|
+
*/
|
|
25
|
+
"location",
|
|
26
|
+
/**
|
|
27
|
+
* Click on a monument.
|
|
28
|
+
*/
|
|
29
|
+
"monument",
|
|
30
|
+
/**
|
|
31
|
+
* Complete a mission.
|
|
32
|
+
*/
|
|
33
|
+
"mission",
|
|
34
|
+
/**
|
|
35
|
+
* Complete an arbitrary task.
|
|
36
|
+
*/
|
|
37
|
+
"task"
|
|
9
38
|
];
|
|
10
39
|
|
|
11
40
|
const BADGE_TYPE = [
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
41
|
+
"exploration",
|
|
42
|
+
"history",
|
|
43
|
+
"accomplishment",
|
|
44
|
+
"achievement",
|
|
45
|
+
"accolade",
|
|
46
|
+
"gladiator",
|
|
47
|
+
"veteran",
|
|
48
|
+
"pvp",
|
|
49
|
+
"invention",
|
|
50
|
+
"defeat",
|
|
51
|
+
"event",
|
|
52
|
+
"ouroboros",
|
|
53
|
+
"consignment",
|
|
54
|
+
"day-job",
|
|
55
|
+
"architect-entertainment"
|
|
27
56
|
];
|
|
28
57
|
|
|
29
58
|
const ENHANCEMENT_CATEGORY = [
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
59
|
+
"defense-debuff",
|
|
60
|
+
"to-hit-debuff",
|
|
61
|
+
"taunt",
|
|
62
|
+
"confuse",
|
|
63
|
+
"healing",
|
|
64
|
+
"defense-buff",
|
|
65
|
+
"resist-damage",
|
|
66
|
+
"intangibility",
|
|
67
|
+
"sleep",
|
|
68
|
+
"slow",
|
|
69
|
+
"hold",
|
|
70
|
+
"stun",
|
|
71
|
+
"immobilize",
|
|
72
|
+
"fear",
|
|
73
|
+
"endurance-modification",
|
|
74
|
+
"endurance-reduction",
|
|
75
|
+
"recharge-reduction",
|
|
76
|
+
"interrupt-duration",
|
|
77
|
+
"accuracy",
|
|
78
|
+
"to-hit-buff",
|
|
79
|
+
"damage",
|
|
80
|
+
"knockback",
|
|
81
|
+
"run-speed",
|
|
82
|
+
"jump",
|
|
83
|
+
"fly-speed",
|
|
84
|
+
"range"
|
|
56
85
|
];
|
|
57
86
|
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
];
|
|
87
|
+
const MISSION_TYPE = ["story-arc", "mission", "task-force", "strike-force", "trial", "personal-story"];
|
|
88
|
+
|
|
89
|
+
const MORALITY = ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist"];
|
|
62
90
|
|
|
63
91
|
const SEX = ["M", "F"];
|
|
92
|
+
const SEX_ORDER = Object.fromEntries(SEX.map((x, index) => [x, index]));
|
|
93
|
+
function compareSex(a, b) {
|
|
94
|
+
const orderA = a ? SEX_ORDER[a] : -1;
|
|
95
|
+
const orderB = b ? SEX_ORDER[b] : -1;
|
|
96
|
+
return orderA - orderB;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var __defProp$a = Object.defineProperty;
|
|
100
|
+
var __typeError$6 = (msg) => {
|
|
101
|
+
throw TypeError(msg);
|
|
102
|
+
};
|
|
103
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
104
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
105
|
+
var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
|
|
106
|
+
var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
107
|
+
var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
108
|
+
var __privateSet$4 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
|
|
109
|
+
var _items$1;
|
|
110
|
+
class AlignmentList {
|
|
111
|
+
constructor(items) {
|
|
112
|
+
__privateAdd$6(this, _items$1);
|
|
113
|
+
__publicField$a(this, "hero");
|
|
114
|
+
__publicField$a(this, "villain");
|
|
115
|
+
__publicField$a(this, "praetorian");
|
|
116
|
+
__publicField$a(this, "primal");
|
|
117
|
+
__publicField$a(this, "all");
|
|
118
|
+
const set = new Set(items ?? [...ALIGNMENT]);
|
|
119
|
+
this.hero = set.has("hero") || set.has("primal") || set.has("all");
|
|
120
|
+
this.villain = set.has("villain") || set.has("primal") || set.has("all");
|
|
121
|
+
this.praetorian = set.has("praetorian") || set.has("all");
|
|
122
|
+
this.primal = this.hero && this.villain;
|
|
123
|
+
this.all = this.hero && this.villain && this.praetorian;
|
|
124
|
+
__privateSet$4(this, _items$1, /* @__PURE__ */ new Set());
|
|
125
|
+
if (this.hero) __privateGet$5(this, _items$1).add("hero");
|
|
126
|
+
if (this.villain) __privateGet$5(this, _items$1).add("villain");
|
|
127
|
+
if (this.praetorian) __privateGet$5(this, _items$1).add("praetorian");
|
|
128
|
+
}
|
|
129
|
+
get items() {
|
|
130
|
+
return [...__privateGet$5(this, _items$1)];
|
|
131
|
+
}
|
|
132
|
+
has(alignment) {
|
|
133
|
+
switch (alignment) {
|
|
134
|
+
case "hero": {
|
|
135
|
+
return this.hero;
|
|
136
|
+
}
|
|
137
|
+
case "villain": {
|
|
138
|
+
return this.villain;
|
|
139
|
+
}
|
|
140
|
+
case "praetorian": {
|
|
141
|
+
return this.praetorian;
|
|
142
|
+
}
|
|
143
|
+
case "primal": {
|
|
144
|
+
return this.primal;
|
|
145
|
+
}
|
|
146
|
+
case "all": {
|
|
147
|
+
return this.all;
|
|
148
|
+
}
|
|
149
|
+
default: {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
_items$1 = new WeakMap();
|
|
156
|
+
|
|
157
|
+
var __typeError$5 = (msg) => {
|
|
158
|
+
throw TypeError(msg);
|
|
159
|
+
};
|
|
160
|
+
var __accessCheck$5 = (obj, member, msg) => member.has(obj) || __typeError$5("Cannot " + msg);
|
|
161
|
+
var __privateGet$4 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
162
|
+
var __privateAdd$5 = (obj, member, value) => member.has(obj) ? __typeError$5("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
163
|
+
var __privateSet$3 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
|
|
164
|
+
var __privateMethod$2 = (obj, member, method) => (__accessCheck$5(obj, member, "access private method"), method);
|
|
165
|
+
var _sortedValues, _Alternates_instances, compareAlternates_fn;
|
|
166
|
+
class Alternates {
|
|
167
|
+
/**
|
|
168
|
+
* Create an alternate set from either a list of categorized values, or a single value when there are no alternates.
|
|
169
|
+
* @param value List of alternates, or a single value.
|
|
170
|
+
*/
|
|
171
|
+
constructor(value) {
|
|
172
|
+
__privateAdd$5(this, _Alternates_instances);
|
|
173
|
+
__privateAdd$5(this, _sortedValues, []);
|
|
174
|
+
if (Array.isArray(value)) {
|
|
175
|
+
__privateSet$3(this, _sortedValues, value.sort());
|
|
176
|
+
__privateGet$4(this, _sortedValues).sort((a, b) => __privateMethod$2(this, _Alternates_instances, compareAlternates_fn).call(this, a, b));
|
|
177
|
+
} else {
|
|
178
|
+
__privateSet$3(this, _sortedValues, [{ value }]);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
getValue(alignment, sex) {
|
|
182
|
+
for (let index = __privateGet$4(this, _sortedValues).length; index--; ) {
|
|
183
|
+
const entry = __privateGet$4(this, _sortedValues)[index];
|
|
184
|
+
if ((entry.alignment === void 0 || entry.alignment === alignment) && (entry.sex === void 0 || entry.sex === sex)) return entry.value;
|
|
185
|
+
}
|
|
186
|
+
return this.default?.value;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
|
|
190
|
+
*/
|
|
191
|
+
get default() {
|
|
192
|
+
return __privateGet$4(this, _sortedValues)[0];
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
|
|
196
|
+
*/
|
|
197
|
+
get canonical() {
|
|
198
|
+
return __privateGet$4(this, _sortedValues);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Create a joined string from the alternate values in canonical order.
|
|
202
|
+
* @param separator Separator to use. Default is ' / '
|
|
203
|
+
*/
|
|
204
|
+
toString(separator) {
|
|
205
|
+
return this.canonical.map((x) => x.value).join(separator);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
_sortedValues = new WeakMap();
|
|
209
|
+
_Alternates_instances = new WeakSet();
|
|
210
|
+
compareAlternates_fn = function(a, b) {
|
|
211
|
+
const aSpecificity = (a.alignment ? 2 : 0) + (a.sex ? 1 : 0);
|
|
212
|
+
const bSpecificity = (b.alignment ? 2 : 0) + (b.sex ? 1 : 0);
|
|
213
|
+
if (aSpecificity !== bSpecificity) return aSpecificity - bSpecificity;
|
|
214
|
+
const alignmentComparison = compareAlignment(a.alignment, b.alignment);
|
|
215
|
+
if (alignmentComparison !== 0) return alignmentComparison;
|
|
216
|
+
const sexComparison = compareSex(a.sex, b.sex);
|
|
217
|
+
if (sexComparison !== 0) return sexComparison;
|
|
218
|
+
return String(a.value).localeCompare(String(b.value));
|
|
219
|
+
};
|
|
64
220
|
|
|
65
221
|
var __typeError$4 = (msg) => {
|
|
66
222
|
throw TypeError(msg);
|
|
67
223
|
};
|
|
68
224
|
var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
|
|
69
|
-
var __privateGet$
|
|
225
|
+
var __privateGet$3 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
70
226
|
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);
|
|
71
|
-
var __privateSet$
|
|
227
|
+
var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
|
|
72
228
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
|
|
73
229
|
var _value, _Key_instances, validateKey_fn;
|
|
74
230
|
const INVALID_KEY_PATTERN = /[^a-z0-9-]/;
|
|
@@ -77,10 +233,10 @@ class Key {
|
|
|
77
233
|
__privateAdd$4(this, _Key_instances);
|
|
78
234
|
__privateAdd$4(this, _value);
|
|
79
235
|
__privateMethod$1(this, _Key_instances, validateKey_fn).call(this, value);
|
|
80
|
-
__privateSet$
|
|
236
|
+
__privateSet$2(this, _value, value);
|
|
81
237
|
}
|
|
82
238
|
get value() {
|
|
83
|
-
return __privateGet$
|
|
239
|
+
return __privateGet$3(this, _value);
|
|
84
240
|
}
|
|
85
241
|
}
|
|
86
242
|
_value = new WeakMap();
|
|
@@ -89,429 +245,611 @@ validateKey_fn = function(key) {
|
|
|
89
245
|
if (INVALID_KEY_PATTERN.test(key)) throw new Error(`Invalid key: [${key}]; Keys can only contain lowercase characters, numbers and dashes.`);
|
|
90
246
|
};
|
|
91
247
|
|
|
92
|
-
var __defProp$
|
|
93
|
-
var __defNormalProp$
|
|
94
|
-
var __publicField$
|
|
248
|
+
var __defProp$9 = Object.defineProperty;
|
|
249
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
250
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
95
251
|
class Archetype {
|
|
96
252
|
constructor(data) {
|
|
97
|
-
__publicField$
|
|
98
|
-
__publicField$
|
|
99
|
-
__publicField$
|
|
253
|
+
__publicField$9(this, "key");
|
|
254
|
+
__publicField$9(this, "name");
|
|
255
|
+
__publicField$9(this, "description");
|
|
100
256
|
this.key = new Key(data.key).value;
|
|
101
257
|
this.name = data.name;
|
|
102
258
|
this.description = data.description;
|
|
103
259
|
}
|
|
104
260
|
}
|
|
105
261
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
262
|
+
function badgeUri(target) {
|
|
263
|
+
const key = typeof target === "string" ? target : target.key;
|
|
264
|
+
return `badge://${key}`;
|
|
265
|
+
}
|
|
266
|
+
function badgeLink(target) {
|
|
267
|
+
const key = typeof target === "string" ? target : target.key;
|
|
268
|
+
return `[${key}](${badgeUri(target)})`;
|
|
269
|
+
}
|
|
270
|
+
function contactUri(target) {
|
|
271
|
+
const key = typeof target === "string" ? target : target.key;
|
|
272
|
+
return `contact://${key}`;
|
|
273
|
+
}
|
|
274
|
+
function contactLink(target) {
|
|
275
|
+
const key = typeof target === "string" ? target : target.key;
|
|
276
|
+
return `[${key}](${contactUri(target)})`;
|
|
277
|
+
}
|
|
278
|
+
function missionUri(target) {
|
|
279
|
+
const key = typeof target === "string" ? target : target.key;
|
|
280
|
+
return `mission://${key}`;
|
|
281
|
+
}
|
|
282
|
+
function missionLink(target) {
|
|
283
|
+
const key = typeof target === "string" ? target : target.key;
|
|
284
|
+
return `[${key}](${missionUri(target)})`;
|
|
285
|
+
}
|
|
286
|
+
function zoneUri(target) {
|
|
287
|
+
const key = typeof target === "string" ? target : target.key;
|
|
288
|
+
return `zone://${key}`;
|
|
289
|
+
}
|
|
290
|
+
function zoneLink(target) {
|
|
291
|
+
const key = typeof target === "string" ? target : target.key;
|
|
292
|
+
return `[${key}](${zoneUri(target)})`;
|
|
293
|
+
}
|
|
294
|
+
function coalesceToArray(value) {
|
|
295
|
+
if (!value) return void 0;
|
|
296
|
+
return Array.isArray(value) ? value : [value];
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
var __defProp$8 = Object.defineProperty;
|
|
300
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
301
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
302
|
+
class BadgeRequirement {
|
|
110
303
|
constructor(data) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
__publicField$
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
__publicField$
|
|
121
|
-
|
|
122
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Unique key used to reference this badge requirement.
|
|
306
|
+
*
|
|
307
|
+
* Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
|
|
308
|
+
*/
|
|
309
|
+
__publicField$8(this, "key");
|
|
310
|
+
/**
|
|
311
|
+
* The requirement type.
|
|
312
|
+
*/
|
|
313
|
+
__publicField$8(this, "type");
|
|
314
|
+
/**
|
|
315
|
+
* If the requirement involves a location, where it is.
|
|
316
|
+
*/
|
|
317
|
+
__publicField$8(this, "location");
|
|
318
|
+
/**
|
|
319
|
+
* If the requirement involves a badge, the badge key.
|
|
320
|
+
*/
|
|
321
|
+
__publicField$8(this, "badgeKey");
|
|
322
|
+
/**
|
|
323
|
+
* If the requirement involves a mission, the mission key.
|
|
324
|
+
*/
|
|
325
|
+
__publicField$8(this, "missionKey");
|
|
326
|
+
/**
|
|
327
|
+
* If the requirement involves a monument, the text that is displayed thereon.
|
|
328
|
+
*/
|
|
329
|
+
__publicField$8(this, "monumentText");
|
|
330
|
+
/**
|
|
331
|
+
* If the requirement involves crafting an invention, the Level of the invention required.
|
|
332
|
+
*/
|
|
333
|
+
__publicField$8(this, "inventionLevel");
|
|
334
|
+
/**
|
|
335
|
+
* If the requirement involves crafting an invention, the types of enhancements that will qualify.
|
|
336
|
+
*/
|
|
337
|
+
__publicField$8(this, "inventionTypes");
|
|
338
|
+
/**
|
|
339
|
+
* Number of times the task needs to be repeated.
|
|
340
|
+
*/
|
|
341
|
+
__publicField$8(this, "count");
|
|
342
|
+
/**
|
|
343
|
+
* Additional information about the requirement.
|
|
344
|
+
*/
|
|
345
|
+
__publicField$8(this, "notes");
|
|
346
|
+
/**
|
|
347
|
+
* List of external links. Wiki, forums, etc.
|
|
348
|
+
*/
|
|
349
|
+
__publicField$8(this, "links");
|
|
123
350
|
this.key = new Key(data.key).value;
|
|
124
351
|
this.type = data.type;
|
|
125
|
-
this.
|
|
126
|
-
this.loc = data.loc;
|
|
127
|
-
this.plaqueType = data.plaqueType;
|
|
128
|
-
this.inscription = data.inscription;
|
|
129
|
-
this.vidiotMapKey = data.vidiotMapKey;
|
|
352
|
+
this.location = coalesceToArray(data.location);
|
|
130
353
|
this.badgeKey = data.badgeKey;
|
|
354
|
+
this.missionKey = data.missionKey;
|
|
355
|
+
this.monumentText = data.monumentText;
|
|
131
356
|
this.inventionLevel = data.inventionLevel;
|
|
132
357
|
this.inventionTypes = data.inventionTypes;
|
|
133
|
-
this.
|
|
358
|
+
this.count = data.count;
|
|
134
359
|
this.notes = data.notes;
|
|
360
|
+
this.links = data.links ?? [];
|
|
135
361
|
}
|
|
136
362
|
}
|
|
137
363
|
|
|
364
|
+
var __defProp$7 = Object.defineProperty;
|
|
138
365
|
var __typeError$3 = (msg) => {
|
|
139
366
|
throw TypeError(msg);
|
|
140
367
|
};
|
|
368
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
369
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
141
370
|
var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
|
|
142
|
-
var __privateGet$
|
|
371
|
+
var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
143
372
|
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);
|
|
144
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
145
|
-
var
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
373
|
+
var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
|
|
374
|
+
var _items;
|
|
375
|
+
class MoralityList {
|
|
376
|
+
constructor(items) {
|
|
377
|
+
__privateAdd$3(this, _items);
|
|
378
|
+
__publicField$7(this, "hero");
|
|
379
|
+
__publicField$7(this, "vigilante");
|
|
380
|
+
__publicField$7(this, "villain");
|
|
381
|
+
__publicField$7(this, "rogue");
|
|
382
|
+
__publicField$7(this, "resistance");
|
|
383
|
+
__publicField$7(this, "loyalist");
|
|
384
|
+
__publicField$7(this, "primal");
|
|
385
|
+
__publicField$7(this, "praetorian");
|
|
386
|
+
__publicField$7(this, "heroic");
|
|
387
|
+
__publicField$7(this, "villainous");
|
|
388
|
+
__publicField$7(this, "paragonCityAccess");
|
|
389
|
+
__publicField$7(this, "rogueIslesAccess");
|
|
390
|
+
__publicField$7(this, "all");
|
|
391
|
+
const set = new Set(items ?? [...MORALITY]);
|
|
392
|
+
this.hero = set.has("hero") || set.has("primal") || set.has("heroic") || set.has("paragon-city-access") || set.has("all");
|
|
393
|
+
this.vigilante = set.has("vigilante") || set.has("primal") || set.has("heroic") || set.has("paragon-city-access") || set.has("rogue-isles-access") || set.has("all");
|
|
394
|
+
this.villain = set.has("villain") || set.has("primal") || set.has("villainous") || set.has("rogue-isles-access") || set.has("all");
|
|
395
|
+
this.rogue = set.has("rogue") || set.has("primal") || set.has("villainous") || set.has("paragon-city-access") || set.has("rogue-isles-access") || set.has("all");
|
|
396
|
+
this.resistance = set.has("resistance") || set.has("praetorian") || set.has("all");
|
|
397
|
+
this.loyalist = set.has("loyalist") || set.has("praetorian") || set.has("all");
|
|
398
|
+
this.primal = this.hero && this.vigilante && this.villain && this.rogue;
|
|
399
|
+
this.praetorian = this.loyalist && this.resistance;
|
|
400
|
+
this.heroic = this.hero && this.vigilante;
|
|
401
|
+
this.villainous = this.villain && this.rogue;
|
|
402
|
+
this.paragonCityAccess = this.heroic && this.rogue;
|
|
403
|
+
this.rogueIslesAccess = this.villainous && this.vigilante;
|
|
404
|
+
this.all = this.primal && this.praetorian;
|
|
405
|
+
__privateSet$1(this, _items, /* @__PURE__ */ new Set());
|
|
406
|
+
if (this.hero) __privateGet$2(this, _items).add("hero");
|
|
407
|
+
if (this.vigilante) __privateGet$2(this, _items).add("vigilante");
|
|
408
|
+
if (this.villain) __privateGet$2(this, _items).add("villain");
|
|
409
|
+
if (this.rogue) __privateGet$2(this, _items).add("rogue");
|
|
410
|
+
if (this.resistance) __privateGet$2(this, _items).add("resistance");
|
|
411
|
+
if (this.loyalist) __privateGet$2(this, _items).add("loyalist");
|
|
162
412
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
*/
|
|
166
|
-
get default() {
|
|
167
|
-
return __privateGet$3(this, _sortedValues)[0]?.value;
|
|
413
|
+
get items() {
|
|
414
|
+
return [...__privateGet$2(this, _items)];
|
|
168
415
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
416
|
+
has(morality) {
|
|
417
|
+
switch (morality) {
|
|
418
|
+
case "hero": {
|
|
419
|
+
return this.hero;
|
|
420
|
+
}
|
|
421
|
+
case "vigilante": {
|
|
422
|
+
return this.vigilante;
|
|
423
|
+
}
|
|
424
|
+
case "villain": {
|
|
425
|
+
return this.villain;
|
|
426
|
+
}
|
|
427
|
+
case "rogue": {
|
|
428
|
+
return this.rogue;
|
|
429
|
+
}
|
|
430
|
+
case "resistance": {
|
|
431
|
+
return this.resistance;
|
|
432
|
+
}
|
|
433
|
+
case "loyalist": {
|
|
434
|
+
return this.loyalist;
|
|
435
|
+
}
|
|
436
|
+
case "primal": {
|
|
437
|
+
return this.primal;
|
|
438
|
+
}
|
|
439
|
+
case "praetorian": {
|
|
440
|
+
return this.praetorian;
|
|
441
|
+
}
|
|
442
|
+
case "heroic": {
|
|
443
|
+
return this.hero;
|
|
444
|
+
}
|
|
445
|
+
case "paragon-city-access": {
|
|
446
|
+
return this.paragonCityAccess;
|
|
447
|
+
}
|
|
448
|
+
case "rogue-isles-access": {
|
|
449
|
+
return this.rogueIslesAccess;
|
|
450
|
+
}
|
|
451
|
+
case "villainous": {
|
|
452
|
+
return this.villainous;
|
|
453
|
+
}
|
|
454
|
+
case "all": {
|
|
455
|
+
return this.all;
|
|
456
|
+
}
|
|
457
|
+
default: {
|
|
458
|
+
return false;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
174
461
|
}
|
|
175
462
|
}
|
|
176
|
-
|
|
177
|
-
_Alternates_instances = new WeakSet();
|
|
178
|
-
compareAlternates_fn = function(a, b) {
|
|
179
|
-
const aSpecificity = (a.alignment ? 2 : 0) + (a.sex ? 1 : 0);
|
|
180
|
-
const bSpecificity = (b.alignment ? 2 : 0) + (b.sex ? 1 : 0);
|
|
181
|
-
if (aSpecificity !== bSpecificity) return aSpecificity - bSpecificity;
|
|
182
|
-
const alignmentComparison = __privateMethod(this, _Alternates_instances, compareAlignment_fn).call(this, a.alignment, b.alignment);
|
|
183
|
-
if (alignmentComparison !== 0) return alignmentComparison;
|
|
184
|
-
const sexComparison = __privateMethod(this, _Alternates_instances, compareSex_fn).call(this, a.sex, b.sex);
|
|
185
|
-
if (sexComparison !== 0) return sexComparison;
|
|
186
|
-
return String(a.value).localeCompare(String(b.value));
|
|
187
|
-
};
|
|
188
|
-
compareAlignment_fn = function(a, b) {
|
|
189
|
-
if (a === b) return 0;
|
|
190
|
-
if (a === void 0 && b !== void 0) return -1;
|
|
191
|
-
if (b === void 0 && a !== void 0) return 1;
|
|
192
|
-
const aSort = a === void 0 ? -1 : ALIGNMENT_SORT[a] ?? -1;
|
|
193
|
-
const bSort = b === void 0 ? -1 : ALIGNMENT_SORT[b] ?? -1;
|
|
194
|
-
if (aSort !== bSort) return bSort - aSort;
|
|
195
|
-
return a?.localeCompare(b ?? "") ?? 0;
|
|
196
|
-
};
|
|
197
|
-
compareSex_fn = function(a, b) {
|
|
198
|
-
if (a === b) return 0;
|
|
199
|
-
if (a === void 0 && b !== void 0) return -1;
|
|
200
|
-
if (b === void 0 && a !== void 0) return 1;
|
|
201
|
-
const aSort = SEX_SORT[a ?? -1] ?? -1;
|
|
202
|
-
const bSort = SEX_SORT[b ?? -1] ?? -1;
|
|
203
|
-
if (aSort !== bSort) return bSort - aSort;
|
|
204
|
-
return a?.localeCompare(b ?? "") ?? 0;
|
|
205
|
-
};
|
|
463
|
+
_items = new WeakMap();
|
|
206
464
|
|
|
207
|
-
var __defProp$
|
|
465
|
+
var __defProp$6 = Object.defineProperty;
|
|
208
466
|
var __typeError$2 = (msg) => {
|
|
209
467
|
throw TypeError(msg);
|
|
210
468
|
};
|
|
211
|
-
var __defNormalProp$
|
|
212
|
-
var __publicField$
|
|
469
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
470
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
213
471
|
var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
|
|
214
|
-
var __privateGet$
|
|
472
|
+
var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
215
473
|
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);
|
|
216
|
-
var
|
|
474
|
+
var _requirementsIndex, _zoneKeys;
|
|
217
475
|
class Badge {
|
|
218
|
-
constructor(
|
|
219
|
-
__privateAdd$2(this,
|
|
476
|
+
constructor(badgeData) {
|
|
477
|
+
__privateAdd$2(this, _requirementsIndex, {});
|
|
478
|
+
__privateAdd$2(this, _zoneKeys, /* @__PURE__ */ new Set());
|
|
220
479
|
/**
|
|
221
480
|
* The database key for this badge.
|
|
222
481
|
*/
|
|
223
|
-
__publicField$
|
|
482
|
+
__publicField$6(this, "key");
|
|
224
483
|
/**
|
|
225
484
|
* The type of badge.
|
|
226
485
|
*/
|
|
227
|
-
__publicField$
|
|
486
|
+
__publicField$6(this, "type");
|
|
228
487
|
/**
|
|
229
488
|
* The name of this badge.
|
|
230
489
|
*
|
|
231
490
|
* May vary by character sex or alignment.
|
|
232
491
|
*/
|
|
233
|
-
__publicField$
|
|
492
|
+
__publicField$6(this, "name");
|
|
234
493
|
/**
|
|
235
|
-
* The character
|
|
494
|
+
* The character moralities that this badge is available to.
|
|
236
495
|
*/
|
|
237
|
-
__publicField$
|
|
496
|
+
__publicField$6(this, "morality");
|
|
238
497
|
/**
|
|
239
498
|
* The badge text as it appears in-game. May vary by character sex or alignment.
|
|
240
499
|
*/
|
|
241
|
-
__publicField$
|
|
500
|
+
__publicField$6(this, "badgeText");
|
|
242
501
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
502
|
+
* Short description of how to acquire the badge. Detailed instructions will be in the notes field.
|
|
246
503
|
*/
|
|
247
|
-
__publicField$
|
|
504
|
+
__publicField$6(this, "acquisition");
|
|
248
505
|
/**
|
|
249
506
|
* Absolute URL to this badge's icon.
|
|
250
507
|
*
|
|
251
508
|
* May vary by character sex or alignment.
|
|
252
509
|
*/
|
|
253
|
-
__publicField$
|
|
510
|
+
__publicField$6(this, "icon");
|
|
254
511
|
/**
|
|
255
512
|
* Freeform notes or tips about the badge.
|
|
256
|
-
*
|
|
257
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
258
|
-
*/
|
|
259
|
-
__publicField$4(this, "notes");
|
|
260
|
-
/**
|
|
261
|
-
* List of external links for this Badge. Wiki, forums, etc.
|
|
262
513
|
*/
|
|
263
|
-
__publicField$
|
|
264
|
-
/**
|
|
265
|
-
* For exploration badges, the key of the {@link GameMap} that this badge is found on.
|
|
266
|
-
*/
|
|
267
|
-
__publicField$4(this, "mapKey");
|
|
268
|
-
/**
|
|
269
|
-
* For exploration badges, the `/loc` coordinates of the badge on the in-game map.
|
|
270
|
-
*/
|
|
271
|
-
__publicField$4(this, "loc");
|
|
514
|
+
__publicField$6(this, "notes");
|
|
272
515
|
/**
|
|
273
|
-
*
|
|
516
|
+
* List of external links. Wiki, forums, etc.
|
|
274
517
|
*/
|
|
275
|
-
__publicField$
|
|
518
|
+
__publicField$6(this, "links");
|
|
276
519
|
/**
|
|
277
|
-
*
|
|
520
|
+
* The id used with the in-game `/settitle` command to apply the badge.
|
|
521
|
+
* The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
|
|
278
522
|
*/
|
|
279
|
-
__publicField$
|
|
523
|
+
__publicField$6(this, "setTitleId");
|
|
280
524
|
/**
|
|
281
525
|
* A description of the effect the badge will have, such as a buff or granting a temporary power.
|
|
282
|
-
*
|
|
283
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
284
526
|
*/
|
|
285
|
-
__publicField$
|
|
527
|
+
__publicField$6(this, "effect");
|
|
286
528
|
/**
|
|
287
|
-
*
|
|
529
|
+
* Represents the requirements for badges with multiple fulfillment steps, such as visiting monuments for history badges, completing missions, or collecting other badges.
|
|
288
530
|
*/
|
|
289
|
-
__publicField$
|
|
531
|
+
__publicField$6(this, "requirements");
|
|
290
532
|
/**
|
|
291
533
|
* Some badges are not included in the badge total count... such as Flames of Prometheus, which can be removed by redeeming it for a Notice of the Well.
|
|
292
534
|
*/
|
|
293
|
-
__publicField$
|
|
294
|
-
this.key = new Key(
|
|
295
|
-
this.type =
|
|
296
|
-
this.name = new Alternates(
|
|
297
|
-
this.
|
|
298
|
-
this.badgeText = new Alternates(
|
|
299
|
-
this.acquisition =
|
|
300
|
-
this.icon = new Alternates(
|
|
301
|
-
this.notes =
|
|
302
|
-
this.links =
|
|
303
|
-
this.
|
|
304
|
-
this.
|
|
305
|
-
this.
|
|
306
|
-
this.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return
|
|
535
|
+
__publicField$6(this, "ignoreInTotals");
|
|
536
|
+
this.key = new Key(badgeData.key).value;
|
|
537
|
+
this.type = badgeData.type;
|
|
538
|
+
this.name = new Alternates(badgeData.name);
|
|
539
|
+
this.morality = new MoralityList(coalesceToArray(badgeData.morality));
|
|
540
|
+
this.badgeText = new Alternates(badgeData.badgeText ?? []);
|
|
541
|
+
this.acquisition = badgeData.acquisition;
|
|
542
|
+
this.icon = new Alternates(badgeData.icon ?? []);
|
|
543
|
+
this.notes = badgeData.notes;
|
|
544
|
+
this.links = badgeData.links ?? [];
|
|
545
|
+
this.effect = badgeData.effect;
|
|
546
|
+
this.setTitleId = badgeData.setTitleId;
|
|
547
|
+
this.ignoreInTotals = badgeData.ignoreInTotals ?? false;
|
|
548
|
+
this.requirements = badgeData.requirements?.map((requirementData) => {
|
|
549
|
+
if (__privateGet$1(this, _requirementsIndex)[requirementData.key]) throw new Error(`Duplicate badge requirement key [${badgeData.key}:${requirementData.key}]`);
|
|
550
|
+
const requirement = new BadgeRequirement(requirementData);
|
|
551
|
+
__privateGet$1(this, _requirementsIndex)[requirement.key] = requirement;
|
|
552
|
+
if (requirement.location) for (const location of requirement.location) {
|
|
553
|
+
if (location.zoneKey) __privateGet$1(this, _zoneKeys).add(location.zoneKey);
|
|
554
|
+
}
|
|
555
|
+
return requirement;
|
|
314
556
|
});
|
|
315
557
|
}
|
|
316
|
-
|
|
317
|
-
const result = __privateGet$
|
|
318
|
-
if (result === void 0) throw new Error(`Unknown badge
|
|
558
|
+
getRequirement(key) {
|
|
559
|
+
const result = __privateGet$1(this, _requirementsIndex)[key];
|
|
560
|
+
if (result === void 0) throw new Error(`Unknown badge requirement key [${key}]`);
|
|
319
561
|
return result;
|
|
320
562
|
}
|
|
563
|
+
/**
|
|
564
|
+
* Return a list of all the zone keys referenced by this badge.
|
|
565
|
+
*/
|
|
566
|
+
get zoneKeys() {
|
|
567
|
+
return [...__privateGet$1(this, _zoneKeys)];
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* The zone key if this badge relates to a single zone.
|
|
571
|
+
*/
|
|
572
|
+
get zoneKey() {
|
|
573
|
+
return __privateGet$1(this, _zoneKeys).size === 1 ? __privateGet$1(this, _zoneKeys).values().next().value : void 0;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
_requirementsIndex = new WeakMap();
|
|
577
|
+
_zoneKeys = new WeakMap();
|
|
578
|
+
function compareByDefaultName(a, b) {
|
|
579
|
+
const aName = a?.name.default?.value;
|
|
580
|
+
const bName = b?.name.default?.value;
|
|
581
|
+
if (!aName && !bName) return 0;
|
|
582
|
+
if (!aName) return 1;
|
|
583
|
+
if (!bName) return -1;
|
|
584
|
+
return aName.localeCompare(bName);
|
|
585
|
+
}
|
|
586
|
+
function compareByZoneKey(a, b) {
|
|
587
|
+
const aZone = a?.zoneKey;
|
|
588
|
+
const bZone = b?.zoneKey;
|
|
589
|
+
if (!aZone && !bZone) return 0;
|
|
590
|
+
if (!aZone) return 1;
|
|
591
|
+
if (!bZone) return -1;
|
|
592
|
+
return aZone.localeCompare(bZone);
|
|
321
593
|
}
|
|
322
|
-
_partialsIndex = new WeakMap();
|
|
323
594
|
|
|
324
|
-
var __defProp$
|
|
325
|
-
var __defNormalProp$
|
|
326
|
-
var __publicField$
|
|
327
|
-
class
|
|
595
|
+
var __defProp$5 = Object.defineProperty;
|
|
596
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
597
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
598
|
+
class AbstractIndex {
|
|
599
|
+
/**
|
|
600
|
+
* Create a new index.
|
|
601
|
+
* @param keyField The field of the values that will act as the key.
|
|
602
|
+
* @param values Values to index.
|
|
603
|
+
*/
|
|
604
|
+
constructor(keyField, values) {
|
|
605
|
+
__publicField$5(this, "_values", []);
|
|
606
|
+
__publicField$5(this, "_hashTable", {});
|
|
607
|
+
this._values = values ?? [];
|
|
608
|
+
this._hashTable = {};
|
|
609
|
+
for (const value of this.values) {
|
|
610
|
+
const key = value[keyField];
|
|
611
|
+
if (this._hashTable[key] !== void 0) throw new Error(`Duplicate key [${key}]`);
|
|
612
|
+
this._hashTable[key] = value;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Return all indexed values
|
|
617
|
+
*/
|
|
618
|
+
get values() {
|
|
619
|
+
return this._values;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Get a value from the index
|
|
623
|
+
* @param key Key string
|
|
624
|
+
*/
|
|
625
|
+
get(key) {
|
|
626
|
+
if (!key) return void 0;
|
|
627
|
+
return this._hashTable[key];
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
var __typeError$1 = (msg) => {
|
|
632
|
+
throw TypeError(msg);
|
|
633
|
+
};
|
|
634
|
+
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
635
|
+
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);
|
|
636
|
+
var __privateMethod = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
637
|
+
var _BadgeIndex_instances, satisfiesQueryPredicate_fn, satisfiesFilterPredicate_fn, sort_fn;
|
|
638
|
+
class BadgeIndex extends AbstractIndex {
|
|
639
|
+
constructor(values) {
|
|
640
|
+
super("key", values);
|
|
641
|
+
__privateAdd$1(this, _BadgeIndex_instances);
|
|
642
|
+
}
|
|
643
|
+
search(options) {
|
|
644
|
+
const filtered = options?.query || options?.filter ? this._values.filter((badge) => __privateMethod(this, _BadgeIndex_instances, satisfiesQueryPredicate_fn).call(this, badge, options?.query) && __privateMethod(this, _BadgeIndex_instances, satisfiesFilterPredicate_fn).call(this, badge, options?.filter)) : this._values;
|
|
645
|
+
const totalPages = options?.pageSize ? Math.ceil(filtered.length / options?.pageSize) : 1;
|
|
646
|
+
const page = Math.max(1, Math.min(totalPages, options?.page ?? 1));
|
|
647
|
+
const paged = options?.pageSize ? filtered.slice((page - 1) * options.pageSize, page * options?.pageSize) : filtered;
|
|
648
|
+
const sorted = __privateMethod(this, _BadgeIndex_instances, sort_fn).call(this, paged, options?.sort);
|
|
649
|
+
return {
|
|
650
|
+
items: sorted,
|
|
651
|
+
page,
|
|
652
|
+
pageSize: options?.pageSize,
|
|
653
|
+
totalItems: filtered.length,
|
|
654
|
+
totalPages
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
_BadgeIndex_instances = new WeakSet();
|
|
659
|
+
satisfiesQueryPredicate_fn = function(badge, query) {
|
|
660
|
+
const queryString = query?.str?.toLowerCase() ?? "";
|
|
661
|
+
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.setTitleId?.some((x) => x?.toString().includes(queryString)));
|
|
662
|
+
};
|
|
663
|
+
satisfiesFilterPredicate_fn = function(badge, filter) {
|
|
664
|
+
return (!filter?.type || badge.type === filter.type) && (!filter?.zoneKey || badge.zoneKey === filter.zoneKey) && (!filter?.morality || badge.morality.has(filter.morality));
|
|
665
|
+
};
|
|
666
|
+
sort_fn = function(badges, sort) {
|
|
667
|
+
if (!sort) return badges;
|
|
668
|
+
const ascending = sort.dir !== "desc";
|
|
669
|
+
if (sort.by === "badge-name") return badges.sort((a, b) => ascending ? compareByDefaultName(a, b) : compareByDefaultName(b, a));
|
|
670
|
+
if (sort.by === "zone-key") return badges.sort((a, b) => ascending ? compareByZoneKey(a, b) : compareByZoneKey(b, a));
|
|
671
|
+
return sort.dir === "desc" ? badges.reverse() : badges;
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
var __defProp$4 = Object.defineProperty;
|
|
675
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
676
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
677
|
+
class BundleHeader {
|
|
328
678
|
constructor(data) {
|
|
329
679
|
/**
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
* Screen-space, pixels from top-left `[0, 0]`.
|
|
680
|
+
* Name of the content bundle.
|
|
333
681
|
*/
|
|
334
|
-
__publicField$
|
|
682
|
+
__publicField$4(this, "name");
|
|
335
683
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* Supports {@link https://www.markdownguide.org/|Markdown} format.
|
|
684
|
+
* Description of the fork.
|
|
339
685
|
*/
|
|
340
|
-
__publicField$
|
|
686
|
+
__publicField$4(this, "description");
|
|
341
687
|
/**
|
|
342
|
-
*
|
|
688
|
+
* Url for the repository where the bundle is maintained.
|
|
343
689
|
*/
|
|
344
|
-
__publicField$
|
|
690
|
+
__publicField$4(this, "repositoryUrl");
|
|
345
691
|
/**
|
|
346
|
-
*
|
|
692
|
+
* Url for the location of the changelog.
|
|
347
693
|
*/
|
|
348
|
-
__publicField$
|
|
694
|
+
__publicField$4(this, "changelogUrl");
|
|
349
695
|
/**
|
|
350
|
-
*
|
|
696
|
+
* List of external links. Wiki, forums, etc.
|
|
351
697
|
*/
|
|
352
|
-
__publicField$
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
this
|
|
357
|
-
this.
|
|
698
|
+
__publicField$4(this, "links");
|
|
699
|
+
/**
|
|
700
|
+
* The current version of the data package.
|
|
701
|
+
*/
|
|
702
|
+
__publicField$4(this, "version");
|
|
703
|
+
this.name = data?.name;
|
|
704
|
+
this.description = data?.description;
|
|
705
|
+
this.repositoryUrl = data?.repositoryUrl;
|
|
706
|
+
this.changelogUrl = data?.changelogUrl;
|
|
707
|
+
this.links = data?.links ?? [];
|
|
708
|
+
this.version = data?.version;
|
|
358
709
|
}
|
|
359
710
|
}
|
|
360
711
|
|
|
361
|
-
var __defProp$
|
|
362
|
-
var __defNormalProp$
|
|
363
|
-
var __publicField$
|
|
364
|
-
class
|
|
712
|
+
var __defProp$3 = Object.defineProperty;
|
|
713
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
714
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
715
|
+
class Zone {
|
|
365
716
|
constructor(data) {
|
|
366
717
|
/**
|
|
367
|
-
*
|
|
718
|
+
* Unique key used to reference this zone.
|
|
719
|
+
*
|
|
720
|
+
* Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
|
|
368
721
|
*/
|
|
369
|
-
__publicField$
|
|
722
|
+
__publicField$3(this, "key");
|
|
370
723
|
/**
|
|
371
|
-
*
|
|
724
|
+
* The name of the zone as it appears in-game.
|
|
372
725
|
*/
|
|
373
|
-
__publicField$
|
|
726
|
+
__publicField$3(this, "name");
|
|
374
727
|
/**
|
|
375
|
-
* List of
|
|
728
|
+
* List of external links. Wiki, forums, etc.
|
|
376
729
|
*/
|
|
377
|
-
__publicField$
|
|
378
|
-
this.
|
|
730
|
+
__publicField$3(this, "links");
|
|
731
|
+
this.key = new Key(data.key).value;
|
|
379
732
|
this.name = data.name;
|
|
380
|
-
this.
|
|
733
|
+
this.links = data.links ?? [];
|
|
381
734
|
}
|
|
382
735
|
}
|
|
383
736
|
|
|
384
|
-
var __defProp$
|
|
385
|
-
var __defNormalProp$
|
|
386
|
-
var __publicField$
|
|
387
|
-
class
|
|
737
|
+
var __defProp$2 = Object.defineProperty;
|
|
738
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
739
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
740
|
+
class Contact {
|
|
388
741
|
constructor(data) {
|
|
389
742
|
/**
|
|
390
|
-
*
|
|
743
|
+
* Unique key used to reference this contact.
|
|
744
|
+
*
|
|
745
|
+
* Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
|
|
391
746
|
*/
|
|
392
|
-
__publicField$
|
|
747
|
+
__publicField$2(this, "key");
|
|
393
748
|
/**
|
|
394
|
-
* The name of
|
|
749
|
+
* The name of this contact.
|
|
395
750
|
*/
|
|
396
|
-
__publicField$
|
|
751
|
+
__publicField$2(this, "name");
|
|
397
752
|
/**
|
|
398
|
-
*
|
|
753
|
+
* The contact's title.
|
|
399
754
|
*/
|
|
400
|
-
__publicField$
|
|
755
|
+
__publicField$2(this, "title");
|
|
756
|
+
/**
|
|
757
|
+
* The character moralities that this contact will interact with.
|
|
758
|
+
*/
|
|
759
|
+
__publicField$2(this, "morality");
|
|
401
760
|
/**
|
|
402
|
-
*
|
|
761
|
+
* The location of this contact.
|
|
403
762
|
*/
|
|
404
|
-
__publicField$
|
|
763
|
+
__publicField$2(this, "location");
|
|
764
|
+
/**
|
|
765
|
+
* The level range this contact will offer missions for.
|
|
766
|
+
*/
|
|
767
|
+
__publicField$2(this, "levelRange");
|
|
768
|
+
/**
|
|
769
|
+
* Freeform notes or tips about the contact.
|
|
770
|
+
*/
|
|
771
|
+
__publicField$2(this, "notes");
|
|
772
|
+
/**
|
|
773
|
+
* List of external links. Wiki, forums, etc.
|
|
774
|
+
*/
|
|
775
|
+
__publicField$2(this, "links");
|
|
405
776
|
this.key = new Key(data.key).value;
|
|
406
777
|
this.name = data.name;
|
|
407
|
-
this.
|
|
408
|
-
this.
|
|
778
|
+
this.title = data.title;
|
|
779
|
+
this.morality = new MoralityList(coalesceToArray(data.morality));
|
|
780
|
+
this.location = data.location;
|
|
781
|
+
this.levelRange = data.levelRange;
|
|
782
|
+
this.notes = data.notes;
|
|
783
|
+
this.links = data.links ?? [];
|
|
409
784
|
}
|
|
410
785
|
}
|
|
411
786
|
|
|
412
|
-
var __defProp = Object.defineProperty;
|
|
413
|
-
var
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
417
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
418
|
-
var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
|
|
419
|
-
var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
420
|
-
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
421
|
-
var _archetypeIndex, _mapIndex, _badgeIndex;
|
|
422
|
-
class ServerGroup {
|
|
787
|
+
var __defProp$1 = Object.defineProperty;
|
|
788
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
789
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
790
|
+
class Mission {
|
|
423
791
|
constructor(data) {
|
|
424
|
-
__privateAdd$1(this, _archetypeIndex, {});
|
|
425
|
-
__privateAdd$1(this, _mapIndex, {});
|
|
426
|
-
__privateAdd$1(this, _badgeIndex, {});
|
|
427
792
|
/**
|
|
428
|
-
*
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Name of the server group.
|
|
793
|
+
* Unique key used to reference this mission.
|
|
794
|
+
*
|
|
795
|
+
* Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
|
|
433
796
|
*/
|
|
434
|
-
__publicField(this, "
|
|
797
|
+
__publicField$1(this, "key");
|
|
435
798
|
/**
|
|
436
|
-
*
|
|
799
|
+
* The name of the mission as it appears from the contact.
|
|
437
800
|
*
|
|
438
|
-
*
|
|
801
|
+
* The name may be different when viewed in Ouroboros as a Flashback.
|
|
439
802
|
*/
|
|
440
|
-
__publicField(this, "
|
|
803
|
+
__publicField$1(this, "name");
|
|
441
804
|
/**
|
|
442
|
-
*
|
|
805
|
+
* The type of mission... Story arc, task force, trial, etc.
|
|
443
806
|
*/
|
|
444
|
-
__publicField(this, "
|
|
807
|
+
__publicField$1(this, "type");
|
|
445
808
|
/**
|
|
446
|
-
*
|
|
809
|
+
* The character moralities that may accept the mission.
|
|
447
810
|
*/
|
|
448
|
-
__publicField(this, "
|
|
811
|
+
__publicField$1(this, "morality");
|
|
449
812
|
/**
|
|
450
|
-
*
|
|
451
|
-
* Torchbearer, Excelsior, etc.
|
|
813
|
+
* The keys of any contacts that provide this mission.
|
|
452
814
|
*/
|
|
453
|
-
__publicField(this, "
|
|
815
|
+
__publicField$1(this, "contactKeys");
|
|
454
816
|
/**
|
|
455
|
-
*
|
|
817
|
+
* The level range this mission is available for.
|
|
456
818
|
*/
|
|
457
|
-
__publicField(this, "
|
|
819
|
+
__publicField$1(this, "levelRange");
|
|
458
820
|
/**
|
|
459
|
-
*
|
|
821
|
+
* Freeform notes or tips about the mission.
|
|
460
822
|
*/
|
|
461
|
-
__publicField(this, "
|
|
823
|
+
__publicField$1(this, "notes");
|
|
462
824
|
/**
|
|
463
|
-
* List of
|
|
825
|
+
* List of external links. Wiki, forums, etc.
|
|
464
826
|
*/
|
|
465
|
-
__publicField(this, "
|
|
827
|
+
__publicField$1(this, "links");
|
|
466
828
|
/**
|
|
467
|
-
*
|
|
829
|
+
* If the mission is available in Ouroboros as a Flashback.
|
|
468
830
|
*/
|
|
469
|
-
__publicField(this, "
|
|
831
|
+
__publicField$1(this, "flashback");
|
|
470
832
|
this.key = new Key(data.key).value;
|
|
471
833
|
this.name = data.name;
|
|
472
|
-
this.
|
|
473
|
-
this.
|
|
474
|
-
this.
|
|
475
|
-
this.
|
|
476
|
-
this.
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
__privateGet$1(this, _archetypeIndex)[archetype.key] = archetype;
|
|
480
|
-
return archetype;
|
|
481
|
-
}) ?? [];
|
|
482
|
-
this.maps = data.maps?.map((data2) => {
|
|
483
|
-
if (__privateGet$1(this, _mapIndex)[data2.key] !== void 0) throw new Error(`Duplicate map key [${data2.key}]`);
|
|
484
|
-
const map = new GameMap(data2);
|
|
485
|
-
__privateGet$1(this, _mapIndex)[map.key] = map;
|
|
486
|
-
return map;
|
|
487
|
-
}) ?? [];
|
|
488
|
-
this.badges = data.badges?.map((data2) => {
|
|
489
|
-
if (__privateGet$1(this, _badgeIndex)[data2.key] !== void 0) throw new Error(`Duplicate badge key [${data2.key}]`);
|
|
490
|
-
const badge = new Badge(data2);
|
|
491
|
-
__privateGet$1(this, _badgeIndex)[badge.key] = badge;
|
|
492
|
-
return badge;
|
|
493
|
-
}) ?? [];
|
|
494
|
-
this.changelog = data.changelog;
|
|
495
|
-
}
|
|
496
|
-
getArchetype(key) {
|
|
497
|
-
const result = __privateGet$1(this, _archetypeIndex)[key];
|
|
498
|
-
if (result === void 0) throw new Error(`Unknown archetype key [${key}]`);
|
|
499
|
-
return result;
|
|
500
|
-
}
|
|
501
|
-
getMap(key) {
|
|
502
|
-
const result = __privateGet$1(this, _mapIndex)[key];
|
|
503
|
-
if (result === void 0) throw new Error(`Unknown map key [${key}]`);
|
|
504
|
-
return result;
|
|
505
|
-
}
|
|
506
|
-
getBadge(key) {
|
|
507
|
-
const result = __privateGet$1(this, _badgeIndex)[key];
|
|
508
|
-
if (result === void 0) throw new Error(`Unknown badge key [${key}]`);
|
|
509
|
-
return result;
|
|
834
|
+
this.type = data.type;
|
|
835
|
+
this.morality = new MoralityList(coalesceToArray(data.morality));
|
|
836
|
+
this.contactKeys = coalesceToArray(data.contactKeys);
|
|
837
|
+
this.levelRange = data.levelRange;
|
|
838
|
+
this.notes = data.notes;
|
|
839
|
+
this.links = data.links ?? [];
|
|
840
|
+
this.flashback = createFlashback(data);
|
|
510
841
|
}
|
|
511
842
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
843
|
+
function createFlashback(data) {
|
|
844
|
+
if (!data.flashback) return void 0;
|
|
845
|
+
return {
|
|
846
|
+
id: data.flashback.id,
|
|
847
|
+
levelRange: data.flashback.levelRange ?? data.levelRange,
|
|
848
|
+
name: data.flashback.name ?? data.name,
|
|
849
|
+
morality: new MoralityList(coalesceToArray(data.flashback.morality ?? data.morality)),
|
|
850
|
+
notes: data.flashback.notes
|
|
851
|
+
};
|
|
852
|
+
}
|
|
515
853
|
|
|
516
854
|
var __typeError = (msg) => {
|
|
517
855
|
throw TypeError(msg);
|
|
@@ -519,50 +857,153 @@ var __typeError = (msg) => {
|
|
|
519
857
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
520
858
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
521
859
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
522
|
-
var
|
|
860
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
861
|
+
var _archetypeIndex, _zoneIndex, _contactIndex, _missionIndex, _badgeIndex, _header, _servers;
|
|
523
862
|
class CohContentDatabase {
|
|
524
|
-
|
|
525
|
-
|
|
863
|
+
/**
|
|
864
|
+
* Create a db instance from the given content bundle.
|
|
865
|
+
* @param bundle The bundle to load.
|
|
866
|
+
*/
|
|
867
|
+
constructor(bundle) {
|
|
868
|
+
__privateAdd(this, _archetypeIndex);
|
|
869
|
+
__privateAdd(this, _zoneIndex);
|
|
870
|
+
__privateAdd(this, _contactIndex);
|
|
871
|
+
__privateAdd(this, _missionIndex);
|
|
872
|
+
__privateAdd(this, _badgeIndex);
|
|
873
|
+
__privateAdd(this, _header);
|
|
874
|
+
__privateAdd(this, _servers);
|
|
875
|
+
__privateSet(this, _header, new BundleHeader(bundle.header));
|
|
876
|
+
__privateSet(this, _servers, bundle.servers ?? []);
|
|
877
|
+
__privateSet(this, _archetypeIndex, new AbstractIndex("key", bundle.archetypes?.map((x) => new Archetype(x))));
|
|
878
|
+
__privateSet(this, _zoneIndex, new AbstractIndex("key", bundle.zones?.map((x) => new Zone(x))));
|
|
879
|
+
__privateSet(this, _contactIndex, new AbstractIndex("key", bundle.contacts?.map((x) => new Contact(x))));
|
|
880
|
+
__privateSet(this, _missionIndex, new AbstractIndex("key", bundle.missions?.map((x) => new Mission(x))));
|
|
881
|
+
__privateSet(this, _badgeIndex, new BadgeIndex(bundle.badges?.map((x) => new Badge(x))));
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Header information about the content bundle.
|
|
885
|
+
*/
|
|
886
|
+
get header() {
|
|
887
|
+
return __privateGet(this, _header);
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* List of the game server names.
|
|
891
|
+
*
|
|
892
|
+
* Torchbearer, Excelsior, etc.
|
|
893
|
+
*/
|
|
894
|
+
get servers() {
|
|
895
|
+
return __privateGet(this, _servers);
|
|
526
896
|
}
|
|
527
897
|
/**
|
|
528
|
-
*
|
|
529
|
-
* @param data The data to load.
|
|
898
|
+
* List of archetypes.
|
|
530
899
|
*/
|
|
531
|
-
|
|
532
|
-
__privateGet(this,
|
|
900
|
+
get archetypes() {
|
|
901
|
+
return __privateGet(this, _archetypeIndex).values;
|
|
533
902
|
}
|
|
534
903
|
/**
|
|
535
|
-
* Get
|
|
904
|
+
* Get archetype by key.
|
|
905
|
+
* @param key The key.
|
|
536
906
|
*/
|
|
537
|
-
|
|
538
|
-
return
|
|
907
|
+
getArchetype(key) {
|
|
908
|
+
return __privateGet(this, _archetypeIndex).get(key);
|
|
539
909
|
}
|
|
540
910
|
/**
|
|
541
|
-
*
|
|
542
|
-
* @param serverGroupKey The key.
|
|
911
|
+
* List of game zones.
|
|
543
912
|
*/
|
|
544
|
-
|
|
545
|
-
return __privateGet(this,
|
|
913
|
+
get zones() {
|
|
914
|
+
return __privateGet(this, _zoneIndex).values;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Get zone by key.
|
|
918
|
+
* @param key The key.
|
|
919
|
+
*/
|
|
920
|
+
getZone(key) {
|
|
921
|
+
return __privateGet(this, _zoneIndex).get(key);
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* List of contacts.
|
|
925
|
+
*/
|
|
926
|
+
get contacts() {
|
|
927
|
+
return __privateGet(this, _contactIndex).values;
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Get contact by key.
|
|
931
|
+
* @param key The key.
|
|
932
|
+
*/
|
|
933
|
+
getContact(key) {
|
|
934
|
+
return __privateGet(this, _contactIndex).get(key);
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* List of missions.
|
|
938
|
+
*/
|
|
939
|
+
get missions() {
|
|
940
|
+
return __privateGet(this, _missionIndex).values;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Get mission by key.
|
|
944
|
+
* @param key The key.
|
|
945
|
+
*/
|
|
946
|
+
getMission(key) {
|
|
947
|
+
return __privateGet(this, _missionIndex).get(key);
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* List of badges.
|
|
951
|
+
*/
|
|
952
|
+
get badges() {
|
|
953
|
+
return __privateGet(this, _badgeIndex).values;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Get badge by key.
|
|
957
|
+
* @param key The key.
|
|
958
|
+
*/
|
|
959
|
+
getBadge(key) {
|
|
960
|
+
return __privateGet(this, _badgeIndex).get(key);
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Search, sort and filter the badge list.
|
|
964
|
+
* This is a fairly brute-forced approach and will not be as performant as loading the badge data into a traditional
|
|
965
|
+
* database engine, but is sufficient for most operations.
|
|
966
|
+
* @param options {@link BadgeSearchOptions}
|
|
967
|
+
*/
|
|
968
|
+
searchBadges(options) {
|
|
969
|
+
return __privateGet(this, _badgeIndex).search(options);
|
|
546
970
|
}
|
|
547
971
|
}
|
|
548
|
-
|
|
972
|
+
_archetypeIndex = new WeakMap();
|
|
973
|
+
_zoneIndex = new WeakMap();
|
|
974
|
+
_contactIndex = new WeakMap();
|
|
975
|
+
_missionIndex = new WeakMap();
|
|
976
|
+
_badgeIndex = new WeakMap();
|
|
977
|
+
_header = new WeakMap();
|
|
978
|
+
_servers = new WeakMap();
|
|
549
979
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
980
|
+
var __defProp = Object.defineProperty;
|
|
981
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
982
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
983
|
+
class Location {
|
|
984
|
+
constructor(data) {
|
|
985
|
+
/**
|
|
986
|
+
* Key of the {@link Zone} that the location references.
|
|
987
|
+
*/
|
|
988
|
+
__publicField(this, "zoneKey");
|
|
989
|
+
/**
|
|
990
|
+
* In-game `/loc` coordinates of the location.
|
|
991
|
+
*/
|
|
992
|
+
__publicField(this, "coords");
|
|
993
|
+
/**
|
|
994
|
+
* The type of icon to use if the location appears on a map. (Typically the Vidiot map icon).
|
|
995
|
+
*/
|
|
996
|
+
__publicField(this, "icon");
|
|
997
|
+
/**
|
|
998
|
+
* The text that should appear in the location icon. (Typically a number or symbol from the Vidiot map).
|
|
999
|
+
*/
|
|
1000
|
+
__publicField(this, "iconText");
|
|
1001
|
+
this.zoneKey = data.zoneKey;
|
|
1002
|
+
this.coords = data.coords;
|
|
1003
|
+
this.icon = data.icon;
|
|
1004
|
+
this.iconText = data.iconText;
|
|
555
1005
|
}
|
|
556
|
-
];
|
|
557
|
-
|
|
558
|
-
function createBadgeReference(target) {
|
|
559
|
-
const key = typeof target === "string" ? target : target.key;
|
|
560
|
-
return `[badge:${key}]`;
|
|
561
|
-
}
|
|
562
|
-
function createMapReference(target) {
|
|
563
|
-
const key = typeof target === "string" ? target : target.key;
|
|
564
|
-
return `[map:${key}]`;
|
|
565
1006
|
}
|
|
566
1007
|
|
|
567
|
-
export { ALIGNMENT, Archetype,
|
|
1008
|
+
export { ALIGNMENT, AlignmentList, Alternates, Archetype, BADGE_REQUIREMENT_TYPE, BADGE_TYPE, Badge, BadgeIndex, BadgeRequirement, BundleHeader, CohContentDatabase, Contact, ENHANCEMENT_CATEGORY, Key, Location, MISSION_TYPE, MORALITY, Mission, MoralityList, SEX, Zone, badgeLink, badgeUri, coalesceToArray, compareAlignment, compareByDefaultName, compareByZoneKey, compareSex, contactLink, contactUri, missionLink, missionUri, zoneLink, zoneUri };
|
|
568
1009
|
//# sourceMappingURL=coh-content-db.mjs.map
|