From 2273f7abe0d50a3d7151f8fa330934b2d2a3ca8b Mon Sep 17 00:00:00 2001 From: ApoC Date: Sun, 5 Jul 2009 14:28:03 +0200 Subject: [PATCH] [8123] Introduced new method Player::RemoveSpellCategoryCooldown(uint32,bool) This method removes cooldown from all spells from given category and optionaly sends update to player. By default update is not send. Signed-off-by: ApoC --- src/game/Player.cpp | 16 ++++++++++++++++ src/game/Player.h | 1 + src/shared/revision_nr.h | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5dc4939fb..65a879d5d 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3352,6 +3352,22 @@ void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ ) SendClearCooldown(spell_id, this); } +void Player::RemoveSpellCategoryCooldown(uint32 cat, bool update /* = false */) +{ + SpellCategoryStore::const_iterator ct = sSpellCategoryStore.find(cat); + if (ct == sSpellCategoryStore.end()) + return; + + const SpellCategorySet& ct_set = ct->second; + for (SpellCooldowns::const_iterator i = m_spellCooldowns.begin(); i != m_spellCooldowns.end();) + { + if (ct_set.find(i->first) != ct_set.end()) + RemoveSpellCooldown((i++)->first, update); + else + ++i; + } +} + void Player::RemoveArenaSpellCooldowns() { // remove cooldowns on spells that has < 15 min CD diff --git a/src/game/Player.h b/src/game/Player.h index 44d93408f..a30471d0a 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1517,6 +1517,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL); void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ); void RemoveSpellCooldown(uint32 spell_id, bool update = false); + void RemoveSpellCategoryCooldown(uint32 cat, bool update = false); void SendClearCooldown( uint32 spell_id, Unit* target ); void RemoveArenaSpellCooldowns(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c904f3ac4..29a61a3dd 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8122" + #define REVISION_NR "8123" #endif // __REVISION_NR_H__