Add Shift+Right Click Hand Over to NPCs (quest/dialogue)
Release / build-release (push) Has been cancelled
Release / build-release (push) Has been cancelled
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+19
-2
@@ -33,6 +33,7 @@ internal static unsafe class ContextMenuHandler
|
||||
Sort,
|
||||
Trade,
|
||||
Sell,
|
||||
HandOver,
|
||||
}
|
||||
|
||||
public static bool ContextLabelMatches(AutoContextAction desiredAction, string menuText)
|
||||
@@ -92,6 +93,11 @@ internal static unsafe class ContextMenuHandler
|
||||
t.StartsWith("Sell", StringComparison.OrdinalIgnoreCase) ||
|
||||
(Has(t, "Sell") && Has(t, "Item")),
|
||||
|
||||
AutoContextAction.HandOver =>
|
||||
t.Equals("Hand Over", StringComparison.OrdinalIgnoreCase) ||
|
||||
(Has(t, "Hand") && Has(t, "Over")) ||
|
||||
(Has(t, "Hand Over") && Has(t, "Item")),
|
||||
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
@@ -117,8 +123,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;
|
||||
string? removeTxt = null, addTxt = null, placeTxt = null, returnTxt = null, entrustTxt = null, retrieveTxt = null, companyRemoveTxt = null, splitTxt = null, tradeTxt = null, sellTxt = null;
|
||||
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;
|
||||
|
||||
var max = Math.Min(agent->ContextItemCount, 64);
|
||||
for (var i = 0; i < max; i++)
|
||||
@@ -201,6 +207,12 @@ internal static unsafe class ContextMenuHandler
|
||||
sellIdx = i;
|
||||
sellTxt = text;
|
||||
}
|
||||
|
||||
if (handOverIdx < 0 && ContextLabelMatches(AutoContextAction.HandOver, text))
|
||||
{
|
||||
handOverIdx = i;
|
||||
handOverTxt = text;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundAny)
|
||||
@@ -232,6 +244,11 @@ internal static unsafe class ContextMenuHandler
|
||||
{
|
||||
chosen = companyRemoveIdx >= 0 ? (companyRemoveIdx, companyRemoveTxt) : (-1, (string?)null);
|
||||
}
|
||||
else if (mode == ModifierMode.Shift && handOverIdx >= 0)
|
||||
{
|
||||
// Quest/dialogue: hand over item to NPC
|
||||
chosen = (handOverIdx, handOverTxt);
|
||||
}
|
||||
else if (mode == ModifierMode.Ctrl)
|
||||
{
|
||||
chosen = returnIdx >= 0 ? (returnIdx, returnTxt) :
|
||||
|
||||
Reference in New Issue
Block a user