diff options
-rw-r--r-- | src/server/game/DataStores/DBCStores.cpp | 156 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStores.h | 3 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCStructure.h | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 44 |
4 files changed, 3 insertions, 202 deletions
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index bea9a882215..7532a6f8c75 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -206,8 +206,6 @@ DBCStorage <SpellEffectScalingEntry> sSpellEffectScalingStore(SpellEffectScaling SpellCategoryStore sSpellsByCategoryStore; PetFamilySpellsStore sPetFamilySpellsStore; -SpellsPerClassStore sSpellsPerClassStore; -ClassBySkillIdStore sClassBySkillIdStore; SpellEffectScallingByEffectId sSpellEffectScallingByEffectId; @@ -600,92 +598,9 @@ void LoadDBCStores(const std::string& dataPath) sSpellEffectScallingByEffectId.insert(std::make_pair(spellEffectScaling->SpellEffectID, j)); } - std::map<std::string, uint32> classIdByName; - for (uint32 j = 0; j < sChrClassesStore.GetNumRows(); j++) - { - ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(j); - if (!classEntry) - continue; - - classIdByName.insert(std::make_pair(std::string(classEntry->Name_lang), j)); - } - - for (uint32 j = 0; j < sSkillLineStore.GetNumRows(); j++) - { - SkillLineEntry const* skillEntry = sSkillLineStore.LookupEntry(j); - if (!skillEntry) - continue; - - if (skillEntry->CategoryID!= SKILL_CATEGORY_CLASS) - continue; - - std::map<std::string, uint32> ::const_iterator iter = classIdByName.find(std::string(skillEntry->DisplayName_lang)); - if (iter == classIdByName.end()) - continue; - - sClassBySkillIdStore.insert(std::make_pair(j, iter->second)); - } - - for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) - { - SkillLineAbilityEntry const* skillAbility = sSkillLineAbilityStore.LookupEntry(j); - if (!skillAbility) - continue; - - if (skillAbility->AquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN) - continue; - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillAbility->SpellID); - if (!spellInfo) - continue; - - SpellLevelsEntry const* spellLevels = sSpellLevelsStore.LookupEntry(spellInfo->LevelsID); - if (!spellLevels || !spellLevels->SpellLevel) - continue; - - uint32 classId = GetClassBySkillId(skillAbility->SkillLine); - - if (!classId) - continue; - - if (sSpellsPerClassStore.find(classId) == sSpellsPerClassStore.end()) - sSpellsPerClassStore.insert(make_pair(classId, std::list<SkillLineAbilityEntry const*>())); - - sSpellsPerClassStore[classId].push_back(skillAbility); - } LoadDBC(availableDbcLocales, bad_dbc_files, sTalentStore, dbcPath, "Talent.dbc");//15595 - // Create Spelldifficulty searcher - /* TODO: 6.x update to new spell diffs - for (uint32 i = 0; i < sSpellDifficultyStore.GetNumRows(); ++i) - { - SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(i); - if (!spellDiff) - continue; - - SpellDifficultyEntry newEntry; - memset(newEntry.SpellID, 0, 4*sizeof(uint32)); - for (uint32 x = 0; x < MAX_DIFFICULTY; ++x) - { - if (spellDiff->SpellID[x] <= 0 || !sSpellStore.LookupEntry(spellDiff->SpellID[x])) - { - if (spellDiff->SpellID[x] > 0)//don't show error if spell is <= 0, not all modes have spells and there are unknown negative values - TC_LOG_ERROR("sql.sql", "spelldifficulty_dbc: spell %i at field id:%u at spellid%i does not exist in SpellStore (spell.dbc), loaded as 0", spellDiff->SpellID[x], spellDiff->ID, x); - newEntry.SpellID[x] = 0;//spell was <= 0 or invalid, set to 0 - } - else - newEntry.SpellID[x] = spellDiff->SpellID[x]; - } - - if (newEntry.SpellID[0] <= 0 || newEntry.SpellID[1] <= 0)//id0-1 must be always set! - continue; - - for (uint32 x = 0; x < MAX_DIFFICULTY; ++x) - if (newEntry.SpellID[x]) - sSpellMgr->SetSpellDifficultyId(uint32(newEntry.SpellID[x]), spellDiff->ID); - }*/ - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); @@ -1129,77 +1044,6 @@ SkillRaceClassInfoEntry const* GetSkillRaceClassInfo(uint32 skill, uint8 race, u return NULL; } -uint32 GetClassBySkillId(uint32 skillId) -{ - ClassBySkillIdStore::const_iterator iter = sClassBySkillIdStore.find(skillId); - if (iter != sClassBySkillIdStore.end()) - return iter->second; - return 0; -} - -uint32 GetSkillIdByClass(uint32 classId) -{ - for (ClassBySkillIdStore::const_iterator iter = sClassBySkillIdStore.begin(); iter != sClassBySkillIdStore.end(); iter++) - if (iter->second == classId) - return iter->first; - return 0; -} - -std::list<uint32> GetSpellsForLevels(uint32 classId, uint32 raceMask, uint32 specializationId, uint32 minLevel, uint32 maxLevel) -{ - std::list<uint32> spellList; - - if (classId != 0) - { - SpellsPerClassStore::const_iterator classIter = sSpellsPerClassStore.find(classId); - if (classIter != sSpellsPerClassStore.end()) - { - const std::list<SkillLineAbilityEntry const*>& learnSpellList = classIter->second; - for (std::list<SkillLineAbilityEntry const*>::const_iterator iter = learnSpellList.begin(); iter != learnSpellList.end(); iter++) - { - SkillLineAbilityEntry const* skillLine = *iter; - if (!skillLine) - continue; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(skillLine->SpellID); - if (!spellInfo) - continue; - - if (skillLine->RaceMask && !(skillLine->RaceMask & raceMask)) - continue; - - if (spellInfo->SpellLevel <= minLevel || spellInfo->SpellLevel > maxLevel) - continue; - - spellList.push_back(spellInfo->Id); - } - } - } - - if (!specializationId) - return spellList; - - SpecializationSpellsBySpecStore::const_iterator specIter = sSpecializationSpellsBySpecStore.find(specializationId); - if (specIter != sSpecializationSpellsBySpecStore.end()) - { - SpecializationSpellsBySpecEntry learnSpellList = specIter->second; - for (size_t i = 0; i < learnSpellList.size(); ++i) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learnSpellList[i]->SpellID); - if (!spellInfo) - { - TC_LOG_ERROR("spells", "GetSpellsForLevels: spell %u not found in spellstore", learnSpellList[i]->SpellID); - continue; - } - if (spellInfo->SpellLevel <= minLevel || spellInfo->SpellLevel > maxLevel) - continue; - - spellList.push_back(spellInfo->Id); - } - } - return spellList; -} - uint32 GetTalentSpellCost(uint32 spellId) { TalentBySpellIDMap::const_iterator itr = sTalentBySpellIDMap.find(spellId); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 87a519c8c01..8a411300a79 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -67,9 +67,6 @@ bool IsTotemCategoryCompatiableWith(uint32 itemTotemCategoryId, uint32 requiredT void Zone2MapCoordinates(float &x, float &y, uint32 zone); void Map2ZoneCoordinates(float &x, float &y, uint32 zone); -uint32 GetClassBySkillId(uint32 skillId); -uint32 GetSkillIdByClass(uint32 classId); -std::list<uint32> GetSpellsForLevels(uint32 classId, uint32 raceMask, uint32 specializationId, uint32 minLevel, uint32 maxLevel); typedef std::unordered_map<uint32, std::unordered_map<uint32, MapDifficultyEntry const*>> MapDifficultyMap; MapDifficultyEntry const* GetDefaultMapDifficulty(uint32 mapID); diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 97481616225..69739a32854 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1584,8 +1584,6 @@ typedef std::set<uint32> SpellCategorySet; typedef std::map<uint32, SpellCategorySet > SpellCategoryStore; typedef std::set<uint32> PetFamilySpellsSet; typedef std::map<uint32, PetFamilySpellsSet > PetFamilySpellsStore; -typedef std::unordered_map<uint32, std::list<SkillLineAbilityEntry const*> > SpellsPerClassStore; -typedef std::unordered_map<uint32, uint32> ClassBySkillIdStore; typedef std::unordered_map<uint32, uint32> SpellEffectScallingByEffectId; struct SpellCastTimesEntry diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7595757531b..152d74bf674 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2977,7 +2977,9 @@ void Player::GiveLevel(uint8 level) // Refer-A-Friend if (GetSession()->GetRecruiterId()) + { if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL)) + { if (level % 2 == 0) { ++m_grantableLevels; @@ -2985,12 +2987,7 @@ void Player::GiveLevel(uint8 level) if (!HasByteFlag(PLAYER_FIELD_BYTES, 1, 0x01)) SetByteFlag(PLAYER_FIELD_BYTES, 1, 0x01); } - - std::list<uint32> learnList = GetSpellsForLevels(getClass(), getRaceMask(), GetTalentSpec(GetActiveTalentGroup()), oldLevel, level); - for (std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); iter++) - { - if (!HasSpell(*iter)) - LearnSpell(*iter, true); + } } sScriptMgr->OnPlayerLevelChanged(this, oldLevel); @@ -4178,12 +4175,6 @@ bool Player::ResetTalents(bool noCost, bool resetTalents, bool resetSpecializati if (resetSpecialization) { - std::list<uint32> learnList = GetSpellsForLevels(0, getRaceMask(), GetTalentSpec(GetActiveTalentGroup()), 0, getLevel()); - for (std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); iter++) - { - if (HasSpell(*iter)) - RemoveSpell(*iter, true); - } SetTalentSpec(GetActiveTalentGroup(), 0); SetUInt32Value(PLAYER_FIELD_CURRENT_SPEC_ID, 0); } @@ -18331,13 +18322,6 @@ void Player::_LoadSpells(PreparedQueryResult result) AddSpell((*result)[0].GetUInt32(), (*result)[1].GetBool(), false, false, (*result)[2].GetBool(), true); while (result->NextRow()); } - - std::list<uint32> learnList = GetSpellsForLevels(getClass(), getRaceMask(), GetActiveTalentSpec(), 0, getLevel()); - for (std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); iter++) - { - if (!HasSpell(*iter)) - LearnSpell(*iter, true); - } } void Player::_LoadGroup(PreparedQueryResult result) @@ -25500,13 +25484,6 @@ void Player::LearnTalentSpecialization(uint32 talentSpec) SendTalentsInfoData(); - std::list<uint32> learnList = GetSpellsForLevels(0, getRaceMask(), GetActiveTalentSpec(), 0, getLevel()); - for (std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); iter++) - { - if (!HasSpell(*iter)) - LearnSpell(*iter, true); - } - SaveToDB(); SendTalentsInfoData(); @@ -26070,14 +26047,6 @@ void Player::ActivateTalentGroup(uint8 group) RemoveSpell(effect->TriggerSpell, true); } - // Unlearn specialization specific spells - std::list<uint32> learnList = GetSpellsForLevels(0, getRaceMask(), GetActiveTalentSpec(), 0, getLevel()); - for (std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); iter++) - { - if (HasSpell(*iter)) - RemoveSpell(*iter, true); - } - // remove glyphs for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot) // remove secondary glyph @@ -26090,13 +26059,6 @@ void Player::ActivateTalentGroup(uint8 group) uint32 spentTalents = 0; - learnList = GetSpellsForLevels(getClass(), getRaceMask(), GetActiveTalentSpec(), 0, getLevel()); - for (std::list<uint32>::const_iterator iter = learnList.begin(); iter != learnList.end(); iter++) - { - if (!HasSpell(*iter)) - LearnSpell(*iter, true); - } - for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) { TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); |