diff options
author | megamage <none@none> | 2009-07-07 06:59:03 +0800 |
---|---|---|
committer | megamage <none@none> | 2009-07-07 06:59:03 +0800 |
commit | eec93e0852ddd6fa868dd20dd34dc1cd4fdc8cc3 (patch) | |
tree | 9957dbe33bc512387d469092531c853e1c5bbf06 | |
parent | 6b40a74b4ce66bd58878f0b108c3616fd9c28a68 (diff) |
[8116] Fixed low ranks relearn bug, correctly show tlanes at command spell learn. By VladimirMangos
* Bug showup as paladin talents reset. Thanks to ApoC for reseach problem.
* Now at .learn command use for learn some talent this talent must correctly show as learned in talent dialog.
--HG--
branch : trunk
-rw-r--r-- | src/game/Level3.cpp | 7 | ||||
-rw-r--r-- | src/game/Player.cpp | 43 | ||||
-rw-r--r-- | src/game/Player.h | 2 |
3 files changed, 32 insertions, 20 deletions
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index ba956ac38f4..a099aa8f66c 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -1640,6 +1640,9 @@ bool ChatHandler::HandleUnLearnCommand(const char* args) else SendSysMessage(LANG_FORGET_SPELL); + if(GetTalentSpellCost(spell_id)) + target->SendTalentsInfoData(false); + return true; } @@ -2582,6 +2585,10 @@ bool ChatHandler::HandleLearnCommand(const char* args) else targetPlayer->learnSpell(spell,false); + uint32 first_spell = spellmgr.GetFirstSpellInChain(spell); + if(GetTalentSpellCost(first_spell)) + targetPlayer->SendTalentsInfoData(false); + return true; } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 15dc3c69bd8..29cf24a4318 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2992,7 +2992,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if(!rankSpellId || rankSpellId==spell_id) continue; - removeSpell(rankSpellId); + removeSpell(rankSpellId,false,false); } } } @@ -3268,7 +3268,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent) GetSession()->SendPacket(&data); } -void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_for_low_rank) +void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) { PlayerSpellMap::iterator itr = m_spells.find(spell_id); if (itr == m_spells.end()) @@ -3288,7 +3288,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_ SpellsRequiringSpellMap const& reqMap = spellmgr.GetSpellsRequiringSpell(); SpellsRequiringSpellMap::const_iterator itr2 = reqMap.find(spell_id); for (uint32 i=reqMap.count(spell_id);i>0;i--,itr2++) - removeSpell(itr2->second,disabled); + removeSpell(itr2->second,disabled,false); // re-search, it can be corrupted in prev loop itr = m_spells.find(spell_id); @@ -3417,15 +3417,17 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_ { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); - // if talent then lesser rank also talent and need learn + // if talent then lesser rank also talent and need learn if(talentCosts) { - //learnSpell (prev_id,false); + // I cannot see why mangos has these lines. + //if(learn_low_rank) + // learnSpell (prev_id,false); } - // if ranked non-stackable spell: need activate lesser rank and update dendence state + // if ranked non-stackable spell: need activate lesser rank and update dendence state else if(cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && spellmgr.GetSpellRank(spellInfo->Id) != 0) { - // need manually update dependence state (learn spell ignore like attempts) + // need manually update dependence state (learn spell ignore like attempts) PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id); if (prev_itr != m_spells.end()) { @@ -3437,19 +3439,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_ } // now re-learn if need re-activate - if(cur_active && !prev_itr->second->active) + if(cur_active && !prev_itr->second->active && learn_low_rank) { if(addSpell(prev_id,true,false,prev_itr->second->dependent,prev_itr->second->disabled)) { - if(update_action_bar_for_low_rank) - { - // downgrade spell ranks in spellbook and action bar - WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); - data << uint32(spell_id); - data << uint32(prev_id); - GetSession()->SendPacket( &data ); - prev_activate = true; - } + // downgrade spell ranks in spellbook and action bar + WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4); + data << uint32(spell_id); + data << uint32(prev_id); + GetSession()->SendPacket( &data ); + prev_activate = true; } } } @@ -3664,7 +3663,13 @@ bool Player::resetTalents(bool no_cost) uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first); // unlearn if first rank is talent or learned by talent - if (itrFirstId == talentInfo->RankID[j] || spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId)) + if (itrFirstId == talentInfo->RankID[j]) + { + removeSpell(itr->first,!IsPassiveSpell(itr->first),false); + itr = GetSpellMap().begin(); + continue; + } + else if (spellmgr.IsSpellLearnToSpell(talentInfo->RankID[j],itrFirstId)) { removeSpell(itr->first,!IsPassiveSpell(itr->first)); itr = GetSpellMap().begin(); @@ -19106,7 +19111,7 @@ void Player::resetSpells() PlayerSpellMap smap = GetSpellMap(); for(PlayerSpellMap::const_iterator iter = smap.begin();iter != smap.end(); ++iter) - removeSpell(iter->first); // only iter->first can be accessed, object by iter->second can be deleted already + removeSpell(iter->first,false,false); // only iter->first can be accessed, object by iter->second can be deleted already learnDefaultSpells(); learnQuestRewardedSpells(); diff --git a/src/game/Player.h b/src/game/Player.h index 38de51033c3..863473bcb0b 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1395,7 +1395,7 @@ class TRINITY_DLL_SPEC Player : public Unit void SendInitialSpells(); bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled); void learnSpell(uint32 spell_id, bool dependent); - void removeSpell(uint32 spell_id, bool disabled = false, bool update_action_bar_for_low_rank = false); + void removeSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true); void resetSpells(); void learnDefaultSpells(); void learnQuestRewardedSpells(); |