mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Players: Fixed loading and saving skill data PK violations
This commit is contained in:
@@ -25007,6 +25007,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
||||
|
||||
uint32 count = 0;
|
||||
uint8 professionCount = 0;
|
||||
std::unordered_map<uint32, uint32> loadedSkillValues;
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
@@ -25083,8 +25084,7 @@ void Player::_LoadSkills(PreparedQueryResult result)
|
||||
SetUInt16Value(PLAYER_SKILL_LINEID + SKILL_PERM_BONUS_OFFSET + field, offset, 0);
|
||||
|
||||
mSkillStatus.insert(SkillStatusMap::value_type(skill, SkillStatusData(count, SKILL_UNCHANGED)));
|
||||
|
||||
LearnSkillRewardedSpells(skill, value);
|
||||
loadedSkillValues[skill] = value;
|
||||
|
||||
++count;
|
||||
|
||||
@@ -25097,6 +25097,10 @@ 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);
|
||||
|
||||
if (HasSkill(SKILL_FIST_WEAPONS))
|
||||
SetSkill(SKILL_FIST_WEAPONS, 0, GetSkillValue(SKILL_UNARMED), GetMaxSkillValueForLevel());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user