mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[10063] Cleanup recent added code.
This commit is contained in:
parent
c781dbbada
commit
5b15cd5dd2
4 changed files with 20 additions and 18 deletions
|
|
@ -21209,15 +21209,23 @@ void Player::UpdateAchievementCriteria( AchievementCriteriaTypes type, uint32 mi
|
|||
GetAchievementMgr().UpdateAchievementCriteria(type, miscvalue1,miscvalue2,unit,time);
|
||||
}
|
||||
|
||||
PlayerTalent const* Player::GetTalentById(int32 talentId) const
|
||||
PlayerTalent const* Player::GetKnownTalentById(int32 talentId) const
|
||||
{
|
||||
PlayerTalentMap::const_iterator itr = m_talents[m_activeSpec].find(talentId);
|
||||
if (itr != m_talents[m_activeSpec].end())
|
||||
if (itr != m_talents[m_activeSpec].end() && itr->second.state != PLAYERSPELL_REMOVED)
|
||||
return &itr->second;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SpellEntry const* Player::GetKnownTalentRankById(int32 talentId) const
|
||||
{
|
||||
if (PlayerTalent const* talent = GetKnownTalentById(talentId))
|
||||
return sSpellStore.LookupEntry(talent->m_talentEntry->RankID[talent->currentRank]);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
||||
{
|
||||
uint32 CurTalentPoints = GetFreeTalentPoints();
|
||||
|
|
@ -21244,9 +21252,8 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)
|
|||
|
||||
// find current max talent rank
|
||||
uint32 curtalent_maxrank = 0;
|
||||
PlayerTalentMap::iterator itr = m_talents[m_activeSpec].find(talentId);
|
||||
if (itr != m_talents[m_activeSpec].end() && itr->second.state != PLAYERSPELL_REMOVED)
|
||||
curtalent_maxrank = itr->second.currentRank + 1;
|
||||
if (PlayerTalent const* talent = GetKnownTalentById(talentId))
|
||||
curtalent_maxrank = talent->currentRank + 1;
|
||||
|
||||
// we already have same or higher talent rank learned
|
||||
if(curtalent_maxrank >= (talentRank + 1))
|
||||
|
|
@ -21882,17 +21889,16 @@ void Player::ActivateSpec(uint8 specNum)
|
|||
|
||||
// learn talent spells if they not in new spec (old spec copy)
|
||||
// and if they have different rank
|
||||
PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].find(tempIter->first);
|
||||
if (specIter != m_talents[m_activeSpec].end() && specIter->second.state != PLAYERSPELL_REMOVED)
|
||||
if (PlayerTalent const* cur_talent = GetKnownTalentById(tempIter->first))
|
||||
{
|
||||
if ((*specIter).second.currentRank != talent.currentRank)
|
||||
if (cur_talent->currentRank != talent.currentRank)
|
||||
learnSpell(talentSpellId, false);
|
||||
}
|
||||
else
|
||||
learnSpell(talentSpellId, false);
|
||||
|
||||
// sync states - original state is changed in addSpell that learnSpell calls
|
||||
specIter = m_talents[m_activeSpec].find(tempIter->first);
|
||||
PlayerTalentMap::iterator specIter = m_talents[m_activeSpec].find(tempIter->first);
|
||||
if (specIter != m_talents[m_activeSpec].end())
|
||||
(*specIter).second.state = talent.state;
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue