Decompiled source of Bunject v1.2.0

Bunject.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using Bunburrows;
using Bunject.Computer;
using Bunject.Internal;
using Bunject.Levels;
using Bunject.Menu;
using Bunject.Monitoring;
using Bunject.Patches.PaqueretteActionResolverPatches;
using Bunject.Patches.SaveFileManipulationUtilityPatches;
using Bunject.Tiling;
using Bunject.Utility;
using Characters.Bunny;
using Characters.Bunny.Data;
using Computer;
using Dialogue;
using HarmonyLib;
using Levels;
using Menu;
using Misc;
using Newtonsoft.Json;
using Pause;
using PlatformSpecific;
using Saving;
using Saving.Architecture;
using State;
using TMPro;
using Tiling.Behaviour;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.Tilemaps;
using VisualEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Bunject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Bunject")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2cdf8a36-d56d-43fc-a1a4-2e64ac6b8d90")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Bunject
{
	public class BunjectAPI
	{
		private List<IBunjectorPlugin> bunjectors;

		internal static BunjectAPI Instance { get; private set; }

		internal static ForwardingBunjector Forward { get; private set; }

		internal static IReadOnlyList<IBunjectorPlugin> Bunjectors => Instance.bunjectors;

		internal static IEnumerable<ITileSource> TileSources => Instance.bunjectors.OfType<ITileSource>();

		internal static IEnumerable<IMonitor> Monitors => Instance.bunjectors.OfType<IMonitor>();

		internal static IEnumerable<IMenuSource> MenuOptions => Instance.bunjectors.OfType<IMenuSource>();

		internal static IEnumerable<IComputerTabSource> ComputerTabSources => Instance.bunjectors.OfType<IComputerTabSource>();

		static BunjectAPI()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			Forward = new ForwardingBunjector();
			Instance = new BunjectAPI();
			new Harmony("bunject.API").PatchAll(Assembly.GetAssembly(typeof(BunjectAPI)));
		}

		public static void RegisterPlugin(IBunjectorPlugin bunjector)
		{
			Instance.bunjectors.Add(bunjector);
		}

		public static void RegisterBunburrow(IModBunburrow modBunburrow)
		{
			BunburrowManager.RegisterBurrow(modBunburrow);
		}

		public static void RegisterElevator(int bunburrowID, int depth)
		{
			BunburrowManager.RegisterElevator(bunburrowID, depth);
		}

		public static void ClearRegisters()
		{
			BunburrowManager.ClearRegisters();
		}

		public static void BeginLoadingScreen()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			MenuController val = Object.FindObjectOfType<MenuController>();
			if (!((Object)(object)val == (Object)null))
			{
				new Traverse((object)val).Field<Camera>("mainCamera").Value.backgroundColor = new Color(0.97f, 0.94f, 0.94f);
				val.ShowLoadingScreen();
			}
		}

		public static void CancelLoadingScreen()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			MenuController val = Object.FindObjectOfType<MenuController>();
			if (!((Object)(object)val == (Object)null))
			{
				new Traverse((object)val).Field<Camera>("mainCamera").Value.backgroundColor = new Color(0.2509804f, 0.0627451f, 5f / 32f);
				new Traverse((object)val).Field<GameObject>("loadingScreen").Value.SetActive(false);
			}
		}

		public static bool LoadSave(string pluginName, string saveName)
		{
			SaveFileCustomData.CustomSavePath = SaveFileModUtility.GetPluginSaveFilePath(pluginName, saveName);
			SaveFileCustomData.CustomSaveBackupPath = SaveFileModUtility.GetPluginSaveBackupFilePath(pluginName, saveName);
			SaveFileCustomData.CustomDeletedSavePath = SaveFileModUtility.GetPluginSaveDeletedFilePath(pluginName, saveName);
			SaveFileCustomData.CustomOldSaveDataPath = SaveFileCustomData.CustomSavePath + ".old";
			EnsureFileExists(SaveFileCustomData.CustomSavePath);
			EnsureFileExists(SaveFileCustomData.CustomSaveBackupPath);
			EnsureFileExists(SaveFileCustomData.CustomDeletedSavePath);
			EnsureFileExists(SaveFileCustomData.CustomOldSaveDataPath);
			SaveFileManipulationUtility.TryLoadSave(999);
			SceneManager.LoadSceneAsync("Game");
			return true;
		}

		private static void EnsureFileExists(string path)
		{
			if (!File.Exists(path))
			{
				new FileInfo(path).Directory.Create();
				File.WriteAllBytes(path, new byte[0]);
			}
		}

		private BunjectAPI()
		{
			bunjectors = new List<IBunjectorPlugin>();
		}
	}
	public interface IBunjectorPlugin
	{
		void OnAssetsLoaded();

		void OnProgressionLoaded(GeneralProgression progression);
	}
}
namespace Bunject.Utility
{
	internal class InjectionDictionary<K, V> : Dictionary<K, V>, IDictionary<K, V>, ICollection<KeyValuePair<K, V>>, IEnumerable<KeyValuePair<K, V>>, IEnumerable where V : class
	{
		private Func<K, V, V> injector;

		public new V this[K key]
		{
			get
			{
				V value;
				V val = ((!base.TryGetValue(key, out value)) ? injector(key, null) : injector(key, value));
				if (val == null)
				{
					throw new KeyNotFoundException();
				}
				return val;
			}
			set
			{
				base[key] = value;
			}
		}

		public InjectionDictionary(Func<K, V, V> injector, IDictionary<K, V> source)
			: base(source)
		{
			this.injector = injector;
		}

		public new bool TryGetValue(K key, out V result)
		{
			result = null;
			if (base.TryGetValue(key, out result))
			{
				result = injector(key, result);
			}
			else
			{
				result = injector(key, null);
			}
			return result == null;
		}
	}
}
namespace Bunject.Tiling
{
	public abstract class BaseTileSourcePlugin
	{
		public abstract void Awake();

		public virtual void OnAssetsLoaded()
		{
		}

		public virtual void OnProgressionLoaded(GeneralProgression progression)
		{
		}

		public virtual LevelsList LoadEmergencyLevelsList(LevelsList original)
		{
			return original;
		}

		public abstract bool SupportsTile(string tile);

		public abstract Tile LoadTile(LevelObject levelObject, string tile, Vector2Int position);
	}
	public interface ITileSource : IBunjectorPlugin
	{
		bool SupportsTile(string tile);

		Tile LoadTile(LevelObject levelObject, string tile, Vector2Int position);
	}
	public interface IUpdateTileSprite
	{
		void UpdateTileSprite();
	}
	public sealed class Tile
	{
		public TileLevelData Instance { get; set; }

		public bool IsBunnyTile { get; set; }

		public bool IsStartTile { get; set; }

		public bool IsHoleTile { get; set; }

		public bool HasStartTrap { get; set; }

		public bool HasStartCarrot { get; set; }

		public Tile(TileLevelData instance)
		{
			Instance = instance;
		}
	}
	public static class TileValidator
	{
		private const string VALID_TILES = "^(S(?:{K})?|B(?:{[KB]*})?|E|F|D[0-9]|P[0-9]|N[0-9]+|\\!|Oph|X|C|T(?:{[URLDCTKBPS]+})?|W(?:{[URLD]*[0-9]?})?|R(?:{[URLD]*[0-9]?})?|EW|ER|PU|A|Y(?:{K})?)$";

		private static readonly Regex ValidTileRegex = new Regex("^(S(?:{K})?|B(?:{[KB]*})?|E|F|D[0-9]|P[0-9]|N[0-9]+|\\!|Oph|X|C|T(?:{[URLDCTKBPS]+})?|W(?:{[URLD]*[0-9]?})?|R(?:{[URLD]*[0-9]?})?|EW|ER|PU|A|Y(?:{K})?)$");

		private static readonly string[] Separators = new string[4] { ",", "\r\n", "\r", "\n" };

		public static List<string> GetTilesFromContent(string content)
		{
			return content.Split(Separators, StringSplitOptions.RemoveEmptyEntries).ToList();
		}

		public static bool ValidateTiles(string content)
		{
			return ValidateTiles(GetTilesFromContent(content));
		}

		public static bool ValidateTiles(IEnumerable<string> tiles)
		{
			bool flag = true;
			foreach (string tile in tiles)
			{
				flag &= ValidateTiles(tile);
			}
			return flag;
		}

		public static bool ValidateTile(string tile)
		{
			if (!ValidTileRegex.IsMatch(tile))
			{
				return BunjectAPI.Forward.SupportsTile(tile);
			}
			return true;
		}
	}
}
namespace Bunject.Patches
{
	[HarmonyPatch(typeof(BunniesReleaseAnimator), "StartRelease")]
	internal class BunniesReleaseAnimatorPatches
	{
		private static void Prefix()
		{
		}

