Skip to content

Instantly share code, notes, and snippets.

@elecyb
Created January 4, 2016 21:37
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/fcc302bbcc8bb9bc8275 to your computer and use it in GitHub Desktop.
Save elecyb/fcc302bbcc8bb9bc8275 to your computer and use it in GitHub Desktop.
Fix removing profession specialization.
From eea7ba33d1823b922611085c4d237756cbc47c87 Mon Sep 17 00:00:00 2001
From: elecyb <elecyb@hotmail.com>
Date: Mon, 12 Aug 2013 17:36:56 -0300
Subject: [PATCH 006/402] (wa0003) Drop deprecated code and fix bug where a
player can have more than one profession specialization.
Signed-off-by: elecyb <elecyb@hotmail.com>
---
src/server/game/Entities/Player/Player.cpp | 38 ++++--------------------------
1 file changed, 4 insertions(+), 34 deletions(-)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ca7c1ed..dc1ee3b 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -22902,46 +22902,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);
--
1.8.3.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment