aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIntel <chemicstry@gmail.com>2014-11-10 23:05:24 +0200
committerIntel <chemicstry@gmail.com>2014-11-10 23:05:24 +0200
commit832ecab60f969fa6aa6b4c10b7622312a49d4a58 (patch)
treecfb2f9e50254f913b42a391b1da3b59202e9666e /src
parent64a4d15d51b43237680c7f22389b44f0f3243c0a (diff)
Core/Talents: Add check if talent hasn't been already learnt in tier
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ad870f0262b..127cff885f0 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -25502,6 +25502,8 @@ void Player::CompletedAchievement(AchievementEntry const* entry)
bool Player::LearnTalent(uint32 talentId)
{
+ uint8 spec = GetActiveSpec();
+
TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
if (!talentInfo)
@@ -25515,6 +25517,11 @@ bool Player::LearnTalent(uint32 talentId)
if (getLevel() < (15*talentInfo->TierID + 15))
return false;
+ // Check if such tier talent hasn't been picked already
+ TalentSpecInfo* = GetTalentSpecInfo(spec);
+ if (TalentSpecInfo->Talents[talentInfo->TierID].SpellID != 0)
+ return false;
+
// spell not set in talent.dbc
uint32 spellid = talentInfo->SpellID;
if (spellid == 0)
@@ -25529,14 +25536,14 @@ bool Player::LearnTalent(uint32 talentId)
// learn! (other talent ranks will unlearned at learning)
LearnSpell(spellid, false);
- AddTalent(spellid, GetActiveSpec(), true);
+ AddTalent(spellid, spec, true);
- TC_LOG_INFO("misc", "TalentID: %u Spell: %u Spec: %u\n", talentId, spellid, GetActiveSpec());
+ TC_LOG_INFO("misc", "TalentID: %u Spell: %u Spec: %u\n", talentId, spellid, spec);
// set talent tree for player
- if (!GetTalentSpec(GetActiveSpec()))
+ if (!GetTalentSpec(spec))
{
- SetTalentSpec(GetActiveSpec(), talentInfo->SpecID);
+ SetTalentSpec(spec, talentInfo->SpecID);
// Replace default spells by specialization spells
auto specSpells = sSpecializationSpellsBySpecStore.find(talentInfo->SpecID);