From 50297a11bcf5e3c8dd141a6f76bdab0656335a59 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 5 Jul 2017 12:11:54 -0400 Subject: [PATCH] Fixed Unknown pet names. Fixed Pet's not having a valid position. --- Game/Entities/Pet.cs | 11 ++++++++++- Game/Network/Packets/QueryPackets.cs | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Game/Entities/Pet.cs b/Game/Entities/Pet.cs index 26b9cd34e..a68b8bbd6 100644 --- a/Game/Entities/Pet.cs +++ b/Game/Entities/Pet.cs @@ -178,9 +178,9 @@ namespace Game.Entities SetFaction(owner.getFaction()); SetUInt32Value(UnitFields.CreatedBySpell, summonSpellId); + float px, py, pz; if (IsCritter()) { - float px, py, pz; owner.GetClosePoint(out px, out py, out pz, GetObjectSize(), SharedConst.PetFollowDist, GetFollowAngle()); Relocate(px, py, pz, owner.GetOrientation()); @@ -234,6 +234,15 @@ namespace Game.Entities SynchronizeLevelWithOwner(); + // Set pet's position after setting level, its size depends on it + owner.GetClosePoint(out px, out py, out pz, GetObjectSize(), SharedConst.PetFollowDist, GetFollowAngle()); + Relocate(px, py, pz, owner.GetOrientation()); + if (!IsPositionValid()) + { + Log.outError(LogFilter.Pet, "Pet ({0}, entry {1}) not loaded. Suggested coordinates isn't valid (X: {2} Y: {3})", GetGUID().ToString(), GetEntry(), GetPositionX(), GetPositionY()); + return false; + } + SetReactState((ReactStates)result.Read(6)); SetCanModifyStats(true); diff --git a/Game/Network/Packets/QueryPackets.cs b/Game/Network/Packets/QueryPackets.cs index b42eacf4f..a3c30180b 100644 --- a/Game/Network/Packets/QueryPackets.cs +++ b/Game/Network/Packets/QueryPackets.cs @@ -499,7 +499,6 @@ namespace Game.Network.Packets { _worldPacket.WritePackedGuid(UnitGUID); _worldPacket.WriteBit(Allow); - _worldPacket.FlushBits(); if (Allow) { @@ -515,13 +514,15 @@ namespace Game.Network.Packets _worldPacket.WriteUInt32(Timestamp); _worldPacket.WriteString(Name); } + + _worldPacket.FlushBits(); } public ObjectGuid UnitGUID; public bool Allow; public bool HasDeclined; - public DeclinedName DeclinedNames; + public DeclinedName DeclinedNames = new DeclinedName(); public uint Timestamp; public string Name = ""; }