Decompiled source of PEAK Checkpoint Save v0.4.4

plugins/PEAK_Checkpoint_Save.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Peak.Network;
using Photon.Pun;
using Photon.Voice.Unity.Demos;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Zorro.Core;
using Zorro.Core.Serizalization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PEAK_Checkpoint_Save")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.4.0")]
[assembly: AssemblyInformationalVersion("0.4.4")]
[assembly: AssemblyProduct("PEAK_Checkpoint_Save")]
[assembly: AssemblyTitle("PEAK_Checkpoint_Save")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.4.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 PEAK_Checkpoint_Save
{
	[BepInPlugin("PEAK_Checkpoint_Save", "PEAK_Checkpoint_Save", "0.4.4")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Campfire))]
		public static class Campfire_AutoSave_Patch
		{
			[HarmonyPatch("Interact_CastFinished")]
			[HarmonyPostfix]
			public static void AutoSaveOnCampfire(Campfire __instance)
			{
				//IL_0019: 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_002c: Unknown result type (might be due to invalid IL or missing references)
				if ((Instance.extModsPeakapaloozaENABLED && !Instance.extModsPeakapaloozaPEAKTOBEACH && ((int)__instance.advanceToSegment == 0 || __instance.advanceToSegment == Instance.savedSegment)) || __instance.beenBurningFor > 2f || ((Object)__instance).name.Contains("PortableStovetop_Placed"))
				{
					return;
				}
				if (Instance.extModsPeakapaloozaENABLED && Instance.extModsPeakapaloozaPEAKTOBEACH && !Instance.extModsPeakapaloozaLITFIRSTCAMPFIRE && Instance.loadedSaveFileThisRound)
				{
					Instance.extModsPeakapaloozaLITFIRSTCAMPFIRE = true;
				}
				else
				{
					string text = default(string);
					if (RecentlyLitCampfire > Time.time || !__instance.EveryoneInRange(ref text, 15f))
					{
						return;
					}
					RecentlyLitCampfire = Time.time + 32f;
					RecentlyLoaded = Time.time + 30f;
					Instance.extModsPeakapaloozaLITFIRSTCAMPFIRE = true;
					if ((Object)(object)Instance == (Object)null)
					{
						Debug.LogError((object)"[Checkpoint_Save] Plugin.Instance is NULL! Autosave failed.");
						return;
					}
					((BaseUnityPlugin)Instance).Logger.LogInfo((object)"[Checkpoint_Save] Campfire lit → Autosave triggered.");
					if (PhotonNetwork.OfflineMode)
					{
						Instance.SavePlayerOffline();
					}
					else if (PhotonNetwork.IsMasterClient)
					{
						Instance.pv.RPC("RPC_RecentlyLitCampfire", (RpcTarget)1, Array.Empty<object>());
						Instance.SavePlayerCoop();
					}
					else
					{
						Instance.pv.RPC("RPC_RequestSave", (RpcTarget)2, Array.Empty<object>());
					}
					Instance.loadedSaveFileThisRound = true;
				}
			}
		}

		[HarmonyPatch(typeof(CharacterMovement))]
		[HarmonyPatch("CheckFallDamage")]
		internal class Patch_FallDamage_Protection
		{
			private static bool Prefix(CharacterMovement __instance)
			{
				if (Time.time < NoFallDamageUntil)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Lava))]
		[HarmonyPatch("HitPlayer")]
		internal class Patch_Lava_Hitplayer_Protection
		{
			private static bool Prefix(Lava __instance)
			{
				if (Time.time < NoFallDamageUntil)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Lava))]
		[HarmonyPatch("Heat")]
		internal class Patch_Lava_Heat_Protection
		{
			private static bool Prefix(Lava __instance)
			{
				if (Time.time < NoFallDamageUntil)
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(BoardingPass), "UpdateAscent")]
		private static class UpdateAscent_Override
		{
			public static void Prefix(BoardingPass __instance)
			{
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					Instance.selectedAscent = __instance.ascentIndex;
					if (Instance.PreStartSetSegment())
					{
						Instance.ShowBoardingpassMessage(active: true);
						((Component)Instance._boardingToggle).gameObject.SetActive(true);
					}
					else
					{
						Instance.ShowBoardingpassMessage(active: true, "No savefile found!");
						((Component)Instance._boardingToggle).gameObject.SetActive(false);
						Instance.ShowMessage("", Color.cyan, 0f);
					}
				}
			}
		}

		[HarmonyPatch(typeof(BoardingPass), "OnOpen")]
		private static class onOpen_Override
		{
			public static void Prefix(BoardingPass __instance)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					Instance.ShowMessage("", Color.cyan, 0f);
					if (Instance.configEnableBoardingpassInformation.Value)
					{
						if (Instance.PreStartSetSegment())
						{
							Instance.ShowBoardingpassMessage(active: true);
							((Component)Instance._boardingToggle).gameObject.SetActive(true);
						}
						else
						{
							Instance.ShowBoardingpassMessage(active: true, "No savefile found!");
							((Component)Instance._boardingToggle).gameObject.SetActive(false);
							Instance.ShowMessage("", Color.cyan, 0f);
						}
					}
				}
				else
				{
					Instance.ShowMessage("Only the host can start the game!", new Color(Convert.ToSingle(Instance.configTextmessageColorError.Value.Split(',')[0]) / 255f, Convert.ToSingle(Instance.configTextmessageColorError.Value.Split(',')[1]) / 255f, Convert.ToSingle(Instance.configTextmessageColorError.Value.Split(',')[2]) / 255f, 1f), 10000f);
					BoardingPass val = Object.FindAnyObjectByType<BoardingPass>();
					((Behaviour)val.startGameButton).enabled = false;
					((Behaviour)val.incrementAscentButton).enabled = false;
					((Behaviour)val.decrementAscentButton).enabled = false;
				}
			}
		}

		[HarmonyPatch(typeof(BoardingPass), "OnClose")]
		private static class onClose_Override
		{
			public static void Prefix(BoardingPass __instance)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					Instance.ShowBoardingpassMessage(active: false);
				}
				Instance.ShowMessage("", Color.cyan, 0f);
			}
		}

		[HarmonyPatch(typeof(BoardingPass), "HideIt")]
		private static class hideIt_Override
		{
			public static void Prefix(BoardingPass __instance)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					Instance.ShowBoardingpassMessage(active: false);
				}
				Instance.ShowMessage("", Color.cyan, 0f);
			}
		}

		[HarmonyPatch(typeof(BoardingPass), "StartGame")]
		private static class startGame_Override
		{
			public static void Prefix(BoardingPass __instance)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					Instance.ShowBoardingpassMessage(active: false);
				}
				Instance.ShowMessage("", Color.cyan, 0f);
			}
		}

		[HarmonyPatch(typeof(MapBaker), "GetLevel")]
		private static class GetLevel_Override
		{
			private static bool Prefix(MapBaker __instance, int levelIndex, ref string __result)
			{
				try
				{
					if (!Instance.configLoadLevelScene.Value)
					{
						return true;
					}
					if (Instance.selectedLevel != null && Instance.selectedLevel != "" && Instance.selectedLevel != "null")
					{
						__result = Instance.selectedLevel;
						return false;
					}
					return true;
				}
				catch
				{
					return true;
				}
			}
		}

		[Serializable]
		public class SaveData
		{
			public int settingsVersion;

			public string saveDate;

			public List<string> playerNames;

			public string campfireName;

			public float timePlayed;

			public float posX;

			public float posY;

			public float posZ;

			public string sceneName;

			public List<BiomeType> biomes;

			public List<string> biome_names;

			public Segment segment;

			public bool hasBackpack;

			public bool isSkeleton;

			public List<SavedItemState> inventoryItemStates;

			public List<SavedBackpackItemState> backpackItemStates;

			public float[] afflictions_current;

			public float extraStamina;

			public bool extModsPeakapaloozaPEAKTOBEACH;
		}

		[Serializable]
		public class SavedItemState
		{
			public int slotIndex;

			public ushort itemId;

			public Dictionary<string, SavedEntry> values = new Dictionary<string, SavedEntry>();
		}

		[Serializable]
		public class SavedBackpackItemState
		{
			public byte slotIndex;

			public ushort itemId;

			public Dictionary<string, SavedEntry> values = new Dictionary<string, SavedEntry>();
		}

		[Serializable]
		public class SavedEntry
		{
			public string type;

			public float value;
		}

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

			private object <>2__current;

			public Segment segment;

			public Plugin <>4__this;

			public Vector3 savedPos;

			private Segment <final_segment>5__2;

			private MapHandler <mh>5__3;

			private int <index>5__4;

			private MapSegment <targetSegment>5__5;

			private Vector3 <spawnPos>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<mh>5__3 = null;
				<targetSegment>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: 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_013c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: 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_0167: Expected O, but got Unknown
				//IL_035f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0365: Invalid comparison between Unknown and I4
				//IL_0877: Unknown result type (might be due to invalid IL or missing references)
				//IL_091f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0925: Invalid comparison between Unknown and I4
				//IL_0512: Unknown result type (might be due to invalid IL or missing references)
				//IL_0518: Invalid comparison between Unknown and I4
				//IL_0815: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Expected O, but got Unknown
				//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0208: Expected I4, but got Unknown
				//IL_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0888: Unknown result type (might be due to invalid IL or missing references)
				//IL_088e: Invalid comparison between Unknown and I4
				//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_08dd: Expected O, but got Unknown
				//IL_0951: Unknown result type (might be due to invalid IL or missing references)
				//IL_0956: Unknown result type (might be due to invalid IL or missing references)
				//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_093f: Unknown result type (might be due to invalid IL or missing references)
				//IL_061c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0626: Expected O, but got Unknown
				//IL_081d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0823: Invalid comparison between Unknown and I4
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Expected O, but got Unknown
				//IL_0282: Unknown result type (might be due to invalid IL or missing references)
				//IL_0288: Invalid comparison between Unknown and I4
				//IL_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: Invalid comparison between Unknown and I4
				//IL_0562: Unknown result type (might be due to invalid IL or missing references)
				//IL_056c: Expected O, but got Unknown
				//IL_053c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0542: Invalid comparison between Unknown and I4
				//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0600: Unknown result type (might be due to invalid IL or missing references)
				//IL_0854: Unknown result type (might be due to invalid IL or missing references)
				//IL_085e: Expected O, but got Unknown
				//IL_0826: Unknown result type (might be due to invalid IL or missing references)
				//IL_082c: Invalid comparison between Unknown and I4
				//IL_082f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0835: Invalid comparison between Unknown and I4
				//IL_026e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0273: Unknown result type (might be due to invalid IL or missing references)
				//IL_027a: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_08b6: Expected O, but got Unknown
				//IL_0838: Unknown result type (might be due to invalid IL or missing references)
				//IL_083e: Invalid comparison between Unknown and I4
				//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
				//IL_03de: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e8: Expected I4, but got Unknown
				//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0419: Unknown result type (might be due to invalid IL or missing references)
				//IL_041f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0429: Expected I4, but got Unknown
				//IL_040c: Unknown result type (might be due to invalid IL or missing references)
				//IL_042c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0432: Unknown result type (might be due to invalid IL or missing references)
				//IL_043c: Expected I4, but got Unknown
				//IL_0300: Unknown result type (might be due to invalid IL or missing references)
				//IL_0306: Invalid comparison between Unknown and I4
				//IL_0309: Unknown result type (might be due to invalid IL or missing references)
				//IL_030f: Invalid comparison between Unknown and I4
				//IL_0344: Unknown result type (might be due to invalid IL or missing references)
				//IL_034e: Expected O, but got Unknown
				//IL_0327: Unknown result type (might be due to invalid IL or missing references)
				//IL_032d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0333: Expected I4, but got Unknown
				//IL_0312: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<final_segment>5__2 = segment;
					((BaseUnityPlugin)plugin).Logger.LogInfo((object)$"[Checkpoint_Save] Executing Custom Jump to: {<final_segment>5__2}");
					plugin.LoadingScreen(enableLoadingScreen: true);
					if (!PhotonNetwork.OfflineMode)
					{
						plugin.pv.RPC("RPC_Loadingscreen", (RpcTarget)1, new object[2] { "true", "Loading savegame..." });
					}
					<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					PhotonView? pv = plugin.pv;
					if (pv != null)
					{
						pv.RPC("RPC_RequestFalldamageProtection", (RpcTarget)0, new object[1] { 30 });
					}
					<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
					<>1__state = 2;
					return true;
				}
				case 2:
					<>1__state = -1;
					plugin.ReviveDeadPlayers(savedPos + new Vector3(0f, 4f, 0f), segment);
					<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					try
					{
						EndScreen val5 = Object.FindFirstObjectByType<EndScreen>();
						if (((MenuWindow)val5).isOpen)
						{
							MenuWindow obj3 = Object.FindFirstObjectByType<MenuWindow>();
							typeof(MenuWindow).GetMethod("Close", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj3, null);
							plugin.pv.RPC("RPC_CloseEndscreen", (RpcTarget)1, Array.Empty<object>());
						}
					}
					catch
					{
					}
					<mh>5__3 = Singleton<MapHandler>.Instance;
					if ((Object)(object)<mh>5__3 == (Object)null)
					{
						<>2__current = null;
						<>1__state = 4;
						return true;
					}
					goto IL_01fc;
				case 4:
					<>1__state = -1;
					goto IL_01fc;
				case 5:
					<>1__state = -1;
					if ((int)<final_segment>5__2 < 3)
					{
						Campfire val4 = Object.FindFirstObjectByType<Campfire>();
						if ((Object)(object)val4 != (Object)null)
						{
							PhotonView component = ((Component)val4).GetComponent<PhotonView>();
							if ((Object)(object)component != (Object)null && PhotonNetwork.IsMasterClient)
							{
								component.RPC("Light_Rpc", (RpcTarget)0, Array.Empty<object>());
							}
						}
					}
					goto IL_043c;
				case 6:
					<>1__state = -1;
					plugin.ResetLuggage();
					if (PhotonNetwork.IsMasterClient)
					{
						if (plugin.loadedSaveFileThisRound)
						{
							try
							{
								ISpawner[] componentsInChildren = <targetSegment>5__5.segmentParent.GetComponentsInChildren<ISpawner>();
								foreach (ISpawner val2 in componentsInChildren)
								{
									val2.TrySpawnItems();
								}
							}
							catch
							{
							}
						}
						if (plugin.extModsPeakapaloozaENABLED && !plugin.extModsPeakapaloozaPEAKTOBEACH)
						{
							plugin.pv.RPC("RPC_SyncMapVisuals", (RpcTarget)1, new object[2] { <final_segment>5__2, savedPos });
						}
						<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
						<>1__state = 7;
						return true;
					}
					goto IL_0636;
				case 7:
					<>1__state = -1;
					goto IL_0636;
				case 8:
					<>1__state = -1;
					((MonoBehaviour)plugin).StartCoroutine(plugin.ResetFogAfterLoad(<index>5__4, <final_segment>5__2));
					goto IL_0887;
				case 9:
					<>1__state = -1;
					goto IL_08c7;
				case 10:
					<>1__state = -1;
					if (PhotonNetwork.IsMasterClient)
					{
						<>2__current = ((MonoBehaviour)plugin).StartCoroutine(plugin.TeleportToPosition(<spawnPos>5__6));
						<>1__state = 11;
						return true;
					}
					break;
				case 11:
					{
						<>1__state = -1;
						if ((int)<final_segment>5__2 == 4 && Ascents.currentAscent < 4)
						{
							((MonoBehaviour)plugin).StartCoroutine(plugin.SpawnFlaresAtPeak());
						}
						((MonoBehaviour)plugin).StartCoroutine(plugin.LoadInventoryDelayed(segment));
						break;
					}
					IL_01fc:
					<index>5__4 = (int)<final_segment>5__2;
					<targetSegment>5__5 = <mh>5__3.segments[<index>5__4];
					<spawnPos>5__6 = savedPos;
					<spawnPos>5__6.y += 5f;
					if (plugin.configTeleportTheKilnWorkaround.Value && (int)segment == 4 && !plugin.extModsPeakapaloozaPEAKTOBEACH)
					{
						<spawnPos>5__6 = new Vector3(-0.91186905f, 838.8689f, 1713.6833f);
						<final_segment>5__2 = (Segment)3;
					}
					else if ((int)segment != 4 && !plugin.configLoadLevelScene.Value)
					{
						<spawnPos>5__6.y += 8f;
					}
					if (plugin.extModsPeakapaloozaENABLED && plugin.extModsPeakapaloozaPEAKTOBEACH)
					{
						if (!plugin.loadedSaveFileThisRound)
						{
							PluginInfo val = Chainloader.PluginInfos["PEAKapalooza"];
							BaseUnityPlugin instance = val.Instance;
							Type type = ((object)instance).GetType();
							FieldInfo field = type.GetField("currentSegment", BindingFlags.Static | BindingFlags.Public);
							if (((int)<final_segment>5__2 == 2 || (int)<final_segment>5__2 == 1 || (int)<final_segment>5__2 == 0) && field != null)
							{
								field.SetValue(null, <final_segment>5__2 + 1);
							}
							<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
							<>1__state = 5;
							return true;
						}
					}
					else
					{
						switch (plugin.configTeleportJumpLogic.Value)
						{
						case 0:
							MapHandler.SetSegmentOnSpawn(<final_segment>5__2, (int)<final_segment>5__2);
							break;
						case 1:
							MapHandler.JumpToSegment(<final_segment>5__2);
							break;
						case 2:
							if ((Object)(object)<mh>5__3 != (Object)null)
							{
								<mh>5__3.GoToSegment(<final_segment>5__2);
							}
							else
							{
								MapHandler.SetSegmentOnSpawn(<final_segment>5__2, (int)<final_segment>5__2);
							}
							break;
						default:
							MapHandler.SetSegmentOnSpawn(<final_segment>5__2, (int)<final_segment>5__2);
							break;
						}
					}
					goto IL_043c;
					IL_08c7:
					<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
					<>1__state = 10;
					return true;
					IL_043c:
					if (PhotonNetwork.IsMasterClient && plugin.loadedSaveFileThisRound)
					{
						try
						{
							Item[] array = Object.FindObjectsByType<Item>((FindObjectsSortMode)0);
							Item[] array2 = array;
							foreach (Item val3 in array2)
							{
								if ((!((Object)(object)((Component)val3).transform.parent == (Object)null) && Object.op_Implicit((Object)(object)((Component)val3).GetComponentInParent<Player>())) || !((Object)(object)((MonoBehaviourPun)val3).photonView != (Object)null) || !((MonoBehaviourPun)val3).photonView.IsMine)
								{
									continue;
								}
								if (plugin.extModsPeakapaloozaENABLED && plugin.extModsPeakapaloozaPEAKTOBEACH)
								{
									if (!((Object)val3).name.Contains("BingBong") && !((Object)val3).name.Contains("Flare"))
									{
										PhotonNetwork.Destroy(((MonoBehaviourPun)val3).photonView);
									}
								}
								else
								{
									PhotonNetwork.Destroy(((MonoBehaviourPun)val3).photonView);
								}
							}
						}
						catch
						{
						}
					}
					if ((int)<final_segment>5__2 == 5)
					{
						<index>5__4--;
					}
					else if (plugin.configTeleportTheKilnWorkaround.Value && (int)<final_segment>5__2 == 4)
					{
						<index>5__4--;
					}
					<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
					<>1__state = 6;
					return true;
					IL_0887:
					if ((int)<final_segment>5__2 == 4 && plugin.loadedSaveFileThisRound && !plugin.extModsPeakapaloozaLAVADISABLED)
					{
						plugin.ResetLavaAfterLoad();
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 9;
						return true;
					}
					goto IL_08c7;
					IL_0636:
					if (plugin.loadedSaveFileThisRound)
					{
						try
						{
							List<string> list = new List<string>(11)
							{
								"ChainShootable", "RopeAnchor", "RopeDynamic", "PortableStovetop_Placed", "ClimbingSpikeHammered", "CloudFungus", "Flag_Planted_Checkpoint", "ShelfShroom", "ScoutCannon_Placed", "BounceShroomSpawn",
								"MagicBean"
							};
							GameObject[] array3 = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0);
							GameObject[] array4 = array3;
							foreach (GameObject val6 in array4)
							{
								try
								{
									if ((Object)(object)val6 == (Object)null || (!((Object)(object)val6.transform.parent == (Object)null) && !((Object)(object)val6.GetComponentInParent<Player>() == (Object)null)))
									{
										continue;
									}
									PhotonView component2 = val6.GetComponent<PhotonView>();
									if ((Object)(object)component2 == (Object)null)
									{
										continue;
									}
									foreach (string item in list)
									{
										if (((Object)val6).name.Contains(item) && component2.CreatorActorNr > 0 && !component2.IsRoomView)
										{
											PhotonNetwork.Destroy(val6.gameObject);
										}
									}
								}
								catch
								{
								}
							}
						}
						catch
						{
						}
						try
						{
							MagicBeanVine[] array5 = Object.FindObjectsByType<MagicBeanVine>((FindObjectsSortMode)0);
							MagicBeanVine[] array6 = array5;
							foreach (MagicBeanVine val7 in array6)
							{
								if (!((Object)(object)val7 == (Object)null) && ((Object)(object)((Component)val7).transform.parent == (Object)null || (Object)(object)((Component)val7).GetComponentInParent<Player>() == (Object)null) && ((Object)val7).name.Contains("MagicBeanVine"))
								{
									Object.Destroy((Object)(object)((Component)val7).gameObject);
								}
							}
						}
						catch
						{
						}
					}
					if (((int)<final_segment>5__2 == 0 || (int)<final_segment>5__2 == 1 || (int)<final_segment>5__2 == 2 || (int)<final_segment>5__2 == 3 || (int)<final_segment>5__2 == 4) && !plugin.extModsPeakapaloozaFOGDISABLED)
					{
						<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
						<>1__state = 8;
						return true;
					}
					goto IL_0887;
				}
				plugin.savedSegment = <final_segment>5__2;
				plugin.loadedSaveFileThisRound = 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();
			}
		}

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

			private object <>2__current;

			public Plugin <>4__this;

			public Segment segment;

			private int <i>5__2;

			private List<Character>.Enumerator <>7__wrap2;

			private Character <ch>5__4;

			private SaveData <data>5__5;

			private PhotonView <playerView>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || (uint)(num - 2) <= 2u)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap2 = default(List<Character>.Enumerator);
				<ch>5__4 = null;
				<data>5__5 = null;
				<playerView>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0730: Unknown result type (might be due to invalid IL or missing references)
				//IL_073a: Expected I4, but got Unknown
				//IL_074c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0751: Unknown result type (might be due to invalid IL or missing references)
				//IL_0753: Unknown result type (might be due to invalid IL or missing references)
				//IL_0756: Unknown result type (might be due to invalid IL or missing references)
				//IL_076c: Expected I4, but got Unknown
				//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_06fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0706: Expected O, but got Unknown
				try
				{
					int num = <>1__state;
					Plugin plugin = <>4__this;
					switch (num)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<i>5__2 = 0;
						goto IL_0073;
					case 1:
						<>1__state = -1;
						<i>5__2++;
						goto IL_0073;
					case 2:
						<>1__state = -3;
						<i>5__2++;
						goto IL_01d7;
					case 3:
						<>1__state = -3;
						<i>5__2++;
						goto IL_0491;
					case 4:
						<>1__state = -3;
						<i>5__2++;
						goto IL_04ea;
					case 5:
						<>1__state = -1;
						<i>5__2++;
						goto IL_05d3;
					case 6:
						{
							<>1__state = -1;
							plugin.pv.RPC("RPC_SetHeroTitle", (RpcTarget)1, new object[1] { (int)segment });
							break;
						}
						IL_0073:
						if (<i>5__2 < 60)
						{
							<>2__current = null;
							<>1__state = 1;
							return true;
						}
						<>7__wrap2 = Character.AllCharacters.GetEnumerator();
						<>1__state = -3;
						goto IL_057c;
						IL_04ea:
						if (<i>5__2 < 20)
						{
							<>2__current = null;
							<>1__state = 4;
							return true;
						}
						if (((MonoBehaviourPun)<ch>5__4).photonView.Owner.IsMasterClient && <data>5__5.timePlayed > 0f)
						{
							RunManager val = Object.FindFirstObjectByType<RunManager>();
							val.timeSinceRunStarted = <data>5__5.timePlayed;
							if ((Object)(object)val != (Object)null)
							{
								typeof(RunManager).GetMethod("SyncTimeMaster", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(val, null);
							}
						}
						<data>5__5 = null;
						<playerView>5__6 = null;
						<ch>5__4 = null;
						goto IL_057c;
						IL_057c:
						if (<>7__wrap2.MoveNext())
						{
							<ch>5__4 = <>7__wrap2.Current;
							string playerSaveFile = plugin.GetPlayerSaveFile(NetworkingUtilities.GetUserId(<ch>5__4.player));
							<data>5__5 = null;
							<playerView>5__6 = ((Component)<ch>5__4.player).GetComponent<PhotonView>();
							try
							{
								string text = File.ReadAllText(playerSaveFile);
								<data>5__5 = JsonConvert.DeserializeObject<SaveData>(text);
							}
							catch
							{
								string text = null;
								<data>5__5 = null;
							}
							if (plugin.configInventory.Value && <data>5__5 != null)
							{
								if (<ch>5__4.player.itemSlots != null)
								{
									ItemSlot[] itemSlots = <ch>5__4.player.itemSlots;
									foreach (ItemSlot val2 in itemSlots)
									{
										if (val2 != null)
										{
											try
											{
												val2.EmptyOut();
											}
											catch
											{
											}
										}
									}
								}
								if (<ch>5__4.player.backpackSlot.hasBackpack)
								{
									try
									{
										((ItemSlot)<ch>5__4.player.backpackSlot).EmptyOut();
									}
									catch
									{
									}
								}
								<i>5__2 = 0;
								goto IL_01d7;
							}
							goto IL_0249;
						}
						<>m__Finally1();
						<>7__wrap2 = default(List<Character>.Enumerator);
						<i>5__2 = 0;
						goto IL_05d3;
						IL_01d7:
						if (<i>5__2 < 30)
						{
							<>2__current = null;
							<>1__state = 2;
							return true;
						}
						plugin.LoadPlayerInventory(<data>5__5, <ch>5__4.player, <ch>5__4, <playerView>5__6);
						if ((Object)(object)<playerView>5__6 != (Object)null && <playerView>5__6.Owner != null && <data>5__5.backpackItemStates.Count > 0)
						{
							plugin.LoadBackpackFromSave(<ch>5__4.player, <data>5__5);
						}
						goto IL_0249;
						IL_05d3:
						if (<i>5__2 < 30)
						{
							<>2__current = null;
							<>1__state = 5;
							return true;
						}
						plugin.LoadingScreen(enableLoadingScreen: false);
						if (!PhotonNetwork.OfflineMode)
						{
							plugin.pv.RPC("RPC_Loadingscreen", (RpcTarget)1, new object[2] { "false", "null" });
						}
						plugin.currentlyLoading = false;
						plugin.loadedSaveFileThisRound = true;
						RecentlyLoaded = Time.time + 10f;
						RecentlyLitCampfire = Time.time + 32f;
						plugin.ShowMessage("Save game loaded!", new Color(Convert.ToSingle(plugin.configTextmessageColorNormal.Value.Split(',')[0]) / 255f, Convert.ToSingle(plugin.configTextmessageColorNormal.Value.Split(',')[1]) / 255f, Convert.ToSingle(plugin.configTextmessageColorNormal.Value.Split(',')[2]) / 255f, 1f), 4f);
						if (!PhotonNetwork.OfflineMode)
						{
							plugin.pv.RPC("RPC_SendMessage", (RpcTarget)1, new object[3] { "Save game loaded!", "normal", "4" });
							<>2__current = (object)new WaitForSeconds(0.1f);
							<>1__state = 6;
							return true;
						}
						break;
						IL_0249:
						if (plugin.configAfflictions.Value && <data>5__5 != null)
						{
							if (PhotonNetwork.OfflineMode)
							{
								try
								{
									try
									{
										if (<data>5__5.isSkeleton)
										{
											<ch>5__4.data.SetSkeleton(true);
										}
										else
										{
											<ch>5__4.data.SetSkeleton(false);
										}
									}
									catch
									{
									}
									try
									{
										if (<data>5__5.extraStamina > 0f && <data>5__5.extraStamina <= 1f)
										{
											<ch>5__4.SetExtraStamina(<data>5__5.extraStamina);
										}
										else
										{
											<ch>5__4.SetExtraStamina(0f);
										}
									}
									catch
									{
									}
									CharacterAfflictions afflictions = <ch>5__4.refs.afflictions;
									if (<data>5__5.afflictions_current != null && afflictions.currentStatuses != null && afflictions.currentStatuses.Length == <data>5__5.afflictions_current.Length)
									{
										Array.Copy(<data>5__5.afflictions_current, afflictions.currentStatuses, afflictions.currentStatuses.Length);
									}
								}
								catch
								{
								}
							}
							else if (PhotonNetwork.IsMasterClient && <data>5__5.afflictions_current != null && <data>5__5 != null)
							{
								try
								{
									if (<data>5__5.isSkeleton)
									{
										<ch>5__4.data.SetSkeleton(true);
									}
									else
									{
										<ch>5__4.data.SetSkeleton(false);
									}
								}
								catch
								{
								}
								try
								{
									if ((Object)(object)<playerView>5__6 != (Object)null)
									{
										plugin.pv.RPC("RPC_ApplyAfflictions", <playerView>5__6.Owner, new object[3]
										{
											NetworkingUtilities.GetUserId(<ch>5__4.player),
											<data>5__5.afflictions_current,
											<data>5__5.extraStamina
										});
									}
									else
									{
										((BaseUnityPlugin)plugin).Logger.LogWarning((object)"[Checkpoint_Save] LoadInventoryDelayed: Player has no PhotonView, cannot send afflictions RPC.");
									}
								}
								catch (Exception ex)
								{
									((BaseUnityPlugin)plugin).Logger.LogWarning((object)("[Checkpoint_Save] LoadInventoryDelayed: failed to send afflictions RPC: " + ex));
								}
							}
						}
						<i>5__2 = 0;
						goto IL_0491;
						IL_0491:
						if (<i>5__2 < 20)
						{
							<>2__current = null;
							<>1__state = 3;
							return true;
						}
						if (!PhotonNetwork.OfflineMode)
						{
							plugin.SendSyncInventory(<ch>5__4.player);
						}
						<i>5__2 = 0;
						goto IL_04ea;
					}
					if (!plugin.extModsPeakapaloozaPEAKTOBEACH)
					{
						Segment val3 = segment;
						switch (val3 - 1)
						{
						case 0:
							GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[1].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[1].clip);
							break;
						case 1:
							GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[2].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[2].clip);
							break;
						case 2:
							GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[3].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[3].clip);
							break;
						case 3:
							GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[4].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[4].clip);
							break;
						}
					}
					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;
				((IDisposable)<>7__wrap2).Dispose();
			}

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

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

			private object <>2__current;

			public Plugin <>4__this;

			private BaseUnityPlugin <instance>5__2;

			private FieldInfo <field_peaktobeach>5__3;

			private FieldInfo <field_fogdisabled>5__4;

			private FieldInfo <field_lavadisabled>5__5;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<instance>5__2 = null;
				<field_peaktobeach>5__3 = null;
				<field_fogdisabled>5__4 = null;
				<field_lavadisabled>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => Chainloader.PluginInfos.ContainsKey("PEAKapalooza")));
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					PluginInfo val = Chainloader.PluginInfos["PEAKapalooza"];
					<instance>5__2 = val.Instance;
					Type type = ((object)<instance>5__2).GetType();
					<field_peaktobeach>5__3 = type.GetField("togglePeakToBeach", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
					<field_fogdisabled>5__4 = type.GetField("toggleFogDisable", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
					<field_lavadisabled>5__5 = type.GetField("toggleLavaRisingDisable", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
					break;
				}
				case 2:
					<>1__state = -1;
					break;
				}
				plugin.extModsPeakapaloozaPEAKTOBEACH = (bool)<field_peaktobeach>5__3.GetValue(<instance>5__2);
				plugin.extModsPeakapaloozaFOGDISABLED = (bool)<field_fogdisabled>5__4.GetValue(<instance>5__2);
				plugin.extModsPeakapaloozaLAVADISABLED = (bool)<field_lavadisabled>5__5.GetValue(<instance>5__2);
				<>2__current = null;
				<>1__state = 2;
				return true;
			}

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

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

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

			private object <>2__current;

			public Plugin <>4__this;

			private BaseUnityPlugin <instance>5__2;

			private FieldInfo <field>5__3;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<instance>5__2 = null;
				<field>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Expected O, but got Unknown
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Expected O, but got Unknown
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitUntil((Func<bool>)(() => Chainloader.PluginInfos.ContainsKey("PEAKapalooza")));
					<>1__state = 1;
					return true;
				case 1:
				{
					<>1__state = -1;
					PluginInfo val = Chainloader.PluginInfos["PEAKapalooza"];
					<instance>5__2 = val.Instance;
					Type type = ((object)<instance>5__2).GetType();
					<field>5__3 = type.GetField("shownStartTitle", BindingFlags.Static | BindingFlags.Public);
					if (!(<field>5__3 != null))
					{
						break;
					}
					goto IL_00c9;
				}
				case 2:
					<>1__state = -1;
					goto IL_00c9;
				case 3:
					{
						<>1__state = -1;
						((MonoBehaviour)plugin).StartCoroutine(plugin.TeleportToPosition(new Vector3(16f, 1235f, 2239f)));
						break;
					}
					IL_00c9:
					if (!(bool)<field>5__3.GetValue(<instance>5__2))
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 3;
					return 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();
			}
		}

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

			private object <>2__current;

			public int index;

			public Segment segment;

			private OrbFogHandler <fog>5__2;

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

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

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

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

			private bool MoveNext()
			{
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ab: Invalid comparison between Unknown and I4
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Expected O, but got Unknown
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Expected O, but got Unknown
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Invalid comparison between Unknown and I4
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if (!((Object)(object)Singleton<OrbFogHandler>.Instance != (Object)null))
					{
						break;
					}
					<fog>5__2 = Singleton<OrbFogHandler>.Instance;
					if (Ascents.currentAscent > -1)
					{
						<fog>5__2.SetFogOrigin(index);
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 1;
						return true;
					}
					GameObject.Find("FogSphereSystem").SetActive(false);
					goto IL_00a4;
				case 1:
					<>1__state = -1;
					<fog>5__2.isMoving = false;
					<fog>5__2.currentWaitTime = 0f;
					goto IL_00a4;
				case 2:
					{
						<>1__state = -1;
						goto IL_00f6;
					}
					IL_00a4:
					if ((int)segment == 3 || (int)segment == 4)
					{
						<fog>5__2.currentSize = 10000f;
						<fog>5__2.speed = 0f;
						<>2__current = (object)new WaitForSeconds(0.5f);
						<>1__state = 2;
						return true;
					}
					goto IL_00f6;
					IL_00f6:
					<fog>5__2 = null;
					break;
				}
				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 <SpawnFlaresAtPeak>d__130 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Vector3 <basePos>5__2;

			private int <i>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//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_0040: 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_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<basePos>5__2 = new Vector3(19f, 1228.1f, 2240f);
					<i>5__3 = 0;
					break;
				case 1:
					<>1__state = -1;
					<i>5__3++;
					break;
				}
				if (<i>5__3 < 10)
				{
					Vector3 val = Random.insideUnitSphere * 0.1f;
					val.y = 0f;
					GameObject val2 = PhotonNetwork.InstantiateItem("flare", <basePos>5__2 + val, Quaternion.identity);
					if ((Object)(object)val2 != (Object)null)
					{
						Rigidbody component = val2.GetComponent<Rigidbody>();
						if ((Object)(object)component != (Object)null)
						{
							component.isKinematic = true;
							component.useGravity = true;
						}
					}
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return 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();
			}
		}

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

			private object <>2__current;

			public Plugin <>4__this;

			public Vector3 hostPos;

			private int <i>5__2;

			private List<Character>.Enumerator <>7__wrap2;

			private Character <ch>5__4;

			private float <startTime>5__5;

			private int <i>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 2)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<>7__wrap2 = default(List<Character>.Enumerator);
				<ch>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0255: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_028f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_019c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_0167: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					int num = <>1__state;
					Plugin plugin = <>4__this;
					switch (num)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<i>5__2 = 0;
						goto IL_0063;
					case 1:
						<>1__state = -1;
						<i>5__2++;
						goto IL_0063;
					case 2:
						{
							<>1__state = -3;
							<i>5__6++;
							goto IL_0334;
						}
						IL_0063:
						if (<i>5__2 < plugin.configAdvancedTeleportFramesToWait.Value)
						{
							<>2__current = null;
							<>1__state = 1;
							return true;
						}
						<>7__wrap2 = Character.AllCharacters.GetEnumerator();
						<>1__state = -3;
						goto IL_0364;
						IL_0347:
						if (Time.time - <startTime>5__5 < 30f)
						{
							if (<ch>5__4.Head.y - hostPos.y > 2f)
							{
								try
								{
									if ((Object)(object)((MonoBehaviourPun)<ch>5__4).photonView != (Object)null)
									{
										((MonoBehaviourPun)<ch>5__4).photonView.RPC("WarpPlayerRPC", (RpcTarget)1, new object[2] { hostPos, false });
									}
									((BaseUnityPlugin)plugin).Logger.LogInfo((object)$"[Checkpoint_Save] TeleportClientToHost: warped {((Object)<ch>5__4.player).name} to {hostPos} (previous position: {<ch>5__4.Head})");
								}
								catch (Exception ex)
								{
									((BaseUnityPlugin)plugin).Logger.LogWarning((object)("[Checkpoint_Save] TeleportClientToHost failed: " + ex));
									plugin.ShowMessage("Something went wrong while teleporting =(", new Color(Convert.ToSingle(plugin.configTextmessageColorError.Value.Split(',')[0]) / 255f, Convert.ToSingle(plugin.configTextmessageColorError.Value.Split(',')[1]) / 255f, Convert.ToSingle(plugin.configTextmessageColorError.Value.Split(',')[2]) / 255f, 1f), 5f);
								}
								<i>5__2++;
								if (<i>5__2 <= 150)
								{
									goto IL_0301;
								}
							}
							else
							{
								if (!(<ch>5__4.Head.x - hostPos.x < 6f) || !(<ch>5__4.Head.z - hostPos.z < 6f))
								{
									goto IL_0301;
								}
								((BaseUnityPlugin)plugin).Logger.LogMessage((object)$"[Checkpoint_Save] TeleportClientToHost: warped {((Object)<ch>5__4.player).name} after {<i>5__2} attempts.");
							}
						}
						goto IL_035d;
						IL_0364:
						if (<>7__wrap2.MoveNext())
						{
							<ch>5__4 = <>7__wrap2.Current;
							if ((Object)(object)<ch>5__4 != (Object)(object)Character.localCharacter && (Object)(object)<ch>5__4 != (Object)null)
							{
								((MonoBehaviourPun)<ch>5__4).photonView.RPC("WarpPlayerRPC", (RpcTarget)1, new object[2] { hostPos, false });
								<startTime>5__5 = Time.time;
								<i>5__2 = 0;
								goto IL_0347;
							}
							goto IL_035d;
						}
						<>m__Finally1();
						<>7__wrap2 = default(List<Character>.Enumerator);
						return false;
						IL_0301:
						<i>5__6 = 0;
						goto IL_0334;
						IL_0334:
						if (<i>5__6 < plugin.configAdvancedTeleportFramesToWait.Value)
						{
							<>2__current = null;
							<>1__state = 2;
							return true;
						}
						goto IL_0347;
						IL_035d:
						<ch>5__4 = null;
						goto IL_0364;
					}
				}
				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;
				((IDisposable)<>7__wrap2).Dispose();
			}

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

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

			private object <>2__current;

			public Vector3 pos;

			public Plugin <>4__this;

			private Vector3 <warpPos>5__2;

			private float <startTimeLocal>5__3;

			private int <triedTeleportLocal>5__4;

			private int <i>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: 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_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: 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_0228: Unknown result type (might be due to invalid IL or missing references)
				//IL_024d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0139: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a9: Expected O, but got Unknown
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)Character.localCharacter == (Object)null)
					{
						return false;
					}
					<warpPos>5__2 = pos + new Vector3(0f, 0.5f, 0f);
					((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)2, new object[2] { <warpPos>5__2, false });
					<startTimeLocal>5__3 = Time.time;
					<triedTeleportLocal>5__4 = 0;
					goto IL_0318;
				case 1:
					<>1__state = -1;
					if (!PhotonNetwork.OfflineMode)
					{
						((MonoBehaviour)plugin).StartCoroutine(plugin.TeleportClientsToHost(<warpPos>5__2));
					}
					return false;
				case 2:
					{
						<>1__state = -1;
						<i>5__5++;
						goto IL_0305;
					}
					IL_0318:
					if (Time.time - <startTimeLocal>5__3 < 30f)
					{
						if ((Object)(object)Character.localCharacter == (Object)null)
						{
							return false;
						}
						if (Character.localCharacter.Head.y - <warpPos>5__2.y > 2f)
						{
							try
							{
								if ((Object)(object)((MonoBehaviourPun)Character.localCharacter).photonView != (Object)null)
								{
									((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)2, new object[2] { <warpPos>5__2, false });
								}
								((BaseUnityPlugin)plugin).Logger.LogInfo((object)$"[Checkpoint_Save] TeleportClientToHost: warped {((Object)Character.localCharacter.player).name} to {<warpPos>5__2}  (previous position: {Character.localCharacter.Head})");
							}
							catch (Exception ex)
							{
								((BaseUnityPlugin)plugin).Logger.LogWarning((object)("[Checkpoint_Save] TeleportClientToHost failed: " + ex));
								plugin.ShowMessage("Something went wrong while teleporting =(", new Color(Convert.ToSingle(plugin.configTextmessageColorError.Value.Split(',')[0]) / 255f, Convert.ToSingle(plugin.configTextmessageColorError.Value.Split(',')[1]) / 255f, Convert.ToSingle(plugin.configTextmessageColorError.Value.Split(',')[2]) / 255f, 1f), 5f);
							}
							<triedTeleportLocal>5__4++;
							if (<triedTeleportLocal>5__4 > 150)
							{
								return false;
							}
						}
						else if (Character.localCharacter.Head.x - <warpPos>5__2.x < 6f && Character.localCharacter.Head.z - <warpPos>5__2.z < 6f)
						{
							((BaseUnityPlugin)plugin).Logger.LogMessage((object)$"[Checkpoint_Save] TeleportClientToHost: warped {((Object)Character.localCharacter.player).name} after {<triedTeleportLocal>5__4} attempts.");
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 1;
							return true;
						}
						<i>5__5 = 0;
						goto IL_0305;
					}
					return false;
					IL_0305:
					if (<i>5__5 < plugin.configAdvancedTeleportFramesToWait.Value)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					goto IL_0318;
				}
			}

			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 readonly int settingsVersion = 5;

		public ConfigEntry<KeyboardShortcut>? configLoadKey;

		public ConfigEntry<KeyboardShortcut>? configTutorialKey;

		public ConfigEntry<bool>? configAfflictions;

		public ConfigEntry<bool>? configInventory;

		public ConfigEntry<bool>? configItemStats;

		public ConfigEntry<bool>? configOnetimeLoad;

		public ConfigEntry<bool>? configLoadLevelScene;

		public ConfigEntry<bool>? configEnableLoadingscreen;

		public ConfigEntry<float>? configLoadingscreenTextXPosition;

		public ConfigEntry<float>? configLoadingscreenTextYPosition;

		public ConfigEntry<int>? configLoadingscreenTextFontsize;

		public ConfigEntry<string>? configLoadingscreenBackgroundColor;

		public ConfigEntry<string>? configLoadingscreenTextColor;

		public ConfigEntry<float>? configTextmessageXPosition;

		public ConfigEntry<float>? configTextmessageYPosition;

		public ConfigEntry<int>? configTextmessageFontsize;

		public ConfigEntry<float>? configTextmessageOutlineWidth;

		public ConfigEntry<string>? configTextmessageOutlineColor;

		public ConfigEntry<string>? configTextmessageColorNormal;

		public ConfigEntry<string>? configTextmessageColorError;

		public ConfigEntry<string>? configTextmessageColorSuccess;

		public ConfigEntry<string>? configTextmessageColorWarning;

		public ConfigEntry<bool>? configEnableBoardingpassInformation;

		public ConfigEntry<float>? configBoardingpassMessageXPosition;

		public ConfigEntry<float>? configBoardingpassMessageYPosition;

		public ConfigEntry<string>? configBoardingpassTextColor;

		public ConfigEntry<bool>? configEnableTutorialMessage;

		public ConfigEntry<int>? configTutorialMessageFontsize;

		public ConfigEntry<string>? configTutorialBackgroundColor;

		public ConfigEntry<string>? configTutorialTextColor;

		public ConfigEntry<bool>? configLegacySaveFile;

		public ConfigEntry<bool>? configLegacyLoadingKey;

		public ConfigEntry<bool>? configTeleportTheKilnWorkaround;

		public ConfigEntry<int>? configTeleportJumpLogic;

		public ConfigEntry<int>? configAdvancedTeleportFramesToWait;

		public ConfigEntry<float>? configAdvancedJumpLogicWaitTime;

		public ConfigEntry<bool>? configDebugEnableTeleport;

		public ConfigEntry<KeyboardShortcut>? configDebugTeleportKey;

		public static Plugin? Instance;

		private Harmony? _harmony;

		private Player? cachedPlayer;

		private PhotonView? pv;

		private GameObject? _loadingOverlay;

		private TextMeshProUGUI? _loadingTMP;

		private Image? _loadingImage;

		private GameObject? _messageOverlay;

		private TextMeshProUGUI? _messageTMP;

		private float _messageHideTime;

		private GameObject? _boardingpassOverlay;

		private TextMeshProUGUI? _boardingpassTMP;

		private Image? _boardingpassImage;

		private GameObject? _tutorialOverlay;

		private TextMeshProUGUI? _tutorialTMP;

		private Image? _tutorialImage;

		private bool tutorialMessageEnabled;

		private bool firstTimeTutorialMessage;

		private GameObject? _guiRoot;

		private Toggle? _boardingToggle;

		internal static float NoFallDamageUntil = 0f;

		internal static float RecentlyLoaded = 0f;

		internal static float RecentlyLitCampfire = 0f;

		private float lastTimePressedKey;

		private readonly HashSet<int> _readyActors = new HashSet<int>();

		private bool loadedSaveFileThisRound;

		private bool currentlyLoading;

		private bool extModsCheckedForMods;

		private bool extModsPeakapaloozaENABLED;

		private bool extModsPeakapaloozaCoroutineRunning;

		private bool extModsPeakapaloozaTeleportCoroutineRunning;

		private bool extModsPeakapaloozaPEAKTOBEACH;

		private bool extModsPeakapaloozaFOGDISABLED;

		private bool extModsPeakapaloozaLAVADISABLED;

		private bool extModsPeakapaloozaLITFIRSTCAMPFIRE;

		private Coroutine? extModsCoroutinePeakapalooza;

		private Coroutine? extModsCoroutinePeakapaloozaTeleport;

		private Vector2 msgPosition = new Vector2(0.5f, 0.1f);

		private static MethodInfo? _playerAddItemMethod;

		private string selectedLevel = "null";

		private int selectedAscent;

		private Segment savedSegment;

		private bool savefileFound;

		private List<string> savefilePlayerNames = new List<string>();

		private string savefileTimeSaved = "null";

		private string savefileCampfireName = "null";

		private List<string> savefileBiomeNames = new List<string>();

		private bool savefileExtmodsPeakapaloozaPEAKTOBEACH;

		private List<int> ExcludedItemIds = new List<int> { 100, 58, 66, 2, 24, 104, 115, 17, 63, 64 };

		private static readonly FieldInfo _iidDataField = typeof(ItemInstanceData).GetField("data", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		public const string Id = "PEAK_Checkpoint_Save";

		internal static ManualLogSource Log { get; private set; } = null;


		private bool toggleConfigUseLevel
		{
			get
			{
				return configLoadLevelScene.Value;
			}
			set
			{
				configLoadLevelScene.Value = value;
				((BaseUnityPlugin)this).Config.Save();
			}
		}

		public static string Name => "PEAK_Checkpoint_Save";

		public static string Version => "0.4.4";

		private bool PreStartSetSegment()
		{
			try
			{
				Player localPlayer = GetLocalPlayer();
				string text = null;
				try
				{
					text = GetPlayerSaveFile(NetworkingUtilities.GetUserId(localPlayer), selectedAscent);
				}
				catch
				{
					text = null;
					selectedLevel = "null";
					savefileFound = false;
					return false;
				}
				if (!File.Exists(text))
				{
					selectedLevel = "null";
					savefileFound = false;
					return false;
				}
				string text2 = File.ReadAllText(text);
				SaveData saveData = JsonConvert.DeserializeObject<SaveData>(text2);
				if (saveData != null)
				{
					selectedLevel = saveData.sceneName;
				}
				savefileFound = true;
				savefilePlayerNames = saveData.playerNames;
				savefileTimeSaved = saveData.saveDate;
				savefileCampfireName = saveData.campfireName;
				savefileBiomeNames = saveData.biome_names;
				savefileExtmodsPeakapaloozaPEAKTOBEACH = saveData.extModsPeakapaloozaPEAKTOBEACH;
				return true;
			}
			catch
			{
				savefileFound = false;
				return false;
			}
		}

		internal static void ActivateFallDamageProtection(float seconds)
		{
			NoFallDamageUntil = Time.time + seconds;
		}

		private void Awake()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			if (!Directory.Exists(Paths.PluginPath + "\\Checkpoint_Save"))
			{
				Directory.CreateDirectory(Paths.PluginPath + "\\Checkpoint_Save");
			}
			if (!Directory.Exists(Paths.PluginPath + "\\Checkpoint_Save\\Coop"))
			{
				Directory.CreateDirectory(Paths.PluginPath + "\\Checkpoint_Save\\Coop");
			}
			_harmony = new Harmony("peak.checkpoint.save.harmony");
			_harmony.PatchAll();
			Instance = this;
			pv = ((Component)this).gameObject.AddComponent<PhotonView>();
			pv.ViewID = 742;
			configLoadKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinding", "loadKey", new KeyboardShortcut((KeyCode)287, Array.Empty<KeyCode>()), "Key for loading your save game (Default: F6)");
			configTutorialKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Keybinding", "tutorialKey", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), "Key for showing the tutorial message (Default: F1)");
			configAfflictions = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableAfflictions", true, "Enable save/load of your current afflictions. (hunger, poison, cold, sleep, skeleton...)");
			configInventory = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableInventory", true, "Enable save/load of your inventory and backpack items.");
			configItemStats = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableItemStats", true, "Enable save/load of the item stats. (cooking amount, fuel, rope length...)");
			configOnetimeLoad = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableOnetimeLoad", false, "If enabled, you can only load once, until you reach the next checkpoint to save again. (Call it hardmode or so)");
			configLoadLevelScene = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableLoadLevelScene", true, "Enable save/load of the current Level Scene. (Disable to use the random daily level scene)");
			configEnableLoadingscreen = ((BaseUnityPlugin)this).Config.Bind<bool>("Loadingscreen", "enableLoadingscreen", true, "If enabled, you will see a loading screen while loading the savegame");
			configLoadingscreenTextXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Loadingscreen", "LoadingscreenTextXPosition", 0.5f, "the X position for the text in the loadingscreen. Example: 0.5 = middle of the screen | 1 = right | 0 = left");
			configLoadingscreenTextYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Loadingscreen", "LoadingscreenTextYPosition", 0.9f, "the Y position for the text in the loadingscreen. Example: 0.5 = middle of the screen | 1 = top | 0 = bottom");
			configLoadingscreenTextFontsize = ((BaseUnityPlugin)this).Config.Bind<int>("Loadingscreen", "LoadingscreenFontsize", 64, "the fontsize of the text in the loadingscreen.");
			configLoadingscreenTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("Loadingscreen", "LoadingscreenTextColor", "0,200,200", "The loadingscreen text color in RGB format [0-255]");
			configLoadingscreenBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<string>("Loadingscreen", "LoadingscreenBackgroundColor", "0,0,0", "The loadingscreen background color in RGB format [0-255]");
			configTextmessageXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Textmessage", "TextMessageXPosition", 0.5f, "the X position for the textmessage. Example: 0.5 = middle of the screen | 1 = right | 0 = left");
			configTextmessageYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("Textmessage", "TextMessageYPosition", 0.9f, "the Y position for the textmessage. Example: 0.5 = middle of the screen | 1 = top | 0 = bottom");
			configTextmessageFontsize = ((BaseUnityPlugin)this).Config.Bind<int>("Textmessage", "TextMessageFontsize", 64, "the fontsize of the textmessage.");
			configTextmessageOutlineWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Textmessage", "TextMessageOutlineWidth", 0.05f, "the textmessage outline width (set to 0 to disable the outline)");
			configTextmessageOutlineColor = ((BaseUnityPlugin)this).Config.Bind<string>("Textmessage", "TextMessageOutlineColor", "0,0,0", "The textmessage outline color in RGB format [0-255]");
			configTextmessageColorNormal = ((BaseUnityPlugin)this).Config.Bind<string>("Textmessage", "TextMessageColorNormal", "0,200,200", "The normal textmessage color in RGB format [0-255]");
			configTextmessageColorError = ((BaseUnityPlugin)this).Config.Bind<string>("Textmessage", "TextMessageColorError", "255,0,0", "The error textmessage color in RGB format [0-255]");
			configTextmessageColorSuccess = ((BaseUnityPlugin)this).Config.Bind<string>("Textmessage", "TextMessageColorSuccess", "0,255,0", "The success textmessage color in RGB format [0-255]");
			configTextmessageColorWarning = ((BaseUnityPlugin)this).Config.Bind<string>("Textmessage", "TextMessageColorWarning", "240,240,0", "The warning textmessage color in RGB format [0-255]");
			configEnableBoardingpassInformation = ((BaseUnityPlugin)this).Config.Bind<bool>("BoardingpassMessage", "enableBoardingpassInformation", true, "If enabled, you will see informations about your savefile if you open the boardingpass");
			configBoardingpassMessageXPosition = ((BaseUnityPlugin)this).Config.Bind<float>("BoardingpassMessage", "BoardingpassMessageXPosition", 0.5f, "the X position for the Boardingpass Message. Example: 0.5 = middle of the screen | 1 = right | 0 = left");
			configBoardingpassMessageYPosition = ((BaseUnityPlugin)this).Config.Bind<float>("BoardingpassMessage", "BoardingpassMessageYPosition", 0.15f, "the Y position for the Boardingpass Message. Example: 0.5 = middle of the screen | 1 = top | 0 = bottom");
			configBoardingpassTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("BoardingpassMessage", "BoardingpassMessageTextColor", "255,255,255", "The Boardingpass text color in RGB format [0-255]");
			configEnableTutorialMessage = ((BaseUnityPlugin)this).Config.Bind<bool>("TutorialMessage", "enableTutorialMessage", true, "If enabled, you can open the tutorial message with F1 (default)");
			configTutorialMessageFontsize = ((BaseUnityPlugin)this).Config.Bind<int>("TutorialMessage", "TutorialMessageFontsize", 48, "the fontsize of the Tutorial Message.");
			configTutorialTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("TutorialMessage", "TutorialMessageTextColor", "0,200,200", "The Tutorial Message text color in RGB format [0-255]");
			configTutorialBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<string>("TutorialMessage", "TutorialMessageBackgroundColor", "0,0,0", "The Tutorial Message background color in RGB format [0-255]");
			configLegacySaveFile = ((BaseUnityPlugin)this).Config.Bind<bool>("Legacy Options", "enableLegacySaveFile", false, "If enabled, you have just one save file which works for every difficulty (like it was before version 0.3.0)");
			configLegacyLoadingKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Legacy Options", "enableLegacyLoadingKey", false, "Enable this, if you want to press the loading key only once");
			configTeleportTheKilnWorkaround = ((BaseUnityPlugin)this).Config.Bind<bool>("Teleport Options", "teleportTheKilnWorkaround", false, "If enabled, tries to teleport to the end of Caldera (in front of the volcano) instead of loading the next map segment");
			configTeleportJumpLogic = ((BaseUnityPlugin)this).Config.Bind<int>("Teleport Options", "teleportJumpLogic", 0, "Changes the jump logic if you encounter problems while teleporting in multiplayer [ 0 = SetSegmentOnSpawn | 1 = JumpToSegment | 2 = GoToSegment ]");
			configAdvancedTeleportFramesToWait = ((BaseUnityPlugin)this).Config.Bind<int>("Advanced", "teleportFramesToWait", 30, "Frames to wait between teleport tries.");
			configAdvancedJumpLogicWaitTime = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "jumpLogicWaitTime", 1f, "the waiting time (in seconds) between every step in the jump logic.");
			configDebugEnableTeleport = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "enableTeleport", false, "If enabled, you can teleport every client to your position. Default key: F9");
			configDebugTeleportKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Debug", "teleportKey", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "The key to teleport every client to your position (Default: F9)");
			CheckConfigVersion();
		}

		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: 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_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0570: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0627: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0660: 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_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: 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_05aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			KeyboardShortcut value = configLoadKey.Value;
			Scene activeScene;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "Airport" && PhotonNetwork.IsMasterClient)
				{
					BoardingPass val = Object.FindAnyObjectByType<BoardingPass>();
					if ((Object)(object)val != (Object)null && ((MenuWindow)val).isOpen)
					{
						if (lastTimePressedKey > Time.time || configLegacyLoadingKey.Value)
						{
							selectedLevel = "null";
							lastTimePressedKey = 0f;
							RemoveSavefiles();
							ShowMessage("Savefiles deleted!", new Color(Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[2]) / 255f, 1f), 5f);
							if (PreStartSetSegment())
							{
								ShowBoardingpassMessage(active: true);
								((Component)_boardingToggle).gameObject.SetActive(true);
							}
							else
							{
								ShowBoardingpassMessage(active: true, "No savefile found!");
								((Component)_boardingToggle).gameObject.SetActive(false);
							}
						}
						else
						{
							ShowMessage($"Press ({configLoadKey.Value}) again to delete the savefile\nfor the current difficulty", new Color(Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[2]) / 255f, 1f), 10f);
							lastTimePressedKey = Time.time + 10f;
						}
					}
					else
					{
						ShowMessage("Please load into a level first.", new Color(Convert.ToSingle(configTextmessageColorError.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorError.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorError.Value.Split(',')[2]) / 255f, 1f), 3f);
					}
					goto IL_05f3;
				}
			}
			value = configLoadKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown())
			{
				activeScene = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene)).name == "Title")
				{
					ShowMessage("Please load into a level first.", new Color(Convert.ToSingle(configTextmessageColorError.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorError.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorError.Value.Split(',')[2]) / 255f, 1f), 3f);
					goto IL_05f3;
				}
			}
			value = configLoadKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown() && !currentlyLoading && PhotonNetwork.IsMasterClient)
			{
				if (lastTimePressedKey > Time.time || configLegacyLoadingKey.Value)
				{
					lastTimePressedKey = 0f;
					if (PhotonNetwork.OfflineMode)
					{
						LoadPlayerOffline();
					}
					else
					{
						LoadPlayerCoop();
					}
				}
				else
				{
					ShowMessage($"Do you want to load the savefile?\nPress ({configLoadKey.Value}) to confirm", new Color(Convert.ToSingle(configTextmessageColorNormal.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorNormal.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorNormal.Value.Split(',')[2]) / 255f, 1f), 7f);
					lastTimePressedKey = Time.time + 7f;
				}
			}
			else
			{
				value = configLoadKey.Value;
				if (((KeyboardShortcut)(ref value)).IsDown() && !PhotonNetwork.IsMasterClient)
				{
					ShowMessage("Only the host can load the save!", new Color(Convert.ToSingle(configTextmessageColorError.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorError.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorError.Value.Split(',')[2]) / 255f, 1f), 3f);
				}
				else
				{
					value = configTutorialKey.Value;
					if (((KeyboardShortcut)(ref value)).IsDown())
					{
						activeScene = SceneManager.GetActiveScene();
						if (((Scene)(ref activeScene)).name != "Title" && configEnableTutorialMessage.Value)
						{
							if (tutorialMessageEnabled)
							{
								ShowTutorialMessage(active: false);
								tutorialMessageEnabled = !tutorialMessageEnabled;
							}
							else
							{
								ShowTutorialMessage(active: true);
								tutorialMessageEnabled = !tutorialMessageEnabled;
							}
							goto IL_05f3;
						}
					}
					value = configDebugTeleportKey.Value;
					if (((KeyboardShortcut)(ref value)).IsDown())
					{
						activeScene = SceneManager.GetActiveScene();
						if (((Scene)(ref activeScene)).name != "Title" && configDebugEnableTeleport.Value)
						{
							Vector3 head = Character.localCharacter.Head;
							head.y += 1f;
							PhotonView? obj = pv;
							if (obj != null)
							{
								obj.RPC("RPC_RequestFalldamageProtection", (RpcTarget)0, new object[1] { 20 });
							}
							((MonoBehaviour)this).StartCoroutine(TeleportClientsToHost(head));
						}
					}
				}
			}
			goto IL_05f3;
			IL_05f3:
			if ((Object)(object)_messageOverlay != (Object)null && _messageOverlay.activeSelf && Time.unscaledTime > _messageHideTime)
			{
				_messageOverlay.SetActive(false);
			}
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "Airport")
			{
				loadedSaveFileThisRound = false;
				RecentlyLitCampfire = 0f;
				RecentlyLoaded = 0f;
				savedSegment = (Segment)0;
				if (firstTimeTutorialMessage)
				{
					ShowTutorialMessage(active: true);
					tutorialMessageEnabled = true;
					firstTimeTutorialMessage = false;
				}
				if (!extModsCheckedForMods)
				{
					CheckForExternalMods();
				}
				if (extModsPeakapaloozaENABLED)
				{
					if (!extModsPeakapaloozaCoroutineRunning)
					{
						extModsPeakapaloozaCoroutineRunning = true;
						extModsCoroutinePeakapalooza = ((MonoBehaviour)this).StartCoroutine(PeakapaloozaCheckGameobjects());
					}
					if (extModsCoroutinePeakapaloozaTeleport != null)
					{
						((MonoBehaviour)this).StopCoroutine(extModsCoroutinePeakapaloozaTeleport);
						extModsCoroutinePeakapaloozaTeleport = null;
					}
					extModsPeakapaloozaLITFIRSTCAMPFIRE = false;
					extModsPeakapaloozaTeleportCoroutineRunning = false;
				}
				return;
			}
			activeScene = SceneManager.GetActiveScene();
			if (!((Scene)(ref activeScene)).name.StartsWith("Level"))
			{
				return;
			}
			extModsPeakapaloozaCoroutineRunning = false;
			if (extModsPeakapaloozaENABLED)
			{
				if (extModsCoroutinePeakapalooza != null)
				{
					((MonoBehaviour)this).StopCoroutine(extModsCoroutinePeakapalooza);
					extModsCoroutinePeakapalooza = null;
				}
				if (extModsPeakapaloozaPEAKTOBEACH && !extModsPeakapaloozaTeleportCoroutineRunning && PhotonNetwork.IsMasterClient)
				{
					extModsPeakapaloozaTeleportCoroutineRunning = true;
					extModsCoroutinePeakapaloozaTeleport = ((MonoBehaviour)this).StartCoroutine(PeakapaloozaTeleportPlayersPeakToBeach());
				}
			}
		}

		public void CheckConfigVersion()
		{
			if (File.Exists(Paths.PluginPath + "\\Checkpoint_Save\\settingsVersion"))
			{
				string value = File.ReadAllText(Paths.PluginPath + "\\Checkpoint_Save\\settingsVersion");
				File.WriteAllText(Paths.PluginPath + "\\Checkpoint_Save\\settingsVersion", settingsVersion.ToString() ?? "");
				if (Convert.ToInt32(value) >= settingsVersion)
				{
					return;
				}
				if (configEnableTutorialMessage.Value)
				{
					firstTimeTutorialMessage = true;
				}
				try
				{
					string[] files = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save"));
					string[] array = files;
					foreach (string text in array)
					{
						if (text.Contains("peak_save"))
						{
							File.Delete(text);
						}
					}
				}
				catch
				{
				}
				try
				{
					string[] files2 = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save\\Coop"));
					string[] array2 = files2;
					foreach (string path in array2)
					{
						File.Delete(path);
					}
					return;
				}
				catch
				{
					return;
				}
			}
			File.WriteAllText(Paths.PluginPath + "\\Checkpoint_Save\\settingsVersion", settingsVersion.ToString() ?? "");
			if (configEnableTutorialMessage.Value)
			{
				firstTimeTutorialMessage = true;
			}
			try
			{
				string[] files3 = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save"));
				string[] array3 = files3;
				foreach (string text2 in array3)
				{
					if (text2.Contains("peak_save"))
					{
						File.Delete(text2);
					}
				}
			}
			catch
			{
			}
			try
			{
				string[] files4 = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save\\Coop"));
				string[] array4 = files4;
				foreach (string path2 in array4)
				{
					File.Delete(path2);
				}
			}
			catch
			{
			}
		}

		public void RemoveSavefiles()
		{
			if (PhotonNetwork.OfflineMode)
			{
				string[] files = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save"));
				string[] array = files;
				foreach (string text in array)
				{
					if (!configLegacySaveFile.Value)
					{
						if (text.Contains($"peak_save_{selectedAscent}_offline"))
						{
							File.Delete(text);
						}
					}
					else if (text.Contains("peak_save_offline"))
					{
						File.Delete(text);
					}
				}
				return;
			}
			string[] files2 = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save\\Coop"));
			string[] array2 = files2;
			foreach (string text2 in array2)
			{
				if (!configLegacySaveFile.Value)
				{
					if (text2.Contains($"peak_save_{selectedAscent}_"))
					{
						File.Delete(text2);
					}
				}
				else if (text2.Contains("peak_save_765"))
				{
					File.Delete(text2);
				}
			}
		}

		public void CheckForExternalMods()
		{
			if (Chainloader.PluginInfos.ContainsKey("PEAKapalooza"))
			{
				extModsPeakapaloozaENABLED = true;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"[Checkpoint_Save] MOD Peakapalooza found!");
			}
			extModsCheckedForMods = true;
		}

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

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

		public void ShowMessage(string text, Color color, float duration = 2.5f, bool disableMessage = false)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			EnsureMessageOverlay();
			((TMP_Text)_messageTMP).text = text.ToUpperInvariant();
			((Graphic)_messageTMP).color = color;
			if (disableMessage)
			{
				_messageOverlay.SetActive(false);
				_messageHideTime = 0f;
			}
			else
			{
				_messageOverlay.SetActive(true);
				_messageHideTime = Time.unscaledTime + duration;
			}
		}

		public void ShowBoardingpassMessage(bool active, string override_message = "")
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			if (active)
			{
				EnsureBoardingpassOverlay();
				CreateBoardingPassCheckbox(_boardingpassTMP);
				if (override_message == "")
				{
					ShowMessage("", Color.cyan, 0f);
					string text = "";
					string text2 = "";
					string text3 = "";
					foreach (string savefilePlayerName in savefilePlayerNames)
					{
						text2 += ((text2 == "") ? (savefilePlayerName ?? "") : (", " + savefilePlayerName));
					}
					foreach (string savefileBiomeName in savefileBiomeNames)
					{
						text += ((text == "") ? (savefileBiomeName ?? "") : (", " + savefileBiomeName));
					}
					if (savefileExtmodsPeakapaloozaPEAKTOBEACH)
					{
						text3 = ((!toggleConfigUseLevel) ? ("Saved with PeakToBeach\n\nLevel: using daily level\nSaved at Campfire: " + savefileCampfireName + "\nBiomes: " + text + "\nPlayers: " + text2 + "\nTime saved: " + savefileTimeSaved + "\n\n" + $"[Press ({configLoadKey.Value}) to delete this savefile]\n\n") : ("Saved with PeakToBeach\n\nLevel: using saved level (" + selectedLevel + ")\nSaved at Campfire: " + savefileCampfireName + "\nBiomes: " + text + "\nPlayers: " + text2 + "\nTime saved: " + savefileTimeSaved + "\n\n" + $"[Press ({configLoadKey.Value}) to delete this savefile]\n\n"));
						if (!extModsPeakapaloozaENABLED || !extModsPeakapaloozaPEAKTOBEACH)
						{
							ShowMessage("This save was created with PeakToBeach enabled!\nIf you load without it, you might be\nteleported to wrong positions!", new Color(Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[2]) / 255f, 1f), 10000f);
						}
					}
					else
					{
						text3 = ((!toggleConfigUseLevel) ? ("Level: using daily level\nSaved at Campfire: " + savefileCampfireName + "\nBiomes: " + text + "\nPlayers: " + text2 + "\nTime saved: " + savefileTimeSaved + "\n\n\n" + $"[Press ({configLoadKey.Value}) to delete this savefile]\n\n") : ("Level: using saved level (" + selectedLevel + ")\nSaved at Campfire: " + savefileCampfireName + "\nBiomes: " + text + "\nPlayers: " + text2 + "\nTime saved: " + savefileTimeSaved + "\n\n\n" + $"[Press ({configLoadKey.Value}) to delete this savefile]\n\n"));
						if (extModsPeakapaloozaENABLED && extModsPeakapaloozaPEAKTOBEACH)
						{
							ShowMessage("This save was created without PeakToBeach!\nIf you load with PeakToBeach, you might be\nteleported to wrong positions!", new Color(Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTextmessageColorWarning.Value.Split(',')[2]) / 255f, 1f), 10000f);
						}
					}
					((TMP_Text)_boardingpassTMP).text = text3;
				}
				else
				{
					((TMP_Text)_boardingpassTMP).text = override_message;
				}
				((Graphic)_boardingpassTMP).color = new Color(Convert.ToSingle(configBoardingpassTextColor.Value.Split(',')[0]) / 255f, Convert.ToSingle(configBoardingpassTextColor.Value.Split(',')[1]) / 255f, Convert.ToSingle(configBoardingpassTextColor.Value.Split(',')[2]) / 255f, 1f);
				_boardingpassOverlay.SetActive(true);
			}
			else
			{
				_boardingpassOverlay.SetActive(false);
			}
		}

		public void ShowTutorialMessage(bool active)
		{
			//IL_002d: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			if (active)
			{
				EnsureTutorialOverlay();
				((TMP_Text)_tutorialTMP).text = "Checkpoint Save Tutorial\n\n\nYour progress will be saved at each campfire you lit.\n" + $"To load your savegame later, just start a level and press ({configLoadKey.Value})\n\n" + "Open the boardingpass to see informations about your last saved runs.\nYou can enable/disable loading of the daily/saved level in the boardingpass.\n\nYou can load any time in your current run.\n\nThe progress is saved on the host PC, so the host needs to load every time you play.\n\nYou might get some steam achievements if you load the savegame,\nso do not use it, if you want to achieve everything on your own.\n\n\n\n" + $"Press ({configTutorialKey.Value}) to close this message.\n" + $"You can open it later again with ({configTutorialKey.Value})";
				((Graphic)_tutorialTMP).color = new Color(Convert.ToSingle(configTutorialTextColor.Value.Split(',')[0]) / 255f, Convert.ToSingle(configTutorialTextColor.Value.Split(',')[1]) / 255f, Convert.ToSingle(configTutorialTextColor.Value.Split(',')[2]) / 255f, 1f);
				_tutorialOverlay.SetActive(true);
			}
			else
			{
				_tutorialOverlay.SetActive(false);
			}
		}

		private void EnsureLoadingOverlay()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_012b: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_loadingOverlay != (Object)null))
			{
				GameObject val = new GameObject("CheckpointSave_LoadingOverlay");
				Object.DontDestroyOnLoad((Object)(object)val);
				_loadingOverlay = val;
				Canvas val2 = val.AddComponent<Canvas>();
				val2.renderMode = (RenderMode)0;
				val2.sortingOrder = 9999;
				val.AddComponent<CanvasScaler>();
				val.AddComponent<GraphicRaycaster>();
				GameObject val3 = new GameObject("Panel");
				val3.transform.SetParent(val.transform, false);
				_loadingImage = val3.AddComponent<Image>();
				((Graphic)_loadingImage).color = new Color(Convert.ToSingle(configLoadingscreenBackgroundColor.Value.Split(',')[0]) / 255f, Convert.ToSingle(configLoadingscreenBackgroundColor.Value.Split(',')[1]) / 255f, Convert.ToSingle(configLoadingscreenBackgroundColor.Value.Split(',')[2]) / 255f, 1f);
				RectTransform component = val3.GetComponent<RectTransform>();
				component.anchorMin = Vector2.zero;
				component.anchorMax = Vector2.one;
				component.offsetMin = Vector2.zero;
				component.offsetMax = Vector2.zero;
				GameObject val4 = new GameObject("Text");
				val4.transform.SetParent(val3.transform, false);
				_loadingTMP = val4.AddComponent<TextMeshProUGUI>();
				((TMP_Text)_loadingTMP).text = "Loading savegame...";
				((TMP_Text)_loadingTMP).alignment = (TextAlignmentOptions)514;
				((TMP_Text)_loadingTMP).fontSize = configLoadingscreenTextFontsize.Value;
				((Graphic)_loadingTMP).color = new Color(Convert.ToSingle(configLoadingscreenTextColor.Value.Split(',')[0]) / 255f, Convert.ToSingle(configLoadingscreenTextColor.Value.Split(',')[1]) / 255f, Convert.ToSingle(configLoadingscreenTextColor.Value.Split(',')[2]) / 255f, 1f);
				((TMP_Text)_loadingTMP).textWrappingMode = (TextWrappingModes)0;
				((TMP_Text)_loadingTMP).fontStyle = (FontStyles)16;
				((TMP_Text)_loadingTMP).characterSpacing = 6f;
				((TMP_Text)_loadingTMP).wordSpacing = 0f;
				((TMP_Text)_loadingTMP).lineSpacing = 0f;
				((TMP_Text)_loadingTMP).font = FindTMPFont("DarumaDropOne-Regular SDF", "Pangolin-Regular SDF", "Montserrat-Medium SDF", "LiberationSans SDF");
				if ((Object)(object)((TMP_Text)_loadingTMP).font == (Object)null)
				{
					((TMP_Text)_loadingTMP).font = Resources.FindObjectsOfTypeAll<TMP_FontAsset>().FirstOrDefault();
				}
				RectTransform component2 = val4.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(configLoadingscreenTextXPosition.Value, configLoadingscreenTextYPosition.Value);
				component2.anchorMax = new Vector2(configLoadingscreenTextXPosition.Value, configLoadingscreenTextYPosition.Value);
				component2.offsetMin = Vector2.zero;
				component2.offsetMax = Vector2.zero;
				val.SetActive(false);
			}
		}

		private void EnsureMessageOverlay()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0059: 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_0087: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Expected O, but got Unknown
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_messageOverlay != (Object)null))
			{
				GameObject val = new GameObject("CheckpointSave_MessageOverlay");
				Object.DontDestroyOnLoad((Object)(object)val);
				_messageOverlay = val;
				Canvas val2 = val.AddComponent<Canvas>();
				val2.renderMode = (RenderMode)0;
				val2.sortingOrder = 9998;
				CanvasScaler val3 = val.AddComponent<CanvasScaler>();
				val3.uiScaleMode = (ScaleMode)1;
				val3.referenceResolution = new Vector2(2560f, 1440f);
				val3.screenMatchMode = (ScreenMatchMode)0;
				val3.matchWidthOrHeight = 0.5f;
				val.AddComponent<GraphicRaycaster>();
				GameObject val4 = new GameObject("MessageText");
				val4.transform.SetParent(val.transform, false);
				_messageTMP = val4.AddComponent<TextMeshProUGUI>();
				((TMP_Text)_messageTMP).alignment = (TextAlignmentOptions)514;
				((TMP_Text)_messageTMP).fontSize = configTextmessageFontsize.Value;
				((TMP_Text)_messageTMP).textWrappingMode = (TextWrappingModes)0;
				((TMP_Text)_messageTMP).fontStyle = (FontStyles)16;
				((TMP_Text)_messageTMP).characterSpacing = 6f;
				((TMP_Text)_messageTMP).font = FindTMPFont("DarumaDropOne-Regular SDF", "Pangolin-Regular SDF", "Montserrat-Medium SDF", "LiberationSans SDF");
				((TMP_Text)_messageTMP