mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9694] Not crash in case unknown spell expected to be learned at spec switch.
It will output error insteed and continue.
This commit is contained in:
parent
93bc46b1f3
commit
45fba95d13
2 changed files with 19 additions and 4 deletions
|
|
@ -21733,20 +21733,35 @@ void Player::ActivateSpec(uint8 specNum)
|
|||
continue;
|
||||
}
|
||||
|
||||
uint32 talentSpellId = talent.m_talentEntry->RankID[talent.currentRank];
|
||||
|
||||
// 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 ((*specIter).second.currentRank != talent.currentRank)
|
||||
learnSpell(talent.m_talentEntry->RankID[talent.currentRank], false);
|
||||
learnSpell(talentSpellId, false);
|
||||
}
|
||||
else
|
||||
learnSpell(talent.m_talentEntry->RankID[talent.currentRank], false);
|
||||
learnSpell(talentSpellId, false);
|
||||
|
||||
// sync states - original state is changed in addSpell that learnSpell calls
|
||||
specIter = m_talents[m_activeSpec].find(tempIter->first);
|
||||
(*specIter).second.state = talent.state;
|
||||
if (specIter != m_talents[m_activeSpec].end())
|
||||
(*specIter).second.state = talent.state;
|
||||
else
|
||||
{
|
||||
sLog.outError("ActivateSpec: Talent spell %u expected to learned at spec switch but not listed in talents at final check!", talentSpellId);
|
||||
|
||||
// attempt resync DB state (deleted lost spell from DB)
|
||||
if (talent.state != PLAYERSPELL_NEW)
|
||||
{
|
||||
PlayerTalent& talentNew = m_talents[m_activeSpec][tempIter->first];
|
||||
talentNew = talent;
|
||||
talentNew.state = PLAYERSPELL_REMOVED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InitTalentForLevel();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue