2023-07-08 23:42:42 +03:00
|
|
|
using Aki.Reflection.Patching;
|
|
|
|
using BepInEx;
|
|
|
|
using EFT.UI;
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
namespace IcyClawz.ItemAttributeFix
|
|
|
|
{
|
2023-10-09 03:21:08 +03:00
|
|
|
[BepInPlugin("com.IcyClawz.ItemAttributeFix", "IcyClawz.ItemAttributeFix", "1.2.0")]
|
2023-07-08 23:42:42 +03:00
|
|
|
public class Plugin : BaseUnityPlugin
|
|
|
|
{
|
|
|
|
private void Awake()
|
|
|
|
{
|
|
|
|
new CompactCharacteristicPanelPatch().Enable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-09 22:38:08 +03:00
|
|
|
internal class CompactCharacteristicPanelPatch : ModulePatch
|
2023-07-08 23:42:42 +03:00
|
|
|
{
|
|
|
|
private static readonly FieldInfo ItemAttributeField =
|
|
|
|
typeof(CompactCharacteristicPanel).GetField("ItemAttribute", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
|
|
|
private static readonly FieldInfo StringField =
|
|
|
|
typeof(CompactCharacteristicPanel).GetField("string_0", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
|
|
|
protected override MethodBase GetTargetMethod() =>
|
|
|
|
typeof(CompactCharacteristicPanel).GetMethod("SetValues", BindingFlags.Public | BindingFlags.Instance);
|
|
|
|
|
|
|
|
[PatchPostfix]
|
|
|
|
private static void PatchPostfix(ref CompactCharacteristicPanel __instance)
|
|
|
|
{
|
|
|
|
ItemAttributeClass attribute = ItemAttributeField.GetValue(__instance) as ItemAttributeClass;
|
|
|
|
StringField.SetValue(__instance, attribute.FullStringValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|