fix(Core/Spells): Implemented ENCHANT_PROC_ATTR_EXCLUSIVE. (#15476)

Fixes #12132
This commit is contained in:
UltraNix
2023-04-02 20:28:23 +02:00
committed by GitHub
parent d029ffe3ab
commit a72f5f97e6
4 changed files with 21 additions and 2 deletions
@@ -0,0 +1,3 @@
--
ALTER TABLE `spell_enchant_proc_data` ADD COLUMN `attributeMask` INT UNSIGNED DEFAULT 0 NOT NULL AFTER `procEx`;
UPDATE `spell_enchant_proc_data` SET `attributeMask`=1 WHERE `entry`=3225;
@@ -7218,6 +7218,15 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
continue; continue;
} }
if (entry && (entry->attributeMask & ENCHANT_PROC_ATTR_EXCLUSIVE) != 0)
{
Unit* checkTarget = spellInfo->IsPositive() ? this : target;
if (checkTarget->HasAura(spellInfo->Id, GetGUID()))
{
continue;
}
}
float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance(); float chance = pEnchant->amount[s] != 0 ? float(pEnchant->amount[s]) : GetWeaponProcChance();
if (entry) if (entry)
+3 -2
View File
@@ -2211,8 +2211,8 @@ void SpellMgr::LoadSpellEnchantProcData()
mSpellEnchantProcEventMap.clear(); // need for reload case mSpellEnchantProcEventMap.clear(); // need for reload case
// 0 1 2 3 // 0 1 2 3 4
QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx FROM spell_enchant_proc_data"); QueryResult result = WorldDatabase.Query("SELECT entry, customChance, PPMChance, procEx, attributeMask FROM spell_enchant_proc_data");
if (!result) if (!result)
{ {
LOG_WARN("server.loading", ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty."); LOG_WARN("server.loading", ">> Loaded 0 spell enchant proc event conditions. DB table `spell_enchant_proc_data` is empty.");
@@ -2239,6 +2239,7 @@ void SpellMgr::LoadSpellEnchantProcData()
spe.customChance = fields[1].Get<uint32>(); spe.customChance = fields[1].Get<uint32>();
spe.PPMChance = fields[2].Get<float>(); spe.PPMChance = fields[2].Get<float>();
spe.procEx = fields[3].Get<uint32>(); spe.procEx = fields[3].Get<uint32>();
spe.attributeMask = fields[4].Get<uint32>();
mSpellEnchantProcEventMap[enchantId] = spe; mSpellEnchantProcEventMap[enchantId] = spe;
+6
View File
@@ -304,11 +304,17 @@ struct SpellProcEntry
typedef std::unordered_map<uint32, SpellProcEntry> SpellProcMap; typedef std::unordered_map<uint32, SpellProcEntry> SpellProcMap;
enum EnchantProcAttributes
{
ENCHANT_PROC_ATTR_EXCLUSIVE = 0x1 // Only one instance of that effect can be active
};
struct SpellEnchantProcEntry struct SpellEnchantProcEntry
{ {
uint32 customChance; uint32 customChance;
float PPMChance; float PPMChance;
uint32 procEx; uint32 procEx;
uint32 attributeMask;
}; };
typedef std::unordered_map<uint32, SpellEnchantProcEntry> SpellEnchantProcEventMap; typedef std::unordered_map<uint32, SpellEnchantProcEntry> SpellEnchantProcEventMap;