eft-lootvalueex/Plugin/Patches/Screens/InventoryScreenPatch.cs

24 lines
1.0 KiB
C#

using System.Reflection;
using EFT;
using EFT.HealthSystem;
using EFT.UI;
using LootValueEX.Extensions;
using SPT.Reflection.Patching;
namespace LootValueEX.Patches.Screens
{
internal class InventoryScreenPatch : ModulePatch
{
protected override MethodBase GetTargetMethod() => typeof(InventoryScreen).GetMethods().SingleOrDefault(method => method.Name == "Show" && method.GetParameters()[0].ParameterType == typeof(IHealthController));
[PatchPostfix]
private static void PatchPostfix(ref Profile ___profile_0, ref LootItemClass ___lootItemClass)
{
___profile_0.Inventory.GetPlayerItems(EFT.InventoryLogic.EPlayerItems.Equipment).ExecuteForEach(item => Plugin.Log.LogDebug($"{item.LocalizedName()} ({item.TemplateId}): {item.GetCustomHash()}"));
if(___lootItemClass != null)
___lootItemClass.GetAllItems().ExecuteForEach(item => Plugin.Log.LogDebug($"{item.LocalizedName()} ({item.TemplateId}): {item.GetCustomHash()}"));
}
}
}