Decompiled source of SnipersScripts v1.0.0

Sniper1_1.SnipersScripts.dll

Decompiled 6 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sniper1_1.SnipersScripts.NetcodePatcher;
using SnipersScripts.Behaviors;
using SnipersScripts.Editor;
using SnipersScripts.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.Video;

[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("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[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.Components")]
[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("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("Sniper1_1.SnipersScripts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bcf9ebc8d0ff6c1bf9cc7ef7002670d989c7406e")]
[assembly: AssemblyProduct("SnipersScripts")]
[assembly: AssemblyTitle("Sniper1_1.SnipersScripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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;
		}
	}
}
[HarmonyPatch(typeof(NetworkManager))]
internal static class NetworkPrefabPatch1
{
	private static readonly string MOD_GUID = "Sniper1_1.SnipersScripts";

	[HarmonyPostfix]
	[HarmonyPatch("SetSingleton")]
	private static void RegisterPrefab()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Expected O, but got Unknown
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(MOD_GUID + " Prefab");
		((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
		Object.DontDestroyOnLoad((Object)(object)val);
		NetworkObject val2 = val.AddComponent<NetworkObject>();
		val2.GlobalObjectIdHash = GetHash(MOD_GUID);
		NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val);
		static uint GetHash(string value)
		{
			return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0;
		}
	}
}
namespace SnipersScripts
{
	[BepInPlugin("Sniper1_1.SnipersScripts", "SnipersScripts", "1.0.0")]
	public class SnipersScripts : BaseUnityPlugin
	{
		public static SnipersScripts 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;
			NetcodePatcher();
			Patch();
			Logger.LogInfo((object)"Sniper1_1.SnipersScripts v1.0.0 has loaded!");
		}

		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("Sniper1_1.SnipersScripts");
			}
			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 = "Sniper1_1.SnipersScripts";

		public const string PLUGIN_NAME = "SnipersScripts";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SnipersScripts.Patches
{
	[HarmonyPatch]
	internal class EntranceTeleportPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
		private static void CacheEntranceTeleports()
		{
			foreach (EntranceTeleportLock activeLocker in EntranceTeleportLock.ActiveLockers)
			{
				activeLocker.teleports = Object.FindObjectsOfType<EntranceTeleport>(false).ToList();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
		private static void ClearEntranceTeleportsCache()
		{
			foreach (EntranceTeleportLock activeLocker in EntranceTeleportLock.ActiveLockers)
			{
				activeLocker.teleports?.Clear();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")]
		private static void UnlockLockedDoor(EntranceTeleport __instance)
		{
			if (__instance.exitScript.triggerScript.interactable)
			{
				return;
			}
			foreach (EntranceTeleportLock activeLocker in EntranceTeleportLock.ActiveLockers)
			{
				if (__instance.exitScript.isEntranceToBuilding)
				{
					activeLocker.UnlockIndividualOutside(__instance);
				}
				else if (!__instance.exitScript.isEntranceToBuilding)
				{
					activeLocker.UnlockIndividualInside(__instance);
				}
			}
		}
	}
	[HarmonyPatch]
	public class ItemDropDistancePatch
	{
		public static float CustomRaycastDistance = 80f;

		public static readonly float VanillaRaycastDistance = 80f;

		[HarmonyTargetMethods]
		private static IEnumerable<MethodBase> TargetMethods()
		{
			yield return AccessTools.Method(typeof(GrabbableObject), "GetItemFloorPosition", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(GrabbableObject), "GetPhysicsRegionOfDroppedObject", (Type[])null, (Type[])null);
			yield return AccessTools.Method(typeof(GrabbableObject), "GetPhysicsRegionOfDroppedObjectSynced", (Type[])null, (Type[])null);
		}

		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> ChangeDropDistanceTranspiler(IEnumerable<CodeInstruction> instructions, MethodBase original)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
			CodeMatch val2 = new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)VanillaRaycastDistance, (string)null);
			FieldInfo fieldInfo = AccessTools.Field(typeof(ItemDropDistancePatch), "CustomRaycastDistance");
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { val2 });
			while (val.IsValid)
			{
				val.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldsfld, (object)fieldInfo));
				SnipersScripts.Logger.LogDebug((object)"Patched raycast distance.");
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { val2 });
			}
			return val.InstructionEnumeration();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "Update")]
		private static void GetLocalPlayer(PlayerControllerB __instance)
		{
			if (!((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController))
			{
				TrackPlayerInShip(__instance);
			}
		}

		private static void TrackPlayerInShip(PlayerControllerB player)
		{
			PlayerInShipDetector[] array = PlayerInShipDetector.ActiveDetectors.ToArray();
			foreach (PlayerInShipDetector playerInShipDetector in array)
			{
				playerInShipDetector.UpdatePlayerPosition(player);
			}
		}
	}
	[HarmonyPatch(typeof(RemoteProp))]
	internal class RemoteScrapPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(RemoteProp), "ItemActivate")]
		private static void ItemActivate_Postfix(RemoteProp __instance)
		{
			RemoteScrapEvents[] array = Object.FindObjectsOfType<RemoteScrapEvents>();
			RemoteScrapEvents[] array2 = array;
			foreach (RemoteScrapEvents remoteScrapEvents in array2)
			{
				UnityEvent onRemoteClicked = remoteScrapEvents.onRemoteClicked;
				if (onRemoteClicked != null)
				{
					onRemoteClicked.Invoke();
				}
			}
		}
	}
	[HarmonyPatch]
	internal class ShipPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(StartOfRound), "SetMagnetOn")]
		private static void MagnetTogglePrefix(bool on)
		{
			if (on)
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onMagnetEnable.Invoke();
				}
			}
			else
			{
				foreach (ShipController activeController2 in ShipController.ActiveControllers)
				{
					activeController2.onMagnetDisable.Invoke();
				}
			}
			foreach (ShipController activeController3 in ShipController.ActiveControllers)
			{
				activeController3.onMagnetToggle.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "EndOfGame")]
		private static void ShipEnterOrbit()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShipEnterOrbit.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
		private static void ShipAscend()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShipAscend.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")]
		private static void ShipLanded()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShipLand.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")]
		private static void ShipDescend()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShipDescend.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "ReadOutDialogue")]
		private static void StartShipMessage()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShipMessageStart.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "ReadOutDialogue")]
		private static void EndShipMessage(ref IEnumerator __result)
		{
			__result = WaitForEnd(__result, delegate
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onShipMessageEnd.Invoke();
				}
			});
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "DisableShipSpeakerLocalClient")]
		private static void SpeakerMute()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onSpeakerMute.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HangarShipDoor), "SetDoorClosed")]
		private static void DoorClosed()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onDoorClose.Invoke();
				activeController.onDoorToggle.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HangarShipDoor), "SetDoorOpen")]
		private static void DoorOpened()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onDoorOpen.Invoke();
				activeController.onDoorToggle.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ManualCameraRenderer), "SwitchRadarTargetClientRpc")]
		private static void SwitchSpectateTarget()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onScreenSpectatorToggle.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ManualCameraRenderer), "SwitchScreenOn")]
		private static void CheckScreenPowered(bool on)
		{
			if (on)
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onScreenTurnOn.Invoke();
				}
			}
			else
			{
				foreach (ShipController activeController2 in ShipController.ActiveControllers)
				{
					activeController2.onScreenTurnOff.Invoke();
				}
			}
			foreach (ShipController activeController3 in ShipController.ActiveControllers)
			{
				activeController3.onScreenPoweredToggle.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipTeleporter), "beamUpPlayer")]
		private static void TeleportNormal()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onTeleportStart.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipTeleporter), "beamOutPlayer")]
		private static void TeleportInverse()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onInverseStart.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShipTeleporter), "beamUpPlayer")]
		private static void TeleportEnd(ref IEnumerator __result)
		{
			__result = WaitForEnd(__result, delegate
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onTeleportEnd.Invoke();
				}
			});
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShipTeleporter), "beamOutPlayer")]
		private static void InverseEnd(ref IEnumerator __result)
		{
			__result = WaitForEnd(__result, delegate
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onInverseEnd.Invoke();
				}
			});
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "DisplaySignalTranslatorMessage")]
		private static void TransmitStart()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onSignalTransmitStart.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "DisplaySignalTranslatorMessage")]
		private static void TransmitEnd(ref IEnumerator __result)
		{
			__result = WaitForEnd(__result, delegate
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onSignalTransmitEnd.Invoke();
				}
			});
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipAlarmCord), "PullCordClientRpc")]
		private static void StartHorn()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onHornPull.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipAlarmCord), "Update")]
		private static void HoldCord(ShipAlarmCord __instance)
		{
			if (!__instance.hornBlaring)
			{
				return;
			}
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.whileHornPulled.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipAlarmCord), "StopPullingCordClientRpc")]
		private static void StopHorn()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onHornRelease.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ShipLights), "ToggleShipLights")]
		private static void ToggleLights()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShipLightsToggle.Invoke();
				if (StartOfRound.Instance.shipRoomLights.areLightsOn)
				{
					activeController.onShipLightsTurnOn.Invoke();
				}
				else
				{
					activeController.onShipLightsTurnOff.Invoke();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MoveToExitSpecialAnimation), "SetExitingDisabled")]
		private static void ClampToggle(bool disabled)
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				if (disabled)
				{
					activeController.onClampLock.Invoke();
				}
				if (!disabled)
				{
					activeController.onClampUnlock.Invoke();
				}
				activeController.onClampToggle.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(MoveToExitSpecialAnimation), "shockChair")]
		private static void OnShockStart()
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				activeController.onShockStart.Invoke();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(MoveToExitSpecialAnimation), "shockChair")]
		private static void OnShockEnd(ref IEnumerator __result)
		{
			__result = WaitForEnd(__result, delegate
			{
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onShockEnd.Invoke();
				}
			});
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TVScript), "TurnTVOnOff")]
		private static void PowerTV(bool on)
		{
			foreach (ShipController activeController in ShipController.ActiveControllers)
			{
				if (on)
				{
					activeController.onTvTurnOn.Invoke();
				}
				else
				{
					activeController.OnTvTurnOff.Invoke();
				}
				activeController.onTvToggle.Invoke();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TVScript), "TVFinishedClip")]
		private static bool HandleClipFinished(TVScript __instance)
		{
			if (!__instance.tvOn)
			{
				return false;
			}
			if ((Object)(object)ShipController.currentClipOverride != (Object)null)
			{
				TelevisionClipContainerSO currentClipOverride = ShipController.currentClipOverride;
				ShipController.currentClipOverride = null;
				ShipController.overrideVisiblyPlaying = false;
				foreach (ShipController activeController in ShipController.ActiveControllers)
				{
					activeController.onTvStationChange.Invoke();
				}
				if (currentClipOverride.turnTVOff)
				{
					__instance.TurnTVOnOff(false);
					return false;
				}
				return true;
			}
			foreach (ShipController activeController2 in ShipController.ActiveControllers)
			{
				activeController2.onTvStationChange.Invoke();
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(TVScript), "Update")]
		private static void TrackOverridePlayback(TVScript __instance)
		{
			if ((Object)(object)ShipController.currentClipOverride == (Object)null)
			{
				return;
			}
			TelevisionClipContainerSO currentClipOverride = ShipController.currentClipOverride;
			ShipController.overrideElapsedTime += Time.deltaTime;
			if (__instance.tvOn && !ShipController.overrideVisiblyPlaying)
			{
				ShipController.overrideVisiblyPlaying = true;
				__instance.video.clip = currentClipOverride.clip;
				__instance.video.time = ShipController.overrideElapsedTime;
				__instance.video.Play();
				if ((Object)(object)currentClipOverride.audio != (Object)null)
				{
					__instance.tvSFX.clip = currentClipOverride.audio;
					__instance.tvSFX.time = ShipController.overrideElapsedTime;
					__instance.tvSFX.Play();
				}
				if (!ShipController.overrideStartedWithTvOff)
				{
					foreach (ShipController activeController in ShipController.ActiveControllers)
					{
						activeController.onTvStationChange.Invoke();
					}
				}
				ShipController.overrideStartedWithTvOff = false;
			}
			else if (!__instance.tvOn && ShipController.overrideVisiblyPlaying)
			{
				ShipController.overrideVisiblyPlaying = false;
				__instance.video.Stop();
				__instance.tvSFX.Stop();
			}
			if (!__instance.tvOn && (double)ShipController.overrideElapsedTime >= currentClipOverride.clip.length)
			{
				ShipController.currentClipOverride = null;
			}
		}

		private static IEnumerator WaitForEnd(IEnumerator original, Action callback)
		{
			while (original.MoveNext())
			{
				yield return original.Current;
			}
			callback?.Invoke();
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class StartOfRoundPatches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		private static void StartOfRound_Postfix(StartOfRound __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(EnemyRequiresNestOverrideInternal.populateEnemyList());
		}
	}
}
namespace SnipersScripts.Editor
{
	[CreateAssetMenu(fileName = "Comment", menuName = "SnipersScripts/CommentSO")]
	public class CommentSO : ScriptableObject
	{
		[SerializeField]
		[TextArea(1, 20)]
		private string commentText = string.Empty;
	}
	[AddComponentMenu("SnipersScripts/CommentComponent")]
	public class CommentComponent : MonoBehaviour
	{
		[SerializeField]
		[TextArea(1, 5)]
		private string commentText = string.Empty;
	}
	[CreateAssetMenu(fileName = "ShipMessage", menuName = "SnipersScripts/ShipMessageSO")]
	public class ShipMessageSO : ScriptableObject
	{
		[SerializeField]
		[Tooltip("The alerts like the ones that appear when the ship leaves at midnight.")]
		public DialogueSegment[] shipMessage;
	}
	[CreateAssetMenu(fileName = "TVClip", menuName = "SnipersScripts/TelevisionClipContainerSO")]
	public class TelevisionClipContainerSO : ScriptableObject
	{
		[Tooltip("The clip to play.")]
		public VideoClip clip;

