mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[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:
parent
de66f32882
commit
f9bcfa3a89
13 changed files with 138 additions and 125 deletions
|
|
@ -614,7 +614,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||
|
||||
if( free_slot > 0 && free_slot <= GetPlayer()->m_stableSlots)
|
||||
{
|
||||
_player->RemovePet(pet,PetSaveMode(free_slot));
|
||||
pet->Unsummon(PetSaveMode(free_slot), _player);
|
||||
SendStableResult(STABLE_SUCCESS_STABLE);
|
||||
}
|
||||
else
|
||||
|
|
@ -678,7 +678,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
|||
|
||||
// delete dead pet
|
||||
if(pet)
|
||||
_player->RemovePet(pet,PET_SAVE_AS_DELETED);
|
||||
pet->Unsummon(PET_SAVE_AS_DELETED, _player);
|
||||
|
||||
Pet *newpet = new Pet(HUNTER_PET);
|
||||
if(!newpet->LoadPetFromDB(_player,creature_id,petnumber))
|
||||
|
|
@ -790,7 +790,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
|||
}
|
||||
|
||||
// move alive pet to slot or delete dead pet
|
||||
_player->RemovePet(pet,pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED);
|
||||
pet->Unsummon(pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED, _player);
|
||||
|
||||
// summon unstabled pet
|
||||
Pet *newpet = new Pet;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue