Core/Spells: Corrected the spell id source used in the learn spells map when loading SpellLearnSpell.db2 data

Port From (https://github.com/TrinityCore/TrinityCore/commit/9e948ff4bd5d2f584cde19d851bbbf1bb93b51d4)
This commit is contained in:
hondacrx
2021-02-24 18:55:39 -05:00
parent 5ee0fa576f
commit 5e5cf97963
+8 -8
View File
@@ -979,16 +979,16 @@ namespace Game.Entities
foreach (var spellLearnSpell in CliDB.SpellLearnSpellStorage.Values)
{
if (!HasSpellInfo(spellLearnSpell.SpellID, Difficulty.None))
if (!HasSpellInfo(spellLearnSpell.SpellID, Difficulty.None) || !HasSpellInfo(spellLearnSpell.LearnSpellID, Difficulty.None))
continue;
var db_node_bounds = mSpellLearnSpells.LookupByKey(spellLearnSpell.LearnSpellID);
var db_node_bounds = mSpellLearnSpells.LookupByKey(spellLearnSpell.SpellID);
bool found = false;
foreach (var spellNode in db_node_bounds)
{
if (spellNode.Spell == spellLearnSpell.SpellID)
if (spellNode.Spell == spellLearnSpell.LearnSpellID)
{
Log.outError(LogFilter.Sql, "Found redundant record (entry: {0}, SpellID: {1}) in `spell_learn_spell`, spell added automatically from SpellLearnSpell.db2", spellLearnSpell.LearnSpellID, spellLearnSpell.SpellID);
Log.outError(LogFilter.Sql, $"Found redundant record (entry: {spellLearnSpell.SpellID}, SpellID: {spellLearnSpell.LearnSpellID}) in `spell_learn_spell`, spell added automatically from SpellLearnSpell.db2");
found = true;
break;
}
@@ -998,11 +998,11 @@ namespace Game.Entities
continue;
// Check if it is already found in Spell.dbc, ignore silently if yes
var dbc_node_bounds = GetSpellLearnSpellMapBounds(spellLearnSpell.LearnSpellID);
var dbc_node_bounds = GetSpellLearnSpellMapBounds(spellLearnSpell.SpellID);
found = false;
foreach (var spellNode in dbc_node_bounds)
{
if (spellNode.Spell == spellLearnSpell.SpellID)
if (spellNode.Spell == spellLearnSpell.LearnSpellID)
{
found = true;
break;
@@ -1013,12 +1013,12 @@ namespace Game.Entities
continue;
SpellLearnSpellNode dbcLearnNode = new SpellLearnSpellNode();
dbcLearnNode.Spell = spellLearnSpell.SpellID;
dbcLearnNode.Spell = spellLearnSpell.LearnSpellID;
dbcLearnNode.OverridesSpell = spellLearnSpell.OverridesSpellID;
dbcLearnNode.Active = true;
dbcLearnNode.AutoLearned = false;
mSpellLearnSpells.Add(spellLearnSpell.LearnSpellID, dbcLearnNode);
mSpellLearnSpells.Add(spellLearnSpell.SpellID, dbcLearnNode);
++dbc_count;
}