Updated core difficulty code to use JsonElement

This commit is contained in:
Chomp
2025-08-23 10:30:26 +01:00
parent 3312a5f28c
commit c40439d04f
2 changed files with 4 additions and 6 deletions
@@ -1,3 +1,4 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
@@ -12,5 +13,5 @@ public record Bots
public required BotBase Base { get; init; }
[JsonPropertyName("core")]
public required Dictionary<string, object> Core { get; init; }
public required Dictionary<string, JsonElement> Core { get; init; }
}
@@ -731,10 +731,7 @@ public class SeasonalEventService(
{
// Flag zombies as being enabled
var botData = databaseService.GetBots();
if (!botData.Core.TryAdd("ACTIVE_HALLOWEEN_ZOMBIES_EVENT", true))
{
botData.Core["ACTIVE_HALLOWEEN_ZOMBIES_EVENT"] = true;
}
botData.Core["ACTIVE_HALLOWEEN_ZOMBIES_EVENT"] = JsonDocument.Parse("true").RootElement.Clone();
var globals = databaseService.GetGlobals();
var infectionHalloween = globals.Configuration.SeasonActivity.InfectionHalloween;
@@ -750,7 +747,7 @@ public class SeasonalEventService(
? infectionPercentage
: Convert.ToDouble(randomUtil.GetInt(Convert.ToInt32(infectionPercentage), 100));
if (logger.IsLogEnabled(LogLevel.Debug))
logger.Debug($"Percent infected from map {locationId} is {randomInfectionPercentage}");
logger.Debug($"Percent infected from map: {locationId} is: {randomInfectionPercentage}");
// Infection rates sometimes apply to multiple maps, e.g. Factory day/night or Sandbox/sandbox_high
// Get the list of maps that should have infection value applied to their base
// 90% of locations are just 1 map e.g. bigmap = customs