diff options
author | Shauren <shauren.trinity@gmail.com> | 2015-09-29 00:11:26 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2015-09-29 00:11:26 +0200 |
commit | 3fceabfa113983549b5784dfd3f42259a53c258b (patch) | |
tree | 4a99e4afb3eaafc1b3b072391ab1527909ab35b9 /src | |
parent | 9418484691d186dcf6ccc71c75fdcb3112a38536 (diff) |
Core/Players: Fixed automatic learning skills gained from learning spells when leveling
Closes #15391
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 42 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 4 |
2 files changed, 24 insertions, 22 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 85c2869e72a..13d9ad36bdc 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3275,7 +3275,7 @@ void Player::RemoveTalent(TalentEntry const* talent) plrTalent->second = PLAYERSPELL_REMOVED; } -bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading /*= false*/, bool fromSkill /*= false*/) +bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading /*= false*/, uint32 fromSkill /*= 0*/) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -3512,10 +3512,10 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent SkillLineAbilityMapBounds skill_bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellId); - // add dependent skills if this spell is not learned from adding skill already - if (!fromSkill) + if (SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spellId)) { - if (SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spellId)) + // add dependent skills if this spell is not learned from adding skill already + if (spellLearnSkill->skill != fromSkill) { uint32 skill_value = GetPureSkillValue(spellLearnSkill->skill); uint32 skill_max_value = GetPureMaxSkillValue(spellLearnSkill->skill); @@ -3530,20 +3530,23 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent SetSkill(spellLearnSkill->skill, spellLearnSkill->step, skill_value, skill_max_value); } - else + } + else + { + // not ranked skills + for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx) { - // not ranked skills - for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx) - { - SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->SkillLine); - if (!pSkill) - continue; + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->SkillLine); + if (!pSkill) + continue; - // Runeforging special case - if ((_spell_idx->second->AquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && !HasSkill(pSkill->ID)) || ((pSkill->ID == SKILL_RUNEFORGING_2) && _spell_idx->second->TrivialSkillLineRankHigh == 0)) - if (SkillRaceClassInfoEntry const* rcInfo = GetSkillRaceClassInfo(pSkill->ID, getRace(), getClass())) - LearnDefaultSkill(rcInfo); - } + if (pSkill->ID == fromSkill) + continue; + + // Runeforging special case + if ((_spell_idx->second->AquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && !HasSkill(pSkill->ID)) || ((pSkill->ID == SKILL_RUNEFORGING_2) && _spell_idx->second->TrivialSkillLineRankHigh == 0)) + if (SkillRaceClassInfoEntry const* rcInfo = GetSkillRaceClassInfo(pSkill->ID, getRace(), getClass())) + LearnDefaultSkill(rcInfo); } } @@ -3630,7 +3633,7 @@ bool Player::IsCurrentSpecMasterySpell(SpellInfo const* spellInfo) const return false; } -void Player::LearnSpell(uint32 spell_id, bool dependent, bool fromSkill /*= false*/) +void Player::LearnSpell(uint32 spell_id, bool dependent, uint32 fromSkill /*= 0*/) { PlayerSpellMap::iterator itr = m_spells.find(spell_id); @@ -22730,7 +22733,6 @@ void Player::LearnDefaultSkill(SkillRaceClassInfoEntry const* rcInfo) } } - void Player::LearnQuestRewardedSpells(Quest const* quest) { int32 spell_id = quest->GetRewSpell(); @@ -22877,9 +22879,9 @@ void Player::LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue) RemoveSpell(ability->SpellID); // need learn else if (!IsInWorld()) - AddSpell(ability->SpellID, true, true, true, false, false, true); + AddSpell(ability->SpellID, true, true, true, false, false, ability->SkillLine); else - LearnSpell(ability->SpellID, true, true); + LearnSpell(ability->SpellID, true, ability->SkillLine); } } diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index f139e8e3031..558a017d61d 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1813,8 +1813,8 @@ class Player : public Unit, public GridObject<Player> void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask); void SendKnownSpells(); - bool AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, bool fromSkill = false); - void LearnSpell(uint32 spell_id, bool dependent, bool fromSkill = false); + bool AddSpell(uint32 spellId, bool active, bool learning, bool dependent, bool disabled, bool loading = false, uint32 fromSkill = 0); + void LearnSpell(uint32 spell_id, bool dependent, uint32 fromSkill = 0); void RemoveSpell(uint32 spell_id, bool disabled = false, bool learn_low_rank = true); void ResetSpells(bool myClassOnly = false); void LearnCustomSpells(); |