53 lines
2.5 KiB
C#
53 lines
2.5 KiB
C#
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
|
|
{
|
|
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)
|
|
{
|
|
StackTrace stackTrace = new StackTrace();
|
|
Plugin.Log.LogDebug("Stacktrace of tooltip call: \n" + stackTrace.ToString());
|
|
if (GridItemTooltipPatch.PatchTooltip)
|
|
{
|
|
text += $"<br>TemplateID: {GridItemTooltipPatch.HoveredItem?.TemplateId}<br>Template: {GridItemTooltipPatch.HoveredItem?.Template}<br>Item hashsum: {GridItemTooltipPatch.HoveredItem?.GetHashSum()}<br>Custom hash: {GridItemTooltipPatch.HoveredItem?.GetCustomHash()}<br>Item durability: {GridItemTooltipPatch.HoveredItem?.GetDurability()}<br>Item uses: {GridItemTooltipPatch.HoveredItem?.GetUses()}<br><color=#ff0fff><b>GridItemView</b></color>";
|
|
Plugin.Log.LogDebug(GridItemTooltipPatch.HoveredItem?.AttributesToString());
|
|
}
|
|
if (InsuranceSlotPatch.PatchTooltip)
|
|
{
|
|
text += $"<br>TemplateID: {InsuranceSlotPatch.HoveredItem?.TemplateId}<br><color=#00ffff><b>InsuranceSlotItemView</b></color>";
|
|
}
|
|
if (ItemPricePatch.PatchTooltip)
|
|
{
|
|
text += $"<br>TemplateID: {TradingItemPatch.HoveredItem?.TemplateId}<br><color=#00ff00><b>PriceTooltip</b></color>";
|
|
}
|
|
if (HandbookPatching.PatchTooltip)
|
|
{
|
|
text += $"<br>TemplateID: {HandbookPatching.HoveredItem?.TemplateId}<br><color=#0000ff><b>EntityIcon</b></color>";
|
|
}
|
|
if (InsuranceGridPatch.PatchTooltip)
|
|
{
|
|
text += $"<br>TemplateID: {InsuranceGridPatch.HoveredItem?.TemplateId}<br><color=#21f788><b>InsuranceItemView</b></color>";
|
|
}
|
|
if (BarterItemPatch.PatchTooltip)
|
|
{
|
|
text += $"<br>TemplateID: {BarterItemPatch.HoveredItem?.TemplateId}<br><color=#ff6521><b>TradingRequisitePanel</b></color>";
|
|
}
|
|
__instance.SetText(text);
|
|
}
|
|
}
|
|
}
|