Core/Scripts: Added CalcCastTime spell script hook
Port From (https://github.com/TrinityCore/TrinityCore/commit/6713fa4c93f87af351f3ee65c1ff36b52ea85ddb)
This commit is contained in:
+12
-12
@@ -2505,18 +2505,7 @@ namespace Game.Spells
|
||||
// Prepare data for triggers
|
||||
PrepareDataForTriggerSystem();
|
||||
|
||||
if (m_caster.IsTypeId(TypeId.Player))
|
||||
{
|
||||
if (!m_caster.ToPlayer().GetCommandStatus(PlayerCommandStates.Casttime))
|
||||
{
|
||||
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
|
||||
m_casttime = m_spellInfo.CalcCastTime(this);
|
||||
}
|
||||
else
|
||||
m_casttime = 0;
|
||||
}
|
||||
else
|
||||
m_casttime = m_spellInfo.CalcCastTime(this);
|
||||
m_casttime = CallScriptCalcCastTimeHandlers(m_spellInfo.CalcCastTime(this));
|
||||
|
||||
if (m_caster.IsUnit() && m_caster.ToUnit().IsMoving())
|
||||
{
|
||||
@@ -7462,6 +7451,17 @@ namespace Game.Spells
|
||||
return retVal;
|
||||
}
|
||||
|
||||
int CallScriptCalcCastTimeHandlers(int castTime)
|
||||
{
|
||||
foreach (var script in m_loadedScripts)
|
||||
{
|
||||
script._PrepareScriptCall(SpellScriptHookType.CalcCastTime);
|
||||
castTime = script.CalcCastTime(castTime);
|
||||
script._FinishScriptCall();
|
||||
}
|
||||
return castTime;
|
||||
}
|
||||
|
||||
bool CallScriptEffectHandlers(uint effIndex, SpellEffectHandleMode mode)
|
||||
{
|
||||
// execute script effect handler hooks and check if effects was prevented
|
||||
|
||||
Reference in New Issue
Block a user