Core/PacketIO: Updated packet structures to 9.2.0

Port From (https://github.com/TrinityCore/TrinityCore/commit/9f30afe3528441571f89cb2e1775c756774fa0cd)
This commit is contained in:
hondacrx
2022-05-09 23:14:38 -04:00
parent 1ca851db26
commit 0bbabbd667
32 changed files with 1309 additions and 1023 deletions
@@ -75,6 +75,9 @@ namespace Game.Networking.Packets
{
var movementInfo = new MovementInfo();
movementInfo.Guid = data.ReadPackedGuid();
movementInfo.SetMovementFlags((MovementFlag)data.ReadUInt32());
movementInfo.SetMovementFlags2((MovementFlag2)data.ReadUInt32());
movementInfo.SetExtraMovementFlags2((MovementFlags3)data.ReadUInt32());
movementInfo.Time = data.ReadUInt32();
float x = data.ReadFloat();
float y = data.ReadFloat();
@@ -96,19 +99,27 @@ namespace Game.Networking.Packets
// ResetBitReader
movementInfo.SetMovementFlags((MovementFlag)data.ReadBits<uint>(30));
movementInfo.SetMovementFlags2((MovementFlag2)data.ReadBits<uint>(18));
bool hasTransport = data.HasBit();
bool hasFall = data.HasBit();
bool hasSpline = data.HasBit(); // todo 6.x read this infos
data.ReadBit(); // HeightChangeFailed
data.ReadBit(); // RemoteTimeValid
bool hasInertia = data.HasBit();
if (hasTransport)
ReadTransportInfo(data, ref movementInfo.transport);
if (hasInertia)
{
MovementInfo.Inertia inertia = new();
inertia.guid = data.ReadPackedGuid();
inertia.force = data.ReadPosition();
inertia.lifetime = data.ReadUInt32();
movementInfo.inertia = inertia;
}
if (hasFall)
{
movementInfo.jump.fallTime = data.ReadUInt32();
@@ -134,8 +145,12 @@ namespace Game.Networking.Packets
bool hasFallDirection = movementInfo.HasMovementFlag(MovementFlag.Falling | MovementFlag.FallingFar);
bool hasFallData = hasFallDirection || movementInfo.jump.fallTime != 0;
bool hasSpline = false; // todo 6.x send this infos
bool hasInertia = movementInfo.inertia.HasValue;
data.WritePackedGuid(movementInfo.Guid);
data.WriteUInt32((uint)movementInfo.GetMovementFlags());
data.WriteUInt32((uint)movementInfo.GetMovementFlags2());
data.WriteUInt32((uint)movementInfo.GetExtraMovementFlags2());
data.WriteUInt32(movementInfo.Time);
data.WriteFloat(movementInfo.Pos.GetPositionX());
data.WriteFloat(movementInfo.Pos.GetPositionY());
@@ -147,27 +162,32 @@ namespace Game.Networking.Packets
uint removeMovementForcesCount = 0;
data.WriteUInt32(removeMovementForcesCount);
uint int168 = 0;
data.WriteUInt32(int168);
uint moveIndex = 0;
data.WriteUInt32(moveIndex);
/*for (public uint i = 0; i < removeMovementForcesCount; ++i)
{
_worldPacket << ObjectGuid;
}*/
data.WriteBits((uint)movementInfo.GetMovementFlags(), 30);
data.WriteBits((uint)movementInfo.GetMovementFlags2(), 18);
data.WriteBit(hasTransportData);
data.WriteBit(hasFallData);
data.WriteBit(hasSpline);
data.WriteBit(false); // HeightChangeFailed
data.WriteBit(false); // RemoteTimeValid
data.WriteBit(hasInertia);
data.FlushBits();
if (hasTransportData)
WriteTransportInfo(data, movementInfo.transport);
if (hasInertia)
{
data.WritePackedGuid(movementInfo.inertia.Value.guid);
data.WriteXYZ(movementInfo.inertia.Value.force);
data.WriteUInt32(movementInfo.inertia.Value.lifetime);
}
if (hasFallData)
{
data.WriteUInt32(movementInfo.jump.fallTime);
@@ -1168,13 +1188,13 @@ namespace Game.Networking.Packets
data.WriteBit(CollisionHeight.HasValue);
data.WriteBit(@MovementForce != null);
data.WriteBit(MovementForceGUID.HasValue);
data.WriteBit(MovementInertiaGUID.HasValue);
data.WriteBit(MovementInertiaLifetimeMs.HasValue);
data.FlushBits();
if (@MovementForce != null)
@MovementForce.Write(data);
if (Speed.HasValue)
data.WriteFloat(Speed.Value);
@@ -1198,6 +1218,12 @@ namespace Game.Networking.Packets
if (MovementForceGUID.HasValue)
data.WritePackedGuid(MovementForceGUID.Value);
if (MovementInertiaGUID.HasValue)
data.WritePackedGuid(MovementInertiaGUID.Value);
if (MovementInertiaLifetimeMs.HasValue)
data.WriteUInt32(MovementInertiaLifetimeMs.Value);
}
public ServerOpcodes MessageID;
@@ -1208,6 +1234,8 @@ namespace Game.Networking.Packets
public CollisionHeightInfo? CollisionHeight;
public MovementForce MovementForce;
public ObjectGuid? MovementForceGUID;
public ObjectGuid? MovementInertiaGUID;
public uint? MovementInertiaLifetimeMs;
}
}