mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
fix(Core/Spells): several improvements to cooldowns (#7559)
- Reworked spell category cooldowns. - Implemented category cooldowns for pets. - Properly shows pet spell cooldowns in player's UI. - Corrected pet spell cooldowns with infinity duration. - Do not add/remove infinity spell cooldown on aura apply/remove if casted by item. - Closes #5263
This commit is contained in:
@@ -485,10 +485,9 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication* auraApp)
|
||||
// set infinity cooldown state for spells
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent())
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent() && !m_castItemGuid)
|
||||
{
|
||||
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : nullptr;
|
||||
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, nullptr, true);
|
||||
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, 0, nullptr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,9 +517,11 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication* auraAp
|
||||
// reset cooldown state for spells
|
||||
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if (GetSpellInfo()->IsCooldownStartedOnEvent())
|
||||
if (GetSpellInfo()->IsCooldownStartedOnEvent() && !m_castItemGuid)
|
||||
{
|
||||
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
|
||||
caster->ToPlayer()->SendCooldownEvent(GetSpellInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -949,9 +949,10 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
|
||||
}
|
||||
|
||||
// Remove spell cooldown (not category) if spell triggering spell with cooldown and same category
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->CategoryRecoveryTime && spellInfo->CategoryRecoveryTime
|
||||
&& m_spellInfo->GetCategory() == spellInfo->GetCategory())
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory())
|
||||
{
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
|
||||
}
|
||||
|
||||
// original caster guid only for GO cast
|
||||
m_caster->CastSpell(targets, spellInfo, &values, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_NO_PERIODIC_RESET), nullptr, nullptr, m_originalCasterGUID);
|
||||
@@ -1002,9 +1003,10 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
|
||||
}
|
||||
|
||||
// Remove spell cooldown (not category) if spell triggering spell with cooldown and same category
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_spellInfo->CategoryRecoveryTime && spellInfo->CategoryRecoveryTime
|
||||
&& m_spellInfo->GetCategory() == spellInfo->GetCategory())
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && spellInfo->CategoryRecoveryTime && m_spellInfo->GetCategory() == spellInfo->GetCategory())
|
||||
{
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(spellInfo->Id);
|
||||
}
|
||||
|
||||
// original caster guid only for GO cast
|
||||
m_caster->CastSpell(targets, spellInfo, &values, TRIGGERED_FULL_MASK, nullptr, nullptr, m_originalCasterGUID);
|
||||
|
||||
Reference in New Issue
Block a user