diff options
author | Shocker <none@none> | 2010-10-16 17:01:01 +0300 |
---|---|---|
committer | Shocker <none@none> | 2010-10-16 17:01:01 +0300 |
commit | 8154f7243cfa6221662615993b2bd17b75f06c38 (patch) | |
tree | de7f07a1b824eb0a12e9569045218c04efd929cd /src | |
parent | ae213dd5805f9541fe3520c0180aa7b3f323f77a (diff) |
Core/Arenas: Remove pet spell cooldowns on arena join too, fixes issue 1868
--HG--
branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Battlegrounds/Battleground.cpp | 1 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 24 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.h | 2 |
3 files changed, 21 insertions, 6 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 8a4d213cb75..bb229516f5c 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1104,7 +1104,6 @@ void Battleground::AddPlayer(Player *plr) // add arena specific auras if (isArena()) { - plr->RemoveArenaSpellCooldowns(); plr->RemoveArenaAuras(); plr->RemoveArenaEnchantments(TEMP_ENCHANTMENT_SLOT); if (team == ALLIANCE) // gold diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 61fc00b465c..d023b644ad8 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1981,6 +1981,10 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati LeaveBattleground(false); // don't teleport to entry point } + // remove arena spell coldowns now to also remove pet's cooldowns before it's temporarily unsummoned + if (mEntry->IsBattleArena()) + RemoveArenaSpellCooldowns(true); + // remove pet on map change if (pet) UnsummonPetTemporaryIfAny(); @@ -3896,17 +3900,17 @@ void Player::RemoveSpellCategoryCooldown(uint32 cat, bool update /* = false */) } } -void Player::RemoveArenaSpellCooldowns() +void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns) { - // remove cooldowns on spells that has < 15 min CD + // remove cooldowns on spells that have <= 10 min CD + SpellCooldowns::iterator itr, next; - // iterate spell cooldowns for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next) { next = itr; ++next; SpellEntry const * entry = sSpellStore.LookupEntry(itr->first); - // check if spellentry is present and if the cooldown is less than 10 mins + // check if spellentry is present and if the cooldown is less or equal to 10 min if (entry && entry->RecoveryTime <= 10 * MINUTE * IN_MILLISECONDS && entry->CategoryRecoveryTime <= 10 * MINUTE * IN_MILLISECONDS) @@ -3915,6 +3919,18 @@ void Player::RemoveArenaSpellCooldowns() RemoveSpellCooldown(itr->first, true); } } + + // pet cooldowns + if (removeActivePetCooldowns) + if (Pet *pet = GetPet()) + { + // notify player + for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr) + SendClearCooldown(itr->first, pet); + + // actually clear cooldowns + pet->m_CreatureSpellCooldowns.clear(); + } } void Player::RemoveAllSpellCooldown() diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 4fa1ac08c98..c0c5d54cba1 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1630,7 +1630,7 @@ class Player : public Unit, public GridObject<Player> void SendClearCooldown(uint32 spell_id, Unit* target); void RemoveCategoryCooldown(uint32 cat); - void RemoveArenaSpellCooldowns(); + void RemoveArenaSpellCooldowns(bool removeActivePetCooldowns = false); void RemoveAllSpellCooldown(); void _LoadSpellCooldowns(PreparedQueryResult result); void _SaveSpellCooldowns(SQLTransaction& trans); |