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)
This commit is contained in:
hondacrx
2022-05-07 22:43:46 -04:00
parent f67434306f
commit 3806d3f18f
2 changed files with 6 additions and 9 deletions
+1 -1
View File
@@ -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;
+5 -8
View File
@@ -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);