Decompiled source of Enemy And Valuable Spawn Manager v0.5.5

SpawnManager.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MenuLib;
using MenuLib.MonoBehaviors;
using Microsoft.CodeAnalysis;
using SpawnManager.Extensions;
using SpawnManager.Managers;
using UnityEngine;

[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("SpawnManager")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.5.0")]
[assembly: AssemblyInformationalVersion("0.5.5+c4e17b8d354cfcf51a866982b9929b332d68df05")]
[assembly: AssemblyProduct("SpawnManager")]
[assembly: AssemblyTitle("SpawnManager")]
[assembly: AssemblyVersion("0.5.5.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace SpawnManager
{
	public static class Constants
	{
		public const string MenuLibGuid = "nickklmao.menulib";
	}
	[BepInPlugin("soundedsquash.spawnmanager", "Enemy/Valuable Spawn Manager", "0.5.5.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MuteToggleBase : BaseUnityPlugin
	{
		private const string PluginGuid = "soundedsquash.spawnmanager";

		private const string PluginName = "Enemy/Valuable Spawn Manager";

		private const string PluginVersion = "0.5.5.0";

		private readonly Harmony _harmony = new Harmony("soundedsquash.spawnmanager");

		private static readonly ManualLogSource ManualLogSource = Logger.CreateLogSource("soundedsquash.spawnmanager");

		public void Awake()
		{
			Settings.Initialize(((BaseUnityPlugin)this).Config, ManualLogSource);
			if (PluginManager.IsPluginInstalled("nickklmao.menulib"))
			{
				MenuModManager.Initialize();
			}
			else
			{
				Settings.Logger.LogWarning((object)"MenuLib not loaded. Cannot add button to main menu.");
			}
			_harmony.PatchAll();
			ManualLogSource.LogInfo((object)"Enemy/Valuable Spawn Manager loaded");
		}
	}
	public static class Settings
	{
		private const string HideFromRepoConfig = "HideREPOConfig";

		public static ConfigEntry<bool> ShowSpawnManagerButton { get; private set; } = null;


		public static ConfigEntry<string> DisabledEnemies { get; private set; } = null;


		public static ConfigEntry<string> DisabledValuables { get; private set; } = null;


		public static IDictionary<string, ConfigEntry<string>> DisabledLevelValuables { get; private set; } = new Dictionary<string, ConfigEntry<string>>();


		public static ConfigEntry<string> DisabledLevels { get; private set; } = null;


		public static IDictionary<string, ConfigEntry<string>> DisabledLevelEnemies { get; private set; } = new Dictionary<string, ConfigEntry<string>>();


		public static ConfigEntry<string> DisabledItems { get; private set; } = null;


		public static IDictionary<string, ConfigEntry<string>> DisabledLevelItems { get; private set; } = new Dictionary<string, ConfigEntry<string>>();


		public static ConfigEntry<string> DefaultValuable { get; private set; } = null;


		public static ManualLogSource Logger { get; private set; } = null;


		private static ConfigFile Config { get; set; } = null;


		private static bool LevelsInitialized { get; set; } = false;


		private static bool ValuablesInitialized { get; set; } = false;


		internal static void Initialize(ConfigFile config, ManualLogSource logger)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			Config = config;
			Logger = logger;
			(ShowSpawnManagerButton = Config.Bind<bool>("General", "ShowSpawnManagerButton", true, "Set to false to hide the Spawn Manager button on the main menu.")).SettingChanged += MenuModManager.OnShowSpawnManagerButtonChanged;
			Config.Bind<float>("Do Not Use", "Use Spawn Manager button on main menu", 0f, "Use Spawn Manager button on main menu");
			DisabledEnemies = Config.Bind<string>("Enemies", "DisabledList", "", new ConfigDescription("Comma-separated list of enemy names to disable. (e.g. \"Apex Predator,Headman\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
			DefaultValuable = Config.Bind<string>("Valuables", "Default", "Valuable Goblet", new ConfigDescription("A single tiny valuable used to fill when there aren't enough valuables enabled in the level. (e.g. \"Valuable Diamond\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
			DisabledValuables = Config.Bind<string>("Valuables", "DisabledList", "", new ConfigDescription("Comma-separated list of valuable names to disable. (e.g. \"Valuable Television,Valuable Diamond Display\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
			DisabledLevels = Config.Bind<string>("Levels", "DisabledList", "", new ConfigDescription("Comma-separated list of level names to disable. (e.g. \"Level - Manor\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
			DisabledItems = Config.Bind<string>("Items", "DisabledList", "", new ConfigDescription("Comma-separated list of item names to disable. (e.g. \"Cart Medium\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
		}

		internal static void InitializeEnemiesLevels()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			if (LevelsInitialized)
			{
				return;
			}
			foreach (Level allLevel in LevelManager.GetAllLevels())
			{
				ConfigEntry<string> value = Config.Bind<string>("Levels", allLevel.FriendlyName() + " - Disabled Enemies", "", new ConfigDescription("Comma-separated list of enemy names to disable in this level. (e.g. \"Apex Predator,Headman\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
				DisabledLevelEnemies.Add(((Object)allLevel).name, value);
			}
			LevelsInitialized = true;
		}

		internal static void InitializeItemsLevels()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			foreach (Level item in (from level in LevelManager.GetAllLevelsForItems()
				where !DisabledLevelItems.ContainsKey(((Object)level).name)
				select level).ToList())
			{
				ConfigEntry<string> value = Config.Bind<string>("Items", item.FriendlyName() + " - Disabled Items", "", new ConfigDescription("Comma-separated list of item names to disable in this level. (e.g. \"Cart Medium\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
				DisabledLevelItems.Add(((Object)item).name, value);
			}
		}

		internal static void InitializeValuablesLevels()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			if (ValuablesInitialized || !LevelManager.RunManagerLevelVariableIsAvailable)
			{
				return;
			}
			foreach (Level allLevel in LevelManager.GetAllLevels())
			{
				ConfigEntry<string> value = Config.Bind<string>("Valuables", allLevel.FriendlyName() + " - Disabled Valuables", "", new ConfigDescription("Comma-separated list of valuable names to disable. (e.g. \"Valuable Television,Valuable Diamond Display\")", (AcceptableValueBase)null, new object[1] { "HideREPOConfig" }));
				DisabledLevelValuables.Add(((Object)allLevel).name, value);
			}
			ValuablesInitialized = true;
		}

		public static ISet<string> GetDisabledEnemiesForLevel(string level)
		{
			if (DisabledLevelEnemies.TryGetValue(level, out ConfigEntry<string> value))
			{
				return new HashSet<string>(ConvertStringToList(value.Value));
			}
			return new HashSet<string>();
		}

		public static ISet<string> GetDisabledItemsForLevel(string level)
		{
			if (DisabledLevelItems.TryGetValue(level, out ConfigEntry<string> value))
			{
				return new HashSet<string>(ConvertStringToList(value.Value));
			}
			return new HashSet<string>();
		}

		public static ISet<string> GetDisabledValuablesForLevel(string level)
		{
			if (DisabledLevelValuables.TryGetValue(level, out ConfigEntry<string> value))
			{
				return new HashSet<string>(ConvertStringToList(value.Value));
			}
			return new HashSet<string>();
		}

		public static List<string> GetDisabledSettingsEntryListNames(ConfigEntry<string> settingsVariable)
		{
			return ConvertStringToList(settingsVariable.Value);
		}

		private static List<string> ConvertStringToList(string str)
		{
			if (string.IsNullOrEmpty(str))
			{
				return new List<string>();
			}
			return new List<string>(str.Split(',', StringSplitOptions.RemoveEmptyEntries));
		}

		public static void UpdateSettingsListEntry(ConfigEntry<string> settingsVariable, string entry, bool enabled)
		{
			List<string> disabledSettingsEntryListNames = GetDisabledSettingsEntryListNames(settingsVariable);
			if (enabled)
			{
				disabledSettingsEntryListNames.Remove(entry);
			}
			else if (!disabledSettingsEntryListNames.Contains(entry))
			{
				disabledSettingsEntryListNames.Add(entry);
			}
			settingsVariable.Value = string.Join(",", disabledSettingsEntryListNames);
		}

		public static bool IsSettingsListEntryEnabled(ConfigEntry<string> settingsVariable, string entry)
		{
			return !GetDisabledSettingsEntryListNames(settingsVariable).Contains(entry);
		}
	}
}
namespace SpawnManager.Patches
{
	[HarmonyPatch(typeof(EnemyDirector))]
	public static class EnemyDirectorPatches
	{
		private static List<EnemySetup> _startingEnemyList = new List<EnemySetup>();

		private static bool _isListSet;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void EnemyDirectorStartPostfix()
		{
			EnemyManager.RefreshAllEnemyNames();
			if (SemiFunc.RunIsLevel())
			{
				Settings.Logger.LogDebug((object)"Not on menu level, removing enemies.");
				EnemyManager.RemoveEnemies();
			}
		}

		[HarmonyPatch("PickEnemies")]
		[HarmonyPostfix]
		private static void EnemyDirectorPickEnemiesPostfix(ref List<EnemySetup> ___enemyList)
		{
			if (___enemyList.Count != 0)
			{
				___enemyList.RemoveAll((EnemySetup e) => (Object)(object)e == (Object)null);
				Settings.Logger.LogDebug((object)("Level starting with enemies: " + string.Join(", ", ___enemyList)));
			}
		}

		[HarmonyPatch("GetEnemy")]
		[HarmonyPrefix]
		private static void EnemyDirectorGetEnemyPrefix(EnemyDirector __instance, ref List<EnemySetup> ___enemyList, int ___enemyListIndex)
		{
			if (!_isListSet)
			{
				_startingEnemyList = new List<EnemySetup>(___enemyList);
				_isListSet = true;
			}
			if (___enemyList.Count == 0)
			{
				EnemySetup val = ScriptableObject.CreateInstance<EnemySetup>();
				val.spawnObjects = new List<GameObject>();
				___enemyList.Add(val);
			}
			while (___enemyList.Count < ___enemyListIndex + 1)
			{
				int index = Random.Range(0, _startingEnemyList.Count);
				___enemyList.Add(___enemyList[index]);
			}
		}
	}
	[HarmonyPatch(typeof(LevelGenerator))]
	public static class LevelGeneratorPatches
	{
		[HarmonyPatch("ItemSetup")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		private static void LevelGeneratorItemSetupPrefix()
		{
			Settings.Logger.LogDebug((object)"Removing items.");
			Settings.InitializeItemsLevels();
			ItemsManager.RemoveItems();
		}
	}
	[HarmonyPatch(typeof(RunManager))]
	public static class RunManagerPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		private static void RunManagerAwakePrefix()
		{
			if (!SemiFunc.MenuLevel())
			{
				Settings.Logger.LogDebug((object)"Removing valuables.");
				ValuableManager.RemoveValuables();
			}
		}

		[HarmonyPatch("SetRunLevel")]
		[HarmonyPrefix]
		private static void RunManagerChangeLevelPrefix(RunManager __instance, ref Level ___previousRunLevel)
		{
			Settings.Logger.LogDebug((object)"Removing levels.");
			LevelManager.RemoveLevels();
			if (__instance.levels.Count == 1)
			{
				___previousRunLevel = null;
			}
		}
	}
	[HarmonyPatch(typeof(ValuableDirector))]
	public static class ValuableDirectorPatches
	{
		[HarmonyPatch("Spawn")]
		[HarmonyPrefix]
		private static void ValuableDirectorSpawnPrefix(GameObject _valuable, ValuableVolume _volume, ref string _path)
		{
			if (ValuableManager.AllItems.TryGetValue(((Object)_valuable).name, out ValuableMetaData value))
			{
				_path = ValuableManager.GetValuablePresetTypePath(value.PresetType);
			}
		}
	}
}
namespace SpawnManager.Managers
{
	public static class EnemyManager
	{
		public static Dictionary<string, IEnumerable<GameObject>> EnemySpawnList = new Dictionary<string, IEnumerable<GameObject>>();

		public static void RefreshAllEnemyNames()
		{
			EnemyDirector instance = EnemyDirector.instance;
			EnemySpawnList = (from so in instance.enemiesDifficulty1.Concat(instance.enemiesDifficulty2).Concat(instance.enemiesDifficulty3).SelectMany((EnemySetup ed) => ed.spawnObjects)
				group so by ((Object)so).GetInstanceID() into so
				select so.First() into so
				where (Object)(object)so.GetComponent<EnemyParent>() != (Object)null
				group so by so.GetComponent<EnemyParent>().enemyName).ToDictionary((IGrouping<string, GameObject> g) => g.Key, (IGrouping<string, GameObject> g) => g.AsEnumerable());
		}

		public static void RemoveEnemies()
		{
			if (SemiFunc.IsNotMasterClient())
			{
				return;
			}
			Settings.InitializeEnemiesLevels();
			List<string> disabledEnemyNames = Settings.GetDisabledSettingsEntryListNames(Settings.DisabledEnemies);
			Level levelCurrent = RunManager.instance.levelCurrent;
			string text = ((levelCurrent != null) ? ((Object)levelCurrent).name : null);
			if (text != null)
			{
				ISet<string> disabledEnemiesForLevel = Settings.GetDisabledEnemiesForLevel(text);
				disabledEnemyNames.AddRange(disabledEnemiesForLevel);
			}
			if (disabledEnemyNames.Count == 0)
			{
				return;
			}
			if (EnemySpawnList.Count == 0)
			{
				RefreshAllEnemyNames();
			}
			EnemyDirector instance = EnemyDirector.instance;
			List<GameObject> spawnObjectsToRemove = EnemySpawnList.Where<KeyValuePair<string, IEnumerable<GameObject>>>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => disabledEnemyNames.Contains(kvp.Key)).SelectMany((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Value).ToList();
			Settings.Logger.LogDebug((object)string.Format("Enemies to disable: {0} | Removing {1} spawnObjects from enemy director.", string.Join(", ", disabledEnemyNames), spawnObjectsToRemove.Count));
			List<EnemySetup> list = (from s in instance.enemiesDifficulty1.Concat(instance.enemiesDifficulty2).Concat(instance.enemiesDifficulty3)
				where s.spawnObjects.Any((GameObject so) => spawnObjectsToRemove.Contains(so))
				select s).ToList();
			for (int num = list.Count - 1; num >= 0; num--)
			{
				EnemySetup val = list[num];
				Settings.Logger.LogDebug((object)("Removed enemy setup " + ((Object)val).name));
				instance.enemiesDifficulty1.Remove(val);
				instance.enemiesDifficulty2.Remove(val);
				instance.enemiesDifficulty3.Remove(val);
			}
		}
	}
	public static class ItemsManager
	{
		private static Dictionary<string, Item> _removedList = new Dictionary<string, Item>();

		private static bool StatsManagerItemDictionaryIsAvailable
		{
			get
			{
				if ((Object)(object)StatsManager.instance != (Object)null)
				{
					return StatsManager.instance.itemDictionary != null;
				}
				return false;
			}
		}

		public static Dictionary<string, Item> GetAllItems()
		{
			return _removedList.Concat<KeyValuePair<string, Item>>(StatsManager.instance.itemDictionary).ToDictionary((KeyValuePair<string, Item> pair) => pair.Key, (KeyValuePair<string, Item> pair) => pair.Value);
		}

		public static void RemoveItems()
		{
			RestoreItems();
			if (!SemiFunc.IsNotMasterClient() && StatsManagerItemDictionaryIsAvailable && StatsManager.instance.itemDictionary.Count != 0)
			{
				List<string> disabledItemNames = Settings.GetDisabledSettingsEntryListNames(Settings.DisabledItems);
				Level levelCurrent = RunManager.instance.levelCurrent;
				string text = ((levelCurrent != null) ? ((Object)levelCurrent).name : null);
				if (text != null)
				{
					ISet<string> disabledItemsForLevel = Settings.GetDisabledItemsForLevel(text);
					disabledItemNames.AddRange(disabledItemsForLevel);
				}
				StatsManager.instance.itemDictionary.Where((KeyValuePair<string, Item> keyValuePair) => disabledItemNames.Contains(keyValuePair.Key.ToItemFriendlyName())).ToList().ForEach(delegate(KeyValuePair<string, Item> keyValuePair)
				{
					Settings.Logger.LogDebug((object)("Removed item " + keyValuePair.Key.ToItemFriendlyName() + "."));
					_removedList.TryAdd(keyValuePair.Key, keyValuePair.Value);
					StatsManager.instance.itemDictionary.Remove(keyValuePair.Key);
				});
			}
		}

		public static void RestoreItems()
		{
			if (StatsManagerItemDictionaryIsAvailable && _removedList.Count != 0)
			{
				for (int num = _removedList.Count - 1; num >= 0; num--)
				{
					KeyValuePair<string, Item> keyValuePair = _removedList.ElementAt(num);
					Settings.Logger.LogDebug((object)("Restored item " + keyValuePair.Key.ToItemFriendlyName() + "."));
					StatsManager.instance.itemDictionary.TryAdd(keyValuePair.Key, keyValuePair.Value);
					_removedList.Remove(keyValuePair.Key);
				}
			}
		}
	}
	public static class LevelManager
	{
		private static List<Level> _removedList = new List<Level>();

		public static bool RunManagerLevelVariableIsAvailable
		{
			get
			{
				if ((Object)(object)RunManager.instance != (Object)null)
				{
					return RunManager.instance.levels != null;
				}
				return false;
			}
		}

		public static IEnumerable<Level> GetAllLevels()
		{
			return _removedList.Concat(RunManager.instance.levels);
		}

		public static IEnumerable<Level> GetAllLevelsForItems()
		{
			IEnumerable<Level> enumerable = GetAllLevels();
			if (RunManagerLevelVariableIsAvailable)
			{
				enumerable = enumerable.Append(RunManager.instance.levelShop);
			}
			return enumerable;
		}

		public static void RemoveLevels()
		{
			if (!SemiFunc.IsNotMasterClient() && RunManagerLevelVariableIsAvailable)
			{
				List<string> disabledLevelNames = Settings.GetDisabledSettingsEntryListNames(Settings.DisabledLevels);
				RunManager.instance.levels.Where((Level l) => disabledLevelNames.Contains(((Object)l).name)).ToList().ForEach(delegate(Level level)
				{
					Settings.Logger.LogDebug((object)("Removed level " + ((Object)level).name + "."));
					_removedList.Add(level);
					RunManager.instance.levels.Remove(level);
				});
				if (RunManager.instance.levels.Count == 0)
				{
					Settings.Logger.LogError((object)"No levels left in RunManager. Quitting to Main Menu.");
					((MonoBehaviour)RunManager.instance).StartCoroutine(RunManager.instance.LeaveToMainMenu());
				}
			}
		}

		public static void RestoreLevels()
		{
			if (RunManagerLevelVariableIsAvailable && _removedList.Count != 0)
			{
				for (int num = _removedList.Count - 1; num >= 0; num--)
				{
					Level val = _removedList[num];
					Settings.Logger.LogDebug((object)("Restored level " + ((Object)val).name + "."));
					RunManager.instance.levels.Add(val);
					_removedList.RemoveAt(num);
				}
			}
		}

		public static bool IsValid()
		{
			return RunManager.instance.levels.Any((Level l) => !Settings.GetDisabledSettingsEntryListNames(Settings.DisabledLevels).Contains(((Object)l).name));
		}
	}
	public static class MenuModManager
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action <>9__3_0;

			public static Func<KeyValuePair<string, IEnumerable<GameObject>>, string> <>9__8_8;

			public static ScrollViewBuilderDelegate <>9__8_0;

			public static Func<Level, string> <>9__9_0;

			public static Func<KeyValuePair<string, IEnumerable<GameObject>>, string> <>9__9_9;

			public static Func<ValuableObject, string> <>9__10_12;

			public static Func<KeyValuePair<string, ValuableMetaData>, bool> <>9__10_4;

			public static Func<KeyValuePair<string, ValuableMetaData>, string> <>9__10_5;

			public static Action<string> <>9__10_13;

			public static Func<ValuableObject, string> <>9__10_7;

			public static ScrollViewBuilderDelegate <>9__10_0;

			public static Func<Level, string> <>9__12_0;

			public static Func<ValuableObject, string> <>9__12_10;

			public static Func<ValuableObject, string> <>9__12_5;

			public static Func<Level, string> <>9__13_9;

			public static Func<Level, string> <>9__13_4;

			public static Func<KeyValuePair<string, Item>, string> <>9__15_10;

			public static Func<string, string> <>9__15_4;

			public static Func<string, string> <>9__15_5;

			public static ScrollViewBuilderDelegate <>9__15_0;

			public static Func<Level, string> <>9__16_0;

			public static Func<KeyValuePair<string, Item>, string> <>9__16_11;

			public static Func<string, string> <>9__16_5;

			public static Func<string, string> <>9__16_6;

			internal void <CreateMainMenuButton>b__3_0()
			{
				CreatePopup().OpenPage(false);
			}

			internal RectTransform <CreateEnemyPage>b__8_0(Transform parent)
			{
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass8_0 CS$<>8__locals0 = new <>c__DisplayClass8_0();
				CS$<>8__locals0.button = MenuAPI.CreateREPOButton("Global", (Action)null, parent, new Vector2(0f, -80f));
				CS$<>8__locals0.button.onClick = delegate
				{
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0040: Expected O, but got Unknown
					//IL_0045: Expected O, but got Unknown
					//IL_005e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_0065: Expected O, but got Unknown
					//IL_006a: Expected O, but got Unknown
					//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00d0: Expected O, but got Unknown
					if (_currentPageButton != CS$<>8__locals0.button)
					{
						MenuAPI.CloseAllPagesAddedOnTop();
						REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
						BuilderDelegate obj = CS$<>8__locals0.<>9__2;
						if (obj == null)
						{
							BuilderDelegate val2 = delegate(Transform enemyPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Enable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Enable All", Color.red, "Enable all enemies?", (Action)delegate
									{
										((ConfigEntryBase)Settings.DisabledEnemies).BoxedValue = ((ConfigEntryBase)Settings.DisabledEnemies).DefaultValue;
										_currentPageButton = null;
										CS$<>8__locals0.button.onClick();
									}, (Action)null);
								}, enemyPageParent, new Vector2(367f, 20f));
							};
							BuilderDelegate val3 = val2;
							CS$<>8__locals0.<>9__2 = val2;
							obj = val3;
						}
						val.AddElement(obj);
						BuilderDelegate obj2 = CS$<>8__locals0.<>9__3;
						if (obj2 == null)
						{
							BuilderDelegate val4 = delegate(Transform enemyPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Disable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Disable All", Color.red, "Disable all enemies?", (Action)delegate
									{
										Settings.DisabledEnemies.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
										_currentPageButton = null;
										CS$<>8__locals0.button.onClick();
									}, (Action)null);
								}, enemyPageParent, new Vector2(536f, 20f));
							};
							BuilderDelegate val3 = val4;
							CS$<>8__locals0.<>9__3 = val4;
							obj2 = val3;
						}
						val.AddElement(obj2);
						EnemyManager.RefreshAllEnemyNames();
						Settings.Logger.LogDebug((object)"Refreshed enemy names for menu.");
						List<string> list = EnemyManager.EnemySpawnList.Keys.ToList();
						list.Sort();
						using (List<string>.Enumerator enumerator = list.GetEnumerator())
						{
							while (enumerator.MoveNext())
							{
								val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass8_1
								{
									name = enumerator.Current
								}.<CreateEnemyPage>b__9), 0f, 0f);
							}
						}
						_currentPageButton = CS$<>8__locals0.button;
						val.OpenPage(true);
					}
				};
				return ((REPOElement)CS$<>8__locals0.button).rectTransform;
			}

			internal string <CreateEnemyPage>b__8_8(KeyValuePair<string, IEnumerable<GameObject>> kvp)
			{
				return kvp.Key;
			}

			internal string <CreateLevelEnemyPage>b__9_0(Level vo)
			{
				return ((Object)vo).name;
			}

			internal string <CreateLevelEnemyPage>b__9_9(KeyValuePair<string, IEnumerable<GameObject>> kvp)
			{
				return kvp.Key;
			}

			internal RectTransform <CreateValuablePage>b__10_0(Transform parent)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass10_0 CS$<>8__locals0 = new <>c__DisplayClass10_0();
				CS$<>8__locals0.button = MenuAPI.CreateREPOButton("Global", (Action)null, parent, default(Vector2));
				CS$<>8__locals0.button.onClick = delegate
				{
					//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_0046: Expected O, but got Unknown
					//IL_004b: Expected O, but got Unknown
					//IL_0064: Unknown result type (might be due to invalid IL or missing references)
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_006b: Expected O, but got Unknown
					//IL_0070: Expected O, but got Unknown
					//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
					//IL_010d: Expected O, but got Unknown
					//IL_015b: Unknown result type (might be due to invalid IL or missing references)
					//IL_016f: Expected O, but got Unknown
					<>c__DisplayClass10_1 CS$<>8__locals1 = new <>c__DisplayClass10_1();
					if (_currentPageButton != CS$<>8__locals0.button)
					{
						MenuAPI.CloseAllPagesAddedOnTop();
						REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
						BuilderDelegate obj = CS$<>8__locals0.<>9__2;
						if (obj == null)
						{
							BuilderDelegate val2 = delegate(Transform valuablePageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Enable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Enable All", Color.red, "Enable all valuables?", (Action)delegate
									{
										((ConfigEntryBase)Settings.DisabledValuables).BoxedValue = ((ConfigEntryBase)Settings.DisabledValuables).DefaultValue;
										_currentPageButton = null;
										CS$<>8__locals0.button.onClick();
									}, (Action)null);
								}, valuablePageParent, new Vector2(367f, 20f));
							};
							BuilderDelegate val3 = val2;
							CS$<>8__locals0.<>9__2 = val2;
							obj = val3;
						}
						val.AddElement(obj);
						BuilderDelegate obj2 = CS$<>8__locals0.<>9__3;
						if (obj2 == null)
						{
							BuilderDelegate val4 = delegate(Transform valuablePageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Disable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Disable All", Color.red, "Disable all valuables?", (Action)delegate
									{
										Settings.DisabledValuables.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
										_currentPageButton = null;
										CS$<>8__locals0.button.onClick();
									}, (Action)null);
								}, valuablePageParent, new Vector2(536f, 20f));
							};
							BuilderDelegate val3 = val4;
							CS$<>8__locals0.<>9__3 = val4;
							obj2 = val3;
						}
						val.AddElement(obj2);
						ValuableManager.RefreshAllValuables();
						Settings.Logger.LogDebug((object)$"Refreshed {ValuableManager.ValuableList.Count} valuable names for menu.");
						CS$<>8__locals1.tinyItems = from ai in ValuableManager.AllItems
							where ai.Value.PresetType == ValuableManager.ValuablePresetType.Tiny
							select ai into i
							select i.Key;
						val.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform valuablePageParent) => ((REPOElement)MenuAPI.CreateREPOSlider("Default Valuable", "This is used when not enough valuables are enabled for certain sizes. Only tiny items are allowed.", (Action<string>)delegate(string stringValue)
						{
							Settings.DefaultValuable.Value = stringValue;
						}, valuablePageParent, CS$<>8__locals1.tinyItems.ToArray(), Settings.DefaultValuable.Value, default(Vector2), "", "", (BarBehavior)0)).rectTransform), 0f, 0f);
						using (IEnumerator<ValuableObject> enumerator = ValuableManager.ValuableList.OrderBy((ValuableObject vo) => ((Object)vo).name).GetEnumerator())
						{
							while (enumerator.MoveNext())
							{
								val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass10_2
								{
									valuableObject = enumerator.Current
								}.<CreateValuablePage>b__14), 0f, 0f);
							}
						}
						_currentPageButton = CS$<>8__locals0.button;
						val.OpenPage(true);
					}
				};
				return ((REPOElement)CS$<>8__locals0.button).rectTransform;
			}

			internal string <CreateValuablePage>b__10_12(ValuableObject vo)
			{
				return ((Object)vo).name;
			}

			internal bool <CreateValuablePage>b__10_4(KeyValuePair<string, ValuableMetaData> ai)
			{
				return ai.Value.PresetType == ValuableManager.ValuablePresetType.Tiny;
			}

			internal string <CreateValuablePage>b__10_5(KeyValuePair<string, ValuableMetaData> i)
			{
				return i.Key;
			}

			internal void <CreateValuablePage>b__10_13(string stringValue)
			{
				Settings.DefaultValuable.Value = stringValue;
			}

			internal string <CreateValuablePage>b__10_7(ValuableObject vo)
			{
				return ((Object)vo).name;
			}

			internal string <CreateLevelValuablesPages>b__12_0(Level vo)
			{
				return ((Object)vo).name;
			}

			internal string <CreateLevelValuablesPages>b__12_10(ValuableObject vo)
			{
				return ((Object)vo).name;
			}

			internal string <CreateLevelValuablesPages>b__12_5(ValuableObject vo)
			{
				return ((Object)vo).name;
			}

			internal string <CreateLevelPage>b__13_9(Level l)
			{
				return ((Object)l).name;
			}

			internal string <CreateLevelPage>b__13_4(Level vo)
			{
				return ((Object)vo).name;
			}

			internal RectTransform <CreateItemPage>b__15_0(Transform parent)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass15_0 CS$<>8__locals0 = new <>c__DisplayClass15_0();
				CS$<>8__locals0.button = MenuAPI.CreateREPOButton("Global", (Action)null, parent, default(Vector2));
				CS$<>8__locals0.button.onClick = delegate
				{
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0040: Expected O, but got Unknown
					//IL_0045: Expected O, but got Unknown
					//IL_005e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_0065: Expected O, but got Unknown
					//IL_006a: Expected O, but got Unknown
					//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
					//IL_00f8: Expected O, but got Unknown
					if (_currentPageButton != CS$<>8__locals0.button)
					{
						MenuAPI.CloseAllPagesAddedOnTop();
						REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
						BuilderDelegate obj = CS$<>8__locals0.<>9__2;
						if (obj == null)
						{
							BuilderDelegate val2 = delegate(Transform itemPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Enable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Enable All", Color.red, "Enable all shop items?", (Action)delegate
									{
										((ConfigEntryBase)Settings.DisabledItems).BoxedValue = ((ConfigEntryBase)Settings.DisabledItems).DefaultValue;
										_currentPageButton = null;
										CS$<>8__locals0.button.onClick();
									}, (Action)null);
								}, itemPageParent, new Vector2(367f, 20f));
							};
							BuilderDelegate val3 = val2;
							CS$<>8__locals0.<>9__2 = val2;
							obj = val3;
						}
						val.AddElement(obj);
						BuilderDelegate obj2 = CS$<>8__locals0.<>9__3;
						if (obj2 == null)
						{
							BuilderDelegate val4 = delegate(Transform itemPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Disable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Disable All", Color.red, "Disable all shop items?", (Action)delegate
									{
										Settings.DisabledItems.Value = string.Join(',', from l in ItemsManager.GetAllItems()
											select l.Key.ToItemFriendlyName());
										_currentPageButton = null;
										CS$<>8__locals0.button.onClick();
									}, (Action)null);
								}, itemPageParent, new Vector2(536f, 20f));
							};
							BuilderDelegate val3 = val4;
							CS$<>8__locals0.<>9__3 = val4;
							obj2 = val3;
						}
						val.AddElement(obj2);
						using (IEnumerator<string> enumerator = (from item in ItemsManager.GetAllItems().Keys
							select item.ToItemFriendlyName() into itemName
							orderby itemName
							select itemName).GetEnumerator())
						{
							while (enumerator.MoveNext())
							{
								val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass15_1
								{
									item = enumerator.Current
								}.<CreateItemPage>b__11), 0f, 0f);
							}
						}
						_currentPageButton = CS$<>8__locals0.button;
						val.OpenPage(true);
					}
				};
				return ((REPOElement)CS$<>8__locals0.button).rectTransform;
			}

			internal string <CreateItemPage>b__15_10(KeyValuePair<string, Item> l)
			{
				return l.Key.ToItemFriendlyName();
			}

			internal string <CreateItemPage>b__15_4(string item)
			{
				return item.ToItemFriendlyName();
			}

			internal string <CreateItemPage>b__15_5(string itemName)
			{
				return itemName;
			}

			internal string <CreateLevelItemPages>b__16_0(Level vo)
			{
				return ((Object)vo).name;
			}

			internal string <CreateLevelItemPages>b__16_11(KeyValuePair<string, Item> kvp)
			{
				return kvp.Key.ToItemFriendlyName();
			}

			internal string <CreateLevelItemPages>b__16_5(string item)
			{
				return item.ToItemFriendlyName();
			}

			internal string <CreateLevelItemPages>b__16_6(string itemName)
			{
				return itemName;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass10_0
		{
			public REPOButton button;

			public Action <>9__9;

			public Action <>9__8;

			public BuilderDelegate <>9__2;

			public Action <>9__11;

			public Action <>9__10;

			public BuilderDelegate <>9__3;

			internal void <CreateValuablePage>b__1()
			{
				//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_0046: Expected O, but got Unknown
				//IL_004b: Expected O, but got Unknown
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Expected O, but got Unknown
				//IL_0070: Expected O, but got Unknown
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Expected O, but got Unknown
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Expected O, but got Unknown
				<>c__DisplayClass10_1 CS$<>8__locals0 = new <>c__DisplayClass10_1();
				if (_currentPageButton == button)
				{
					return;
				}
				MenuAPI.CloseAllPagesAddedOnTop();
				REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
				BuilderDelegate obj = <>9__2;
				if (obj == null)
				{
					BuilderDelegate val2 = delegate(Transform valuablePageParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Enable All", (Action)delegate
						{
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.OpenPopup("Enable All", Color.red, "Enable all valuables?", (Action)delegate
							{
								((ConfigEntryBase)Settings.DisabledValuables).BoxedValue = ((ConfigEntryBase)Settings.DisabledValuables).DefaultValue;
								_currentPageButton = null;
								button.onClick();
							}, (Action)null);
						}, valuablePageParent, new Vector2(367f, 20f));
					};
					BuilderDelegate val3 = val2;
					<>9__2 = val2;
					obj = val3;
				}
				val.AddElement(obj);
				BuilderDelegate obj2 = <>9__3;
				if (obj2 == null)
				{
					BuilderDelegate val4 = delegate(Transform valuablePageParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Disable All", (Action)delegate
						{
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.OpenPopup("Disable All", Color.red, "Disable all valuables?", (Action)delegate
							{
								Settings.DisabledValuables.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
								_currentPageButton = null;
								button.onClick();
							}, (Action)null);
						}, valuablePageParent, new Vector2(536f, 20f));
					};
					BuilderDelegate val3 = val4;
					<>9__3 = val4;
					obj2 = val3;
				}
				val.AddElement(obj2);
				ValuableManager.RefreshAllValuables();
				Settings.Logger.LogDebug((object)$"Refreshed {ValuableManager.ValuableList.Count} valuable names for menu.");
				CS$<>8__locals0.tinyItems = from ai in ValuableManager.AllItems
					where ai.Value.PresetType == ValuableManager.ValuablePresetType.Tiny
					select ai into i
					select i.Key;
				val.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform valuablePageParent) => ((REPOElement)MenuAPI.CreateREPOSlider("Default Valuable", "This is used when not enough valuables are enabled for certain sizes. Only tiny items are allowed.", (Action<string>)delegate(string stringValue)
				{
					Settings.DefaultValuable.Value = stringValue;
				}, valuablePageParent, CS$<>8__locals0.tinyItems.ToArray(), Settings.DefaultValuable.Value, default(Vector2), "", "", (BarBehavior)0)).rectTransform), 0f, 0f);
				using (IEnumerator<ValuableObject> enumerator = ValuableManager.ValuableList.OrderBy((ValuableObject vo) => ((Object)vo).name).GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass10_2
						{
							valuableObject = enumerator.Current
						}.<CreateValuablePage>b__14), 0f, 0f);
					}
				}
				_currentPageButton = button;
				val.OpenPage(true);
			}

			internal void <CreateValuablePage>b__2(Transform valuablePageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Enable All", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Enable All", Color.red, "Enable all valuables?", (Action)delegate
					{
						((ConfigEntryBase)Settings.DisabledValuables).BoxedValue = ((ConfigEntryBase)Settings.DisabledValuables).DefaultValue;
						_currentPageButton = null;
						button.onClick();
					}, (Action)null);
				}, valuablePageParent, new Vector2(367f, 20f));
			}

			internal void <CreateValuablePage>b__8()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.OpenPopup("Enable All", Color.red, "Enable all valuables?", (Action)delegate
				{
					((ConfigEntryBase)Settings.DisabledValuables).BoxedValue = ((ConfigEntryBase)Settings.DisabledValuables).DefaultValue;
					_currentPageButton = null;
					button.onClick();
				}, (Action)null);
			}

			internal void <CreateValuablePage>b__9()
			{
				((ConfigEntryBase)Settings.DisabledValuables).BoxedValue = ((ConfigEntryBase)Settings.DisabledValuables).DefaultValue;
				_currentPageButton = null;
				button.onClick();
			}

			internal void <CreateValuablePage>b__3(Transform valuablePageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Disable All", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Disable All", Color.red, "Disable all valuables?", (Action)delegate
					{
						Settings.DisabledValuables.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
						_currentPageButton = null;
						button.onClick();
					}, (Action)null);
				}, valuablePageParent, new Vector2(536f, 20f));
			}

			internal void <CreateValuablePage>b__10()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.OpenPopup("Disable All", Color.red, "Disable all valuables?", (Action)delegate
				{
					Settings.DisabledValuables.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
					_currentPageButton = null;
					button.onClick();
				}, (Action)null);
			}

			internal void <CreateValuablePage>b__11()
			{
				Settings.DisabledValuables.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
				_currentPageButton = null;
				button.onClick();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass10_1
		{
			public IEnumerable<string> tinyItems;

			internal RectTransform <CreateValuablePage>b__6(Transform valuablePageParent)
			{
				//IL_0041: 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)
				return ((REPOElement)MenuAPI.CreateREPOSlider("Default Valuable", "This is used when not enough valuables are enabled for certain sizes. Only tiny items are allowed.", (Action<string>)delegate(string stringValue)
				{
					Settings.DefaultValuable.Value = stringValue;
				}, valuablePageParent, tinyItems.ToArray(), Settings.DefaultValuable.Value, default(Vector2), "", "", (BarBehavior)0)).rectTransform;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass10_2
		{
			public ValuableObject valuableObject;

			public Action<bool> <>9__15;

			internal RectTransform <CreateValuablePage>b__14(Transform valuablePageParent)
			{
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				return ((REPOElement)MenuAPI.CreateREPOToggle(valuableObject.FriendlyName(), (Action<bool>)delegate(bool b)
				{
					Settings.UpdateSettingsListEntry(Settings.DisabledValuables, ((Object)valuableObject).name, b);
				}, valuablePageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledValuables, ((Object)valuableObject).name))).rectTransform;
			}

			internal void <CreateValuablePage>b__15(bool b)
			{
				Settings.UpdateSettingsListEntry(Settings.DisabledValuables, ((Object)valuableObject).name, b);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass15_0
		{
			public REPOButton button;

			public Action <>9__7;

			public Action <>9__6;

			public BuilderDelegate <>9__2;

			public Action <>9__9;

			public Action <>9__8;

			public BuilderDelegate <>9__3;

			internal void <CreateItemPage>b__1()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				//IL_0045: Expected O, but got Unknown
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Expected O, but got Unknown
				//IL_006a: Expected O, but got Unknown
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f8: Expected O, but got Unknown
				if (_currentPageButton == button)
				{
					return;
				}
				MenuAPI.CloseAllPagesAddedOnTop();
				REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
				BuilderDelegate obj = <>9__2;
				if (obj == null)
				{
					BuilderDelegate val2 = delegate(Transform itemPageParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Enable All", (Action)delegate
						{
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.OpenPopup("Enable All", Color.red, "Enable all shop items?", (Action)delegate
							{
								((ConfigEntryBase)Settings.DisabledItems).BoxedValue = ((ConfigEntryBase)Settings.DisabledItems).DefaultValue;
								_currentPageButton = null;
								button.onClick();
							}, (Action)null);
						}, itemPageParent, new Vector2(367f, 20f));
					};
					BuilderDelegate val3 = val2;
					<>9__2 = val2;
					obj = val3;
				}
				val.AddElement(obj);
				BuilderDelegate obj2 = <>9__3;
				if (obj2 == null)
				{
					BuilderDelegate val4 = delegate(Transform itemPageParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Disable All", (Action)delegate
						{
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.OpenPopup("Disable All", Color.red, "Disable all shop items?", (Action)delegate
							{
								Settings.DisabledItems.Value = string.Join(',', from l in ItemsManager.GetAllItems()
									select l.Key.ToItemFriendlyName());
								_currentPageButton = null;
								button.onClick();
							}, (Action)null);
						}, itemPageParent, new Vector2(536f, 20f));
					};
					BuilderDelegate val3 = val4;
					<>9__3 = val4;
					obj2 = val3;
				}
				val.AddElement(obj2);
				using (IEnumerator<string> enumerator = (from item in ItemsManager.GetAllItems().Keys
					select item.ToItemFriendlyName() into itemName
					orderby itemName
					select itemName).GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass15_1
						{
							item = enumerator.Current
						}.<CreateItemPage>b__11), 0f, 0f);
					}
				}
				_currentPageButton = button;
				val.OpenPage(true);
			}

			internal void <CreateItemPage>b__2(Transform itemPageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Enable All", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Enable All", Color.red, "Enable all shop items?", (Action)delegate
					{
						((ConfigEntryBase)Settings.DisabledItems).BoxedValue = ((ConfigEntryBase)Settings.DisabledItems).DefaultValue;
						_currentPageButton = null;
						button.onClick();
					}, (Action)null);
				}, itemPageParent, new Vector2(367f, 20f));
			}

			internal void <CreateItemPage>b__6()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.OpenPopup("Enable All", Color.red, "Enable all shop items?", (Action)delegate
				{
					((ConfigEntryBase)Settings.DisabledItems).BoxedValue = ((ConfigEntryBase)Settings.DisabledItems).DefaultValue;
					_currentPageButton = null;
					button.onClick();
				}, (Action)null);
			}

			internal void <CreateItemPage>b__7()
			{
				((ConfigEntryBase)Settings.DisabledItems).BoxedValue = ((ConfigEntryBase)Settings.DisabledItems).DefaultValue;
				_currentPageButton = null;
				button.onClick();
			}

			internal void <CreateItemPage>b__3(Transform itemPageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Disable All", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Disable All", Color.red, "Disable all shop items?", (Action)delegate
					{
						Settings.DisabledItems.Value = string.Join(',', from l in ItemsManager.GetAllItems()
							select l.Key.ToItemFriendlyName());
						_currentPageButton = null;
						button.onClick();
					}, (Action)null);
				}, itemPageParent, new Vector2(536f, 20f));
			}

			internal void <CreateItemPage>b__8()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.OpenPopup("Disable All", Color.red, "Disable all shop items?", (Action)delegate
				{
					Settings.DisabledItems.Value = string.Join(',', from l in ItemsManager.GetAllItems()
						select l.Key.ToItemFriendlyName());
					_currentPageButton = null;
					button.onClick();
				}, (Action)null);
			}

			internal void <CreateItemPage>b__9()
			{
				Settings.DisabledItems.Value = string.Join(',', from l in ItemsManager.GetAllItems()
					select l.Key.ToItemFriendlyName());
				_currentPageButton = null;
				button.onClick();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass15_1
		{
			public string item;

			public Action<bool> <>9__12;

			internal RectTransform <CreateItemPage>b__11(Transform itemPageParent)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				return ((REPOElement)MenuAPI.CreateREPOToggle(item, (Action<bool>)delegate(bool b)
				{
					Settings.UpdateSettingsListEntry(Settings.DisabledItems, item, b);
				}, itemPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledItems, item))).rectTransform;
			}

			internal void <CreateItemPage>b__12(bool b)
			{
				Settings.UpdateSettingsListEntry(Settings.DisabledItems, item, b);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_0
		{
			public REPOButton button;

			public Action <>9__5;

			public Action <>9__4;

			public BuilderDelegate <>9__2;

			public Action <>9__7;

			public Action <>9__6;

			public BuilderDelegate <>9__3;

			internal void <CreateEnemyPage>b__1()
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				//IL_0045: Expected O, but got Unknown
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Expected O, but got Unknown
				//IL_006a: Expected O, but got Unknown
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Expected O, but got Unknown
				if (_currentPageButton == button)
				{
					return;
				}
				MenuAPI.CloseAllPagesAddedOnTop();
				REPOPopupPage val = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
				BuilderDelegate obj = <>9__2;
				if (obj == null)
				{
					BuilderDelegate val2 = delegate(Transform enemyPageParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Enable All", (Action)delegate
						{
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.OpenPopup("Enable All", Color.red, "Enable all enemies?", (Action)delegate
							{
								((ConfigEntryBase)Settings.DisabledEnemies).BoxedValue = ((ConfigEntryBase)Settings.DisabledEnemies).DefaultValue;
								_currentPageButton = null;
								button.onClick();
							}, (Action)null);
						}, enemyPageParent, new Vector2(367f, 20f));
					};
					BuilderDelegate val3 = val2;
					<>9__2 = val2;
					obj = val3;
				}
				val.AddElement(obj);
				BuilderDelegate obj2 = <>9__3;
				if (obj2 == null)
				{
					BuilderDelegate val4 = delegate(Transform enemyPageParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Disable All", (Action)delegate
						{
							//IL_0005: Unknown result type (might be due to invalid IL or missing references)
							MenuAPI.OpenPopup("Disable All", Color.red, "Disable all enemies?", (Action)delegate
							{
								Settings.DisabledEnemies.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
								_currentPageButton = null;
								button.onClick();
							}, (Action)null);
						}, enemyPageParent, new Vector2(536f, 20f));
					};
					BuilderDelegate val3 = val4;
					<>9__3 = val4;
					obj2 = val3;
				}
				val.AddElement(obj2);
				EnemyManager.RefreshAllEnemyNames();
				Settings.Logger.LogDebug((object)"Refreshed enemy names for menu.");
				List<string> list = EnemyManager.EnemySpawnList.Keys.ToList();
				list.Sort();
				using (List<string>.Enumerator enumerator = list.GetEnumerator())
				{
					while (enumerator.MoveNext())
					{
						val.AddElementToScrollView(new ScrollViewBuilderDelegate(new <>c__DisplayClass8_1
						{
							name = enumerator.Current
						}.<CreateEnemyPage>b__9), 0f, 0f);
					}
				}
				_currentPageButton = button;
				val.OpenPage(true);
			}

			internal void <CreateEnemyPage>b__2(Transform enemyPageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Enable All", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Enable All", Color.red, "Enable all enemies?", (Action)delegate
					{
						((ConfigEntryBase)Settings.DisabledEnemies).BoxedValue = ((ConfigEntryBase)Settings.DisabledEnemies).DefaultValue;
						_currentPageButton = null;
						button.onClick();
					}, (Action)null);
				}, enemyPageParent, new Vector2(367f, 20f));
			}

			internal void <CreateEnemyPage>b__4()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.OpenPopup("Enable All", Color.red, "Enable all enemies?", (Action)delegate
				{
					((ConfigEntryBase)Settings.DisabledEnemies).BoxedValue = ((ConfigEntryBase)Settings.DisabledEnemies).DefaultValue;
					_currentPageButton = null;
					button.onClick();
				}, (Action)null);
			}

			internal void <CreateEnemyPage>b__5()
			{
				((ConfigEntryBase)Settings.DisabledEnemies).BoxedValue = ((ConfigEntryBase)Settings.DisabledEnemies).DefaultValue;
				_currentPageButton = null;
				button.onClick();
			}

			internal void <CreateEnemyPage>b__3(Transform enemyPageParent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Disable All", (Action)delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					MenuAPI.OpenPopup("Disable All", Color.red, "Disable all enemies?", (Action)delegate
					{
						Settings.DisabledEnemies.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
						_currentPageButton = null;
						button.onClick();
					}, (Action)null);
				}, enemyPageParent, new Vector2(536f, 20f));
			}

			internal void <CreateEnemyPage>b__6()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.OpenPopup("Disable All", Color.red, "Disable all enemies?", (Action)delegate
				{
					Settings.DisabledEnemies.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
					_currentPageButton = null;
					button.onClick();
				}, (Action)null);
			}

			internal void <CreateEnemyPage>b__7()
			{
				Settings.DisabledEnemies.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
				_currentPageButton = null;
				button.onClick();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass8_1
		{
			public string name;

			public Action<bool> <>9__10;

			internal RectTransform <CreateEnemyPage>b__9(Transform enemyPageParent)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				return ((REPOElement)MenuAPI.CreateREPOToggle(name, (Action<bool>)delegate(bool b)
				{
					Settings.UpdateSettingsListEntry(Settings.DisabledEnemies, name, b);
				}, enemyPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledEnemies, name))).rectTransform;
			}

			internal void <CreateEnemyPage>b__10(bool b)
			{
				Settings.UpdateSettingsListEntry(Settings.DisabledEnemies, name, b);
			}
		}

		private static object? _currentPageButton;

		private static object? _mainMenuButton;

		public static void Initialize()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			MenuAPI.AddElementToMainMenu(new BuilderDelegate(CreateMainMenuButton));
		}

		private static void CreateMainMenuButton(Transform parent)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			_mainMenuButton = MenuAPI.CreateREPOButton("Spawn Manager", (Action)delegate
			{
				CreatePopup().OpenPage(false);
			}, parent, new Vector2(550f, 22f));
			SetMainMenuButtonVisibility();
		}

		private static void SetMainMenuButtonVisibility()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (SemiFunc.IsMainMenu() && _mainMenuButton != null)
			{
				((Component)(REPOButton)_mainMenuButton).gameObject.SetActive(Settings.ShowSpawnManagerButton.Value);
			}
		}

		public static void OnShowSpawnManagerButtonChanged(object sender, EventArgs args)
		{
			SetMainMenuButtonVisibility();
		}

		private static REPOPopupPage CreatePopup()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			REPOPopupPage menu = MenuAPI.CreateREPOPopupPage("Spawn Manager", (PresetSide)0, false, true, 0f);
			LevelManager.RestoreLevels();
			ValuableManager.RestoreValuableObjects();
			ItemsManager.RestoreItems();
			Settings.InitializeEnemiesLevels();
			Settings.InitializeItemsLevels();
			Settings.InitializeValuablesLevels();
			CreateSubMenuEnemies(menu);
			CreateLevelPage(menu, out REPOButton levelButton);
			CreateSubMenuItems(menu);
			CreateSubMenuValuables(menu);
			menu.AddElement((BuilderDelegate)delegate(Transform parent)
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				MenuAPI.CreateREPOButton("Back", (Action)delegate
				{
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					if (!LevelManager.IsValid())
					{
						MenuAPI.OpenPopup("Invalid Levels", Color.red, "Please make sure you have at least one level enabled. Would you like to edit the selections now?", (Action)delegate
						{
							levelButton.onClick();
						}, (Action)null);
					}
					else
					{
						menu.ClosePage(true);
					}
				}, parent, new Vector2(77f, 20f));
			});
			return menu;
		}

		private static void CreateSubMenuEnemies(REPOPopupPage menu)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			REPOPopupPage menu2 = menu;
			menu2.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				REPOButton obj = MenuAPI.CreateREPOButton("Enemies", (Action)null, parent, default(Vector2));
				obj.onClick = delegate
				{
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Expected O, but got Unknown
					REPOPopupPage subMenu = MenuAPI.CreateREPOPopupPage("Enemies", (PresetSide)0, false, true, 0f);
					CreateEnemyPage(subMenu);
					CreateLevelEnemyPage(subMenu);
					subMenu.AddElement((BuilderDelegate)delegate(Transform subMenuparent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Back", (Action)delegate
						{
							subMenu.ClosePage(true);
							CreatePopup().OpenPage(false);
						}, subMenuparent, new Vector2(77f, 20f));
					});
					menu2.ClosePage(true);
					subMenu.OpenPage(false);
				};
				return ((REPOElement)obj).rectTransform;
			}, 0f, 0f);
		}

		private static void CreateEnemyPage(REPOPopupPage menu)
		{
			//IL_0015: 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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__8_0;
			if (obj == null)
			{
				ScrollViewBuilderDelegate val = delegate(Transform parent)
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					REPOButton button = MenuAPI.CreateREPOButton("Global", (Action)null, parent, new Vector2(0f, -80f));
					BuilderDelegate val2 = default(BuilderDelegate);
					BuilderDelegate val3 = default(BuilderDelegate);
					button.onClick = delegate
					{
						//IL_0039: Unknown result type (might be due to invalid IL or missing references)
						//IL_003e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0040: Expected O, but got Unknown
						//IL_0045: Expected O, but got Unknown
						//IL_005e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0063: Unknown result type (might be due to invalid IL or missing references)
						//IL_0065: Expected O, but got Unknown
						//IL_006a: Expected O, but got Unknown
						//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
						//IL_00d0: Expected O, but got Unknown
						if (_currentPageButton != button)
						{
							MenuAPI.CloseAllPagesAddedOnTop();
							REPOPopupPage val4 = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
							BuilderDelegate obj2 = val2;
							if (obj2 == null)
							{
								BuilderDelegate val5 = delegate(Transform enemyPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Enable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Enable All", Color.red, "Enable all enemies?", (Action)delegate
										{
											((ConfigEntryBase)Settings.DisabledEnemies).BoxedValue = ((ConfigEntryBase)Settings.DisabledEnemies).DefaultValue;
											_currentPageButton = null;
											button.onClick();
										}, (Action)null);
									}, enemyPageParent, new Vector2(367f, 20f));
								};
								BuilderDelegate val6 = val5;
								val2 = val5;
								obj2 = val6;
							}
							val4.AddElement(obj2);
							BuilderDelegate obj3 = val3;
							if (obj3 == null)
							{
								BuilderDelegate val7 = delegate(Transform enemyPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Disable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Disable All", Color.red, "Disable all enemies?", (Action)delegate
										{
											Settings.DisabledEnemies.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
											_currentPageButton = null;
											button.onClick();
										}, (Action)null);
									}, enemyPageParent, new Vector2(536f, 20f));
								};
								BuilderDelegate val6 = val7;
								val3 = val7;
								obj3 = val6;
							}
							val4.AddElement(obj3);
							EnemyManager.RefreshAllEnemyNames();
							Settings.Logger.LogDebug((object)"Refreshed enemy names for menu.");
							List<string> list = EnemyManager.EnemySpawnList.Keys.ToList();
							list.Sort();
							foreach (string name in list)
							{
								val4.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform enemyPageParent) => ((REPOElement)MenuAPI.CreateREPOToggle(name, (Action<bool>)delegate(bool b)
								{
									Settings.UpdateSettingsListEntry(Settings.DisabledEnemies, name, b);
								}, enemyPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledEnemies, name))).rectTransform), 0f, 0f);
							}
							_currentPageButton = button;
							val4.OpenPage(true);
						}
					};
					return ((REPOElement)button).rectTransform;
				};
				<>c.<>9__8_0 = val;
				obj = (object)val;
			}
			menu.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f);
		}

		private static void CreateLevelEnemyPage(REPOPopupPage menu)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			foreach (Level level in from vo in LevelManager.GetAllLevels()
				orderby ((Object)vo).name
				select vo)
			{
				menu.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
				{
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					string friendlyName = level.FriendlyName();
					REPOButton button = MenuAPI.CreateREPOButton(friendlyName ?? "", (Action)null, parent, default(Vector2));
					BuilderDelegate val = default(BuilderDelegate);
					BuilderDelegate val2 = default(BuilderDelegate);
					button.onClick = delegate
					{
						//IL_0043: Unknown result type (might be due to invalid IL or missing references)
						//IL_0048: Unknown result type (might be due to invalid IL or missing references)
						//IL_004a: Expected O, but got Unknown
						//IL_004f: Expected O, but got Unknown
						//IL_0068: 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_006f: Expected O, but got Unknown
						//IL_0074: Expected O, but got Unknown
						//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
						//IL_00e1: Expected O, but got Unknown
						if (_currentPageButton != button)
						{
							MenuAPI.CloseAllPagesAddedOnTop();
							REPOPopupPage val3 = MenuAPI.CreateREPOPopupPage(friendlyName ?? "", (PresetSide)1, false, false, 0f);
							BuilderDelegate obj = val;
							if (obj == null)
							{
								BuilderDelegate val4 = delegate(Transform enemyPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Enable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Enable All", Color.red, "Enable all enemies?", (Action)delegate
										{
											if (Settings.DisabledLevelEnemies.TryGetValue(((Object)level).name, out ConfigEntry<string> value2))
											{
												((ConfigEntryBase)value2).BoxedValue = ((ConfigEntryBase)value2).DefaultValue;
												_currentPageButton = null;
												button.onClick();
											}
										}, (Action)null);
									}, enemyPageParent, new Vector2(367f, 20f));
								};
								BuilderDelegate val5 = val4;
								val = val4;
								obj = val5;
							}
							val3.AddElement(obj);
							BuilderDelegate obj2 = val2;
							if (obj2 == null)
							{
								BuilderDelegate val6 = delegate(Transform enemyPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Disable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Disable All", Color.red, "Disable all enemies?", (Action)delegate
										{
											if (Settings.DisabledLevelEnemies.TryGetValue(((Object)level).name, out ConfigEntry<string> value))
											{
												value.Value = string.Join(',', EnemyManager.EnemySpawnList.Select<KeyValuePair<string, IEnumerable<GameObject>>, string>((KeyValuePair<string, IEnumerable<GameObject>> kvp) => kvp.Key));
												_currentPageButton = null;
												button.onClick();
											}
										}, (Action)null);
									}, enemyPageParent, new Vector2(536f, 20f));
								};
								BuilderDelegate val5 = val6;
								val2 = val6;
								obj2 = val5;
							}
							val3.AddElement(obj2);
							EnemyManager.RefreshAllEnemyNames();
							Settings.Logger.LogDebug((object)"Refreshed enemy names for menu.");
							List<string> list = EnemyManager.EnemySpawnList.Keys.ToList();
							list.Sort();
							foreach (string name in list)
							{
								val3.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform enemyPageParent)
								{
									//IL_0047: Unknown result type (might be due to invalid IL or missing references)
									//IL_004d: Unknown result type (might be due to invalid IL or missing references)
									ConfigEntry<string> configEntry = Settings.DisabledLevelEnemies[((Object)level).name];
									return ((REPOElement)MenuAPI.CreateREPOToggle(name, (Action<bool>)delegate(bool b)
									{
										Settings.UpdateSettingsListEntry(configEntry, name, b);
									}, enemyPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(configEntry, name))).rectTransform;
								}, 0f, 0f);
							}
							_currentPageButton = button;
							val3.OpenPage(true);
						}
					};
					return ((REPOElement)button).rectTransform;
				}, 0f, 0f);
			}
		}

		private static void CreateValuablePage(REPOPopupPage menu)
		{
			//IL_0015: 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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				ScrollViewBuilderDelegate val = delegate(Transform parent)
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					REPOButton button = MenuAPI.CreateREPOButton("Global", (Action)null, parent, default(Vector2));
					BuilderDelegate val2 = default(BuilderDelegate);
					BuilderDelegate val3 = default(BuilderDelegate);
					button.onClick = delegate
					{
						//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_0046: Expected O, but got Unknown
						//IL_004b: Expected O, but got Unknown
						//IL_0064: Unknown result type (might be due to invalid IL or missing references)
						//IL_0069: Unknown result type (might be due to invalid IL or missing references)
						//IL_006b: Expected O, but got Unknown
						//IL_0070: Expected O, but got Unknown
						//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
						//IL_010d: Expected O, but got Unknown
						//IL_015b: Unknown result type (might be due to invalid IL or missing references)
						//IL_016f: Expected O, but got Unknown
						if (_currentPageButton != button)
						{
							MenuAPI.CloseAllPagesAddedOnTop();
							REPOPopupPage val4 = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
							BuilderDelegate obj2 = val2;
							if (obj2 == null)
							{
								BuilderDelegate val5 = delegate(Transform valuablePageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Enable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Enable All", Color.red, "Enable all valuables?", (Action)delegate
										{
											((ConfigEntryBase)Settings.DisabledValuables).BoxedValue = ((ConfigEntryBase)Settings.DisabledValuables).DefaultValue;
											_currentPageButton = null;
											button.onClick();
										}, (Action)null);
									}, valuablePageParent, new Vector2(367f, 20f));
								};
								BuilderDelegate val6 = val5;
								val2 = val5;
								obj2 = val6;
							}
							val4.AddElement(obj2);
							BuilderDelegate obj3 = val3;
							if (obj3 == null)
							{
								BuilderDelegate val7 = delegate(Transform valuablePageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Disable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Disable All", Color.red, "Disable all valuables?", (Action)delegate
										{
											Settings.DisabledValuables.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
											_currentPageButton = null;
											button.onClick();
										}, (Action)null);
									}, valuablePageParent, new Vector2(536f, 20f));
								};
								BuilderDelegate val6 = val7;
								val3 = val7;
								obj3 = val6;
							}
							val4.AddElement(obj3);
							ValuableManager.RefreshAllValuables();
							Settings.Logger.LogDebug((object)$"Refreshed {ValuableManager.ValuableList.Count} valuable names for menu.");
							IEnumerable<string> tinyItems = from ai in ValuableManager.AllItems
								where ai.Value.PresetType == ValuableManager.ValuablePresetType.Tiny
								select ai into i
								select i.Key;
							val4.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform valuablePageParent) => ((REPOElement)MenuAPI.CreateREPOSlider("Default Valuable", "This is used when not enough valuables are enabled for certain sizes. Only tiny items are allowed.", (Action<string>)delegate(string stringValue)
							{
								Settings.DefaultValuable.Value = stringValue;
							}, valuablePageParent, tinyItems.ToArray(), Settings.DefaultValuable.Value, default(Vector2), "", "", (BarBehavior)0)).rectTransform), 0f, 0f);
							foreach (ValuableObject valuableObject in ValuableManager.ValuableList.OrderBy((ValuableObject vo) => ((Object)vo).name))
							{
								val4.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform valuablePageParent) => ((REPOElement)MenuAPI.CreateREPOToggle(valuableObject.FriendlyName(), (Action<bool>)delegate(bool b)
								{
									Settings.UpdateSettingsListEntry(Settings.DisabledValuables, ((Object)valuableObject).name, b);
								}, valuablePageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledValuables, ((Object)valuableObject).name))).rectTransform), 0f, 0f);
							}
							_currentPageButton = button;
							val4.OpenPage(true);
						}
					};
					return ((REPOElement)button).rectTransform;
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			menu.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f);
		}

		private static void CreateSubMenuValuables(REPOPopupPage menu)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			REPOPopupPage menu2 = menu;
			menu2.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				REPOButton obj = MenuAPI.CreateREPOButton("Valuables", (Action)null, parent, default(Vector2));
				obj.onClick = delegate
				{
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Expected O, but got Unknown
					REPOPopupPage subMenu = MenuAPI.CreateREPOPopupPage("Valuables", (PresetSide)0, false, true, 0f);
					CreateValuablePage(subMenu);
					CreateLevelValuablesPages(subMenu);
					subMenu.AddElement((BuilderDelegate)delegate(Transform subMenuParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Back", (Action)delegate
						{
							subMenu.ClosePage(true);
							CreatePopup().OpenPage(false);
						}, subMenuParent, new Vector2(77f, 20f));
					});
					menu2.ClosePage(true);
					subMenu.OpenPage(false);
				};
				return ((REPOElement)obj).rectTransform;
			}, 0f, 0f);
		}

		private static void CreateLevelValuablesPages(REPOPopupPage menu)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			foreach (Level level in from vo in LevelManager.GetAllLevels()
				orderby ((Object)vo).name
				select vo)
			{
				menu.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
				{
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					string friendlyName = level.FriendlyName();
					REPOButton button = MenuAPI.CreateREPOButton(friendlyName ?? "", (Action)null, parent, default(Vector2));
					BuilderDelegate val = default(BuilderDelegate);
					BuilderDelegate val2 = default(BuilderDelegate);
					button.onClick = delegate
					{
						//IL_0043: Unknown result type (might be due to invalid IL or missing references)
						//IL_0048: Unknown result type (might be due to invalid IL or missing references)
						//IL_004a: Expected O, but got Unknown
						//IL_004f: Expected O, but got Unknown
						//IL_0068: 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_006f: Expected O, but got Unknown
						//IL_0074: Expected O, but got Unknown
						//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
						//IL_0108: Expected O, but got Unknown
						if (_currentPageButton != button)
						{
							MenuAPI.CloseAllPagesAddedOnTop();
							REPOPopupPage val3 = MenuAPI.CreateREPOPopupPage(friendlyName ?? "", (PresetSide)1, false, false, 0f);
							BuilderDelegate obj = val;
							if (obj == null)
							{
								BuilderDelegate val4 = delegate(Transform pageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Enable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Enable All", Color.red, "Enable all valuables?", (Action)delegate
										{
											if (Settings.DisabledLevelValuables.TryGetValue(((Object)level).name, out ConfigEntry<string> value2))
											{
												((ConfigEntryBase)value2).BoxedValue = ((ConfigEntryBase)value2).DefaultValue;
												_currentPageButton = null;
												button.onClick();
											}
										}, (Action)null);
									}, pageParent, new Vector2(367f, 20f));
								};
								BuilderDelegate val5 = val4;
								val = val4;
								obj = val5;
							}
							val3.AddElement(obj);
							BuilderDelegate obj2 = val2;
							if (obj2 == null)
							{
								BuilderDelegate val6 = delegate(Transform pageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Disable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Disable All", Color.red, "Disable all valuables?", (Action)delegate
										{
											if (Settings.DisabledLevelValuables.TryGetValue(((Object)level).name, out ConfigEntry<string> value))
											{
												value.Value = string.Join(',', ValuableManager.ValuableList.Select((ValuableObject vo) => ((Object)vo).name));
												_currentPageButton = null;
												button.onClick();
											}
										}, (Action)null);
									}, pageParent, new Vector2(536f, 20f));
								};
								BuilderDelegate val5 = val6;
								val2 = val6;
								obj2 = val5;
							}
							val3.AddElement(obj2);
							ValuableManager.RefreshAllValuables();
							Settings.Logger.LogDebug((object)$"Refreshed {ValuableManager.ValuableList.Count} valuable names for menu.");
							foreach (ValuableObject valuableObject in ValuableManager.ValuableList.OrderBy((ValuableObject vo) => ((Object)vo).name))
							{
								val3.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform pageParent)
								{
									//IL_004c: 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)
									ConfigEntry<string> configEntry = Settings.DisabledLevelValuables[((Object)level).name];
									return ((REPOElement)MenuAPI.CreateREPOToggle(((Object)valuableObject).name, (Action<bool>)delegate(bool b)
									{
										Settings.UpdateSettingsListEntry(configEntry, ((Object)valuableObject).name, b);
									}, pageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(configEntry, ((Object)valuableObject).name))).rectTransform;
								}, 0f, 0f);
							}
							_currentPageButton = button;
							val3.OpenPage(true);
						}
					};
					return ((REPOElement)button).rectTransform;
				}, 0f, 0f);
			}
		}

		private static void CreateLevelPage(REPOPopupPage menu, out REPOButton levelButton)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			REPOButton localButton = null;
			menu.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				REPOButton button = MenuAPI.CreateREPOButton("Levels", (Action)null, parent, default(Vector2));
				BuilderDelegate val = default(BuilderDelegate);
				BuilderDelegate val2 = default(BuilderDelegate);
				button.onClick = delegate
				{
					//IL_0039: Unknown result type (might be due to invalid IL or missing references)
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0040: Expected O, but got Unknown
					//IL_0045: Expected O, but got Unknown
					//IL_005e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_0065: Expected O, but got Unknown
					//IL_006a: Expected O, but got Unknown
					//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cf: Expected O, but got Unknown
					if (_currentPageButton != button)
					{
						MenuAPI.CloseAllPagesAddedOnTop();
						REPOPopupPage val3 = MenuAPI.CreateREPOPopupPage("Levels", (PresetSide)1, false, false, 0f);
						BuilderDelegate obj = val;
						if (obj == null)
						{
							BuilderDelegate val4 = delegate(Transform levelPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Enable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Enable All", Color.red, "Enable all Levels?", (Action)delegate
									{
										((ConfigEntryBase)Settings.DisabledLevels).BoxedValue = ((ConfigEntryBase)Settings.DisabledLevels).DefaultValue;
										_currentPageButton = null;
										button.onClick();
									}, (Action)null);
								}, levelPageParent, new Vector2(367f, 20f));
							};
							BuilderDelegate val5 = val4;
							val = val4;
							obj = val5;
						}
						val3.AddElement(obj);
						BuilderDelegate obj2 = val2;
						if (obj2 == null)
						{
							BuilderDelegate val6 = delegate(Transform levelPageParent)
							{
								//IL_002f: Unknown result type (might be due to invalid IL or missing references)
								MenuAPI.CreateREPOButton("Disable All", (Action)delegate
								{
									//IL_0005: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.OpenPopup("Disable All", Color.red, "Disable all Levels?", (Action)delegate
									{
										Settings.DisabledLevels.Value = string.Join(',', from l in LevelManager.GetAllLevels()
											select ((Object)l).name);
										_currentPageButton = null;
										button.onClick();
									}, (Action)null);
								}, levelPageParent, new Vector2(536f, 20f));
							};
							BuilderDelegate val5 = val6;
							val2 = val6;
							obj2 = val5;
						}
						val3.AddElement(obj2);
						foreach (Level level in from vo in LevelManager.GetAllLevels()
							orderby ((Object)vo).name
							select vo)
						{
							val3.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform levelPageParent) => ((REPOElement)MenuAPI.CreateREPOToggle(level.FriendlyName(), (Action<bool>)delegate(bool b)
							{
								Settings.UpdateSettingsListEntry(Settings.DisabledLevels, ((Object)level).name, b);
							}, levelPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledLevels, ((Object)level).name))).rectTransform), 0f, 0f);
						}
						_currentPageButton = button;
						val3.OpenPage(true);
					}
				};
				localButton = button;
				return ((REPOElement)button).rectTransform;
			}, 0f, 0f);
			levelButton = localButton;
		}

		private static void CreateSubMenuItems(REPOPopupPage menu)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			REPOPopupPage menu2 = menu;
			menu2.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				REPOButton obj = MenuAPI.CreateREPOButton("Shop Items", (Action)null, parent, default(Vector2));
				obj.onClick = delegate
				{
					//IL_0041: Unknown result type (might be due to invalid IL or missing references)
					//IL_004b: Expected O, but got Unknown
					REPOPopupPage subMenu = MenuAPI.CreateREPOPopupPage("Shop Items", (PresetSide)0, false, true, 0f);
					CreateItemPage(subMenu);
					CreateLevelItemPages(subMenu);
					subMenu.AddElement((BuilderDelegate)delegate(Transform subMenuParent)
					{
						//IL_002f: Unknown result type (might be due to invalid IL or missing references)
						MenuAPI.CreateREPOButton("Back", (Action)delegate
						{
							subMenu.ClosePage(true);
							CreatePopup().OpenPage(false);
						}, subMenuParent, new Vector2(77f, 20f));
					});
					menu2.ClosePage(true);
					subMenu.OpenPage(false);
				};
				return ((REPOElement)obj).rectTransform;
			}, 0f, 0f);
		}

		private static void CreateItemPage(REPOPopupPage menu)
		{
			//IL_0015: 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_0020: Expected O, but got Unknown
			object obj = <>c.<>9__15_0;
			if (obj == null)
			{
				ScrollViewBuilderDelegate val = delegate(Transform parent)
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					REPOButton button = MenuAPI.CreateREPOButton("Global", (Action)null, parent, default(Vector2));
					BuilderDelegate val2 = default(BuilderDelegate);
					BuilderDelegate val3 = default(BuilderDelegate);
					button.onClick = delegate
					{
						//IL_0039: Unknown result type (might be due to invalid IL or missing references)
						//IL_003e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0040: Expected O, but got Unknown
						//IL_0045: Expected O, but got Unknown
						//IL_005e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0063: Unknown result type (might be due to invalid IL or missing references)
						//IL_0065: Expected O, but got Unknown
						//IL_006a: Expected O, but got Unknown
						//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
						//IL_00f8: Expected O, but got Unknown
						if (_currentPageButton != button)
						{
							MenuAPI.CloseAllPagesAddedOnTop();
							REPOPopupPage val4 = MenuAPI.CreateREPOPopupPage("Global", (PresetSide)1, false, false, 0f);
							BuilderDelegate obj2 = val2;
							if (obj2 == null)
							{
								BuilderDelegate val5 = delegate(Transform itemPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Enable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Enable All", Color.red, "Enable all shop items?", (Action)delegate
										{
											((ConfigEntryBase)Settings.DisabledItems).BoxedValue = ((ConfigEntryBase)Settings.DisabledItems).DefaultValue;
											_currentPageButton = null;
											button.onClick();
										}, (Action)null);
									}, itemPageParent, new Vector2(367f, 20f));
								};
								BuilderDelegate val6 = val5;
								val2 = val5;
								obj2 = val6;
							}
							val4.AddElement(obj2);
							BuilderDelegate obj3 = val3;
							if (obj3 == null)
							{
								BuilderDelegate val7 = delegate(Transform itemPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Disable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Disable All", Color.red, "Disable all shop items?", (Action)delegate
										{
											Settings.DisabledItems.Value = string.Join(',', from l in ItemsManager.GetAllItems()
												select l.Key.ToItemFriendlyName());
											_currentPageButton = null;
											button.onClick();
										}, (Action)null);
									}, itemPageParent, new Vector2(536f, 20f));
								};
								BuilderDelegate val6 = val7;
								val3 = val7;
								obj3 = val6;
							}
							val4.AddElement(obj3);
							foreach (string item2 in from item in ItemsManager.GetAllItems().Keys
								select item.ToItemFriendlyName() into itemName
								orderby itemName
								select itemName)
							{
								val4.AddElementToScrollView((ScrollViewBuilderDelegate)((Transform itemPageParent) => ((REPOElement)MenuAPI.CreateREPOToggle(item2, (Action<bool>)delegate(bool b)
								{
									Settings.UpdateSettingsListEntry(Settings.DisabledItems, item2, b);
								}, itemPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(Settings.DisabledItems, item2))).rectTransform), 0f, 0f);
							}
							_currentPageButton = button;
							val4.OpenPage(true);
						}
					};
					return ((REPOElement)button).rectTransform;
				};
				<>c.<>9__15_0 = val;
				obj = (object)val;
			}
			menu.AddElementToScrollView((ScrollViewBuilderDelegate)obj, 0f, 0f);
		}

		private static void CreateLevelItemPages(REPOPopupPage menu)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			foreach (Level level in from vo in LevelManager.GetAllLevelsForItems().ToList()
				orderby ((Object)vo).name
				select vo)
			{
				menu.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform parent)
				{
					//IL_0032: Unknown result type (might be due to invalid IL or missing references)
					//IL_0038: Unknown result type (might be due to invalid IL or missing references)
					string friendlyName = level.FriendlyName();
					REPOButton button = MenuAPI.CreateREPOButton(friendlyName ?? "", (Action)null, parent, default(Vector2));
					BuilderDelegate val = default(BuilderDelegate);
					BuilderDelegate val2 = default(BuilderDelegate);
					button.onClick = delegate
					{
						//IL_0043: Unknown result type (might be due to invalid IL or missing references)
						//IL_0048: Unknown result type (might be due to invalid IL or missing references)
						//IL_004a: Expected O, but got Unknown
						//IL_004f: Expected O, but got Unknown
						//IL_0068: 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_006f: Expected O, but got Unknown
						//IL_0074: Expected O, but got Unknown
						//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
						//IL_0109: Expected O, but got Unknown
						if (_currentPageButton != button)
						{
							MenuAPI.CloseAllPagesAddedOnTop();
							REPOPopupPage val3 = MenuAPI.CreateREPOPopupPage(friendlyName ?? "", (PresetSide)1, false, false, 0f);
							BuilderDelegate obj = val;
							if (obj == null)
							{
								BuilderDelegate val4 = delegate(Transform itemPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Enable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Enable All", Color.red, "Enable all shop items?", (Action)delegate
										{
											if (Settings.DisabledLevelItems.TryGetValue(((Object)level).name, out ConfigEntry<string> value2))
											{
												((ConfigEntryBase)value2).BoxedValue = ((ConfigEntryBase)value2).DefaultValue;
												_currentPageButton = null;
												button.onClick();
											}
										}, (Action)null);
									}, itemPageParent, new Vector2(367f, 20f));
								};
								BuilderDelegate val5 = val4;
								val = val4;
								obj = val5;
							}
							val3.AddElement(obj);
							BuilderDelegate obj2 = val2;
							if (obj2 == null)
							{
								BuilderDelegate val6 = delegate(Transform itemPageParent)
								{
									//IL_002f: Unknown result type (might be due to invalid IL or missing references)
									MenuAPI.CreateREPOButton("Disable All", (Action)delegate
									{
										//IL_0005: Unknown result type (might be due to invalid IL or missing references)
										MenuAPI.OpenPopup("Disable All", Color.red, "Disable all shop items?", (Action)delegate
										{
											if (Settings.DisabledLevelItems.TryGetValue(((Object)level).name, out ConfigEntry<string> value))
											{
												value.Value = string.Join(',', from kvp in ItemsManager.GetAllItems()
													select kvp.Key.ToItemFriendlyName());
												_currentPageButton = null;
												button.onClick();
											}
										}, (Action)null);
									}, itemPageParent, new Vector2(536f, 20f));
								};
								BuilderDelegate val5 = val6;
								val2 = val6;
								obj2 = val5;
							}
							val3.AddElement(obj2);
							foreach (string name in from item in ItemsManager.GetAllItems().Keys
								select item.ToItemFriendlyName() into itemName
								orderby itemName
								select itemName)
							{
								val3.AddElementToScrollView((ScrollViewBuilderDelegate)delegate(Transform itemPageParent)
								{
									//IL_0047: Unknown result type (might be due to invalid IL or missing references)
									//IL_004d: Unknown result type (might be due to invalid IL or missing references)
									ConfigEntry<string> configEntry = Settings.DisabledLevelItems[((Object)level).name];
									return ((REPOElement)MenuAPI.CreateREPOToggle(name, (Action<bool>)delegate(bool b)
									{
										Settings.UpdateSettingsListEntry(configEntry, name, b);
									}, itemPageParent, default(Vector2), "ON", "OFF", Settings.IsSettingsListEntryEnabled(configEntry, name))).rectTransform;
								}, 0f, 0f);
							}
							_currentPageButton = button;
							val3.OpenPage(true);
						}
					};
					return ((REPOElement)button).rectTransform;
				}, 0f, 0f);
			}
		}
	}
	public static class PluginManager
	{
		public static bool IsPluginInstalled(string pluginGuid)
		{
			string pluginGuid2 = pluginGuid;
			return Chainloader.PluginInfos.Keys.Any((string pluginInfo) => pluginInfo == pluginGuid2);
		}
	}
	public static class ValuableManager
	{
		public enum ValuablePresetType
		{
			Tiny,
			Small,
			Medium,
			Big,
			Wide,
			Tall,
			VeryTall
		}

		public static List<ValuableObject> ValuableList = new List<ValuableObject>();

		public static Dictionary<string, GameObject> RemovedList = new Dictionary<string, GameObject>();

		public static Dictionary<string, LevelValuables> LevelValuablesDictionary = new Dictionary<string, LevelValuables>();

		public static Dictionary<string, ValuableMetaData> AllItems = new Dictionary<string, ValuableMetaData>();

		public static void RefreshAllValuables()
		{
			if ((Object)(object)RunManager.instance != (Object)null && RunManager.instance.levels != null)
			{
				if (AllItems.Count == 0)
				{
					foreach (Level level in RunManager.instance.levels)
					{
						foreach (LevelValuables valuablePreset in level.ValuablePresets)
						{
							AddItemsToDictionary(valuablePreset.tiny, ((Object)valuablePreset).name, ValuablePresetType.Tiny);
							AddItemsToDictionary(valuablePreset.small, ((Object)valuablePreset).name, ValuablePresetType.Small);
							AddItemsToDictionary(valuablePreset.medium, ((Object)valuablePreset).name, ValuablePr