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 CasinoBalanceTweaks v1.3.0
BepInEx/Plugins/CasinoBalanceTweaks/CasinoBalanceTweaks.dll
Decompiled 9 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CasinoBalanceTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CasinoBalanceTweaks")] [assembly: AssemblyTitle("CasinoBalanceTweaks")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace CasinoBalanceTweaks { [BepInPlugin("potatoh.lethalcasinobalancetweaks", "Lethal Casino Balance Tweaks", "1.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static ConfigEntry<float> SlotPayoutScale; internal static ConfigEntry<int> MaxScrapValue; private Harmony _harmony = null; private void Awake() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; SlotPayoutScale = ((BaseUnityPlugin)this).Config.Bind<float>("Slot Machine", "PayoutScale", 0.4f, "Scales slot machine PROFIT only. 1.0 = original LethalCasino payout, 0.4 = 40% of profit."); MaxScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Slot Machine", "MaxScrapValue", 1500, "Maximum scrap value after slot machine win. Set 0 to disable cap."); _harmony = new Harmony("potatoh.lethalcasinobalancetweaks"); _harmony.PatchAll(); Log.LogInfo((object)"Lethal Casino Balance Tweaks loaded."); } } [HarmonyPatch] internal static class SlotMachineUpdateScrapValuePatch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("LethalCasino.Custom.SlotMachine"); return AccessTools.Method(type, "UpdateScrapValueClientRpc", new Type[2] { typeof(NetworkBehaviourReference), typeof(int) }, (Type[])null); } private static void Prefix(NetworkBehaviour __instance, NetworkBehaviourReference item, ref int newValue) { if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.NetworkManager == (Object)null) { return; } string text = (AccessTools.Field(typeof(NetworkBehaviour), "__rpc_exec_stage")?.GetValue(__instance))?.ToString(); bool flag = text == "Execute"; GrabbableObject val = default(GrabbableObject); if ((!__instance.NetworkManager.IsServer && !__instance.NetworkManager.IsHost) || flag || !((NetworkBehaviourReference)(ref item)).TryGet<GrabbableObject>(ref val, (NetworkManager)null) || (Object)(object)val == (Object)null) { return; } int scrapValue = val.scrapValue; if (newValue > scrapValue) { float num = Mathf.Clamp(Plugin.SlotPayoutScale.Value, 0f, 1f); int num2 = newValue - scrapValue; int num3 = scrapValue + Mathf.RoundToInt((float)num2 * num); int value = Plugin.MaxScrapValue.Value; if (value > 0) { num3 = Mathf.Min(num3, value); } Plugin.Log.LogInfo((object)$"[SLOTS] payout scaled: {scrapValue} -> {newValue} became {num3}"); newValue = num3; } } } }