Decompiled source of NotCreative v1.1.0

NotCreative.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NotCreative")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("NotCreative")]
[assembly: AssemblyTitle("NotCreative")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 NotCreative
{
	internal class IconEntry
	{
		public string Name;

		public string Subtitle;

		public string Description;

		public Texture Icon;

		public Rect Uv = new Rect(0f, 0f, 1f, 1f);

		public Color Color = new Color(0.55f, 0.58f, 0.65f);

		public string Search;

		private AssetReferenceT<Sprite> iconReference;

		private bool iconRequested;

		public void SetIcon(Sprite sprite, AssetReferenceT<Sprite> reference)
		{
			if (Object.op_Implicit((Object)(object)sprite))
			{
				SetSprite(sprite);
			}
			else if (reference != null && ((AssetReference)reference).RuntimeKeyIsValid())
			{
				iconReference = reference;
			}
		}

		public void RequestIcon()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Icon) || iconRequested || iconReference == null)
			{
				return;
			}
			iconRequested = true;
			try
			{
				AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>(((AssetReference)iconReference).RuntimeKey);
				val.Completed += delegate(AsyncOperationHandle<Sprite> loaded)
				{
					//IL_0002: Unknown result type (might be due to invalid IL or missing references)
					//IL_0008: Invalid comparison between Unknown and I4
					if ((int)loaded.Status == 1)
					{
						SetSprite(loaded.Result);
					}
				};
			}
			catch (Exception ex)
			{
				NotCreativePlugin.Log.LogWarning((object)("Could not load the icon for " + Name + ": " + ex.Message));
			}
		}

		private void SetSprite(Sprite sprite)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)sprite) && Object.op_Implicit((Object)(object)sprite.texture))
			{
				Uv = Helpers.SpriteUv(sprite);
				Icon = (Texture)(object)sprite.texture;
			}
		}

		public void BuildSearch()
		{
			Search = (Name + " " + Subtitle).ToLowerInvariant();
		}
	}
	internal enum ItemCategory
	{
		Common,
		Uncommon,
		Legendary,
		Boss,
		Lunar,
		Void,
		Food,
		Other
	}
	internal enum EquipmentCategory
	{
		Normal,
		Lunar,
		Boss,
		Aspect
	}
	internal enum InteractableCategory
	{
		Chest,
		Shrine,
		Drone,
		Printer,
		Portal,
		Other
	}
	internal sealed class ItemEntry : IconEntry
	{
		public ItemIndex Index;

		public ItemCategory Category;

		public bool Hidden;
	}
	internal sealed class EquipmentEntry : IconEntry
	{
		public EquipmentIndex Index;

		public EquipmentCategory Category;
	}
	internal sealed class MonsterEntry : IconEntry
	{
		public CharacterMaster MasterPrefab;
	}
	internal sealed class SurvivorEntry : IconEntry
	{
		public SurvivorDef Def;
	}
	internal sealed class InteractableEntry : IconEntry
	{
		public string Key;

		public bool IsLegacyPath;

		public InteractableCategory Category;

		public InteractableSpawnCard Card;
	}
	internal sealed class StageEntry : IconEntry
	{
		public SceneDef Def;
	}
	internal sealed class EliteEntry
	{
		public EliteDef Def;

		public string Name;

		public Color Color;
	}
	internal static class Catalogs
	{
		private const string LegacyIscPrefix = "SpawnCards/InteractableSpawnCard/";

		public static readonly List<ItemEntry> Items = new List<ItemEntry>();

		public static readonly List<EquipmentEntry> Equipment = new List<EquipmentEntry>();

		public static readonly List<MonsterEntry> Monsters = new List<MonsterEntry>();

		public static readonly List<SurvivorEntry> Survivors = new List<SurvivorEntry>();

		public static readonly List<StageEntry> Stages = new List<StageEntry>();

		public static readonly List<EliteEntry> Elites = new List<EliteEntry>();

		public static readonly List<InteractableEntry> Interactables = new List<InteractableEntry>();

		public static readonly Color[] ItemCategoryColors = (Color[])(object)new Color[8];

		public static readonly int[] ItemCategoryCounts = new int[8];

		public static readonly int[] ItemCategoryCountsWithHidden = new int[8];

		public static readonly Color[] EquipmentCategoryColors = (Color[])(object)new Color[4];

		public static readonly Color[] InteractableCategoryColors = (Color[])(object)new Color[6]
		{
			Styles.Hex(15254634u),
			Styles.Hex(9425865u),
			Styles.Hex(10335743u),
			Styles.Hex(15902298u),
			Styles.Hex(13081599u),
			Styles.Hex(9344424u)
		};

		private static bool built;

		private static bool interactablesBuilt;

		public static void EnsureBuilt()
		{
			if (!built && ItemCatalog.itemCount != 0)
			{
				built = true;
				BuildItems();
				BuildEquipment();
				BuildMonsters();
				BuildSurvivors();
				BuildStages();
				BuildElites();
				NotCreativePlugin.Log.LogInfo((object)$"Catalogs: {Items.Count} items, {Equipment.Count} equipment, {Monsters.Count} monsters, {Survivors.Count} survivors, {Stages.Count} stages, {Elites.Count} elites.");
			}
		}

		private static void BuildItems()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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_002d: 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_0039: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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_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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					ItemDef current = enumerator.Current;
					if (Object.op_Implicit((Object)(object)current))
					{
						ItemEntry itemEntry = new ItemEntry
						{
							Index = current.itemIndex,
							Category = CategoryOf(current.tier),
							Hidden = current.hidden,
							Name = Helpers.Lang(current.nameToken, ((Object)current).name),
							Subtitle = ((Object)current).name,
							Description = Helpers.StripTags(Helpers.Lang(current.pickupToken, ""))
						};
						ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef(current.tier);
						if (Object.op_Implicit((Object)(object)itemTierDef))
						{
							itemEntry.Color = Color32.op_Implicit(ColorCatalog.GetColor(itemTierDef.colorIndex));
						}
						itemEntry.SetIcon(current.GetIcon(), current.GetIconReference());
						itemEntry.BuildSearch();
						Items.Add(itemEntry);
						int category = (int)itemEntry.Category;
						ItemCategoryCountsWithHidden[category]++;
						if (!itemEntry.Hidden)
						{
							ItemCategoryCounts[category]++;
						}
						if (ItemCategoryColors[category].a == 0f && Object.op_Implicit((Object)(object)itemTierDef))
						{
							ItemCategoryColors[category] = itemEntry.Color;
						}
					}
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
			ItemCategoryColors[7] = Styles.TextDim;
			Items.Sort((ItemEntry a, ItemEntry b) => (a.Category == b.Category) ? string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase) : a.Category.CompareTo(b.Category));
		}

		private static ItemCategory CategoryOf(ItemTier tier)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected I4, but got Unknown
			switch ((int)tier)
			{
			case 0:
				return ItemCategory.Common;
			case 1:
				return ItemCategory.Uncommon;
			case 2:
				return ItemCategory.Legendary;
			case 4:
				return ItemCategory.Boss;
			case 3:
				return ItemCategory.Lunar;
			case 6:
			case 7:
			case 8:
			case 9:
				return ItemCategory.Void;
			case 10:
				return ItemCategory.Food;
			default:
				return ItemCategory.Other;
			}
		}

		private static void BuildEquipment()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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)
			for (int i = 0; i < EquipmentCatalog.equipmentCount; i++)
			{
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)i);
				if (!Object.op_Implicit((Object)(object)equipmentDef))
				{
					continue;
				}
				string text = Helpers.Lang(equipmentDef.nameToken, null);
				AssetReferenceT<Sprite> iconReference = equipmentDef.GetIconReference();
				if (text != null || Object.op_Implicit((Object)(object)equipmentDef.GetIcon()) || (iconReference != null && ((AssetReference)iconReference).RuntimeKeyIsValid()))
				{
					EquipmentEntry equipmentEntry = new EquipmentEntry
					{
						Index = equipmentDef.equipmentIndex,
						Category = (Object.op_Implicit((Object)(object)equipmentDef.passiveBuffDef) ? EquipmentCategory.Aspect : (equipmentDef.isLunar ? EquipmentCategory.Lunar : (equipmentDef.isBoss ? EquipmentCategory.Boss : EquipmentCategory.Normal))),
						Name = (text ?? ((Object)equipmentDef).name),
						Subtitle = ((Object)equipmentDef).name,
						Description = Helpers.StripTags(Helpers.Lang(equipmentDef.pickupToken, "")),
						Color = Color32.op_Implicit(ColorCatalog.GetColor(equipmentDef.colorIndex))
					};
					equipmentEntry.SetIcon(equipmentDef.GetIcon(), equipmentDef.GetIconReference());
					equipmentEntry.BuildSearch();
					Equipment.Add(equipmentEntry);
					int category = (int)equipmentEntry.Category;
					if (EquipmentCategoryColors[category].a == 0f)
					{
						EquipmentCategoryColors[category] = ((equipmentEntry.Category == EquipmentCategory.Aspect) ? Styles.Accent : equipmentEntry.Color);
					}
				}
			}
			Equipment.Sort((EquipmentEntry a, EquipmentEntry b) => (a.Category == b.Category) ? string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase) : a.Category.CompareTo(b.Category));
		}

		private static void BuildMonsters()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			Color color = default(Color);
			((Color)(ref color))..ctor(0.93f, 0.8f, 0.3f);
			foreach (CharacterMaster allAiMaster in MasterCatalog.allAiMasters)
			{
				if (!Object.op_Implicit((Object)(object)allAiMaster) || !Object.op_Implicit((Object)(object)allAiMaster.bodyPrefab))
				{
					continue;
				}
				CharacterBody component = allAiMaster.bodyPrefab.GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component))
				{
					MonsterEntry monsterEntry = new MonsterEntry
					{
						MasterPrefab = allAiMaster,
						Name = Helpers.Lang(component.baseNameToken, ((Object)allAiMaster).name),
						Subtitle = ((Object)allAiMaster).name,
						Description = (component.isChampion ? "Boss" : ""),
						Icon = component.portraitIcon
					};
					if (component.isChampion)
					{
						monsterEntry.Color = color;
					}
					monsterEntry.BuildSearch();
					Monsters.Add(monsterEntry);
				}
			}
			Monsters.Sort((MonsterEntry a, MonsterEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
		}

		private static void BuildSurvivors()
		{
			//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)
			foreach (SurvivorDef orderedSurvivorDef in SurvivorCatalog.orderedSurvivorDefs)
			{
				if (Object.op_Implicit((Object)(object)orderedSurvivorDef) && Object.op_Implicit((Object)(object)orderedSurvivorDef.bodyPrefab))
				{
					CharacterBody component = orderedSurvivorDef.bodyPrefab.GetComponent<CharacterBody>();
					SurvivorEntry survivorEntry = new SurvivorEntry
					{
						Def = orderedSurvivorDef,
						Name = Helpers.Lang(orderedSurvivorDef.displayNameToken, orderedSurvivorDef.cachedName),
						Subtitle = orderedSurvivorDef.cachedName,
						Description = "Respawns you as this survivor right where you stand. Items are kept.",
						Icon = (Object.op_Implicit((Object)(object)component) ? component.portraitIcon : null),
						Color = orderedSurvivorDef.primaryColor
					};
					survivorEntry.BuildSearch();
					Survivors.Add(survivorEntry);
				}
			}
		}

		private static void BuildStages()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Invalid comparison between Unknown and I4
			Enumerator<SceneDef> enumerator = SceneCatalog.allSceneDefs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					SceneDef current = enumerator.Current;
					if (Object.op_Implicit((Object)(object)current) && !current.isOfflineScene && ((int)current.sceneType == 1 || (int)current.sceneType == 5 || (int)current.sceneType == 2 || (int)current.sceneType == 4))
					{
						StageEntry stageEntry = new StageEntry
						{
							Def = current,
							Name = Helpers.Lang(current.nameToken, current.cachedName),
							Subtitle = current.cachedName,
							Description = Helpers.StripTags(Helpers.Lang(current.subtitleToken, ""))
						};
						stageEntry.BuildSearch();
						Stages.Add(stageEntry);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose();
			}
			Stages.Sort(delegate(StageEntry a, StageEntry b)
			{
				int num = ((a.Def.stageOrder > 0) ? a.Def.stageOrder : int.MaxValue);
				int num2 = ((b.Def.stageOrder > 0) ? b.Def.stageOrder : int.MaxValue);
				return (num == num2) ? string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase) : num.CompareTo(num2);
			});
		}

		private static void BuildElites()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00a3: 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)
			HashSet<EquipmentDef> hashSet = new HashSet<EquipmentDef>();
			foreach (EliteIndex elite in EliteCatalog.eliteList)
			{
				EliteDef eliteDef = EliteCatalog.GetEliteDef(elite);
				if (Object.op_Implicit((Object)(object)eliteDef) && Object.op_Implicit((Object)(object)eliteDef.eliteEquipmentDef) && hashSet.Add(eliteDef.eliteEquipmentDef))
				{
					string name = Helpers.Lang(eliteDef.modifierToken, ((Object)eliteDef).name).Replace("{0}", "").Trim();
					Color val = Color32.op_Implicit(eliteDef.color);
					Elites.Add(new EliteEntry
					{
						Def = eliteDef,
						Name = name,
						Color = ((val.a > 0f) ? val : Styles.Accent)
					});
				}
			}
			Elites.Sort((EliteEntry a, EliteEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
		}

		public static void EnsureInteractables()
		{
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			if (interactablesBuilt)
			{
				return;
			}
			interactablesBuilt = true;
			Dictionary<string, InteractableEntry> dictionary = new Dictionary<string, InteractableEntry>(StringComparer.OrdinalIgnoreCase);
			try
			{
				foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators)
				{
					foreach (object key2 in resourceLocator.Keys)
					{
						if (key2 is string text && text.EndsWith(".asset", StringComparison.Ordinal))
						{
							string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
							if (fileNameWithoutExtension.StartsWith("isc", StringComparison.Ordinal) && !dictionary.ContainsKey(fileNameWithoutExtension))
							{
								dictionary[fileNameWithoutExtension] = new InteractableEntry
								{
									Key = text
								};
							}
						}
					}
				}
			}
			catch (Exception ex)
			{
				NotCreativePlugin.Log.LogWarning((object)("Could not read the Addressables catalog: " + ex.Message));
			}
			List<string> list = new List<string>();
			LegacyResourcesAPI.GetAllPaths(list);
			foreach (string item in list)
			{
				if (item.StartsWith("SpawnCards/InteractableSpawnCard/", StringComparison.Ordinal))
				{
					string key = item.Substring("SpawnCards/InteractableSpawnCard/".Length);
					if (!dictionary.ContainsKey(key))
					{
						dictionary[key] = new InteractableEntry
						{
							Key = item,
							IsLegacyPath = true
						};
					}
				}
			}
			foreach (KeyValuePair<string, InteractableEntry> item2 in dictionary)
			{
				InteractableEntry value = item2.Value;
				value.Name = Helpers.Humanize(item2.Key.Substring(3));
				value.Subtitle = item2.Key;
				value.Description = value.Key;
				value.Category = CategoryOf(item2.Key.ToLowerInvariant());
				value.Color = InteractableCategoryColors[(int)value.Category];
				value.BuildSearch();
				Interactables.Add(value);
			}
			Interactables.Sort((InteractableEntry a, InteractableEntry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
			NotCreativePlugin.Log.LogInfo((object)$"Catalogs: {Interactables.Count} interactable spawn cards.");
		}

		private static InteractableCategory CategoryOf(string name)
		{
			if (name.Contains("portal"))
			{
				return InteractableCategory.Portal;
			}
			if (name.Contains("shrine"))
			{
				return InteractableCategory.Shrine;
			}
			if (name.Contains("duplicator") || name.Contains("printer"))
			{
				return InteractableCategory.Printer;
			}
			if (name.Contains("drone") || name.Contains("turret"))
			{
				return InteractableCategory.Drone;
			}
			if (name.Contains("chest") || name.Contains("barrel") || name.Contains("lockbox") || name.Contains("shop") || name.Contains("casino"))
			{
				return InteractableCategory.Chest;
			}
			return InteractableCategory.Other;
		}

		public static InteractableSpawnCard LoadCard(InteractableEntry entry)
		{
			//IL_0024: 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 (Object.op_Implicit((Object)(object)entry.Card))
			{
				return entry.Card;
			}
			try
			{
				entry.Card = (entry.IsLegacyPath ? LegacyResourcesAPI.Load<InteractableSpawnCard>(entry.Key) : Addressables.LoadAssetAsync<InteractableSpawnCard>((object)entry.Key).WaitForCompletion());
			}
			catch (Exception ex)
			{
				NotCreativePlugin.Log.LogWarning((object)("Could not load " + entry.Key + ": " + ex.Message));
			}
			return entry.Card;
		}
	}
	internal sealed class CreativeMenu
	{
		private enum CellLayout
		{
			Icon,
			IconLabel,
			Text
		}

		private struct Cell
		{
			public IconEntry Entry;

			public string Badge;

			public bool Dim;

			public bool Selected;
		}

		private struct Click
		{
			public int Index;

			public int Button;

			public bool Shift;
		}

		private sealed class Grid
		{
			public Vector2 Scroll;

			public float ViewHeight;
		}

		private sealed class Filter<T> where T : IconEntry
		{
			private IList<T> source;

			private int sourceCount = -1;

			private string key;

			private readonly List<T> result = new List<T>();

			public List<T> Apply(IList<T> items, string search, int mode, Func<T, bool> predicate)
			{
				string text = (search ?? "").Trim().ToLowerInvariant();
				string text2 = mode + "\n" + text;
				if (items == source && items.Count == sourceCount && text2 == key)
				{
					return result;
				}
				source = items;
				sourceCount = items.Count;
				key = text2;
				result.Clear();
				foreach (T item in items)
				{
					if (predicate(item) && (text.Length == 0 || item.Search.Contains(text)))
					{
						result.Add(item);
					}
				}
				return result;
			}
		}

		private const int WindowId = 20035;

		private const float WindowWidth = 1120f;

		private const float WindowHeight = 760f;

		private const float InnerWidth = 1084f;

		private static readonly string[] TabNames = new string[5] { "Items", "Equipment", "Player", "Spawn", "World" };

		private readonly PlayerCheats cheats;

		private readonly List<MPEventSystem> cursorHolders = new List<MPEventSystem>();

		private readonly List<Image> cursorImages = new List<Image>();

		private readonly Vector3[] cursorCorners = (Vector3[])(object)new Vector3[4];

		private readonly List<Action> queued = new List<Action>();

		private readonly List<Action> deferredUi = new List<Action>();

		private Rect windowRect;

		private Rect drawnWindowRect;

		private float windowScale = -1f;

		private int tab;

		private IconEntry hovered;

		private const float LeftColumn = 410f;

		private const float RightColumnInner = 624f;

		private static readonly string[] ItemFilterNames = new string[9] { "All", "Common", "Uncommon", "Legendary", "Boss", "Lunar", "Void", "Food", "Other" };

		private static readonly string[] EquipmentFilterNames = new string[5] { "All", "Normal", "Lunar", "Boss", "Elite aspects" };

		private static readonly string[] InteractableFilterNames = new string[7] { "All", "Chests", "Shrines", "Drones", "Printers", "Portals", "Other" };

		private static readonly string[] GiveModeNames = new string[2] { "Give", "Drop" };

		private static readonly string[] SpawnModeNames = new string[2] { "Monsters", "Interactables" };

		private static readonly string[] TeamNames = new string[2] { "Enemy", "Ally" };

		private static readonly int[] Amounts = new int[5] { 1, 5, 10, 50, 100 };

		private static readonly string[] AmountNames = new string[5] { "1", "5", "10", "50", "100" };

		private static readonly int[] SpawnCounts = new int[5] { 1, 3, 5, 10, 20 };

		private static readonly string[] SpawnCountNames = new string[5] { "1", "3", "5", "10", "20" };

		private static readonly uint[] MoneyAmounts = new uint[4] { 100u, 1000u, 10000u, 100000u };

		private static readonly uint[] CoinAmounts = new uint[3] { 1u, 10u, 100u };

		private static readonly uint[] LevelAmounts = new uint[4] { 1u, 5u, 10u, 50u };

		private string itemSearch = "";

		private int itemFilter;

		private int itemAmount;

		private int itemMode;

		private bool showHidden;

		private string[] itemChipLabels;

		private bool itemChipLabelsHidden;

		private readonly Grid itemGrid = new Grid();

		private readonly Filter<ItemEntry> itemView = new Filter<ItemEntry>();

		private string equipmentSearch = "";

		private int equipmentFilter;

		private int equipmentMode;

		private string[] equipmentChipLabels;

		private readonly Grid equipmentGrid = new Grid();

		private readonly Filter<EquipmentEntry> equipmentView = new Filter<EquipmentEntry>();

		private Vector2 playerScroll;

		private readonly Grid survivorGrid = new Grid();

		private int spawnMode;

		private int spawnCount;

		private int spawnTeam;

		private int spawnElite;

		private int interactableFilter;

		private string[] eliteNames;

		private Color[] eliteDots;

		private string[] interactableChipLabels;

		private string monsterSearch = "";

		private string interactableSearch = "";

		private readonly Grid monsterGrid = new Grid();

		private readonly Grid interactableGrid = new Grid();

		private readonly Filter<MonsterEntry> monsterView = new Filter<MonsterEntry>();

		private readonly Filter<InteractableEntry> interactableView = new Filter<InteractableEntry>();

		private Vector2 worldScroll;

		private readonly Grid stageGrid = new Grid();

		public static bool IsOpen { get; private set; }

		public CreativeMenu(PlayerCheats cheats)
		{
			this.cheats = cheats;
		}

		public void Toggle()
		{
			if (IsOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		public void Open()
		{
			if (IsOpen)
			{
				return;
			}
			IsOpen = true;
			Catalogs.EnsureBuilt();
			if (MPEventSystem.readOnlyInstancesList != null)
			{
				foreach (MPEventSystem readOnlyInstances in MPEventSystem.readOnlyInstancesList)
				{
					if (Object.op_Implicit((Object)(object)readOnlyInstances))
					{
						int cursorOpenerCount = readOnlyInstances.cursorOpenerCount;
						readOnlyInstances.cursorOpenerCount = cursorOpenerCount + 1;
						cursorHolders.Add(readOnlyInstances);
					}
				}
			}
			TimeControl.OnMenuOpened();
		}

		public void Close()
		{
			if (!IsOpen)
			{
				return;
			}
			IsOpen = false;
			foreach (MPEventSystem cursorHolder in cursorHolders)
			{
				if (Object.op_Implicit((Object)(object)cursorHolder))
				{
					int cursorOpenerCount = cursorHolder.cursorOpenerCount;
					cursorHolder.cursorOpenerCount = cursorOpenerCount - 1;
				}
			}
			cursorHolders.Clear();
			TimeControl.OnMenuClosed();
		}

		public void Update()
		{
			if (queued.Count == 0)
			{
				return;
			}
			Action[] array = queued.ToArray();
			queued.Clear();
			Action[] array2 = array;
			foreach (Action action in array2)
			{
				try
				{
					action();
				}
				catch (Exception ex)
				{
					Notifier.Error("Something went wrong: " + ex.Message);
					NotCreativePlugin.Log.LogError((object)ex);
				}
			}
		}

		private void Queue(Action action)
		{
			queued.Add(action);
		}

		private void Defer(Action action)
		{
			deferredUi.Add(action);
		}

		public void OnGUI()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Invalid comparison between Unknown and I4
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Expected O, but got Unknown
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			if (!IsOpen)
			{
				return;
			}
			float num = ComputeScale();
			Styles.Ensure(num);
			if ((int)Event.current.type == 8 && deferredUi.Count > 0)
			{
				foreach (Action item in deferredUi)
				{
					item();
				}
				deferredUi.Clear();
			}
			GUISkin skin = GUI.skin;
			GUI.skin = Styles.Skin;
			float num2 = Ui.S(1120f);
			float num3 = Ui.S(760f);
			if (num != windowScale)
			{
				windowRect = new Rect(((float)Screen.width - num2) / 2f, ((float)Screen.height - num3) / 2f, num2, num3);
				windowScale = num;
			}
			if ((int)Event.current.type == 7)
			{
				if (TimeControl.MenuPaused)
				{
					Ui.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)Texture2D.whiteTexture, new Color(0f, 0f, 0f, 0.35f));
				}
				float num4 = Ui.S(30f);
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref windowRect)).x - num4, ((Rect)(ref windowRect)).y - num4 + Ui.S(8f), ((Rect)(ref windowRect)).width + num4 * 2f, ((Rect)(ref windowRect)).height + num4 * 2f);
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, 0.6f);
				Shapes.Shadow(Ui.S(14f), num4).Draw(val, false, false, false, false);
				GUI.color = color;
			}
			drawnWindowRect = windowRect;
			windowRect = GUI.Window(20035, windowRect, new WindowFunction(DrawWindow), GUIContent.none);
			((Rect)(ref windowRect)).x = Mathf.Clamp(((Rect)(ref windowRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - num2));
			((Rect)(ref windowRect)).y = Mathf.Clamp(((Rect)(ref windowRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - num3));
			GUI.skin = skin;
		}

		private static float ComputeScale()
		{
			float num = (float)Screen.height / 1080f * NotCreativePlugin.UiScale.Value;
			num = Mathf.Min(new float[3]
			{
				num,
				(float)Screen.width / 1160f,
				(float)Screen.height / 800f
			});
			return Mathf.Round(Mathf.Max(num, 0.4f) * 50f) / 50f;
		}

		private void DrawWindow(int id)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			hovered = null;
			DrawHeader();
			DrawTabs();
			string text = BannerText();
			if (text != null)
			{
				GUILayout.Label(text, Styles.Banner, Array.Empty<GUILayoutOption>());
			}
			switch (tab)
			{
			case 0:
				DrawItemsTab();
				break;
			case 1:
				DrawEquipmentTab();
				break;
			case 2:
				DrawPlayerTab();
				break;
			case 3:
				DrawSpawnTab();
				break;
			default:
				DrawWorldTab();
				break;
			}
			Ui.Space(8f);
			DrawInfoBar();
			DrawGameCursor();
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref drawnWindowRect)).width - Ui.S(60f), Ui.S(60f)));
		}

		private void DrawHeader()
		{
			//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_0052: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Height(46f) });
			Rect rect = GUILayoutUtility.GetRect(Ui.S(42f), Ui.S(42f), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				Ui.Width(42f),
				Ui.Height(42f)
			});
			Ui.DrawTexture(rect, (Texture)(object)Shapes.Logo(((Rect)(ref rect)).width), Color.white);
			Ui.Space(12f);
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label("NotCreative", Styles.Title, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Creative menu   ·   v1.1.0", Styles.Subtitle, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (TimeControl.MenuPaused)
			{
				GUILayout.Label("Paused", Styles.PillAccent, Array.Empty<GUILayoutOption>());
			}
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				GUILayout.Label((!NetworkServer.active) ? "Client" : (RoR2Application.isInSinglePlayer ? "Single-player" : "Host"), Styles.Pill, Array.Empty<GUILayoutOption>());
				GUILayout.Label($"Stage {Run.instance.stageClearCount + 1}", Styles.Pill, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Label($"{NotCreativePlugin.MenuKey.Value} to close", Styles.Pill, Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
			GUILayout.FlexibleSpace();
			GUILayout.EndVertical();
			Ui.Space(8f);
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(GUIContent.none, Styles.CloseButton, Array.Empty<GUILayoutOption>()))
			{
				Queue(Close);
			}
			Rect lastRect = GUILayoutUtility.GetLastRect();
			float num = Ui.S(13f);
			Ui.DrawTexture(new Rect(((Rect)(ref lastRect)).center.x - num / 2f, ((Rect)(ref lastRect)).center.y - num / 2f, num, num), (Texture)(object)Shapes.CloseIcon(num), ((Rect)(ref lastRect)).Contains(Event.current.mousePosition) ? Styles.Danger : Styles.TextDim);
			GUILayout.FlexibleSpace();
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void DrawTabs()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			Ui.Space(10f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < TabNames.Length; i++)
			{
				bool flag = i == tab;
				if (GUILayout.Toggle(flag, TabNames[i], Styles.Tab, Array.Empty<GUILayoutOption>()) && !flag)
				{
					int target = i;
					Defer(delegate
					{
						tab = target;
					});
				}
				if (flag && (int)Event.current.type == 7)
				{
					Rect lastRect = GUILayoutUtility.GetLastRect();
					Ui.Fill(new Rect(((Rect)(ref lastRect)).x + Ui.S(14f), ((Rect)(ref lastRect)).yMax - Ui.S(3f), ((Rect)(ref lastRect)).width - Ui.S(28f), Ui.S(3f)), Styles.Accent, Ui.S(1.5f));
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			Ui.Divider();
			Ui.Space(12f);
		}

		private static string BannerText()
		{
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				return "No run is active. Start a run (single-player, or host a lobby) to use the menu.";
			}
			if (!NetworkServer.active)
			{
				return "You're a client in someone else's lobby. NotCreative only works for the host or in single-player.";
			}
			return null;
		}

		private void DrawInfoBar()
		{
			//IL_009f: 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_0054: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//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_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Invalid comparison between Unknown and I4
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			string text;
			string text2;
			if (hovered != null)
			{
				int num = Mathf.RoundToInt(Ui.S(12f));
				text = $"<color=#{Styles.ToHex(hovered.Color)}>{hovered.Name}</color>   <size={num}><color=#{Styles.ToHex(Styles.TextFaint)}>{hovered.Subtitle}</color></size>";
				text2 = (string.IsNullOrEmpty(hovered.Description) ? " " : hovered.Description);
			}
			else
			{
				text = "<color=#" + Styles.ToHex(Styles.TextDim) + ">Hover over something to see what it is</color>";
				text2 = "Spawned things appear where your crosshair was pointing when you opened the menu.";
			}
			GUILayout.BeginHorizontal(Styles.Card, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Height(76f) });
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(48f) });
			GUILayout.FlexibleSpace();
			Rect rect = GUILayoutUtility.GetRect(Ui.S(48f), Ui.S(48f), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				Ui.Width(48f),
				Ui.Height(48f)
			});
			GUILayout.FlexibleSpace();
			GUILayout.EndVertical();
			Ui.Space(14f);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.Label(text, Styles.InfoName, Array.Empty<GUILayoutOption>());
			GUILayout.Label(text2, Styles.InfoText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			GUILayout.EndVertical();
			Rect rect2 = GUILayoutUtility.GetRect(Ui.S(320f), Ui.S(48f), (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				Ui.Width(320f),
				GUILayout.ExpandHeight(true)
			});
			GUILayout.EndHorizontal();
			if ((int)Event.current.type == 7)
			{
				Ui.Fill(rect, Styles.Field, Ui.S(10f));
				if (hovered != null && Object.op_Implicit((Object)(object)hovered.Icon))
				{
					Color color = GUI.color;
					GUI.color = Color.white;
					GUI.DrawTextureWithTexCoords(Ui.Inset(rect, Ui.S(5f)), hovered.Icon, hovered.Uv, true);
					GUI.color = color;
				}
				else
				{
					Ui.DrawTexture(Ui.Inset(rect, Ui.S(8f)), (Texture)(object)Shapes.Logo(((Rect)(ref rect)).width - Ui.S(16f)), new Color(1f, 1f, 1f, (hovered != null) ? 0.25f : 0.5f));
				}
				DrawToast(rect2);
			}
		}

		private static void DrawToast(Rect area)
		{
			//IL_002f: 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_0034: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			if (Notifier.IsRecent)
			{
				float num = Time.unscaledTime - Notifier.ShownAt;
				float num2 = Mathf.Clamp01(5f - num);
				Color val = (Notifier.IsError ? Styles.Danger : Styles.Success);
				GUIContent val2 = new GUIContent(Notifier.Message);
				float num3 = Mathf.Min(Styles.ToastText.CalcSize(val2).x, ((Rect)(ref area)).width);
				float num4 = Ui.S(34f);
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(((Rect)(ref area)).xMax - num3, ((Rect)(ref area)).center.y - num4 / 2f, num3, num4);
				Ui.Fill(val3, WithAlpha(Styles.Mix(Styles.Surface, val, 0.14f), num2), num4 / 2f);
				Ui.Stroke(val3, WithAlpha(Styles.Mix(Styles.Line, val, 0.6f), num2), num4 / 2f, Mathf.Max(1f, Ui.S(1f)));
				float num5 = Ui.S(8f);
				Ui.Disc(new Rect(((Rect)(ref val3)).x + Ui.S(14f), ((Rect)(ref val3)).center.y - num5 / 2f, num5, num5), WithAlpha(val, num2));
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num2);
				GUI.Label(val3, val2, Styles.ToastText);
				GUI.color = color;
			}
		}

		private static Color WithAlpha(Color color, float alpha)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			color.a *= alpha;
			return color;
		}

		private static Inventory LocalInventory()
		{
			CharacterMaster localMaster = Helpers.LocalMaster;
			if (!Object.op_Implicit((Object)(object)localMaster))
			{
				return null;
			}
			return localMaster.inventory;
		}

		private bool DrawGrid(Grid grid, int count, Func<int, Cell> cellAt, CellLayout layout, float cellWidth, float cellHeight, float width, out Click click)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Invalid comparison between Unknown and I4
			//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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Invalid comparison between Unknown and I4
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			click = new Click
			{
				Index = -1
			};
			Event current = Event.current;
			float num = Ui.S(cellWidth);
			float num2 = Ui.S(cellHeight);
			int num3 = Mathf.Max(1, Mathf.FloorToInt((Ui.S(width) - Ui.S(18f)) / num));
			int num4 = (count + num3 - 1) / num3;
			grid.Scroll = GUILayout.BeginScrollView(grid.Scroll, false, false, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			Rect rect = GUILayoutUtility.GetRect((float)num3 * num, Mathf.Max((float)num4 * num2, 1f), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
			float y = grid.Scroll.y;
			float num5 = grid.Scroll.y + ((grid.ViewHeight > 0f) ? grid.ViewHeight : 4000f);
			bool flag = current.mousePosition.y >= y && current.mousePosition.y <= num5;
			float num6 = Ui.S(3f);
			Rect rect2 = default(Rect);
			for (int i = 0; i < num4; i++)
			{
				float num7 = ((Rect)(ref rect)).y + (float)i * num2;
				if (num7 + num2 < y || num7 > num5)
				{
					continue;
				}
				for (int j = 0; j < num3; j++)
				{
					int num8 = i * num3 + j;
					if (num8 >= count)
					{
						break;
					}
					((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + (float)j * num + num6, num7 + num6, num - num6 * 2f, num2 - num6 * 2f);
					Cell cell = cellAt(num8);
					cell.Entry.RequestIcon();
					bool flag2 = flag && ((Rect)(ref rect2)).Contains(current.mousePosition);
					if (flag2)
					{
						hovered = cell.Entry;
						if ((int)current.type == 0)
						{
							click = new Click
							{
								Index = num8,
								Button = current.button,
								Shift = current.shift
							};
							current.Use();
						}
					}
					if ((int)current.type == 7)
					{
						DrawCell(rect2, cell, layout, flag2);
					}
				}
			}
			GUILayout.EndScrollView();
			if ((int)current.type == 7)
			{
				Rect lastRect = GUILayoutUtility.GetLastRect();
				grid.ViewHeight = ((Rect)(ref lastRect)).height;
			}
			return click.Index >= 0;
		}

		private static void DrawCell(Rect rect, Cell cell, CellLayout layout, bool hover)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0036: 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)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Expected O, but got Unknown
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			IconEntry entry = cell.Entry;
			Color color = entry.Color;
			float radius = Ui.S(9f);
			Ui.Fill(rect, hover ? Styles.RaisedHover : Styles.Raised, radius);
			Ui.Fill(rect, new Color(color.r, color.g, color.b, cell.Dim ? 0.03f : (hover ? 0.17f : 0.09f)), radius);
			float num = ((Rect)(ref rect)).width - Ui.S(22f);
			Ui.Fill(new Rect(((Rect)(ref rect)).center.x - num / 2f, ((Rect)(ref rect)).yMax - Ui.S(6f), num, Ui.S(3f)), new Color(color.r, color.g, color.b, cell.Dim ? 0.25f : 0.9f), Ui.S(1.5f));
			Color color2 = GUI.color;
			GUI.color = (Color)(cell.Dim ? new Color(1f, 1f, 1f, 0.3f) : Color.white);
			switch (layout)
			{
			case CellLayout.Icon:
				if (Object.op_Implicit((Object)(object)entry.Icon))
				{
					float num3 = Mathf.Min(((Rect)(ref rect)).width, ((Rect)(ref rect)).height) - Ui.S(16f);
					GUI.DrawTextureWithTexCoords(new Rect(((Rect)(ref rect)).center.x - num3 / 2f, ((Rect)(ref rect)).y + Ui.S(6f), num3, num3), entry.Icon, entry.Uv, true);
				}
				else
				{
					GUI.Label(rect, entry.Name, Styles.CellText);
				}
				break;
			case CellLayout.IconLabel:
			{
				float num2 = Mathf.Min(((Rect)(ref rect)).width - Ui.S(24f), ((Rect)(ref rect)).height - Ui.S(52f));
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref rect)).center.x - num2 / 2f, ((Rect)(ref rect)).y + Ui.S(7f), num2, num2);
				if (Object.op_Implicit((Object)(object)entry.Icon))
				{
					GUI.DrawTextureWithTexCoords(val, entry.Icon, entry.Uv, true);
				}
				GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref val)).yMax + Ui.S(3f), ((Rect)(ref rect)).width, ((Rect)(ref rect)).yMax - ((Rect)(ref val)).yMax - Ui.S(8f)), entry.Name, Styles.CellLabel);
				break;
			}
			default:
				GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height - Ui.S(4f)), entry.Name, Styles.CellText);
				break;
			}
			GUI.color = color2;
			if (!string.IsNullOrEmpty(cell.Badge))
			{
				GUIContent val2 = new GUIContent(cell.Badge);
				float num4 = Ui.S(18f);
				float num5 = Mathf.Max(num4, Styles.Badge.CalcSize(val2).x);
				Rect val3 = new Rect(((Rect)(ref rect)).xMax - num5 - Ui.S(4f), ((Rect)(ref rect)).y + Ui.S(4f), num5, num4);
				Ui.Fill(val3, new Color(0f, 0f, 0f, 0.72f), num4 / 2f);
				GUI.Label(val3, val2, Styles.Badge);
			}
			if (cell.Selected)
			{
				Ui.Stroke(rect, Styles.Accent, radius, Ui.S(2f));
			}
			else if (hover)
			{
				Ui.Stroke(rect, new Color(1f, 1f, 1f, 0.3f), radius, Mathf.Max(1f, Ui.S(1f)));
			}
		}

		private void DrawGameCursor()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: 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_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_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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Event.current.type != 7)
			{
				return;
			}
			Color color = GUI.color;
			foreach (MPEventSystem cursorHolder in cursorHolders)
			{
				if (!Object.op_Implicit((Object)(object)cursorHolder) || !cursorHolder.isCursorVisible)
				{
					continue;
				}
				CursorIndicatorController componentInChildren = ((Component)cursorHolder).GetComponentInChildren<CursorIndicatorController>();
				if (!Object.op_Implicit((Object)(object)componentInChildren))
				{
					continue;
				}
				((Component)componentInChildren).GetComponentsInChildren<Image>(false, cursorImages);
				foreach (Image cursorImage in cursorImages)
				{
					if (((Behaviour)cursorImage).enabled && Object.op_Implicit((Object)(object)cursorImage.sprite))
					{
						Canvas canvas = ((Graphic)cursorImage).canvas;
						Camera obj = ((Object.op_Implicit((Object)(object)canvas) && (int)canvas.renderMode != 0) ? canvas.worldCamera : null);
						((Graphic)cursorImage).rectTransform.GetWorldCorners(cursorCorners);
						Vector2 val = RectTransformUtility.WorldToScreenPoint(obj, cursorCorners[0]);
						Vector2 val2 = RectTransformUtility.WorldToScreenPoint(obj, cursorCorners[2]);
						Rect val3 = new Rect(val.x - ((Rect)(ref drawnWindowRect)).x, (float)Screen.height - val2.y - ((Rect)(ref drawnWindowRect)).y, val2.x - val.x, val2.y - val.y);
						GUI.color = ((Graphic)cursorImage).color;
						GUI.DrawTextureWithTexCoords(val3, (Texture)(object)cursorImage.sprite.texture, Helpers.SpriteUv(cursorImage.sprite), true);
					}
				}
			}
			GUI.color = color;
		}

		private void DrawItemsTab()
		{
			Inventory inventory = LocalInventory();
			int amount = Amounts[itemAmount];
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			itemSearch = Ui.Search(itemSearch, 280f);
			Ui.Space(14f);
			Ui.Caption("Amount");
			itemAmount = Ui.Segmented(itemAmount, AmountNames, 250f);
			Ui.Space(14f);
			itemMode = Ui.Segmented(itemMode, GiveModeNames, 150f);
			GUILayout.FlexibleSpace();
			if (Ui.Chip("Show hidden", showHidden))
			{
				Defer(delegate
				{
					showHidden = !showHidden;
				});
			}
			GUILayout.EndHorizontal();
			itemFilter = Ui.ChipFlow(itemFilter, ItemChipLabels(), ItemChipDots(), 1084f);
			Ui.Space(4f);
			int filter = itemFilter;
			bool hidden = showHidden;
			List<ItemEntry> items = itemView.Apply(Catalogs.Items, itemSearch, filter * 2 + (hidden ? 1 : 0), (ItemEntry e) => (hidden || !e.Hidden) && (filter == 0 || e.Category == (ItemCategory)(filter - 1)));
			if (DrawGrid(itemGrid, items.Count, (int i) => ItemCell(items[i], inventory), CellLayout.Icon, 70f, 70f, 1084f, out var click))
			{
				ItemEntry item = items[click.Index];
				bool drop = itemMode == 1;
				if (click.Button == 1)
				{
					int count = (click.Shift ? int.MaxValue : amount);
					Queue(delegate
					{
						GameActions.RemoveItem(item, count);
					});
				}
				else if (click.Button == 0)
				{
					Queue(delegate
					{
						//IL_000e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0013: Unknown result type (might be due to invalid IL or missing references)
						if (drop)
						{
							GameActions.DropPickup(PickupCatalog.FindPickupIndex(item.Index), item.Name, amount);
						}
						else
						{
							GameActions.GiveItem(item, amount);
						}
					});
				}
			}
			Ui.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Clear inventory", Styles.ButtonDanger, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(170f) }))
			{
				Queue(GameActions.ClearInventory);
			}
			if (GUILayout.Button($"Give all shown  ×{amount}", Styles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(210f) }))
			{
				ItemEntry[] shown = items.ToArray();
				Queue(delegate
				{
					GameActions.GiveItems(shown, amount);
				});
			}
			GUILayout.FlexibleSpace();
			Ui.Hint("Left click: give      Right click: remove      Shift + right click: remove all");
			GUILayout.EndHorizontal();
		}

		private static Cell ItemCell(ItemEntry item, Inventory inventory)
		{
			//IL_000d: 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)
			int num = (Object.op_Implicit((Object)(object)inventory) ? inventory.GetItemCountPermanent(item.Index) : 0);
			return new Cell
			{
				Entry = item,
				Badge = ((num > 0) ? num.ToString() : null),
				Dim = (Object.op_Implicit((Object)(object)Run.instance) && Run.instance.IsItemExpansionLocked(item.Index))
			};
		}

		private string[] ItemChipLabels()
		{
			if (itemChipLabels == null || itemChipLabelsHidden != showHidden)
			{
				int[] array = (showHidden ? Catalogs.ItemCategoryCountsWithHidden : Catalogs.ItemCategoryCounts);
				itemChipLabels = new string[ItemFilterNames.Length];
				int num = 0;
				for (int i = 1; i < ItemFilterNames.Length; i++)
				{
					itemChipLabels[i] = Counted(ItemFilterNames[i], array[i - 1]);
					num += array[i - 1];
				}
				itemChipLabels[0] = Counted(ItemFilterNames[0], num);
				itemChipLabelsHidden = showHidden;
			}
			return itemChipLabels;
		}

		private static Color[] ItemChipDots()
		{
			Color[] array = (Color[])(object)new Color[ItemFilterNames.Length];
			Array.Copy(Catalogs.ItemCategoryColors, 0, array, 1, Catalogs.ItemCategoryColors.Length);
			return array;
		}

		private static string Counted(string name, int count)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return $"{name}  <color=#{Styles.ToHex(Styles.TextFaint)}>{count}</color>";
		}

		private void DrawEquipmentTab()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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: Invalid comparison between Unknown and I4
			Inventory val = LocalInventory();
			EquipmentIndex current = (EquipmentIndex)((!Object.op_Implicit((Object)(object)val)) ? (-1) : ((int)val.currentEquipmentIndex));
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			equipmentSearch = Ui.Search(equipmentSearch, 280f);
			Ui.Space(14f);
			equipmentMode = Ui.Segmented(equipmentMode, GiveModeNames, 150f);
			GUILayout.FlexibleSpace();
			Ui.Caption("Equipped");
			GUILayout.Label(EquipmentName(current), ((int)current == -1) ? Styles.Pill : Styles.PillAccent, Array.Empty<GUILayoutOption>());
			Ui.Space(6f);
			if (GUILayout.Button("Remove", Styles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(100f) }))
			{
				Queue(GameActions.RemoveEquipment);
			}
			GUILayout.EndHorizontal();
			equipmentFilter = Ui.ChipFlow(equipmentFilter, EquipmentChipLabels(), EquipmentChipDots(), 1084f);
			Ui.Space(4f);
			int filter = equipmentFilter;
			List<EquipmentEntry> list = equipmentView.Apply(Catalogs.Equipment, equipmentSearch, filter, (EquipmentEntry e) => filter == 0 || e.Category == (EquipmentCategory)(filter - 1));
			Func<int, Cell> cellAt = (int i) => new Cell
			{
				Entry = list[i],
				Selected = (list[i].Index == current),
				Dim = (Object.op_Implicit((Object)(object)Run.instance) && Run.instance.IsEquipmentExpansionLocked(list[i].Index))
			};
			if (DrawGrid(equipmentGrid, list.Count, cellAt, CellLayout.Icon, 70f, 70f, 1084f, out var click) && click.Button == 0)
			{
				EquipmentEntry equipment = list[click.Index];
				if (equipmentMode == 1)
				{
					Queue(delegate
					{
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						//IL_000b: Unknown result type (might be due to invalid IL or missing references)
						GameActions.DropPickup(PickupCatalog.FindPickupIndex(equipment.Index), equipment.Name, 1);
					});
				}
				else
				{
					Queue(delegate
					{
						GameActions.SetEquipment(equipment);
					});
				}
			}
			Ui.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			Ui.Hint("Left click: equip (replaces what you're holding)");
			GUILayout.EndHorizontal();
		}

		private string[] EquipmentChipLabels()
		{
			if (equipmentChipLabels == null)
			{
				int[] array = new int[EquipmentFilterNames.Length - 1];
				foreach (EquipmentEntry item in Catalogs.Equipment)
				{
					array[(int)item.Category]++;
				}
				equipmentChipLabels = new string[EquipmentFilterNames.Length];
				equipmentChipLabels[0] = Counted(EquipmentFilterNames[0], Catalogs.Equipment.Count);
				for (int i = 1; i < EquipmentFilterNames.Length; i++)
				{
					equipmentChipLabels[i] = Counted(EquipmentFilterNames[i], array[i - 1]);
				}
			}
			return equipmentChipLabels;
		}

		private static Color[] EquipmentChipDots()
		{
			Color[] array = (Color[])(object)new Color[EquipmentFilterNames.Length];
			Array.Copy(Catalogs.EquipmentCategoryColors, 0, array, 1, Catalogs.EquipmentCategoryColors.Length);
			return array;
		}

		private unsafe static string EquipmentName(EquipmentIndex index)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if ((int)index == -1)
			{
				return "Nothing";
			}
			foreach (EquipmentEntry item in Catalogs.Equipment)
			{
				if (item.Index == index)
				{
					return item.Name;
				}
			}
			return ((object)(*(EquipmentIndex*)(&index))/*cast due to .constrained prefix*/).ToString();
		}

		private void DrawPlayerTab()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			playerScroll = GUILayout.BeginScrollView(playerScroll, false, false, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				Ui.Width(410f),
				GUILayout.ExpandHeight(true)
			});
			Ui.BeginCard("Cheats");
			cheats.GodMode = Ui.Switch(cheats.GodMode, "God mode", "You can't take damage");
			cheats.NoCooldowns = Ui.Switch(cheats.NoCooldowns, "No cooldowns", "Skills and equipment recharge instantly");
			cheats.Fly = Ui.Switch(cheats.Fly, "Fly", "Jump to go up, Left Ctrl to go down");
			cheats.Noclip = Ui.Switch(cheats.Noclip, "Noclip", "Fly through walls and floors");
			cheats.FlySpeed = Ui.Slider("Fly speed", cheats.FlySpeed, 1f, 10f);
			Ui.EndCard();
			Ui.BeginCard("Stats");
			float num = Ui.Slider("Move speed", cheats.MoveSpeedMult, 1f, 10f);
			float num2 = Ui.Slider("Damage", cheats.DamageMult, 1f, 100f);
			float num3 = Ui.Slider("Attack speed", cheats.AttackSpeedMult, 1f, 10f);
			if (num != cheats.MoveSpeedMult || num2 != cheats.DamageMult || num3 != cheats.AttackSpeedMult)
			{
				cheats.MoveSpeedMult = num;
				cheats.DamageMult = num2;
				cheats.AttackSpeedMult = num3;
				cheats.MarkStatsDirty();
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Reset stats", Styles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(130f) }))
			{
				cheats.ResetStats();
			}
			GUILayout.EndHorizontal();
			Ui.EndCard();
			GUILayout.EndScrollView();
			Ui.Space(6f);
			GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			Ui.BeginCard("Resources");
			AmountRow("Money", MoneyAmounts, "$", delegate(uint amount)
			{
				GameActions.GiveMoney(amount);
			});
			AmountRow("Lunar coins", CoinAmounts, "", delegate(uint amount)
			{
				GameActions.GiveLunarCoins(amount);
			});
			uint num4 = (Object.op_Implicit((Object)(object)TeamManager.instance) ? TeamManager.instance.GetTeamLevel((TeamIndex)1) : 0u);
			AmountRow($"Level  <color=#{Styles.ToHex(Styles.Accent)}>{num4}</color>", LevelAmounts, "", delegate(uint amount)
			{
				GameActions.AddLevels(amount);
			});
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Health", Styles.Caption, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(120f) });
			if (GUILayout.Button("Full heal", Styles.Button, Array.Empty<GUILayoutOption>()))
			{
				Queue(GameActions.Heal);
			}
			if (GUILayout.Button("Revive", Styles.Button, Array.Empty<GUILayoutOption>()))
			{
				Queue(GameActions.Revive);
			}
			GUILayout.EndHorizontal();
			Ui.EndCard();
			Ui.BeginCard("Change survivor", GUILayout.ExpandHeight(true));
			CharacterMaster localMaster = Helpers.LocalMaster;
			GameObject currentBody = (Object.op_Implicit((Object)(object)localMaster) ? localMaster.bodyPrefab : null);
			List<SurvivorEntry> survivors = Catalogs.Survivors;
			Func<int, Cell> cellAt = (int i) => new Cell
			{
				Entry = survivors[i],
				Selected = (Object.op_Implicit((Object)(object)currentBody) && (Object)(object)survivors[i].Def.bodyPrefab == (Object)(object)currentBody)
			};
			if (DrawGrid(survivorGrid, survivors.Count, cellAt, CellLayout.IconLabel, 100f, 118f, 624f, out var click) && click.Button == 0)
			{
				SurvivorEntry survivor = survivors[click.Index];
				Queue(delegate
				{
					GameActions.ChangeSurvivor(survivor);
				});
			}
			Ui.EndCard();
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void AmountRow(string label, uint[] amounts, string prefix, Action<uint> action)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(label, Styles.Caption, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(120f) });
			foreach (uint amount in amounts)
			{
				if (GUILayout.Button("+" + prefix + ShortNumber(amount), Styles.Button, Array.Empty<GUILayoutOption>()))
				{
					Queue(delegate
					{
						action(amount);
					});
				}
			}
			GUILayout.EndHorizontal();
		}

		private static string ShortNumber(uint value)
		{
			if (value < 1000)
			{
				return value.ToString();
			}
			return value / 1000 + "k";
		}

		private void DrawSpawnTab()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			int mode = Ui.Segmented(spawnMode, SpawnModeNames, 300f);
			if (mode != spawnMode)
			{
				Defer(delegate
				{
					spawnMode = mode;
				});
			}
			Ui.Space(14f);
			Ui.Caption("Count");
			spawnCount = Ui.Segmented(spawnCount, SpawnCountNames, 240f);
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Kill all enemies", Styles.ButtonDanger, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(170f) }))
			{
				Queue(GameActions.KillAllEnemies);
			}
			GUILayout.EndHorizontal();
			if (spawnMode == 0)
			{
				DrawMonsters();
			}
			else
			{
				DrawInteractables();
			}
		}

		private void DrawMonsters()
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			int count = SpawnCounts[spawnCount];
			if (eliteNames == null || eliteNames.Length != Catalogs.Elites.Count + 1)
			{
				eliteNames = new string[Catalogs.Elites.Count + 1];
				eliteDots = (Color[])(object)new Color[eliteNames.Length];
				eliteNames[0] = "No elite";
				for (int i = 0; i < Catalogs.Elites.Count; i++)
				{
					eliteNames[i + 1] = Catalogs.Elites[i].Name;
					eliteDots[i + 1] = Catalogs.Elites[i].Color;
				}
				spawnElite = 0;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			monsterSearch = Ui.Search(monsterSearch, 280f);
			Ui.Space(14f);
			Ui.Caption("Team");
			spawnTeam = Ui.Segmented(spawnTeam, TeamNames, 180f);
			GUILayout.FlexibleSpace();
			Ui.Hint("Allies follow you and fight for you");
			GUILayout.EndHorizontal();
			spawnElite = Ui.ChipFlow(spawnElite, eliteNames, eliteDots, 1084f);
			Ui.Space(4f);
			List<MonsterEntry> list = monsterView.Apply(Catalogs.Monsters, monsterSearch, 0, (MonsterEntry _) => true);
			if (DrawGrid(monsterGrid, list.Count, (int index) => new Cell
			{
				Entry = list[index]
			}, CellLayout.IconLabel, 100f, 118f, 1084f, out var click) && click.Button == 0)
			{
				MonsterEntry monster = list[click.Index];
				bool ally = spawnTeam == 1;
				EliteDef elite = ((spawnElite > 0) ? Catalogs.Elites[spawnElite - 1].Def : null);
				Queue(delegate
				{
					GameActions.SpawnMonster(monster, count, ally, elite);
				});
			}
		}

		private void DrawInteractables()
		{
			Catalogs.EnsureInteractables();
			int count = SpawnCounts[spawnCount];
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			interactableSearch = Ui.Search(interactableSearch, 280f);
			GUILayout.FlexibleSpace();
			Ui.Hint("Spawns where your crosshair is pointing");
			GUILayout.EndHorizontal();
			interactableFilter = Ui.ChipFlow(interactableFilter, InteractableChipLabels(), InteractableChipDots(), 1084f);
			Ui.Space(4f);
			int filter = interactableFilter;
			List<InteractableEntry> list = interactableView.Apply(Catalogs.Interactables, interactableSearch, filter, (InteractableEntry e) => filter == 0 || e.Category == (InteractableCategory)(filter - 1));
			if (DrawGrid(interactableGrid, list.Count, (int i) => new Cell
			{
				Entry = list[i]
			}, CellLayout.Text, 214f, 46f, 1084f, out var click) && click.Button == 0)
			{
				InteractableEntry entry = list[click.Index];
				Queue(delegate
				{
					GameActions.SpawnInteractable(entry, count);
				});
			}
		}

		private string[] InteractableChipLabels()
		{
			if (interactableChipLabels == null)
			{
				int[] array = new int[InteractableFilterNames.Length - 1];
				foreach (InteractableEntry interactable in Catalogs.Interactables)
				{
					array[(int)interactable.Category]++;
				}
				interactableChipLabels = new string[InteractableFilterNames.Length];
				interactableChipLabels[0] = Counted(InteractableFilterNames[0], Catalogs.Interactables.Count);
				for (int i = 1; i < InteractableFilterNames.Length; i++)
				{
					interactableChipLabels[i] = Counted(InteractableFilterNames[i], array[i - 1]);
				}
			}
			return interactableChipLabels;
		}

		private static Color[] InteractableChipDots()
		{
			Color[] array = (Color[])(object)new Color[InteractableFilterNames.Length];
			Array.Copy(Catalogs.InteractableCategoryColors, 0, array, 1, Catalogs.InteractableCategoryColors.Length);
			return array;
		}

		private void DrawWorldTab()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			worldScroll = GUILayout.BeginScrollView(worldScroll, false, false, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				Ui.Width(410f),
				GUILayout.ExpandHeight(true)
			});
			Ui.BeginCard("Enemies");
			bool spawnsOff = CombatDirector.cvDirectorCombatDisable.value;
			if (Ui.Switch(spawnsOff, "Stop enemy spawns", "No new monsters appear") != spawnsOff)
			{
				Queue(delegate
				{
					GameActions.SetEnemySpawning(spawnsOff);
				});
			}
			if (GUILayout.Button("Kill all enemies", Styles.ButtonDanger, Array.Empty<GUILayoutOption>()))
			{
				Queue(GameActions.KillAllEnemies);
			}
			Ui.EndCard();
			Ui.BeginCard("Teleporter");
			TeleporterStatus();
			if (GUILayout.Button("Activate + fully charge", Styles.ButtonPrimary, Array.Empty<GUILayoutOption>()))
			{
				Queue(GameActions.ChargeTeleporter);
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button("Blue portal", Styles.Button, Array.Empty<GUILayoutOption>()))
			{
				Queue(delegate
				{
					GameActions.RequestPortal("shop");
				});
			}
			if (GUILayout.Button("Gold portal", Styles.Button, Array.Empty<GUILayoutOption>()))
			{
				Queue(delegate
				{
					GameActions.RequestPortal("gold");
				});
			}
			if (GUILayout.Button("Celestial", Styles.Button, Array.Empty<GUILayoutOption>()))
			{
				Queue(delegate
				{
					GameActions.RequestPortal("celestial");
				});
			}
			GUILayout.EndHorizontal();
			Ui.EndCard();
			Ui.BeginCard("Time");
			float num = Ui.Slider("Game speed", TimeControl.GameSpeed, 0.1f, 4f);
			if (num != TimeControl.GameSpeed)
			{
				TimeControl.SetGameSpeed(num);
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Normal speed", Styles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(140f) }))
			{
				TimeControl.SetGameSpeed(1f);
			}
			GUILayout.EndHorizontal();
			bool pause = NotCreativePlugin.PauseInSinglePlayer.Value;
			if (Ui.Switch(pause, "Pause while the menu is open", "Single-player only") != pause)
			{
				Queue(delegate
				{
					TimeControl.SetPauseEnabled(!pause);
				});
			}
			Ui.EndCard();
			GUILayout.EndScrollView();
			Ui.Space(6f);
			Ui.BeginCard("Travel to stage", GUILayout.ExpandHeight(true));
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			Ui.Hint("Click a stage to go there right away");
			GUILayout.FlexibleSpace();
			if (GUILayout.Button("Next stage", Styles.ButtonPrimary, (GUILayoutOption[])(object)new GUILayoutOption[1] { Ui.Width(130f) }))
			{
				Queue(delegate
				{
					if (GameActions.NextStage())
					{
						Close();
					}
				});
			}
			GUILayout.EndHorizontal();
			SceneDef currentScene = SceneCatalog.GetSceneDefForCurrentScene();
			List<StageEntry> stages = Catalogs.Stages;
			Func<int, Cell> cellAt = (int i) => new Cell
			{
				Entry = stages[i],
				Selected = (Object.op_Implicit((Object)(object)currentScene) && (Object)(object)stages[i].Def == (Object)(object)currentScene),
				Dim = (Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)stages[i].Def.requiredExpansion) && !Run.instance.IsExpansionEnabled(stages[i].Def.requiredExpansion))
			};
			if (DrawGrid(stageGrid, stages.Count, cellAt, CellLayout.Text, 206f, 46f, 624f, out var click) && click.Button == 0)
			{
				StageEntry stage = stages[click.Index];
				Queue(delegate
				{
					if (GameActions.GoToStage(stage))
					{
						Close();
					}
				});
			}
			Ui.EndCard();
			GUILayout.EndHorizontal();
		}

		private static void TeleporterStatus()
		{
			//IL_0014: 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_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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Invalid comparison between Unknown and I4
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			TeleporterInteraction instance = TeleporterInteraction.instance;
			string text;
			Color color;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				text = "No teleporter on this stage";
				color = Styles.TextFaint;
			}
			else if (instance.isCharged)
			{
				text = "Charged";
				color = Styles.Success;
			}
			else if (instance.isCharging && Object.op_Implicit((Object)(object)instance.holdoutZoneController))
			{
				text = $"Charging  {Mathf.RoundToInt(instance.holdoutZoneController.charge * 100f)}%";
				color = Styles.Accent;
			}
			else
			{
				text = (instance.isIdle ? "Not activated yet" : "Starting…");
				color = Styles.TextDim;
			}
			Rect rect = GUILayoutUtility.GetRect(Ui.S(100f), Ui.S(30f), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if ((int)Event.current.type == 7)
			{
				float num = Ui.S(9f);
				Ui.Disc(new Rect(((Rect)(ref rect)).x + Ui.S(4f), ((Rect)(ref rect)).center.y - num / 2f, num, num), color);
				Color color2 = GUI.color;
				GUI.color = color;
				GUI.Label(new Rect(((Rect)(ref rect)).x + Ui.S(20f), ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - Ui.S(20f), ((Rect)(ref rect)).height), text, Styles.SwitchLabel);
				GUI.color = color2;
			}
		}
	}
	internal static class GameActions
	{
		private const int MaxDroplets = 100;

		private static readonly Xoroshiro128Plus Rng = new Xoroshiro128Plus((ulong)DateTime.Now.Ticks);

		private static bool chargeTeleporterWhenReady;

		public static void Update()
		{
			if (chargeTeleporterWhenReady)
			{
				TeleporterInteraction instance = TeleporterInteraction.instance;
				if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)Run.instance))
				{
					chargeTeleporterWhenReady = false;
				}
				else if (instance.isCharging)
				{
					instance.holdoutZoneController.FullyChargeHoldoutZone();
					chargeTeleporterWhenReady = false;
				}
			}
		}

		public static void GiveItem(ItemEntry item, int count)
		{
			//IL_0010: 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)
			if (Helpers.CheckMaster(out var master))
			{
				if (Run.instance.IsItemExpansionLocked(item.Index))
				{
					Notifier.Error(item.Name + " needs a DLC that is turned off in this run.");
					return;
				}
				master.inventory.GiveItemPermanent(item.Index, count);
				Notifier.Info($"+{count} {item.Name}");
			}
		}

		public static void GiveItems(IList<ItemEntry> items, int count)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (!Helpers.CheckMaster(out var master))
			{
				return;
			}
			int num = 0;
			foreach (ItemEntry item in items)
			{
				if (!Run.instance.IsItemExpansionLocked(item.Index))
				{
					master.inventory.GiveItemPermanent(item.Index, count);
					num++;
				}
			}
			Notifier.Info($"Gave {count}x of {num} items.");
		}

		public static void RemoveItem(ItemEntry item, int count)
		{
			//IL_0011: 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)
			if (Helpers.CheckMaster(out var master))
			{
				int itemCountPermanent = master.inventory.GetItemCountPermanent(item.Index);
				if (itemCountPermanent <= 0)
				{
					Notifier.Error("You don't have " + item.Name + ".");
					return;
				}
				int num = Math.Min(count, itemCountPermanent);
				master.inventory.RemoveItemPermanent(item.Index, num);
				Notifier.Info($"-{num} {item.Name}");
			}
		}

		public static void ClearInventory()
		{
			if (Helpers.CheckMaster(out var master))
			{
				master.inventory.CleanInventory();
				Notifier.Info("Inventory cleared.");
			}
		}

		public static void SetEquipment(EquipmentEntry equipment)
		{
			//IL_0010: 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)
			if (Helpers.CheckMaster(out var master))
			{
				if (Run.instance.IsEquipmentExpansionLocked(equipment.Index))
				{
					Notifier.Error(equipment.Name + " needs a DLC that is turned off in this run.");
					return;
				}
				Equip(master.inventory, equipment.Index);
				Notifier.Info("Equipment: " + equipment.Name);
			}
		}

		public static void RemoveEquipment()
		{
			if (Helpers.CheckMaster(out var master))
			{
				Equip(master.inventory, (EquipmentIndex)(-1));
				Notifier.Info("Equipment removed.");
			}
		}

		private static void Equip(Inventory inventory, EquipmentIndex index)
		{
			//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)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			EquipmentLocation activeEquipmentLocation = inventory.activeEquipmentLocation;
			inventory.SetEquipmentIndex(index, ref activeEquipmentLocation);
		}

		public static void DropPickup(PickupIndex pickup, string name, int count)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_00de: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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)
			if (!Helpers.CheckBody(out var body))
			{
				return;
			}
			if (pickup == PickupIndex.none)
			{
				Notifier.Error(name + " can't be dropped.");
				return;
			}
			count = Math.Min(count, 100);
			Vector3 val = (Object.op_Implicit((Object)(object)body.inputBank) ? body.inputBank.aimDirection : ((Component)body).transform.forward);
			val.y = 0f;
			val = ((((Vector3)(ref val)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val)).normalized : Vector3.forward);
			Vector3 val2 = body.corePosition + Vector3.up * 1.5f;
			for (int i = 0; i < count; i++)
			{
				Vector3 val3 = Quaternion.AngleAxis(360f * (float)i / (float)count, Vector3.up) * val;
				float num = ((count > 1) ? (4f + (float)count * 0.15f) : 5f);
				PickupDropletController.CreatePickupDroplet(new UniquePickup(pickup), val2, Vector3.up * 20f + val3 * num, false);
			}
			Notifier.Info($"Dropped {count}x {name}");
		}

		public static void GiveMoney(uint amount)
		{
			if (Helpers.CheckMaster(out var master))
			{
				master.GiveMoney(amount, true);
				Notifier.Info($"+${amount}");
			}
		}

		public static void GiveLunarCoins(uint amount)
		{
			if (Helpers.CheckServer())
			{
				LocalUser localUser = Helpers.LocalUser;
				NetworkUser val = ((localUser != null) ? localUser.currentNetworkUser : null);
				if (!Object.op_Implicit((Object)(object)val))
				{
					Notifier.Error("No network user found.");
					return;
				}
				val.AwardLunarCoins(amount);
				Notifier.Info($"+{amount} lunar coins");
			}
		}

		public static void AddLevels(uint levels)
		{
			if (Helpers.CheckServer() && Object.op_Implicit((Object)(object)TeamManager.instance))
			{
				TeamManager instance = TeamManager.instance;
				ulong experienceForLevel = TeamManager.GetExperienceForLevel(instance.GetTeamLevel((TeamIndex)1) + levels);
				ulong teamExperience = instance.GetTeamExperience((TeamIndex)1);
				if (experienceForLevel > teamExperience)
				{
					instance.GiveTeamExperience((TeamIndex)1, experienceForLevel - teamExperience);
				}
				Notifier.Info($"Level {instance.GetTeamLevel((TeamIndex)1)}");
			}
		}

		public static void Heal()
		{
			//IL_0023: 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 (Helpers.CheckBody(out var body) && Object.op_Implicit((Object)(object)body.healthComponent))
			{
				body.healthComponent.HealFraction(1f, default(ProcChainMask));
				body.healthComponent.RechargeShieldFull();
				Notifier.Info("Fully healed.");
			}
		}

		public static void Revive()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (!Helpers.CheckMaster(out var master))
			{
				return;
			}
			CharacterBody body = master.GetBody();
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive)
			{
				Notifier.Info("You're already alive.");
				return;
			}
			if (master.deathFootPosition != Vector3.zero)
			{
				master.Respawn(master.deathFootPosition, Quaternion.identity, false);
			}
			else if (Object.op_Implicit((Object)(object)Stage.instance))
			{
				Stage.instance.RespawnCharacter(master);
			}
			Notifier.Info("Revived.");
		}

		public static void ChangeSurvivor(SurvivorEntry survivor)
		{
			//IL_002c: 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)
			if (Helpers.CheckMaster(out var master))
			{
				CharacterBody body = master.GetBody();
				master.bodyPrefab = survivor.Def.bodyPrefab;
				if (Object.op_Implicit((Object)(object)body))
				{
					master.Respawn(body.footPosition, ((Component)body).transform.rotation, false);
				}
				else if (Object.op_Implicit((Object)(object)Stage.instance))
				{
					Stage.instance.RespawnCharacter(master);
				}
				Notifier.Info("You are now " + survivor.Name + ".");
			}
		}

		public static void SpawnMonster(MonsterEntry monster, int count, bool ally, EliteDef elite)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			if (!Helpers.CheckBody(out var body))
			{
				return;
			}
			Vector3 spawnPoint = Helpers.GetSpawnPoint(body);
			int num = 0;
			for (int i = 0; i < count; i++)
			{
				Vector3 val = spawnPoint;
				if (count > 1)
				{
					Vector2 val2 = Random.insideUnitCircle * (2f + (float)count * 0.4f);
					val += new Vector3(val2.x, 0f, val2.y);
				}
				CharacterMaster val3 = new MasterSummon
				{
					masterPrefab = ((Component)monster.MasterPrefab).gameObject,
					position = val,
					rotation = Helpers.FacePlayer(val, body),
					teamIndexOverride = (TeamIndex)(ally ? 1 : 2),
					summonerBodyObject = (ally ? ((Component)body).gameObject : null),
					ignoreTeamMemberLimit = true,
					useAmbientLevel = true
				}.Perform();
				if (Object.op_Implicit((Object)(object)val3))
				{
					num++;
					if (Object.op_Implicit((Object)(object)elite) && Object.op_Implicit((Object)(object)val3.inventory))
					{
						Equip(val3.inventory, elite.eliteEquipmentDef.equipmentIndex);
						val3.inventory.GiveItemPermanent(Items.BoostHp, Mathf.RoundToInt((elite.healthBoostCoefficient - 1f) * 10f));
						val3.inventory.GiveItemPermanent(Items.BoostDamage, Mathf.RoundToInt((elite.damageBoostCoefficient - 1f) * 10f));
					}
				}
			}
			if (num == 0)
			{
				Notifier.Error("Could not spawn " + monster.Name + ".");
			}
			else
			{
				Notifier.Info($"Spawned {num}x {monster.Name}" + (ally ? " (ally)" : ""));
			}
		}

		public static void SpawnInteractable(InteractableEntry entry, int count)
		{
			//IL_0042: 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_0052: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f8: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_009c: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00c7: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (!Helpers.CheckBody(out var body))
			{
				return;
			}
			InteractableSpawnCard val = Catalogs.LoadCard(entry);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((SpawnCard)val).prefab))
			{
				Notifier.Error("Could not load " + entry.Name + ".");
				return;
			}
			Vector3 spawnPoint = Helpers.GetSpawnPoint(body);
			int num = 0;
			RaycastHit val4 = default(RaycastHit);
			for (int i = 0; i < count; i++)
			{
				Vector3 val2 = spawnPoint;
				if (count > 1)
				{
					float num2 = 360f * (float)i / (float)count;
					val2 += Quaternion.AngleAxis(num2, Vector3.up) * Vector3.forward * (2.5f + (float)count * 0.5f);
					Vector3 val3 = val2 + Vector3.up * 5f;
					Vector3 down = Vector3.down;
					LayerIndex world = LayerIndex.world;
					if (Physics.Raycast(val3, down, ref val4, 50f, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask), (QueryTriggerInteraction)1))
					{
						val2 = ((RaycastHit)(ref val4)).point;
					}
				}
				DirectorPlacementRule val5 = new DirectorPlacementRule
				{
					placementMode = (PlacementMode)0,
					position = val2
				};
				DirectorSpawnRequest val6 = new DirectorSpawnRequest((SpawnCard)(object)val, val5, Rng);
				if (((SpawnCard)val).DoSpawn(val2, Helpers.FacePlayer(val2, body), val6).success)
				{
					num++;
				}
			}
			if (num == 0)
			{
				Notifier.Error("Could not spawn " + entry.Name + ".");
			}
			else
			{
				Notifier.Info($"Spawned {num}x {entry.Name}");
			}
		}

		public static void KillAllEnemies()
		{
			//IL_0086: 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 (!Helpers.CheckServer())
			{
				return;
			}
			int num = 0;
			TeamIndex[] array = new TeamIndex[3];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			TeamIndex[] array2 = (TeamIndex[])(object)array;
			for (int i = 0; i < array2.Length; i++)
			{
				foreach (TeamComponent item in new List<TeamComponent>(TeamComponent.GetTeamMembers(array2[i])))
				{
					CharacterBody val = (Object.op_Implicit((Object)(object)item) ? item.body : null);
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive)
					{
						val.healthComponent.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo));
						num++;
					}
				}
			}
			Notifier.Info($"Killed {num} enemies.");
		}

		public static void ChargeTeleporter()
		{
			if (!Helpers.CheckBody(out var body))
			{
				return;
			}
			TeleporterInteraction instance = TeleporterInteraction.instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				Notifier.Error("There's no teleporter on this stage.");
				return;
			}
			if (instance.isCharged)
			{