From c76fcebeb37238b6424e5e93706d95c8532b2038 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 25 Apr 2023 17:12:30 -0400 Subject: [PATCH] Scripts/Spells: Added proc requirements to a few auras that have SPELL_ATTR3_CAN_PROC_FROM_PROCS attribute Port From (https://github.com/TrinityCore/TrinityCore/commit/a265672e5438acba781354b12614791791643881) --- Source/Game/Entities/Player/Player.Items.cs | 2 +- .../Game/Networking/Packets/AzeritePackets.cs | 2 +- Source/Scripts/Spells/Items.cs | 52 ++++++++++++++++++- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 1314d3119..ac5f59a6e 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -4061,7 +4061,7 @@ namespace Game.Entities } } - void ApplyAllAzeriteEmpoweredItemMods(bool apply) + public void ApplyAllAzeriteEmpoweredItemMods(bool apply) { for (byte i = 0; i < InventorySlots.BagEnd; ++i) { diff --git a/Source/Game/Networking/Packets/AzeritePackets.cs b/Source/Game/Networking/Packets/AzeritePackets.cs index 0b8c8a5d0..8dcafd9ff 100644 --- a/Source/Game/Networking/Packets/AzeritePackets.cs +++ b/Source/Game/Networking/Packets/AzeritePackets.cs @@ -96,7 +96,7 @@ namespace Game.Networking.Packets public byte Slot; } - class PlayerAzeriteItemEquippedStatusChanged : ServerPacket + public class PlayerAzeriteItemEquippedStatusChanged : ServerPacket { public PlayerAzeriteItemEquippedStatusChanged() : base(ServerOpcodes.PlayerAzeriteItemEquippedStatusChanged) { } diff --git a/Source/Scripts/Spells/Items.cs b/Source/Scripts/Spells/Items.cs index 640ecc814..0acb2d76c 100644 --- a/Source/Scripts/Spells/Items.cs +++ b/Source/Scripts/Spells/Items.cs @@ -7,6 +7,7 @@ using Game.BattleGrounds; using Game.DataStorage; using Game.Entities; using Game.Loots; +using Game.Networking.Packets; using Game.Scripting; using Game.Spells; using System; @@ -3991,7 +3992,7 @@ namespace Scripts.Spells.Items FragileEchoEnergize = 215270, } - [Script] // 215266 + [Script] // 215266 - Fragile Echoes class spell_item_amalgams_seventh_spine : AuraScript { public override bool Validate(SpellInfo spellInfo) @@ -4052,7 +4053,7 @@ namespace Scripts.Spells.Items } } - [Script] // 215267 + [Script] // 215267 - Fragile Echo class spell_item_amalgams_seventh_spine_mana_restore : AuraScript { public override bool Validate(SpellInfo spellInfo) @@ -4079,4 +4080,51 @@ namespace Scripts.Spells.Items AfterEffectRemove.Add(new EffectApplyHandler(TriggerManaRestoration, 1, AuraType.Dummy, AuraEffectHandleModes.Real)); } } + + [Script] // 228445 - March of the Legion + class spell_item_set_march_of_the_legion : AuraScript + { + bool IsDemon(AuraEffect aurEff, ProcEventInfo eventInfo) + { + return eventInfo.GetProcTarget() && eventInfo.GetProcTarget().GetCreatureType() == CreatureType.Demon; + } + + public override void Register() + { + DoCheckEffectProc.Add(new CheckEffectProcHandler(IsDemon, 0, AuraType.ProcTriggerSpell)); + } + } + + [Script] // 277253 - Heart of Azeroth + class spell_item_heart_of_azeroth : AuraScript + { + void SetEquippedFlag(AuraEffect effect, AuraEffectHandleModes mode) + { + SetState(true); + } + + void ClearEquippedFlag(AuraEffect effect, AuraEffectHandleModes mode) + { + SetState(false); + } + + void SetState(bool equipped) + { + Player target = GetTarget().ToPlayer(); + if (target != null) + { + target.ApplyAllAzeriteEmpoweredItemMods(equipped); + + PlayerAzeriteItemEquippedStatusChanged statusChanged = new(); + statusChanged.IsHeartEquipped = equipped; + target.SendPacket(statusChanged); + } + } + + public override void Register() + { + OnEffectApply.Add(new EffectApplyHandler(SetEquippedFlag, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + OnEffectRemove.Add(new EffectApplyHandler(ClearEquippedFlag, 0, AuraType.Dummy, AuraEffectHandleModes.Real)); + } + } }