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