From ab62b070a81bc3bfaa838f0c2f12d3b37924155d Mon Sep 17 00:00:00 2001 From: ozen-m <74519617+ozen-m@users.noreply.github.com> Date: Mon, 20 Oct 2025 11:23:31 +0800 Subject: [PATCH] Fix insurance removes stored item and fix drawn element not being removed (#639) * Exclude items stored inside root item (e.g. armored rigs) when processing regular items * Remove draw element when whitelist is null * Simplify null check --- .../SPTarkov.Server.Core/Controllers/InsuranceController.cs | 2 +- .../Utils/Collections/ProbabilityObjectArray.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs index 62733df3..00ec9e5b 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs @@ -402,7 +402,7 @@ public class InsuranceController( if (parentAttachmentsMap.ContainsKey(insuredItem.Id)) { // This call will also return the parent item itself, queueing it for deletion as well. - var itemAndChildren = insured.Items.GetItemWithChildren(insuredItem.Id); + var itemAndChildren = insured.Items.GetItemWithChildren(insuredItem.Id, true); foreach (var item in itemAndChildren) { toDelete.Add(item.Id); diff --git a/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs b/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs index 3ef05bfe..4e99f7e7 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Collections/ProbabilityObjectArray.cs @@ -226,7 +226,7 @@ public class ProbabilityObjectArray : List> drawnKeys.Add(chosenItem.Key); // Only remove item if it's not in whitelist - if (neverRemoveWhitelist is not null && !neverRemoveWhitelist.Contains(chosenItem.Key)) + if (neverRemoveWhitelist is null || !neverRemoveWhitelist.Contains(chosenItem.Key)) { // Reduce total weight value by items weight + Remove item from pool totalWeight -= chosenItem.Weight;