baltica 0.0.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.
Files changed (62) hide show
  1. package/dist/bridge/bridge-options.d.ts +22 -0
  2. package/dist/bridge/bridge-options.js +11 -0
  3. package/dist/bridge/bridge-player.d.ts +14 -0
  4. package/dist/bridge/bridge-player.js +26 -0
  5. package/dist/bridge/bridge.d.ts +25 -0
  6. package/dist/bridge/bridge.js +143 -0
  7. package/dist/client/client-data.d.ts +28 -0
  8. package/dist/client/client-data.js +140 -0
  9. package/dist/client/client-options.d.ts +58 -0
  10. package/dist/client/client-options.js +48 -0
  11. package/dist/client/client.d.ts +44 -0
  12. package/dist/client/client.js +216 -0
  13. package/dist/client/index.d.ts +5 -0
  14. package/dist/client/index.js +21 -0
  15. package/dist/client/types/index.d.ts +3 -0
  16. package/dist/client/types/index.js +19 -0
  17. package/dist/client/types/login-data.d.ts +11 -0
  18. package/dist/client/types/login-data.js +26 -0
  19. package/dist/client/types/payload.d.ts +50 -0
  20. package/dist/client/types/payload.js +91 -0
  21. package/dist/client/types/skin/Skin.json +112 -0
  22. package/dist/client/types/skin/index.d.ts +1 -0
  23. package/dist/client/types/skin/index.js +17 -0
  24. package/dist/client/worker/WorkerClient.d.ts +18 -0
  25. package/dist/client/worker/WorkerClient.js +99 -0
  26. package/dist/client/worker/index.d.ts +2 -0
  27. package/dist/client/worker/index.js +18 -0
  28. package/dist/client/worker/worker.d.ts +4 -0
  29. package/dist/client/worker/worker.js +131 -0
  30. package/dist/index.d.ts +4 -0
  31. package/dist/index.js +20 -0
  32. package/dist/libs/emitter.d.ts +13 -0
  33. package/dist/libs/emitter.js +76 -0
  34. package/dist/libs/index.d.ts +1 -0
  35. package/dist/libs/index.js +17 -0
  36. package/dist/network/auth.d.ts +17 -0
  37. package/dist/network/auth.js +148 -0
  38. package/dist/network/client-cache-status.d.ts +8 -0
  39. package/dist/network/client-cache-status.js +37 -0
  40. package/dist/network/index.d.ts +3 -0
  41. package/dist/network/index.js +19 -0
  42. package/dist/network/level-chunk-packet.d.ts +23 -0
  43. package/dist/network/level-chunk-packet.js +75 -0
  44. package/dist/network/packet-compressor.d.ts +13 -0
  45. package/dist/network/packet-compressor.js +82 -0
  46. package/dist/network/packet-encryptor.d.ts +21 -0
  47. package/dist/network/packet-encryptor.js +101 -0
  48. package/dist/server/index.d.ts +3 -0
  49. package/dist/server/index.js +19 -0
  50. package/dist/server/player.d.ts +34 -0
  51. package/dist/server/player.js +166 -0
  52. package/dist/server/server-options.d.ts +27 -0
  53. package/dist/server/server-options.js +16 -0
  54. package/dist/server/server.d.ts +17 -0
  55. package/dist/server/server.js +44 -0
  56. package/dist/tools/bridge.d.ts +1 -0
  57. package/dist/tools/bridge.js +35 -0
  58. package/dist/tools/client.d.ts +1 -0
  59. package/dist/tools/client.js +59 -0
  60. package/dist/tools/server.d.ts +1 -0
  61. package/dist/tools/server.js +8 -0
  62. package/package.json +36 -0
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Client = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const node_crypto_2 = require("node:crypto");
6
+ const raknet_1 = require("@sanctumterra/raknet");
7
+ const protocol_1 = require("@serenityjs/protocol");
8
+ const emitter_1 = require("../libs/emitter");
9
+ const network_1 = require("../network");
10
+ const client_cache_status_1 = require("../network/client-cache-status");
11
+ const level_chunk_packet_1 = require("../network/level-chunk-packet");
12
+ const packet_encryptor_1 = require("../network/packet-encryptor");
13
+ const client_data_1 = require("./client-data");
14
+ const client_options_1 = require("./client-options");
15
+ const worker_1 = require("./worker");
16
+ class Client extends emitter_1.Emitter {
17
+ constructor(options) {
18
+ super();
19
+ this.options = { ...client_options_1.defaultClientOptions, ...options };
20
+ this.status = raknet_1.Status.Disconnected;
21
+ this.protocol = client_options_1.ProtocolList[this.options.version];
22
+ this.raknet = this.options.worker
23
+ ? new worker_1.WorkerClient({
24
+ address: this.options.host,
25
+ port: this.options.port,
26
+ })
27
+ : new raknet_1.Client({
28
+ address: this.options.host,
29
+ port: this.options.port,
30
+ });
31
+ this.sessionReady = false;
32
+ this._encryptionEnabled = false;
33
+ this._compressionEnabled = false;
34
+ this.cancelPastLogin = false;
35
+ this.data = new client_data_1.ClientData(this);
36
+ this.once("session", this.handleSession.bind(this));
37
+ this.options.offline ? (0, network_1.createOfflineSession)(this) : (0, network_1.authenticate)(this);
38
+ }
39
+ async connect() {
40
+ this.packetCompressor = new network_1.PacketCompressor(this);
41
+ this.listen();
42
+ const advertisement = await this.raknet.connect();
43
+ this.raknet.on("encapsulated", this.handleEncapsulated.bind(this));
44
+ return new Promise((resolve, reject) => {
45
+ this.once("StartGamePacket", this.handleStartGamePacket.bind(this));
46
+ this.once("SetLocalPlayerAsInitializedPacket", this.handleSetLocalPlayerAsInitializedPacket.bind(this));
47
+ this.once("AvailableCommandsPacket", () => { });
48
+ const interval = setInterval(() => {
49
+ if (this.status === raknet_1.Status.Connected &&
50
+ this.startGamePacket &&
51
+ this.sessionReady) {
52
+ clearInterval(interval);
53
+ resolve([advertisement, this.startGamePacket]);
54
+ }
55
+ }, 50);
56
+ });
57
+ }
58
+ handleStartGamePacket(packet) {
59
+ this.startGamePacket = packet;
60
+ this.runtimeEntityId = packet.runtimeEntityId;
61
+ if (this.cancelPastLogin)
62
+ return;
63
+ const radius = new protocol_1.RequestChunkRadiusPacket();
64
+ radius.radius = this.options.viewDistance;
65
+ radius.maxRadius = this.options.viewDistance;
66
+ this.queue(radius);
67
+ }
68
+ handleSetLocalPlayerAsInitializedPacket(packet) {
69
+ this.status = raknet_1.Status.Connected;
70
+ }
71
+ handleEncapsulated(buffer) {
72
+ try {
73
+ const packets = this.packetCompressor.decompress(buffer);
74
+ for (const packet of packets) {
75
+ this.processPacket(packet);
76
+ }
77
+ }
78
+ catch (error) {
79
+ raknet_1.Logger.error("Failed to handle encapsulated packet", error);
80
+ }
81
+ }
82
+ sendPacket(packet, priority = raknet_1.Priority.Normal) {
83
+ try {
84
+ const serialized = packet instanceof protocol_1.DataPacket ? packet.serialize() : packet;
85
+ const compressed = this.packetCompressor.compress(serialized, this.options.compressionMethod);
86
+ const frame = new raknet_1.Frame();
87
+ frame.orderChannel = 0;
88
+ frame.payload = compressed;
89
+ this.raknet.sendFrame(frame, priority);
90
+ }
91
+ catch (error) {
92
+ raknet_1.Logger.error(`Failed to send packet ${packet.constructor.name}`, error);
93
+ }
94
+ }
95
+ send(packet) {
96
+ this.sendPacket(packet, raknet_1.Priority.Immediate);
97
+ }
98
+ queue(packet) {
99
+ raknet_1.Logger.debug(`Queueing packet ${packet.constructor.name}`);
100
+ this.sendPacket(packet, raknet_1.Priority.Normal);
101
+ }
102
+ /** Already decompressed packets */
103
+ processPacket(buffer) {
104
+ const id = (0, protocol_1.getPacketId)(buffer);
105
+ if (!protocol_1.Packets[id])
106
+ return raknet_1.Logger.warn(`Unknown Game packet ${id}`);
107
+ let PacketClass = protocol_1.Packets[id];
108
+ try {
109
+ if (id === protocol_1.Packet.LevelChunk) {
110
+ PacketClass = level_chunk_packet_1.LevelChunkPacket;
111
+ }
112
+ if (this.hasListeners(PacketClass.name)) {
113
+ const packet = new PacketClass(buffer).deserialize();
114
+ this.emit(PacketClass.name, packet);
115
+ }
116
+ if (this.hasListeners("packet")) {
117
+ const packet = new PacketClass(buffer).deserialize();
118
+ this.emit("packet", packet);
119
+ }
120
+ }
121
+ catch (error) {
122
+ raknet_1.Logger.error(`Failed to process packet ${PacketClass.name}`, error);
123
+ }
124
+ }
125
+ handleSession() {
126
+ this.sessionReady = true;
127
+ }
128
+ listen() {
129
+ this.raknet.once("connect", () => {
130
+ const timer = setInterval(() => {
131
+ if (this.sessionReady) {
132
+ const request = new protocol_1.RequestNetworkSettingsPacket();
133
+ request.protocol = this.protocol;
134
+ this.send(request);
135
+ clearInterval(timer);
136
+ }
137
+ }, 50);
138
+ });
139
+ this.once("NetworkSettingsPacket", (packet) => {
140
+ this._compressionEnabled = true;
141
+ this.options.compressionMethod = this.packetCompressor.getMethod(packet.compressionMethod);
142
+ this.options.compressionThreshold = packet.compressionThreshold;
143
+ const loginPacket = this.data.createLoginPacket();
144
+ this.send(loginPacket);
145
+ });
146
+ this.once("ServerToClientHandshakePacket", (packet) => {
147
+ const [header, payload] = packet.token
148
+ .split(".")
149
+ .map((k) => Buffer.from(k, "base64"));
150
+ const { x5u } = JSON.parse(header.toString());
151
+ const { salt } = JSON.parse(payload.toString());
152
+ const pubKeyDer = (0, node_crypto_2.createPublicKey)({
153
+ key: Buffer.from(x5u, "base64"),
154
+ type: "spki",
155
+ format: "der",
156
+ });
157
+ this.data.sharedSecret = this.data.createSharedSecret(this.data.loginData.ecdhKeyPair.privateKey, pubKeyDer);
158
+ const secretHash = (0, node_crypto_1.createHash)("sha256")
159
+ .update(new Uint8Array(Buffer.from(salt, "base64")))
160
+ .update(new Uint8Array(this.data.sharedSecret))
161
+ .digest();
162
+ this.secretKeyBytes = secretHash;
163
+ this.iv = secretHash.slice(0, 16);
164
+ this.startEncryption(this.iv);
165
+ const handshake = new protocol_1.ClientToServerHandshakePacket();
166
+ this.send(handshake);
167
+ });
168
+ this.once("ResourcePacksInfoPacket", this.handleResourcePacksInfoPacket.bind(this));
169
+ // this.once("ResourcePackStackPacket", this.handleResourcePacksInfoPacket.bind(this));
170
+ this.on("PlayStatusPacket", this.handlePlayStatusPacket.bind(this));
171
+ }
172
+ handlePlayStatusPacket(packet) {
173
+ if (packet.status === protocol_1.PlayStatus.LoginSuccess) {
174
+ }
175
+ if (packet.status === protocol_1.PlayStatus.PlayerSpawn) {
176
+ if (this.cancelPastLogin)
177
+ return;
178
+ const init = new protocol_1.SetLocalPlayerAsInitializedPacket();
179
+ init.runtimeEntityId = this.runtimeEntityId;
180
+ const ServerBoundLoadingScreen = new protocol_1.ServerboundLoadingScreenPacketPacket();
181
+ ServerBoundLoadingScreen.type =
182
+ protocol_1.ServerboundLoadingScreenType.EndLoadingScreen;
183
+ ServerBoundLoadingScreen.hasScreenId = false;
184
+ this.send(init);
185
+ this.emit("SetLocalPlayerAsInitializedPacket", init);
186
+ }
187
+ }
188
+ handleResourcePacksInfoPacket(packet) {
189
+ if (this.cancelPastLogin)
190
+ return;
191
+ const response = new protocol_1.ResourcePackClientResponsePacket();
192
+ response.packs = [];
193
+ response.response = protocol_1.ResourcePackResponse.Completed;
194
+ this.send(response);
195
+ if (packet instanceof protocol_1.ResourcePacksInfoPacket) {
196
+ this.send(client_cache_status_1.ClientCacheStatusPacket.create(false));
197
+ }
198
+ }
199
+ startEncryption(iv) {
200
+ this.packetEncryptor = new packet_encryptor_1.PacketEncryptor(this, iv);
201
+ this._encryptionEnabled = true;
202
+ }
203
+ sendMessage(text) {
204
+ const textPacket = new protocol_1.TextPacket();
205
+ textPacket.filtered = "";
206
+ textPacket.message = text.replace(/^\s+/, "");
207
+ textPacket.needsTranslation = false;
208
+ textPacket.parameters = [];
209
+ textPacket.platformChatId = "";
210
+ textPacket.source = this.profile.name;
211
+ textPacket.type = protocol_1.TextPacketType.Chat;
212
+ textPacket.xuid = "";
213
+ this.sendPacket(textPacket, raknet_1.Priority.Normal);
214
+ }
215
+ }
216
+ exports.Client = Client;
@@ -0,0 +1,5 @@
1
+ export * from "./client";
2
+ export * from "./client-options";
3
+ export * from "./client-data";
4
+ export * from "./types";
5
+ export * from "./worker";
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client"), exports);
18
+ __exportStar(require("./client-options"), exports);
19
+ __exportStar(require("./client-data"), exports);
20
+ __exportStar(require("./types"), exports);
21
+ __exportStar(require("./worker"), exports);
@@ -0,0 +1,3 @@
1
+ export * from "./payload";
2
+ export * from "./skin";
3
+ export * from "./login-data";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./payload"), exports);
18
+ __exportStar(require("./skin"), exports);
19
+ __exportStar(require("./login-data"), exports);
@@ -0,0 +1,11 @@
1
+ import { type KeyPairKeyObjectResult } from "node:crypto";
2
+ type LoginData = {
3
+ ecdhKeyPair: KeyPairKeyObjectResult;
4
+ publicKeyDER: string | Buffer;
5
+ privateKeyPEM: string | Buffer;
6
+ clientX509: string;
7
+ clientIdentityChain: string;
8
+ clientUserChain: string;
9
+ };
10
+ export declare const prepareLoginData: () => LoginData;
11
+ export type { LoginData };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareLoginData = void 0;
4
+ const node_crypto_1 = require("node:crypto");
5
+ const curve = "secp384r1";
6
+ const pem = { format: "pem", type: "sec1" };
7
+ const der = { format: "der", type: "spki" };
8
+ const prepareLoginData = () => {
9
+ const ecdhKeyPair = (0, node_crypto_1.generateKeyPairSync)("ec", { namedCurve: curve });
10
+ const loginData = {
11
+ ecdhKeyPair: ecdhKeyPair,
12
+ publicKeyDER: Buffer.alloc(0),
13
+ privateKeyPEM: "",
14
+ clientX509: "",
15
+ clientIdentityChain: "",
16
+ clientUserChain: "",
17
+ };
18
+ loginData.ecdhKeyPair = (0, node_crypto_1.generateKeyPairSync)("ec", { namedCurve: curve });
19
+ loginData.publicKeyDER = loginData.ecdhKeyPair.publicKey.export(der);
20
+ loginData.privateKeyPEM = loginData.ecdhKeyPair.privateKey
21
+ .export(pem)
22
+ .toString("base64");
23
+ loginData.clientX509 = loginData.publicKeyDER.toString("base64");
24
+ return loginData;
25
+ };
26
+ exports.prepareLoginData = prepareLoginData;
@@ -0,0 +1,50 @@
1
+ import type { Player } from "src/server/player";
2
+ import type { Client } from "../client";
3
+ import type { AnimatedImageData, PersonaPieces, PieceTintColors } from "./skin";
4
+ export type Payload = {
5
+ AnimatedImageData: AnimatedImageData[];
6
+ ArmSize: string;
7
+ CapeData: string;
8
+ CapeId: string;
9
+ CapeImageHeight: number;
10
+ CapeImageWidth: number;
11
+ CapeOnClassicSkin: boolean;
12
+ ClientRandomId: number;
13
+ CompatibleWithClientSideChunkGen: boolean;
14
+ CurrentInputMode: number;
15
+ DefaultInputMode: number;
16
+ DeviceId: string;
17
+ DeviceModel: string;
18
+ DeviceOS: number;
19
+ GameVersion: string;
20
+ GuiScale: number;
21
+ IsEditorMode: boolean;
22
+ LanguageCode: string;
23
+ MaxViewDistance: number;
24
+ MemoryTier: number;
25
+ OverrideSkin: boolean;
26
+ PersonaPieces: PersonaPieces[];
27
+ PersonaSkin: boolean;
28
+ PieceTintColors: PieceTintColors[];
29
+ PlatformOfflineId: string;
30
+ PlatformOnlineId: string;
31
+ PlatformType: number;
32
+ PlayFabId: string;
33
+ PremiumSkin: boolean;
34
+ SelfSignedId: string;
35
+ ServerAddress: string;
36
+ SkinAnimationData: string;
37
+ SkinColor: string;
38
+ SkinGeometryDataEngineVersion: string;
39
+ SkinData: string;
40
+ SkinGeometryData: string;
41
+ SkinId: string;
42
+ SkinImageHeight: number;
43
+ SkinImageWidth: number;
44
+ SkinResourcePatch: string;
45
+ ThirdPartyName: string;
46
+ ThirdPartyNameOnly: boolean;
47
+ TrustedSkin: boolean;
48
+ UIProfile: number;
49
+ };
50
+ export declare const createDefaultPayload: (client: Client | Player) => Payload;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createDefaultPayload = void 0;
37
+ const client_data_1 = require("../client-data");
38
+ const client_options_1 = require("../client-options");
39
+ const skin = __importStar(require("./skin/Skin.json"));
40
+ const createDefaultPayload = (client) => {
41
+ return {
42
+ AnimatedImageData: skin.skinData.AnimatedImageData,
43
+ ArmSize: skin.skinData.ArmSize,
44
+ CapeData: skin.skinData.CapeData,
45
+ CapeId: skin.skinData.CapeId,
46
+ CapeImageHeight: skin.skinData.CapeImageHeight,
47
+ CapeImageWidth: skin.skinData.CapeImageWidth,
48
+ CapeOnClassicSkin: skin.skinData.CapeOnClassicSkin,
49
+ ClientRandomId: client_data_1.ClientData.generateId(),
50
+ CompatibleWithClientSideChunkGen: false,
51
+ CurrentInputMode: client.options.loginOptions.CurrentInputMode,
52
+ DefaultInputMode: client.options.loginOptions.DefaultInputMode,
53
+ DeviceId: client_data_1.ClientData.nextUUID(),
54
+ DeviceModel: client.options.loginOptions.DeviceModel,
55
+ DeviceOS: client.options.deviceOS ?? client_options_1.DeviceOS.NintendoSwitch,
56
+ GameVersion: client.options?.version,
57
+ GuiScale: 0,
58
+ IsEditorMode: false,
59
+ LanguageCode: "en_US",
60
+ MaxViewDistance: client.options?.viewDistance,
61
+ MemoryTier: 2,
62
+ OverrideSkin: false,
63
+ PersonaPieces: skin.skinData.PersonaPieces,
64
+ PersonaSkin: skin.skinData.PersonaSkin,
65
+ PieceTintColors: skin.skinData.PieceTintColors,
66
+ PlatformOfflineId: client_data_1.ClientData.nextUUID().replace(/-/g, ""),
67
+ PlatformOnlineId: client_data_1.ClientData.OnlineId(),
68
+ PlatformType: 2,
69
+ PlayFabId: client_data_1.ClientData.nextUUID().replace(/-/g, "").slice(0, 16),
70
+ PremiumSkin: skin.skinData.PremiumSkin,
71
+ SelfSignedId: client_data_1.ClientData.nextUUID(),
72
+ ServerAddress: `${client.options.host}:${client.options.port}`,
73
+ SkinAnimationData: skin.skinData.SkinAnimationData,
74
+ SkinColor: skin.skinData.SkinColor,
75
+ SkinGeometryDataEngineVersion: skin.skinData.SkinGeometryDataEngineVersion,
76
+ SkinData: skin.skinData.SkinData,
77
+ SkinGeometryData: skin.skinData.SkinGeometryData,
78
+ SkinId: skin.skinData.SkinId,
79
+ SkinImageHeight: skin.skinData.SkinImageHeight,
80
+ SkinImageWidth: skin.skinData.SkinImageWidth,
81
+ SkinResourcePatch: skin.skinData.SkinResourcePatch,
82
+ ThirdPartyName: client.profile?.name || "Player",
83
+ ThirdPartyNameOnly: false,
84
+ TrustedSkin: skin.skinData.TrustedSkin,
85
+ UIProfile: 0,
86
+ };
87
+ };
88
+ exports.createDefaultPayload = createDefaultPayload;
89
+ const getRandomId = () => {
90
+ return Math.floor(Math.random() * Date.now() * Math.random() * 1000000) ^ Date.now();
91
+ };