Decompiled source of DevTools v2.2.0

DevTools.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FMOD.Studio;
using FMODUnity;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("DevTools")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6597124f3d9808bcb8d5c162aab174149552ee8d")]
[assembly: AssemblyProduct("DevTools")]
[assembly: AssemblyTitle("DevTools")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DevTools
{
	[BepInPlugin("com.certifired.DevTools", "DevTools", "2.2.0")]
	public class DevToolsPlugin : BaseUnityPlugin
	{
		private const string MyGUID = "com.certifired.DevTools";

		private const string PluginName = "DevTools";

		private const string VersionString = "2.2.0";

		private static readonly Harmony Harmony = new Harmony("com.certifired.DevTools");

		public static ManualLogSource Log;

		public static ConfigEntry<KeyCode> GuiToggleKey;

		public static ConfigEntry<bool> ShowGui;

		public static ConfigEntry<bool> InfiniteCrafting;

		public static ConfigEntry<bool> MaxPower;

		public static ConfigEntry<bool> UltraPickaxe;

		public static ConfigEntry<bool> FasterMole;

		public static ConfigEntry<bool> DisableEncumbrance;

		public static ConfigEntry<bool> ShowDebugCoords;

		public static ConfigEntry<bool> HideMachineLights;

		public static ConfigEntry<bool> HideMachineParticles;

		public static ConfigEntry<float> SimSpeed;

		public static ConfigEntry<int> FreeCameraMode;

		public static ConfigEntry<bool> AllDoorsUnlocked;

		public static ConfigEntry<bool> MoleBitsAlwaysAvailable;

		public static ConfigEntry<bool> InfiniteOre;

		public static ConfigEntry<int> PlayerSpeedPercent;

		public static ConfigEntry<int> MoleSpeedPercent;

		public static ConfigEntry<int> SmelterSpeedPercent;

		public static ConfigEntry<int> AssemblerSpeedPercent;

		public static ConfigEntry<int> ThresherSpeedPercent;

		public static ConfigEntry<int> PlanterSpeedPercent;

		public static ConfigEntry<int> FuelConsumptionPercent;

		public static ConfigEntry<int> PowerConsumptionPercent;

		public static ConfigEntry<int> PowerGenerationPercent;

		public static ConfigEntry<int> InserterBaseStackSize;

		public static ConfigEntry<bool> CatSounds;

		public static ConfigEntry<bool> RainbowCores;

		public static ConfigEntry<bool> PlaceholderVoice;

		private static bool isInitialized = false;

		private static bool settingsApplied = false;

		private static float rainbowHue = 0f;

		private static bool guiVisible = false;

		private static Rect windowRect = new Rect(20f, 20f, 420f, 600f);

		private static Vector2 scrollPosition = Vector2.zero;

		private static int currentTab = 0;

		private static string[] tabNames = new string[5] { "Player", "Game Mode", "Machines", "Power", "Special" };

		private static GUIStyle headerStyle;

		private static GUIStyle boxStyle;

		private static bool stylesInitialized = false;

		private static string simSpeedInput = "1";

		private static string playerSpeedInput = "100";

		private static string moleSpeedInput = "100";

		private static string smelterSpeedInput = "100";

		private static string assemblerSpeedInput = "100";

		private static string thresherSpeedInput = "100";

		private static string planterSpeedInput = "100";

		private static string fuelConsumptionInput = "100";

		private static string powerConsumptionInput = "100";

		private static string powerGenerationInput = "100";

		private static string inserterStackInput = "1";

		private void Awake()
		{
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Expected O, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Expected O, but got Unknown
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Expected O, but got Unknown
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Expected O, but got Unknown
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Expected O, but got Unknown
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Expected O, but got Unknown
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Expected O, but got Unknown
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Expected O, but got Unknown
			//IL_05ea: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"PluginName: DevTools, VersionString: 2.2.0 is loading...");
			GuiToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("GUI", "Toggle Key", (KeyCode)277, "Key to toggle the DevTools GUI");
			ShowGui = ((BaseUnityPlugin)this).Config.Bind<bool>("GUI", "Show GUI", false, "Whether the GUI is currently visible");
			InfiniteCrafting = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Infinite Crafting", false, "Build machines without consuming resources");
			MaxPower = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Max Power", false, "All machines operate at full power regardless of network status");
			UltraPickaxe = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Ultra Pickaxe", false, "Enhanced mining speed and power");
			FasterMole = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Faster MOLE", false, "MOLE operates at 4x speed");
			DisableEncumbrance = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Disable Encumbrance", false, "Remove weight/inventory limits");
			ShowDebugCoords = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Show Debug Coordinates", false, "Display debug position information");
			HideMachineLights = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Hide Machine Lights", false, "Disable machine light effects (performance)");
			HideMachineParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("PlayerCheats", "Hide Machine Particles", false, "Disable machine particle effects (performance)");
			SimSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("PlayerCheats", "Simulation Speed", 1f, new ConfigDescription("Game simulation speed multiplier", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>()));
			FreeCameraMode = ((BaseUnityPlugin)this).Config.Bind<int>("PlayerCheats", "Free Camera Mode", 0, new ConfigDescription("Camera mode: 0=Normal, 1=Free, 2=ScriptedAnimation, 3=Benchmark, 4=CheatAnimation", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 4), Array.Empty<object>()));
			AllDoorsUnlocked = ((BaseUnityPlugin)this).Config.Bind<bool>("GameModeSettings", "All Doors Unlocked", false, "Unlock all doors in the game");
			MoleBitsAlwaysAvailable = ((BaseUnityPlugin)this).Config.Bind<bool>("GameModeSettings", "MOLE Bits Always Available", false, "All MOLE drill bits are always accessible");
			InfiniteOre = ((BaseUnityPlugin)this).Config.Bind<bool>("GameModeSettings", "Infinite Ore", false, "Ore veins never deplete");
			PlayerSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<int>("GameModeSettings", "Player Speed Percent", 100, new ConfigDescription("Player movement speed percentage (100 = normal)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			MoleSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<int>("GameModeSettings", "MOLE Speed Percent", 100, new ConfigDescription("MOLE digging speed percentage (100 = normal)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			SmelterSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<int>("MachineSettings", "Smelter Speed Percent", 100, new ConfigDescription("Smelter crafting speed percentage (100 = normal)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			AssemblerSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<int>("MachineSettings", "Assembler Speed Percent", 100, new ConfigDescription("Assembler crafting speed percentage (100 = normal)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			ThresherSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<int>("MachineSettings", "Thresher Speed Percent", 100, new ConfigDescription("Thresher processing speed percentage (100 = normal)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			PlanterSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<int>("MachineSettings", "Planter Speed Percent", 100, new ConfigDescription("Planter growth speed percentage (100 = normal)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			FuelConsumptionPercent = ((BaseUnityPlugin)this).Config.Bind<int>("PowerSettings", "Fuel Consumption Percent", 100, new ConfigDescription("Fuel consumption percentage (lower = less fuel used)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 500), Array.Empty<object>()));
			PowerConsumptionPercent = ((BaseUnityPlugin)this).Config.Bind<int>("PowerSettings", "Power Consumption Percent", 100, new ConfigDescription("Power consumption percentage (lower = less power used)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 500), Array.Empty<object>()));
			PowerGenerationPercent = ((BaseUnityPlugin)this).Config.Bind<int>("PowerSettings", "Power Generation Percent", 100, new ConfigDescription("Power generation percentage (higher = more power)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(50, 1000), Array.Empty<object>()));
			InserterBaseStackSize = ((BaseUnityPlugin)this).Config.Bind<int>("MachineSettings", "Inserter Base Stack Size", 1, new ConfigDescription("Base stack size for inserters", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			CatSounds = ((BaseUnityPlugin)this).Config.Bind<bool>("SpecialCheats", "Cat Sounds", false, "Replace machine sounds with cat meowing (FMOD Cat Cheat parameter)");
			RainbowCores = ((BaseUnityPlugin)this).Config.Bind<bool>("SpecialCheats", "Rainbow Cores", false, "Memory Tree cores cycle through rainbow colors");
			PlaceholderVoice = ((BaseUnityPlugin)this).Config.Bind<bool>("SpecialCheats", "Placeholder Voice", false, "Enable placeholder voice lines (developer audio)");
			simSpeedInput = SimSpeed.Value.ToString("F1");
			playerSpeedInput = PlayerSpeedPercent.Value.ToString();
			moleSpeedInput = MoleSpeedPercent.Value.ToString();
			smelterSpeedInput = SmelterSpeedPercent.Value.ToString();
			assemblerSpeedInput = AssemblerSpeedPercent.Value.ToString();
			thresherSpeedInput = ThresherSpeedPercent.Value.ToString();
			planterSpeedInput = PlanterSpeedPercent.Value.ToString();
			fuelConsumptionInput = FuelConsumptionPercent.Value.ToString();
			powerConsumptionInput = PowerConsumptionPercent.Value.ToString();
			powerGenerationInput = PowerGenerationPercent.Value.ToString();
			inserterStackInput = InserterBaseStackSize.Value.ToString();
			guiVisible = ShowGui.Value;
			Harmony.PatchAll();
			Log.LogInfo((object)"PluginName: DevTools, VersionString: 2.2.0 is loaded.");
			Log.LogInfo((object)$"Press {GuiToggleKey.Value} to toggle the DevTools GUI");
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(GuiToggleKey.Value))
			{
				guiVisible = !guiVisible;
				ShowGui.Value = guiVisible;
				Log.LogInfo((object)("DevTools GUI " + (guiVisible ? "opened" : "closed")));
			}
			if ((Object)(object)Player.instance != (Object)null && (Object)(object)Player.instance.cheats != (Object)null)
			{
				ApplyPlayerCheats();
				if (!isInitialized)
				{
					isInitialized = true;
					Log.LogInfo((object)"DevTools initialized - PlayerCheats active");
				}
			}
			if (GameState.instance != null)
			{
				ApplyGameModeSettings();
				if (!settingsApplied)
				{
					settingsApplied = true;
					Log.LogInfo((object)"DevTools applied game mode settings");
				}
			}
			ApplyCatSounds();
			if (RainbowCores.Value)
			{
				UpdateRainbowCores();
			}
		}

		private void OnGUI()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (guiVisible)
			{
				InitStyles();
				windowRect = GUILayout.Window(12345, windowRect, new WindowFunction(DrawWindow), "DevTools v2.2.0", Array.Empty<GUILayoutOption>());
				((Rect)(ref windowRect)).x = Mathf.Clamp(((Rect)(ref windowRect)).x, 0f, (float)Screen.width - ((Rect)(ref windowRect)).width);
				((Rect)(ref windowRect)).y = Mathf.Clamp(((Rect)(ref windowRect)).y, 0f, (float)Screen.height - ((Rect)(ref windowRect)).height);
			}
		}

		private void InitStyles()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0076: Expected O, but got Unknown
			if (!stylesInitialized)
			{
				headerStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				headerStyle.normal.textColor = Color.cyan;
				boxStyle = new GUIStyle(GUI.skin.box)
				{
					padding = new RectOffset(10, 10, 10, 10)
				};
				stylesInitialized = true;
			}
		}

		private void DrawWindow(int windowId)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < tabNames.Length; i++)
			{
				GUI.color = ((currentTab == i) ? Color.cyan : Color.white);
				if (GUILayout.Button(tabNames[i], (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
				{
					currentTab = i;
				}
			}
			GUI.color = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(480f) });
			switch (currentTab)
			{
			case 0:
				DrawPlayerTab();
				break;
			case 1:
				DrawGameModeTab();
				break;
			case 2:
				DrawMachinesTab();
				break;
			case 3:
				DrawPowerTab();
				break;
			case 4:
				DrawSpecialTab();
				break;
			}
			GUILayout.EndScrollView();
			GUILayout.Space(5f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Press {GuiToggleKey.Value} to toggle", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }))
			{
				guiVisible = false;
				ShowGui.Value = false;
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
		}

		private void DrawPlayerTab()
		{
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Player Cheats", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.BeginVertical(boxStyle, Array.Empty<GUILayoutOption>());
			InfiniteCrafting.Value = GUILayout.Toggle(InfiniteCrafting.Value, " Infinite Crafting", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Build machines without consuming resources", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			MaxPower.Value = GUILayout.Toggle(MaxPower.Value, " Max Power", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  All machines operate at full power", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			UltraPickaxe.Value = GUILayout.Toggle(UltraPickaxe.Value, " Ultra Pickaxe", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Enhanced mining speed and power", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			FasterMole.Value = GUILayout.Toggle(FasterMole.Value, " Faster MOLE", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  MOLE operates at 4x speed", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			DisableEncumbrance.Value = GUILayout.Toggle(DisableEncumbrance.Value, " Disable Encumbrance", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Remove weight/inventory limits", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			ShowDebugCoords.Value = GUILayout.Toggle(ShowDebugCoords.Value, " Show Debug Coordinates", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Display debug position information", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			HideMachineLights.Value = GUILayout.Toggle(HideMachineLights.Value, " Hide Machine Lights", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Disable machine light effects (performance)", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			HideMachineParticles.Value = GUILayout.Toggle(HideMachineParticles.Value, " Hide Machine Particles", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Disable machine particle effects (performance)", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUILayout.Label($"Simulation Speed: {SimSpeed.Value:F1}x", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			SimSpeed.Value = GUILayout.HorizontalSlider(SimSpeed.Value, 0.1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			simSpeedInput = GUILayout.TextField(simSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (float.TryParse(simSpeedInput, out var result))
				{
					SimSpeed.Value = Mathf.Clamp(result, 0.1f, 10f);
				}
				simSpeedInput = SimSpeed.Value.ToString("F1");
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label($"Free Camera Mode: {FreeCameraMode.Value}", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			string[] array = new string[5] { "Normal", "Free", "Scripted", "Benchmark", "Cheat" };
			for (int i = 0; i < array.Length; i++)
			{
				GUI.color = ((FreeCameraMode.Value == i) ? Color.green : Color.white);
				if (GUILayout.Button(array[i], Array.Empty<GUILayoutOption>()))
				{
					FreeCameraMode.Value = i;
				}
			}
			GUI.color = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void DrawGameModeTab()
		{
			GUILayout.Label("Game Mode Settings", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.BeginVertical(boxStyle, Array.Empty<GUILayoutOption>());
			AllDoorsUnlocked.Value = GUILayout.Toggle(AllDoorsUnlocked.Value, " All Doors Unlocked", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Unlock all doors in the game", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			MoleBitsAlwaysAvailable.Value = GUILayout.Toggle(MoleBitsAlwaysAvailable.Value, " MOLE Bits Always Available", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  All MOLE drill bits are accessible", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			InfiniteOre.Value = GUILayout.Toggle(InfiniteOre.Value, " Infinite Ore", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Ore veins never deplete", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(15f);
			GUILayout.Label($"Player Speed: {PlayerSpeedPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			PlayerSpeedPercent.Value = (int)GUILayout.HorizontalSlider((float)PlayerSpeedPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			playerSpeedInput = GUILayout.TextField(playerSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(playerSpeedInput, out var result))
				{
					PlayerSpeedPercent.Value = Mathf.Clamp(result, 50, 1000);
				}
				playerSpeedInput = PlayerSpeedPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label($"MOLE Speed: {MoleSpeedPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			MoleSpeedPercent.Value = (int)GUILayout.HorizontalSlider((float)MoleSpeedPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			moleSpeedInput = GUILayout.TextField(moleSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(moleSpeedInput, out var result2))
				{
					MoleSpeedPercent.Value = Mathf.Clamp(result2, 50, 1000);
				}
				moleSpeedInput = MoleSpeedPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void DrawMachinesTab()
		{
			GUILayout.Label("Machine Settings", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.BeginVertical(boxStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Smelter Speed: {SmelterSpeedPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			SmelterSpeedPercent.Value = (int)GUILayout.HorizontalSlider((float)SmelterSpeedPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			smelterSpeedInput = GUILayout.TextField(smelterSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(smelterSpeedInput, out var result))
				{
					SmelterSpeedPercent.Value = Mathf.Clamp(result, 50, 1000);
				}
				smelterSpeedInput = SmelterSpeedPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label($"Assembler Speed: {AssemblerSpeedPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			AssemblerSpeedPercent.Value = (int)GUILayout.HorizontalSlider((float)AssemblerSpeedPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			assemblerSpeedInput = GUILayout.TextField(assemblerSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(assemblerSpeedInput, out var result2))
				{
					AssemblerSpeedPercent.Value = Mathf.Clamp(result2, 50, 1000);
				}
				assemblerSpeedInput = AssemblerSpeedPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label($"Thresher Speed: {ThresherSpeedPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			ThresherSpeedPercent.Value = (int)GUILayout.HorizontalSlider((float)ThresherSpeedPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			thresherSpeedInput = GUILayout.TextField(thresherSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(thresherSpeedInput, out var result3))
				{
					ThresherSpeedPercent.Value = Mathf.Clamp(result3, 50, 1000);
				}
				thresherSpeedInput = ThresherSpeedPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(10f);
			GUILayout.Label($"Planter Speed: {PlanterSpeedPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			PlanterSpeedPercent.Value = (int)GUILayout.HorizontalSlider((float)PlanterSpeedPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			planterSpeedInput = GUILayout.TextField(planterSpeedInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(planterSpeedInput, out var result4))
				{
					PlanterSpeedPercent.Value = Mathf.Clamp(result4, 50, 1000);
				}
				planterSpeedInput = PlanterSpeedPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(15f);
			GUILayout.Label($"Inserter Base Stack Size: {InserterBaseStackSize.Value}", Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			InserterBaseStackSize.Value = (int)GUILayout.HorizontalSlider((float)InserterBaseStackSize.Value, 1f, 100f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			inserterStackInput = GUILayout.TextField(inserterStackInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(inserterStackInput, out var result5))
				{
					InserterBaseStackSize.Value = Mathf.Clamp(result5, 1, 100);
				}
				inserterStackInput = InserterBaseStackSize.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void DrawPowerTab()
		{
			GUILayout.Label("Power Settings", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.BeginVertical(boxStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Fuel Consumption: {FuelConsumptionPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Lower = less fuel used", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			FuelConsumptionPercent.Value = (int)GUILayout.HorizontalSlider((float)FuelConsumptionPercent.Value, 10f, 500f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			fuelConsumptionInput = GUILayout.TextField(fuelConsumptionInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(fuelConsumptionInput, out var result))
				{
					FuelConsumptionPercent.Value = Mathf.Clamp(result, 10, 500);
				}
				fuelConsumptionInput = FuelConsumptionPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(15f);
			GUILayout.Label($"Power Consumption: {PowerConsumptionPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Lower = less power used", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			PowerConsumptionPercent.Value = (int)GUILayout.HorizontalSlider((float)PowerConsumptionPercent.Value, 10f, 500f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			powerConsumptionInput = GUILayout.TextField(powerConsumptionInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(powerConsumptionInput, out var result2))
				{
					PowerConsumptionPercent.Value = Mathf.Clamp(result2, 10, 500);
				}
				powerConsumptionInput = PowerConsumptionPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.Space(15f);
			GUILayout.Label($"Power Generation: {PowerGenerationPercent.Value}%", Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Higher = more power generated", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			PowerGenerationPercent.Value = (int)GUILayout.HorizontalSlider((float)PowerGenerationPercent.Value, 50f, 1000f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(280f) });
			powerGenerationInput = GUILayout.TextField(powerGenerationInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) });
			if (GUILayout.Button("Set", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
			{
				if (int.TryParse(powerGenerationInput, out var result3))
				{
					PowerGenerationPercent.Value = Mathf.Clamp(result3, 50, 1000);
				}
				powerGenerationInput = PowerGenerationPercent.Value.ToString();
			}
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}

		private void DrawSpecialTab()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Special Cheats", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.BeginVertical(boxStyle, Array.Empty<GUILayoutOption>());
			GUI.color = (CatSounds.Value ? Color.yellow : Color.white);
			CatSounds.Value = GUILayout.Toggle(CatSounds.Value, " \ud83d\udc31 Cat Sounds", Array.Empty<GUILayoutOption>());
			GUI.color = Color.white;
			GUILayout.Label("  Replace machine sounds with cat meowing", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Uses FMOD 'Cat Cheat' parameter", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			GUI.color = (RainbowCores.Value ? Color.magenta : Color.white);
			RainbowCores.Value = GUILayout.Toggle(RainbowCores.Value, " \ud83c\udf08 Rainbow Cores", Array.Empty<GUILayoutOption>());
			GUI.color = Color.white;
			GUILayout.Label("  Memory Tree cores cycle through rainbow colors", GUI.skin.label, Array.Empty<GUILayoutOption>());
			if (RainbowCores.Value)
			{
				Color rainbowColor = GetRainbowColor();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("  Current color: ", Array.Empty<GUILayoutOption>());
				GUI.color = rainbowColor;
				GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(50f),
					GUILayout.Height(20f)
				});
				GUI.color = Color.white;
				GUILayout.EndHorizontal();
			}
			GUILayout.Space(10f);
			GUI.color = (PlaceholderVoice.Value ? Color.cyan : Color.white);
			PlaceholderVoice.Value = GUILayout.Toggle(PlaceholderVoice.Value, " \ud83c\udfa4 Placeholder Voice", Array.Empty<GUILayoutOption>());
			GUI.color = Color.white;
			GUILayout.Label("  Enable developer placeholder voice lines", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Label("  Hear the original temp audio recordings!", GUI.skin.label, Array.Empty<GUILayoutOption>());
			GUILayout.Space(20f);
			GUILayout.Label("Status", headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.Label("Player Cheats: " + (isInitialized ? "Active ✓" : "Waiting..."), Array.Empty<GUILayoutOption>());
			GUILayout.Label("Game Mode Settings: " + (settingsApplied ? "Applied ✓" : "Waiting..."), Array.Empty<GUILayoutOption>());
			if (RainbowCores.Value)
			{
				GUILayout.Label($"Rainbow Hue: {rainbowHue:F2}", Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
		}

		private void ApplyPlayerCheats()
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			PlayerCheats val = Player.instance?.cheats;
			if (!((Object)(object)val == (Object)null))
			{
				val.infiniteCrafting = InfiniteCrafting.Value;
				val.maxPower = MaxPower.Value;
				val.ultraPickaxe = UltraPickaxe.Value;
				val.fasterMole = FasterMole.Value;
				val.disableEncumbrance = DisableEncumbrance.Value;
				val.showDebugCoords = ShowDebugCoords.Value;
				val.hideMachineLights = HideMachineLights.Value;
				val.hideMachineParticles = HideMachineParticles.Value;
				val.simSpeed = SimSpeed.Value;
				val.freeCameraMode = (FreeCameraMode)FreeCameraMode.Value;
			}
		}

		private void ApplyGameModeSettings()
		{
			try
			{
				ref GameInstanceSettings gameModeSettings = ref GameState.instance.gameModeSettings;
				if (gameModeSettings.Values != null)
				{
					SetBoolSetting(ref gameModeSettings, (EGameModeSettingType)2, AllDoorsUnlocked.Value);
					SetBoolSetting(ref gameModeSettings, (EGameModeSettingType)5, CatSounds.Value);
					SetBoolSetting(ref gameModeSettings, (EGameModeSettingType)29, MoleBitsAlwaysAvailable.Value);
					SetBoolSetting(ref gameModeSettings, (EGameModeSettingType)16, InfiniteOre.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)20, PlayerSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)27, MoleSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)12, FuelConsumptionPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)13, PowerConsumptionPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)14, PowerGenerationPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)39, SmelterSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)42, SmelterSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)46, AssemblerSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)49, AssemblerSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)54, ThresherSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)56, ThresherSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)52, PlanterSpeedPercent.Value);
					SetIntSetting(ref gameModeSettings, (EGameModeSettingType)15, InserterBaseStackSize.Value);
				}
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Failed to apply game mode settings: " + ex.Message));
			}
		}

		private static void SetBoolSetting(ref GameInstanceSettings settings, EGameModeSettingType settingType, bool value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Expected I4, but got Unknown
			try
			{
				int num = (int)settingType;
				if (num >= 0 && num < settings.Values.Length)
				{
					settings.Values[num].BoolValue = value;
				}
			}
			catch
			{
			}
		}

		private static void SetIntSetting(ref GameInstanceSettings settings, EGameModeSettingType settingType, int value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Expected I4, but got Unknown
			try
			{
				int num = (int)settingType;
				if (num >= 0 && num < settings.Values.Length)
				{
					settings.Values[num].IntValue = value;
				}
			}
			catch
			{
			}
		}

		private static void ApplyCatSounds()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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)
			try
			{
				System studioSystem = RuntimeManager.StudioSystem;
				((System)(ref studioSystem)).setParameterByName("Cat Cheat", CatSounds.Value ? 1f : 0f, false);
			}
			catch
			{
			}
		}

		private void UpdateRainbowCores()
		{
			rainbowHue += Time.deltaTime * 0.2f;
			if (rainbowHue > 1f)
			{
				rainbowHue = 0f;
			}
		}

		public static Color GetRainbowColor()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return Color.HSVToRGB(rainbowHue, 1f, 1f);
		}

		public static float GetRainbowHue()
		{
			return rainbowHue;
		}
	}
	[HarmonyPatch]
	internal static class DevToolsPatches
	{
		[HarmonyPatch(typeof(MemoryTreeInstance), "SimUpdate")]
		[HarmonyPostfix]
		private static void ApplyRainbowCores(ref MemoryTreeInstance __instance)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (!DevToolsPlugin.RainbowCores.Value)
			{
				return;
			}
			try
			{
				GameObject refGameObj = __instance.commonInfo.refGameObj;
				if ((Object)(object)refGameObj == (Object)null)
				{
					return;
				}
				MeshRenderer[] componentsInChildren = refGameObj.GetComponentsInChildren<MeshRenderer>(true);
				Color rainbowColor = DevToolsPlugin.GetRainbowColor();
				MeshRenderer[] array = componentsInChildren;
				foreach (MeshRenderer val in array)
				{
					Material[] materials = ((Renderer)val).materials;
					Material[] array2 = materials;
					foreach (Material val2 in array2)
					{
						if (val2.HasProperty("_EmissionColor"))
						{
							val2.EnableKeyword("_EMISSION");
							val2.SetColor("_EmissionColor", rainbowColor * 2f);
						}
					}
				}
			}
			catch
			{
			}
		}
	}
}