Decompiled source of Cloverclocked v0.1.1

BepInEx/plugins/pharmacomaniac-Cloverclocked/Cloverclocked.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CloverPit.Helpers;
using Cloverclocked;
using Cloverclocked.Helpers;
using Cloverclocked.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Panik;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Cloverclocked")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.1.0")]
[assembly: AssemblyInformationalVersion("0.1.1+187b73084ea3b521ccdb3451edb1064d53f5dab3")]
[assembly: AssemblyProduct("Cloverclocked")]
[assembly: AssemblyTitle("Cloverclocked")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CloverPit.Helpers
{
	internal static class SpinCoroutineHelper
	{
		private static readonly BindingFlags NestedTypeFlags = BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly BindingFlags MoveNextFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static MethodInfo? _cachedMoveNext;

		private static Type? _cachedIteratorType;

		internal static bool TryGetMoveNext(string logPrefix, [NotNullWhen(true)] out MethodInfo? moveNext, [NotNullWhen(true)] out Type? iteratorType)
		{
			if (_cachedMoveNext != null && _cachedIteratorType != null)
			{
				moveNext = _cachedMoveNext;
				iteratorType = _cachedIteratorType;
				return true;
			}
			Type type = typeof(SlotMachineScript).GetNestedTypes(NestedTypeFlags).FirstOrDefault((Type t) => t.Name.Contains("_SpinCoroutine"));
			if (type == null)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogError((object)(logPrefix + " State machine type for _SpinCoroutine not found. Patch not applied."));
				}
				moveNext = null;
				iteratorType = null;
				return false;
			}
			MethodInfo method = type.GetMethod("MoveNext", MoveNextFlags);
			if (method == null)
			{
				ManualLogSource log2 = CloverclockedPlugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)(logPrefix + " MoveNext not found on _SpinCoroutine state machine. Patch not applied."));
				}
				moveNext = null;
				iteratorType = null;
				return false;
			}
			_cachedIteratorType = type;
			_cachedMoveNext = method;
			iteratorType = type;
			moveNext = method;
			return true;
		}
	}
}
namespace Cloverclocked
{
	internal static class PatchLog
	{
		private static readonly HashSet<string> Keys = new HashSet<string>();

		internal static void InfoOnce(string key, string message)
		{
			string message2 = message;
			LogOnce("info:" + key, delegate(ManualLogSource? log)
			{
				if (log != null)
				{
					log.LogInfo((object)message2);
				}
			});
		}

		internal static void WarnOnce(string key, string message)
		{
			string message2 = message;
			LogOnce("warn:" + key, delegate(ManualLogSource? log)
			{
				if (log != null)
				{
					log.LogWarning((object)message2);
				}
			});
		}

		internal static void ErrorOnce(string key, string message)
		{
			string message2 = message;
			LogOnce("error:" + key, delegate(ManualLogSource? log)
			{
				if (log != null)
				{
					log.LogError((object)message2);
				}
			});
		}

		private static void LogOnce(string key, Action<ManualLogSource?> logger)
		{
			if (Keys.Add(key))
			{
				logger(CloverclockedPlugin.Log);
			}
		}
	}
	[BepInPlugin("pharmacomaniac.cloverpit.cloverclocked", "Cloverclocked", "0.1.1")]
	public class CloverclockedPlugin : BaseUnityPlugin
	{
		private record PatchStatus(string Key, bool Enabled, bool Applied, Exception? Error = null);

		public const string PluginGuid = "pharmacomaniac.cloverpit.cloverclocked";

		public const string PluginName = "Cloverclocked";

		public const string PluginVersion = "0.1.1";

		internal static ManualLogSource Log;

		private Harmony? _harmony;

		private readonly List<ConfigEntry<bool>> _patchToggles = new List<ConfigEntry<bool>>();

		private readonly List<PatchStatus> _patchStatuses = new List<PatchStatus>();

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("pharmacomaniac.cloverpit.cloverclocked");
			RegisterPatches();
			Log.LogDebug((object)"Cloverclocked initialized.");
		}

		private void RegisterPatches()
		{
			if (_harmony != null)
			{
				RegisterPatch("AutoCollectInterest", "Automatically collect pending interest whenever it is awarded or restored.", AutoCollectInterestFeature.Apply);
				RegisterPatch("AutoFlipCards", "Memory pack QoL: auto-flip cards, auto-confirm prompts, and auto-accept skip offers.", AutoFlipCardsFeature.Apply);
				RegisterPatch("AutoRedButton", "Automatically press the red button whenever it is flashing and the slots are idle.", AutoRedButtonFeature.Apply, defaultValue: false);
				RegisterPatch("SkipCoinPlate", "Skip the final coin plate camera/animation at the end of each spin.", SkipCoinPlateFeature.Apply, defaultValue: false);
				RegisterPatch("ExponentialPatternSpeed", "Speed up pattern result reveals exponentially after the first few patterns.", ExponentialPatternSpeedFeature.Apply);
				RegisterPatch("DoubleSpinSpeed", "Double the base slot spin animation speed.", DoubleSpinSpeedFeature.Apply);
				ConfigEntry<bool> val = RegisterPatch("UnlockTransitionSpeedExperimental", "EXPERIMENTAL: Add faster transition speeds (1,2,3,4,8,16) to the settings menu. Untested with cutscene skips; enable at your own risk.", UnlockTransitionSpeedFeature.Apply, defaultValue: false);
				TransitionSpeedSafety.ScheduleVanillaClampIfNeeded(val.Value);
				RegisterPatch("SkipBigPatternAndJackpotWaits", "Skip the long pattern anticipation and jackpot applause waits during spins.", SkipBigPatternAndJackpotWaitsFeature.Apply);
				RegisterPatch("SkipNoMoreSpins", "Skip the long \"no more spins\" coroutine and end the round immediately.", SkipNoMoreSpinsFeature.Apply, defaultValue: false);
				RegisterPatch("NoSlow666", "Remove the 66/666 slowdown so spins stay fast at high luck.", NoSlow666Feature.Apply);
				RegisterPatch("RightClickDeposit", "Right-clicking the ATM deposit button automatically deposits only the safe amount.", RightClickDepositFeature.Apply);
				RegisterPatch("SkipDebtClear", "Skip the ATM debt clear cutscene.", SkipDebtClearFeature.Apply, defaultValue: false);
				RegisterPatch("SkipInterestsAndTickets", "Skip the Interests & Tickets cutscene after each run.", SkipInterestsAndTicketsFeature.Apply, defaultValue: false);
				LogPatchSummary();
			}
		}

		private ConfigEntry<bool> RegisterPatch(string key, string description, Action<Harmony> applyAction, bool defaultValue = true)
		{
			if (_harmony == null)
			{
				return ((BaseUnityPlugin)this).Config.Bind<bool>("Patches." + key, "Enabled", defaultValue, description);
			}
			ConfigEntry<bool> val = ((BaseUnityPlugin)this).Config.Bind<bool>("Patches." + key, "Enabled", defaultValue, description);
			_patchToggles.Add(val);
			if (!val.Value)
			{
				_patchStatuses.Add(new PatchStatus(key, Enabled: false, Applied: false));
				Log.LogDebug((object)("Patch " + key + " disabled via config."));
				return val;
			}
			try
			{
				applyAction(_harmony);
				_patchStatuses.Add(new PatchStatus(key, Enabled: true, Applied: true));
				Log.LogDebug((object)("Patch " + key + " applied."));
			}
			catch (Exception ex)
			{
				_patchStatuses.Add(new PatchStatus(key, Enabled: true, Applied: false, ex));
				Log.LogError((object)$"Failed to apply patch {key}: {ex}");
			}
			return val;
		}

