Core/Pets: Fixed exploit where warlock can abandon its pet to generate new name (#18606)

This commit is contained in:
xinef1
2016-12-31 20:50:56 +01:00
committed by Shauren
parent 48f30911b9
commit 8ce5712552

View File

@@ -676,20 +676,15 @@ void WorldSession::HandlePetAbandon(WorldPacket& recvData)
// pet/charmed
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
if (pet)
if (pet && pet->ToPet() && pet->ToPet()->getPetType() == HUNTER_PET)
{
if (pet->IsPet())
if (pet->GetGUID() == _player->GetPetGUID())
{
if (pet->GetGUID() == _player->GetPetGUID())
{
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
pet->SetPower(POWER_HAPPINESS, feelty > 50000 ? (feelty-50000) : 0);
}
_player->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
uint32 feelty = pet->GetPower(POWER_HAPPINESS);
pet->SetPower(POWER_HAPPINESS, feelty > 50000 ? (feelty-50000) : 0);
}
else if (pet->GetGUID() == _player->GetCharmGUID())
_player->StopCastingCharm();
_player->RemovePet((Pet*)pet, PET_SAVE_AS_DELETED);
}
}