using SPTarkov.DI.Annotations; using SPTarkov.Server.Core.Models.Enums; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; using SPTarkov.Server.Core.Servers; namespace SPTarkov.Server.Core.Helpers; [Injectable] public class RepeatableQuestHelper( ISptLogger _logger, ConfigServer _configServer ) { protected QuestConfig _questConfig = _configServer.GetConfig(); /// /// Get the relevant elimination config based on the current players PMC level /// /// Level of PMC character /// Main repeatable config /// EliminationConfig public EliminationConfig? GetEliminationConfigByPmcLevel( int pmcLevel, RepeatableQuestConfig repeatableConfig ) { return repeatableConfig.QuestConfig.Elimination.FirstOrDefault(x => pmcLevel >= x.LevelRange.Min && pmcLevel <= x.LevelRange.Max ); } /// /// Returns the repeatable template ids for the provided side /// /// Side to get the templates for /// /// public Dictionary? GetRepeatableQuestTemplatesByGroup(PlayerGroup playerGroup) { var templates = _questConfig.RepeatableQuestTemplates; return playerGroup switch { PlayerGroup.Pmc => templates.Pmc, PlayerGroup.Scav => templates.Scav, _ => throw new ArgumentOutOfRangeException(nameof(playerGroup), playerGroup, null), }; } }