		private void LogPatchSummary()
		{
			List<PatchStatus> list = _patchStatuses.Where((PatchStatus p) => p.Enabled).ToList();
			int num = list.Count((PatchStatus p) => p.Applied);
			int count = list.Count;
			List<string> list2 = (from p in list
				where !p.Applied
				select p.Key).ToList();
			List<string> list3 = (from p in _patchStatuses
				where !p.Enabled
				select p.Key).ToList();
			List<string> list4 = new List<string> { $"applied {num}/{count} patches" };
			if (list3.Count > 0)
			{
				list4.Add("disabled: " + string.Join(", ", list3));
			}
			if (list2.Count > 0)
			{
				list4.Add("failed: " + string.Join(", ", list2));
			}
			Log.LogInfo((object)("Cloverclocked: " + string.Join("; ", list4)));
		}

		private void OnDestroy()
		{
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace Cloverclocked.Patches
{
	internal static class AutoCollectInterestFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(AutoInterestPickupPatches));
		}
	}
	[HarmonyPatch(typeof(GameplayData))]
	internal static class AutoInterestPickupPatches
	{
		private const string LogPrefix = "[AutoCollectInterest]";

		[HarmonyPostfix]
		[HarmonyPatch("InterestEarnedGrow")]
		private static void Postfix_InterestEarnedGrow()
		{
			TryAutoCollectInterest("InterestEarnedGrow");
		}

		[HarmonyPostfix]
		[HarmonyPatch("InterestEarnedGrow_Manual")]
		private static void Postfix_InterestEarnedGrowManual(BigInteger value)
		{
			TryAutoCollectInterest("InterestEarnedGrow_Manual");
		}

		[HarmonyPostfix]
		[HarmonyPatch("_Coins_RestoreFromSerialization")]
		private static void Postfix_CoinsRestoreFromSerialization()
		{
			TryAutoCollectInterest("_Coins_RestoreFromSerialization");
		}

		private static void TryAutoCollectInterest(string source)
		{
			try
			{
				BigInteger bigInteger = GameplayData.InterestEarnedGet();
				if (bigInteger > 0L)
				{
					ManualLogSource log = CloverclockedPlugin.Log;
					if (log != null)
					{
						log.LogDebug((object)string.Format("{0} Auto-collecting {1} (source: {2}).", "[AutoCollectInterest]", bigInteger, source));
					}
					GameplayData.InterestPickUp();
				}
			}
			catch (Exception arg)
			{
				ManualLogSource log2 = CloverclockedPlugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)string.Format("{0} Failed to auto-collect interest after {1}: {2}", "[AutoCollectInterest]", source, arg));
				}
			}
		}
	}
	internal static class AutoFlipCardsFeature
	{
		internal static void Apply(Harmony harmony)
		{
			AutoFlipCardsState.Initialize();
			harmony.PatchAll(typeof(MemoryPackDealUI_Update_AutoFlipInspectorPatch));
			harmony.PatchAll(typeof(CardScript_Update_AutoFlipPatch));
			harmony.PatchAll(typeof(Controls_ActionButton_PressedGet_AutoConfirmPatch));
		}
	}
	internal static class AutoFlipCardsState
	{
		private const string LogPrefix = "[AutoFlipCards]";

		private static FieldInfo? _cardsEnabledField;

		private static FieldInfo? _cardsHolderField;

		private static bool _inspectorAllSet;

		internal static void Initialize()
		{
			if (_cardsEnabledField != null && _cardsHolderField != null)
			{
				return;
			}
			_cardsEnabledField = AccessTools.Field(typeof(CardScript), "cardsEnabled");
			_cardsHolderField = AccessTools.Field(typeof(MemoryPackDealUI), "cardsHolder");
			if (_cardsEnabledField == null || _cardsHolderField == null)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogWarning((object)"[AutoFlipCards] Failed to resolve Memory Pack reflection data. Patch disabled.");
				}
			}
		}

		internal static void TickInspector()
		{
			if (_cardsEnabledField == null || _cardsHolderField == null)
			{
				return;
			}
			if (!MemoryPackDealUI.IsDealRunnning())
			{
				_inspectorAllSet = false;
			}
			else
			{
				if (!CardsInspectorScript.IsEnabled())
				{
					return;
				}
				MemoryPackDealUI instance = MemoryPackDealUI.instance;
				if ((Object)(object)instance == (Object)null)
				{
					return;
				}
				object? value = _cardsHolderField.GetValue(instance);
				Transform val = (Transform)((value is Transform) ? value : null);
				if (val == null)
				{
					return;
				}
				if (!(_cardsEnabledField.GetValue(null) is List<CardScript> list) || list.Count == 0)
				{
					_inspectorAllSet = false;
					return;
				}
				List<CardScript> list2 = new List<CardScript>();
				foreach (CardScript item in list)
				{
					if (!((Object)(object)item == (Object)null) && !((Object)(object)item.rectTransform == (Object)null) && ((Component)item).gameObject.activeInHierarchy && ((Component)item).transform.IsChildOf(val))
					{
						list2.Add(item);
					}
				}
				if (list2.Count == 0)
				{
					_inspectorAllSet = false;
					return;
				}
				bool flag = true;
				for (int i = 0; i < list2.Count; i++)
				{
					if (list2[i].IsFaceDown())
					{
						flag = false;
						break;
					}
				}
				if (!flag)
				{
					_inspectorAllSet = false;
				}
				else if (!CardScript.IsAnyCardFoiling() && !_inspectorAllSet)
				{
					CardsInspectorScript.Close();
					CardsInspectorScript.Open("CARDS_INSPECTOR_TITLE__PACK_OPENED_ALL_INSPECTED", "CARDS_INSPECTOR_DESCRIPTION__PACK_OPENED_ALL_INSPECTED", (PromptKind)0);
					_inspectorAllSet = true;
				}
			}
		}
	}
	[HarmonyPatch(typeof(MemoryPackDealUI), "Update")]
	internal static class MemoryPackDealUI_Update_AutoFlipInspectorPatch
	{
		private static void Postfix()
		{
			AutoFlipCardsState.TickInspector();
		}
	}
	[HarmonyPatch(typeof(CardScript), "Update")]
	internal static class CardScript_Update_AutoFlipPatch
	{
		private static void Prefix(CardScript __instance)
		{
			if (MemoryPackDealUI.IsDealRunnning() && CardsInspectorScript.IsEnabled() && __instance.IsFaceDown())
			{
				__instance.FlipRequest();
			}
		}
	}
	[HarmonyPatch(typeof(Controls))]
	[HarmonyPatch("ActionButton_PressedGet")]
	[HarmonyPatch(new Type[]
	{
		typeof(int),
		typeof(InputAction),
		typeof(bool)
	})]
	internal static class Controls_ActionButton_PressedGet_AutoConfirmPatch
	{
		private static void Postfix(int playerIndex, InputAction action, bool ignoreIfNotPlaying, ref bool __result)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Invalid comparison between Unknown and I4
			if (MemoryPackDealUI.IsDealRunnning() && ((int)action == 4 || (int)action == 6))
			{
				__result = true;
			}
		}
	}
	internal static class AutoRedButtonFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(RedButtonScript_Update_AutoPressPatch));
		}
	}
	internal static class AutoRedButtonLogic
	{
		internal static void TryAutoPress(RedButtonScript button)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if (!((Object)(object)button == (Object)null) && PlatformMaster.IsInitialized() && (int)GameplayMaster.GetGamePhase() == 5 && !SlotMachineScript.IsSpinning() && RedButtonScript.ButtonIsFlashing())
			{
				button.Press();
			}
		}
	}
	[HarmonyPatch(typeof(RedButtonScript), "Update")]
	internal static class RedButtonScript_Update_AutoPressPatch
	{
		private static void Postfix(RedButtonScript __instance)
		{
			AutoRedButtonLogic.TryAutoPress(__instance);
		}
	}
	internal static class DoubleSpinSpeedFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(SpinCoroutine_DoubleSpeedPatch));
		}
	}
	[HarmonyPatch]
	internal static class SpinCoroutine_DoubleSpeedPatch
	{
		private const string LogPrefix = "[DoubleSpinSpeed]";

		private static MethodBase? TargetMethod()
		{
			if (!SpinCoroutineHelper.TryGetMoveNext("[DoubleSpinSpeed]", out MethodInfo moveNext, out Type _))
			{
				return null;
			}
			return moveNext;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			MethodInfo tickGetter = AccessTools.PropertyGetter(typeof(Tick), "Time");
			if (tickGetter == null)
			{
				PatchLog.ErrorOnce("[DoubleSpinSpeed]:TickGetterMissing", "[DoubleSpinSpeed] Failed to resolve Tick.Time; spin speed not changed.");
				return instructions;
			}
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => CodeInstructionExtensions.Calls(ci, tickGetter)), (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)IsLdloc, (string)null),
				new CodeMatch((OpCode?)OpCodes.Mul, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)0.5f, (string)null)
			});
			if (val.IsInvalid)
			{
				PatchLog.ErrorOnce("[DoubleSpinSpeed]:MultiplierNotFound", "[DoubleSpinSpeed] Base spin speed multiplier not found; no changes applied.");
				return instructions;
			}
			val.Advance(3);
			val.SetOperandAndAdvance((object)1f);
			PatchLog.InfoOnce("[DoubleSpinSpeed]:Applied", "[DoubleSpinSpeed] Spin animation speed doubled (0.5 -> 1.0).");
			return val.InstructionEnumeration();
		}

		private static bool IsLdloc(CodeInstruction instr)
		{
			OpCode opcode = instr.opcode;
			if (!(opcode == OpCodes.Ldloc) && !(opcode == OpCodes.Ldloc_S) && !(opcode == OpCodes.Ldloc_0) && !(opcode == OpCodes.Ldloc_1) && !(opcode == OpCodes.Ldloc_2))
			{
				return opcode == OpCodes.Ldloc_3;
			}
			return true;
		}
	}
	internal static class ExponentialPatternSpeedFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(SlotMachineScript_Spin_Patch));
			harmony.PatchAll(typeof(SpinCoroutine_MoveNext_Patch));
		}
	}
	internal static class PatternSpeedState
	{
		private const int Threshold = 5;

		private const float GrowthFactor = 1.6f;

		private const float MaxExtraMultiplier = 50f;

		internal static int CurrentPatternIndex;

		internal static void Reset()
		{
			CurrentPatternIndex = 0;
		}

		internal static void IncrementPattern()
		{
			CurrentPatternIndex++;
		}

		internal static float AdjustMultiplier(float original)
		{
			if (original <= 0f)
			{
				return original;
			}
			if (CurrentPatternIndex <= 5)
			{
				return original;
			}
			int num = CurrentPatternIndex - 5;
			double num2 = Math.Pow(1.600000023841858, num);
			if (num2 > 50.0)
			{
				num2 = 50.0;
			}
			return original * (float)num2;
		}
	}
	[HarmonyPatch(typeof(SlotMachineScript), "Spin")]
	internal static class SlotMachineScript_Spin_Patch
	{
		private static void Prefix()
		{
			PatternSpeedState.Reset();
		}
	}
	[HarmonyPatch]
	internal static class SpinCoroutine_MoveNext_Patch
	{
		private const string LogPrefix = "[ExponentialPatternSpeed]";

		private static MethodBase? TargetMethod()
		{
			if (!SpinCoroutineHelper.TryGetMoveNext("[ExponentialPatternSpeed]", out MethodInfo moveNext, out Type _))
			{
				return null;
			}
			return moveNext;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo methodInfo = AccessTools.Method(typeof(SlotMachineScript), "GetPatternSensationalLevel", new Type[2]
			{
				typeof(Kind),
				typeof(Kind)
			}, (Type[])null);
			if (methodInfo == null)
			{
				PatchLog.ErrorOnce("[ExponentialPatternSpeed]:GetSensationalMissing", "[ExponentialPatternSpeed] Failed to resolve GetPatternSensationalLevel; no pattern speed changes applied.");
				return list;
			}
			MethodInfo methodInfo2 = AccessTools.Method(typeof(PatternSpeedState), "IncrementPattern", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(PatternSpeedState), "AdjustMultiplier", (Type[])null, (Type[])null);
			if (methodInfo2 == null || methodInfo3 == null)
			{
				PatchLog.ErrorOnce("[ExponentialPatternSpeed]:StateHelpersMissing", "[ExponentialPatternSpeed] Failed to resolve PatternSpeedState methods; no pattern speed changes applied.");
				return list;
			}
			FieldInfo fieldInfo = null;
			if (SpinCoroutineHelper.TryGetMoveNext("[ExponentialPatternSpeed]", out MethodInfo moveNext, out Type _))
			{
				Type declaringType = moveNext.DeclaringType;
				if (declaringType != null)
				{
					fieldInfo = declaringType.GetField("<animationMultiplier>5__55", BindingFlags.Instance | BindingFlags.NonPublic) ?? FindAnimationMultiplierFieldFallback(declaringType);
				}
			}
			if (fieldInfo == null)
			{
				PatchLog.WarnOnce("[ExponentialPatternSpeed]:AnimFieldMissing", "[ExponentialPatternSpeed] Failed to locate animationMultiplier field; only pattern index increments will be applied.");
			}
			int num = 0;
			for (int i = 0; i < list.Count; i++)
			{
				if (CodeInstructionExtensions.Calls(list[i], methodInfo))
				{
					list.Insert(i + 1, new CodeInstruction(OpCodes.Call, (object)methodInfo2));
					num++;
					i++;
				}
			}
			bool flag = false;
			if (fieldInfo != null)
			{
				for (int j = 0; j < list.Count; j++)
				{
					CodeInstruction val = list[j];
					if (!flag && val.opcode == OpCodes.Stfld && object.Equals(val.operand, fieldInfo))
					{
						list.Insert(j, new CodeInstruction(OpCodes.Call, (object)methodInfo3));
						flag = true;
						j++;
					}
				}
			}
			PatchLog.InfoOnce("[ExponentialPatternSpeed]:Applied", "[ExponentialPatternSpeed] Patched slot pattern coroutine: " + $"{num} pattern increments, " + $"{(flag ? 1 : 0)} animationMultiplier wrap.");
			return list;
		}

		private static FieldInfo? FindAnimationMultiplierFieldFallback(Type smType)
		{
			FieldInfo[] fields = smType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (fieldInfo.FieldType == typeof(float) && fieldInfo.Name.IndexOf("animationMultiplier", StringComparison.OrdinalIgnoreCase) >= 0)
				{
					return fieldInfo;
				}
			}
			return null;
		}
	}
	internal static class NoSlow666Feature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(NoSlow666_SpinCoroutine_MoveNext_Patch));
		}
	}
	internal static class NoSlow666Logic
	{
		internal static float FixNum9(float overTheGameSpeedMult, float clamp666)
		{
			if (overTheGameSpeedMult < 1.5f)
			{
				overTheGameSpeedMult = 1.5f;
			}
			if (overTheGameSpeedMult > 1.75f)
			{
				overTheGameSpeedMult = 1.75f;
			}
			return overTheGameSpeedMult;
		}
	}
	[HarmonyPatch]
	internal static class NoSlow666_SpinCoroutine_MoveNext_Patch
	{
		private const string LogPrefix = "[No666SlowSpin]";

		private static MethodBase? TargetMethod()
		{
			if (!SpinCoroutineHelper.TryGetMoveNext("[No666SlowSpin]", out MethodInfo moveNext, out Type _))
			{
				return null;
			}
			return moveNext;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il, MethodBase __originalMethod)
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Expected O, but got Unknown
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			try
			{
				Type declaringType = __originalMethod.DeclaringType;
				if (declaringType == null)
				{
					PatchLog.ErrorOnce("[No666SlowSpin]:IteratorMissing", "[No666SlowSpin] __originalMethod.DeclaringType is null.");
					return instructions;
				}
				FieldInfo[] fields = declaringType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				FieldInfo fieldInfo = fields.FirstOrDefault((FieldInfo f) => f.Name.StartsWith("<overTheGameSpeedMult>", StringComparison.Ordinal));
				FieldInfo fieldInfo2 = fields.FirstOrDefault((FieldInfo f) => f.Name.StartsWith("<_666SpinAnimSpeedMult_CLAMPER>", StringComparison.Ordinal));
				if (fieldInfo == null || fieldInfo2 == null)
				{
					PatchLog.ErrorOnce("[No666SlowSpin]:FieldsMissing", "[No666SlowSpin] Iterator fields for overTheGameSpeedMult / _666SpinAnimSpeedMult_CLAMPER not found; no patch applied.");
					return instructions;
				}
				MethodInfo methodInfo = AccessTools.Method(typeof(Mathf), "Min", new Type[2]
				{
					typeof(float),
					typeof(float)
				}, (Type[])null);
				MethodInfo methodInfo2 = AccessTools.Method(typeof(NoSlow666Logic), "FixNum9", (Type[])null, (Type[])null);
				if (methodInfo == null || methodInfo2 == null)
				{
					PatchLog.ErrorOnce("[No666SlowSpin]:MethodsMissing", "[No666SlowSpin] Failed to resolve Mathf.Min or FixNum9; no patch applied.");
					return instructions;
				}
				CodeMatcher val = new CodeMatcher(instructions, il).MatchForward(true, (CodeMatch[])(object)new CodeMatch[5]
				{
					new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo2, (string)null),
					new CodeMatch((OpCode?)OpCodes.Call, (object)methodInfo, (string)null)
				});
				if (val.IsInvalid)
				{
					PatchLog.WarnOnce("[No666SlowSpin]:PatternNotFound", "[No666SlowSpin] Target Mathf.Min(overTheGameSpeedMult, _666SpinAnimSpeedMult_CLAMPER) pattern not found; no patch applied.");
					return instructions;
				}
				val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Call, (object)methodInfo2));
				PatchLog.InfoOnce("[No666SlowSpin]:Applied", "[No666SlowSpin] Patched num9 calculation: 66/666 slow spin disabled.");
				return val.InstructionEnumeration();
			}
			catch (Exception arg)
			{
				PatchLog.ErrorOnce("[No666SlowSpin]:Exception", string.Format("{0} Transpiler exception: {1}", "[No666SlowSpin]", arg));
				return instructions;
			}
		}
	}
	internal static class RightClickDepositFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(RightClickDepositPatches));
		}
	}
	internal static class RightClickDepositState
	{
		internal static bool UseSafeDepositAmount;

		internal static BigInteger GetSafeDepositAmount()
		{
			BigInteger bigInteger = GameplayData.CoinsGet();
			BigInteger bigInteger2 = GameplayData.DebtMissingGet();
			if (bigInteger2 <= 0L || bigInteger <= 0L)
			{
				return 0;
			}
			if (GameplayData.RoundsLeftToDeadline() <= 0)
			{
				BigInteger bigInteger3 = bigInteger;
				if (bigInteger3 > bigInteger2)
				{
					bigInteger3 = bigInteger2;
				}
				return bigInteger3;
			}
			BigInteger bigInteger4 = GameplayData.SpinCostMax_Get();
			if (bigInteger <= bigInteger4)
			{
				return 0;
			}
			BigInteger bigInteger5 = bigInteger - bigInteger4;
			if (bigInteger5 > bigInteger2)
			{
				bigInteger5 = bigInteger2;
			}
			if (bigInteger5 < 0L)
			{
				bigInteger5 = 0;
			}
			return bigInteger5;
		}
	}
	[HarmonyPatch]
	internal static class RightClickDepositPatches
	{
		private const string LogPrefix = "[RightClickDeposit]";

		private static readonly Dictionary<int, bool> AtmDepositButtonCache = new Dictionary<int, bool>();

		private static bool IsAtmDepositButton(DiegeticMenuElement elem)
		{
			if ((Object)(object)elem == (Object)null)
			{
				return false;
			}
			int instanceID = ((Object)elem).GetInstanceID();
			if (AtmDepositButtonCache.TryGetValue(instanceID, out var value))
			{
				return value;
			}
			bool flag = false;
			UnityEvent onSelectCallback = elem.onSelectCallback;
			if (onSelectCallback != null)
			{
				int persistentEventCount = ((UnityEventBase)onSelectCallback).GetPersistentEventCount();
				for (int i = 0; i < persistentEventCount; i++)
				{
					Object persistentTarget = ((UnityEventBase)onSelectCallback).GetPersistentTarget(i);
					string persistentMethodName = ((UnityEventBase)onSelectCallback).GetPersistentMethodName(i);
					if (persistentTarget is GameplayMaster && persistentMethodName == "FCall_DepositTry")
					{
						flag = true;
						break;
					}
				}
			}
			AtmDepositButtonCache[instanceID] = flag;
			if (flag)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)string.Format("{0} Found ATM deposit button: {1} (id {2})", "[RightClickDeposit]", ((Object)((Component)elem).gameObject).name, instanceID));
				}
			}
			return flag;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameplayData), "NextDepositAmmountGet", new Type[] { typeof(bool) })]
		private static bool GameplayData_NextDepositAmmountGet_Prefix(bool forceDefault, ref BigInteger __result)
		{
			if (!RightClickDepositState.UseSafeDepositAmount || forceDefault)
			{
				return true;
			}
			try
			{
				__result = RightClickDepositState.GetSafeDepositAmount();
			}
			catch (Exception arg)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogError((object)string.Format("{0} Error computing safe deposit amount for right-click: {1}", "[RightClickDeposit]", arg));
				}
				__result = 0;
			}
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DiegeticMenuElement), "Update")]
		private static void DiegeticMenuElement_Update_Postfix(DiegeticMenuElement __instance)
		{
			try
			{
				if (!IsAtmDepositButton(__instance) || !__instance.IsMouseOnMe() || !Input.GetMouseButtonDown(1))
				{
					return;
				}
				if ((Object)(object)GameplayMaster.instance == (Object)null)
				{
					ManualLogSource log = CloverclockedPlugin.Log;
					if (log != null)
					{
						log.LogWarning((object)"[RightClickDeposit] GameplayMaster.instance missing; cannot perform right-click deposit.");
					}
					return;
				}
				RightClickDepositState.UseSafeDepositAmount = true;
				try
				{
					GameplayMaster.instance.FCall_DepositTry();
				}
				finally
				{
					RightClickDepositState.UseSafeDepositAmount = false;
				}
			}
			catch (Exception arg)
			{
				ManualLogSource log2 = CloverclockedPlugin.Log;
				if (log2 != null)
				{
					log2.LogError((object)string.Format("{0} Error in DiegeticMenuElement.Update postfix: {1}", "[RightClickDeposit]", arg));
				}
			}
		}
	}
	internal static class SkipBigPatternAndJackpotWaitsFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(SpinCoroutine_RemoveDelaysPatch));
		}
	}
	[HarmonyPatch]
	internal static class SpinCoroutine_RemoveDelaysPatch
	{
		private const string LogPrefix = "[SkipBigPatternAndJackpotWaits]";

		private static Type? _iteratorType;

		private static FieldInfo? _timerField;

		private static MethodBase? TargetMethod()
		{
			if (!SpinCoroutineHelper.TryGetMoveNext("[SkipBigPatternAndJackpotWaits]", out MethodInfo moveNext, out Type iteratorType))
			{
				return null;
			}
			_iteratorType = iteratorType;
			return moveNext;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (_iteratorType != null && _timerField == null)
			{
				_timerField = _iteratorType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.FieldType == typeof(float) && f.Name.Contains("<timer>"));
			}
			FieldInfo timerField = _timerField;
			if (timerField == null)
			{
				PatchLog.WarnOnce("[SkipBigPatternAndJackpotWaits]:TimerFieldMissing", "[SkipBigPatternAndJackpotWaits] Could not find <timer> field; no changes applied.");
				return instructions;
			}
			CodeMatcher matcher = new CodeMatcher(instructions, (ILGenerator)null);
			bool flag = PatchTimerLoopAfterAnchor(ref matcher, "SoundSlotMachineLongStreakEndAnticipation", timerField, "[SkipBigPatternAndJackpotWaits]:Anticipation");
			matcher.Start();
			bool flag2 = PatchTimerLoopAfterAnchor(ref matcher, "SoundSlotMachineApplause", timerField, "[SkipBigPatternAndJackpotWaits]:Applause");
			PatchLog.InfoOnce("[SkipBigPatternAndJackpotWaits]:Applied", string.Format("{0} Patched waits (anticipation={1}, applause={2}).", "[SkipBigPatternAndJackpotWaits]", flag, flag2));
			return matcher.InstructionEnumeration();
		}

		private static bool PatchTimerLoopAfterAnchor(ref CodeMatcher matcher, string anchorString, FieldInfo timerField, string logPrefix)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Expected O, but got Unknown
			FieldInfo timerField2 = timerField;
			matcher.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldstr, (object)anchorString, (string)null)
			});
			if (!matcher.IsValid)
			{
				PatchLog.WarnOnce(logPrefix + ":AnchorMissing", logPrefix + " Anchor string '" + anchorString + "' not found; skipping.");
				return false;
			}
			matcher.Insert((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Ldstr, (object)anchorString),
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(SpinCoroutine_RemoveDelaysPatch), "LogPatchedWaitHit", (Type[])null, (Type[])null))
			});
			matcher.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => ci.opcode == OpCodes.Ldfld && object.Equals(ci.operand, timerField2)), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)0f, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => ci.opcode == OpCodes.Bgt || ci.opcode == OpCodes.Bgt_S), (string)null)
			});
			if (!matcher.IsValid)
			{
				PatchLog.WarnOnce(logPrefix + ":TimerLoopMissing", logPrefix + " Timer loop after '" + anchorString + "' not found; skipping.");
				return false;
			}
			matcher.Advance(3);
			CodeInstruction instruction = matcher.Instruction;
			OpCode opcode = instruction.opcode;
			OpCode opCode;
			if (opcode == OpCodes.Bgt)
			{
				opCode = OpCodes.Ble;
			}
			else
			{
				if (!(opcode == OpCodes.Bgt_S))
				{
					PatchLog.WarnOnce(logPrefix + ":UnexpectedBranch", $"{logPrefix} Expected Bgt/Bgt_S at loop condition but found {opcode}; skipping.");
					return false;
				}
				opCode = OpCodes.Ble_S;
			}
			matcher.SetInstruction(new CodeInstruction(opCode, instruction.operand));
			return true;
		}

		private static void LogPatchedWaitHit(string anchorString)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)string.Format("{0} Skipping wait near '{1}' (phase={2}, spinsLeft={3}).", "[SkipBigPatternAndJackpotWaits]", anchorString, GameplayMaster.GetGamePhase(), GameplayData.SpinsLeftGet()));
			}
		}
	}
	internal static class SkipCoinPlateFeature
	{
		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(SkipFinalCoinPlatePatch));
		}
	}
	[HarmonyPatch]
	internal static class SkipFinalCoinPlatePatch
	{
		private const string LogPrefix = "[SkipCoinPlate]";

		private static MethodBase? TargetMethod()
		{
			if (!SpinCoroutineHelper.TryGetMoveNext("[SkipCoinPlate]", out MethodInfo moveNext, out Type _))
			{
				return null;
			}
			return moveNext;
		}

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Expected O, but got Unknown
			MethodInfo spinsLeftGet = AccessTools.Method(typeof(GameplayData), "SpinsLeftGet", (Type[])null, (Type[])null);
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			bool flag = false;
			val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => CodeInstructionExtensions.Calls(ci, spinsLeftGet)), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => ci.opcode == OpCodes.Ble || ci.opcode == OpCodes.Ble_S), (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => ci.opcode == OpCodes.Br || ci.opcode == OpCodes.Br_S), (string)null)
			});
			if (!val.IsValid)
			{
				PatchLog.WarnOnce("[SkipCoinPlate]:PatternNotFound", "[SkipCoinPlate] Target branch not found; coin plate cinematic will not be skipped.");
				return val.InstructionEnumeration();
			}
			CodeInstruction instruction = val.Instruction;
			Label? label = default(Label?);
			if (!CodeInstructionExtensions.Branches(instruction, ref label))
			{
				return val.InstructionEnumeration();
			}
			val.Advance(-3);
			val.RemoveInstructions(4);
			val.Insert((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(SkipFinalCoinPlatePatch), "LogSkippedCoinPlate", (Type[])null, (Type[])null)),
				new CodeInstruction(instruction.opcode, (object)label)
			});
			if (true)
			{
				PatchLog.InfoOnce("[SkipCoinPlate]:Applied", "[SkipCoinPlate] Removed coin plate cinematic branch on last spin.");
			}
			return val.InstructionEnumeration();
		}

		private static void LogSkippedCoinPlate()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			int num = GameplayData.SpinsLeftGet();
			BigInteger bigInteger = GameplayData.RoundEarnedCoinsGet();
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)string.Format("{0} Bypassing coin plate cinematic (spinsLeft={1}, roundEarned={2}, phase={3}).", "[SkipCoinPlate]", num, bigInteger, GameplayMaster.GetGamePhase()));
			}
		}
	}
	internal static class SkipDebtClearFeature
	{
		internal const string LogPrefix = "[SkipDebtClear]";

		private static readonly Type[] PatchTypes = new Type[13]
		{
			typeof(DebtClearCutsceneStart_Enter),
			typeof(DebtClearCoroutine_MoveNext_Exit),
			typeof(Dialogue_Set2_Prefix),
			typeof(Dialogue_Set3_Prefix),
			typeof(Dialogue_InputDelay_Prefix),
			typeof(Dialogue_IsEnabled_Postfix),
			typeof(RewardBox_IsOpening_Postfix),
			typeof(AlarmRewardBox_IsRinging_Postfix),
			typeof(AlarmRewardBox_AlarmRing_Prefix),
			typeof(PowerupTriggerAnimController_HasAnimations_Postfix),
			typeof(Controls_ActionButton_PressedGet_PlayerIndex_Postfix),
			typeof(Controls_ActionButton_PressedGet_Player_Postfix),
			typeof(PhoneScript_PhoneRing_Prefix)
		};

		internal static void Apply(Harmony harmony)
		{
			Type[] patchTypes = PatchTypes;
			foreach (Type type in patchTypes)
			{
				harmony.PatchAll(type);
			}
		}
	}
	internal static class SkipDebtClearLog
	{
		internal static void Debug(string message)
		{
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)("[SkipDebtClear] " + message));
			}
		}
	}
	internal static class SkipDebtClearState
	{
		private static int depth;

		public static bool Active => depth > 0;

		public static void Enter()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			depth++;
			SkipDebtClearLog.Debug($"Entering debt-clear skip scope (depth={depth}, phase={GameplayMaster.GetGamePhase()}).");
		}

		public static void Exit()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if (depth > 0)
			{
				depth--;
				SkipDebtClearLog.Debug($"Exiting debt-clear skip scope (depth={depth}, phase={GameplayMaster.GetGamePhase()}).");
			}
		}
	}
	[HarmonyPatch(typeof(ATMScript), "DebtClearCutsceneStart")]
	internal static class DebtClearCutsceneStart_Enter
	{
		private static void Prefix()
		{
			SkipDebtClearState.Enter();
		}
	}
	[HarmonyPatch]
	internal static class DebtClearCoroutine_MoveNext_Exit
	{
		private static MethodBase? TargetMethod()
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(ATMScript), "DebtClearCoroutine", (Type[])null, (Type[])null);
			if (!(methodInfo != null))
			{
				return null;
			}
			return AccessTools.EnumeratorMoveNext((MethodBase)methodInfo);
		}

		private static void Postfix(bool __result)
		{
			if (!__result)
			{
				SkipDebtClearLog.Debug("Debt clear coroutine finished; disabling shims.");
				SkipDebtClearState.Exit();
			}
		}
	}
	[HarmonyPatch(typeof(DialogueScript), "SetDialogue", new Type[]
	{
		typeof(List<string>),
		typeof(bool)
	})]
	internal static class Dialogue_Set2_Prefix
	{
		private static bool Prefix()
		{
			if (SkipDebtClearState.Active)
			{
				SkipDebtClearLog.Debug("Skipping DialogueScript.SetDialogue(List) call.");
			}
			return !SkipDebtClearState.Active;
		}
	}
	[HarmonyPatch(typeof(DialogueScript), "SetDialogue", new Type[]
	{
		typeof(bool),
		typeof(string[])
	})]
	internal static class Dialogue_Set3_Prefix
	{
		private static bool Prefix()
		{
			if (SkipDebtClearState.Active)
			{
				SkipDebtClearLog.Debug("Skipping DialogueScript.SetDialogue(params) call.");
			}
			return !SkipDebtClearState.Active;
		}
	}
	[HarmonyPatch(typeof(DialogueScript), "SetDialogueInputDelay")]
	internal static class Dialogue_InputDelay_Prefix
	{
		private static bool Prefix()
		{
			if (SkipDebtClearState.Active)
			{
				SkipDebtClearLog.Debug("Skipping DialogueScript.SetDialogueInputDelay during cutscene.");
			}
			return !SkipDebtClearState.Active;
		}
	}
	[HarmonyPatch(typeof(DialogueScript), "IsEnabled")]
	internal static class Dialogue_IsEnabled_Postfix
	{
		private static void Postfix(ref bool __result)
		{
			if (SkipDebtClearState.Active)
			{
				__result = false;
				SkipDebtClearLog.Debug("Forcing DialogueScript.IsEnabled=false.");
			}
		}
	}
	[HarmonyPatch(typeof(RewardBoxScript), "IsOpening")]
	internal static class RewardBox_IsOpening_Postfix
	{
		private static void Postfix(ref bool __result)
		{
			if (SkipDebtClearState.Active)
			{
				__result = false;
				SkipDebtClearLog.Debug("RewardBoxScript.IsOpening forced false.");
			}
		}
	}
	[HarmonyPatch(typeof(AlarmRewardBox), "IsRinging")]
	internal static class AlarmRewardBox_IsRinging_Postfix
	{
		private static void Postfix(ref bool __result)
		{
			if (SkipDebtClearState.Active)
			{
				__result = false;
				SkipDebtClearLog.Debug("AlarmRewardBox.IsRinging forced false.");
			}
		}
	}
	[HarmonyPatch(typeof(AlarmRewardBox), "AlarmRing")]
	internal static class AlarmRewardBox_AlarmRing_Prefix
	{
		private static bool Prefix()
		{
			bool flag = !SkipDebtClearState.Active;
			if (!flag)
			{
				SkipDebtClearLog.Debug("Skipping alarm ring during debt-clear cutscene.");
			}
			return flag;
		}
	}
	[HarmonyPatch(typeof(PowerupTriggerAnimController), "HasAnimations")]
	internal static class PowerupTriggerAnimController_HasAnimations_Postfix
	{
		private static void Postfix(ref bool __result)
		{
			if (SkipDebtClearState.Active)
			{
				__result = false;
				SkipDebtClearLog.Debug("PowerupTriggerAnimController.HasAnimations forced false.");
			}
		}
	}
	[HarmonyPatch(typeof(Controls), "ActionButton_PressedGet", new Type[]
	{
		typeof(int),
		typeof(InputAction),
		typeof(bool)
	})]
	internal static class Controls_ActionButton_PressedGet_PlayerIndex_Postfix
	{
		private static void Postfix(InputAction action, ref bool __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Controls_InputGateShim.ForceMenuSelect(ref __result, action);
		}
	}
	[HarmonyPatch(typeof(Controls), "ActionButton_PressedGet", new Type[]
	{
		typeof(PlayerExt),
		typeof(InputAction),
		typeof(bool)
	})]
	internal static class Controls_ActionButton_PressedGet_Player_Postfix
	{
		private static void Postfix(InputAction action, ref bool __result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Controls_InputGateShim.ForceMenuSelect(ref __result, action);
		}
	}
	internal static class Controls_InputGateShim
	{
		public static void ForceMenuSelect(ref bool __result, InputAction action)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			if (SkipDebtClearState.Active && (int)action == 4)
			{
				__result = true;
				SkipDebtClearLog.Debug("MenuSelect input gate skipped.");
			}
		}
	}
	[HarmonyPatch(typeof(PhoneScript), "PhoneRing")]
	internal static class PhoneScript_PhoneRing_Prefix
	{
		private static bool Prefix()
		{
			bool flag = !SkipDebtClearState.Active;
			if (!flag)
			{
				SkipDebtClearLog.Debug("Suppressing phone ring during debt-clear cutscene.");
			}
			return flag;
		}
	}
	internal static class SkipInterestsAndTicketsFeature
	{
		private static readonly Type[] PatchTypes = new Type[6]
		{
			typeof(FCall_StopPlaying_Postfix),
			typeof(SetGamePhase_Postfix),
			typeof(Camera_SetPosition_Prefix),
			typeof(Camera_IsNear_Prefix),
			typeof(TicketMachine_IsRunning_Prefix),
			typeof(CutscenePhaseBehaviour_Clamp)
		};

		internal static void Apply(Harmony harmony)
		{
			Type[] patchTypes = PatchTypes;
			foreach (Type type in patchTypes)
			{
				harmony.PatchAll(type);
			}
		}
	}
	internal static class SkipInterestsAndTicketsShim
	{
		internal const string LogPrefix = "[SkipInterestsAndTickets]";

		internal static bool Enabled = true;

		internal static bool Active;

		internal static bool LoggedCutsceneScope;

		private static readonly FieldInfo InterestsAndTicketsTimerF = AccessTools.Field(typeof(GameplayMaster), "interestsAndTicketsTimer");

		private static readonly FieldInfo DelayF = AccessTools.Field(typeof(GameplayMaster), "delay");

		private static readonly FieldInfo InterestsAndTicketsPhaseF = AccessTools.Field(typeof(GameplayMaster), "interestsAndTicketsPhase");

		private static bool InCutscene => (int)GameplayMaster.GetGamePhase() == 1;

		internal static bool ActiveAndAllowed
		{
			get
			{
				if (Enabled && Active && InCutscene)
				{
					return !ATMScript.DebtClearCutsceneIsPlaying();
				}
				return false;
			}
		}

		internal static void PreClamp(GameplayMaster gm)
		{
			if (!ActiveAndAllowed || (Object)(object)gm == (Object)null)
			{
				return;
			}
			if (!LoggedCutsceneScope)
			{
				LogStatus("Entering clamp window", gm);
				LoggedCutsceneScope = true;
			}
			try
			{
				if (MemoScript.IsEnabled())
				{
					MemoScript.Close(false);
				}
			}
			catch
			{
			}
			try
			{
				if (DialogueScript.IsEnabled() && !ATMScript.DebtClearCutsceneIsPlaying())
				{
					DialogueScript.Close();
				}
			}
			catch
			{
			}
			try
			{
				InterestsAndTicketsTimerF?.SetValue(gm, -1f);
			}
			catch
			{
			}
			ZeroPostDelayIfDoneAndNoAnimations(gm);
		}

		internal static void PostClamp(GameplayMaster gm)
		{
			if (ActiveAndAllowed && !((Object)(object)gm == (Object)null))
			{
				try
				{
					InterestsAndTicketsTimerF?.SetValue(gm, -1f);
				}
				catch
				{
				}
				ZeroPostDelayIfDoneAndNoAnimations(gm);
			}
		}

		private static void ZeroPostDelayIfDoneAndNoAnimations(GameplayMaster gm)
		{
			try
			{
				object obj = InterestsAndTicketsPhaseF?.GetValue(gm);
				if (obj != null)
				{
					string a = Enum.GetName(obj.GetType(), obj) ?? string.Empty;
					if (string.Equals(a, "done", StringComparison.OrdinalIgnoreCase) && !PowerupTriggerAnimController.HasAnimations())
					{
						DelayF?.SetValue(gm, 0f);
						LogStatus("Phase done; zeroing delay", gm);
					}
				}
			}
			catch
			{
			}
		}

		private static void LogStatus(string context, GameplayMaster gm)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			string phaseName = GetPhaseName(gm);
			float? num = ReadFloat(InterestsAndTicketsTimerF, gm);
			float? num2 = ReadFloat(DelayF, gm);
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)string.Format("{0} {1} (gamePhase={2}, itPhase={3}, timer={4}, delay={5}, debtClearPlaying={6}).", "[SkipInterestsAndTickets]", context, GameplayMaster.GetGamePhase(), phaseName, num?.ToString() ?? "null", num2?.ToString() ?? "null", ATMScript.DebtClearCutsceneIsPlaying()));
			}
		}

		private static string GetPhaseName(GameplayMaster gm)
		{
			try
			{
				object obj = InterestsAndTicketsPhaseF?.GetValue(gm);
				return (obj == null) ? "unknown" : (Enum.GetName(obj.GetType(), obj) ?? "unnamed");
			}
			catch
			{
				return "error";
			}
		}

		private static float? ReadFloat(FieldInfo field, GameplayMaster gm)
		{
			try
			{
				object obj = field?.GetValue(gm);
				if (obj is float)
				{
					return (float)obj;
				}
			}
			catch
			{
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(GameplayMaster), "FCall_StopPlaying")]
	internal static class FCall_StopPlaying_Postfix
	{
		private static void Postfix()
		{
			if (SkipInterestsAndTicketsShim.Enabled)
			{
				SkipInterestsAndTicketsShim.Active = true;
				SkipInterestsAndTicketsShim.LoggedCutsceneScope = false;
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)"[SkipInterestsAndTickets] Activated Interests & Tickets skip scope.");
				}
			}
		}
	}
	[HarmonyPatch(typeof(GameplayMaster), "SetGamePhase")]
	internal static class SetGamePhase_Postfix
	{
		private static void Postfix(GamePhase phase)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			bool active = SkipInterestsAndTicketsShim.Active;
			if ((int)phase != 3)
			{
				return;
			}
			SkipInterestsAndTicketsShim.Active = false;
			SkipInterestsAndTicketsShim.LoggedCutsceneScope = false;
			if (active)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)"[SkipInterestsAndTickets] Deactivated skip scope on preparation.");
				}
			}
		}
	}
	[HarmonyPatch(typeof(CameraController), "SetPosition")]
	internal static class Camera_SetPosition_Prefix
	{
		private static void Prefix([HarmonyArgument(0)] PositionKind kind, [HarmonyArgument(1)] ref bool immediate, [HarmonyArgument(2)] ref float lerpSpeedMultiplier)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (SkipInterestsAndTicketsShim.ActiveAndAllowed)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)string.Format("{0} Snapping camera to {1} (immediate lerp).", "[SkipInterestsAndTickets]", kind));
				}
				immediate = true;
				lerpSpeedMultiplier = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(CameraController), "IsCameraNearPositionAndAngle")]
	internal static class Camera_IsNear_Prefix
	{
		private static bool Prefix(ref bool __result)
		{
			if (!SkipInterestsAndTicketsShim.ActiveAndAllowed)
			{
				return true;
			}
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)"[SkipInterestsAndTickets] Forcing camera near-position gate true.");
			}
			__result = true;
			return false;
		}
	}
	[HarmonyPatch(typeof(TicketMachineScript), "IsTicketMachineRunning")]
	internal static class TicketMachine_IsRunning_Prefix
	{
		private static bool Prefix(ref bool __result)
		{
			if (!SkipInterestsAndTicketsShim.ActiveAndAllowed)
			{
				return true;
			}
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)"[SkipInterestsAndTickets] Pretending ticket machine is idle.");
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(GameplayMaster), "CutscenePhaseBehaviour")]
	internal static class CutscenePhaseBehaviour_Clamp
	{
		private static void Prefix(GameplayMaster __instance)
		{
			if (!ATMScript.DebtClearCutsceneIsPlaying())
			{
				SkipInterestsAndTicketsShim.PreClamp(__instance);
			}
		}

		private static void Postfix(GameplayMaster __instance)
		{
			if (!ATMScript.DebtClearCutsceneIsPlaying())
			{
				SkipInterestsAndTicketsShim.PostClamp(__instance);
			}
		}
	}
	internal static class SkipNoMoreSpinsFeature
	{
		internal const string LogPrefix = "[SkipNoMoreSpins]";

		internal static void Apply(Harmony harmony)
		{
			harmony.PatchAll(typeof(SetNoMoreSpins_SkipPatch));
			harmony.PatchAll(typeof(MemoScript_SkipRoundsLeftMemo_Patch));
		}
	}
	[HarmonyPatch(typeof(SlotMachineScript), "Set_NoMoreSpins")]
	internal static class SetNoMoreSpins_SkipPatch
	{
		private static bool Prefix(SlotMachineScript __instance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)string.Format("{0} Skipping Set_NoMoreSpins visuals (phase={1}, spinsLeft={2}, roundEarned={3}).", "[SkipNoMoreSpins]", GameplayMaster.GetGamePhase(), GameplayData.SpinsLeftGet(), GameplayData.RoundEarnedCoinsGet()));
			}
			SlotMachineScript.StateSet((State)2);
			FieldInfo fieldInfo = AccessTools.Field(typeof(SlotMachineScript), "OnRoundEnd");
			Event val = (Event)fieldInfo.GetValue(__instance);
			if (val != null)
			{
				val.Invoke();
			}
			__instance.TurnOff(false);
			FieldInfo fieldInfo2 = AccessTools.Field(typeof(SlotMachineScript), "noMoreCoinsCoroutine");
			if (fieldInfo2 != null)
			{
				fieldInfo2.SetValue(__instance, null);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(MemoScript), "SetMessage")]
	internal static class MemoScript_SkipRoundsLeftMemo_Patch
	{
		private static bool Prefix(Message message, float time)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((int)message == 0)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)"[SkipNoMoreSpins] Suppressing rounds-left memo during no-more-spins skip.");
				}
				return false;
			}
			return true;
		}
	}
	internal static class UnlockTransitionSpeedFeature
	{
		private sealed class UnlockTransitionSpeedInitGuard : MonoBehaviour
		{
			private IEnumerator Start()
			{
				float timeout = 20f;
				while (!PlatformMaster.IsInitialized() && timeout > 0f)
				{
					timeout -= Time.unscaledDeltaTime;
					yield return null;
				}
				if (!PlatformMaster.IsInitialized())
				{
					ManualLogSource log = CloverclockedPlugin.Log;
					if (log != null)
					{
						log.LogWarning((object)"[UnlockTransitionSpeed] PlatformMaster never initialized (timeout). Patching anyway.");
					}
				}
				ApplyInternal();
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		internal static readonly int[] AllowedSpeeds = new int[6] { 1, 2, 3, 4, 8, 16 };

		private static Harmony? _harmony;

		private static bool _patched;

		private static bool _patchQueued;

		internal static void Apply(Harmony harmony)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			_harmony = harmony;
			if (PlatformMaster.IsInitialized())
			{
				ApplyInternal();
			}
			else if (!_patchQueued)
			{
				_patchQueued = true;
				GameObject val = new GameObject("Cloverclocked.UnlockTransitionSpeed.InitGuard")
				{
					hideFlags = (HideFlags)61
				};
				Object.DontDestroyOnLoad((Object)(object)val);
				val.AddComponent<UnlockTransitionSpeedInitGuard>();
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)"[UnlockTransitionSpeed] Waiting for PlatformMaster initialization before patching.");
				}
			}
		}

		private static void ApplyInternal()
		{
			if (!_patched && _harmony != null)
			{
				_harmony.PatchAll(typeof(MainMenuScript_TransitionSpeedPatch));
				_harmony.PatchAll(typeof(SettingsData_TransitionSpeedMappedPatch));
				_patched = true;
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)"[UnlockTransitionSpeed] Patches applied after PlatformMaster initialization.");
				}
			}
		}

		internal static int CycleSpeed(int current, int direction)
		{
			if (direction == 0)
			{
				return current;
			}
			int[] allowedSpeeds = AllowedSpeeds;
			int num = Array.IndexOf(allowedSpeeds, current);
			if (num < 0)
			{
				int num2 = 0;
				int num3 = int.MaxValue;
				for (int i = 0; i < allowedSpeeds.Length; i++)
				{
					int num4 = Math.Abs(allowedSpeeds[i] - current);
					if (num4 < num3)
					{
						num3 = num4;
						num2 = i;
					}
				}
				num = num2;
			}
			int num5 = allowedSpeeds.Length;
			int num6 = (num + direction) % num5;
			if (num6 < 0)
			{
				num6 += num5;
			}
			return allowedSpeeds[num6];
		}
	}
	[HarmonyPatch(typeof(MainMenuScript), "MFunc_TransitionSpeed")]
	internal static class MainMenuScript_TransitionSpeedPatch
	{
		private static readonly FieldInfo SaveSettingsOnCloseField = AccessTools.Field(typeof(MainMenuScript), "saveSettingsOnClose");

		private static bool Prefix(MainMenuScript __instance, int _selectionDirection, bool saveSettingsWhenClosing)
		{
			Sound.Play("SoundMenuSelect", 1f, 1f);
			SettingsData settings = Data.settings;
			settings.transitionSpeed = UnlockTransitionSpeedFeature.CycleSpeed(settings.transitionSpeed, _selectionDirection);
			if (SaveSettingsOnCloseField != null)
			{
				SaveSettingsOnCloseField.SetValue(__instance, saveSettingsWhenClosing);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(SettingsData), "TransitionSpeedMapped_Get")]
	internal static class SettingsData_TransitionSpeedMappedPatch
	{
		private static bool Prefix(ref float __result, float from, float fromMin, float fromMax, float toMin, float toMax)
		{
			__result = from;
			return false;
		}
	}
}
namespace Cloverclocked.Helpers
{
	internal static class TransitionSpeedSafety
	{
		private sealed class TransitionSpeedSafetyGuard : MonoBehaviour
		{
			private IEnumerator Start()
			{
				float timeout = 20f;
				while (!PlatformMaster.IsInitialized() && timeout > 0f)
				{
					timeout -= Time.unscaledDeltaTime;
					yield return null;
				}
				if (!PlatformMaster.IsInitialized())
				{
					ManualLogSource log = CloverclockedPlugin.Log;
					if (log != null)
					{
						log.LogWarning((object)"[TransitionSpeedSafety] PlatformMaster never initialized (timeout). Clamping transition speed anyway.");
					}
				}
				ClampToVanillaRange();
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		private const int VanillaMaxSpeed = 4;

		private static bool _scheduled;

		internal static void ScheduleVanillaClampIfNeeded(bool unlockFeatureEnabled)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			if (unlockFeatureEnabled || _scheduled)
			{
				return;
			}
			_scheduled = true;
			if (PlatformMaster.IsInitialized())
			{
				ClampToVanillaRange();
				return;
			}
			GameObject val = new GameObject("Cloverclocked.TransitionSpeedSafety")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)(object)val);
			val.AddComponent<TransitionSpeedSafetyGuard>();
			ManualLogSource log = CloverclockedPlugin.Log;
			if (log != null)
			{
				log.LogDebug((object)"[TransitionSpeedSafety] Waiting for PlatformMaster before clamping transition speed.");
			}
		}

		private static void ClampToVanillaRange()
		{
			SettingsData settings = Data.settings;
			if (settings == null)
			{
				ManualLogSource log = CloverclockedPlugin.Log;
				if (log != null)
				{
					log.LogDebug((object)"[TransitionSpeedSafety] Data.settings unavailable; skipping clamp.");
				}
				return;
			}
			int transitionSpeed = settings.transitionSpeed;
			if (transitionSpeed > 4)
			{
				int num = (settings.transitionSpeed = Mathf.Clamp(transitionSpeed, 1, 4));
				ManualLogSource log2 = CloverclockedPlugin.Log;
				if (log2 != null)
				{
					log2.LogWarning((object)$"UnlockTransitionSpeed is disabled, but transition speed was x{transitionSpeed}. Reset to x{num} to avoid instability.");
				}
			}
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}