aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellScript.cpp
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2017-01-12 23:03:08 +0100
committerjoschiwald <joschiwald.trinity@gmail.com>2017-01-12 23:03:08 +0100
commit2b5d7eef3a091e67c27e853d43ac0bebbfa67531 (patch)
tree61e403e546fabfdda672102ee87bdfbc499245f1 /src/server/game/Spells/SpellScript.cpp
parentf8fe750b5ecefbf313b17013b7e5d0949cab4568 (diff)
Core/SpellScripts: Added helper method to validate spells
Diffstat (limited to 'src/server/game/Spells/SpellScript.cpp')
-rw-r--r--src/server/game/Spells/SpellScript.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp
index c50043fd2dd..16074c1534d 100644
--- a/src/server/game/Spells/SpellScript.cpp
+++ b/src/server/game/Spells/SpellScript.cpp
@@ -18,6 +18,7 @@
#include "Spell.h"
#include "ScriptMgr.h"
#include "SpellAuras.h"
+#include "SpellMgr.h"
#include "SpellScript.h"
#include <string>
@@ -32,6 +33,17 @@ bool _SpellScript::_Validate(SpellInfo const* entry)
return true;
}
+bool _SpellScript::ValidateSpellInfo(std::vector<uint32> spellIds)
+{
+ for (uint32 spellId : spellIds)
+ if (!sSpellMgr->GetSpellInfo(spellId))
+ {
+ TC_LOG_ERROR("scripts.spells", "_SpellScript::ValidateSpellInfo: Spell %u does not exist.", spellId);
+ return false;
+ }
+ return true;
+}
+
void _SpellScript::_Register()
{
m_currentScriptState = SPELL_SCRIPT_STATE_REGISTRATION;