Decompiled source of ULTRAROGUE v0.1.1

Ultrarogue.dll

Decompiled 11 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using TMPro;
using ULTRAKILL.Portal;
using ULTRAKILL.Portal.Geometry;
using Ultrarogue;
using Ultrarogue.Characters;
using Ultrarogue.Items;
using Ultrarogue.SceneStuff;
using Unity.AI.Navigation;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.Events;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
using UnityEngine.ResourceManagement.ResourceProviders;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("Ultrarogue")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+61e70fc5f36b0587681a9c82cb132806303c81d2")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("Ultrarogue")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class AssetsManager
{
	[CompilerGenerated]
	private sealed class <GetAllEnemies>d__21 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private AsyncOperationHandle<IResourceLocator> <initHandle>5__1;

		private List<IResourceLocation> <allLocations>5__2;

		private int <enemyCount>5__3;

		private IEnumerator<IResourceLocator> <>s__4;

		private IResourceLocator <locator>5__5;

		private List<object> <keys>5__6;

		private AsyncOperationHandle<IList<IResourceLocation>> <locHandle>5__7;

		private List<IResourceLocation>.Enumerator <>s__8;

		private IResourceLocation <location>5__9;

		private AsyncOperationHandle<SpawnableObject> <loadHandle>5__10;

		private SpawnableObject <obj>5__11;

		private Dictionary<EnemyType, List<SpawnableObject>>.Enumerator <>s__12;

		private KeyValuePair<EnemyType, List<SpawnableObject>> <kvp>5__13;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			case -3:
			case 2:
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
				break;
			case -4:
			case 3:
				try
				{
				}
				finally
				{
					<>m__Finally2();
				}
				break;
			}
			<initHandle>5__1 = default(AsyncOperationHandle<IResourceLocator>);
			<allLocations>5__2 = null;
			<>s__4 = null;
			<locator>5__5 = null;
			<keys>5__6 = null;
			<locHandle>5__7 = default(AsyncOperationHandle<IList<IResourceLocation>>);
			<>s__8 = default(List<IResourceLocation>.Enumerator);
			<location>5__9 = null;
			<loadHandle>5__10 = default(AsyncOperationHandle<SpawnableObject>);
			<obj>5__11 = null;
			<>s__12 = default(Dictionary<EnemyType, List<SpawnableObject>>.Enumerator);
			<kvp>5__13 = default(KeyValuePair<EnemyType, List<SpawnableObject>>);
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Invalid comparison between Unknown and I4
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Invalid comparison between Unknown and I4
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Invalid comparison between Unknown and I4
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<initHandle>5__1 = Addressables.InitializeAsync();
					<>2__current = <initHandle>5__1;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<allLocations>5__2 = new List<IResourceLocation>();
					<>s__4 = Addressables.ResourceLocators.GetEnumerator();
					<>1__state = -3;
					goto IL_0168;
				case 2:
					<>1__state = -3;
					if ((int)<locHandle>5__7.Status == 1)
					{
						<allLocations>5__2.AddRange(<locHandle>5__7.Result);
					}
					Addressables.Release<IList<IResourceLocation>>(<locHandle>5__7);
					<keys>5__6 = null;
					<locHandle>5__7 = default(AsyncOperationHandle<IList<IResourceLocation>>);
					<locator>5__5 = null;
					goto IL_0168;
				case 3:
					{
						<>1__state = -4;
						if ((int)<loadHandle>5__10.Status != 1)
						{
							break;
						}
						<obj>5__11 = <loadHandle>5__10.Result;
						if ((int)<obj>5__11.spawnableObjectType == 1)
						{
							if (!enemiesByType.ContainsKey(<obj>5__11.enemyType))
							{
								enemiesByType[<obj>5__11.enemyType] = new List<SpawnableObject>();
							}
							enemiesByType[<obj>5__11.enemyType].Add(<obj>5__11);
							<enemyCount>5__3++;
							<loadHandle>5__10 = default(AsyncOperationHandle<SpawnableObject>);
							<obj>5__11 = null;
							<location>5__9 = null;
						}
						break;
					}
					IL_0168:
					while (<>s__4.MoveNext())
					{
						<locator>5__5 = <>s__4.Current;
						<keys>5__6 = <locator>5__5.Keys.ToList();
						if (<keys>5__6.Count == 0)
						{
							continue;
						}
						<locHandle>5__7 = Addressables.LoadResourceLocationsAsync((IList<object>)<keys>5__6, (MergeMode)1, typeof(SpawnableObject));
						<>2__current = <locHandle>5__7;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>s__4 = null;
					<allLocations>5__2 = (from l in <allLocations>5__2
						group l by l.InternalId into g
						select g.First()).ToList();
					Plugin.Logger.LogInfo((object)$"Found {<allLocations>5__2.Count} SpawnableObject locations");
					<enemyCount>5__3 = 0;
					<>s__8 = <allLocations>5__2.GetEnumerator();
					<>1__state = -4;
					break;
				}
				if (<>s__8.MoveNext())
				{
					<location>5__9 = <>s__8.Current;
					<loadHandle>5__10 = Addressables.LoadAssetAsync<SpawnableObject>(<location>5__9);
					<>2__current = <loadHandle>5__10;
					<>1__state = 3;
					return true;
				}
				<>m__Finally2();
				<>s__8 = default(List<IResourceLocation>.Enumerator);
				Plugin.Logger.LogInfo((object)$"Loaded {<enemyCount>5__3} enemy SpawnableObjects across {enemiesByType.Count} type(s).");
				<>s__12 = enemiesByType.GetEnumerator();
				try
				{
					while (<>s__12.MoveNext())
					{
						<kvp>5__13 = <>s__12.Current;
						Plugin.Logger.LogInfo((object)$"  {<kvp>5__13.Key}: {<kvp>5__13.Value.Count} variant(s)");
						<kvp>5__13 = default(KeyValuePair<EnemyType, List<SpawnableObject>>);
					}
				}
				finally
				{
					((IDisposable)<>s__12).Dispose();
				}
				<>s__12 = default(Dictionary<EnemyType, List<SpawnableObject>>.Enumerator);
				OnLoadComplete();
				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 (<>s__4 != null)
			{
				<>s__4.Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -1;
			((IDisposable)<>s__8).Dispose();
		}

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

	[CompilerGenerated]
	private sealed class <GetAllSpawnables>d__20 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		private AsyncOperationHandle<IResourceLocator> <initHandle>5__1;

		private List<IResourceLocation> <allLocations>5__2;

		private IEnumerator<IResourceLocator> <>s__3;

		private IResourceLocator <locator>5__4;

		private List<object> <keys>5__5;

		private AsyncOperationHandle<IList<IResourceLocation>> <locHandle>5__6;

		private List<IResourceLocation>.Enumerator <>s__7;

		private IResourceLocation <location>5__8;

		private AsyncOperationHandle<WeaponDescriptor> <loadHandle>5__9;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			case -3:
			case 2:
				try
				{
				}
				finally
				{
					<>m__Finally1();
				}
				break;
			case -4:
			case 3:
				try
				{
				}
				finally
				{
					<>m__Finally2();
				}
				break;
			}
			<initHandle>5__1 = default(AsyncOperationHandle<IResourceLocator>);
			<allLocations>5__2 = null;
			<>s__3 = null;
			<locator>5__4 = null;
			<keys>5__5 = null;
			<locHandle>5__6 = default(AsyncOperationHandle<IList<IResourceLocation>>);
			<>s__7 = default(List<IResourceLocation>.Enumerator);
			<location>5__8 = null;
			<loadHandle>5__9 = default(AsyncOperationHandle<WeaponDescriptor>);
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Invalid comparison between Unknown and I4
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Invalid comparison between Unknown and I4
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<initHandle>5__1 = Addressables.InitializeAsync();
					<>2__current = <initHandle>5__1;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<allLocations>5__2 = new List<IResourceLocation>();
					<>s__3 = Addressables.ResourceLocators.GetEnumerator();
					<>1__state = -3;
					goto IL_0168;
				case 2:
					<>1__state = -3;
					if ((int)<locHandle>5__6.Status == 1)
					{
						<allLocations>5__2.AddRange(<locHandle>5__6.Result);
					}
					Addressables.Release<IList<IResourceLocation>>(<locHandle>5__6);
					<keys>5__5 = null;
					<locHandle>5__6 = default(AsyncOperationHandle<IList<IResourceLocation>>);
					<locator>5__4 = null;
					goto IL_0168;
				case 3:
					{
						<>1__state = -4;
						if ((int)<loadHandle>5__9.Status == 1)
						{
							descriptors.Add(<loadHandle>5__9.Result);
						}
						<loadHandle>5__9 = default(AsyncOperationHandle<WeaponDescriptor>);
						<location>5__8 = null;
						break;
					}
					IL_0168:
					while (<>s__3.MoveNext())
					{
						<locator>5__4 = <>s__3.Current;
						<keys>5__5 = <locator>5__4.Keys.ToList();
						if (<keys>5__5.Count == 0)
						{
							continue;
						}
						<locHandle>5__6 = Addressables.LoadResourceLocationsAsync((IList<object>)<keys>5__5, (MergeMode)1, typeof(WeaponDescriptor));
						<>2__current = <locHandle>5__6;
						<>1__state = 2;
						return true;
					}
					<>m__Finally1();
					<>s__3 = null;
					<allLocations>5__2 = (from l in <allLocations>5__2
						group l by l.InternalId into g
						select g.First()).ToList();
					Plugin.Logger.LogInfo((object)$"Found {<allLocations>5__2.Count} WeaponDescriptor locations");
					<>s__7 = <allLocations>5__2.GetEnumerator();
					<>1__state = -4;
					break;
				}
				if (<>s__7.MoveNext())
				{
					<location>5__8 = <>s__7.Current;
					<loadHandle>5__9 = Addressables.LoadAssetAsync<WeaponDescriptor>(<location>5__8);
					<>2__current = <loadHandle>5__9;
					<>1__state = 3;
					return true;
				}
				<>m__Finally2();
				<>s__7 = default(List<IResourceLocation>.Enumerator);
				OnLoadComplete();
				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 (<>s__3 != null)
			{
				<>s__3.Dispose();
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -1;
			((IDisposable)<>s__7).Dispose();
		}

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

	public static List<WeaponDescriptor> descriptors = new List<WeaponDescriptor>();

	public static Material weaponMat;

	public static GameObject Agony;

	public static GameObject Tundra;

	public static Dictionary<EnemyType, List<SpawnableObject>> enemiesByType = new Dictionary<EnemyType, List<SpawnableObject>>();

	private static int _loadsDone = 0;

	private const int TotalLoads = 2;

	public static GameObject napalmProj;

	public static GameObject mindflayerBeam;

	public static GameObject funnyPowerIntroSpawn;

	public static AudioClip StalkerWarning;

	public static Sprite ArmFeedbacker;

	public static Sprite ArmKnuckleBlaster;

	public static Sprite ArmWhiplash;

	public static bool IsReady { get; private set; } = false;


	public static void Init()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)Plugin.Instance).StartCoroutine(GetAllSpawnables());
		((MonoBehaviour)Plugin.Instance).StartCoroutine(GetAllEnemies());
		if ((Object)(object)napalmProj == (Object)null)
		{
			napalmProj = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/GasolineProjectile.prefab").WaitForCompletion();
		}
		if ((Object)(object)Agony == (Object)null)
		{
			Agony = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Enemies/SwordsMachine Agony.prefab").WaitForCompletion();
		}
		if ((Object)(object)funnyPowerIntroSpawn == (Object)null)
		{
			funnyPowerIntroSpawn = Addressables.LoadAssetAsync<EndlessEnemy>((object)"Assets/Data/Cyber Grind Patterns/Data/PowerEndlessData.asset").WaitForCompletion().prefab;
		}
		if ((Object)(object)Tundra == (Object)null)
		{
			Tundra = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Enemies/SwordsMachine Tundra.prefab").WaitForCompletion();
		}
		if ((Object)(object)mindflayerBeam == (Object)null)
		{
			mindflayerBeam = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Hitscan Beams/Mindflayer Beam.prefab").WaitForCompletion();
		}
		if ((Object)(object)StalkerWarning == (Object)null)
		{
			StalkerWarning = Addressables.LoadAssetAsync<AudioClip>((object)"Assets/Sounds/Enemies/StalkerWarning.wav").WaitForCompletion();
		}
		if ((Object)(object)ArmFeedbacker == (Object)null)
		{
			ArmFeedbacker = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/ArmFeedbacker.png").WaitForCompletion();
		}
		if ((Object)(object)ArmKnuckleBlaster == (Object)null)
		{
			ArmKnuckleBlaster = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/ArmKnuckleblaster.png").WaitForCompletion();
		}
		if ((Object)(object)ArmWhiplash == (Object)null)
		{
			ArmWhiplash = Addressables.LoadAssetAsync<Sprite>((object)"Assets/Textures/UI/ArmWhiplash.png").WaitForCompletion();
		}
	}

	private static void OnLoadComplete()
	{
		_loadsDone++;
		if (_loadsDone >= 2)
		{
			IsReady = true;
			Plugin.Logger.LogInfo((object)($"AssetsManager ready — {descriptors.Count} weapon descriptors, " + $"{enemiesByType.Values.Sum((List<SpawnableObject> l) => l.Count)} enemies across " + $"{enemiesByType.Count} type(s) loaded."));
		}
	}

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

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

	public static Sprite prefToDescriptor(string pref, bool alternate)
	{
		if (!IsReady)
		{
			Plugin.Logger.LogWarning((object)("prefToDescriptor called before assets finished loading! pref=" + pref));
			return null;
		}
		char c = pref.Last();
		if (pref.Contains("rev"))
		{
			IEnumerable<WeaponDescriptor> source = descriptors.Where((WeaponDescriptor x) => x.weaponName.StartsWith((!alternate) ? "Revolver" : "Alternative Revolver"));
			switch (c)
			{
			case '0':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Pierce"))).icon;
			case '1':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Twirl"))).icon;
			case '2':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Ricochet"))).icon;
			}
		}
		else if (pref.Contains("sho"))
		{
			IEnumerable<WeaponDescriptor> source = descriptors.Where((WeaponDescriptor x) => x.weaponName.StartsWith((!alternate) ? "Shotgun" : "Hammer"));
			switch (c)
			{
			case '0':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Grenade"))).icon;
			case '1':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Pump"))).icon;
			case '2':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Saw"))).icon;
			}
		}
		else if (pref.Contains("nai"))
		{
			IEnumerable<WeaponDescriptor> source = descriptors.Where((WeaponDescriptor x) => x.weaponName.StartsWith((!alternate) ? "Nailgun" : "Sawblade Launcher"));
			switch (c)
			{
			case '0':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Magnet"))).icon;
			case '1':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Overheat"))).icon;
			case '2':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Jumpstart"))).icon;
			}
		}
		else if (pref.Contains("rai"))
		{
			IEnumerable<WeaponDescriptor> source = descriptors.Where((WeaponDescriptor x) => x.weaponName.StartsWith("Railcannon"));
			switch (c)
			{
			case '0':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Electric"))).icon;
			case '1':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Harpoon"))).icon;
			case '2':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Malicious"))).icon;
			}
		}
		else if (pref.Contains("rock"))
		{
			IEnumerable<WeaponDescriptor> source = descriptors.Where((WeaponDescriptor x) => x.weaponName.StartsWith("Rocket Launcher"));
			switch (c)
			{
			case '0':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Freeze"))).icon;
			case '1':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Cannonball"))).icon;
			case '2':
				return source.FirstOrDefault((Func<WeaponDescriptor, bool>)((WeaponDescriptor x) => x.weaponName.EndsWith("Napalm"))).icon;
			}
		}
		else if (pref.Contains("arm"))
		{
			switch (c)
			{
			case '0':
				return ArmFeedbacker;
			case '1':
				return ArmKnuckleBlaster;
			case '2':
				return ArmWhiplash;
			}
		}
		Plugin.Logger.LogWarning((object)("prefToDescriptor: no match for pref='" + pref + "'"));
		return descriptors.Find((WeaponDescriptor x) => x.weaponName == "UNKNOWN").icon;
	}

	public static List<SpawnableObject> GetEnemiesOfType(EnemyType type)
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		if (!IsReady)
		{
			Plugin.Logger.LogWarning((object)"GetEnemiesOfType called before assets finished loading!");
			return null;
		}
		List<SpawnableObject> value;
		return enemiesByType.TryGetValue(type, out value) ? value : new List<SpawnableObject>();
	}
}
public class Missle : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <ActivateHoming>d__12 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Missle <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(<>4__this.homingDelay);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.homingActive = true;
				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();
		}
	}

	public EnemyIdentifier enemyThatGotHit;

	private EnemyIdentifier target;

	public float speed = 25f;

	public float upwardForce = 15f;

	public float homingDelay = 0.5f;

	public float turnSpeed = 5f;

	public float damage = 10f;

	public float explosionRadius = 0.1f;

	private bool homingActive = false;

	private Rigidbody rb;

	private bool kaboomed = false;

	private void Start()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		rb = ((Component)this).GetComponent<Rigidbody>();
		rb.velocity = Vector3.up * upwardForce;
		target = enemyThatGotHit;
		((MonoBehaviour)this).StartCoroutine(ActivateHoming());
	}

	[IteratorStateMachine(typeof(<ActivateHoming>d__12))]
	private IEnumerator ActivateHoming()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ActivateHoming>d__12(0)
		{
			<>4__this = this
		};
	}

	private void FixedUpdate()
	{
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		if (!homingActive)
		{
			return;
		}
		if ((Object)(object)target == (Object)null || target.dead)
		{
			List<EnemyIdentifier> currentEnemies = MonoSingleton<EnemyTracker>.Instance.GetCurrentEnemies();
			if (currentEnemies.Count <= 0)
			{
				return;
			}
			target = currentEnemies[Random.Range(0, currentEnemies.Count)];
		}
		Vector3 val = (((Object)(object)target.weakPoint == (Object)null) ? ((Component)target).transform.position : target.weakPoint.transform.position);
		Vector3 val2 = val - ((Component)this).transform.position;
		Vector3 normalized = ((Vector3)(ref val2)).normalized;
		Vector3 velocity = Vector3.Lerp(rb.velocity, normalized * speed, turnSpeed * Time.fixedDeltaTime);
		rb.velocity = velocity;
		Transform transform = ((Component)this).transform;
		val2 = rb.velocity;
		transform.forward = ((Vector3)(ref val2)).normalized;
	}

	private void OnTriggerEnter(Collider col)
	{
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)((Component)col).gameObject.GetComponent<NewMovement>()) && LayerMaskDefaults.IsMatchingLayer(((Component)col).gameObject.layer, (LMD)3) && !kaboomed)
		{
			kaboomed = true;
			Plugin.Logger.LogInfo((object)("I hit " + ((Object)((Component)col).gameObject).name));
			EnemyIdentifierIdentifier component = ((Component)col).gameObject.GetComponent<EnemyIdentifierIdentifier>();
			EnemyIdentifier val = (((Object)(object)component == (Object)null) ? ((Component)col).gameObject.GetComponent<EnemyIdentifier>() : component.eid);
			if ((Object)(object)val != (Object)null)
			{
				val.hitter = "missle";
				val.DeliverDamage(((Component)col).gameObject, Vector3.zero, ((Component)component).transform.position, damage, false, 0f, (GameObject)null, false, false);
			}
			Explode();
		}
	}

	private void Explode()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(MonoSingleton<DefaultReferenceManager>.Instance.explosion, ((Component)this).transform.position, Quaternion.identity);
		Explosion[] componentsInChildren = val.GetComponentsInChildren<Explosion>();
		foreach (Explosion val2 in componentsInChildren)
		{
			val2.maxSize = explosionRadius;
			val2.canHit = (AffectedSubjects)2;
			val2.damage = Mathf.RoundToInt(damage) * 2;
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}
}
public class ExecuteOnSceneLoadRogue : MonoBehaviour
{
	[Tooltip("Lower value ExecuteOnSceneLoad are executed first")]
	public int relativeExecutionOrder = 0;

