Fixed Unknown pet names.

Fixed Pet's not having a valid position.
This commit is contained in:
hondacrx
2017-07-05 12:11:54 -04:00
parent c2847a7278
commit 50297a11bc
2 changed files with 13 additions and 3 deletions
+10 -1
View File
@@ -178,9 +178,9 @@ namespace Game.Entities
SetFaction(owner.getFaction()); SetFaction(owner.getFaction());
SetUInt32Value(UnitFields.CreatedBySpell, summonSpellId); SetUInt32Value(UnitFields.CreatedBySpell, summonSpellId);
float px, py, pz;
if (IsCritter()) if (IsCritter())
{ {
float px, py, pz;
owner.GetClosePoint(out px, out py, out pz, GetObjectSize(), SharedConst.PetFollowDist, GetFollowAngle()); owner.GetClosePoint(out px, out py, out pz, GetObjectSize(), SharedConst.PetFollowDist, GetFollowAngle());
Relocate(px, py, pz, owner.GetOrientation()); Relocate(px, py, pz, owner.GetOrientation());
@@ -234,6 +234,15 @@ namespace Game.Entities
SynchronizeLevelWithOwner(); 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<byte>(6)); SetReactState((ReactStates)result.Read<byte>(6));
SetCanModifyStats(true); SetCanModifyStats(true);
+3 -2
View File
@@ -499,7 +499,6 @@ namespace Game.Network.Packets
{ {
_worldPacket.WritePackedGuid(UnitGUID); _worldPacket.WritePackedGuid(UnitGUID);
_worldPacket.WriteBit(Allow); _worldPacket.WriteBit(Allow);
_worldPacket.FlushBits();
if (Allow) if (Allow)
{ {
@@ -515,13 +514,15 @@ namespace Game.Network.Packets
_worldPacket.WriteUInt32(Timestamp); _worldPacket.WriteUInt32(Timestamp);
_worldPacket.WriteString(Name); _worldPacket.WriteString(Name);
} }
_worldPacket.FlushBits();
} }
public ObjectGuid UnitGUID; public ObjectGuid UnitGUID;
public bool Allow; public bool Allow;
public bool HasDeclined; public bool HasDeclined;
public DeclinedName DeclinedNames; public DeclinedName DeclinedNames = new DeclinedName();
public uint Timestamp; public uint Timestamp;
public string Name = ""; public string Name = "";
} }