Decompiled source of Dropper v1.1.3

com.github.Arof2.Beast_Mode.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
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 PEAKLib.Core;
using PEAKLib.Items;
using Photon.Pun;
using TMPro;
using UnityEngine;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.Arof2.Beast_Mode")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+c78cc2c6e2e5c74e115f58a7282d2dbd82c59564")]
[assembly: AssemblyProduct("com.github.Arof2.Beast_Mode")]
[assembly: AssemblyTitle("Dropper")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Dropper
{
	public class AddItemInNetwork : MonoBehaviourPun
	{
		private PhotonView photonView;

		private void Awake()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		public void AddItemIntoInventory(int itemID, int photonID)
		{
			photonView.RPC("AddItemIntoInventoryRPC", (RpcTarget)2, new object[2] { itemID, photonID });
			Plugin.Log.LogInfo((object)$"Client requesting item id: {itemID} to player with photonID: {photonID}");
		}

		[PunRPC]
		public void AddItemIntoInventoryRPC(int itemID, int photonID)
		{
			ItemSlot val = default(ItemSlot);
			((Component)PhotonNetwork.GetPhotonView(photonID)).GetComponent<Character>().player.AddItem((ushort)itemID, (ItemInstanceData)null, ref val);
			Plugin.Log.LogInfo((object)$"Host giving player {photonID} the item {(ushort)itemID}");
		}
	}
	public class InteractableBackPorter : MonoBehaviourPun, IInteractibleConstant, IInteractible
	{
		public Action<Character> Interacted;

		private MaterialPropertyBlock mpb;

		private MeshRenderer[] _mr;

		public float interactTime => 2f;

		public bool holdOnFinish
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		private MeshRenderer[] meshRenderers
		{
			get
			{
				if (_mr == null)
				{
					_mr = ((Component)this).GetComponentsInChildren<MeshRenderer>();
					MonoBehaviour.print((object)_mr.Length);
				}
				return _mr;
			}
			set
			{
				_mr = value;
			}
		}

		public void CancelCast(Character interactor)
		{
		}

		public void Awake()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			mpb = new MaterialPropertyBlock();
		}

		public Vector3 Center()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position;
		}

		public string GetInteractionText()
		{
			return "Teleport To Last Area";
		}

		public float GetInteractTime(Character interactor)
		{
			return interactTime;
		}

		public string GetName()
		{
			return "Reverse Teleporter";
		}

		public Transform GetTransform()
		{
			return ((Component)this).transform;
		}

		public void HoverEnter()
		{
			if (mpb == null)
			{
				return;
			}
			mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 1f);
			for (int i = 0; i < meshRenderers.Length; i++)
			{
				if ((Object)(object)meshRenderers[i] != (Object)null)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void HoverExit()
		{
			if (mpb != null)
			{
				mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 0f);
				for (int i = 0; i < meshRenderers.Length; i++)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void Interact(Character interactor)
		{
		}

		public void Interact_CastFinished(Character interactor)
		{
			Interacted?.Invoke(interactor);
		}

		public bool IsConstantlyInteractable(Character interactor)
		{
			return IsInteractible(interactor);
		}

		public bool IsInteractible(Character interactor)
		{
			return true;
		}

		public void ReleaseInteract(Character interactor)
		{
		}
	}
	public class InteractableBrewingStand : MonoBehaviourPun, IInteractibleConstant, IInteractible
	{
		private bool ineracted;

		public Action<Character> Interacted;

		private MaterialPropertyBlock mpb;

		private MeshRenderer[] _mr;

		public float interactTime => 0.5f;

		public bool holdOnFinish
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		private MeshRenderer[] meshRenderers
		{
			get
			{
				if (_mr == null)
				{
					_mr = ((Component)this).GetComponentsInChildren<MeshRenderer>();
					MonoBehaviour.print((object)_mr.Length);
				}
				return _mr;
			}
			set
			{
				_mr = value;
			}
		}

		public void Awake()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			mpb = new MaterialPropertyBlock();
		}

		public void CancelCast(Character interactor)
		{
		}

		public Vector3 Center()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position;
		}

		public string GetInteractionText()
		{
			return "Take Potion";
		}

		public float GetInteractTime(Character interactor)
		{
			return interactTime;
		}

		public string GetName()
		{
			return "Brewing stand";
		}

		public Transform GetTransform()
		{
			return ((Component)this).transform;
		}

		public void HoverEnter()
		{
			if (ineracted || mpb == null)
			{
				return;
			}
			mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 1f);
			for (int i = 0; i < meshRenderers.Length; i++)
			{
				if ((Object)(object)meshRenderers[i] != (Object)null)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void HoverExit()
		{
			if (mpb != null)
			{
				mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 0f);
				for (int i = 0; i < meshRenderers.Length; i++)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void Interact(Character interactor)
		{
		}

		public void Interact_CastFinished(Character interactor)
		{
			if (!ineracted)
			{
				((Component)this).gameObject.layer = 2;
				((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
				((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(true);
				HarmonyPatches.SetupMaterial(((Component)((Component)this).transform.GetChild(1)).gameObject);
				ineracted = true;
				Interacted?.Invoke(interactor);
			}
		}

		public bool IsConstantlyInteractable(Character interactor)
		{
			return IsInteractible(interactor);
		}

		public bool IsInteractible(Character interactor)
		{
			return true;
		}

		public void ReleaseInteract(Character interactor)
		{
		}
	}
	public class InteratableFinisher : MonoBehaviourPun, IInteractibleConstant, IInteractible
	{
		public Action<Character> Interacted;

		private MaterialPropertyBlock mpb;

		private MeshRenderer[] _mr;

		public float interactTime => 2f;

		public bool holdOnFinish
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		private MeshRenderer[] meshRenderers
		{
			get
			{
				if (_mr == null)
				{
					_mr = ((Component)this).GetComponentsInChildren<MeshRenderer>();
					MonoBehaviour.print((object)_mr.Length);
				}
				return _mr;
			}
			set
			{
				_mr = value;
			}
		}

		public void Awake()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			mpb = new MaterialPropertyBlock();
		}

		public void CancelCast(Character interactor)
		{
		}

		public Vector3 Center()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position;
		}

		public string GetInteractionText()
		{
			Plugin.Log.LogDebug((object)$"Current Spawn point Index: {HarmonyPatches.CurrentSpawnPointIndex} | Max index: {HarmonyPatches.MaxSpawnPointIndex}");
			if (HarmonyPatches.CurrentSpawnPointIndex == HarmonyPatches.MaxSpawnPointIndex)
			{
				return "Finish the game for all players";
			}
			return "Breaking out of the map doesn't allow you to finish early";
		}

		public float GetInteractTime(Character interactor)
		{
			return interactTime;
		}

		public string GetName()
		{
			return "Goal";
		}

		public Transform GetTransform()
		{
			return ((Component)this).transform;
		}

		public void HoverEnter()
		{
			if (mpb == null)
			{
				return;
			}
			mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 1f);
			for (int i = 0; i < meshRenderers.Length; i++)
			{
				if ((Object)(object)meshRenderers[i] != (Object)null)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void HoverExit()
		{
			if (mpb != null)
			{
				mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 0f);
				for (int i = 0; i < meshRenderers.Length; i++)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void Interact(Character interactor)
		{
		}

		public void Interact_CastFinished(Character interactor)
		{
			if (HarmonyPatches.CurrentSpawnPointIndex == HarmonyPatches.MaxSpawnPointIndex)
			{
				Interacted?.Invoke(interactor);
			}
		}

		public bool IsConstantlyInteractable(Character interactor)
		{
			return IsInteractible(interactor);
		}

		public bool IsInteractible(Character interactor)
		{
			return true;
		}

		public void ReleaseInteract(Character interactor)
		{
		}
	}
	public class InteratableTeleporter : MonoBehaviourPun, IInteractibleConstant, IInteractible
	{
		public Action<Character> Interacted;

		private MaterialPropertyBlock mpb;

		private MeshRenderer[] _mr;

		public float interactTime => 2f;

		public bool holdOnFinish
		{
			get
			{
				throw new NotImplementedException();
			}
		}

		private MeshRenderer[] meshRenderers
		{
			get
			{
				if (_mr == null)
				{
					_mr = ((Component)this).GetComponentsInChildren<MeshRenderer>();
					MonoBehaviour.print((object)_mr.Length);
				}
				return _mr;
			}
			set
			{
				_mr = value;
			}
		}

		public void CancelCast(Character interactor)
		{
		}

		public void Awake()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			mpb = new MaterialPropertyBlock();
		}

		public Vector3 Center()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return ((Component)this).transform.position;
		}

		public string GetInteractionText()
		{
			return "Teleport To Next Area";
		}

		public float GetInteractTime(Character interactor)
		{
			return interactTime;
		}

		public string GetName()
		{
			return "Teleporter";
		}

		public Transform GetTransform()
		{
			return ((Component)this).transform;
		}

		public void HoverEnter()
		{
			if (mpb == null)
			{
				return;
			}
			mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 1f);
			for (int i = 0; i < meshRenderers.Length; i++)
			{
				if ((Object)(object)meshRenderers[i] != (Object)null)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void HoverExit()
		{
			if (mpb != null)
			{
				mpb.SetFloat(Item.PROPERTY_INTERACTABLE, 0f);
				for (int i = 0; i < meshRenderers.Length; i++)
				{
					((Renderer)meshRenderers[i]).SetPropertyBlock(mpb);
				}
			}
		}

		public void Interact(Character interactor)
		{
		}

		public void Interact_CastFinished(Character interactor)
		{
			Interacted?.Invoke(interactor);
		}

		public bool IsConstantlyInteractable(Character interactor)
		{
			return IsInteractible(interactor);
		}

		public bool IsInteractible(Character interactor)
		{
			return true;
		}

		public void ReleaseInteract(Character interactor)
		{
		}
	}
	public class LoadCorrectDropper : MonoBehaviourPun
	{
		[PunRPC]
		public void LoadDropper(int ascentIndex)
		{
			Plugin.Log.LogInfo((object)$"LoadDropper called with ascentIndex: {ascentIndex}");
			if (ascentIndex == 0)
			{
				Plugin.ToggleModpack(0);
			}
			if (ascentIndex == 1)
			{
				Plugin.ToggleModpack(1);
			}
			if (ascentIndex > 1 || ascentIndex == -1)
			{
				Plugin.ToggleModpack(-1);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.github.Beast.Dropper", "Dropper", "1.1.3")]
	public class Plugin : BaseUnityPlugin
	{
		public static Action<int> ToggleModpack;

		public static bool alreadyPatched;

		public static bool PlayingDropperMap;

		public static Item ResetBerryItem;

		public static Item HealthPotion;

		internal static ManualLogSource Log { get; private set; }

		public static AssetBundle Bundle { get; private set; }

		internal static ModDefinition Definition { get; set; }

		public static string PluginName => "Dropper";

		public static Version PLuginVersion => new Version(1, 1, 3);

		public static string PLuginID => "com.github.Beast.Dropper";

		private void Awake()
		{
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			LoadBundle();
			ToggleModpack = delegate(int mode)
			{
				Log.LogInfo((object)$"Setting up Modpack with mode {mode}");
				switch (mode)
				{
				case 0:
					PlayingDropperMap = true;
					HarmonyPatches.Mode = HarmonyPatches.GameMode.Dropper;
					if (!alreadyPatched)
					{
						alreadyPatched = true;
						Harmony.CreateAndPatchAll(typeof(HarmonyPatches), (string)null);
					}
					break;
				case 1:
					PlayingDropperMap = true;
					HarmonyPatches.Mode = HarmonyPatches.GameMode.Descend;
					if (!alreadyPatched)
					{
						Harmony.CreateAndPatchAll(typeof(HarmonyPatches), (string)null);
						alreadyPatched = true;
					}
					break;
				default:
					PlayingDropperMap = false;
					alreadyPatched = false;
					Harmony.UnpatchAll();
					Harmony.CreateAndPatchAll(typeof(MandatoryHarmonyPatches), (string)null);
					break;
				}
			};
			Log.LogInfo((object)"Adding Localisation");
			LocalizedText.mainTable.Add("Name_Reset".ToUpperInvariant(), GetLocalisationOf("Resetter"));
			LocalizedText.mainTable.Add("Force reset on #targetchar".ToUpperInvariant(), GetLocalisationOf("force reset #targetchar"));
			LocalizedText.mainTable.Add("Name_Instant Health I".ToUpperInvariant(), GetLocalisationOf("Instant Health I"));
			LocalizedText.mainTable.Add("administer #targetchar".ToUpperInvariant(), GetLocalisationOf("administer #targetchar"));
			LocalizedText.mainTable.Add("Dropper".ToUpperInvariant(), GetLocalisationOf("Dropper"));
			LocalizedText.mainTable.Add("Immense dread".ToUpperInvariant(), GetLocalisationOf("Immense dread"));
			LocalizedText.mainTable.Add("Desc_Dropper".ToUpperInvariant(), GetLocalisationOf("Does falling from 50 meters and crushing all your bones hurt? YES! But the adrenaline keeps you alive and ready to hit the portal next time!"));
			LocalizedText.mainTable.Add("Dropper - Descend".ToUpperInvariant(), GetLocalisationOf("Dropper - Descent"));
			LocalizedText.mainTable.Add("Desc_Dropper - Descend".ToUpperInvariant(), GetLocalisationOf("Instead of doing it all in one jump, how about we mix it up with some parkour to climb down. Why would you do that? Well let's finish the first map an you will see why"));
			Log.LogInfo((object)"Applying MandatoryHarmonyPatches");
			Harmony.CreateAndPatchAll(typeof(MandatoryHarmonyPatches), (string)null);
			Log.LogInfo((object)"Done Applying MandatoryHarmonyPatches");
			Definition = ModDefinition.GetOrCreate(PLuginID, PluginName, PLuginVersion);
			Log.LogInfo((object)"Adding Custom Items via PeakLibItems");
			ResetBerryItem = Bundle.LoadAsset<GameObject>("ResetBerry").GetComponent<Item>();
			new ItemContent(ResetBerryItem).Register(Definition);
			HealthPotion = Bundle.LoadAsset<GameObject>("Health potion").GetComponent<Item>();
			new ItemContent(HealthPotion).Register(Definition);
			HarmonyPatches.SetupMaterial(((Component)HealthPotion).gameObject);
			Log.LogInfo((object)"Plugin Dropper is loaded!");
		}

		private List<string> GetLocalisationOf(string input)
		{
			List<string> list = new List<string>();
			for (int i = 0; i < 15; i++)
			{
				list.Add(input);
			}
			return list;
		}

		private void LoadBundle()
		{
			Log.LogInfo((object)"Loading AssetBundle...");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string path = "dropper_assets";
			string text = Path.Combine(directoryName, path);
			if (File.Exists(text))
			{
				Log.LogInfo((object)"Found AssetBundle");
				Bundle = AssetBundle.LoadFromFile(text);
				if ((Object)(object)Bundle == (Object)null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load AssetBundle!");
				}
				else
				{
					((BaseUnityPlugin)this).Logger.LogInfo((object)"AssetBundle loaded successfully!");
				}
			}
			else
			{
				Log.LogError((object)("AssetBundle not found at " + text));
			}
		}
	}
	internal class HarmonyPatches
	{
		public enum GameMode
		{
			Dropper,
			Descend
		}

		[CompilerGenerated]
		private sealed class <<UnPassOut>g__Wait3s|14_0>d : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

			[DebuggerHidden]
			public <<UnPassOut>g__Wait3s|14_0>d(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

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

		[CompilerGenerated]
		private sealed class <>c__DisplayClass12_0
		{
			public int localindex;

			public TriggerTeleporter component;

			internal void <DelayedActivation>b__0(Character character)
			{
				//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_003d: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass12_1 CS$<>8__locals0 = new <>c__DisplayClass12_1
				{
					character = character
				};
				if (CS$<>8__locals0.character.IsLocal)
				{
					CS$<>8__locals0.character.WarpPlayerRPC(spawnPoints[localindex + 1].position - Vector3.up, true);
					Plugin.Log.LogInfo((object)$"Teleported {((Object)CS$<>8__locals0.character).name} to Spawn Point {localindex + 1} from Teleporter {((Object)((Component)component).gameObject).name}");
					CurrentSpawnPointIndex = localindex + 1;
					((MonoBehaviour)CS$<>8__locals0.character).StartCoroutine(FixPassout());
				}
				[IteratorStateMachine(typeof(<>c__DisplayClass12_1.<<DelayedActivation>g__FixPassout|1>d))]
				IEnumerator FixPassout()
				{
					//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
					return new <>c__DisplayClass12_1.<<DelayedActivation>g__FixPassout|1>d(0)
					{
						<>4__this = CS$<>8__locals0
					};
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass12_1
		{
			public Character character;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass12_2
		{
			public int localindex;

			public InteratableTeleporter component;

			internal void <DelayedActivation>b__2(Character character)
			{
				//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_003d: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass12_3 CS$<>8__locals0 = new <>c__DisplayClass12_3
				{
					character = character
				};
				if (CS$<>8__locals0.character.IsLocal)
				{
					CS$<>8__locals0.character.WarpPlayerRPC(spawnPoints[localindex + 1].position - Vector3.up, true);
					Plugin.Log.LogInfo((object)$"Teleported {((Object)CS$<>8__locals0.character).name} to Spawn Point {localindex + 1} from Teleporter {((Object)((Component)component).gameObject).name}");
					CurrentSpawnPointIndex = localindex + 1;
					CS$<>8__locals0.character.refs.afflictions.ClearAllStatus(false);
					((MonoBehaviour)CS$<>8__locals0.character).StartCoroutine(FixPassout());
				}
				[IteratorStateMachine(typeof(<>c__DisplayClass12_3.<<DelayedActivation>g__FixPassout|3>d))]
				IEnumerator FixPassout()
				{
					//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
					return new <>c__DisplayClass12_3.<<DelayedActivation>g__FixPassout|3>d(0)
					{
						<>4__this = CS$<>8__locals0
					};
				}
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass12_3
		{
			public Character character;
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass12_4
		{
			public int localindex;

			internal void <DelayedActivation>b__4(Character character)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				if (character.IsLocal)
				{
					character.WarpPlayerRPC(spawnPoints[localindex].position - Vector3.up, true);
					CurrentSpawnPointIndex = localindex;
					Plugin.Log.LogInfo((object)$"reverse Teleported {((Object)character).name} to Spawn Point {localindex}");
					character.refs.afflictions.ClearAllStatus(false);
					GiveResetBerry(character);
				}
			}
		}

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

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				//IL_062d: 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_00ac: Expected O, but got Unknown
				//IL_0179: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Expected O, but got Unknown
				//IL_026b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0272: Expected O, but got Unknown
				//IL_0540: Unknown result type (might be due to invalid IL or missing references)
				//IL_0547: Expected O, but got Unknown
				//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0600: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Plugin.Log.LogInfo((object)"Delaying Activation of ScoutmasterSpawner ------------------------------------ new Round ----------------------------------------------");
					CurrentSpawnPointIndex = 0;
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					Plugin.Log.LogInfo((object)"Moving Peak Finisher So that we can use it later");
					((Component)Singleton<PeakHandler>.Instance).transform.SetParent((Transform)null, true);
					Plugin.Log.LogInfo((object)"Deactivating Map Parts");
					foreach (Transform item2 in GameObject.Find("Map").transform)
					{
						Transform val = item2;
						((Component)val).gameObject.SetActive(false);
					}
					GameObject.Find("EdgeWalls").SetActive(false);
					GameObject.Find("FogCutouts").SetActive(false);
					GameObject.Find("MountainProgress").SetActive(false);
					GameObject.Find("FogSphereSystem").SetActive(false);
					GameObject.Find("BlindPost").SetActive(false);
					GameObject.Find("Post Fog").SetActive(false);
					GameObject.Find("WaterMesh").SetActive(false);
					GameObject.Find("WaterZone").SetActive(false);
					Plugin.Log.LogInfo((object)"Instantiating Cutom Map Prefab");
					GameObject val2 = Plugin.Bundle.LoadAsset<GameObject>("Dropper Prefab");
					GameObject val3 = Object.Instantiate<GameObject>(val2, Vector3.up * 10f, Quaternion.identity);
					Plugin.Log.LogInfo((object)"Setting up Networking objects");
					GameObject val4 = GameObject.Find("GAME");
					addItemScript = val4.gameObject.AddComponent<AddItemInNetwork>();
					photonScript = val4.gameObject.GetComponent<PhotonView>();
					Plugin.Log.LogInfo((object)"Setting up Default Material");
					DefaultMaterial = new Material(((Renderer)((Component)val3.transform.Find("Dummy test object (1)")).GetComponent<MeshRenderer>()).material);
					DefaultMaterial.shader = Shader.Find("W/Peak_Standard");
					Plugin.Log.LogInfo((object)"Setting up Materials");
					SetupMaterial(val3);
					Plugin.Log.LogInfo((object)"Setting up Spawn Points");
					Transform val5 = val3.gameObject.transform.Find("Spawn Points Modding");
					spawnPoints = new List<Transform>();
					foreach (Transform item3 in val5)
					{
						Transform item = item3;
						spawnPoints.Add(item);
					}
					Plugin.Log.LogInfo((object)$"Found {spawnPoints.Count} Spawn points");
					Plugin.Log.LogInfo((object)"Setting Up Teleporation Cubes");
					if (Mode == GameMode.Dropper)
					{
						GameObject val6 = GameObject.Find("ohter parent");
						Plugin.Log.LogInfo((object)$"Found {val6.transform.childCount} End Portals");
						MaxSpawnPointIndex = val6.transform.childCount;
						for (int i = 0; i < val6.transform.childCount; i++)
						{
							<>c__DisplayClass12_0 CS$<>8__locals0 = new <>c__DisplayClass12_0
							{
								localindex = i,
								component = ((Component)val6.transform.GetChild(i)).gameObject.AddComponent<TriggerTeleporter>()
							};
							TriggerTeleporter component = CS$<>8__locals0.component;
							component.Interacted = (Action<Character>)Delegate.Combine(component.Interacted, (Action<Character>)delegate(Character character)
							{
								//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_003d: Unknown result type (might be due to invalid IL or missing references)
								<>c__DisplayClass12_1 CS$<>8__locals4 = new <>c__DisplayClass12_1
								{
									character = character
								};
								if (CS$<>8__locals4.character.IsLocal)
								{
									CS$<>8__locals4.character.WarpPlayerRPC(spawnPoints[CS$<>8__locals0.localindex + 1].position - Vector3.up, true);
									Plugin.Log.LogInfo((object)$"Teleported {((Object)CS$<>8__locals4.character).name} to Spawn Point {CS$<>8__locals0.localindex + 1} from Teleporter {((Object)((Component)CS$<>8__locals0.component).gameObject).name}");
									CurrentSpawnPointIndex = CS$<>8__locals0.localindex + 1;
									((MonoBehaviour)CS$<>8__locals4.character).StartCoroutine(FixPassout());
								}
								[IteratorStateMachine(typeof(<>c__DisplayClass12_1.<<DelayedActivation>g__FixPassout|1>d))]
								IEnumerator FixPassout()
								{
									//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
									return new <>c__DisplayClass12_1.<<DelayedActivation>g__FixPassout|1>d(0)
									{
										<>4__this = CS$<>8__locals4
									};
								}
							});
						}
					}
					else if (Mode == GameMode.Descend)
					{
						GameObject val7 = GameObject.Find("Next Stage Parent");
						Plugin.Log.LogInfo((object)$"Found {val7.transform.childCount} Teleporters");
						MaxSpawnPointIndex = val7.transform.childCount;
						for (int j = 0; j < val7.transform.childCount; j++)
						{
							<>c__DisplayClass12_2 CS$<>8__locals1 = new <>c__DisplayClass12_2
							{
								localindex = j,
								component = ((Component)val7.transform.GetChild(j).GetChild(0)).gameObject.AddComponent<InteratableTeleporter>()
							};
							InteratableTeleporter component2 = CS$<>8__locals1.component;
							component2.Interacted = (Action<Character>)Delegate.Combine(component2.Interacted, (Action<Character>)delegate(Character character)
							{
								//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_003d: Unknown result type (might be due to invalid IL or missing references)
								<>c__DisplayClass12_3 CS$<>8__locals3 = new <>c__DisplayClass12_3
								{
									character = character
								};
								if (CS$<>8__locals3.character.IsLocal)
								{
									CS$<>8__locals3.character.WarpPlayerRPC(spawnPoints[CS$<>8__locals1.localindex + 1].position - Vector3.up, true);
									Plugin.Log.LogInfo((object)$"Teleported {((Object)CS$<>8__locals3.character).name} to Spawn Point {CS$<>8__locals1.localindex + 1} from Teleporter {((Object)((Component)CS$<>8__locals1.component).gameObject).name}");
									CurrentSpawnPointIndex = CS$<>8__locals1.localindex + 1;
									CS$<>8__locals3.character.refs.afflictions.ClearAllStatus(false);
									((MonoBehaviour)CS$<>8__locals3.character).StartCoroutine(FixPassout());
								}
								[IteratorStateMachine(typeof(<>c__DisplayClass12_3.<<DelayedActivation>g__FixPassout|3>d))]
								IEnumerator FixPassout()
								{
									//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
									return new <>c__DisplayClass12_3.<<DelayedActivation>g__FixPassout|3>d(0)
									{
										<>4__this = CS$<>8__locals3
									};
								}
							});
						}
					}
					Plugin.Log.LogInfo((object)"Setting up Reverse Teleporters");
					GameObject val8 = GameObject.Find("Reverse Teleporters");
					for (int k = 0; k < val8.transform.childCount; k++)
					{
						<>c__DisplayClass12_4 CS$<>8__locals2 = new <>c__DisplayClass12_4();
						Transform child = val8.transform.GetChild(k);
						CS$<>8__locals2.localindex = k;
						InteractableBackPorter interactableBackPorter = ((Component)child).gameObject.AddComponent<InteractableBackPorter>();
						interactableBackPorter.Interacted = (Action<Character>)Delegate.Combine(interactableBackPorter.Interacted, (Action<Character>)delegate(Character character)
						{
							//IL_001a: Unknown result type (might be due to invalid IL or missing references)
							//IL_001f: Unknown result type (might be due to invalid IL or missing references)
							//IL_0024: Unknown result type (might be due to invalid IL or missing references)
							if (character.IsLocal)
							{
								character.WarpPlayerRPC(spawnPoints[CS$<>8__locals2.localindex].position - Vector3.up, true);
								CurrentSpawnPointIndex = CS$<>8__locals2.localindex;
								Plugin.Log.LogInfo((object)$"reverse Teleported {((Object)character).name} to Spawn Point {CS$<>8__locals2.localindex}");
								character.refs.afflictions.ClearAllStatus(false);
								GiveResetBerry(character);
							}
						});
					}
					InteratableFinisher interatableFinisher = GameObject.Find("Finisher").AddComponent<InteratableFinisher>();
					interatableFinisher.Interacted = (Action<Character>)Delegate.Combine(interatableFinisher.Interacted, (Action<Character>)delegate(Character character)
					{
						MethodInfo method = typeof(Character).GetMethod("TestWin", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
						method.Invoke(character, new object[0]);
					});
					foreach (Transform item4 in GameObject.Find("Brewing stands").transform)
					{
						Transform val9 = item4;
						InteractableBrewingStand interactableBrewingStand = ((Component)val9).gameObject.AddComponent<InteractableBrewingStand>();
						interactableBrewingStand.Interacted = (Action<Character>)Delegate.Combine(interactableBrewingStand.Interacted, (Action<Character>)delegate(Character character)
						{
							Plugin.Log.LogInfo((object)$"Character  {character.characterName} has interacted with the brewing stand | Is character local: {character.IsLocal}");
							_ = character.IsLocal;
							addItemScript.AddItemIntoInventory(Plugin.HealthPotion.itemID, ((MonoBehaviourPun)character).photonView.ViewID);
						});
					}
					if (Mode == GameMode.Dropper)
					{
						GameObject.Find("Dropper Map").SetActive(true);
						GameObject.Find("Descend map").SetActive(false);
					}
					else
					{
						GameObject.Find("Dropper Map").SetActive(false);
						GameObject.Find("Descend map").SetActive(true);
					}
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 2;
					return true;
				}
				case 2:
					<>1__state = -1;
					if (spawnPoints.Count > 0)
					{
						Character.localCharacter.WarpPlayerRPC(spawnPoints[0].position, true);
						Plugin.Log.LogInfo((object)$"Teleporting Players to Spawn Point {0} | {((Object)((Component)spawnPoints[0]).gameObject).name}");
					}
					else
					{
						Plugin.Log.LogError((object)"No spawn points found in the prefab!");
					}
					GiveResetBerry(Character.localCharacter);
					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 static Material DefaultMaterial;

		public static List<Transform> spawnPoints;

		public static int CurrentSpawnPointIndex = 0;

		public static int MaxSpawnPointIndex = 0;

		public static PhotonView photonScript;

		public static AddItemInNetwork addItemScript;

		public static GameMode Mode = GameMode.Dropper;

		public static bool gainFullControlOfCharacter = false;

		public static string ResetBerryName = Plugin.PLuginID + ":ResetBerry";

		public static string HealthPotionName = Plugin.PLuginID + ":Health potion";

		private static Dictionary<string, Shader> _peakShaders = null;

		internal static Dictionary<string, Shader> PeakShaders
		{
			get
			{
				if (_peakShaders == null)
				{
					List<string> list = new List<string>
					{
						"W/Peak_Standard", "W/Character", "W/Peak_Transparent", "W/Peak_Glass", "W/Peak_Clip", "W/Peak_glass_liquid", "W/Peak_GroundTransition", "W/Peak_Guidebook", "W/Peak_Honey", "W/Peak_Ice",
						"W/Peak_Rock", "W/Peak_Rope", "W/Peak_Splash", "W/Peak_Waterfall", "W/Vine", "Universal Render Pipeline/Lit"
					};
					_peakShaders = new Dictionary<string, Shader>();
					foreach (string item in list)
					{
						Shader val = Shader.Find(item);
						if ((Object)(object)val == (Object)null)
						{
							Plugin.Log.LogWarning((object)("Shader " + item + " not found, skipping."));
						}
						else
						{
							_peakShaders[item] = val;
						}
					}
				}
				return _peakShaders;
			}
		}

		[HarmonyPatch(typeof(ScoutmasterSpawner), "Awake")]
		[HarmonyPostfix]
		private static void ScoutmasterSpawner_Awake_Postfix(ScoutmasterSpawner __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(DelayedActivation());
		}

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

		public static void GiveResetBerry(Character character)
		{
			if ((Object)(object)character.player.itemSlots[0].prefab == (Object)(object)Plugin.ResetBerryItem || (Object)(object)character.player.itemSlots[1].prefab == (Object)(object)Plugin.ResetBerryItem || (Object)(object)character.player.itemSlots[2].prefab == (Object)(object)Plugin.ResetBerryItem)
			{
				Plugin.Log.LogInfo((object)("Not giving charater: " + character.characterName));
			}
			else
			{
				addItemScript.AddItemIntoInventory(Plugin.ResetBerryItem.itemID, ((MonoBehaviourPun)character).photonView.ViewID);
			}
		}

		private static void UnPassOut(Character character)
		{
			FieldInfo field = typeof(Character).GetField("UnPassOutCalled", BindingFlags.Instance | BindingFlags.NonPublic);
			field.SetValue(character, false);
			((MonoBehaviour)character).StartCoroutine(Wait3s());
			[IteratorStateMachine(typeof(<<UnPassOut>g__Wait3s|14_0>d))]
			static IEnumerator Wait3s()
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <<UnPassOut>g__Wait3s|14_0>d(0);
			}
		}

		[HarmonyPatch(typeof(CharacterData), "GetTargetRagdollControll")]
		[HarmonyPrefix]
		public static bool Prefix(CharacterData __instance, ref float __result)
		{
			if (gainFullControlOfCharacter)
			{
				__result = 1f;
				__instance.fallSeconds = 0f;
				__instance.passedOut = false;
				__instance.passOutValue = 0f;
				__instance.fullyPassedOut = false;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(AchievementManager), "ThrowAchievement")]
		[HarmonyPrefix]
		private static bool AchievementManager_ThrowAchievement_Prefix(AchievementManager __instance)
		{
			return false;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static bool OverrideHungerRateMultiplier(ref float __result)
		{
			__result = 0f;
			return false;
		}

		[HarmonyPatch(typeof(BerryBush), "SpawnItems")]
		[HarmonyPrefix]
		private static void BerryBush_SpawnItems_Prefix(BerryBush __instance, ref List<Transform> spawnSpots)
		{
			spawnSpots.Clear();
		}

		[HarmonyPatch(typeof(ScoutmasterSpawner), "SpawnScoutmaster")]
		[HarmonyPrefix]
		private static bool ScoutmasterSpawner_SpawnScoutmaster_Prefix(ScoutmasterSpawner __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(Character), "RPCA_PassOut")]
		[HarmonyPrefix]
		private static bool Character_RPCA_PassOut_Prefix(Character __instance)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Log.LogInfo((object)$"Preventing {((Object)__instance).name} from passing out and respawning him at spawnpointIndex: {CurrentSpawnPointIndex}");
			__instance.refs.afflictions.ClearAllStatus(false);
			__instance.WarpPlayerRPC(spawnPoints[CurrentSpawnPointIndex].position, true);
			return false;
		}

		[HarmonyPatch(typeof(CharacterItems), "DoDropping")]
		[HarmonyPrefix]
		private static bool CharacterItems_DoDropping_Prefix(CharacterItems __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(ItemSlot), "EmptyOut")]
		[HarmonyPrefix]
		private static bool ItemSlot_EmptyOut_Prefix(ItemSlot __instance)
		{
			Plugin.Log.LogInfo((object)("Preventing " + ((Object)((Component)__instance.prefab).gameObject).name + " from being dropped isntead " + ResetBerryName));
			if (((Object)((Component)__instance.prefab).gameObject).name == ResetBerryName)
			{
				return false;
			}
			return true;
		}

		private static void CheckEveryMaterialShader(GameObject gameObject)
		{
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				for (int j = 0; j < val.materials.Length; j++)
				{
					Material val2 = val.materials[j];
					Plugin.Log.LogInfo((object)("Rendere " + ((Object)((Component)val).gameObject).name + " with Material " + ((Object)val2).name + " uses shader " + ((Object)val2.shader).name));
				}
			}
		}

		public static void SetupMaterial(GameObject gameObject)
		{
			Renderer[] componentsInChildren = gameObject.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if (PeakShaders.TryGetValue(((Object)val2.shader).name, out Shader value))
					{
						val2.shader = value;
					}
				}
			}
			Renderer[] componentsInChildren2 = gameObject.GetComponentsInChildren<Renderer>();
			foreach (Renderer val3 in componentsInChildren2)
			{
				Material[] materials2 = val3.materials;
				foreach (Material val4 in materials2)
				{
					if (((Object)val4.shader).name == "Universal Render Pipeline/Lit" && !val4.IsKeywordEnabled("_EMISSION") && !IsTransparent(val4) && !HasAlphaClipping(val4))
					{
						Texture texture = val4.GetTexture("_BaseMap");
						if ((Object)(object)texture == (Object)null)
						{
							Plugin.Log.LogInfo((object)("No texture found for material " + ((Object)val4).name + ", skipping conversion."));
							continue;
						}
						val4.shader = DefaultMaterial.shader;
						val4.SetTexture("_BaseTexture", texture);
					}
				}
				val3.materials = materials2;
			}
		}

		private static bool IsTransparent(Material mat)
		{
			if (mat.HasProperty("_Surface"))
			{
				float @float = mat.GetFloat("_Surface");
				return @float > 0.5f;
			}
			return mat.renderQueue >= 3000;
		}

		private static bool HasAlphaClipping(Material mat)
		{
			return mat.IsKeywordEnabled("_ALPHATEST_ON");
		}
	}
	internal class MandatoryHarmonyPatches
	{
		private static bool modifiedBoardpass;

		private static LoadCorrectDropper loader;

		[HarmonyPatch(typeof(AchievementManager), "GetMaxAscent")]
		[HarmonyPostfix]
		public static void AchievementManager_GetMaxAscent_Postfix(ref int __result)
		{
			__result += 2;
		}

		[HarmonyPatch(typeof(AirportCheckInKiosk), "Awake")]
		[HarmonyPostfix]
		private static void AirportCheckInKiosk_Awake_Postfix(AirportCheckInKiosk __instance)
		{
			Plugin.Log.LogInfo((object)"Starting To add in additional Game Modes");
			loader = ((Component)__instance).gameObject.AddComponent<LoadCorrectDropper>();
			AddGameModes();
		}

		private static void AddGameModes()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0083: Expected O, but got Unknown
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Expected O, but got Unknown
			if (modifiedBoardpass)
			{
				Plugin.Log.LogInfo((object)"Game modes already added, skipping...");
				return;
			}
			Plugin.Log.LogInfo((object)"Adding Game Modes to Boarding Pass...");
			AscentData instance = SingletonAsset<AscentData>.Instance;
			modifiedBoardpass = true;
			instance.ascents.Add(new AscentInstanceData
			{
				color = Color.black,
				title = "Dropper",
				description = "",
				titleReward = "Immense dread",
				sashSprite = Plugin.Bundle.LoadAsset<Sprite>("icon")
			});
			instance.ascents.Add(new AscentInstanceData
			{
				color = Color.black,
				title = "Dropper - Descend",
				description = "",
				titleReward = "Immense dread",
				sashSprite = Plugin.Bundle.LoadAsset<Sprite>("icon")
			});
			AscentInstanceData value = instance.ascents[instance.ascents.Count - 1];
			AscentInstanceData value2 = instance.ascents[instance.ascents.Count - 2];
			for (int num = instance.ascents.Count - 1; num > 1; num--)
			{
				instance.ascents[num] = instance.ascents[num - 1];
			}
			for (int num2 = instance.ascents.Count - 1; num2 > 1; num2--)
			{
				instance.ascents[num2] = instance.ascents[num2 - 1];
			}
			instance.ascents[1] = value2;
			instance.ascents[2] = value;
		}

		[HarmonyPatch(typeof(BoardingPass), "Initialize")]
		[HarmonyPrefix]
		public static void Prefix(BoardingPass __instance)
		{
			FieldInfo field = typeof(BoardingPass).GetField("maxAscent", BindingFlags.Instance | BindingFlags.NonPublic);
			int num = (int)field.GetValue(__instance);
			field.SetValue(__instance, num + 1);
		}

		[HarmonyPatch(typeof(BoardingPass), "StartGame")]
		[HarmonyPrefix]
		public static void BoardingPass_StartGame_Prefix(BoardingPass __instance)
		{
			Plugin.Log.LogInfo((object)$"DROPPER Starting Game with Ascent Index: {__instance.ascentIndex}");
			((Component)loader).GetComponent<PhotonView>().RPC("LoadDropper", (RpcTarget)0, new object[1] { __instance.ascentIndex });
		}

		[HarmonyPatch(typeof(AscentUI), "Update")]
		[HarmonyPostfix]
		public static void AscentUI_Update_Postfix(AscentUI __instance)
		{
			if (Ascents.currentAscent >= 0 && !Plugin.PlayingDropperMap)
			{
				((TMP_Text)__instance.text).text = SingletonAsset<AscentData>.Instance.ascents[Ascents.currentAscent + 3].localizedTitle;
			}
			else if (Plugin.PlayingDropperMap)
			{
				switch (HarmonyPatches.Mode)
				{
				case HarmonyPatches.GameMode.Dropper:
					((TMP_Text)__instance.text).text = SingletonAsset<AscentData>.Instance.ascents[Ascents.currentAscent + 1].localizedTitle;
					break;
				case HarmonyPatches.GameMode.Descend:
					((TMP_Text)__instance.text).text = SingletonAsset<AscentData>.Instance.ascents[Ascents.currentAscent + 2].localizedTitle;
					break;
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		public static void OverrideAscentDifficulty(ref int __result)
		{
			if (Plugin.PlayingDropperMap)
			{
				__result = 0;
			}
			else if (__result > 0)
			{
				__result -= 2;
			}
		}
	}
	public class TriggerTeleporter : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <EnableCharactersDelayed>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TriggerTeleporter <>4__this;

			public int id;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Expected O, but got Unknown
				int num = <>1__state;
				TriggerTeleporter triggerTeleporter = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					triggerTeleporter.charactersInTrigger.Remove(id);
					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 Action<Character> Interacted;

		public List<int> charactersInTrigger = new List<int>();

		private void OnTriggerEnter(Collider other)
		{
			Character componentInParent = ((Component)((Component)other).transform).GetComponentInParent<Character>();
			if ((Object)(object)componentInParent != (Object)null)
			{
				int viewID = ((Component)componentInParent).GetComponent<PhotonView>().ViewID;
				if (!charactersInTrigger.Contains(viewID))
				{
					charactersInTrigger.Add(viewID);
					Interacted?.Invoke(componentInParent);
					((MonoBehaviour)componentInParent).StartCoroutine(EnableCharactersDelayed(viewID));
				}
			}
		}

		[IteratorStateMachine(typeof(<EnableCharactersDelayed>d__3))]
		private IEnumerator EnableCharactersDelayed(int id)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EnableCharactersDelayed>d__3(0)
			{
				<>4__this = this,
				id = id
			};
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}