diff --git a/Patches/OpenSortingTablePatch.cs b/Patches/OpenSortingTablePatch.cs new file mode 100644 index 0000000..3434187 --- /dev/null +++ b/Patches/OpenSortingTablePatch.cs @@ -0,0 +1,35 @@ +using Aki.Reflection.Patching; +using Comfort.Common; +using EFT.UI; +using HarmonyLib; +using System.Linq; +using System.Reflection; + +namespace UIFixes +{ + public class OpenSortingTablePatch : ModulePatch + { + private static readonly EItemUiContextType[] AllowedScreens = [EItemUiContextType.InventoryScreen, EItemUiContextType.ScavengerInventoryScreen]; + + + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(ItemUiContext), nameof(ItemUiContext.QuickMoveToSortingTable)); + } + + [PatchPrefix] + public static void Prefix(ItemUiContext __instance) + { + if (!AllowedScreens.Contains(__instance.ContextType) || Plugin.InRaid()) + { + return; + } + + SortingTableClass sortingTable = __instance.R().InventoryController.Inventory.SortingTable; + if (sortingTable != null && !sortingTable.IsVisible) + { + Singleton.Instance.InventoryScreen.method_6(); + } + } + } +} diff --git a/Plugin.cs b/Plugin.cs index bd3bfc0..01f7bb9 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -47,6 +47,7 @@ namespace UIFixes new LoadMagPresetsPatch().Enable(); KeepWindowsOnScreenPatches.Enable(); new ContextMenuShortcutPatch().Enable(); + new OpenSortingTablePatch().Enable(); } public static bool InRaid()