Skip to content

Instantly share code, notes, and snippets.

@elecyb
Created March 4, 2013 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elecyb/5086202 to your computer and use it in GitHub Desktop.
Save elecyb/5086202 to your computer and use it in GitHub Desktop.
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 8660b04..b7c00d5 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22354,47 +22354,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))
{
- // not have first rank learned (unlearned prof?)
- uint32 first_spell = sSpellMgr->GetFirstSpellInChain(learned_0);
- if (!HasSpell(first_spell))
- return;
-
SpellInfo const* learnedInfo = sSpellMgr->GetSpellInfo(learned_0);
if (!learnedInfo)
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment