Scripts/Spells: Modernize spell script internals a bit
Port From (https://github.com/TrinityCore/TrinityCore/commit/228c56f3c5e23345cf2b5a391c614e52f61fe7f9)
This commit is contained in:
@@ -11,11 +11,11 @@ using System.Linq;
|
|||||||
namespace Game.Scripting
|
namespace Game.Scripting
|
||||||
{
|
{
|
||||||
// helper class from which SpellScript and SpellAura derive, use these classes instead
|
// helper class from which SpellScript and SpellAura derive, use these classes instead
|
||||||
public class BaseSpellScript
|
public class SpellScriptBase
|
||||||
{
|
{
|
||||||
// internal use classes & functions
|
// internal use classes & functions
|
||||||
// DO NOT OVERRIDE THESE IN SCRIPTS
|
// DO NOT OVERRIDE THESE IN SCRIPTS
|
||||||
public BaseSpellScript()
|
public SpellScriptBase()
|
||||||
{
|
{
|
||||||
m_currentScriptState = (byte)SpellScriptState.None;
|
m_currentScriptState = (byte)SpellScriptState.None;
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ namespace Game.Scripting
|
|||||||
m_scriptName = scriptname;
|
m_scriptName = scriptname;
|
||||||
m_scriptSpellId = spellId;
|
m_scriptSpellId = spellId;
|
||||||
}
|
}
|
||||||
public string _GetScriptName()
|
public string GetScriptName()
|
||||||
{
|
{
|
||||||
return m_scriptName;
|
return m_scriptName;
|
||||||
}
|
}
|
||||||
@@ -107,33 +107,33 @@ namespace Game.Scripting
|
|||||||
_effIndex = effIndex;
|
_effIndex = effIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetAffectedEffectsMask(SpellInfo spellEntry)
|
public uint GetAffectedEffectsMask(SpellInfo spellInfo)
|
||||||
{
|
{
|
||||||
uint mask = 0;
|
uint mask = 0;
|
||||||
if ((_effIndex == SpellConst.EffectAll) || (_effIndex == SpellConst.EffectFirstFound))
|
if (_effIndex == SpellConst.EffectAll || _effIndex == SpellConst.EffectFirstFound)
|
||||||
{
|
{
|
||||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||||
{
|
{
|
||||||
if ((_effIndex == SpellConst.EffectFirstFound) && mask != 0)
|
if (_effIndex == SpellConst.EffectFirstFound && mask != 0)
|
||||||
return mask;
|
return mask;
|
||||||
if (CheckEffect(spellEntry, i))
|
if (CheckEffect(spellInfo, i))
|
||||||
mask |= (1u << i);
|
mask |= 1u << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (CheckEffect(spellEntry, _effIndex))
|
if (CheckEffect(spellInfo, _effIndex))
|
||||||
mask |= (1u << (int)_effIndex);
|
mask |= 1u << (int)_effIndex;
|
||||||
}
|
}
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEffectAffected(SpellInfo spellEntry, uint effIndex)
|
public bool IsEffectAffected(SpellInfo spellInfo, uint effIndex)
|
||||||
{
|
{
|
||||||
return Convert.ToBoolean(GetAffectedEffectsMask(spellEntry) & (1 << (int)effIndex));
|
return Convert.ToBoolean(GetAffectedEffectsMask(spellInfo) & (1 << (int)effIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract bool CheckEffect(SpellInfo spellEntry, uint effIndex);
|
public abstract bool CheckEffect(SpellInfo spellInfo, uint effIndex);
|
||||||
|
|
||||||
uint _effIndex;
|
uint _effIndex;
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ namespace Game.Scripting
|
|||||||
public virtual void Unload() { }
|
public virtual void Unload() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SpellScript : BaseSpellScript
|
public class SpellScript : SpellScriptBase
|
||||||
{
|
{
|
||||||
// internal use classes & functions
|
// internal use classes & functions
|
||||||
// DO NOT OVERRIDE THESE IN SCRIPTS
|
// DO NOT OVERRIDE THESE IN SCRIPTS
|
||||||
@@ -176,60 +176,63 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
public class CastHandler
|
public class CastHandler
|
||||||
{
|
{
|
||||||
public CastHandler(SpellCastFnType _pCastHandlerScript) { pCastHandlerScript = _pCastHandlerScript; }
|
SpellCastFnType _callImpl;
|
||||||
|
|
||||||
|
public CastHandler(SpellCastFnType callImpl) { _callImpl = callImpl; }
|
||||||
|
|
||||||
public void Call()
|
public void Call()
|
||||||
{
|
{
|
||||||
pCastHandlerScript();
|
_callImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellCastFnType pCastHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CheckCastHandler
|
public class CheckCastHandler
|
||||||
{
|
{
|
||||||
public CheckCastHandler(SpellCheckCastFnType checkCastHandlerScript)
|
SpellCheckCastFnType _callImpl;
|
||||||
|
|
||||||
|
public CheckCastHandler(SpellCheckCastFnType callImpl)
|
||||||
{
|
{
|
||||||
_checkCastHandlerScript = checkCastHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpellCastResult Call()
|
public SpellCastResult Call()
|
||||||
{
|
{
|
||||||
return _checkCastHandlerScript();
|
return _callImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellCheckCastFnType _checkCastHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OnCalculateResistAbsorbHandler
|
public class OnCalculateResistAbsorbHandler
|
||||||
{
|
{
|
||||||
public OnCalculateResistAbsorbHandler(SpellOnResistAbsorbCalculateFnType onResistAbsorbCalculateHandlerScript)
|
SpellOnResistAbsorbCalculateFnType _callImpl;
|
||||||
|
|
||||||
|
public OnCalculateResistAbsorbHandler(SpellOnResistAbsorbCalculateFnType callImpl)
|
||||||
{
|
{
|
||||||
_onCalculateResistAbsorbHandlerScript = onResistAbsorbCalculateHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(DamageInfo damageInfo, ref uint resistAmount, ref int absorbAmount)
|
public void Call(DamageInfo damageInfo, ref uint resistAmount, ref int absorbAmount)
|
||||||
{
|
{
|
||||||
_onCalculateResistAbsorbHandlerScript(damageInfo, ref resistAmount, ref absorbAmount);
|
_callImpl(damageInfo, ref resistAmount, ref absorbAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellOnResistAbsorbCalculateFnType _onCalculateResistAbsorbHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectHandler : EffectHook
|
public class EffectHandler : EffectHook
|
||||||
{
|
{
|
||||||
public EffectHandler(SpellEffectFnType pEffectHandlerScript, uint effIndex, SpellEffectName effName) : base(effIndex)
|
SpellEffectName _effName;
|
||||||
|
SpellEffectFnType _callImpl;
|
||||||
|
|
||||||
|
public EffectHandler(SpellEffectFnType callImpl, uint effIndex, SpellEffectName effName) : base(effIndex)
|
||||||
{
|
{
|
||||||
_pEffectHandlerScript = pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
_effName = effName;
|
_effName = effName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckEffect(SpellInfo spellEntry, uint effIndex)
|
public override bool CheckEffect(SpellInfo spellInfo, uint effIndex)
|
||||||
{
|
{
|
||||||
if (spellEntry.GetEffects().Count <= effIndex)
|
if (spellInfo.GetEffects().Count <= effIndex)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SpellEffectInfo spellEffectInfo = spellEntry.GetEffect(effIndex);
|
SpellEffectInfo spellEffectInfo = spellInfo.GetEffect(effIndex);
|
||||||
if (spellEffectInfo.Effect == 0 && _effName == 0)
|
if (spellEffectInfo.Effect == 0 && _effName == 0)
|
||||||
return true;
|
return true;
|
||||||
if (spellEffectInfo.Effect == 0)
|
if (spellEffectInfo.Effect == 0)
|
||||||
@@ -239,59 +242,61 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
public void Call(uint effIndex)
|
public void Call(uint effIndex)
|
||||||
{
|
{
|
||||||
_pEffectHandlerScript(effIndex);
|
_callImpl(effIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellEffectName _effName;
|
|
||||||
SpellEffectFnType _pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BeforeHitHandler
|
public class BeforeHitHandler
|
||||||
{
|
{
|
||||||
public BeforeHitHandler(SpellBeforeHitFnType pBeforeHitHandlerScript)
|
SpellBeforeHitFnType _callImpl;
|
||||||
|
|
||||||
|
public BeforeHitHandler(SpellBeforeHitFnType callImpl)
|
||||||
{
|
{
|
||||||
_pBeforeHitHandlerScript = pBeforeHitHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(SpellMissInfo missInfo)
|
public void Call(SpellMissInfo missInfo)
|
||||||
{
|
{
|
||||||
_pBeforeHitHandlerScript(missInfo);
|
_callImpl(missInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellBeforeHitFnType _pBeforeHitHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HitHandler
|
public class HitHandler
|
||||||
{
|
{
|
||||||
public HitHandler(SpellHitFnType pHitHandlerScript)
|
SpellHitFnType _callImpl;
|
||||||
|
|
||||||
|
public HitHandler(SpellHitFnType callImpl)
|
||||||
{
|
{
|
||||||
_pHitHandlerScript = pHitHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call()
|
public void Call()
|
||||||
{
|
{
|
||||||
_pHitHandlerScript();
|
_callImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellHitFnType _pHitHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OnCalcCritChanceHandler
|
public class OnCalcCritChanceHandler
|
||||||
{
|
{
|
||||||
public OnCalcCritChanceHandler(SpellOnCalcCritChanceFnType onCalcCritChanceHandlerScript)
|
SpellOnCalcCritChanceFnType _callImpl;
|
||||||
|
|
||||||
|
public OnCalcCritChanceHandler(SpellOnCalcCritChanceFnType callImpl)
|
||||||
{
|
{
|
||||||
_onCalcCritChanceHandlerScript = onCalcCritChanceHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
|
||||||
public void Call(Unit victim, ref float critChance)
|
|
||||||
{
|
|
||||||
_onCalcCritChanceHandlerScript(victim, ref critChance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellOnCalcCritChanceFnType _onCalcCritChanceHandlerScript;
|
public void Call(Unit victim, ref float critChance)
|
||||||
|
{
|
||||||
|
_callImpl(victim, ref critChance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TargetHook : EffectHook
|
public class TargetHook : EffectHook
|
||||||
{
|
{
|
||||||
|
Targets _targetType;
|
||||||
|
bool _area;
|
||||||
|
bool _dest;
|
||||||
|
|
||||||
public TargetHook(uint effectIndex, Targets targetType, bool area, bool dest = false) : base(effectIndex)
|
public TargetHook(uint effectIndex, Targets targetType, bool area, bool dest = false) : base(effectIndex)
|
||||||
{
|
{
|
||||||
_targetType = targetType;
|
_targetType = targetType;
|
||||||
@@ -299,15 +304,15 @@ namespace Game.Scripting
|
|||||||
_dest = dest;
|
_dest = dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckEffect(SpellInfo spellEntry, uint effIndexToCheck)
|
public override bool CheckEffect(SpellInfo spellInfo, uint effIndexToCheck)
|
||||||
{
|
{
|
||||||
if (_targetType == 0)
|
if (_targetType == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (spellEntry.GetEffects().Count <= effIndexToCheck)
|
if (spellInfo.GetEffects().Count <= effIndexToCheck)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SpellEffectInfo spellEffectInfo = spellEntry.GetEffect(effIndexToCheck);
|
SpellEffectInfo spellEffectInfo = spellInfo.GetEffect(effIndexToCheck);
|
||||||
if (spellEffectInfo.TargetA.GetTarget() != _targetType && spellEffectInfo.TargetB.GetTarget() != _targetType)
|
if (spellEffectInfo.TargetA.GetTarget() != _targetType && spellEffectInfo.TargetB.GetTarget() != _targetType)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -353,58 +358,51 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Targets GetTarget() { return _targetType; }
|
public Targets GetTarget() { return _targetType; }
|
||||||
|
|
||||||
Targets _targetType;
|
|
||||||
bool _area;
|
|
||||||
bool _dest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObjectAreaTargetSelectHandler : TargetHook
|
public class ObjectAreaTargetSelectHandler : TargetHook
|
||||||
{
|
{
|
||||||
public ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript, uint effIndex, Targets targetType)
|
SpellObjectAreaTargetSelectFnType _callImpl;
|
||||||
: base(effIndex, targetType, true)
|
|
||||||
|
public ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType callImpl, uint effIndex, Targets targetType) : base(effIndex, targetType, true)
|
||||||
{
|
{
|
||||||
_pObjectAreaTargetSelectHandlerScript = pObjectAreaTargetSelectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(List<WorldObject> targets)
|
public void Call(List<WorldObject> targets)
|
||||||
{
|
{
|
||||||
_pObjectAreaTargetSelectHandlerScript(targets);
|
_callImpl(targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObjectTargetSelectHandler : TargetHook
|
public class ObjectTargetSelectHandler : TargetHook
|
||||||
{
|
{
|
||||||
public ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint _effIndex, Targets _targetType)
|
SpellObjectTargetSelectFnType _callImpl;
|
||||||
: base(_effIndex, _targetType, false)
|
|
||||||
|
public ObjectTargetSelectHandler(SpellObjectTargetSelectFnType callImpl, uint _effIndex, Targets _targetType) : base(_effIndex, _targetType, false)
|
||||||
{
|
{
|
||||||
pObjectTargetSelectHandlerScript = _pObjectTargetSelectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(ref WorldObject target)
|
public void Call(ref WorldObject target)
|
||||||
{
|
{
|
||||||
pObjectTargetSelectHandlerScript(ref target);
|
_callImpl(ref target);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellObjectTargetSelectFnType pObjectTargetSelectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DestinationTargetSelectHandler : TargetHook
|
public class DestinationTargetSelectHandler : TargetHook
|
||||||
{
|
{
|
||||||
public DestinationTargetSelectHandler(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint _effIndex, Targets _targetType)
|
SpellDestinationTargetSelectFnType _callImpl;
|
||||||
: base(_effIndex, _targetType, false, true)
|
|
||||||
|
public DestinationTargetSelectHandler(SpellDestinationTargetSelectFnType callImpl, uint _effIndex, Targets _targetType) : base(_effIndex, _targetType, false, true)
|
||||||
{
|
{
|
||||||
DestinationTargetSelectHandlerScript = _DestinationTargetSelectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(ref SpellDestination target)
|
public void Call(ref SpellDestination target)
|
||||||
{
|
{
|
||||||
DestinationTargetSelectHandlerScript(ref target);
|
_callImpl(ref target);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellDestinationTargetSelectFnType DestinationTargetSelectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool _Validate(SpellInfo entry)
|
public override bool _Validate(SpellInfo entry)
|
||||||
@@ -439,6 +437,7 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
return base._Validate(entry);
|
return base._Validate(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool _Load(Spell spell)
|
public bool _Load(Spell spell)
|
||||||
{
|
{
|
||||||
m_spell = spell;
|
m_spell = spell;
|
||||||
@@ -447,21 +446,27 @@ namespace Game.Scripting
|
|||||||
_FinishScriptCall();
|
_FinishScriptCall();
|
||||||
return load;
|
return load;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _InitHit()
|
public void _InitHit()
|
||||||
{
|
{
|
||||||
m_hitPreventEffectMask = 0;
|
m_hitPreventEffectMask = 0;
|
||||||
m_hitPreventDefaultEffectMask = 0;
|
m_hitPreventDefaultEffectMask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool _IsEffectPrevented(uint effIndex) { return Convert.ToBoolean(m_hitPreventEffectMask & (1 << (int)effIndex)); }
|
public bool _IsEffectPrevented(uint effIndex) { return Convert.ToBoolean(m_hitPreventEffectMask & (1 << (int)effIndex)); }
|
||||||
|
|
||||||
public bool _IsDefaultEffectPrevented(uint effIndex) { return Convert.ToBoolean(m_hitPreventDefaultEffectMask & (1 << (int)effIndex)); }
|
public bool _IsDefaultEffectPrevented(uint effIndex) { return Convert.ToBoolean(m_hitPreventDefaultEffectMask & (1 << (int)effIndex)); }
|
||||||
|
|
||||||
public void _PrepareScriptCall(SpellScriptHookType hookType)
|
public void _PrepareScriptCall(SpellScriptHookType hookType)
|
||||||
{
|
{
|
||||||
m_currentScriptState = (byte)hookType;
|
m_currentScriptState = (byte)hookType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _FinishScriptCall()
|
public void _FinishScriptCall()
|
||||||
{
|
{
|
||||||
m_currentScriptState = (byte)SpellScriptState.None;
|
m_currentScriptState = (byte)SpellScriptState.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInCheckCastHook()
|
public bool IsInCheckCastHook()
|
||||||
{
|
{
|
||||||
return m_currentScriptState == (byte)SpellScriptHookType.CheckCast;
|
return m_currentScriptState == (byte)SpellScriptHookType.CheckCast;
|
||||||
@@ -475,37 +480,27 @@ namespace Game.Scripting
|
|||||||
|| m_currentScriptState == (byte)SpellScriptHookType.AfterCast
|
|| m_currentScriptState == (byte)SpellScriptHookType.AfterCast
|
||||||
|| m_currentScriptState == (byte)SpellScriptHookType.CalcCritChance;
|
|| m_currentScriptState == (byte)SpellScriptHookType.CalcCritChance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInTargetHook()
|
public bool IsInTargetHook()
|
||||||
{
|
{
|
||||||
switch ((SpellScriptHookType)m_currentScriptState)
|
return (SpellScriptHookType)m_currentScriptState switch
|
||||||
{
|
{
|
||||||
case SpellScriptHookType.LaunchTarget:
|
SpellScriptHookType.LaunchTarget or SpellScriptHookType.EffectHitTarget or SpellScriptHookType.EffectSuccessfulDispel or SpellScriptHookType.BeforeHit or SpellScriptHookType.Hit or SpellScriptHookType.AfterHit => true,
|
||||||
case SpellScriptHookType.EffectHitTarget:
|
_ => false,
|
||||||
case SpellScriptHookType.EffectSuccessfulDispel:
|
};
|
||||||
case SpellScriptHookType.BeforeHit:
|
|
||||||
case SpellScriptHookType.Hit:
|
|
||||||
case SpellScriptHookType.AfterHit:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsInModifiableHook()
|
bool IsInModifiableHook()
|
||||||
{
|
{
|
||||||
// after hit hook executed after damage/healing is already done
|
// after hit hook executed after damage/healing is already done
|
||||||
// modifying it at this point has no effect
|
// modifying it at this point has no effect
|
||||||
switch ((SpellScriptHookType)m_currentScriptState)
|
return (SpellScriptHookType)m_currentScriptState switch
|
||||||
{
|
{
|
||||||
case SpellScriptHookType.LaunchTarget:
|
SpellScriptHookType.LaunchTarget or SpellScriptHookType.EffectHitTarget or SpellScriptHookType.BeforeHit or SpellScriptHookType.Hit => true,
|
||||||
case SpellScriptHookType.EffectHitTarget:
|
_ => false,
|
||||||
case SpellScriptHookType.BeforeHit:
|
};
|
||||||
case SpellScriptHookType.Hit:
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInHitPhase()
|
public bool IsInHitPhase()
|
||||||
{
|
{
|
||||||
return (m_currentScriptState >= (byte)SpellScriptHookType.EffectHit && m_currentScriptState < (byte)SpellScriptHookType.AfterHit + 1);
|
return (m_currentScriptState >= (byte)SpellScriptHookType.EffectHit && m_currentScriptState < (byte)SpellScriptHookType.AfterHit + 1);
|
||||||
@@ -757,7 +752,7 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
return m_spell.corpseTarget;
|
return m_spell.corpseTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -813,7 +808,7 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
m_spell.m_healing = heal;
|
m_spell.m_healing = heal;
|
||||||
}
|
}
|
||||||
void PreventHitHeal() { SetHitHeal(0); }
|
public void PreventHitHeal() { SetHitHeal(0); }
|
||||||
public Spell GetSpell() { return m_spell; }
|
public Spell GetSpell() { return m_spell; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -867,12 +862,10 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
|
|
||||||
UnitAura unitAura = m_spell.spellAura;
|
UnitAura unitAura = m_spell.spellAura;
|
||||||
if (unitAura != null)
|
unitAura?.Remove();
|
||||||
unitAura.Remove();
|
|
||||||
|
|
||||||
DynObjAura dynAura = m_spell.dynObjAura;
|
DynObjAura dynAura = m_spell.dynObjAura;
|
||||||
if (dynAura != null)
|
dynAura?.Remove();
|
||||||
dynAura.Remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevents effect execution on current spell hit target
|
// prevents effect execution on current spell hit target
|
||||||
@@ -953,7 +946,7 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
m_spell.variance = variance;
|
m_spell.variance = variance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns: cast item if present.
|
// returns: cast item if present.
|
||||||
public Item GetCastItem() { return m_spell.m_CastItem; }
|
public Item GetCastItem() { return m_spell.m_CastItem; }
|
||||||
|
|
||||||
@@ -1042,7 +1035,7 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AuraScript : BaseSpellScript
|
public class AuraScript : SpellScriptBase
|
||||||
{
|
{
|
||||||
// internal use classes & functions
|
// internal use classes & functions
|
||||||
// DO NOT OVERRIDE THESE IN SCRIPTS
|
// DO NOT OVERRIDE THESE IN SCRIPTS
|
||||||
@@ -1066,272 +1059,296 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
public class CheckAreaTargetHandler
|
public class CheckAreaTargetHandler
|
||||||
{
|
{
|
||||||
public CheckAreaTargetHandler(AuraCheckAreaTargetDelegate _pHandlerScript) { pHandlerScript = _pHandlerScript; }
|
AuraCheckAreaTargetDelegate _callImpl;
|
||||||
|
|
||||||
|
public CheckAreaTargetHandler(AuraCheckAreaTargetDelegate callImpl) { _callImpl = callImpl; }
|
||||||
|
|
||||||
public bool Call(Unit target)
|
public bool Call(Unit target)
|
||||||
{
|
{
|
||||||
return pHandlerScript(target);
|
return _callImpl(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraCheckAreaTargetDelegate pHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AuraDispelHandler
|
public class AuraDispelHandler
|
||||||
{
|
{
|
||||||
public AuraDispelHandler(AuraDispelDelegate _pHandlerScript) { pHandlerScript = _pHandlerScript; }
|
AuraDispelDelegate _callImpl;
|
||||||
|
|
||||||
|
public AuraDispelHandler(AuraDispelDelegate callImpl) { _callImpl = callImpl; }
|
||||||
|
|
||||||
public void Call(DispelInfo dispelInfo)
|
public void Call(DispelInfo dispelInfo)
|
||||||
{
|
{
|
||||||
pHandlerScript(dispelInfo);
|
_callImpl(dispelInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraDispelDelegate pHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectBase : EffectHook
|
public class EffectBase : EffectHook
|
||||||
{
|
{
|
||||||
public EffectBase(uint _effIndex, AuraType _effName)
|
AuraType _effAurName;
|
||||||
: base(_effIndex)
|
|
||||||
|
public EffectBase(uint effIndex, AuraType auraType) : base(effIndex)
|
||||||
{
|
{
|
||||||
effAurName = _effName;
|
_effAurName = auraType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckEffect(SpellInfo spellEntry, uint effIndex)
|
public override bool CheckEffect(SpellInfo spellInfo, uint effIndex)
|
||||||
{
|
{
|
||||||
if (spellEntry.GetEffects().Count <= effIndex)
|
if (spellInfo.GetEffects().Count <= effIndex)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SpellEffectInfo spellEffectInfo = spellEntry.GetEffect(effIndex);
|
SpellEffectInfo spellEffectInfo = spellInfo.GetEffect(effIndex);
|
||||||
if (spellEffectInfo.ApplyAuraName == 0 && effAurName == 0)
|
if (spellEffectInfo.ApplyAuraName == 0 && _effAurName == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (spellEffectInfo.ApplyAuraName == 0)
|
if (spellEffectInfo.ApplyAuraName == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (effAurName == AuraType.Any) || (spellEffectInfo.ApplyAuraName == effAurName);
|
return (_effAurName == AuraType.Any) || (spellEffectInfo.ApplyAuraName == _effAurName);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraType effAurName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectPeriodicHandler : EffectBase
|
public class EffectPeriodicHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectPeriodicHandler(AuraEffectPeriodicDelegate _pEffectHandlerScript, byte _effIndex, AuraType _effName)
|
AuraEffectPeriodicDelegate _callImpl;
|
||||||
: base(_effIndex, _effName)
|
|
||||||
|
public EffectPeriodicHandler(AuraEffectPeriodicDelegate callImpl, byte _effIndex, AuraType _effName) : base(_effIndex, _effName)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect _aurEff)
|
public void Call(AuraEffect _aurEff)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(_aurEff);
|
_callImpl(_aurEff);
|
||||||
}
|
}
|
||||||
AuraEffectPeriodicDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectUpdatePeriodicHandler : EffectBase
|
public class EffectUpdatePeriodicHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicDelegate _pEffectHandlerScript, byte _effIndex, AuraType _effName)
|
AuraEffectUpdatePeriodicDelegate _callImpl;
|
||||||
: base(_effIndex, _effName)
|
|
||||||
{
|
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
|
||||||
}
|
|
||||||
public void Call(AuraEffect aurEff) { pEffectHandlerScript(aurEff); }
|
|
||||||
|
|
||||||
AuraEffectUpdatePeriodicDelegate pEffectHandlerScript;
|
public EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicDelegate callImpl, byte _effIndex, AuraType _effName) : base(_effIndex, _effName)
|
||||||
|
{
|
||||||
|
_callImpl = callImpl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Call(AuraEffect aurEff)
|
||||||
|
{
|
||||||
|
_callImpl(aurEff);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectCalcAmountHandler : EffectBase
|
public class EffectCalcAmountHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectCalcAmountHandler(AuraEffectCalcAmountDelegate _pEffectHandlerScript, uint _effIndex, AuraType _effName)
|
public AuraEffectCalcAmountDelegate _callImpl;
|
||||||
: base(_effIndex, _effName)
|
|
||||||
|
public EffectCalcAmountHandler(AuraEffectCalcAmountDelegate callImpl, uint _effIndex, AuraType _effName) : base(_effIndex, _effName)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
public void Call(AuraEffect aurEff, ref int amount, ref bool canBeRecalculated)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, ref amount, ref canBeRecalculated);
|
_callImpl(aurEff, ref amount, ref canBeRecalculated);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuraEffectCalcAmountDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectCalcPeriodicHandler : EffectBase
|
public class EffectCalcPeriodicHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectCalcPeriodicHandler(AuraEffectCalcPeriodicDelegate _pEffectHandlerScript, byte _effIndex, AuraType _effName)
|
AuraEffectCalcPeriodicDelegate _callImpl;
|
||||||
: base(_effIndex, _effName)
|
|
||||||
|
public EffectCalcPeriodicHandler(AuraEffectCalcPeriodicDelegate callImpl, byte _effIndex, AuraType _effName) : base(_effIndex, _effName)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, ref bool isPeriodic, ref int periodicTimer)
|
public void Call(AuraEffect aurEff, ref bool isPeriodic, ref int periodicTimer)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, ref isPeriodic, ref periodicTimer);
|
_callImpl(aurEff, ref isPeriodic, ref periodicTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectCalcPeriodicDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectCalcSpellModHandler : EffectBase
|
public class EffectCalcSpellModHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectCalcSpellModHandler(AuraEffectCalcSpellModDelegate _pEffectHandlerScript, byte _effIndex, AuraType _effName)
|
AuraEffectCalcSpellModDelegate _callImpl;
|
||||||
: base(_effIndex, _effName)
|
|
||||||
|
public EffectCalcSpellModHandler(AuraEffectCalcSpellModDelegate callImpl, byte _effIndex, AuraType _effName) : base(_effIndex, _effName)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, ref SpellModifier spellMod)
|
public void Call(AuraEffect aurEff, ref SpellModifier spellMod)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, ref spellMod);
|
_callImpl(aurEff, ref spellMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectCalcSpellModDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectCalcCritChanceHandler : EffectBase
|
public class EffectCalcCritChanceHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectCalcCritChanceHandler(AuraEffectCalcCritChanceFnType effectHandlerScript, byte effIndex, AuraType effName) : base(effIndex, effName)
|
AuraEffectCalcCritChanceFnType _callImpl;
|
||||||
|
|
||||||
|
public EffectCalcCritChanceHandler(AuraEffectCalcCritChanceFnType callImpl, byte effIndex, AuraType effName) : base(effIndex, effName)
|
||||||
{
|
{
|
||||||
_effectHandlerScript = effectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
|
||||||
public void Call(AuraEffect aurEff, Unit victim, ref float critChance)
|
|
||||||
{
|
|
||||||
_effectHandlerScript(aurEff, victim, ref critChance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectCalcCritChanceFnType _effectHandlerScript;
|
public void Call(AuraEffect aurEff, Unit victim, ref float critChance)
|
||||||
|
{
|
||||||
|
_callImpl(aurEff, victim, ref critChance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectApplyHandler : EffectBase
|
public class EffectApplyHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectApplyHandler(AuraEffectApplicationModeDelegate _pEffectHandlerScript, byte _effIndex, AuraType _effName, AuraEffectHandleModes _mode)
|
AuraEffectApplicationModeDelegate _callImpl;
|
||||||
: base(_effIndex, _effName)
|
AuraEffectHandleModes mode;
|
||||||
|
|
||||||
|
public EffectApplyHandler(AuraEffectApplicationModeDelegate callImpl, byte _effIndex, AuraType _effName, AuraEffectHandleModes _mode) : base(_effIndex, _effName)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
mode = _mode;
|
mode = _mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect _aurEff, AuraEffectHandleModes _mode)
|
public void Call(AuraEffect _aurEff, AuraEffectHandleModes _mode)
|
||||||
{
|
{
|
||||||
if (Convert.ToBoolean(_mode & mode))
|
if (Convert.ToBoolean(_mode & mode))
|
||||||
pEffectHandlerScript(_aurEff, _mode);
|
_callImpl(_aurEff, _mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectApplicationModeDelegate pEffectHandlerScript;
|
|
||||||
AuraEffectHandleModes mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectAbsorbHandler : EffectBase
|
public class EffectAbsorbHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectAbsorbHandler(AuraEffectAbsorbDelegate _pEffectHandlerScript, byte _effIndex, bool overKill = false)
|
AuraEffectAbsorbDelegate _callImpl;
|
||||||
: base(_effIndex, overKill ? AuraType.SchoolAbsorbOverkill : AuraType.SchoolAbsorb)
|
|
||||||
|
public EffectAbsorbHandler(AuraEffectAbsorbDelegate callImpl, byte _effIndex, bool overKill = false) : base(_effIndex, overKill ? AuraType.SchoolAbsorbOverkill : AuraType.SchoolAbsorb)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
public void Call(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, dmgInfo, ref absorbAmount);
|
_callImpl(aurEff, dmgInfo, ref absorbAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectAbsorbDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectAbsorbHealHandler : EffectBase
|
public class EffectAbsorbHealHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectAbsorbHealHandler(AuraEffectAbsorbHealDelegate _pEffectHandlerScript, byte _effIndex)
|
AuraEffectAbsorbHealDelegate _callImpl;
|
||||||
: base(_effIndex, AuraType.SchoolHealAbsorb)
|
|
||||||
|
public EffectAbsorbHealHandler(AuraEffectAbsorbHealDelegate callImpl, byte _effIndex) : base(_effIndex, AuraType.SchoolHealAbsorb)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, HealInfo healInfo, ref uint absorbAmount)
|
public void Call(AuraEffect aurEff, HealInfo healInfo, ref uint absorbAmount)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, healInfo, ref absorbAmount);
|
_callImpl(aurEff, healInfo, ref absorbAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectAbsorbHealDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectManaShieldHandler : EffectBase
|
public class EffectManaShieldHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectManaShieldHandler(AuraEffectAbsorbDelegate _pEffectHandlerScript, byte _effIndex)
|
AuraEffectAbsorbDelegate _callImpl;
|
||||||
: base(_effIndex, AuraType.ManaShield)
|
|
||||||
|
public EffectManaShieldHandler(AuraEffectAbsorbDelegate callImpl, byte _effIndex) : base(_effIndex, AuraType.ManaShield)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
public void Call(AuraEffect aurEff, DamageInfo dmgInfo, ref uint absorbAmount)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, dmgInfo, ref absorbAmount);
|
_callImpl(aurEff, dmgInfo, ref absorbAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectAbsorbDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectSplitHandler : EffectBase
|
public class EffectSplitHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectSplitHandler(AuraEffectSplitDelegate _pEffectHandlerScript, byte _effIndex)
|
AuraEffectSplitDelegate _callImpl;
|
||||||
: base(_effIndex, AuraType.SplitDamagePct)
|
|
||||||
|
public EffectSplitHandler(AuraEffectSplitDelegate callImpl, byte _effIndex) : base(_effIndex, AuraType.SplitDamagePct)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript = _pEffectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, DamageInfo dmgInfo, uint splitAmount)
|
public void Call(AuraEffect aurEff, DamageInfo dmgInfo, uint splitAmount)
|
||||||
{
|
{
|
||||||
pEffectHandlerScript(aurEff, dmgInfo, splitAmount);
|
_callImpl(aurEff, dmgInfo, splitAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectSplitDelegate pEffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CheckProcHandler
|
public class CheckProcHandler
|
||||||
{
|
{
|
||||||
public CheckProcHandler(AuraCheckProcDelegate handlerScript)
|
AuraCheckProcDelegate _callImpl;
|
||||||
|
|
||||||
|
public CheckProcHandler(AuraCheckProcDelegate callImpl)
|
||||||
{
|
{
|
||||||
_HandlerScript = handlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
|
||||||
public bool Call(ProcEventInfo eventInfo)
|
|
||||||
{
|
|
||||||
return _HandlerScript(eventInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraCheckProcDelegate _HandlerScript;
|
public bool Call(ProcEventInfo eventInfo)
|
||||||
|
{
|
||||||
|
return _callImpl(eventInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CheckEffectProcHandler : EffectBase
|
public class CheckEffectProcHandler : EffectBase
|
||||||
{
|
{
|
||||||
public CheckEffectProcHandler(AuraCheckEffectProcDelegate handlerScript, uint effIndex, AuraType effName) : base(effIndex, effName)
|
AuraCheckEffectProcDelegate _callImpl;
|
||||||
|
|
||||||
|
public CheckEffectProcHandler(AuraCheckEffectProcDelegate callImpl, uint effIndex, AuraType effName) : base(effIndex, effName)
|
||||||
{
|
{
|
||||||
_HandlerScript = handlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Call(AuraEffect aurEff, ProcEventInfo eventInfo)
|
public bool Call(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
return _HandlerScript(aurEff, eventInfo);
|
return _callImpl(aurEff, eventInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraCheckEffectProcDelegate _HandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AuraProcHandler
|
public class AuraProcHandler
|
||||||
{
|
{
|
||||||
public AuraProcHandler(AuraProcDelegate handlerScript)
|
AuraProcDelegate _callImpl;
|
||||||
|
|
||||||
|
public AuraProcHandler(AuraProcDelegate callImpl)
|
||||||
{
|
{
|
||||||
_HandlerScript = handlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(ProcEventInfo eventInfo)
|
public void Call(ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
_HandlerScript(eventInfo);
|
_callImpl(eventInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraProcDelegate _HandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EffectProcHandler : EffectBase
|
public class EffectProcHandler : EffectBase
|
||||||
{
|
{
|
||||||
public EffectProcHandler(AuraEffectProcDelegate effectHandlerScript, byte effIndex, AuraType effName) : base(effIndex, effName)
|
AuraEffectProcDelegate _callImpl;
|
||||||
|
|
||||||
|
public EffectProcHandler(AuraEffectProcDelegate callImpl, byte effIndex, AuraType effName) : base(effIndex, effName)
|
||||||
{
|
{
|
||||||
_EffectHandlerScript = effectHandlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Call(AuraEffect aurEff, ProcEventInfo eventInfo)
|
public void Call(AuraEffect aurEff, ProcEventInfo eventInfo)
|
||||||
{
|
{
|
||||||
_EffectHandlerScript(aurEff, eventInfo);
|
_callImpl(aurEff, eventInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEffectProcDelegate _EffectHandlerScript;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EnterLeaveCombatHandler
|
public class EnterLeaveCombatHandler
|
||||||
{
|
{
|
||||||
public EnterLeaveCombatHandler(AuraEnterLeaveCombatFnType handlerScript)
|
AuraEnterLeaveCombatFnType _callImpl;
|
||||||
|
|
||||||
|
public EnterLeaveCombatHandler(AuraEnterLeaveCombatFnType callImpl)
|
||||||
{
|
{
|
||||||
_handlerScript = handlerScript;
|
_callImpl = callImpl;
|
||||||
}
|
|
||||||
public void Call(bool isNowInCombat)
|
|
||||||
{
|
|
||||||
_handlerScript(isNowInCombat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AuraEnterLeaveCombatFnType _handlerScript;
|
public void Call(bool isNowInCombat)
|
||||||
|
{
|
||||||
|
_callImpl(isNowInCombat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuraScript()
|
public AuraScript()
|
||||||
{
|
{
|
||||||
m_aura = null;
|
m_aura = null;
|
||||||
@@ -1468,20 +1485,11 @@ namespace Game.Scripting
|
|||||||
}
|
}
|
||||||
public bool _IsDefaultActionPrevented()
|
public bool _IsDefaultActionPrevented()
|
||||||
{
|
{
|
||||||
switch ((AuraScriptHookType)m_currentScriptState)
|
return (AuraScriptHookType)m_currentScriptState switch
|
||||||
{
|
{
|
||||||
case AuraScriptHookType.EffectApply:
|
AuraScriptHookType.EffectApply or AuraScriptHookType.EffectRemove or AuraScriptHookType.EffectPeriodic or AuraScriptHookType.EffectAbsorb or AuraScriptHookType.EffectSplit or AuraScriptHookType.PrepareProc or AuraScriptHookType.Proc or AuraScriptHookType.EffectProc => m_defaultActionPrevented,
|
||||||
case AuraScriptHookType.EffectRemove:
|
_ => throw new Exception("AuraScript._IsDefaultActionPrevented is called in a wrong place"),
|
||||||
case AuraScriptHookType.EffectPeriodic:
|
};
|
||||||
case AuraScriptHookType.EffectAbsorb:
|
|
||||||
case AuraScriptHookType.EffectSplit:
|
|
||||||
case AuraScriptHookType.PrepareProc:
|
|
||||||
case AuraScriptHookType.Proc:
|
|
||||||
case AuraScriptHookType.EffectProc:
|
|
||||||
return m_defaultActionPrevented;
|
|
||||||
default:
|
|
||||||
throw new Exception("AuraScript._IsDefaultActionPrevented is called in a wrong place");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Aura m_aura;
|
Aura m_aura;
|
||||||
@@ -1707,7 +1715,7 @@ namespace Game.Scripting
|
|||||||
// returns owner if it's unit or unit derived object, null otherwise (only for persistent area auras null is returned)
|
// returns owner if it's unit or unit derived object, null otherwise (only for persistent area auras null is returned)
|
||||||
public Unit GetUnitOwner() { return m_aura.GetUnitOwner(); }
|
public Unit GetUnitOwner() { return m_aura.GetUnitOwner(); }
|
||||||
// returns owner if it's dynobj, null otherwise
|
// returns owner if it's dynobj, null otherwise
|
||||||
DynamicObject GetDynobjOwner() { return m_aura.GetDynobjOwner(); }
|
public DynamicObject GetDynobjOwner() { return m_aura.GetDynobjOwner(); }
|
||||||
|
|
||||||
// removes aura with remove mode (see AuraRemoveMode enum)
|
// removes aura with remove mode (see AuraRemoveMode enum)
|
||||||
public void Remove(AuraRemoveMode removeMode = 0) { m_aura.Remove(removeMode); }
|
public void Remove(AuraRemoveMode removeMode = 0) { m_aura.Remove(removeMode); }
|
||||||
@@ -1715,39 +1723,39 @@ namespace Game.Scripting
|
|||||||
public Aura GetAura() { return m_aura; }
|
public Aura GetAura() { return m_aura; }
|
||||||
|
|
||||||
// returns type of the aura, may be dynobj owned aura or unit owned aura
|
// returns type of the aura, may be dynobj owned aura or unit owned aura
|
||||||
AuraObjectType GetAuraType() { return m_aura.GetAuraType(); }
|
public AuraObjectType GetAuraType() { return m_aura.GetAuraType(); }
|
||||||
|
|
||||||
// aura duration manipulation - when duration goes to 0 aura is removed
|
// aura duration manipulation - when duration goes to 0 aura is removed
|
||||||
public int GetDuration() { return m_aura.GetDuration(); }
|
public int GetDuration() { return m_aura.GetDuration(); }
|
||||||
public void SetDuration(int duration, bool withMods = false) { m_aura.SetDuration(duration, withMods); }
|
public void SetDuration(int duration, bool withMods = false) { m_aura.SetDuration(duration, withMods); }
|
||||||
// sets duration to maxduration
|
// sets duration to maxduration
|
||||||
public void RefreshDuration() { m_aura.RefreshDuration(); }
|
public void RefreshDuration() { m_aura.RefreshDuration(); }
|
||||||
long GetApplyTime() { return m_aura.GetApplyTime(); }
|
public long GetApplyTime() { return m_aura.GetApplyTime(); }
|
||||||
public int GetMaxDuration() { return m_aura.GetMaxDuration(); }
|
public int GetMaxDuration() { return m_aura.GetMaxDuration(); }
|
||||||
public void SetMaxDuration(int duration) { m_aura.SetMaxDuration(duration); }
|
public void SetMaxDuration(int duration) { m_aura.SetMaxDuration(duration); }
|
||||||
int CalcMaxDuration() { return m_aura.CalcMaxDuration(); }
|
public int CalcMaxDuration() { return m_aura.CalcMaxDuration(); }
|
||||||
// expired - duration just went to 0
|
// expired - duration just went to 0
|
||||||
public bool IsExpired() { return m_aura.IsExpired(); }
|
public bool IsExpired() { return m_aura.IsExpired(); }
|
||||||
// permament - has infinite duration
|
// permament - has infinite duration
|
||||||
bool IsPermanent() { return m_aura.IsPermanent(); }
|
public bool IsPermanent() { return m_aura.IsPermanent(); }
|
||||||
|
|
||||||
// charges manipulation - 0 - not charged aura
|
// charges manipulation - 0 - not charged aura
|
||||||
byte GetCharges() { return m_aura.GetCharges(); }
|
public byte GetCharges() { return m_aura.GetCharges(); }
|
||||||
void SetCharges(byte charges) { m_aura.SetCharges(charges); }
|
public void SetCharges(byte charges) { m_aura.SetCharges(charges); }
|
||||||
byte CalcMaxCharges() { return m_aura.CalcMaxCharges(); }
|
public byte CalcMaxCharges() { return m_aura.CalcMaxCharges(); }
|
||||||
bool ModCharges(sbyte num, AuraRemoveMode removeMode = AuraRemoveMode.Default) { return m_aura.ModCharges(num, removeMode); }
|
public bool ModCharges(sbyte num, AuraRemoveMode removeMode = AuraRemoveMode.Default) { return m_aura.ModCharges(num, removeMode); }
|
||||||
// returns true if last charge dropped
|
// returns true if last charge dropped
|
||||||
bool DropCharge(AuraRemoveMode removeMode = AuraRemoveMode.Default) { return m_aura.DropCharge(removeMode); }
|
public bool DropCharge(AuraRemoveMode removeMode = AuraRemoveMode.Default) { return m_aura.DropCharge(removeMode); }
|
||||||
|
|
||||||
// stack amount manipulation
|
// stack amount manipulation
|
||||||
public byte GetStackAmount() { return m_aura.GetStackAmount(); }
|
public byte GetStackAmount() { return m_aura.GetStackAmount(); }
|
||||||
void SetStackAmount(byte num) { m_aura.SetStackAmount(num); }
|
public void SetStackAmount(byte num) { m_aura.SetStackAmount(num); }
|
||||||
public bool ModStackAmount(int num, AuraRemoveMode removeMode = AuraRemoveMode.Default) { return m_aura.ModStackAmount(num, removeMode); }
|
public bool ModStackAmount(int num, AuraRemoveMode removeMode = AuraRemoveMode.Default) { return m_aura.ModStackAmount(num, removeMode); }
|
||||||
|
|
||||||
// passive - "working in background", not saved, not removed by immunities, not seen by player
|
// passive - "working in background", not saved, not removed by immunities, not seen by player
|
||||||
bool IsPassive() { return m_aura.IsPassive(); }
|
public bool IsPassive() { return m_aura.IsPassive(); }
|
||||||
// death persistent - not removed on death
|
// death persistent - not removed on death
|
||||||
bool IsDeathPersistent() { return m_aura.IsDeathPersistent(); }
|
public bool IsDeathPersistent() { return m_aura.IsDeathPersistent(); }
|
||||||
|
|
||||||
// check if aura has effect of given effindex
|
// check if aura has effect of given effindex
|
||||||
public bool HasEffect(byte effIndex) { return m_aura.HasEffect(effIndex); }
|
public bool HasEffect(byte effIndex) { return m_aura.HasEffect(effIndex); }
|
||||||
@@ -1755,7 +1763,7 @@ namespace Game.Scripting
|
|||||||
public AuraEffect GetEffect(byte effIndex) { return m_aura.GetEffect(effIndex); }
|
public AuraEffect GetEffect(byte effIndex) { return m_aura.GetEffect(effIndex); }
|
||||||
|
|
||||||
// check if aura has effect of given aura type
|
// check if aura has effect of given aura type
|
||||||
bool HasEffectType(AuraType type)
|
public bool HasEffectType(AuraType type)
|
||||||
{
|
{
|
||||||
return m_aura.HasEffectType(type);
|
return m_aura.HasEffectType(type);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1931,7 +1931,7 @@ namespace Game.Spells
|
|||||||
m_loadedScripts = Global.ScriptMgr.CreateAuraScripts(m_spellInfo.Id, this);
|
m_loadedScripts = Global.ScriptMgr.CreateAuraScripts(m_spellInfo.Id, this);
|
||||||
foreach (var script in m_loadedScripts)
|
foreach (var script in m_loadedScripts)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Spells, "Aura.LoadScripts: Script `{0}` for aura `{1}` is loaded now", script._GetScriptName(), m_spellInfo.Id);
|
Log.outDebug(LogFilter.Spells, "Aura.LoadScripts: Script `{0}` for aura `{1}` is loaded now", script.GetScriptName(), m_spellInfo.Id);
|
||||||
script.Register();
|
script.Register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7464,7 +7464,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
foreach (var script in m_loadedScripts)
|
foreach (var script in m_loadedScripts)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Spells, "Spell.LoadScripts: Script `{0}` for spell `{1}` is loaded now", script._GetScriptName(), m_spellInfo.Id);
|
Log.outDebug(LogFilter.Spells, "Spell.LoadScripts: Script `{0}` for spell `{1}` is loaded now", script.GetScriptName(), m_spellInfo.Id);
|
||||||
script.Register();
|
script.Register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user