Decompiled source of CheatMenuPlus v1.5.5

BepInEx\plugins\CheatMenuPlus\CheatMenu.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon;
using Pigeon.Math;
using Pigeon.Movement;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("CheatMenu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0.2+36858bab7df4ebf0639a01f16939f1b855b19909")]
[assembly: AssemblyProduct("CheatMenu+")]
[assembly: AssemblyTitle("CheatMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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;
		}
	}
}
public static class CheatsMenu
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__6_0;

		public static UnityAction <>9__6_1;

		public static UnityAction <>9__6_2;

		public static UnityAction <>9__6_3;

		public static UnityAction <>9__6_4;

		public static UnityAction <>9__6_5;

		public static UnityAction <>9__6_6;

		public static UnityAction <>9__6_7;

		public static UnityAction <>9__6_8;

		public static UnityAction <>9__6_9;

		public static UnityAction <>9__6_10;

		public static UnityAction <>9__6_11;

		public static UnityAction <>9__6_12;

		public static UnityAction <>9__6_13;

		public static UnityAction <>9__6_14;

		public static UnityAction <>9__6_15;

		public static UnityAction <>9__6_16;

		public static UnityAction <>9__6_17;

		public static UnityAction <>9__6_18;

		public static UnityAction <>9__6_19;

		public static UnityAction <>9__6_20;

		public static UnityAction <>9__6_21;

		public static UnityAction <>9__6_22;

		public static UnityAction <>9__6_23;

		public static UnityAction <>9__6_24;

		public static Func<FieldInfo, bool> <>9__27_0;

		internal void <CreateCheatsMenu>b__6_0()
		{
			refillAmmoNow();
		}

		internal void <CreateCheatsMenu>b__6_1()
		{
			refreshCooldownsNow();
		}

		internal void <CreateCheatsMenu>b__6_2()
		{
			setMovementPreset(10f, 14f);
		}

		internal void <CreateCheatsMenu>b__6_3()
		{
			setMovementPreset(24f, 20f);
		}

		internal void <CreateCheatsMenu>b__6_4()
		{
			setMovementPreset(48f, 28f);
		}

		internal void <CreateCheatsMenu>b__6_5()
		{
			setMovementPreset(10f, 45f);
		}

		internal void <CreateCheatsMenu>b__6_6()
		{
			resetMovement();
		}

		internal void <CreateCheatsMenu>b__6_7()
		{
			saveTeleportPosition();
		}

		internal void <CreateCheatsMenu>b__6_8()
		{
			teleportToSavedPosition();
		}

		internal void <CreateCheatsMenu>b__6_9()
		{
			teleportToCrosshair();
		}

		internal void <CreateCheatsMenu>b__6_10()
		{
			killAllEnemies();
		}

		internal void <CreateCheatsMenu>b__6_11()
		{
			SpawnMenu.spawnSwarm(10);
		}

		internal void <CreateCheatsMenu>b__6_12()
		{
			SpawnMenu.spawnSwarm(25);
		}

		internal void <CreateCheatsMenu>b__6_13()
		{
			makeEnemiesFlee();
		}

		internal void <CreateCheatsMenu>b__6_14()
		{
			stopEnemiesFleeing();
		}

		internal void <CreateCheatsMenu>b__6_15()
		{
			setEnemyIntensity(0f);
		}

		internal void <CreateCheatsMenu>b__6_16()
		{
			setEnemyIntensity(1f);
		}

		internal void <CreateCheatsMenu>b__6_17()
		{
			cleanUpParts();
		}

		internal void <CreateCheatsMenu>b__6_18()
		{
			cleanUpCollectables();
		}

		internal void <CreateCheatsMenu>b__6_19()
		{
			giveAllResources();
		}

		internal void <CreateCheatsMenu>b__6_20()
		{
			clearLostLootUpgrades();
		}

		internal void <CreateCheatsMenu>b__6_21()
		{
			SpawnMenu.spawnObject("SaxitosBag");
		}

		internal void <CreateCheatsMenu>b__6_22()
		{
			SpawnMenu.spawnObject("HoldableBarrel");
		}

		internal void <CreateCheatsMenu>b__6_23()
		{
			SpawnMenu.spawnObject("MilkJug");
		}

		internal void <CreateCheatsMenu>b__6_24()
		{
			ProgressionMenu.unlockEverything();
		}

		internal bool <getCooldownFields>b__27_0(FieldInfo field)
		{
			return field.FieldType == typeof(CooldownData);
		}
	}

	private static readonly Dictionary<Type, FieldInfo[]> cooldownFieldsByType = new Dictionary<Type, FieldInfo[]>();

	private static readonly FieldInfo cooldownChargeField = typeof(CooldownData).GetField("charge", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo cooldownMaxChargesField = typeof(CooldownData).GetField("maxCharges", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly PropertyInfo gunReloadingProperty = typeof(Gun).GetProperty("Reloading", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static Vector3 savedTeleportPosition;

	private static bool hasSavedTeleportPosition = false;

	public static void CreateCheatsMenu(MenuMod2Menu parentMenu)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Expected O, but got Unknown
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Expected O, but got Unknown
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Expected O, but got Unknown
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Expected O, but got Unknown
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Expected O, but got Unknown
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Expected O, but got Unknown
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Expected O, but got Unknown
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Expected O, but got Unknown
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Expected O, but got Unknown
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Expected O, but got Unknown
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Expected O, but got Unknown
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Expected O, but got Unknown
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Expected O, but got Unknown
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Expected O, but got Unknown
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Expected O, but got Unknown
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0352: Expected O, but got Unknown
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Expected O, but got Unknown
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a8: Expected O, but got Unknown
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d3: Expected O, but got Unknown
		//IL_03f3: 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_03fe: Expected O, but got Unknown
		//IL_045a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0464: Expected O, but got Unknown
		//IL_046e: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Expected O, but got Unknown
		//IL_0497: Unknown result type (might be due to invalid IL or missing references)
		//IL_049c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a2: Expected O, but got Unknown
		//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cd: Expected O, but got Unknown
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f8: Expected O, but got Unknown
		//IL_0518: Unknown result type (might be due to invalid IL or missing references)
		//IL_051d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0523: Expected O, but got Unknown
		//IL_0573: Unknown result type (might be due to invalid IL or missing references)
		//IL_057d: Expected O, but got Unknown
		//IL_0587: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bf: Expected O, but got Unknown
		//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0601: Expected O, but got Unknown
		//IL_060b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0543: Unknown result type (might be due to invalid IL or missing references)
		//IL_0548: Unknown result type (might be due to invalid IL or missing references)
		//IL_054e: Expected O, but got Unknown
		//IL_0634: Unknown result type (might be due to invalid IL or missing references)
		//IL_0639: Unknown result type (might be due to invalid IL or missing references)
		//IL_063f: Expected O, but got Unknown
		MenuMod2Menu menuMod2Menu = new MenuMod2Menu("CHEATS", parentMenu);
		MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu("Ammo & Abilities", menuMod2Menu);
		MM2Button button7 = null;
		button7 = menuMod2Menu2.addButton("Infinite ammo", (UnityAction)delegate
		{
			toggleInfiniteAmmo(button7);
		}).changeSuffix("  OFF").changeColour(MenuStyle.Danger);
		MM2Button button6 = null;
		button6 = menuMod2Menu2.addButton("No cooldowns", (UnityAction)delegate
		{
			toggleNoCooldowns(button6);
		}).changeSuffix("  OFF").changeColour(MenuStyle.Danger);
		object obj = <>c.<>9__6_0;
		if (obj == null)
		{
			UnityAction val = delegate
			{
				refillAmmoNow();
			};
			<>c.<>9__6_0 = val;
			obj = (object)val;
		}
		menuMod2Menu2.addButton("Refill ammo now", (UnityAction)obj);
		object obj2 = <>c.<>9__6_1;
		if (obj2 == null)
		{
			UnityAction val2 = delegate
			{
				refreshCooldownsNow();
			};
			<>c.<>9__6_1 = val2;
			obj2 = (object)val2;
		}
		menuMod2Menu2.addButton("Refresh cooldowns now", (UnityAction)obj2);
		MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu("Movement", menuMod2Menu);
		object obj3 = <>c.<>9__6_2;
		if (obj3 == null)
		{
			UnityAction val3 = delegate
			{
				setMovementPreset(10f, 14f);
			};
			<>c.<>9__6_2 = val3;
			obj3 = (object)val3;
		}
		menuMod2Menu3.addButton("Movement normal", (UnityAction)obj3);
		object obj4 = <>c.<>9__6_3;
		if (obj4 == null)
		{
			UnityAction val4 = delegate
			{
				setMovementPreset(24f, 20f);
			};
			<>c.<>9__6_3 = val4;
			obj4 = (object)val4;
		}
		menuMod2Menu3.addButton("Movement fast", (UnityAction)obj4);
		object obj5 = <>c.<>9__6_4;
		if (obj5 == null)
		{
			UnityAction val5 = delegate
			{
				setMovementPreset(48f, 28f);
			};
			<>c.<>9__6_4 = val5;
			obj5 = (object)val5;
		}
		menuMod2Menu3.addButton("Movement very fast", (UnityAction)obj5);
		object obj6 = <>c.<>9__6_5;
		if (obj6 == null)
		{
			UnityAction val6 = delegate
			{
				setMovementPreset(10f, 45f);
			};
			<>c.<>9__6_5 = val6;
			obj6 = (object)val6;
		}
		menuMod2Menu3.addButton("Jump high", (UnityAction)obj6);
		object obj7 = <>c.<>9__6_6;
		if (obj7 == null)
		{
			UnityAction val7 = delegate
			{
				resetMovement();
			};
			<>c.<>9__6_6 = val7;
			obj7 = (object)val7;
		}
		menuMod2Menu3.addButton("Reset movement", (UnityAction)obj7);
		MenuMod2Menu menuMod2Menu4 = new MenuMod2Menu("Teleport", menuMod2Menu);
		object obj8 = <>c.<>9__6_7;
		if (obj8 == null)
		{
			UnityAction val8 = delegate
			{
				saveTeleportPosition();
			};
			<>c.<>9__6_7 = val8;
			obj8 = (object)val8;
		}
		menuMod2Menu4.addButton("Save position", (UnityAction)obj8);
		object obj9 = <>c.<>9__6_8;
		if (obj9 == null)
		{
			UnityAction val9 = delegate
			{
				teleportToSavedPosition();
			};
			<>c.<>9__6_8 = val9;
			obj9 = (object)val9;
		}
		menuMod2Menu4.addButton("Teleport to saved position", (UnityAction)obj9);
		object obj10 = <>c.<>9__6_9;
		if (obj10 == null)
		{
			UnityAction val10 = delegate
			{
				teleportToCrosshair();
			};
			<>c.<>9__6_9 = val10;
			obj10 = (object)val10;
		}
		menuMod2Menu4.addButton("Teleport to crosshair", (UnityAction)obj10);
		MenuMod2Menu menuMod2Menu5 = new MenuMod2Menu("Enemies", menuMod2Menu);
		MM2Button button5 = null;
		button5 = menuMod2Menu5.addButton("Toggle enemy spawning", (UnityAction)delegate
		{
			toggleSpawning(button5);
		}).changeSuffix("  ON").changeColour(MenuStyle.Success);
		object obj11 = <>c.<>9__6_10;
		if (obj11 == null)
		{
			UnityAction val11 = delegate
			{
				killAllEnemies();
			};
			<>c.<>9__6_10 = val11;
			obj11 = (object)val11;
		}
		menuMod2Menu5.addButton("Kill all enemies", (UnityAction)obj11);
		object obj12 = <>c.<>9__6_11;
		if (obj12 == null)
		{
			UnityAction val12 = delegate
			{
				SpawnMenu.spawnSwarm(10);
			};
			<>c.<>9__6_11 = val12;
			obj12 = (object)val12;
		}
		menuMod2Menu5.addButton("Spawn swarm x10", (UnityAction)obj12);
		object obj13 = <>c.<>9__6_12;
		if (obj13 == null)
		{
			UnityAction val13 = delegate
			{
				SpawnMenu.spawnSwarm(25);
			};
			<>c.<>9__6_12 = val13;
			obj13 = (object)val13;
		}
		menuMod2Menu5.addButton("Spawn swarm x25", (UnityAction)obj13);
		object obj14 = <>c.<>9__6_13;
		if (obj14 == null)
		{
			UnityAction val14 = delegate
			{
				makeEnemiesFlee();
			};
			<>c.<>9__6_13 = val14;
			obj14 = (object)val14;
		}
		menuMod2Menu5.addButton("Make enemies flee", (UnityAction)obj14);
		object obj15 = <>c.<>9__6_14;
		if (obj15 == null)
		{
			UnityAction val15 = delegate
			{
				stopEnemiesFleeing();
			};
			<>c.<>9__6_14 = val15;
			obj15 = (object)val15;
		}
		menuMod2Menu5.addButton("Stop enemies fleeing", (UnityAction)obj15);
		object obj16 = <>c.<>9__6_15;
		if (obj16 == null)
		{
			UnityAction val16 = delegate
			{
				setEnemyIntensity(0f);
			};
			<>c.<>9__6_15 = val16;
			obj16 = (object)val16;
		}
		menuMod2Menu5.addButton("Calm enemy intensity", (UnityAction)obj16);
		object obj17 = <>c.<>9__6_16;
		if (obj17 == null)
		{
			UnityAction val17 = delegate
			{
				setEnemyIntensity(1f);
			};
			<>c.<>9__6_16 = val17;
			obj17 = (object)val17;
		}
		menuMod2Menu5.addButton("Max enemy intensity", (UnityAction)obj17);
		object obj18 = <>c.<>9__6_17;
		if (obj18 == null)
		{
			UnityAction val18 = delegate
			{
				cleanUpParts();
			};
			<>c.<>9__6_17 = val18;
			obj18 = (object)val18;
		}
		menuMod2Menu5.addButton("Clean up parts", (UnityAction)obj18);
		object obj19 = <>c.<>9__6_18;
		if (obj19 == null)
		{
			UnityAction val19 = delegate
			{
				cleanUpCollectables();
			};
			<>c.<>9__6_18 = val19;
			obj19 = (object)val19;
		}
		menuMod2Menu5.addButton("Clean up collectables", (UnityAction)obj19);
		MenuMod2Menu menuMod2Menu6 = new MenuMod2Menu("Loot", menuMod2Menu);
		MM2Button button4 = null;
		button4 = menuMod2Menu6.addButton("Infinite resources", (UnityAction)delegate
		{
			toggleInfiniteResources(button4);
		}).changeSuffix("  OFF").changeColour(MenuStyle.Danger);
		object obj20 = <>c.<>9__6_19;
		if (obj20 == null)
		{
			UnityAction val20 = delegate
			{
				giveAllResources();
			};
			<>c.<>9__6_19 = val20;
			obj20 = (object)val20;
		}
		menuMod2Menu6.addButton("Give max resources", (UnityAction)obj20);
		object obj21 = <>c.<>9__6_20;
		if (obj21 == null)
		{
			UnityAction val21 = delegate
			{
				clearLostLootUpgrades();
			};
			<>c.<>9__6_20 = val21;
			obj21 = (object)val21;
		}
		menuMod2Menu6.addButton("Clear lost loot upgrades", (UnityAction)obj21);
		object obj22 = <>c.<>9__6_21;
		if (obj22 == null)
		{
			UnityAction val22 = delegate
			{
				SpawnMenu.spawnObject("SaxitosBag");
			};
			<>c.<>9__6_21 = val22;
			obj22 = (object)val22;
		}
		menuMod2Menu6.addButton("Spawn Saxitos", (UnityAction)obj22);
		object obj23 = <>c.<>9__6_22;
		if (obj23 == null)
		{
			UnityAction val23 = delegate
			{
				SpawnMenu.spawnObject("HoldableBarrel");
			};
			<>c.<>9__6_22 = val23;
			obj23 = (object)val23;
		}
		menuMod2Menu6.addButton("Spawn barrel", (UnityAction)obj23);
		object obj24 = <>c.<>9__6_23;
		if (obj24 == null)
		{
			UnityAction val24 = delegate
			{
				SpawnMenu.spawnObject("MilkJug");
			};
			<>c.<>9__6_23 = val24;
			obj24 = (object)val24;
		}
		menuMod2Menu6.addButton("Spawn milk", (UnityAction)obj24);
		MM2Button button3 = null;
		button3 = menuMod2Menu.addButton("Godmode", (UnityAction)delegate
		{
			toggleGod(button3);
		}).changeSuffix("  OFF").changeColour(MenuStyle.Danger);
		MM2Button button2 = null;
		button2 = menuMod2Menu.addButton("Super sprint", (UnityAction)delegate
		{
			toggleSprintFast(button2);
		}).changeSuffix("  OFF").changeColour(MenuStyle.Danger);
		MM2Button button = null;
		button = menuMod2Menu.addButton("Super jump", (UnityAction)delegate
		{
			toggleSuperJump(button);
		}).changeSuffix("  OFF").changeColour(MenuStyle.Danger);
		object obj25 = <>c.<>9__6_24;
		if (obj25 == null)
		{
			UnityAction val25 = delegate
			{
				ProgressionMenu.unlockEverything();
			};
			<>c.<>9__6_24 = val25;
			obj25 = (object)val25;
		}
		menuMod2Menu.addButton("Unlock everything", (UnityAction)obj25);
	}

	public static void toggleGod(MM2Button button = null)
	{
		try
		{
			if (SparrohPlugin.god)
			{
				Player.LocalPlayer.SetMaxHealth(37.5f);
				typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f });
				typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f });
				SparrohPlugin.god = false;
			}
			else
			{
				Player.LocalPlayer.SetMaxHealth(999999f);
				typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f });
				typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f });
				SparrohPlugin.god = true;
			}
			if (button != null)
			{
				updateToggleButton(button, SparrohPlugin.god);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleGod: " + ex.Message));
		}
	}

	public static void toggleSprintFast(MM2Button b = null)
	{
		try
		{
			if (SparrohPlugin.sprintFast)
			{
				Player.LocalPlayer.DefaultMoveSpeed = 10f;
				SparrohPlugin.sprintFast = false;
			}
			else
			{
				Player.LocalPlayer.DefaultMoveSpeed = 100f;
				SparrohPlugin.sprintFast = true;
			}
			if (b != null)
			{
				updateToggleButton(b, SparrohPlugin.sprintFast);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleSprintFast: " + ex.Message));
		}
	}

	public static void toggleSuperJump(MM2Button b = null)
	{
		try
		{
			if (SparrohPlugin.superJump)
			{
				typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 14f);
				SparrohPlugin.superJump = false;
			}
			else
			{
				typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 100f);
				SparrohPlugin.superJump = true;
			}
			if (b != null)
			{
				updateToggleButton(b, SparrohPlugin.superJump);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleSuperJump: " + ex.Message));
		}
	}

	public static void setGod(bool enabled, MM2Button b = null)
	{
		if (enabled)
		{
			Player.LocalPlayer.SetMaxHealth(999999f);
			typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f });
			typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 999999f });
		}
		else
		{
			Player.LocalPlayer.SetMaxHealth(37.5f);
			typeof(Player).GetMethod("SetHealth_Client", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f });
			typeof(Player).GetMethod("SetHealth_Owner", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(Player.LocalPlayer, new object[1] { 37.5f });
		}
	}

	public static void setSprintFast(bool enabled, MM2Button b = null)
	{
		if (enabled)
		{
			Player.LocalPlayer.DefaultMoveSpeed = 100f;
		}
		else
		{
			Player.LocalPlayer.DefaultMoveSpeed = 10f;
		}
	}

	public static void setSuperJump(bool enabled, MM2Button b = null)
	{
		if (enabled)
		{
			typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 100f);
		}
		else
		{
			typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 14f);
		}
	}

	public static void setMovementPreset(float moveSpeed, float jumpSpeed)
	{
		try
		{
			SparrohPlugin.sprintFast = false;
			SparrohPlugin.superJump = false;
			SparrohPlugin.movementPreset = true;
			SparrohPlugin.moveSpeedOverride = moveSpeed;
			SparrohPlugin.jumpSpeedOverride = jumpSpeed;
			applyMovement(moveSpeed, jumpSpeed);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in setMovementPreset: " + ex.Message));
		}
	}

	public static void resetMovement()
	{
		try
		{
			SparrohPlugin.sprintFast = false;
			SparrohPlugin.superJump = false;
			SparrohPlugin.movementPreset = false;
			applyMovement(10f, 14f);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in resetMovement: " + ex.Message));
		}
	}

	public static void applyMovement(float moveSpeed, float jumpSpeed)
	{
		if (!((Object)(object)Player.LocalPlayer == (Object)null))
		{
			Player.LocalPlayer.DefaultMoveSpeed = moveSpeed;
			typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(Player.LocalPlayer, jumpSpeed);
		}
	}

	public static void enemySpawning(bool enabled, MM2Button b = null)
	{
		EnemyManager enemyManager = SparrohPlugin.GetEnemyManager();
		if ((Object)(object)enemyManager != (Object)null)
		{
			if (enabled)
			{
				enemyManager.EnableSpawning();
			}
			else
			{
				enemyManager.DisableSpawning();
			}
		}
	}

	public static MM2Button toggleSpawning(MM2Button b = null)
	{
		try
		{
			EnemyManager enemyManager = SparrohPlugin.GetEnemyManager();
			if ((Object)(object)enemyManager != (Object)null)
			{
				if ((bool)typeof(EnemyManager).GetField("enableAmbientWave", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(enemyManager))
				{
					enemyManager.DisableSpawning();
					if (b != null)
					{
						updateToggleButton(b, enabled: false);
					}
				}
				else
				{
					enemyManager.EnableSpawning();
					if (b != null)
					{
						updateToggleButton(b, enabled: true);
					}
				}
			}
			return b;
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleSpawning: " + ex.Message));
			return b;
		}
	}

	public static void killAllEnemies(MM2Button b = null)
	{
		try
		{
			EnemyManager enemyManager = SparrohPlugin.GetEnemyManager();
			if ((Object)(object)enemyManager != (Object)null)
			{
				enemyManager.KillAllEnemies_Server();
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in killAllEnemies: " + ex.Message));
		}
	}

	public static void cleanUpParts(MM2Button b = null)
	{
		try
		{
			foreach (EnemyPart item in Object.FindObjectsOfType<EnemyPart>().ToList())
			{
				item.Kill((DamageFlags)2);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in cleanUpParts: " + ex.Message));
		}
	}

	public static void cleanUpCollectables(MM2Button b = null)
	{
		try
		{
			foreach (ClientCollectable item in Object.FindObjectsOfType<ClientCollectable>().ToList())
			{
				item.DespawnTrackedObject();
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in cleanUpCollectables: " + ex.Message));
		}
	}

	public static void clearLostLootUpgrades(MM2Button b = null)
	{
		try
		{
			PlayerData.Instance.rentedUpgrades.Clear();
			SparrohPlugin.Logger.LogInfo((object)"Cleared all rented upgrades from lost loot machine");
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in clearLostLootUpgrades: " + ex.Message));
		}
	}

	public static void toggleInfiniteResources(MM2Button b = null)
	{
		try
		{
			SparrohPlugin.infiniteResources = !SparrohPlugin.infiniteResources;
			if (SparrohPlugin.infiniteResources)
			{
				giveAllResources();
				updateToggleButton(b, enabled: true);
			}
			else
			{
				updateToggleButton(b, enabled: false);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleInfiniteResources: " + ex.Message));
		}
	}

	public static void toggleInfiniteAmmo(MM2Button b = null)
	{
		try
		{
			SparrohPlugin.infiniteAmmo = !SparrohPlugin.infiniteAmmo;
			if (SparrohPlugin.infiniteAmmo)
			{
				refillAmmoNow();
				updateToggleButton(b, enabled: true);
			}
			else
			{
				updateToggleButton(b, enabled: false);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleInfiniteAmmo: " + ex.Message));
		}
	}

	public static void toggleNoCooldowns(MM2Button b = null)
	{
		try
		{
			SparrohPlugin.noCooldowns = !SparrohPlugin.noCooldowns;
			if (SparrohPlugin.noCooldowns)
			{
				refreshCooldownsNow();
				updateToggleButton(b, enabled: true);
			}
			else
			{
				updateToggleButton(b, enabled: false);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleNoCooldowns: " + ex.Message));
		}
	}

	public static void refillAmmoNow(MM2Button b = null)
	{
		try
		{
			Gun[] array = Object.FindObjectsOfType<Gun>();
			foreach (Gun val in array)
			{
				val.RemainingAmmo = Mathf.Max(val.RemainingAmmo, 999f);
				val.StoredAmmo = Mathf.Max(val.StoredAmmo, 999f);
				gunReloadingProperty?.SetValue(val, false, null);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in refillAmmoNow: " + ex.Message));
		}
	}

	public static void refreshCooldownsNow(MM2Button b = null)
	{
		try
		{
			MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>();
			foreach (MonoBehaviour val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				FieldInfo[] cooldownFields = getCooldownFields(((object)val).GetType());
				foreach (FieldInfo fieldInfo in cooldownFields)
				{
					object value = fieldInfo.GetValue(val);
					if (value != null)
					{
						int num = ((!(cooldownMaxChargesField != null)) ? 1 : ((int)cooldownMaxChargesField.GetValue(value)));
						if (num <= 0)
						{
							num = 1;
						}
						cooldownChargeField?.SetValue(value, (float)num);
						fieldInfo.SetValue(val, value);
					}
				}
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in refreshCooldownsNow: " + ex.Message));
		}
	}

	private static FieldInfo[] getCooldownFields(Type type)
	{
		if (cooldownFieldsByType.TryGetValue(type, out var value))
		{
			return value;
		}
		List<FieldInfo> list = new List<FieldInfo>();
		Type type2 = type;
		while (type2 != null)
		{
			list.AddRange(from field in type2.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)
				where field.FieldType == typeof(CooldownData)
				select field);
			type2 = type2.BaseType;
		}
		FieldInfo[] array = list.ToArray();
		cooldownFieldsByType[type] = array;
		return array;
	}

	public static void saveTeleportPosition(MM2Button b = null)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!((Object)(object)Player.LocalPlayer == (Object)null))
			{
				savedTeleportPosition = ((Component)Player.LocalPlayer).transform.position;
				hasSavedTeleportPosition = true;
				SparrohPlugin.SendTextChatMessageToClient("Saved teleport position.");
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in saveTeleportPosition: " + ex.Message));
		}
	}

	public static void teleportToSavedPosition(MM2Button b = null)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (hasSavedTeleportPosition && !((Object)(object)Player.LocalPlayer == (Object)null))
			{
				teleportPlayer(savedTeleportPosition);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in teleportToSavedPosition: " + ex.Message));
		}
	}

	public static void teleportToCrosshair(MM2Button b = null)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!((Object)(object)Player.LocalPlayer == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook.Camera == (Object)null))
			{
				Transform transform = ((Component)Player.LocalPlayer.PlayerLook.Camera).transform;
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(transform.position, transform.forward, ref val, 100000f))
				{
					teleportPlayer(((RaycastHit)(ref val)).point + Vector3.up * 1.5f);
				}
				else
				{
					SparrohPlugin.SendTextChatMessageToClient("No teleport target found.");
				}
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in teleportToCrosshair: " + ex.Message));
		}
	}

	private static void teleportPlayer(Vector3 position)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		CharacterController component = ((Component)Player.LocalPlayer).GetComponent<CharacterController>();
		if ((Object)(object)component != (Object)null)
		{
			((Collider)component).enabled = false;
		}
		((Component)Player.LocalPlayer).transform.position = position;
		if ((Object)(object)component != (Object)null)
		{
			((Collider)component).enabled = true;
		}
	}

	public static void makeEnemiesFlee(MM2Button b = null)
	{
		try
		{
			EnemyManager enemyManager = SparrohPlugin.GetEnemyManager();
			if (enemyManager != null)
			{
				enemyManager.MakeAllEnemiesFlee_Server(1000f, 30f);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in makeEnemiesFlee: " + ex.Message));
		}
	}

	public static void stopEnemiesFleeing(MM2Button b = null)
	{
		try
		{
			EnemyManager enemyManager = SparrohPlugin.GetEnemyManager();
			if (enemyManager != null)
			{
				enemyManager.StopFlee_Server();
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in stopEnemiesFleeing: " + ex.Message));
		}
	}

	public static void setEnemyIntensity(float intensity, MM2Button b = null)
	{
		try
		{
			EnemyManager enemyManager = SparrohPlugin.GetEnemyManager();
			if (enemyManager != null)
			{
				enemyManager.SetEnemyIntensity(intensity, false);
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in setEnemyIntensity: " + ex.Message));
		}
	}

	private static void updateToggleButton(MM2Button button, bool enabled)
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		if (button != null)
		{
			button.changeSuffix(enabled ? "  ON" : "  OFF");
			button.changeColour(enabled ? MenuStyle.Success : MenuStyle.Danger);
		}
	}

	public static void giveAllResoruces(MM2Button b = null)
	{
		giveAllResources(b);
	}

	public static void giveAllResources(MM2Button b = null)
	{
		try
		{
			if (!((Object)(object)Global.Instance == (Object)null) && PlayerData.Instance != null)
			{
				PlayerResource[] playerResources = Global.Instance.PlayerResources;
				foreach (PlayerResource val in playerResources)
				{
					PlayerData.Instance.AddResource(val, val.Max, true);
				}
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in giveAllResources: " + ex.Message));
		}
	}
}
public static class MenuMod2Manager
{
	public static List<MenuMod2Menu> allMenus;

	public static MenuMod2Menu currentMenu;
}
public class MenuMod2Menu
{
	private const int PanelWidth = 420;

	private const int PanelHeight = 620;

	private const int HeaderHeight = 78;

	private const int FooterHeight = 34;

	private const int ButtonWidth = 390;

	private const int ButtonHeight = 34;

	private const int ButtonSpacing = 2;

	private const int ContentPadding = 15;

	public List<MM2Button> buttons;

	public GameObject menuCanvas;

	public RectTransform contentRoot;

	public string menuName;

	public MenuMod2Menu parrentMenu;

	public MM2Button thisButton;

	public List<MenuMod2Menu> subMenus;

	private bool hasMenuCameraLock;

	private bool hasMenuRotationLock;

	private bool hasMenuInputLock;

	private bool hasMenuFireLock;

	public MenuMod2Menu(string indetifier, MenuMod2Menu _parrentMenu = null)
	{
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Expected O, but got Unknown
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Expected O, but got Unknown
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Expected O, but got Unknown
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			menuName = indetifier;
			if (MenuMod2Manager.allMenus == null)
			{
				MenuMod2Manager.allMenus = new List<MenuMod2Menu>();
			}
			foreach (MenuMod2Menu allMenu in MenuMod2Manager.allMenus)
			{
				if (allMenu.menuName == indetifier)
				{
					throw new Exception("Menu with name " + indetifier + " already exists.");
				}
			}
			MenuMod2Manager.allMenus.Add(this);
			buttons = new List<MM2Button>();
			menuCanvas = new GameObject("menuCanvas");
			Object.DontDestroyOnLoad((Object)(object)menuCanvas);
			Canvas obj = menuCanvas.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 30000;
			CanvasScaler obj2 = menuCanvas.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.screenMatchMode = (ScreenMatchMode)0;
			obj2.matchWidthOrHeight = 0.5f;
			menuCanvas.AddComponent<GraphicRaycaster>();
			BuildMenuShell();
			menuCanvas.SetActive(false);
			if (_parrentMenu != null)
			{
				parrentMenu = _parrentMenu;
				MenuMod2Menu menuMod2Menu = parrentMenu;
				if (menuMod2Menu.subMenus == null)
				{
					menuMod2Menu.subMenus = new List<MenuMod2Menu>();
				}
				parrentMenu.subMenus.Add(this);
				thisButton = parrentMenu.addButton(indetifier, (UnityAction)delegate
				{
					Open();
				});
				addButton("Back", (UnityAction)delegate
				{
					parrentMenu.Open();
				}).changeColour(MenuStyle.Secondary);
			}
			else if (indetifier == "Main Menu")
			{
				addButton("Close", (UnityAction)delegate
				{
					Close();
				}).changeColour(MenuStyle.Danger);
				parrentMenu = null;
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in MenuMod2Menu constructor: " + ex.Message));
		}
	}

	private void BuildMenuShell()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: 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_0033: 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)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Expected O, but got Unknown
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: 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)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_020d: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Expected O, but got Unknown
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Expected O, but got Unknown
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Unknown result type (might be due to invalid IL or missing references)
		//IL_038d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Expected O, but got Unknown
		//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ab: Expected O, but got Unknown
		//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_050f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_052a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0549: Unknown result type (might be due to invalid IL or missing references)
		//IL_054f: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_056d: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("MenuBackdrop");
		val.transform.SetParent(menuCanvas.transform, false);
		RectTransform obj = val.AddComponent<RectTransform>();
		obj.anchorMin = Vector2.zero;
		obj.anchorMax = Vector2.one;
		obj.offsetMin = Vector2.zero;
		obj.offsetMax = Vector2.zero;
		((Graphic)val.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
		GameObject val2 = new GameObject("MenuPanel");
		val2.transform.SetParent(menuCanvas.transform, false);
		RectTransform obj2 = val2.AddComponent<RectTransform>();
		obj2.anchorMin = new Vector2(0.08f, 0.5f);
		obj2.anchorMax = new Vector2(0.08f, 0.5f);
		obj2.pivot = new Vector2(0f, 0.5f);
		obj2.sizeDelta = new Vector2(420f, 620f);
		obj2.anchoredPosition = Vector2.zero;
		((Graphic)val2.AddComponent<Image>()).color = MenuStyle.Panel;
		GameObject val3 = new GameObject("Header");
		val3.transform.SetParent(val2.transform, false);
		RectTransform obj3 = val3.AddComponent<RectTransform>();
		obj3.anchorMin = new Vector2(0f, 1f);
		obj3.anchorMax = new Vector2(1f, 1f);
		obj3.pivot = new Vector2(0.5f, 1f);
		obj3.sizeDelta = new Vector2(0f, 78f);
		obj3.anchoredPosition = Vector2.zero;
		((Graphic)val3.AddComponent<Image>()).color = MenuStyle.Header;
		CreateText(val3.transform, "Brand", "CHEATMENU+", 24, (FontStyle)1, MenuStyle.HeaderText, (TextAnchor)4, new Vector2(0f, -30f), new Vector2(420f, 34f), new Vector2(0.5f, 1f));
		CreateText(val3.transform, "Version", "1.5.5", 12, (FontStyle)1, MenuStyle.HeaderSubText, (TextAnchor)4, new Vector2(0f, -58f), new Vector2(420f, 20f), new Vector2(0.5f, 1f));
		GameObject val4 = new GameObject("Section");
		val4.transform.SetParent(val2.transform, false);
		RectTransform obj4 = val4.AddComponent<RectTransform>();
		obj4.anchorMin = new Vector2(0f, 1f);
		obj4.anchorMax = new Vector2(1f, 1f);
		obj4.pivot = new Vector2(0.5f, 1f);
		obj4.sizeDelta = new Vector2(0f, 36f);
		obj4.anchoredPosition = new Vector2(0f, -78f);
		((Graphic)val4.AddComponent<Image>()).color = MenuStyle.Section;
		CreateText(val4.transform, "Title", menuName.ToUpperInvariant(), 16, (FontStyle)1, MenuStyle.Text, (TextAnchor)4, Vector2.zero, new Vector2(420f, 36f), new Vector2(0.5f, 0.5f));
		GameObject val5 = new GameObject("Viewport");
		val5.transform.SetParent(val2.transform, false);
		RectTransform val6 = val5.AddComponent<RectTransform>();
		val6.anchorMin = new Vector2(0f, 0f);
		val6.anchorMax = new Vector2(1f, 1f);
		val6.offsetMin = new Vector2(15f, 49f);
		val6.offsetMax = new Vector2(-15f, -129f);
		((Graphic)val5.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0f);
		val5.AddComponent<RectMask2D>();
		GameObject val7 = new GameObject("Content");
		val7.transform.SetParent(val5.transform, false);
		contentRoot = val7.AddComponent<RectTransform>();
		contentRoot.anchorMin = new Vector2(0f, 1f);
		contentRoot.anchorMax = new Vector2(1f, 1f);
		contentRoot.pivot = new Vector2(0.5f, 1f);
		contentRoot.anchoredPosition = Vector2.zero;
		contentRoot.sizeDelta = new Vector2(0f, 0f);
		ScrollRect obj5 = val2.AddComponent<ScrollRect>();
		obj5.viewport = val6;
		obj5.content = contentRoot;
		obj5.horizontal = false;
		obj5.vertical = true;
		obj5.movementType = (MovementType)2;
		obj5.scrollSensitivity = 28f;
		GameObject val8 = new GameObject("Footer");
		val8.transform.SetParent(val2.transform, false);
		RectTransform obj6 = val8.AddComponent<RectTransform>();
		obj6.anchorMin = new Vector2(0f, 0f);
		obj6.anchorMax = new Vector2(1f, 0f);
		obj6.pivot = new Vector2(0.5f, 0f);
		obj6.sizeDelta = new Vector2(0f, 34f);
		obj6.anchoredPosition = Vector2.zero;
		((Graphic)val8.AddComponent<Image>()).color = MenuStyle.Footer;
		CreateText(val8.transform, "Hint", "INSERT  Open / Close", 12, (FontStyle)1, MenuStyle.MutedText, (TextAnchor)4, Vector2.zero, new Vector2(420f, 34f), new Vector2(0.5f, 0.5f));
	}

	private Text CreateText(Transform parent, string objectName, string value, int fontSize, FontStyle fontStyle, Color color, TextAnchor alignment, Vector2 anchoredPosition, Vector2 size, Vector2 anchor)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(objectName);
		val.transform.SetParent(parent, false);
		Text obj = val.AddComponent<Text>();
		obj.text = value;
		obj.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		obj.fontSize = fontSize;
		obj.fontStyle = fontStyle;
		((Graphic)obj).color = color;
		obj.alignment = alignment;
		obj.horizontalOverflow = (HorizontalWrapMode)1;
		obj.verticalOverflow = (VerticalWrapMode)0;
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = anchor;
		component.anchorMax = anchor;
		component.pivot = anchor;
		component.sizeDelta = size;
		component.anchoredPosition = anchoredPosition;
		return obj;
	}

	public void Open()
	{
		try
		{
			SparrohPlugin.Logger.LogDebug((object)("Opening menu: " + (menuName ?? "unkown")));
			if (MenuMod2Manager.currentMenu != null && MenuMod2Manager.currentMenu != this)
			{
				MenuMod2Manager.currentMenu.Close();
			}
			MenuMod2Manager.currentMenu = this;
			menuCanvas.SetActive(true);
			AcquireMenuInputLock();
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			foreach (MM2Button button in buttons)
			{
				button.show();
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in Open(): " + ex.Message));
		}
	}

	public void Close()
	{
		try
		{
			if (MenuMod2Manager.currentMenu != this)
			{
				SparrohPlugin.Logger.LogWarning((object)("Attempted to close menu \"" + menuName + "\" that wasn't open.  This should not happen"));
				return;
			}
			SparrohPlugin.Logger.LogDebug((object)("Closing menu: " + menuName));
			MenuMod2Manager.currentMenu = null;
			ReleaseMenuInputLock();
			foreach (MM2Button button in buttons)
			{
				button.hide();
			}
			menuCanvas.SetActive(false);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in Close(): " + ex.Message));
		}
	}

	private void AcquireMenuCameraLock()
	{
		try
		{
			if (!hasMenuCameraLock && !((Object)(object)Player.LocalPlayer == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook == (Object)null))
			{
				PlayerLook playerLook = Player.LocalPlayer.PlayerLook;
				playerLook.EnableMenuCamera += 1;
				hasMenuCameraLock = true;
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in AcquireMenuCameraLock(): " + ex.Message));
		}
	}

	private void AcquireMenuInputLock()
	{
		try
		{
			if (!hasMenuInputLock)
			{
				PlayerInput.EnableMenu();
				hasMenuInputLock = true;
			}
			if (!hasMenuRotationLock && !((Object)(object)Player.LocalPlayer == (Object)null) && !((Object)(object)Player.LocalPlayer.PlayerLook == (Object)null))
			{
				PlayerLook playerLook = Player.LocalPlayer.PlayerLook;
				playerLook.RotationLocksX += 1;
				PlayerLook playerLook2 = Player.LocalPlayer.PlayerLook;
				playerLook2.RotationLocksY += 1;
				Player.LocalPlayer.LockFiring(true);
				hasMenuRotationLock = true;
				hasMenuFireLock = true;
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in AcquireMenuInputLock(): " + ex.Message));
		}
	}

	private void ReleaseMenuInputLock()
	{
		try
		{
			if (hasMenuRotationLock && (Object)(object)Player.LocalPlayer != (Object)null && (Object)(object)Player.LocalPlayer.PlayerLook != (Object)null)
			{
				Player.LocalPlayer.PlayerLook.RotationLocksX = Math.Max(0, Player.LocalPlayer.PlayerLook.RotationLocksX - 1);
				Player.LocalPlayer.PlayerLook.RotationLocksY = Math.Max(0, Player.LocalPlayer.PlayerLook.RotationLocksY - 1);
			}
			if (hasMenuFireLock && (Object)(object)Player.LocalPlayer != (Object)null)
			{
				Player.LocalPlayer.LockFiring(false);
			}
			hasMenuRotationLock = false;
			hasMenuFireLock = false;
			if (hasMenuInputLock)
			{
				PlayerInput.DisableMenu();
			}
			hasMenuInputLock = false;
		}
		catch (Exception ex)
		{
			hasMenuInputLock = false;
			hasMenuRotationLock = false;
			hasMenuFireLock = false;
			SparrohPlugin.Logger.LogError((object)("Exception in ReleaseMenuInputLock(): " + ex.Message));
		}
	}

	private void ReleaseMenuCameraLock()
	{
		try
		{
			if (!hasMenuCameraLock || (Object)(object)Player.LocalPlayer == (Object)null || (Object)(object)Player.LocalPlayer.PlayerLook == (Object)null)
			{
				hasMenuCameraLock = false;
				return;
			}
			Player.LocalPlayer.PlayerLook.EnableMenuCamera = Math.Max(0, Player.LocalPlayer.PlayerLook.EnableMenuCamera - 1);
			hasMenuCameraLock = false;
			if (Player.LocalPlayer.PlayerLook.EnableMenuCamera == 0)
			{
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in ReleaseMenuCameraLock(): " + ex.Message));
		}
	}

	public MenuMod2Menu hasMenu(string menuName)
	{
		if (this.menuName == menuName)
		{
			return this;
		}
		if (subMenus != null)
		{
			foreach (MenuMod2Menu subMenu in subMenus)
			{
				if (subMenu.menuName == menuName)
				{
					return subMenu;
				}
			}
		}
		return null;
	}

	public MM2Button addButtonBackup(string text, UnityAction callback)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, callback, ((Component)contentRoot).gameObject);
		buttons.Add(mM2Button);
		arrangeButtons();
		return mM2Button;
	}

	public MM2Button addButton(string text, UnityAction callback)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, null, ((Component)contentRoot).gameObject);
		mM2Button.createButton();
		mM2Button.SetCallback(callback);
		buttons.Add(mM2Button);
		arrangeButtons();
		return mM2Button;
	}

	public MM2Button addInput(string text, string defaultValue)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, null, ((Component)contentRoot).gameObject);
		mM2Button.createInput(defaultValue);
		buttons.Add(mM2Button);
		arrangeButtons();
		return mM2Button;
	}

	public void destroy()
	{
		try
		{
			foreach (MenuMod2Menu item in new List<MenuMod2Menu>(MenuMod2Manager.allMenus))
			{
				if (item.menuName == menuName)
				{
					MenuMod2Manager.allMenus.Remove(item);
				}
			}
			if (MenuMod2Manager.currentMenu == this)
			{
				MM2Button mM2Button = buttons.FirstOrDefault((MM2Button b) => b.name == "back");
				if (mM2Button == null)
				{
					Close();
				}
				else
				{
					((UnityEvent)mM2Button.button.onClick).Invoke();
				}
			}
			foreach (MM2Button item2 in new List<MM2Button>(parrentMenu?.buttons ?? new List<MM2Button>()))
			{
				if (item2.name == thisButton.name)
				{
					parrentMenu.buttons.Remove(item2);
				}
			}
			foreach (MM2Button item3 in new List<MM2Button>(buttons))
			{
				Object.Destroy((Object)(object)item3.buttonObj);
				buttons.Remove(item3);
			}
			foreach (MenuMod2Menu item4 in subMenus ?? new List<MenuMod2Menu>())
			{
				item4.destroy();
			}
			Object.Destroy((Object)(object)menuCanvas);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in destroy(): " + ex.Message));
		}
	}

	public bool removeButton(string buttonName)
	{
		try
		{
			MM2Button mM2Button = buttons.FirstOrDefault((MM2Button b) => b.name == buttonName);
			if (mM2Button != null)
			{
				buttons.Remove(mM2Button);
				Object.Destroy((Object)(object)mM2Button.buttonObj);
				arrangeButtons();
				return true;
			}
			return false;
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in removeButton(): " + ex.Message));
			return false;
		}
	}

	public void arrangeButtons()
	{
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!((Object)(object)contentRoot == (Object)null))
			{
				int num = 1;
				float num2 = 36f;
				float num3 = num * 390 + (num - 1) * 2;
				int num4 = Mathf.CeilToInt((float)buttons.Count / (float)num);
				float num5 = Mathf.Max(0f, (float)num4 * num2 - 2f);
				contentRoot.sizeDelta = new Vector2(0f, num5);
				for (int i = 0; i < buttons.Count; i++)
				{
					int num6 = i % num;
					int num7 = i / num;
					float num8 = (0f - num3) / 2f + 195f + (float)(num6 * 392);
					float num9 = -17f - (float)num7 * num2;
					buttons[i].move(new Vector2(num8, num9));
				}
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in arrangeButtons(): " + ex.Message));
		}
	}
}
public static class MenuStyle
{
	public static readonly Color Panel = new Color(0.015f, 0.015f, 0.018f, 0.86f);

