From aa2feff542a19a253a046ae0ce8cd5d92bb354a2 Mon Sep 17 00:00:00 2001 From: Chomp Date: Wed, 19 Mar 2025 16:57:39 +0000 Subject: [PATCH] Exposed repeatable collection quest FiR requirement + min durability value in config --- .../Generators/RepeatableQuestGenerator.cs | 26 +++++++++---------- .../Models/Spt/Config/QuestConfig.cs | 19 ++++++++++++++ 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs index b1d93338..75592a07 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/RepeatableQuestGenerator.cs @@ -681,7 +681,7 @@ public class RepeatableQuestGenerator( // Push a CompletionCondition with the item and the amount of the item chosenRequirementItemsTpls.Add(itemSelected.Id); - quest.Conditions.AvailableForFinish.Add(GenerateCompletionAvailableForFinish(itemSelected.Id, value)); + quest.Conditions.AvailableForFinish.Add(GenerateCompletionAvailableForFinish(itemSelected.Id, value, repeatableConfig.QuestConfig.Completion)); if (roublesBudget > 0) { @@ -717,22 +717,20 @@ public class RepeatableQuestGenerator( /// This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest /// theoretically can have many) /// - /// id of the item to request - /// amount of items of this specific type to request + /// Id of the item to request + /// Amount of items of this specific type to request + /// Completion config from quest.json /// object of "Completion"-condition - protected QuestCondition GenerateCompletionAvailableForFinish(string itemTpl, double value) + protected QuestCondition GenerateCompletionAvailableForFinish(string itemTpl, + double value, + Completion completionConfig) { - var minDurability = 0; - var onlyFoundInRaid = true; - if ( - _itemHelper.IsOfBaseclass(itemTpl, BaseClasses.WEAPON) || - _itemHelper.IsOfBaseclass(itemTpl, BaseClasses.ARMOR) - ) - { - minDurability = _randomUtil.GetArrayValue([60, 80]); - } + var onlyFoundInRaid = completionConfig.RequiredItemsAreFiR; + var minDurability = _itemHelper.IsOfBaseclasses(itemTpl, [BaseClasses.WEAPON, BaseClasses.ARMOR]) + ? _randomUtil.GetArrayValue([completionConfig.RequiredItemMinDurabilityMinMax.Min, completionConfig.RequiredItemMinDurabilityMinMax.Max]) + : 0; - // By default all collected items must be FiR, except dog tags + // Dog tags MUST NOT be FiR for them to work if (_itemHelper.IsDogtag(itemTpl)) { onlyFoundInRaid = false; diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs index 4cb8fc5f..ac40d7ab 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/QuestConfig.cs @@ -556,6 +556,25 @@ public record Completion : BaseQuestConfig get; set; } + + /// + /// Should supplied items be required FiR + /// + public bool? RequiredItemsAreFiR + { + get; + set; + } + + /// + /// Should supplied items be required FiR + /// + [JsonPropertyName("requiredItemMinDurabilityMinMax")] + public MinMax? RequiredItemMinDurabilityMinMax + { + get; + set; + } } public record Pickup : BaseQuestConfig