		private static void Postfix()
		{
		}
	}
}
namespace Bunject.Patches.VisualEffectsPatches
{
	[HarmonyPatch(typeof(VisualEffectsController), "UpdateVisualEffects", new Type[] { typeof(VisualEffectsInfo) })]
	internal class UpdateVisualEffectsPatch
	{
		[HarmonyPriority(600)]
		private static void Prefix(ref VisualEffectsInfo visualEffectsInfo)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			Bunburrow? bunburrow = visualEffectsInfo.Bunburrow;
			if (bunburrow.HasValue)
			{
				Bunburrow valueOrDefault = bunburrow.GetValueOrDefault();
				if (valueOrDefault.IsCustomBunburrow())
				{
					LevelObject val = AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(valueOrDefault)][visualEffectsInfo.Depth];
					visualEffectsInfo = new VisualEffectsInfo((Bunburrow?)val.BunburrowStyle.Bunburrow, visualEffectsInfo.Depth, val.IsHell, val.IsTemple, false);
				}
			}
		}
	}
}
namespace Bunject.Patches.TileLevelDataPatches
{
	[HarmonyPatch(typeof(TileLevelData), "UpdateTileSprite")]
	internal class UpdateTileSpritePatch
	{
		private static bool Prefix(TileLevelData __instance)
		{
			if (__instance is IUpdateTileSprite updateTileSprite)
			{
				updateTileSprite.UpdateTileSprite();
				return false;
			}
			return true;
		}
	}
}
namespace Bunject.Patches.SettingsManagerPatches
{
	[HarmonyPatch(typeof(SettingsManager), "HandleBoot")]
	internal class HandleBootPatches
	{
		private static void Postfix()
		{
			BunjectAPI.Forward.OnAssetsLoaded();
		}
	}
}
namespace Bunject.Patches.SaveFileManipulationUtilityPatches
{
	internal static class SaveFileCustomData
	{
		internal const int CustomSaveFileIndex = 999;

		internal static string CustomSavePath { get; set; }

		internal static string CustomSaveBackupPath { get; set; }

		internal static string CustomDeletedSavePath { get; set; }

		internal static string CustomOldSaveDataPath { get; set; }
	}
	[HarmonyPatch(typeof(SaveFileManipulationUtility), "GetSaveDataPath")]
	internal class GetSaveDataPath
	{
		internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result)
		{
			if (saveIndex == 999)
			{
				__result = SaveFileCustomData.CustomSavePath;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SaveFileManipulationUtility), "GetBackupSaveDataPath")]
	internal class GetBackupSaveDataPath
	{
		internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result)
		{
			if (saveIndex == 999)
			{
				__result = SaveFileCustomData.CustomSaveBackupPath;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SaveFileManipulationUtility), "GetOldSaveDataPath")]
	internal class GetOldSaveDataPath
	{
		internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result)
		{
			if (saveIndex == 999)
			{
				__result = SaveFileCustomData.CustomOldSaveDataPath;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SaveFileManipulationUtility), "GetDeletedSaveDataPath")]
	internal class GetDeletedSaveDataPath
	{
		internal static bool Prefix(int saveIndex, bool platformSpecific, ref string __result)
		{
			if (saveIndex == 999)
			{
				__result = SaveFileCustomData.CustomDeletedSavePath;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(SaveFileManipulationUtility), "HandleBackToMainMenu")]
	internal class HandleBackToMainMenu
	{
		internal static void Postfix()
		{
			SaveFileCustomData.CustomSavePath = null;
			SaveFileCustomData.CustomSaveBackupPath = null;
		}
	}
}
namespace Bunject.Patches.ReleasedBunnyControllerPatches
{
	[HarmonyPatch(typeof(ReleasedBunnyController), "Initialize")]
	internal class InitializePatch
	{
		private static bool Prefix(ReleasedBunnyController __instance, BunnyIdentity bunnyIdentity, BunniesReleaseAnimator bunniesReleaseAnimator)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			if ((int)bunnyIdentity.Bunburrow < BunburrowManager.CustomBunburrowThreshold)
			{
				return true;
			}
			bunniesReleaseAnimator.NotifyBunnyInHole(__instance);
			Object.Destroy((Object)(object)((Component)__instance).gameObject);
			return false;
		}
	}
}
namespace Bunject.Patches.PlatformSpecificManagerPatches
{
	[HarmonyPatch(typeof(PlatformSpecificManager), "UnlockAchievement")]
	internal class UnlockAchievementPatches
	{
		private static bool Prefix()
		{
			return false;
		}
	}
	[HarmonyPatch(typeof(PlatformSpecificManager), "CheckAchievementsOnStart")]
	internal class CheckAchievementsOnStartPatches
	{
		private static bool Prefix()
		{
			return false;
		}
	}
}
namespace Bunject.Patches.PauseControllerPatches
{
	[HarmonyPatch(typeof(PauseController), "HandleBackToMenuConfirm")]
	internal static class HandleBackToMenuConfirm
	{
		internal static void Postfix()
		{
			BunjectAPI.Forward.OnMainMenu();
		}
	}
}
namespace Bunject.Patches.PaqueretteActionResolverPatches
{
	[HarmonyPatch(typeof(PaqueretteActionResolver), "HandleTalkButtonPress")]
	internal class HandleTalkButtonPressPatches
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__2 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private int <detectionState>5__2;

			private IEnumerator<CodeInstruction> <>7__wrap2;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 4u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<detectionState>5__2 = 0;
						<>7__wrap2 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Ldloc_3, (object)null);
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -3;
						<>2__current = CodeInstruction.Call(typeof(BunburrowSignController), "get_Bunburrow", (Type[])null, (Type[])null);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						<>2__current = CodeInstruction.Call(typeof(HandleTalkButtonPressPatches), "ExtractBurrow", (Type[])null, (Type[])null);
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						<detectionState>5__2++;
						break;
					case 5:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap2.MoveNext())
					{
						CodeInstruction current = <>7__wrap2.Current;
						switch (<detectionState>5__2)
						{
						case 0:
							if (CodeInstructionExtensions.Calls(current, GetBunburrowUnlockStatus))
							{
								<detectionState>5__2++;
							}
							break;
						case 1:
						{
							Label? label = default(Label?);
							if (CodeInstructionExtensions.Branches(current, ref label))
							{
								<>2__current = current;
								<>1__state = 1;
								return true;
							}
							break;
						}
						}
						<>2__current = current;
						<>1__state = 5;
						return true;
					}
					<>m__Finally1();
					<>7__wrap2 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap2 != null)
				{
					<>7__wrap2.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__2 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__2(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		public static Bunburrow? targetBurrow;

		private static MethodInfo GetBunburrowUnlockStatus = typeof(GeneralProgression).GetProperty("BunburrowsUnlockStatus").GetGetMethod();

		[IteratorStateMachine(typeof(<Transpiler>d__2))]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__2(-2)
			{
				<>3__instructions = instructions
			};
		}

		private static void ExtractBurrow(Bunburrow bunburrow)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			targetBurrow = bunburrow;
		}
	}
}
namespace Bunject.Patches.OphelineComputerCanvasControllerPatches
{
	[HarmonyPatch(typeof(OphelineComputerCanvasController), "Awake")]
	internal static class Awake
	{
		internal static void Postfix(OphelineComputerCanvasController __instance)
		{
			ComputerTabManager.Instantiate(__instance);
		}
	}
	[HarmonyPatch(typeof(OphelineComputerCanvasController), "Open")]
	internal static class Open
	{
		internal static void Postfix(OphelineComputerCanvasController __instance)
		{
			ComputerTabManager.instance?.OnComputerOpen();
		}
	}
	[HarmonyPatch(typeof(OphelineComputerCanvasController), "SwitchTab")]
	internal class SwitchTab
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private int <state>5__2;

			private IEnumerator<CodeInstruction> <>7__wrap2;

