From 4ea63711a96f99eb7f4b39a1debf9efd9339ae5f Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 4 May 2025 14:02:09 +0100 Subject: [PATCH] Fixed `IsNightTime` not handling factory night/day raids --- .../Generators/BotInventoryGenerator.cs | 4 ++-- .../SPTarkov.Server.Core/Helpers/WeatherHelper.cs | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs index ac2db192..d5d9f2c7 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/BotInventoryGenerator.cs @@ -190,11 +190,11 @@ public class BotInventoryGenerator( if ( randomistionDetails?.NighttimeChanges is not null && raidConfig is not null && - _weatherHelper.IsNightTime(raidConfig.TimeVariant) + _weatherHelper.IsNightTime(raidConfig.TimeVariant, raidConfig.Location) ) { foreach (var equipmentSlotKvP in randomistionDetails.NighttimeChanges.EquipmentModsModifiers) - // Never let mod chance go outside of 0 - 100 + // Never let mod chance go outside 0 - 100 { randomistionDetails.EquipmentMods[equipmentSlotKvP.Key] = Math.Min( Math.Max(randomistionDetails.EquipmentMods[equipmentSlotKvP.Key] + equipmentSlotKvP.Value, 0), diff --git a/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs index 61670378..222570f6 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/WeatherHelper.cs @@ -41,9 +41,19 @@ public class WeatherHelper( /// Is the current raid at nighttime /// /// PASS OR CURR (from raid settings) + /// map name. E.g. factory4_day /// True when nighttime - public bool IsNightTime(DateTimeEnum timeVariant) + public bool IsNightTime(DateTimeEnum timeVariant, string mapLocation) { + switch (mapLocation) + { + // Factory differs from other maps, has static times + case "factory4_night": + return true; + case "factory4_day": + return false; + } + var time = GetInRaidTime(); // getInRaidTime() provides left side value, if player chose right side, set ahead 12 hrs