diff --git a/Patches/ConfirmationDialogKeysPatches.cs b/Patches/ConfirmationDialogKeysPatches.cs index e320391..023864f 100644 --- a/Patches/ConfirmationDialogKeysPatches.cs +++ b/Patches/ConfirmationDialogKeysPatches.cs @@ -1,4 +1,5 @@ using EFT.UI; +using EFT.UI.Ragfair; using HarmonyLib; using SPT.Reflection.Patching; using System.Reflection; @@ -14,6 +15,7 @@ namespace UIFixes new DialogWindowPatch().Enable(); new ItemUiContextWindowPatch().Enable(); new ErrorScreenPatch().Enable(); + new AddOfferPatch().Enable(); new ClickOutPatch().Enable(); new ClickOutSplitDialogPatch().Enable(); @@ -90,6 +92,28 @@ namespace UIFixes } } + public class AddOfferPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(AddOfferWindow), nameof(AddOfferWindow.Update)); + } + + [PatchPostfix] + public static void Postfix(AddOfferWindow __instance, InteractableElement ____addOfferButton) + { + if (!____addOfferButton.isActiveAndEnabled || !____addOfferButton.Interactable) + { + return; + } + + if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Space)) + { + __instance.method_1(); + } + } + } + public class ClickOutPatch : ModulePatch { protected override MethodBase GetTargetMethod() diff --git a/Patches/SwapPatches.cs b/Patches/SwapPatches.cs index 84ad910..0a3bd51 100644 --- a/Patches/SwapPatches.cs +++ b/Patches/SwapPatches.cs @@ -49,6 +49,7 @@ namespace UIFixes new RememberSwapGridHoverPatch().Enable(); new InspectWindowUpdateStatsOnSwapPatch().Enable(); new FixAddModFirearmOperationPatch().Enable(); + new HideScaryTooltipPatch().Enable(); } private static bool ValidPrerequisites(ItemContextClass itemContext, ItemContextAbstractClass targetItemContext, IInventoryEventResult operation) @@ -521,6 +522,26 @@ namespace UIFixes } } + public class HideScaryTooltipPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(SimpleTooltip), nameof(SimpleTooltip.ShowInventoryError)); + } + + [PatchPrefix] + public static bool Prefix(SimpleTooltip __instance, InventoryError error) + { + if (error is StashGridClass.GClass3310 || error is StashGridClass.GClass3311) + { + __instance.Close(); + return false; + } + + return true; + } + } + public class FixAddModFirearmOperationPatch : ModulePatch { protected override MethodBase GetTargetMethod()