h1z1-server 0.19.0 → 0.19.2
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/package.json +3 -3
- package/src/packets/ClientProtocol/ClientProtocol_860/h1z1packets.ts +85 -3
- package/src/servers/LoginServer/loginserver.ts +28 -1
- package/src/servers/ZoneServer/workers/createBaseEntities.ts +1 -0
- package/src/servers/ZoneServer/zonepackethandlers.ts +7 -3
- package/src/types/packets.ts +5 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "h1z1-server",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2",
|
|
4
4
|
"description": "Library for emulating h1z1 servers",
|
|
5
5
|
"author": "Quentin Gruber <quentingruber@gmail.com> (http://github.com/quentingruber)",
|
|
6
6
|
"license": "GPL-3.0-only",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"debug": "4.3.3",
|
|
19
19
|
"h1emu-core": "0.6.2",
|
|
20
20
|
"h1z1-dataschema": "1.5.7",
|
|
21
|
-
"mongodb": "4.2.
|
|
21
|
+
"mongodb": "4.2.2",
|
|
22
22
|
"mongodb-restore-dump": "1.0.1",
|
|
23
23
|
"typedoc": "0.22.10",
|
|
24
|
-
"typescript": "4.5.
|
|
24
|
+
"typescript": "4.5.4",
|
|
25
25
|
"v8-compile-cache": "2.3.0"
|
|
26
26
|
},
|
|
27
27
|
"directories": {
|
|
@@ -1010,7 +1010,7 @@ const lightWeightNpcSchema = [
|
|
|
1010
1010
|
{ name: "npcDefinitionId", type: "uint32", defaultValue: 0 },
|
|
1011
1011
|
{ name: "isVehicle", type: "boolean", defaultValue: false }, // determine if npc is moving with positionUpdate - Avcio
|
|
1012
1012
|
{ name: "profileId", type: "uint32", defaultValue: 0 },
|
|
1013
|
-
{ name: "
|
|
1013
|
+
{ name: "dontRequestFullData", type: "boolean", defaultValue: false },
|
|
1014
1014
|
{
|
|
1015
1015
|
name: "color",
|
|
1016
1016
|
type: "rgb",
|
|
@@ -10287,17 +10287,99 @@ var packets = [
|
|
|
10287
10287
|
],
|
|
10288
10288
|
["NavGen", 0xce, {}],
|
|
10289
10289
|
["Locks", 0xcf, {}],
|
|
10290
|
+
[
|
|
10291
|
+
"Ragdoll.Start",
|
|
10292
|
+
0xd00100,
|
|
10293
|
+
{
|
|
10294
|
+
fields: [
|
|
10295
|
+
{
|
|
10296
|
+
name: "characterId",
|
|
10297
|
+
type: "uint64string",
|
|
10298
|
+
defaultValue: "0x0000000000000000",
|
|
10299
|
+
},
|
|
10300
|
+
],
|
|
10301
|
+
},
|
|
10302
|
+
],
|
|
10290
10303
|
[
|
|
10291
10304
|
"Ragdoll.UpdatePose",
|
|
10292
|
-
|
|
10305
|
+
0xd00101,
|
|
10306
|
+
{
|
|
10307
|
+
fields: [
|
|
10308
|
+
{
|
|
10309
|
+
name: "characterId",
|
|
10310
|
+
type: "uint64string",
|
|
10311
|
+
defaultValue: "0x0000000000000000",
|
|
10312
|
+
},
|
|
10313
|
+
{
|
|
10314
|
+
name: "positionUpdate",
|
|
10315
|
+
type: "custom",
|
|
10316
|
+
parser: readPositionUpdateData,
|
|
10317
|
+
packer: packPositionUpdateData,
|
|
10318
|
+
},
|
|
10319
|
+
],
|
|
10320
|
+
},
|
|
10321
|
+
],
|
|
10322
|
+
[
|
|
10323
|
+
"Ragdoll.Unk",
|
|
10324
|
+
0xd00118,
|
|
10293
10325
|
{
|
|
10294
10326
|
fields: [
|
|
10295
|
-
{ name: "usePositionUpdate", type: "boolean", defaultValue: true }, // if set to true it need at lot more fields that seems to be a positionUpdate
|
|
10296
10327
|
{
|
|
10297
10328
|
name: "characterId",
|
|
10298
10329
|
type: "uint64string",
|
|
10299
10330
|
defaultValue: "0x0000000000000000",
|
|
10300
10331
|
},
|
|
10332
|
+
{ name: "unk1", type: "int32", defaultValue: 1 },
|
|
10333
|
+
{
|
|
10334
|
+
name: "unkArray1",
|
|
10335
|
+
type: "array",
|
|
10336
|
+
defaultValue: [],
|
|
10337
|
+
fields: [
|
|
10338
|
+
{ name: "unknownByte1", type: "uint8", defaultValue: 0 },
|
|
10339
|
+
{
|
|
10340
|
+
name: "position",
|
|
10341
|
+
type: "floatvector3",
|
|
10342
|
+
defaultValue: [0, 50, 0],
|
|
10343
|
+
},
|
|
10344
|
+
{
|
|
10345
|
+
name: "rotation",
|
|
10346
|
+
type: "floatvector4",
|
|
10347
|
+
defaultValue: [0, 0, 0, 0],
|
|
10348
|
+
},
|
|
10349
|
+
],
|
|
10350
|
+
},
|
|
10351
|
+
],
|
|
10352
|
+
},
|
|
10353
|
+
],
|
|
10354
|
+
[
|
|
10355
|
+
"Ragdoll.Unk2",
|
|
10356
|
+
0xd0010b,
|
|
10357
|
+
{
|
|
10358
|
+
fields: [
|
|
10359
|
+
{
|
|
10360
|
+
name: "characterId",
|
|
10361
|
+
type: "uint64string",
|
|
10362
|
+
defaultValue: "0x0000000000000000",
|
|
10363
|
+
},
|
|
10364
|
+
{ name: "unk1", type: "int32", defaultValue: 1 },
|
|
10365
|
+
{
|
|
10366
|
+
name: "unkArray1",
|
|
10367
|
+
type: "array",
|
|
10368
|
+
defaultValue: [],
|
|
10369
|
+
fields: [
|
|
10370
|
+
{ name: "unknownByte1", type: "uint8", defaultValue: 1 },
|
|
10371
|
+
{
|
|
10372
|
+
name: "position",
|
|
10373
|
+
type: "floatvector3",
|
|
10374
|
+
defaultValue: [0, 50, 0],
|
|
10375
|
+
},
|
|
10376
|
+
{
|
|
10377
|
+
name: "rotation",
|
|
10378
|
+
type: "floatvector4",
|
|
10379
|
+
defaultValue: [0, 0, 0, 0],
|
|
10380
|
+
},
|
|
10381
|
+
],
|
|
10382
|
+
},
|
|
10301
10383
|
{
|
|
10302
10384
|
name: "positionUpdate",
|
|
10303
10385
|
type: "custom",
|
|
@@ -149,7 +149,7 @@ export class LoginServer extends EventEmitter {
|
|
|
149
149
|
|
|
150
150
|
this._h1emuLoginServer.on(
|
|
151
151
|
"data",
|
|
152
|
-
(err: string, client: H1emuClient, packet: any) => {
|
|
152
|
+
async (err: string, client: H1emuClient, packet: any) => {
|
|
153
153
|
if (err) {
|
|
154
154
|
console.error(err);
|
|
155
155
|
} else {
|
|
@@ -172,6 +172,12 @@ export class LoginServer extends EventEmitter {
|
|
|
172
172
|
debug(`ZoneConnection established`);
|
|
173
173
|
client.session = true;
|
|
174
174
|
this._zoneConnections[client.clientId] = serverId;
|
|
175
|
+
await this._db
|
|
176
|
+
.collection("servers")
|
|
177
|
+
.updateOne(
|
|
178
|
+
{ serverId: serverId },
|
|
179
|
+
{ $set: { allowedAccess: true } }
|
|
180
|
+
);
|
|
175
181
|
} else {
|
|
176
182
|
delete this._h1emuLoginServer._clients[client.clientId];
|
|
177
183
|
return;
|
|
@@ -406,9 +412,29 @@ export class LoginServer extends EventEmitter {
|
|
|
406
412
|
debug("CharacterSelectInfoRequest");
|
|
407
413
|
}
|
|
408
414
|
|
|
415
|
+
async updateServersStatus(): Promise<void> {
|
|
416
|
+
const servers = await this._db.collection("servers").find().toArray();
|
|
417
|
+
|
|
418
|
+
for (let index = 0; index < servers.length; index++) {
|
|
419
|
+
const server: GameServer = servers[index];
|
|
420
|
+
if (
|
|
421
|
+
server.allowedAccess &&
|
|
422
|
+
!Object.values(this._zoneConnections).includes(server.serverId)
|
|
423
|
+
) {
|
|
424
|
+
await this._db
|
|
425
|
+
.collection("servers")
|
|
426
|
+
.updateOne(
|
|
427
|
+
{ serverId: server.serverId },
|
|
428
|
+
{ $set: { allowedAccess: false } }
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
409
434
|
async ServerListRequest(client: Client) {
|
|
410
435
|
let servers;
|
|
411
436
|
if (!this._soloMode) {
|
|
437
|
+
await this.updateServersStatus();
|
|
412
438
|
servers = await this._db.collection("servers").find().toArray();
|
|
413
439
|
const userWhiteList = await this._db
|
|
414
440
|
.collection("servers-whitelist")
|
|
@@ -767,6 +793,7 @@ export class LoginServer extends EventEmitter {
|
|
|
767
793
|
|
|
768
794
|
async updateServerList(client: Client): Promise<void> {
|
|
769
795
|
if (!this._soloMode) {
|
|
796
|
+
await this.updateServersStatus();
|
|
770
797
|
// useless if in solomode ( never get called either)
|
|
771
798
|
let servers: Array<GameServer> = await this._db
|
|
772
799
|
.collection("servers")
|
|
@@ -1975,8 +1975,12 @@ export class zonePacketHandlers {
|
|
|
1975
1975
|
// character
|
|
1976
1976
|
const entityData = server._characters[characterId];
|
|
1977
1977
|
if (entityData) {
|
|
1978
|
-
server.sendData(client, "PlayerUpdate.
|
|
1978
|
+
server.sendData(client, "PlayerUpdate.LightweightToFullNpc", {
|
|
1979
1979
|
transientId: entityData.transientId,
|
|
1980
|
+
unknownDword1: 16777215, // Data from PS2 dump that fits into h1 packets (i believe these were used for vehicle)
|
|
1981
|
+
unknownDword2: 13951728,
|
|
1982
|
+
unknownDword3: 1,
|
|
1983
|
+
unknownDword6: 100,
|
|
1980
1984
|
});
|
|
1981
1985
|
server.sendData(client, "Equipment.SetCharacterEquipment", {
|
|
1982
1986
|
profileId: 3,
|
|
@@ -2209,8 +2213,8 @@ export class zonePacketHandlers {
|
|
|
2209
2213
|
this.playerUpdateFullCharacterDataRequest(server, client, packet);
|
|
2210
2214
|
break;
|
|
2211
2215
|
default:
|
|
2212
|
-
|
|
2213
|
-
|
|
2216
|
+
console.error(packet);
|
|
2217
|
+
console.error("Packet not implemented in packetHandlers");
|
|
2214
2218
|
break;
|
|
2215
2219
|
}
|
|
2216
2220
|
}
|
package/src/types/packets.ts
CHANGED
|
@@ -667,9 +667,12 @@ export type h1z1PacketsType =
|
|
|
667
667
|
| "QuickChat.SendData"
|
|
668
668
|
| "QuickChat.SendTell"
|
|
669
669
|
| "QuickChat.SendChatToChannel"
|
|
670
|
-
| "
|
|
670
|
+
| "ReportReply"
|
|
671
671
|
| "LiveGamer"
|
|
672
672
|
| "Acquaintance"
|
|
673
|
+
| "AcquaintanceAdd"
|
|
674
|
+
| "AcquaintanceRemove"
|
|
675
|
+
| "AcquaintanceOnline"
|
|
673
676
|
| "ClientServerShuttingDown"
|
|
674
677
|
| "Friend.List"
|
|
675
678
|
| "Friend.Online"
|
|
@@ -2439,12 +2442,7 @@ export type h1z1PacketsType =
|
|
|
2439
2442
|
| "WeaponLagLockParameters"
|
|
2440
2443
|
| "CrateOpeningBase"
|
|
2441
2444
|
| "PlayerHeatWarning"
|
|
2442
|
-
| "AnimationBase"
|
|
2443
|
-
| "AccessedCharacter.BeginCharacterAccess"
|
|
2444
|
-
| "AccessedCharacter.Unknown1"
|
|
2445
|
-
| "FirstTimeEvent.State"
|
|
2446
|
-
| "FirstTimeEvent.Script"
|
|
2447
|
-
| "Vehicle.OwnerPassengerList";
|
|
2445
|
+
| "AnimationBase";
|
|
2448
2446
|
export type loginPacketsType =
|
|
2449
2447
|
| "LoginRequest"
|
|
2450
2448
|
| "LoginReply"
|