Core/Spells: Refactor SpellHistory ModifyCoooldowns and ResetCooldowns callbacks to use CooldownEntry argument instead of internal iterator
Port From (https://github.com/TrinityCore/TrinityCore/commit/ace6342aea9e8e3f69af88ca3963fc961ba56f1b)
This commit is contained in:
@@ -3378,13 +3378,13 @@ namespace Game.Entities
|
||||
public void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
|
||||
{
|
||||
// remove cooldowns on spells that have < 10 min CD
|
||||
GetSpellHistory().ResetCooldowns(p =>
|
||||
GetSpellHistory().ResetCooldowns(cooldownEntry =>
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(p.Key, Difficulty.None);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cooldownEntry.SpellId, Difficulty.None);
|
||||
TimeSpan cooldown = TimeSpan.Zero;
|
||||
TimeSpan categoryCooldown = TimeSpan.Zero;
|
||||
uint categoryId = 0;
|
||||
SpellHistory.GetCooldownDurations(spellInfo, p.Value.ItemId, ref cooldown, ref categoryId, ref categoryCooldown);
|
||||
SpellHistory.GetCooldownDurations(spellInfo, cooldownEntry.ItemId, ref cooldown, ref categoryId, ref categoryCooldown);
|
||||
return cooldown < TimeSpan.FromMinutes(10)
|
||||
&& categoryCooldown < TimeSpan.FromMinutes(10)
|
||||
&& !spellInfo.HasAttribute(SpellAttr6.DoNotResetCooldownInArena);
|
||||
|
||||
@@ -655,9 +655,9 @@ namespace Game.Entities
|
||||
break;
|
||||
}
|
||||
|
||||
GetSpellHistory().ResetCooldowns(pair =>
|
||||
GetSpellHistory().ResetCooldowns(cooldown =>
|
||||
{
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(cooldown.SpellId, Difficulty.None);
|
||||
return spellInfo.HasAttribute(SpellAttr10.ResetCooldownOnEncounterEnd);
|
||||
}, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user