From 8d173b9f115e49ea738c74121e9288216c0498f6 Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Sun, 14 Jul 2024 21:42:22 -0700 Subject: [PATCH] make stack sort optional --- Patches/SortPatches.cs | 5 +++++ Settings.cs | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/Patches/SortPatches.cs b/Patches/SortPatches.cs index 26bd5a2..abe169b 100644 --- a/Patches/SortPatches.cs +++ b/Patches/SortPatches.cs @@ -74,6 +74,11 @@ public static class SortPatches [PatchPrefix] public static bool Prefix(GridSortPanel __instance, LootItemClass ___lootItemClass, InventoryControllerClass ___inventoryControllerClass) { + if (!Settings.StackBeforeSort.Value) + { + return true; + } + Sort(__instance, ___lootItemClass, ___inventoryControllerClass).HandleExceptions(); return false; } diff --git a/Settings.cs b/Settings.cs index 3da3995..0e99afa 100644 --- a/Settings.cs +++ b/Settings.cs @@ -85,6 +85,7 @@ internal class Settings public static ConfigEntry ReorderGrids { get; set; } public static ConfigEntry SynchronizeStashScrolling { get; set; } public static ConfigEntry GreedyStackMove { get; set; } + public static ConfigEntry StackBeforeSort { get; set; } public static ConfigEntry MergeFIRMoney { get; set; } public static ConfigEntry MergeFIRAmmo { get; set; } public static ConfigEntry MergeFIROther { get; set; } @@ -433,6 +434,15 @@ internal class Settings null, new ConfigurationManagerAttributes { }))); + configEntries.Add(StackBeforeSort = config.Bind( + InventorySection, + "Combine Stacks Before Sorting", + true, + new ConfigDescription( + "When sorting containers, first combine stacks of the same type. This will not be undone if the sorting fails.", + null, + new ConfigurationManagerAttributes { }))); + configEntries.Add(MergeFIRMoney = config.Bind( InventorySection, "Autostack Money with FiR Money",