	public UnityEvent onSceneLoad;

	public void Execute()
	{
		if (onSceneLoad != null)
		{
			onSceneLoad.Invoke();
		}
	}
}
[Serializable]
public class LayerInfoRogue
{
	public string layerName = "";

	public string[] layerLevels = new string[0];
}
public class FirstRoomSpawnerRogue : MonoBehaviour, ISerializationCallbackReceiver
{
	[HideInInspector]
	internal class PlayerForcedMovement : MonoBehaviour
	{
		public NewMovement player;

		private Rigidbody rb;

		public static float defaultMoveForce = 67f;

		public float force = defaultMoveForce;

		public void Awake()
		{
			if ((Object)(object)player == (Object)null)
			{
				player = MonoSingleton<NewMovement>.Instance;
			}
			rb = ((Component)player).GetComponent<Rigidbody>();
			rb.useGravity = false;
		}

		public void LateUpdate()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			rb.velocity = new Vector3(0f, force, 0f);
		}

		public void DestroyComp()
		{
			rb.useGravity = true;
			Object.Destroy((Object)(object)this);
		}
	}

	[HideInInspector]
	private class LocalMoveTowards : MonoBehaviour
	{
		public Vector3 targetLocalPosition;

		public bool active = false;

		public float speed = 10f;

		public void Update()
		{
			//IL_001c: 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_0033: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			if (active)
			{
				((Component)this).transform.localPosition = Vector3.MoveTowards(((Component)this).transform.localPosition, targetLocalPosition, Time.deltaTime * speed);
				if (((Component)this).transform.localPosition == targetLocalPosition)
				{
					Object.Destroy((Object)(object)this);
				}
			}
		}

		public void Activate()
		{
			active = true;
		}
	}

	[HideInInspector]
	private class CustomHellmapCursor : MonoBehaviour
	{
		public Vector2 targetPosition;

		public Image targetImage;

		public AudioSource aud;

		private bool white = true;

		private RectTransform rect;

		private void Start()
		{
			rect = ((Component)this).GetComponent<RectTransform>();
			((MonoBehaviour)this).Invoke("FlashImage", 0.075f);
		}

		private void Update()
		{
			//IL_000d: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			rect.anchoredPosition = Vector2.MoveTowards(rect.anchoredPosition, targetPosition, Time.deltaTime * 4f * Vector3.Distance(Vector2.op_Implicit(rect.anchoredPosition), Vector2.op_Implicit(targetPosition)));
		}

		private void FlashImage()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			if (white)
			{
				white = false;
				((Graphic)targetImage).color = new Color(0f, 0f, 0f, 0f);
				if (!((Component)this).gameObject.activeSelf)
				{
					return;
				}
				aud.Play();
			}
			else
			{
				white = true;
				((Graphic)targetImage).color = Color.white;
			}
			if (((Component)this).gameObject.activeInHierarchy)
			{
				((MonoBehaviour)this).Invoke("FlashImage", 0.075f);
			}
		}
	}

	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static UnityAction <>9__36_5;

		public static Func<GameObject, Transform> <>9__37_1;

		public static Func<GameObject, OnLevelStart> <>9__37_2;

		public static Func<GameObject, bool> <>9__37_4;

		internal void <ConvertToAscendingFirstRoom>b__36_5()
		{
			//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)
			MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
		}

		internal Transform <Spawn>b__37_1(GameObject go)
		{
			return go.transform;
		}

		internal OnLevelStart <Spawn>b__37_2(GameObject go)
		{
			return go.GetComponent<OnLevelStart>();
		}

		internal bool <Spawn>b__37_4(GameObject o)
		{
			return ((Object)o).name == "Canvas";
		}
	}

	[Tooltip("Player will be moved to this position if the room is not ascending variant. If null, default position is used")]
	public Transform playerSpawnPos;

	[Tooltip("If set to true, room will not be deleted. Else, it will be replaced in game")]
	public bool doNotReplace = false;

	[Header("Replace Settings")]
	[Tooltip("Enabling this field causes room to be spawned as the secret variant")]
	public bool secretRoom = false;

	[Tooltip("Enabling this field causes room to be spawned as the prime variant")]
	public bool primeRoom = false;

	[Tooltip("Enabling this field causes room to be spawned as the encore variant")]
	public bool encoreRoom = false;

	[HideInInspector]
	[Tooltip("Enabling this field causes the whole room to be converted into the ascending variant where the player is spawned at the bottom and ascends upwards instead of falling")]
	public bool convertToUpwardRoom = false;

	[HideInInspector]
	[Tooltip("This clip will be played when the trap door closes beneath the player for ascending rooms")]
	public AudioClip upwardRoomDoorCloseClip;

	[HideInInspector]
	[Tooltip("If bottom part of the ascending room collides with out of bounds triggers, this list can temporarely disable them while the player is ascending")]
	public List<GameObject> upwardRoomOutOfBoundsToDisable;

	[Header("Player Fields")]
	[Space(10f)]
	public CameraClearFlags cameraFillMode = (CameraClearFlags)2;

	public Color backgroundColor = Color.black;

	[Header("Level Fields")]
	[Space(10f)]
	[Tooltip("If set to true, level title will be displayed when the door is opened")]
	public bool displayLevelTitle = true;

	[Tooltip("If set to true, music will start when the door is opened")]
	public bool startMusic = true;

	[Header("Hellmap")]
	[Tooltip("Enable the layer and level map when the player spawn")]
	[Space(10f)]
	public bool enableHellMap = false;

	[Tooltip("Sound clip which is played for each beep while falling")]
	public AudioClip hellmapBeepClip;

	[Tooltip("Each layer has a layer name and number of levels. For limbo the header is LIMBO and levels are [1-1, 1-2, 1-3, 1-4]")]
	public List<LayerInfoRogue> layersAndLevels = new List<LayerInfoRogue>();

	[HideInInspector]
	public List<int> levelSizes = new List<int>();

	[HideInInspector]
	public List<string> layerNames = new List<string>();

	[HideInInspector]
	public List<string> levelNames = new List<string>();

	[Tooltip("Which layer the cursor starts from. First layer is 0 and at the top")]
	public int layerIndexToStartFrom;

	[Tooltip("Which level in the layer the cursor starts from. The first level is 0 and is just below the layer title (the uppermost level)")]
	public int levelIndexToStartFrom;

	[Tooltip("Which layer the cursor ends at. First layer is 0 and at the top")]
	public int layerIndexToEndAt;

	[Tooltip("Which level in the layer the cursor ends at. The first level is 0 and is just below the layer title (the uppermost level)")]
	public int levelIndexToEndAt;

	private bool spawned = false;

	public static float upDisablePos = 60f;

	public static float doorClosePos = 10f;

	public static float doorCloseSpeed = 10f;

	public static float actDelay = 0.5f;

	public static float ascendingPlayerSpawnPos = -55f;

	public void OnBeforeSerialize()
	{
		levelSizes.Clear();
		layerNames.Clear();
		levelNames.Clear();
		for (int i = 0; i < layersAndLevels.Count; i++)
		{
			layerNames.Add(layersAndLevels[i].layerName);
			levelSizes.Add(layersAndLevels[i].layerLevels.Length);
			levelNames.AddRange(layersAndLevels[i].layerLevels);
		}
	}

	public void Deserialize()
	{
		layersAndLevels.Clear();
		int num = 0;
		for (int i = 0; i < levelSizes.Count; i++)
		{
			LayerInfoRogue layerInfoRogue = new LayerInfoRogue();
			layerInfoRogue.layerName = layerNames[i];
			int num2 = levelSizes[i];
			layerInfoRogue.layerLevels = new string[num2];
			for (int j = 0; j < num2; j++)
			{
				layerInfoRogue.layerLevels[j] = levelNames[num++];
			}
			layersAndLevels.Add(layerInfoRogue);
		}
	}

	public void OnAfterDeserialize()
	{
	}

	private static Text MakeText(Transform parent)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject();
		RectTransform val2 = val.AddComponent<RectTransform>();
		((Transform)val2).SetParent(parent);
		val.transform.localScale = Vector3.one;
		return val.AddComponent<Text>();
	}

	private static RectTransform MakeRect(Transform parent)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		GameObject val = new GameObject();
		RectTransform val2 = val.AddComponent<RectTransform>();
		((Transform)val2).SetParent(parent);
		return val2;
	}

	public static void ConvertToAscendingFirstRoom(GameObject firstRoom, AudioClip doorCloseAud, List<GameObject> toEnable, List<GameObject> toDisable, bool doNotReplace)
	{
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0399: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Expected O, but got Unknown
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Expected O, but got Unknown
		//IL_0484: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Expected O, but got Unknown
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ab: Expected O, but got Unknown
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Expected O, but got Unknown
		//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_0569: Unknown result type (might be due to invalid IL or missing references)
		//IL_0573: Expected O, but got Unknown
		//IL_057a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0584: Expected O, but got Unknown
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Expected O, but got Unknown
		//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bf: Expected O, but got Unknown
		//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Expected O, but got Unknown
		//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0603: Expected O, but got Unknown
		//IL_060a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0614: Expected O, but got Unknown
		//IL_0627: Unknown result type (might be due to invalid IL or missing references)
		//IL_0631: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0652: Unknown result type (might be due to invalid IL or missing references)
		//IL_0657: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Expected O, but got Unknown
		List<GameObject> toEnable2 = toEnable;
		List<GameObject> toDisable2 = toDisable;
		Transform val = firstRoom.transform.Find("Room");
		if (!doNotReplace)
		{
			Transform val2 = val.Find("Pit (3)");
			((Component)val2).transform.localPosition = new Vector3(0f, 2f, 41.72f);
			((Component)val2).transform.localRotation = Quaternion.Euler(0f, 0f, 180f);
			Object.Destroy((Object)(object)((Component)((Component)val).transform.Find("Room/Ceiling")).gameObject);
			Transform val3 = ((Component)val).transform.Find("Room/Floor");
			GameObject gameObject = ((Component)val3.GetChild(0)).gameObject;
			GameObject val4 = Object.Instantiate<GameObject>(gameObject, val3);
			val4.transform.localPosition = new Vector3(-15f, 9.7f, 20.28f);
			val4.transform.localRotation = Quaternion.identity;
			GameObject val5 = Object.Instantiate<GameObject>(gameObject, val3);
			val5.transform.localPosition = new Vector3(5f, 9.7f, 20.28f);
			val5.transform.localRotation = Quaternion.identity;
			GameObject val6 = Object.Instantiate<GameObject>(gameObject, val3);
			val6.transform.localPosition = new Vector3(-5f, 9.7f, 0.2f);
			val6.transform.localRotation = Quaternion.Euler(0f, -90f, 0f);
			GameObject val7 = Object.Instantiate<GameObject>(gameObject, val3);
			val7.transform.localPosition = new Vector3(5f, 9.7f, 10.28f);
			val7.transform.localRotation = Quaternion.identity;
			((Renderer)val7.GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[2]
			{
				UtilsRogue.metalDec20,
				UtilsRogue.metalDec20
			};
			GameObject val8 = Object.Instantiate<GameObject>(gameObject, val3);
			val8.transform.localPosition = new Vector3(-15f, 9.7f, 10.28f);
			val8.transform.localRotation = Quaternion.identity;
			((Renderer)val8.GetComponent<MeshRenderer>()).materials = (Material[])(object)new Material[2]
			{
				UtilsRogue.metalDec20,
				UtilsRogue.metalDec20
			};
			GameObject val9 = Object.Instantiate<GameObject>(gameObject, val3);
			val9.transform.localPosition = new Vector3(-5f, -0.3f, 20.28f);
			val9.transform.localRotation = Quaternion.Euler(0f, -90f, -180f);
		}
		Transform val10 = val.Find("Decorations");
		Transform child = val10.GetChild(12);
		child.localPosition = new Vector3(-5f, 2f, 52f);
		LocalMoveTowards floorMover = ((Component)child).gameObject.AddComponent<LocalMoveTowards>();
		floorMover.targetLocalPosition = new Vector3(-5f, 2f, 42f);
		floorMover.speed = doorCloseSpeed;
		AudioSource floorTileAud = ((Component)child).gameObject.AddComponent<AudioSource>();
		floorTileAud.playOnAwake = false;
		floorTileAud.loop = false;
		floorTileAud.clip = doorCloseAud;
		PlayerActivator act = firstRoom.GetComponentsInChildren<PlayerActivator>().First();
		((Component)act).gameObject.SetActive(false);
		NewMovement instance = MonoSingleton<NewMovement>.Instance;
		((Component)instance).transform.localPosition = new Vector3(((Component)instance).transform.localPosition.x, ascendingPlayerSpawnPos, ((Component)instance).transform.localPosition.z);
		PlayerForcedMovement focedMov = ((Component)instance).gameObject.AddComponent<PlayerForcedMovement>();
		GameObject val11 = new GameObject();
		val11.transform.SetParent(((Component)act).transform.parent);
		val11.transform.localPosition = new Vector3(0f, upDisablePos, 0f);
		val11.transform.localRotation = Quaternion.identity;
		val11.transform.localScale = new Vector3(80f, 0.2f, 80f);
		val11.layer = ((Component)act).gameObject.layer;
		BoxCollider val12 = val11.AddComponent<BoxCollider>();
		((Collider)val12).isTrigger = true;
		ObjectActivator val13 = val11.AddComponent<ObjectActivator>();
		val13.dontActivateOnEnable = true;
		val13.oneTime = true;
		val13.events = new UltrakillEvent();
		val13.events.onActivate = new UnityEvent();
		val13.events.onActivate.AddListener((UnityAction)delegate
		{
			focedMov.DestroyComp();
		});
		GameObject val14 = new GameObject();
		val14.transform.SetParent(((Component)act).transform.parent);
		val14.transform.localPosition = new Vector3(0f, doorClosePos, 0f);
		val14.transform.localRotation = Quaternion.identity;
		val14.transform.localScale = new Vector3(80f, 0.2f, 80f);
		val14.layer = ((Component)act).gameObject.layer;
		BoxCollider val15 = val14.AddComponent<BoxCollider>();
		((Collider)val15).isTrigger = true;
		ObjectActivator val16 = val14.AddComponent<ObjectActivator>();
		val16.dontActivateOnEnable = true;
		val16.oneTime = true;
		val16.events = new UltrakillEvent();
		val16.events.onActivate = new UnityEvent();
		val16.events.onActivate.AddListener((UnityAction)delegate
		{
			floorMover.Activate();
		});
		val16.events.onActivate.AddListener((UnityAction)delegate
		{
			floorTileAud.Play();
		});
		val16.events.onActivate.AddListener((UnityAction)delegate
		{
			foreach (GameObject item in toEnable2)
			{
				item.SetActive(true);
			}
			foreach (GameObject item2 in toDisable2)
			{
				item2.SetActive(false);
			}
		});
		ObjectActivator val17 = val14.AddComponent<ObjectActivator>();
		val17.dontActivateOnEnable = true;
		val17.oneTime = true;
		val17.events = new UltrakillEvent();
		val17.events.onActivate = new UnityEvent();
		val17.events.onActivate.AddListener((UnityAction)delegate
		{
			((Component)act).gameObject.SetActive(true);
		});
		UnityEvent onActivate = val17.events.onActivate;
		object obj = <>c.<>9__36_5;
		if (obj == null)
		{
			UnityAction val18 = delegate
			{
				//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)
				MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)MonoSingleton<NewMovement>.Instance).transform.position;
			};
			<>c.<>9__36_5 = val18;
			obj = (object)val18;
		}
		onActivate.AddListener((UnityAction)obj);
		val17.delay = actDelay;
	}

	public void Spawn()
	{
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		//IL_0486: Unknown result type (might be due to invalid IL or missing references)
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_0511: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_0551: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0568: Unknown result type (might be due to invalid IL or missing references)
		//IL_0598: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0630: Unknown result type (might be due to invalid IL or missing references)
		//IL_0635: Unknown result type (might be due to invalid IL or missing references)
		//IL_0636: Unknown result type (might be due to invalid IL or missing references)
		//IL_063e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0652: Unknown result type (might be due to invalid IL or missing references)
		//IL_0669: Unknown result type (might be due to invalid IL or missing references)
		//IL_0676: Unknown result type (might be due to invalid IL or missing references)
		//IL_069a: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_070c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0719: Unknown result type (might be due to invalid IL or missing references)
		//IL_0730: Unknown result type (might be due to invalid IL or missing references)
		//IL_073d: Unknown result type (might be due to invalid IL or missing references)
		//IL_074a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0df9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dfe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e15: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b37: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b3c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b45: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b75: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b83: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bce: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c01: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c0e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c1b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c8b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ccb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cd5: Expected O, but got Unknown
		//IL_0786: Unknown result type (might be due to invalid IL or missing references)
		//IL_078b: Unknown result type (might be due to invalid IL or missing references)
		//IL_078c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0794: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0811: Unknown result type (might be due to invalid IL or missing references)
		//IL_0816: Unknown result type (might be due to invalid IL or missing references)
		//IL_0817: Unknown result type (might be due to invalid IL or missing references)
		//IL_081f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0833: Unknown result type (might be due to invalid IL or missing references)
		//IL_0840: Unknown result type (might be due to invalid IL or missing references)
		//IL_085c: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_08fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0911: Unknown result type (might be due to invalid IL or missing references)
		//IL_091e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0935: Unknown result type (might be due to invalid IL or missing references)
		//IL_0942: Unknown result type (might be due to invalid IL or missing references)
		//IL_098c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0991: Unknown result type (might be due to invalid IL or missing references)
		//IL_0992: Unknown result type (might be due to invalid IL or missing references)
		//IL_099a: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_09fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a35: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a43: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
		//IL_1025: Unknown result type (might be due to invalid IL or missing references)
		//IL_112a: Unknown result type (might be due to invalid IL or missing references)
		if (spawned)
		{
			return;
		}
		GameObject onLevelStartObj = null;
		bool flag = (Object)(object)MonoSingleton<OnLevelStart>.Instance != (Object)null;
		if (!flag)
		{
			Transform val = ((Component)this).gameObject.transform.Find("OnLevelStart");
			if ((Object)(object)val != (Object)null)
			{
				flag = (Object)(object)((Component)val).GetComponent<OnLevelStart>() != (Object)null;
				onLevelStartObj = ((Component)val).gameObject;
			}
		}
		else
		{
			onLevelStartObj = ((Component)MonoSingleton<OnLevelStart>.Instance).gameObject;
		}
		GameObject val2 = ((Component)this).gameObject;
		GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)(secretRoom ? "FirstRoom Secret" : (primeRoom ? "FirstRoom Prime" : (encoreRoom ? "Assets/Prefabs/Levels/Special Rooms/FirstRoom Encore.prefab" : "FirstRoom")))).WaitForCompletion();
		Scene activeScene;
		if (!doNotReplace)
		{
			val2 = Object.Instantiate<GameObject>(val3, ((Component)this).transform.parent);
			if (flag)
			{
				Transform? obj = val2.transform.Find("OnLevelStart");
				if (obj == null)
				{
					activeScene = SceneManager.GetActiveScene();
					obj = (from go in ((Scene)(ref activeScene)).GetRootGameObjects()
						where ((Object)go).name == "OnLevelStart" && (Object)(object)go.transform != (Object)(object)onLevelStartObj
						select go.transform).FirstOrDefault();
				}
				Transform val4 = obj;
				if ((Object)(object)val4 != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)val4).gameObject);
				}
				if ((Object)(object)onLevelStartObj != (Object)null)
				{
					onLevelStartObj.transform.SetParent(val2.transform);
				}
			}
		}
		else
		{
			GameObject val5 = Object.Instantiate<GameObject>(val3, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent);
			Object.Destroy((Object)(object)((Component)val5.transform.Find("Room")).gameObject);
			if (flag)
			{
				Transform val6 = val5.transform.Find("OnLevelStart");
				if ((Object)(object)val6 != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)val6).gameObject);
				}
				else
				{
					activeScene = SceneManager.GetActiveScene();
					OnLevelStart val7 = (from go in ((Scene)(ref activeScene)).GetRootGameObjects()
						select go.GetComponent<OnLevelStart>() into ls
						where (Object)(object)ls != (Object)null && (Object)(object)((Component)ls).gameObject != (Object)(object)onLevelStartObj
						select ls).FirstOrDefault();
					if ((Object)(object)val7 != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val7).gameObject);
					}
				}
			}
		}
		MeshCollider[] componentsInChildren = val2.GetComponentsInChildren<MeshCollider>();
		MeshFilter val9 = default(MeshFilter);
		foreach (MeshCollider val8 in componentsInChildren)
		{
			if (((Component)val8).gameObject.TryGetComponent<MeshFilter>(ref val9))
			{
				val9.mesh = val8.sharedMesh;
			}
		}
		Transform transform = ((Component)MonoSingleton<NewMovement>.Instance).transform;
		((Component)transform).transform.parent = val2.transform;
		val2.transform.position = ((Component)this).transform.position;
		val2.transform.rotation = ((Component)this).transform.rotation;
		((Component)transform).transform.parent = null;
		Quaternion rotation = ((Component)this).transform.rotation;
		UtilsRogue.SetPlayerWorldRotation(Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f));
		if ((Object)(object)playerSpawnPos != (Object)null)
		{
			((Component)transform).transform.parent = ((Component)playerSpawnPos).transform.parent;
			((Component)transform).transform.localPosition = playerSpawnPos.localPosition;
			UtilsRogue.SetPlayerWorldRotation(playerSpawnPos.rotation);
			((Component)transform).transform.SetParent((Transform)null);
		}
		MonoSingleton<StatsManager>.Instance.spawnPos = ((Component)transform).transform.position;
		try
		{
			Transform val10 = val2.transform.Find("Room/FinalDoor");
			FinalDoor component = ((Component)val10).GetComponent<FinalDoor>();
			Camera main = Camera.main;
			main.backgroundColor = backgroundColor;
			main.clearFlags = cameraFillMode;
			FinalDoorOpener component2 = ((Component)val2.transform.Find("Room/FinalDoor/FinalDoorOpener")).GetComponent<FinalDoorOpener>();
			component2.startMusic = startMusic;
			FinalDoor component3 = ((Component)val2.transform.Find("Room/FinalDoor")).GetComponent<FinalDoor>();
			Transform obj2 = ((Component)MonoSingleton<NewMovement>.Instance).transform.Find("Canvas");
			if (obj2 == null)
			{
				activeScene = SceneManager.GetActiveScene();
				obj2 = (from o in ((Scene)(ref activeScene)).GetRootGameObjects()
					where ((Object)o).name == "Canvas"
					select o).First().transform;
			}
			Transform val11 = obj2;
			GameObject val12 = null;
			if (enableHellMap)
			{
				Deserialize();
				RectTransform val13 = MakeRect(val11);
				((Object)val13).name = "Hellmap";
				val12 = ((Component)val13).gameObject;
				Vector2 anchorMin = (val13.anchorMax = new Vector2(0.5f, 0.5f));
				val13.anchorMin = anchorMin;
				val13.pivot = new Vector2(0.5f, 0.5f);
				val13.sizeDelta = new Vector2(250f, 650f);
				val13.anchoredPosition = Vector2.zero;
				((Transform)val13).localScale = Vector3.one * 0.82244f;
				((Transform)val13).SetAsFirstSibling();
				RectTransform val15 = MakeRect(((Component)val13).transform);
				((Object)val15).name = "Hellmap Container";
				val15.anchorMin = Vector2.zero;
				val15.anchorMax = Vector2.one;
				val15.pivot = new Vector2(0.5f, 0.5f);
				val15.sizeDelta = Vector2.zero;
				val15.anchoredPosition = Vector2.zero;
				((Transform)val15).localScale = Vector3.one;
				float num = 0f;
				Stack<RectTransform> stack = new Stack<RectTransform>();
				foreach (LayerInfoRogue layersAndLevel in layersAndLevels)
				{
					RectTransform val16 = MakeRect((Transform)(object)val15);
					anchorMin = (val16.anchorMax = new Vector2(0f, 1f));
					val16.anchorMin = anchorMin;
					val16.sizeDelta = new Vector2(250f, 50f);
					val16.pivot = new Vector2(0f, 1f);
					((Transform)val16).localScale = Vector3.one;
					val16.anchoredPosition = new Vector2(0f, (num == 0f) ? (-3.051758E-05f) : num);
					num -= 50f;
					Text val18 = MakeText((Transform)(object)val16);
					val18.text = layersAndLevel.layerName;
					val18.fontSize = 36;
					val18.font = UtilsRogue.gameFont;
					val18.alignment = (TextAnchor)3;
					((Graphic)val18).color = Color.white;
					RectTransform component4 = ((Component)val18).GetComponent<RectTransform>();
					component4.anchorMin = Vector2.zero;
					component4.anchorMax = Vector2.one;
					component4.sizeDelta = Vector2.zero;
					component4.pivot = new Vector2(0.5f, 0.5f);
					((Transform)component4).localScale = Vector3.one;
					component4.anchoredPosition = Vector2.zero;
					string[] layerLevels = layersAndLevel.layerLevels;
					foreach (string text in layerLevels)
					{
						RectTransform val19 = MakeRect((Transform)(object)val15);
						anchorMin = (val19.anchorMax = new Vector2(0f, 1f));
						val19.anchorMin = anchorMin;
						val19.pivot = new Vector2(0f, 1f);
						((Transform)val19).localScale = Vector3.one;
						val19.anchoredPosition = new Vector2(60f, num);
						val19.sizeDelta = new Vector2(125f, 45f);
						num -= 50f;
						RectTransform val21 = MakeRect(((Component)val19).transform);
						anchorMin = (val21.anchorMax = new Vector2(0.5f, 0.5f));
						val21.anchorMin = anchorMin;
						val21.sizeDelta = new Vector2(25f, 9f);
						val21.anchoredPosition = Vector2.zero;
						((Transform)val21).localScale = new Vector3(5f, 5f, 5f);
						Image val23 = ((Component)val21).gameObject.AddComponent<Image>();
						val23.type = (Type)1;
						val23.sprite = UtilsRogue.levelPanel;
						val23.pixelsPerUnitMultiplier = 1f;
						Text val24 = MakeText(((Component)val19).transform);
						val24.text = text;
						val24.font = UtilsRogue.gameFont;
						val24.fontSize = 32;
						val24.alignment = (TextAnchor)4;
						((Graphic)val24).color = Color.black;
						RectTransform component5 = ((Component)val24).gameObject.GetComponent<RectTransform>();
						component5.anchorMin = Vector2.zero;
						component5.anchorMax = Vector2.one;
						component5.pivot = new Vector2(0.5f, 0.5f);
						component5.sizeDelta = Vector2.zero;
						component5.anchoredPosition = new Vector2(0f, 0f);
						((Transform)component5).localScale = Vector3.one;
					}
					if (layersAndLevel.layerLevels.Length != 0)
					{
						RectTransform val25 = MakeRect((Transform)(object)val15);
						anchorMin = (val25.anchorMax = new Vector2(0.5f, 1f));
						val25.anchorMin = anchorMin;
						val25.pivot = new Vector2(0.5f, 0f);
						val25.anchoredPosition = new Vector2(-95f, num + 25f);
						val25.sizeDelta = new Vector2(3f, (float)layersAndLevel.layerLevels.Length * 50f - 27.5f);
						((Transform)val25).localScale = Vector3.one;
						((Component)val25).gameObject.AddComponent<Image>();
						for (int k = 0; k < layersAndLevel.layerLevels.Length; k++)
						{
							RectTransform val27 = MakeRect((Transform)(object)val25);
							anchorMin = (val27.anchorMax = new Vector2(0.5f, 0f));
							val27.anchorMin = anchorMin;
							val27.pivot = new Vector2(0f, 0.5f);
							val27.sizeDelta = new Vector2(20f, 3f);
							val27.anchoredPosition = new Vector2(-1.5f, (float)k * 50f);
							((Transform)val27).localScale = Vector3.one;
							((Component)val27).gameObject.AddComponent<Image>();
						}
						stack.Push(val25);
					}
				}
				while (stack.Count != 0)
				{
					RectTransform val29 = stack.Pop();
					((Transform)val29).SetAsLastSibling();
				}
				Vector2 anchoredPosition = ((Component)((Transform)val15).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToStartFrom, levelIndexToStartFrom))).GetComponent<RectTransform>().anchoredPosition;
				((Vector2)(ref anchoredPosition))..ctor(210f, anchoredPosition.y - 22.5f);
				Vector2 anchoredPosition2 = ((Component)((Transform)val15).GetChild(GetChildIndexFromLayerAndLevel(layerIndexToEndAt, levelIndexToEndAt))).GetComponent<RectTransform>().anchoredPosition;
				((Vector2)(ref anchoredPosition2))..ctor(210f, anchoredPosition2.y - 22.5f);
				RectTransform val30 = MakeRect((Transform)(object)val13);
				anchorMin = (val30.anchorMax = new Vector2(0f, 1f));
				val30.anchorMin = anchorMin;
				val30.pivot = new Vector2(0.5f, 0.5f);
				val30.sizeDelta = new Vector2(35f, 35f);
				((Transform)val30).rotation = Quaternion.Euler(0f, 0f, 90f);
				((Transform)val30).localScale = Vector3.one;
				val30.anchoredPosition = anchoredPosition;
				AudioSource val32 = ((Component)val30).gameObject.AddComponent<AudioSource>();
				val32.playOnAwake = false;
				val32.loop = false;
				val32.clip = hellmapBeepClip;
				val32.volume = 0.1f;
				Image val33 = ((Component)val30).gameObject.AddComponent<Image>();
				val33.sprite = UtilsRogue.hellmapArrow;
				CustomHellmapCursor customHellmapCursor = ((Component)val30).gameObject.AddComponent<CustomHellmapCursor>();
				customHellmapCursor.targetPosition = anchoredPosition2;
				customHellmapCursor.aud = val32;
				customHellmapCursor.targetImage = val33;
				ObjectActivator val34 = ((Component)UnityUtilsRogue.GetComponentInChildrenRecursive<PlayerActivator>(val2.transform)).gameObject.AddComponent<ObjectActivator>();
				val34.dontActivateOnEnable = true;
				val34.oneTime = true;
				val34.events = new UltrakillEvent();
				val34.events.toDisActivateObjects = (GameObject[])(object)new GameObject[1] { ((Component)val13).gameObject };
			}
			if (convertToUpwardRoom)
			{
				foreach (GameObject item in upwardRoomOutOfBoundsToDisable)
				{
					item.SetActive(false);
				}
				List<GameObject> list = new List<GameObject>();
				if ((Object)(object)val12 != (Object)null)
				{
					list.Add(val12);
				}
				List<GameObject> list2 = new List<GameObject>();
				list2.AddRange(upwardRoomOutOfBoundsToDisable);
				ConvertToAscendingFirstRoom(val2, upwardRoomDoorCloseClip, list2, list, doNotReplace);
			}
			if (!encoreRoom)
			{
				return;
			}
			FinalRank instance = MonoSingleton<FinalRank>.Instance;
			if (!((Object)(object)instance != (Object)null))
			{
				return;
			}
			Transform val35 = ((Component)instance).transform.Find("Extra Info");
			RectTransform val36 = default(RectTransform);
			if ((Object)(object)val35 != (Object)null && ((Component)val35).gameObject.TryGetComponent<RectTransform>(ref val36))
			{
				val36.anchoredPosition = Vector2.op_Implicit(new Vector3(0f, 200f, 0f));
				val36.sizeDelta = new Vector2(480f, 180f);
			}
			Transform val37 = ((Component)instance).transform.Find("Secrets -  Title");
			Transform val38 = ((Component)instance).transform.Find("Secrets - Info");
			Transform val39 = (((Object)(object)val38 == (Object)null) ? null : ((Component)val38).transform.Find("Text (1)"));
			Transform val40 = ((Component)instance).transform.Find("Challenge - Title");
			Transform val41 = ((Component)instance).transform.Find("Challenge");
			List<GameObject> list3 = instance.toAppear.ToList();
			if ((Object)(object)val37 != (Object)null && !list3.Contains(((Component)val37).gameObject))
			{
				list3.Insert(list3.Count - 1, ((Component)val37).gameObject);
			}
			if ((Object)(object)val38 != (Object)null && !list3.Contains(((Component)val38).gameObject))
			{
				list3.Insert(list3.Count - 1, ((Component)val38).gameObject);
			}
			if ((Object)(object)val39 != (Object)null && !list3.Contains(((Component)val39).gameObject))
			{
				list3.Insert(list3.Count - 1, ((Component)val39).gameObject);
			}
			if ((Object)(object)val40 != (Object)null && !list3.Contains(((Component)val40).gameObject))
			{
				((Component)val40).gameObject.SetActive(true);
				list3.Insert(list3.Count - 1, ((Component)val40).gameObject);
			}
			if ((Object)(object)val41 != (Object)null && !list3.Contains(((Component)val41).gameObject))
			{
				list3.Insert(list3.Count - 1, ((Component)val41).gameObject);
			}
			instance.toAppear = list3.ToArray();
			Transform val42 = ((Component)val11).transform.Find("Level Stats Controller");
			if (!((Object)(object)val42 != (Object)null))
			{
				return;
			}
			LevelStats componentInChildren = ((Component)val42).GetComponentInChildren<LevelStats>(true);
			((Component)componentInChildren).GetComponent<RectTransform>().sizeDelta = new Vector2(285f, 315f);
			Transform obj3 = ((Component)componentInChildren).transform.Find("Challenge Title/Challenge");
			componentInChildren.challenge = ((obj3 != null) ? ((Component)obj3).GetComponent<TMP_Text>() : null);
			Transform obj4 = ((Component)componentInChildren).transform.Find("Challenge Title");
			if (obj4 != null)
			{
				((Component)obj4).gameObject.SetActive(true);
			}
			Transform obj5 = ((Component)componentInChildren).transform.Find("Secrets Title");
			if (obj5 != null)
			{
				((Component)obj5).gameObject.SetActive(true);
			}
			List<Image> list4 = new List<Image>();
			for (int num2 = 5; num2 >= 1; num2--)
			{
				Transform val43 = ((Component)componentInChildren).transform.Find($"Secrets Title/Secret {num2}");
				if ((Object)(object)val43 != (Object)null)
				{
					list4.Add(((Component)val43).GetComponent<Image>());
				}
			}
			componentInChildren.secrets = list4.ToArray();
			Transform val44 = ((Component)componentInChildren).transform.Find("Assists Title");
			((Component)val44).GetComponent<RectTransform>().anchoredPosition = new Vector2(10f, -275f);
		}
		catch (Exception ex)
		{
			throw ex;
		}
		finally
		{
			spawned = true;
		}
		int GetChildIndexFromLayerAndLevel(int layer, int level)
		{
			int num3 = 0;
			for (int l = 0; l < layer; l++)
			{
				num3 += 1 + levelSizes[l];
			}
			return num3 + 1 + level;
		}
	}

	public void Awake()
	{
		Spawn();
	}

	public void Start()
	{
		if ((Object)(object)MonoSingleton<OnLevelStart>.Instance != (Object)null)
		{
			MonoSingleton<OnLevelStart>.Instance.levelNameOnStart = displayLevelTitle;
		}
		else
		{
			Debug.LogWarning((object)"Could not find OnLevelStart");
		}
		if (!doNotReplace)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}
}
public class Gambler : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <explosionNumerator>d__13 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Gambler <>4__this;

		private GameObject <explosionPrefab>5__1;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				((Component)<>4__this).gameObject.AddComponent<AudioSource>().PlayOneShot(AssetsManager.StalkerWarning);
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<explosionPrefab>5__1 = MonoSingleton<DefaultReferenceManager>.Instance.explosion;
				if ((Object)(object)<explosionPrefab>5__1 != (Object)null)
				{
					Object.Instantiate<GameObject>(<explosionPrefab>5__1, ((Component)<>4__this).transform.position, Quaternion.identity);
				}
				Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
				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 const float GAMBLE_COOLDOWN = 1.5f;

	private const float EXPLOSION_BASE_CHANCE = 0.08f;

	private const float EXPLOSION_CHANCE_RAMP = 0.07f;

	private const float EXPLOSION_RADIUS = 5f;

	private const float EXPLOSION_DAMAGE = 40f;

	private float cooldown = 0f;

	private int useCount = 0;

	private bool exploded = false;

	private Transform itemPlacementThing;

	private void Update()
	{
		//IL_004e: 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)
		if (!exploded)
		{
			if (cooldown > 0f)
			{
				cooldown -= Time.deltaTime;
			}
			else if (!((Object)(object)MonoSingleton<NewMovement>.Instance == (Object)null) && Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) <= 2f)
			{
				Activate();
				cooldown = 1.5f;
			}
		}
	}

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)itemPlacementThing == (Object)null)
		{
			itemPlacementThing = new GameObject("ItemPar").transform;
			((Component)itemPlacementThing).transform.parent = ((Component)this).transform.parent;
			itemPlacementThing.position = ((Component)this).transform.position;
		}
	}

	public void Activate()
	{
		RogueDifficultyManager instance = RogueDifficultyManager.Instance;
		if ((Object)(object)instance == (Object)null)
		{
			return;
		}
		if (instance.Gold <= 0)
		{
			HudMessageReceiver instance2 = MonoSingleton<HudMessageReceiver>.Instance;
			if (instance2 != null)
			{
				instance2.SendHudMessage("No gold to gamble!", "", "", 0, false, false, true);
			}
			return;
		}
		instance.Gold--;
		useCount++;
		float num = 0.08f + 0.07f * (float)(useCount - 1);
		if (RogueDifficultyManager.GambleItemRNG.NextDouble() <= (double)num)
		{
			Explode();
		}
		else if (RogueDifficultyManager.GambleItemRNG.NextDouble() <= 0.3499999940395355)
		{
			HudMessageReceiver instance3 = MonoSingleton<HudMessageReceiver>.Instance;
			if (instance3 != null)
			{
				instance3.SendHudMessage("You won!", "", "", 0, false, false, true);
			}
			ItemPickup.CreatePickup(Plugin.GiveRandomItem(RogueDifficultyManager.GambleItemRNG), itemPlacementThing, 5f);
		}
		else
		{
			HudMessageReceiver instance4 = MonoSingleton<HudMessageReceiver>.Instance;
			if (instance4 != null)
			{
				instance4.SendHudMessage("You lost... try again?", "", "", 0, false, false, true);
			}
		}
	}

	private void Explode()
	{
		exploded = true;
		((MonoBehaviour)this).StartCoroutine(explosionNumerator());
	}

	[IteratorStateMachine(typeof(<explosionNumerator>d__13))]
	private IEnumerator explosionNumerator()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <explosionNumerator>d__13(0)
		{
			<>4__this = this
		};
	}
}
public class GoldPickup : MonoBehaviour
{
	private bool pickedUp = false;

