using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Mono.Cecil.Cil;
using MonoMod.Cil;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClipFix")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("N/A")]
[assembly: AssemblyProduct("ClipFix")]
[assembly: AssemblyCopyright("Copyright © N/A 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e2845997-29f4-4ae2-977d-4ca8094e106d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ClipFix;
[BepInPlugin("spapi.etg.clipoverflow", "Clip Overflow", "1.0.0")]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "spapi.etg.clipoverflow";
public const string NAME = "Clip Overflow";
public const string VERSION = "1.0.0";
public static MethodInfo f1cm_f = AccessTools.Method(typeof(Plugin), "Fix1ClipMods_Fix", (Type[])null, (Type[])null);
public void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("spapi.etg.clipoverflow").PatchAll();
}
[HarmonyPatch(typeof(ProjectileModule), "GetModNumberOfShotsInClip")]
[HarmonyILManipulator]
public static void Fix1ClipMods_Transpiler(ILContext ctx)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(ctx);
ILLabel val2 = default(ILLabel);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref val2)
}))
{
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Call, (MethodBase)f1cm_f);
}
}
public static int Fix1ClipMods_Fix(int current, ProjectileModule mod)
{
if (mod == null)
{
return current;
}
int numberOfShotsInClip = mod.numberOfShotsInClip;
if (numberOfShotsInClip == current)
{
return current + 1;
}
return current;
}
}