eft-lootvalueex/Plugin/Patches/Tooltips/TradingItemPatch.cs

27 lines
842 B
C#
Raw Normal View History

using LootValueEX.Extensions;
using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
using System.Reflection;
namespace LootValueEX.Patches.Tooltips
{
class TradingItemPatch : ModulePatch
{
protected override MethodBase GetTargetMethod() => typeof(EFT.UI.DragAndDrop.TradingItemView).GetMethod("ShowTooltip", BindingFlags.Instance | BindingFlags.Public);
internal static EFT.InventoryLogic.Item? HoveredItem { get; private set; }
[PatchPrefix]
internal static void GetHoveredItem(EFT.UI.DragAndDrop.TradingItemView __instance)
{
if (!__instance.Item.IsExamined())
return;
HoveredItem = __instance.Item;
}
[PatchPostfix]
internal static void RemoveHoveredItem()
{
HoveredItem = null;
}
}
}