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:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user