aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsilinoron <none@none>2010-08-23 15:13:20 -0700
committersilinoron <none@none>2010-08-23 15:13:20 -0700
commit8bebc56b8f4ca872198e7d44c6efbdb8e24e2d8f (patch)
tree72b7a5d8919ada388368d2da9759e4021329592a /src
parentc09528a6bf1cee9dbbf45bfd564f52a3a4e4a1b7 (diff)
parent07a3a1254b78a42a7836efee99dc3d821c726d28 (diff)
merge
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp32
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp48
-rw-r--r--src/server/game/Scripting/ScriptMgr.h31
-rw-r--r--src/server/game/Spells/Auras/SpellAuraDefines.h12
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp19
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h13
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp128
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.h16
-rw-r--r--src/server/game/Spells/Spell.cpp2
-rw-r--r--src/server/game/Spells/SpellScript.cpp272
-rw-r--r--src/server/game/Spells/SpellScript.h239
-rw-r--r--src/server/scripts/Examples/example_spell.cpp267
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp6
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp18
-rw-r--r--src/server/scripts/Spells/spell_dk.cpp18
-rw-r--r--src/server/scripts/Spells/spell_druid.cpp6
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp13
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp50
-rw-r--r--src/server/scripts/Spells/spell_mage.cpp18
-rw-r--r--src/server/scripts/Spells/spell_paladin.cpp24
-rw-r--r--src/server/scripts/Spells/spell_priest.cpp12
-rw-r--r--src/server/scripts/Spells/spell_quest.cpp12
-rw-r--r--src/server/scripts/Spells/spell_rogue.cpp24
-rw-r--r--src/server/scripts/Spells/spell_shaman.cpp12
-rw-r--r--src/server/scripts/Spells/spell_warlock.cpp18
-rw-r--r--src/server/scripts/Spells/spell_warrior.cpp6
26 files changed, 1047 insertions, 269 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 31fce16b114..52915b27f90 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -5103,18 +5103,38 @@ void ObjectMgr::ValidateSpellScripts()
for (SpellScriptsMap::iterator itr = mSpellScripts.begin(); itr != mSpellScripts.end();)
{
SpellEntry const * spellEntry = sSpellStore.LookupEntry(itr->first);
- std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> > spellScripts;
- sScriptMgr.CreateSpellScripts(itr->first, spellScripts);
+ std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> > SpellScriptLoaders;
+ sScriptMgr.CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
SpellScriptsMap::iterator bitr;
itr = mSpellScripts.upper_bound(itr->first);
- for (std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> >::iterator sitr = spellScripts.begin(); sitr != spellScripts.end(); ++sitr)
+ for (std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr)
{
bar.step();
- sitr->first->Register();
- if (!sitr->first->_Validate(spellEntry, sObjectMgr.GetScriptName(sitr->second->second)))
+ SpellScript * spellScript = sitr->first->GetSpellScript();
+ AuraScript * auraScript = sitr->first->GetAuraScript();
+ bool valid = true;
+ if (!spellScript && !auraScript)
+ {
+ sLog.outError("TSCR: Functions GetSpellScript() and GetAuraScript() of script `%s` do not return objects - script skipped", GetScriptName(sitr->second->second));
+ valid = false;
+ }
+ if (spellScript)
+ {
+ spellScript->Register();
+ if (!spellScript->_Validate(spellEntry, sObjectMgr.GetScriptName(sitr->second->second)))
+ valid = false;
+ delete spellScript;
+ }
+ if (auraScript)
+ {
+ auraScript->Register();
+ if (!auraScript->_Validate(spellEntry, sObjectMgr.GetScriptName(sitr->second->second)))
+ valid = false;
+ delete auraScript;
+ }
+ if (!valid)
mSpellScripts.erase(sitr->second);
- delete sitr->first;
}
}
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index c6c319f89fd..a72ce595c7a 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -148,8 +148,7 @@ ScriptMgr::~ScriptMgr()
SCR_REG_LST(T).clear();
// Clear scripts for every script type.
- SCR_CLEAR(SpellHandlerScript);
- SCR_CLEAR(AuraHandlerScript);
+ SCR_CLEAR(SpellScriptLoader);
SCR_CLEAR(ServerScript);
SCR_CLEAR(WorldScript);
SCR_CLEAR(FormulaScript);
@@ -296,42 +295,50 @@ void ScriptMgr::CreateSpellScripts(uint32 spell_id, std::list<SpellScript *> & s
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
{
- SpellHandlerScript* tmpscript = ScriptRegistry<SpellHandlerScript>::GetScriptById(itr->second);
+ SpellScriptLoader* tmpscript = ScriptRegistry<SpellScriptLoader>::GetScriptById(itr->second);
if (!tmpscript)
continue;
SpellScript* script = tmpscript->GetSpellScript();
if (!script)
- {
- sLog.outError("Spell script %s for spell %u returned a NULL SpellScript pointer!", tmpscript->GetName().c_str(), spell_id);
continue;
- }
script_vector.push_back(script);
}
}
-void ScriptMgr::CreateSpellScripts(uint32 spell_id, std::vector<std::pair<SpellScript *, SpellScriptsMap::iterator> > & script_vector)
+void ScriptMgr::CreateAuraScripts(uint32 spell_id, std::list<AuraScript *> & script_vector)
{
SpellScriptsBounds bounds = sObjectMgr.GetSpellScriptsBounds(spell_id);
- script_vector.reserve(std::distance(bounds.first, bounds.second));
for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
{
- SpellHandlerScript* tmpscript = ScriptRegistry<SpellHandlerScript>::GetScriptById(itr->second);
+ SpellScriptLoader* tmpscript = ScriptRegistry<SpellScriptLoader>::GetScriptById(itr->second);
if (!tmpscript)
continue;
- SpellScript* script = tmpscript->GetSpellScript();
+ AuraScript* script = tmpscript->GetAuraScript();
if (!script)
- {
- sLog.outError("Spell script %s for spell %u returned a NULL SpellScript pointer!", tmpscript->GetName().c_str(), spell_id);
continue;
- }
- script_vector.push_back(std::make_pair(script, itr));
+ script_vector.push_back(script);
+ }
+}
+
+void ScriptMgr::CreateSpellScriptLoaders(uint32 spell_id, std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> > & script_vector)
+{
+ SpellScriptsBounds bounds = sObjectMgr.GetSpellScriptsBounds(spell_id);
+ script_vector.reserve(std::distance(bounds.first, bounds.second));
+
+ for (SpellScriptsMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
+ {
+ SpellScriptLoader* tmpscript = ScriptRegistry<SpellScriptLoader>::GetScriptById(itr->second);
+ if (!tmpscript)
+ continue;
+
+ script_vector.push_back(std::make_pair(tmpscript, itr));
}
}
@@ -1154,16 +1161,10 @@ void ScriptMgr::OnGuildDisband(Guild *guild)
FOREACH_SCRIPT(GuildScript)->OnDisband(guild);
}
-SpellHandlerScript::SpellHandlerScript(const char* name)
- : ScriptObject(name)
-{
- ScriptMgr::ScriptRegistry<SpellHandlerScript>::AddScript(this);
-}
-
-AuraHandlerScript::AuraHandlerScript(const char* name)
+SpellScriptLoader::SpellScriptLoader(const char* name)
: ScriptObject(name)
{
- ScriptMgr::ScriptRegistry<AuraHandlerScript>::AddScript(this);
+ ScriptMgr::ScriptRegistry<SpellScriptLoader>::AddScript(this);
}
ServerScript::ServerScript(const char* name)
@@ -1312,8 +1313,7 @@ template<class TScript> std::map<uint32, TScript*> ScriptMgr::ScriptRegistry<TSc
template<class TScript> uint32 ScriptMgr::ScriptRegistry<TScript>::_scriptIdCounter = 0;
// Specialize for each script type class like so:
-template class ScriptMgr::ScriptRegistry<SpellHandlerScript>;
-template class ScriptMgr::ScriptRegistry<AuraHandlerScript>;
+template class ScriptMgr::ScriptRegistry<SpellScriptLoader>;
template class ScriptMgr::ScriptRegistry<ServerScript>;
template class ScriptMgr::ScriptRegistry<WorldScript>;
template class ScriptMgr::ScriptRegistry<FormulaScript>;
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index c8baeddf48d..2bf023babf8 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -42,6 +42,7 @@ class Creature;
class CreatureAI;
class InstanceScript;
class SpellScript;
+class AuraScript;
class Quest;
class Item;
class GameObject;
@@ -180,32 +181,20 @@ template<class TObject> class UpdatableScript
virtual void OnUpdate(TObject* /*obj*/, uint32 /*diff*/) { }
};
-class SpellHandlerScript : public ScriptObject
+class SpellScriptLoader : public ScriptObject
{
protected:
- SpellHandlerScript(const char* name);
+ SpellScriptLoader(const char* name);
public:
bool IsDatabaseBound() const { return true; }
// Should return a fully valid SpellScript pointer.
- virtual SpellScript* GetSpellScript() const = 0;
-};
-
-class AuraHandlerScript : public ScriptObject
-{
- protected:
-
- AuraHandlerScript(const char* name);
-
- public:
-
- bool IsDatabaseBound() const { return true; }
-
+ virtual SpellScript* GetSpellScript() const { return NULL; };
// Should return a fully valid AuraScript pointer.
- // virtual AuraScript* GetAuraScript() const = 0;
+ virtual AuraScript* GetAuraScript() const { return NULL; };
};
class ServerScript : public ScriptObject
@@ -742,15 +731,11 @@ class ScriptMgr
void IncrementScriptCount() { ++_scriptCount; }
uint32 GetScriptCount() const { return _scriptCount; }
- public: /* SpellHandlerScript */
+ public: /* SpellScriptLoader */
void CreateSpellScripts(uint32 spell_id, std::list<SpellScript*>& script_vector);
- void CreateSpellScripts(uint32 spell_id, std::vector<std::pair<SpellScript*, SpellScriptsMap::iterator> >& script_vector);
-
- public: /* AuraHandlerScript */
-
- // void CreateAuraScripts(uint32 spell_id, std::list<AuraScript*>& script_vector);
- // void CreateAuraScripts(uint32 spell_id, std::vector<std::pair<AuraScript*, SpellScriptsMap::iterator> >& script_vector);
+ void CreateAuraScripts(uint32 spell_id, std::list<AuraScript*>& script_vector);
+ void CreateSpellScriptLoaders(uint32 spell_id, std::vector<std::pair<SpellScriptLoader*, SpellScriptsMap::iterator> >& script_vector);
public: /* ServerScript */
diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h
index 4e36798705c..aa4a6ce0515 100644
--- a/src/server/game/Spells/Auras/SpellAuraDefines.h
+++ b/src/server/game/Spells/Auras/SpellAuraDefines.h
@@ -35,6 +35,18 @@ enum AURA_FLAGS
AFLAG_NEGATIVE = 0x80
};
+enum AuraEffectHandleModes
+{
+ AURA_EFFECT_HANDLE_DEFAULT = 0x0,
+ AURA_EFFECT_HANDLE_REAL = 0x01,
+ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT = 0x02,
+ AURA_EFFECT_HANDLE_CHANGE_AMOUNT = 0x04,
+ AURA_EFFECT_HANDLE_STAT = 0x08,
+ AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL),
+ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL),
+ AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK),
+};
+
//m_schoolAbsorb
enum DAMAGE_ABSORB_TYPE
{
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 4c24aa16d24..6605d45d846 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -737,6 +737,8 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
DoneActualBenefit *= caster->CalculateLevelPenalty(GetSpellProto());
amount += (int32)DoneActualBenefit;
}
+
+ GetBase()->CallScriptEffectCalcAmountHandlers(const_cast<AuraEffect const *>(this), amount, m_canBeRecalculated);
amount *= GetBase()->GetStackAmount();
return amount;
}
@@ -787,6 +789,8 @@ void AuraEffect::CalculatePeriodic(Unit * caster, bool create)
break;
}
+ GetBase()->CallScriptEffectCalcPeriodicHandlers(const_cast<AuraEffect const *>(this), m_isPeriodic, m_amplitude);
+
if (!m_isPeriodic)
return;
@@ -907,6 +911,7 @@ void AuraEffect::CalculateSpellMod()
default:
break;
}
+ GetBase()->CallScriptEffectCalcSpellModHandlers(const_cast<AuraEffect const *>(this), m_spellmod);
}
void AuraEffect::ChangeAmount(int32 newAmount, bool mark)
@@ -946,7 +951,14 @@ void AuraEffect::HandleEffect(AuraApplication const * aurApp, uint8 mode, bool a
if (mode & AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK)
ApplySpellMod(aurApp->GetTarget(), apply);
- (*this.*AuraEffectHandler [GetAuraType()])(aurApp, mode, apply);
+ bool prevented = false;
+ if (apply)
+ prevented = GetBase()->CallScriptEffectApplyHandlers(const_cast<AuraEffect const *>(this), aurApp, (AuraEffectHandleModes)mode);
+ else
+ prevented = GetBase()->CallScriptEffectRemoveHandlers(const_cast<AuraEffect const *>(this), aurApp, (AuraEffectHandleModes)mode);
+
+ if (!prevented)
+ (*this.*AuraEffectHandler [GetAuraType()])(aurApp, mode, apply);
}
void AuraEffect::HandleEffect(Unit * target, uint8 mode, bool apply)
@@ -1203,6 +1215,7 @@ void AuraEffect::UpdatePeriodic(Unit * caster)
default:
break;
}
+ GetBase()->CallScriptEffectUpdatePeriodicHandlers(this);
}
bool AuraEffect::IsPeriodicTickCrit(Unit * target, Unit const * caster) const
@@ -1244,6 +1257,10 @@ void AuraEffect::PeriodicTick(Unit * target, Unit * caster) const
return;
}
+ bool prevented = GetBase()->CallScriptEffectPeriodicHandlers(const_cast<AuraEffect const *>(this), GetBase()->GetApplicationOfTarget(target->GetGUID()));
+ if (prevented)
+ return;
+
switch(GetAuraType())
{
case SPELL_AURA_PERIODIC_DAMAGE:
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index bbd1d2499d9..cafe9fa5fb8 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -9,15 +9,6 @@ class Aura;
#include "SpellAuras.h"
-#define AURA_EFFECT_HANDLE_DEFAULT 0
-#define AURA_EFFECT_HANDLE_REAL 0x01
-#define AURA_EFFECT_HANDLE_SEND_FOR_CLIENT 0x02
-#define AURA_EFFECT_HANDLE_CHANGE_AMOUNT 0x04
-#define AURA_EFFECT_HANDLE_STAT 0x08
-#define AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL)
-#define AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL)
-#define AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK)
-
typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const * aurApp, uint8 mode, bool apply) const;
class AuraEffect
@@ -91,11 +82,11 @@ class AuraEffect
int32 const m_baseAmount;
int32 m_amount;
- bool m_canBeRecalculated:1;
+ bool m_canBeRecalculated;
SpellModifier *m_spellmod;
- bool m_isPeriodic:1;
+ bool m_isPeriodic;
int32 m_periodicTimer;
int32 m_amplitude;
uint32 m_tickNumber;
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 9ca2a98fa7c..8738c749d4e 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -34,6 +34,8 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
+#include "ScriptMgr.h"
+#include "SpellScript.h"
AuraApplication::AuraApplication(Unit * target, Unit * caster, Aura * aura, uint8 effMask):
m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE),
@@ -326,6 +328,8 @@ m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellProto->spellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false)
{
+ LoadScripts();
+
if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
@@ -1593,6 +1597,130 @@ void Aura::_DeleteRemovedApplications()
}
}
+void Aura::LoadScripts()
+{
+ sLog.outDebug("Aura::LoadScripts");
+ sScriptMgr.CreateAuraScripts(m_spellProto->Id, m_loadedScripts);
+ for(std::list<AuraScript *>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
+ {
+ if (!(*itr)->_Load(this))
+ {
+ std::list<AuraScript *>::iterator bitr = itr;
+ ++itr;
+ m_loadedScripts.erase(bitr);
+ continue;
+ }
+ (*itr)->Register();
+ ++itr;
+ }
+}
+
+bool Aura::CallScriptEffectApplyHandlers(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode)
+{
+ bool preventDefault = false;
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ (*scritr)->_ResetDefault();
+ std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff, aurApp, mode);
+ }
+ if (!preventDefault)
+ preventDefault = (*scritr)->_IsDefaultActionPrevented((SpellEffIndex)aurEff->GetEffIndex());
+ }
+ return preventDefault;
+}
+
+bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode)
+{
+ bool preventDefault = false;
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ (*scritr)->_ResetDefault();
+ std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff, aurApp, mode);
+ }
+ if (!preventDefault)
+ preventDefault = (*scritr)->_IsDefaultActionPrevented((SpellEffIndex)aurEff->GetEffIndex());
+ }
+ return preventDefault;
+}
+
+bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const * aurEff, AuraApplication const * aurApp)
+{
+ bool preventDefault = false;
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ (*scritr)->_ResetDefault();
+ std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff, aurApp);
+ }
+ if (!preventDefault)
+ preventDefault = (*scritr)->_IsDefaultActionPrevented((SpellEffIndex)aurEff->GetEffIndex());
+ }
+ return preventDefault;
+}
+
+void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff)
+{
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff);
+ }
+ }
+}
+
+void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated)
+{
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->OnEffectCalcAmount.end(), effItr = (*scritr)->OnEffectCalcAmount.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
+ }
+ }
+}
+
+void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude)
+{
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectCalcPeriodic.end(), effItr = (*scritr)->OnEffectCalcPeriodic.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
+ }
+ }
+}
+
+void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const * aurEff, SpellModifier *& spellMod)
+{
+ for(std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
+ {
+ std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->OnEffectCalcSpellMod.end(), effItr = (*scritr)->OnEffectCalcSpellMod.begin();
+ for(; effItr != effEndItr ; ++effItr)
+ {
+ if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
+ (*effItr).Call(*scritr, aurEff, spellMod);
+ }
+ }
+}
+
UnitAura::UnitAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID)
: Aura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID)
{
diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h
index 16fe91c735d..3fa7d3efa83 100644
--- a/src/server/game/Spells/Auras/SpellAuras.h
+++ b/src/server/game/Spells/Auras/SpellAuras.h
@@ -32,6 +32,7 @@ struct ProcTriggerSpell;
class AuraEffect;
class Aura;
class DynamicObject;
+class AuraScript;
// update aura target map every 500 ms instead of every update - reduce amount of grid searcher calls
#define UPDATE_TARGET_MAP_INTERVAL 500
@@ -150,7 +151,7 @@ class Aura
// helpers for aura effects
bool HasEffect(uint8 effIndex) const { return bool(GetEffect(effIndex)); }
bool HasEffectType(AuraType type) const;
- AuraEffect * GetEffect (uint8 effIndex) const { ASSERT (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; }
+ AuraEffect * GetEffect(uint8 effIndex) const { ASSERT (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; }
uint8 GetEffectMask() const { uint8 effMask = 0; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_effects[i]) effMask |= 1<<i; return effMask; }
void RecalculateAmountOfEffects();
void HandleAllEffects(AuraApplication const * aurApp, uint8 mode, bool apply);
@@ -159,12 +160,23 @@ class Aura
ApplicationMap const & GetApplicationMap() {return m_applications;}
const AuraApplication * GetApplicationOfTarget (uint64 const & guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
AuraApplication * GetApplicationOfTarget (uint64 const & guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
- bool IsAppliedOnTarget (uint64 const & guid) const { return m_applications.find(guid) != m_applications.end(); }
+ bool IsAppliedOnTarget(uint64 const & guid) const { return m_applications.find(guid) != m_applications.end(); }
void SetNeedClientUpdateForTargets() const;
void HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply);
bool CanBeAppliedOn(Unit *target);
bool CheckAreaTarget(Unit *target);
+
+ // AuraScript
+ void LoadScripts();
+ bool CallScriptEffectApplyHandlers(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode);
+ bool CallScriptEffectRemoveHandlers(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode);
+ bool CallScriptEffectPeriodicHandlers(AuraEffect const * aurEff, AuraApplication const * aurApp);
+ void CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff);
+ void CallScriptEffectCalcAmountHandlers(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated);
+ void CallScriptEffectCalcPeriodicHandlers(AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude);
+ void CallScriptEffectCalcSpellModHandlers(AuraEffect const * aurEff, SpellModifier *& spellMod);
+ std::list<AuraScript *> m_loadedScripts;
private:
void _DeleteRemovedApplications();
protected:
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index d9395edabfa..64694c502c6 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -7312,7 +7312,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex)
bool preventDefault = false;
for(std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
{
- std::list<SpellScript::EffectHandler>::iterator effEndItr = (*scritr)->EffectHandlers.end(), effItr = (*scritr)->EffectHandlers.begin();
+ std::list<SpellScript::EffectHandler>::iterator effEndItr = (*scritr)->OnEffect.end(), effItr = (*scritr)->OnEffect.begin();
for(; effItr != effEndItr ; ++effItr)
{
// effect execution can be prevented
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index 29a7e6f24ae..c6a577eb6c4 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -126,7 +126,7 @@ std::string _SpellScript::EffectAuraNameCheck::ToString()
}
}
-SpellScript::EffectHandler::EffectHandler(EffectHandlerFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
+SpellScript::EffectHandler::EffectHandler(SpellEffectFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
: _SpellScript::EffectNameCheck(_effName), _SpellScript::EffectHook(_effIndex)
{
pEffectHandlerScript = _pEffectHandlerScript;
@@ -149,7 +149,7 @@ void SpellScript::EffectHandler::Call(SpellScript * spellScript, SpellEffIndex e
bool SpellScript::_Validate(SpellEntry const * entry, const char * scriptname)
{
- for (std::list<EffectHandler>::iterator itr = EffectHandlers.begin(); itr != EffectHandlers.end(); ++itr)
+ for (std::list<EffectHandler>::iterator itr = OnEffect.begin(); itr != OnEffect.end(); ++itr)
{
if (!(*itr).GetAffectedEffectsMask(entry))
{
@@ -284,3 +284,271 @@ void SpellScript::CreateItem(uint32 effIndex, uint32 itemId)
{
m_spell->DoCreateItem(effIndex, itemId);
}
+
+bool AuraScript::_Validate(SpellEntry const * entry, const char * scriptname)
+{
+ for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ for (std::list<EffectApplyHandler>::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ for (std::list<EffectPeriodicHandler>::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ for (std::list<EffectUpdatePeriodicHandler>::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ for (std::list<EffectCalcAmountHandler>::iterator itr = OnEffectCalcAmount.begin(); itr != OnEffectCalcAmount.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ for (std::list<EffectCalcPeriodicHandler>::iterator itr = OnEffectCalcPeriodic.begin(); itr != OnEffectCalcPeriodic.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ for (std::list<EffectCalcSpellModHandler>::iterator itr = OnEffectCalcSpellMod.begin(); itr != OnEffectCalcSpellMod.end(); ++itr)
+ if (!(*itr).GetAffectedEffectsMask(entry))
+ sLog.outError("TSCR: Spell `%u` Effect `%s` of script`%s` did not match dbc effect data - bound handler won't be executed", entry->Id, (*itr).ToString().c_str(), scriptname);
+
+ return _SpellScript::_Validate(entry, scriptname);
+}
+
+AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
+ : _SpellScript::EffectAuraNameCheck(_effName), _SpellScript::EffectHook(_effIndex)
+{
+}
+
+bool AuraScript::EffectBase::CheckEffect(SpellEntry const * spellEntry, uint8 effIndex)
+{
+ return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
+}
+
+std::string AuraScript::EffectBase::ToString()
+{
+ return "Index: " + EffIndexToString() + " AuraName: " +_SpellScript::EffectAuraNameCheck::ToString();
+}
+
+AuraScript::EffectPeriodicHandler::EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
+ : AuraScript::EffectBase(_effIndex, _effName)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+}
+
+void AuraScript::EffectPeriodicHandler::Call(AuraScript * auraScript, AuraEffect const * _aurEff, AuraApplication const * _aurApp)
+{
+ (auraScript->*pEffectHandlerScript)(_aurEff, _aurApp);
+}
+
+AuraScript::EffectUpdatePeriodicHandler::EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
+ : AuraScript::EffectBase(_effIndex, _effName)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+}
+
+void AuraScript::EffectUpdatePeriodicHandler::Call(AuraScript * auraScript, AuraEffect * aurEff)
+{
+ (auraScript->*pEffectHandlerScript)(aurEff);
+}
+
+AuraScript::EffectCalcAmountHandler::EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
+ : AuraScript::EffectBase(_effIndex, _effName)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+}
+
+void AuraScript::EffectCalcAmountHandler::Call(AuraScript * auraScript, AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated)
+{
+ (auraScript->*pEffectHandlerScript)(aurEff, amount, canBeRecalculated);
+}
+
+AuraScript::EffectCalcPeriodicHandler::EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
+ : AuraScript::EffectBase(_effIndex, _effName)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+}
+
+void AuraScript::EffectCalcPeriodicHandler::Call(AuraScript * auraScript, AuraEffect const * aurEff, bool & isPeriodic, int32 & periodicTimer)
+{
+ (auraScript->*pEffectHandlerScript)(aurEff, isPeriodic, periodicTimer);
+}
+
+AuraScript::EffectCalcSpellModHandler::EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName)
+ : AuraScript::EffectBase(_effIndex, _effName)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+}
+
+void AuraScript::EffectCalcSpellModHandler::Call(AuraScript * auraScript, AuraEffect const * aurEff, SpellModifier *& spellMod)
+{
+ (auraScript->*pEffectHandlerScript)(aurEff, spellMod);
+}
+
+AuraScript::EffectApplyHandler::EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode)
+ : AuraScript::EffectBase(_effIndex, _effName)
+{
+ pEffectHandlerScript = _pEffectHandlerScript;
+ mode = _mode;
+}
+
+void AuraScript::EffectApplyHandler::Call(AuraScript * auraScript, AuraEffect const * _aurEff, AuraApplication const * _aurApp, AuraEffectHandleModes _mode)
+{
+ if (_mode & mode)
+ (auraScript->*pEffectHandlerScript)(_aurEff, _aurApp, _mode);
+}
+
+bool AuraScript::_Load(Aura * aura)
+{
+ m_aura = aura;
+ return Load();
+}
+
+SpellEntry const* AuraScript::GetSpellProto() const
+{
+ return m_aura->GetSpellProto();
+}
+
+uint32 AuraScript::GetId() const
+{
+ return m_aura->GetId();
+}
+
+uint64 const& AuraScript::GetCasterGUID() const
+{
+ return m_aura->GetCasterGUID();
+}
+
+Unit* AuraScript::GetCaster() const
+{
+ return m_aura->GetCaster();
+}
+
+WorldObject* AuraScript::GetOwner() const
+{
+ return m_aura->GetOwner();
+}
+
+Unit* AuraScript::GetUnitOwner() const
+{
+ return m_aura->GetUnitOwner();
+}
+
+DynamicObject* AuraScript::GetDynobjOwner() const
+{
+ return m_aura->GetDynobjOwner();
+}
+
+void AuraScript::Remove(uint32 removeMode)
+{
+ m_aura->Remove((AuraRemoveMode)removeMode);
+}
+
+Aura* AuraScript::GetAura() const
+{
+ return m_aura;
+}
+
+AuraObjectType AuraScript::GetType() const
+{
+ return m_aura->GetType();
+}
+
+int32 AuraScript::GetDuration() const
+{
+ return m_aura->GetDuration();
+}
+
+void AuraScript::SetDuration(int32 duration, bool withMods)
+{
+ m_aura->SetDuration(duration, withMods);
+}
+
+void AuraScript::RefreshDuration()
+{
+ m_aura->RefreshDuration();
+}
+
+time_t AuraScript::GetApplyTime() const
+{
+ return m_aura->GetApplyTime();
+}
+
+int32 AuraScript::GetMaxDuration() const
+{
+ return m_aura->GetMaxDuration();
+}
+
+void AuraScript::SetMaxDuration(int32 duration)
+{
+ m_aura->SetMaxDuration(duration);
+}
+
+bool AuraScript::IsExpired() const
+{
+ return m_aura->IsExpired();
+}
+
+bool AuraScript::IsPermanent() const
+{
+ return m_aura->IsPermanent();
+}
+
+uint8 AuraScript::GetCharges() const
+{
+ return m_aura->GetCharges();
+}
+
+void AuraScript::SetCharges(uint8 charges)
+{
+ m_aura->SetCharges(charges);
+}
+
+bool AuraScript::DropCharge()
+{
+ return m_aura->DropCharge();
+}
+
+uint8 AuraScript::GetStackAmount() const
+{
+ return m_aura->GetStackAmount();
+}
+
+void AuraScript::SetStackAmount(uint8 num, bool applied)
+{
+ m_aura->SetStackAmount(num, applied);
+}
+
+bool AuraScript::ModStackAmount(int32 num)
+{
+ return m_aura->ModStackAmount(num);
+}
+
+bool AuraScript::IsPassive() const
+{
+ return m_aura->IsPassive();
+}
+
+bool AuraScript::IsDeathPersistent() const
+{
+ return m_aura->IsDeathPersistent();
+}
+
+bool AuraScript::HasEffect(uint8 effIndex) const
+{
+ return m_aura->HasEffect(effIndex);
+}
+
+AuraEffect* AuraScript::GetEffect(uint8 effIndex) const
+{
+ return m_aura->GetEffect(effIndex);
+}
+
+bool AuraScript::HasEffectType(AuraType type) const
+{
+ return m_aura->HasEffectType(type);
+}
+
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h
index 9c9b4f39df3..57ce2cdde99 100644
--- a/src/server/game/Spells/SpellScript.h
+++ b/src/server/game/Spells/SpellScript.h
@@ -21,20 +21,22 @@
#include "Util.h"
#include "SharedDefines.h"
+#include "SpellAuraDefines.h"
class Unit;
struct SpellEntry;
class SpellScript;
class Spell;
class Aura;
+class AuraEffect;
+struct SpellModifier;
class Creature;
class GameObject;
+class DynamicObject;
class Player;
class Item;
class WorldLocation;
-
-typedef void(SpellScript::*EffectHandlerFnType)(SpellEffIndex);
-typedef void(SpellScript::*HitHandlerFnType)();
+class WorldObject;
#define SPELL_EFFECT_ANY (uint16)-1
#define SPELL_AURA_ANY (uint16)-1
@@ -99,17 +101,20 @@ class SpellScript : public _SpellScript
// internal use classes & functions
// DO NOT OVERRIDE THESE IN SCRIPTS
public:
+ typedef void(SpellScript::*SpellEffectFnType)(SpellEffIndex);
+ typedef void(SpellScript::*SpellHitFnType)();
+
class EffectHandler : public _SpellScript::EffectNameCheck, public _SpellScript::EffectHook
{
public:
- EffectHandler(EffectHandlerFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
+ EffectHandler(SpellEffectFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
std::string ToString();
bool CheckEffect(SpellEntry const * spellEntry, uint8 effIndex);
void Call(SpellScript * spellScript, SpellEffIndex effIndex);
private:
- EffectHandlerFnType pEffectHandlerScript;
+ SpellEffectFnType pEffectHandlerScript;
};
- typedef HitHandlerFnType HitHandler;
+ typedef SpellHitFnType HitHandler;
public:
bool _Validate(SpellEntry const * entry, const char * scriptname);
bool _Load(Spell * spell);
@@ -125,22 +130,23 @@ class SpellScript : public _SpellScript
// SpellScript interface
// hooks to which you can attach your functions
//
- // List of functions registered by EffectHandlerFn
- // allows more than one hook
- // example EffectHandlers += EffectHandlerFn(class::function, EffectIndexSpecifier, EffectNameSpecifier);
- HookList<EffectHandler> EffectHandlers;
- // List of functions registered by HitHandlerFn
- // allows more than one hook
- // example: BeforeHit += HitHandlerFn(class::function);
+ // example: OnEffect += SpellEffectFn(class::function, EffectIndexSpecifier, EffectNameSpecifier);
+ // where function is void function(SpellEffIndex effIndex)
+ HookList<EffectHandler> OnEffect;
+ #define SpellEffectFn(F, I, N) EffectHandler((SpellEffectFnType)&F, I, N)
+
+ // example: BeforeHit += SpellHitFn(class::function);
HookList<HitHandler> BeforeHit;
- // example: OnHit += HitHandlerFn(class::function);
+ // example: OnHit += SpellHitFn(class::function);
HookList<HitHandler> OnHit;
- // example: AfterHit += HitHandlerFn(class::function);
+ // example: AfterHit += SpellHitFn(class::function);
HookList<HitHandler> AfterHit;
+ // where function is: void function()
+ #define SpellHitFn(F) (SpellHitFnType)&F
// hooks are executed in following order, at specified event of spell:
// 1. BeforeHit - executed just before spell hits a target
- // 2. EffectHandlers - executed just before specified effect handler call
+ // 2. OnEffect - executed just before specified effect handler call
// 3. OnHit - executed just before spell deals damage and procs auras
// 4. AfterHit - executed just after spell finishes all it's jobs for target
@@ -202,20 +208,193 @@ class SpellScript : public _SpellScript
// Creates item. Calls Spell::DoCreateItem method.
void CreateItem(uint32 effIndex, uint32 itemId);
};
-// SpellScript interface
-//
-// function registering macros, should be used only in Register()
-//
-// EffectHandlerFn
-// called at: Spell hit on unit, just before default effect handler, called for effects matching EffectIndexSpecifier and EffectNameSpecifier conditions
-// hook parameter is current effect index
-// parameters: function to call, EffectIndexSpecifier, EffectNameSpecifier
-#define EffectHandlerFn(F, I, N) EffectHandler((EffectHandlerFnType)&F, I, N)
-
-// HitHandlerFn
-// called at: Spell hit on unit, before or after effect handlers, depends if bound to OnHit or AfterHit
-// parameters: function to call
-#define HitHandlerFn(F) (HitHandlerFnType)&F
+
+class AuraScript : public _SpellScript
+{
+ // internal use classes & functions
+ // DO NOT OVERRIDE THESE IN SCRIPTS
+ public:
+ typedef void(AuraScript::*AuraEffectApplicationModeFnType)(AuraEffect const *, AuraApplication const *, AuraEffectHandleModes mode);
+ typedef void(AuraScript::*AuraEffectPeriodicFnType)(AuraEffect const *, AuraApplication const *);
+ typedef void(AuraScript::*AuraEffectUpdatePeriodicFnType)(AuraEffect *);
+ typedef void(AuraScript::*AuraEffectCalcAmountFnType)(AuraEffect const *, int32 &, bool &);
+ typedef void(AuraScript::*AuraEffectCalcPeriodicFnType)(AuraEffect const *, bool &, int32 &);
+ typedef void(AuraScript::*AuraEffectCalcSpellModFnType)(AuraEffect const *, SpellModifier *&);
+
+ class EffectBase : public _SpellScript::EffectAuraNameCheck, public _SpellScript::EffectHook
+ {
+ public:
+ EffectBase(uint8 _effIndex, uint16 _effName);
+ std::string ToString();
+ bool CheckEffect(SpellEntry const * spellEntry, uint8 effIndex);
+ };
+ class EffectPeriodicHandler : public EffectBase
+ {
+ public:
+ EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
+ void Call(AuraScript * auraScript, AuraEffect const * _aurEff, AuraApplication const * _aurApp);
+ private:
+ AuraEffectPeriodicFnType pEffectHandlerScript;
+ };
+ class EffectUpdatePeriodicHandler : public EffectBase
+ {
+ public:
+ EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
+ void Call(AuraScript * auraScript, AuraEffect * aurEff);
+ private:
+ AuraEffectUpdatePeriodicFnType pEffectHandlerScript;
+ };
+ class EffectCalcAmountHandler : public EffectBase
+ {
+ public:
+ EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
+ void Call(AuraScript * auraScript, AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated);
+ private:
+ AuraEffectCalcAmountFnType pEffectHandlerScript;
+ };
+ class EffectCalcPeriodicHandler : public EffectBase
+ {
+ public:
+ EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
+ void Call(AuraScript * auraScript, AuraEffect const* aurEff, bool & isPeriodic, int32 & periodicTimer);
+ private:
+ AuraEffectCalcPeriodicFnType pEffectHandlerScript;
+ };
+ class EffectCalcSpellModHandler : public EffectBase
+ {
+ public:
+ EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName);
+ void Call(AuraScript * auraScript, AuraEffect const* aurEff, SpellModifier *& spellMod);
+ private:
+ AuraEffectCalcSpellModFnType pEffectHandlerScript;
+ };
+ class EffectApplyHandler : public EffectBase
+ {
+ public:
+ EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript,uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode);
+ void Call(AuraScript * auraScript, AuraEffect const * _aurEff, AuraApplication const * _aurApp, AuraEffectHandleModes _mode);
+ private:
+ AuraEffectApplicationModeFnType pEffectHandlerScript;
+ AuraEffectHandleModes mode;
+ };
+ public:
+ bool _Validate(SpellEntry const * entry, const char * scriptname);
+ bool _Load(Aura * aura);
+ void _ResetDefault() { m_default = true; }
+ bool _IsDefaultActionPrevented(SpellEffIndex effIndex) {return !m_default;};
+ bool PreventDefaultAction() { m_default = false; };
+ private:
+ Aura * m_aura;
+ bool m_default;
+ public:
+ //
+ // AuraScript interface
+ // hooks to which you can attach your functions
+ //
+ // executed when periodic aura effect is applied with specified mode to target
+ // example: OnEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
+ HookList<EffectApplyHandler> OnEffectApply;
+ #define AuraEffectApplyFn(F, I, N, M) EffectApplyHandler((AuraEffectApplicationModeFnType)&F, I, N, M)
+
+ // executed when periodic aura effect is removed with specified mode from target
+ // example: OnEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
+ // where function is: void function (AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode);
+ HookList<EffectApplyHandler> OnEffectRemove;
+ #define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandler((AuraEffectApplicationModeFnType)&F, I, N, M)
+
+ // executed when periodic aura effect ticks on target
+ // example: OnEffectPeriodic += AuraEffectPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
+ // where function is: void function (AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode);
+ HookList<EffectPeriodicHandler> OnEffectPeriodic;
+ #define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandler((AuraEffectPeriodicFnType)&F, I, N)
+
+ // executed when periodic aura effect is updated
+ // example: OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
+ // where function is: void function (AuraEffect const * aurEff, AuraApplication const * aurApp);
+ HookList<EffectUpdatePeriodicHandler> OnEffectUpdatePeriodic;
+ #define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandler((AuraEffectUpdatePeriodicFnType)&F, I, N)
+
+ // executed when aura effect calculates amount
+ // example: OnEffectCalcAmount += AuraEffectCalcAmounFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
+ // where function is: void function (AuraEffect * aurEff, int32 & amount, bool & canBeRecalculated);
+ HookList<EffectCalcAmountHandler> OnEffectCalcAmount;
+ #define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandler((AuraEffectCalcAmountFnType)&F, I, N)
+
+ // executed when aura effect calculates periodic data
+ // example: OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
+ // where function is: void function (AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude);
+ HookList<EffectCalcPeriodicHandler> OnEffectCalcPeriodic;
+ #define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandler((AuraEffectCalcPeriodicFnType)&F, I, N)
+
+ // executed when aura effect calculates spellmod
+ // example: OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
+ // where function is: void function (AuraEffect const * aurEff, SpellModifier *& spellMod);
+ HookList<EffectCalcSpellModHandler> OnEffectCalcSpellMod;
+ #define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandler((AuraEffectCalcSpellModFnType)&F, I, N)
+
+ // AuraScript interface - functions which are redirecting to Aura class
+
+ // returns proto of the spell
+ SpellEntry const* GetSpellProto() const;
+ // returns spellid of the spell
+ uint32 GetId() const;
+
+ // returns guid of object which casted the aura (m_originalCaster of the Spell class)
+ uint64 const& GetCasterGUID() const;
+ // returns unit which casted the aura or NULL if not avalible (caster logged out for example)
+ Unit* GetCaster() const;
+ // returns object on which aura was casted, target for non-area auras, area aura source for area auras
+ WorldObject * GetOwner() const;
+ // returns owner if it's unit, NULL otherwise
+ Unit * GetUnitOwner() const;
+ // returns owner if it's dynobj, NULL otherwise
+ DynamicObject * GetDynobjOwner() const;
+
+ // removes aura with remove mode (see AuraRemoveMode enum)
+ void Remove(uint32 removeMode = 0);
+ // returns aura object of script
+ Aura * GetAura() const;
+
+ // returns type of the aura, may be dynobj owned aura or unit owned aura
+ AuraObjectType GetType() const;
+
+ // aura duration manipulation - when duration goes to 0 aura is removed
+ int32 GetDuration() const;
+ void SetDuration(int32 duration, bool withMods = false);
+ // sets duration to maxduration
+ void RefreshDuration();
+ time_t GetApplyTime() const;
+ int32 GetMaxDuration() const;
+ void SetMaxDuration(int32 duration);
+ // expired - duration just went to 0
+ bool IsExpired() const;
+ // permament - has infinite duration
+ bool IsPermanent() const;
+
+ // charges manipulation - 0 - not charged aura
+ uint8 GetCharges() const;
+ void SetCharges(uint8 charges);
+ // returns true if last charge dropped
+ bool DropCharge();
+
+ // stack amount manipulation
+ uint8 GetStackAmount() const;
+ void SetStackAmount(uint8 num, bool applied = true);
+ bool ModStackAmount(int32 num);
+
+ // passive - "working in background", not saved, not removed by immonities, not seen by player
+ bool IsPassive() const;
+ // death persistent - not removed on death
+ bool IsDeathPersistent() const;
+
+ // check if aura has effect of given effindex
+ bool HasEffect(uint8 effIndex) const;
+ // returns aura effect of given effect index or NULL
+ AuraEffect * GetEffect(uint8 effIndex) const;
+
+ // check if aura has effect of given aura type
+ bool HasEffectType(AuraType type) const;
+};
//
// definitions:
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp
index 9d7fa31ca9a..0f4226b9a99 100644
--- a/src/server/scripts/Examples/example_spell.cpp
+++ b/src/server/scripts/Examples/example_spell.cpp
@@ -23,115 +23,258 @@
*/
#include "ScriptPCH.h"
+#include "SpellAuras.h"
+#include "SpellAuraEffects.h"
-class spell_ex_49375 : public SpellHandlerScript
+class spell_ex_5581 : public SpellScriptLoader
{
public:
- spell_ex_49375() : SpellHandlerScript("spell_ex_49375") { }
+ spell_ex_5581() : SpellScriptLoader("spell_ex_5581") { }
- class spell_ex_49375SpellScript : public SpellScript
+ class spell_ex_5581SpellScript : public SpellScript
{
+ enum Spells
+ {
+ SPELL_TRIGGERED = 18282
+ };
+
std::string localVariable;
char * localVariable2;
- // effect handler hook - effIndex - effIndex of handled effect of a spell
- void HandleDummy(SpellEffIndex /*effIndex*/)
+ // function called on server startup
+ // checks if script has data required for it to work
+ bool Validate(SpellEntry const * spellEntry)
+ {
+ // check if spellid 70522 exists in dbc, we will trigger it later
+ if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
+ return false;
+ return true;
+ }
+
+ // function called just after script is added to spell
+ // we initialize local variables if needed
+ bool Load()
+ {
+ localVariable = "we're using local variable";
+ localVariable2 = new char;
+ return true;
+ // return false - script will be immediately removed from the spell
+ // for example - we don't want this script to be executed on a creature
+ // if (GetCaster()->GetTypeID() != TYPEID_PLAYER)
+ // return false;
+ }
+
+ // function called just before script delete
+ // we free allocated memory
+ void Unload()
+ {
+ delete localVariable2;
+ }
+
+ void HandleDummy(SpellEffIndex effIndex)
{
// we're handling SPELL_EFFECT_DUMMY in effIndex 0 here
- sLog.outError("WE ARE HANDLING DUMMY!");
+ sLog.outString("SPELL_EFFECT_DUMMY is executed on target!");
+ sLog.outString(localVariable.c_str());
// make caster cast a spell on a unit target of effect
if (Unit * target = GetHitUnit())
- GetCaster()->CastSpell(target, 70522, true);
- };
+ GetCaster()->CastSpell(target, SPELL_TRIGGERED, true);
+ }
void HandleBeforeHit()
{
- sLog.outError("Spell is about to hit target!");
+ sLog.outString("Spell is about to hit target!");
}
void HandleOnHit()
{
- sLog.outError("Spell just hit target!");
+ sLog.outString("Spell just hit target!");
}
void HandleAfterHit()
{
- sLog.outError("Spell just finished hitting target!");
+ sLog.outString("Spell just finished hitting target!");
}
+ // register functions used in spell script - names of these functions do not matter
void Register()
{
// we're registering our function here
// function HandleDummy will be called when unit is hit by spell, just before default effect 0 handler
- EffectHandlers += EffectHandlerFn(spell_ex_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_ex_5581SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
// this will prompt an error on startup because effect 0 of spell 49375 is set to SPELL_EFFECT_DUMMY, not SPELL_EFFECT_APPLY_AURA
- //EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
+ //OnEffect += SpellEffectFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
// this will make HandleDummy function to be called on first != 0 effect of spell 49375
- //EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_ANY);
+ //OnEffect += SpellEffectFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_FIRST_FOUND, SPELL_EFFECT_ANY);
// this will make HandleDummy function to be called on all != 0 effect of spell 49375
- //EffectHandlers += EffectHandlerFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY);
+ //OnEffect += SpellEffectFn(spell_gen_49375SpellScript::HandleDummy, EFFECT_ALL, SPELL_EFFECT_ANY);
// bind handler to BeforeHit event of the spell
- BeforeHit += HitHandlerFn(spell_ex_49375SpellScript::HandleBeforeHit);
+ BeforeHit += SpellHitFn(spell_ex_5581SpellScript::HandleBeforeHit);
// bind handler to OnHit event of the spell
- OnHit += HitHandlerFn(spell_ex_49375SpellScript::HandleOnHit);
+ OnHit += SpellHitFn(spell_ex_5581SpellScript::HandleOnHit);
// bind handler to AfterHit event of the spell
- AfterHit += HitHandlerFn(spell_ex_49375SpellScript::HandleAfterHit);
- };
+ AfterHit += SpellHitFn(spell_ex_5581SpellScript::HandleAfterHit);
+ }
+ };
+ // function which creates SpellScript
+ SpellScript *GetSpellScript() const
+ {
+ return new spell_ex_5581SpellScript();
+ }
+};
+
+class spell_ex_66244 : public SpellScriptLoader
+{
+ public:
+ spell_ex_66244() : SpellScriptLoader("spell_ex_66244") { }
+
+ class spell_ex_66244AuraScript : public AuraScript
+ {
+ enum Spells
+ {
+ SPELL_TRIGGERED = 18282
+ };
// function called on server startup
// checks if script has data required for it to work
bool Validate(SpellEntry const * /*spellEntry*/)
{
- // check if spellid 1 exists in dbc
- if (!sSpellStore.LookupEntry(70522))
+ // check if spellid 70522 exists in dbc, we will trigger it later
+ if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
return false;
return true;
- };
+ }
- // function called just after script is added to spell
+ // function called in aura constructor
// we initialize local variables if needed
bool Load()
{
- localVariable = "WE'RE USING LOCAL VARIABLE";
- localVariable2 = new char;
- return true;
- // script will be immediately removed from the spell
- // for example - we don't want this script to be executed on a creature
- // if (GetCaster()->GetTypeID() != TYPEID_PLAYER)
- // return false;
+ // do not load script if aura is casted by player or caster not avalible
+ if (Unit * caster = GetCaster())
+ if (caster->GetTypeId() == TYPEID_PLAYER)
+ return true;
+ return false;
}
- // function called just before script delete
- // we free allocated memory
- void Unload()
+ void HandleEffectApply(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode)
{
- delete localVariable2;
+ sLog.outString("Aura Effect is about to be applied on target!");
+ Unit * target = aurApp->GetTarget();
+ // cast spell on target on aura apply
+ target->CastSpell(target, SPELL_TRIGGERED, true);
+ }
+
+ void HandleEffectRemove(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode)
+ {
+ sLog.outString("Aura Effect is just removed on target!");
+ Unit * target = aurApp->GetTarget();
+ Unit * caster = GetCaster();
+ // caster may be not avalible (logged out for example)
+ if (!caster)
+ return;
+ // cast spell on caster on aura remove
+ target->CastSpell(caster, SPELL_TRIGGERED, true);
+ }
+
+ void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp)
+ {
+ sLog.outString("Perioidic Aura Effect is does a tick on target!");
+ Unit * target = aurApp->GetTarget();
+ // aura targets damage self on tick
+ target->DealDamage(target, 100);
+ }
+
+ void HandleEffectPeriodicUpdate(AuraEffect * aurEff)
+ {
+ sLog.outString("Perioidic Aura Effect is now updated!");
+ // we're doubling aura amount every tick
+ aurEff->ChangeAmount(aurEff->GetAmount() * 2);
+ }
+
+ void HandleEffectCalcAmount(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated)
+ {
+ sLog.outString("Amount of Aura Effect is being calculated now!");
+ // we're setting amount to 0
+ amount = 100;
+ // amount will be never recalculated due to applying passive aura
+ canBeRecalculated = false;
+ }
+
+ void HandleEffectCalcPeriodic(AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude)
+ {
+ sLog.outString("Periodic data of Aura Effect is being calculated now!");
+ // we're setting aura to be periodic and tick every 10 seconds
+ isPeriodic = true;
+ amplitude = 2 * IN_MILLISECONDS;
+ }
+
+ void HandleEffectCalcSpellMod(AuraEffect * const aurEff, SpellModifier *& spellMod)
+ {
+ sLog.outString("SpellMod data of Aura Effect is being calculated now!");
+ // we don't want spellmod for example
+ if(spellMod)
+ {
+ delete spellMod;
+ spellMod = NULL;
+ }
+ /*
+ // alternative: we want spellmod for spell which doesn't have it
+ if (!spellMod)
+ {
+ spellMod = new SpellModifier(GetAura());
+ spellMod->op = SPELLMOD_DOT;
+ spellMod->type = SPELLMOD_PCT;
+ spellMod->spellId = GetId();
+ spellMod->mask[1] = 0x00002000;
+ }
+ */
+ }
+
+ // function registering
+ void Register()
+ {
+ OnEffectApply += AuraEffectApplyFn(spell_ex_66244AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ OnEffectRemove += AuraEffectRemoveFn(spell_ex_66244AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodic,EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_66244AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_66244AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
+ OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_66244AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
}
};
- // function which creates SpellScript
- SpellScript *GetSpellScript() const
+ // function which creates AuraScript
+ AuraScript *GetAuraScript() const
{
- return new spell_ex_49375SpellScript();
+ return new spell_ex_66244AuraScript();
}
};
+
+
+// this function has to be added to function set in ScriptLoader.cpp
+void AddSC_example_spell_scripts()
+{
+ new spell_ex_5581;
+ new spell_ex_66244;
+}
+
/* empty script for copypasting
-class spell_ex : public SpellHandlerScript
+class spell_ex : public SpellScriptLoader
{
public:
- spell_ex() : SpellHandlerScript("spell_ex") { }
+ spell_ex() : SpellScriptLoader("spell_ex") { }
class spell_ex_SpellScript : public SpellScript
{
- void Function(SpellEffIndex effIndex){}
+ //bool Validate(SpellEntry const * spellEntry){return true;}
+ //bool Load(){return true;}
+ //void Unload(){}
+
+ //void Function(SpellEffIndex effIndex) //OnEffect += SpellEffectFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_EFFECT_ANY);
+ //void Function() //OnHit += SpellEffectFn(spell_ex_SpellScript::Function);
void Register()
{
- //EffectHandlers += EffectHandlerFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_EFFECT_ANY);
}
-
- //bool Load(){return true;}
- //void Unload(){}
- //bool Validate(SpellEntry const * spellEntry){return true;}
};
SpellScript *GetSpellScript() const
@@ -139,13 +282,35 @@ class spell_ex : public SpellHandlerScript
return new spell_ex_SpellScript();
}
};
-
*/
-// this function has to be added to function set in ScriptLoader.cpp
-void AddSC_example_spell_scripts()
+/* empty script for copypasting
+class spell_ex : public SpellScriptLoader
{
-/* Commented out to prevent loading errors
- new spell_ex_49375;
+ public:
+ spell_ex() : SpellScriptLoader("spell_ex") { }
+
+ class spell_ex_AuraScript : public AuraScript
+ {
+ //bool Validate(SpellEntry const * spellEntry){return true;}
+ //bool Load(){return true;}
+ //void Unload(){}
+
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode) //OnEffectApply += AuraEffectApplyFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode) //OnEffectRemove += AuraEffectRemoveFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp) //OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect * aurEff) //OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated) //OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude) //OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ //void spell_ex_SpellScript::Function(AuraEffect * const aurEff, SpellModifier *& spellMod) //OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY);
+ void Register()
+ {
+ }
+ };
+
+ AuraScript *GetAuraScript() const
+ {
+ return new spell_ex_AuraScript();
+ }
+};
*/
-}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
index c882763e945..8517af8a658 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp
@@ -748,10 +748,10 @@ class npc_vengeful_shade : public CreatureScript
}
};
-class spell_cultist_dark_martyrdom : public SpellHandlerScript
+class spell_cultist_dark_martyrdom : public SpellScriptLoader
{
public:
- spell_cultist_dark_martyrdom() : SpellHandlerScript("spell_cultist_dark_martyrdom") { }
+ spell_cultist_dark_martyrdom() : SpellScriptLoader("spell_cultist_dark_martyrdom") { }
class spell_cultist_dark_martyrdom_SpellScript : public SpellScript
{
@@ -778,7 +778,7 @@ class spell_cultist_dark_martyrdom : public SpellHandlerScript
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_cultist_dark_martyrdom_SpellScript::HandleEffect, EFFECT_2, SPELL_EFFECT_FORCE_DESELECT);
+ OnEffect += SpellEffectFn(spell_cultist_dark_martyrdom_SpellScript::HandleEffect, EFFECT_2, SPELL_EFFECT_FORCE_DESELECT);
}
};
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
index 50a8214a35e..daaed063994 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp
@@ -398,10 +398,10 @@ class npc_bone_spike : public CreatureScript
}
};
-class spell_marrowgar_coldflame : public SpellHandlerScript
+class spell_marrowgar_coldflame : public SpellScriptLoader
{
public:
- spell_marrowgar_coldflame() : SpellHandlerScript("spell_marrowgar_coldflame") { }
+ spell_marrowgar_coldflame() : SpellScriptLoader("spell_marrowgar_coldflame") { }
class spell_marrowgar_coldflame_SpellScript : public SpellScript
{
@@ -417,7 +417,7 @@ class spell_marrowgar_coldflame : public SpellHandlerScript
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
bool Load()
@@ -434,10 +434,10 @@ class spell_marrowgar_coldflame : public SpellHandlerScript
}
};
-class spell_marrowgar_bone_spike_graveyard : public SpellHandlerScript
+class spell_marrowgar_bone_spike_graveyard : public SpellScriptLoader
{
public:
- spell_marrowgar_bone_spike_graveyard() : SpellHandlerScript("spell_marrowgar_bone_spike_graveyard") { }
+ spell_marrowgar_bone_spike_graveyard() : SpellScriptLoader("spell_marrowgar_bone_spike_graveyard") { }
class spell_marrowgar_bone_spike_graveyard_SpellScript : public SpellScript
{
@@ -466,7 +466,7 @@ class spell_marrowgar_bone_spike_graveyard : public SpellHandlerScript
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_marrowgar_bone_spike_graveyard_SpellScript::HandleApplyAura, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
+ OnEffect += SpellEffectFn(spell_marrowgar_bone_spike_graveyard_SpellScript::HandleApplyAura, EFFECT_1, SPELL_EFFECT_APPLY_AURA);
}
bool Load()
@@ -483,10 +483,10 @@ class spell_marrowgar_bone_spike_graveyard : public SpellHandlerScript
}
};
-class spell_marrowgar_bone_storm : public SpellHandlerScript
+class spell_marrowgar_bone_storm : public SpellScriptLoader
{
public:
- spell_marrowgar_bone_storm() : SpellHandlerScript("spell_marrowgar_bone_storm") { }
+ spell_marrowgar_bone_storm() : SpellScriptLoader("spell_marrowgar_bone_storm") { }
class spell_marrowgar_bone_storm_SpellScript : public SpellScript
{
@@ -504,7 +504,7 @@ class spell_marrowgar_bone_storm : public SpellHandlerScript
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
+ OnEffect += SpellEffectFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE);
}
bool Load()
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp
index 932d13fccd0..8d6f078355a 100644
--- a/src/server/scripts/Spells/spell_dk.cpp
+++ b/src/server/scripts/Spells/spell_dk.cpp
@@ -33,10 +33,10 @@ enum DeathKnightSpells
};
// 49158 Corpse Explosion (51325, 51326, 51327, 51328)
-class spell_dk_corpse_explosion : public SpellHandlerScript
+class spell_dk_corpse_explosion : public SpellScriptLoader
{
public:
- spell_dk_corpse_explosion() : SpellHandlerScript("spell_dk_corpse_explosion") { }
+ spell_dk_corpse_explosion() : SpellScriptLoader("spell_dk_corpse_explosion") { }
class spell_dk_corpse_explosion_SpellScript : public SpellScript
{
@@ -68,7 +68,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_dk_corpse_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_dk_corpse_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -79,10 +79,10 @@ public:
};
// 50524 Runic Power Feed (keeping Gargoyle alive)
-class spell_dk_runic_power_feed : public SpellHandlerScript
+class spell_dk_runic_power_feed : public SpellScriptLoader
{
public:
- spell_dk_runic_power_feed() : SpellHandlerScript("spell_dk_runic_power_feed") { }
+ spell_dk_runic_power_feed() : SpellScriptLoader("spell_dk_runic_power_feed") { }
class spell_dk_runic_power_feed_SpellScript : public SpellScript
{
@@ -107,7 +107,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_dk_runic_power_feed_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_dk_runic_power_feed_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -118,10 +118,10 @@ public:
};
// 55090 Scourge Strike (55265, 55270, 55271)
-class spell_dk_scourge_strike : public SpellHandlerScript
+class spell_dk_scourge_strike : public SpellScriptLoader
{
public:
- spell_dk_scourge_strike() : SpellHandlerScript("spell_dk_scourge_strike") { }
+ spell_dk_scourge_strike() : SpellScriptLoader("spell_dk_scourge_strike") { }
class spell_dk_scourge_strike_SpellScript : public SpellScript
{
@@ -144,7 +144,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp
index 9adbc48d53e..6238e6c5871 100644
--- a/src/server/scripts/Spells/spell_druid.cpp
+++ b/src/server/scripts/Spells/spell_druid.cpp
@@ -31,10 +31,10 @@ enum DruidSpells
};
// 54846 Glyph of Starfire
-class spell_dru_glyph_of_starfire : public SpellHandlerScript
+class spell_dru_glyph_of_starfire : public SpellScriptLoader
{
public:
- spell_dru_glyph_of_starfire() : SpellHandlerScript("spell_dru_glyph_of_starfire") { }
+ spell_dru_glyph_of_starfire() : SpellScriptLoader("spell_dru_glyph_of_starfire") { }
class spell_dru_glyph_of_starfire_SpellScript : public SpellScript
{
@@ -72,7 +72,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_dru_glyph_of_starfire_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_dru_glyph_of_starfire_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index e0b04d9b09a..931914ea03e 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -24,6 +24,7 @@
#include "ScriptPCH.h"
+
enum NPCEntries
{
NPC_DOOMGUARD = 11859,
@@ -31,10 +32,10 @@ enum NPCEntries
NPC_IMP = 416,
};
-class spell_gen_remove_flight_auras : public SpellHandlerScript
+class spell_gen_remove_flight_auras : public SpellScriptLoader
{
public:
- spell_gen_remove_flight_auras() : SpellHandlerScript("spell_gen_remove_flight_auras") {}
+ spell_gen_remove_flight_auras() : SpellScriptLoader("spell_gen_remove_flight_auras") {}
class spell_gen_remove_flight_auras_SpellScript : public SpellScript
{
@@ -49,7 +50,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_gen_remove_flight_auras_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_gen_remove_flight_auras_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -59,10 +60,10 @@ public:
}
};
-class spell_gen_pet_summoned : public SpellHandlerScript
+class spell_gen_pet_summoned : public SpellScriptLoader
{
public:
- spell_gen_pet_summoned() : SpellHandlerScript("spell_gen_pet_summoned") { }
+ spell_gen_pet_summoned() : SpellScriptLoader("spell_gen_pet_summoned") { }
class spell_gen_pet_summonedSpellScript : public SpellScript
{
@@ -105,7 +106,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_gen_pet_summonedSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_gen_pet_summonedSpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index 9f98564d0ea..106384c6320 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -41,10 +41,10 @@ enum HunterSpells
};
// 53209 Chimera Shot
-class spell_hun_chimera_shot : public SpellHandlerScript
+class spell_hun_chimera_shot : public SpellScriptLoader
{
public:
- spell_hun_chimera_shot() : SpellHandlerScript("spell_hun_chimera_shot") { }
+ spell_hun_chimera_shot() : SpellScriptLoader("spell_hun_chimera_shot") { }
class spell_hun_chimera_shot_SpellScript : public SpellScript
{
@@ -122,7 +122,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_hun_chimera_shot_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -133,10 +133,10 @@ public:
};
// 53412 Invigoration
-class spell_hun_invigoration : public SpellHandlerScript
+class spell_hun_invigoration : public SpellScriptLoader
{
public:
- spell_hun_invigoration() : SpellHandlerScript("spell_hun_invigoration") { }
+ spell_hun_invigoration() : SpellScriptLoader("spell_hun_invigoration") { }
class spell_hun_invigoration_SpellScript : public SpellScript
{
@@ -157,7 +157,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_hun_invigoration_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -167,10 +167,10 @@ public:
}
};
-class spell_hun_last_stand_pet : public SpellHandlerScript
+class spell_hun_last_stand_pet : public SpellScriptLoader
{
public:
- spell_hun_last_stand_pet() : SpellHandlerScript("spell_hun_last_stand_pet") { }
+ spell_hun_last_stand_pet() : SpellScriptLoader("spell_hun_last_stand_pet") { }
class spell_hun_last_stand_pet_SpellScript : public SpellScript
{
@@ -191,7 +191,7 @@ public:
void Register()
{
// add dummy effect spell handler to pet's Last Stand
- EffectHandlers += EffectHandlerFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_hun_last_stand_pet_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -201,10 +201,10 @@ public:
}
};
-class spell_hun_masters_call : public SpellHandlerScript
+class spell_hun_masters_call : public SpellScriptLoader
{
public:
- spell_hun_masters_call() : SpellHandlerScript("spell_hun_masters_call") { }
+ spell_hun_masters_call() : SpellScriptLoader("spell_hun_masters_call") { }
class spell_hun_masters_call_SpellScript : public SpellScript
{
@@ -241,8 +241,8 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
- EffectHandlers += EffectHandlerFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_hun_masters_call_SpellScript::HandleScriptEffect, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -252,10 +252,10 @@ public:
}
};
-class spell_hun_readiness : public SpellHandlerScript
+class spell_hun_readiness : public SpellScriptLoader
{
public:
- spell_hun_readiness() : SpellHandlerScript("spell_hun_readiness") { }
+ spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { }
class spell_hun_readiness_SpellScript : public SpellScript
{
@@ -284,7 +284,7 @@ public:
void Register()
{
// add dummy effect spell handler to Readiness
- EffectHandlers += EffectHandlerFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -295,10 +295,10 @@ public:
};
// 37506 Scatter Shot
-class spell_hun_scatter_shot : public SpellHandlerScript
+class spell_hun_scatter_shot : public SpellScriptLoader
{
public:
- spell_hun_scatter_shot() : SpellHandlerScript("spell_hun_scatter_shot") { }
+ spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { }
class spell_hun_scatter_shot_SpellScript : public SpellScript
{
@@ -316,7 +316,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -326,10 +326,10 @@ public:
}
};
-class spell_hun_pet_heart_of_the_phoenix : public SpellHandlerScript
+class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader
{
public:
- spell_hun_pet_heart_of_the_phoenix() : SpellHandlerScript("spell_hun_pet_heart_of_the_phoenix") { }
+ spell_hun_pet_heart_of_the_phoenix() : SpellScriptLoader("spell_hun_pet_heart_of_the_phoenix") { }
class spell_hun_pet_heart_of_the_phoenix_SpellScript : public SpellScript
{
@@ -354,7 +354,7 @@ public:
void Register()
{
// add dummy effect spell handler to pet's Last Stand
- EffectHandlers += EffectHandlerFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_hun_pet_heart_of_the_phoenix_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
bool Load()
@@ -371,10 +371,10 @@ public:
}
};
-class spell_hun_pet_carrion_feeder : public SpellHandlerScript
+class spell_hun_pet_carrion_feeder : public SpellScriptLoader
{
public:
- spell_hun_pet_carrion_feeder() : SpellHandlerScript("spell_hun_pet_carrion_feeder") { }
+ spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { }
class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript
{
@@ -396,7 +396,7 @@ public:
void Register()
{
// add dummy effect spell handler to pet's Last Stand
- EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
bool Load()
diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp
index 4eb08919e4f..36504353bcb 100644
--- a/src/server/scripts/Spells/spell_mage.cpp
+++ b/src/server/scripts/Spells/spell_mage.cpp
@@ -37,10 +37,10 @@ enum MageSpells
SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY = 70907,
};
-class spell_mage_cold_snap : public SpellHandlerScript
+class spell_mage_cold_snap : public SpellScriptLoader
{
public:
- spell_mage_cold_snap() : SpellHandlerScript("spell_mage_cold_snap") { }
+ spell_mage_cold_snap() : SpellScriptLoader("spell_mage_cold_snap") { }
class spell_mage_cold_snap_SpellScript : public SpellScript
{
@@ -71,7 +71,7 @@ class spell_mage_cold_snap : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Cold Snap
- EffectHandlers += EffectHandlerFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_mage_cold_snap_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -81,10 +81,10 @@ class spell_mage_cold_snap : public SpellHandlerScript
}
};
-class spell_mage_polymorph_cast_visual : public SpellHandlerScript
+class spell_mage_polymorph_cast_visual : public SpellScriptLoader
{
public:
- spell_mage_polymorph_cast_visual() : SpellHandlerScript("spell_mage_polymorph_visual") { }
+ spell_mage_polymorph_cast_visual() : SpellScriptLoader("spell_mage_polymorph_visual") { }
class spell_mage_polymorph_cast_visual_SpellScript : public SpellScript
{
@@ -109,7 +109,7 @@ class spell_mage_polymorph_cast_visual : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Polymorph visual
- EffectHandlers += EffectHandlerFn(spell_mage_polymorph_cast_visual_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_mage_polymorph_cast_visual_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -129,10 +129,10 @@ const uint32 spell_mage_polymorph_cast_visual::spell_mage_polymorph_cast_visual_
SPELL_MAGE_SHEEP_FORM
};
-class spell_mage_summon_water_elemental : public SpellHandlerScript
+class spell_mage_summon_water_elemental : public SpellScriptLoader
{
public:
- spell_mage_summon_water_elemental() : SpellHandlerScript("spell_mage_summon_water_elemental") { }
+ spell_mage_summon_water_elemental() : SpellScriptLoader("spell_mage_summon_water_elemental") { }
class spell_mage_summon_water_elemental_SpellScript : public SpellScript
{
@@ -162,7 +162,7 @@ class spell_mage_summon_water_elemental : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Summon Water Elemental
- EffectHandlers += EffectHandlerFn(spell_mage_summon_water_elemental_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_mage_summon_water_elemental_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp
index 46be23b4091..8e3295a6c48 100644
--- a/src/server/scripts/Spells/spell_paladin.cpp
+++ b/src/server/scripts/Spells/spell_paladin.cpp
@@ -38,10 +38,10 @@ enum PaladinSpells
SPELL_BLESSING_OF_LOWER_CITY_SHAMAN = 37881,
};
-class spell_pal_blessing_of_faith : public SpellHandlerScript
+class spell_pal_blessing_of_faith : public SpellScriptLoader
{
public:
- spell_pal_blessing_of_faith() : SpellHandlerScript("spell_pal_blessing_of_faith") { }
+ spell_pal_blessing_of_faith() : SpellScriptLoader("spell_pal_blessing_of_faith") { }
class spell_pal_blessing_of_faith_SpellScript : public SpellScript
{
@@ -79,7 +79,7 @@ public:
void Register()
{
// add dummy effect spell handler to Blessing of Faith
- EffectHandlers += EffectHandlerFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_pal_blessing_of_faith_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -90,10 +90,10 @@ public:
};
// 63521 Guarded by The Light
-class spell_pal_guarded_by_the_light : public SpellHandlerScript
+class spell_pal_guarded_by_the_light : public SpellScriptLoader
{
public:
- spell_pal_guarded_by_the_light() : SpellHandlerScript("spell_pal_guarded_by_the_light") { }
+ spell_pal_guarded_by_the_light() : SpellScriptLoader("spell_pal_guarded_by_the_light") { }
class spell_pal_guarded_by_the_light_SpellScript : public SpellScript
{
@@ -113,7 +113,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_pal_guarded_by_the_light_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -123,10 +123,10 @@ public:
}
};
-class spell_pal_holy_shock : public SpellHandlerScript
+class spell_pal_holy_shock : public SpellScriptLoader
{
public:
- spell_pal_holy_shock() : SpellHandlerScript("spell_pal_holy_shock") { }
+ spell_pal_holy_shock() : SpellScriptLoader("spell_pal_holy_shock") { }
class spell_pal_holy_shock_SpellScript : public SpellScript
{
@@ -166,7 +166,7 @@ public:
void Register()
{
// add dummy effect spell handler to Holy Shock
- EffectHandlers += EffectHandlerFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_pal_holy_shock_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -176,10 +176,10 @@ public:
}
};
-class spell_pal_judgement_of_command : public SpellHandlerScript
+class spell_pal_judgement_of_command : public SpellScriptLoader
{
public:
- spell_pal_judgement_of_command() : SpellHandlerScript("spell_pal_judgement_of_command") { }
+ spell_pal_judgement_of_command() : SpellScriptLoader("spell_pal_judgement_of_command") { }
class spell_pal_judgement_of_command_SpellScript : public SpellScript
{
@@ -193,7 +193,7 @@ public:
void Register()
{
// add dummy effect spell handler to Judgement of Command
- EffectHandlers += EffectHandlerFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_pal_judgement_of_command_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp
index acada207aac..f923274f1ef 100644
--- a/src/server/scripts/Spells/spell_priest.cpp
+++ b/src/server/scripts/Spells/spell_priest.cpp
@@ -31,10 +31,10 @@ enum PriestSpells
PRIEST_SPELL_PENANCE_R1_HEAL = 47757,
};
-class spell_pri_pain_and_suffering_proc : public SpellHandlerScript
+class spell_pri_pain_and_suffering_proc : public SpellScriptLoader
{
public:
- spell_pri_pain_and_suffering_proc() : SpellHandlerScript("spell_pri_pain_and_suffering_proc") { }
+ spell_pri_pain_and_suffering_proc() : SpellScriptLoader("spell_pri_pain_and_suffering_proc") { }
// 47948 Pain and Suffering (proc)
class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript
@@ -49,7 +49,7 @@ class spell_pri_pain_and_suffering_proc : public SpellHandlerScript
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_pri_pain_and_suffering_proc_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_pri_pain_and_suffering_proc_SpellScript::HandleEffectScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -59,10 +59,10 @@ class spell_pri_pain_and_suffering_proc : public SpellHandlerScript
}
};
-class spell_pri_penance : public SpellHandlerScript
+class spell_pri_penance : public SpellScriptLoader
{
public:
- spell_pri_penance() : SpellHandlerScript("spell_pri_penance") { }
+ spell_pri_penance() : SpellScriptLoader("spell_pri_penance") { }
class spell_pri_penance_SpellScript : public SpellScript
{
@@ -102,7 +102,7 @@ class spell_pri_penance : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Penance
- EffectHandlers += EffectHandlerFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_pri_penance_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp
index 7f4ef9b22f1..257ae73ba4f 100644
--- a/src/server/scripts/Spells/spell_quest.cpp
+++ b/src/server/scripts/Spells/spell_quest.cpp
@@ -32,10 +32,10 @@ enum Quest11587Spells
// http://www.wowhead.com/quest=11587 Prison Break
// 45449 Arcane Prisoner Rescue
-class spell_q11587_arcane_prisoner_rescue : public SpellHandlerScript
+class spell_q11587_arcane_prisoner_rescue : public SpellScriptLoader
{
public:
- spell_q11587_arcane_prisoner_rescue() : SpellHandlerScript("spell_q11587_arcane_prisoner_rescue") { }
+ spell_q11587_arcane_prisoner_rescue() : SpellScriptLoader("spell_q11587_arcane_prisoner_rescue") { }
class spell_q11587_arcane_prisoner_rescue_SpellScript : public SpellScript
{
@@ -65,7 +65,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_q11587_arcane_prisoner_rescue_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_q11587_arcane_prisoner_rescue_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -92,10 +92,10 @@ enum Quest11730Spells
// http://www.wowhead.com/quest=11730 Master and Servant
// 46023 The Ultrasonic Screwdriver
-class spell_q11730_ultrasonic_screwdriver : public SpellHandlerScript
+class spell_q11730_ultrasonic_screwdriver : public SpellScriptLoader
{
public:
- spell_q11730_ultrasonic_screwdriver() : SpellHandlerScript("spell_q11730_ultrasonic_screwdriver") { }
+ spell_q11730_ultrasonic_screwdriver() : SpellScriptLoader("spell_q11730_ultrasonic_screwdriver") { }
class spell_q11730_ultrasonic_screwdriver_SpellScript : public SpellScript
{
@@ -148,7 +148,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_q11730_ultrasonic_screwdriver_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_q11730_ultrasonic_screwdriver_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp
index a85713fd068..0ccd1dd586b 100644
--- a/src/server/scripts/Spells/spell_rogue.cpp
+++ b/src/server/scripts/Spells/spell_rogue.cpp
@@ -31,10 +31,10 @@ enum RogueSpells
ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819,
};
-class spell_rog_cheat_death : public SpellHandlerScript
+class spell_rog_cheat_death : public SpellScriptLoader
{
public:
- spell_rog_cheat_death() : SpellHandlerScript("spell_rog_cheat_death") { }
+ spell_rog_cheat_death() : SpellScriptLoader("spell_rog_cheat_death") { }
class spell_rog_cheat_death_SpellScript : public SpellScript
{
@@ -54,7 +54,7 @@ class spell_rog_cheat_death : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Cheat Death
- EffectHandlers += EffectHandlerFn(spell_rog_cheat_death_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_rog_cheat_death_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -64,10 +64,10 @@ class spell_rog_cheat_death : public SpellHandlerScript
}
};
-class spell_rog_hunger_for_blood : public SpellHandlerScript
+class spell_rog_hunger_for_blood : public SpellScriptLoader
{
public:
- spell_rog_hunger_for_blood() : SpellHandlerScript("spell_rog_hunger_for_blood") { }
+ spell_rog_hunger_for_blood() : SpellScriptLoader("spell_rog_hunger_for_blood") { }
class spell_rog_hunger_for_blood_SpellScript : public SpellScript
{
@@ -87,7 +87,7 @@ class spell_rog_hunger_for_blood : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Hunger for Blood
- EffectHandlers += EffectHandlerFn(spell_rog_hunger_for_blood_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_rog_hunger_for_blood_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -97,10 +97,10 @@ class spell_rog_hunger_for_blood : public SpellHandlerScript
}
};
-class spell_rog_preparation : public SpellHandlerScript
+class spell_rog_preparation : public SpellScriptLoader
{
public:
- spell_rog_preparation() : SpellHandlerScript("spell_rog_preparation") { }
+ spell_rog_preparation() : SpellScriptLoader("spell_rog_preparation") { }
class spell_rog_preparation_SpellScript : public SpellScript
{
@@ -149,7 +149,7 @@ class spell_rog_preparation : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Preparation
- EffectHandlers += EffectHandlerFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_rog_preparation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -159,10 +159,10 @@ class spell_rog_preparation : public SpellHandlerScript
}
};
-class spell_rog_shiv : public SpellHandlerScript
+class spell_rog_shiv : public SpellScriptLoader
{
public:
- spell_rog_shiv() : SpellHandlerScript("spell_rog_shiv") { }
+ spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { }
class spell_rog_shiv_SpellScript : public SpellScript
{
@@ -186,7 +186,7 @@ class spell_rog_shiv : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Shiv
- EffectHandlers += EffectHandlerFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp
index 56dea16fbbf..3c69ae72fdc 100644
--- a/src/server/scripts/Spells/spell_shaman.cpp
+++ b/src/server/scripts/Spells/spell_shaman.cpp
@@ -33,10 +33,10 @@ enum ShamanSpells
};
// 1535 Fire Nova
-class spell_sha_fire_nova : public SpellHandlerScript
+class spell_sha_fire_nova : public SpellScriptLoader
{
public:
- spell_sha_fire_nova() : SpellHandlerScript("spell_sha_fire_nova") { }
+ spell_sha_fire_nova() : SpellScriptLoader("spell_sha_fire_nova") { }
class spell_sha_fire_nova_SpellScript : public SpellScript
{
@@ -71,7 +71,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_sha_fire_nova_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_sha_fire_nova_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -82,10 +82,10 @@ public:
};
// 39610 Mana Tide Totem
-class spell_sha_mana_tide_totem : public SpellHandlerScript
+class spell_sha_mana_tide_totem : public SpellScriptLoader
{
public:
- spell_sha_mana_tide_totem() : SpellHandlerScript("spell_sha_mana_tide_totem") { }
+ spell_sha_mana_tide_totem() : SpellScriptLoader("spell_sha_mana_tide_totem") { }
class spell_sha_mana_tide_totem_SpellScript : public SpellScript
{
@@ -119,7 +119,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_sha_mana_tide_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_sha_mana_tide_totem_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp
index 4f638a6958e..448a468cdf2 100644
--- a/src/server/scripts/Spells/spell_warlock.cpp
+++ b/src/server/scripts/Spells/spell_warlock.cpp
@@ -37,10 +37,10 @@ enum WarlockSpells
};
// 47193 Demonic Empowerment
-class spell_warl_demonic_empowerment : public SpellHandlerScript
+class spell_warl_demonic_empowerment : public SpellScriptLoader
{
public:
- spell_warl_demonic_empowerment() : SpellHandlerScript("spell_warl_demonic_empowerment") { }
+ spell_warl_demonic_empowerment() : SpellScriptLoader("spell_warl_demonic_empowerment") { }
class spell_warl_demonic_empowerment_SpellScript : public SpellScript
{
@@ -95,7 +95,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_warl_demonic_empowerment_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_warl_demonic_empowerment_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -106,10 +106,10 @@ public:
};
// 47422 Everlasting Affliction
-class spell_warl_everlasting_affliction : public SpellHandlerScript
+class spell_warl_everlasting_affliction : public SpellScriptLoader
{
public:
- spell_warl_everlasting_affliction() : SpellHandlerScript("spell_warl_everlasting_affliction") { }
+ spell_warl_everlasting_affliction() : SpellScriptLoader("spell_warl_everlasting_affliction") { }
class spell_warl_everlasting_affliction_SpellScript : public SpellScript
{
@@ -123,7 +123,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_warl_everlasting_affliction_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_warl_everlasting_affliction_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
@@ -134,10 +134,10 @@ public:
};
// 6201 Create Healthstone (and ranks)
-class spell_warl_create_healthstone : public SpellHandlerScript
+class spell_warl_create_healthstone : public SpellScriptLoader
{
public:
- spell_warl_create_healthstone() : SpellHandlerScript("spell_warl_create_healthstone") { }
+ spell_warl_create_healthstone() : SpellScriptLoader("spell_warl_create_healthstone") { }
class spell_warl_create_healthstone_SpellScript : public SpellScript
{
@@ -177,7 +177,7 @@ public:
void Register()
{
- EffectHandlers += EffectHandlerFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ OnEffect += SpellEffectFn(spell_warl_create_healthstone_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp
index deab26bf716..48a37395b81 100644
--- a/src/server/scripts/Spells/spell_warrior.cpp
+++ b/src/server/scripts/Spells/spell_warrior.cpp
@@ -28,10 +28,10 @@ enum WarriorSpells
WARRIOR_SPELL_LAST_STAND_TRIGGERED = 12976,
};
-class spell_warr_last_stand : public SpellHandlerScript
+class spell_warr_last_stand : public SpellScriptLoader
{
public:
- spell_warr_last_stand() : SpellHandlerScript("spell_warr_last_stand") { }
+ spell_warr_last_stand() : SpellScriptLoader("spell_warr_last_stand") { }
class spell_warr_last_stand_SpellScript : public SpellScript
{
@@ -51,7 +51,7 @@ class spell_warr_last_stand : public SpellHandlerScript
void Register()
{
// add dummy effect spell handler to Last Stand
- EffectHandlers += EffectHandlerFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ OnEffect += SpellEffectFn(spell_warr_last_stand_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};