			private CodeInstruction <instruction>5__4;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 6u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap2 = null;
				<instruction>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: Expected O, but got Unknown
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Expected O, but got Unknown
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<state>5__2 = 0;
						<>7__wrap2 = instructions.GetEnumerator();
						<>1__state = -3;
						goto IL_023a;
					case 1:
						<>1__state = -3;
						Console.WriteLine("SWITCH:");
						Console.WriteLine(<instruction>5__4);
						Console.WriteLine("END SWITCH");
						<state>5__2++;
						goto IL_0214;
					case 2:
						<>1__state = -3;
						Console.WriteLine("Next thing?");
						<>2__current = CodeInstruction.LoadField(typeof(OphelineComputerCanvasController), "currentTabIndex", false);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						<>2__current = CodeInstruction.LoadField(typeof(OphelineComputerCanvasController), "availableTabs", false);
						<>1__state = 5;
						return true;
					case 5:
						<>1__state = -3;
						<>2__current = CodeInstruction.Call(typeof(SwitchTab), "SwitchToCustomTab", (Type[])null, (Type[])null);
						<>1__state = 6;
						return true;
					case 6:
						<>1__state = -3;
						<state>5__2++;
						goto IL_0214;
					case 7:
						{
							<>1__state = -3;
							<instruction>5__4 = null;
							goto IL_023a;
						}
						IL_023a:
						if (<>7__wrap2.MoveNext())
						{
							<instruction>5__4 = <>7__wrap2.Current;
							switch (<state>5__2)
							{
							case 0:
								if (<instruction>5__4.opcode == OpCodes.Switch)
								{
									Console.WriteLine("Alter switch value");
									<>2__current = CodeInstruction.Call(typeof(SwitchTab), "ChangeSwitchValue", (Type[])null, (Type[])null);
									<>1__state = 1;
									return true;
								}
								break;
							case 1:
								Console.WriteLine("Load 'this'");
								<>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
								<>1__state = 2;
								return true;
							}
							goto IL_0214;
						}
						<>m__Finally1();
						<>7__wrap2 = null;
						Console.WriteLine("All the way through");
						return false;
						IL_0214:
						<>2__current = <instruction>5__4;
						<>1__state = 7;
						return true;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap2 != null)
				{
					<>7__wrap2.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		private static MethodInfo StartLevelTransition = typeof(GameManager).GetMethod("StartLevelTransition", BindingFlags.Static | BindingFlags.NonPublic);

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__1(-2)
			{
				<>3__instructions = instructions
			};
		}

		private static int ChangeSwitchValue(int value)
		{
			if (value == 2 && !GameManager.GeneralProgression.IsMapUnlocked)
			{
				return 3;
			}
			return value;
		}

		private static void SwitchToCustomTab(int currentTabIndex, List<ComputerTabController> availableTabs)
		{
			ComputerTabController controller = availableTabs[currentTabIndex];
			ComputerTabManager.instance.SelectTab(controller.ToCustom());
		}
	}
}
namespace Bunject.Patches.MenuPatches
{
	[HarmonyPatch(typeof(MenuController), "Update")]
	internal class MenuPatches_Update
	{
		private static void Postfix(MenuController __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				BunjectAPI.Forward.ShowOrHideMenu(__instance.IsReady && !__instance.IsInBunstack && !__instance.IsInOptions && !__instance.IsInSaveScreen);
			}
			else
			{
				BunjectAPI.Forward.ShowOrHideMenu(showMenu: false);
			}
		}
	}
}
namespace Bunject.Patches.LevelStatePatches
{
	[HarmonyPatch(typeof(LevelState), "HandleBunnyCapture")]
	internal class LevelStatePatch_HandleBunnyCapture
	{
		private static void Postfix(BunnyCaptureData bunnyCaptureData)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			BunjectAPI.Forward.OnBunnyCapture(bunnyCaptureData.BunnyIdentity, ((BunnyCaptureData)(ref bunnyCaptureData)).IsHomeCapture());
		}
	}
}
namespace Bunject.Patches.LevelsListPatches
{
	[HarmonyPatch]
	internal class IndexerPatch
	{
		private static MethodBase TargetMethod()
		{
			return typeof(LevelsList).GetProperties().First((PropertyInfo pi) => pi.GetIndexParameters().Length == 1).GetGetMethod();
		}

		private static Exception Finalizer(Exception __exception, ref LevelObject __result, LevelsList __instance, int depth)
		{
			if (__instance is ModLevelsList modLevelsList)
			{
				__result = modLevelsList.LoadLevel(depth, CurrentLoadingContext.Value);
			}
			if ((Object)(object)__result == (Object)null)
			{
				Console.WriteLine("Level Load Failure!  Deferring to Emergency Level");
				LevelsList val = BunjectAPI.Forward.LoadEmergencyLevelsList(null);
				if ((Object)(object)val != (Object)(object)__instance)
				{
					__result = val[depth];
				}
			}
			return null;
		}
	}
}
namespace Bunject.Patches.LevelLoaderPatches
{
	[HarmonyPatch(typeof(LevelLoader), "LoadLevel")]
	internal class LoadLevelPatch
	{
		private static bool Prefix(LevelObject levelObject, out List<string> __result)
		{
			List<string> tilesFromContent = TileValidator.GetTilesFromContent(levelObject.Content);
			foreach (string item in tilesFromContent)
			{
				if (!TileValidator.ValidateTile(item))
				{
					Debug.LogWarning((object)("Invalid tile string: " + item));
				}
			}
			__result = tilesFromContent;
			return false;
		}
	}
}
namespace Bunject.Patches.LevelIndicatorGeneratorPatches
{
	[HarmonyPatch(typeof(LevelIndicatorGenerator), "GetLongLevelIndicator")]
	internal class GetLongLevelIndicatorPatches
	{
		private static string Postfix(string __result, bool useWhite)
		{
			//IL_000a: 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)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			LevelIdentity levelIdentity = GameManager.LevelStates.CurrentLevelState.LevelIdentity;
			if (levelIdentity.Bunburrow.IsCustomBunburrow())
			{
				string text = LevelIndicatorGenerator.GetShortLevelIndicator() + Traverse.Create(typeof(LevelIndicatorGenerator)).Method("GenerateBunniesStringForLevelIndicator", new object[1] { useWhite }).GetValue<string>() + " ";
				string customNameKey = GameManager.CurrentLevel.BaseData.CustomNameKey;
				__result = text + ((BunburrowExtension.IsVoidBunburrow(levelIdentity.Bunburrow) && string.IsNullOrWhiteSpace(customNameKey)) ? LevelIndicatorGenerator.GenerateVoidLevelName("") : customNameKey);
			}
			return BunjectAPI.Forward.OnLevelTitle(__result, levelIdentity, useWhite);
		}
	}
	[HarmonyPatch(typeof(LevelIndicatorGenerator), "GetLevelBunburrowStyle")]
	internal class GetLevelBunburrowStylePatch
	{
		public static BunburrowStyle Postfix(BunburrowStyle __result, LevelIdentity levelIdentity)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (levelIdentity.Bunburrow.IsCustomBunburrow())
			{
				return AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(levelIdentity.Bunburrow)][levelIdentity.Depth].BunburrowStyle;
			}
			return __result;
		}
	}
}
namespace Bunject.Patches.LevelBuilderPatches
{
	[HarmonyPatch]
	internal class BuildNewLevelPatch_SupportMoreSurfaceEntries
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private MethodInfo <startsWith>5__2;

			private MethodInfo <get_Chars>5__3;

			private MethodInfo <char_ToString>5__4;

			private int <detectionStage>5__5;

			private IEnumerator<CodeInstruction> <>7__wrap5;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<startsWith>5__2 = null;
				<get_Chars>5__3 = null;
				<char_ToString>5__4 = null;
				<>7__wrap5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<startsWith>5__2 = typeof(string).GetMethod("StartsWith", new Type[1] { typeof(string) });
						<get_Chars>5__3 = typeof(string).GetProperty("Chars").GetGetMethod();
						<char_ToString>5__4 = typeof(char).GetMethod("ToString", new Type[0]);
						<detectionStage>5__5 = 0;
						<>7__wrap5 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					}
					while (<>7__wrap5.MoveNext())
					{
						CodeInstruction val = <>7__wrap5.Current;
						switch (<detectionStage>5__5)
						{
						case 0:
							if (val.opcode == OpCodes.Ldstr && (string)val.operand == "N")
							{
								<detectionStage>5__5 = 1;
							}
							break;
						case 1:
							if (CodeInstructionExtensions.Calls(val, <startsWith>5__2))
							{
								<detectionStage>5__5 = 2;
							}
							else
							{
								<detectionStage>5__5 = 0;
							}
							break;
						case 2:
							if (CodeInstructionExtensions.Calls(val, <get_Chars>5__3))
							{
								<detectionStage>5__5 = 3;
								val = CodeInstruction.Call(typeof(string), "Substring", new Type[1] { typeof(int) }, (Type[])null);
							}
							break;
						case 3:
							if (CodeInstructionExtensions.Calls(val, <char_ToString>5__4))
							{
								<detectionStage>5__5 = 4;
							}
							continue;
						}
						<>2__current = val;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap5 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap5 != null)
				{
					<>7__wrap5.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		private static MethodInfo TargetMethod()
		{
			return typeof(LevelBuilder).GetMethod("BuildNewLevel", new Type[3]
			{
				typeof(LevelObject),
				typeof(BunburrowStyle),
				typeof(bool)
			});
		}

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__1(-2)
			{
				<>3__instructions = instructions
			};
		}
	}
}
namespace Bunject.Patches.GeneralProgressionPatches
{
	[HarmonyPatch(typeof(GeneralProgression), "GetVoidlessPillarsProgress")]
	internal class GetVoidlesssPillarsProgressPatch
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private IEnumerator<CodeInstruction> <>7__wrap1;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					case 2:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						CodeInstruction current = <>7__wrap1.Current;
						if (CodeInstructionExtensions.Calls(current, IsVoidBunburrow))
						{
							<>2__current = CodeInstruction.Call(typeof(CustomBunburrowExtension), "IsVoidOrCustomBunburrow", (Type[])null, (Type[])null);
							<>1__state = 1;
							return true;
						}
						<>2__current = current;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		private static MethodInfo IsVoidBunburrow = typeof(BunburrowExtension).GetMethod("IsVoidBunburrow");

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__1(-2)
			{
				<>3__instructions = instructions
			};
		}
	}
	[HarmonyPatch(typeof(GeneralProgression), "GetNonVoidBunniesCount")]
	internal class GetNonVoidBunniesCountPatches
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private IEnumerator<CodeInstruction> <>7__wrap1;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					case 2:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						CodeInstruction current = <>7__wrap1.Current;
						if (CodeInstructionExtensions.Calls(current, IsNonVoidBunburrow))
						{
							<>2__current = CodeInstruction.Call(typeof(CustomBunburrowExtension), "IsCoreBunburrow", (Type[])null, (Type[])null);
							<>1__state = 1;
							return true;
						}
						<>2__current = current;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		private static MethodInfo IsNonVoidBunburrow = typeof(BunburrowExtension).GetMethod("IsNonVoidBunburrow");

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__1(-2)
			{
				<>3__instructions = instructions
			};
		}
	}
	[HarmonyPatch(typeof(GeneralProgression), "FreeAllNonVoidBunnies")]
	internal class FreeAllNonVoidBunniesPatches
	{
		private static void Postfix()
		{
			BunnyReleaser.NotifyReleased();
		}
	}
	[HarmonyPatch(typeof(GeneralProgression), "FreeBunniesFromBunburrow")]
	internal class FreeBunniesFromBunburrowPatches
	{
		private static void Postfix()
		{
			BunnyReleaser.NotifyReleased();
		}
	}
	[HarmonyPatch(typeof(GeneralProgression), "HandleElevatorUnlock")]
	internal class HandleElevatorUnlockPatch
	{
		public static void Postfix(GeneralProgression __instance)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (ElevatorManager.ElevatorUnlock(GameManager.LevelStates.CurrentLevelState.LevelIdentity, out var elevatorData) && !CollectionExtension.ContainsEquatable<string>((IEnumerable<string>)__instance.UnlockedElevators, elevatorData))
			{
				Traverse.Create((object)__instance).Field<List<string>>("unlockedElevators").Value.Add(elevatorData);
			}
		}
	}
}
namespace Bunject.Patches.GameManagerPatches
{
	[HarmonyPatch(typeof(GameManager), "HandleDialogueEvent")]
	internal class HandleDialogueEventPatches
	{
		private static void Prefix(string eventKey, ref Bunburrow? bunburrowInfo)
		{
			if (eventKey == "release")
			{
				bunburrowInfo = HandleTalkButtonPressPatches.targetBurrow;
				HandleTalkButtonPressPatches.targetBurrow = null;
			}
		}
	}
	[HarmonyPatch(typeof(GameManager), "HandleRappelling")]
	internal class HandleRappellingPatches
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__1 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private int <state>5__2;

