mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
fix(Core/Professions): properly unlearn skill dependent spells (#7290)
- Closes #7165
This commit is contained in:
@@ -3178,7 +3178,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const
|
||||
(!form && spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_WHILE_NOT_SHAPESHIFTED)));
|
||||
}
|
||||
|
||||
void Player::learnSpell(uint32 spellId)
|
||||
void Player::learnSpell(uint32 spellId, bool temporary)
|
||||
{
|
||||
// Xinef: don't allow to learn active spell once more
|
||||
if (HasActiveSpell(spellId))
|
||||
@@ -3189,7 +3189,7 @@ void Player::learnSpell(uint32 spellId)
|
||||
|
||||
uint32 firstRankSpellId = sSpellMgr->GetFirstSpellInChain(spellId);
|
||||
bool thisSpec = GetTalentSpellCost(firstRankSpellId) > 0 || sSpellMgr->IsAdditionalTalentSpell(firstRankSpellId);
|
||||
bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true);
|
||||
bool added = addSpell(spellId, thisSpec ? GetActiveSpecMask() : SPEC_MASK_ALL, true, temporary);
|
||||
if (added)
|
||||
{
|
||||
sScriptMgr->OnPlayerLearnSpell(this, spellId);
|
||||
@@ -3206,7 +3206,7 @@ void Player::learnSpell(uint32 spellId)
|
||||
// pussywizard: next ranks must not be in current spec (otherwise no need to learn already learnt)
|
||||
PlayerSpellMap::iterator itr = m_spells.find(nextSpell);
|
||||
if (itr != m_spells.end() && itr->second->State != PLAYERSPELL_REMOVED && !itr->second->IsInSpec(m_activeSpec))
|
||||
learnSpell(nextSpell);
|
||||
learnSpell(nextSpell, temporary);
|
||||
}
|
||||
|
||||
// xinef: if we learn new spell, check all spells requiring this spell, if we have such a spell, and it is not in current spec - learn it
|
||||
@@ -3215,7 +3215,7 @@ void Player::learnSpell(uint32 spellId)
|
||||
{
|
||||
PlayerSpellMap::iterator itr2 = m_spells.find(itr->second);
|
||||
if (itr2 != m_spells.end() && itr2->second->State != PLAYERSPELL_REMOVED && !itr2->second->IsInSpec(m_activeSpec))
|
||||
learnSpell(itr2->first);
|
||||
learnSpell(itr2->first, temporary);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11019,7 +11019,7 @@ void Player::LearnCustomSpells()
|
||||
GetName().c_str(), GetGUID().ToString().c_str(), uint32(getClass()), uint32(getRace()), tspell);
|
||||
if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
|
||||
{
|
||||
addSpell(tspell, true, true);
|
||||
addSpell(tspell, SPEC_MASK_ALL, true);
|
||||
}
|
||||
else // but send in normal spell in game learn case
|
||||
{
|
||||
@@ -11218,13 +11218,14 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsInWorld())
|
||||
{
|
||||
addSpell(pAbility->Spell, SPEC_MASK_ALL, true, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
learnSpell(pAbility->Spell);
|
||||
learnSpell(pAbility->Spell, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user