diff --git a/Source/Game/Arenas/Arena.cs b/Source/Game/Arenas/Arena.cs index 803625f69..ec2b4270e 100644 --- a/Source/Game/Arenas/Arena.cs +++ b/Source/Game/Arenas/Arena.cs @@ -16,6 +16,7 @@ */ using Framework.Constants; +using Framework.Dynamic; using Game.BattleGrounds; using Game.Entities; using Game.Guilds; @@ -26,7 +27,9 @@ using System.Collections.Generic; namespace Game.Arenas { public class Arena : Battleground - { + { + protected TaskScheduler taskScheduler = new(); + public Arena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { StartDelayTimes[BattlegroundConst.EventIdFirst] = BattlegroundStartTimeIntervals.Delay1m; diff --git a/Source/Game/Arenas/Zones/BladesEdgeArena.cs b/Source/Game/Arenas/Zones/BladesEdgeArena.cs index a71eee81f..8fd75ae25 100644 --- a/Source/Game/Arenas/Zones/BladesEdgeArena.cs +++ b/Source/Game/Arenas/Zones/BladesEdgeArena.cs @@ -16,9 +16,10 @@ */ using Framework.Constants; +using Game.BattleGrounds; using Game.Entities; using Game.Networking.Packets; -using Game.BattleGrounds; +using System; namespace Game.Arenas { @@ -26,6 +27,14 @@ namespace Game.Arenas { public BladesEdgeArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { } + public override void PostUpdateImpl(uint diff) + { + if (GetStatus() != BattlegroundStatus.InProgress) + return; + + taskScheduler.Update(diff); + } + public override void StartingEventCloseDoors() { for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door4; ++i) @@ -40,6 +49,12 @@ namespace Game.Arenas for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door4; ++i) DoorOpen(i); + taskScheduler.Schedule(TimeSpan.FromSeconds(5), task => + { + for (int i = BladeEdgeObjectTypes.Door1; i <= BladeEdgeObjectTypes.Door2; ++i) + DelObject(i); + }); + for (int i = BladeEdgeObjectTypes.Buff1; i <= BladeEdgeObjectTypes.Buff2; ++i) SpawnBGObject(i, 60); } diff --git a/Source/Game/Arenas/Zones/NagrandArena.cs b/Source/Game/Arenas/Zones/NagrandArena.cs index 3a6b21e9c..1dc54e173 100644 --- a/Source/Game/Arenas/Zones/NagrandArena.cs +++ b/Source/Game/Arenas/Zones/NagrandArena.cs @@ -16,9 +16,10 @@ */ using Framework.Constants; +using Game.BattleGrounds; using Game.Entities; using Game.Networking.Packets; -using Game.BattleGrounds; +using System; namespace Game.Arenas { @@ -26,6 +27,14 @@ namespace Game.Arenas { public NagrandArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { } + public override void PostUpdateImpl(uint diff) + { + if (GetStatus() != BattlegroundStatus.InProgress) + return; + + taskScheduler.Update(diff); + } + public override void StartingEventCloseDoors() { for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door4; ++i) @@ -37,6 +46,12 @@ namespace Game.Arenas for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door4; ++i) DoorOpen(i); + taskScheduler.Schedule(TimeSpan.FromSeconds(5), task => + { + for (int i = NagrandArenaObjectTypes.Door1; i <= NagrandArenaObjectTypes.Door2; ++i) + DelObject(i); + }); + for (int i = NagrandArenaObjectTypes.Buff1; i <= NagrandArenaObjectTypes.Buff2; ++i) SpawnBGObject(i, 60); } diff --git a/Source/Game/Arenas/Zones/RuinsofLordaeron.cs b/Source/Game/Arenas/Zones/RuinsofLordaeron.cs index 0f0e9df70..2f514f364 100644 --- a/Source/Game/Arenas/Zones/RuinsofLordaeron.cs +++ b/Source/Game/Arenas/Zones/RuinsofLordaeron.cs @@ -16,9 +16,10 @@ */ using Framework.Constants; +using Game.BattleGrounds; using Game.Entities; using Game.Networking.Packets; -using Game.BattleGrounds; +using System; namespace Game.Arenas { @@ -26,6 +27,14 @@ namespace Game.Arenas { public RuinsofLordaeronArena(BattlegroundTemplate battlegroundTemplate) : base(battlegroundTemplate) { } + public override void PostUpdateImpl(uint diff) + { + if (GetStatus() != BattlegroundStatus.InProgress) + return; + + taskScheduler.Update(diff); + } + public override bool SetupBattleground() { bool result = true; @@ -59,6 +68,12 @@ namespace Game.Arenas for (int i = RuinsofLordaeronObjectTypes.Door1; i <= RuinsofLordaeronObjectTypes.Door2; ++i) DoorOpen(i); + taskScheduler.Schedule(TimeSpan.FromSeconds(5), task => + { + for (int i = RuinsofLordaeronObjectTypes.Door1; i <= RuinsofLordaeronObjectTypes.Door2; ++i) + DelObject(i); + }); + for (int i = RuinsofLordaeronObjectTypes.Buff1; i <= RuinsofLordaeronObjectTypes.Buff2; ++i) SpawnBGObject(i, 60); }