	public static readonly Color Header = new Color(0.12f, 0.44f, 0.95f, 0.98f);

	public static readonly Color Section = new Color(0.02f, 0.02f, 0.024f, 0.92f);

	public static readonly Color Footer = new Color(0.02f, 0.02f, 0.024f, 0.94f);

	public static readonly Color Button = new Color(0.03f, 0.03f, 0.036f, 0.76f);

	public static readonly Color ButtonHover = new Color(0.12f, 0.44f, 0.95f, 0.92f);

	public static readonly Color Accent = new Color(0.12f, 0.44f, 0.95f, 1f);

	public static readonly Color Secondary = new Color(0.08f, 0.08f, 0.09f, 0.92f);

	public static readonly Color Success = new Color(0.05f, 0.38f, 0.18f, 0.92f);

	public static readonly Color Danger = new Color(0.5f, 0.08f, 0.08f, 0.92f);

	public static readonly Color HeaderText = new Color(1f, 1f, 1f, 1f);

	public static readonly Color HeaderSubText = new Color(0.82f, 0.9f, 1f, 1f);

	public static readonly Color Text = new Color(0.94f, 0.96f, 0.96f, 1f);

	public static readonly Color MutedText = new Color(0.62f, 0.66f, 0.7f, 1f);
}
public class MM2Button
{
	public GameObject buttonObj;

