mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
fix(Core/Spells): Reset melee swing timer on cast rather than on finish. (#10101)
Fixes #7216
This commit is contained in:
@@ -3797,6 +3797,41 @@ void Spell::_cast(bool skipCheck)
|
||||
handle_immediate();
|
||||
}
|
||||
|
||||
if (IsAutoActionResetSpell())
|
||||
{
|
||||
bool found = false;
|
||||
Unit::AuraEffectList const& vIgnoreReset = m_caster->GetAuraEffectsByType(SPELL_AURA_IGNORE_MELEE_RESET);
|
||||
for (Unit::AuraEffectList::const_iterator i = vIgnoreReset.begin(); i != vIgnoreReset.end(); ++i)
|
||||
{
|
||||
if ((*i)->IsAffectedOnSpell(m_spellInfo))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found && !m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
|
||||
{
|
||||
bool allow = true;
|
||||
if (m_casttime == 0 && m_spellInfo->CalcCastTime())
|
||||
{
|
||||
allow = false;
|
||||
}
|
||||
|
||||
if (allow)
|
||||
{
|
||||
m_caster->resetAttackTimer(BASE_ATTACK);
|
||||
|
||||
if (m_caster->haveOffhandWeapon())
|
||||
{
|
||||
m_caster->resetAttackTimer(OFF_ATTACK);
|
||||
}
|
||||
|
||||
m_caster->resetAttackTimer(RANGED_ATTACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CallScriptAfterCastHandlers();
|
||||
|
||||
if (modOwner)
|
||||
@@ -4241,34 +4276,6 @@ void Spell::finish(bool ok)
|
||||
}
|
||||
}
|
||||
|
||||
if (IsAutoActionResetSpell())
|
||||
{
|
||||
bool found = false;
|
||||
Unit::AuraEffectList const& vIgnoreReset = m_caster->GetAuraEffectsByType(SPELL_AURA_IGNORE_MELEE_RESET);
|
||||
for (Unit::AuraEffectList::const_iterator i = vIgnoreReset.begin(); i != vIgnoreReset.end(); ++i)
|
||||
{
|
||||
if ((*i)->IsAffectedOnSpell(m_spellInfo))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found && !m_spellInfo->HasAttribute(SPELL_ATTR2_DO_NOT_RESET_COMBAT_TIMERS))
|
||||
{
|
||||
bool allow = true;
|
||||
if (m_casttime == 0 && m_spellInfo->CalcCastTime())
|
||||
allow = false;
|
||||
|
||||
if (allow)
|
||||
{
|
||||
m_caster->resetAttackTimer(BASE_ATTACK);
|
||||
if (m_caster->haveOffhandWeapon())
|
||||
m_caster->resetAttackTimer(OFF_ATTACK);
|
||||
m_caster->resetAttackTimer(RANGED_ATTACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// potions disabled by client, send event "not in combat" if need
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_triggeredByAuraSpell)
|
||||
m_caster->ToPlayer()->UpdatePotionCooldown(this);
|
||||
|
||||
Reference in New Issue
Block a user