From c643b124554089537f6f44e879af9857d35ed05d Mon Sep 17 00:00:00 2001 From: Tyfon <29051038+tyfon7@users.noreply.github.com> Date: Mon, 10 Jun 2024 01:04:25 -0700 Subject: [PATCH] Add keybinds for Use/UseAll --- Patches/ContextMenuShortcutPatch.cs | 14 ++++++++++++++ Settings.cs | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Patches/ContextMenuShortcutPatch.cs b/Patches/ContextMenuShortcutPatch.cs index 3183bdd..f160189 100644 --- a/Patches/ContextMenuShortcutPatch.cs +++ b/Patches/ContextMenuShortcutPatch.cs @@ -40,6 +40,20 @@ namespace UIFixes return; } + if (Settings.UseKeyBind.Value.IsDown()) + { + __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.Use); + } + + if (Settings.UseAllKeyBind.Value.IsDown()) + { + var interactions = __instance.GetItemContextInteractions(itemContext, null); + if (!interactions.ExecuteInteraction(EItemInfoButton.UseAll)) + { + interactions.ExecuteInteraction(EItemInfoButton.Use); + } + } + if (Settings.FilterByKeyBind.Value.IsDown()) { __instance.GetItemContextInteractions(itemContext, null).ExecuteInteraction(EItemInfoButton.FilterSearch); diff --git a/Settings.cs b/Settings.cs index cbbaa19..acad49b 100644 --- a/Settings.cs +++ b/Settings.cs @@ -45,6 +45,8 @@ namespace UIFixes public static ConfigEntry InspectKeyBind { get; set; } public static ConfigEntry OpenKeyBind { get; set; } public static ConfigEntry TopUpKeyBind { get; set; } + public static ConfigEntry UseKeyBind { get; set; } + public static ConfigEntry UseAllKeyBind { get; set; } public static ConfigEntry FilterByKeyBind { get; set; } public static ConfigEntry LinkedSearchKeyBind { get; set; } public static ConfigEntry UseRaidMouseScrollMulti { get; set; } // Advanced @@ -194,6 +196,24 @@ namespace UIFixes null, new ConfigurationManagerAttributes { }))); + configEntries.Add(UseKeyBind = config.Bind( + InputSection, + "Use Item Shortcut", + new KeyboardShortcut(KeyCode.None), + new ConfigDescription( + "Keybind to use an item, such a consumable.", + null, + new ConfigurationManagerAttributes { }))); + + configEntries.Add(UseAllKeyBind = config.Bind( + InputSection, + "Use Item (All) Shortcut", + new KeyboardShortcut(KeyCode.None), + new ConfigDescription( + "Keybind to use all of an item, such a consumable. This will still work on items that don't have 'Use All', just 'Use', in their context menu.", + null, + new ConfigurationManagerAttributes { }))); + configEntries.Add(FilterByKeyBind = config.Bind( InputSection, "Filter by Item Shortcut",