diff options
| author | MrSmite <mrsmite@att.net> | 2013-11-11 13:22:41 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-11-11 13:22:41 +0100 |
| commit | 79a2d6b7fc9e516435ff6e035ad869aad1cae876 (patch) | |
| tree | a367038690905de18e66e188da6adb16ce299643 /src/server/game/Entities | |
| parent | 65cd07a288267861c684fe3e27bb6bc51f190d89 (diff) | |
Core/Spells: Fixed Revive Pet to revive the pet near the owner
Closes #11196
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Pet/Pet.cpp | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 8dade972180..b019cd7e423 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -178,17 +178,6 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c if (!Create(guid, map, owner->GetPhaseMask(), petEntry, petId)) return false; - float px, py, pz; - owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); - Relocate(px, py, pz, owner->GetOrientation()); - - if (!IsPositionValid()) - { - TC_LOG_ERROR("entities.pet", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", - GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); - return false; - } - setPetType(petType); setFaction(owner->getFaction()); SetUInt32Value(UNIT_CREATED_BY_SPELL, summonSpellId); @@ -196,6 +185,17 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c CreatureTemplate const* cinfo = GetCreatureTemplate(); if (cinfo->type == CREATURE_TYPE_CRITTER) { + float px, py, pz; + owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); + Relocate(px, py, pz, owner->GetOrientation()); + + if (!IsPositionValid()) + { + TC_LOG_ERROR("entities.pet", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); + return false; + } + map->AddToMap(this->ToCreature()); return true; } @@ -242,6 +242,17 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c SynchronizeLevelWithOwner(); + // Set pet's position after setting level, its size depends on it + float px, py, pz; + owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, GetFollowAngle()); + Relocate(px, py, pz, owner->GetOrientation()); + if (!IsPositionValid()) + { + TC_LOG_ERROR("entities.pet", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", + GetGUIDLow(), GetEntry(), GetPositionX(), GetPositionY()); + return false; + } + SetReactState(ReactStates(fields[6].GetUInt8())); SetCanModifyStats(true); |
