Core/Players: Improve reset spell cooldowns when entering arenas (#30032)

Co-authored-by: Shauren <shauren.trinity@gmail.com>
(cherry picked from commit 97b19a5445)
This commit is contained in:
Gildor
2024-06-27 20:12:16 +02:00
committed by Shauren
parent 4e89a302fc
commit 752ea0f8e9
2 changed files with 7 additions and 4 deletions

View File

@@ -3493,8 +3493,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);

View File

@@ -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;