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:
Hondacrx
2025-06-08 15:56:31 -04:00
parent 4ace6f58c6
commit a3a9ef5259
5 changed files with 87 additions and 84 deletions
+3 -3
View File
@@ -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);
+2 -2
View File
@@ -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);
}