23 lines
603 B
C#
Raw Permalink Normal View History

using BepInEx;
using SPT.Reflection.Patching;
using System.Reflection;
2024-03-05 22:48:21 +02:00
namespace IcyClawz.MagazineInspector;
[BepInPlugin("com.IcyClawz.MagazineInspector", "IcyClawz.MagazineInspector", "1.5.0")]
2024-03-05 22:48:21 +02:00
public class Plugin : BaseUnityPlugin
{
private void Awake() =>
new MagazinePatch().Enable();
}
internal class MagazinePatch : ModulePatch
{
2024-03-05 22:48:21 +02:00
protected override MethodBase GetTargetMethod() =>
typeof(MagazineItemClass).GetConstructors()[0];
2024-03-05 22:48:21 +02:00
[PatchPostfix]
private static void PatchPostfix(ref MagazineItemClass __instance) =>
2024-03-05 22:48:21 +02:00
__instance.AddAmmoCountAttribute();
}