Decompiled source of PEAK Checkpoint Save v0.4.7

plugins/PEAK_Checkpoint_Save.dll

Decompiled a month 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Peak.Network;
using Photon.Pun;
using Photon.Realtime;
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.7.0")]
[assembly: AssemblyInformationalVersion("0.4.7")]
[assembly: AssemblyProduct("PEAK_Checkpoint_Save")]
[assembly: AssemblyTitle("PEAK_Checkpoint_Save")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.7.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.7")]
	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
				{
					if (RecentlyLitCampfire > Time.time || !__instance.EveryoneInRange())
					{
						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(MapGenerator))]
		[HarmonyPatch("GenerateAll")]
		internal class Patch_MapGenerator
		{
			private static void Prefix(MapGenerator __instance)
			{
				__instance.seed = 3232;
			}
		}

		[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, disableMessage: true);
					}
				}
			}
		}

		[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, disableMessage: true);
					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, disableMessage: true);
						}
					}
				}
				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;
					((Behaviour)val.customOptionsButton).enabled = false;
					((Behaviour)val.customRunButton).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, disableMessage: true);
			}
		}

		[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, disableMessage: true);
			}
		}

		[HarmonyPatch(typeof(BoardingPass), "StartGame")]
		private static class startGame_Override
		{
			public static bool Prefix(BoardingPass __instance)
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode && Instance.configAdvancedEnableClientModCheck.Value && Instance.CheckForClientsModVersions())
				{
					return false;
				}
				if (PhotonNetwork.IsMasterClient || PhotonNetwork.OfflineMode)
				{
					Instance.ShowBoardingpassMessage(active: false);
				}
				Instance.ShowMessage("", Color.cyan, 0f, disableMessage: true);
				if (Instance.configDebugEnableLogging.Value)
				{
					Instance.LogEvent($"(BoardingPass-StartGame) Player count: {PhotonNetwork.PlayerList.Length}\nAscent: {Ascents.currentAscent}\nCustomRun: {RunSettings.IsCustomRun}\nLevel: {Instance.selectedLevel}");
				}
				return true;
			}
		}

		[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 (Exception ex)
				{
					if (Instance.configDebugEnableLogging.Value)
					{
						Instance.LogEvent("(MapBaker-GetLevel) " + ex.Message);
					}
					return true;
				}
			}
		}

		[HarmonyPatch(typeof(NetworkConnector), "OnJoinedRoom")]
		private static class OnJoinedRoom_Override
		{
			public static void Postfix(NetworkConnector __instance)
			{
				Instance.CreatePhotonView();
				if (!Instance.clientSentModVersion && !PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient)
				{
					((MonoBehaviour)Instance).StartCoroutine(Instance.SendModVersionToMaster());
					Instance.clientSentModVersion = true;
				}
			}
		}

		[Serializable]
		public class SaveData
		{
			public int settingsVersion;

			public string saveDate;

			public List<string> playerNames;

			public string campfireName;

			public float timePlayed;

			public float timeOfDay;

			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;
		}

		public class CheckpointNetwork : MonoBehaviourPun
		{
			[PunRPC]
			public void RPC_SendModVersionToMaster(string userID, string userName, string modVersion)
			{
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				if (PhotonNetwork.OfflineMode || !PhotonNetwork.IsMasterClient || !Instance.configAdvancedEnableClientModCheck.Value)
				{
					return;
				}
				if (Instance.configDebugEnableLogging.Value)
				{
					Instance.LogEvent("[Checkpoint_Save] (RPC_SendModVersionToMaster): userID: " + userID + ", userName: " + userName + ", modVersion: " + modVersion);
				}
				((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[Checkpoint_Save] (RPC_SendModVersionToMaster): userID: " + userID + ", userName: " + userName + ", modVersion: " + modVersion));
				if (Version != modVersion)
				{
					if (Instance.playerReceivedModVersions.ContainsKey(userID))
					{
						Instance.playerReceivedModVersions.Remove(userID);
					}
					Instance.ShowMessage(userName + " is using a different mod version (" + modVersion + ")!\nPlease make sure that everybody\nuses the same version as the host (" + Version + ")!", 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), 30f);
				}
				else if (!Instance.playerReceivedModVersions.ContainsKey(userID))
				{
					Instance.playerReceivedModVersions.Add(userID, userName);
				}
			}

			[PunRPC]
			public void RPC_SendReadyStatusToMaster(string userID, string userName)
			{
				if (!PhotonNetwork.OfflineMode && PhotonNetwork.IsMasterClient && Instance.configAdvancedEnableClientReadyStatusCheck.Value)
				{
					if (Instance.configDebugEnableLogging.Value)
					{
						Instance.LogEvent("[Checkpoint_Save] (RPC_SendReadyStatusToMaster): userID: " + userID + ", userName: " + userName);
					}
					((BaseUnityPlugin)Instance).Logger.LogInfo((object)("[Checkpoint_Save] (RPC_SendReadyStatusToMaster): userID: " + userID + ", userName: " + userName));
					if (!Instance.playerReceivedReadyStatus.ContainsKey(userID))
					{
						Instance.playerReceivedReadyStatus.Add(userID, userName);
					}
				}
			}

			[PunRPC]
			public void RPC_RequestSave()
			{
				((BaseUnityPlugin)Instance).Logger.LogInfo((object)"[Checkpoint_Save] RPC: Save requested.");
				if (PhotonNetwork.IsMasterClient)
				{
					Instance.SavePlayerCoop();
					RecentlyLitCampfire = Time.time + 32f;
				}
			}

			[PunRPC]
			public void RPC_RecentlyLitCampfire()
			{
				if (!PhotonNetwork.IsMasterClient)
				{
					RecentlyLitCampfire = Time.time + 32f;
				}
			}

			[PunRPC]
			public void RPC_RequestFalldamageProtection(int seconds)
			{
				if (Instance.configDebugEnableLogging.Value)
				{
					Instance.LogEvent("RPC: Falldamage protection requested.");
				}
				((BaseUnityPlugin)Instance).Logger.LogInfo((object)"[Checkpoint_Save] RPC: Falldamage protection requested.");
				ActivateFallDamageProtection(seconds);
			}

			[PunRPC]
			public void RPC_SendMessage(string message, string color, string time)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
				Color cyan = Color.cyan;
				switch (color)
				{
				case "error":
					((Color)(ref cyan))..ctor(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);
					break;
				case "normal":
					((Color)(ref cyan))..ctor(Convert.ToSingle(Instance.configTextmessageColorNormal.Value.Split(',')[0]) / 255f, Convert.ToSingle(Instance.configTextmessageColorNormal.Value.Split(',')[1]) / 255f, Convert.ToSingle(Instance.configTextmessageColorNormal.Value.Split(',')[2]) / 255f, 1f);
					break;
				case "warning":
					((Color)(ref cyan))..ctor(Convert.ToSingle(Instance.configTextmessageColorWarning.Value.Split(',')[0]) / 255f, Convert.ToSingle(Instance.configTextmessageColorWarning.Value.Split(',')[1]) / 255f, Convert.ToSingle(Instance.configTextmessageColorWarning.Value.Split(',')[2]) / 255f, 1f);
					break;
				case "success":
					((Color)(ref cyan))..ctor(Convert.ToSingle(Instance.configTextmessageColorSuccess.Value.Split(',')[0]) / 255f, Convert.ToSingle(Instance.configTextmessageColorSuccess.Value.Split(',')[1]) / 255f, Convert.ToSingle(Instance.configTextmessageColorSuccess.Value.Split(',')[2]) / 255f, 1f);
					break;
				default:
					((Color)(ref cyan))..ctor(Convert.ToSingle(Instance.configTextmessageColorNormal.Value.Split(',')[0]) / 255f, Convert.ToSingle(Instance.configTextmessageColorNormal.Value.Split(',')[1]) / 255f, Convert.ToSingle(Instance.configTextmessageColorNormal.Value.Split(',')[2]) / 255f, 1f);
					break;
				}
				Instance.ShowMessage(message, cyan, Convert.ToSingle(time));
			}

			[PunRPC]
			public void RPC_Loadingscreen(string enableLoadingScreen, string message)
			{
				Instance.LoadingScreen(Convert.ToBoolean(enableLoadingScreen), message);
			}

			[PunRPC]
			public void RPC_SetHeroTitle(int segment)
			{
				if (!Instance.extModsPeakapaloozaPEAKTOBEACH)
				{
					switch (segment)
					{
					case 1:
						GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[1].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[1].clip);
						break;
					case 2:
						GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[2].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[2].clip);
						break;
					case 3:
						GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[3].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[3].clip);
						break;
					case 4:
						GUIManager.instance.SetHeroTitle(Singleton<MountainProgressHandler>.Instance.progressPoints[4].localizedTitle, Singleton<MountainProgressHandler>.Instance.progressPoints[4].clip);
						break;
					}
				}
			}

			[PunRPC]
			public void RPC_CloseEndscreen()
			{
				try
				{
					EndScreen val = Object.FindFirstObjectByType<EndScreen>();
					if (((MenuWindow)val).isOpen)
					{
						MenuWindow obj = Object.FindFirstObjectByType<MenuWindow>();
						typeof(MenuWindow).GetMethod("Close", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj, null);
					}
				}
				catch
				{
				}
			}

			[PunRPC]
			public void RPC_ApplyAfflictions(string userId, float[] statuses, float extraStamina)
			{
				try
				{
					Player localPlayer = Instance.GetLocalPlayer();
					if ((Object)(object)localPlayer == (Object)null)
					{
						if (Instance.configDebugEnableLogging.Value)
						{
							Instance.LogEvent("RPC_ApplyAfflictions: no local player.");
						}
						((BaseUnityPlugin)Instance).Logger.LogWarning((object)"[Checkpoint_Save] RPC_ApplyAfflictions: no local player.");
						return;
					}
					if (NetworkingUtilities.GetUserId(localPlayer) != userId)
					{
						return;
					}
					Character localCharacter = Character.localCharacter;
					if ((Object)(object)localCharacter == (Object)null)
					{
						if (Instance.configDebugEnableLogging.Value)
						{
							Instance.LogEvent("RPC_ApplyAfflictions: no local Character.");
						}
						((BaseUnityPlugin)Instance).Logger.LogWarning((object)"[Checkpoint_Save] RPC_ApplyAfflictions: no local Character.");
						return;
					}
					CharacterAfflictions afflictions = localCharacter.refs.afflictions;
					if (statuses != null && afflictions.currentStatuses != null && afflictions.currentStatuses.Length == statuses.Length)
					{
						Array.Copy(statuses, afflictions.currentStatuses, afflictions.currentStatuses.Length);
					}
					else
					{
						if (Instance.configDebugEnableLogging.Value)
						{
							Instance.LogEvent("RPC_ApplyAfflictions: length mismatch or null.");
						}
						((BaseUnityPlugin)Instance).Logger.LogWarning((object)"[Checkpoint_Save] RPC_ApplyAfflictions: length mismatch or null.");
					}
					try
					{
						if (extraStamina > 0f && extraStamina <= 1f)
						{
							localCharacter.SetExtraStamina(extraStamina);
						}
						else
						{
							localCharacter.SetExtraStamina(0f);
						}
					}
					catch (Exception ex)
					{
						if (Instance.configDebugEnableLogging.Value)
						{
							Instance.LogEvent("RPC_ApplyAfflictions/extraStamina error: " + ex);
						}
					}
				}
				catch (Exception ex2)
				{
					if (Instance.configDebugEnableLogging.Value)
					{
						Instance.LogEvent("RPC_ApplyAfflictions error: " + ex2);
					}
					((BaseUnityPlugin)Instance).Logger.LogError((object)("[Checkpoint_Save] RPC_ApplyAfflictions error: " + ex2));
				}
				Instance.loadedSaveFileThisRound = true;
			}

			[PunRPC]
			public void RPC_SyncMapVisuals(Segment segment, Vector3 savedPos)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				if (!PhotonNetwork.IsMasterClient)
				{
					HashSet<int> playersToTeleport = new HashSet<int>();
					((MonoBehaviour)this).StartCoroutine(Instance.CustomJumpToSegment(segment, playersToTeleport, savedPos));
				}
			}
		}

		[CompilerGenerated]
		private sealed class <CustomJumpToSegment>d__144 : 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__144(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_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_0069: 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_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: Expected O, but got Unknown
				//IL_0388: Unknown result type (might be due to invalid IL or missing references)
				//IL_038e: Invalid comparison between Unknown and I4
				//IL_0989: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a95: Invalid comparison between Unknown and I4
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Expected I4, but got Unknown
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0250: Unknown result type (might be due to invalid IL or missing references)
				//IL_099b: Unknown result type (might be due to invalid IL or missing references)
				//IL_09a1: Invalid comparison between Unknown and I4
				//IL_0a43: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a4d: Expected O, but got Unknown
				//IL_0a69: Unknown result type (might be due to invalid IL or missing references)
				//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_05bb: Invalid comparison between Unknown and I4
				//IL_0927: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Expected O, but got Unknown
				//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b1: Invalid comparison between Unknown and I4
				//IL_0277: Unknown result type (might be due to invalid IL or missing references)
				//IL_027d: Invalid comparison between Unknown and I4
				//IL_09f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_09fe: Invalid comparison between Unknown and I4
				//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
				//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_06ee: Expected O, but got Unknown
				//IL_092f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0935: Invalid comparison between Unknown and I4
				//IL_0b35: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b3b: Invalid comparison between Unknown and I4
				//IL_0605: Unknown result type (might be due to invalid IL or missing references)
				//IL_060f: Expected O, but got Unknown
				//IL_05df: Unknown result type (might be due to invalid IL or missing references)
				//IL_05e5: Invalid comparison between Unknown and I4
				//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_06c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0966: Unknown result type (might be due to invalid IL or missing references)
				//IL_0970: Expected O, but got Unknown
				//IL_0938: Unknown result type (might be due to invalid IL or missing references)
				//IL_093e: Invalid comparison between Unknown and I4
				//IL_0297: Unknown result type (might be due to invalid IL or missing references)
				//IL_029c: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b7c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b81: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b69: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b44: Invalid comparison between Unknown and I4
				//IL_0b1c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0941: Unknown result type (might be due to invalid IL or missing references)
				//IL_0947: Invalid comparison between Unknown and I4
				//IL_0401: Unknown result type (might be due to invalid IL or missing references)
				//IL_0407: Unknown result type (might be due to invalid IL or missing references)
				//IL_0411: Expected I4, but got Unknown
				//IL_0414: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a26: Expected O, but got Unknown
				//IL_0b47: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b4d: Invalid comparison between Unknown and I4
				//IL_094a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0950: Invalid comparison between Unknown and I4
				//IL_0442: Unknown result type (might be due to invalid IL or missing references)
				//IL_0448: Unknown result type (might be due to invalid IL or missing references)
				//IL_0452: Expected I4, but got Unknown
				//IL_0435: 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_045b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0465: Expected I4, but got Unknown
				//IL_0329: Unknown result type (might be due to invalid IL or missing references)
				//IL_032f: Invalid comparison between Unknown and I4
				//IL_0b50: Unknown result type (might be due to invalid IL or missing references)
				//IL_0b56: Invalid comparison between Unknown and I4
				//IL_0332: Unknown result type (might be due to invalid IL or missing references)
				//IL_0338: Invalid comparison between Unknown and I4
				//IL_036d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0377: Expected O, but got Unknown
				//IL_0350: Unknown result type (might be due to invalid IL or missing references)
				//IL_0356: Unknown result type (might be due to invalid IL or missing references)
				//IL_035c: Expected I4, but got Unknown
				//IL_033b: 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 val2 = Object.FindFirstObjectByType<EndScreen>();
						if (((MenuWindow)val2).isOpen)
						{
							MenuWindow obj = Object.FindFirstObjectByType<MenuWindow>();
							typeof(MenuWindow).GetMethod("Close", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj, null);
							plugin.pv.RPC("RPC_CloseEndscreen", (RpcTarget)1, Array.Empty<object>());
						}
					}
					catch (Exception ex2)
					{
						if (plugin.configDebugEnableLogging.Value)
						{
							plugin.LogEvent("(CustomJumpToSegment-Endscreen) " + ex2.Message);
						}
					}
					<mh>5__3 = Singleton<MapHandler>.Instance;
					if ((Object)(object)<mh>5__3 == (Object)null)
					{
						<>2__current = null;
						<>1__state = 4;
						return true;
					}
					goto IL_0225;
				case 4:
					<>1__state = -1;
					goto IL_0225;
				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_0465;
				case 6:
					<>1__state = -1;
					plugin.ResetLuggage();
					if (PhotonNetwork.IsMasterClient)
					{
						if (plugin.loadedSaveFileThisRound)
						{
							try
							{
								ISpawner[] componentsInChildren = <targetSegment>5__5.segmentParent.GetComponentsInChildren<ISpawner>();
								foreach (ISpawner val3 in componentsInChildren)
								{
									val3.TrySpawnItems();
								}
							}
							catch (Exception ex3)
							{
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent("(CustomJumpToSegment-TrySpawnItems) " + ex3.Message);
								}
							}
						}
						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_06fe;
				case 7:
					<>1__state = -1;
					goto IL_06fe;
				case 8:
					<>1__state = -1;
					((MonoBehaviour)plugin).StartCoroutine(plugin.ResetFogAfterLoad(<index>5__4, <final_segment>5__2));
					goto IL_099a;
				case 9:
					<>1__state = -1;
					goto IL_0a37;
				case 10:
					<>1__state = -1;
					if (PhotonNetwork.IsMasterClient)
					{
						<>2__current = ((MonoBehaviour)plugin).StartCoroutine(plugin.TeleportToPosition(<spawnPos>5__6));
						<>1__state = 11;
						return true;
					}
					goto IL_0aac;
				case 11:
					<>1__state = -1;
					if ((int)<final_segment>5__2 == 4 && Ascents.currentAscent < 4)
					{
						((MonoBehaviour)plugin).StartCoroutine(plugin.SpawnFlaresAtPeak());
					}
					goto IL_0aac;
				case 12:
					{
						<>1__state = -1;
						break;
					}
					IL_0465:
					if (PhotonNetwork.IsMasterClient && plugin.loadedSaveFileThisRound)
					{
						try
						{
							Item[] array = Object.FindObjectsByType<Item>((FindObjectsSortMode)0);
							Item[] array2 = array;
							foreach (Item val in array2)
							{
								if ((!((Object)(object)((Component)val).transform.parent == (Object)null) && Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<Player>())) || !((Object)(object)((MonoBehaviourPun)val).photonView != (Object)null) || !((MonoBehaviourPun)val).photonView.IsMine)
								{
									continue;
								}
								if (plugin.extModsPeakapaloozaENABLED && plugin.extModsPeakapaloozaPEAKTOBEACH)
								{
									if (!((Object)val).name.Contains("BingBong") && !((Object)val).name.Contains("Flare") && !((Object)val).name.Contains("Marshmallow") && !((Object)val).name.Contains("Glizzy"))
									{
										PhotonNetwork.Destroy(((MonoBehaviourPun)val).photonView);
									}
								}
								else if (!((Object)val).name.Contains("Marshmallow") && !((Object)val).name.Contains("Glizzy"))
								{
									PhotonNetwork.Destroy(((MonoBehaviourPun)val).photonView);
								}
							}
						}
						catch (Exception ex)
						{
							if (plugin.configDebugEnableLogging.Value)
							{
								plugin.LogEvent("(CustomJumpToSegment-DestroyItems) " + ex.Message);
							}
						}
					}
					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_0aac:
					if (plugin.loadedSaveFileThisRound && plugin.configCampfireReset.Value)
					{
						<>2__current = ((MonoBehaviour)plugin).StartCoroutine(plugin.ResetCampfire());
						<>1__state = 12;
						return true;
					}
					break;
					IL_0a37:
					<>2__current = (object)new WaitForSeconds(plugin.configAdvancedJumpLogicWaitTime.Value);
					<>1__state = 10;
					return true;
					IL_0225:
					<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 val5 = Chainloader.PluginInfos["PEAKapalooza"];
							BaseUnityPlugin instance = val5.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_0465;
					IL_099a:
					if ((int)<final_segment>5__2 == 2)
					{
						Tornado[] array3 = Object.FindObjectsByType<Tornado>((FindObjectsSortMode)0);
						Tornado[] array4 = array3;
						foreach (Tornado val6 in array4)
						{
							if ((Object)(object)val6 != (Object)null && ((Object)val6).name.Contains("Clone"))
							{
								try
								{
									Object.Destroy((Object)(object)((Component)val6).gameObject);
								}
								catch
								{
								}
							}
						}
					}
					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_0a37;
					IL_06fe:
					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[] array5 = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0);
							GameObject[] array6 = array5;
							foreach (GameObject val7 in array6)
							{
								try
								{
									if ((Object)(object)val7 == (Object)null || (!((Object)(object)val7.transform.parent == (Object)null) && !((Object)(object)val7.GetComponentInParent<Player>() == (Object)null)))
									{
										continue;
									}
									PhotonView component2 = val7.GetComponent<PhotonView>();
									if ((Object)(object)component2 == (Object)null)
									{
										continue;
									}
									foreach (string item in list)
									{
										if (((Object)val7).name.Contains(item) && component2.CreatorActorNr > 0 && !component2.IsRoomView)
										{
											PhotonNetwork.Destroy(val7.gameObject);
										}
									}
								}
								catch
								{
								}
							}
						}
						catch (Exception ex4)
						{
							if (plugin.configDebugEnableLogging.Value)
							{
								plugin.LogEvent("(CustomJumpToSegment-DestroyObjects1) " + ex4.Message);
							}
						}
						try
						{
							MagicBeanVine[] array7 = Object.FindObjectsByType<MagicBeanVine>((FindObjectsSortMode)0);
							MagicBeanVine[] array8 = array7;
							foreach (MagicBeanVine val8 in array8)
							{
								if (!((Object)(object)val8 == (Object)null) && ((Object)(object)((Component)val8).transform.parent == (Object)null || (Object)(object)((Component)val8).GetComponentInParent<Player>() == (Object)null) && ((Object)val8).name.Contains("MagicBeanVine"))
								{
									Object.Destroy((Object)(object)((Component)val8).gameObject);
								}
							}
						}
						catch (Exception ex5)
						{
							if (plugin.configDebugEnableLogging.Value)
							{
								plugin.LogEvent("(CustomJumpToSegment-DestroyObjects2) " + ex5.Message);
							}
						}
					}
					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_099a;
				}
				if (PhotonNetwork.IsMasterClient && plugin.configDaytime.Value)
				{
					if (plugin.savefileTimeOfDay != 0f)
					{
						DayNightManager val9 = Object.FindFirstObjectByType<DayNightManager>();
						val9.setTimeOfDay(plugin.savefileTimeOfDay);
					}
					((MonoBehaviour)plugin).StartCoroutine(plugin.LoadInventoryDelayed(segment));
				}
				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)
				{
					((MonoBehaviour)plugin).StartCoroutine(plugin.ResetFogAfterLoad(<index>5__4, <final_segment>5__2, extented_time: true));
				}
				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__150 : 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 Player[] <>7__wrap2;

			private Character <ch>5__4;

			private SaveData <data>5__5;

			private PhotonView <playerView>5__6;

			private int <i>5__7;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap2 = null;
				<ch>5__4 = null;
				<data>5__5 = null;
				<playerView>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0770: Unknown result type (might be due to invalid IL or missing references)
				//IL_077a: Expected I4, but got Unknown
				//IL_0786: Unknown result type (might be due to invalid IL or missing references)
				//IL_0790: Expected O, but got Unknown
				//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_07b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_07cc: Expected I4, but got Unknown
				//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0741: Unknown result type (might be due to invalid IL or missing references)
				//IL_074b: Expected O, but got Unknown
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<i>5__2 = 0;
					goto IL_006d;
				case 1:
					<>1__state = -1;
					<i>5__2++;
					goto IL_006d;
				case 2:
					<>1__state = -1;
					<i>5__7++;
					goto IL_01e4;
				case 3:
					<>1__state = -1;
					<i>5__7++;
					goto IL_04db;
				case 4:
					<>1__state = -1;
					<i>5__7++;
					goto IL_052e;
				case 5:
					<>1__state = -1;
					<i>5__2++;
					goto IL_0618;
				case 6:
					<>1__state = -1;
					plugin.pv.RPC("RPC_SetHeroTitle", (RpcTarget)1, new object[1] { (int)segment });
					goto IL_0780;
				case 7:
					{
						<>1__state = -1;
						if (!plugin.extModsPeakapaloozaPEAKTOBEACH)
						{
							Segment val = segment;
							switch (val - 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;
							}
						}
						if (PhotonNetwork.OfflineMode)
						{
							if (plugin.configOnetimeLoad.Value)
							{
								try
								{
									File.Delete(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save\\peak_save_offline.json"));
								}
								catch (Exception ex)
								{
									if (plugin.configDebugEnableLogging.Value)
									{
										plugin.LogEvent("(LoadPlayerOffline) Error while deleting save files: " + ex);
									}
									((BaseUnityPlugin)plugin).Logger.LogError((object)("[Checkpoint_Save] Error while deleting save files: " + ex));
								}
							}
						}
						else if (plugin.configOnetimeLoad.Value)
						{
							try
							{
								if (PhotonNetwork.IsMasterClient)
								{
									string[] files = Directory.GetFiles(Path.Combine(Paths.PluginPath + "\\Checkpoint_Save\\Coop"));
									string[] array = files;
									foreach (string path in array)
									{
										File.Delete(path);
									}
								}
							}
							catch (Exception ex2)
							{
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent("(LoadPlayerCoop) Error while deleting save files: " + ex2);
								}
								((BaseUnityPlugin)plugin).Logger.LogError((object)("[Checkpoint_Save] Error while deleting save files: " + ex2));
							}
						}
						return false;
					}
					IL_01e4:
					if (<i>5__7 < 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_0256;
					IL_05ce:
					if (<i>5__2 < <>7__wrap2.Length)
					{
						Player val2 = <>7__wrap2[<i>5__2];
						<ch>5__4 = val2.character;
						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;
						}
						<ch>5__4.refs.afflictions.RemoveAllThorns();
						if (plugin.configInventory.Value && <data>5__5 != null)
						{
							if (<ch>5__4.player.itemSlots != null)
							{
								ItemSlot[] itemSlots = <ch>5__4.player.itemSlots;
								foreach (ItemSlot val3 in itemSlots)
								{
									if (val3 != null)
									{
										try
										{
											val3.EmptyOut();
										}
										catch
										{
										}
									}
								}
							}
							if (<ch>5__4.player.backpackSlot.hasBackpack)
							{
								try
								{
									((ItemSlot)<ch>5__4.player.backpackSlot).EmptyOut();
								}
								catch
								{
								}
							}
							<i>5__7 = 0;
							goto IL_01e4;
						}
						goto IL_0256;
					}
					<>7__wrap2 = null;
					<i>5__2 = 0;
					goto IL_0618;
					IL_0256:
					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
								{
									if (plugin.configDebugEnableLogging.Value)
									{
										plugin.LogEvent("(LoadInventoryDelayed) Player has no PhotonView, cannot send afflictions RPC.");
									}
									((BaseUnityPlugin)plugin).Logger.LogWarning((object)"[Checkpoint_Save] LoadInventoryDelayed: Player has no PhotonView, cannot send afflictions RPC.");
								}
							}
							catch (Exception ex3)
							{
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent("(LoadInventoryDelayed) failed to send afflictions RPC: " + ex3);
								}
								((BaseUnityPlugin)plugin).Logger.LogWarning((object)("[Checkpoint_Save] LoadInventoryDelayed: failed to send afflictions RPC: " + ex3));
							}
						}
					}
					<i>5__7 = 0;
					goto IL_04db;
					IL_04db:
					if (<i>5__7 < 20)
					{
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					if (!PhotonNetwork.OfflineMode)
					{
						plugin.SendSyncInventory(<ch>5__4.player);
					}
					<i>5__7 = 0;
					goto IL_052e;
					IL_052e:
					if (<i>5__7 < 20)
					{
						<>2__current = null;
						<>1__state = 4;
						return true;
					}
					if (((MonoBehaviourPun)<ch>5__4).photonView.Owner.IsMasterClient && <data>5__5.timePlayed > 0f)
					{
						RunManager val4 = Object.FindFirstObjectByType<RunManager>();
						val4.timeSinceRunStarted = <data>5__5.timePlayed;
						if ((Object)(object)val4 != (Object)null)
						{
							typeof(RunManager).GetMethod("SyncTimeMaster", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(val4, null);
						}
					}
					<ch>5__4 = null;
					<data>5__5 = null;
					<playerView>5__6 = null;
					<i>5__2++;
					goto IL_05ce;
					IL_0618:
					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.5f);
						<>1__state = 6;
						return true;
					}
					goto IL_0780;
					IL_006d:
					if (<i>5__2 < 60)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>7__wrap2 = Object.FindObjectsByType<Player>((FindObjectsSortMode)0);
					<i>5__2 = 0;
					goto IL_05ce;
					IL_0780:
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 7;
					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 <PeakapaloozaCheckGameobjects>d__127 : 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__127(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__128 : 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__128(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_0226: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Expected O, but got Unknown
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Expected O, but got Unknown
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: 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 val2 = Chainloader.PluginInfos["PEAKapalooza"];
					<instance>5__2 = val2.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_00d0;
				}
				case 2:
					<>1__state = -1;
					goto IL_00d0;
				case 3:
				{
					<>1__state = -1;
					Player[] array = Object.FindObjectsByType<Player>((FindObjectsSortMode)0);
					foreach (Player val in array)
					{
						if (!((Object)(object)val == (Object)null))
						{
							Character character = val.character;
							character.data.dead = false;
							character.data.deathTimer = 0f;
							character.data.passedOut = false;
							character.data.fullyPassedOut = false;
							character.data.sinceGrounded = 0f;
							character.refs.afflictions.ClearAllStatus(true);
							character.refs.afflictions.RemoveAllThorns();
							character.refs.afflictions.ClearAllAfflictions();
							character.data.fallSeconds = 0f;
						}
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 4;
					return true;
				}
				case 4:
					{
						<>1__state = -1;
						((MonoBehaviour)plugin).StartCoroutine(plugin.TeleportClientsToHost(new Vector3(16f, 1235f, 2239f)));
						break;
					}
					IL_00d0:
					if (!(bool)<field>5__3.GetValue(<instance>5__2))
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					plugin.pv.RPC("RPC_RequestFalldamageProtection", (RpcTarget)0, new object[1] { 30 });
					<>2__current = (object)new WaitForSeconds(5f);
					<>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 <ResetCampfire>d__143 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Campfire[] <>7__wrap1;

			private int <>7__wrap2;

			private Campfire <campfire>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap1 = null;
				<campfire>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Expected O, but got Unknown
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>7__wrap1 = Object.FindObjectsByType<Campfire>((FindObjectsSortMode)0);
					<>7__wrap2 = 0;
					goto IL_0135;
				case 1:
				{
					<>1__state = -1;
					<campfire>5__4.state = (FireState)0;
					Transform logRoot = <campfire>5__4.logRoot;
					for (int i = 0; i < logRoot.childCount; i++)
					{
						((Component)logRoot.GetChild(i)).gameObject.SetActive(true);
					}
					goto IL_0100;
				}
				case 2:
					{
						<>1__state = -1;
						<campfire>5__4 = null;
						<>7__wrap2++;
						goto IL_0135;
					}
					IL_0100:
					<>2__current = (object)new WaitForSeconds(0.05f);
					<>1__state = 2;
					return true;
					IL_0135:
					if (<>7__wrap2 < <>7__wrap1.Length)
					{
						<campfire>5__4 = <>7__wrap1[<>7__wrap2];
						if (<campfire>5__4.EveryoneInRange() && !((Object)<campfire>5__4).name.Contains("PortableStovetop_Placed"))
						{
							MethodInfo method = typeof(Campfire).GetMethod("Extinguish_Rpc", BindingFlags.Instance | BindingFlags.NonPublic);
							if (method != null)
							{
								method.Invoke(<campfire>5__4, null);
							}
							<>2__current = (object)new WaitForSeconds(0.3f);
							<>1__state = 1;
							return true;
						}
						goto IL_0100;
					}
					<>7__wrap1 = null;
					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__145 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public int index;

			public bool extented_time;

			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__145(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Invalid comparison between Unknown and I4
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Expected O, but got Unknown
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Expected O, but got Unknown
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Invalid comparison between Unknown and I4
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Expected O, but got Unknown
				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);
						if (!extented_time)
						{
							<>2__current = (object)new WaitForSeconds(1.5f);
							<>1__state = 1;
							return true;
						}
						<>2__current = (object)new WaitForSeconds(8f);
						<>1__state = 2;
						return true;
					}
					if (GameObject.Find("FogSphereSystem").activeSelf)
					{
						GameObject.Find("FogSphereSystem").SetActive(false);
					}
					goto IL_00e3;
				case 1:
					<>1__state = -1;
					goto IL_00a4;
				case 2:
					<>1__state = -1;
					goto IL_00a4;
				case 3:
					{
						<>1__state = -1;
						goto IL_013d;
					}
					IL_00a4:
					<fog>5__2.isMoving = false;
					<fog>5__2.currentWaitTime = 0f;
					goto IL_00e3;
					IL_013d:
					<fog>5__2 = null;
					break;
					IL_00e3:
					if ((int)segment == 3 || (int)segment == 4)
					{
						<fog>5__2.currentSize = 10000f;
						<fog>5__2.speed = 0f;
						if (!extented_time)
						{
							<>2__current = (object)new WaitForSeconds(0.5f);
							<>1__state = 3;
							return true;
						}
					}
					goto IL_013d;
				}
				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 <SendModVersionToMaster>d__116 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0042;
				case 1:
					<>1__state = -1;
					goto IL_0042;
				case 2:
					{
						<>1__state = -1;
						plugin.pv.RPC("RPC_SendModVersionToMaster", (RpcTarget)2, new object[3]
						{
							PhotonNetwork.LocalPlayer.UserId,
							PhotonNetwork.LocalPlayer.NickName,
							Version
						});
						return false;
					}
					IL_0042:
					if ((Object)(object)Character.localCharacter == (Object)null)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(1f);
					<>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 <SendReadyStatusToMaster>d__117 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Plugin <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				int num = <>1__state;
				Plugin plugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0042;
				case 1:
					<>1__state = -1;
					goto IL_0042;
				case 2:
					{
						<>1__state = -1;
						plugin.pv.RPC("RPC_SendReadyStatusToMaster", (RpcTarget)2, new object[2]
						{
							PhotonNetwork.LocalPlayer.UserId,
							PhotonNetwork.LocalPlayer.NickName
						});
						return false;
					}
					IL_0042:
					if ((Object)(object)Character.localCharacter == (Object)null)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>2__current = (object)new WaitForSeconds(5f);
					<>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 <SpawnFlaresAtPeak>d__142 : 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__142(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__148 : 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 Player[] <>7__wrap2;

			private Character <ch>5__4;

			private float <startTime>5__5;

			private int <triedTeleport>5__6;

			private int <i>5__7;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>7__wrap2 = null;
				<ch>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0304: Unknown result type (might be due to invalid IL or missing references)
				//IL_032f: Unknown result type (might be due to invalid IL or missing references)
				//IL_019b: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: 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;
					<i>5__2 = 0;
					goto IL_0059;
				case 1:
					<>1__state = -1;
					<i>5__2++;
					goto IL_0059;
				case 2:
					{
						<>1__state = -1;
						<i>5__7++;
						goto IL_03eb;
					}
					IL_0059:
					if (<i>5__2 < plugin.configAdvancedTeleportFramesToWait.Value)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<>7__wrap2 = Object.FindObjectsByType<Player>((FindObjectsSortMode)0);
					<i>5__2 = 0;
					goto IL_0429;
					IL_03fe:
					if (Time.time - <startTime>5__5 < 30f)
					{
						if (Math.Abs(<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})");
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent($"(TeleportClientsToHost) warped {((Object)<ch>5__4.player).name} to {hostPos} (previous position: {<ch>5__4.Head})");
								}
							}
							catch (Exception ex)
							{
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent("(TeleportClientToHost) failed: " + 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);
							}
							<triedTeleport>5__6++;
							if (<triedTeleport>5__6 <= 150)
							{
								goto IL_03bb;
							}
						}
						else
						{
							if (!(Math.Abs(<ch>5__4.Head.x - hostPos.x) < 6f) || !(Math.Abs(<ch>5__4.Head.z - hostPos.z) < 6f))
							{
								goto IL_03bb;
							}
							if (plugin.configDebugEnableLogging.Value)
							{
								plugin.LogEvent($"(TeleportClientsToHost) warped {((Object)<ch>5__4.player).name} after {<triedTeleport>5__6} attempts.");
							}
							((BaseUnityPlugin)plugin).Logger.LogMessage((object)$"[Checkpoint_Save] TeleportClientToHost: warped {((Object)<ch>5__4.player).name} after {<triedTeleport>5__6} attempts.");
						}
					}
					goto IL_0414;
					IL_0429:
					if (<i>5__2 < <>7__wrap2.Length)
					{
						Player val = <>7__wrap2[<i>5__2];
						<ch>5__4 = val.character;
						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;
							<triedTeleport>5__6 = 0;
							goto IL_03fe;
						}
						goto IL_0414;
					}
					<>7__wrap2 = null;
					return false;
					IL_03bb:
					<i>5__7 = 0;
					goto IL_03eb;
					IL_0414:
					<ch>5__4 = null;
					<i>5__2++;
					goto IL_0429;
					IL_03eb:
					if (<i>5__7 < plugin.configAdvancedTeleportFramesToWait.Value)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					goto IL_03fe;
				}
			}

			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 <TeleportToPosition>d__147 : 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__147(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_037c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0264: 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_029d: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c7: 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_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_0358: Unknown result type (might be due to invalid IL or missing references)
				//IL_0362: 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_03d1;
				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_03be;
					}
					IL_03d1:
					if (Time.time - <startTimeLocal>5__3 < 30f)
					{
						if ((Object)(object)Character.localCharacter == (Object)null)
						{
							return false;
						}
						if (Math.Abs(Character.localCharacter.Head.y - <warpPos>5__2.y) > 3f)
						{
							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 });
								}
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent($"[Checkpoint_Save] TeleportClientToHost: warped {((Object)Character.localCharacter.player).name} to {<warpPos>5__2}  (previous position: {Character.localCharacter.Head})");
								}
								((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)
							{
								if (plugin.configDebugEnableLogging.Value)
								{
									plugin.LogEvent("[Checkpoint_Save] TeleportClientToHost failed: " + 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 (Math.Abs(Character.localCharacter.Head.x - <warpPos>5__2.x) < 6f && Math.Abs(Character.localCharacter.Head.z - <warpPos>5__2.z) < 6f)
						{
							if (plugin.configDebugEnableLogging.Value)
							{
								plugin.LogEvent($"[Checkpoint_Save] TeleportClientToHost: warped {((Object)Character.localCharacter.player).name} after {<triedTeleportLocal>5__4} attempts.");
							}
							((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_03be;
					}
					return false;
					IL_03be:
					if (<i>5__5 < plugin.configAdvancedTeleportFramesToWait.Value)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					goto IL_03d1;
				}
			}

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

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

		private string Logger_Path = "";

		public readonly int settingsVersion = 6;

		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>? configDaytime;

		public ConfigEntry<bool>? configCampfireReset;

		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>? configAdvancedEnableClientModCheck;

		public ConfigEntry<bool>? configAdvancedEnableClientReadyStatusCheck;

		public ConfigEntry<bool>? configDebugEnableTeleport;

		public ConfigEntry<KeyboardShortcut>? configDebugTeleportKey;

		public ConfigEntry<bool>? configDebugEnableLogging;

		public static Plugin? Instance;

		private Harmony? _harmony;

		private Player? cachedPlayer;

		private PhotonView? pv;

		private GameObject? networkGO;

		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 GameObject? _tutorialOverlay;

		private TextMeshProUGUI? _tutorialTMP;

		private Image? _tutorialImage;

		private bool tutorialMessageEnabled;

		private bool firstTimeTutorialMessage;

		private Toggle? _boardingToggle;

		internal static float NoFallDamageUntil = 0f;

		internal static float RecentlyLoaded = 0f;

		internal static float RecentlyLitCampfire = 0f;

		private float lastTimePressedKey;

		private bool loadedSaveFileThisRound;

		private bool currentlyLoading;

		private bool clientSentModVersion;

		private Dictionary<string, string> playerReceivedModVersions = new Dictionary<string, string>();

		private bool clientSentReadyStatus;

		private Dictionary<string, string> playerReceivedReadyStatus = new Dictionary<string, string>();

		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 bool extModsPeakUnlimitedENABLED;

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

		private static MethodInfo? _playerAddItemMethod;

		private string selectedLevel = "null";

		private int selectedAscent;

		private Segment savedSegment;

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

		private string savefileTimeSaved = "null";

		private string savefileCampfireName = "null";

		private float savefilePlaytime;

		private float savefileTimeOfDay;

		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";

		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.7";

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

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

		private void CreatePhotonView(bool destroy_first = false)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			if (destroy_first)
			{
				try
				{
					if ((Object)(object)networkGO != (Object)null)
					{
						Object.Destroy((Object)(object)networkGO);
						networkGO = null;
					}
					if ((Object)(object)pv != (Object)null)
					{
						Object.Destroy((Object)(object)pv);
						pv = null;
					}
				}
				catch
				{
				}
			}
			try
			{
				if (!((Object)(object)networkGO != (Object)null))
				{
					networkGO = new GameObject("CheckpointNetwork");
					Object.DontDestroyOnLoad((Object)(object)networkGO);
					pv = networkGO.AddComponent<PhotonView>();
					networkGO.AddComponent<CheckpointNetwork>();
					pv.ViewID = 19420;
				}
			}
			catch (Exception ex)
			{
				if (configDebugEnableLogging.Value)
				{
					LogEvent("[Checkpoint_Save] (CreatePhotonview): " + ex);
				}
				((BaseUnityPlugin)this).Logger.LogError((object)("[Checkpoint_Save] (CreatePhotonview): " + ex));
			}
		}

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

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

		private bool CheckReadyStatusForPlayers()
		{
			bool flag = false;
			Player[] array = Object.FindObjectsByType<Player>((FindObjectsSortMode)0);
			foreach (Player val in array)
			{
				if (!((Object)(object)val == (Object)null))
				{
					Character character = val.character;
					if (!playerReceivedReadyStatus.ContainsKey(NetworkingUtilities.GetUserId(character.player)) && !((MonoBehaviourPun)character).photonView.Owner.IsMasterClient)
					{
						flag = true;
					}
				}
			}
			if (flag)
			{
				return false;
			}
			return true;
		}

		private void Awake()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: 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");
			}
			if (!Directory.Exists(Paths.PluginPath + "\\Checkpoint_Save\\Logs"))
			{
				Directory.CreateDirectory(Paths.PluginPath + "\\Checkpoint_Save\\Logs");
			}
			_harmony = new Harmony("peak.checkpoint.save.harmony");
			_harmony.PatchAll();
			Instance = this;
			CreatePhotonView();
			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)");
			configDaytime = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableDaytime", true, "Enable save/load of the current ingame time.");
			configCampfireReset = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "enableCampfireReset", true, "If enabled, the campfire will reset after loading more than once in the current run.");
			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.13f, "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 Tutoria