Created
January 20, 2012 02:32
-
-
Save SeTM/1644595 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
src/game/Player.cpp | 36 ++++++++++++++++++++++++++---------- | |
1 files changed, 26 insertions(+), 10 deletions(-) | |
diff --git a/src/game/Player.cpp b/src/game/Player.cpp | |
index 6471861..d5dcf34 100644 | |
--- a/src/game/Player.cpp | |
+++ b/src/game/Player.cpp | |
@@ -3560,10 +3560,26 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo | |
{ | |
PlayerSpellMap::iterator itr = m_spells.find(spell_id); | |
if (itr == m_spells.end()) | |
+ { | |
+ // remove dependent spells | |
+ SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id); | |
+ | |
+ for(SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2) | |
+ removeSpell(itr2->second.spell, disabled); | |
+ | |
return; | |
+ } | |
if (itr->second.state == PLAYERSPELL_REMOVED || (disabled && itr->second.disabled)) | |
+ { | |
+ // remove dependent spells | |
+ SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id); | |
+ | |
+ for(SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2) | |
+ removeSpell(itr2->second.spell, disabled); | |
+ | |
return; | |
+ } | |
// unlearn non talent higher ranks (recursive) | |
SpellChainMapNext const& nextMap = sSpellMgr.GetSpellChainNext(); | |
@@ -3611,19 +3627,19 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo | |
(*iter).second.state = PLAYERSPELL_REMOVED; | |
else | |
m_talents[m_activeSpec].erase(iter); | |
- } | |
- else | |
- sLog.outError("removeSpell: Player (GUID: %u) has talent spell (id: %u) but doesn't have talent",GetGUIDLow(), spell_id ); | |
- // free talent points | |
- uint32 talentCosts = GetTalentSpellCost(talentPos); | |
+ // free talent points | |
+ uint32 talentCosts = GetTalentSpellCost(talentPos); | |
- if(talentCosts < m_usedTalentCount) | |
- m_usedTalentCount -= talentCosts; | |
- else | |
- m_usedTalentCount = 0; | |
+ if(talentCosts < m_usedTalentCount) | |
+ m_usedTalentCount -= talentCosts; | |
+ else | |
+ m_usedTalentCount = 0; | |
- UpdateFreeTalentPoints(false); | |
+ UpdateFreeTalentPoints(false); | |
+ } | |
+ else | |
+ sLog.outError("removeSpell: Player (GUID: %u) has talent spell (id: %u) but doesn't have talent",GetGUIDLow(), spell_id ); | |
} | |
// update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment