From 144cd4151b070e61a9a16d23e6a74d607fa8b5a5 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Sun, 8 Jun 2025 14:52:11 -0400 Subject: [PATCH] Core/Objects: Removed type casts before accessing WorldObject::m_Events that became unneccessary after moving it from Unit to WorldObject Port From (https://github.com/TrinityCore/TrinityCore/commit/bc8874f30597a996eb30b7b278bcc71b2f082f10) --- Source/Game/Entities/TemporarySummon.cs | 19 +------------------ Source/Game/Entities/Totem.cs | 2 +- Source/Game/Spells/Auras/Aura.cs | 7 +------ 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/Source/Game/Entities/TemporarySummon.cs b/Source/Game/Entities/TemporarySummon.cs index 158ca777e..575c2b2e3 100644 --- a/Source/Game/Entities/TemporarySummon.cs +++ b/Source/Game/Entities/TemporarySummon.cs @@ -321,9 +321,7 @@ namespace Game.Entities { if (msTime != 0) { - ForcedUnsummonDelayEvent pEvent = new(this); - - m_Events.AddEvent(pEvent, m_Events.CalculateTime(TimeSpan.FromMilliseconds(msTime))); + m_Events.AddEventAtOffset(new ForcedDespawnDelayEvent(this), TimeSpan.FromMilliseconds(msTime)); return; } @@ -1215,21 +1213,6 @@ namespace Game.Entities } } - public class ForcedUnsummonDelayEvent : BasicEvent - { - public ForcedUnsummonDelayEvent(TempSummon owner) - { - m_owner = owner; - } - public override bool Execute(ulong e_time, uint p_time) - { - m_owner.UnSummon(); - return true; - } - - TempSummon m_owner; - } - public class TempSummonData { public uint entry; // Entry of summoned creature diff --git a/Source/Game/Entities/Totem.cs b/Source/Game/Entities/Totem.cs index 4ba0ededc..254dfc2a2 100644 --- a/Source/Game/Entities/Totem.cs +++ b/Source/Game/Entities/Totem.cs @@ -91,7 +91,7 @@ namespace Game.Entities { if (msTime != 0) { - m_Events.AddEvent(new ForcedUnsummonDelayEvent(this), m_Events.CalculateTime(TimeSpan.FromMilliseconds(msTime))); + m_Events.AddEventAtOffset(new ForcedDespawnDelayEvent(this), TimeSpan.FromMilliseconds(msTime)); return; } diff --git a/Source/Game/Spells/Auras/Aura.cs b/Source/Game/Spells/Auras/Aura.cs index 7e2c90cde..d7110c9d6 100644 --- a/Source/Game/Spells/Auras/Aura.cs +++ b/Source/Game/Spells/Auras/Aura.cs @@ -895,13 +895,8 @@ namespace Game.Spells if (m_dropEvent != null) return; - // only units have events - Unit owner = m_owner.ToUnit(); - if (owner == null) - return; - m_dropEvent = new ChargeDropEvent(this, removeMode); - owner.m_Events.AddEvent(m_dropEvent, owner.m_Events.CalculateTime(TimeSpan.FromMilliseconds(delay))); + m_owner.m_Events.AddEventAtOffset(m_dropEvent, TimeSpan.FromMilliseconds(delay)); } public void SetStackAmount(byte stackAmount)