2024-10-13 00:38:51 +02:00
using EFT.InventoryLogic ;
using EFT.UI.DragAndDrop ;
using LootValueEX.Extensions ;
using SPT.Reflection.Patching ;
using SPT.Reflection.Utils ;
using System.Reflection ;
2024-11-04 05:37:34 +01:00
namespace LootValueEX.Patches.Tooltips
2024-10-13 00:38:51 +02:00
{
/// <summary>
/// This patch will affect the following screens: Stash, Weapon Preset Builder, Character Gear, Character Preset Selector, New Ragfair Offer, Message Items, Loot
/// </summary>
internal class GridItemTooltipPatch : ModulePatch
{
protected override MethodBase GetTargetMethod ( ) = > typeof ( GridItemView ) . GetMethod ( "ShowTooltip" , BindingFlags . Instance | BindingFlags . Public ) ;
internal static bool PatchTooltip { get ; private set ; } = false ;
2024-11-04 05:37:34 +01:00
internal static Item ? HoveredItem { get ; private set ; }
2024-10-13 00:38:51 +02:00
[PatchPrefix]
static void EnableTooltipPatch ( GridItemView __instance )
{
if ( ! __instance . Item . IsExamined ( ) )
return ;
PatchTooltip = true ;
HoveredItem = __instance . Item ;
}
[PatchPostfix]
static void DisableTooltipPatch ( )
{
PatchTooltip = false ;
HoveredItem = null ;
}
}
}