Fixed previous commit. Now elemental is despawned when totem is replaced.

--HG--
branch : trunk
This commit is contained in:
Astellar
2010-01-05 02:42:40 +03:00
parent 51d0e0fa8c
commit a4895ce876
2 changed files with 14 additions and 12 deletions

View File

@@ -9039,8 +9039,22 @@ void Unit::SetMinion(Minion *minion, bool apply)
m_Controlled.erase(minion);
if (minion->IsGuardianPet())
{
if (GetPetGUID() == minion->GetGUID())
SetPetGUID(0);
}
else if (minion->isTotem())
{
// All summoned by totem minions must disappear when it is removed.
if (const SpellEntry* spInfo = sSpellStore.LookupEntry(((Totem*)minion)->GetSpell()))
for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spInfo->Effect[i] != SPELL_EFFECT_SUMMON)
continue;
this->RemoveAllMinionsByEntry(spInfo->EffectMiscValue[i]);
}
}
if (GetTypeId() == TYPEID_PLAYER)
{