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