	private void Update()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		if (Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) <= 2f && !pickedUp)
		{
			pickedUp = true;
			RogueDifficultyManager.Instance.Gold++;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public static void CreatePickup(Vector3 position)
	{
		//IL_0022: 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_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
		val.GetComponent<Collider>().enabled = false;
		val.AddComponent<GoldPickup>();
		val.transform.position = position + Vector3.up * 2f;
	}
}
public class ItemPedestal : MonoBehaviour
{
	private BaseItem chosenItem;

	private void Start()
	{
		if ((float)RogueDifficultyManager.ItemRNG.NextDouble() <= 0.5f)
		{
			chosenItem = Plugin.GiveRandomItem();
			ItemPickup.CreatePickup(chosenItem, ((Component)this).transform);
		}
		else
		{
			WeaponPickupRogue.CreatePickup(((Component)this).transform);
		}
	}
}
public class ItemPickup : MonoBehaviour
{
	public BaseItem item;

	private bool pickedUp = false;

	private Func<bool> canPickup;

	private void Update()
	{
		//IL_0046: 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)
		((Component)((Component)this).transform).transform.LookAt(((Component)Camera.main).transform);
		((Component)((Component)this).transform).transform.Rotate(0f, 180f, 0f);
		if (Vector3.Distance(((Component)MonoSingleton<NewMovement>.Instance).transform.position, ((Component)this).transform.position) <= 2f && !pickedUp && (canPickup == null || canPickup()))
		{
			pickedUp = true;
			HudMessageReceiver instance = MonoSingleton<HudMessageReceiver>.Instance;
			if (instance != null)
			{
				instance.SendHudMessage(item.ToString(), "", "", 0, false, false, true);
			}
			Plugin.GiveItem(item);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	public static void CreatePickup(BaseItem item, Transform position, float offset = 3f)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
		val.GetComponent<Collider>().enabled = false;
		val.AddComponent<ItemPickup>().item = item;
		Material val2 = new Material(AssetsManager.weaponMat);
		val2.mainTexture = (Texture)(object)item.ItemTexture;
		((Renderer)val.GetComponent<MeshRenderer>()).material = val2;
		val.transform.position = position.position + Vector3.up * offset;
		val.transform.parent = position;
		Transform transform = val.transform;
		transform.localScale *= 3f;
	}

	public static void CreatePickupConditional(BaseItem item, Transform position, Func<bool> pickupCon, float offset = 3f)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
		val.GetComponent<Collider>().enabled = false;
		val.AddComponent<ItemPickup>().item = item;
		val.GetComponent<ItemPickup>().canPickup = pickupCon;
		Material val2 = new Material(AssetsManager.weaponMat);
		val2.mainTexture = (Texture)(object)item.ItemTexture;
		((Renderer)val.GetComponent<MeshRenderer>()).material = val2;
		val.transform.position = position.position + Vector3.up * offset;
		Transform transform = val.transform;
		transform.localScale *= 3f;
		val.transform.parent = position;
	}
}
public class MinimapUI : MonoBehaviour
{
	[Header("References")]
	[Tooltip("The RectTransform of the panel that contains the minimap.")]
	public RectTransform minimapPanel;

