Decompiled source of Zeranos Moon v0.0.35

kite.ZelevatorCode.dll

Decompiled a day 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.Logging;
using DunGen;
using ElevatorMod.Patches.Utils;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using WeatherRegistry;
using kite.ZelevatorCode.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("kite.ZelevatorCode")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ElevatorMod")]
[assembly: AssemblyTitle("kite.ZelevatorCode")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
}
[HarmonyPriority(99999)]
[HarmonyPatch(typeof(TimeOfDay))]
[HarmonyPatch("TimeOfDayEvents")]
public static class TimeOfDayEventsPatch
{
	private static bool Prefix(TimeOfDay __instance)
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (StartOfRound.Instance.currentLevel.PlanetName != "7510 Zeranos")
		{
			return true;
		}
		__instance.dayMode = __instance.GetDayPhase(__instance.globalTime / __instance.totalTime);
		if (__instance.dayMode > __instance.dayModeLastTimePlayerWasOutside)
		{
			__instance.PlayerSeesNewTimeOfDay();
		}
		float num = __instance.globalTime / __instance.totalTime;
		if (!(num >= 0.25f) || num <= 0.75f)
		{
		}
		return false;
	}
}
namespace ElevatorMod
{
	[BepInPlugin("kite.ZelevatorCode", "ElevatorMod", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ElevatorMod : BaseUnityPlugin
	{
		public static AssetBundle zeranosWeathersBundle;

		public Weather BloodMoonWeather;

		public GameObject BloodMoonPermanentEffectPrefab;

		public Weather RadiationWeather;

		public GameObject RadiationPermanentEffectPrefab;

		public static GameObject RadiationZonePrefab;

		public static AssetBundle elevatorAnimationsBundle;

		public static AssetBundle elevatorEnemiesBundle;

		public static RuntimeAnimatorController elevatorAnimController;

		public static GameObject planetTimeMonitor;

		public static ElevatorMod Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			elevatorAnimationsBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "zeranosmisc"));
			elevatorEnemiesBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "zeranosenemies"));
			zeranosWeathersBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "zeranosweathers"));
			if ((Object)(object)elevatorAnimationsBundle == (Object)null || (Object)(object)elevatorEnemiesBundle == (Object)null || (Object)(object)zeranosWeathersBundle == (Object)null)
			{
				Logger.LogError((object)"Failed to load assets.");
			}
			else
			{
				Logger.LogInfo((object)"------------------------------------------------------");
				planetTimeMonitor = elevatorAnimationsBundle.LoadAsset<GameObject>("PlanetTime_MPf.prefab");
				NetworkPrefabs.RegisterNetworkPrefab(planetTimeMonitor);
				LoadScrapsBundlesAndRegister();
				LoadEnemiesBundlesAndRegister();
				LoadWeatherBundles();
				RegisterAllWeathers();
			}
			NetcodePatcher();
			Patch();
			Logger.LogInfo((object)"kite.ZelevatorCode v1.0.0 has loaded!");
		}

		public void LoadScrapsBundlesAndRegister()
		{
		}

		public void LoadEnemiesBundlesAndRegister()
		{
			EnemyType val = elevatorEnemiesBundle.LoadAsset<EnemyType>("ShadowPlayerEnemy");
			TerminalNode val2 = elevatorEnemiesBundle.LoadAsset<TerminalNode>("ShadowEnemyTN");
			TerminalKeyword val3 = elevatorEnemiesBundle.LoadAsset<TerminalKeyword>("ShadowEnemyTK");
			Dictionary<string, int> dictionary = new Dictionary<string, int> { { "7510 Zeranos", 19 } };
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
		}

		public void LoadWeatherBundles()
		{
			BloodMoonPermanentEffectPrefab = zeranosWeathersBundle.LoadAsset<GameObject>("BloodMoonPermanentEffect.prefab");
			RadiationPermanentEffectPrefab = zeranosWeathersBundle.LoadAsset<GameObject>("RadiationStormPermanentEffect.prefab");
			RadiationZonePrefab = zeranosWeathersBundle.LoadAsset<GameObject>("RadiationAnomaly.prefab");
			NetworkPrefabs.RegisterNetworkPrefab(RadiationZonePrefab);
		}

		public void RegisterAllWeathers()
		{
			RegisterBloodMoonWeather();
			RegisterRadiationStormWeather();
		}

		private void RegisterBloodMoonWeather()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(BloodMoonPermanentEffectPrefab);
			((Object)val).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)val);
			ImprovedWeatherEffect val2 = new ImprovedWeatherEffect((GameObject)null, val)
			{
				SunAnimatorBool = ""
			};
			Weather val3 = new Weather("Blood Moon", val2);
			val3.DefaultWeight = 20;
			val3.DefaultLevelFilters = new string[1] { "7510 Zeranos" };
			val3.LevelFilteringOption = (FilteringOption)0;
			val3.Color = Color.red;
			BloodMoonWeather = val3;
			WeatherManager.RegisterWeather(BloodMoonWeather);
		}

		private void RegisterRadiationStormWeather()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(RadiationPermanentEffectPrefab);
			((Object)val).hideFlags = (HideFlags)61;
			Object.DontDestroyOnLoad((Object)(object)val);
			ImprovedWeatherEffect val2 = new ImprovedWeatherEffect((GameObject)null, val)
			{
				SunAnimatorBool = ""
			};
			Weather val3 = new Weather("Radiation", val2);
			val3.DefaultWeight = 25;
			val3.DefaultLevelFilters = new string[1] { "7510 Zeranos" };
			val3.LevelFilteringOption = (FilteringOption)0;
			val3.Color = Color.yellow;
			RadiationWeather = val3;
			WeatherManager.RegisterWeather(RadiationWeather);
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("kite.ZelevatorCode");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		private void NetcodePatcher()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "kite.ZelevatorCode";

		public const string PLUGIN_NAME = "ElevatorMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ElevatorMod.Patches
{
	public class AttachmentToStartOfRound : NetworkBehaviour
	{
		public static AttachmentToStartOfRound Instance;

		public List<float> levelTimes = new List<float>();

		public float zeranosTime;

		public float currentLevelTime;

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

		private void Start()
		{
			RandomizePlanetTime();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ClearList_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1314414026u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1314414026u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClearList_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ClearList_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1856846744u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1856846744u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					levelTimes.Clear();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AddToList_ServerRpc(float time)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1893358891u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1893358891u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AddToList_ClientRpc(time);
				}
			}
		}

		[ClientRpc]
		public void AddToList_ClientRpc(float time)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(71325336u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref time, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 71325336u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					levelTimes.Add(time);
					Debug.Log((object)("Adding to the list: " + time));
				}
			}
		}

		public void RandomizePlanetTime()
		{
			StartOfRound instance = StartOfRound.Instance;
			if (((NetworkBehaviour)instance).IsServer)
			{
				Instance.ClearList_ServerRpc();
				string currentSaveFileName = GameNetworkManager.Instance.currentSaveFileName;
				Terminal val = Object.FindObjectOfType<Terminal>();
				SelectableLevel[] moonsCatalogueList = val.moonsCatalogueList;
				SelectableLevel[] array = moonsCatalogueList;
				foreach (SelectableLevel val2 in array)
				{
					float num = Random.Range(0f, 1f);
					ES3.Save<float>(val2.PlanetName + "_globaltime", num);
					Instance.AddToList_ServerRpc(num);
				}
				SetZeranosTime_ClientRpc(zeranosTime = Random.Range(0f, 1f));
			}
		}

		[ClientRpc]
		public void SetZeranosTime_ClientRpc(float newTime)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3755566542u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newTime, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3755566542u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					zeranosTime = newTime;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AttachmentToStartOfRound()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1314414026u, new RpcReceiveHandler(__rpc_handler_1314414026));
			NetworkManager.__rpc_func_table.Add(1856846744u, new RpcReceiveHandler(__rpc_handler_1856846744));
			NetworkManager.__rpc_func_table.Add(1893358891u, new RpcReceiveHandler(__rpc_handler_1893358891));
			NetworkManager.__rpc_func_table.Add(71325336u, new RpcReceiveHandler(__rpc_handler_71325336));
			NetworkManager.__rpc_func_table.Add(3755566542u, new RpcReceiveHandler(__rpc_handler_3755566542));
		}

		private static void __rpc_handler_1314414026(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AttachmentToStartOfRound)(object)target).ClearList_ServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1856846744(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AttachmentToStartOfRound)(object)target).ClearList_ClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1893358891(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float time = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref time, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AttachmentToStartOfRound)(object)target).AddToList_ServerRpc(time);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_71325336(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float time = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref time, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AttachmentToStartOfRound)(object)target).AddToList_ClientRpc(time);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3755566542(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float zeranosTime_ClientRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref zeranosTime_ClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AttachmentToStartOfRound)(object)target).SetZeranosTime_ClientRpc(zeranosTime_ClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AttachmentToStartOfRound";
		}
	}
	public class CameraMonitor : MonoBehaviour
	{
		public MeshRenderer monitorRenderer;

		public Material blackMat;

		public Material screenMat;

		private RenderTexture selectedRt;

		public void Init()
		{
			Material[] materials = ((Renderer)monitorRenderer).materials;
			materials[1] = blackMat;
			((Renderer)monitorRenderer).materials = materials;
		}

		public void EnableMonitor(RenderTexture renderTexture)
		{
			selectedRt = renderTexture;
			screenMat.SetTexture("_UnlitColorMap", (Texture)(object)renderTexture);
			screenMat.EnableKeyword("_UNLIT_COLOR_MAP");
			Material[] materials = ((Renderer)monitorRenderer).materials;
			materials[1] = screenMat;
			((Renderer)monitorRenderer).materials = materials;
			Debug.Log((object)"Enabling Monitors");
		}

		public void ToggleMonitor(bool enable)
		{
			if (enable)
			{
				screenMat.SetTexture("_UnlitColorMap", (Texture)(object)selectedRt);
				screenMat.EnableKeyword("_UNLIT_COLOR_MAP");
				Material[] materials = ((Renderer)monitorRenderer).materials;
				materials[1] = screenMat;
				((Renderer)monitorRenderer).materials = materials;
				Debug.Log((object)"Enabling Monitors");
			}
			else
			{
				Material[] materials2 = ((Renderer)monitorRenderer).materials;
				materials2[1] = blackMat;
				((Renderer)monitorRenderer).materials = materials2;
				Debug.Log((object)"Disabling Monitors");
			}
		}
	}
	public class CCTVMonitors : MonoBehaviour
	{
		public int seed = 6516451;

		public List<FacilityCCTV> cameras = new List<FacilityCCTV>();

		public List<CameraMonitor> monitors = new List<CameraMonitor>();

		public void Init()
		{
			seed = StartOfRound.Instance.randomMapSeed;
			foreach (CameraMonitor monitor in monitors)
			{
				monitor.Init();
			}
			FacilityCCTV[] array = Object.FindObjectsOfType<FacilityCCTV>();
			FacilityCCTV[] array2 = array;
			foreach (FacilityCCTV facilityCCTV in array2)
			{
				cameras.Add(facilityCCTV);
				facilityCCTV.Init();
				facilityCCTV.ToggleCamera(enable: false);
				Debug.Log((object)("Found camera " + ((Object)((Component)facilityCCTV).gameObject).name + ", adding to the List."));
			}
			ShuffleMonitors(monitors, seed);
			int randomIntFromSeed = KiteUtilities.GetRandomIntFromSeed(seed, 2, monitors.Count - 8);
			for (int j = 0; j < randomIntFromSeed; j++)
			{
				monitors[j].EnableMonitor(cameras[j].GetRenderTexture());
			}
		}

		public void ToggleRendering(bool enable)
		{
			foreach (FacilityCCTV camera in cameras)
			{
				camera.ToggleCamera(enable);
			}
			foreach (CameraMonitor monitor in monitors)
			{
				monitor.ToggleMonitor(enable);
			}
		}

		public void ShuffleMonitors(List<CameraMonitor> list, int seed)
		{
			Random random = new Random(seed);
			int count = list.Count;
			for (int num = count - 1; num > 0; num--)
			{
				int index = random.Next(num + 1);
				CameraMonitor value = list[num];
				list[num] = list[index];
				list[index] = value;
			}
		}

		public static int GetRandomIntFromSeed(int seed, int min, int max)
		{
			if (min >= max)
			{
				throw new ArgumentException("Min value must be less than Max value.");
			}
			Random random = new Random(seed);
			return random.Next(min, max);
		}
	}
	public class ElevatorApparatus : NetworkBehaviour
	{
		[Header("Used by EndlessElevator")]
		[Space]
		public int lightMaterialIndex = 1;

		private LungProp apparatus;

		private Light light;

		private MeshRenderer apparatusRenderer;

		public float apparatusPower = -1f;

		public float maxApparatusPower = 50f;

		public float minApparatusPower = 150f;

		public bool lungPowered = true;

		public bool server_starLowerPower = false;

		public static ElevatorApparatus Instance { get; private set; }

		public void Awake()
		{
			Instance = this;
		}

		public void Initialize()
		{
			GetLigtAndMesh();
			RandomizePower();
			Debug.Log((object)$"{((Object)((Component)this).gameObject).name} : Init, {lungPowered}, {apparatusPower}");
		}

		public void Update()
		{
			if (((NetworkBehaviour)this).IsServer && server_starLowerPower)
			{
				apparatusPower -= EndlessElevator.Instance.chargeMultiplier;
				apparatusPower = Mathf.Clamp(apparatusPower, 0f, 200f);
				SetLungPower_ClientRpc(apparatusPower);
				if (apparatusPower <= 0f)
				{
					ToggleOffLung();
					server_starLowerPower = false;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DockToElevator_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2670638014u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2670638014u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DockToElevator_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void DockToElevator_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2693657390u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2693657390u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					DockToElevator();
				}
			}
		}

		public void DockToElevator()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			Debug.LogWarning((object)"Docking apparatus to elevator");
			((GrabbableObject)apparatus).playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
			((GrabbableObject)apparatus).isHeldByEnemy = false;
			((GrabbableObject)apparatus).hasBeenHeld = true;
			apparatus.isLungDockedInElevator = true;
			apparatus.sparkParticle.SetActive(true);
			((Component)apparatus).GetComponentInChildren<Collider>().enabled = false;
			((Component)apparatus).transform.parent = ((Component)EndlessElevator.Instance.apparatusPosition).transform;
			((Component)apparatus).transform.SetPositionAndRotation(((Component)EndlessElevator.Instance.apparatusPosition).transform.position, ((Component)EndlessElevator.Instance.apparatusPosition).transform.rotation);
			EndlessElevator.Instance.SetApparatus(apparatus, this);
			EndlessElevator.Instance.updateAppPosition = true;
			EndlessElevator.Instance.StopUpdateApparatusPosition_Invoke(5f);
			if (!(EndlessElevator.Instance.elevatorPower >= EndlessElevator.Instance.maxElevatorPower))
			{
				server_starLowerPower = true;
				EndlessElevator.Instance.server_startCharging = true;
				EndlessElevator.Instance.server_startDecreasing = false;
				Debug.Log((object)$"{server_starLowerPower} - {EndlessElevator.Instance.server_startCharging} : {EndlessElevator.Instance.server_startDecreasing}");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DeattachFromElevator_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1024670841u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1024670841u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DeattachFromElevator_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void DeattachFromElevator_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3340352423u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3340352423u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					DeattachFromElevator();
				}
			}
		}

		public void DeattachFromElevator()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			Debug.LogWarning((object)"Deattaching apparatus from elevator");
			((GrabbableObject)apparatus).isHeldByEnemy = false;
			((GrabbableObject)apparatus).hasBeenHeld = false;
			apparatus.isLungDockedInElevator = false;
			if ((Object)(object)apparatus.sparkParticle != (Object)null)
			{
				apparatus.sparkParticle.SetActive(false);
			}
			((Component)apparatus).GetComponentInChildren<Collider>().enabled = true;
			((Component)apparatus).transform.parent = RoundManager.Instance.mapPropsContainer.transform;
			((Component)apparatus).transform.position = ((Component)EndlessElevator.Instance.apparatusPosition).transform.position;
			((Component)apparatus).transform.rotation = ((Component)EndlessElevator.Instance.apparatusPosition).transform.rotation;
			EndlessElevator.Instance.hasApparatus = false;
			EndlessElevator.Instance.server_startCharging = false;
			server_starLowerPower = false;
		}

		public void RandomizePower()
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				float randomRange = EndlessElevator.Instance.GetRandomRange(minApparatusPower, maxApparatusPower, StartOfRound.Instance.randomMapSeed);
				apparatusPower = randomRange;
				SetLungPower_ClientRpc(apparatusPower);
			}
		}

		[ClientRpc]
		public void SetLungPower_ClientRpc(float newValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3729071495u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref newValue, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3729071495u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					apparatusPower = newValue;
				}
			}
		}

		public void GetLigtAndMesh()
		{
			light = GetChildWithPrefix(((Component)this).gameObject.transform, "Point Light").GetComponent<Light>();
			apparatusRenderer = GetChildWithPrefix(((Component)this).gameObject.transform, "Mesh").GetComponent<MeshRenderer>();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ToggleOffLung_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4092688392u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4092688392u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ToggleOffLung_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ToggleOffLung_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4158817614u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4158817614u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ToggleLung(enable: false);
				}
			}
		}

		public void ToggleOffLung()
		{
			ToggleLung(enable: false);
			Debug.Log((object)(((Object)((Component)this).gameObject).name + " : lung apparatus has no power"));
		}

		public void ToggleLung(bool enable)
		{
			if (enable)
			{
				((Behaviour)light).enabled = true;
				((Renderer)apparatusRenderer).materials[1] = EndlessElevator.Instance.lungLightOnMat;
				lungPowered = true;
			}
			else
			{
				((Behaviour)light).enabled = false;
				((Renderer)apparatusRenderer).materials[1] = EndlessElevator.Instance.lungLightOffMat;
				lungPowered = false;
			}
		}

		public void SetLungProp(LungProp newProp)
		{
			apparatus = newProp;
		}

		public LungProp GetLungProp()
		{
			return apparatus;
		}

		public static GameObject GetChildWithPrefix(Transform parent, string prefix)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (((Object)val).name.StartsWith(prefix))
				{
					return ((Component)val).gameObject;
				}
			}
			return null;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ElevatorApparatus()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2670638014u, new RpcReceiveHandler(__rpc_handler_2670638014));
			NetworkManager.__rpc_func_table.Add(2693657390u, new RpcReceiveHandler(__rpc_handler_2693657390));
			NetworkManager.__rpc_func_table.Add(1024670841u, new RpcReceiveHandler(__rpc_handler_1024670841));
			NetworkManager.__rpc_func_table.Add(3340352423u, new RpcReceiveHandler(__rpc_handler_3340352423));
			NetworkManager.__rpc_func_table.Add(3729071495u, new RpcReceiveHandler(__rpc_handler_3729071495));
			NetworkManager.__rpc_func_table.Add(4092688392u, new RpcReceiveHandler(__rpc_handler_4092688392));
			NetworkManager.__rpc_func_table.Add(4158817614u, new RpcReceiveHandler(__rpc_handler_4158817614));
		}

		private static void __rpc_handler_2670638014(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ElevatorApparatus)(object)target).DockToElevator_ServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2693657390(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ElevatorApparatus)(object)target).DockToElevator_ClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1024670841(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ElevatorApparatus)(object)target).DeattachFromElevator_ServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3340352423(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ElevatorApparatus)(object)target).DeattachFromElevator_ClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3729071495(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float lungPower_ClientRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref lungPower_ClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ElevatorApparatus)(object)target).SetLungPower_ClientRpc(lungPower_ClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4092688392(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ElevatorApparatus)(object)target).ToggleOffLung_ServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4158817614(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ElevatorApparatus)(object)target).ToggleOffLung_ClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ElevatorApparatus";
		}
	}
	public class ElevatorGasTank : NetworkBehaviour
	{
		[HideInInspector]
		public float power;

		public float minPower = 70f;

		public float maxPower = 150f;

		private RoundManager roundManager;

		public void Start()
		{
			roundManager = Object.FindObjectOfType<RoundManager>();
			SetRandomPowerLocal();
		}

		[ClientRpc]
		public void SetRandomPower_ClientRpc(float value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(765644298u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 765644298u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					power = value;
					Debug.Log((object)$"Got power : {power}");
				}
			}
		}

		public void SetRandomPowerLocal()
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				float randomRange = EndlessElevator.Instance.GetRandomRange(minPower, maxPower, StartOfRound.Instance.randomMapSeed);
				power = randomRange;
				Debug.Log((object)$"Server add random power : {power}");
				SetRandomPower_ClientRpc(power);
			}
		}

		public void DockToElevator(EndlessElevator Instance)
		{
			if (((NetworkBehaviour)this).IsServer && !(power <= 0f))
			{
				Instance.AddPower_ServerRpc(power);
				Instance.hasApparatus = true;
				Instance.server_startCharging = false;
				Instance.server_startDecreasing = false;
				Instance.noPower = false;
				Instance.SetLightState_ServerRpc(on: true);
				power = 0f;
				SetRandomPower_ClientRpc(power);
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ElevatorGasTank()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(765644298u, new RpcReceiveHandler(__rpc_handler_765644298));
		}

		private static void __rpc_handler_765644298(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float randomPower_ClientRpc = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref randomPower_ClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((ElevatorGasTank)(object)target).SetRandomPower_ClientRpc(randomPower_ClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ElevatorGasTank";
		}
	}
	public class EndlessElevator : NetworkBehaviour
	{
		private Random random;

		[Header("Elevator Controller")]
		[Space]
		public List<string> elevatorNamings = new List<string>();

		[HideInInspector]
		public string elevatorName;

		[HideInInspector]
		public int floorIndex = 0;

		[HideInInspector]
		public bool isUpperFloor = true;

		[HideInInspector]
		public bool isMoving = false;

		[HideInInspector]
		public bool tryStop = false;

		[HideInInspector]
		public int movingDirection = -1;

		[HideInInspector]
		public bool noPower = true;

		[HideInInspector]
		public float elevatorPower = 0f;

		public float maxElevatorPower = 200f;

		public int minFloorSetRange = 1;

		public int maxFloorSetRange = 9;

		public Animator elevatorAnim;

		public Animator elevatorInteriorAnimator;

		public Animator[] elevatorDoorsAnimators;

		public GameObject elevatorShaftInteriorWalls;

		public GameObject elevatorWall;

		public GameObject elevatorWallWithDoor;

		public Transform facilityBuildingPos;

		private Transform interiorPos;

		[Space]
		public AudioSource elevatorAudioPlayer;

		public AudioSource elevatorBreathAudioPlayer;

		public AudioSource elevatorSpeakerAudioPlayer;

		public AudioSource elevatorDoorAudioPlayer;

		public AudioSource elevatorDoorSlamAudioPlayer;

		public AudioSource elevatorLightFlickerAudioPlayer;

		public AudioSource elevatorLightFlickerEnableAudioPlayer;

		[Space]
		public Text elevatorMonitorText;

		[HideInInspector]
		public bool monitorEnabled = true;

		[HideInInspector]
		public bool showPowerOnMonitor = false;

		public string monitorDirectionUpText = "Dir: Up";

		public string monitorDirectionDownText = "Dir: down";

		public string monitorStopText = "Stop";

		public string monitorMoveText = "Move";

		public string monitorPowerText = "Power: ";

		public string monitorErrorText = "ERROR 0x468d54";

		[Space]
		public float chargeMultiplier = 0.05f;

		public float decreaseMultiplier = 0.085f;

		public Transform apparatusPosition;

		public bool hasApparatus = false;

		public bool server_startCharging = false;

		public bool server_startDecreasing = false;

		public bool server_startCheckFloorsWhileMoving = false;

		private LungProp attachedApparatus = null;

		private ElevatorApparatus apparatus = null;

		public Material lungLightOnMat;

		public Material lungLightOffMat;

		public AnimationCurve flickerCurve;

		public float lightsOnIntensity = 70.4954f;

		public List<Light> lightsToDisable = new List<Light>();

		public List<Light> lightsToDisableInstant = new List<Light>();

		public List<MeshRenderer> lightRenderers = new List<MeshRenderer>();

		public Material lightsOnMat;

		public Material lightsOffMat;

		[HideInInspector]
		public bool lightsOn = false;

		[Space]
		public UnityEvent OnStartMove;

		public UnityEvent OnMoveProcess;

		public UnityEvent OnStopMove;

		public UnityEvent OnDoneGenerate;

		private bool testCallOnce = false;

		[HideInInspector]
		public List<GameObject> grabbableObjectsInElevator = new List<GameObject>();

		[HideInInspector]
		public List<GameObject> playersInElevator = new List<GameObject>();

		private bool checkedForFirstTime;

		private bool updateLightsOffOnce = false;

		public bool updateAppPosition = false;

		public bool usedOneChance = false;

		public int oneChanceConfirmationState = 0;

		[HideInInspector]
		public bool firstTimeElevator = true;

		[HideInInspector]
		public bool fueledAtLeastOnce = false;

		[HideInInspector]
		public bool patch_entranceTeleport_checkedAlready = false;

		private PlayerPhysicsRegion playerPhysicsRegion_elevator;

		public GameObject loadingUiObject;

		public GameObject deathUiObject;

		public Animator deathUiAnimator;

		public TMP_Text loadingSeedText;

		public bool doorsClosedByUser = false;

		public float currentDoorHoldPercent = 100f;

		public float maxDoorHoldPercent = 100f;

		public float doorHoldPercentDecrease = 0.05f;

		public bool server_decreaseDoorsPower = false;

		public bool canUserUseDoors = true;

		[Space]
		public Animator pipeMeterAnimator;

		public List<Animator> miscInteriorAnimators = new List<Animator>();

		public MeshRenderer[] redDots;

		public Material redDotOnMat;

		public Material redDotOffMat;

		public float floorDecreaseTimeInSeconds = 4f;

		private float floorDecreaseTimer = 0f;

		private List<EntranceTeleport> entrances = new List<EntranceTeleport>();

		public GameObject teleportUIObject;

		public Animator teleportAnimator;

		public string mapHazardsLayerName = "MapHazards";

		public string mapRadarLayerName = "MapRadar";

		public string enemiesLayerName = "Enemies";

		private OffMeshLink doorOffmeshLink;

		private const float UpAxisThreshold = -0.3f;

		private static readonly string[] ExcludedNames = new string[14]
		{
			"MapDot", "MapCamera", "MapDirectionIndicator", "CameraGreenTransition", "RadarCamNightVision", "MapScreenUI", "PlanetVideoReel", "PlayerBeingMonitored", "PlanetDescription", "ArrowUI",
			"ShipIcon", "ArrowContainer", "Arrow", "MapScreenUIWorldSpace"
		};

		public static EndlessElevator Instance { get; private set; }

		public void Awake()
		{
			Instance = this;
			elevatorPower = 150f;
			noPower = false;
			SetLightState_ServerRpc(on: true);
			TryGetPhysicsRegion();
			Debug.Log((object)("Woke up. Instance = " + (object)Instance));
		}

		public void Start()
		{
			((MonoBehaviour)this).StartCoroutine(InitializeElevator());
			Debug.Log((object)("Start. Instance = " + (object)Instance));
			elevatorPower = 150f;
			noPower = false;
			SetLightState_ServerRpc(on: true);
			TryGetPhysicsRegion();
			elevatorAnim.SetInteger("direction", -1);
			elevatorInteriorAnimator.SetTrigger("move");
			elevatorAnim.SetBool("isMoving", true);
		}

		private void ActivateEntranceTeleports()
		{
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>();
			EntranceTeleport[] array2 = array;
			foreach (EntranceTeleport val in array2)
			{
				entrances.Add(val);
				Debug.Log((object)$"Found entrance teleport : {((Component)val).gameObject}");
				((Component)val).gameObject.SetActive(true);
			}
		}

		public void SetOffmeshLinkState(bool enable)
		{
			if ((Object)(object)doorOffmeshLink == (Object)null)
			{
				doorOffmeshLink = ((Component)this).GetComponentInChildren<OffMeshLink>();
			}
			((Behaviour)doorOffmeshLink).enabled = enable;
		}

		public void Update()
		{
			if ((Object)(object)interiorPos == (Object)null)
			{
				GetInteriorElevatorPosition();
			}
			if ((Object)(object)elevatorAnim.runtimeAnimatorController == (Object)null)
			{
				Debug.Log((object)"Bro ur animator is null -----------------------------");
			}
			if (testCallOnce)
			{
				UpdateDoorsPower();
				UpdateApparatusCharge();
				CalculateElevatorFloorsWhileMoving();
			}
			if (elevatorPower <= 0f)
			{
				noPower = true;
			}
			else
			{
				noPower = false;
			}
		}

		public IEnumerator InitializeElevator()
		{
			Scene scene = SceneManager.GetSceneByName("LevelZeranos");
			yield return (object)new WaitUntil((Func<bool>)(() => ((Scene)(ref scene)).isLoaded));
			ActivateEntranceTeleports();
			GameObject generatorObj = GameObject.FindGameObjectWithTag("DungeonGenerator");
			generatorObj.GetComponent<RuntimeDungeon>();
			Debug.Log((object)"Initialize : Start waitin");
			yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.fullyLoadedPlayers.Count >= StartOfRound.Instance.connectedPlayersAmount + 1));
			yield return (object)new WaitUntil((Func<bool>)(() => RoundManager.Instance.dungeonCompletedGenerating));
			yield return (object)new WaitUntil((Func<bool>)(() => RoundManager.Instance.playersFinishedGeneratingFloor.Count >= GameNetworkManager.Instance.connectedPlayers));
			if ((Object)(object)FloorNumber.Instance != (Object)null && FloorNumber.Instance.number <= 0 && !isUpperFloor)
			{
				FloorNumber.Instance.SetNumber(Mathf.Abs(floorIndex));
			}
			Debug.Log((object)"LOADING NEW ANIMATOR -----------------------------");
			Debug.Log((object)"Start.");
			SetRandomName();
			LogAnimatorInfo();
			PlanetTimeMonitor.Instance.ToggleMonitor(show: false);
			TryGetPhysicsRegion();
			noPower = false;
			elevatorPower = 150f;
			maxElevatorPower = 200f;
			lightsOnIntensity = 65f;
			floorIndex = 1;
			server_startCharging = false;
			server_startDecreasing = false;
			fueledAtLeastOnce = true;
			SetLightState_ServerRpc(on: true);
			Animator[] array = elevatorDoorsAnimators;
			foreach (Animator elevatorDoor in array)
			{
				elevatorDoor.SetTrigger("Open");
				SetOffmeshLinkState(enable: true);
			}
			testCallOnce = true;
			GetInteriorElevatorPosition();
			EntranceTeleport[] teleports = Object.FindObjectsOfType<EntranceTeleport>();
			EntranceTeleport[] array2 = teleports;
			foreach (EntranceTeleport telep in array2)
			{
				entrances.Add(telep);
				Debug.Log((object)$"Found entrance teleport : {((Component)telep).gameObject}");
			}
			ActivateEntranceTeleports();
			Debug.Log((object)"Initialize : Finished waitin");
			if ((Object)(object)interiorPos == (Object)null)
			{
				ShowZeranosInteriorError();
				SetMonitorText_WithoutPower_ServerRpc(monitorErrorText);
			}
		}

		public void ShowZeranosInteriorError()
		{
			HUDManager.Instance.DisplayTip("ERROR", "You are not using ZeranosFacility as an interior, so your moon will not be correct and will not work!!!", true, false, "LC_Tip1");
		}

		public void GetInteriorElevatorPosition()
		{
			GameObject val = GameObject.Find("ElevatorConnectionPosition");
			if ((Object)(object)val != (Object)null)
			{
				interiorPos = val.transform;
				Debug.Log((object)"Found interiorPos from StartRoom.");
			}
			else
			{
				interiorPos = null;
				Debug.LogWarning((object)"Cannot find interiorPos from StartRoom!");
			}
		}

		public void TryGetPhysicsRegion()
		{
			playerPhysicsRegion_elevator = ((Component)this).GetComponentInChildren<PlayerPhysicsRegion>();
		}

		[ClientRpc]
		public void TeleportToInterior_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(527571229u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 527571229u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					TeleportToInterior();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TeleportToInterior_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2343998794u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2343998794u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					TeleportToInterior_ClientRpc();
				}
			}
		}

		public void TeleportToInterior()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = interiorPos.position;
			((Component)this).transform.rotation = interiorPos.rotation;
		}

		[ClientRpc]
		public void TeleportToOutside_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3088029220u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3088029220u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					TeleportToOutside();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TeleportToOutside_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4102633210u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4102633210u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					TeleportToOutside_ClientRpc();
				}
			}
		}

		public void TeleportToOutside()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.position = facilityBuildingPos.position;
			((Component)this).transform.rotation = facilityBuildingPos.rotation;
		}

		public void SetRandomName()
		{
			if (elevatorNamings == null || elevatorNamings.Count == 0)
			{
				Debug.LogWarning((object)"No names available in the list.");
				return;
			}
			Random random = new Random(StartOfRound.Instance.randomMapSeed);
			int index = random.Next(0, elevatorNamings.Count);
			elevatorName = elevatorNamings[index];
			Debug.Log((object)("Assigned Elevator Name: " + elevatorName));
		}

		public void AnimateInteriorMisc(bool moving, bool meterCrazy, bool touchOnlyMeter)
		{
			pipeMeterAnimator.SetBool("crazy", meterCrazy);
			pipeMeterAnimator.SetBool("moving", moving);
			if (touchOnlyMeter)
			{
				return;
			}
			foreach (Animator miscInteriorAnimator in miscInteriorAnimators)
			{
				miscInteriorAnimator.SetBool("moving", moving);
			}
		}

		public void SetDirectionRedDot(int l_direcion)
		{
			if (l_direcion < 0)
			{
				((Renderer)redDots[0]).material = redDotOffMat;
				((Renderer)redDots[1]).material = redDotOnMat;
			}
			else
			{
				((Renderer)redDots[0]).material = redDotOnMat;
				((Renderer)redDots[1]).material = redDotOffMat;
			}
		}

		public void MoveElevatorButtonEvent()
		{
			MoveElevatorButtonEvent_ServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void MoveElevatorButtonEvent_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2300244908u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2300244908u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					MoveElevatorButtonEvent_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void MoveElevatorButtonEvent_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2243441634u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2243441634u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if (!noPower)
			{
				MoveElevator_ServerRpc(movingDirection);
			}
			else
			{
				if (usedOneChance || !fueledAtLeastOnce)
				{
					return;
				}
				if (movingDirection > 0)
				{
					if (oneChanceConfirmationState == 1)
					{
						MoveElevator_ServerRpc(1);
						SetOneChanceStateToTrue_ServerRpc();
					}
				}
				else
				{
					SetOneChanceConfirmation_ServerRpc(0);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetOneChanceConfirmation_ServerRpc(int val)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendServerRpc(3378037052u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, val);
					((NetworkBehaviour)this).__endSendServerRpc(ref val3, 3378037052u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetOneChanceConfirmation_ClientRpc(val);
				}
			}
		}

		[ClientRpc]
		public void SetOneChanceConfirmation_ClientRpc(int val)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendClientRpc(844205036u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val3, val);
					((NetworkBehaviour)this).__endSendClientRpc(ref val3, 844205036u, val2, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					oneChanceConfirmationState = val;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetOneChanceStateToTrue_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(548663862u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 548663862u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetOneChanceStateToTrue_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void SetOneChanceStateToTrue_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2869664424u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2869664424u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					usedOneChance = true;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MoveElevator_ServerRpc(int direction)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(574130757u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, direction);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 574130757u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					MoveElevator_ClientRpc(direction);
				}
			}
		}

		[ClientRpc]
		public void MoveElevator_ClientRpc(int direction)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(936958158u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, direction);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 936958158u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					MoveElevator(direction);
				}
			}
		}

		public void MoveElevator(int direction)
		{
			if (!isMoving && (movingDirection <= 0 || !isUpperFloor))
			{
				if ((Object)(object)interiorPos == (Object)null)
				{
					ShowZeranosInteriorError();
					SetMonitorText_WithoutPower_ServerRpc(monitorErrorText);
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(ElevatorMovement(direction));
					isMoving = true;
				}
			}
		}

		public void CalculateElevatorFloorsWhileMoving()
		{
			if (isMoving && server_startCheckFloorsWhileMoving && ((NetworkBehaviour)this).IsServer)
			{
				if (floorDecreaseTimer >= floorDecreaseTimeInSeconds)
				{
					SetRandomLowerFloorIndex();
					floorDecreaseTimer = 0f;
					ResetTimer_ClientRpc();
				}
				floorDecreaseTimer += Time.deltaTime;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ResetTimer_ServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1856970962u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1856970962u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ResetTimer_ClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ResetTimer_ClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(284571628u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 284571628u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					floorDecreaseTimer = 0f;
				}
			}
		}

		public IEnumerator ElevatorMovement(int dir)
		{
			ResetTimer_ServerRpc();
			SetMonitorText_ServerRpc(" ");
			SetScrapsInElevator_ServerRpc(onElevator: true);
			LogAnimatorInfo();
			if (!doorsClosedByUser)
			{
				Animator[] array = elevatorDoorsAnimators;
				foreach (Animator elevatorDoor2 in array)
				{
					elevatorDoor2.SetTrigger("Close");
					SetOffmeshLinkState(enable: false);
				}
				elevatorDoorAudioPlayer.Play();
			}
			OpenCloseDoors_NoAnim_ServerRpc(open: true);
			WalkieTalkie.TransmitOneShotAudio(elevatorDoorAudioPlayer, elevatorDoorAudioPlayer.clip, 0.25f);
			OnStartMove.Invoke();
			yield return (object)new WaitForSeconds(0.75f);
			((MonoBehaviour)this).StartCoroutine(KillLocalPlayerOutsideElevator());
			elevatorAudioPlayer.volume = 0f;
			elevatorAudioPlayer.pitch = 0.7f;
			elevatorAudioPlayer.Play();
			FadeVolume(elevatorAudioPlayer, 0.034f, 2.85f);
			elevatorAnim.SetInteger("direction", dir);
			elevatorInteriorAnimator.SetTrigger("move");
			elevatorAnim.SetBool("isMoving", true);
			elevatorAnim.SetTrigger("move");
			yield return (object)new WaitForSeconds(6f);
			elevatorInteriorAnimator.SetBool("isMoving", true);
			yield return (object)new WaitForSeconds(0.52f);
			if (!firstTimeElevator)
			{
				DisableAudioSourcesForUndergroundEnemies();
				GetAndDespawnHazardsMapObjects();
				DisableHangingLights();
			}
			SetPlayersInElevator_ServerRpc(onElevator: true);
			_ = !playersInElevator.Any();
			if (playerPhysicsRegion_elevator.hasLocalPlayer)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
			}
			if (dir < 0)
			{
				server_startCheckFloorsWhileMoving = true;
			}
			AnimateInteriorMisc(moving: true, meterCrazy: false, touchOnlyMeter: false);
			elevatorAudioPlayer.pitch = 1f;
			server_startCharging = false;
			server_startDecreasing = true;
			SetMonitorText_ServerRpc(monitorMoveText);
			TeleportToInterior_ServerRpc();
			elevatorShaftInteriorWalls.SetActive(true);
			elevatorWall.SetActive(true);
			elevatorWallWithDoor.SetActive(false);
			FadeVolume(elevatorAudioPlayer, 0.245f, 0.27f);
			OnMoveProcess.Invoke();
			if (dir < 0)
			{
				SetRandomLowerFloorIndex();
			}
			else
			{
				floorIndex = 0;
				SetFloorIndexClientRpc(0);
			}
			yield return (object)new WaitForSeconds(3f);
			if (dir < 0)
			{
				yield return (object)new WaitUntil((Func<bool>)(() => tryStop || noPower));
			}
			else
			{
				yield return (object)new WaitForSeconds(7.2f);
			}
			server_startCheckFloorsWhileMoving = false;
			if (dir < 0)
			{
				GenerateNewFloor();
			}
			AnimateInteriorMisc(moving: true, meterCrazy: true, touchOnlyMeter: true);
			SetMonitorText_ServerRpc(monitorStopText);
			server_startDecreasing = false;
			yield return (object)new WaitForSeconds(2.4f);
			tryStop = false;
			if (dir > 0)
			{
				isUpperFloor = true;
				TeleportToOutside_ServerRpc();
				SetPlayersInElevator_ServerRpc(onElevator: false);
				elevatorShaftInteriorWalls.SetActive(false);
				elevatorWall.SetActive(true);
				elevatorWallWithDoor.SetActive(false);
			}
			else
			{
				isUpperFloor = false;
				elevatorWall.SetActive(false);
				elevatorWallWithDoor.SetActive(true);
			}
			elevatorAnim.SetBool("isMoving", false);
			elevatorInteriorAnimator.SetBool("isMoving", false);
			FadeVolume(elevatorAudioPlayer, 0f, 3.3f);
			yield return (object)new WaitForSeconds(3.3f);
			elevatorAudioPlayer.Stop();
			elevatorBreathAudioPlayer.Play();
			WalkieTalkie.TransmitOneShotAudio(elevatorBreathAudioPlayer, elevatorBreathAudioPlayer.clip, 0.45f);
			AnimateInteriorMisc(moving: false, meterCrazy: false, touchOnlyMeter: false);
			OpenCloseDoors_NoAnim_ServerRpc(open: true);
			Animator[] array2 = elevatorDoorsAnimators;
			foreach (Animator elevatorDoor in array2)
			{
				elevatorDoor.SetTrigger("Open");
				SetOffmeshLinkState(enable: true);
			}
			OnStopMove.Invoke();
			int roundValue = Mathf.RoundToInt(elevatorPower);
			SetMonitorText_ServerRpc(monitorPowerText + roundValue + "%");
			SetScrapsInElevator_ServerRpc(onElevator: false);
			yield return (object)new WaitForSeconds(5f);
			isMoving = false;
		}

		public void ForceOpenCloseDoor(bool open)
		{
			if (canUserUseDoors && !noPower && !isMoving && doorsClosedByUser != !open)
			{
				OpenCloseDoors_ServerRpc(open);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenCloseDoors_ServerRpc(bool open)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2447856286u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2447856286u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					OpenCloseDoors_ClientRpc(open);
				}
			}
		}

		[ClientRpc]
		public void OpenCloseDoors_ClientRpc(bool open)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2008373178u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2008373178u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if (open)
			{
				Animator[] array = elevatorDoorsAnimators;
				foreach (Animator val3 in array)
				{
					val3.SetTrigger("Open");
					SetOffmeshLinkState(enable: true);
				}
			}
			else
			{
				Animator[] array2 = elevatorDoorsAnimators;
				foreach (Animator val4 in array2)
				{
					val4.SetTrigger("Close");
					SetOffmeshLinkState(enable: false);
				}
			}
			elevatorDoorAudioPlayer.Play();
			WalkieTalkie.TransmitOneShotAudio(elevatorDoorAudioPlayer, elevatorDoorAudioPlayer.clip, 0.25f);
			doorsClosedByUser = !open;
			server_decreaseDoorsPower = doorsClosedByUser;
		}

		[ServerRpc(RequireOwnership = false)]
		public void OpenCloseDoors_NoAnim_ServerRpc(bool open)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2786378170u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref open, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2786378170u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					OpenCloseDoors_NoAnim_ClientRpc(open);
				}
			}
		}

		[ClientRpc]
		public void OpenCloseDoors_NoAnim_ClientRpc(bool open)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).