From d1cfe62c3f784b42a9870eb497e90b48f4e181ff Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 17 Jan 2025 12:59:11 +0000 Subject: [PATCH] Implemented `TraderStandingRequirementCheck` --- Core/Helpers/QuestHelper.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Core/Helpers/QuestHelper.cs b/Core/Helpers/QuestHelper.cs index d63e3139..277dd80f 100644 --- a/Core/Helpers/QuestHelper.cs +++ b/Core/Helpers/QuestHelper.cs @@ -139,8 +139,8 @@ public class QuestHelper /// true if loyalty is high enough to fulfill quest requirement public bool TraderLoyaltyLevelRequirementCheck(QuestCondition questProperties, PmcData profile) { - var requiredLoyaltyLevel = questProperties.Value as int?; - if (!profile.TradersInfo.TryGetValue(questProperties.Target, out var trader)) + var requiredLoyaltyLevel = questProperties.Value as float?; + if (!profile.TradersInfo.TryGetValue(questProperties.Target as string, out var trader)) { _logger.Error( _localisationService.GetText("quest-unable_to_find_trader_in_profile", questProperties.Target)); @@ -157,10 +157,17 @@ public class QuestHelper /// true if standing is high enough to fulfill quest requirement public bool TraderStandingRequirementCheck(QuestCondition questProperties, PmcData profile) { - throw new System.NotImplementedException(); + var requiredLoyaltyLevel = questProperties.Value as float?; + if (!profile.TradersInfo.TryGetValue(questProperties.Target as string, out var trader)) + { + _logger.Error( + _localisationService.GetText("quest-unable_to_find_trader_in_profile", questProperties.Target)); + } + + return CompareAvailableForValues(trader.Standing.Value, requiredLoyaltyLevel.Value, questProperties.CompareMethod); } - protected bool CompareAvailableForValues(int current, int required, string compareMethod) + protected bool CompareAvailableForValues(double current, float required, string compareMethod) { switch (compareMethod) {