	[Header("Layout")]
	[Tooltip("Pixel size of each room cell.")]
	public float cellSize = 16f;

	[Tooltip("Width of corridor connectors between cells, as a fraction of cellSize.")]
	[Range(0.2f, 0.6f)]
	public float corridorFraction = 0.4f;

	[Header("Room Colors")]
	public Color colorNormal = new Color(0.52f, 0.52f, 0.55f);

	public Color colorStart = new Color(0.28f, 0.82f, 0.38f);

	public Color colorBoss = new Color(0.88f, 0.14f, 0.14f);

	public Color colorTreasure = new Color(0.95f, 0.78f, 0.08f);

	public Color colorShop = new Color(0.22f, 0.52f, 0.95f);

	public Color colorGambling = new Color(0.72f, 0.22f, 0.92f);

	[Header("UI Colors")]
	[Tooltip("Colour of rooms adjacent to visited ones but not yet entered.")]
	public Color colorSilhouette = new Color(0.28f, 0.28f, 0.3f);

	[Tooltip("Base colour flashed on the current room. It pulses between this and white.")]
	public Color colorCurrentBase = new Color(0.95f, 0.95f, 1f);

	[Tooltip("Colour of corridor connectors between revealed cells.")]
	public Color colorCorridor = new Color(0.38f, 0.38f, 0.4f);

