Decompiled source of CheatMenu v1.0.0

BepInEx/plugins/CheatMenu.dll

Decompiled a week 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.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.5+45ee35f8f93e255bc2e3c02bf18ea78d9092968d")]
[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__1_0;

		public static UnityAction <>9__1_1;

		public static UnityAction <>9__1_2;

		public static UnityAction <>9__1_3;

		public static UnityAction <>9__1_4;

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

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

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

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

		internal void <CreateCheatsMenu>b__1_4()
		{
			giveAllResoruces();
		}
	}

	private static ManualLogSource Logger = Plugin.Logger;

	public static void CreateCheatsMenu(MenuMod2Menu parentMenu)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		//IL_00a8: 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_00e0: Expected O, but got Unknown
		//IL_00e0: 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_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Expected O, but got Unknown
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Expected O, but got Unknown
		//IL_015f: 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_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Expected O, but got Unknown
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Expected O, but got Unknown
		Logger.LogInfo((object)"Creating CHEATS menu");
		MenuMod2Menu menuMod2Menu = new MenuMod2Menu("CHEATS", parentMenu);
		MM2Button button4 = null;
		button4 = menuMod2Menu.addButton("Godmode", (UnityAction)delegate
		{
			toggleGod(button4);
		}).changeColour(Color.red);
		MM2Button button3 = null;
		button3 = menuMod2Menu.addButton("Super sprint", (UnityAction)delegate
		{
			toggleSprintFast(button3);
		}).changeColour(Color.red);
		MM2Button button2 = null;
		button2 = menuMod2Menu.addButton("Super jump", (UnityAction)delegate
		{
			toggleSuperJump(button2);
		}).changeColour(Color.red);
		MM2Button button = null;
		button = menuMod2Menu.addButton("Toggle enemy spawning", (UnityAction)delegate
		{
			toggleSpawning(button);
		}).changeColour(Color.green);
		object obj = <>c.<>9__1_0;
		if (obj == null)
		{
			UnityAction val = delegate
			{
				killAllEnemies();
			};
			<>c.<>9__1_0 = val;
			obj = (object)val;
		}
		menuMod2Menu.addButton("Kill all enemies", (UnityAction)obj);
		object obj2 = <>c.<>9__1_1;
		if (obj2 == null)
		{
			UnityAction val2 = delegate
			{
				SpawnMenu.spawnSwarm(10);
			};
			<>c.<>9__1_1 = val2;
			obj2 = (object)val2;
		}
		menuMod2Menu.addButton("Spawn swarm", (UnityAction)obj2);
		object obj3 = <>c.<>9__1_2;
		if (obj3 == null)
		{
			UnityAction val3 = delegate
			{
				cleanUpParts();
			};
			<>c.<>9__1_2 = val3;
			obj3 = (object)val3;
		}
		menuMod2Menu.addButton("Clean up parts", (UnityAction)obj3);
		object obj4 = <>c.<>9__1_3;
		if (obj4 == null)
		{
			UnityAction val4 = delegate
			{
				cleanUpCollectables();
			};
			<>c.<>9__1_3 = val4;
			obj4 = (object)val4;
		}
		menuMod2Menu.addButton("Clean up collectables", (UnityAction)obj4);
		object obj5 = <>c.<>9__1_4;
		if (obj5 == null)
		{
			UnityAction val5 = delegate
			{
				giveAllResoruces();
			};
			<>c.<>9__1_4 = val5;
			obj5 = (object)val5;
		}
		menuMod2Menu.addButton("Give max resources", (UnityAction)obj5);
	}

	public static void toggleGod(MM2Button button = null)
	{
		//IL_0139: 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)
		if (Plugin.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 });
			Plugin.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 });
			Plugin.god = true;
		}
		if (button != null)
		{
			if (Plugin.god)
			{
				button.changeColour(Color.green);
			}
			else
			{
				button.changeColour(Color.red);
			}
		}
	}

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

	public static void toggleSuperJump(MM2Button b = null)
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		if (Plugin.superJump)
		{
			typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 14f);
			Plugin.superJump = false;
		}
		else
		{
			typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 100f);
			Plugin.superJump = true;
		}
		if (b != null)
		{
			if (Plugin.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)
		{
			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 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);
			object value = field.GetValue(Player.LocalPlayer);
			if (Convert.ToInt32(value) != 100)
			{
				Plugin.previousAirJumps = Convert.ToInt32(value);
			}
			float num = Convert.ToSingle(field2.GetValue(Player.LocalPlayer));
			if (num != 100f)
			{
				Plugin.previousAirJumpSpeed = num;
			}
			field.SetValue(Player.LocalPlayer, 100);
			FieldInfo field3 = typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic);
			field2.SetValue(Player.LocalPlayer, field3.GetValue(Player.LocalPlayer));
		}
		else
		{
			typeof(Player).GetField("airJumps", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, Plugin.previousAirJumps);
			typeof(Player).GetField("airJumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, Plugin.previousAirJumpSpeed);
		}
	}

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

	public static MM2Button toggleSpawning(MM2Button b = null)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		EnemyManager enemyManager = Plugin.GetEnemyManager();
		if ((Object)(object)enemyManager != (Object)null)
		{
			if ((bool)typeof(EnemyManager).GetField("enableAmbientWave", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(enemyManager))
			{
				enemyManager.DisableSpawning();
				b?.changeColour(Color.red);
			}
			else
			{
				enemyManager.EnableSpawning();
				b?.changeColour(Color.green);
			}
		}
		return b;
	}

	public static void killAllEnemies(MM2Button b = null)
	{
		EnemyManager enemyManager = Plugin.GetEnemyManager();
		if ((Object)(object)enemyManager != (Object)null)
		{
			enemyManager.KillAllEnemies_Server();
		}
	}

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

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

	public static void giveAllResoruces(MM2Button b = null)
	{
		PlayerResource[] playerResources = Global.Instance.PlayerResources;
		foreach (PlayerResource val in playerResources)
		{
			PlayerData.Instance.AddResource(val, val.Max, true);
		}
	}
}
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;

	public List<MenuMod2Menu> subMenus;

	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_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Expected O, but got Unknown
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Expected O, but got Unknown
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Expected O, but got Unknown
		//IL_0155: 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);
		menuCanvas.AddComponent<Canvas>().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);
			Plugin.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")
		{
			Plugin.Logger.LogDebug((object)("Creating menu " + indetifier));
			addButton("Close", (UnityAction)delegate
			{
				Close();
			}).changeColour(Color.red);
			parrentMenu = null;
		}
	}

	public void Open()
	{
		Plugin.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)
		{
			Plugin.Logger.LogWarning((object)("Attempted to close menu \"" + menuName + "\" that wasn't open.  This should not happen"));
			return;
		}
		Plugin.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_000b: 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_000b: 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()
	{
		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);
	}

	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_0059: 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)
		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_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_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: 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_0112: 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_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		Plugin.Logger.LogDebug((object)("Creating button: " + name + " in menu " + menu.menuName));
		buttonObj = new GameObject("MenuButton");
		buttonObj.transform.SetParent(canvas.transform, false);
		RectTransform obj = buttonObj.AddComponent<RectTransform>();
		obj.sizeDelta = new Vector2(200f, 50f);
		obj.anchoredPosition = pos;
		button = buttonObj.AddComponent<Button>();
		((Graphic)buttonObj.AddComponent<Image>()).color = Color.white;
		GameObject val = new GameObject("ButtonText");
		val.transform.SetParent(buttonObj.transform, false);
		Text obj2 = val.AddComponent<Text>();
		obj2.text = prefix + name + suffix;
		obj2.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
		((Graphic)obj2).color = Color.black;
		obj2.alignment = (TextAnchor)4;
		RectTransform component = val.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
		{
			Plugin.Logger.LogWarning((object)"Button text component not found, cannot update text.");
		}
		return this;
	}

	public MM2Button changeColour(Color newColor)
	{
		//IL_0016: 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
		{
			Plugin.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 static class MissionsMenu
{
	private static ManualLogSource Logger = Plugin.Logger;

	public static void CreateMissionsMenu(MenuMod2Menu parentMenu)
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Expected O, but got Unknown
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Expected O, but got Unknown
		//IL_0151: 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_0212: Expected O, but got Unknown
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Expected O, but got Unknown
		Logger.LogInfo((object)"Creating MISSIONS menu");
		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);
					});
				}
			}
		}
	}

	public static void toggleForceModifier(MissionModifier modifier, MM2Button b = null)
	{
		//IL_0050: 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)
		if (Plugin.forcedModifiers.Contains(modifier))
		{
			Plugin.forcedModifiers.Remove(modifier);
			if (b != null)
			{
				b.changePrefix("");
				b.changeColour(Color.white);
			}
		}
		else
		{
			Plugin.forcedModifiers.Add(modifier);
			if (b != null)
			{
				b.changePrefix("* ");
				b.changeColour(Color.green);
			}
		}
	}

	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)
		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 (Plugin.forcedModifiers != null && Plugin.forcedModifiers.Count > 0)
		{
			foreach (MissionModifier forcedModifier in Plugin.forcedModifiers)
			{
				int num = Global.Instance.MissionModifiers.IndexOf(forcedModifier);
				((MissionData)(ref mission2)).AddModifier(num, true, true);
			}
		}
		DropPod.SetMission(mission2);
	}
}
[MycoMod(/*Could not decode attribute arguments.*/)]
[BepInPlugin("slidedrum.cheatmenu", "CheatMenu", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__18_0;

		public static UnityAction <>9__22_0;

		public static UnityAction <>9__22_1;

		public static UnityAction <>9__22_2;

		public static UnityAction <>9__22_3;

		public static UnityAction <>9__22_5;

		internal void <createMainMenu>b__18_0()
		{
		}

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

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

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

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

		internal void <AddEnemyMenu>b__22_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 sparrohMode = false;

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

	private void Awake()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		Logger = ((BaseUnityPlugin)this).Logger;
		MenuMod2Manager.Logger = Logger;
		Harmony.CreateAndPatchAll(typeof(Plugin), (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>/backquote", (string)null, (string)null, (string)null);
		_openMenu.performed += delegate
		{
			toggleMenu();
		};
	}

	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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Expected O, but got Unknown
		try
		{
			if (mainMenu == null)
			{
				Logger.LogInfo((object)"Creating CheatMenu!");
				_ = (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);
					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__18_0;
				if (obj == null)
				{
					UnityAction val = delegate
					{
					};
					<>c.<>9__18_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()
	{
		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();
		}
	}

	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 invalid IL or missing references)
		//IL_0084: Expected O, but got Unknown
		//IL_00a4: 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)
		//IL_00af: Expected O, but got Unknown
		//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_00da: Expected O, but got Unknown
		try
		{
			MM2Button button = null;
			button = enemyMenu.addButton("Toggle enemy spawning", (UnityAction)delegate
			{
				CheatsMenu.toggleSpawning(button);
			}).changeColour(Color.green);
			object obj = <>c.<>9__22_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					CheatsMenu.killAllEnemies();
				};
				<>c.<>9__22_0 = val;
				obj = (object)val;
			}
			enemyMenu.addButton("Kill all enemies", (UnityAction)obj);
			object obj2 = <>c.<>9__22_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					SpawnMenu.spawnSwarm(10);
				};
				<>c.<>9__22_1 = val2;
				obj2 = (object)val2;
			}
			enemyMenu.addButton("Spawn swarm", (UnityAction)obj2);
			object obj3 = <>c.<>9__22_2;
			if (obj3 == null)
			{
				UnityAction val3 = delegate
				{
					CheatsMenu.cleanUpParts();
				};
				<>c.<>9__22_2 = val3;
				obj3 = (object)val3;
			}
			enemyMenu.addButton("Clean up parts", (UnityAction)obj3);
			object obj4 = <>c.<>9__22_3;
			if (obj4 == null)
			{
				UnityAction val4 = delegate
				{
					CheatsMenu.cleanUpCollectables();
				};
				<>c.<>9__22_3 = val4;
				obj4 = (object)val4;
			}
			enemyMenu.addButton("Clean up collectables", (UnityAction)obj4);
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("Exception in AddEnemyMenu: " + ex.Message));
			object obj5 = <>c.<>9__22_5;
			if (obj5 == null)
			{
				UnityAction val5 = delegate
				{
				};
				<>c.<>9__22_5 = val5;
				obj5 = (object)val5;
			}
			enemyMenu.addButton("Enemy spawning error", (UnityAction)obj5);
		}
	}

	public static string CleanRichText(string input)
	{
		if (string.IsNullOrEmpty(input))
		{
			return input;
		}
		return Regex.Replace(input, "<.*?>", string.Empty);
	}

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

	public static EnemyManager GetEnemyManager()
	{
		return EnemyManager.Instance;
	}

	public static void ApplyActiveCheats()
	{
		if (!((Object)(object)Player.LocalPlayer == (Object)null))
		{
			if (god)
			{
				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 });
			}
			if (sprintFast)
			{
				Player.LocalPlayer.DefaultMoveSpeed = 100f;
			}
			if (superJump)
			{
				typeof(Player).GetField("jumpSpeed", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Player.LocalPlayer, 100f);
			}
		}
	}

	[HarmonyPatch(typeof(Mission), "GetModifierCount")]
	[HarmonyPostfix]
	private static void GetModifierCountPostfix(int seed, ref int __result)
	{
		List<MissionModifier> list = forcedModifiers;
		if (list != null && list.Count > 0)
		{
			__result += list.Count;
		}
	}

	[HarmonyPatch(typeof(Mission), "GetModifiers")]
	[HarmonyPostfix]
	private static void GetModifiersPostfix(Span<int> indices, int seed, Mission mission, int startIndex, int count, bool allowStacking)
	{
		List<MissionModifier> list = forcedModifiers;
		if (list == null || list.Count <= 0 || indices.Length < list.Count)
		{
			return;
		}
		for (int i = 0; i < list.Count && i < indices.Length; i++)
		{
			int num = Global.Instance.MissionModifiers.IndexOf(list[i]);
			if (num >= 0)
			{
				for (int num2 = indices.Length - 1; num2 > i; num2--)
				{
					indices[num2] = indices[num2 - 1];
				}
				indices[i] = num;
			}
		}
	}
}
public static class ProgressionMenu
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__1_0;

		public static UnityAction <>9__1_1;

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

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

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

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

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

		public static UnityAction <>9__1_12;

		public static Func<MM2Button, bool> <>9__7_0;

		internal void <CreateProgressionMenu>b__1_0()
		{
			giveMissingUpgrades();
		}

		internal void <CreateProgressionMenu>b__1_1()
		{
			unlockLockedSkills();
		}

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

		internal string <CreateProgressionMenu>b__1_4(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 <CreateProgressionMenu>b__1_5(IUpgradable g)
		{
			return g.Info.Name;
		}

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

		internal string <CreateProgressionMenu>b__1_11(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 void <CreateProgressionMenu>b__1_12()
		{
			setAllCharictersToLevel(30);
		}

		internal bool <levelUpGearRelative>b__7_0(MM2Button btn)
		{
			return btn.name == "Back";
		}
	}

	private static ManualLogSource Logger = Plugin.Logger;

	public static void CreateProgressionMenu(MenuMod2Menu parentMenu)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: 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_00db: 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_011d: Expected O, but got Unknown
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: 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_03f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: 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_042f: Expected O, but got Unknown
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0461: Unknown result type (might be due to invalid IL or missing references)
		//IL_0466: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Expected O, but got Unknown
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Expected O, but got Unknown
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Expected O, but got Unknown
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Expected O, but got Unknown
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Expected O, but got Unknown
		Logger.LogInfo((object)"Creating PROGRESSION menu");
		MenuMod2Menu menuMod2Menu = new MenuMod2Menu("PROGRESSION", parentMenu);
		object obj = <>c.<>9__1_0;
		if (obj == null)
		{
			UnityAction val = delegate
			{
				giveMissingUpgrades();
			};
			<>c.<>9__1_0 = val;
			obj = (object)val;
		}
		menuMod2Menu.addButton("Give missing upgrades", (UnityAction)obj);
		object obj2 = <>c.<>9__1_1;
		if (obj2 == null)
		{
			UnityAction val2 = delegate
			{
				unlockLockedSkills();
			};
			<>c.<>9__1_1 = val2;
			obj2 = (object)val2;
		}
		menuMod2Menu.addButton("Unlock locked skills", (UnityAction)obj2);
		MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu("Unlock weapon", menuMod2Menu);
		MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu("Levels", menuMod2Menu);
		IUpgradable[] allGear = Global.Instance.AllGear;
		foreach (IUpgradable gear2 in allGear)
		{
			GearInfo info = gear2.Info;
			Color newColor = Color.red;
			if (PlayerData.GetGearData(gear2).IsUnlocked)
			{
				newColor = Color.green;
			}
			else if (PlayerData.GetGearData(gear2).IsCollected)
			{
				newColor = Color.yellow;
			}
			MM2Button button = null;
			button = menuMod2Menu2.addButton(info.Name, (UnityAction)delegate
			{
				unlockGear(gear2, button);
			}).changeColour(newColor);
		}
		GearType key;
		if (Plugin.sparrohMode)
		{
			MenuMod2Menu parrentMenu = new MenuMod2Menu("Character Levels", menuMod2Menu3);
			foreach (IGrouping<GearType, IUpgradable> item in (from g in Global.Instance.AllGear
				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 key3 = g.Key;
				return ((object)(GearType)(ref key3)).ToString();
			}))
			{
				key = item.Key;
				MenuMod2Menu parrentMenu2 = new MenuMod2Menu(((object)(GearType)(ref key)).ToString() + " Levels", menuMod2Menu3);
				foreach (IUpgradable gear in item.OrderBy((IUpgradable g) => g.Info.Name))
				{
					MenuMod2Menu gearMenu = new MenuMod2Menu($"{gear.Info.Name} (Level {getGearLevel(gear)})", parrentMenu2);
					gearMenu.addButton("Level +1", (UnityAction)delegate
					{
						levelUpGearRelative(gear, 1, gearMenu);
					});
					gearMenu.addButton("Level -1", (UnityAction)delegate
					{
						levelUpGearRelative(gear, -1, gearMenu);
					});
				}
			}
			Character[] characters = Global.Instance.Characters;
			foreach (Character character in characters)
			{
				MenuMod2Menu charMenu = new MenuMod2Menu($"{((Dude)character).Info.Name} (Level {getGearLevel((IUpgradable)(object)character)})", parrentMenu);
				charMenu.addButton("Level +1", (UnityAction)delegate
				{
					levelUpGearRelative((IUpgradable)(object)character, 1, charMenu);
				});
				charMenu.addButton("Level -1", (UnityAction)delegate
				{
					levelUpGearRelative((IUpgradable)(object)character, -1, charMenu);
				});
			}
			return;
		}
		foreach (IGrouping<GearType, IUpgradable> gearGroup in (from g in Global.Instance.AllGear
			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();
		}))
		{
			key = gearGroup.Key;
			string text = ((object)(GearType)(ref key)).ToString();
			menuMod2Menu3.addButton("Set " + text + " Levels to 30", (UnityAction)delegate
			{
				setAllGearInTypeToLevel(gearGroup.ToList(), 30);
			});
		}
		object obj3 = <>c.<>9__1_12;
		if (obj3 == null)
		{
			UnityAction val3 = delegate
			{
				setAllCharictersToLevel(30);
			};
			<>c.<>9__1_12 = val3;
			obj3 = (object)val3;
		}
		menuMod2Menu3.addButton("Set Character Levels to 30", (UnityAction)obj3);
	}

	public static void giveMissingUpgrades(MM2Button b = null)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Invalid comparison between Unknown and I4
		IUpgradable[] allGear = Global.Instance.AllGear;
		foreach (IUpgradable val in allGear)
		{
			foreach (Upgrade upgrade in val.Info.Upgrades)
			{
				UpgradeInstance val2 = new UpgradeInstance(upgrade, val);
				if ((int)upgrade.UpgradeType != 0 && (int)upgrade.UpgradeType != 2 && (PlayerData.GetUnlockedInstances(upgrade) == null || PlayerData.GetUnlockedInstances(upgrade).Instances == null || PlayerData.GetUnlockedInstances(upgrade).Instances.Count <= 0))
				{
					PlayerData.CollectInstance(val2, (UnlockFlags)1);
					val2.Unlock(true);
				}
			}
		}
		Plugin.SendTextChatMessageToClient("All missing upgrades are added silently.");
	}

	public static void collectGear(IUpgradable gear, MM2Button b = null)
	{
		//IL_0015: 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_0016: 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 levelUpAllWeapons(int level, MM2Button b = null)
	{
		IUpgradable[] allGear = Global.Instance.AllGear;
		for (int i = 0; i < allGear.Length; i++)
		{
			levelUpWeapon(allGear[i], level);
		}
	}

	public static void levelUpWeapon(IUpgradable gear, int level, MM2Button b = null)
	{
		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 levelUpGearRelative(IUpgradable gear, int delta, MenuMod2Menu menu = null, MM2Button b = null)
	{
		GearData gearData = PlayerData.GetGearData(gear);
		if (!gearData.IsUnlocked)
		{
			return;
		}
		FieldInfo? field = ((object)gearData).GetType().GetField("level", BindingFlags.Instance | BindingFlags.NonPublic);
		int num = (int)field.GetValue(gearData);
		int num2 = Math.Max(0, num + delta);
		field.SetValue(gearData, num2);
		if (menu != null)
		{
			string text = $"{gear.Info.Name} (Level {num2})";
			menu.thisButton.changeName(text);
			menu.menuName = text;
			menu.buttons.FirstOrDefault((MM2Button btn) => btn.name == "Back")?.changePrefix("[" + menu.menuName + "]\n");
		}
		b?.updateText();
	}

	public static int getGearLevel(IUpgradable gear)
	{
		GearData gearData = PlayerData.GetGearData(gear);
		if (gearData.IsUnlocked)
		{
			return (int)((object)gearData).GetType().GetField("level", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(gearData);
		}
		return 0;
	}

	public static void setAllCharictersToLevel(int level, MM2Button b = null)
	{
		Character[] characters = Global.Instance.Characters;
		for (int i = 0; i < characters.Length; i++)
		{
			GearData gearData = PlayerData.GetGearData((IUpgradable)(object)characters[i]);
			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 setAllGearInTypeToLevel(IEnumerable<IUpgradable> gearList, int level, MM2Button b = null)
	{
		foreach (IUpgradable gear in gearList)
		{
			GearData gearData = PlayerData.GetGearData(gear);
			if (gearData.IsUnlocked)
			{
				((object)gearData).GetType().GetField("level", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(gearData, level);
			}
		}
	}

	public static void giveAllSkills(MM2Button b = null)
	{
		Character[] characters = Global.Instance.Characters;
		foreach (Character val in characters)
		{
			SkillTree skillTree = val.SkillTree;
			SkillTreeUpgradeUI[] componentsInChildren = ((Component)skillTree).GetComponentsInChildren<SkillTreeUpgradeUI>();
			foreach (SkillTreeUpgradeUI val2 in componentsInChildren)
			{
				UpgradeInstance obj = PlayerData.CollectInstance((IUpgradable)(object)val, val2.Upgrade, (UnlockFlags)0);
				obj.Seed = Random.Range(int.MinValue, int.MaxValue);
				obj.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;
		foreach (Character val in characters)
		{
			SkillTree skillTree = val.SkillTree;
			SkillTreeUpgradeUI[] componentsInChildren = ((Component)skillTree).GetComponentsInChildren<SkillTreeUpgradeUI>();
			foreach (SkillTreeUpgradeUI val2 in componentsInChildren)
			{
				if (PlayerData.GetUpgradeInfo((IUpgradable)(object)val, val2.Upgrade).TotalInstancesCollected <= 0)
				{
					UpgradeInstance obj = PlayerData.CollectInstance((IUpgradable)(object)val, val2.Upgrade, (UnlockFlags)0);
					obj.Seed = Random.Range(int.MinValue, int.MaxValue);
					obj.Unlock(false);
					PlayerData instance = PlayerData.Instance;
					int totalSkillPointsSpent = instance.TotalSkillPointsSpent;
					instance.TotalSkillPointsSpent = totalSkillPointsSpent + 1;
					skillTree.Refresh();
				}
			}
		}
	}
}
public static class SpawnMenu
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

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

		public static UnityAction <>9__1_0;

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

		public static UnityAction <>9__1_1;

		public static UnityAction <>9__1_2;

		public static UnityAction <>9__1_3;

		public static UnityAction <>9__1_4;

		public static UnityAction <>9__1_5;

		public static UnityAction <>9__1_6;

		public static UnityAction <>9__1_7;

		public static UnityAction <>9__1_8;

		public static UnityAction <>9__1_9;

		public static UnityAction <>9__1_10;

		public static UnityAction <>9__1_11;

		public static UnityAction <>9__1_12;

		internal void <CreateSpawnMenu>b__1_0()
		{
			//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)
			spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "amalgamation")));
		}

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

		internal void <CreateSpawnMenu>b__1_1()
		{
			//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)
			spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "cranius")));
		}

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

		internal void <CreateSpawnMenu>b__1_2()
		{
			spawnObject("Kart");
		}

		internal void <CreateSpawnMenu>b__1_3()
		{
			spawnObject("WheelBox");
		}

		internal void <CreateSpawnMenu>b__1_4()
		{
			spawnObject("SaxitosBag");
		}

		internal void <CreateSpawnMenu>b__1_5()
		{
			spawnObject("Jukebox");
		}

		internal void <CreateSpawnMenu>b__1_6()
		{
			spawnObject("HoldableBarrel");
		}

		internal void <CreateSpawnMenu>b__1_7()
		{
			spawnObject("TrainingDummy");
		}

		internal void <CreateSpawnMenu>b__1_8()
		{
			spawnObject("NoteBlock");
		}

		internal void <CreateSpawnMenu>b__1_9()
		{
			spawnObject("ExplosiveHotPotato");
		}

		internal void <CreateSpawnMenu>b__1_10()
		{
			spawnObject("BearPhys");
		}

		internal void <CreateSpawnMenu>b__1_11()
		{
			spawnObject("TP");
		}

		internal void <CreateSpawnMenu>b__1_12()
		{
			spawnObject("MilkJug");
		}
	}

	private static ManualLogSource Logger = Plugin.Logger;

	public static void CreateSpawnMenu(MenuMod2Menu parentMenu)
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Expected O, but got Unknown
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Expected O, but got Unknown
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Expected O, but got Unknown
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Expected O, but got Unknown
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Expected O, but got Unknown
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Expected O, but got Unknown
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Expected O, but got Unknown
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Expected O, but got Unknown
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Expected O, but got Unknown
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Expected O, but got Unknown
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Expected O, but got Unknown
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f5: Expected O, but got Unknown
		Logger.LogInfo((object)"Creating SPAWN menu");
		MenuMod2Menu parrentMenu = new MenuMod2Menu("SPAWN", parentMenu);
		MenuMod2Menu parrentMenu2 = new MenuMod2Menu("Enemy", parrentMenu);
		MenuMod2Menu menuMod2Menu = new MenuMod2Menu("BOSSES", parrentMenu2);
		object obj = <>c.<>9__1_0;
		if (obj == null)
		{
			UnityAction val = 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)
				spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "amalgamation")));
			};
			<>c.<>9__1_0 = val;
			obj = (object)val;
		}
		menuMod2Menu.addButton("Spawn Amalgamation", (UnityAction)obj);
		object obj2 = <>c.<>9__1_1;
		if (obj2 == null)
		{
			UnityAction val2 = 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)
				spawnEnemy(((IEnumerable<EnemyClass>)Global.Instance.EnemyClasses).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass x) => x.APIName == "cranius")));
			};
			<>c.<>9__1_1 = val2;
			obj2 = (object)val2;
		}
		menuMod2Menu.addButton("Spawn Cranius", (UnityAction)obj2);
		MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu("STANDARD", parrentMenu2);
		EnemyClass[] enemyClasses = Global.Instance.EnemyClasses;
		foreach (EnemyClass enemyClass in enemyClasses)
		{
			if ((Object)(object)enemyClass != (Object)null && !string.IsNullOrEmpty(enemyClass.Name))
			{
				menuMod2Menu2.addButton("Spawn " + 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)
					spawnEnemy(enemyClass);
				});
			}
		}
		MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu("Vehicle", parrentMenu);
		object obj3 = <>c.<>9__1_2;
		if (obj3 == null)
		{
			UnityAction val3 = delegate
			{
				spawnObject("Kart");
			};
			<>c.<>9__1_2 = val3;
			obj3 = (object)val3;
		}
		menuMod2Menu3.addButton("Spawn Dart", (UnityAction)obj3);
		object obj4 = <>c.<>9__1_3;
		if (obj4 == null)
		{
			UnityAction val4 = delegate
			{
				spawnObject("WheelBox");
			};
			<>c.<>9__1_3 = val4;
			obj4 = (object)val4;
		}
		menuMod2Menu3.addButton("Spawn WheelBox", (UnityAction)obj4);
		MenuMod2Menu menuMod2Menu4 = new MenuMod2Menu("Object", parrentMenu);
		object obj5 = <>c.<>9__1_4;
		if (obj5 == null)
		{
			UnityAction val5 = delegate
			{
				spawnObject("SaxitosBag");
			};
			<>c.<>9__1_4 = val5;
			obj5 = (object)val5;
		}
		menuMod2Menu4.addButton("Saxitos", (UnityAction)obj5);
		object obj6 = <>c.<>9__1_5;
		if (obj6 == null)
		{
			UnityAction val6 = delegate
			{
				spawnObject("Jukebox");
			};
			<>c.<>9__1_5 = val6;
			obj6 = (object)val6;
		}
		menuMod2Menu4.addButton("Radio", (UnityAction)obj6);
		object obj7 = <>c.<>9__1_6;
		if (obj7 == null)
		{
			UnityAction val7 = delegate
			{
				spawnObject("HoldableBarrel");
			};
			<>c.<>9__1_6 = val7;
			obj7 = (object)val7;
		}
		menuMod2Menu4.addButton("Barrel", (UnityAction)obj7);
		object obj8 = <>c.<>9__1_7;
		if (obj8 == null)
		{
			UnityAction val8 = delegate
			{
				spawnObject("TrainingDummy");
			};
			<>c.<>9__1_7 = val8;
			obj8 = (object)val8;
		}
		menuMod2Menu4.addButton("Dummy", (UnityAction)obj8);
		object obj9 = <>c.<>9__1_8;
		if (obj9 == null)
		{
			UnityAction val9 = delegate
			{
				spawnObject("NoteBlock");
			};
			<>c.<>9__1_8 = val9;
			obj9 = (object)val9;
		}
		menuMod2Menu4.addButton("Box", (UnityAction)obj9);
		object obj10 = <>c.<>9__1_9;
		if (obj10 == null)
		{
			UnityAction val10 = delegate
			{
				spawnObject("ExplosiveHotPotato");
			};
			<>c.<>9__1_9 = val10;
			obj10 = (object)val10;
		}
		menuMod2Menu4.addButton("Bomb", (UnityAction)obj10);
		object obj11 = <>c.<>9__1_10;
		if (obj11 == null)
		{
			UnityAction val11 = delegate
			{
				spawnObject("BearPhys");
			};
			<>c.<>9__1_10 = val11;
			obj11 = (object)val11;
		}
		menuMod2Menu4.addButton("Bear", (UnityAction)obj11);
		object obj12 = <>c.<>9__1_11;
		if (obj12 == null)
		{
			UnityAction val12 = delegate
			{
				spawnObject("TP");
			};
			<>c.<>9__1_11 = val12;
			obj12 = (object)val12;
		}
		menuMod2Menu4.addButton("Toilet Paper", (UnityAction)obj12);
		object obj13 = <>c.<>9__1_12;
		if (obj13 == null)
		{
			UnityAction val13 = delegate
			{
				spawnObject("MilkJug");
			};
			<>c.<>9__1_12 = val13;
			obj13 = (object)val13;
		}
		menuMod2Menu4.addButton("Milk", (UnityAction)obj13);
	}

	public static void spawnObject(string name)
	{
		//IL_000f: 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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		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 = Plugin.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))
			{
				Plugin.SendTextChatMessageToClient("Could not find valid spawn position in look direction.");
				return;
			}
			NetworkObject component = obj.GetComponent<NetworkObject>();
			if (component != null)
			{
				component.Spawn(true);
			}
		}
		else
		{
			Plugin.SendTextChatMessageToClient("Invalid look position.");
		}
	}

	public static bool FindValidSpawnPos(ref GameObject obj)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: 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_0052: 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_0071: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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)
		{
			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++)
		{
			if (!Physics.CheckBox(val3 + val2, extents, rotation))
			{
				obj.transform.position = val3;
				obj.SetActive(true);
				return true;
			}
			val3 += Vector3.up * 1f;
		}
		Object.Destroy((Object)(object)obj);
		return false;
	}

	public static void spawnSwarm(int size)
	{
		EnemyManager enemyManager = Plugin.GetEnemyManager();
		if ((Object)(object)enemyManager != (Object)null)
		{
			enemyManager.SpawnSwarm_ServerRpc(size);
		}
	}

	public static void spawnEnemy(EnemyClass enemyClass, Vector3 pos = default(Vector3))
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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)
		//IL_002a: 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_0037: Unknown result type (might be due to invalid IL or missing references)
		EnemyManager enemyManager = Plugin.GetEnemyManager();
		if ((Object)(object)enemyManager != (Object)null)
		{
			if (pos == default(Vector3))
			{
				enemyManager.SpawnEnemy_Server(enemyClass);
			}
			else
			{
				enemyManager.SpawnEnemy_Server(pos, enemyClass, (WeightedArray<EnemyClassGroup>)null, false, (CustomWave)null, default(SpawnParams));
			}
		}
	}

	public static void spawnEnemy(EnemyClassGroup enemyClassGroup, Vector3 pos = default(Vector3))
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		EnemyManager enemyManager = Plugin.GetEnemyManager();
		if ((Object)(object)enemyManager != (Object)null)
		{
			if (pos == default(Vector3))
			{
				enemyManager.SpawnEnemy_Server(enemyClassGroup);
			}
			else
			{
				enemyManager.SpawnEnemy_Server(pos, enemyClassGroup);
			}
		}
	}
}
public static class UpgradesMenu
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

		public static UnityAction <>9__1_17;

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

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

		internal string <CreateUpgradesMenu>b__1_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 <CreateUpgradesMenu>b__1_3(IUpgradable g)
		{
			return g.Info.Name;
		}

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

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

		internal string <CreateUpgradesMenu>b__1_6(Upgrade u)
		{
			return Plugin.CleanRichText(u.Name);
		}

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

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

		internal string <CreateUpgradesMenu>b__1_11(Upgrade u)
		{
			return Plugin.CleanRichText(u.Name);
		}

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

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

		internal Upgrade <CreateUpgradesMenu>b__1_18(SkillTreeUpgradeUI ui)
		{
			return ui.Upgrade;
		}

		internal Rarity <CreateUpgradesMenu>b__1_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 <CreateUpgradesMenu>b__1_20(KeyValuePair<string, Upgrade> kvp)
		{
			return kvp.Key;
		}

		internal void <CreateUpgradesMenu>b__1_17()
		{
		}
	}

	private static ManualLogSource Logger = Plugin.Logger;

	public static void CreateUpgradesMenu(MenuMod2Menu parentMenu)
	{
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_038a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Invalid comparison between Unknown and I4
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Invalid comparison between Unknown and I4
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Expected O, but got Unknown
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Expected O, but got Unknown
		//IL_03be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Expected O, but got Unknown
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Expected O, but got Unknown
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_06dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e2: Expected O, but got Unknown
		//IL_067f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0689: Expected O, but got Unknown
		//IL_069b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0694: Unknown result type (might be due to invalid IL or missing references)
		Logger.LogInfo((object)"About to create gear and character menus");
		MenuMod2Menu parrentMenu = new MenuMod2Menu("UPGRADES", 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;
			MenuMod2Menu parrentMenu2 = new MenuMod2Menu(((object)(GearType)(ref key)).ToString(), parrentMenu);
			foreach (IUpgradable gear in item.OrderBy((IUpgradable g) => g.Info.Name))
			{
				GearInfo info = gear.Info;
				MenuMod2Menu menuMod2Menu = new MenuMod2Menu(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) || Plugin.sparrohMode
					orderby u.Rarity descending, Plugin.CleanRichText(u.Name)
					select u).ToList())
				{
					if ((int)upgrade3.UpgradeType == 2)
					{
						menuMod2Menu.addButton(Plugin.CleanRichText(upgrade3.Name), (UnityAction)delegate
						{
							giveCosmetic(upgrade3, gear);
						}).changeColour(upgrade3.Color);
					}
					else
					{
						menuMod2Menu.addButton(Plugin.CleanRichText(upgrade3.Name), (UnityAction)delegate
						{
							giveUpgrade(upgrade3, gear);
						}).changeColour(upgrade3.Color);
					}
				}
			}
		}
		MenuMod2Menu parrentMenu3 = new MenuMod2Menu("Characters", parrentMenu);
		Character[] characters = Global.Instance.Characters;
		foreach (Character character in characters)
		{
			MenuMod2Menu menuMod2Menu2 = new MenuMod2Menu(((Dude)character).Info.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) || Plugin.sparrohMode
				orderby u.Rarity descending, Plugin.CleanRichText(u.Name)
				select u).ToList())
			{
				if ((int)upgrade2.UpgradeType == 2)
				{
					menuMod2Menu2.addButton(Plugin.CleanRichText(upgrade2.Name), (UnityAction)delegate
					{
						giveCosmetic(upgrade2, (IUpgradable)(object)character);
					}).changeColour(upgrade2.Color);
				}
				else
				{
					menuMod2Menu2.addButton(Plugin.CleanRichText(upgrade2.Name), (UnityAction)delegate
					{
						giveCharacterUpgrade(upgrade2, (IUpgradable)(object)character);
					}).changeColour(upgrade2.Color);
				}
			}
		}
		MenuMod2Menu menuMod2Menu3 = new MenuMod2Menu("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) || Plugin.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(Plugin.CleanRichText(upgrade.Name), (UnityAction)delegate
					{
						giveUniversalUpgrade(upgrade);
					}).changeColour(flag ? Color.green : upgrade.Color);
				}
				return;
			}
			object obj = <>c.<>9__1_17;
			if (obj == null)
			{
				UnityAction val2 = delegate
				{
				};
				<>c.<>9__1_17 = val2;
				obj = (object)val2;
			}
			menuMod2Menu3.addButton("No generics found", (UnityAction)obj);
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("Exception in universal upgrade menu creation: " + ex.Message + "\n" + ex.StackTrace));
		}
	}

	public static void giveAllUpgrades(MM2Button b = null)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Invalid comparison between Unknown and I4
		//IL_0045: 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_0051: Expected O, but got Unknown
		IUpgradable[] allGear = Global.Instance.AllGear;
		foreach (IUpgradable val in allGear)
		{
			foreach (Upgrade upgrade in val.Info.Upgrades)
			{
				if ((int)upgrade.UpgradeType != 0 && (int)upgrade.UpgradeType != 2)
				{
					UpgradeInstance val2 = new UpgradeInstance(upgrade, val);
					PlayerData.CollectInstance(val2, (UnlockFlags)1);
					val2.Unlock(true);
				}
			}
		}
		Plugin.SendTextChatMessageToClient("All upgrades for weapons are added silently.");
	}

	public static void giveAllCosmetics(MM2Button b = null)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Invalid comparison between Unknown and I4
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Invalid comparison between Unknown and I4
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Invalid comparison between Unknown and I4
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Expected O, but got Unknown
		IUpgradable[] allGear = Global.Instance.AllGear;
		foreach (IUpgradable val in allGear)
		{
			foreach (Upgrade upgrade in val.Info.Upgrades)
			{
				if ((int)upgrade.UpgradeType == 2 && !Regex.IsMatch(upgrade.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_)", RegexOptions.IgnoreCase))
				{
					UpgradeInstance val2 = new UpgradeInstance(upgrade, val);
					PlayerData.CollectInstance(val2, (UnlockFlags)1);
					val2.Unlock(true);
				}
			}
		}
		Character[] characters = Global.Instance.Characters;
		foreach (Character val3 in characters)
		{
			foreach (Upgrade upgrade2 in ((Dude)val3).Info.Upgrades)
			{
				if ((int)upgrade2.UpgradeType == 2 && !Regex.IsMatch(upgrade2.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_)", RegexOptions.IgnoreCase))
				{
					UpgradeInstance val4 = new UpgradeInstance(upgrade2, (IUpgradable)(object)val3);
					PlayerData.CollectInstance(val4, (UnlockFlags)1);
					val4.Unlock(true);
				}
			}
		}
		if ((Object)(object)Global.Instance.DropPod != (Object)null)
		{
			IUpgradable dropPod = (IUpgradable)(object)Global.Instance.DropPod;
			GearInfo info = dropPod.Info;
			if ((Object)(object)info != (Object)null)
			{
				foreach (Upgrade upgrade3 in info.Upgrades)
				{
					if ((int)upgrade3.UpgradeType == 2 && !Regex.IsMatch(upgrade3.Name, "(_test_|_dev_|_wip|debug|temp|placeholder|todo|_old|_backup|_copy|\\.skinasset$|^test_)", RegexOptions.IgnoreCase))
					{
						UpgradeInstance val5 = new UpgradeInstance(upgrade3, dropPod);
						PlayerData.CollectInstance(val5, (UnlockFlags)1);
						val5.Unlock(true);
					}
				}
			}
		}
		Plugin.SendTextChatMessageToClient("All cosmetics for characters, weapons, and drop pod are added silently.");
	}

	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
		UpgradeInstance val = new UpgradeInstance(upgrade, gear);
		PlayerData.CollectInstance(val, (UnlockFlags)1);
		val.Unlock(true);
	}

	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
		UpgradeInstance val = new UpgradeInstance(upgrade, gear);
		PlayerData.CollectInstance(val, (UnlockFlags)0);
		val.Unlock(true);
	}

	public static void giveCharacterUpgrade(Upgrade upgrade, IUpgradable character, MM2Button b = null)
	{
		UpgradeInstance obj = PlayerData.CollectInstance(character, upgrade, (UnlockFlags)1);
		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();
		}
	}

	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_0032: Unknown result type (might be due to invalid IL or missing references)
		IUpgradable instance = (IUpgradable)(object)Global.Instance;
		UpgradeInstance val = new UpgradeInstance(upgrade, instance);
		PlayerData.CollectInstance(val, (UnlockFlags)1);
		val.Seed = Random.Range(int.MinValue, int.MaxValue);
		val.Unlock(true);
		((PlayerUpgrade)upgrade).Apply(Player.LocalPlayer, val);
		Plugin.SendTextChatMessageToClient("Universal upgrade added silently.");
	}
}
namespace CheatMenu
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CheatMenu";

		public const string PLUGIN_NAME = "CheatMenu";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}