From 1be1a5ad1a977c35d2b3a37559bc7171de3fac13 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 23 Jun 2021 22:13:19 -0400 Subject: [PATCH] Core/Spells: add log on load about improper use of attribute PROC_ATTR_REQ_SPELLMOD Port From (https://github.com/TrinityCore/TrinityCore/commit/3582bacc4a3550725d288b55fb16311dee0ae0df) --- .../Framework/Constants/Spells/SpellConst.cs | 1 + Source/Game/Spells/SpellManager.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index d54102e5f..430831b7e 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -2482,6 +2482,7 @@ namespace Framework.Constants MaskAll = 0x0003FFF } + [Flags] public enum ProcAttributes { ReqExpOrHonor = 0x01, // requires proc target to give exp or honor for aura proc diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index 4ede40443..67b4c8568 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -1425,6 +1425,24 @@ namespace Game.Entities Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} has wrong `HitMask` set: {1}", spellInfo.Id, procEntry.HitMask); if (procEntry.HitMask != 0 && !(Convert.ToBoolean(procEntry.ProcFlags & ProcFlags.TakenHitMask) || (Convert.ToBoolean(procEntry.ProcFlags & ProcFlags.DoneHitMask) && (procEntry.SpellPhaseMask == 0 || Convert.ToBoolean(procEntry.SpellPhaseMask & (ProcFlagsSpellPhase.Hit | ProcFlagsSpellPhase.Finish)))))) Log.outError(LogFilter.Sql, "`spell_proc` table entry for spellId {0} has `HitMask` value defined, but it won't be used for defined `ProcFlags` and `SpellPhaseMask` values", spellInfo.Id); + if (procEntry.AttributesMask.HasFlag(ProcAttributes.ReqSpellmod)) + { + bool found = false; + foreach (SpellEffectInfo effect in spellInfo.GetEffects()) + { + if (effect == null || !effect.IsAura()) + continue; + + if (effect.ApplyAuraName == AuraType.AddPctModifier || effect.ApplyAuraName == AuraType.AddFlatModifier) + { + found = true; + break; + } + } + + if (!found) + Log.outError(LogFilter.Sql, $"The `spell_proc` table entry for spellId {spellInfo.Id} has Attribute PROC_ATTR_REQ_SPELLMOD, but spell has no spell mods. Proc will not be triggered"); + } mSpellProcMap.Add((spellInfo.Id, spellInfo.Difficulty), procEntry); ++count;