diff options
Diffstat (limited to 'src/server/game/Spells/SpellScript.h')
-rw-r--r-- | src/server/game/Spells/SpellScript.h | 47 |
1 files changed, 33 insertions, 14 deletions
diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 330727cdc1e..03f06961a4b 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -18,27 +18,34 @@ #ifndef __SPELL_SCRIPT_H #define __SPELL_SCRIPT_H -#include "Util.h" +#include "ObjectGuid.h" #include "SharedDefines.h" #include "SpellAuraDefines.h" -#include "Spell.h" -#include "ScriptReloadMgr.h" +#include "Util.h" +#include <memory> #include <stack> -class Unit; -class SpellInfo; -class SpellScript; -class Spell; class Aura; +class AuraApplication; class AuraEffect; -struct SpellModifier; class Creature; -class GameObject; +class DamageInfo; +class DispelInfo; class DynamicObject; -class Player; +class GameObject; class Item; +class ModuleReference; +class Player; +class ProcEventInfo; +class Spell; +class SpellInfo; +class SpellScript; +class Unit; class WorldLocation; class WorldObject; +struct SpellDestination; +struct SpellModifier; +struct SpellValue; #define SPELL_EFFECT_ANY (uint16)-1 #define SPELL_AURA_ANY (uint16)-1 @@ -61,7 +68,7 @@ class TC_GAME_API _SpellScript virtual bool _Validate(SpellInfo const* entry); public: - _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(NULL), m_scriptSpellId(0) {} + _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(nullptr), m_scriptSpellId(0) {} virtual ~_SpellScript() { } void _Register(); void _Unload(); @@ -133,7 +140,19 @@ class TC_GAME_API _SpellScript // use for: deallocating memory allocated by script virtual void Unload() { } // Helpers - static bool ValidateSpellInfo(std::vector<uint32> const& spellIds); + static bool ValidateSpellInfo(std::initializer_list<uint32> spellIds) + { + return _ValidateSpellInfo(spellIds.begin(), spellIds.end()); + } + + template <class T> + static bool ValidateSpellInfo(T const& spellIds) + { + return _ValidateSpellInfo(std::begin(spellIds), std::end(spellIds)); + } + + private: + static bool _ValidateSpellInfo(uint32 const* begin, uint32 const* end); }; // SpellScript interface - enum used for runtime checks of script function calls @@ -657,11 +676,11 @@ class TC_GAME_API AuraScript : public _SpellScript #define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) public: - AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false) + AuraScript() : _SpellScript(), m_aura(nullptr), m_auraApplication(nullptr), m_defaultActionPrevented(false) { } bool _Validate(SpellInfo const* entry) override; bool _Load(Aura* aura); - void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL); + void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = nullptr); void _FinishScriptCall(); bool _IsDefaultActionPrevented(); private: |