			private IEnumerator<CodeInstruction> <>7__wrap2;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 1u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<state>5__2 = 0;
						<>7__wrap2 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						<state>5__2++;
						break;
					case 2:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap2.MoveNext())
					{
						CodeInstruction current = <>7__wrap2.Current;
						switch (<state>5__2)
						{
						case 0:
							if (CodeInstructionExtensions.Calls(current, StartLevelTransition))
							{
								<state>5__2++;
							}
							break;
						case 1:
							if (CodeInstructionExtensions.Calls(current, StartLevelTransition))
							{
								<>2__current = CodeInstruction.Call(typeof(HandleRappellingPatches), "StartLevelRappellingTransition", (Type[])null, (Type[])null);
								<>1__state = 1;
								return true;
							}
							break;
						}
						<>2__current = current;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>7__wrap2 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap2 != null)
				{
					<>7__wrap2.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__1 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__1(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		private static MethodInfo StartLevelTransition = typeof(GameManager).GetMethod("StartLevelTransition", BindingFlags.Static | BindingFlags.NonPublic);

		[IteratorStateMachine(typeof(<Transpiler>d__1))]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__1(-2)
			{
				<>3__instructions = instructions
			};
		}

		private static void StartLevelRappellingTransition(LevelObject surfaceLevel, LevelTransitionType levelTransitionType, LevelIdentity levelIdentity, LevelIdentity? elevatorTargetLevelIdentity)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			Bunburrow value = Traverse.Create<GameManager>().Field<Bunburrow>("previousBunburrow").Value;
			LevelObject val = BunjectAPI.Forward.LoadBurrowSurfaceLevel(((Object)AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(value)]).name, surfaceLevel);
			StartLevelTransition.Invoke(null, new object[4] { val, levelTransitionType, levelIdentity, elevatorTargetLevelIdentity });
		}
	}
	[HarmonyPatch(typeof(GameManager), "StartLevelTransition")]
	internal class StartLevelTransitionPatches
	{
		private static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity)
		{
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class SetGeneralProgressionPatches
	{
		private static void Prefix(GeneralProgression value)
		{
			BunjectAPI.Forward.OnProgressionLoaded(value);
		}
	}
	[HarmonyPatch(typeof(GameManager), "HandleSurfaceElevatorUse")]
	internal class HandleSurfaceElevatorUsePatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo TryGetValue = AccessTools.Method(typeof(IReadOnlyDictionary<string, LevelIdentity>), "TryGetValue", (Type[])null, (Type[])null);
			int num = list.FindIndex((CodeInstruction x) => CodeInstructionExtensions.Calls(x, TryGetValue));
			Label? label = default(Label?);
			if (num >= 0 && num + 2 < list.Count && CodeInstructionExtensions.Branches(list[num + 1], ref label))
			{
				Label label2 = il.DefineLabel();
				list.Insert(num + 2, CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Nop, (object)null), new Label[1] { label2 }));
				list.InsertRange(num + 1, new List<CodeInstruction>
				{
					new CodeInstruction(OpCodes.Brtrue, (object)label2),
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					new CodeInstruction(OpCodes.Ldloca, (object)0),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(HandleSurfaceElevatorUsePatch), "Infix", (Type[])null, (Type[])null))
				});
			}
			return list;
		}

		private static bool Infix(string elevatorName, out LevelIdentity level)
		{
			return ElevatorManager.IsElevatorUnlock(elevatorName, out level);
		}
	}
	[HarmonyPatch(typeof(GameManager), "Init")]
	internal class Init
	{
		[CompilerGenerated]
		private sealed class <Postfix>d__0 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public IEnumerator __result;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Postfix>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0047;
				case 1:
					<>1__state = -1;
					goto IL_0047;
				case 2:
					{
						<>1__state = -1;
						return false;
					}
					IL_0047:
					if (__result.MoveNext())
					{
						object current = __result.Current;
						<>2__current = current;
						<>1__state = 1;
						return true;
					}
					<>2__current = ElevatorManager.ExtractElevatorProgression();
					<>1__state = 2;
					return true;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<Postfix>d__0))]
		public static IEnumerator Postfix(IEnumerator __result)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Postfix>d__0(0)
			{
				__result = __result
			};
		}
	}
	[HarmonyPatch(typeof(GameManager), "InstantiateBunburrowEntrySigns")]
	internal class InstantiateBunburrowEntrySignsPatch
	{
		[CompilerGenerated]
		private sealed class <Transpiler>d__0 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private CodeInstruction <>2__current;

			private int <>l__initialThreadId;

			private IEnumerable<CodeInstruction> instructions;

			public IEnumerable<CodeInstruction> <>3__instructions;

			private MethodInfo <tileLevelData_LeftTile>5__2;

			private int <state>5__3;

			private IEnumerator<CodeInstruction> <>7__wrap3;

			private CodeInstruction <code>5__5;

			CodeInstruction IEnumerator<CodeInstruction>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Transpiler>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 1) <= 4u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<tileLevelData_LeftTile>5__2 = null;
				<>7__wrap3 = null;
				<code>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Expected O, but got Unknown
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Expected O, but got Unknown
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: 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
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<tileLevelData_LeftTile>5__2 = AccessTools.PropertyGetter(typeof(TileLevelData), "LeftTile");
						<state>5__3 = 0;
						<>7__wrap3 = instructions.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						switch (<state>5__3)
						{
						case 0:
							if (CodeInstructionExtensions.Calls(<code>5__5, <tileLevelData_LeftTile>5__2))
							{
								<state>5__3 = 1;
							}
							break;
						case 1:
							if (CodeInstructionExtensions.IsStloc(<code>5__5, (LocalBuilder)null))
							{
								<>2__current = new CodeInstruction(OpCodes.Ldloc_2, (object)null);
								<>1__state = 2;
								return true;
							}
							break;
						}
						goto IL_019d;
					case 2:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Ldloc_3, (object)null);
						<>1__state = 3;
						return true;
					case 3:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(InstantiateBunburrowEntrySignsPatch), "GetSignTile", (Type[])null, (Type[])null));
						<>1__state = 4;
						return true;
					case 4:
						<>1__state = -3;
						<>2__current = new CodeInstruction(OpCodes.Stloc_3, (object)null);
						<>1__state = 5;
						return true;
					case 5:
						{
							<>1__state = -3;
							<state>5__3 = 2;
							goto IL_019d;
						}
						IL_019d:
						<code>5__5 = null;
						break;
					}
					if (<>7__wrap3.MoveNext())
					{
						<code>5__5 = <>7__wrap3.Current;
						<>2__current = <code>5__5;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap3 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap3 != null)
				{
					<>7__wrap3.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
			{
				<Transpiler>d__0 <Transpiler>d__;
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					<Transpiler>d__ = this;
				}
				else
				{
					<Transpiler>d__ = new <Transpiler>d__0(0);
				}
				<Transpiler>d__.instructions = <>3__instructions;
				return <Transpiler>d__;
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
			}
		}

		[IteratorStateMachine(typeof(<Transpiler>d__0))]
		internal static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator il)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Transpiler>d__0(-2)
			{
				<>3__instructions = instructions
			};
		}

		private static FloorTile GetSignTile(BunburrowEntryTile currentHole, FloorTile otherwise)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			FloorTile val = otherwise;
			Bunburrow? bunburrow = currentHole.Bunburrow;
			if (bunburrow.HasValue)
			{
				Bunburrow valueOrDefault = bunburrow.GetValueOrDefault();
				if (valueOrDefault.IsCustomBunburrow())
				{
					IModBunburrow modBunburrow = valueOrDefault.GetModBunburrow();
					if (modBunburrow != null)
					{
						if (!modBunburrow.HasSign)
						{
							val = null;
						}
						else if (!modBunburrow.HasEntrance)
						{
							val = (FloorTile)(object)currentHole;
						}
						else
						{
							Vector2Int? val2 = modBunburrow.OverrideSignCoordinate();
							if (val2.HasValue)
							{
								Vector2Int valueOrDefault2 = val2.GetValueOrDefault();
								TileLevelData tileInListByCoordinates = LevelBuilderExtensions.GetTileInListByCoordinates(GameManager.CurrentLevel.Tiles.ToList(), ((Vector2Int)(ref valueOrDefault2)).y, ((Vector2Int)(ref valueOrDefault2)).x);
								val = (FloorTile)(((object)((tileInListByCoordinates is FloorTile) ? tileInListByCoordinates : null)) ?? ((object)val));
							}
						}
					}
				}
			}
			return val;
		}
	}
	[HarmonyPatch(typeof(GameManager), "LoadLevel")]
	internal class LoadLevelPatches
	{
		public static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity, LevelTransitionType levelTransitionType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if ((int)levelTransitionType != 3 && levelIdentity.Bunburrow.IsCustomBunburrow())
			{
				IModBunburrow modBunburrow = levelIdentity.Bunburrow.GetModBunburrow();
				if (modBunburrow != null)
				{
					LevelsList levels = modBunburrow.GetLevels();
					if (levels != null)
					{
						LoadingContext value = CurrentLoadingContext.Value;
						try
						{
							CurrentLoadingContext.Value = LoadingContext.LevelTransition;
							levelObject = levels[levelIdentity.Depth];
						}
						finally
						{
							CurrentLoadingContext.Value = value;
						}
					}
				}
			}
			levelObject = BunjectAPI.Forward.OnLevelLoad(levelObject, levelIdentity);
		}
	}
	[HarmonyPatch(typeof(GameManager), "LoadLevelAtUndo")]
	internal class LoadLevelAtUndo
	{
		public static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			levelObject = BunjectAPI.Forward.OnLevelLoad(levelObject, levelIdentity);
		}
	}
	[HarmonyPatch(typeof(GameManager), "LoadLevelFromSave")]
	internal class LoadLevelFromSave
	{
		public static void Prefix(ref LevelObject levelObject, LevelIdentity levelIdentity)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			levelObject = BunjectAPI.Forward.OnLevelLoad(levelObject, levelIdentity);
		}
	}
}
namespace Bunject.Patches.ElevatorControllerPatches
{
	[HarmonyPatch(typeof(ElevatorController), "StartElevating")]
	internal static class StartElevating
	{
		internal static void Prefix(bool displayCredits)
		{
			if (displayCredits)
			{
				BunjectAPI.Forward.OnShowCredits();
			}
		}
	}
}
namespace Bunject.Patches.ChoiceSelectorPatches
{
	[HarmonyPatch(typeof(ChoiceSelector), "StartListeningToInputs")]
	internal class StartListeningToInputsPatch
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo GeneralInputManager = AccessTools.Property(typeof(GameManager), "GeneralInputManager").GetGetMethod();
			List<Label> labels = list.FindLast((CodeInstruction x) => CodeInstructionExtensions.Calls(x, GeneralInputManager))?.labels;
			if (labels != null)
			{
				int num = list.FindIndex((CodeInstruction x) => labels.Any((Label y) => y.Equals(x.operand)));
				if (num >= 0)
				{
					list.InsertRange(num, new List<CodeInstruction>
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(StartListeningToInputsPatch), "Infix", (Type[])null, (Type[])null))
					});
				}
			}
			return list;
		}

		private static void Infix(ChoiceSelector @this)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			List<ChoiceObject> list = new List<ChoiceObject>();
			List<LevelIdentity> list2 = new List<LevelIdentity>();
			foreach (string unlockedElevator in GameManager.GeneralProgression.UnlockedElevators)
			{
				if (ElevatorManager.IsElevatorUnlock(unlockedElevator, out var level))
				{
					list2.Add(level);
					list.Add(new ChoiceObject(unlockedElevator, unlockedElevator, false));
				}
			}
			IReadOnlyList<ChoiceObject> readOnlyList = list;
			Traverse obj = Traverse.Create((object)@this);
			List<ChoiceLineController> value = obj.Field<List<ChoiceLineController>>("choicesLineControllers").Value;
			RectTransform value2 = obj.Field<RectTransform>("contentRectTransform").Value;
			for (int i = 0; i < readOnlyList.Count; i++)
			{
				LevelIdentity val = list2[i];
				BunburrowStyle levelBunburrowStyle = LevelIndicatorGenerator.GetLevelBunburrowStyle(val);
				ChoiceLineController component = Object.Instantiate<GameObject>(AssetsManager.ChoiceLinePrefab, (Transform)(object)value2).GetComponent<ChoiceLineController>();
				value.Add(component);
				component.Init(readOnlyList[i], LevelIndicatorGenerator.GetShortLevelIndicator(val));
				component.UpdateStyle(Color.black, levelBunburrowStyle.SkyboxColor, levelBunburrowStyle.UIWhiteColor, levelBunburrowStyle.ButtonDefaultColor, levelBunburrowStyle.FlowerSprite);
			}
		}
	}
}
namespace Bunject.Patches.BunburrowSignControllerPatches
{
	[HarmonyPatch(typeof(BunburrowSignController), "Init")]
	internal class InitPatch
	{
		public static void Postfix(BunburrowSignController __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			Bunburrow bunburrow = __instance.Bunburrow;
			if (bunburrow.IsCustomBunburrow() && !BunburrowExtension.IsVoidBunburrow(__instance.Bunburrow) && AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(bunburrow)].Length > 0)
			{
				BunburrowStyle bunburrowStyle = AssetsManager.LevelsLists[BunburrowExtension.ToBunburrowName(bunburrow)][1].BunburrowStyle;
				Traverse val = Traverse.Create((object)__instance);
				val.Field<SpriteRenderer>("progressFirstDigitSpriteRenderer").Value.color = bunburrowStyle.SkyboxColor;
				val.Field<SpriteRenderer>("progressSecondDigitSpriteRenderer").Value.color = bunburrowStyle.SkyboxColor;
				val.Field<SpriteRenderer>("progressPercentSpriteRenderer").Value.color = bunburrowStyle.SkyboxColor;
				val.Field<SpriteRenderer>("requirementFirstDigitSpriteRenderer").Value.color = bunburrowStyle.SkyboxColor;
				val.Field<SpriteRenderer>("requirementSecondDigitSpriteRenderer").Value.color = bunburrowStyle.SkyboxColor;
				val.Field<SpriteRenderer>("completeIconSpriteRenderer").Value.color = bunburrowStyle.SignCompleteIconColor;
				val.Field<SpriteRenderer>("homeIconSpriteRenderer").Value.color = bunburrowStyle.SignHomeIconColor;
				((Renderer)val.Field<SpriteRenderer>("sign").Value).material.SetInt(val.Field<int>("ShouldGlitchHash").Value, 0);
				__instance.UpdateContent();
			}
		}
	}
}
namespace Bunject.Patches.BunburrowsListOfStylesPatches
{
	[HarmonyPatch]
	internal class IndexerPatch
	{
		private static MethodBase TargetMethod()
		{
			return typeof(BunburrowsListOfStyles).GetProperties().First((PropertyInfo pi) => pi.GetIndexParameters().Length == 1).GetGetMethod();
		}

