reflection part 2

This commit is contained in:
Tyfon
2024-07-11 21:58:20 -07:00
parent 8ad0b8c5f7
commit 3d8c9cc232
10 changed files with 178 additions and 84 deletions

View File

@@ -1,9 +1,9 @@
using SPT.Reflection.Patching;
using Comfort.Common;
using EFT.HealthSystem;
using Comfort.Common;
using EFT.InventoryLogic;
using EFT.UI;
using HarmonyLib;
using SPT.Reflection.Patching;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -25,7 +25,7 @@ namespace UIFixes
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.DeclaredProperty(typeof(GClass3054), nameof(GClass3054.AvailableInteractions)).GetMethod;
return AccessTools.DeclaredProperty(R.TradingInteractions.Type, "AvailableInteractions").GetMethod;
}
[PatchPostfix]
@@ -41,7 +41,7 @@ namespace UIFixes
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.DeclaredProperty(typeof(GClass3057), nameof(GClass3057.AvailableInteractions)).GetMethod;
return AccessTools.DeclaredProperty(R.TransferInteractions.Type, "AvailableInteractions").GetMethod;
}
[PatchPostfix]
@@ -88,11 +88,12 @@ namespace UIFixes
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Constructor(typeof(ScavengerInventoryScreen.GClass3156), [typeof(GClass2780), typeof(GClass2780), typeof(IHealthController), typeof(StashClass), typeof(ISession)]);
Type type = typeof(ScavengerInventoryScreen).GetNestedTypes().Single(t => t.GetField("ScavController") != null); // ScavengerInventoryScreen.GClass3156
return AccessTools.GetDeclaredConstructors(type).Single();
}
[PatchPrefix]
public static void Prefix(GClass2780 scavController)
public static void Prefix(InventoryContainerClass scavController)
{
scavController.Inventory.Stash = null;
}