From ace6342aea9e8e3f69af88ca3963fc961ba56f1b Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 30 Jan 2025 18:27:38 +0100 Subject: Core/Spells: Refactor SpellHistory ModifyCoooldowns and ResetCooldowns callbacks to use CooldownEntry argument instead of internal iterator --- src/server/scripts/Spells/spell_dh.cpp | 4 ++-- src/server/scripts/World/duel_reset.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Spells/spell_dh.cpp b/src/server/scripts/Spells/spell_dh.cpp index 986d75fd313..eb91f1d1a46 100644 --- a/src/server/scripts/Spells/spell_dh.cpp +++ b/src/server/scripts/Spells/spell_dh.cpp @@ -391,9 +391,9 @@ class spell_dh_chaotic_transformation : public SpellScript void HandleCooldown() const { - GetCaster()->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr) + GetCaster()->GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownEntry const& cooldown) { - uint32 category = sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE)->CategoryId; + uint32 category = sSpellMgr->AssertSpellInfo(cooldown.SpellId, DIFFICULTY_NONE)->CategoryId; return category == SPELL_CATEGORY_DH_EYE_BEAM || category == SPELL_CATEGORY_DH_BLADE_DANCE; }, true); } diff --git a/src/server/scripts/World/duel_reset.cpp b/src/server/scripts/World/duel_reset.cpp index 9f4fc5977c9..6d3dca3d16f 100644 --- a/src/server/scripts/World/duel_reset.cpp +++ b/src/server/scripts/World/duel_reset.cpp @@ -91,9 +91,9 @@ class DuelResetScript : public PlayerScript 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([player, onStartDuel](SpellHistory::CooldownStorageType::iterator itr) -> bool + player->GetSpellHistory()->ResetCooldowns([player, onStartDuel](SpellHistory::CooldownEntry const& cooldown) -> bool { - SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE); + SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(cooldown.SpellId, DIFFICULTY_NONE); Milliseconds remainingCooldown = player->GetSpellHistory()->GetRemainingCooldown(spellInfo); Milliseconds totalCooldown = Milliseconds(spellInfo->RecoveryTime); Milliseconds categoryCooldown = Milliseconds(spellInfo->CategoryRecoveryTime); @@ -114,7 +114,7 @@ class DuelResetScript : public PlayerScript applySpellMod(categoryCooldown); return remainingCooldown > 0ms - && !itr->second.OnHold + && !cooldown.OnHold && Milliseconds(totalCooldown) < 10min && Milliseconds(categoryCooldown) < 10min && Milliseconds(remainingCooldown) < 10min -- cgit v1.2.3