Core/Spells: add log on load about improper use of attribute PROC_ATTR_REQ_SPELLMOD

Port From (https://github.com/TrinityCore/TrinityCore/commit/3582bacc4a3550725d288b55fb16311dee0ae0df)
This commit is contained in:
hondacrx
2021-06-23 22:13:19 -04:00
parent 1b87be93be
commit 1be1a5ad1a
2 changed files with 19 additions and 0 deletions
@@ -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
+18
View File
@@ -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;