	[Header("Animation")]
	[Tooltip("Speed of the current-room pulse. Higher = faster throb.")]
	public float pulseSpeed = 2.8f;

	private readonly Dictionary<Vector2Int, Image> _cells = new Dictionary<Vector2Int, Image>();

	private readonly Dictionary<(Vector2Int, Vector2Int), Image> _corridors = new Dictionary<(Vector2Int, Vector2Int), Image>();

	private readonly HashSet<Vector2Int> _visited = new HashSet<Vector2Int>();

	private readonly HashSet<Vector2Int> _scouted = new HashSet<Vector2Int>();

	private Vector2Int _currentPos = new Vector2Int(int.MinValue, 0);

	private float _pulseTimer;

	private static readonly Vector2Int[] Dirs = (Vector2Int[])(object)new Vector2Int[4]
	{
		Vector2Int.up,
		Vector2Int.down,
		Vector2Int.left,
		Vector2Int.right
	};

	private Dictionary<Vector2Int, Room> _placedRooms;

	public static MinimapUI Instance { get; private set; }

	private void Awake()
	{
		if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else
		{
			Instance = this;
		}
	}

	private void Update()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		if (_placedRooms == null || (Object)(object)RoomGenerator.Instance == (Object)null)
		{
			return;
		}
		NewMovement instance = MonoSingleton<NewMovement>.Instance;
		if (!((Object)(object)instance == (Object)null))
		{
			Vector2Int val = RoomGenerator.Instance.WorldToGrid(((Component)instance).transform.position);
			if (val != _currentPos)
			{
				_currentPos = val;
				MarkVisited(val);
			}
			_pulseTimer += Time.deltaTime * pulseSpeed;
			float num = 0.6f + 0.4f * Mathf.Sin(_pulseTimer);
			Color color = Color.Lerp(colorCurrentBase * 0.7f, colorCurrentBase, num);
			if (_cells.TryGetValue(_currentPos, out Image value))
			{
				((Graphic)value).color = color;
			}
		}
	}

	public void BuildMinimap(Dictionary<Vector2Int, Room> placedRooms)
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_030c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0311: Unknown result type (might be due to invalid IL or missing references)
		//IL_0313: Unknown result type (might be due to invalid IL or missing references)
		//IL_0317: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0359: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_028c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		DestroyChildren();
		_cells.Clear();
		_corridors.Clear();
		_visited.Clear();
		_scouted.Clear();
		_currentPos = new Vector2Int(int.MinValue, 0);
		_placedRooms = placedRooms;
		if ((Object)(object)minimapPanel == (Object)null)
		{
			Debug.LogError((object)"[MinimapUI] minimapPanel is not assigned — assign it in the Inspector.");
			return;
		}
		int num = int.MaxValue;
		int num2 = int.MaxValue;
		int num3 = int.MinValue;
		int num4 = int.MinValue;
		foreach (Vector2Int key3 in placedRooms.Keys)
		{
			Vector2Int current = key3;
			if (((Vector2Int)(ref current)).x < num)
			{
				num = ((Vector2Int)(ref current)).x;
			}
			if (((Vector2Int)(ref current)).x > num3)
			{
				num3 = ((Vector2Int)(ref current)).x;
			}
			if (((Vector2Int)(ref current)).y < num2)
			{
				num2 = ((Vector2Int)(ref current)).y;
			}
			if (((Vector2Int)(ref current)).y > num4)
			{
				num4 = ((Vector2Int)(ref current)).y;
			}
		}
		float num5 = cellSize + cellSize * corridorFraction;
		float num6 = cellSize * corridorFraction;
		float num7 = num5 - cellSize;
		Vector2 val = default(Vector2);
		((Vector2)(ref val))..ctor((0f - (float)(num3 + num) / 2f) * num5, (0f - (float)(num4 + num2) / 2f) * num5);
		foreach (KeyValuePair<Vector2Int, Room> placedRoom in placedRooms)
		{
			Vector2Int key = placedRoom.Key;
			Vector2 val2 = GridToPx(key, num5) + val;
			Vector2Int[] array = (Vector2Int[])(object)new Vector2Int[2]
			{
				Vector2Int.right,
				Vector2Int.up
			};
			foreach (Vector2Int val3 in array)
			{
				if (placedRooms.ContainsKey(key + val3))
				{
					bool flag = val3 == Vector2Int.right;
					float num8 = (flag ? num7 : num6);
					float num9 = (flag ? num6 : num7);
					float num10 = (flag ? (cellSize / 2f + num7 / 2f) : 0f);
					float num11 = (flag ? 0f : (cellSize / 2f + num7 / 2f));
					Image val4 = MakeImage($"Corr_{key}_{val3}", minimapPanel, val2 + new Vector2(num10, num11), new Vector2(num8, num9));
					((Graphic)val4).color = Color.clear;
					_corridors[(key, val3)] = val4;
				}
			}
		}
		foreach (KeyValuePair<Vector2Int, Room> placedRoom2 in placedRooms)
		{
			Vector2Int key2 = placedRoom2.Key;
			Vector2 anchoredPos = GridToPx(key2, num5) + val;
			Image val5 = MakeImage($"Room_{key2}", minimapPanel, anchoredPos, new Vector2(cellSize, cellSize));
			((Graphic)val5).color = Color.clear;
			_cells[key2] = val5;
		}
		MarkVisited(Vector2Int.zero);
	}

	public void ClearAndReset()
	{
		//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)
		DestroyChildren();
		_cells.Clear();
		_corridors.Clear();
		_visited.Clear();
		_scouted.Clear();
		_placedRooms = null;
		_currentPos = new Vector2Int(int.MinValue, 0);
	}

	private void MarkVisited(Vector2Int pos)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		if (_placedRooms == null)
		{
			return;
		}
		_visited.Add(pos);
		Vector2Int[] dirs = Dirs;
		foreach (Vector2Int val in dirs)
		{
			Vector2Int val2 = pos + val;
			if (_placedRooms.ContainsKey(val2))
			{
				_scouted.Add(val2);
			}
		}
		RefreshAll();
	}

	private void RefreshAll()
	{
		//IL_001e: 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_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown res