mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
Core/Players: Fixed automatic learning skills gained from learning spells when leveling
Closes #15391
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user