Add container ignore system

This commit is contained in:
Dev 2023-09-08 15:35:19 +01:00
parent fa68bd7635
commit fbe5af24ee
3 changed files with 16 additions and 2 deletions

View File

@ -48,5 +48,8 @@
}, },
"writerConfig": { "writerConfig": {
"outputLocation": "E:\\spt\\dumps\\output" "outputLocation": "E:\\spt\\dumps\\output"
},
"containerIgnoreList": {
"tarkovstreets": ["container_City_SW_04_DesignStuff_00002"]
} }
} }

View File

@ -49,4 +49,8 @@ public class Config
[JsonProperty("writerConfig")] [JsonProperty("writerConfig")]
[JsonPropertyName("writerConfig")] [JsonPropertyName("writerConfig")]
public WriterConfig WriterConfig { get; set; } public WriterConfig WriterConfig { get; set; }
[JsonProperty("containerIgnoreList")]
[JsonPropertyName("containerIgnoreList")]
public Dictionary<string, string[]> ContainerIgnoreList { get; set; }
} }

View File

@ -87,11 +87,18 @@ public class MultithreadSteppedDumpProcessor : IDumpProcessor
else else
mapDumpCounter.Add(data.Data.Name, 1); mapDumpCounter.Add(data.Data.Name, 1);
} }
LootDumpProcessorContext.GetConfig().ContainerIgnoreList.TryGetValue(data.Data.Id.ToLower(), out string[]? ignoreListForMap);
foreach (var dynamicStaticContainer in StaticLootProcessor.CreateDynamicStaticContainers(data)) foreach (var dynamicStaticContainer in StaticLootProcessor.CreateDynamicStaticContainers(data))
{ {
lock (mapStaticContainersAggregatedLock) lock (mapStaticContainersAggregatedLock)
{ {
// Skip adding containers to aggredated data if container id is in ignore list
if (ignoreListForMap != null && ignoreListForMap.Contains(dynamicStaticContainer.Id))
{
continue;
}
if (mapAggregatedData.ContainsKey(dynamicStaticContainer)) if (mapAggregatedData.ContainsKey(dynamicStaticContainer))
mapAggregatedData[dynamicStaticContainer] += 1; mapAggregatedData[dynamicStaticContainer] += 1;
else else
@ -154,7 +161,7 @@ public class MultithreadSteppedDumpProcessor : IDumpProcessor
} }
private static double GetStaticProbability(string mapName, KeyValuePair<Template, int> td, Dictionary<string, int> mapDumpCounter) private static double GetStaticProbability(string mapName, KeyValuePair<Template, int> td, Dictionary<string, int> mapDumpCounter)
{ {
return Math.Round((double)((decimal)td.Value / (decimal)mapDumpCounter[mapName]), 2); return Math.Round((double)((decimal)td.Value / (decimal)mapDumpCounter[mapName]), 2);
} }