using EFT.UI;
using LootValueEX.Extensions;
using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace LootValueEX.Patches.Tooltips
{
internal class TooltipPatch : ModulePatch
{
protected override MethodBase GetTargetMethod() => typeof(SimpleTooltip).GetMethods(BindingFlags.Instance | BindingFlags.Public).Where(x => x.Name == "Show").ToList()[0];
[PatchPostfix]
public static void AlterText(SimpleTooltip __instance, string text)
{
if (GridItemTooltipPatch.PatchTooltip)
{
Structs.TradeOfferStruct tradeOffer = Utils.ItemUtils.GetBestTraderValue(GridItemTooltipPatch.HoveredItem);
text += $"
Hash: {GridItemTooltipPatch.HoveredItem?.GetCustomHash()}
Trader: {tradeOffer.TraderID}
Value: {tradeOffer.Price}
Currency: {tradeOffer.CurrencyID}
Price in rubles: {tradeOffer.PriceInRouble}
GridItemView";
}
if (InsuranceSlotPatch.PatchTooltip)
{
text += $"
TemplateID: {InsuranceSlotPatch.HoveredItem?.TemplateId}
InsuranceSlotItemView";
}
if (ItemPricePatch.PatchTooltip)
{
text += $"
TemplateID: {TradingItemPatch.HoveredItem?.TemplateId}
PriceTooltip";
}
if (HandbookPatching.PatchTooltip)
{
text += $"
TemplateID: {HandbookPatching.HoveredItem?.TemplateId}
EntityIcon";
}
if (InsuranceGridPatch.PatchTooltip)
{
text += $"
TemplateID: {InsuranceGridPatch.HoveredItem?.TemplateId}
InsuranceItemView";
}
if (BarterItemPatch.PatchTooltip)
{
text += $"
TemplateID: {BarterItemPatch.HoveredItem?.TemplateId}
TradingRequisitePanel";
}
__instance.SetText(text);
}
}
}