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:
@@ -4565,7 +4565,7 @@ namespace Game.Spells
|
|||||||
return SpellCastResult.NotReady;
|
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)
|
if (m_triggeredByAuraSpell != null)
|
||||||
return SpellCastResult.DontReport;
|
return SpellCastResult.DontReport;
|
||||||
|
|||||||
@@ -223,13 +223,13 @@ namespace Game.Spells
|
|||||||
StartCooldown(spellInfo, itemId, spell);
|
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 (spellInfo.PreventionType.HasAnyFlag(SpellPreventionType.Silence))
|
||||||
if (IsSchoolLocked(spellInfo.GetSchoolMask()))
|
if (IsSchoolLocked(spellInfo.GetSchoolMask()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (HasCooldown(spellInfo, itemId, ignoreCategoryCooldown))
|
if (HasCooldown(spellInfo, itemId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!HasCharge(spellInfo.ChargeCategoryId))
|
if (!HasCharge(spellInfo.ChargeCategoryId))
|
||||||
@@ -630,19 +630,16 @@ namespace Game.Spells
|
|||||||
_spellCooldowns.Clear();
|
_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))
|
if (_spellCooldowns.ContainsKey(spellInfo.Id))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (ignoreCategoryCooldown)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint category = 0;
|
uint category = 0;
|
||||||
GetCooldownDurations(spellInfo, itemId, ref category);
|
GetCooldownDurations(spellInfo, itemId, ref category);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user