*Remove aura type by caster in some cases. New function RemoveAuraTypeByCaster.

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-03-13 17:25:46 -06:00
1 parent 7c33373289
commit 7dd699c076
6 files changed
+47 -28

No files matched your search

+38 -19
View File
@@ -535,6 +535,26 @@ void Unit::RemoveSpellsCausingAura(AuraType auraType)
}
}
void Unit::RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID)
{
if (auraType >= TOTAL_AURAS) return;
AuraList::iterator iter, next;
for(iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); ++iter)
{
next = iter;
++next;
if (*iter)
{
RemoveAurasByCasterSpell((*iter)->GetId(), casterGUID);
if (!m_modAuras[auraType].empty())
next = m_modAuras[auraType].begin();
else
return;
}
}
}
void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
{
if(!(m_interruptMask & flag))
@@ -4454,6 +4474,24 @@ void Unit::RemoveAura(uint32 spellId, uint32 effindex, Aura* except)
}
}
void Unit::RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID)
{
for(int k = 0; k < 3; ++k)
{
spellEffectPair spair = spellEffectPair(spellId, k);
for (AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
{
if (iter->second->GetCasterGUID() == casterGUID)
{
RemoveAura(iter);
iter = m_Auras.upper_bound(spair); // overwrite by more appropriate
}
else
++iter;
}
}
}
void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler)
{
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
@@ -4596,25 +4634,6 @@ void Unit::RemoveAurasDueToSpell(uint32 spellId, Aura* except)
RemoveAura(spellId,i,except);
}
void Unit::RemoveAurasDueToCasterSpell(uint32 spellId, uint64 guid)
{
for (int k=0; k < 3; ++k)
{
spellEffectPair spair = spellEffectPair(spellId, k);
for (AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair);)
{
if (iter->second->GetCasterGUID() == guid)
{
RemoveAura(iter);
break;
//iter = m_Auras.upper_bound(spair); // overwrite by more appropriate
}
else
++iter;
}
}
}
void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
{
for (int k=0; k < 3; ++k)