Skip to content

Commit

Permalink
Fix Warlock pet abandon exploit
Browse files Browse the repository at this point in the history
Warlocks were able to remove their current demon from the database and acquire a fresh one by calling PetAbandon() function.
Demon had only initial spells and newly generated name.

Abandon handler now works as expected and dismisses demons instead.

For reference:
http://wowprogramming.com/docs/api/PetAbandon
  • Loading branch information
Warlockbugs authored and Fabi committed Jan 15, 2017
1 parent a070ab3 commit 1e53f24
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/game/PetHandler.cpp
Expand Up @@ -641,20 +641,20 @@ void WorldSession::HandlePetAbandon(WorldPacket& recv_data)
// pet/charmed
if (Unit* petUnit = _player->GetMap()->GetUnit(guid))
{
if (!petUnit ||
petUnit->GetOwnerGuid() != _player->GetObjectGuid() || !petUnit->GetCharmInfo())
if (petUnit->GetOwnerGuid() != _player->GetObjectGuid() || !petUnit->GetCharmInfo())
return;

Creature* petCreature = petUnit->GetTypeId() == TYPEID_UNIT ? static_cast<Creature*>(petUnit) : nullptr;
Pet* pet = (petCreature && petCreature->IsPet()) ? static_cast<Pet*>(petUnit) : nullptr;

if (pet)
{
// POWER_HAPPINESS unusued in 4.x.x
//if (pet->GetObjectGuid() == _player->GetPetGuid())
// pet->ModifyPower(POWER_HAPPINESS, -50000);

pet->Unsummon(PET_SAVE_AS_DELETED, _player);
// Permanently abandon pet
if (pet->getPetType() == HUNTER_PET)
pet->Unsummon(PET_SAVE_AS_DELETED, _player);
// Simply dismiss
else
petUnit->SetDeathState(CORPSE);
}
else if (petUnit->GetObjectGuid() == _player->GetCharmGuid())
{
Expand Down

0 comments on commit 1e53f24

Please sign in to comment.