Decompiled source of MenuMod2 v1.0.1

MenuMod2 V1.0.0.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MenuMod2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Menu Mod 2")]
[assembly: AssemblyTitle("MenuMod2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MenuMod2
{
	public static class Cheats
	{
		public static ManualLogSource Logger = MenuMod2.Logger;

		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 List<MissionModifier> forcedModifiers = new List<MissionModifier>();

		public static void giveAllUpgrades(MM2Button b = null)
		{
			//IL_0035: 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: Invalid comparison between Unknown and I4
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			IUpgradable[] allGear = Global.Instance.AllGear;
			foreach (IUpgradable val in allGear)
			{
				GearInfo info = val.Info;
				Upgrade[] upgrades = info.Upgrades;
				foreach (Upgrade val2 in upgrades)
				{
					if ((int)val2.UpgradeType != 0 && (int)val2.UpgradeType != 2)
					{
						UpgradeInstance val3 = new UpgradeInstance(val2, val);
						PlayerData.CollectInstance(val3, (UnlockFlags)0);
						val3.Unlock(false);
					}
				}
			}
		}

		public static void giveAllCosmetics(MM2Button b = null)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			IUpgradable[] allGear = Global.Instance.AllGear;
			foreach (IUpgradable val in allGear)
			{
				GearInfo info = val.Info;
				Upgrade[] upgrades = info.Upgrades;
				foreach (Upgrade val2 in upgrades)
				{
					if ((int)val2.UpgradeType == 2 && !val2.ExcludeFromWorldPool)
					{
						UpgradeInstance val3 = new UpgradeInstance(val2, val);
						PlayerData.CollectInstance(val3, (UnlockFlags)0);
						val3.Unlock(false);
					}
				}
			}
		}

		public static void giveMissingUpgrades(MM2Button b = null)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0045: 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_0054: Invalid comparison between Unknown and I4
			IUpgradable[] allGear = Global.Instance.AllGear;
			foreach (IUpgradable val in allGear)
			{
				GearInfo info = val.Info;
				Upgrade[] upgrades = info.Upgrades;
				foreach (Upgrade val2 in upgrades)
				{
					UpgradeInstance val3 = new UpgradeInstance(val2, val);
					if ((int)val2.UpgradeType != 0 && (int)val2.UpgradeType != 2 && (PlayerData.GetUnlockedInstances(val2) == null || PlayerData.GetUnlockedInstances(val2).Instances == null || PlayerData.GetUnlockedInstances(val2).Instances.Count <= 0))
					{
						Logger.LogInfo((object)("Unlocking upgrade " + val2.Name + " for gear " + info.Name));
						PlayerData.CollectInstance(val3, (UnlockFlags)0);
						val3.Unlock(false);
					}
				}
			}
		}

		public static void giveUpgrade(Upgrade upgrade, IUpgradable gear, MM2Button b = null)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			UpgradeInstance val = new UpgradeInstance(upgrade, gear);
			PlayerData.CollectInstance(val, (UnlockFlags)0);
			val.Unlock(false);
		}

		public static void printAllUpgradeStats(MM2Button b = null)
		{
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Invalid comparison between Unknown and I4
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			list.Add("Broke1");
			list.Add("Broke2");
			list.Add("Broke3");
			list.Add("Broke4");
			list.Add("PrismEp");
			list.Add("PrismEx");
			list.Add("PrismR");
			list.Add("PrismS");
			List<Type> list2 = new List<Type>();
			list2.Add(typeof(UpgradeProperty_UpgradeFlag));
			IUpgradable[] allGear = Global.Instance.AllGear;
			foreach (IUpgradable val in allGear)
			{
				GearInfo info = val.Info;
				if ((Object)(object)info == (Object)null || !info.HasUpgradeGrid || info.Upgrades.Count() == 0)
				{
					continue;
				}
				string name = info.Name;
				MenuMod2.Logger.LogInfo((object)("Gear: " + name));
				Upgrade[] upgrades = info.Upgrades;
				if (upgrades == null || upgrades.Length == 0)
				{
					continue;
				}
				Upgrade[] array = upgrades;
				foreach (Upgrade val2 in array)
				{
					if ((int)val2.UpgradeType == 0 || (int)val2.UpgradeType == 2 || (val2.ExcludeFromWorldPool && !list.Contains(val2.APIName)))
					{
						continue;
					}
					string text = MenuMod2.CleanRichText(val2.Name);
					string text2 = MenuMod2.CleanRichText(val2.Description);
					MenuMod2.Logger.LogInfo((object)("-\tUpgrade: " + text + " [" + val2.RarityName + "] - " + text2));
					UpgradePropertyList properties = val2.Properties;
					if (!((UpgradePropertyList)(ref properties)).HasProperties)
					{
						continue;
					}
					foreach (UpgradeProperty item in (UpgradePropertyList)(ref properties))
					{
						if (!list2.Contains(((object)item).GetType()))
						{
							MenuMod2.Logger.LogInfo((object)$"-\t-\tProperty: {item}");
							FieldInfo[] fields = ((object)item).GetType().GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
							LogFieldsRecursive(item);
						}
					}
				}
			}
			static void LogFieldsRecursive(object obj, string indent = "-\t-\t-\t", int depth = 0, int maxDepth = 10)
			{
				if (obj != null && depth <= maxDepth)
				{
					Type type = obj.GetType();
					if (type.IsPrimitive || type == typeof(string) || type == typeof(Vector2) || type == typeof(Vector3) || type.IsEnum)
					{
						MenuMod2.Logger.LogInfo((object)$"{indent}{type.Name} = {obj}");
					}
					else
					{
						FieldInfo[] fields2 = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
						if (fields2.Length == 0)
						{
							MenuMod2.Logger.LogInfo((object)(indent + type.Name + " has no fields to log."));
						}
						else
						{
							FieldInfo[] array2 = fields2;
							foreach (FieldInfo fieldInfo in array2)
							{
								object value = fieldInfo.GetValue(obj);
								if (value == null)
								{
									MenuMod2.Logger.LogInfo((object)(indent + fieldInfo.Name + " = null"));
								}
								else
								{
									Type type2 = value.GetType();
									if (type2.IsPrimitive || type2 == typeof(string) || type2 == typeof(Vector2) || type2 == typeof(Vector3) || type2.IsEnum)
									{
										MenuMod2.Logger.LogInfo((object)$"{indent}{fieldInfo.Name} = {value} ({type2.Name})");
									}
									else
									{
										MenuMod2.Logger.LogInfo((object)(indent + fieldInfo.Name + " = " + type2.Name));
										LogFieldsRecursive(value, indent + "-\t", depth + 1, maxDepth);
									}
								}
							}
						}
					}
				}
			}
		}

		public static void spawnObject(string name, MM2Button b = null)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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)
			Vector3 position = ((Component)Player.LocalPlayer).gameObject.transform.position;
			Vector3 forward = ((Component)Player.LocalPlayer.PlayerLook.Camera).transform.forward;
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(position, forward, ref val, 100000f))
			{
				GameObject val2 = MenuMod2.findObjectByName(name);
				if ((Object)(object)val2 == (Object)null)
				{
					return;
				}
				GameObject obj = Object.Instantiate<GameObject>(val2);
				obj.transform.position = ((RaycastHit)(ref val)).point;
				if (!FindValidSpawnPos(ref obj))
				{
					SendTextChatMessageToClient("Could not find valid spawn position in look direction.");
					return;
				}
				NetworkObject component = obj.GetComponent<NetworkObject>();
				if (component != null)
				{
					component.Spawn(true);
				}
			}
			else
			{
				SendTextChatMessageToClient("Invalid look position.");
			}
		}

		public static void SendDebugTextChatMessage(MM2Button b = null)
		{
			MenuMod2.Logger.LogInfo((object)"Sending test message to chat");
			SendTextChatMessageToClient("Debug Message this message is very long, longer than the 128 char limit. does it show everything, or what happens. I dont' know untill I test it.  But you'll know when you're reading this! \nDebug Message this message is very long, longer than the 128 char limit. does it show everything, or what happens.  I dont' know untill I test it.  But you'll know when you're reading this!");
		}

		public static void SendTextChatMessageToClient(string Message, MM2Button b = null)
		{
			Player.LocalPlayer.PlayerLook.AddTextChatMessage(Message, Player.LocalPlayer);
		}

		public static bool FindValidSpawnPos(ref GameObject obj, MM2Button b = null)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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)
			Vector3 position = obj.transform.position;
			if ((Object)(object)obj == (Object)null)
			{
				return false;
			}
			obj.SetActive(false);
			Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>();
			if (componentsInChildren.Length == 0)
			{
				Debug.LogWarning((object)"No renderers found, cannot calculate bounds.");
				Object.Destroy((Object)(object)obj);
				return false;
			}
			Bounds bounds = componentsInChildren[0].bounds;
			Renderer[] array = componentsInChildren;
			foreach (Renderer val in array)
			{
				((Bounds)(ref bounds)).Encapsulate(val.bounds);
			}
			Vector3 extents = ((Bounds)(ref bounds)).extents;
			Quaternion rotation = obj.transform.rotation;
			Vector3 val2 = ((Bounds)(ref bounds)).center - obj.transform.position;
			Vector3 val3 = position;
			for (int j = 0; j < 100; j++)
			{
				Vector3 val4 = val3 + val2;
				if (!Physics.CheckBox(val4, extents, rotation))
				{
					obj.transform.position = val3;
					obj.SetActive(true);
					return true;
				}
				val3 += Vector3.up * 1f;
			}
			Debug.LogWarning((object)"No valid spawn position found. Destroying object.");
			Object.Destroy((Object)(object)obj);
			return false;
		}

		public static void toggleGod(MM2Button button = null)
		{
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			if (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 });
				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 });
				god = true;
			}
			if (button != null)
			{
				if (god)
				{
					button.changeColour(Color.green);
				}
				else
				{
					button.changeColour(Color.red);
				}
			}
		}

		public static void toggleSprintFast(MM2Button b = null)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (sprintFast)
			{
				Player.LocalPlayer.DefaultMoveSpeed = 10f;
				sprintFast = false;
			}
			else
			{
				Player.LocalPlayer.DefaultMoveSpeed = 100f;
				sprintFast = true;
			}
			if (b != null)
			{
				if (sprintFast)
				{
					b.changeColour(Color.green);
				}
				else
				{
					b.changeColour(Color.red);
				}
			}
		}

		public static void toggleSuperJump(MM2Button b = null)
		{
			//IL_009c: 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)
			if (superJump)
			{
				FieldInfo field = typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(Player.LocalPlayer, 14f);
				superJump = false;
			}
			else
			{
				FieldInfo field2 = typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				field2.SetValue(Player.LocalPlayer, 100f);
				superJump = true;
			}
			if (b != null)
			{
				if (superJump)
				{
					b.changeColour(Color.green);
				}
				else
				{
					b.changeColour(Color.red);
				}
			}
		}

		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)
			{
				FieldInfo field = typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(Player.LocalPlayer, 100f);
			}
			else
			{
				FieldInfo field2 = typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				field2.SetValue(Player.LocalPlayer, 14f);
			}
		}

		public static void setAirJump(bool enabled, MM2Button b = null)
		{
			if (enabled)
			{
				FieldInfo field = typeof(Player).GetField("airJumps", BindingFlags.Instance | BindingFlags.NonPublic);
				FieldInfo field2 = typeof(Player).GetField("airJumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				if ((int)field.GetValue(Player.LocalPlayer) != 100)
				{
					previousAirJumps = (int)field.GetValue(Player.LocalPlayer);
				}
				if ((int)field2.GetValue(Player.LocalPlayer) != 100)
				{
					previousAirJumpSpeed = (float)field2.GetValue(Player.LocalPlayer);
				}
				field.SetValue(Player.LocalPlayer, 100);
				FieldInfo field3 = typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				field2.SetValue(Player.LocalPlayer, field3.GetValue(Player.LocalPlayer));
			}
			else
			{
				FieldInfo field4 = typeof(Player).GetField("airJumps", BindingFlags.Instance | BindingFlags.NonPublic);
				field4.SetValue(Player.LocalPlayer, previousAirJumps);
				FieldInfo field5 = typeof(Player).GetField("airJumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
				field4.SetValue(Player.LocalPlayer, previousAirJumpSpeed);
			}
		}

		public static void enemySpawning(bool enabled, MM2Button b = null)
		{
			if (enabled)
			{
				EnemyManager.Instance.EnableSpawning();
			}
			else
			{
				EnemyManager.Instance.DisableSpawning();
			}
		}

		public static MM2Button toggleSpawning(MM2Button b = null)
		{
			//IL_0067: 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)
			FieldInfo field = typeof(EnemyManager).GetField("enableAmbientWave", BindingFlags.Instance | BindingFlags.NonPublic);
			if ((bool)field.GetValue(EnemyManager.Instance))
			{
				EnemyManager.Instance.DisableSpawning();
				b?.changeColour(Color.red);
			}
			else
			{
				EnemyManager.Instance.EnableSpawning();
				b?.changeColour(Color.green);
			}
			return b;
		}

		public static void killAllEnemies(MM2Button b = null)
		{
			EnemyManager.Instance.KillAllEnemies_Server();
		}

		public static void spawnSwarm(int size, MM2Button b = null)
		{
			EnemyManager.Instance.SpawnSwarm_ServerRpc(size);
		}

		public static void toggleForceModifier(MissionModifier modifier, MM2Button b = null)
		{
			//IL_0080: 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)
			if (forcedModifiers.Contains(modifier))
			{
				forcedModifiers.Remove(modifier);
				if (b != null)
				{
					b.changePrefix("");
					b.changeColour(Color.white);
				}
				Logger.LogDebug((object)("Removed forced modifier: " + modifier.ModifierName));
			}
			else
			{
				forcedModifiers.Add(modifier);
				if (b != null)
				{
					b.changePrefix("* ");
					b.changeColour(Color.green);
				}
				Logger.LogDebug((object)("Added forced modifier: " + modifier.ModifierName));
			}
		}

		public static void cleanUpParts(MM2Button b = null)
		{
			List<EnemyPart> list = Object.FindObjectsOfType<EnemyPart>().ToList();
			foreach (EnemyPart item in list)
			{
				item.Kill((DamageFlags)2);
			}
		}

		public static void cleanUpCollectables(MM2Button b = null)
		{
			List<ClientCollectable> list = Object.FindObjectsOfType<ClientCollectable>().ToList();
			foreach (ClientCollectable item in list)
			{
				item.DespawnTrackedObject();
			}
		}

		public static void collectGear(IUpgradable gear, MM2Button b = null)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			PlayerData.CollectGear(gear);
			PlayerData.GetGearData(gear).Collect();
			b?.changeColour(Color.yellow);
		}

		public static void unlockGear(IUpgradable gear, MM2Button b = null)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			PlayerData.UnlockGear(gear, false);
			PlayerData.GetGearData(gear).Unlock();
			b?.changeColour(Color.green);
		}

		public static void loadMission(Mission mission, WorldRegion region, MM2Button b = null)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			MissionData mission2 = default(MissionData);
			((MissionData)(ref mission2))..ctor(MissionManager.MissionSeed, mission, region, region.SceneNames[0], Global.Instance.DefaultMissionContainer);
			DropPod.SetMission(mission2);
		}

		public static void giveAllResoruces(MM2Button b = null)
		{
			PlayerResource[] playerResources = Global.Instance.PlayerResources;
			PlayerResource[] array = playerResources;
			foreach (PlayerResource val in array)
			{
				PlayerData.Instance.AddResource(val, val.Max);
			}
		}

		public static void levelUpAllWeapons(int level, MM2Button b = null)
		{
			IUpgradable[] allGear = Global.Instance.AllGear;
			MenuMod2.Logger.LogDebug((object)$"found {allGear.Length} gear items to level up.");
			IUpgradable[] array = allGear;
			foreach (IUpgradable gear in array)
			{
				levelUpWeapon(gear, level);
			}
		}

		public static void levelUpWeapon(IUpgradable gear, int level, MM2Button b = null)
		{
			MenuMod2.Logger.LogInfo((object)$"Leveling up {gear.Info.Name} to level {level}");
			GearData gearData = PlayerData.GetGearData(gear);
			if (gearData.IsUnlocked)
			{
				FieldInfo field = ((object)gearData).GetType().GetField("level", BindingFlags.Instance | BindingFlags.NonPublic);
				int val = (int)field.GetValue(gearData);
				field.SetValue(gearData, Math.Max(level, val));
			}
		}

		public static void setAllCharictersToLevel(int level, MM2Button b = null)
		{
			Character[] characters = Global.Instance.Characters;
			MenuMod2.Logger.LogDebug((object)$"found {characters.Length} characters to set level for.");
			Character[] array = characters;
			foreach (Character val in array)
			{
				MenuMod2.Logger.LogInfo((object)$"Setting level for {((Object)val).name} to {level}");
				GearData gearData = PlayerData.GetGearData((IUpgradable)(object)val);
				if (gearData.IsUnlocked)
				{
					FieldInfo field = ((object)gearData).GetType().GetField("level", BindingFlags.Instance | BindingFlags.NonPublic);
					int val2 = (int)field.GetValue(gearData);
					field.SetValue(gearData, Math.Max(level, val2));
				}
			}
		}

		public static void giveAllSkills(MM2Button b = null)
		{
			Character[] characters = Global.Instance.Characters;
			MenuMod2.Logger.LogDebug((object)$"found {characters.Length} characters to unlock skills for.");
			Character[] array = characters;
			foreach (Character val in array)
			{
				MenuMod2.Logger.LogDebug((object)("Unlocking all skills for " + ((Object)val).name));
				SkillTree skillTree = val.SkillTree;
				SkillTreeUpgradeUI[] componentsInChildren = ((Component)skillTree).GetComponentsInChildren<SkillTreeUpgradeUI>();
				SkillTreeUpgradeUI[] array2 = componentsInChildren;
				foreach (SkillTreeUpgradeUI val2 in array2)
				{
					MenuMod2.Logger.LogInfo((object)("Unlocking skill " + val2.Upgrade.Name + " for " + ((Object)val).name));
					UpgradeInstance val3 = PlayerData.CollectInstance((IUpgradable)(object)val, val2.Upgrade, (UnlockFlags)0);
					val3.Seed = val2.Upgrade.ID;
					val3.Unlock(false);
					PlayerData instance = PlayerData.Instance;
					int totalSkillPointsSpent = instance.TotalSkillPointsSpent;
					instance.TotalSkillPointsSpent = totalSkillPointsSpent + 1;
					skillTree.Refresh();
				}
			}
		}

		public static void unlockLockedSkills(MM2Button b = null)
		{
			Character[] characters = Global.Instance.Characters;
			MenuMod2.Logger.LogDebug((object)$"found {characters.Length} characters to unlock skills for.");
			Character[] array = characters;
			foreach (Character val in array)
			{
				MenuMod2.Logger.LogDebug((object)("Unlocking all skills for " + ((Object)val).name));
				SkillTree skillTree = val.SkillTree;
				SkillTreeUpgradeUI[] componentsInChildren = ((Component)skillTree).GetComponentsInChildren<SkillTreeUpgradeUI>();
				SkillTreeUpgradeUI[] array2 = componentsInChildren;
				foreach (SkillTreeUpgradeUI val2 in array2)
				{
					if (PlayerData.GetUpgradeInfo((IUpgradable)(object)val, val2.Upgrade).TotalInstancesCollected > 0)
					{
						MenuMod2.Logger.LogInfo((object)("Skill " + val2.Upgrade.Name + " is already unlocked for " + ((Object)val).name));
						continue;
					}
					MenuMod2.Logger.LogInfo((object)("Unlocking skill " + val2.Upgrade.Name + " for " + ((Object)val).name));
					UpgradeInstance val3 = PlayerData.CollectInstance((IUpgradable)(object)val, val2.Upgrade, (UnlockFlags)0);
					val3.Seed = val2.Upgrade.ID;
					val3.Unlock(false);
					PlayerData instance = PlayerData.Instance;
					int totalSkillPointsSpent = instance.TotalSkillPointsSpent;
					instance.TotalSkillPointsSpent = totalSkillPointsSpent + 1;
					skillTree.Refresh();
				}
			}
		}

		public static void spawnEnemy(EnemyClass enemyClass, Vector3 pos = default(Vector3), MM2Button b = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			if (pos == default(Vector3))
			{
				EnemyManager.Instance.SpawnEnemy_Server(enemyClass);
			}
			else
			{
				EnemyManager.Instance.SpawnEnemy_Server(pos, enemyClass, (WeightedArray<EnemyClassGroup>)null, false, (CustomWave)null);
			}
		}

		public static void spawnEnemy(EnemyClassGroup enemyClassGroup, Vector3 pos = default(Vector3), MM2Button b = null)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			if (pos == default(Vector3))
			{
				EnemyManager.Instance.SpawnEnemy_Server(enemyClassGroup);
			}
			else
			{
				EnemyManager.Instance.SpawnEnemy_Server(pos, enemyClassGroup);
			}
		}
	}
	public static class MenuMod2Manager
	{
		internal static ManualLogSource Logger;

		public static List<MenuMod2Menu> allMenus;

		public static MenuMod2Menu currentMenu;
	}
	public class MenuMod2Menu
	{
		public List<MM2Button> buttons;

		public GameObject menuCanvas;

		public string menuName;

		public MenuMod2Menu parrentMenu;

		public MM2Button thisButton = null;

		public List<MenuMod2Menu> subMenus;

		public MenuMod2Menu(string indetifier, MenuMod2Menu _parrentMenu = null)
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Expected O, but got Unknown
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			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 val = menuCanvas.AddComponent<Canvas>();
			val.renderMode = (RenderMode)0;
			menuCanvas.AddComponent<CanvasScaler>();
			menuCanvas.AddComponent<GraphicRaycaster>();
			if (_parrentMenu != null)
			{
				parrentMenu = _parrentMenu;
				MenuMod2Menu menuMod2Menu = parrentMenu;
				if (menuMod2Menu.subMenus == null)
				{
					menuMod2Menu.subMenus = new List<MenuMod2Menu>();
				}
				parrentMenu.subMenus.Add(this);
				MenuMod2.Logger.LogDebug((object)("Creating menu " + indetifier + " under " + _parrentMenu.menuName));
				thisButton = parrentMenu.addButton(indetifier, (UnityAction)delegate
				{
					Open();
				});
				addButton("Back", (UnityAction)delegate
				{
					parrentMenu.Open();
				}).changeColour(Color.grey).changeSuffix(" (" + parrentMenu.menuName + ")").changePrefix("[" + menuName + "]\n");
			}
			else if (indetifier == "Main Menu")
			{
				MenuMod2.Logger.LogDebug((object)("Creating menu " + indetifier));
				addButton("Close", (UnityAction)delegate
				{
					Close();
				}).changeColour(Color.red);
				parrentMenu = null;
			}
		}

		public void Open()
		{
			MenuMod2.Logger.LogDebug((object)("Opening menu: " + (menuName ?? "unkown")));
			if (MenuMod2Manager.currentMenu != null && MenuMod2Manager.currentMenu != this)
			{
				MenuMod2Manager.currentMenu.Close();
			}
			MenuMod2Manager.currentMenu = this;
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			foreach (MM2Button button in buttons)
			{
				button.show();
			}
		}

		public void Close()
		{
			if (MenuMod2Manager.currentMenu != this)
			{
				MenuMod2.Logger.LogWarning((object)("Attempted to close menu \"" + menuName + "\" that wasn't open.  This should not happen"));
				return;
			}
			MenuMod2.Logger.LogDebug((object)("Closing menu: " + menuName));
			MenuMod2Manager.currentMenu = null;
			if ((Object)(object)Player.LocalPlayer != (Object)null && Player.LocalPlayer.PlayerLook.EnableMenuCamera == 0)
			{
				Cursor.visible = false;
				Cursor.lockState = (CursorLockMode)1;
			}
			foreach (MM2Button button in buttons)
			{
				button.hide();
			}
		}

		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_000c: Unknown result type (might be due to invalid IL or missing references)
			MM2Button mM2Button = new MM2Button(this, new Vector2(0f, 0f), text, callback, menuCanvas);
			buttons.Add(mM2Button);
			arrangeButtons();
			return mM2Button;
		}

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

		public void destroy()
		{
			List<MenuMod2Menu> list = new List<MenuMod2Menu>(MenuMod2Manager.allMenus);
			foreach (MenuMod2Menu item in list)
			{
				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();
				}
			}
			List<MM2Button> list2 = new List<MM2Button>(parrentMenu?.buttons ?? new List<MM2Button>());
			foreach (MM2Button item2 in list2)
			{
				if (item2.name == thisButton.name)
				{
					parrentMenu.buttons.Remove(item2);
				}
			}
			List<MM2Button> list3 = new List<MM2Button>(buttons);
			foreach (MM2Button item3 in list3)
			{
				Object.Destroy((Object)(object)item3.buttonObj);
				buttons.Remove(item3);
			}
			List<MenuMod2Menu> list4 = subMenus ?? new List<MenuMod2Menu>();
			foreach (MenuMod2Menu item4 in list4)
			{
				item4.destroy();
			}
			Object.Destroy((Object)(object)menuCanvas);
		}

		public bool removeButton(string buttonName)
		{
			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;
		}

		public void arrangeButtons()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			int num = 200;
			int num2 = 50;
			int num3 = 5;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, 0f);
			int num4 = 0;
			int num5 = 0;
			int num6 = 1;
			int num7 = 0;
			int num8 = 1;
			int num9 = 0;
			int num10 = 0;
			Vector2 val2 = default(Vector2);
			for (int i = 0; i < buttons.Count; i++)
			{
				((Vector2)(ref val2))..ctor((float)(num4 * (num + num3)), (float)(num5 * -(num2 + num3)));
				buttons[i].move(val2 + val);
				num4 += num6;
				num5 += num7;
				num9++;
				if (num9 == num8)
				{
					num9 = 0;
					int num11 = num6;
					num6 = -num7;
					num7 = num11;
					num10++;
					if (num10 % 2 == 0)
					{
						num8++;
					}
				}
			}
		}
	}
	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 MM2Button(MenuMod2Menu _menu, Vector2 screenPos, string text, UnityAction callback, GameObject menuCanvas)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			menu = _menu;
			name = text;
			pos = screenPos;
			canvas = menuCanvas;
			prefix = string.Empty;
			suffix = string.Empty;
		}

		public MM2Button createButton()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0070: 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)
			//IL_00a6: 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_00bc: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			MenuMod2.Logger.LogDebug((object)("Creating button: " + name + " in menu " + menu.menuName));
			buttonObj = new GameObject("MenuButton");
			buttonObj.transform.SetParent(canvas.transform, false);
			RectTransform val = buttonObj.AddComponent<RectTransform>();
			val.sizeDelta = new Vector2(200f, 50f);
			val.anchoredPosition = pos;
			button = buttonObj.AddComponent<Button>();
			Image val2 = buttonObj.AddComponent<Image>();
			((Graphic)val2).color = Color.white;
			GameObject val3 = new GameObject("ButtonText");
			val3.transform.SetParent(buttonObj.transform, false);
			Text val4 = val3.AddComponent<Text>();
			val4.text = prefix + name + suffix;
			val4.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
			((Graphic)val4).color = Color.black;
			val4.alignment = (TextAnchor)4;
			RectTransform component = val3.GetComponent<RectTransform>();
			component.anchorMin = Vector2.zero;
			component.anchorMax = Vector2.one;
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			hide();
			return this;
		}

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

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

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

		public MM2Button changeColour(Color newColor)
		{
			//IL_001a: 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;
			}
			else
			{
				MenuMod2.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_000e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = buttonObj.GetComponent<RectTransform>();
			component.anchoredPosition = newPos;
			return this;
		}

		public void SetCallback(UnityAction callback)
		{
			((UnityEventBase)button.onClick).RemoveAllListeners();
			((UnityEvent)button.onClick).AddListener(callback);
		}
	}
	[MycoMod(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("MenuMod2", "Menu Mod 2", "1.0.0")]
	public class MenuMod2 : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__9_0;

			public static UnityAction <>9__9_1;

			public static Func<EnemyClass, bool> <>9__9_25;

			public static UnityAction <>9__9_2;

			public static Func<EnemyClass, bool> <>9__9_26;

			public static UnityAction <>9__9_3;

			public static UnityAction <>9__9_4;

			public static UnityAction <>9__9_5;

			public static UnityAction <>9__9_6;

			public static UnityAction <>9__9_7;

			public static UnityAction <>9__9_8;

			public static UnityAction <>9__9_9;

			public static UnityAction <>9__9_10;

			public static UnityAction <>9__9_11;

			public static UnityAction <>9__9_12;

			public static UnityAction <>9__9_13;

			public static UnityAction <>9__9_14;

			public static UnityAction <>9__9_15;

			public static UnityAction <>9__9_16;

			public static UnityAction <>9__9_17;

			public static UnityAction <>9__9_18;

			public static UnityAction <>9__9_19;

			public static UnityAction <>9__9_20;

			public static UnityAction <>9__9_21;

			public static UnityAction <>9__9_22;

			public static UnityAction <>9__9_23;

			public static UnityAction <>9__9_24;

			internal void <createMainMenu>b__9_0()
			{
				Cheats.spawnObject("Kart");
			}

			internal void <createMainMenu>b__9_1()
			{
				Cheats.spawnObject("WheelBox");
			}

			internal void <createMainMenu>b__9_2()
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				Cheats.spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "amalgamation")));
			}

			internal bool <createMainMenu>b__9_25(EnemyClass x)
			{
				return x.APIName == "amalgamation";
			}

			internal void <createMainMenu>b__9_3()
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				Cheats.spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "cranius")));
			}

			internal bool <createMainMenu>b__9_26(EnemyClass x)
			{
				return x.APIName == "cranius";
			}

			internal void <createMainMenu>b__9_4()
			{
				Cheats.spawnObject("SaxitosBag");
			}

			internal void <createMainMenu>b__9_5()
			{
				Cheats.spawnObject("Jukebox");
			}

			internal void <createMainMenu>b__9_6()
			{
				Cheats.spawnObject("HoldableBarrel");
			}

			internal void <createMainMenu>b__9_7()
			{
				Cheats.spawnObject("TrainingDummy");
			}

			internal void <createMainMenu>b__9_8()
			{
				Cheats.spawnObject("NoteBlock");
			}

			internal void <createMainMenu>b__9_9()
			{
				Cheats.spawnObject("ExplosiveHotPotato");
			}

			internal void <createMainMenu>b__9_10()
			{
				Cheats.spawnObject("BearPhys");
			}

			internal void <createMainMenu>b__9_11()
			{
				Cheats.spawnObject("TP");
			}

			internal void <createMainMenu>b__9_12()
			{
				Cheats.spawnObject("MilkJug");
			}

			internal void <createMainMenu>b__9_13()
			{
				Cheats.killAllEnemies();
			}

			internal void <createMainMenu>b__9_14()
			{
				Cheats.spawnSwarm(10);
			}

			internal void <createMainMenu>b__9_15()
			{
				Cheats.cleanUpParts();
			}

			internal void <createMainMenu>b__9_16()
			{
				Cheats.cleanUpCollectables();
			}

			internal void <createMainMenu>b__9_17()
			{
				Cheats.giveAllResoruces();
			}

			internal void <createMainMenu>b__9_18()
			{
				Cheats.giveAllUpgrades();
			}

			internal void <createMainMenu>b__9_19()
			{
				Cheats.giveAllCosmetics();
			}

			internal void <createMainMenu>b__9_20()
			{
				Cheats.giveMissingUpgrades();
			}

			internal void <createMainMenu>b__9_21()
			{
				Cheats.giveAllSkills();
			}

			internal void <createMainMenu>b__9_22()
			{
				Cheats.unlockLockedSkills();
			}

			internal void <createMainMenu>b__9_23()
			{
				Cheats.levelUpAllWeapons(30);
			}

			internal void <createMainMenu>b__9_24()
			{
				Cheats.setAllCharictersToLevel(10);
			}
		}

		public static ManualLogSource Logger;

		public InputActionMap _actionmap;

		private InputAction _openMenu;

		public GameObject menuCanvas;

		private bool enabled = false;

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

		public MenuMod2Menu mainMenu;

		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)
			{
				Logger.LogError((object)"Could not find profileIndex field in PlayerData.");
				return;
			}
			int num = (int)field.GetValue(ProfileConfig.Instance);
			if ((Object)(object)EnemyManager.Instance != (Object)null)
			{
				if (num == 0)
				{
					Logger.LogWarning((object)"Using default profile is not supported.  Please switch to a different profile on the main menu.");
					_actionmap.Disable();
				}
				else
				{
					createMainMenu();
				}
			}
		}

		public void Awake()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			SceneManager.sceneLoaded += OnSceneLoaded;
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin MenuMod2 is loaded!");
			_actionmap = new InputActionMap("MenuMod2");
			_openMenu = InputActionSetupExtensions.AddAction(_actionmap, "openMenu", (InputActionType)0, "<Keyboard>/backquote", (string)null, (string)null, (string)null, (string)null);
			_openMenu.performed += delegate
			{
				toggleMenu();
			};
			_actionmap.Enable();
			Harmony val = new Harmony("com.SlideDrum.menumod2");
			val.PatchAll();
		}

		public void createMainMenu()
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00ec: 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_00f7: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Expected O, but got Unknown
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Expected O, but got Unknown
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Expected O, but got Unknown
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Expected O, but got Unknown
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Expected O, but got Unknown
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Expected O, but got Unknown
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Expected O, but got Unknown
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Expected O, but got Unknown
			//IL_0478: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Expected O, but got Unknown
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Expected O, but got Unknown
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Expected O, but got Unknown
			//IL_052d: 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_0568: Expected O, but got Unknown
			//IL_0568: 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_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Expected O, but got Unknown
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Expected O, but got Unknown
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0659: Expected O, but got Unknown
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0801: Unknown result type (might be due to invalid IL or missing references)
			//IL_0807: Expected O, but got Unknown
			//IL_0828: Unknown result type (might be due to invalid IL or missing references)
			//IL_082d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Expected O, but got Unknown
			//IL_0854: Unknown result type (might be due to invalid IL or missing references)
			//IL_0859: Unknown result type (might be due to invalid IL or missing references)
			//IL_085f: Expected O, but got Unknown
			//IL_0880: Unknown result type (might be due to invalid IL or missing references)
			//IL_0885: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Expected O, but got Unknown
			//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Expected O, but got Unknown
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Expected O, but got Unknown
			//IL_08d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e3: Expected O, but got Unknown
			//IL_0904: Unknown result type (might be due to invalid IL or missing references)
			//IL_0909: Unknown result type (might be due to invalid IL or missing references)
			//IL_090f: Expected O, but got Unknown
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_0935: Unknown result type (might be due to invalid IL or missing references)
			//IL_093b: Expected O, but got Unknown
			//IL_09b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a31: Expected O, but got Unknown
			//IL_0a31: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a81: Invalid comparison between Unknown and I4
			//IL_0ad8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Expected O, but got Unknown
			//IL_0ab6: Unknown result type (might be due to invalid IL or missing references)
			if (mainMenu != null)
			{
				Logger.LogWarning((object)"Main menu already exists, This should not happen.");
				return;
			}
			Logger.LogInfo((object)"Creating MenuMod2!");
			mainMenu = new MenuMod2Menu("Main Menu");
			MenuMod2Menu parrentMenu = new MenuMod2Menu("Spawn Menu", mainMenu);
			MenuMod2Menu menuMod2Menu = new MenuMod2Menu("Vehicle", parrentMenu);
			object obj = <>c.<>9__9_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					Cheats.spawnObject("Kart");
				};
				<>c.<>9__9_0 = val;
				obj = (object)val;
			}
			menuMod2Menu.addButton("Spawn Dart", (UnityAction)obj);
			object obj2 = <>c.<>9__9_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					Cheats.spawnObject("WheelBox");
				};
				<>c.<>9__9_1 = val2;
				obj2 = (object)val2;
			}
			menuMod2Menu.addButton("Spawn WheelBox", (UnityAction)obj2);
			MenuMod2Menu parrentMenu2 = new MenuMod2Menu("Enemy", parrentMenu);
			MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu("BOSSES", parrentMenu2);
			object obj3 = <>c.<>9__9_2;
			if (obj3 == null)
			{
				UnityAction val3 = delegate
				{
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					Cheats.spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "amalgamation")));
				};
				<>c.<>9__9_2 = val3;
				obj3 = (object)val3;
			}
			menuMod2Menu2.addButton("Spawn Amalgamation", (UnityAction)obj3);
			object obj4 = <>c.<>9__9_3;
			if (obj4 == null)
			{
				UnityAction val4 = delegate
				{
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					Cheats.spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "cranius")));
				};
				<>c.<>9__9_3 = val4;
				obj4 = (object)val4;
			}
			menuMod2Menu2.addButton("Spawn Cranius", (UnityAction)obj4);
			List<EnemyClassGroup> itemsFromWeightedArray = GetItemsFromWeightedArray<EnemyClassGroup>(EnemyManager.Instance.EnemyClassGroups);
			foreach (EnemyClassGroup group in itemsFromWeightedArray)
			{
				string name = ((Object)group).name;
				MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu(name, parrentMenu2);
				menuMod2Menu3.addButton("Random", (UnityAction)delegate
				{
					//IL_0008: Unknown result type (might be due to invalid IL or missing references)
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					Cheats.spawnEnemy(group);
				});
				List<EnemyClass> itemsFromWeightedArray2 = GetItemsFromWeightedArray<EnemyClass>(group.enemyClasses);
				foreach (EnemyClass enemyClass in itemsFromWeightedArray2)
				{
					menuMod2Menu3.addButton(((Object)enemyClass).name, (UnityAction)delegate
					{
						//IL_0008: Unknown result type (might be due to invalid IL or missing references)
						//IL_000e: Unknown result type (might be due to invalid IL or missing references)
						Cheats.spawnEnemy(enemyClass);
					});
				}
			}
			MenuMod2Menu menuMod2Menu4 = new MenuMod2Menu("Object", parrentMenu);
			object obj5 = <>c.<>9__9_4;
			if (obj5 == null)
			{
				UnityAction val5 = delegate
				{
					Cheats.spawnObject("SaxitosBag");
				};
				<>c.<>9__9_4 = val5;
				obj5 = (object)val5;
			}
			menuMod2Menu4.addButton("Saxitos", (UnityAction)obj5);
			object obj6 = <>c.<>9__9_5;
			if (obj6 == null)
			{
				UnityAction val6 = delegate
				{
					Cheats.spawnObject("Jukebox");
				};
				<>c.<>9__9_5 = val6;
				obj6 = (object)val6;
			}
			menuMod2Menu4.addButton("Radio", (UnityAction)obj6);
			object obj7 = <>c.<>9__9_6;
			if (obj7 == null)
			{
				UnityAction val7 = delegate
				{
					Cheats.spawnObject("HoldableBarrel");
				};
				<>c.<>9__9_6 = val7;
				obj7 = (object)val7;
			}
			menuMod2Menu4.addButton("Barrel", (UnityAction)obj7);
			object obj8 = <>c.<>9__9_7;
			if (obj8 == null)
			{
				UnityAction val8 = delegate
				{
					Cheats.spawnObject("TrainingDummy");
				};
				<>c.<>9__9_7 = val8;
				obj8 = (object)val8;
			}
			menuMod2Menu4.addButton("Dummy", (UnityAction)obj8);
			object obj9 = <>c.<>9__9_8;
			if (obj9 == null)
			{
				UnityAction val9 = delegate
				{
					Cheats.spawnObject("NoteBlock");
				};
				<>c.<>9__9_8 = val9;
				obj9 = (object)val9;
			}
			menuMod2Menu4.addButton("Box", (UnityAction)obj9);
			object obj10 = <>c.<>9__9_9;
			if (obj10 == null)
			{
				UnityAction val10 = delegate
				{
					Cheats.spawnObject("ExplosiveHotPotato");
				};
				<>c.<>9__9_9 = val10;
				obj10 = (object)val10;
			}
			menuMod2Menu4.addButton("Bomb", (UnityAction)obj10);
			object obj11 = <>c.<>9__9_10;
			if (obj11 == null)
			{
				UnityAction val11 = delegate
				{
					Cheats.spawnObject("BearPhys");
				};
				<>c.<>9__9_10 = val11;
				obj11 = (object)val11;
			}
			menuMod2Menu4.addButton("Bear", (UnityAction)obj11);
			object obj12 = <>c.<>9__9_11;
			if (obj12 == null)
			{
				UnityAction val12 = delegate
				{
					Cheats.spawnObject("TP");
				};
				<>c.<>9__9_11 = val12;
				obj12 = (object)val12;
			}
			menuMod2Menu4.addButton("Toilet Paper", (UnityAction)obj12);
			object obj13 = <>c.<>9__9_12;
			if (obj13 == null)
			{
				UnityAction val13 = delegate
				{
					Cheats.spawnObject("MilkJug");
				};
				<>c.<>9__9_12 = val13;
				obj13 = (object)val13;
			}
			menuMod2Menu4.addButton("Milk", (UnityAction)obj13);
			MenuMod2Menu menuMod2Menu5 = new MenuMod2Menu("Enemys", mainMenu);
			MM2Button button6 = null;
			button6 = menuMod2Menu5.addButton("Toggle enemy spawning", (UnityAction)delegate
			{
				Cheats.toggleSpawning(button6);
			}).changeColour(Color.green);
			object obj14 = <>c.<>9__9_13;
			if (obj14 == null)
			{
				UnityAction val14 = delegate
				{
					Cheats.killAllEnemies();
				};
				<>c.<>9__9_13 = val14;
				obj14 = (object)val14;
			}
			menuMod2Menu5.addButton("Kill all enemies", (UnityAction)obj14);
			object obj15 = <>c.<>9__9_14;
			if (obj15 == null)
			{
				UnityAction val15 = delegate
				{
					Cheats.spawnSwarm(10);
				};
				<>c.<>9__9_14 = val15;
				obj15 = (object)val15;
			}
			menuMod2Menu5.addButton("Spawn swarm", (UnityAction)obj15);
			object obj16 = <>c.<>9__9_15;
			if (obj16 == null)
			{
				UnityAction val16 = delegate
				{
					Cheats.cleanUpParts();
				};
				<>c.<>9__9_15 = val16;
				obj16 = (object)val16;
			}
			menuMod2Menu5.addButton("Clean up parts", (UnityAction)obj16);
			object obj17 = <>c.<>9__9_16;
			if (obj17 == null)
			{
				UnityAction val17 = delegate
				{
					Cheats.cleanUpCollectables();
				};
				<>c.<>9__9_16 = val17;
				obj17 = (object)val17;
			}
			menuMod2Menu5.addButton("Clean up collectables", (UnityAction)obj17);
			MenuMod2Menu menuMod2Menu6 = new MenuMod2Menu("Player", mainMenu);
			MM2Button button5 = null;
			button5 = menuMod2Menu6.addButton("Godmode", (UnityAction)delegate
			{
				Cheats.toggleGod(button5);
			}).changeColour(Color.red);
			MM2Button button4 = null;
			button4 = menuMod2Menu6.addButton("Super sprint", (UnityAction)delegate
			{
				Cheats.toggleSprintFast(button4);
			}).changeColour(Color.red);
			MM2Button button3 = null;
			button3 = menuMod2Menu6.addButton("Super jump", (UnityAction)delegate
			{
				Cheats.toggleSuperJump(button3);
			}).changeColour(Color.red);
			MenuMod2Menu parrentMenu3 = new MenuMod2Menu("Missions", mainMenu);
			MenuMod2Menu menuMod2Menu7 = new MenuMod2Menu("Force Modifier", parrentMenu3);
			FieldInfo field = typeof(WeightedArray<MissionModifier>).GetField("items", BindingFlags.Instance | BindingFlags.NonPublic);
			Array array = field.GetValue(Global.Instance.MissionModifiers) as Array;
			foreach (object item in array)
			{
				FieldInfo field2 = item.GetType().GetField("value");
				MissionModifier modifier = (MissionModifier)field2.GetValue(item);
				MM2Button button2 = null;
				button2 = menuMod2Menu7.addButton(modifier.ModifierName ?? "", (UnityAction)delegate
				{
					Cheats.toggleForceModifier(modifier, button2);
				});
			}
			MenuMod2Menu parrentMenu4 = new MenuMod2Menu("Load mission", parrentMenu3);
			List<MenuMod2Menu> list = new List<MenuMod2Menu>();
			Mission[] missions = Global.Instance.Missions;
			foreach (Mission mission in missions)
			{
				if (!((Enum)mission.MissionFlags).HasFlag((Enum)(object)(MissionFlags)1) || !mission.CanBeSelected())
				{
					continue;
				}
				MenuMod2Menu menuMod2Menu8 = new MenuMod2Menu(mission.MissionName, parrentMenu4);
				list.Add(menuMod2Menu8);
				WorldRegion[] regions = Global.Instance.Regions;
				WorldRegion[] array2 = regions;
				foreach (WorldRegion region in array2)
				{
					menuMod2Menu8.addButton(region.RegionName ?? "", (UnityAction)delegate
					{
						Cheats.loadMission(mission, region);
					});
				}
			}
			MenuMod2Menu menuMod2Menu9 = new MenuMod2Menu("Inventory", mainMenu);
			MenuMod2Menu menuMod2Menu10 = new MenuMod2Menu("Skills", menuMod2Menu9);
			MenuMod2Menu menuMod2Menu11 = new MenuMod2Menu("Upgrades", menuMod2Menu9);
			MenuMod2Menu menuMod2Menu12 = new MenuMod2Menu("Unlock weapon", menuMod2Menu9);
			MenuMod2Menu menuMod2Menu13 = new MenuMod2Menu("Levels", menuMod2Menu9);
			object obj18 = <>c.<>9__9_17;
			if (obj18 == null)
			{
				UnityAction val18 = delegate
				{
					Cheats.giveAllResoruces();
				};
				<>c.<>9__9_17 = val18;
				obj18 = (object)val18;
			}
			menuMod2Menu9.addButton("Give max resources", (UnityAction)obj18);
			object obj19 = <>c.<>9__9_18;
			if (obj19 == null)
			{
				UnityAction val19 = delegate
				{
					Cheats.giveAllUpgrades();
				};
				<>c.<>9__9_18 = val19;
				obj19 = (object)val19;
			}
			menuMod2Menu11.addButton("Give one of each upgrade", (UnityAction)obj19);
			object obj20 = <>c.<>9__9_19;
			if (obj20 == null)
			{
				UnityAction val20 = delegate
				{
					Cheats.giveAllCosmetics();
				};
				<>c.<>9__9_19 = val20;
				obj20 = (object)val20;
			}
			menuMod2Menu11.addButton("Give one of each cosmetic", (UnityAction)obj20);
			object obj21 = <>c.<>9__9_20;
			if (obj21 == null)
			{
				UnityAction val21 = delegate
				{
					Cheats.giveMissingUpgrades();
				};
				<>c.<>9__9_20 = val21;
				obj21 = (object)val21;
			}
			menuMod2Menu11.addButton("Give missing upgrades", (UnityAction)obj21);
			object obj22 = <>c.<>9__9_21;
			if (obj22 == null)
			{
				UnityAction val22 = delegate
				{
					Cheats.giveAllSkills();
				};
				<>c.<>9__9_21 = val22;
				obj22 = (object)val22;
			}
			menuMod2Menu10.addButton("Give all skills", (UnityAction)obj22);
			object obj23 = <>c.<>9__9_22;
			if (obj23 == null)
			{
				UnityAction val23 = delegate
				{
					Cheats.unlockLockedSkills();
				};
				<>c.<>9__9_22 = val23;
				obj23 = (object)val23;
			}
			menuMod2Menu10.addButton("Unlock locked skills", (UnityAction)obj23);
			object obj24 = <>c.<>9__9_23;
			if (obj24 == null)
			{
				UnityAction val24 = delegate
				{
					Cheats.levelUpAllWeapons(30);
				};
				<>c.<>9__9_23 = val24;
				obj24 = (object)val24;
			}
			menuMod2Menu13.addButton("Level 30 all weapons", (UnityAction)obj24);
			object obj25 = <>c.<>9__9_24;
			if (obj25 == null)
			{
				UnityAction val25 = delegate
				{
					Cheats.setAllCharictersToLevel(10);
				};
				<>c.<>9__9_24 = val25;
				obj25 = (object)val25;
			}
			menuMod2Menu13.addButton("Level 10 all employees", (UnityAction)obj25);
			MenuMod2Menu parrentMenu5 = new MenuMod2Menu("Give spesific upgrade", menuMod2Menu11);
			IUpgradable[] allGear = Global.Instance.AllGear;
			List<MenuMod2Menu> list2 = new List<MenuMod2Menu>();
			IUpgradable[] array3 = allGear;
			foreach (IUpgradable gear in array3)
			{
				GearInfo info = gear.Info;
				if (info.Upgrades.Length == 0)
				{
					continue;
				}
				MenuMod2Menu menuMod2Menu14 = new MenuMod2Menu(info.Name, parrentMenu5);
				Color newColor = Color.red;
				if (PlayerData.GetGearData(gear).IsUnlocked)
				{
					newColor = Color.green;
				}
				else if (PlayerData.GetGearData(gear).IsCollected)
				{
					newColor = Color.yellow;
				}
				MM2Button button = null;
				button = menuMod2Menu12.addButton(info.Name, (UnityAction)delegate
				{
					Cheats.unlockGear(gear, button);
				}).changeColour(newColor);
				list2.Add(menuMod2Menu14);
				Upgrade[] upgrades = info.Upgrades;
				foreach (Upgrade upgrade in upgrades)
				{
					if ((int)upgrade.UpgradeType == 3)
					{
						menuMod2Menu14.addButton(CleanRichText(upgrade.Name), (UnityAction)delegate
						{
							Cheats.giveUpgrade(upgrade, gear);
						}).changeColour(upgrade.Color);
					}
				}
				menuMod2Menu14.thisButton.changeColour(newColor);
			}
		}

		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)
				{
					continue;
				}
				Type type2 = item2.GetType();
				FieldInfo field2 = type2.GetField("weight");
				FieldInfo field3 = type2.GetField("value");
				if (!(field2 == null) && !(field3 == null))
				{
					int num = (int)field2.GetValue(item2);
					if (num > 0)
					{
						T item = (T)field3.GetValue(item2);
						list.Add(item);
					}
				}
			}
			return list;
		}

		public void toggleMenu()
		{
			if (MenuMod2Manager.currentMenu != null)
			{
				MenuMod2Manager.currentMenu.Close();
			}
			else if (mainMenu != null)
			{
				mainMenu.Open();
			}
		}

		public static GameObject findObjectByName(string name)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (((Object)val).name == name)
				{
					Scene scene = val.scene;
					if (!((Scene)(ref scene)).IsValid())
					{
						return val;
					}
					Logger.LogWarning((object)("Object " + name + " found but not in hide and don't save"));
				}
			}
			Logger.LogWarning((object)("Could not find " + name));
			return null;
		}

		public static string CleanRichText(string input)
		{
			if (input != null)
			{
				return Regex.Replace(input, "<.*?>", string.Empty);
			}
			return input;
		}
	}
	[HarmonyPatch(typeof(MissionContainer), "GetAdditionalModifiers")]
	internal class MissionContainerPatch
	{
		private static void Prefix(ref Span<int> modifiers, int seed, int startIndex, Mission mission)
		{
			ManualLogSource logger = MenuMod2.Logger;
			List<MissionModifier> forcedModifiers = Cheats.forcedModifiers;
			logger.LogDebug((object)$"GetAdditionalModifiers called with seed: {seed}, startIndex: {startIndex}, mission: {mission}");
			if (forcedModifiers == null || forcedModifiers.Count == 0)
			{
				return;
			}
			for (int i = 0; i < forcedModifiers.Count; i++)
			{
				MissionModifier val = forcedModifiers[i];
				if ((Object)(object)val != (Object)null)
				{
					modifiers[startIndex + i] = Global.Instance.MissionModifiers.IndexOf(val);
				}
			}
			logger.LogDebug((object)$"Injected {forcedModifiers.Count} forced modifiers at index {startIndex}");
		}
	}
	[HarmonyPatch(typeof(MissionContainer), "GetAdditionalModifierCount")]
	internal class AdditionalModifierCountPatch
	{
		private static void Postfix(ref int __result)
		{
			List<MissionModifier> forcedModifiers = Cheats.forcedModifiers;
			if (forcedModifiers != null && forcedModifiers.Count > 0)
			{
				__result += forcedModifiers.Count;
				MenuMod2.Logger.LogDebug((object)$"GetAdditionalModifierCount patched: increased by {forcedModifiers.Count}, new count = {__result}");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MenuMod2";

		public const string PLUGIN_NAME = "Menu Mod 2";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}