From 0080898785c6d5bdc21e28c0c5eacda48c388bad Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Mon, 11 Nov 2024 11:36:52 -0500 Subject: [PATCH] Core/PacketIO: Updated packet structures to 11.0.5 Port From (https://github.com/TrinityCore/TrinityCore/commit/5f37b29f41b6cb3fbcc3dc6bc0cf3a25c1f7eb6a) --- Source/Game/Handlers/GroupHandler.cs | 2 ++ Source/Game/Handlers/NPCHandler.cs | 1 - .../Networking/Packets/AuctionHousePackets.cs | 8 +++---- Source/Game/Networking/Packets/ItemPackets.cs | 2 +- .../Networking/Packets/MovementPackets.cs | 2 +- Source/Game/Networking/Packets/NPCPackets.cs | 6 ++---- .../Game/Networking/Packets/PartyPackets.cs | 21 +++++++++++++++++++ .../Packets/PerksPorgramPacketsCommon.cs | 2 ++ .../Game/Networking/Packets/SpellPackets.cs | 8 +++++-- 9 files changed, 39 insertions(+), 13 deletions(-) diff --git a/Source/Game/Handlers/GroupHandler.cs b/Source/Game/Handlers/GroupHandler.cs index 4fbd0f3ac..9f5442f7c 100644 --- a/Source/Game/Handlers/GroupHandler.cs +++ b/Source/Game/Handlers/GroupHandler.cs @@ -698,6 +698,8 @@ namespace Game broadcastPingUnit.Type = pingUnit.Type; broadcastPingUnit.PinFrameID = pingUnit.PinFrameID; broadcastPingUnit.PingDuration = pingUnit.PingDuration; + broadcastPingUnit.CreatureID = pingUnit.CreatureID; + broadcastPingUnit.SpellOverrideNameID = pingUnit.SpellOverrideNameID; broadcastPingUnit.Write(); for (GroupReference itr = group.GetFirstMember(); itr != null; itr = itr.Next()) diff --git a/Source/Game/Handlers/NPCHandler.cs b/Source/Game/Handlers/NPCHandler.cs index e20618b70..216b1acd9 100644 --- a/Source/Game/Handlers/NPCHandler.cs +++ b/Source/Game/Handlers/NPCHandler.cs @@ -477,7 +477,6 @@ namespace Game price -= MathFunctions.CalculatePct(price, priceMod); item.MuID = (int)slot + 1; - item.Durability = (int)itemTemplate.MaxDurability; item.ExtendedCostID = (int)vendorItem.ExtendedCost; item.Type = (int)vendorItem.Type; item.Quantity = leftInStock; diff --git a/Source/Game/Networking/Packets/AuctionHousePackets.cs b/Source/Game/Networking/Packets/AuctionHousePackets.cs index c1c4874ca..322b652dd 100644 --- a/Source/Game/Networking/Packets/AuctionHousePackets.cs +++ b/Source/Game/Networking/Packets/AuctionHousePackets.cs @@ -609,16 +609,16 @@ namespace Game.Networking.Packets { _worldPacket.WriteInt32(Items.Count); _worldPacket.WriteUInt32(Unknown830); - _worldPacket.WriteUInt32(TotalCount); _worldPacket.WriteUInt32(DesiredDelay); + foreach (AuctionItem item in Items) + item.Write(_worldPacket); + _worldPacket.WriteBits((int)ListType, 2); _worldPacket.WriteBit(HasMoreResults); _worldPacket.FlushBits(); BucketKey.Write(_worldPacket); - - foreach (AuctionItem item in Items) - item.Write(_worldPacket); + _worldPacket.WriteUInt32(TotalCount); } } diff --git a/Source/Game/Networking/Packets/ItemPackets.cs b/Source/Game/Networking/Packets/ItemPackets.cs index 79f27363d..22c564902 100644 --- a/Source/Game/Networking/Packets/ItemPackets.cs +++ b/Source/Game/Networking/Packets/ItemPackets.cs @@ -76,7 +76,7 @@ namespace Game.Networking.Packets { _worldPacket.WritePackedGuid(VendorGUID); _worldPacket.WriteUInt32(Muid); - _worldPacket.WriteUInt8((byte)Reason); + _worldPacket.WriteUInt32((uint)Reason); } public ObjectGuid VendorGUID; diff --git a/Source/Game/Networking/Packets/MovementPackets.cs b/Source/Game/Networking/Packets/MovementPackets.cs index f323b7616..73b6542ea 100644 --- a/Source/Game/Networking/Packets/MovementPackets.cs +++ b/Source/Game/Networking/Packets/MovementPackets.cs @@ -1241,7 +1241,7 @@ namespace Game.Networking.Packets public void Write(WorldPacket data) { - data.WriteUInt16((ushort)MessageID); + data.WriteUInt32((uint)MessageID); data.WriteUInt32(SequenceIndex); data.WriteBit(Speed.HasValue); data.WriteBit(SpeedRange != null); diff --git a/Source/Game/Networking/Packets/NPCPackets.cs b/Source/Game/Networking/Packets/NPCPackets.cs index 240809500..d8fd0f85c 100644 --- a/Source/Game/Networking/Packets/NPCPackets.cs +++ b/Source/Game/Networking/Packets/NPCPackets.cs @@ -145,14 +145,14 @@ namespace Game.Networking.Packets public override void Write() { _worldPacket.WritePackedGuid(Vendor); - _worldPacket.WriteUInt8(Reason); + _worldPacket.WriteInt32(Reason); _worldPacket.WriteInt32(Items.Count); foreach (VendorItemPkt item in Items) item.Write(_worldPacket); } - public byte Reason = 0; + public int Reason; public List Items = new(); public ObjectGuid Vendor; } @@ -428,7 +428,6 @@ namespace Game.Networking.Packets data.WriteUInt64(Price); data.WriteInt32(MuID); data.WriteInt32(Type); - data.WriteInt32(Durability); data.WriteInt32(StackCount); data.WriteInt32(Quantity); data.WriteInt32(ExtendedCostID); @@ -446,7 +445,6 @@ namespace Game.Networking.Packets public ItemInstance Item = new(); public int Quantity = -1; public ulong Price; - public int Durability; public int StackCount; public int ExtendedCostID; public int PlayerConditionFailed; diff --git a/Source/Game/Networking/Packets/PartyPackets.cs b/Source/Game/Networking/Packets/PartyPackets.cs index 7e1a3d143..98a2c9a9f 100644 --- a/Source/Game/Networking/Packets/PartyPackets.cs +++ b/Source/Game/Networking/Packets/PartyPackets.cs @@ -965,6 +965,8 @@ namespace Game.Networking.Packets public PingSubjectType Type = PingSubjectType.Max; public uint PinFrameID; public TimeSpan PingDuration; + public uint CreatureID; + public uint SpellOverrideNameID; public SendPingUnit(WorldPacket packet) : base(packet) { } @@ -975,6 +977,14 @@ namespace Game.Networking.Packets Type = (PingSubjectType)_worldPacket.ReadUInt8(); PinFrameID = _worldPacket.ReadUInt32(); PingDuration = TimeSpan.FromMilliseconds(_worldPacket.ReadInt32()); + + bool hasCreatureID = _worldPacket.HasBit(); + bool hasSpellOverrideNameID = _worldPacket.HasBit(); + if (hasCreatureID) + CreatureID = _worldPacket.ReadUInt32(); + + if (hasSpellOverrideNameID) + SpellOverrideNameID = _worldPacket.ReadUInt32(); } } @@ -985,6 +995,8 @@ namespace Game.Networking.Packets public PingSubjectType Type = PingSubjectType.Max; public uint PinFrameID; public TimeSpan PingDuration; + public uint? CreatureID; + public uint? SpellOverrideNameID; public ReceivePingUnit() : base(ServerOpcodes.ReceivePingUnit) { } @@ -995,6 +1007,15 @@ namespace Game.Networking.Packets _worldPacket.WriteUInt8((byte)Type); _worldPacket.WriteUInt32(PinFrameID); _worldPacket.WriteInt32((int)PingDuration.TotalMilliseconds); + _worldPacket.WriteBit(CreatureID.HasValue); + _worldPacket.WriteBit(SpellOverrideNameID.HasValue); + _worldPacket.FlushBits(); + + if (CreatureID.HasValue) + _worldPacket.WriteUInt32(CreatureID.Value); + + if (SpellOverrideNameID.HasValue) + _worldPacket.WriteUInt32(SpellOverrideNameID.Value); } } diff --git a/Source/Game/Networking/Packets/PerksPorgramPacketsCommon.cs b/Source/Game/Networking/Packets/PerksPorgramPacketsCommon.cs index 40267f70e..2683e2f78 100644 --- a/Source/Game/Networking/Packets/PerksPorgramPacketsCommon.cs +++ b/Source/Game/Networking/Packets/PerksPorgramPacketsCommon.cs @@ -15,6 +15,7 @@ namespace Game.Networking.Packets public int Price; public long AvailableUntil; public bool Disabled; + public bool Field_41; public void Write(WorldPacket data) { @@ -28,6 +29,7 @@ namespace Game.Networking.Packets data.WriteInt32(Price); data.WriteInt64(AvailableUntil); data.WriteBit(Disabled); + data.WriteBit(Field_41); data.FlushBits(); } } diff --git a/Source/Game/Networking/Packets/SpellPackets.cs b/Source/Game/Networking/Packets/SpellPackets.cs index 7fb395ea4..34f1721f2 100644 --- a/Source/Game/Networking/Packets/SpellPackets.cs +++ b/Source/Game/Networking/Packets/SpellPackets.cs @@ -1155,7 +1155,7 @@ namespace Game.Networking.Packets { Guid = _worldPacket.ReadPackedGuid(); CastID = _worldPacket.ReadPackedGuid(); - MoveMsgID = _worldPacket.ReadUInt16(); + MoveMsgID = _worldPacket.ReadUInt32(); SpellID = _worldPacket.ReadUInt32(); Pitch = _worldPacket.ReadFloat(); Speed = _worldPacket.ReadFloat(); @@ -1170,7 +1170,7 @@ namespace Game.Networking.Packets public ObjectGuid Guid; public ObjectGuid CastID; - public ushort MoveMsgID; + public uint MoveMsgID; public uint SpellID; public float Pitch; public float Speed; @@ -1348,6 +1348,8 @@ namespace Game.Networking.Packets data.WriteInt32(AttackPower); data.WriteInt32(SpellPower); data.WriteUInt32(Armor); + data.WriteInt32(Unknown_1105_1); + data.WriteInt32(Unknown_1105_2); data.WriteBits(PowerData.Count, 9); data.FlushBits(); @@ -1363,6 +1365,8 @@ namespace Game.Networking.Packets int AttackPower; int SpellPower; uint Armor; + int Unknown_1105_1; + int Unknown_1105_2; List PowerData = new(); }