[10735] Fixed spell 51420 work by use recently added protector pets as expected.

Thanks to NoFantasy for problem research (and prev. new pet type adding case research aslo) ;)
This commit is contained in:
VladimirMangos 2010-11-18 22:19:51 +03:00
parent 98d19f4d07
commit 876458c6e4
4 changed files with 16 additions and 11 deletions

View file

@ -5909,11 +5909,20 @@ void Unit::RemoveGuardians()
Pet* Unit::FindGuardianWithEntry(uint32 entry)
{
// pet guid middle part is entry (and creature also)
// and in guardian list must be guardians with same entry _always_
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
if(Pet* pet = GetMap()->GetPet(*itr))
if (pet->GetEntry() == entry)
if (pet->getPetType() == entry)
return pet;
return NULL;
}
Pet* Unit::GetProtectorPet()
{
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
if(Pet* pet = GetMap()->GetPet(*itr))
if (pet->getPetType() == PROTECTOR_PET)
return pet;
return NULL;