From 9e948ff4bd5d2f584cde19d851bbbf1bb93b51d4 Mon Sep 17 00:00:00 2001 From: Matan Shukry Date: Wed, 24 Feb 2021 21:20:14 +0200 Subject: Core/Spells: Corrected the spell id source used in the learn spells map when loading SpellLearnSpell.db2 data (#26140) --- src/server/game/Spells/SpellMgr.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 7b92b7c4051..43ee4952ed3 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1087,16 +1087,17 @@ void SpellMgr::LoadSpellLearnSpells() for (SpellLearnSpellEntry const* spellLearnSpell : sSpellLearnSpellStore) { - if (!GetSpellInfo(spellLearnSpell->SpellID, DIFFICULTY_NONE)) + if (!GetSpellInfo(spellLearnSpell->SpellID, DIFFICULTY_NONE) || + !GetSpellInfo(spellLearnSpell->LearnSpellID, DIFFICULTY_NONE)) continue; - SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(spellLearnSpell->LearnSpellID); + SpellLearnSpellMapBounds db_node_bounds = dbSpellLearnSpells.equal_range(spellLearnSpell->SpellID); bool found = false; for (SpellLearnSpellMap::const_iterator itr = db_node_bounds.first; itr != db_node_bounds.second; ++itr) { - if (int32(itr->second.Spell) == spellLearnSpell->SpellID) + if (int32(itr->second.Spell) == spellLearnSpell->LearnSpellID) { - TC_LOG_ERROR("sql.sql", "Found redundant record (entry: %u, SpellID: %u) in `spell_learn_spell`, spell added automatically from SpellLearnSpell.db2", spellLearnSpell->LearnSpellID, spellLearnSpell->SpellID); + TC_LOG_ERROR("sql.sql", "Found redundant record (entry: %u, SpellID: %u) in `spell_learn_spell`, spell added automatically from SpellLearnSpell.db2", spellLearnSpell->SpellID, spellLearnSpell->LearnSpellID); found = true; break; } @@ -1106,11 +1107,11 @@ void SpellMgr::LoadSpellLearnSpells() continue; // Check if it is already found in Spell.dbc, ignore silently if yes - SpellLearnSpellMapBounds dbc_node_bounds = GetSpellLearnSpellMapBounds(spellLearnSpell->LearnSpellID); + SpellLearnSpellMapBounds dbc_node_bounds = GetSpellLearnSpellMapBounds(spellLearnSpell->SpellID); found = false; for (SpellLearnSpellMap::const_iterator itr = dbc_node_bounds.first; itr != dbc_node_bounds.second; ++itr) { - if (int32(itr->second.Spell) == spellLearnSpell->SpellID) + if (int32(itr->second.Spell) == spellLearnSpell->LearnSpellID) { found = true; break; @@ -1121,12 +1122,12 @@ void SpellMgr::LoadSpellLearnSpells() continue; SpellLearnSpellNode dbcLearnNode; - dbcLearnNode.Spell = spellLearnSpell->SpellID; + dbcLearnNode.Spell = spellLearnSpell->LearnSpellID; dbcLearnNode.OverridesSpell = spellLearnSpell->OverridesSpellID; dbcLearnNode.Active = true; dbcLearnNode.AutoLearned = false; - mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spellLearnSpell->LearnSpellID, dbcLearnNode)); + mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spellLearnSpell->SpellID, dbcLearnNode)); ++dbc_count; } -- cgit v1.2.3