From cdddfcaf0cdfc69e12ed58a0b5979ec7484fa4be Mon Sep 17 00:00:00 2001 From: Metra Date: Tue, 27 Aug 2024 20:58:33 -0700 Subject: [PATCH] put the filter in a more reasonable place --- .../Controllers/Slots/SlotsController.cs | 1 + .../Extensions/ControllerExtensions.cs | 3 --- .../Types/Categories/LuckyDipCategory.cs | 8 ++++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs index 13f9afa8a..f71267bab 100644 --- a/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs +++ b/ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs @@ -263,6 +263,7 @@ public async Task LuckyDipSlots([FromQuery] int seed) PaginationData pageData = this.Request.GetPaginationData(); SlotQueryBuilder queryBuilder = this.FilterFromRequest(token); + queryBuilder.AddFilter(new LockedSlotFilter()); pageData.TotalElements = await StatisticsHelper.SlotCount(this.database, queryBuilder); diff --git a/ProjectLighthouse.Servers.GameServer/Extensions/ControllerExtensions.cs b/ProjectLighthouse.Servers.GameServer/Extensions/ControllerExtensions.cs index 103a92b4d..7c654a6f2 100644 --- a/ProjectLighthouse.Servers.GameServer/Extensions/ControllerExtensions.cs +++ b/ProjectLighthouse.Servers.GameServer/Extensions/ControllerExtensions.cs @@ -175,9 +175,6 @@ void ParseLbp3Query(string key, Action allMust, Action noneCan, Action dontCare) if (!queryBuilder.GetFilters(typeof(CrossControlFilter)).Any()) queryBuilder.AddFilter(new ExcludeCrossControlFilter()); - - if (controller.Request.Path.Value != null && controller.Request.Path.Value.EndsWith("lbp2luckydip")) - queryBuilder.AddFilter(new LockedSlotFilter()); queryBuilder.AddFilter(new SubLevelFilter(token.UserId)); queryBuilder.AddFilter(new HiddenSlotFilter()); diff --git a/ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs b/ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs index 93bea8805..6d8528b4d 100644 --- a/ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs +++ b/ProjectLighthouse.Servers.GameServer/Types/Categories/LuckyDipCategory.cs @@ -2,6 +2,7 @@ using LBPUnion.ProjectLighthouse.Database; using LBPUnion.ProjectLighthouse.Extensions; using LBPUnion.ProjectLighthouse.Filter; +using LBPUnion.ProjectLighthouse.Filter.Filters; using LBPUnion.ProjectLighthouse.Filter.Sorts; using LBPUnion.ProjectLighthouse.Types.Entities.Level; using LBPUnion.ProjectLighthouse.Types.Entities.Token; @@ -16,7 +17,10 @@ public class LuckyDipCategory : SlotCategory public override string Endpoint { get; set; } = "lucky_dip"; public override string Tag => "lucky_dip"; - public override IQueryable GetItems(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) => - database.Slots.Where(queryBuilder.Build()) + public override IQueryable GetItems(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) + { + queryBuilder.AddFilter(new LockedSlotFilter()); + return database.Slots.Where(queryBuilder.Build()) .ApplyOrdering(new SlotSortBuilder().AddSort(new RandomFirstUploadedSort())); + } } \ No newline at end of file