diff options
| -rw-r--r-- | src/common/Utilities/Util.h | 32 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 21 | ||||
| -rw-r--r-- | src/server/game/Scripting/ScriptMgr.h | 5 | ||||
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 115 | ||||
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.h | 4 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 73 | ||||
| -rw-r--r-- | src/server/game/Spells/Spell.h | 2 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.cpp | 64 | ||||
| -rw-r--r-- | src/server/game/Spells/SpellScript.h | 6 | 
9 files changed, 154 insertions, 168 deletions
| diff --git a/src/common/Utilities/Util.h b/src/common/Utilities/Util.h index fc322a89583..25cd20f27ac 100644 --- a/src/common/Utilities/Util.h +++ b/src/common/Utilities/Util.h @@ -327,33 +327,35 @@ TC_COMMON_API bool StringToBool(std::string const& str);  // simple class for not-modifyable list  template <typename T> -class HookList +class HookList final  { -    typedef typename std::list<T>::iterator ListIterator; +    typedef std::vector<T> ContainerType; +      private: -        typename std::list<T> m_list; +        typename ContainerType _container; +      public: -        HookList<T> & operator+=(T t) -        { -            m_list.push_back(t); -            return *this; -        } -        HookList<T> & operator-=(T t) +        typedef typename ContainerType::iterator iterator; + +        HookList<T>& operator+=(T t)          { -            m_list.remove(t); +            _container.push_back(t);              return *this;          } +          size_t size()          { -            return m_list.size(); +            return _container.size();          } -        ListIterator begin() + +        iterator begin()          { -            return m_list.begin(); +            return _container.begin();          } -        ListIterator end() + +        iterator end()          { -            return m_list.end(); +            return _container.end();          }  }; diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 2737c852d98..b9357d60967 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1202,12 +1202,11 @@ void ScriptMgr::FillSpellSummary()      }  } -template<typename T, typename F> -void CreateSpellOrAuraScripts(uint32 spellId, std::list<T*>& scriptVector, F&& extractor) +template<typename T, typename F, typename O> +void CreateSpellOrAuraScripts(uint32 spellId, std::vector<T*>& scriptVector, F&& extractor, O* objectInvoker)  {      SpellScriptsBounds bounds = sObjectMgr->GetSpellScriptsBounds(spellId); - -    for (SpellScriptsContainer::iterator itr = bounds.first; itr != bounds.second; ++itr) +    for (auto itr = bounds.first; itr != bounds.second; ++itr)      {          // When the script is disabled continue with the next one          if (!itr->second.second) @@ -1218,24 +1217,28 @@ void CreateSpellOrAuraScripts(uint32 spellId, std::list<T*>& scriptVector, F&& e              continue;          T* script = (*tmpscript.*extractor)(); -          if (!script)              continue;          script->_Init(&tmpscript->GetName(), spellId); +        if (!script->_Load(objectInvoker)) +        { +            delete script; +            continue; +        }          scriptVector.push_back(script);      }  } -void ScriptMgr::CreateSpellScripts(uint32 spellId, std::list<SpellScript*>& scriptVector) +void ScriptMgr::CreateSpellScripts(uint32 spellId, std::vector<SpellScript*>& scriptVector, Spell* invoker) const  { -    CreateSpellOrAuraScripts(spellId, scriptVector, &SpellScriptLoader::GetSpellScript); +    CreateSpellOrAuraScripts(spellId, scriptVector, &SpellScriptLoader::GetSpellScript, invoker);  } -void ScriptMgr::CreateAuraScripts(uint32 spellId, std::list<AuraScript*>& scriptVector) +void ScriptMgr::CreateAuraScripts(uint32 spellId, std::vector<AuraScript*>& scriptVector, Aura* invoker) const  { -    CreateSpellOrAuraScripts(spellId, scriptVector, &SpellScriptLoader::GetAuraScript); +    CreateSpellOrAuraScripts(spellId, scriptVector, &SpellScriptLoader::GetAuraScript, invoker);  }  SpellScriptLoader* ScriptMgr::GetSpellScriptLoader(uint32 scriptId) diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index a6cce299645..22a84804089 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -29,6 +29,7 @@  class AccountMgr;  class AuctionHouseObject; +class Aura;  class AuraScript;  class Battleground;  class BattlegroundMap; @@ -896,8 +897,8 @@ class TC_GAME_API ScriptMgr      public: /* SpellScriptLoader */ -        void CreateSpellScripts(uint32 spellId, std::list<SpellScript*>& scriptVector); -        void CreateAuraScripts(uint32 spellId, std::list<AuraScript*>& scriptVector); +        void CreateSpellScripts(uint32 spellId, std::vector<SpellScript*>& scriptVector, Spell* invoker) const; +        void CreateAuraScripts(uint32 spellId, std::vector<AuraScript*>& scriptVector, Aura* invoker) const;          SpellScriptLoader* GetSpellScriptLoader(uint32 scriptId);      public: /* ServerScript */ diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 826d7ee6b65..39797269c2b 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -360,7 +360,7 @@ m_procCooldown(std::chrono::steady_clock::time_point::min())  AuraScript* Aura::GetScriptByName(std::string const& scriptName) const  { -    for (std::list<AuraScript*>::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr) +    for (auto itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)          if ((*itr)->_GetScriptName()->compare(scriptName) == 0)              return *itr;      return NULL; @@ -381,12 +381,10 @@ void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount)  Aura::~Aura()  {      // unload scripts -    while (!m_loadedScripts.empty()) +    for (auto itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)      { -        std::list<AuraScript*>::iterator itr = m_loadedScripts.begin();          (*itr)->_Unload();          delete (*itr); -        m_loadedScripts.erase(itr);      }      // free effects memory @@ -2044,30 +2042,21 @@ void Aura::_DeleteRemovedApplications()  void Aura::LoadScripts()  { -    sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts); -    for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();) +    sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts, this); +    for (auto itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)      { -        if (!(*itr)->_Load(this)) -        { -            std::list<AuraScript*>::iterator bitr = itr; -            ++itr; -            delete (*bitr); -            m_loadedScripts.erase(bitr); -            continue; -        }          TC_LOG_DEBUG("spells", "Aura::LoadScripts: Script `%s` for aura `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);          (*itr)->Register(); -        ++itr;      }  }  bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)  {      bool result = true; -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET); -        std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin(); +        auto hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();          for (; hookItr != hookItrEnd; ++hookItr)              result &= hookItr->Call(*scritr, target); @@ -2078,10 +2067,10 @@ bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)  void Aura::CallScriptDispel(DispelInfo* dispelInfo)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL); -        std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin(); +        auto hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();          for (; hookItr != hookItrEnd; ++hookItr)              hookItr->Call(*scritr, dispelInfo); @@ -2091,10 +2080,10 @@ void Aura::CallScriptDispel(DispelInfo* dispelInfo)  void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL); -        std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin(); +        auto hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();          for (; hookItr != hookItrEnd; ++hookItr)              hookItr->Call(*scritr, dispelInfo); @@ -2105,10 +2094,10 @@ void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)  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) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp); -        std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin(); +        auto effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, mode); @@ -2125,10 +2114,10 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati  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) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp); -        std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin(); +        auto effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, mode); @@ -2143,10 +2132,10 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat  void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp); -        std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin(); +        auto effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, mode); @@ -2157,10 +2146,10 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl  void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp); -        std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin(); +        auto effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, mode); @@ -2172,10 +2161,10 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp  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) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp); -        std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin(); +        auto effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff); @@ -2191,10 +2180,10 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic  void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC); -        std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin(); +        auto effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff); @@ -2205,10 +2194,10 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* 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) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT); -        std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin(); +        auto effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, amount, canBeRecalculated); @@ -2219,10 +2208,10 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &  void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC); -        std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin(); +        auto effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, isPeriodic, amplitude); @@ -2233,10 +2222,10 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &  void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD); -        std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin(); +        auto effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, spellMod); @@ -2247,10 +2236,10 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM  void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool& defaultPrevented)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp); -        std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin(); +        auto effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex())) @@ -2265,10 +2254,10 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co  void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp); -        std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin(); +        auto effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount); @@ -2279,10 +2268,10 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplicati  void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp); -        std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin(); +        auto effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount); @@ -2293,10 +2282,10 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplicatio  void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp); -        std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin(); +        auto effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount); @@ -2307,10 +2296,10 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraAppli  void Aura::CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & splitAmount)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp); -        std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin(); +        auto effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, dmgInfo, splitAmount); @@ -2322,10 +2311,10 @@ void Aura::CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication con  bool Aura::CallScriptCheckProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)  {      bool result = true; -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp); -        std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin(); +        auto hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();          for (; hookItr != hookItrEnd; ++hookItr)              result &= hookItr->Call(*scritr, eventInfo); @@ -2338,10 +2327,10 @@ bool Aura::CallScriptCheckProcHandlers(AuraApplication const* aurApp, ProcEventI  bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)  {      bool prepare = true; -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp); -        std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin(); +        auto effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();          for (; effItr != effEndItr; ++effItr)              effItr->Call(*scritr, eventInfo); @@ -2357,10 +2346,10 @@ bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEven  bool Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)  {      bool handled = false; -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp); -        std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin(); +        auto hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();          for (; hookItr != hookItrEnd; ++hookItr)              hookItr->Call(*scritr, eventInfo); @@ -2373,10 +2362,10 @@ bool Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo&  void Aura::CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp); -        std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin(); +        auto hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();          for (; hookItr != hookItrEnd; ++hookItr)              hookItr->Call(*scritr, eventInfo); @@ -2387,10 +2376,10 @@ void Aura::CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventI  bool Aura::CallScriptCheckEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo)  {      bool result = true; -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_EFFECT_PROC, aurApp); -        std::list<AuraScript::CheckEffectProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckEffectProc.end(), hookItr = (*scritr)->DoCheckEffectProc.begin(); +        auto hookItrEnd = (*scritr)->DoCheckEffectProc.end(), hookItr = (*scritr)->DoCheckEffectProc.begin();          for (; hookItr != hookItrEnd; ++hookItr)              if (hookItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  result &= hookItr->Call(*scritr, aurEff, eventInfo); @@ -2404,10 +2393,10 @@ bool Aura::CallScriptCheckEffectProcHandlers(AuraEffect const* aurEff, AuraAppli  bool Aura::CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo)  {      bool preventDefault = false; -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp); -        std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin(); +        auto effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, eventInfo); @@ -2422,10 +2411,10 @@ bool Aura::CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplicatio  void Aura::CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo)  { -    for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp); -        std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin(); +        auto effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();          for (; effItr != effEndItr; ++effItr)              if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))                  effItr->Call(*scritr, aurEff, eventInfo); diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index a6dd29f11d0..450a8c4dde2 100644 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -238,9 +238,11 @@ class TC_GAME_API Aura          AuraScript* GetScriptByName(std::string const& scriptName) const; -        std::list<AuraScript*> m_loadedScripts; +        std::vector<AuraScript*> m_loadedScripts; +      private:          void _DeleteRemovedApplications(); +      protected:          SpellInfo const* const m_spellInfo;          ObjectGuid const m_casterGuid; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 621e8cd185d..289c37077ab 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -626,12 +626,10 @@ m_caster((info->HasAttribute(SPELL_ATTR6_CAST_BY_CHARMER) && caster->GetCharmerO  Spell::~Spell()  {      // unload scripts -    while (!m_loadedScripts.empty()) +    for (auto itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)      { -        std::list<SpellScript*>::iterator itr = m_loadedScripts.begin();          (*itr)->_Unload();          delete (*itr); -        m_loadedScripts.erase(itr);      }      if (m_referencedFromCurrentSpell && m_selfContainer && *m_selfContainer == this) @@ -7189,29 +7187,20 @@ void Spell::AssertEffectExecuteData() const  void Spell::LoadScripts()  { -    sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts); -    for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();) +    sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts, this); +    for (auto itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)      { -        if (!(*itr)->_Load(this)) -        { -            std::list<SpellScript*>::iterator bitr = itr; -            ++itr; -            delete (*bitr); -            m_loadedScripts.erase(bitr); -            continue; -        }          TC_LOG_DEBUG("spells", "Spell::LoadScripts: Script `%s` for spell `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);          (*itr)->Register(); -        ++itr;      }  }  void Spell::CallScriptBeforeCastHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_CAST); -        std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin(); +        auto hookItrEnd = (*scritr)->BeforeCast.end(), hookItr = (*scritr)->BeforeCast.begin();          for (; hookItr != hookItrEnd; ++hookItr)              (*hookItr).Call(*scritr); @@ -7221,10 +7210,10 @@ void Spell::CallScriptBeforeCastHandlers()  void Spell::CallScriptOnCastHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_ON_CAST); -        std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin(); +        auto hookItrEnd = (*scritr)->OnCast.end(), hookItr = (*scritr)->OnCast.begin();          for (; hookItr != hookItrEnd; ++hookItr)              (*hookItr).Call(*scritr); @@ -7234,10 +7223,10 @@ void Spell::CallScriptOnCastHandlers()  void Spell::CallScriptAfterCastHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_CAST); -        std::list<SpellScript::CastHandler>::iterator hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin(); +        auto hookItrEnd = (*scritr)->AfterCast.end(), hookItr = (*scritr)->AfterCast.begin();          for (; hookItr != hookItrEnd; ++hookItr)              (*hookItr).Call(*scritr); @@ -7248,10 +7237,10 @@ void Spell::CallScriptAfterCastHandlers()  SpellCastResult Spell::CallScriptCheckCastHandlers()  {      SpellCastResult retVal = SPELL_CAST_OK; -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST); -        std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin(); +        auto hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin();          for (; hookItr != hookItrEnd; ++hookItr)          {              SpellCastResult tempResult = (*hookItr).Call(*scritr); @@ -7266,7 +7255,7 @@ SpellCastResult Spell::CallScriptCheckCastHandlers()  void Spell::PrepareScriptHitHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)          (*scritr)->_InitHit();  } @@ -7274,9 +7263,9 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo  {      // execute script effect handler hooks and check if effects was prevented      bool preventDefault = false; -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      { -        std::list<SpellScript::EffectHandler>::iterator effItr, effEndItr; +        HookList<SpellScript::EffectHandler>::iterator effItr, effEndItr;          SpellScriptHookType hookType;          switch (mode)          { @@ -7320,10 +7309,10 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMo  void Spell::CallScriptSuccessfulDispel(SpellEffIndex effIndex)  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_EFFECT_SUCCESSFUL_DISPEL); -        std::list<SpellScript::EffectHandler>::iterator hookItrEnd = (*scritr)->OnEffectSuccessfulDispel.end(), hookItr = (*scritr)->OnEffectSuccessfulDispel.begin(); +        auto hookItrEnd = (*scritr)->OnEffectSuccessfulDispel.end(), hookItr = (*scritr)->OnEffectSuccessfulDispel.begin();          for (; hookItr != hookItrEnd; ++hookItr)              hookItr->Call(*scritr, effIndex); @@ -7333,10 +7322,10 @@ void Spell::CallScriptSuccessfulDispel(SpellEffIndex effIndex)  void Spell::CallScriptBeforeHitHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT); -        std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin(); +        auto hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin();          for (; hookItr != hookItrEnd; ++hookItr)              (*hookItr).Call(*scritr); @@ -7346,10 +7335,10 @@ void Spell::CallScriptBeforeHitHandlers()  void Spell::CallScriptOnHitHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT); -        std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin(); +        auto hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin();          for (; hookItr != hookItrEnd; ++hookItr)              (*hookItr).Call(*scritr); @@ -7359,10 +7348,10 @@ void Spell::CallScriptOnHitHandlers()  void Spell::CallScriptAfterHitHandlers()  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT); -        std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin(); +        auto hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin();          for (; hookItr != hookItrEnd; ++hookItr)              (*hookItr).Call(*scritr); @@ -7372,10 +7361,10 @@ void Spell::CallScriptAfterHitHandlers()  void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT); -        std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin(); +        auto hookItrEnd = (*scritr)->OnObjectAreaTargetSelect.end(), hookItr = (*scritr)->OnObjectAreaTargetSelect.begin();          for (; hookItr != hookItrEnd; ++hookItr)              if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())                  hookItr->Call(*scritr, targets); @@ -7386,10 +7375,10 @@ void Spell::CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& ta  void Spell::CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT); -        std::list<SpellScript::ObjectTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin(); +        auto hookItrEnd = (*scritr)->OnObjectTargetSelect.end(), hookItr = (*scritr)->OnObjectTargetSelect.begin();          for (; hookItr != hookItrEnd; ++hookItr)              if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())                  hookItr->Call(*scritr, target); @@ -7400,10 +7389,10 @@ void Spell::CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffI  void Spell::CallScriptDestinationTargetSelectHandlers(SpellDestination& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType)  { -    for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr) +    for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)      {          (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT); -        std::list<SpellScript::DestinationTargetSelectHandler>::iterator hookItrEnd = (*scritr)->OnDestinationTargetSelect.end(), hookItr = (*scritr)->OnDestinationTargetSelect.begin(); +        auto hookItrEnd = (*scritr)->OnDestinationTargetSelect.end(), hookItr = (*scritr)->OnDestinationTargetSelect.begin();          for (; hookItr != hookItrEnd; ++hookItr)              if (hookItr->IsEffectAffected(m_spellInfo, effIndex) && targetType.GetTarget() == hookItr->GetTarget())                  hookItr->Call(*scritr, target); @@ -7418,15 +7407,15 @@ bool Spell::CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToC      if (m_loadedScripts.empty())          return true; -    for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr) +    for (auto itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)      { -        std::list<SpellScript::ObjectTargetSelectHandler>::iterator targetSelectHookEnd = (*itr)->OnObjectTargetSelect.end(), targetSelectHookItr = (*itr)->OnObjectTargetSelect.begin(); +        auto targetSelectHookEnd = (*itr)->OnObjectTargetSelect.end(), targetSelectHookItr = (*itr)->OnObjectTargetSelect.begin();          for (; targetSelectHookItr != targetSelectHookEnd; ++targetSelectHookItr)              if (((*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && !(*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)) ||                  (!(*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && (*targetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)))                  return false; -        std::list<SpellScript::ObjectAreaTargetSelectHandler>::iterator areaTargetSelectHookEnd = (*itr)->OnObjectAreaTargetSelect.end(), areaTargetSelectHookItr = (*itr)->OnObjectAreaTargetSelect.begin(); +        auto areaTargetSelectHookEnd = (*itr)->OnObjectAreaTargetSelect.end(), areaTargetSelectHookItr = (*itr)->OnObjectAreaTargetSelect.begin();          for (; areaTargetSelectHookItr != areaTargetSelectHookEnd; ++areaTargetSelectHookItr)              if (((*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && !(*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck)) ||                  (!(*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndex) && (*areaTargetSelectHookItr).IsEffectAffected(m_spellInfo, effIndexToCheck))) diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 884591d81d8..881e95fc9a4 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -662,7 +662,7 @@ class TC_GAME_API Spell          void CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);          void CallScriptDestinationTargetSelectHandlers(SpellDestination& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);          bool CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToCheck); -        std::list<SpellScript*> m_loadedScripts; +        std::vector<SpellScript*> m_loadedScripts;          struct HitTriggerSpell          { diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 67aaa582776..7e9932511cd 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -301,35 +301,35 @@ void SpellScript::DestinationTargetSelectHandler::Call(SpellScript* spellScript,  bool SpellScript::_Validate(SpellInfo const* entry)  { -    for (std::list<EffectHandler>::iterator itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr) +    for (auto itr = OnEffectLaunch.begin(); itr != OnEffectLaunch.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunch` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectHandler>::iterator itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr) +    for (auto itr = OnEffectLaunchTarget.begin(); itr != OnEffectLaunchTarget.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectLaunchTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectHandler>::iterator itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr) +    for (auto itr = OnEffectHit.begin(); itr != OnEffectHit.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHit` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectHandler>::iterator itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr) +    for (auto itr = OnEffectHitTarget.begin(); itr != OnEffectHitTarget.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectHitTarget` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectHandler>::iterator itr = OnEffectSuccessfulDispel.begin(); itr != OnEffectSuccessfulDispel.end(); ++itr) +    for (auto itr = OnEffectSuccessfulDispel.begin(); itr != OnEffectSuccessfulDispel.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSuccessfulDispel` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<ObjectAreaTargetSelectHandler>::iterator itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr) +    for (auto itr = OnObjectAreaTargetSelect.begin(); itr != OnObjectAreaTargetSelect.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectAreaTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<ObjectTargetSelectHandler>::iterator itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr) +    for (auto itr = OnObjectTargetSelect.begin(); itr != OnObjectTargetSelect.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnObjectTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<DestinationTargetSelectHandler>::iterator itr = OnDestinationTargetSelect.begin(); itr != OnDestinationTargetSelect.end(); ++itr) +    for (auto itr = OnDestinationTargetSelect.begin(); itr != OnDestinationTargetSelect.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnDestinationTargetSelect` of SpellScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); @@ -648,99 +648,99 @@ SpellValue const* SpellScript::GetSpellValue()  bool AuraScript::_Validate(SpellInfo const* entry)  { -    for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end();  ++itr) +    for (auto itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end();  ++itr)          if (!entry->HasAreaAuraEffect() && !entry->HasEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA) && !entry->HasEffect(SPELL_EFFECT_APPLY_AURA))              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<AuraDispelHandler>::iterator itr = OnDispel.begin(); itr != OnDispel.end();  ++itr) +    for (auto itr = OnDispel.begin(); itr != OnDispel.end();  ++itr)          if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<AuraDispelHandler>::iterator itr = AfterDispel.begin(); itr != AfterDispel.end();  ++itr) +    for (auto itr = AfterDispel.begin(); itr != AfterDispel.end();  ++itr)          if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterDispel` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end();  ++itr) +    for (auto itr = OnEffectApply.begin(); itr != OnEffectApply.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectApplyHandler>::iterator itr = OnEffectRemove.begin(); itr != OnEffectRemove.end();  ++itr) +    for (auto itr = OnEffectRemove.begin(); itr != OnEffectRemove.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectApplyHandler>::iterator itr = AfterEffectApply.begin(); itr != AfterEffectApply.end();  ++itr) +    for (auto itr = AfterEffectApply.begin(); itr != AfterEffectApply.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectApply` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectApplyHandler>::iterator itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end();  ++itr) +    for (auto itr = AfterEffectRemove.begin(); itr != AfterEffectRemove.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectRemove` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectPeriodicHandler>::iterator itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end();  ++itr) +    for (auto itr = OnEffectPeriodic.begin(); itr != OnEffectPeriodic.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectUpdatePeriodicHandler>::iterator itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end();  ++itr) +    for (auto itr = OnEffectUpdatePeriodic.begin(); itr != OnEffectUpdatePeriodic.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectUpdatePeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectCalcAmountHandler>::iterator itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end();  ++itr) +    for (auto itr = DoEffectCalcAmount.begin(); itr != DoEffectCalcAmount.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcAmount` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectCalcPeriodicHandler>::iterator itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end();  ++itr) +    for (auto itr = DoEffectCalcPeriodic.begin(); itr != DoEffectCalcPeriodic.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcPeriodic` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectCalcSpellModHandler>::iterator itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end();  ++itr) +    for (auto itr = DoEffectCalcSpellMod.begin(); itr != DoEffectCalcSpellMod.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoEffectCalcSpellMod` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectAbsorbHandler>::iterator itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end();  ++itr) +    for (auto itr = OnEffectAbsorb.begin(); itr != OnEffectAbsorb.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectAbsorbHandler>::iterator itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end();  ++itr) +    for (auto itr = AfterEffectAbsorb.begin(); itr != AfterEffectAbsorb.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectAbsorb` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectManaShieldHandler>::iterator itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end();  ++itr) +    for (auto itr = OnEffectManaShield.begin(); itr != OnEffectManaShield.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectManaShieldHandler>::iterator itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end();  ++itr) +    for (auto itr = AfterEffectManaShield.begin(); itr != AfterEffectManaShield.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectManaShield` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectSplitHandler>::iterator itr = OnEffectSplit.begin(); itr != OnEffectSplit.end();  ++itr) +    for (auto itr = OnEffectSplit.begin(); itr != OnEffectSplit.end();  ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectSplit` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<CheckProcHandler>::iterator itr = DoCheckProc.begin(); itr != DoCheckProc.end(); ++itr) +    for (auto itr = DoCheckProc.begin(); itr != DoCheckProc.end(); ++itr)          if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoCheckProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<CheckEffectProcHandler>::iterator itr = DoCheckEffectProc.begin(); itr != DoCheckEffectProc.end(); ++itr) +    for (auto itr = DoCheckEffectProc.begin(); itr != DoCheckEffectProc.end(); ++itr)          if (!itr->GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `DoCheckEffectProc` of AuraScript won't be executed", entry->Id, itr->ToString().c_str(), m_scriptName->c_str()); -    for (std::list<AuraProcHandler>::iterator itr = DoPrepareProc.begin(); itr != DoPrepareProc.end(); ++itr) +    for (auto itr = DoPrepareProc.begin(); itr != DoPrepareProc.end(); ++itr)          if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `DoPrepareProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<AuraProcHandler>::iterator itr = OnProc.begin(); itr != OnProc.end(); ++itr) +    for (auto itr = OnProc.begin(); itr != OnProc.end(); ++itr)          if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `OnProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<AuraProcHandler>::iterator itr = AfterProc.begin(); itr != AfterProc.end(); ++itr) +    for (auto itr = AfterProc.begin(); itr != AfterProc.end(); ++itr)          if (!entry->HasEffect(SPELL_EFFECT_APPLY_AURA) && !entry->HasAreaAuraEffect())              TC_LOG_ERROR("scripts", "Spell `%u` of script `%s` does not have apply aura effect - handler bound to hook `AfterProc` of AuraScript won't be executed", entry->Id, m_scriptName->c_str()); -    for (std::list<EffectProcHandler>::iterator itr = OnEffectProc.begin(); itr != OnEffectProc.end(); ++itr) +    for (auto itr = OnEffectProc.begin(); itr != OnEffectProc.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `OnEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); -    for (std::list<EffectProcHandler>::iterator itr = AfterEffectProc.begin(); itr != AfterEffectProc.end(); ++itr) +    for (auto itr = AfterEffectProc.begin(); itr != AfterEffectProc.end(); ++itr)          if (!(*itr).GetAffectedEffectsMask(entry))              TC_LOG_ERROR("scripts", "Spell `%u` Effect `%s` of script `%s` did not match dbc effect data - handler bound to hook `AfterEffectProc` of AuraScript won't be executed", entry->Id, (*itr).ToString().c_str(), m_scriptName->c_str()); diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index 1ec10f03820..d3c874cda43 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -63,9 +63,9 @@ class TC_GAME_API _SpellScript      public:          _SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(NULL), m_scriptSpellId(0) {}          virtual ~_SpellScript() { } -        virtual void _Register(); -        virtual void _Unload(); -        virtual void _Init(std::string const* scriptname, uint32 spellId); +        void _Register(); +        void _Unload(); +        void _Init(std::string const* scriptname, uint32 spellId);          std::string const* _GetScriptName() const;      protected: | 
