mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[8116] Fixed low ranks relearn bug, correctly show tlanes at command spell learn.
* 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.
This commit is contained in:
parent
bc0397695c
commit
9798dbe5e2
4 changed files with 34 additions and 21 deletions
|
|
@ -1074,6 +1074,9 @@ bool ChatHandler::HandleUnLearnCommand(const char* args)
|
||||||
else
|
else
|
||||||
SendSysMessage(LANG_FORGET_SPELL);
|
SendSysMessage(LANG_FORGET_SPELL);
|
||||||
|
|
||||||
|
if(GetTalentSpellCost(spell_id))
|
||||||
|
target->SendTalentsInfoData(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2016,6 +2019,10 @@ bool ChatHandler::HandleLearnCommand(const char* args)
|
||||||
else
|
else
|
||||||
targetPlayer->learnSpell(spell,false);
|
targetPlayer->learnSpell(spell,false);
|
||||||
|
|
||||||
|
uint32 first_spell = spellmgr.GetFirstSpellInChain(spell);
|
||||||
|
if(GetTalentSpellCost(first_spell))
|
||||||
|
targetPlayer->SendTalentsInfoData(false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2907,7 +2907,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
|
||||||
if(!rankSpellId || rankSpellId==spell_id)
|
if(!rankSpellId || rankSpellId==spell_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
removeSpell(rankSpellId);
|
removeSpell(rankSpellId,false,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3156,7 +3156,7 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
|
||||||
GetSession()->SendPacket(&data);
|
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);
|
PlayerSpellMap::iterator itr = m_spells.find(spell_id);
|
||||||
if (itr == m_spells.end())
|
if (itr == m_spells.end())
|
||||||
|
|
@ -3169,7 +3169,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
||||||
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
|
SpellChainMapNext const& nextMap = spellmgr.GetSpellChainNext();
|
||||||
for(SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2)
|
for(SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2)
|
||||||
if(HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second))
|
if(HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second))
|
||||||
removeSpell(itr2->second,disabled);
|
removeSpell(itr2->second,disabled,false);
|
||||||
|
|
||||||
// re-search, it can be corrupted in prev loop
|
// re-search, it can be corrupted in prev loop
|
||||||
itr = m_spells.find(spell_id);
|
itr = m_spells.find(spell_id);
|
||||||
|
|
@ -3298,13 +3298,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
||||||
{
|
{
|
||||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
|
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)
|
if(talentCosts)
|
||||||
learnSpell (prev_id,false);
|
{
|
||||||
// if ranked non-stackable spell: need activate lesser rank and update dendence state
|
if(learn_low_rank)
|
||||||
|
learnSpell (prev_id,false);
|
||||||
|
}
|
||||||
|
// 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)
|
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);
|
PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id);
|
||||||
if (prev_itr != m_spells.end())
|
if (prev_itr != m_spells.end())
|
||||||
{
|
{
|
||||||
|
|
@ -3316,19 +3319,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
||||||
}
|
}
|
||||||
|
|
||||||
// now re-learn if need re-activate
|
// 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(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);
|
||||||
// downgrade spell ranks in spellbook and action bar
|
data << uint32(spell_id);
|
||||||
WorldPacket data(SMSG_SUPERCEDED_SPELL, 4 + 4);
|
data << uint32(prev_id);
|
||||||
data << uint32(spell_id);
|
GetSession()->SendPacket( &data );
|
||||||
data << uint32(prev_id);
|
prev_activate = true;
|
||||||
GetSession()->SendPacket( &data );
|
|
||||||
prev_activate = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3535,7 +3535,13 @@ bool Player::resetTalents(bool no_cost)
|
||||||
uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first);
|
uint32 itrFirstId = spellmgr.GetFirstSpellInChain(itr->first);
|
||||||
|
|
||||||
// unlearn if first rank is talent or learned by talent
|
// 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));
|
removeSpell(itr->first,!IsPassiveSpell(itr->first));
|
||||||
itr = GetSpellMap().begin();
|
itr = GetSpellMap().begin();
|
||||||
|
|
@ -18215,7 +18221,7 @@ void Player::resetSpells()
|
||||||
PlayerSpellMap smap = GetSpellMap();
|
PlayerSpellMap smap = GetSpellMap();
|
||||||
|
|
||||||
for(PlayerSpellMap::const_iterator iter = smap.begin();iter != smap.end(); ++iter)
|
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();
|
learnDefaultSpells();
|
||||||
learnQuestRewardedSpells();
|
learnQuestRewardedSpells();
|
||||||
|
|
|
||||||
|
|
@ -1452,7 +1452,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
void SendInitialSpells();
|
void SendInitialSpells();
|
||||||
bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled);
|
bool addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled);
|
||||||
void learnSpell(uint32 spell_id, bool dependent);
|
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 resetSpells();
|
||||||
void learnDefaultSpells();
|
void learnDefaultSpells();
|
||||||
void learnQuestRewardedSpells();
|
void learnQuestRewardedSpells();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8115"
|
#define REVISION_NR "8116"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue