Add Quick Use: Shift+RClick usable items when no other inventories open
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+20
-2
@@ -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) :
|
||||
|
||||
Reference in New Issue
Block a user