Core/Spells: Implemented SPELL_AURA_SUPPRESS_ITEM_PASSIVE_EFFECT_BY_SPELL_LABEL

Port From (https://github.com/TrinityCore/TrinityCore/commit/6e4a90d2749c7675eebbb3eb41cd50ecaab78b7e)
This commit is contained in:
hondacrx
2021-10-16 18:26:30 -04:00
parent 6ca98e5f7d
commit 5ad5b8ef18
3 changed files with 23 additions and 0 deletions
@@ -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)
{
+4
View File
@@ -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())
{
+16
View File
@@ -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<Aura> 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
}