magicrealmsshared 0.5.2 → 0.6.1
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/dist/communication/ws.d.ts +10 -3
- package/dist/communication/ws.js +34 -28
- package/dist/game/colors.js +4 -1
- package/dist/geo/chunks.js +17 -10
- package/dist/index.js +5 -2
- package/dist/types/charcter.d.ts +2 -2
- package/dist/types/charcter.js +2 -1
- package/dist/types/items.d.ts +1 -1
- package/dist/types/items.js +5 -2
- package/dist/types/types.js +2 -1
- package/package.json +2 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GameCharacter } from "../types/charcter
|
|
2
|
-
import { Auth_Token, PlayerClientData, Well } from "../types/types
|
|
1
|
+
import { GameCharacter } from "../types/charcter";
|
|
2
|
+
import { Auth_Token, PlayerClientData, Well } from "../types/types";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
export declare const GeoJSONPointSchema: z.ZodObject<{
|
|
5
5
|
type: z.ZodLiteral<"Point">;
|
|
@@ -11,7 +11,7 @@ export declare const AUTH_ACK = "AUTH_ACK";
|
|
|
11
11
|
export declare const AUTH_INVALID = "AI";
|
|
12
12
|
export declare const LOGIN_COMMAND = "LOGIN";
|
|
13
13
|
export declare const LOGIN_DATA_SCHEME: z.ZodObject<{
|
|
14
|
-
email: z.
|
|
14
|
+
email: z.ZodString;
|
|
15
15
|
password: z.ZodString;
|
|
16
16
|
}, z.core.$strict>;
|
|
17
17
|
export type LOGIN_DATA = z.infer<typeof LOGIN_DATA_SCHEME>;
|
|
@@ -26,6 +26,13 @@ export declare const LOGIN_RESPONSE_CODE_SUCCESS = 0;
|
|
|
26
26
|
export declare const LOGIN_RESPONSE_CODE_EMAIL_INVALID = 10;
|
|
27
27
|
export declare const LOGIN_RESPONSE_CODE_PASSWORD_INVALID = 20;
|
|
28
28
|
export declare const LOGIN_RESPONSE_CODE_SERVER_ERROR = 1000;
|
|
29
|
+
export declare const REGISTER_COMMAND = "";
|
|
30
|
+
export declare const REGISTER_DATA_SCHEME: z.ZodObject<{
|
|
31
|
+
email: z.ZodString;
|
|
32
|
+
password: z.ZodString;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
export type REGISTER_DATA = z.infer<typeof REGISTER_DATA_SCHEME>;
|
|
35
|
+
export type REGISTER_RESPONSE_DATA<T> = LOGIN_RESPONSE_DATA<T>;
|
|
29
36
|
export declare const DATA_UPDATE_COMMAND = "DATA_UPDATE";
|
|
30
37
|
export type DATA_UPDATE<T> = {
|
|
31
38
|
drop?: string[];
|
package/dist/communication/ws.js
CHANGED
|
@@ -1,42 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ADMIN_WELL_DELETE_COMMAND = exports.ADMIN_WELL_CREATE_COMMAND = exports.POSUPDATE_SCHEME = exports.POSUPDATE_COMMAND = exports.DATA_UPDATE_COMMAND = exports.REGISTER_DATA_SCHEME = exports.REGISTER_COMMAND = exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = exports.LOGIN_RESPONSE_CODE_EMAIL_INVALID = exports.LOGIN_RESPONSE_CODE_SUCCESS = exports.LOGIN_RESPONSE_COMMAND = exports.LOGIN_DATA_SCHEME = exports.LOGIN_COMMAND = exports.AUTH_INVALID = exports.AUTH_ACK = exports.AUTH = exports.AUTH_TOKEN_SCHEME = exports.GeoJSONPointSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.GeoJSONPointSchema = zod_1.z.strictObject({
|
|
6
|
+
type: zod_1.z.literal("Point"),
|
|
7
|
+
coordinates: zod_1.z.array(zod_1.z.number()).length(2).superRefine(([lon, lat], ctx) => {
|
|
5
8
|
if (lon < -180 || lon > 180) {
|
|
6
9
|
ctx.addIssue({
|
|
7
|
-
code: "
|
|
8
|
-
values: ["lon"],
|
|
10
|
+
code: "custom",
|
|
9
11
|
message: "Longitude out of range",
|
|
10
12
|
});
|
|
11
13
|
}
|
|
12
14
|
if (lat < -90 || lat > 90) {
|
|
13
15
|
ctx.addIssue({
|
|
14
|
-
code: "
|
|
15
|
-
values: ["lat"],
|
|
16
|
+
code: "custom",
|
|
16
17
|
message: "Latitude out of range",
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
}),
|
|
20
21
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
email: z.
|
|
28
|
-
password: z.string().max(128),
|
|
22
|
+
exports.AUTH_TOKEN_SCHEME = zod_1.z.string().length(64);
|
|
23
|
+
exports.AUTH = "AUTH";
|
|
24
|
+
exports.AUTH_ACK = "AUTH_ACK";
|
|
25
|
+
exports.AUTH_INVALID = "AI";
|
|
26
|
+
exports.LOGIN_COMMAND = "LOGIN";
|
|
27
|
+
exports.LOGIN_DATA_SCHEME = zod_1.z.strictObject({
|
|
28
|
+
email: zod_1.z.string(),
|
|
29
|
+
password: zod_1.z.string().max(128),
|
|
29
30
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
pre: z.number(),
|
|
31
|
+
exports.LOGIN_RESPONSE_COMMAND = "NIGOL";
|
|
32
|
+
exports.LOGIN_RESPONSE_CODE_SUCCESS = 0;
|
|
33
|
+
exports.LOGIN_RESPONSE_CODE_EMAIL_INVALID = 10;
|
|
34
|
+
exports.LOGIN_RESPONSE_CODE_PASSWORD_INVALID = 20;
|
|
35
|
+
exports.LOGIN_RESPONSE_CODE_SERVER_ERROR = 1000;
|
|
36
|
+
exports.REGISTER_COMMAND = "";
|
|
37
|
+
exports.REGISTER_DATA_SCHEME = zod_1.z.strictObject({
|
|
38
|
+
email: zod_1.z.string(),
|
|
39
|
+
password: zod_1.z.string().max(128),
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
exports.DATA_UPDATE_COMMAND = "DATA_UPDATE";
|
|
42
|
+
exports.POSUPDATE_COMMAND = "POSUPDATE";
|
|
43
|
+
exports.POSUPDATE_SCHEME = zod_1.z.strictObject({
|
|
44
|
+
pos: exports.GeoJSONPointSchema,
|
|
45
|
+
pre: zod_1.z.number(),
|
|
46
|
+
});
|
|
47
|
+
exports.ADMIN_WELL_CREATE_COMMAND = "ADMIN_WELL_CREATE";
|
|
48
|
+
exports.ADMIN_WELL_DELETE_COMMAND = "ADMIN_WELL_DELETE";
|
package/dist/game/colors.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GameColors = void 0;
|
|
1
4
|
/*
|
|
2
5
|
1
|
|
3
6
|
🔴
|
|
@@ -15,7 +18,7 @@
|
|
|
15
18
|
🔵
|
|
16
19
|
(Zeit & Erkenntnis)
|
|
17
20
|
*/
|
|
18
|
-
|
|
21
|
+
exports.GameColors = new Map([
|
|
19
22
|
[
|
|
20
23
|
1, {
|
|
21
24
|
name: "Pyra",
|
package/dist/geo/chunks.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChunkSizeLat = exports.ChunkSizeLong = void 0;
|
|
4
|
+
exports.ChunkCoordinatesAreEqual = ChunkCoordinatesAreEqual;
|
|
5
|
+
exports.ChunkCoordinatesOfGEOJSONPoint = ChunkCoordinatesOfGEOJSONPoint;
|
|
6
|
+
exports.ChunkBoundaries = ChunkBoundaries;
|
|
7
|
+
exports.GEOJSONPointIsInChunks = GEOJSONPointIsInChunks;
|
|
8
|
+
exports.ChunkSizeLong = 0.025;
|
|
9
|
+
exports.ChunkSizeLat = 0.025;
|
|
10
|
+
function ChunkCoordinatesAreEqual(...chunkCoordinates) {
|
|
4
11
|
if (chunkCoordinates.length < 1)
|
|
5
12
|
return false;
|
|
6
13
|
for (const cc of chunkCoordinates) {
|
|
@@ -11,20 +18,20 @@ export function ChunkCoordinatesAreEqual(...chunkCoordinates) {
|
|
|
11
18
|
}
|
|
12
19
|
return true;
|
|
13
20
|
}
|
|
14
|
-
|
|
21
|
+
function ChunkCoordinatesOfGEOJSONPoint(point) {
|
|
15
22
|
return [
|
|
16
|
-
Math.floor(point.coordinates[0] / ChunkSizeLong),
|
|
17
|
-
Math.floor(point.coordinates[1] / ChunkSizeLat),
|
|
23
|
+
Math.floor(point.coordinates[0] / exports.ChunkSizeLong),
|
|
24
|
+
Math.floor(point.coordinates[1] / exports.ChunkSizeLat),
|
|
18
25
|
];
|
|
19
26
|
}
|
|
20
27
|
//Long-Min, Long-Max, Lat-Min, Lat-Max
|
|
21
|
-
|
|
28
|
+
function ChunkBoundaries(chunkCoordinates) {
|
|
22
29
|
return [
|
|
23
|
-
[chunkCoordinates[0] * ChunkSizeLong, chunkCoordinates[1] * ChunkSizeLat],
|
|
24
|
-
[(chunkCoordinates[0] + 1) * ChunkSizeLong, (chunkCoordinates[1] + 1) * ChunkSizeLat]
|
|
30
|
+
[chunkCoordinates[0] * exports.ChunkSizeLong, chunkCoordinates[1] * exports.ChunkSizeLat],
|
|
31
|
+
[(chunkCoordinates[0] + 1) * exports.ChunkSizeLong, (chunkCoordinates[1] + 1) * exports.ChunkSizeLat]
|
|
25
32
|
];
|
|
26
33
|
}
|
|
27
|
-
|
|
34
|
+
function GEOJSONPointIsInChunks(point, ...chunkCoordinates) {
|
|
28
35
|
const chunkCoordinatesOfPoint = ChunkCoordinatesOfGEOJSONPoint(point);
|
|
29
36
|
for (const cc of chunkCoordinates) {
|
|
30
37
|
if (ChunkCoordinatesAreEqual(cc, chunkCoordinatesOfPoint))
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.INTERACTION_DISTANCE = exports.PROJECT_NAME = void 0;
|
|
4
|
+
exports.PROJECT_NAME = "Magic Realms";
|
|
5
|
+
exports.INTERACTION_DISTANCE = 45;
|
package/dist/types/charcter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GameItem, HeadGear, ManaCrytal } from "./items
|
|
2
|
-
import { ObjectWithId } from "./types
|
|
1
|
+
import { GameItem, HeadGear, ManaCrytal } from "./items";
|
|
2
|
+
import { ObjectWithId } from "./types";
|
|
3
3
|
export type Equipment<IDFormat, DateFormat> = {
|
|
4
4
|
head: HeadGear<IDFormat, DateFormat> | null;
|
|
5
5
|
manaCrystals: ManaCrytal<IDFormat, DateFormat>[];
|
package/dist/types/charcter.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/types/items.d.ts
CHANGED
package/dist/types/items.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EGameItemType = void 0;
|
|
4
|
+
var EGameItemType;
|
|
2
5
|
(function (EGameItemType) {
|
|
3
6
|
EGameItemType[EGameItemType["ManaCrytal"] = 1] = "ManaCrytal";
|
|
4
7
|
EGameItemType[EGameItemType["HeadGear"] = 10] = "HeadGear";
|
|
5
|
-
})(EGameItemType || (EGameItemType = {}));
|
|
8
|
+
})(EGameItemType || (exports.EGameItemType = EGameItemType = {}));
|
package/dist/types/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magicrealmsshared",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.6.1",
|
|
5
4
|
"description": "",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
6
|
"scripts": {
|
|
@@ -47,6 +46,6 @@
|
|
|
47
46
|
}
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
|
-
"zod": "^
|
|
49
|
+
"zod": "^3.25.76"
|
|
51
50
|
}
|
|
52
51
|
}
|