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