Decompiled source of SnipersScripts v1.3.0

Sniper1_1.SnipersScripts.dll

Decompiled a week 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+1343934c0bc193e43f384468d3ad3a543d812882")]
[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;
		}
	}
}
public interface IWeighted
{
	float Weight { get; }
}
public abstract class WeightedSelector<T> where T : IWeighted
{
	public static T SelectWeightedRandom(IList<T> items, int seed)
	{
		Random random = new Random(seed);
		if (items == null || items.Count == 0)
		{
			return default(T);
		}
		float num = 0f;
		for (int i = 0; i < items.Count; i++)
		{
			num += Math.Max(0f, items[i].Weight);
		}
		if (num <= 0f)
		{
			return default(T);
		}
		double num2 = random.NextDouble() * (double)num;
		double num3 = 0.0;
		for (int j = 0; j < items.Count; j++)
		{
			if (!(items[j].Weight <= 0f))
			{
				num3 += (double)items[j].Weight;
				if (num2 <= num3)
				{
					return items[j];
				}
			}
		}
		return items[items.Count - 1];
	}
}
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. If null, will wait for the duration of the clip silently.")]
		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)
			{
				audioSource.clip = clip;
				audioSource.Play();
			}
			onAudioClipStart.Invoke();
			audioCorutine = ((MonoBehaviour)this).StartCoroutine(WaitForAudioClipEnd(clip));
		}

		public void StopAudioClip()
		{
			if ((Object)(object)audioSource != (Object)null)
			{
				audioSource.Stop();
			}
			if (audioCorutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(audioCorutine);
				audioCorutine = null;
			}
			onAudioClipStop.Invoke();
		}

		private IEnumerator WaitForAudioClipEnd(AudioClip clip = null)
		{
			if ((Object)(object)audioSource == (Object)null && (Object)(object)clip != (Object)null)
			{
				yield return (object)new WaitForSeconds(clip.length);
			}
			else
			{
				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/InteractTriggerInteractableToggle")]
	internal class InteractTriggerInteractableToggle : MonoBehaviour
	{
		public InteractTrigger interactTrigger;

		public void SetInteractable(bool isInteractable)
		{
			if ((Object)(object)interactTrigger != (Object)null)
			{
				interactTrigger.interactable = isInteractable;
			}
			else
			{
				printError();
			}
		}

		public void SetHoverTip(string hoverTip)
		{
			if ((Object)(object)interactTrigger != (Object)null)
			{
				interactTrigger.hoverTip = hoverTip;
			}
			else
			{
				printError();
			}
		}

		public void SetDisabledHoverTip(string disabledHoverTip)
		{
			if ((Object)(object)interactTrigger != (Object)null)
			{
				interactTrigger.disabledHoverTip = disabledHoverTip;
			}
			else
			{
				printError();
			}
		}

		private void printError()
		{
			SnipersScripts.Logger.LogWarning((object)("InteractTriggerInteractableToggle on " + ((Object)this).name + " has no InteractTrigger assigned."));
		}
	}
	[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/LocalPlayerEvent")]
	internal class LocalPlayerEvent : MonoBehaviour
	{
		[Tooltip("Runs on the local player.")]
		public UnityEvent<PlayerControllerB> localPlayerEvent;

		public void InvokeLocalPlayerEvent()
		{
			localPlayerEvent.Invoke(StartOfRound.Instance.localPlayerController);
		}
	}
	[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/RandomMaterialSelector")]
	public class RandomMaterialSelector : MonoBehaviour
	{
		[SerializeField]
		[Tooltip("If true, only use the level seed. This means that additional objects with the same possibleMaterials list will end up with the same result. If false, additional randomization is used.")]
		private bool onlyUseLevelSeed = false;

		[SerializeField]
		[Tooltip("If true, all mesh renderers will share the same outcome. If false, each mesh renderer will have its own outcome.")]
		private bool renderersShareOutcome = false;

		[SerializeField]
		[Tooltip("The mesh renderers to randomize the materials of.")]
		private List<MeshRenderer> meshRenderers = new List<MeshRenderer>();

		[SerializeField]
		[Tooltip("The weighted list of materials to choose from.")]
		private List<RandomMaterialSelectorData> possibleMaterials = new List<RandomMaterialSelectorData>();

		[SerializeField]
		[Tooltip("If true, randomized on start. If false, call Randomize() to randomize.")]
		private bool randomizeOnStart = true;

		private Random random;

		public void Start()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			int seed = (onlyUseLevelSeed ? RoundManager.Instance.playersManager.randomMapSeed : (RoundManager.Instance.playersManager.randomMapSeed + (int)(((Component)this).transform.position.x * 100f) + (int)(((Component)this).transform.position.y * 100f) + (int)(((Component)this).transform.position.z * 100f)));
			random = new Random(seed);
			if (randomizeOnStart)
			{
				Randomize();
			}
		}

		public void Randomize()
		{
			if (renderersShareOutcome)
			{
				RandomMaterialSelectorData randomMaterialSelectorData = WeightedSelector<RandomMaterialSelectorData>.SelectWeightedRandom(possibleMaterials, random.Next());
				{
					foreach (MeshRenderer meshRenderer in meshRenderers)
					{
						if ((Object)(object)meshRenderer != (Object)null && randomMaterialSelectorData.materials.Count > 0)
						{
							((Renderer)meshRenderer).sharedMaterials = randomMaterialSelectorData.materials.ToArray();
						}
					}
					return;
				}
			}
			for (int i = 0; i < meshRenderers.Count; i++)
			{
				if ((Object)(object)meshRenderers[i] != (Object)null)
				{
					RandomMaterialSelectorData randomMaterialSelectorData2 = WeightedSelector<RandomMaterialSelectorData>.SelectWeightedRandom(possibleMaterials, random.Next());
					if (randomMaterialSelectorData2.materials.Count > 0)
					{
						((Renderer)meshRenderers[i]).sharedMaterials = randomMaterialSelectorData2.materials.ToArray();
					}
				}
			}
		}
	}
	[Serializable]
	public class RandomMaterialSelectorData : IWeighted
	{
		[Tooltip("The materials applied to the mesh renderer if chosen")]
		public List<Material> materials = new List<Material>();

		[Min(0f)]
		public float weight;

		public float Weight => weight;
	}
	[AddComponentMenu("SnipersScripts/RandomPropEnabler")]
	public class RandomPropEnabler : MonoBehaviour
	{
		[Serializable]
		public class RandomObjectSelectorData : IWeighted
		{
			[Tooltip("The materials applied to the mesh renderer if chosen")]
			public GameObject gameOjbect;

			[Min(0f)]
			public float weight;

			public float Weight => weight;
		}

		[SerializeField]
		[Tooltip("If true, only use the level seed. This means that additional objects with the same possibleObjects list will end up with the same result. If false, additional randomization is used.")]
		private bool onlyUseLevelSeed = false;

		[SerializeField]
		[Min(0f)]
		private int minimumObjects = 0;

		[SerializeField]
		[Min(0f)]
		private int maximumObjects = 1;

		[SerializeField]
		[Tooltip("The weighted list of objects to choose from.")]
		private List<RandomObjectSelectorData> possibleObjects = new List<RandomObjectSelectorData>();

		[SerializeField]
		[Tooltip("If true, randomized on start. If false, call Randomize() to randomize.")]
		private bool randomizeOnStart = true;

		private Random random;

		private void Start()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			int seed = (onlyUseLevelSeed ? RoundManager.Instance.playersManager.randomMapSeed : (RoundManager.Instance.playersManager.randomMapSeed + (int)(((Component)this).transform.position.x * 100f) + (int)(((Component)this).transform.position.y * 100f) + (int)(((Component)this).transform.position.z * 100f)));
			random = new Random(seed);
			if (maximumObjects > possibleObjects.Count)
			{
				SnipersScripts.Logger.LogWarning((object)$"RandomPropEnabler on {((Object)this).name} has maximumObjects ({maximumObjects}) greater than possibleObjects.Count ({possibleObjects.Count}). Setting maximumObjects to possibleObjects.Count.");
				maximumObjects = possibleObjects.Count;
			}
			if (minimumObjects > maximumObjects)
			{
				SnipersScripts.Logger.LogWarning((object)$"RandomPropEnabler on {((Object)this).name} has minimumObjects ({minimumObjects}) greater than maximumObjects ({maximumObjects}). Switching.");
				int num = minimumObjects;
				minimumObjects = maximumObjects;
				maximumObjects = num;
			}
			if (randomizeOnStart)
			{
				Randomize();
			}
		}

		public void Randomize()
		{
			int num = random.Next(minimumObjects, maximumObjects + 1);
			List<RandomObjectSelectorData> list = new List<RandomObjectSelectorData>(possibleObjects);
			foreach (RandomObjectSelectorData possibleObject in possibleObjects)
			{
				GameObject gameOjbect = possibleObject.gameOjbect;
				if (gameOjbect != null)
				{
					gameOjbect.SetActive(false);
				}
			}
			for (int i = 0; i < num; i++)
			{
				if (list.Count == 0)
				{
					break;
				}
				RandomObjectSelectorData randomObjectSelectorData = WeightedSelector<RandomObjectSelectorData>.SelectWeightedRandom(list, random.Next());
				GameObject gameOjbect2 = randomObjectSelectorData.gameOjbect;
				if (gameOjbect2 != null)
				{
					gameOjbect2.SetActive(true);
				}
				list.Remove(randomObjectSelectorData);
			}
		}
	}
	[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/SimpleSellScript")]
	internal class SimpleSellScript : NetworkBehaviour
	{
		[Header("Sell Settings")]
		[Tooltip("If true, items sold will use the company buy rate. If false, the override buy rate will be used.")]
		public bool UseCompanyBuyRate = true;

		[Tooltip("The buy rate to use if UseCompanyBuyRate is false. 1 is the full 100% buy rate.")]
		public float OverrideBuyRate = 1f;

		[Tooltip("The maximum number of items that can be placed on the counter.")]
		public int maxItems = 150;

		[Header("Events")]
		[Tooltip("Invoked when an item is placed on the counter.")]
		public UnityEvent onItemPlaced;

		[Tooltip("Invoked when items are sold.")]
		public UnityEvent onSell;

		[Header("References & Audios")]
		[Tooltip("The collider used for item placement.")]
		public Collider placementCollider;

		private InteractTrigger placementTrigger;

		private List<GrabbableObject> itemsToSell = new List<GrabbableObject>();

		[Tooltip("The audio source used to play reward sounds.")]
		public AudioSource rewardsMusic;

		[Tooltip("Plays when your profit is > 1/4 of credits.")]
		public AudioClip rewardGood;

		[Tooltip("Plays when your profit is <= 1/4 of credits.")]
		public AudioClip rewardBad;

		private void Awake()
		{
			if (!((Component)placementCollider).TryGetComponent<InteractTrigger>(ref placementTrigger))
			{
				SnipersScripts.Logger.LogError((object)("SimpleSellScript on " + ((Object)this).name + " failed to find InteractTrigger for " + ((Object)placementCollider).name));
			}
		}

		public void PlaceItem(PlayerControllerB playerPlacingItem)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (itemsToSell.Count < maxItems && (Object)(object)placementCollider != (Object)null)
			{
				Vector3 val = RoundManager.RandomPointInBounds(placementCollider.bounds);
				Bounds bounds = placementCollider.bounds;
				val.y = ((Bounds)(ref bounds)).min.y;
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(new Ray(val + Vector3.up * 3f, Vector3.down), ref val2, 8f, 1048640, (QueryTriggerInteraction)2))
				{
					val = ((RaycastHit)(ref val2)).point;
				}
				GrabbableObject currentlyHeldObjectServer = playerPlacingItem.currentlyHeldObjectServer;
				val.y += currentlyHeldObjectServer.itemProperties.verticalOffset;
				val = ((Component)placementCollider).gameObject.transform.InverseTransformPoint(val);
				AddItemToDeskRpc(NetworkObjectReference.op_Implicit(((Component)currentlyHeldObjectServer).gameObject.GetComponent<NetworkObject>()));
				playerPlacingItem.DiscardHeldObject(true, ((Component)placementCollider).GetComponent<NetworkObject>(), val, false);
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void AddItemToDeskRpc(NetworkObjectReference itemNetworkObject)
		{
			//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(2308002525u, val3, val, (SendTo)6, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref itemNetworkObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendRpc(ref val2, 2308002525u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val4 = default(NetworkObject);
				if (((NetworkObjectReference)(ref itemNetworkObject)).TryGet(ref val4, (NetworkManager)null) && !itemsToSell.Contains(((Component)val4).GetComponentInChildren<GrabbableObject>()))
				{
					itemsToSell.Add(((Component)val4).GetComponentInChildren<GrabbableObject>());
					onItemPlaced.Invoke();
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SellItemsRpc()
		{
			//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(963304867u, val3, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val2, 963304867u, val3, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1)
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			int num = 0;
			foreach (GrabbableObject item in itemsToSell)
			{
				num += item.scrapValue;
			}
			num = (int)((float)num * (UseCompanyBuyRate ? StartOfRound.Instance.companyBuyingRate : OverrideBuyRate));
			Terminal val4 = Object.FindObjectOfType<Terminal>();
			val4.groupCredits += num;
			EndOfGameStats gameStats = StartOfRound.Instance.gameStats;
			gameStats.scrapValueCollected += num;
			TimeOfDay instance = TimeOfDay.Instance;
			instance.quotaFulfilled += num;
			TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
			HUDManager.Instance.DisplayCreditsEarning(num, itemsToSell.ToArray(), val4.groupCredits);
			if ((float)num < (float)val4.groupCredits / 4f)
			{
				AudioSource obj = rewardsMusic;
				if (obj != null)
				{
					obj.PlayOneShot(rewardBad);
				}
			}
			else
			{
				AudioSource obj2 = rewardsMusic;
				if (obj2 != null)
				{
					obj2.PlayOneShot(rewardGood);
				}
			}
			NetworkObject val5 = default(NetworkObject);
			foreach (GrabbableObject item2 in itemsToSell)
			{
				if (((Component)item2).TryGetComponent<NetworkObject>(ref val5) && ((NetworkBehaviour)this).IsServer)
				{
					val5.Despawn(true);
				}
			}
			itemsToSell.Clear();
			onSell.Invoke();
		}

		private void Update()
		{
			placementTrigger.interactable = GameNetworkManager.Instance.localPlayerController.isHoldingObject;
			foreach (GrabbableObject item in itemsToSell)
			{
				if (item.grabbable)
				{
					item.grabbable = false;
				}
			}
		}

		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(2308002525u, new RpcReceiveHandler(__rpc_handler_2308002525), "AddItemToDeskRpc");
			((NetworkBehaviour)this).__registerRpc(963304867u, new RpcReceiveHandler(__rpc_handler_963304867), "SellItemsRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2308002525(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_004f: 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)
			{
				NetworkObjectReference itemNetworkObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref itemNetworkObject, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SimpleSellScript)(object)target).AddItemToDeskRpc(itemNetworkObject);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_963304867(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;
				((SimpleSellScript)(object)target).SellItemsRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[Met