[9087] Fixes in pet unsummons

* Not unsummon warlock pets at logout.
* Prevent overwrite current saved pet at save secondary pet (with temporary unsummoned first).
  This possible at arena for example.
* Not fixed: in char list at login pet don't must be show with character if character saved at mount in game.
  Not critical and maybe not need fix as feature ;)
This commit is contained in:
VladimirMangos 2009-12-30 21:49:54 +03:00
parent 468295392d
commit 305b54d242
2 changed files with 9 additions and 20 deletions

View file

@ -16860,7 +16860,14 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
if(!pet)
pet = GetPet();
if(returnreagent && (pet || m_temporaryUnsummonedPetNumber))
if(!pet || pet->GetOwnerGUID()!=GetGUID())
return;
// not save secondary permanent pet as current
if (pet && m_temporaryUnsummonedPetNumber != pet->GetCharmInfo()->GetPetNumber() && mode == PET_SAVE_AS_CURRENT)
mode = PET_SAVE_NOT_IN_SLOT;
if(returnreagent && pet && mode != PET_SAVE_AS_CURRENT)
{
//returning of reagents only for players, so best done here
uint32 spellId = pet ? pet->GetUInt32Value(UNIT_CREATED_BY_SPELL) : m_oldpetspell;
@ -16883,12 +16890,8 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
}
}
}
m_temporaryUnsummonedPetNumber = 0;
}
if(!pet || pet->GetOwnerGUID()!=GetGUID())
return;
// only if current pet in slot
switch(pet->getPetType())
{
@ -16906,20 +16909,6 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
pet->CombatStop();
if(returnreagent)
{
switch(pet->GetEntry())
{
//warlock pets except imp are removed(?) when logging out
case 1860:
case 1863:
case 417:
case 17252:
mode = PET_SAVE_NOT_IN_SLOT;
break;
}
}
pet->SavePetToDB(mode);
pet->AddObjectToRemoveList();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9086"
#define REVISION_NR "9087"
#endif // __REVISION_NR_H__