fix(Core/Player): learnSkillRewardedSpells AFERT ALL skills have been loaded (#6676)

- Closes #6670
- Closes https://github.com/chromiecraft/chromiecraft/issues/1046
This commit is contained in:
Necropola
2021-07-06 12:46:18 +02:00
committed by GitHub
parent 5f74bd8ebb
commit 341d65c1db

View File

@@ -26008,6 +26008,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
// SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", m_guid.GetCounter());
uint32 count = 0;
std::unordered_map<uint32, uint32> loadedSkillValues;
if (result)
{
do
@@ -26073,7 +26074,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
learnSkillRewardedSpells(skill, value);
loadedSkillValues[skill] = value;
++count;
@@ -26085,6 +26086,12 @@ void Player::_LoadSkills(PreparedQueryResult result)
} while (result->NextRow());
}
// Learn skill rewarded spells after all skills have been loaded to prevent learning a skill from them before its loaded with proper value from DB
for (auto& skill : loadedSkillValues)
{
learnSkillRewardedSpells(skill.first, skill.second);
}
for (; count < PLAYER_MAX_SKILLS; ++count)
{
SetUInt32Value(PLAYER_SKILL_INDEX(count), 0);