Core/Player Drop deprecated code and fix bug where a player can have more than one profession specialization.
This commit is contained in:
1 parent
893c63f320
commit
d27b0ea8a8
1 file changed
+4
-34
@@ -22602,46 +22602,16 @@ void Player::LearnQuestRewardedSpells(Quest const* quest)
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
// prevent learn non first rank unknown profession and second specialization for same profession)
|
||||
uint32 learned_0 = spellInfo->Effects[0].TriggerSpell;
|
||||
if (sSpellMgr->GetSpellRank(learned_0) > 1 && !HasSpell(learned_0))
|
||||
if (!HasSpell(learned_0))
|
||||
{
|
||||
SpellInfo const* learnedInfo = sSpellMgr->GetSpellInfo(learned_0);
|
||||
if (!learnedInfo)
|
||||
return;
|
||||
|
||||
// not have first rank learned (unlearned prof?)
|
||||
if (!HasSpell(learnedInfo->GetFirstRankSpell()->Id))
|
||||
return;
|
||||
|
||||
SpellsRequiringSpellMapBounds spellsRequired = sSpellMgr->GetSpellsRequiredForSpellBounds(learned_0);
|
||||
for (SpellsRequiringSpellMap::const_iterator itr2 = spellsRequired.first; itr2 != spellsRequired.second; ++itr2)
|
||||
{
|
||||
uint32 profSpell = itr2->second;
|
||||
|
||||
// specialization
|
||||
if (learnedInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effects[1].Effect == 0 && profSpell)
|
||||
{
|
||||
// search other specialization for same prof
|
||||
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
{
|
||||
if (itr->second->state == PLAYERSPELL_REMOVED || itr->first == learned_0)
|
||||
continue;
|
||||
|
||||
SpellInfo const* itrInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
if (!itrInfo)
|
||||
return;
|
||||
|
||||
// compare only specializations
|
||||
if (itrInfo->Effects[0].Effect != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effects[1].Effect != 0)
|
||||
continue;
|
||||
|
||||
// compare same chain spells
|
||||
if (sSpellMgr->IsSpellRequiringSpell(itr->first, profSpell))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// profession specialization can be re-learned from npc
|
||||
if (learnedInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effects[1].Effect == 0 && !learnedInfo->SpellLevel)
|
||||
return;
|
||||
}
|
||||
|
||||
CastSpell(this, spell_id, true);
|
||||
|
||||
Reference in new issue
Block a user