Core/Spells: Allow spell scripts to access other scripts attached to a spell

Port From (https://github.com/TrinityCore/TrinityCore/commit/4c66c09e38ab327019f63f3c7beadb72f4647123)
This commit is contained in:
Hondacrx
2025-12-08 09:43:35 -05:00
parent f5fabb8134
commit da953c07ab
+10
View File
@@ -8257,6 +8257,16 @@ namespace Game.Spells
return true; return true;
} }
public Script GetScript<Script>() where Script : SpellScript
{
return GetScriptByType(typeof(Script)) as Script;
}
public SpellScript GetScriptByType(Type type)
{
return m_loadedScripts.Find(script => script.GetType() == type);
}
public bool CanExecuteTriggersOnHit(Unit unit, SpellInfo triggeredByAura = null) public bool CanExecuteTriggersOnHit(Unit unit, SpellInfo triggeredByAura = null)
{ {
bool onlyOnTarget = triggeredByAura != null && triggeredByAura.HasAttribute(SpellAttr4.ClassTriggerOnlyOnTarget); bool onlyOnTarget = triggeredByAura != null && triggeredByAura.HasAttribute(SpellAttr4.ClassTriggerOnlyOnTarget);