aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellAuras.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-27 12:53:27 -0600
committermegamage <none@none>2009-02-27 12:53:27 -0600
commitadb19df4749ed0a9293a7c845c3883f02d093f17 (patch)
treec949ad91aaf14f293a1c66d3a524150f295870e7 /src/game/SpellAuras.cpp
parent2dbe092d9f90721ddc3cbf30a4b755a5799ee9f8 (diff)
[7349] Implement spell cast depenences from area/quest.aura state store in new table `spell_area`. Author: VladimirMangos
* It allow store requirenments: area, active or rewarded quest (until possible another quest not rewarded), aura present at character, character race/gender. * Listed spell can marked as auto-casted when fit requirents. In this case spell requirements checked at zone/subzone update (and then resurraction also), quest start/reward, dummy aura apply. * Old hardcoded lines for similar check removed from sources and required DB support for work now. --HG-- branch : trunk
Diffstat (limited to 'src/game/SpellAuras.cpp')
-rw-r--r--src/game/SpellAuras.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index d31ec2ff553..49cd9426f1c 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1894,6 +1894,22 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE);
return;
}
+
+ // some auras applied at aura apply
+ if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER)
+ {
+ SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId());
+ if(saBounds.first != saBounds.second)
+ {
+ uint32 zone = m_target->GetZoneId();
+ uint32 area = m_target->GetAreaId();
+
+ for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
+ if(itr->second->autocast && itr->second->IsFitToRequirements((Player*)m_target,zone,area))
+ if( !m_target->HasAura(itr->second->spellId,0) )
+ m_target->CastSpell(m_target,itr->second->spellId,true);
+ }
+ }
}
// AT REMOVE
else
@@ -1977,6 +1993,21 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
}
+
+ // some auras remove at aura remove
+ if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER)
+ {
+ SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId());
+ if(saBounds.first != saBounds.second)
+ {
+ uint32 zone = m_target->GetZoneId();
+ uint32 area = m_target->GetAreaId();
+
+ for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
+ if(!itr->second->IsFitToRequirements((Player*)m_target,zone,area))
+ m_target->RemoveAurasDueToSpell(itr->second->spellId);
+ }
+ }
}
// AT APPLY & REMOVE