diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 10893bb5a..0d47b7352 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -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(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c6bdf25e9..ad53342f4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9693" + #define REVISION_NR "9694" #endif // __REVISION_NR_H__