From 3e54ef0a8c0a2fb4617a7090019e47e444d74f14 Mon Sep 17 00:00:00 2001 From: CWX Date: Sun, 19 Jan 2025 19:32:12 +0000 Subject: [PATCH] sort issue with JS --- Libraries/Core/Generators/BotLootGenerator.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Libraries/Core/Generators/BotLootGenerator.cs b/Libraries/Core/Generators/BotLootGenerator.cs index 9c5c05e5..baccc5a9 100644 --- a/Libraries/Core/Generators/BotLootGenerator.cs +++ b/Libraries/Core/Generators/BotLootGenerator.cs @@ -750,8 +750,15 @@ public class BotLootGenerator( return false; } - // Increment item count with this bot type - itemSpawnLimits.CurrentLimits[idToCheckFor]++; + + // Use tryAdd to see if it exists, and automatically add 1 + if (!itemSpawnLimits.CurrentLimits.TryAdd(idToCheckFor, 1)) + { + // if it does exist, come in here and increment + // Increment item count with this bot type + itemSpawnLimits.CurrentLimits[idToCheckFor]++; + } + // Check if over limit if (itemSpawnLimits.CurrentLimits[idToCheckFor] > itemSpawnLimits.GlobalLimits[idToCheckFor])