fix(Core/Spell): Reset cd on some channeled spells (#19696)

If a spell is both channeled and has SPELL_ATTR0_COOLDOWN_ON_EVENT
attribute (only rituals) is channeled for its full duration, it goes on
an infinite cooldown. The client needs to be notified when the ritual
ends without being completed.
This commit is contained in:
Saqra1 2024-08-25 21:43:01 -05:00 committed by GitHub
parent 1bfcc0e469
commit 68402b6d91
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3739,9 +3739,8 @@ void Spell::cancel(bool bySelf)
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (m_spellInfo->HasAttribute(SPELL_ATTR0_COOLDOWN_ON_EVENT))
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
if (m_caster->IsPlayer() && m_spellInfo->IsCooldownStartedOnEvent())
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
SendChannelUpdate(0);
SendInterrupted(SPELL_FAILED_INTERRUPTED);
@ -4498,7 +4497,12 @@ void Spell::finish(bool ok)
if (Creature* creatureCaster = m_caster->ToCreature())
creatureCaster->ReleaseFocus(this);
if (!ok)
if (ok)
{
if (m_caster->IsPlayer() && m_spellInfo->IsChanneled() && m_spellInfo->IsCooldownStartedOnEvent())
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
}
else
{
if (m_caster->IsPlayer())
{