diff options
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/SpellScript.h | 9 | ||||
-rw-r--r-- | src/server/scripts/Examples/example_spell.cpp | 22 |
3 files changed, 29 insertions, 4 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index eb7c2c9b4fa..af5eab71799 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7097,7 +7097,7 @@ void Spell::SelectTrajTargets() void Spell::LoadScripts() { - sLog.outError("Spell::LoadScripts"); + sLog.outDebug("Spell::LoadScripts"); sScriptMgr.CreateSpellScripts(m_spellInfo->Id, m_loadedScripts); for(std::list<SpellScript *>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) { diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index d80f3b5468d..b7a83748b75 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -124,11 +124,18 @@ class SpellScript : public _SpellScript Unit * GetCaster(); Unit * GetOriginalCaster(); SpellEntry const * GetSpellInfo(); + // functions useable only during spell hit on target phase - Unit * GetEffectUnitTarget(); + + // returns: target of current effect if it was Unit otherwise NULL + Unit * GetEffectUnitTarget(); + // returns: target of current effect if it was Creature otherwise NULL Creature * GetEffectCreatureTarget(); + // returns: target of current effect if it was Player otherwise NULL Player * GetEffectPlayerTarget(); + // returns: target of current effect if it was Item otherwise NULL Item * GetEffectItemTarget(); + // returns: target of current effect if it was GameObject otherwise NULL GameObject * GetEffectGOTarget(); int32 GetEffectValue(); }; diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 149cd09d4c9..90655127aa9 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -26,10 +26,9 @@ class spell_ex_49375SpellScript : public SpellScript { -public: std::string localVariable; char * localVariable2; -private: + // effect handler hook - effIndex - effIndex of handled effect of a spell void HandleDummy(SpellEffIndex effIndex) { @@ -87,6 +86,25 @@ SpellScript * GetSpellScript_spell_ex_49375() return new spell_ex_49375SpellScript(); } +/* empty script for copypasting +class spell_ex_SpellScript : public SpellScript +{ + void Function(SpellEffIndex effIndex){} + 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_spell_ex_() +{ + return new spell_ex_SpellScript(); +} +*/ + // this function has to be added to function set in ScriptLoader.cpp void AddSC_example_spell_scripts() { |