magicrealmsshared 0.5.1 → 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/dist/communication/ws.d.ts +39 -9
- package/dist/communication/ws.js +29 -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,19 +1,31 @@
|
|
|
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">;
|
|
6
|
-
coordinates: z.ZodArray<z.ZodNumber>;
|
|
7
|
-
}, z.
|
|
6
|
+
coordinates: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
type: "Point";
|
|
9
|
+
coordinates: number[];
|
|
10
|
+
}, {
|
|
11
|
+
type: "Point";
|
|
12
|
+
coordinates: number[];
|
|
13
|
+
}>;
|
|
8
14
|
export declare const AUTH_TOKEN_SCHEME: z.ZodString;
|
|
9
15
|
export declare const AUTH = "AUTH";
|
|
10
16
|
export declare const AUTH_ACK = "AUTH_ACK";
|
|
11
17
|
export declare const AUTH_INVALID = "AI";
|
|
12
18
|
export declare const LOGIN_COMMAND = "LOGIN";
|
|
13
19
|
export declare const LOGIN_DATA_SCHEME: z.ZodObject<{
|
|
14
|
-
email: z.
|
|
20
|
+
email: z.ZodString;
|
|
15
21
|
password: z.ZodString;
|
|
16
|
-
}, z.
|
|
22
|
+
}, "strict", z.ZodTypeAny, {
|
|
23
|
+
email: string;
|
|
24
|
+
password: string;
|
|
25
|
+
}, {
|
|
26
|
+
email: string;
|
|
27
|
+
password: string;
|
|
28
|
+
}>;
|
|
17
29
|
export type LOGIN_DATA = z.infer<typeof LOGIN_DATA_SCHEME>;
|
|
18
30
|
export declare const LOGIN_RESPONSE_COMMAND = "NIGOL";
|
|
19
31
|
export type LOGIN_RESPONSE_DATA<T> = {
|
|
@@ -35,10 +47,28 @@ export declare const POSUPDATE_COMMAND = "POSUPDATE";
|
|
|
35
47
|
export declare const POSUPDATE_SCHEME: z.ZodObject<{
|
|
36
48
|
pos: z.ZodObject<{
|
|
37
49
|
type: z.ZodLiteral<"Point">;
|
|
38
|
-
coordinates: z.ZodArray<z.ZodNumber>;
|
|
39
|
-
}, z.
|
|
50
|
+
coordinates: z.ZodEffects<z.ZodArray<z.ZodNumber, "many">, number[], number[]>;
|
|
51
|
+
}, "strict", z.ZodTypeAny, {
|
|
52
|
+
type: "Point";
|
|
53
|
+
coordinates: number[];
|
|
54
|
+
}, {
|
|
55
|
+
type: "Point";
|
|
56
|
+
coordinates: number[];
|
|
57
|
+
}>;
|
|
40
58
|
pre: z.ZodNumber;
|
|
41
|
-
}, z.
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
pos: {
|
|
61
|
+
type: "Point";
|
|
62
|
+
coordinates: number[];
|
|
63
|
+
};
|
|
64
|
+
pre: number;
|
|
65
|
+
}, {
|
|
66
|
+
pos: {
|
|
67
|
+
type: "Point";
|
|
68
|
+
coordinates: number[];
|
|
69
|
+
};
|
|
70
|
+
pre: number;
|
|
71
|
+
}>;
|
|
42
72
|
export type POSUPDATE = z.infer<typeof POSUPDATE_SCHEME>;
|
|
43
73
|
export declare const ADMIN_WELL_CREATE_COMMAND = "ADMIN_WELL_CREATE";
|
|
44
74
|
export type ADMIN_WELL_CREATE = Pick<Well<string>, "pos"> & Partial<Omit<Well<string>, "_id" | "pos">>;
|
package/dist/communication/ws.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
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.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
|
-
pos: GeoJSONPointSchema,
|
|
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.DATA_UPDATE_COMMAND = "DATA_UPDATE";
|
|
37
|
+
exports.POSUPDATE_COMMAND = "POSUPDATE";
|
|
38
|
+
exports.POSUPDATE_SCHEME = zod_1.z.strictObject({
|
|
39
|
+
pos: exports.GeoJSONPointSchema,
|
|
40
|
+
pre: zod_1.z.number(),
|
|
40
41
|
});
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
exports.ADMIN_WELL_CREATE_COMMAND = "ADMIN_WELL_CREATE";
|
|
43
|
+
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.0",
|
|
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
|
}
|