From 3806d3f18fbda926c6ec8c6ae1699bfac8571ab2 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 7 May 2022 22:43:46 -0400 Subject: [PATCH] Core/Spells: Ignore existing cooldown for spells using TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD instead of only skipping setting new cooldown Port From (https://github.com/TrinityCore/TrinityCore/commit/d92f25478a3550c1e40f7e792ebfc6c50572ba97) --- Source/Game/Spells/Spell.cs | 2 +- Source/Game/Spells/SpellHistory.cs | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Source/Game/Spells/Spell.cs b/Source/Game/Spells/Spell.cs index 55a8c0c29..8e2a8ba51 100644 --- a/Source/Game/Spells/Spell.cs +++ b/Source/Game/Spells/Spell.cs @@ -4565,7 +4565,7 @@ namespace Game.Spells return SpellCastResult.NotReady; } - if (m_caster.IsUnit() && !m_caster.ToUnit().GetSpellHistory().IsReady(m_spellInfo, m_castItemEntry, IsIgnoringCooldowns())) + if (!IsIgnoringCooldowns() && m_caster.ToUnit() != null && !m_caster.ToUnit().GetSpellHistory().IsReady(m_spellInfo, m_castItemEntry)) { if (m_triggeredByAuraSpell != null) return SpellCastResult.DontReport; diff --git a/Source/Game/Spells/SpellHistory.cs b/Source/Game/Spells/SpellHistory.cs index c413a4d7e..ca1944a82 100644 --- a/Source/Game/Spells/SpellHistory.cs +++ b/Source/Game/Spells/SpellHistory.cs @@ -223,13 +223,13 @@ namespace Game.Spells StartCooldown(spellInfo, itemId, spell); } - public bool IsReady(SpellInfo spellInfo, uint itemId = 0, bool ignoreCategoryCooldown = false) + public bool IsReady(SpellInfo spellInfo, uint itemId = 0) { if (spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence)) if (IsSchoolLocked(spellInfo.GetSchoolMask())) return false; - if (HasCooldown(spellInfo, itemId, ignoreCategoryCooldown)) + if (HasCooldown(spellInfo, itemId)) return false; if (!HasCharge(spellInfo.ChargeCategoryId)) @@ -630,19 +630,16 @@ namespace Game.Spells _spellCooldowns.Clear(); } - public bool HasCooldown(uint spellId, uint itemId = 0, bool ignoreCategoryCooldown = false) + public bool HasCooldown(uint spellId, uint itemId = 0) { - return HasCooldown(Global.SpellMgr.GetSpellInfo(spellId, _owner.GetMap().GetDifficultyID()), itemId, ignoreCategoryCooldown); + return HasCooldown(Global.SpellMgr.GetSpellInfo(spellId, _owner.GetMap().GetDifficultyID()), itemId); } - public bool HasCooldown(SpellInfo spellInfo, uint itemId = 0, bool ignoreCategoryCooldown = false) + public bool HasCooldown(SpellInfo spellInfo, uint itemId = 0) { if (_spellCooldowns.ContainsKey(spellInfo.Id)) return true; - if (ignoreCategoryCooldown) - return false; - uint category = 0; GetCooldownDurations(spellInfo, itemId, ref category);