From 49997e5819e19d5a5d32836facee22c608733c2e Mon Sep 17 00:00:00 2001 From: Chomp Date: Fri, 17 Jan 2025 14:20:18 +0000 Subject: [PATCH] Fixed compile error and improved logic of `GetQuestCount` --- Core/Controllers/RepeatableQuestController.cs | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Core/Controllers/RepeatableQuestController.cs b/Core/Controllers/RepeatableQuestController.cs index ceacb2ea..11fcb8fb 100644 --- a/Core/Controllers/RepeatableQuestController.cs +++ b/Core/Controllers/RepeatableQuestController.cs @@ -405,19 +405,37 @@ public class RepeatableQuestController return pmcLevel <= locationBase.RequiredPlayerLevelMax && pmcLevel >= locationBase.RequiredPlayerLevelMin; } + /// + /// Get count of repeatable quests profile should have access to + /// + /// + /// Player profile + /// Quest count private int GetQuestCount(RepeatableQuestConfig repeatableConfig, PmcData pmcData) { + var questCount = repeatableConfig.NumQuests.GetValueOrDefault(0); + if (questCount == 0) + { + _logger.Warning($"Repeatable {repeatableConfig.Name} quests have a count of 0"); + } + + // Add elite bonus to daily quests if (repeatableConfig.Name.ToLower() == "daily" && _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, pmcData) ) { // Elite charisma skill gives extra daily quest(s) - return (repeatableConfig.NumQuests + - _databaseService.GetGlobals().Configuration.SkillsSettings.Charisma.BonusSettings.EliteBonusSettings - .RepeatableQuestExtraCount.GetValueOrDefault(0) - ); + questCount += _databaseService + .GetGlobals() + .Configuration + .SkillsSettings + .Charisma + .BonusSettings + .EliteBonusSettings + .RepeatableQuestExtraCount + .GetValueOrDefault(0); } - return repeatableConfig.NumQuests; + return questCount; } }