Add offer with space/enter; hide scary slot swap error tooltip
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using EFT.UI;
|
using EFT.UI;
|
||||||
|
using EFT.UI.Ragfair;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using SPT.Reflection.Patching;
|
using SPT.Reflection.Patching;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -14,6 +15,7 @@ namespace UIFixes
|
|||||||
new DialogWindowPatch().Enable();
|
new DialogWindowPatch().Enable();
|
||||||
new ItemUiContextWindowPatch().Enable();
|
new ItemUiContextWindowPatch().Enable();
|
||||||
new ErrorScreenPatch().Enable();
|
new ErrorScreenPatch().Enable();
|
||||||
|
new AddOfferPatch().Enable();
|
||||||
|
|
||||||
new ClickOutPatch().Enable();
|
new ClickOutPatch().Enable();
|
||||||
new ClickOutSplitDialogPatch().Enable();
|
new ClickOutSplitDialogPatch().Enable();
|
||||||
@@ -90,6 +92,28 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AddOfferPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(AddOfferWindow), nameof(AddOfferWindow.Update));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPostfix]
|
||||||
|
public static void Postfix(AddOfferWindow __instance, InteractableElement ____addOfferButton)
|
||||||
|
{
|
||||||
|
if (!____addOfferButton.isActiveAndEnabled || !____addOfferButton.Interactable)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter) || Input.GetKeyDown(KeyCode.Space))
|
||||||
|
{
|
||||||
|
__instance.method_1();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class ClickOutPatch : ModulePatch
|
public class ClickOutPatch : ModulePatch
|
||||||
{
|
{
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
|
@@ -49,6 +49,7 @@ namespace UIFixes
|
|||||||
new RememberSwapGridHoverPatch().Enable();
|
new RememberSwapGridHoverPatch().Enable();
|
||||||
new InspectWindowUpdateStatsOnSwapPatch().Enable();
|
new InspectWindowUpdateStatsOnSwapPatch().Enable();
|
||||||
new FixAddModFirearmOperationPatch().Enable();
|
new FixAddModFirearmOperationPatch().Enable();
|
||||||
|
new HideScaryTooltipPatch().Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidPrerequisites(ItemContextClass itemContext, ItemContextAbstractClass targetItemContext, IInventoryEventResult operation)
|
private static bool ValidPrerequisites(ItemContextClass itemContext, ItemContextAbstractClass targetItemContext, IInventoryEventResult operation)
|
||||||
@@ -521,6 +522,26 @@ namespace UIFixes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class HideScaryTooltipPatch : ModulePatch
|
||||||
|
{
|
||||||
|
protected override MethodBase GetTargetMethod()
|
||||||
|
{
|
||||||
|
return AccessTools.Method(typeof(SimpleTooltip), nameof(SimpleTooltip.ShowInventoryError));
|
||||||
|
}
|
||||||
|
|
||||||
|
[PatchPrefix]
|
||||||
|
public static bool Prefix(SimpleTooltip __instance, InventoryError error)
|
||||||
|
{
|
||||||
|
if (error is StashGridClass.GClass3310 || error is StashGridClass.GClass3311)
|
||||||
|
{
|
||||||
|
__instance.Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class FixAddModFirearmOperationPatch : ModulePatch
|
public class FixAddModFirearmOperationPatch : ModulePatch
|
||||||
{
|
{
|
||||||
protected override MethodBase GetTargetMethod()
|
protected override MethodBase GetTargetMethod()
|
||||||
|
Reference in New Issue
Block a user