	public MenuMod2Menu menu;

	public string name;

	public string prefix;

	public string suffix;

	public GameObject canvas;

	public Vector2 pos;

	public Button button;

	public InputField inputField;

	public MM2Button(MenuMod2Menu _menu, Vector2 screenPos, string text, UnityAction callback, GameObject menuCanvas)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		menu = _menu;
		name = text;
		pos = screenPos;
		canvas = menuCanvas;
		prefix = string.Empty;
		suffix = string.Empty;
	}

	public MM2Button createButton()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		buttonObj = new GameObject("MenuButton");
		buttonObj.transform.SetParent(canvas.transform, false);
		RectTransform obj = buttonObj.AddComponent<RectTransform>();
		obj.anchorMin = new Vector2(0.5f, 1f);
		obj.anchorMax = new Vector2(0.5f, 1f);
		obj.pivot = new Vector2(0.5f, 0.5f);
		obj.sizeDelta = new Vector2(390f, 34f);
		obj.anchoredPosition = pos;
		Image val = buttonObj.AddComponent<Image>();
		((Graphic)val).color = MenuStyle.Button;
		button = buttonObj.AddComponent<Button>();
		((Selectable)button).targetGraphic = (Graphic)(object)val;
		ColorBlock colors = ((Selectable)button).colors;
		((ColorBlock)(ref colors)).normalColor = MenuStyle.Button;
		((ColorBlock)(ref colors)).highlightedColor = MenuStyle.ButtonHover;
		((ColorBlock)(ref colors)).pressedColor = MenuStyle.Accent;
		((ColorBlock)(ref colors)).selectedColor = MenuStyle.ButtonHover;
		((ColorBlock)(ref colors)).disabledColor = new Color(0.1f, 0.11f, 0.12f, 0.65f);
		((ColorBlock)(ref colors)).colorMultiplier = 1f;
		((Selectable)button).colors = colors;
		GameObject val2 = new GameObject("ButtonText");
		val2.transform.SetParent(buttonObj.transform, false);
		Text obj2 = val2.AddComponent<Text>();
		obj2.text = prefix + name + suffix;
		obj2.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		obj2.fontSize = 15;
		((Graphic)obj2).color = MenuStyle.Text;
		obj2.alignment = (TextAnchor)4;
		obj2.horizontalOverflow = (HorizontalWrapMode)0;
		obj2.verticalOverflow = (VerticalWrapMode)0;
		RectTransform component = val2.GetComponent<RectTransform>();
		component.anchorMin = Vector2.zero;
		component.anchorMax = Vector2.one;
		component.offsetMin = new Vector2(18f, 0f);
		component.offsetMax = new Vector2(-18f, 0f);
		hide();
		return this;
	}

	public MM2Button createInput(string defaultValue)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Expected O, but got Unknown
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0309: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		buttonObj = new GameObject("MenuInput");
		buttonObj.transform.SetParent(canvas.transform, false);
		RectTransform obj = buttonObj.AddComponent<RectTransform>();
		obj.anchorMin = new Vector2(0.5f, 1f);
		obj.anchorMax = new Vector2(0.5f, 1f);
		obj.pivot = new Vector2(0.5f, 0.5f);
		obj.sizeDelta = new Vector2(390f, 34f);
		obj.anchoredPosition = pos;
		((Graphic)buttonObj.AddComponent<Image>()).color = MenuStyle.Button;
		GameObject val = new GameObject("InputLabel");
		val.transform.SetParent(buttonObj.transform, false);
		Text obj2 = val.AddComponent<Text>();
		obj2.text = name;
		obj2.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		obj2.fontSize = 14;
		((Graphic)obj2).color = MenuStyle.MutedText;
		obj2.alignment = (TextAnchor)3;
		RectTransform component = val.GetComponent<RectTransform>();
		component.anchorMin = new Vector2(0f, 0f);
		component.anchorMax = new Vector2(0.48f, 1f);
		component.offsetMin = new Vector2(18f, 0f);
		component.offsetMax = new Vector2(-6f, 0f);
		GameObject val2 = new GameObject("InputField");
		val2.transform.SetParent(buttonObj.transform, false);
		RectTransform obj3 = val2.AddComponent<RectTransform>();
		obj3.anchorMin = new Vector2(0.5f, 0.16f);
		obj3.anchorMax = new Vector2(1f, 0.84f);
		obj3.offsetMin = new Vector2(4f, 0f);
		obj3.offsetMax = new Vector2(-16f, 0f);
		((Graphic)val2.AddComponent<Image>()).color = new Color(0.015f, 0.015f, 0.018f, 0.95f);
		GameObject val3 = new GameObject("Text");
		val3.transform.SetParent(val2.transform, false);
		Text val4 = val3.AddComponent<Text>();
		val4.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		val4.fontSize = 14;
		((Graphic)val4).color = MenuStyle.Text;
		val4.alignment = (TextAnchor)4;
		val4.horizontalOverflow = (HorizontalWrapMode)0;
		val4.verticalOverflow = (VerticalWrapMode)0;
		RectTransform component2 = val3.GetComponent<RectTransform>();
		component2.anchorMin = Vector2.zero;
		component2.anchorMax = Vector2.one;
		component2.offsetMin = new Vector2(8f, 0f);
		component2.offsetMax = new Vector2(-8f, 0f);
		GameObject val5 = new GameObject("Placeholder");
		val5.transform.SetParent(val2.transform, false);
		Text val6 = val5.AddComponent<Text>();
		val6.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		val6.fontSize = 14;
		val6.fontStyle = (FontStyle)2;
		((Graphic)val6).color = MenuStyle.MutedText;
		val6.alignment = (TextAnchor)4;
		val6.text = defaultValue;
		RectTransform component3 = val5.GetComponent<RectTransform>();
		component3.anchorMin = Vector2.zero;
		component3.anchorMax = Vector2.one;
		component3.offsetMin = new Vector2(8f, 0f);
		component3.offsetMax = new Vector2(-8f, 0f);
		inputField = val2.AddComponent<InputField>();
		inputField.textComponent = val4;
		inputField.placeholder = (Graphic)(object)val6;
		inputField.contentType = (ContentType)3;
		inputField.text = defaultValue;
		inputField.caretColor = MenuStyle.Text;
		inputField.selectionColor = MenuStyle.ButtonHover;
		hide();
		return this;
	}

	public MM2Button hide()
	{
		buttonObj.SetActive(false);
		return this;
	}

	public MM2Button show()
	{
		buttonObj.SetActive(true);
		return this;
	}

	public MM2Button updateText()
	{
		if ((Object)(object)inputField != (Object)null)
		{
			return this;
		}
		Text componentInChildren = buttonObj.GetComponentInChildren<Text>();
		if ((Object)(object)componentInChildren != (Object)null)
		{
			componentInChildren.text = prefix + name + suffix;
		}
		else
		{
			SparrohPlugin.Logger.LogWarning((object)"Button text component not found, cannot update text.");
		}
		return this;
	}

	public MM2Button changeColour(Color newColor)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//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)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: 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)
		Image component = buttonObj.GetComponent<Image>();
		if ((Object)(object)component != (Object)null)
		{
			((Graphic)component).color = newColor;
			if ((Object)(object)button != (Object)null)
			{
				ColorBlock colors = ((Selectable)button).colors;
				Color val3 = (((ColorBlock)(ref colors)).normalColor = (((Graphic)component).color = Color.Lerp(MenuStyle.Button, newColor, 0.22f)));
				((ColorBlock)(ref colors)).highlightedColor = Color.Lerp(val3, Color.white, 0.1f);
				((ColorBlock)(ref colors)).pressedColor = MenuStyle.Accent;
				((ColorBlock)(ref colors)).selectedColor = ((ColorBlock)(ref colors)).highlightedColor;
				((Selectable)button).colors = colors;
			}
		}
		else
		{
			SparrohPlugin.Logger.LogWarning((object)"Button image component not found, cannot change color.");
		}
		return this;
	}

	public MM2Button changeName(string newName)
	{
		name = newName;
		updateText();
		return this;
	}

	public MM2Button changePrefix(string newPrefix)
	{
		prefix = newPrefix;
		updateText();
		return this;
	}

	public MM2Button changeSuffix(string newSuffix)
	{
		suffix = newSuffix;
		updateText();
		return this;
	}

	public MM2Button move(Vector2 newPos)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		buttonObj.GetComponent<RectTransform>().anchoredPosition = newPos;
		return this;
	}

	public void SetCallback(UnityAction callback)
	{
		((UnityEventBase)button.onClick).RemoveAllListeners();
		((UnityEvent)button.onClick).AddListener(callback);
	}

	public string getInputText()
	{
		if (!((Object)(object)inputField != (Object)null))
		{
			return string.Empty;
		}
		return inputField.text;
	}
}
public static class MissionsMenu
{
	public static void CreateMissionsMenu(MenuMod2Menu parentMenu)
	{
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Expected O, but got Unknown
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Expected O, but got Unknown
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Expected O, but got Unknown
		try
		{
			MenuMod2Menu parrentMenu = new MenuMod2Menu("MISSIONS", parentMenu);
			MenuMod2Menu menuMod2Menu = new MenuMod2Menu("Force Modifier", parrentMenu);
			foreach (object item in typeof(WeightedArray<MissionModifier>).GetField("items", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(Global.Instance.MissionModifiers) as Array)
			{
				FieldInfo field = item.GetType().GetField("value");
				MissionModifier modifier = (MissionModifier)field.GetValue(item);
				MM2Button button = null;
				button = menuMod2Menu.addButton(modifier.ModifierName ?? "", (UnityAction)delegate
				{
					toggleForceModifier(modifier, button);
				});
			}
			MenuMod2Menu parrentMenu2 = new MenuMod2Menu("Load mission", parrentMenu);
			List<MenuMod2Menu> list = new List<MenuMod2Menu>();
			List<string> list2 = new List<string> { "Amalgamation Hunt", "Ouroboros", "Oxythane Breach" };
			Mission[] missions = Global.Instance.Missions;
			foreach (Mission mission in missions)
			{
				bool flag = ((Enum)mission.MissionFlags).HasFlag((Enum)(object)(MissionFlags)1) && mission.CanBeSelected();
				bool flag2 = list2.Contains(mission.MissionName);
				if (!(flag || flag2))
				{
					continue;
				}
				MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu(mission.MissionName, parrentMenu2);
				list.Add(menuMod2Menu2);
				WorldRegion[] regions = Global.Instance.Regions;
				if (flag)
				{
					WorldRegion[] array = regions;
					foreach (WorldRegion region in array)
					{
						menuMod2Menu2.addButton(region.RegionName ?? "", (UnityAction)delegate
						{
							loadMission(mission, region);
						});
					}
				}
				else
				{
					if (!flag2)
					{
						continue;
					}
					WorldRegion defaultRegion = ((regions.Length != 0) ? regions[0] : null);
					if ((Object)(object)defaultRegion != (Object)null)
					{
						menuMod2Menu2.addButton(defaultRegion.RegionName ?? "", (UnityAction)delegate
						{
							loadMission(mission, defaultRegion);
						});
					}
				}
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in CreateMissionsMenu: " + ex.Message));
		}
	}

	public static void toggleForceModifier(MissionModifier modifier, MM2Button b = null)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (SparrohPlugin.forcedModifiers.Contains(modifier))
			{
				SparrohPlugin.forcedModifiers.Remove(modifier);
				if (b != null)
				{
					b.changePrefix("");
					b.changeColour(Color.white);
				}
			}
			else
			{
				SparrohPlugin.forcedModifiers.Add(modifier);
				if (b != null)
				{
					b.changePrefix("* ");
					b.changeColour(Color.green);
				}
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in toggleForceModifier: " + ex.Message));
		}
	}

	public static void loadMission(Mission mission, WorldRegion region, MM2Button b = null)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			SceneData val = (SceneData)((region.Scenes != null && region.Scenes.Length != 0) ? region.Scenes[0] : default(SceneData));
			MissionData mission2 = default(MissionData);
			((MissionData)(ref mission2))..ctor(MissionManager.MissionSeed, mission, region, val, Global.Instance.DefaultMissionContainer, mission.GetAdditionalData());
			if (SparrohPlugin.forcedModifiers != null && SparrohPlugin.forcedModifiers.Count > 0)
			{
				foreach (MissionModifier forcedModifier in SparrohPlugin.forcedModifiers)
				{
					int num = Global.Instance.MissionModifiers.IndexOf(forcedModifier);
					((MissionData)(ref mission2)).AddModifier(num, true, true);
				}
			}
			DropPod.SetMission(mission2);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in loadMission: " + ex.Message));
		}
	}
}
public static class OuroborosMenu
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static Func<IUpgradable, bool> <>9__0_0;

		public static Func<IUpgradable, GearType> <>9__0_1;

		public static Func<IGrouping<GearType, IUpgradable>, string> <>9__0_2;

		public static Func<IUpgradable, string> <>9__0_3;

		public static Func<Upgrade, bool> <>9__0_4;

		public static Func<Upgrade, Rarity> <>9__0_5;

		public static Func<Upgrade, string> <>9__0_6;

		public static Func<Upgrade, bool> <>9__0_9;

		public static Func<Upgrade, Rarity> <>9__0_10;

		public static Func<Upgrade, string> <>9__0_11;

		public static Func<UpgradeInfo, bool> <>9__0_14;

		public static Func<UpgradeInfo, GenericPlayerUpgrade> <>9__0_15;

		public static Func<SkillTreeUpgradeUI, Upgrade> <>9__0_18;

		public static Func<KeyValuePair<string, Upgrade>, Rarity> <>9__0_19;

		public static Func<KeyValuePair<string, Upgrade>, string> <>9__0_20;

		public static UnityAction <>9__0_17;

		internal bool <CreateOuroborosMenu>b__0_0(IUpgradable g)
		{
			return g.Info.Upgrades.Count > 0;
		}

		internal GearType <CreateOuroborosMenu>b__0_1(IUpgradable g)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return g.GearType;
		}

		internal string <CreateOuroborosMenu>b__0_2(IGrouping<GearType, IUpgradable> g)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			GearType key = g.Key;
			return ((object)(GearType)(ref key)).ToString();
		}

		internal string <CreateOuroborosMenu>b__0_3(IUpgradable g)
		{
			return g.Info.Name;
		}

		internal bool <CreateOuroborosMenu>b__0_4(Upgrade u)
		{
			if (Regex.IsMatch(u.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_|roachard)", RegexOptions.IgnoreCase))
			{
				return SparrohPlugin.sparrohMode;
			}
			return true;
		}

		internal Rarity <CreateOuroborosMenu>b__0_5(Upgrade u)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return u.Rarity;
		}

		internal string <CreateOuroborosMenu>b__0_6(Upgrade u)
		{
			return SparrohPlugin.CleanRichText(u.Name);
		}

		internal bool <CreateOuroborosMenu>b__0_9(Upgrade u)
		{
			if (Regex.IsMatch(u.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_|roachard)", RegexOptions.IgnoreCase))
			{
				return SparrohPlugin.sparrohMode;
			}
			return true;
		}

		internal Rarity <CreateOuroborosMenu>b__0_10(Upgrade u)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return u.Rarity;
		}

		internal string <CreateOuroborosMenu>b__0_11(Upgrade u)
		{
			return SparrohPlugin.CleanRichText(u.Name);
		}

		internal bool <CreateOuroborosMenu>b__0_14(UpgradeInfo u)
		{
			return u.Upgrade is GenericPlayerUpgrade;
		}

		internal GenericPlayerUpgrade <CreateOuroborosMenu>b__0_15(UpgradeInfo u)
		{
			Upgrade upgrade = u.Upgrade;
			return (GenericPlayerUpgrade)(object)((upgrade is GenericPlayerUpgrade) ? upgrade : null);
		}

		internal Upgrade <CreateOuroborosMenu>b__0_18(SkillTreeUpgradeUI ui)
		{
			return ui.Upgrade;
		}

		internal Rarity <CreateOuroborosMenu>b__0_19(KeyValuePair<string, Upgrade> kvp)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return kvp.Value.Rarity;
		}

		internal string <CreateOuroborosMenu>b__0_20(KeyValuePair<string, Upgrade> kvp)
		{
			return kvp.Key;
		}

		internal void <CreateOuroborosMenu>b__0_17()
		{
		}
	}

	public static void CreateOuroborosMenu(MenuMod2Menu parentMenu)
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ac: Invalid comparison between Unknown and I4
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Invalid comparison between Unknown and I4
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Expected O, but got Unknown
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d3: Expected O, but got Unknown
		//IL_03da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Expected O, but got Unknown
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Expected O, but got Unknown
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fe: Expected O, but got Unknown
		//IL_069b: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a5: Expected O, but got Unknown
		//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			MenuMod2Menu parrentMenu = new MenuMod2Menu("OUROBOROS", parentMenu);
			foreach (IGrouping<GearType, IUpgradable> item in (from g in Global.Instance.AllGear
				where g.Info.Upgrades.Count > 0
				group g by g.GearType).OrderBy(delegate(IGrouping<GearType, IUpgradable> g)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				GearType key2 = g.Key;
				return ((object)(GearType)(ref key2)).ToString();
			}))
			{
				GearType key = item.Key;
				string text = ((object)(GearType)(ref key)).ToString();
				MenuMod2Menu parrentMenu2 = new MenuMod2Menu("Ouro " + text, parrentMenu);
				foreach (IUpgradable gear in item.OrderBy((IUpgradable g) => g.Info.Name))
				{
					GearInfo info = gear.Info;
					MenuMod2Menu menuMod2Menu = new MenuMod2Menu("Ouro " + info.Name, parrentMenu2);
					foreach (Upgrade upgrade3 in (from u in info.Upgrades
						where !Regex.IsMatch(u.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_|roachard)", RegexOptions.IgnoreCase) || SparrohPlugin.sparrohMode
						orderby u.Rarity descending, SparrohPlugin.CleanRichText(u.Name)
						select u).ToList())
					{
						if ((int)upgrade3.UpgradeType == 2)
						{
							menuMod2Menu.addButton(SparrohPlugin.CleanRichText(upgrade3.Name), (UnityAction)delegate
							{
								giveCosmetic(upgrade3, gear);
							}).changeColour(upgrade3.Color);
						}
						else
						{
							menuMod2Menu.addButton(SparrohPlugin.CleanRichText(upgrade3.Name), (UnityAction)delegate
							{
								giveUpgrade(upgrade3, gear);
							}).changeColour(upgrade3.Color);
						}
					}
				}
			}
			MenuMod2Menu parrentMenu3 = new MenuMod2Menu("Ouro Characters", parrentMenu);
			Character[] characters = Global.Instance.Characters;
			foreach (Character character in characters)
			{
				GearInfo info2 = ((Dude)character).Info;
				MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu("Ouro " + info2.Name, parrentMenu3);
				foreach (Upgrade upgrade2 in (from u in ((Dude)character).Info.Upgrades
					where !Regex.IsMatch(u.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_|roachard)", RegexOptions.IgnoreCase) || SparrohPlugin.sparrohMode
					orderby u.Rarity descending, SparrohPlugin.CleanRichText(u.Name)
					select u).ToList())
				{
					if ((int)upgrade2.UpgradeType == 2)
					{
						menuMod2Menu2.addButton(SparrohPlugin.CleanRichText(upgrade2.Name), (UnityAction)delegate
						{
							giveCosmetic(upgrade2, (IUpgradable)(object)character);
						}).changeColour(upgrade2.Color);
					}
					else
					{
						menuMod2Menu2.addButton(SparrohPlugin.CleanRichText(upgrade2.Name), (UnityAction)delegate
						{
							giveCharacterUpgrade(upgrade2, (IUpgradable)(object)character);
						}).changeColour(upgrade2.Color);
					}
				}
			}
			MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu("Ouro Universal", parrentMenu3);
			try
			{
				GenericPlayerUpgrade[] source = (from u in PlayerData.GetAllUpgrades((IUpgradable)(object)Global.Instance, true)
					where u.Upgrade is GenericPlayerUpgrade
					select u).Select(delegate(UpgradeInfo u)
				{
					Upgrade upgrade4 = u.Upgrade;
					return (GenericPlayerUpgrade)(object)((upgrade4 is GenericPlayerUpgrade) ? upgrade4 : null);
				}).ToArray();
				HashSet<Upgrade> hashSet = new HashSet<Upgrade>();
				characters = Global.Instance.Characters;
				for (int i = 0; i < characters.Length; i++)
				{
					SkillTreeUpgradeUI[] componentsInChildren = ((Component)characters[i].SkillTree).GetComponentsInChildren<SkillTreeUpgradeUI>();
					hashSet.UnionWith(componentsInChildren.Select((SkillTreeUpgradeUI ui) => ui.Upgrade));
				}
				HashSet<Upgrade> characterSpecificUpgrades = new HashSet<Upgrade>();
				characters = Global.Instance.Characters;
				foreach (Character val in characters)
				{
					characterSpecificUpgrades.UnionWith(((Dude)val).Info.Upgrades);
				}
				List<GenericPlayerUpgrade> list = source.Where((GenericPlayerUpgrade u) => (int)((Upgrade)u).UpgradeType != 2 && (!Regex.IsMatch(((Upgrade)u).Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_|roachard)", RegexOptions.IgnoreCase) || SparrohPlugin.sparrohMode) && !characterSpecificUpgrades.Contains((Upgrade)(object)u)).ToList();
				foreach (GenericPlayerUpgrade item2 in list)
				{
					_ = item2;
				}
				Dictionary<string, Upgrade> dictionary = new Dictionary<string, Upgrade>();
				foreach (GenericPlayerUpgrade item3 in list)
				{
					if (!dictionary.ContainsKey(((Upgrade)item3).APIName))
					{
						dictionary[((Upgrade)item3).APIName] = (Upgrade)(object)item3;
					}
				}
				if (dictionary.Any())
				{
					foreach (KeyValuePair<string, Upgrade> item4 in from kvp in dictionary
						orderby kvp.Value.Rarity descending, kvp.Key
						select kvp)
					{
						Upgrade upgrade = item4.Value;
						bool flag = false;
						menuMod2Menu3.addButton(SparrohPlugin.CleanRichText(upgrade.Name), (UnityAction)delegate
						{
							giveUniversalUpgrade(upgrade);
						}).changeColour(flag ? Color.green : upgrade.Color);
					}
					return;
				}
				object obj = <>c.<>9__0_17;
				if (obj == null)
				{
					UnityAction val2 = delegate
					{
					};
					<>c.<>9__0_17 = val2;
					obj = (object)val2;
				}
				menuMod2Menu3.addButton("No generics found", (UnityAction)obj);
			}
			catch (Exception ex)
			{
				SparrohPlugin.Logger.LogError((object)("Exception in ouroboros universal upgrade menu creation: " + ex.Message + "\n" + ex.StackTrace));
			}
		}
		catch (Exception ex2)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in CreateOuroborosMenu: " + ex2.Message));
		}
	}

	public static void giveCosmetic(Upgrade upgrade, IUpgradable gear, MM2Button b = null)
	{
		//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_000e: Expected O, but got Unknown
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		try
		{
			UpgradeInstance val = new UpgradeInstance(upgrade, gear);
			PlayerData.CollectInstance(val, (UnlockFlags)1);
			SetRented(val);
			val.Unlock(true);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in giveCosmetic: " + ex.Message));
		}
	}

	public static void giveUpgrade(Upgrade upgrade, IUpgradable gear, MM2Button b = null)
	{
		//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_000e: Expected O, but got Unknown
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		try
		{
			UpgradeInstance val = new UpgradeInstance(upgrade, gear);
			PlayerData.CollectInstance(val, (UnlockFlags)0);
			SetRented(val);
			val.Unlock(true);
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in giveUpgrade: " + ex.Message));
		}
	}

	public static void giveCharacterUpgrade(Upgrade upgrade, IUpgradable character, MM2Button b = null)
	{
		try
		{
			UpgradeInstance obj = PlayerData.CollectInstance(character, upgrade, (UnlockFlags)1);
			SetRented(obj);
			obj.Seed = Random.Range(int.MinValue, int.MaxValue);
			obj.Unlock(false);
			PlayerData instance = PlayerData.Instance;
			instance.TotalSkillPointsSpent += 1;
			Character val = (Character)(object)((character is Character) ? character : null);
			if (val != null && (Object)(object)val.SkillTree != (Object)null)
			{
				val.SkillTree.Refresh();
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in giveCharacterUpgrade: " + ex.Message));
		}
	}

	public static void giveUniversalUpgrade(Upgrade upgrade, MM2Button b = null)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			IUpgradable instance = (IUpgradable)(object)Global.Instance;
			UpgradeInstance val = new UpgradeInstance(upgrade, instance);
			PlayerData.CollectInstance(val, (UnlockFlags)1);
			SetRented(val);
			val.Seed = Random.Range(int.MinValue, int.MaxValue);
			val.Unlock(true);
			((PlayerUpgrade)upgrade).Apply(Player.LocalPlayer, val);
			SparrohPlugin.SendTextChatMessageToClient("Ouroboros universal upgrade added silently.");
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Exception in giveUniversalUpgrade: " + ex.Message));
		}
	}

	private static void SetRented(UpgradeInstance upgradeInstance)
	{
		try
		{
			PropertyInfo property = typeof(UpgradeInstance).GetProperty("RemoveAfterMission", BindingFlags.Instance | BindingFlags.Public);
			if (property != null)
			{
				property.SetValue(upgradeInstance, true);
				SparrohPlugin.Logger.LogInfo((object)("Set RemoveAfterMission to true for " + upgradeInstance.Upgrade.Name));
			}
			else
			{
				SparrohPlugin.Logger.LogWarning((object)"RemoveAfterMission property not found");
			}
		}
		catch (Exception ex)
		{
			SparrohPlugin.Logger.LogError((object)("Failed to set RemoveAfterMission: " + ex.Message));
		}
		PlayerData.Instance.rentedUpgrades.Add(upgradeInstance);
		SparrohPlugin.Logger.LogInfo((object)$"Added to rentedUpgrades. Count: {PlayerData.Instance.rentedUpgrades.Count}");
	}
}
[MycoMod(/*Could not decode attribute arguments.*/)]
[BepInPlugin("venuss.cheatmenuplus", "CheatMenu+", "1.5.5")]
public class SparrohPlugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__29_0;

		public static UnityAction <>9__33_0;

		public static UnityAction <>9__33_1;

		public static UnityAction <>9__33_2;

		public static UnityAction <>9__33_3;

		public static UnityAction <>9__33_5;

		internal void <createMainMenu>b__29_0()
		{
		}

		internal void <AddEnemyMenu>b__33_0()
		{
			CheatsMenu.killAllEnemies();
		}

		internal void <AddEnemyMenu>b__33_1()
		{
			SpawnMenu.spawnSwarm(10);
		}

		internal void <AddEnemyMenu>b__33_2()
		{
			CheatsMenu.cleanUpParts();
		}

		internal void <AddEnemyMenu>b__33_3()
		{
			CheatsMenu.cleanUpCollectables();
		}

		internal void <AddEnemyMenu>b__33_5()
		{
		}
	}

	public const string PluginGUID = "venuss.cheatmenuplus";

	public const string PluginName = "CheatMenu+";

	public const string PluginVersion = "1.5.5";

	public static ManualLogSource Logger;

	public InputActionMap _actionmap;

	private InputAction _openMenu;

	public GameObject menuCanvas;

	private bool enabled;

	public List<MenuMod2Menu> allMenues = new List<MenuMod2Menu>();

	public MenuMod2Menu mainMenu;

	public static int previousAirJumps = 0;

	public static float previousAirJumpSpeed = 0f;

	public static bool god = false;

	public static bool sprintFast = false;

	public static bool superJump = false;

	public static bool airJump = false;

	public static bool infiniteResources = false;

	public static bool infiniteAmmo = false;

	public static bool noCooldowns = false;

	public static bool movementPreset = false;

	public static float moveSpeedOverride = 10f;

	public static float jumpSpeedOverride = 14f;

	public static bool sparrohMode = false;

	public static List<MissionModifier> forcedModifiers = new List<MissionModifier>();

	private static float nextAmmoRefreshTime = 0f;

	private static float nextCooldownRefreshTime = 0f;

	private void Awake()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		Logger = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(typeof(SparrohPlugin), (string)null);
		SceneManager.sceneLoaded += OnSceneLoaded;
		_actionmap = new InputActionMap();
		_openMenu = InputActionSetupExtensions.AddAction(_actionmap, "OpenMenu", (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null);
		InputActionSetupExtensions.AddBinding(_openMenu, "<Keyboard>/insert", (string)null, (string)null, (string)null);
		_openMenu.performed += delegate
		{
			toggleMenu();
		};
		Logger.LogInfo((object)"CheatMenu+ loaded");
	}

	private void Update()
	{
		ApplyActiveCheats();
	}

	private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		Logger.LogDebug((object)("Scene loaded: " + ((Scene)(ref scene)).name));
		if (ProfileConfig.Instance == null)
		{
			return;
		}
		FieldInfo field = typeof(ProfileConfig).GetField("profileIndex", BindingFlags.Instance | BindingFlags.NonPublic);
		if (!(field == null))
		{
			if ((int)field.GetValue(ProfileConfig.Instance) == 0)
			{
				Logger.LogWarning((object)"Using default profile is not supported.  Please switch to a different profile on the main menu.");
				_actionmap.Disable();
			}
			else
			{
				createMainMenu();
				_actionmap.Enable();
			}
		}
	}

	public void createMainMenu()
	{
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Expected O, but got Unknown
		try
		{
			if (mainMenu == null)
			{
				_ = (Object)(object)Global.Instance != (Object)null;
				mainMenu = new MenuMod2Menu("Main Menu");
				SpawnMenu.CreateSpawnMenu(mainMenu);
				CheatsMenu.CreateCheatsMenu(mainMenu);
				if ((Object)(object)Global.Instance != (Object)null)
				{
					MissionsMenu.CreateMissionsMenu(mainMenu);
					UpgradesMenu.CreateUpgradesMenu(mainMenu);
					UpgradesMenu.RehydratePersistedCustomUpgrades();
					OuroborosMenu.CreateOuroborosMenu(mainMenu);
					ProgressionMenu.CreateProgressionMenu(mainMenu);
				}
			}
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("Exception in createMainMenu: " + ex.Message));
			if (mainMenu == null)
			{
				mainMenu = new MenuMod2Menu("Main Menu");
				MenuMod2Menu menuMod2Menu = new MenuMod2Menu("Error - Check Logs", mainMenu);
				object obj = <>c.<>9__29_0;
				if (obj == null)
				{
					UnityAction val = delegate
					{
					};
					<>c.<>9__29_0 = val;
					obj = (object)val;
				}
				menuMod2Menu.addButton("Error occurred - check logs", (UnityAction)obj);
			}
		}
	}

	public static List<T> GetItemsFromWeightedArray<T>(object weightedArray)
	{
		if (weightedArray == null)
		{
			return null;
		}
		Type type = weightedArray.GetType();
		if (!type.IsGenericType || type.GetGenericTypeDefinition().Name != "WeightedArray`1")
		{
			throw new ArgumentException("Expected instance of WeightedArray<T>");
		}
		FieldInfo? field = type.GetField("items", BindingFlags.Instance | BindingFlags.NonPublic);
		if (field == null)
		{
			throw new MissingFieldException("Could not find 'items' field in WeightedArray");
		}
		if (!(field.GetValue(weightedArray) is Array array))
		{
			return null;
		}
		List<T> list = new List<T>();
		foreach (object item2 in array)
		{
			if (item2 != null)
			{
				Type type2 = item2.GetType();
				FieldInfo field2 = type2.GetField("weight");
				FieldInfo field3 = type2.GetField("value");
				if (!(field2 == null) && !(field3 == null) && (int)field2.GetValue(item2) > 0)
				{
					T item = (T)field3.GetValue(item2);
					list.Add(item);
				}
			}
		}
		return list;
	}

	public void toggleMenu()
	{
		try
		{
			if (MenuMod2Manager.currentMenu != null)
			{
				MenuMod2Manager.currentMenu.Close();
				return;
			}
			if (mainMenu == null && ProfileConfig.Instance != null)
			{
				FieldInfo field = typeof(ProfileConfig).GetField("profileIndex", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null && (int)field.GetValue(ProfileConfig.Instance) != 0)
				{
					createMainMenu();
				}
			}
			if (mainMenu != null)
			{
				mainMenu.Open();
			}
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("Exception in toggleMenu: " + ex.Message));
		}
	}

	public static GameObject findObjectByName(string name)
	{
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
		foreach (GameObject val in array)
		{
			if (((Object)val).name == name)
			{
				Scene scene = val.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					return val;
				}
			}
		}
		return null;
	}

	public static void AddEnemyMenu(MenuMod2Menu enemyMenu)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Expected O, but got Unknown
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to inv