From 6a4efe9e53a3d61df2bb149250cb7e96f1f72500 Mon Sep 17 00:00:00 2001 From: Archangel Date: Wed, 17 Sep 2025 20:46:43 +0200 Subject: [PATCH 1/3] Set correct type on global LocationInfection --- Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs | 2 +- .../SPTarkov.Server.Core/Services/SeasonalEventService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs index 4ca9e157..883b9551 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs @@ -12,7 +12,7 @@ public record Globals public required Config Configuration { get; init; } [JsonPropertyName("LocationInfection")] - public required LocationInfection LocationInfection { get; init; } + public required Dictionary LocationInfection { get; init; } [JsonPropertyName("bot_presets")] public required IEnumerable BotPresets { get; init; } diff --git a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs index acba63b6..3236c6c7 100644 --- a/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/SeasonalEventService.cs @@ -738,7 +738,7 @@ public class SeasonalEventService( infectionHalloween.DisplayUIEnabled = true; infectionHalloween.Enabled = true; - var globalInfectionDict = globals.LocationInfection.GetAllPropertiesAsDictionary(); + var globalInfectionDict = globals.LocationInfection; foreach (var (locationId, infectionPercentage) in zombieSettings.MapInfectionAmount) { // calculate a random value unless the rate is 100 @@ -758,7 +758,7 @@ public class SeasonalEventService( } // Globals data needs value updated too - globalInfectionDict[locationId] = randomInfectionPercentage; + globalInfectionDict[locationId] = Convert.ToInt32(randomInfectionPercentage); } foreach (var locationId in zombieSettings.DisableBosses) From 1cc1d2e95d164cb912a2336be8fd44959622be62 Mon Sep 17 00:00:00 2001 From: Archangel Date: Wed, 17 Sep 2025 20:49:10 +0200 Subject: [PATCH 2/3] Remove unused record --- .../Models/Eft/Common/Globals.cs | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs index 883b9551..704fbb77 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Eft/Common/Globals.cs @@ -85,39 +85,6 @@ public record RadioStation public RadioStationType Station { get; set; } } -public record LocationInfection -{ - [JsonPropertyName("Interchange")] - public double Interchange { get; set; } - - [JsonPropertyName("Lighthouse")] - public double Lighthouse { get; set; } - - [JsonPropertyName("RezervBase")] - public double RezervBase { get; set; } - - [JsonPropertyName("Sandbox")] - public double Sandbox { get; set; } - - [JsonPropertyName("Shoreline")] - public double Shoreline { get; set; } - - [JsonPropertyName("TarkovStreets")] - public double TarkovStreets { get; set; } - - [JsonPropertyName("Woods")] - public double Woods { get; set; } - - [JsonPropertyName("bigmap")] - public double BigMap { get; set; } - - [JsonPropertyName("factory4")] - public double Factory4 { get; set; } - - [JsonPropertyName("laboratory")] - public double Laboratory { get; set; } -} - public record ArtilleryShelling { [JsonPropertyName("ArtilleryMapsConfigs")] From 26d816ee56531b30768f2235f98e6c3aa76696d3 Mon Sep 17 00:00:00 2001 From: qe201020335 Date: Thu, 18 Sep 2025 00:53:26 -0400 Subject: [PATCH 3/3] Add `MeansImplicitUse` attribute to patch and injectable attributes --- Libraries/SPTarkov.DI/Annotations/Injectable.cs | 5 ++++- Libraries/SPTarkov.DI/SPTarkov.DI.csproj | 1 + Libraries/SPTarkov.Reflection/Patching/Attributes.cs | 9 ++++++++- Libraries/SPTarkov.Reflection/SPTarkov.Reflection.csproj | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.DI/Annotations/Injectable.cs b/Libraries/SPTarkov.DI/Annotations/Injectable.cs index 1017dc43..3b4c7fb9 100644 --- a/Libraries/SPTarkov.DI/Annotations/Injectable.cs +++ b/Libraries/SPTarkov.DI/Annotations/Injectable.cs @@ -1,6 +1,9 @@ -namespace SPTarkov.DI.Annotations; +using JetBrains.Annotations; + +namespace SPTarkov.DI.Annotations; [AttributeUsage(AttributeTargets.Class, Inherited = false)] +[MeansImplicitUse] public class Injectable(InjectionType injectionType = InjectionType.Scoped, Type? typeOverride = null, int typePriority = int.MaxValue) : Attribute { diff --git a/Libraries/SPTarkov.DI/SPTarkov.DI.csproj b/Libraries/SPTarkov.DI/SPTarkov.DI.csproj index 862630b6..bc264fd0 100644 --- a/Libraries/SPTarkov.DI/SPTarkov.DI.csproj +++ b/Libraries/SPTarkov.DI/SPTarkov.DI.csproj @@ -15,6 +15,7 @@ true + diff --git a/Libraries/SPTarkov.Reflection/Patching/Attributes.cs b/Libraries/SPTarkov.Reflection/Patching/Attributes.cs index c38dac99..cef98bb1 100644 --- a/Libraries/SPTarkov.Reflection/Patching/Attributes.cs +++ b/Libraries/SPTarkov.Reflection/Patching/Attributes.cs @@ -1,18 +1,25 @@ -namespace SPTarkov.Reflection.Patching; +using JetBrains.Annotations; + +namespace SPTarkov.Reflection.Patching; [AttributeUsage(AttributeTargets.Method)] +[MeansImplicitUse] public class PatchPrefixAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] +[MeansImplicitUse] public class PatchPostfixAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] +[MeansImplicitUse] public class PatchTranspilerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] +[MeansImplicitUse] public class PatchFinalizerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Method)] +[MeansImplicitUse] public class PatchIlManipulatorAttribute : Attribute { } /// diff --git a/Libraries/SPTarkov.Reflection/SPTarkov.Reflection.csproj b/Libraries/SPTarkov.Reflection/SPTarkov.Reflection.csproj index 9615c7e4..d9f08b18 100644 --- a/Libraries/SPTarkov.Reflection/SPTarkov.Reflection.csproj +++ b/Libraries/SPTarkov.Reflection/SPTarkov.Reflection.csproj @@ -18,6 +18,7 @@ +