*Optimization, and remove talents from the talent map by TalentID, not SpellID.
--HG-- branch : trunk
This commit is contained in:
+19
-31
@@ -3791,9 +3791,10 @@ bool Player::resetTalents(bool no_cost)
|
||||
}
|
||||
*/
|
||||
|
||||
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
||||
PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->TalentID);
|
||||
if (plrTalent != m_talents[m_activeSpec]->end())
|
||||
{
|
||||
if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], m_activeSpec))
|
||||
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
||||
{
|
||||
for (PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();)
|
||||
{
|
||||
@@ -3820,8 +3821,7 @@ bool Player::resetTalents(bool no_cost)
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
//removeSpell(talentInfo->RankID[rank], false, false);
|
||||
m_talents[m_activeSpec]->find(talentInfo->RankID[rank])->second->state = PLAYERSPELL_REMOVED; // mark the talent in the talent map as removed
|
||||
plrTalent->second->state = PLAYERSPELL_REMOVED; // mark the talent in the talent map as removed
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21998,36 +21998,27 @@ void Player::ActivateSpec(uint8 spec)
|
||||
//RemoveAllAuras(this->GetGUID(), NULL, false, true); // removes too many auras
|
||||
//ExitVehicle(); // should be impossible to switch specs from inside a vehicle..
|
||||
|
||||
// Remove all talents and talent-learned spells under this spec.
|
||||
for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i)
|
||||
{
|
||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
|
||||
// find class talent tabs (all players have 3 talent tabs)
|
||||
uint32 const *talentTabIds = GetTalentTabPages(getClass());
|
||||
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
uint32 talentTabId = talentTabIds[i];
|
||||
|
||||
for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
|
||||
{
|
||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId);
|
||||
if (!talentInfo)
|
||||
continue;
|
||||
|
||||
TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab);
|
||||
|
||||
if (!talentTabInfo)
|
||||
// skip another tab talents
|
||||
if (talentInfo->TalentTab != talentTabId)
|
||||
continue;
|
||||
|
||||
// unlearn only talents for character class
|
||||
// some spell learned by one class as normal spells or know at creation but another class learn it as talent,
|
||||
// to prevent unexpected lost normal learned spell skip another class talents
|
||||
if ((getClassMask() & talentTabInfo->ClassMask) == 0)
|
||||
continue;
|
||||
|
||||
/*
|
||||
for (PlayerTalentMap::iterator itr = m_talents[m_activeSpec]->begin(); itr != m_talents[m_activeSpec]->end(); ++itr)
|
||||
PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->TalentID);
|
||||
if (plrTalent != m_talents[m_activeSpec]->end())
|
||||
{
|
||||
removeSpell(itr->first, !IsPassiveSpell(itr->first), false);
|
||||
itr->second->state = PLAYERSPELL_REMOVED;
|
||||
}
|
||||
*/
|
||||
|
||||
for (int8 rank = MAX_TALENT_RANK-1; rank >= 0; --rank)
|
||||
{
|
||||
if (talentInfo->RankID[rank] && HasTalent(talentInfo->RankID[rank], m_activeSpec))
|
||||
{
|
||||
for (PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();)
|
||||
{
|
||||
@@ -22054,8 +22045,8 @@ void Player::ActivateSpec(uint8 spec)
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
//removeSpell(talentInfo->RankID[rank], false, false);
|
||||
//m_talents[m_activeSpec]->find(talentInfo->RankID[rank])->second->state = PLAYERSPELL_REMOVED; // mark the talent in the talent map as removed
|
||||
plrTalent->second->state = PLAYERSPELL_REMOVED; // mark the talent in the talent map as removed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22070,9 +22061,6 @@ void Player::ActivateSpec(uint8 spec)
|
||||
SetActiveSpec(spec);
|
||||
uint32 spentTalents = 0;
|
||||
|
||||
// find class talent tabs (all players have 3 talent tabs)
|
||||
uint32 const *talentTabIds = GetTalentTabPages(getClass());
|
||||
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
{
|
||||
uint32 talentTabId = talentTabIds[i];
|
||||
|
||||
Reference in New Issue
Block a user