		[Tooltip("The audio to play.")]
		public AudioClip audio;

		[Tooltip("Forces the tv on if it isn't currently.")]
		public bool forceTVOn = true;

		[Tooltip("Turns the TV off after completion. If false, resumes normal channels.")]
		public bool turnTVOff = true;
	}
}
namespace SnipersScripts.Behaviors
{
	[AddComponentMenu("SnipersScripts/AudioClipEvents")]
	public class AudioClipEvents : MonoBehaviour
	{
		[Tooltip("The AudioSource to use")]
		public AudioSource audioSource;

		[Tooltip("Event to run when the AudioClip starts playing")]
		public UnityEvent onAudioClipStart;

		[Tooltip("Event to run when the AudioClip finishes playing")]
		public UnityEvent onAudioClipEnd;

		[Tooltip("Event to run when the AudioClip is stopped")]
		public UnityEvent onAudioClipStop;

		private Coroutine audioCorutine = null;

		public void PlayAudioClip(AudioClip clip)
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				SnipersScripts.Logger.LogWarning((object)"AudioSource is not assigned.");
				return;
			}
			audioSource.clip = clip;
			audioSource.Play();
			onAudioClipStart.Invoke();
			audioCorutine = ((MonoBehaviour)this).StartCoroutine(WaitForAudioClipEnd());
		}

		public void StopAudioClip()
		{
			if ((Object)(object)audioSource == (Object)null)
			{
				SnipersScripts.Logger.LogWarning((object)"AudioSource is not assigned.");
				return;
			}
			if (audioCorutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(audioCorutine);
				audioCorutine = null;
			}
			audioSource.Stop();
			onAudioClipStop.Invoke();
		}

		private IEnumerator WaitForAudioClipEnd()
		{
			if (!((Object)(object)audioSource == (Object)null))
			{
				yield return (object)new WaitUntil((Func<bool>)(() => !audioSource.isPlaying));
				onAudioClipEnd.Invoke();
			}
		}
	}
	internal class EnemyRequiresNestOverrideInternal
	{
		internal static List<EnemyType> allEnemyTypes = new List<EnemyType>();

		public static IEnumerator populateEnemyList()
		{
			yield return (object)new WaitForSeconds(0.5f);
			allEnemyTypes.Clear();
			SelectableLevel allEnemiesLevel = Object.FindObjectOfType<QuickMenuManager>().testAllEnemiesLevel;
			getEnemies(allEnemiesLevel.DaytimeEnemies);
			getEnemies(allEnemiesLevel.Enemies);
			getEnemies(allEnemiesLevel.OutsideEnemies);
		}

		private static void getEnemies(List<SpawnableEnemyWithRarity> enemyTypes)
		{
			foreach (SpawnableEnemyWithRarity enemyType in enemyTypes)
			{
				allEnemyTypes.Add(enemyType.enemyType);
			}
		}
	}
	[AddComponentMenu("SnipersScripts/EnemyRequiresNestOverride")]
	public class EnemyRequiresNestOverride : MonoBehaviour
	{
		[Tooltip("Events to run while enemy does not require nest.")]
		public UnityEvent<EnemyType> onEnemyDoesNotRequireNest;

		public void ToggleEnemyNestRequirement(EnemyType enemyType)
		{
			foreach (EnemyType allEnemyType in EnemyRequiresNestOverrideInternal.allEnemyTypes)
			{
				if ((Object)(object)allEnemyType == (Object)(object)enemyType)
				{
					((MonoBehaviour)this).StartCoroutine(CycleEnemyNestRequiement(allEnemyType));
					break;
				}
			}
		}

		public void ToggleEnemyNestRequirement(string enemyName)
		{
			foreach (EnemyType allEnemyType in EnemyRequiresNestOverrideInternal.allEnemyTypes)
			{
				if (allEnemyType.enemyName == enemyName)
				{
					ToggleEnemyNestRequirement(allEnemyType);
					break;
				}
			}
		}

		private IEnumerator CycleEnemyNestRequiement(EnemyType enemy)
		{
			if ((Object)(object)enemy != (Object)null)
			{
				bool currentNestRequirement = enemy.requireNestObjectsToSpawn;
				enemy.requireNestObjectsToSpawn = false;
				onEnemyDoesNotRequireNest?.Invoke(enemy);
				yield return (object)new WaitForSeconds(0.5f);
				enemy.requireNestObjectsToSpawn = currentNestRequirement;
			}
		}
	}
	[AddComponentMenu("SnipersScripts/EntranceTeleportLock")]
	public class EntranceTeleportLock : NetworkBehaviour
	{
		internal static readonly List<EntranceTeleportLock> ActiveLockers = new List<EntranceTeleportLock>();

		[HideInInspector]
		public List<EntranceTeleport> teleports = new List<EntranceTeleport>();

		public string lockedMessage = "Door locked";

		private void OnEnable()
		{
			ActiveLockers.Add(this);
		}

		private void OnDisable()
		{
			ActiveLockers.Remove(this);
		}

		public void LockAll()
		{
			LockInside();
			LockOutside();
		}

		public void UnlockAll()
		{
			UnlockInside();
			UnlockOutside();
		}

		public void LockInside()
		{
			LockMainInside();
			LockFireInside();
		}

		public void UnlockInside()
		{
			UnlockMainInside();
			UnlockFireInside();
		}

		public void LockMainInside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId == 0)
				{
					LockIndividualInside(teleport);
				}
			}
		}

		public void UnlockMainInside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId == 0)
				{
					UnlockIndividualInside(teleport);
				}
			}
		}

		public void LockFireInside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId != 0)
				{
					LockIndividualInside(teleport);
				}
			}
		}

		public void UnlockFireInside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId != 0)
				{
					UnlockIndividualInside(teleport);
				}
			}
		}

		public void LockIndividualInside(EntranceTeleport tp)
		{
			if (tp.isEntranceToBuilding)
			{
				Lock(tp.exitScript, locked: true);
			}
			else if (!tp.isEntranceToBuilding)
			{
				Lock(tp, locked: true);
			}
		}

		public void UnlockIndividualInside(EntranceTeleport tp)
		{
			if (tp.isEntranceToBuilding)
			{
				Lock(tp.exitScript, locked: false);
			}
			else if (!tp.isEntranceToBuilding)
			{
				Lock(tp, locked: false);
			}
		}

		public void LockOutside()
		{
			LockMainOutside();
			LockFireOutside();
		}

		public void UnlockOutside()
		{
			UnlockMainOutside();
			UnlockFireOutside();
		}

		public void LockMainOutside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId == 0)
				{
					LockIndividualOutside(teleport);
				}
			}
		}

		public void UnlockMainOutside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId == 0)
				{
					UnlockIndividualOutside(teleport);
				}
			}
		}

		public void LockFireOutside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId != 0)
				{
					LockIndividualOutside(teleport);
				}
			}
		}

		public void UnlockFireOutside()
		{
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId != 0)
				{
					UnlockIndividualOutside(teleport);
				}
			}
		}

		public void LockIndividualOutside(EntranceTeleport tp)
		{
			if (!tp.isEntranceToBuilding)
			{
				Lock(tp.exitScript, locked: true);
			}
			else if (tp.isEntranceToBuilding)
			{
				Lock(tp, locked: true);
			}
		}

		public void UnlockIndividualOutside(EntranceTeleport tp)
		{
			if (!tp.isEntranceToBuilding)
			{
				Lock(tp.exitScript, locked: false);
			}
			else if (tp.isEntranceToBuilding)
			{
				Lock(tp, locked: false);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetLockedMessageRpc(string message = null)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3283938549u, val3, val, (SendTo)6, (RpcDelivery)0);
				bool flag = message != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(message, false);
				}
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3283938549u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			lockedMessage = message;
			foreach (EntranceTeleport teleport in teleports)
			{
				teleport.triggerScript.disabledHoverTip = lockedMessage;
			}
		}

		private void Lock(EntranceTeleport teleport, bool locked)
		{
			if ((Object)(object)teleport != (Object)null && (Object)(object)teleport.triggerScript != (Object)null)
			{
				LockRpc(teleport.entranceId, locked, teleport.isEntranceToBuilding);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void LockRpc(int id, bool locked, bool outside)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3846296364u, val3, val, (SendTo)6, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, id);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref locked, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref outside, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3846296364u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			SetLockedMessageRpc(lockedMessage);
			foreach (EntranceTeleport teleport in teleports)
			{
				if (teleport.entranceId == id && teleport.isEntranceToBuilding == outside)
				{
					teleport.triggerScript.interactable = !locked;
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3283938549u, new RpcReceiveHandler(__rpc_handler_3283938549), "SetLockedMessageRpc");
			((NetworkBehaviour)this).__registerRpc(3846296364u, new RpcReceiveHandler(__rpc_handler_3846296364), "LockRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_3283938549(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string lockedMessageRpc = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref lockedMessageRpc, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EntranceTeleportLock)(object)target).SetLockedMessageRpc(lockedMessageRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3846296364(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int id = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref id);
				bool locked = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref locked, default(ForPrimitives));
				bool outside = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref outside, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((EntranceTeleportLock)(object)target).LockRpc(id, locked, outside);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "EntranceTeleportLock";
		}
	}
	[AddComponentMenu("SnipersScripts/ItemDropDistanceOverride")]
	public class ItemDropDistanceOverride : NetworkBehaviour
	{
		[Min(0f)]
		[Tooltip("The distance from which items can be dropped.")]
		public float itemDropDistance = ItemDropDistancePatch.VanillaRaycastDistance;

		[Tooltip("If true, the override will be applied on Start. If false, you can call ApplyDropDistanceOverride() manually.")]
		public bool applyOverrideOnStart = true;

		private void Start()
		{
			if (applyOverrideOnStart)
			{
				ApplyDropDistanceOverrideRpc(itemDropDistance);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ApplyDropDistanceOverrideRpc(float distance)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(232351214u, val3, val, (SendTo)6, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref distance, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val2, 232351214u, val3, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					ItemDropDistancePatch.CustomRaycastDistance = distance;
					SnipersScripts.Logger.LogDebug((object)$"Item drop distance override applied: {distance}");
				}
			}
		}

		private void OnDestroy()
		{
			ItemDropDistancePatch.CustomRaycastDistance = ItemDropDistancePatch.VanillaRaycastDistance;
			SnipersScripts.Logger.LogDebug((object)$"Item drop distance override removed, reset to {ItemDropDistancePatch.VanillaRaycastDistance}.");
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(232351214u, new RpcReceiveHandler(__rpc_handler_232351214), "ApplyDropDistanceOverrideRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_232351214(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 distance = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref distance, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ItemDropDistanceOverride)(object)target).ApplyDropDistanceOverrideRpc(distance);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ItemDropDistanceOverride";
		}
	}
	[AddComponentMenu("SnipersScripts/LoggerScript")]
	public class LoggerScript : MonoBehaviour
	{
		public enum type
		{
			Debug,
			Info,
			Warning,
			Error,
			Fatal
		}

		private static readonly string MESSAGE_STARTER = "SnipersScripts' LoggerScript says: ";

		[Tooltip("The message to log to the console on Start. Left empty, logs can only be printed by calling the print methods from other events.")]
		public string log = string.Empty;

		[Tooltip("The channel to log message to if log is not empty")]
		public type logType;

		[Tooltip("True: logs `Log` on start through the selected `Log Type` channel. False: logs only on manual invocation.")]
		public bool logOnStart = true;

		private void Start()
		{
			if (logOnStart)
			{
				PrintCurrentLogOnCurrentType();
			}
		}

		public void PrintCurrentLogOnCurrentType()
		{
			if (!string.IsNullOrEmpty(log))
			{
				if (logType == type.Debug)
				{
					PrintDebug(log);
				}
				if (logType == type.Info)
				{
					PrintInfo(log);
				}
				if (logType == type.Warning)
				{
					PrintWarning(log);
				}
				if (logType == type.Error)
				{
					PrintError(log);
				}
				if (logType == type.Fatal)
				{
					PrintFatal(log);
				}
			}
		}

		public void PrintDebug(string message)
		{
			SnipersScripts.Logger.LogDebug((object)(MESSAGE_STARTER + "\"" + message + "\""));
		}

		public void PrintInfo(string message)
		{
			SnipersScripts.Logger.LogInfo((object)(MESSAGE_STARTER + "\"" + message + "\""));
		}

		public void PrintWarning(string message)
		{
			SnipersScripts.Logger.LogWarning((object)(MESSAGE_STARTER + "\"" + message + "\""));
		}

		public void PrintError(string message)
		{
			SnipersScripts.Logger.LogError((object)(MESSAGE_STARTER + "\"" + message + "\""));
		}

		public void PrintFatal(string message)
		{
			SnipersScripts.Logger.LogFatal((object)(MESSAGE_STARTER + "\"" + message + "\""));
		}
	}
	[AddComponentMenu("SnipersScripts/PlayerInShipDetector")]
	public class PlayerInShipDetector : MonoBehaviour
	{
		internal static readonly List<PlayerInShipDetector> ActiveDetectors = new List<PlayerInShipDetector>();

		private readonly Dictionary<PlayerControllerB, bool> previousShipRoomState = new Dictionary<PlayerControllerB, bool>();

		[Tooltip("If true, events invoke when player enters/exits ship. If false, events only run on a manual call to EvaluateIsInShipManualInvoke.")]
		public bool checkPassively = true;

		[Tooltip("If true, the detector will immediately check the player's position and fire the appropriate events, instead of waiting for the first swtich")]
		public bool checkImmediately = false;

		[Tooltip("The event to trigger when the player enters the ship.")]
		public UnityEvent<PlayerControllerB> onPlayerEnterShip;

		[Tooltip("The event to trigger when the player exits the ship.")]
		public UnityEvent<PlayerControllerB> onPlayerExitShip;

		[Tooltip("The event to trigger when the player switches between locations.")]
		public UnityEvent<PlayerControllerB> onPlayerSwitchLocation;

		private void OnEnable()
		{
			ActiveDetectors.Add(this);
		}

		private void OnDisable()
		{
			ActiveDetectors.Remove(this);
		}

		internal void UpdatePlayerPosition(PlayerControllerB player)
		{
			if (checkPassively)
			{
				EvaluateIsInShip(player, alwaysFireEnterExit: false);
			}
		}

		public void EvaluateIsInShipManualInvoke(PlayerControllerB player)
		{
			EvaluateIsInShip(player, alwaysFireEnterExit: true);
		}

		public bool EvaluateIsInShipManual(PlayerControllerB player)
		{
			return EvaluateIsInShip(player, alwaysFireEnterExit: true);
		}

		private bool EvaluateIsInShip(PlayerControllerB player, bool alwaysFireEnterExit)
		{
			bool value;
			bool flag = previousShipRoomState.TryGetValue(player, out value);
			bool flag2 = flag && player.isInHangarShipRoom != value;
			previousShipRoomState[player] = player.isInHangarShipRoom;
			if (flag2)
			{
				onPlayerSwitchLocation?.Invoke(player);
			}
			bool flag3 = !flag && checkImmediately;
			if (alwaysFireEnterExit || flag2 || flag3)
			{
				if (player.isInHangarShipRoom)
				{
					onPlayerEnterShip?.Invoke(player);
				}
				if (!player.isInHangarShipRoom)
				{
					onPlayerExitShip?.Invoke(player);
				}
			}
			return player.isInHangarShipRoom;
		}

		public void SetPassiveCheck(bool passiveCheck)
		{
			checkPassively = passiveCheck;
		}
	}
	[AddComponentMenu("SnipersScripts/Raycast")]
	internal class Raycast : MonoBehaviour
	{
		[Tooltip("Determins if the raycasts should run on Start or only when manually called")]
		public bool fireRaysOnStart = true;

		public List<RaycastOptions> raycasts;

		private void Start()
		{
			if (fireRaysOnStart)
			{
				FireRays();
			}
		}

		public void FireRays()
		{
			foreach (RaycastOptions raycast in raycasts)
			{
				FireRay(raycast);
			}
		}

		public void FireRay(int rayIndex)
		{
			if (rayIndex >= 0 && rayIndex < raycasts.Count)
			{
				FireRay(raycasts[rayIndex]);
			}
			else
			{
				SnipersScripts.Logger.LogError((object)$"Index {rayIndex} is not within the bounds of the Raycast Options list on {((Object)((Component)this).gameObject).name}");
			}
		}

		public void FireRay(RaycastOptions ray)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)this).transform.position;
			Vector3 val = ((!ray.globalAxis) ? ((Component)this).transform.TransformDirection(ray.direction) : ray.direction);
			ray.onRayStart?.Invoke(position);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(position, val, ref val2, ray.distance, LayerMask.op_Implicit(ray.mask)))
			{
				Vector3 point = ((RaycastHit)(ref val2)).point;
				ray.onRayHit?.Invoke(point);
			}
			else
			{
				ray.onRayFail?.Invoke(position);
			}
		}
	}
	[Serializable]
	public class RaycastOptions : ISerializationCallbackReceiver
	{
		[Tooltip("The direction to fire the raycast")]
		public Vector3 direction;

		[Min(0f)]
		[Tooltip("How far the ray should travel before failing")]
		public float distance;

		[Tooltip("If true, ray fires in the global rotation. If false, it fires relative to the attached game object's rotation.")]
		public bool globalAxis = false;

		[Tooltip("What layers the raycast hits successfully.")]
		public LayerMask mask;

		[Tooltip("Fires when the ray starts, with its start position.")]
		public UnityEvent<Vector3> onRayStart;

		[Tooltip("Fires when the ray hits something in the Mask, with its hit position.")]
		public UnityEvent<Vector3> onRayHit;

		[Tooltip("Fires when the ray fails to hit something in the Mask, with its start position.")]
		public UnityEvent<Vector3> onRayFail;

		[NonSerialized]
		private bool initialized = false;

		public void OnAfterDeserialize()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (!initialized)
			{
				initialized = true;
				if (distance == 0f)
				{
					distance = 100f;
				}
				if (((LayerMask)(ref mask)).value == 0)
				{
					mask = LayerMask.op_Implicit(301992193);
				}
			}
		}

		public void OnBeforeSerialize()
		{
		}
	}
	[AddComponentMenu("SnipersScripts/RemoteScrapEvents")]
	public class RemoteScrapEvents : MonoBehaviour
	{
		[Tooltip("Event to run when the remote scrap item is clicked")]
		public UnityEvent onRemoteClicked;
	}
	[AddComponentMenu("SnipersScripts/ShipController")]
	public class ShipController : NetworkBehaviour
	{
		internal static readonly List<ShipController> ActiveControllers = new List<ShipController>();

		[Header("Ship Magnet")]
		public UnityEvent onMagnetEnable;

		public UnityEvent onMagnetDisable;

		public UnityEvent onMagnetToggle;

		[Header("Ship Flight")]
		public UnityEvent onShipDescend;

		public UnityEvent onShipLand;

		public UnityEvent onShipAscend;

		public UnityEvent onShipEnterOrbit;

		[Header("Ship Communication")]
		[Tooltip("Events that trigger when a ship message starts")]
		public UnityEvent onShipMessageStart;

		[Tooltip("Events that trigger when a ship message ends")]
		public UnityEvent onShipMessageEnd;

		[Tooltip("Invokes when the ship speaker is muted")]
		public UnityEvent onSpeakerMute;

		public UnityEvent onSignalTransmitStart;

		public UnityEvent onSignalTransmitEnd;

		private SignalTranslator signalTranslator = null;

		public UnityEvent onHornPull;

		public UnityEvent whileHornPulled;

		public UnityEvent onHornRelease;

		private ShipAlarmCord shipHorn = null;

		[Header("Ship Doors")]
		public UnityEvent onDoorOpen;

		public UnityEvent onDoorClose;

		public UnityEvent onDoorToggle;

		[Header("Map Radar")]
		public UnityEvent onScreenTurnOn;

		public UnityEvent onScreenTurnOff;

		public UnityEvent onScreenPoweredToggle;

		public UnityEvent onScreenSpectatorToggle;

		[Header("Teleporters")]
		public UnityEvent onTeleportStart;

		public UnityEvent onTeleportEnd;

		public UnityEvent onInverseStart;

		public UnityEvent onInverseEnd;

		private ShipTeleporter teleporterNormal = null;

		private ShipTeleporter teleporterInverse = null;

		[Header("Lights")]
		public UnityEvent onShipLightsTurnOn;

		public UnityEvent onShipLightsTurnOff;

		public UnityEvent onShipLightsToggle;

		private AnimatedObjectTrigger lightSwitch = null;

		[Header("Electric Chair")]
		public UnityEvent onClampLock;

		public UnityEvent onClampUnlock;

		public UnityEvent onClampToggle;

		public UnityEvent onShockStart;

		public UnityEvent onShockEnd;

		private MoveToExitSpecialAnimation electricChair = null;

		[Header("TV")]
		public UnityEvent onTvTurnOn;

		public UnityEvent OnTvTurnOff;

		public UnityEvent onTvToggle;

		public UnityEvent onTvStationChange;

		private TVScript tv = null;

		[HideInInspector]
		public static TelevisionClipContainerSO currentClipOverride = null;

		[HideInInspector]
		public static float overrideElapsedTime = 0f;

		[HideInInspector]
		public static bool overrideVisiblyPlaying = false;

		[HideInInspector]
		public static bool overrideStartedWithTvOff = false;

		private void OnEnable()
		{
			ActiveControllers.Add(this);
		}

		private void OnDisable()
		{
			ActiveControllers.Remove(this);
		}

		public void SetMagnetPowered(bool powered)
		{
			if (powered != StartOfRound.Instance.magnetOn)
			{
				ToggleMagnetPower();
			}
		}

		public void ToggleMagnetPower()
		{
			ToggleMagnetPower(powered: true);
		}

		private void ToggleMagnetPower(bool powered)
		{
			StartOfRound.Instance.SetMagnetOn(powered);
			StartOfRound.Instance.magnetLever.TriggerAnimation(StartOfRound.Instance.localPlayerController);
		}

		public void SetShipLanded(bool land)
		{
			if (land != StartOfRound.Instance.shipHasLanded)
			{
				ToggleShipFlight();
			}
		}

		public void ToggleShipFlight()
		{
			ToggleShipFlightRpc(!StartOfRound.Instance.shipHasLanded);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void ToggleShipFlightRpc(bool land)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1734920772u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref land, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1734920772u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (!((NetworkBehaviour)this).IsClient)
			{
				return;
			}
			if (Object.FindFirstObjectByType<StartMatchLever>().triggerScript.interactable)
			{
				if (land)
				{
					Object.FindFirstObjectByType<StartMatchLever>().LeverAnimation();
					StartOfRound.Instance.StartGame();
				}
				else
				{
					Object.FindFirstObjectByType<StartMatchLever>().LeverAnimation();
					StartOfRound.Instance.ShipLeave();
				}
			}
			else
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to move ship when lever can't be pulled. Cancelling action.");
			}
		}

		public void SetShipMessage(ShipMessageSO message)
		{
			HUDManager.Instance.ReadDialogue(message.shipMessage);
		}

		public void SetShipSpeakerAudio(AudioClip audioClip)
		{
			if ((Object)(object)audioClip != (Object)null && !StartOfRound.Instance.speakerAudioSource.isPlaying)
			{
				StartOfRound.Instance.speakerAudioSource.PlayOneShot(audioClip);
			}
			else if ((Object)(object)audioClip == (Object)null && StartOfRound.Instance.speakerAudioSource.isPlaying)
			{
				StartOfRound.Instance.DisableShipSpeaker();
			}
		}

		public void SetTransmitterMessage(string message)
		{
			if ((Object)(object)signalTranslator == (Object)null && !FindShipComponent<SignalTranslator>())
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to transmit over nonexisting transmitter. Cancelling.");
			}
			else
			{
				HUDManager.Instance.UseSignalTranslatorServerRpc(message);
			}
		}

		public void PullHorn()
		{
			if ((Object)(object)shipHorn == (Object)null && !FindShipComponent<ShipAlarmCord>())
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to use non-existing horn. Cancelling.");
				return;
			}
			ShipAlarmCord obj = shipHorn;
			if (obj != null)
			{
				obj.HoldCordDown();
			}
		}

		public void SetShipDoorOpen(bool open)
		{
			if (open == Object.FindFirstObjectByType<HangarShipDoor>().shipDoorsAnimator.GetBool("Closed"))
			{
				ToggleShipDoor();
			}
		}

		public void ToggleShipDoor()
		{
			ToggleShipDoorRpc(!Object.FindFirstObjectByType<HangarShipDoor>().shipDoorsAnimator.GetBool("Closed"));
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void ToggleShipDoorRpc(bool powered)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(305821440u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref powered, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 305821440u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (powered)
				{
					Object.FindFirstObjectByType<HangarShipDoor>().PlayDoorAnimation(true);
				}
				else
				{
					Object.FindFirstObjectByType<HangarShipDoor>().PlayDoorAnimation(false);
				}
			}
		}

		public void SetShipScreenOn(bool powered)
		{
			if (powered != StartOfRound.Instance.mapScreen.isScreenOn)
			{
				ToggleShipScreenPower();
			}
		}

		public void ToggleShipScreenPower()
		{
			ToggleShipScreenPowerRpc(!StartOfRound.Instance.mapScreen.isScreenOn);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void ToggleShipScreenPowerRpc(bool power)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2203096438u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref power, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2203096438u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (power)
				{
					StartOfRound.Instance.mapScreen.SwitchScreenOnServerRpc(true);
				}
				else
				{
					StartOfRound.Instance.mapScreen.SwitchScreenOnServerRpc(false);
				}
			}
		}

		public void ToggleShipScreenSpectator()
		{
			StartOfRound.Instance.mapScreen.SwitchRadarTargetForward(true);
		}

		public void TeleportPlayer(bool inverse)
		{
			if (((!inverse && (Object)(object)teleporterNormal == (Object)null) || (inverse && (Object)(object)teleporterInverse == (Object)null)) && !FindShipComponent<ShipTeleporter>(inverse))
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to use non-existing teleporter. Cancelling.");
			}
			else if (!inverse && teleporterNormal.buttonTrigger.interactable)
			{
				ShipTeleporter obj = teleporterNormal;
				if (obj != null)
				{
					obj.PressTeleportButtonOnLocalClient();
				}
			}
			else if (inverse && teleporterInverse.buttonTrigger.interactable)
			{
				ShipTeleporter obj2 = teleporterInverse;
				if (obj2 != null)
				{
					obj2.PressTeleportButtonOnLocalClient();
				}
			}
		}

		public void SetShipLightsOn(bool on)
		{
			if (on != StartOfRound.Instance.shipRoomLights.areLightsOn)
			{
				ToggleShipLights();
			}
		}

		public void ToggleShipLights()
		{
			if ((Object)(object)lightSwitch == (Object)null && !FindShipComponent<AnimatedObjectTrigger>())
			{
				SnipersScripts.Logger.LogWarning((object)"Somehow the light switch is missing.");
				return;
			}
			AnimatedObjectTrigger obj = lightSwitch;
			if (obj != null)
			{
				obj.TriggerAnimation(StartOfRound.Instance.localPlayerController);
			}
			StartOfRound.Instance.shipRoomLights.ToggleShipLights();
		}

		public void SetChairClamped(bool clamp)
		{
			if (FindElectricChair())
			{
				if (clamp != electricChair.exitingDisabled)
				{
					ToggleChairClamps();
				}
			}
			else
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to interact with nonexisting electric chair. Cancelling.");
			}
		}

		public void ToggleChairClamps()
		{
			if (FindElectricChair())
			{
				ToggleChairClamps(!electricChair.exitingDisabled);
			}
			else
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to interact with nonexisting electric chair. Cancelling.");
			}
		}

		private void ToggleChairClamps(bool clamp)
		{
			electricChair.SetExitingDisabled(clamp);
			electricChair.animatedObjectTrigger.TriggerAnimation(StartOfRound.Instance.localPlayerController);
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ShockElectricChairRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1986244335u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1986244335u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (FindElectricChair())
				{
					electricChair.OnShipPowerSurge();
				}
				else
				{
					SnipersScripts.Logger.LogWarning((object)"Tried to interact with nonexisting electric chair. Cancelling.");
				}
			}
		}

		private bool FindElectricChair()
		{
			if ((Object)(object)electricChair != (Object)null)
			{
				return true;
			}
			return FindShipComponent<MoveToExitSpecialAnimation>();
		}

		public void SetTvOn(bool on)
		{
			if (FindTv())
			{
				if (on != tv.tvOn)
				{
					ToggleTv();
				}
			}
			else
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to interact with nonexisting TV. Cancelling.");
			}
		}

		public void ToggleTv()
		{
			if (FindTv())
			{
				ToggleTv(!tv.tvOn);
			}
			else
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to interact with nonexisting TV. Cancelling.");
			}
		}

		private void ToggleTv(bool on)
		{
			tv.SwitchTVLocalClient();
		}

		private bool FindTv()
		{
			if ((Object)(object)tv != (Object)null)
			{
				return true;
			}
			return FindShipComponent<TVScript>();
		}

		public void SetTvClip(TelevisionClipContainerSO clip)
		{
			if (FindTv() && (Object)(object)clip != (Object)null)
			{
				overrideStartedWithTvOff = !tv.tvOn;
				currentClipOverride = clip;
				overrideElapsedTime = 0f;
				overrideVisiblyPlaying = false;
				if (currentClipOverride.forceTVOn && !tv.tvOn)
				{
					tv.TurnTVOnOff(true);
				}
			}
			else
			{
				SnipersScripts.Logger.LogWarning((object)"Tried to interact with nonexisting TV. Cancelling.");
			}
		}

		private bool FindShipComponent<T>(bool inverseTeleporter = false, string gameObjectName = "LightSwitch")
		{
			if (typeof(T) == typeof(ShipTeleporter))
			{
				List<ShipTeleporter> list = FindObjectsInSampleScene<ShipTeleporter>();
				foreach (ShipTeleporter item in list)
				{
					if (inverseTeleporter && item.isInverseTeleporter)
					{
						teleporterInverse = item;
						return true;
					}
					if (!inverseTeleporter && !item.isInverseTeleporter)
					{
						teleporterNormal = item;
						return true;
					}
				}
			}
			if (typeof(T) == typeof(SignalTranslator))
			{
				foreach (SignalTranslator item2 in FindObjectsInSampleScene<SignalTranslator>())
				{
					signalTranslator = item2;
					if ((Object)(object)signalTranslator != (Object)null)
					{
						return true;
					}
				}
			}
			if (typeof(T) == typeof(ShipAlarmCord))
			{
				foreach (ShipAlarmCord item3 in FindObjectsInSampleScene<ShipAlarmCord>())
				{
					shipHorn = item3;
					if ((Object)(object)shipHorn != (Object)null)
					{
						return true;
					}
				}
			}
			if (typeof(T) == typeof(AnimatedObjectTrigger) && gameObjectName == "LightSwitch")
			{
				foreach (AnimatedObjectTrigger item4 in FindObjectsInSampleScene<AnimatedObjectTrigger>())
				{
					if (((Object)((Component)item4).gameObject).name == "LightSwitch")
					{
						lightSwitch = item4;
						if ((Object)(object)lightSwitch != (Object)null)
						{
							return true;
						}
					}
				}
			}
			if (typeof(T) == typeof(MoveToExitSpecialAnimation))
			{
				foreach (MoveToExitSpecialAnimation item5 in FindObjectsInSampleScene<MoveToExitSpecialAnimation>())
				{
					if (item5.electricChair)
					{
						electricChair = item5;
						return true;
					}
				}
			}
			if (typeof(T) == typeof(TVScript))
			{
				foreach (TVScript item6 in FindObjectsInSampleScene<TVScript>())
				{
					tv = item6;
					if ((Object)(object)tv != (Object)null)
					{
						return true;
					}
				}
			}
			return false;
		}

		private List<T> FindObjectsInSampleScene<T>() where T : Component
		{
			return Object.FindObjectsByType<T>((FindObjectsInactive)1, (FindObjectsSortMode)0).Where(delegate(T component)
			{
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				Scene scene = ((Component)component).gameObject.scene;
				return ((Scene)(ref scene)).name == "SampleSceneRelay";
			}).ToList();
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1734920772u, new RpcReceiveHandler(__rpc_handler_1734920772), "ToggleShipFlightRpc");
			((NetworkBehaviour)this).__registerRpc(305821440u, new RpcReceiveHandler(__rpc_handler_305821440), "ToggleShipDoorRpc");
			((NetworkBehaviour)this).__registerRpc(2203096438u, new RpcReceiveHandler(__rpc_handler_2203096438), "ToggleShipScreenPowerRpc");
			((NetworkBehaviour)this).__registerRpc(1986244335u, new RpcReceiveHandler(__rpc_handler_1986244335), "ShockElectricChairRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1734920772(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)
			{
				bool land = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref land, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShipController)(object)target).ToggleShipFlightRpc(land);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_305821440(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)
			{
				bool powered = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref powered, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShipController)(object)target).ToggleShipDoorRpc(powered);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2203096438(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)
			{
				bool power = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref power, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ShipController)(object)target).ToggleShipScreenPowerRpc(power);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1986244335(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;
				((ShipController)(object)target).ShockElectricChairRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "ShipController";
		}
	}
	[AddComponentMenu("SnipersScripts/WaitRandomTime")]
	internal class WaitRandomTime : NetworkBehaviour
	{
		[Min(0f)]
		public float minWaitTime = 1f;

		[Min(0f)]
		public float maxWaitTime = 5f;

		[Tooltip("True, timer starts automatically. False, timer must be started manually.")]
		public bool runOnStart = false;

		[Tooltip("If true, once a time is chosen between min and max, it will not be re-rolled on subsequent waits.")]
		public bool onlyRandomizeOnce = false;

		[Tooltip("Event to run when the wait starts")]
		public UnityEvent onWaitStart;

		[Tooltip("Event to run when the wait is complete")]
		public UnityEvent onWaitComplete;

		[Tooltip("Event to run when the wait is stopped")]
		public UnityEvent onWaitStop;

		private Coroutine waitCoroutine = null;

		private Random random;

		private bool timeIsLocked = false;

		private float currentWaitingTime = 0f;

		public void Start()
		{
			if (runOnStart)
			{
				StartWaitRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StartWaitRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1171370140u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 1171370140u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsClient)
			{
				if (random == null)
				{
					random = new Random(RoundManager.Instance.playersManager.randomMapSeed + (int)((Component)this).transform.position.x + (int)((Component)this).transform.position.y + (int)((Component)this).transform.position.z);
				}
				if (minWaitTime > maxWaitTime)
				{
					SnipersScripts.Logger.LogWarning((object)$"WaitRandomTime: minWaitTime ({minWaitTime}) is greater than maxWaitTime ({maxWaitTime}). Switching values.");
					float num = minWaitTime;
					minWaitTime = maxWaitTime;
					maxWaitTime = num;
				}
				waitCoroutine = ((MonoBehaviour)this).StartCoroutine(Wait());
			}
		}

		private IEnumerator Wait()
		{
			UnityEvent obj = onWaitStart;
			if (obj != null)
			{
				obj.Invoke();
			}
			yield return (object)new WaitForSeconds(GetWaitTime());
			UnityEvent obj2 = onWaitComplete;
			if (obj2 != null)
			{
				obj2.Invoke();
			}
		}

		private float GetWaitTime()
		{
			if (!timeIsLocked)
			{
				currentWaitingTime = minWaitTime + (float)(random.NextDouble() * (double)(maxWaitTime - minWaitTime));
				if (onlyRandomizeOnce)
				{
					timeIsLocked = true;
				}
			}
			return currentWaitingTime;
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void StopWaitRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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 != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3137626092u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 3137626092u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsClient && waitCoroutine != null)
			{
				UnityEvent obj = onWaitStop;
				if (obj != null)
				{
					obj.Invoke();
				}
				((MonoBehaviour)this).StopCoroutine(waitCoroutine);
				waitCoroutine = null;
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1171370140u, new RpcReceiveHandler(__rpc_handler_1171370140), "StartWaitRpc");
			((NetworkBehaviour)this).__registerRpc(3137626092u, new RpcReceiveHandler(__rpc_handler_3137626092), "StopWaitRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1171370140(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;
				((WaitRandomTime)(object)target).StartWaitRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3137626092(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;
				((WaitRandomTime)(object)target).StopWaitRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "WaitRandomTime";
		}
	}
	[AddComponentMenu("SnipersScripts/WaterloggedSensor")]
	[RequireComponent(typeof(Collider))]
	internal class WaterloggedSensor : NetworkBehaviour
	{
		[Tooltip("If the check should run to invoke the events on start instead of only on switched state.")]
		public bool checkOnStart = true;

		[Tooltip("Invokes when game object under water.")]
		public UnityEvent onSubmerge;

		[Tooltip("Invokes when game object leaves water.")]
		public UnityEvent onEmerge;

		private void Start()
		{
			if (checkOnStart)
			{
				CheckSensorRpc();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void CheckSensorRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val3 = default(RpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4200019624u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 4200019624u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, 1f);
			Collider[] array2 = array;
			foreach (Collider collider in array2)
			{
				if (VallidateCollider(collider))
				{
					onSubmerge.Invoke();
					return;
				}
			}
			onEmerge.Invoke();
		}

		private void OnTriggerEnter(Collider collider)
		{
			if (VallidateCollider(collider))
			{
				onSubmerge.Invoke();
			}
		}

		private void OnTriggerExit(Collider collider)
		{
			if (VallidateCollider(collider))
			{
				onEmerge.Invoke();
			}
		}

		private bool VallidateCollider(Collider collider)
		{
			QuicksandTrigger val = default(QuicksandTrigger);
			return ((Component)collider).TryGetComponent<QuicksandTrigger>(ref val) && (val.isWater || val.isInsideWater);
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(4200019624u, new RpcReceiveHandler(__rpc_handler_4200019624), "CheckSensorRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_4200019624(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;
				((WaterloggedSensor)(object)target).CheckSensorRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "WaterloggedSensor";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Sniper1_1.SnipersScripts.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}