Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalCasinoAtmFix v1.0.1
BepInEx/plugins/LethalCasinoAtmFix.dll
Decompiled 5 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Unity.Netcode; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Azx.LethalCasinoAtmFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Azx.LethalCasinoAtmFix")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("adbf880f-a1ac-4a9b-9403-b52a4f1e4b55")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Azx.LethalCasinoAtmFix; [BepInPlugin("Azx.lethal-casino-atm-fix", "Lethal Casino ATM Fix", "1.0.3")] public class AtmNoEqualBlockPlugin : BaseUnityPlugin { internal static ManualLogSource Log; private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"[ATM Fix] Initializing…"); try { new Harmony("Azx.lethal-casino-atm-fix").PatchAll(); Log.LogInfo((object)"[ATM Fix] Patch applied."); } catch (Exception arg) { Log.LogError((object)$"[ATM Fix] Failed to patch: {arg}"); } } } [HarmonyPatch] internal static class BuyChipsServerRpc_Patch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("LethalCasino.Custom.AtmMachine"); if (type == null) { ManualLogSource log = AtmNoEqualBlockPlugin.Log; if (log != null) { log.LogError((object)"[ATM Fix] Type not found: LethalCasino.Custom.AtmMachine"); } return null; } MethodInfo methodInfo = AccessTools.Method(type, "BuyChipsServerRpc", new Type[2] { typeof(NetworkBehaviourReference), typeof(int) }, (Type[])null); if (methodInfo == null) { ManualLogSource log2 = AtmNoEqualBlockPlugin.Log; if (log2 == null) { return methodInfo; } log2.LogError((object)"[ATM Fix] Method not found: BuyChipsServerRpc(NetworkBehaviourReference,int)"); } return methodInfo; } private static bool HasOrdinal(string haystack, string needle) { if (haystack != null) { return haystack.IndexOf(needle, StringComparison.Ordinal) >= 0; } return false; } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); int num = list.FindIndex((CodeInstruction ci) => ci.opcode == OpCodes.Ldstr && HasOrdinal(ci.operand as string, "Scrap is already worth")); if (num < 0) { num = list.FindIndex((CodeInstruction ci) => ci.opcode == OpCodes.Ldstr && HasOrdinal(ci.operand as string, "No reason to use the ATM")); } if (num < 0) { ManualLogSource log = AtmNoEqualBlockPlugin.Log; if (log != null) { log.LogWarning((object)"[ATM Fix] Anchor string not found – leaving method unmodified."); } return list; } int num2 = -1; int num3 = num; while (num3 >= 0 && num3 >= num - 20) { OpCode opcode = list[num3].opcode; if (opcode == OpCodes.Brfalse || opcode == OpCodes.Brfalse_S) { num2 = num3; break; } num3--; } if (num2 < 0) { ManualLogSource log2 = AtmNoEqualBlockPlugin.Log; if (log2 != null) { log2.LogWarning((object)"[ATM Fix] Could not locate guarding Brfalse before the warning block – leaving method unmodified."); } return list; } if (num2 - 1 >= 0 && list[num2 - 1].opcode != OpCodes.Ceq) { ManualLogSource log3 = AtmNoEqualBlockPlugin.Log; if (log3 != null) { log3.LogDebug((object)"[ATM Fix] Guarding branch not preceded by CEQ – continuing anyway."); } } list.Insert(num2, new CodeInstruction(OpCodes.Ldc_I4_0, (object)null)); list.Insert(num2, new CodeInstruction(OpCodes.Pop, (object)null)); ManualLogSource log4 = AtmNoEqualBlockPlugin.Log; if (log4 != null) { log4.LogInfo((object)"[ATM Fix] Forced equality check to false (pop + ldc.i4.0 before brfalse)."); } return list; } }