From 611b234142c0dc68aaaa736e03b1b92470a62653 Mon Sep 17 00:00:00 2001 From: Chomp Date: Mon, 30 Jun 2025 09:50:11 +0100 Subject: [PATCH] Added ability to change weekly boss reset day via config --- .../Models/Spt/Config/BotConfig.cs | 13 +++++++++++++ .../Services/PostDbLoadService.cs | 10 +++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs index 7ca520b5..fbf00508 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs @@ -149,11 +149,24 @@ public record BotConfig : BaseConfig public record WeeklyBossSettings { + /// + /// Should a weekly boss be picked to 100% spawn + /// [JsonPropertyName("enabled")] public bool Enabled { get; set; } + /// + /// Bosses that can be picked + /// [JsonPropertyName("bossPool")] public List BossPool { get; set; } + + /// + /// Day of week boss choice resets + /// + [JsonPropertyName("resetDay")] + [JsonConverter(typeof(JsonStringEnumConverter))] + public DayOfWeek ResetDay { get; set; } } /// diff --git a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs index 52fcff9f..cdf359a6 100644 --- a/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/PostDbLoadService.cs @@ -130,7 +130,10 @@ public class PostDbLoadService( if (_botConfig.WeeklyBoss.Enabled) { - var chosenBoss = GetWeeklyBoss(_botConfig.WeeklyBoss.BossPool); + var chosenBoss = GetWeeklyBoss( + _botConfig.WeeklyBoss.BossPool, + _botConfig.WeeklyBoss.ResetDay + ); FlagMapAsGuaranteedBoss(chosenBoss); } } @@ -139,11 +142,12 @@ public class PostDbLoadService( /// Choose a boss that will spawn at 100% on a map from a predefined collection of bosses /// /// Pool of bosses to pick from + /// Day of week choice of boss changes /// Boss to spawn for this week - protected WildSpawnType GetWeeklyBoss(List bosses) + protected WildSpawnType GetWeeklyBoss(List bosses, DayOfWeek bossResetDay) { // Get closest monday to today - var startOfWeek = DateTime.Today.GetStartOfWeek(); + var startOfWeek = DateTime.Today.GetStartOfWeek(bossResetDay); // Create a consistent seed for the week using the year and the day of the year of above monday chosen // This results in seed being identical for the week