diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-09-19 00:35:14 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-09-19 00:35:14 +0200 |
commit | 4c66c09e38ab327019f63f3c7beadb72f4647123 (patch) | |
tree | a77cbf4fbdd7e2d3e15b19f9cbaa2bc3092c638f /src/server/game/Spells/Spell.h | |
parent | 7f43815c988688a6ab8d9035b044389b20f4ac14 (diff) |
Core/Spells: Allow spell scripts to access other scripts attached to a spell
Diffstat (limited to 'src/server/game/Spells/Spell.h')
-rw-r--r-- | src/server/game/Spells/Spell.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 8555151235b..ec80aaae3f0 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -31,6 +31,7 @@ #include "Types.h" #include "UniqueTrackablePtr.h" #include <memory> +#include <typeinfo> namespace WorldPackets::Spells { @@ -920,6 +921,8 @@ class TC_GAME_API Spell void CallScriptCalcCritChanceHandlers(Unit const* victim, float& chance); void CallScriptCalcDamageHandlers(SpellEffectInfo const& spellEffectInfo, Unit* victim, int32& damage, int32& flatMod, float& pctMod); void CallScriptCalcHealingHandlers(SpellEffectInfo const& spellEffectInfo, Unit* victim, int32& healing, int32& flatMod, float& pctMod); + template <class Script> + Script* GetScript() const { return static_cast<Script*>(GetScriptByType(typeid(Script))); } protected: void CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); void CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType); @@ -927,6 +930,7 @@ class TC_GAME_API Spell void CallScriptEmpowerStageCompletedHandlers(int32 completedStagesCount); void CallScriptEmpowerCompletedHandlers(int32 completedStagesCount); bool CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToCheck); + SpellScript* GetScriptByType(std::type_info const& type) const; std::vector<SpellScript*> m_loadedScripts; struct HitTriggerSpell |