diff --git a/ContextMenuHandler.cs b/ContextMenuHandler.cs index 512a9ac..8becbbb 100644 --- a/ContextMenuHandler.cs +++ b/ContextMenuHandler.cs @@ -34,6 +34,7 @@ internal static unsafe class ContextMenuHandler Trade, Sell, HandOver, + Use, } public static bool ContextLabelMatches(AutoContextAction desiredAction, string menuText) @@ -98,6 +99,10 @@ internal static unsafe class ContextMenuHandler (Has(t, "Hand") && Has(t, "Over")) || (Has(t, "Hand Over") && Has(t, "Item")), + AutoContextAction.Use => + t.Equals("Use", StringComparison.OrdinalIgnoreCase) || + t.StartsWith("Use", StringComparison.OrdinalIgnoreCase), + _ => false, }; } @@ -123,8 +128,8 @@ internal static unsafe class ContextMenuHandler // Single-pass: decode each label once, record first match per action. var foundAny = false; - int removeIdx = -1, addIdx = -1, placeIdx = -1, returnIdx = -1, entrustIdx = -1, retrieveIdx = -1, companyRemoveIdx = -1, splitIdx = -1, tradeIdx = -1, sellIdx = -1, handOverIdx = -1; - string? removeTxt = null, addTxt = null, placeTxt = null, returnTxt = null, entrustTxt = null, retrieveTxt = null, companyRemoveTxt = null, splitTxt = null, tradeTxt = null, sellTxt = null, handOverTxt = null; + int removeIdx = -1, addIdx = -1, placeIdx = -1, returnIdx = -1, entrustIdx = -1, retrieveIdx = -1, companyRemoveIdx = -1, splitIdx = -1, tradeIdx = -1, sellIdx = -1, handOverIdx = -1, useIdx = -1; + string? removeTxt = null, addTxt = null, placeTxt = null, returnTxt = null, entrustTxt = null, retrieveTxt = null, companyRemoveTxt = null, splitTxt = null, tradeTxt = null, sellTxt = null, handOverTxt = null, useTxt = null; var max = Math.Min(agent->ContextItemCount, 64); for (var i = 0; i < max; i++) @@ -213,6 +218,12 @@ internal static unsafe class ContextMenuHandler handOverIdx = i; handOverTxt = text; } + + if (useIdx < 0 && ContextLabelMatches(AutoContextAction.Use, text)) + { + useIdx = i; + useTxt = text; + } } if (!foundAny) @@ -249,6 +260,13 @@ internal static unsafe class ContextMenuHandler // Quest/dialogue: hand over item to NPC chosen = (handOverIdx, handOverTxt); } + else if (mode == ModifierMode.Shift && + !saddlebagOpen && !retainerOpen && !companyChestOpen && !tradeOpen && !vendorOpen && + useIdx >= 0 && configuration.EnableQuickUse) + { + // No other inventories open: quick Use for usable items (potions, food, etc.) + chosen = (useIdx, useTxt); + } else if (mode == ModifierMode.Ctrl) { chosen = returnIdx >= 0 ? (returnIdx, returnTxt) : diff --git a/QuickTransfer.cs b/QuickTransfer.cs index 231fa35..e714780 100644 --- a/QuickTransfer.cs +++ b/QuickTransfer.cs @@ -29,7 +29,7 @@ namespace QuickTransfer; [Serializable] public sealed class Configuration : IPluginConfiguration { - public int Version { get; set; } = 3; + public int Version { get; set; } = 4; public bool Enabled { get; set; } = true; // Default OFF (explicitly requested). @@ -46,6 +46,8 @@ public sealed class Configuration : IPluginConfiguration public bool EnableVendorQuickSell { get; set; } = true; public bool AutoConfirmVendorSell { get; set; } = true; + public bool EnableQuickUse { get; set; } = true; + public void Save() => Plugin.PluginInterface.SavePluginConfig(this); } @@ -1392,16 +1394,15 @@ public sealed unsafe class Plugin : IDalamudPlugin Configuration.Version = 3; Configuration.Save(); } - else if (Configuration.Version > 3) + else if (Configuration.Version < 4) + { + Configuration.Version = 4; + Configuration.Save(); + } + else if (Configuration.Version > 4) { // If the user downgrades, don't overwrite their config; just keep their stored values. } - else - { - // Version == 3: still ensure debug isn't accidentally on by default after updates. - // (User can re-enable it explicitly.) - // No auto-save here to avoid writing config every startup. - } } catch { diff --git a/QuickTransfer.json b/QuickTransfer.json index 34f9bec..a17895e 100644 --- a/QuickTransfer.json +++ b/QuickTransfer.json @@ -3,7 +3,7 @@ "Name": "QuickTransfer", "InternalName": "QuickTransfer", "AssemblyVersion": "1.0.6.0", - "Description": "Automate inventory transfers with Shift/Ctrl/Alt + Right-Click. Trade window, vendor quick sell, FC chest, Hand Over to NPCs.", + "Description": "Automate inventory transfers with Shift/Ctrl/Alt + Right-Click. Quick Use on usable items, trade window, vendor quick sell, FC chest, Hand Over to NPCs.", "ApplicableVersion": "any", "RepoUrl": "https://github.com/Knack117/QuickTransfer", "Tags": [ diff --git a/QuickTransferWindow.cs b/QuickTransferWindow.cs index 3bc5bb4..dd05dde 100644 --- a/QuickTransferWindow.cs +++ b/QuickTransferWindow.cs @@ -109,6 +109,16 @@ public class QuickTransferWindow : Window, IDisposable } ImGui.SameLine(); ImGui.TextColored(new Vector4(0.7f, 0.7f, 0.7f, 0.7f), "(Auto-fill quantity, confirm \"How many?\", and click OK on \"Are you certain?\")"); + + // Quick Use + var enableQuickUse = _config.EnableQuickUse; + if (ImGui.Checkbox("Enable Quick Use###EnableQuickUse", ref enableQuickUse)) + { + _config.EnableQuickUse = enableQuickUse; + _config.Save(); + } + ImGui.SameLine(); + ImGui.TextColored(new Vector4(0.7f, 0.7f, 0.7f, 0.7f), "(Shift+RClick: auto-select \"Use\" on usable items when no other inventories are open)"); // Transfer cooldown ImGui.Spacing(); @@ -139,6 +149,7 @@ public class QuickTransferWindow : Window, IDisposable ImGui.BulletText("Company Chest (FreeCompanyChest) open: Shift+RClick Inventory/Armoury deposits, Shift+RClick Company Chest withdraws (\"Remove\")"); ImGui.BulletText("Vendor Shop open: Shift+RClick to auto-select \"Sell\"; enable \"Auto-confirm vendor sell\" to auto-fill quantity and confirm."); ImGui.BulletText("Quest/dialogue: Shift+RClick on an item to auto-select \"Hand Over\" when handing items to an NPC."); + ImGui.BulletText("Inventory only (no other panels open): Shift+RClick on a usable item (potions, food, etc.) to auto-select \"Use\"."); ImGui.BulletText("Middle-Click: Sort the clicked container when a \"Sort\" menu entry exists. In Company Chest, MMB runs an organize pass (stack + compact)."); ImGui.BulletText("Use /qt or click 'Open Config' in plugin list to reopen this window"); diff --git a/README.md b/README.md index c79a731..6561c52 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,14 @@ A Dalamud plugin for Final Fantasy XIV that adds quick inventory actions via the game's existing context menus: -- **Shift + Right Click**: quick transfers (including vendor sell when shop is open, and Hand Over to NPCs in quest/dialogue) +- **Shift + Right Click**: quick transfers (including Quick Use on usable items when no other inventories are open, vendor sell when shop is open, and Hand Over to NPCs in quest/dialogue) - **Ctrl + Right Click**: armoury-mode transfers (when a special container is open) - **Alt + Right Click**: split a stack in half ## Features - **Quick Transfer**: Hold Shift and right-click an item to automatically trigger the matching context menu action +- **Quick Use**: When no other inventories (saddlebag, retainer, company chest, trade, vendor) are open, Shift + Right Click on a usable item (potions, food, etc.) auto-selects **Use** - **Vendor Quick Sell**: With a vendor shop open, Shift + Right Click auto-selects **Sell**. With **Auto-confirm vendor sell** enabled, quantity dialogs and "Are you certain?" confirmations are auto-filled and confirmed - **Trade Window Support**: Shift + Right Click items from inventory into Trade window with auto-fill max quantity - **Company Chest**: Shift + Right Click to deposit/withdraw when Free Company Chest is open; middle-click runs organize (stack + compact) @@ -68,6 +69,8 @@ The plugin only clicks **existing** context menu options when they are available - Shift + Right Click Inventory/Armoury → deposit; Shift + Right Click Company Chest → **Remove** (withdraw) - **Hand Over to NPCs (quest/dialogue)** - When an NPC is asking for items (e.g. quest turn-in), Shift + Right Click the item → **Hand Over** +- **Inventory only (no other panels open)** + - Shift + Right Click on a usable item (potions, food, etc.) → **Use** If an option is not present for the clicked item, **nothing happens**. @@ -99,6 +102,7 @@ If an option is not present for the clicked item, **nothing happens**. | Company Chest: Middle-Click Organize | Enable MMB organize (stack+compact) in FC chest | True | | Auto-confirm quantity prompts | Auto-fill and confirm InputNumeric prompts (Split / FC chest) | True | | Enable Vendor Quick Sell | Shift+RClick auto-selects "Sell" when vendor is open | True | +| Enable Quick Use | Shift+RClick auto-selects "Use" on usable items when no other inventories are open | True | | Auto-confirm vendor sell | Auto-fill quantity and click OK on sell dialogs ("How many?", "Are you certain?") | True | ## Development diff --git a/pluginmaster.json b/pluginmaster.json index 1139b61..833667c 100644 --- a/pluginmaster.json +++ b/pluginmaster.json @@ -1,21 +1 @@ -[ - { - "Author": "Knack117", - "Name": "QuickTransfer", - "InternalName": "QuickTransfer", - "AssemblyVersion": "1.0.6.0", - "Description": "Automate inventory transfers with Shift/Ctrl/Alt + Right-Click. Trade window, vendor quick sell, FC chest, Hand Over to NPCs.", - "ApplicableVersion": "any", - "RepoUrl": "https://github.com/Knack117/QuickTransfer", - "DalamudApiLevel": 14, - "Punchline": "Quick item transfer + split helpers.", - "Tags": [ - "inventory", - "utility", - "quality of life" - ], - "AcceptsFeedback": true, - "DownloadLinkInstall": "https://github.com/Knack117/QuickTransfer/releases/latest/download/QuickTransfer.zip", - "DownloadLinkUpdate": "https://github.com/Knack117/QuickTransfer/releases/latest/download/QuickTransfer.zip" - } -] +[{"Author":"Knack117","Name":"QuickTransfer","Punchline":"Quick item transfer + split helpers.","Description":"Automate inventory transfers with Shift/Ctrl/Alt + Right-Click. Quick Use on usable items, trade window, vendor quick sell, FC chest, Hand Over to NPCs.","InternalName":"QuickTransfer","AssemblyVersion":"1.0.6.0","RepoUrl":"http://brassnet.ddns.net:33983/KnackAtNite/QuickTransfer","ApplicableVersion":"any","DalamudApiLevel":14,"Tags":["inventory","utility","quality of life"],"AcceptsFeedback":true,"DownloadLinkInstall":"http://brassnet.ddns.net:33983/KnackAtNite/QuickTransfer/releases/download/v1.0.6/QuickTransfer.zip","DownloadLinkUpdate":"http://brassnet.ddns.net:33983/KnackAtNite/QuickTransfer/releases/download/v1.0.6/QuickTransfer.zip","LastUpdate":"1739020800"}]