aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 92cbb69912f..d461c4298f7 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3377,18 +3377,7 @@ SpellCastResult Spell::prepare(SpellCastTargets const& targets, AuraEffect const
// Prepare data for triggers
prepareDataForTriggerSystem();
- if (Player* player = m_caster->ToPlayer())
- {
- if (!player->GetCommandStatus(CHEAT_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; // Set cast time to 0 if .cheat casttime is enabled.
- }
- else
- m_casttime = m_spellInfo->CalcCastTime(this);
+ m_casttime = CallScriptCalcCastTimeHandlers(m_spellInfo->CalcCastTime(this));
if (m_caster->IsUnit() && m_caster->ToUnit()->isMoving())
{
@@ -8432,6 +8421,17 @@ SpellCastResult Spell::CallScriptCheckCastHandlers()
return retVal;
}
+int32 Spell::CallScriptCalcCastTimeHandlers(int32 castTime)
+{
+ for (auto scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
+ {
+ (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CALC_CAST_TIME);
+ castTime = (*scritr)->CalcCastTime(castTime);
+ (*scritr)->_FinishScriptCall();
+ }
+ return castTime;
+}
+
bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMode mode)
{
// execute script effect handler hooks and check if effects was prevented