Core/Spells: Validate spell_proc.AttributesMask on startup

This commit is contained in:
Shauren
2022-01-11 19:05:35 +01:00
parent 4772b55368
commit 415aaae7f2
2 changed files with 12 additions and 0 deletions

View File

@@ -1626,6 +1626,11 @@ void SpellMgr::LoadSpellProcs()
if (!found)
TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has Attribute PROC_ATTR_REQ_SPELLMOD, but spell has no spell mods. Proc will not be triggered", spellInfo->Id);
}
if (procEntry.AttributesMask & ~PROC_ATTR_ALL_ALLOWED)
{
TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has `AttributesMask` value specifying invalid attributes 0x%02X.", spellInfo->Id, procEntry.AttributesMask & ~PROC_ATTR_ALL_ALLOWED);
procEntry.AttributesMask &= PROC_ATTR_ALL_ALLOWED;
}
mSpellProcMap[{ spellInfo->Id, spellInfo->Difficulty }] = procEntry;

View File

@@ -272,6 +272,13 @@ enum ProcAttributes
PROC_ATTR_REDUCE_PROC_60 = 0x0000080 // aura should have a reduced chance to proc if level of proc Actor > 60
};
#define PROC_ATTR_ALL_ALLOWED (PROC_ATTR_REQ_EXP_OR_HONOR | \
PROC_ATTR_TRIGGERED_CAN_PROC | \
PROC_ATTR_REQ_POWER_COST | \
PROC_ATTR_REQ_SPELLMOD | \
PROC_ATTR_USE_STACKS_FOR_CHARGES | \
PROC_ATTR_REDUCE_PROC_60)
struct SpellProcEntry
{
uint32 SchoolMask; // if nonzero - bitmask for matching proc condition based on spell's school