		private static BunburrowStyle Postfix(BunburrowStyle __result, Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (bunburrow.IsCustomBunburrow())
			{
				return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow?.Style ?? __result;
			}
			return __result;
		}
	}
}
namespace Bunject.Patches.BunburrowExtensionPatches
{
	[HarmonyPatch(typeof(BunburrowExtension), "ToBunburrow", new Type[] { typeof(string) })]
	internal class ToBunburrowStringPatch
	{
		public static Bunburrow Postfix(Bunburrow __result, string bunburrowName)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			return ((Bunburrow?)BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ModBunburrow?.Name == bunburrowName)?.ID).GetValueOrDefault(__result);
		}
	}
	[HarmonyPatch(typeof(BunburrowExtension), "ToBunburrow", new Type[] { typeof(int) })]
	internal class ToBunburrowIntPatch
	{
		private static Bunburrow Postfix(Bunburrow __result, int bunburrowID)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (((Bunburrow)bunburrowID).IsCustomBunburrow())
			{
				return (Bunburrow)bunburrowID;
			}
			return __result;
		}
	}
	[HarmonyPatch(typeof(BunburrowExtension), "ToBunburrowName")]
	internal class ToBunburrowNamePatch
	{
		private static string Postfix(string __result, Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (bunburrow.IsCustomBunburrow())
			{
				return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow.Name;
			}
			return __result;
		}
	}
	[HarmonyPatch(typeof(BunburrowExtension), "ToComparisonIndex")]
	internal class ToComparisonIndexPatch
	{
		private static int Postfix(int __result, Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (bunburrow.IsCustomBunburrow())
			{
				return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ComparisonIndex ?? __result;
			}
			return __result;
		}
	}
	[HarmonyPatch(typeof(BunburrowExtension), "ToIndicator")]
	internal class ToIndicatorPatch
	{
		private static string Postfix(string __result, Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (bunburrow.IsCustomBunburrow())
			{
				return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow?.Indicator;
			}
			return __result;
		}
	}
	[HarmonyPatch(typeof(BunburrowExtension), "IsNonVoidBunburrow")]
	internal class IsNonVoidBunburrowPatch
	{
		private static bool Postfix(bool __result, Bunburrow bunburrow)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (bunburrow.IsCustomBunburrow())
			{
				return !BunburrowExtension.IsVoidBunburrow(bunburrow);
			}
			return __result;
		}
	}
	[HarmonyPatch(typeof(BunburrowExtension), "IsVoidBunburrow")]
	internal class IsVoidBunburrowPatch
	{
		private static bool Postfix(bool __result, Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (bunburrow.IsCustomBunburrow())
			{
				return (BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata bb) => bb.ID == (int)bunburrow)?.ModBunburrow?.IsVoid).GetValueOrDefault(__result);
			}
			return __result;
		}
	}
}
namespace Bunject.Patches.BunburrowEntryTilePatches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class ConstructorPatch
	{
		private static void Postfix(BunburrowEntryTile __instance)
		{
			Traverse val = Traverse.Create((object)__instance);
			Traverse<int> val2 = val.Field<int>("specialIndex");
			if (val2.Value > 10)
			{
				val.Field<Bunburrow?>("Bunburrow").Value = (Bunburrow)val2.Value;
				val.Field("isUnlocked").SetValue((object)true);
				val2.Value = -1;
			}
		}
	}
	[HarmonyPatch(typeof(BunburrowEntryTile), "HandleLevelReset")]
	internal class HandleLevelResetPatch
	{
		private static void Postfix(BunburrowEntryTile __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.Bunburrow.HasValue && __instance.Bunburrow.Value.IsCustomBunburrow())
			{
				IModBunburrow modBunburrow = __instance.Bunburrow.Value.GetModBunburrow();
				if (modBunburrow != null && !modBunburrow.HasEntrance)
				{
					GameManager.TileMaps.ExitsTileMap.SetTile(VectorConversions.ToVector3Int(((TileLevelData)__instance).Position), (TileBase)null);
				}
			}
		}
	}
}
namespace Bunject.Patches.AssetsManagerPatches
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	internal class LevelsListsPatch
	{
		private static void Prefix(ref ReadOnlyDictionary<string, LevelsList> value)
		{
			value = new ReadOnlyDictionary<string, LevelsList>(new InjectionDictionary<string, LevelsList>(AssetsManagerRewiring.LoadLevelsList, value));
		}
	}
}
namespace Bunject.Monitoring
{
	public interface IMonitor : IBunjectorPlugin
	{
		LevelObject OnLevelLoad(LevelObject level, LevelIdentity identity);

