diff options
author | Shauren <shauren.trinity@gmail.com> | 2019-08-17 17:42:58 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2019-08-17 17:42:58 +0200 |
commit | 677663139cd130be502d5854d7ab7d1aebdf494c (patch) | |
tree | 7ec3583a03469e7ce08e99660daa451f6a917302 | |
parent | ea16c4ac9fcbef26ce28865212af904e2a0f6db8 (diff) |
Core/Spells: Removed PROC_ATTR_DISABLE_EFF_* attributes and store that in a separate column
-rw-r--r-- | sql/updates/world/3.3.5/2019_08_17_01_world.sql | 4 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuras.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 20 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.h | 5 |
4 files changed, 18 insertions, 17 deletions
diff --git a/sql/updates/world/3.3.5/2019_08_17_01_world.sql b/sql/updates/world/3.3.5/2019_08_17_01_world.sql new file mode 100644 index 00000000000..f9239dd8a2e --- /dev/null +++ b/sql/updates/world/3.3.5/2019_08_17_01_world.sql @@ -0,0 +1,4 @@ +ALTER TABLE `spell_proc` ADD `DisableEffectsMask` int(10) unsigned NOT NULL DEFAULT '0' AFTER `AttributesMask`; + +UPDATE `spell_proc` SET `DisableEffectsMask`=((`AttributesMask` >> 4) & 0x7); +UPDATE `spell_proc` SET `AttributesMask`=(`AttributesMask` & 0xF); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index c13248c96af..b1d9ae7b264 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -2073,9 +2073,9 @@ uint8 Aura::GetProcEffectMask(AuraApplication* aurApp, ProcEventInfo& eventInfo, // At least one effect has to pass checks to proc aura uint8 procEffectMask = aurApp->GetEffectMask(); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (procEffectMask & (1 << i)) - if ((procEntry->AttributesMask & (PROC_ATTR_DISABLE_EFF_0 << i)) || !GetEffect(i)->CheckEffectProc(aurApp, eventInfo)) - procEffectMask &= ~(1 << i); + if (procEffectMask & (1u << i)) + if ((procEntry->DisableEffectsMask & (1u << i)) || !GetEffect(i)->CheckEffectProc(aurApp, eventInfo)) + procEffectMask &= ~(1u << i); if (!procEffectMask) return 0; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 73105006fe5..0d1d18b66a0 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1529,8 +1529,8 @@ void SpellMgr::LoadSpellProcs() // 0 1 2 3 4 5 QueryResult result = WorldDatabase.Query("SELECT SpellId, SchoolMask, SpellFamilyName, SpellFamilyMask0, SpellFamilyMask1, SpellFamilyMask2, " - // 6 7 8 9 10 11 12 13 14 - "ProcFlags, SpellTypeMask, SpellPhaseMask, HitMask, AttributesMask, ProcsPerMinute, Chance, Cooldown, Charges FROM spell_proc"); + // 6 7 8 9 10 11 12 13 14 15 + "ProcFlags, SpellTypeMask, SpellPhaseMask, HitMask, AttributesMask, DisableEffectsMask, ProcsPerMinute, Chance, Cooldown, Charges FROM spell_proc"); uint32 count = 0; if (result) @@ -1579,10 +1579,11 @@ void SpellMgr::LoadSpellProcs() baseProcEntry.SpellPhaseMask = fields[8].GetUInt32(); baseProcEntry.HitMask = fields[9].GetUInt32(); baseProcEntry.AttributesMask = fields[10].GetUInt32(); - baseProcEntry.ProcsPerMinute = fields[11].GetFloat(); - baseProcEntry.Chance = fields[12].GetFloat(); - baseProcEntry.Cooldown = Milliseconds(fields[13].GetUInt32()); - baseProcEntry.Charges = fields[14].GetUInt8(); + baseProcEntry.DisableEffectsMask = fields[11].GetUInt32(); + baseProcEntry.ProcsPerMinute = fields[12].GetFloat(); + baseProcEntry.Chance = fields[13].GetFloat(); + baseProcEntry.Cooldown = Milliseconds(fields[14].GetUInt32()); + baseProcEntry.Charges = fields[15].GetUInt8(); while (spellInfo) { @@ -1634,8 +1635,8 @@ void SpellMgr::LoadSpellProcs() if (procEntry.HitMask && !(procEntry.ProcFlags & TAKEN_HIT_PROC_FLAG_MASK || (procEntry.ProcFlags & DONE_HIT_PROC_FLAG_MASK && (!procEntry.SpellPhaseMask || procEntry.SpellPhaseMask & (PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH))))) TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has `HitMask` value defined, but it will not be used for defined `ProcFlags` and `SpellPhaseMask` values.", spellInfo->Id); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if ((procEntry.AttributesMask & (PROC_ATTR_DISABLE_EFF_0 << i)) && !spellInfo->Effects[i].IsAura()) - TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has Attribute PROC_ATTR_DISABLE_EFF_%u, but effect %u is not an aura effect", spellInfo->Id, static_cast<uint32>(i), static_cast<uint32>(i)); + if ((procEntry.DisableEffectsMask & (1u << i)) && !spellInfo->Effects[i].IsAura()) + TC_LOG_ERROR("sql.sql", "The `spell_proc` table entry for spellId %u has DisableEffectsMask with effect %u, but effect %u is not an aura effect", spellInfo->Id, static_cast<uint32>(i), static_cast<uint32>(i)); if (procEntry.AttributesMask & PROC_ATTR_REQ_SPELLMOD) { bool found = false; @@ -1866,12 +1867,11 @@ void SpellMgr::LoadSpellProcs() } procEntry.AttributesMask = 0; + procEntry.DisableEffectsMask = nonProcMask; if (spellInfo->ProcFlags & PROC_FLAG_KILL) procEntry.AttributesMask |= PROC_ATTR_REQ_EXP_OR_HONOR; if (addTriggerFlag) procEntry.AttributesMask |= PROC_ATTR_TRIGGERED_CAN_PROC; - if (nonProcMask) - procEntry.AttributesMask |= nonProcMask * PROC_ATTR_DISABLE_EFF_0; procEntry.ProcsPerMinute = 0; procEntry.Chance = spellInfo->ProcChance; diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index 2a361d2a0cf..0521146f6e4 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -244,10 +244,6 @@ enum ProcAttributes PROC_ATTR_REQ_MANA_COST = 0x0000004, // requires triggering spell to have a mana cost for aura proc PROC_ATTR_REQ_SPELLMOD = 0x0000008, // requires triggering spell to be affected by proccing aura to drop charges - PROC_ATTR_DISABLE_EFF_0 = 0x0000010, // explicitly disables aura proc from effects, USE ONLY IF 100% SURE AURA SHOULDN'T PROC - PROC_ATTR_DISABLE_EFF_1 = 0x0000020, /// used to avoid a console error if the spell has invalid trigger spell and handled elsewhere - PROC_ATTR_DISABLE_EFF_2 = 0x0000040, /// or handling not needed - PROC_ATTR_REDUCE_PROC_60 = 0x0000080 // aura should have a reduced chance to proc if level of proc Actor > 60 }; @@ -261,6 +257,7 @@ struct SpellProcEntry uint32 SpellPhaseMask; // if nonzero - bitmask for matching phase of a spellcast on which proc occurs, see enum ProcFlagsSpellPhase uint32 HitMask; // if nonzero - bitmask for matching proc condition based on hit result, see enum ProcFlagsHit uint32 AttributesMask; // bitmask, see ProcAttributes + uint32 DisableEffectsMask;// bitmask float ProcsPerMinute; // if nonzero - chance to proc is equal to value * aura caster's weapon speed / 60 float Chance; // if nonzero - owerwrite procChance field for given Spell.dbc entry, defines chance of proc to occur, not used if ProcsPerMinute set Milliseconds Cooldown; // if nonzero - cooldown in secs for aura proc, applied to aura |