diff options
| author | Ovahlord <dreadkiller@gmx.de> | 2024-08-18 18:11:19 +0200 |
|---|---|---|
| committer | Ovahlord <dreadkiller@gmx.de> | 2024-08-18 18:23:24 +0200 |
| commit | b98db4beeae32b6d16a979939ad8ba55827c0335 (patch) | |
| tree | b38306ce7c516a0992173a458df81311a72325f0 /src/server/game/Spells/SpellMgr.cpp | |
| parent | 33b61bd2430e884b99a8ce824cc983a04a2c64c4 (diff) | |
Core/Spells: restored old mastery handling
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index fa13dadd5a6..5abf6b02ef9 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1197,6 +1197,63 @@ void SpellMgr::LoadSpellLearnSpells() ++dbc_count; } + uint32 mastery_count = 0; + for (TalentTabEntry const* talentTab : sTalentTabStore) + { + for (uint32 c = CLASS_WARRIOR; c < MAX_CLASSES; ++c) + { + if (!(talentTab->ClassMask & (1 << (c - 1)))) + continue; + + uint32 masteryMainSpell = MasterySpells[c]; + + for (uint32 mastery : talentTab->MasterySpellID) + { + if (!mastery) + continue; + + SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(masteryMainSpell); + bool found = false; + for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr) + { + if (itr->second.Spell == mastery) + { + TC_LOG_ERROR("sql.sql", "Found redundant record (entry: %u, SpellID: %u) in `spell_learn_spell`, spell added automatically as mastery learned spell from ChrSpecialization.dbc", masteryMainSpell, mastery); + found = true; + break; + } + } + + if (found) + continue; + + // Check if it is already found in Spell.dbc, ignore silently if yes + SpellLearnSpellMapBounds dbc_node_bounds = GetSpellLearnSpellMapBounds(masteryMainSpell); + found = false; + for (SpellLearnSpellMap::const_iterator itr = dbc_node_bounds.first; itr != dbc_node_bounds.second; ++itr) + { + if (itr->second.Spell == mastery) + { + found = true; + break; + } + } + + if (found) + continue; + + SpellLearnSpellNode masteryNode; + masteryNode.Spell = mastery; + masteryNode.OverridesSpell = 0; + masteryNode.Active = true; + masteryNode.AutoLearned = false; + + mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(masteryMainSpell, masteryNode)); + ++mastery_count; + } + } + } + TC_LOG_INFO("server.loading", ">> Loaded {} spell learn spells, {} found in Spell.dbc in {} ms", count, dbc_count, GetMSTimeDiffToNow(oldMSTime)); } |
