using Aki.Reflection.Patching; using BepInEx; using EFT.InventoryLogic; using System.Reflection; namespace IcyClawz.ItemSellPrice { [BepInPlugin("com.IcyClawz.ItemSellPrice", "IcyClawz.ItemSellPrice", "1.2.1")] public class Plugin : BaseUnityPlugin { private void Awake() { new TraderPatch().Enable(); new ItemPatch().Enable(); new AmmoPatch().Enable(); new GrenadePatch().Enable(); new SecureContainerPatch().Enable(); } } internal class TraderPatch : ModulePatch { protected override MethodBase GetTargetMethod() => typeof(TraderClass).GetConstructors()[0]; [PatchPostfix] private static void PatchPostfix(ref TraderClass __instance) { __instance.UpdateSupplyData(); } } internal class ItemPatch : ModulePatch { protected override MethodBase GetTargetMethod() => typeof(Item).GetConstructors()[0]; [PatchPostfix] private static void PatchPostfix(ref Item __instance) { __instance.AddTraderOfferAttribute(); } } internal class AmmoPatch : ModulePatch { protected override MethodBase GetTargetMethod() => typeof(BulletClass).GetConstructors()[0]; [PatchPostfix] private static void PatchPostfix(ref BulletClass __instance) { __instance.AddTraderOfferAttribute(); } } internal class GrenadePatch : ModulePatch { protected override MethodBase GetTargetMethod() => typeof(GrenadeClass).GetConstructors()[0]; [PatchPostfix] private static void PatchPostfix(ref GrenadeClass __instance) { __instance.AddTraderOfferAttribute(); } } internal class SecureContainerPatch : ModulePatch { protected override MethodBase GetTargetMethod() => typeof(ItemContainerClass).GetConstructors()[0]; [PatchPostfix] private static void PatchPostfix(ref ItemContainerClass __instance) { __instance.AddTraderOfferAttribute(); } } }