From 594a489eac528244ff74bb656f52e12b4d22b938 Mon Sep 17 00:00:00 2001 From: DrakiaXYZ Date: Tue, 5 Nov 2024 09:10:40 +0000 Subject: [PATCH] Resolve missing static forced containers/weapons when using loot dumps from multiple versions (#7) Instead of only using the static forced containers from the first dump, merge all static forced containers so we can utilize dumps from multiple versions Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT/LootDumpProcessor/pulls/7 Co-authored-by: DrakiaXYZ Co-committed-by: DrakiaXYZ --- .../MultithreadSteppedDumpProcessor.cs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Process/Processor/DumpProcessor/MultithreadSteppedDumpProcessor.cs b/Process/Processor/DumpProcessor/MultithreadSteppedDumpProcessor.cs index f83d9c1..4b1c41b 100644 --- a/Process/Processor/DumpProcessor/MultithreadSteppedDumpProcessor.cs +++ b/Process/Processor/DumpProcessor/MultithreadSteppedDumpProcessor.cs @@ -66,18 +66,31 @@ public class MultithreadSteppedDumpProcessor : IDumpProcessor var mapId = dataDump.Data.LocationLoot.Id.ToLower(); - // the if statement below takes care of processing "forced" or real static data for each map, only need - // to do this once per map, we dont care about doing it again + // Because we may use multiple version dumps for map data, merge the static loot between dumps lock (staticContainersLock) { - if (!staticContainers.ContainsKey(mapId)) + if (!staticContainers.TryGetValue(mapId, out var mapStaticLoot)) { if (LoggerFactory.GetInstance().CanBeLogged(LogLevel.Info)) LoggerFactory.GetInstance().Log($"Doing first time process for map {mapId} of real static data", LogLevel.Info); - var mapStaticContainers = StaticLootProcessor.CreateStaticWeaponsAndStaticForcedContainers(dataDump); + + staticContainers[mapId] = new MapStaticLoot + { + StaticWeapons = new List