Skip to content

Commit

Permalink
[10735] Fixed spell 51420 work by use recently added protector pets a…
Browse files Browse the repository at this point in the history
…s expected.

Thanks to NoFantasy for problem research (and prev. new pet type adding case research aslo) ;)
  • Loading branch information
VladimirMangos committed Nov 18, 2010
1 parent f032911 commit b040738
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/game/SpellEffects.cpp
Expand Up @@ -1541,13 +1541,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
return;

if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;

// Not expecting any MINI_PET here, the ones used for related quests are
// fighting "companions" (effMiscValueB 387). Needs to be corrected.
Pet* pPet = ((Player*)m_caster)->GetMiniPet();

// only spell related protector pets exist currently
Pet* pPet = m_caster->GetProtectorPet();
if (!pPet)
return;

Expand Down
15 changes: 12 additions & 3 deletions src/game/Unit.cpp
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/game/Unit.h
Expand Up @@ -1532,6 +1532,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
void RemoveGuardian(Pet* pet);
void RemoveGuardians();
Pet* FindGuardianWithEntry(uint32 entry);
Pet* GetProtectorPet(); // expected single case in guardian list

bool isCharmed() const { return !GetCharmerGuid().IsEmpty(); }

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10734"
#define REVISION_NR "10735"
#endif // __REVISION_NR_H__

0 comments on commit b040738

Please sign in to comment.