aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-13 17:25:46 -0600
committermegamage <none@none>2009-03-13 17:25:46 -0600
commit7dd699c076b5ff212b819c7b9dcf5707958f9be5 (patch)
tree11ec1a5bf909434c83056d6dbb0d321d7185ba80 /src
parent7c33373289e236520d5150476cbe30ef42045153 (diff)
*Remove aura type by caster in some cases. New function RemoveAuraTypeByCaster.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Player.cpp4
-rw-r--r--src/game/Player.h3
-rw-r--r--src/game/Spell.cpp4
-rw-r--r--src/game/SpellEffects.cpp4
-rw-r--r--src/game/Unit.cpp57
-rw-r--r--src/game/Unit.h3
6 files changed, 47 insertions, 28 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 3ed59445d88..78ac6dc3958 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -19129,8 +19129,8 @@ void Player::StopCastingBindSight()
{
if (WorldObject* fTarget = GetFarsightTarget())
{
- if (fTarget->isType(TYPEMASK_PLAYER | TYPEMASK_UNIT))
- ((Unit*)fTarget)->RemoveSpellsCausingAura(SPELL_AURA_BIND_SIGHT);
+ if (fTarget->isType(TYPEMASK_UNIT))
+ ((Unit*)fTarget)->RemoveAuraTypeByCaster(SPELL_AURA_BIND_SIGHT, GetGUID());
}
}
diff --git a/src/game/Player.h b/src/game/Player.h
index 53dcf84d5b5..0003c6d85bc 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -914,10 +914,9 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetViewport(uint64 guid, bool movable);
void StopCastingCharm() { Uncharm(); }
- void StopBindSight();
+ void StopCastingBindSight();
WorldObject* GetFarsightTarget() const;
void ClearFarsight();
- void StopCastingBindSight();
void SetFarsightTarget(WorldObject* target);
// Controls if vision is currently on farsight object, updated in FAR_SIGHT opcode
void SetFarsightVision(bool apply) { m_farsightVision = apply; }
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 9f5ed2a4e02..04310f2c6c8 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2141,11 +2141,11 @@ void Spell::cancel()
{
Unit* unit = m_caster->GetGUID()==(*ihit).targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID);
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);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 32aeb1a7968..d7e236b4be6 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -418,7 +418,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if( (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && ((*i)->GetSpellProto()->SpellFamilyFlags & 4) &&
(*i)->GetCasterGUID()==m_caster->GetGUID() )
{
- unitTarget->RemoveAurasDueToCasterSpell((*i)->GetId(), m_caster->GetGUID());
+ unitTarget->RemoveAurasByCasterSpell((*i)->GetId(), m_caster->GetGUID());
break;
}
}
@@ -2437,7 +2437,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
}
}
addhealth += tickheal * tickcount;
- unitTarget->RemoveAurasDueToCasterSpell(targetAura->GetId(), targetAura->GetCasterGUID());
+ unitTarget->RemoveAurasByCasterSpell(targetAura->GetId(), targetAura->GetCasterGUID());
//addhealth += tickheal * tickcount;
//addhealth = caster->SpellHealingBonus(m_spellInfo, addhealth,HEAL, unitTarget);
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index d8c4d3bb16a..886020459b1 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index f73a5386aef..d3455d83baa 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1127,7 +1127,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveSingleAuraFromStack(uint32 spellId, uint32 effindex);
void RemoveAurasDueToSpell(uint32 spellId, Aura* except = NULL);
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 RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToSpellByCancel(uint32 spellId);
@@ -1135,6 +1135,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void RemoveNotOwnSingleTargetAuras();
void RemoveSpellsCausingAura(AuraType auraType);
+ void RemoveAuraTypeByCaster(AuraType auraType, uint64 casterGUID);
void RemoveRankAurasDueToSpell(uint32 spellId);
bool RemoveNoStackAurasDueToAura(Aura *Aur);
void RemoveAurasWithInterruptFlags(uint32 flags, uint32 except = 0);