aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGildor <gildor55@gmail.com>2024-06-27 20:12:16 +0200
committerOvahlord <dreadkiller@gmx.de>2024-12-12 19:58:44 +0100
commita0bdf2da3b4c56f977dbb6772097e0254685ccbe (patch)
tree3fc0ba222c822da880b887a9c66c991cbe7e4f1b /src
parentda61bf5ebf6a5f005adce26ff7fb4172cdce0e6a (diff)
Core/Players: Improve reset spell cooldowns when entering arenas (#30032)
Co-authored-by: Shauren <shauren.trinity@gmail.com> (cherry picked from commit 97b19a54457d6239a8e57f61281bda1cd16b8984) (cherry picked from commit 752ea0f8e9a04abd53a3b811de2fbb91b689e69f)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp7
-rw-r--r--src/server/game/Spells/SpellHistory.h4
2 files changed, 7 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 46061504908..0a6bb78d393 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3127,8 +3127,11 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr)
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE);
- return spellInfo->RecoveryTime < 10 * MINUTE * IN_MILLISECONDS
- && spellInfo->CategoryRecoveryTime < 10 * MINUTE * IN_MILLISECONDS
+ SpellHistory::Duration cooldown = 0s;
+ SpellHistory::Duration categoryCooldown = 0s;
+ SpellHistory::GetCooldownDurations(spellInfo, itr->second.ItemId, &cooldown, nullptr, &categoryCooldown);
+ return cooldown < 10min
+ && categoryCooldown < 10min
&& !spellInfo->HasAttribute(SPELL_ATTR6_DO_NOT_RESET_COOLDOWN_IN_ARENA);
}, true);
diff --git a/src/server/game/Spells/SpellHistory.h b/src/server/game/Spells/SpellHistory.h
index f46bbd0c941..25c8a53788e 100644
--- a/src/server/game/Spells/SpellHistory.h
+++ b/src/server/game/Spells/SpellHistory.h
@@ -178,6 +178,8 @@ public:
void PauseCooldowns();
void ResumeCooldowns();
+ static void GetCooldownDurations(SpellInfo const* spellInfo, uint32 itemId, Duration* cooldown, uint32* categoryId, Duration* categoryCooldown);
+
void SaveCooldownStateBeforeDuel();
void RestoreCooldownStateAfterDuel();
@@ -195,8 +197,6 @@ private:
void SendSetSpellCharges(uint32 chargeCategoryId, ChargeEntryCollection const& chargeCollection);
- static void GetCooldownDurations(SpellInfo const* spellInfo, uint32 itemId, Duration* cooldown, uint32* categoryId, Duration* categoryCooldown);
-
Unit* _owner;
CooldownStorageType _spellCooldowns;
CooldownStorageType _spellCooldownsBeforeDuel;