		string OnLevelTitle(string title, LevelIdentity identity, bool useWhite);

		LevelsList LoadEmergencyLevelsList(LevelsList original);

		void OnBunnyCapture(BunnyIdentity bunnyIdentity, bool wasHomeCapture);

		void OnMainMenu();

		void OnShowCredits();
	}
}
namespace Bunject.Menu
{
	public interface IMenuSource : IBunjectorPlugin
	{
		string MenuTitle { get; }

		void DrawMenuOptions();
	}
	internal class MenuDisplay : MonoBehaviour
	{
		private Rect windowRect = new Rect(20f, 20f, 0f, 0f);

		private List<IMenuSource> menuSources;

		private int activeMenu;

		private void OnGUI()
		{
			//IL_0038: 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_0073: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			menuSources = BunjectAPI.MenuOptions.ToList();
			if (menuSources.Count > 0)
			{
				activeMenu %= menuSources.Count;
				GUILayout.Window(0, windowRect, new WindowFunction(RenderWindow), "Bunject", (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.MinWidth(400f),
					GUILayout.MinHeight(50f)
				});
			}
		}

		private void RenderWindow(int windowId)
		{
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (menuSources.Count > 1)
			{
				if (GUILayout.Button("<", Array.Empty<GUILayoutOption>()))
				{
					activeMenu = (activeMenu + menuSources.Count - 1) % menuSources.Count;
				}
				GUILayout.Label(menuSources[activeMenu % menuSources.Count].MenuTitle, Array.Empty<GUILayoutOption>());
				if (GUILayout.Button(">", Array.Empty<GUILayoutOption>()))
				{
					activeMenu = (activeMenu + 1) % menuSources.Count;
				}
			}
			GUILayout.EndHorizontal();
			menuSources[activeMenu].DrawMenuOptions();
			GUILayout.EndVertical();
		}
	}
}
namespace Bunject.Levels
{
	internal class CoreBunburrow : IModBunburrow
	{
		private LevelsList levels;

		public string Name { get; }

		public string Indicator { get; }

		public bool IsVoid { get; }

		public int ID { get; set; }

		public BunburrowStyle Style { get; }

		public bool HasEntrance => true;

		public bool HasSign => true;

		public CoreBunburrow(string name, string indicator, bool isVoid)
		{
			Name = name;
			Indicator = indicator;
			IsVoid = isVoid;
		}

		public Vector2Int? OverrideSignCoordinate()
		{
			return null;
		}

		public LevelsList GetLevels()
		{
			if ((Object)(object)levels == (Object)null)
			{
				levels = AssetsManager.LevelsLists[Name];
			}
			return levels;
		}

		public LevelObject GetLevel(int depth)
		{
			return GetLevels()[depth];
		}

		public LevelObject GetSurfaceLevel()
		{
			return AssetsManager.SurfaceRightLevel;
		}
	}
	public interface IModBunburrow
	{
		int ID { get; set; }

		string Name { get; }

		string Indicator { get; }

		bool IsVoid { get; }

		BunburrowStyle Style { get; }

		bool HasEntrance { get; }

		bool HasSign { get; }

		Vector2Int? OverrideSignCoordinate();

		LevelsList GetLevels();

		LevelObject GetSurfaceLevel();
	}
	public enum LoadingContext
	{
		Metadata,
		LevelTransition
	}
	internal static class CurrentLoadingContext
	{
		public static LoadingContext Value { get; set; }
	}
	public class ModLevelObject : LevelObject
	{
		private Traverse traverse;

		public string BunburrowName { get; set; }

		public int Depth { get; set; }

		private Traverse Traverse
		{
			get
			{
				if (traverse == null)
				{
					traverse = Traverse.Create((object)this);
				}
				return traverse;
			}
		}

		public string CustomNameKey
		{
			get
			{
				return ((LevelObject)this).CustomNameKey;
			}
			set
			{
				Traverse.Field<string>("customNameKey").Value = value;
			}
		}

		public string Content
		{
			get
			{
				return ((LevelObject)this).Content;
			}
			set
			{
				Traverse.Field<string>("content").Value = value;
			}
		}

		public int NumberOfTraps
		{
			get
			{
				return ((LevelObject)this).NumberOfTraps;
			}
			set
			{
				Traverse.Field<int>("numberOfTraps").Value = value;
			}
		}

		public int NumberOfPickaxes
		{
			get
			{
				return ((LevelObject)this).NumberOfPickaxes;
			}
			set
			{
				Traverse.Field<int>("numberOfPickaxes").Value = value;
			}
		}

		public int NumberOfShovels
		{
			get
			{
				return ((LevelObject)this).NumberOfShovels;
			}
			set
			{
				Traverse.Field<int>("numberOfShovels").Value = value;
			}
		}

		public int NumberOfCarrots
		{
			get
			{
				return ((LevelObject)this).NumberOfCarrots;
			}
			set
			{
				Traverse.Field<int>("numberOfCarrots").Value = value;
			}
		}

		public BunburrowStyle BunburrowStyle
		{
			get
			{
				return ((LevelObject)this).BunburrowStyle;
			}
			set
			{
				Traverse.Field<BunburrowStyle>("bunburrowStyle").Value = value;
			}
		}

		public Sprite SpecificBackground
		{
			get
			{
				return ((LevelObject)this).SpecificBackground;
			}
			set
			{
				Traverse.Field<Sprite>("specificBackground").Value = value;
			}
		}

		public bool IsTemple
		{
			get
			{
				return ((LevelObject)this).IsTemple;
			}
			set
			{
				Traverse.Field<bool>("isTemple").Value = value;
			}
		}

		public bool IsHell
		{
			get
			{
				return ((LevelObject)this).IsHell;
			}
			set
			{
				Traverse.Field<bool>("isHell").Value = value;
			}
		}

