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

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-13 17:25:46 -06:00
parent 7c33373289
commit 7dd699c076
6 changed files with 47 additions and 28 deletions
+2 -2
View File
@@ -19129,8 +19129,8 @@ void Player::StopCastingBindSight()
{ {
if (WorldObject* fTarget = GetFarsightTarget()) if (WorldObject* fTarget = GetFarsightTarget())
{ {
if (fTarget->isType(TYPEMASK_PLAYER | TYPEMASK_UNIT)) if (fTarget->isType(TYPEMASK_UNIT))
((Unit*)fTarget)->RemoveSpellsCausingAura(SPELL_AURA_BIND_SIGHT); ((Unit*)fTarget)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID());
} }
} }
+1 -2
View File
@@ -914,10 +914,9 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetViewport(uint64 guid, bool movable); void SetViewport(uint64 guid, bool movable);
void StopCastingCharm() { Uncharm(); } void StopCastingCharm() { Uncharm(); }
void StopBindSight(); void StopCastingBindSight();
WorldObject* GetFarsightTarget() const; WorldObject* GetFarsightTarget() const;
void ClearFarsight(); void ClearFarsight();
void StopCastingBindSight();
void SetFarsightTarget(WorldObject* target); void SetFarsightTarget(WorldObject* target);
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode // Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
void SetFarsightVision(bool apply) { m_farsightVision = apply; } void SetFarsightVision(bool apply) { m_farsightVision = apply; }
+2 -2
View File
@@ -2141,11 +2141,11 @@ void Spell::cancel()
{ {
Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
if( unit && unit->isAlive() ) if( unit && unit->isAlive() )
unit->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); unit->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
} }
} }
m_caster->RemoveAurasDueToCasterSpell(m_spellInfo->Id, m_caster->GetGUID()); m_caster->RemoveAurasByCasterSpell(m_spellInfo->Id, m_caster->GetGUID());
SendChannelUpdate(0); SendChannelUpdate(0);
SendInterrupted(0); SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED); SendCastResult(SPELL_FAILED_INTERRUPTED);
+2 -2
View File
@@ -418,7 +418,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if( (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && ((*i)->GetSpellProto()->SpellFamilyFlags & 4) && if( (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && ((*i)->GetSpellProto()->SpellFamilyFlags & 4) &&
(*i)->GetCasterGUID()==m_caster->GetGUID() ) (*i)->GetCasterGUID()==m_caster->GetGUID() )
{ {
unitTarget->RemoveAurasDueToCasterSpell((*i)->GetId(), m_caster->GetGUID()); unitTarget->RemoveAurasByCasterSpell((*i)->GetId(), m_caster->GetGUID());
break; break;
} }
} }
@@ -2437,7 +2437,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
} }
} }
addhealth += tickheal * tickcount; addhealth += tickheal * tickcount;
unitTarget->RemoveAurasDueToCasterSpell(targetAura->GetId(), targetAura->GetCasterGUID()); unitTarget->RemoveAurasByCasterSpell(targetAura->GetId(), targetAura->GetCasterGUID());
//addhealth += tickheal * tickcount; //addhealth += tickheal * tickcount;
//addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth,HEAL, unitTarget); //addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth,HEAL, unitTarget);
+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) void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
{ {
if(!(m_interruptMask & flag)) 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) void Unit::RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler)
{ {
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ) 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); 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) void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
{ {
for (int k=0; k < 3; ++k) for (int k=0; k < 3; ++k)
+2 -1
View File
@@ -1127,7 +1127,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex); void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex);
void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL); void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL);
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId); void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
void RemoveAurasDueToCasterSpell(uint32 spellId, uint64 guid); void RemoveAurasByCasterSpell(uint32 spellId, uint64 casterGUID);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler); void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeler);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToSpellByCancel(uint32 spellId); void RemoveAurasDueToSpellByCancel(uint32 spellId);
@@ -1135,6 +1135,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveNotOwnSingleTargetAuras(); void RemoveNotOwnSingleTargetAuras();
void RemoveSpellsCausingAura(AuraType auraType); void RemoveSpellsCausingAura(AuraType auraType);
void RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID);
void RemoveRankAurasDueToSpell(uint32 spellId); void RemoveRankAurasDueToSpell(uint32 spellId);
bool RemoveNoStackAurasDueToAura(Aura *Aur); bool RemoveNoStackAurasDueToAura(Aura *Aur);
void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0); void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0);