[10739] Cleanup pet remove code and some fixes.

* Merge Player::RemovePet and Pet::Remove function code to Pet::Unsummon
  This let be sure that in all cases all required steps doen. For example this fix
  creature's guardians propertly remove from guardians list.
* Add new pet save mode PET_SAVE_REAGENTS as replacement PET_SAVE_NOT_IN_SLOT+true-arg stable pair in old function args
  This will avoid use reagent save arg with wrong different save modes.
* Fixed recently added code with absent check for re-summon protector pet call.
This commit is contained in:
VladimirMangos 2010-11-19 02:07:14 +03:00
parent de66f32882
commit f9bcfa3a89
13 changed files with 138 additions and 125 deletions

View file

@ -144,7 +144,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
{
Pet* p = (Pet*)pet;
if(p->getPetType() == HUNTER_PET)
_player->RemovePet(p,PET_SAVE_AS_DELETED);
p->Unsummon(PET_SAVE_AS_DELETED, _player);
else
//dismissing a summoned pet is like killing them (this prevents returning a soulshard...)
p->SetDeathState(CORPSE);
@ -552,7 +552,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
pet->SetPower(POWER_HAPPINESS ,(feelty-50000) > 0 ?(feelty-50000) : 0);
}
_player->RemovePet((Pet*)pet,PET_SAVE_AS_DELETED);
((Pet*)pet)->Unsummon(PET_SAVE_AS_DELETED, _player);
}
else if (pet->GetObjectGuid() == _player->GetCharmGuid())
{