From 718bbfc1b6a8da102b4b8ff9fa6f543b8497ed26 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 15 Mar 2021 16:30:47 -0400 Subject: [PATCH] Core/Spells: Check if serverside spells don't overwrite db2 spells Port From (https://github.com/TrinityCore/TrinityCore/commit/deed58f080fe11cfdeb7623b4ed577d062456702) --- Source/Game/Spells/SpellManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 7a3787a52..df3019fa1 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -2499,6 +2499,12 @@ namespace Game.Entities { uint spellId = spellsResult.Read(0); Difficulty difficulty = (Difficulty)spellsResult.Read(2); + if (CliDB.SpellNameStorage.HasRecord(spellId)) + { + Log.outError(LogFilter.Sql, $"Serverside spell {spellId} difficulty {difficulty} is already loaded from file. Overriding existing spells is not allowed."); + continue; + } + mServersideSpellNames.Add(new (spellId, spellsResult.Read(61))); SpellInfo spellInfo = new SpellInfo(mServersideSpellNames.Last().Name, difficulty, spellEffects[(spellId, difficulty)]); @@ -2573,7 +2579,7 @@ namespace Game.Entities spellInfo.SchoolMask = (SpellSchoolMask)spellsResult.Read(74); spellInfo.ChargeCategoryId = spellsResult.Read(75); - mSpellInfoMap.Add(spellInfo.Id, spellInfo); + mSpellInfoMap.Add(spellId, spellInfo); } while (spellsResult.NextRow()); }