aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRat <gmstreetrat@gmail.com>2014-12-05 14:10:02 +0100
committerRat <gmstreetrat@gmail.com>2014-12-05 14:10:02 +0100
commitd74b4077c33e05890dbba429a4b73f3b6261fe5b (patch)
tree30663073f85e142ed474eafccbd25098ffaf5f7a
parent340f7257952dbbb7dc822d0f0ec803dbd6b17485 (diff)
Core/Spells: finished implementing talent learning, talent reset, specialization learning
-rw-r--r--src/server/game/DataStores/DBCStores.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp25
2 files changed, 26 insertions, 1 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index f23dd49102b..ecff4836416 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -521,7 +521,7 @@ void LoadDBCStores(const std::string& dataPath)
sSpecializationSpellsBySpecStore[specSpells->SpecID].push_back(specSpells);
if (specSpells->OverridesSpellID)
- sSpecializationOverrideSpellMap[specSpells->SpecID][specSpells->OverridesSpellID] = specSpells->SpellID;
+ sSpecializationOverrideSpellMap[specSpells->SpecID][specSpells->OverridesSpellID] = specSpells->SpellID;
}
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellStore, dbcPath, "Spell.dbc"/*, &CustomSpellEntryfmt, &CustomSpellEntryIndex*/);
LoadDBC(availableDbcLocales, bad_dbc_files, sSpellCategoriesStore, dbcPath, "SpellCategories.dbc");//15595
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 740c96753ab..8b4fc341ab9 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -25606,6 +25606,31 @@ void Player::LearnTalentSpecialization(uint32 talentSpec)
SetTalentSpec(GetActiveTalentGroup(), talentSpec);
SetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID, talentSpec);
+
+ PlayerTalentMap* talents = GetTalentMap(GetActiveTalentGroup());
+
+ for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId)
+ {
+ TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId);
+
+ if (!talentInfo || talentInfo->ClassID != getClass() || talentInfo->SpecID != talentSpec)
+ continue;
+
+ for (PlayerTalentMap::iterator itr = talents->begin(); itr != talents->end();)
+ {
+ TalentEntry const* talent = sTalentStore.LookupEntry(itr->first);
+ if (!talent || talent->TierID != talentInfo->TierID)
+ {
+ ++itr;
+ continue;
+ }
+ RemoveSpell(talent->SpellID, false);
+ itr = talents->erase(itr);
+
+ TC_LOG_DEBUG("spells", "Player %s unlearning talent id: %u tier: %u because of specialization change", GetName().c_str(), talent->ID, talent->TierID);
+ }
+ }
+
SendTalentsInfoData();
std::list<uint32> learnList = GetSpellsForLevels(0, getRaceMask(), GetActiveTalentSpec(), 0, getLevel());