aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-08-16 14:59:21 +0200
committerShauren <shauren.trinity@gmail.com>2012-08-16 14:59:21 +0200
commitc27dfa224d056b97dbd80df67d46bd191f212d65 (patch)
tree15eb66815423482022a027024b76fe777765a75c /src
parent7cf825ffce2f640d19f8c4d12391c379a224ddb9 (diff)
Core/Players: Set PLAYER_PROFESSION_SKILL_LINE_1 fields not only when loading from db
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ff25ff3b7f6..3d204eaec6a 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -6443,6 +6443,12 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
if (SkillLineAbilityEntry const* pAbility = sSkillLineAbilityStore.LookupEntry(j))
if (pAbility->skillId == id)
removeSpell(sSpellMgr->GetFirstSpellInChain(pAbility->spellId));
+
+ // Clear profession lines
+ if (GetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1) == id)
+ SetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1, 0);
+ else if (GetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1 + 1) == id)
+ SetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1 + 1, 0);
}
}
else if (newVal) //add
@@ -6455,14 +6461,22 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal)
if (!GetUInt16Value(PLAYER_SKILL_LINEID_0 + field, offset))
{
- SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id);
- if (!pSkill)
+ SkillLineEntry const* skillEntry = sSkillLineStore.LookupEntry(id);
+ if (!skillEntry)
{
sLog->outError(LOG_FILTER_GENERAL, "Skill not found in SkillLineStore: skill #%u", id);
return;
}
SetUInt16Value(PLAYER_SKILL_LINEID_0 + field, offset, id);
+ if (skillEntry->categoryId == SKILL_CATEGORY_PROFESSION)
+ {
+ if (!GetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1))
+ SetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1, id);
+ else if (!GetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1 + 1))
+ SetUInt32Value(PLAYER_PROFESSION_SKILL_LINE_1 + 1, id);
+ }
+
SetUInt16Value(PLAYER_SKILL_STEP_0 + field, offset, step);
SetUInt16Value(PLAYER_SKILL_RANK_0 + field, offset, newVal);
SetUInt16Value(PLAYER_SKILL_MAX_RANK_0 + field, offset, maxVal);