@truelies/osm-dybuf 0.4.5 → 0.4.6
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 +28 -0
- package/collectible_types.d.ts +22 -0
- package/collectible_types.mjs +48 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -157,6 +157,34 @@ console.log(decodeAxisCode(axisCode, lonBits)); // -123
|
|
|
157
157
|
- `encodeAxisCode(index, magnitudeBits)` / `decodeAxisCode(code, magnitudeBits)`:
|
|
158
158
|
- encodes grid index as `sign bit + (abs(index) - 1)`
|
|
159
159
|
|
|
160
|
+
### Collectible types
|
|
161
|
+
|
|
162
|
+
`collectible_types.mjs` exposes stable numeric collectible type IDs for Firestore / frontend use:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import {
|
|
166
|
+
COLLECTIBLE_TYPE_IDS,
|
|
167
|
+
COLLECTIBLE_TYPES_BY_ID,
|
|
168
|
+
TELEPORT_SUBTYPE_IDS,
|
|
169
|
+
} from "@truelies/osm-dybuf/collectible_types";
|
|
170
|
+
|
|
171
|
+
console.log(COLLECTIBLE_TYPE_IDS.teleport); // 1
|
|
172
|
+
console.log(TELEPORT_SUBTYPE_IDS.rail); // 1
|
|
173
|
+
console.log(COLLECTIBLE_TYPES_BY_ID[2].nameZh); // "聖晶石"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Current built-in IDs:
|
|
177
|
+
|
|
178
|
+
- `1`: 傳送點
|
|
179
|
+
- `2`: 聖晶石
|
|
180
|
+
|
|
181
|
+
Current teleport subtypes:
|
|
182
|
+
|
|
183
|
+
- `1`: 鐵路
|
|
184
|
+
- `2`: 陸路
|
|
185
|
+
- `3`: 海路
|
|
186
|
+
- `4`: 空路
|
|
187
|
+
|
|
160
188
|
## Local Development
|
|
161
189
|
|
|
162
190
|
```bash
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const COLLECTIBLE_TYPE_IDS: Readonly<{
|
|
2
|
+
teleport: 1;
|
|
3
|
+
sacredCrystal: 2;
|
|
4
|
+
}>;
|
|
5
|
+
|
|
6
|
+
export interface CollectibleTypeMeta {
|
|
7
|
+
id: number;
|
|
8
|
+
key: string;
|
|
9
|
+
nameZh: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export declare const COLLECTIBLE_TYPES_BY_ID: Readonly<Record<number, Readonly<CollectibleTypeMeta>>>;
|
|
13
|
+
|
|
14
|
+
export declare const TELEPORT_SUBTYPE_IDS: Readonly<{
|
|
15
|
+
rail: 1;
|
|
16
|
+
road: 2;
|
|
17
|
+
sea: 3;
|
|
18
|
+
air: 4;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
export declare const TELEPORT_SUBTYPES_BY_ID: Readonly<Record<number, Readonly<CollectibleTypeMeta>>>;
|
|
22
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const COLLECTIBLE_TYPE_IDS = Object.freeze({
|
|
2
|
+
teleport: 1,
|
|
3
|
+
sacredCrystal: 2,
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
export const COLLECTIBLE_TYPES_BY_ID = Object.freeze({
|
|
7
|
+
[COLLECTIBLE_TYPE_IDS.teleport]: Object.freeze({
|
|
8
|
+
id: COLLECTIBLE_TYPE_IDS.teleport,
|
|
9
|
+
key: "teleport",
|
|
10
|
+
nameZh: "傳送點",
|
|
11
|
+
}),
|
|
12
|
+
[COLLECTIBLE_TYPE_IDS.sacredCrystal]: Object.freeze({
|
|
13
|
+
id: COLLECTIBLE_TYPE_IDS.sacredCrystal,
|
|
14
|
+
key: "sacred_crystal",
|
|
15
|
+
nameZh: "聖晶石",
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const TELEPORT_SUBTYPE_IDS = Object.freeze({
|
|
20
|
+
rail: 1,
|
|
21
|
+
road: 2,
|
|
22
|
+
sea: 3,
|
|
23
|
+
air: 4,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const TELEPORT_SUBTYPES_BY_ID = Object.freeze({
|
|
27
|
+
[TELEPORT_SUBTYPE_IDS.rail]: Object.freeze({
|
|
28
|
+
id: TELEPORT_SUBTYPE_IDS.rail,
|
|
29
|
+
key: "rail",
|
|
30
|
+
nameZh: "鐵路",
|
|
31
|
+
}),
|
|
32
|
+
[TELEPORT_SUBTYPE_IDS.road]: Object.freeze({
|
|
33
|
+
id: TELEPORT_SUBTYPE_IDS.road,
|
|
34
|
+
key: "road",
|
|
35
|
+
nameZh: "陸路",
|
|
36
|
+
}),
|
|
37
|
+
[TELEPORT_SUBTYPE_IDS.sea]: Object.freeze({
|
|
38
|
+
id: TELEPORT_SUBTYPE_IDS.sea,
|
|
39
|
+
key: "sea",
|
|
40
|
+
nameZh: "海路",
|
|
41
|
+
}),
|
|
42
|
+
[TELEPORT_SUBTYPE_IDS.air]: Object.freeze({
|
|
43
|
+
id: TELEPORT_SUBTYPE_IDS.air,
|
|
44
|
+
key: "air",
|
|
45
|
+
nameZh: "空路",
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truelies/osm-dybuf",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Gridex OSM DyBuf parser and schema utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./osm_dybuf.mjs",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"import": "./grid_index.mjs",
|
|
20
20
|
"types": "./grid_index.d.ts"
|
|
21
21
|
},
|
|
22
|
+
"./collectible_types": {
|
|
23
|
+
"import": "./collectible_types.mjs",
|
|
24
|
+
"types": "./collectible_types.d.ts"
|
|
25
|
+
},
|
|
22
26
|
"./region_numeric_codes.json": "./region_numeric_codes.json"
|
|
23
27
|
},
|
|
24
28
|
"files": [
|
|
@@ -29,7 +33,9 @@
|
|
|
29
33
|
"region_numeric_codes.json",
|
|
30
34
|
"region_numeric_codes.js",
|
|
31
35
|
"grid_index.mjs",
|
|
32
|
-
"grid_index.d.ts"
|
|
36
|
+
"grid_index.d.ts",
|
|
37
|
+
"collectible_types.mjs",
|
|
38
|
+
"collectible_types.d.ts"
|
|
33
39
|
],
|
|
34
40
|
"keywords": [
|
|
35
41
|
"dybuf",
|