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:
@@ -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());
|
// SetPQuery(PLAYER_LOGIN_QUERY_LOADSKILLS, "SELECT skill, value, max FROM character_skills WHERE guid = '%u'", m_guid.GetCounter());
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
std::unordered_map<uint32, uint32> loadedSkillValues;
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
@@ -26073,7 +26074,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
|||||||
|
|
||||||
mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
|
mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
|
||||||
|
|
||||||
learnSkillRewardedSpells(skill, value);
|
loadedSkillValues[skill] = value;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
@@ -26085,6 +26086,12 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
|||||||
} while (result->NextRow());
|
} 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)
|
for (; count < PLAYER_MAX_SKILLS; ++count)
|
||||||
{
|
{
|
||||||
SetUInt32Value(PLAYER_SKILL_INDEX(count), 0);
|
SetUInt32Value(PLAYER_SKILL_INDEX(count), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user