using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Photon.Pun; using UnboundLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LimitedAmmoPatch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LimitedAmmoPatch")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("15f04c88-89b4-443f-aa88-fc57be02c289")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace LimitedAmmoPatch; [BepInPlugin("come.rsmind.rounds.limitedammopatch", "LimitedAmmoPatch", "1.0.0")] [BepInProcess("Rounds.exe")] public class LimitedAmmoPatch : BaseUnityPlugin { private const string ModId = "come.rsmind.rounds.limitedammopatch"; private const string ModName = "LimitedAmmoPatch"; public const string Version = "1.0.0"; internal static Harmony harmony; public static LimitedAmmoPatch instance { get; private set; } private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("come.rsmind.rounds.limitedammopatch"); harmony.PatchAll(); } public void Start() { instance = this; } } [HarmonyPatch(typeof(Gun), "BulletInit")] public class Gun_BulletInit_Patch { private static bool Prefix(Gun __instance, GameObject bullet, bool useAmmo) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown if (!__instance.player.data.view.IsMine) { return true; } if (useAmmo && (int)ExtensionMethods.GetFieldValue((object)(GunAmmo)ExtensionMethods.GetFieldValue((object)__instance, "gunAmmo"), "currentAmmo") <= 0) { PhotonNetwork.Destroy(bullet); return false; } return true; } }