@mapletip/data 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -1
- package/client/items.js +35 -1
- package/client/monster-client.d.ts +15 -4
- package/client/monster-client.js +79 -8
- package/client/monsters.d.ts +16 -11
- package/client/monsters.js +12 -6
- package/client/static-client.d.ts +1 -1
- package/generated/monster-catalog-2-4.d.ts +378 -0
- package/generated/monster-catalog-2-4.validator.js +17 -0
- package/generated/monster-drop-browse-1-1.d.ts +150 -0
- package/generated/monster-drop-browse-1-1.validator.js +17 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -82,11 +82,31 @@ digest. `getMonsterBrowse` still requests only the release manifest named by the
|
|
|
82
82
|
build index, the product manifest and the Monster catalog.
|
|
83
83
|
|
|
84
84
|
Releases built before revision `2.1` carry contract-`2.0` catalogs without `sprite`; this
|
|
85
|
-
SDK reads both, and `hasMonsterSprites` narrows a catalog to revisions `2.1`
|
|
85
|
+
SDK reads both, and `hasMonsterSprites` narrows a catalog to revisions `2.1` through `2.4`. `@mapletip/data`
|
|
86
86
|
`0.2.0` and older reject a `2.1` catalog with a typed `SCHEMA_VALIDATION_ERROR` instead of
|
|
87
87
|
returning rows without sprites, so upgrade to `0.3.0` before adopting a pin that carries
|
|
88
88
|
it.
|
|
89
89
|
|
|
90
|
+
### Monster HP and MP recovery
|
|
91
|
+
|
|
92
|
+
Catalog revision `2.4` adds independent `hpRecovery` and `mpRecovery` facts to each row.
|
|
93
|
+
`known` preserves the source integer, including zero; `unknown`, `absent` with its
|
|
94
|
+
coverage key, and `unsupported` remain distinct. One field's value or state says nothing
|
|
95
|
+
about the other. No recovery interval or per-second unit is established, so describe
|
|
96
|
+
these as HP and MP recovery values rather than rates.
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { getMonsterBrowse } from '@mapletip/data/monsters';
|
|
100
|
+
|
|
101
|
+
const catalog = await getMonsterBrowse({ baseUrl: releaseRootUrl, pin: releasePin, buildId: 'gms-v83' });
|
|
102
|
+
if (catalog.format === 'mapletip.monster-catalog-2' && catalog.contractVersion === '2.4') {
|
|
103
|
+
const recoveries = catalog.records.map((row) => ({
|
|
104
|
+
hpRecovery: row.hpRecovery.state === 'known' ? row.hpRecovery.value : row.hpRecovery.state,
|
|
105
|
+
mpRecovery: row.mpRecovery.state === 'known' ? row.mpRecovery.value : row.mpRecovery.state,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
90
110
|
### Monster drops and locations
|
|
91
111
|
|
|
92
112
|
Monster catalog `2.2` keeps these summaries on every Monster row. The catalog-level
|
|
@@ -133,6 +153,30 @@ const monstersWithItem = Object.entries(dropBrowse.records)
|
|
|
133
153
|
.map(([monsterKey]) => monsterKey);
|
|
134
154
|
```
|
|
135
155
|
|
|
156
|
+
Drop browse revision `1.1` adds each resolved distinct item's same-build Media icon fact to
|
|
157
|
+
the `items[]` table. Use `itemIconUrl` only for a `known` icon; for other states, keep the
|
|
158
|
+
item name visible without substituting another image. The icon is already in the drop
|
|
159
|
+
browse artifact, so this read does not need an Item, Equipment or Media request:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
import { getMonsterDropBrowse } from '@mapletip/data/monsters';
|
|
163
|
+
import { itemIconUrl } from '@mapletip/data/items';
|
|
164
|
+
|
|
165
|
+
const dropBrowse = await getMonsterDropBrowse({
|
|
166
|
+
baseUrl: releaseRootUrl,
|
|
167
|
+
pin: releasePin,
|
|
168
|
+
buildId: 'cw-launch',
|
|
169
|
+
});
|
|
170
|
+
if (dropBrowse.contractVersion === '1.1') {
|
|
171
|
+
const items = dropBrowse.items.map((item) => ({
|
|
172
|
+
name: item.itemName.state === 'known' ? item.itemName.value : 'Unknown item',
|
|
173
|
+
iconUrl: item.icon.state === 'known'
|
|
174
|
+
? itemIconUrl(releaseRootUrl, item.icon.value)
|
|
175
|
+
: undefined,
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
136
180
|
Location summaries count client map placements, not live spawn rates. `known` carries
|
|
137
181
|
distinct map and placement counts; `absent` carries neither count and uses the
|
|
138
182
|
catalog-level coverage key; `unresolved` carries counts for the resolved portion when
|
package/client/items.js
CHANGED
|
@@ -189,5 +189,39 @@ export async function getItemRelatedEntities(options) {
|
|
|
189
189
|
}
|
|
190
190
|
/** Resolve one Item icon blob URL from its content-addressed media digest. */
|
|
191
191
|
export function itemIconUrl(baseUrl, contentId) {
|
|
192
|
-
return resolveMediaContentUrl(baseUrl, contentId, 'Item icon');
|
|
192
|
+
return resolveMediaContentUrl(baseUrl, compactSha256ToHex(contentId) ?? contentId, 'Item icon');
|
|
193
|
+
}
|
|
194
|
+
/** Expand the drop-browse base64url digest while keeping the resolver's hex contract. */
|
|
195
|
+
function compactSha256ToHex(value) {
|
|
196
|
+
if (value.length !== 43)
|
|
197
|
+
return undefined;
|
|
198
|
+
const bytes = [];
|
|
199
|
+
let accumulator = 0;
|
|
200
|
+
let bitCount = 0;
|
|
201
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
202
|
+
const code = value.charCodeAt(index);
|
|
203
|
+
const sextet = code >= 65 && code <= 90
|
|
204
|
+
? code - 65
|
|
205
|
+
: code >= 97 && code <= 122
|
|
206
|
+
? code - 97 + 26
|
|
207
|
+
: code >= 48 && code <= 57
|
|
208
|
+
? code - 48 + 52
|
|
209
|
+
: code === 45
|
|
210
|
+
? 62
|
|
211
|
+
: code === 95
|
|
212
|
+
? 63
|
|
213
|
+
: -1;
|
|
214
|
+
if (sextet < 0)
|
|
215
|
+
return undefined;
|
|
216
|
+
accumulator = (accumulator << 6) | sextet;
|
|
217
|
+
bitCount += 6;
|
|
218
|
+
if (bitCount >= 8) {
|
|
219
|
+
bitCount -= 8;
|
|
220
|
+
bytes.push((accumulator >> bitCount) & 0xff);
|
|
221
|
+
accumulator &= (1 << bitCount) - 1;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (bytes.length !== 32 || bitCount !== 2 || accumulator !== 0)
|
|
225
|
+
return undefined;
|
|
226
|
+
return bytes.map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
193
227
|
}
|
|
@@ -11,7 +11,10 @@ import type { MonsterCatalogV2 } from '../generated/monster-catalog-2.d.ts';
|
|
|
11
11
|
import type { MonsterCatalogV2_1 } from '../generated/monster-catalog-2-1.d.ts';
|
|
12
12
|
import type { MonsterCatalogV2_2 } from '../generated/monster-catalog-2-2.d.ts';
|
|
13
13
|
import type { MonsterCatalogV2_3 } from '../generated/monster-catalog-2-3.d.ts';
|
|
14
|
+
import type { MonsterCatalogV2_4 } from '../generated/monster-catalog-2-4.d.ts';
|
|
14
15
|
import type { MonsterDropBrowseV1 } from '../generated/monster-drop-browse.d.ts';
|
|
16
|
+
import type { MonsterDropBrowseItemV1_1, MonsterDropBrowseV1_1 } from '../generated/monster-drop-browse-1-1.d.ts';
|
|
17
|
+
import type { CatalogFact as CatalogFact2 } from '../generated/contract-2-catalog-fact.d.ts';
|
|
15
18
|
import type { MonsterLocationBrowseV1 } from '../generated/monster-location-browse.d.ts';
|
|
16
19
|
import type { MonsterLocationBrowseV1_1 } from '../generated/monster-location-browse-1-1.d.ts';
|
|
17
20
|
import type { MonsterDetailRecord, PageDescriptor } from '../generated/monster-detail.d.ts';
|
|
@@ -22,17 +25,24 @@ import type { MonsterLocationOccurrence } from '../generated/monster-relationshi
|
|
|
22
25
|
import type { MonsterCoreRelationshipPackV2 } from '../generated/monster-core-relationship-pack-2.d.ts';
|
|
23
26
|
import { type OpenProductOptions, type OperationOptions, type StaticProductManifest, type VerifiedProductContext } from './core.js';
|
|
24
27
|
/**
|
|
25
|
-
* A verified Monster catalog. Contracts 2.1
|
|
26
|
-
* for a monster's representative image; 2.0 and 1.x records have none.
|
|
28
|
+
* A verified Monster catalog. Contracts 2.1 through 2.4 carry the Media content ID
|
|
29
|
+
* fact for a monster's representative image; 2.0 and 1.x records have none.
|
|
27
30
|
*/
|
|
28
|
-
export type StaticMonsterCatalog = MonsterCatalog | MonsterCatalogV2 | MonsterCatalogV2_1 | MonsterCatalogV2_2 | MonsterCatalogV2_3;
|
|
31
|
+
export type StaticMonsterCatalog = MonsterCatalog | MonsterCatalogV2 | MonsterCatalogV2_1 | MonsterCatalogV2_2 | MonsterCatalogV2_3 | MonsterCatalogV2_4;
|
|
32
|
+
type StaticMonsterDropBrowseItemV1_1 = Omit<MonsterDropBrowseItemV1_1, 'icon'> & {
|
|
33
|
+
readonly icon: CatalogFact2<string>;
|
|
34
|
+
};
|
|
35
|
+
export type StaticMonsterDropBrowseV1_1 = Omit<MonsterDropBrowseV1_1, 'items' | 'itemIcons'> & {
|
|
36
|
+
readonly items: StaticMonsterDropBrowseItemV1_1[];
|
|
37
|
+
};
|
|
38
|
+
export type StaticMonsterDropBrowse = MonsterDropBrowseV1 | StaticMonsterDropBrowseV1_1;
|
|
29
39
|
export type StaticMonsterLocationBrowse = MonsterLocationBrowseV1 | MonsterLocationBrowseV1_1;
|
|
30
40
|
export type StaticMonsterDetail = MonsterDetailRecord | MonsterDetailRecordV2;
|
|
31
41
|
export type StaticMonsterEvidencePage = MonsterEvidencePage | MonsterEvidencePageV2;
|
|
32
42
|
export interface StaticProductClient {
|
|
33
43
|
readonly manifest: StaticProductManifest;
|
|
34
44
|
loadCatalog(options?: OperationOptions): Promise<StaticMonsterCatalog>;
|
|
35
|
-
loadDropBrowse(options?: OperationOptions): Promise<
|
|
45
|
+
loadDropBrowse(options?: OperationOptions): Promise<StaticMonsterDropBrowse>;
|
|
36
46
|
loadLocationBrowse(options?: OperationOptions): Promise<StaticMonsterLocationBrowse>;
|
|
37
47
|
getDetail(key: string, options?: OperationOptions): Promise<StaticMonsterDetail>;
|
|
38
48
|
getRelationshipPage(page: PageDescriptor, options?: OperationOptions): Promise<MonsterLocationOccurrence[]>;
|
|
@@ -46,3 +56,4 @@ export declare function openMonsterProduct(options: OpenProductOptions): Promise
|
|
|
46
56
|
export declare function isMonsterProductClient(client: {
|
|
47
57
|
readonly manifest: StaticProductManifest;
|
|
48
58
|
}): client is StaticProductClient;
|
|
59
|
+
export {};
|
package/client/monster-client.js
CHANGED
|
@@ -3,7 +3,9 @@ import validateCatalogV2 from '../generated/monster-catalog-2.validator.js';
|
|
|
3
3
|
import validateCatalogV2_1 from '../generated/monster-catalog-2-1.validator.js';
|
|
4
4
|
import validateCatalogV2_2 from '../generated/monster-catalog-2-2.validator.js';
|
|
5
5
|
import validateCatalogV2_3 from '../generated/monster-catalog-2-3.validator.js';
|
|
6
|
+
import validateCatalogV2_4 from '../generated/monster-catalog-2-4.validator.js';
|
|
6
7
|
import validateDropBrowse from '../generated/monster-drop-browse.validator.js';
|
|
8
|
+
import validateDropBrowseV1_1 from '../generated/monster-drop-browse-1-1.validator.js';
|
|
7
9
|
import validateLocationBrowse from '../generated/monster-location-browse.validator.js';
|
|
8
10
|
import validateLocationBrowseV1_1 from '../generated/monster-location-browse-1-1.validator.js';
|
|
9
11
|
import { MissingPageError, MissingRecordError, SchemaValidationError, UnsupportedCapabilityError, UnsupportedProductError, assertEnvelopeVersion, assertSameScope, lazyValidator, memoized, openProductContext, rangeDescriptor, recordRangeDescriptor, } from './core.js';
|
|
@@ -13,13 +15,15 @@ import { MissingPageError, MissingRecordError, SchemaValidationError, Unsupporte
|
|
|
13
15
|
*/
|
|
14
16
|
const validateCatalogRevision = Object.assign((data) => {
|
|
15
17
|
const version = data?.contractVersion;
|
|
16
|
-
const validator = version === '2.
|
|
17
|
-
?
|
|
18
|
-
: version === '2.
|
|
19
|
-
?
|
|
20
|
-
: version === '2.
|
|
21
|
-
?
|
|
22
|
-
:
|
|
18
|
+
const validator = version === '2.4'
|
|
19
|
+
? validateCatalogV2_4
|
|
20
|
+
: version === '2.3'
|
|
21
|
+
? validateCatalogV2_3
|
|
22
|
+
: version === '2.2'
|
|
23
|
+
? validateCatalogV2_2
|
|
24
|
+
: version === '2.1'
|
|
25
|
+
? validateCatalogV2_1
|
|
26
|
+
: validateCatalogV2;
|
|
23
27
|
const valid = validator(data);
|
|
24
28
|
validateCatalogRevision.errors = validator.errors;
|
|
25
29
|
return valid;
|
|
@@ -40,6 +44,49 @@ const validateLocationBrowseRevision = Object.assign((data) => {
|
|
|
40
44
|
validateLocationBrowseRevision.errors = validator.errors;
|
|
41
45
|
return valid;
|
|
42
46
|
}, { errors: undefined });
|
|
47
|
+
const validateDropBrowseRevision = Object.assign((data) => {
|
|
48
|
+
const version = data?.contractVersion;
|
|
49
|
+
const validator = version === '1.1' ? validateDropBrowseV1_1 : validateDropBrowse;
|
|
50
|
+
const valid = validator(data);
|
|
51
|
+
validateDropBrowseRevision.errors = validator.errors;
|
|
52
|
+
return valid;
|
|
53
|
+
}, { errors: undefined });
|
|
54
|
+
function compactSha256ToHex(value) {
|
|
55
|
+
if (value.length !== 43) {
|
|
56
|
+
throw new SchemaValidationError('dropBrowse.itemIcons', 'compact Media ID must be 43-character base64url');
|
|
57
|
+
}
|
|
58
|
+
const bytes = [];
|
|
59
|
+
let accumulator = 0;
|
|
60
|
+
let bitCount = 0;
|
|
61
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
62
|
+
const code = value.charCodeAt(index);
|
|
63
|
+
const sextet = code >= 65 && code <= 90
|
|
64
|
+
? code - 65
|
|
65
|
+
: code >= 97 && code <= 122
|
|
66
|
+
? code - 97 + 26
|
|
67
|
+
: code >= 48 && code <= 57
|
|
68
|
+
? code - 48 + 52
|
|
69
|
+
: code === 45
|
|
70
|
+
? 62
|
|
71
|
+
: code === 95
|
|
72
|
+
? 63
|
|
73
|
+
: -1;
|
|
74
|
+
if (sextet < 0) {
|
|
75
|
+
throw new SchemaValidationError('dropBrowse.itemIcons', 'compact Media ID is not base64url');
|
|
76
|
+
}
|
|
77
|
+
accumulator = (accumulator << 6) | sextet;
|
|
78
|
+
bitCount += 6;
|
|
79
|
+
if (bitCount >= 8) {
|
|
80
|
+
bitCount -= 8;
|
|
81
|
+
bytes.push((accumulator >> bitCount) & 0xff);
|
|
82
|
+
accumulator &= (1 << bitCount) - 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (bytes.length !== 32 || bitCount !== 2 || accumulator !== 0) {
|
|
86
|
+
throw new SchemaValidationError('dropBrowse.itemIcons', 'compact Media ID is not a canonical SHA-256 digest');
|
|
87
|
+
}
|
|
88
|
+
return bytes.map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
89
|
+
}
|
|
43
90
|
/** Build a Monster client over an already verified product manifest. */
|
|
44
91
|
export function monsterProductClient(context) {
|
|
45
92
|
const { manifest, contract2, fetchJson, fetchEnvelope } = context;
|
|
@@ -81,7 +128,31 @@ export function monsterProductClient(context) {
|
|
|
81
128
|
return raw;
|
|
82
129
|
}
|
|
83
130
|
async function loadDropBrowse(operation) {
|
|
84
|
-
|
|
131
|
+
const browse = await loadBrowseArtifact(manifest.dropBrowse, 'monster-drop-browse-v1', validateDropBrowseRevision, 'drop browse artifact', operation);
|
|
132
|
+
if (browse.contractVersion !== '1.1')
|
|
133
|
+
return browse;
|
|
134
|
+
if (browse.items.length !== browse.itemIcons.length) {
|
|
135
|
+
throw new SchemaValidationError(manifest.dropBrowse?.path ?? 'dropBrowse', 'itemIcons length does not match items');
|
|
136
|
+
}
|
|
137
|
+
const items = browse.items.map((item, index) => {
|
|
138
|
+
const icon = browse.itemIcons[index];
|
|
139
|
+
if (icon === undefined) {
|
|
140
|
+
throw new SchemaValidationError(manifest.dropBrowse?.path ?? 'dropBrowse', 'item icon fact is missing');
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
...item,
|
|
144
|
+
icon: typeof icon === 'string'
|
|
145
|
+
? { state: 'known', value: compactSha256ToHex(icon) }
|
|
146
|
+
: icon,
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
return {
|
|
150
|
+
format: browse.format,
|
|
151
|
+
contractVersion: browse.contractVersion,
|
|
152
|
+
scope: browse.scope,
|
|
153
|
+
items,
|
|
154
|
+
records: browse.records,
|
|
155
|
+
};
|
|
85
156
|
}
|
|
86
157
|
async function loadLocationBrowse(operation) {
|
|
87
158
|
return loadBrowseArtifact(manifest.locationBrowse, 'monster-location-browse-v1', validateLocationBrowseRevision, 'location browse artifact', operation);
|
package/client/monsters.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import type { MonsterCatalogV2_1 } from '../generated/monster-catalog-2-1.d.ts';
|
|
2
2
|
import type { MonsterCatalogV2_2 } from '../generated/monster-catalog-2-2.d.ts';
|
|
3
3
|
import type { MonsterCatalogV2_3 } from '../generated/monster-catalog-2-3.d.ts';
|
|
4
|
+
import type { MonsterCatalogV2_4 } from '../generated/monster-catalog-2-4.d.ts';
|
|
4
5
|
import type { MonsterDropBrowseV1 } from '../generated/monster-drop-browse.d.ts';
|
|
6
|
+
import type { MonsterDropBrowseV1_1 } from '../generated/monster-drop-browse-1-1.d.ts';
|
|
5
7
|
import type { MonsterLocationBrowseV1 } from '../generated/monster-location-browse.d.ts';
|
|
6
8
|
import type { MonsterLocationBrowseV1_1 } from '../generated/monster-location-browse-1-1.d.ts';
|
|
7
|
-
import type { StaticMonsterCatalog, StaticMonsterLocationBrowse } from './monster-client.js';
|
|
9
|
+
import type { StaticMonsterCatalog, StaticMonsterDropBrowse, StaticMonsterLocationBrowse } from './monster-client.js';
|
|
8
10
|
import { type OpenReleaseOptions } from './release.js';
|
|
9
|
-
export type { MonsterCatalogV2_3 };
|
|
11
|
+
export type { MonsterCatalogV2_3, MonsterCatalogV2_4 };
|
|
10
12
|
export { isMonsterProductClient, openMonsterProduct } from './monster-client.js';
|
|
11
|
-
export type { StaticMonsterCatalog, StaticMonsterDetail, StaticMonsterEvidencePage, StaticProductClient, } from './monster-client.js';
|
|
12
|
-
export type { MonsterDropBrowseV1, MonsterLocationBrowseV1, MonsterLocationBrowseV1_1 };
|
|
13
|
+
export type { StaticMonsterDropBrowse, StaticMonsterDropBrowseV1_1, StaticMonsterCatalog, StaticMonsterDetail, StaticMonsterEvidencePage, StaticProductClient, } from './monster-client.js';
|
|
14
|
+
export type { MonsterDropBrowseV1, MonsterDropBrowseV1_1, MonsterLocationBrowseV1, MonsterLocationBrowseV1_1 };
|
|
13
15
|
export type { MonsterCatalogV2_1, MonsterCatalogV2_2 };
|
|
14
16
|
export type { OpenReleaseOptions };
|
|
15
17
|
/** Options for the one-shot Monster catalog read: an opened release plus the build to read. */
|
|
@@ -29,7 +31,7 @@ export type GetMonsterLocationBrowseOptions = GetMonsterBrowseOptions;
|
|
|
29
31
|
*/
|
|
30
32
|
export declare function getMonsterBrowse(options: GetMonsterBrowseOptions): Promise<StaticMonsterCatalog>;
|
|
31
33
|
/** Read one build's manifest-pinned Monster drop browse artifact without caching or fallback. */
|
|
32
|
-
export declare function getMonsterDropBrowse(options: GetMonsterDropBrowseOptions): Promise<
|
|
34
|
+
export declare function getMonsterDropBrowse(options: GetMonsterDropBrowseOptions): Promise<StaticMonsterDropBrowse>;
|
|
33
35
|
/** Read one build's manifest-pinned Monster location browse artifact without caching or fallback. */
|
|
34
36
|
export declare function getMonsterLocationBrowse(options: GetMonsterLocationBrowseOptions): Promise<StaticMonsterLocationBrowse>;
|
|
35
37
|
/**
|
|
@@ -40,14 +42,17 @@ export declare function getMonsterLocationBrowse(options: GetMonsterLocationBrow
|
|
|
40
42
|
*/
|
|
41
43
|
export declare function monsterSpriteUrl(baseUrl: URL | string, contentId: string): string;
|
|
42
44
|
/**
|
|
43
|
-
* Narrow a verified catalog to a revision whose rows carry `sprite`. Catalogs 2.1
|
|
44
|
-
* 2.2 include it; earlier pins do not. The loose 1.x type keeps a plain field check from
|
|
45
|
+
* Narrow a verified catalog to a revision whose rows carry `sprite`. Catalogs 2.1, 2.2,
|
|
46
|
+
* 2.3, and 2.4 include it; earlier pins do not. The loose 1.x type keeps a plain field check from
|
|
45
47
|
* narrowing.
|
|
46
48
|
*/
|
|
47
|
-
export declare function hasMonsterSprites(catalog: StaticMonsterCatalog): catalog is MonsterCatalogV2_1 | MonsterCatalogV2_2 | MonsterCatalogV2_3;
|
|
49
|
+
export declare function hasMonsterSprites(catalog: StaticMonsterCatalog): catalog is MonsterCatalogV2_1 | MonsterCatalogV2_2 | MonsterCatalogV2_3 | MonsterCatalogV2_4;
|
|
48
50
|
/** Narrow a verified catalog to revisions with drop and location summaries. */
|
|
49
|
-
export declare function hasMonsterBrowseSummaries(catalog: StaticMonsterCatalog): catalog is MonsterCatalogV2_2 | MonsterCatalogV2_3;
|
|
50
|
-
/**
|
|
51
|
-
|
|
51
|
+
export declare function hasMonsterBrowseSummaries(catalog: StaticMonsterCatalog): catalog is MonsterCatalogV2_2 | MonsterCatalogV2_3 | MonsterCatalogV2_4;
|
|
52
|
+
/**
|
|
53
|
+
* Narrow a verified catalog to revisions with geography-key fields. Revision 2.4 permits
|
|
54
|
+
* the row field to be omitted when the same-build Map product has no genuine geography.
|
|
55
|
+
*/
|
|
56
|
+
export declare function hasMonsterGeography(catalog: StaticMonsterCatalog): catalog is MonsterCatalogV2_3 | MonsterCatalogV2_4;
|
|
52
57
|
/** Narrow a location browse artifact to revision 1.1, whose entries carry Map geography facts. */
|
|
53
58
|
export declare function hasMonsterLocationGeography(browse: StaticMonsterLocationBrowse): browse is MonsterLocationBrowseV1_1;
|
package/client/monsters.js
CHANGED
|
@@ -42,22 +42,28 @@ export function monsterSpriteUrl(baseUrl, contentId) {
|
|
|
42
42
|
return resolveMediaContentUrl(baseUrl, contentId, 'Monster sprite');
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
* Narrow a verified catalog to a revision whose rows carry `sprite`. Catalogs 2.1
|
|
46
|
-
* 2.2 include it; earlier pins do not. The loose 1.x type keeps a plain field check from
|
|
45
|
+
* Narrow a verified catalog to a revision whose rows carry `sprite`. Catalogs 2.1, 2.2,
|
|
46
|
+
* 2.3, and 2.4 include it; earlier pins do not. The loose 1.x type keeps a plain field check from
|
|
47
47
|
* narrowing.
|
|
48
48
|
*/
|
|
49
49
|
export function hasMonsterSprites(catalog) {
|
|
50
50
|
return catalog.format === 'mapletip.monster-catalog-2'
|
|
51
|
-
&& (catalog.contractVersion === '2.1' || catalog.contractVersion === '2.2'
|
|
51
|
+
&& (catalog.contractVersion === '2.1' || catalog.contractVersion === '2.2'
|
|
52
|
+
|| catalog.contractVersion === '2.3' || catalog.contractVersion === '2.4');
|
|
52
53
|
}
|
|
53
54
|
/** Narrow a verified catalog to revisions with drop and location summaries. */
|
|
54
55
|
export function hasMonsterBrowseSummaries(catalog) {
|
|
55
56
|
return catalog.format === 'mapletip.monster-catalog-2'
|
|
56
|
-
&& (catalog.contractVersion === '2.2' || catalog.contractVersion === '2.3'
|
|
57
|
+
&& (catalog.contractVersion === '2.2' || catalog.contractVersion === '2.3'
|
|
58
|
+
|| catalog.contractVersion === '2.4');
|
|
57
59
|
}
|
|
58
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Narrow a verified catalog to revisions with geography-key fields. Revision 2.4 permits
|
|
62
|
+
* the row field to be omitted when the same-build Map product has no genuine geography.
|
|
63
|
+
*/
|
|
59
64
|
export function hasMonsterGeography(catalog) {
|
|
60
|
-
return catalog.format === 'mapletip.monster-catalog-2'
|
|
65
|
+
return catalog.format === 'mapletip.monster-catalog-2'
|
|
66
|
+
&& (catalog.contractVersion === '2.3' || catalog.contractVersion === '2.4');
|
|
61
67
|
}
|
|
62
68
|
/** Narrow a location browse artifact to revision 1.1, whose entries carry Map geography facts. */
|
|
63
69
|
export function hasMonsterLocationGeography(browse) {
|
|
@@ -29,7 +29,7 @@ export type { StaticDomainCatalog, StaticDomainCatalogRecord, StaticDomainDetail
|
|
|
29
29
|
export { openRelease, resolveTargetAvailability } from './release.js';
|
|
30
30
|
export type { OpenReleaseOptions, ReleaseProductDescriptor, StaticReleaseBuild, StaticReleaseClient, TargetAvailability, } from './release.js';
|
|
31
31
|
export { getMonsterBrowse, getMonsterDropBrowse, getMonsterLocationBrowse, hasMonsterGeography, hasMonsterLocationGeography, hasMonsterBrowseSummaries, hasMonsterSprites, monsterSpriteUrl, } from './monsters.js';
|
|
32
|
-
export type { GetMonsterBrowseOptions, GetMonsterDropBrowseOptions, GetMonsterLocationBrowseOptions, MonsterDropBrowseV1, MonsterLocationBrowseV1, MonsterLocationBrowseV1_1, MonsterCatalogV2_3, } from './monsters.js';
|
|
32
|
+
export type { GetMonsterBrowseOptions, GetMonsterDropBrowseOptions, GetMonsterLocationBrowseOptions, MonsterDropBrowseV1, MonsterDropBrowseV1_1, MonsterLocationBrowseV1, MonsterLocationBrowseV1_1, StaticMonsterDropBrowse, MonsterCatalogV2_3, MonsterCatalogV2_4, } from './monsters.js';
|
|
33
33
|
export { getMapGeography, isMapGeographyModel, isMapProductClient, openMapProduct } from './maps.js';
|
|
34
34
|
export type { GetMapGeographyOptions, MapGeographyModel, StaticMapProductClient } from './maps.js';
|
|
35
35
|
export type AnyProductClient = StaticProductClient | StaticMediaProductClient | StaticQuestProductClient | StaticItemProductClient | StaticEquipmentProductClient | StaticDomainProductClient;
|