From 0445a0b3a6af81f6ac45e671b027b2aac3872001 Mon Sep 17 00:00:00 2001 From: Slendy Date: Mon, 11 Mar 2024 21:32:03 -0500 Subject: [PATCH] Update activity system to use new team pick time --- .../Unit/Activity/ActivityEventHandlerTests.cs | 2 +- .../Types/Activity/ActivityEntityEventHandler.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ProjectLighthouse.Tests.GameApiTests/Unit/Activity/ActivityEventHandlerTests.cs b/ProjectLighthouse.Tests.GameApiTests/Unit/Activity/ActivityEventHandlerTests.cs index 6f08b8b4..95d1ba05 100644 --- a/ProjectLighthouse.Tests.GameApiTests/Unit/Activity/ActivityEventHandlerTests.cs +++ b/ProjectLighthouse.Tests.GameApiTests/Unit/Activity/ActivityEventHandlerTests.cs @@ -673,7 +673,7 @@ public class ActivityEventHandlerTests { SlotId = 1, CreatorId = 1, - TeamPick = true, + TeamPickTime = 1, }; eventHandler.OnEntityChanged(database, oldSlot, newSlot); diff --git a/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs b/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs index 2342c566..46f5ebb2 100644 --- a/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs +++ b/ProjectLighthouse/Types/Activity/ActivityEntityEventHandler.cs @@ -245,10 +245,13 @@ public class ActivityEntityEventHandler : IEntityEventHandler { if (origEntity is not SlotEntity oldSlotEntity) break; - switch (oldSlotEntity.TeamPick) + bool oldIsTeamPick = oldSlotEntity.TeamPickTime != 0; + bool newIsTeamPick = slotEntity.TeamPickTime != 0; + + switch (oldIsTeamPick) { // When a level is team picked - case false when slotEntity.TeamPick: + case false when newIsTeamPick: activity = new LevelActivityEntity { Type = EventType.MMPickLevel, @@ -257,7 +260,7 @@ public class ActivityEntityEventHandler : IEntityEventHandler }; break; // When a level has its team pick removed then remove the corresponding activity - case true when !slotEntity.TeamPick: + case true when !newIsTeamPick: database.Activities.OfType() .Where(a => a.Type == EventType.MMPickLevel) .Where(a => a.SlotId == slotEntity.SlotId)