mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
@@ -5379,35 +5379,31 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
|
||||
|
||||
Player* player = m_caster->ToPlayer();
|
||||
if (!player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Maybe player dismissed dead pet or pet despawned?
|
||||
bool hadPet = true;
|
||||
|
||||
if (!player->GetPet())
|
||||
Pet* pet = player->GetPet();
|
||||
if (!pet)
|
||||
{
|
||||
// Position passed to SummonPet is irrelevant with current implementation,
|
||||
// pet will be relocated without using these coords in Pet::LoadPetFromDB
|
||||
player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET);
|
||||
hadPet = false;
|
||||
player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0s, damage);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends
|
||||
Pet* pet = player->GetPet(); // Attempt to get current pet
|
||||
if (!pet || pet->IsAlive())
|
||||
return;
|
||||
|
||||
// If player did have a pet before reviving, teleport it
|
||||
if (hadPet)
|
||||
if (pet->IsAlive())
|
||||
{
|
||||
// Reposition the pet's corpse before reviving so as not to grab aggro
|
||||
// We can use a different, more accurate version of GetClosePoint() since we have a pet
|
||||
float x, y, z; // Will be used later to reposition the pet if we have one
|
||||
player->GetClosePoint(x, y, z, pet->GetCombatReach(), PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
pet->NearTeleportTo(x, y, z, player->GetOrientation());
|
||||
pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
|
||||
return;
|
||||
}
|
||||
|
||||
// Reposition the pet's corpse before reviving so as not to grab aggro
|
||||
// We can use a different, more accurate version of GetClosePoint() since we have a pet
|
||||
float x, y, z; // Will be used later to reposition the pet if we have one
|
||||
player->GetClosePoint(x, y, z, pet->GetCombatReach(), PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
pet->NearTeleportTo(x, y, z, player->GetOrientation());
|
||||
pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
|
||||
pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);
|
||||
pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
pet->setDeathState(ALIVE);
|
||||
|
||||
Reference in New Issue
Block a user