[10847] Unsummon guardians at second item use for items without cooldown.

This commit is contained in:
VladimirMangos 2010-12-09 14:26:26 +03:00
parent e1b243f375
commit 4e72ead2fb
2 changed files with 15 additions and 12 deletions

View file

@ -4617,23 +4617,26 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
PetType petType = propEntry->Title == UNITNAME_SUMMON_TITLE_COMPANION ? PROTECTOR_PET : GUARDIAN_PET;
// protectors allowed only in single amount
if (petType == PROTECTOR_PET)
// second cast unsummon guardian(s) (guardians without like functionality have cooldown > spawn time)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
Pet* old_protector = m_caster->GetProtectorPet();
// for same pet just despawn
if (old_protector && old_protector->GetEntry() == pet_entry)
bool found = false;
// including protector
while (Pet* old_summon = m_caster->FindGuardianWithEntry(pet_entry))
{
old_protector->Unsummon(PET_SAVE_AS_DELETED, m_caster);
return;
old_summon->Unsummon(PET_SAVE_AS_DELETED, m_caster);
found = true;
}
// despawn old pet before summon new
if (old_protector)
old_protector->Unsummon(PET_SAVE_AS_DELETED, m_caster);
if (found)
return;
}
// protectors allowed only in single amount
if (petType = PROTECTOR_PET)
if (Pet* old_protector = m_caster->GetProtectorPet())
old_protector->Unsummon(PET_SAVE_AS_DELETED, m_caster);
// in another case summon new
uint32 level = m_caster->getLevel();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10846"
#define REVISION_NR "10847"
#endif // __REVISION_NR_H__