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) { StackTrace stackTrace = new StackTrace(); Plugin.Log.LogDebug("Stacktrace of tooltip call: \n" + stackTrace.ToString()); if (GridItemTooltipPatch.PatchTooltip) { text += $"
TemplateID: {GridItemTooltipPatch.HoveredItem?.TemplateId}
Template: {GridItemTooltipPatch.HoveredItem?.Template}
Item hashsum: {GridItemTooltipPatch.HoveredItem?.GetHashSum()}
Custom hash: {GridItemTooltipPatch.HoveredItem?.GetCustomHash()}
Item durability: {GridItemTooltipPatch.HoveredItem?.GetDurability()}
Item uses: {GridItemTooltipPatch.HoveredItem?.GetUses()}
GridItemView"; Plugin.Log.LogDebug(GridItemTooltipPatch.HoveredItem?.AttributesToString()); } 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); } } }