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
@@ -78,9 +78,9 @@ namespace Scripts.World.DuelReset
static void ResetSpellCooldowns(Player player, bool onStartDuel)
{
// Remove cooldowns on spells that have < 10 min Cd > 30 sec and has no onHold
player.GetSpellHistory().ResetCooldowns(pair =>
player.GetSpellHistory().ResetCooldowns(cooldown =>
{
SpellInfo spellInfo = SpellMgr.GetSpellInfo(pair.Key, Difficulty.None);
SpellInfo spellInfo = SpellMgr.GetSpellInfo(cooldown.SpellId, Difficulty.None);
TimeSpan remainingCooldown = player.GetSpellHistory().GetRemainingCooldown(spellInfo);
TimeSpan totalCooldown = TimeSpan.FromMilliseconds(spellInfo.RecoveryTime);
TimeSpan categoryCooldown = TimeSpan.FromMilliseconds(spellInfo.CategoryRecoveryTime);
@@ -102,7 +102,7 @@ namespace Scripts.World.DuelReset
applySpellMod(categoryCooldown);
return remainingCooldown > TimeSpan.FromMilliseconds(0)
&& !pair.Value.OnHold
&& !cooldown.OnHold
&& totalCooldown < TimeSpan.FromMinutes(10)
&& categoryCooldown < TimeSpan.FromMinutes(10)
&& remainingCooldown < TimeSpan.FromMinutes(10)