From 42ed7683c920cd1f1b28dbf9bc945dbbfa12b6c0 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 12 Jan 2025 20:35:07 +0000 Subject: [PATCH] Implemented `QuestConditionHelper` --- Core/Helpers/QuestConditionHelper.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Core/Helpers/QuestConditionHelper.cs b/Core/Helpers/QuestConditionHelper.cs index d31764b6..6a4f43cb 100644 --- a/Core/Helpers/QuestConditionHelper.cs +++ b/Core/Helpers/QuestConditionHelper.cs @@ -1,4 +1,4 @@ -using Core.Annotations; +using Core.Annotations; using Core.Models.Eft.Common.Tables; namespace Core.Helpers; @@ -10,28 +10,28 @@ public class QuestConditionHelper List questConditions, Func> furtherFilter = null) { - throw new NotImplementedException(); + return FilterConditions(questConditions, "Quest", furtherFilter); } public List GetLevelConditions( List questConditions, Func> furtherFilter = null) { - throw new NotImplementedException(); + return FilterConditions(questConditions, "Level", furtherFilter); } public List GetLoyaltyConditions( List questConditions, Func> furtherFilter = null) { - throw new NotImplementedException(); + return FilterConditions(questConditions, "TraderLoyalty", furtherFilter); } public List GetStandingConditions( List questConditions, Func> furtherFilter = null) { - throw new NotImplementedException(); + return FilterConditions(questConditions, "TraderStanding", furtherFilter); } protected List FilterConditions( @@ -39,6 +39,15 @@ public class QuestConditionHelper string questType, Func> furtherFilter = null) { - throw new NotImplementedException(); + var filteredQuests = questConditions.Where((c) => { + if (c.ConditionType == questType) + { + // return true or run the passed in function + return furtherFilter is null || furtherFilter(c).Any(); + } + return false; + }).ToList(); + + return filteredQuests; } }