		public bool IsSurface
		{
			get
			{
				return ((LevelObject)this).IsSurface;
			}
			set
			{
				Traverse.Field<bool>("isSurface").Value = value;
			}
		}

		public DirectionsListOf<LevelObject> SideLevels
		{
			get
			{
				return ((LevelObject)this).SideLevels;
			}
			set
			{
				Traverse.Field<DirectionsListOf<LevelObject>>("sideLevels").Value = value;
			}
		}

		public ModLevelObject()
		{
			Traverse.Field("dialogues").SetValue((object)new List<DialogueObject>());
			Traverse.Field("contextualDialogues").SetValue((object)new List<ContextualDialogueInfo>());
			SideLevels = new DirectionsListOf<LevelObject>((LevelObject)null, (LevelObject)null, (LevelObject)null, (LevelObject)null);
		}
	}
	public class ModLevelsList : LevelsList
	{
		private Traverse traverse;

		private Traverse<List<LevelObject>> traverseList;

		protected Traverse Traverse
		{
			get
			{
				if (traverse == null)
				{
					traverse = Traverse.Create((object)this);
				}
				return traverse;
			}
		}

		public int NumberOfRegularBunnies
		{
			get
			{
				return ((LevelsList)this).NumberOfRegularBunnies;
			}
			set
			{
				Traverse.Field<int>("numberOfRegularBunnies").Value = value;
			}
		}

		public int NumberOfTempleBunnies
		{
			get
			{
				return ((LevelsList)this).NumberOfTempleBunnies;
			}
			set
			{
				Traverse.Field<int>("numberOfTempleBunnies").Value = value;
			}
		}

		public int NumberOfHellBunnies
		{
			get
			{
				return ((LevelsList)this).NumberOfHellBunnies;
			}
			set
			{
				Traverse.Field<int>("numberOfHellBunnies").Value = value;
			}
		}

		public DirectionsListOf<LevelsList> AdjacentBunburrows
		{
			get
			{
				return ((LevelsList)this).AdjacentBunburrows;
			}
			set
			{
				Traverse.Field<DirectionsListOf<LevelsList>>("adjacentBunburrows").Value = value;
			}
		}

		public int TempleStartDepth
		{
			get
			{
				return ((LevelsList)this).TempleStartDepth;
			}
			set
			{
				Traverse.Field<int>("templeStartDepth").Value = value;
			}
		}

		public int HellStartDepth
		{
			get
			{
				return ((LevelsList)this).HellStartDepth;
			}
			set
			{
				Traverse.Field<int>("hellStartDepth").Value = value;
			}
		}

		private Traverse<List<LevelObject>> TraverseList
		{
			get
			{
				if (traverseList == null)
				{
					traverseList = Traverse.Field<List<LevelObject>>("list");
				}
				return traverseList;
			}
		}

		protected List<LevelObject> List => traverseList.Value;

		public int MaximumDepth
		{
			get
			{
				return TraverseList.Value.Count;
			}
			set
			{
				List<LevelObject> value2 = TraverseList.Value;
				if (value < value2.Count)
				{
					value2.RemoveRange(value, value2.Count - value);
				}
				else
				{
					value2.AddRange((IEnumerable<LevelObject>)(object)new LevelObject[value - value2.Count]);
				}
			}
		}

		public ModLevelObject this[int depth]
		{
			get
			{
				return TraverseList.Value[depth - 1] as ModLevelObject;
			}
			set
			{
				TraverseList.Value[depth - 1] = (LevelObject)(object)value;
			}
		}

		public ModLevelsList()
		{
			TraverseList.Value = new List<LevelObject>();
			AdjacentBunburrows = new DirectionsListOf<LevelsList>((LevelsList)null, (LevelsList)null, (LevelsList)null, (LevelsList)null);
		}

		public virtual LevelObject LoadLevel(int depth, LoadingContext loadingContext)
		{
			return (LevelObject)(object)this[depth];
		}
	}
}
namespace Bunject.Internal
{
	internal class AssetsManagerRewiring
	{
		internal static LevelsList LoadLevelsList(string name, LevelsList original)
		{
			LevelsList val = original;
			if ((Object)(object)original == (Object)null || original is ModLevelsList)
			{
				val = (LevelsList)(object)BunjectAPI.Forward.LoadLevelsList(name, original as ModLevelsList);
			}
			if ((Object)(object)val == (Object)null)
			{
				return BunjectAPI.Forward.LoadEmergencyLevelsList(null);
			}
			return val;
		}
	}
	internal class BunburrowManager
	{
		private static BunburrowManager instance;

		private List<BunburrowMetadata> bunburrows;

		private int maxID;

		internal static bool IsInitialized => instance != null;

		internal static IReadOnlyList<BunburrowMetadata> Bunburrows
		{
			get
			{
				if (!IsInitialized)
				{
					instance = new BunburrowManager();
				}
				return instance.bunburrows;
			}
		}

		public static int CustomBunburrowThreshold => 50;

		internal static void RegisterBurrow(IModBunburrow modBunburrow)
		{
			if (Bunburrows.Any((BunburrowMetadata bb) => bb.ModBunburrow.Name == modBunburrow.Name))
			{
				throw new ArgumentException("Bunburrow name " + modBunburrow.Name + " is already in use!  Please use a unique name.");
			}
			int num = ++instance.maxID;
			modBunburrow.ID = num;
			BunburrowMetadata item = new BunburrowMetadata
			{
				ID = num,
				ComparisonIndex = num,
				IsCustom = true,
				ModBunburrow = modBunburrow
			};
			instance.bunburrows.Add(item);
		}

		internal static void RegisterElevator(int bunburrowID, int depth)
		{
			BunburrowMetadata bunburrowMetadata = Bunburrows.FirstOrDefault((BunburrowMetadata x) => x.ID == bunburrowID);
			if (bunburrowMetadata == null)
			{
				throw new ArgumentException($"Bunburrow id {bunburrowID} does not exist!  Please use an existing id.");
			}
			if (!bunburrowMetadata.Elevators.Contains(depth))
			{
				bunburrowMetadata.Elevators.Add(depth);
			}
		}

		internal static void ClearRegisters()
		{
			instance.FullReset();
		}

		internal void FullReset()
		{
			bunburrows = (from burrowEnum in Enum.GetValues(typeof(Bunburrow)).OfType<Bunburrow>()
				select new BunburrowMetadata
				{
					ID = (int)burrowEnum,
					ComparisonIndex = BunburrowExtension.ToComparisonIndex(burrowEnum),
					IsCustom = false,
					ModBunburrow = new CoreBunburrow(BunburrowExtension.ToBunburrowName(burrowEnum), BunburrowExtension.ToIndicator(burrowEnum), BunburrowExtension.IsVoidBunburrow(burrowEnum))
				}).ToList();
			maxID = bunburrows.Max((BunburrowMetadata bb) => bb.ID) + CustomBunburrowThreshold;
		}

		private BunburrowManager()
		{
			FullReset();
		}
	}
	internal class BunburrowMetadata
	{
		public int ID { get; set; }

		public int ComparisonIndex { get; set; }

		public bool IsCustom { get; set; }

		public IModBunburrow ModBunburrow { get; set; }

		public List<int> Elevators { get; set; } = new List<int>();

	}
	internal static class BunnyReleaser
	{
		public static void NotifyReleased()
		{
			Delegate[] invocationList = Traverse.Create((object)GameManager.BunniesReleaseAnimator).Field<MulticastDelegate>("OnBunnyReleased").Value.GetInvocationList();
			foreach (Delegate @delegate in invocationList)
			{
				@delegate.Method.Invoke(@delegate.Target, new object[1] { false });
			}
		}
	}
	public static class CustomBunburrowExtension
	{
		[CompilerGenerated]
		private sealed class <GetRegularAndCustomBunbrrowEnumerator>d__4 : IEnumerable<Bunburrow>, IEnumerable, IEnumerator<Bunburrow>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private Bunburrow <>2__current;

			private int <>l__initialThreadId;

			private IEnumerator<BunburrowMetadata> <>7__wrap1;

			Bunburrow IEnumerator<Bunburrow>.Current
			{
				[DebuggerHidden]
				get
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <GetRegularAndCustomBunbrrowEnumerator>d__4(int <>1__state)
			{
				this.<>1__state = <>1__state;
				<>l__initialThreadId = Environment.CurrentManagedThreadId;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>7__wrap1 = BunburrowManager.Bunburrows.GetEnumerator();
						<>1__state = -3;
						break;
					case 1:
						<>1__state = -3;
						break;
					}
					if (<>7__wrap1.MoveNext())
					{
						BunburrowMetadata current = <>7__wrap1.Current;
						<>2__current = (Bunburrow)current.ID;
						<>1__state = 1;
						return true;
					}
					<>m__Finally1();
					<>7__wrap1 = null;
					return false;
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<>7__wrap1 != null)
				{
					<>7__wrap1.Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}

			[DebuggerHidden]
			IEnumerator<Bunburrow> IEnumerable<Bunburrow>.GetEnumerator()
			{
				if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
				{
					<>1__state = 0;
					return this;
				}
				return new <GetRegularAndCustomBunbrrowEnumerator>d__4(0);
			}

