From ccb71fd0aa8d1944d22bdeb239ad20c17660c9d4 Mon Sep 17 00:00:00 2001 From: clodan Date: Wed, 17 Jan 2024 00:45:38 +0000 Subject: [PATCH] Added code to check for odd cases in dumps where way more than average would be included for mean and std calculation --- Config/config.json | 3 ++- Model/Config/ProcessorConfig.cs | 4 ++++ Process/Processor/LooseLootProcessor.cs | 10 ++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Config/config.json b/Config/config.json index 98cffff..7a4ce4f 100644 --- a/Config/config.json +++ b/Config/config.json @@ -44,7 +44,8 @@ ] }, "processorConfig": { - "spawnPointToleranceForForced": 99.5 + "spawnPointToleranceForForced": 99.5, + "looseLootCountTolerancePercentage": 75 }, "writerConfig": { "outputLocation": "E:\\spt\\dumps\\output" diff --git a/Model/Config/ProcessorConfig.cs b/Model/Config/ProcessorConfig.cs index 004f475..51d1c31 100644 --- a/Model/Config/ProcessorConfig.cs +++ b/Model/Config/ProcessorConfig.cs @@ -8,4 +8,8 @@ public class ProcessorConfig [JsonProperty("spawnPointToleranceForForced")] [JsonPropertyName("spawnPointToleranceForForced")] public double SpawnPointToleranceForForced { get; set; } = 99D; + + [JsonProperty("looseLootCountTolerancePercentage")] + [JsonPropertyName("looseLootCountTolerancePercentage")] + public double LooseLootCountTolerancePercentage { get; set; } = 75D; } \ No newline at end of file diff --git a/Process/Processor/LooseLootProcessor.cs b/Process/Processor/LooseLootProcessor.cs index 67f25b9..99ccf4a 100644 --- a/Process/Processor/LooseLootProcessor.cs +++ b/Process/Processor/LooseLootProcessor.cs @@ -81,6 +81,16 @@ public class LooseLootProcessor // No longer used, dispose counts = null; + // we want to cleanup the data, so we calculate the mean for the values we get raw + // For whatever reason, we sometimes get dumps that have A LOT more loose loot point than + // the average + var initialMean = np.mean(np.array(looseLootCounts.MapSpawnpointCount)).ToArray().First(); + var looseLootCountTolerancePercentage = LootDumpProcessorContext.GetConfig().ProcessorConfig.LooseLootCountTolerancePercentage / 100; + // We calculate here a high point to check, anything above this value will be ignored + // The data that was inside those loose loot points still counts for them though! + var high = initialMean * (1 + looseLootCountTolerancePercentage); + looseLootCounts.MapSpawnpointCount = looseLootCounts.MapSpawnpointCount.Where(v => v <= high).ToList(); + looseLootDistribution[mapName] = new LooseLootRoot { SpawnPointCount = new SpawnPointCount