From 5ad5b8ef18c3f5cce7b7660ce8342b4ab6f413ef Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 16 Oct 2021 18:26:30 -0400 Subject: [PATCH] Core/Spells: Implemented SPELL_AURA_SUPPRESS_ITEM_PASSIVE_EFFECT_BY_SPELL_LABEL Port From (https://github.com/TrinityCore/TrinityCore/commit/6e4a90d2749c7675eebbb3eb41cd50ecaab78b7e) --- Source/Game/Entities/Player/Player.Items.cs | 3 +++ Source/Game/Spells/Auras/Aura.cs | 4 ++++ Source/Game/Spells/Auras/AuraEffect.cs | 16 ++++++++++++++++ 3 files changed, 23 insertions(+) diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index eb4a7404e..a7ca7bd1a 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -3889,6 +3889,9 @@ namespace Game.Entities foreach (ItemEffectRecord effectData in pItem.GetEffects()) { SpellInfo effectSpellInfo = Global.SpellMgr.GetSpellInfo((uint)effectData.SpellID, Difficulty.None); + if (effectSpellInfo == null) + continue; + // apply proc cooldown to equip auras if we have any if (effectData.TriggerType == ItemSpelltriggerType.OnEquip) { diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index d13e44544..e167edc20 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -1468,6 +1468,10 @@ namespace Game.Spells bool CanBeAppliedOn(Unit target) { + foreach (uint label in GetSpellInfo().Labels) + if (target.HasAuraTypeWithMiscvalue(AuraType.SuppressItemPassiveEffectBySpellLabel, (int)label)) + return false; + // unit not in world or during remove from world if (!target.IsInWorld || target.IsDuringRemoveFromWorld()) { diff --git a/Source/Game/Spells/Auras/AuraEffect.cs b/Source/Game/Spells/Auras/AuraEffect.cs index ad2401980..b67c6e2ca 100644 --- a/Source/Game/Spells/Auras/AuraEffect.cs +++ b/Source/Game/Spells/Auras/AuraEffect.cs @@ -5772,6 +5772,22 @@ namespace Game.Spells playerTarget.SendMovementSetCollisionHeight(playerTarget.GetCollisionHeight(), UpdateCollisionHeightReason.Force); } + + [AuraEffectHandler(AuraType.SuppressItemPassiveEffectBySpellLabel)] + void HandleSuppressItemPassiveEffectBySpellLabel(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply) + { + if (!mode.HasAnyFlag(AuraEffectHandleModes.Real)) + return; + + List suppressedAuras = new(); + foreach (var appliedAura in aurApp.GetTarget().GetOwnedAuras()) + if (appliedAura.Value.GetSpellInfo().HasLabel((uint)GetMiscValue())) + suppressedAuras.Add(appliedAura.Value); + + // Refresh applications + foreach (Aura aura in suppressedAuras) + aura.ApplyForTargets(); + } #endregion }