			[DebuggerHidden]
			IEnumerator IEnumerable.GetEnumerator()
			{
				return ((IEnumerable<Bunburrow>)this).GetEnumerator();
			}
		}

		public static bool IsVoidOrCustomBunburrow(this Bunburrow bunburrow)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!bunburrow.IsCustomBunburrow())
			{
				return BunburrowExtension.IsVoidBunburrow(bunburrow);
			}
			return true;
		}

		public static bool IsCoreBunburrow(this Bunburrow bunburrow)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return !bunburrow.IsVoidOrCustomBunburrow();
		}

		public static bool IsCustomBunburrow(this Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if ((int)bunburrow > BunburrowManager.CustomBunburrowThreshold)
			{
				return BunburrowManager.Bunburrows.Any((BunburrowMetadata x) => x.ID == (int)bunburrow);
			}
			return false;
		}

		public static IModBunburrow GetModBunburrow(this Bunburrow bunburrow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata x) => x.ID == (int)bunburrow)?.ModBunburrow;
		}

		[IteratorStateMachine(typeof(<GetRegularAndCustomBunbrrowEnumerator>d__4))]
		public static IEnumerable<Bunburrow> GetRegularAndCustomBunbrrowEnumerator()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GetRegularAndCustomBunbrrowEnumerator>d__4(-2);
		}
	}
	internal class ElevatorManager
	{
		[CompilerGenerated]
		private sealed class <ExtractElevatorProgression>d__10 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ExtractElevatorProgression>d__10(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				if (IsInitialized)
				{
					instance.elevatorCache.Clear();
				}
				foreach (string unlockedElevator in GameManager.GeneralProgression.UnlockedElevators)
				{
					if (IsValidSave(unlockedElevator) && !IsElevatorUnlock(unlockedElevator, out var _))
					{
						LevelIdentity key;
						try
						{
							key = JsonConvert.DeserializeObject<LevelIdentitySaveData>(unlockedElevator).BuildLevelIdentity();
						}
						catch
						{
							continue;
						}
						instance.elevatorCache.Add(key, unlockedElevator);
					}
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static ElevatorManager instance;

		private readonly Dictionary<LevelIdentity, string> elevatorCache;

		internal static bool IsInitialized => instance != null;

		internal static IReadOnlyDictionary<LevelIdentity, string> Elevators
		{
			get
			{
				if (!IsInitialized)
				{
					instance = new ElevatorManager();
				}
				return instance.elevatorCache;
			}
		}

		private static bool IsValidSave(string elevatorData)
		{
			return !string.IsNullOrWhiteSpace(elevatorData);
		}

		public static bool IsElevatorUnlock(LevelIdentity level, out string elevatorData)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (Elevators.TryGetValue(level, out elevatorData))
			{
				return IsValidSave(elevatorData);
			}
			return false;
		}

		public static bool IsElevatorUnlock(string elevatorData, out LevelIdentity level)
		{
			//IL_0055: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			if (IsValidSave(elevatorData) && Elevators.Values.Contains(elevatorData))
			{
				level = Elevators.Keys.First((LevelIdentity l) => Elevators[l] == elevatorData);
				return true;
			}
			level = default(LevelIdentity);
			return false;
		}

		public static bool UnlockElevator(Bunburrow burrow, int depth, out string elevatorData)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return ElevatorUnlock(new LevelIdentity(burrow, depth), out elevatorData);
		}

		public static bool ElevatorUnlock(LevelIdentity level, out string elevatorData)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (IsElevatorUnlock(level, out elevatorData))
			{
				return false;
			}
			if (!level.Bunburrow.IsCustomBunburrow() || !BunburrowManager.Bunburrows.Any((BunburrowMetadata burrow) => burrow.ID == (int)level.Bunburrow && burrow.Elevators.Contains(level.Depth)))
			{
				elevatorData = "";
				if (!instance.elevatorCache.ContainsKey(level))
				{
					instance.elevatorCache.Add(level, elevatorData);
				}
				return false;
			}
			elevatorData = JsonConvert.SerializeObject((object)((LevelIdentity)(ref level)).ProduceSaveData());
			instance.elevatorCache.Add(level, elevatorData);
			return true;
		}

		[IteratorStateMachine(typeof(<ExtractElevatorProgression>d__10))]
		public static IEnumerator ExtractElevatorProgression()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ExtractElevatorProgression>d__10(0);
		}

		private ElevatorManager()
		{
			elevatorCache = new Dictionary<LevelIdentity, string>();
		}
	}
	internal class ForwardingBunjector : IBunjectorPlugin, ITileSource, IMonitor, IMenuSource, IComputerTabSource
	{
		public string MenuTitle
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		private GameObject PluginMenuObject { get; set; }

		public void OnAssetsLoaded()
		{
			foreach (IBunjectorPlugin bunjector in BunjectAPI.Bunjectors)
			{
				bunjector.OnAssetsLoaded();
			}
		}

		public void OnProgressionLoaded(GeneralProgression progression)
		{
			foreach (IBunjectorPlugin bunjector in BunjectAPI.Bunjectors)
			{
				bunjector.OnProgressionLoaded(progression);
			}
		}

		public ModLevelsList LoadLevelsList(string name, ModLevelsList original)
		{
			BunburrowMetadata bunburrowMetadata = BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata mb) => mb.ModBunburrow.Name == name);
			if (bunburrowMetadata != null && bunburrowMetadata.IsCustom)
			{
				return (ModLevelsList)(object)bunburrowMetadata.ModBunburrow.GetLevels();
			}
			return original;
		}

		public LevelObject LoadBurrowSurfaceLevel(string listName, LevelObject otherwise)
		{
			return BunburrowManager.Bunburrows.FirstOrDefault((BunburrowMetadata mb) => mb.ModBunburrow.Name == listName)?.ModBunburrow?.GetSurfaceLevel() ?? otherwise;
		}

		public LevelObject OnLevelLoad(LevelObject target, LevelIdentity identity)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			LevelObject val = target;
			foreach (IMonitor monitor in BunjectAPI.Monitors)
			{
				val = monitor.OnLevelLoad(val, identity);
			}
			return val;
		}

		public LevelsList LoadEmergencyLevelsList(LevelsList original)
		{
			LevelsList val = original;
			foreach (IMonitor monitor in BunjectAPI.Monitors)
			{
				val = monitor.LoadEmergencyLevelsList(val);
			}
			return val;
		}

		public void OnBunnyCapture(BunnyIdentity bunnyIdentity, bool wasHomeCapture)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			foreach (IMonitor monitor in BunjectAPI.Monitors)
			{
				monitor.OnBunnyCapture(bunnyIdentity, wasHomeCapture);
			}
		}

		public void OnMainMenu()
		{
			foreach (IMonitor monitor in BunjectAPI.Monitors)
			{
				monitor.OnMainMenu();
			}
		}

		public string OnLevelTitle(string title, LevelIdentity identity, bool useWhite)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			foreach (IMonitor monitor in BunjectAPI.Monitors)
			{
				title = monitor.OnLevelTitle(title, identity, useWhite);
			}
			return title;
		}

		public void OnShowCredits()
		{
			foreach (IMonitor monitor in BunjectAPI.Monitors)
			{
				monitor.OnShowCredits();
			}
		}

		public bool SupportsTile(string tile)
		{
			return BunjectAPI.TileSources.Any((ITileSource ts) => ts.SupportsTile(tile));
		}

		public Tile LoadTile(LevelObject levelObject, string tile, Vector2Int position)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			return BunjectAPI.TileSources.FirstOrDefault((ITileSource ts) => ts.SupportsTile(tile))?.LoadTile(levelObject, tile, position);
		}

		public void DrawMenuOptions()
		{
			throw new NotImplementedException();
		}

		internal void ShowOrHideMenu(bool showMenu)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			if ((Object)(object)PluginMenuObject == (Object)null)
			{
				PluginMenuObject = new GameObject();
				PluginMenuObject.AddComponent<MenuDisplay>();
			}
			PluginMenuObject.SetActive(showMenu);
		}

		public void GenerateTabs(ComputerTabManager manager)
		{
			foreach (IComputerTabSource computerTabSource in BunjectAPI.ComputerTabSources)
			{
				computerTabSource.GenerateTabs(manager);
			}
		}
	}
	[HarmonyPatch]
	internal static class LevelBuilderExtensions
	{
		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(LevelBuilder), "GetTileInListByCoordinates")]
		public static TileLevelData GetTileInListByCoordinates(List<TileLevelData> tiles, int row, int col)
		{
			throw new NotImplementedException("Implementation overwritten by harmony reverse patch");
		}
	}
	public static class SaveFileModUtility
	{
		private static Func<string> getRootSaveDataPathLambda;

		private static bool initialized;

		public static string GetRootSaveDataPath()
		{
			Initialize();
			return getRootSaveDataPathLambda();
		}

		public static string GetPluginSaveDirectory(string pluginName)
		{
			return Path.Combine(GetRootSaveDataPath(), pluginName);
		}

		public static string GetPluginSaveFilePath(string pluginName, string saveName)
		{
			return Path.Combine(GetPluginSaveDirectory(pluginName), saveName +