63 lines
1.9 KiB
C#
Raw Normal View History

2022-05-14 20:06:24 +01:00
using System;
using System.Reflection;
using Aki.Reflection.Patching;
using EFT.InventoryLogic;
namespace itemValueMod
{
public class ItemPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return typeof(Item).GetConstructor(new Type[] { typeof(string), typeof(ItemTemplate) });
}
[PatchPostfix]
private static void PatchPostFix(ref Item __instance, string id, ItemTemplate template)
{
2023-10-20 20:29:04 +01:00
ItemValue.AddItemValue(ref __instance, template);
2022-05-14 20:06:24 +01:00
}
}
public class AmmoPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
2022-12-25 15:41:48 +00:00
return typeof(BulletClass).GetConstructor(new Type[] { typeof(string), typeof(AmmoTemplate) });
2022-05-14 20:06:24 +01:00
}
[PatchPostfix]
2022-12-25 15:41:48 +00:00
private static void PatchPostFix(ref BulletClass __instance, string id, AmmoTemplate template)
2022-05-14 20:06:24 +01:00
{
2023-10-20 20:29:04 +01:00
ItemValue.AddItemValue(ref __instance, template);
2022-05-14 20:06:24 +01:00
}
}
public class GrenadePatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
2022-12-25 15:41:48 +00:00
return typeof(GrenadeClass).GetConstructor(new Type[] { typeof(string), typeof(ThrowableWeaponClass) });
2022-05-14 20:06:24 +01:00
}
[PatchPostfix]
2022-12-25 15:41:48 +00:00
private static void PatchPostFix(ref GrenadeClass __instance, string id, ThrowableWeaponClass template)
2022-05-14 20:06:24 +01:00
{
2023-10-20 20:29:04 +01:00
ItemValue.AddItemValue(ref __instance, template);
2022-05-14 20:06:24 +01:00
}
}
public class SecureContainerPatch : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
2022-12-25 15:41:48 +00:00
return typeof(ItemContainerClass).GetConstructor(new Type[] { typeof(string), typeof(SecureContainerTemplateClass) });
2022-05-14 20:06:24 +01:00
}
[PatchPostfix]
2022-12-25 15:41:48 +00:00
private static void PatchPostFix(ref ItemContainerClass __instance, string id, SecureContainerTemplateClass template)
2022-05-14 20:06:24 +01:00
{
2023-10-20 20:29:04 +01:00
ItemValue.AddItemValue(ref __instance, template);
2022-05-14 20:06:24 +01:00
}
}
}