ContextMenu in trading screen; possible multi-select click not working in raid fix

This commit is contained in:
Tyfon
2024-08-17 00:56:27 -07:00
parent 344fd9334a
commit 28238b8e4d
2 changed files with 24 additions and 4 deletions

View File

@@ -20,7 +20,8 @@ public static class AddOfferContextMenuPatches
public static void Enable()
{
new AddOfferMenuPatch().Enable();
new AddOfferInventoryMenuPatch().Enable();
new AddOfferTradingMenuPatch().Enable();
new AddOfferIsActivePatch().Enable();
new AddOfferIsInteractivePatch().Enable();
new AddOfferNameIconPatch().Enable();
@@ -30,7 +31,7 @@ public static class AddOfferContextMenuPatches
new SelectItemPatch().Enable();
}
public class AddOfferMenuPatch : ModulePatch
public class AddOfferInventoryMenuPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
@@ -49,6 +50,25 @@ public static class AddOfferContextMenuPatches
}
}
public class AddOfferTradingMenuPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.DeclaredProperty(R.TradingInteractions.Type, "AvailableInteractions").GetMethod;
}
[PatchPostfix]
public static void Postfix(ref IEnumerable<EItemInfoButton> __result)
{
if (Settings.AddOfferContextMenu.Value)
{
var list = __result.ToList();
list.Insert(list.IndexOf(EItemInfoButton.Tag), AddOfferInfoButton);
__result = list;
}
}
}
public class AddOfferNameIconPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
@@ -131,7 +151,7 @@ public static class AddOfferContextMenuPatches
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(R.InventoryInteractions.Type, "ExecuteInteractionInternal");
return AccessTools.Method(typeof(BaseItemInfoInteractions), nameof(BaseItemInfoInteractions.ExecuteInteractionInternal));
}
[PatchPrefix]

View File

@@ -167,7 +167,7 @@ public static class MultiSelectPatches
___ItemController is InventoryControllerClass inventoryController)
{
SortingTableClass sortingTable = inventoryController.Inventory.SortingTable;
if (sortingTable != null && sortingTable.IsVisible)
if (sortingTable != null && sortingTable.IsVisible && !Plugin.InRaid())
{
couldBeSortingTableMove = true;
}