Decompiled source of Legend of The Moai v1.6.4

EasterIsland.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DayNightCycles;
using EasterIsland;
using EasterIsland.NetcodePatcher;
using EasterIsland.src;
using EasterIsland.src.EasterIslandScripts;
using EasterIsland.src.EasterIslandScripts.Cave_Easter_Egg;
using EasterIsland.src.EasterIslandScripts.Cave_Easter_Egg.NetObj_Spawners;
using EasterIsland.src.EasterIslandScripts.Technical;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MoaiEnemy.src.MoaiNormal;
using On;
using Unity.AI.Navigation;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

[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: AssemblyCompany("bcs4313")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a new moon, items, and enemies.")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.4+cd9e2c801759e115bb3ab98ef537ed8ed3634744")]
[assembly: AssemblyProduct("LegendOfTheMoai")]
[assembly: AssemblyTitle("EasterIsland")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class BookPageScript : NetworkBehaviour
{
	public Animator livro;

	public GrabbableObject bookRef;

	private void Start()
	{
		livro = ((Component)this).GetComponent<Animator>();
	}

	private void Update()
	{
		InputMap controls = Plugin.controls;
		bookRef.itemProperties.toolTips[0] = "Flip Forward Page: " + InputActionRebindingExtensions.GetBindingDisplayString(controls.BookForward, (DisplayStringOptions)0, (string)null);
		bookRef.itemProperties.toolTips[1] = "Flip Backward Page: " + InputActionRebindingExtensions.GetBindingDisplayString(controls.BookBackward, (DisplayStringOptions)0, (string)null);
		if ((Object)(object)bookRef.playerHeldBy == (Object)null || ((NetworkBehaviour)bookRef.playerHeldBy).NetworkObject.NetworkObjectId != ((NetworkBehaviour)RoundManager.Instance.playersManager.localPlayerController).NetworkObject.NetworkObjectId)
		{
			return;
		}
		if (controls.BookForward.triggered)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				setLivroClientRpc("go_ahead", val: true);
			}
			else
			{
				setLivroServerRpc("go_ahead", val: true);
			}
		}
		else if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			setLivroClientRpc("go_ahead", val: false);
		}
		else
		{
			setLivroServerRpc("go_ahead", val: false);
		}
		if (controls.BookBackward.triggered)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				setLivroClientRpc("go_back", val: true);
			}
			else
			{
				setLivroServerRpc("go_back", val: true);
			}
		}
		else if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			setLivroClientRpc("go_back", val: false);
		}
		else
		{
			setLivroServerRpc("go_back", val: false);
		}
		if (bookRef.itemProperties.toolTips.Length < 2)
		{
			bookRef.itemProperties.toolTips = new string[2] { "", "" };
		}
	}

	[ClientRpc]
	public void setLivroClientRpc(string id, bool val)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val2 = default(ClientRpcParams);
			FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendClientRpc(160744242u, val2, (RpcDelivery)0);
			bool flag = id != null;
			((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val3)).WriteValueSafe(id, false);
			}
			((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref val, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val3, 160744242u, val2, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			livro.SetBool(id, val);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void setLivroServerRpc(string id, bool val)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: 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)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: 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 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val2 = default(ServerRpcParams);
			FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendServerRpc(1366493061u, val2, (RpcDelivery)0);
			bool flag = id != null;
			((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val3)).WriteValueSafe(id, false);
			}
			((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref val, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendServerRpc(ref val3, 1366493061u, val2, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			setLivroClientRpc(id, val);
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_BookPageScript()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(160744242u, new RpcReceiveHandler(__rpc_handler_160744242));
		NetworkManager.__rpc_func_table.Add(1366493061u, new RpcReceiveHandler(__rpc_handler_1366493061));
	}

	private static void __rpc_handler_160744242(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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: 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 id = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref id, false);
			}
			bool val = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref val, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((BookPageScript)(object)target).setLivroClientRpc(id, val);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1366493061(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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: 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 id = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref id, false);
			}
			bool val = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref val, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((BookPageScript)(object)target).setLivroServerRpc(id, val);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "BookPageScript";
	}
}
[RequireComponent(typeof(InteractTrigger))]
public class EasterDoorLock : NetworkBehaviour
{
	private InteractTrigger doorTrigger;

	public float maxTimeLeft = 60f;

	public float lockPickTimeLeft = 60f;

	public bool isLocked;

	public bool isPickingLock;

	public bool demandMet = false;

	[Space(5f)]
	public EasterDoorLock twinDoor;

	public Transform lockPickerPosition;

	public Transform lockPickerPosition2;

	public string requestedObjectID = "????";

	private float enemyDoorMeter;

	public GameObject paintingAnchorNode;

	private bool isDoorOpened;

	private NavMeshObstacle navMeshObstacle;

	public AudioClip pickingLockSFX;

	public AudioClip unlockSFX;

	public AudioSource doorLockSFX;

	private bool displayedLockTip;

	private bool localPlayerPickingLock;

	private int playersPickingDoor;

	private float playerPickingLockProgress;

	private float validationPeriod = 5f;

	private string storedItemName;

	private Vector3 storedRotOffset = Vector3.zero;

	private bool presentItem = false;

	public void Awake()
	{
		doorTrigger = ((Component)this).gameObject.GetComponent<InteractTrigger>();
		lockPickTimeLeft = maxTimeLeft;
		navMeshObstacle = ((Component)this).GetComponent<NavMeshObstacle>();
		LockDoor();
		spawnObj();
	}

	public async void spawnObj()
	{
		if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			while ((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null)
			{
				Debug.Log((object)"Easter Door Lock: Awaiting for level to start... 1");
				await Task.Delay(1000);
			}
			while (RoundManager.Instance.dungeonGenerator.Generator == null)
			{
				Debug.Log((object)"Easter Door Lock: Awaiting for level to start... 2");
				await Task.Delay(1000);
			}
			while (RoundManager.Instance.dungeonGenerator.Generator.IsGenerating)
			{
				Debug.Log((object)"Easter Door Lock: Awaiting for level to start... 3");
				await Task.Delay(1000);
			}
			while (!StartOfRound.Instance.shipHasLanded)
			{
				Debug.Log((object)"Easter Door Lock: Awaiting for ship to land... 4");
				await Task.Delay(1000);
			}
		}
		await Task.Delay(1000);
		while ((Object)(object)GameObject.Find("X8957") != (Object)null)
		{
			await Task.Delay(1000);
			Object.Destroy((Object)(object)GameObject.Find("X8957"));
		}
		if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			loadTriggerItem();
		}
		else
		{
			clientRequestLoop();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void requestItemServerRpc(ulong requestorID)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(741360236u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, requestorID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 741360236u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && storedItemName != "")
			{
				sendItemNameClientRpc(requestorID, storedItemName, storedRotOffset);
			}
		}
	}

	[ClientRpc]
	public void sendItemNameClientRpc(ulong requestorID, string itemName, Vector3 rotOffset)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(654332794u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, requestorID);
			bool flag = itemName != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(itemName, false);
			}
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref rotOffset);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 654332794u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			ManualLogSource logger = Plugin.Logger;
			string[] obj = new string[6] { "Easter Island Door Lock: Setting Item : ", itemName, " with offset ", null, null, null };
			Vector3 val3 = rotOffset;
			obj[3] = ((object)(Vector3)(ref val3)).ToString();
			obj[4] = " for local player: ";
			obj[5] = requestorID.ToString();
			logger.LogInfo((object)string.Concat(obj));
			ulong networkObjectId = ((NetworkBehaviour)RoundManager.Instance.playersManager.localPlayerController).NetworkObject.NetworkObjectId;
			if (networkObjectId == requestorID)
			{
				setItem(itemName, rotOffset);
			}
		}
	}

	public async void clientRequestLoop()
	{
		while (storedItemName == "" || storedItemName == null)
		{
			Plugin.Logger.LogInfo((object)"Easter Island Door Lock: Awaiting for host item to be available...");
			ulong localId = ((NetworkBehaviour)RoundManager.Instance.playersManager.localPlayerController).NetworkObject.NetworkObjectId;
			requestItemServerRpc(localId);
			await Task.Delay(1000);
		}
	}

	public async void loadTriggerItem()
	{
		if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			return;
		}
		demandMet = false;
		Random rnd = new Random();
		GrabbableObject obj = null;
		while ((Object)(object)obj == (Object)null)
		{
			string name = "";
			int highestValue = -1;
			int retryLimit = 4;
			while ((name.Equals("") || name.Contains("goldenhead") || name.ToLower().Contains("techradaritem")) && retryLimit > 0)
			{
				retryLimit--;
				GrabbableObject[] objs = Object.FindObjectsOfType<GrabbableObject>();
				GrabbableObject objTemp = objs[rnd.Next(0, objs.Length)];
				name = ((Object)((Component)objTemp).gameObject).name;
				if (objTemp.scrapValue >= highestValue && objTemp.isInFactory)
				{
					highestValue = objTemp.scrapValue;
					obj = objTemp;
					name = ((Object)((Component)objTemp).gameObject).name;
				}
			}
			if ((Object)(object)obj != (Object)null)
			{
				setItem(obj.itemProperties.itemName, obj.itemProperties.rotationOffset);
			}
			if ((Object)(object)obj == (Object)null)
			{
				Plugin.Logger.LogInfo((object)"Easter Island Door Lock: Awaiting for trigger item object to be available...");
			}
			await Task.Delay(1500);
		}
	}

	public GameObject attachItemToPainting(GameObject GO)
	{
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		GrabbableObject component = GO.GetComponent<GrabbableObject>();
		requestedObjectID = component.itemProperties.itemName;
		GameObject gameObject = ((Component)component).gameObject;
		((NetworkBehaviour)component).NetworkObject.DestroyWithScene = true;
		((Behaviour)gameObject.GetComponent<GrabbableObject>()).enabled = false;
		((Collider)gameObject.GetComponent<BoxCollider>()).enabled = false;
		Vector3 position = default(Vector3);
		((Vector3)(ref position))..ctor(paintingAnchorNode.transform.position.x + 0.25f, paintingAnchorNode.transform.position.y, paintingAnchorNode.transform.position.z);
		gameObject.transform.position = position;
		gameObject.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
		if (Object.op_Implicit((Object)(object)gameObject.GetComponent<NetworkObject>()))
		{
			Object.Destroy((Object)(object)gameObject.GetComponent<NetworkObject>());
		}
		((Object)gameObject).name = "X8957";
		((Object)GO).name = "X8957";
		return GO;
	}

	public async void setItem(string itemName, Vector3 rotOffset)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		Plugin.Logger.LogInfo((object)("Easter Island Door Lock: Setting Item " + itemName));
		GameObject GO = null;
		try
		{
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject obj in array)
			{
				if (obj.itemProperties.itemName.Equals(itemName) && ((Vector3)(ref obj.itemProperties.rotationOffset)).Equals(rotOffset))
				{
					GO = Object.Instantiate<GameObject>(((Component)obj).gameObject);
					attachItemToPainting(GO);
					storedItemName = obj.itemProperties.itemName;
					storedRotOffset = obj.itemProperties.rotationOffset;
				}
			}
		}
		catch (Exception e)
		{
			Plugin.Logger.LogError((object)e);
			await Task.Delay(1000);
			if ((Object)(object)GO != (Object)null)
			{
				Object.Destroy((Object)(object)GO);
			}
			storedItemName = "";
			storedRotOffset = Vector3.zero;
			loadTriggerItem();
		}
	}

	public void OnHoldInteract()
	{
		if (isLocked && !displayedLockTip && HUDManager.Instance.holdFillAmount / doorTrigger.timeToHold > 0.3f)
		{
			displayedLockTip = true;
			HUDManager.Instance.DisplayTip("TIP:", "To get through locked doors efficiently, order a <u>lock-picker</u> from the ship terminal.", false, true, "LCTip_Autopicker");
		}
	}

	public void attemptUnlockDoor(PlayerControllerB player)
	{
		GrabbableObject val = ((!Object.op_Implicit((Object)(object)player.currentlyHeldObject)) ? player.currentlyHeldObjectServer : player.currentlyHeldObject);
		if ((Object)(object)val == (Object)null)
		{
			Debug.Log((object)"Easter Island: No item found to unlock door with. Doing nothing...");
		}
		else if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			attemptUnlockDoorAction(player, val.itemProperties.itemName);
		}
		else
		{
			attemptUnlockDoorServerRpc(((NetworkBehaviour)player).NetworkObject.NetworkObjectId, val.itemProperties.itemName);
		}
	}

	public void attemptUnlockDoorAction(PlayerControllerB player, string objId)
	{
		if (!isLocked)
		{
			return;
		}
		if (objId == requestedObjectID)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				UnlockDoorClientRpc(((NetworkBehaviour)player).NetworkObject.NetworkObjectId);
				demandMet = true;
			}
			else
			{
				demandMet = true;
				UnlockDoorServerRpc(((NetworkBehaviour)player).NetworkObject.NetworkObjectId);
			}
		}
		else if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			playDoorLockSFXClientRpc();
		}
		else
		{
			playDoorLockSFXServerRpc();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void attemptUnlockDoorServerRpc(ulong playerId, string objId)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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)
		//IL_00c7: 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 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3258746969u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			bool flag = objId != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(objId, false);
			}
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3258746969u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			PlayerControllerB player = getPlayer(playerId);
			attemptUnlockDoorAction(player, objId);
		}
	}

	[ClientRpc]
	public void playDoorLockSFXClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2378759453u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2378759453u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				doorLockSFX.Play();
			}
		}
	}

	[ServerRpc]
	public void playDoorLockSFXServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Invalid comparison between Unknown and I4
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Invalid comparison between Unknown and I4
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
				return;
			}
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(41280586u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 41280586u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			playDoorLockSFXClientRpc();
		}
	}

	public PlayerControllerB getPlayer(ulong netid)
	{
		PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
		foreach (PlayerControllerB val in allPlayerScripts)
		{
			if (((NetworkBehaviour)val).NetworkObject.NetworkObjectId == netid)
			{
				return val;
			}
		}
		return null;
	}

	public void LockDoor(float timeToLockPick = 30f)
	{
		doorTrigger.timeToHold = timeToLockPick;
		doorTrigger.hoverTip = "Me no normal door. Give me what me want.";
		doorTrigger.holdTip = "Dum Dum, Gimme Somthin";
		isLocked = true;
		navMeshObstacle.carving = true;
		navMeshObstacle.carveOnlyStationary = true;
		if ((Object)(object)twinDoor != (Object)null)
		{
			twinDoor.doorTrigger.interactable = false;
			twinDoor.doorTrigger.timeToHold = 35f;
			twinDoor.doorTrigger.hoverTip = "Locked (pickable)";
			twinDoor.doorTrigger.holdTip = "Picking lock";
			twinDoor.isLocked = true;
		}
	}

	public void UnlockDoor(ulong netid)
	{
		doorLockSFX.Stop();
		doorLockSFX.PlayOneShot(unlockSFX);
		navMeshObstacle.carving = false;
		if (isLocked && demandMet)
		{
			doorTrigger.hoverTip = "Use door : [LMB]";
			doorTrigger.holdTip = "";
			isPickingLock = false;
			isLocked = false;
			doorTrigger.timeToHoldSpeedMultiplier = 1f;
			navMeshObstacle.carving = false;
			Debug.Log((object)"Unlocking door");
			doorTrigger.timeToHold = 0.3f;
			PlayerControllerB player = getPlayer(netid);
			if (!Object.op_Implicit((Object)(object)player))
			{
				Debug.LogError((object)("Easter Island Door Error: failure to retrieve player id " + netid + " ::"));
			}
			else
			{
				((Component)this).GetComponent<AnimatedObjectTrigger>().TriggerAnimation(player);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void UnlockDoorServerRpc(ulong netid)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1591033154u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, netid);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1591033154u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			PlayerControllerB player = getPlayer(netid);
			if (!Object.op_Implicit((Object)(object)player))
			{
				Debug.LogError((object)("Easter Island Door Error: failure to retrieve player id " + netid + " ::"));
			}
			else
			{
				UnlockDoorClientRpc(((NetworkBehaviour)player).NetworkObject.NetworkObjectId);
			}
		}
	}

	[ClientRpc]
	public void UnlockDoorClientRpc(ulong netid)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1752022397u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, netid);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1752022397u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			demandMet = true;
			PlayerControllerB player = getPlayer(netid);
			if (!Object.op_Implicit((Object)(object)player))
			{
				Debug.LogError((object)("Easter Island Door Error: failure to retrieve player id " + netid + " ::"));
			}
			else
			{
				UnlockDoor(((NetworkBehaviour)player).NetworkObject.NetworkObjectId);
			}
		}
	}

	private void Update()
	{
		if (isLocked)
		{
			if ((Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemId == 14)
			{
				if (StartOfRound.Instance.localPlayerUsingController)
				{
					doorTrigger.disabledHoverTip = "Me no want key -_- give me somethin else";
				}
				else
				{
					doorTrigger.disabledHoverTip = "Me no want key -_- give me somethin else";
				}
			}
			else
			{
				doorTrigger.disabledHoverTip = "Me no normal door. Give me what me want.";
			}
		}
		else
		{
			navMeshObstacle.carving = false;
		}
		if (isLocked && isPickingLock)
		{
			doorTrigger.disabledHoverTip = "It seems stuck...";
		}
	}

	private void OnTriggerStay(Collider other)
	{
		if ((Object)(object)NetworkManager.Singleton == (Object)null || !((NetworkBehaviour)this).IsServer || isLocked || isDoorOpened || !((Component)other).CompareTag("Enemy"))
		{
			return;
		}
		EnemyAICollisionDetect component = ((Component)other).GetComponent<EnemyAICollisionDetect>();
		if (!((Object)(object)component == (Object)null))
		{
			enemyDoorMeter += Time.deltaTime * component.mainScript.openDoorSpeedMultiplier;
			if (enemyDoorMeter > 1f)
			{
				enemyDoorMeter = 0f;
				((Component)this).gameObject.GetComponent<AnimatedObjectTrigger>().TriggerAnimationNonPlayer(component.mainScript.useSecondaryAudiosOnAnimatedObjects, true, false);
				OpenDoorAsEnemyServerRpc();
			}
		}
	}

	public void OpenOrCloseDoor(PlayerControllerB playerWhoTriggered)
	{
		AnimatedObjectTrigger component = ((Component)this).gameObject.GetComponent<AnimatedObjectTrigger>();
		component.TriggerAnimation(playerWhoTriggered);
		isDoorOpened = component.boolValue;
		((Behaviour)navMeshObstacle).enabled = !component.boolValue;
	}

	public void SetDoorAsOpen(bool isOpen)
	{
		isDoorOpened = isOpen;
		((Behaviour)navMeshObstacle).enabled = !isOpen;
	}

	public void OpenDoorAsEnemy()
	{
		isDoorOpened = true;
		((Behaviour)navMeshObstacle).enabled = false;
	}

	[ServerRpc(RequireOwnership = false)]
	public void OpenDoorAsEnemyServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3792172792u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3792172792u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				OpenDoorAsEnemyClientRpc();
			}
		}
	}

	[ClientRpc]
	public void OpenDoorAsEnemyClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1001849341u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1001849341u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				OpenDoorAsEnemy();
			}
		}
	}

	public void TryPickingLock()
	{
		if (isLocked)
		{
			HUDManager.Instance.holdFillAmount = playerPickingLockProgress;
			if (!localPlayerPickingLock)
			{
				localPlayerPickingLock = true;
				PlayerPickLockServerRpc();
			}
		}
	}

	public void StopPickingLock()
	{
		if (localPlayerPickingLock)
		{
			localPlayerPickingLock = false;
			if (playersPickingDoor == 1)
			{
				playerPickingLockProgress = Mathf.Clamp(playerPickingLockProgress - 1f, 0f, 45f);
			}
			PlayerStopPickingLockServerRpc();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void PlayerStopPickingLockServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(830918519u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 830918519u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayerStopPickingLockClientRpc();
			}
		}
	}

	[ClientRpc]
	public void PlayerStopPickingLockClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4154123680u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4154123680u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				doorLockSFX.Stop();
				playersPickingDoor = Mathf.Clamp(playersPickingDoor - 1, 0, 4);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void PlayerPickLockServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1038649219u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1038649219u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayerPickLockClientRpc();
			}
		}
	}

	[ClientRpc]
	public void PlayerPickLockClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2226397805u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2226397805u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				doorLockSFX.clip = pickingLockSFX;
				doorLockSFX.Play();
				playersPickingDoor = Mathf.Clamp(playersPickingDoor + 1, 0, 4);
			}
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_EasterDoorLock()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Expected O, but got Unknown
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Expected O, but got Unknown
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Expected O, but got Unknown
		//IL_013a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Expected O, but got Unknown
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(741360236u, new RpcReceiveHandler(__rpc_handler_741360236));
		NetworkManager.__rpc_func_table.Add(654332794u, new RpcReceiveHandler(__rpc_handler_654332794));
		NetworkManager.__rpc_func_table.Add(3258746969u, new RpcReceiveHandler(__rpc_handler_3258746969));
		NetworkManager.__rpc_func_table.Add(2378759453u, new RpcReceiveHandler(__rpc_handler_2378759453));
		NetworkManager.__rpc_func_table.Add(41280586u, new RpcReceiveHandler(__rpc_handler_41280586));
		NetworkManager.__rpc_func_table.Add(1591033154u, new RpcReceiveHandler(__rpc_handler_1591033154));
		NetworkManager.__rpc_func_table.Add(1752022397u, new RpcReceiveHandler(__rpc_handler_1752022397));
		NetworkManager.__rpc_func_table.Add(3792172792u, new RpcReceiveHandler(__rpc_handler_3792172792));
		NetworkManager.__rpc_func_table.Add(1001849341u, new RpcReceiveHandler(__rpc_handler_1001849341));
		NetworkManager.__rpc_func_table.Add(830918519u, new RpcReceiveHandler(__rpc_handler_830918519));
		NetworkManager.__rpc_func_table.Add(4154123680u, new RpcReceiveHandler(__rpc_handler_4154123680));
		NetworkManager.__rpc_func_table.Add(1038649219u, new RpcReceiveHandler(__rpc_handler_1038649219));
		NetworkManager.__rpc_func_table.Add(2226397805u, new RpcReceiveHandler(__rpc_handler_2226397805));
	}

	private static void __rpc_handler_741360236(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong requestorID = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref requestorID);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EasterDoorLock)(object)target).requestItemServerRpc(requestorID);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_654332794(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_007b: 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)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong requestorID = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref requestorID);
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string itemName = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref itemName, false);
			}
			Vector3 rotOffset = default(Vector3);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref rotOffset);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((EasterDoorLock)(object)target).sendItemNameClientRpc(requestorID, itemName, rotOffset);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3258746969(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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong playerId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string objId = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref objId, false);
			}
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EasterDoorLock)(object)target).attemptUnlockDoorServerRpc(playerId, objId);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_41280586(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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_008c: 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_0055: Invalid comparison between Unknown and I4
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
		{
			if ((int)networkManager.LogLevel <= 1)
			{
				Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
			}
		}
		else
		{
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EasterDoorLock)(object)target).playDoorLockSFXServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1591033154(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong netid = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref netid);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EasterDoorLock)(object)target).UnlockDoorServerRpc(netid);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1752022397(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong netid = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref netid);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((EasterDoorLock)(object)target).UnlockDoorClientRpc(netid);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3792172792(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;
			((EasterDoorLock)(object)target).OpenDoorAsEnemyServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_830918519(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;
			((EasterDoorLock)(object)target).PlayerStopPickingLockServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_1038649219(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;
			((EasterDoorLock)(object)target).PlayerPickLockServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	protected internal override string __getTypeName()
	{
		return "EasterDoorLock";
	}
}
public class GoldMoaiSpawn : MonoBehaviour
{
	private bool awaitSpawn = true;

	[Space(5f)]
	public GameObject hivePrefab;

	public NoisemakerProp hive;

	public void OnEnable()
	{
		Debug.Log((object)"Gold Moai: OnEnable Call");
		if (((NetworkBehaviour)RoundManager.Instance).IsServer)
		{
			SpawnHiveNearEnemy();
		}
	}

	private async void SpawnHiveNearEnemy()
	{
		if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
		{
			return;
		}
		while ((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null)
		{
			Debug.Log((object)"Moai Enemy: Awaiting to spawn gold moai - -3...");
			await Task.Delay(1000);
		}
		while (RoundManager.Instance.dungeonGenerator.Generator == null)
		{
			Debug.Log((object)"Moai Enemy: Awaiting to spawn gold moai - -2...");
			await Task.Delay(1000);
		}
		while (RoundManager.Instance.dungeonGenerator.Generator.IsGenerating)
		{
			Debug.Log((object)"Moai Enemy: Awaiting to spawn gold moai - -1...");
			await Task.Delay(1000);
		}
		while (awaitSpawn)
		{
			GameObject[] nodes = RoundManager.Instance.outsideAINodes;
			while (nodes == null || nodes.Length == 0)
			{
				Debug.Log((object)"Moai Enemy: Awaiting to spawn gold moai - 1...");
				await Task.Delay(1000);
				nodes = RoundManager.Instance.outsideAINodes;
			}
			Vector3 originPos = nodes[new Random().Next(0, nodes.Length)].transform.position;
			Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(originPos, 3f, RoundManager.Instance.navHit, new Random(), -5);
			if (randomNavMeshPositionInBoxPredictable == originPos)
			{
				Debug.Log((object)"Moai Enemy: Awaiting to spawn gold moai - 2...");
				await Task.Delay(1000);
				continue;
			}
			Debug.Log((object)$"Moai Enemy: Set gold moai random position: {randomNavMeshPositionInBoxPredictable}");
			awaitSpawn = false;
			GameObject gameObject = Object.Instantiate<GameObject>(hivePrefab, randomNavMeshPositionInBoxPredictable + Vector3.up * 0.5f, Quaternion.Euler(Vector3.zero), RoundManager.Instance.spawnedScrapContainer);
			gameObject.SetActive(true);
			gameObject.GetComponent<NetworkObject>().Spawn(false);
			((GrabbableObject)gameObject.GetComponent<NoisemakerProp>()).targetFloorPosition = randomNavMeshPositionInBoxPredictable + Vector3.up * 0.5f;
			SpawnHiveClientRpc(NetworkObjectReference.op_Implicit(gameObject.GetComponent<NetworkObject>()), randomNavMeshPositionInBoxPredictable + Vector3.up * 0.5f);
		}
	}

	[ClientRpc]
	public void SpawnHiveClientRpc(NetworkObjectReference hiveObject, Vector3 hivePosition)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		NetworkObject val = default(NetworkObject);
		if (((NetworkObjectReference)(ref hiveObject)).TryGet(ref val, (NetworkManager)null))
		{
			hive = ((Component)val).gameObject.GetComponent<NoisemakerProp>();
			((GrabbableObject)hive).targetFloorPosition = hivePosition;
			((GrabbableObject)hive).isInFactory = false;
			int num = new Random().Next(50, 200);
			((GrabbableObject)hive).scrapValue = num;
			ScanNodeProperties componentInChildren = ((Component)hive).GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.scrapValue = num;
				componentInChildren.headerText = "Golden Moai Head";
				componentInChildren.subText = $"VALUE: ${num}";
			}
			RoundManager instance = RoundManager.Instance;
			instance.totalScrapValueInLevel += (float)((GrabbableObject)hive).scrapValue;
		}
		else
		{
			Debug.LogError((object)"Moai Enemy: Error! gold moai could not be accessed from network object reference");
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
	}

	public void OnDestroy()
	{
		Debug.Log((object)"Moai Enemy: Gold Moai Spawner has been destroyed in scene.");
	}
}
public class PortalMoaiSpawn : MonoBehaviour
{
	private bool awaitSpawn = true;

	public void OnEnable()
	{
		SpawnHiveNearEnemy();
	}

	private async void SpawnHiveNearEnemy()
	{
		if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
		{
			return;
		}
		while ((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null)
		{
			Debug.Log((object)"Moai Enemy: Awaiting to spawn portal  - -3...");
			await Task.Delay(1000);
		}
		while (RoundManager.Instance.dungeonGenerator.Generator == null)
		{
			Debug.Log((object)"Moai Enemy: Awaiting to spawn portal - -2...");
			await Task.Delay(1000);
		}
		while (RoundManager.Instance.dungeonGenerator.Generator.IsGenerating)
		{
			Debug.Log((object)"Moai Enemy: Awaiting to spawn portal - -1...");
			await Task.Delay(1000);
		}
		while (awaitSpawn)
		{
			GameObject[] nodes = RoundManager.Instance.outsideAINodes;
			while (nodes == null || nodes.Length == 0)
			{
				Debug.Log((object)"EasterIslandPortal: Awaiting to spawn portal - 1...");
				await Task.Delay(1000);
				nodes = RoundManager.Instance.outsideAINodes;
			}
			Vector3 originPos = nodes[new Random().Next(0, nodes.Length)].transform.position;
			Vector3 randomNavMeshPositionInBoxPredictable = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(originPos, 3f, RoundManager.Instance.navHit, new Random(), -5);
			if (randomNavMeshPositionInBoxPredictable == originPos)
			{
				Debug.Log((object)"Moai Enemy: Awaiting to spawn portal - 2...");
				await Task.Delay(1000);
				continue;
			}
			if (Object.op_Implicit((Object)(object)GameObject.Find("PortalPair(Clone)")))
			{
				Object.Destroy((Object)(object)GameObject.Find("PortalPair(Clone)"));
			}
			Debug.Log((object)$"EasterIslandPortal: Set portal random position: {randomNavMeshPositionInBoxPredictable}");
			awaitSpawn = false;
			GameObject gameObject = Object.Instantiate<GameObject>(Plugin.portalPair, Plugin.portalPair.transform.position, Plugin.portalPair.transform.rotation);
			gameObject.SetActive(true);
			NetworkObject rootObj = gameObject.GetComponent<NetworkObject>();
			((Component)rootObj).GetComponent<NetworkObject>().Spawn(true);
			while (!rootObj.IsSpawned)
			{
				await Task.Delay(500);
				Debug.Log((object)$"EasterIslandPortal: Awaiting Root Object spawn: {randomNavMeshPositionInBoxPredictable}");
			}
			GameObject labportal = ((Component)gameObject.transform.Find("LabPortal")).gameObject;
			GameObject islandportal = ((Component)gameObject.transform.Find("IslandPortal")).gameObject;
			while (!Object.op_Implicit((Object)(object)labportal))
			{
				await Task.Delay(500);
				Debug.Log((object)$"EasterIslandPortal: Awaiting Lab Portal Object spawn: {randomNavMeshPositionInBoxPredictable}");
			}
			while (!Object.op_Implicit((Object)(object)islandportal))
			{
				await Task.Delay(500);
				Debug.Log((object)$"EasterIslandPortal: Awaiting Island Portal Object spawn: {randomNavMeshPositionInBoxPredictable}");
			}
			Debug.Log((object)"Both portals spawned. Initializing portals.");
			labportal.GetComponent<PortalScript>().initialize(((Component)this).transform.position);
			islandportal.GetComponent<PortalScript>().initialize(randomNavMeshPositionInBoxPredictable + Vector3.up * 0.5f);
		}
	}
}
public class SceneItemInitializer : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}
}
public class TechRadarItem : GrabbableObject
{
	private AudioSource src;

	public AudioClip pingClip;

	public AudioClip turnOffClip;

	public AudioClip outOfBatteryClip;

	public AudioClip rechargeClip;

	public AudioClip continueClip;

	public Transform blankEnd;

	private LineRenderer line;

	private bool toggle = false;

	private float lastTimeSinceFind = 0f;

	private float lastTimeSinceScan = 0f;

	private float lastTimeSincePing = 0f;

	private float pingdelay = 1f;

	private float minDelay = 0.2f;

	private float pingDivisor = 30f;

	private float batteryDrainRate = 0.11f;

	private float scanPrecision = 1f;

	private float scanSteps = 120f;

	public Material lineMaterial;

	private GrabbableObject[] currentObjects;

	private EnemyAI[] currentEnemies;

	private EntranceTeleport[] currentTeleports;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		base.itemProperties.verticalOffset = 0.12f;
		if (!((NetworkBehaviour)this).NetworkObject.IsSpawned && ((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			((NetworkBehaviour)this).NetworkObject.Spawn(false);
		}
		else
		{
			src = ((Component)this).GetComponent<AudioSource>();
		}
	}

	private AnimationCurve CreateConstantCurve(float yValue, float xStart, float xEnd)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		Keyframe val = default(Keyframe);
		((Keyframe)(ref val))..ctor(xStart, yValue);
		Keyframe val2 = default(Keyframe);
		((Keyframe)(ref val2))..ctor(xEnd, yValue);
		return new AnimationCurve((Keyframe[])(object)new Keyframe[2] { val, val2 });
	}

	[ServerRpc(RequireOwnership = false)]
	public void spawnLineServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1197722204u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1197722204u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				spawnLineClientRpc();
			}
		}
	}

	[ClientRpc]
	public void spawnLineClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2945946867u, val, (RpcDelivery)0);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2945946867u, val, (RpcDelivery)0);
		}
		if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			if ((Object)(object)((Component)this).GetComponent<LineRenderer>() == (Object)null)
			{
				line = ((Component)this).gameObject.AddComponent<LineRenderer>();
				Vector3[] array = (Vector3[])(object)new Vector3[2]
				{
					new Vector3(0f, 0f, 0f),
					new Vector3(0f, 1f, 0f)
				};
				((Renderer)line).material = lineMaterial;
				line.useWorldSpace = true;
				line.shadowBias = 0.5f;
				line.textureScale = new Vector2(1f, 1f);
				line.alignment = (LineAlignment)0;
				line.textureMode = (LineTextureMode)0;
				line.widthCurve = CreateConstantCurve(0.2f, 0f, 1f);
			}
			else
			{
				line = ((Component)this).GetComponent<LineRenderer>();
			}
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		src = ((Component)this).GetComponent<AudioSource>();
		if ((Object)(object)line == (Object)null)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				spawnLineClientRpc();
			}
			else
			{
				spawnLineServerRpc();
			}
		}
		toggle = !toggle;
		if (toggle)
		{
			Debug.Log((object)"Artifact Activate");
			src.Stop();
			src.Play();
		}
		else
		{
			Debug.Log((object)"Artifact Deactivated");
			line.SetPosition(1, ((Component)this).transform.position);
			src.Stop();
			src.PlayOneShot(turnOffClip);
		}
	}

	public override void UseUpBatteries()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Artifact Use up Batteries");
		((GrabbableObject)this).UseUpBatteries();
		RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 13f, 0.65f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
		src.Stop();
	}

	public override void PocketItem()
	{
		if (!((NetworkBehaviour)this).IsOwner)
		{
			((GrabbableObject)this).PocketItem();
		}
		else
		{
			((GrabbableObject)this).PocketItem();
		}
	}

	public override void DiscardItem()
	{
		((GrabbableObject)this).DiscardItem();
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
	}

	public override void ChargeBatteries()
	{
		((GrabbableObject)this).ChargeBatteries();
		src.PlayOneShot(rechargeClip);
	}

	public override void Update()
	{
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_0353: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		base.itemProperties.verticalOffset = 0.12f;
		if (!src.isPlaying && toggle)
		{
			src.PlayOneShot(continueClip);
			src.PlayOneShot(continueClip);
		}
		if ((Object)(object)line == (Object)null)
		{
			return;
		}
		if (toggle)
		{
			line.SetPosition(1, ((Component)this).transform.position);
		}
		if (base.insertedBattery.charge <= 0f && toggle)
		{
			toggle = false;
			src.PlayOneShot(outOfBatteryClip);
		}
		Vector3 val = blankEnd.position - ((Component)this).transform.position;
		Vector3 val2 = navmeshRaycast();
		line.SetPosition(0, ((Component)this).transform.position);
		if (toggle)
		{
			Battery insertedBattery = base.insertedBattery;
			insertedBattery.charge -= 0.02f * Time.deltaTime * batteryDrainRate;
			RaycastHit val3 = default(RaycastHit);
			if (val2 != Vector3.zero)
			{
				line.SetPosition(1, val2);
				if ((double)lastTimeSinceScan + 0.2 < (double)Time.time)
				{
					scanArea(val2);
					lastTimeSinceScan = Time.time;
				}
				if (lastTimeSincePing + pingdelay < Time.time)
				{
					src.PlayOneShot(pingClip);
					lastTimeSincePing = Time.time;
				}
			}
			else if (Physics.Raycast(((Component)this).transform.position, val, ref val3))
			{
				Battery insertedBattery2 = base.insertedBattery;
				insertedBattery2.charge -= 0.02f * Time.deltaTime * batteryDrainRate;
				line.SetPosition(1, ((RaycastHit)(ref val3)).transform.position);
				if ((double)lastTimeSinceScan + 0.2 < (double)Time.time)
				{
					scanArea(((RaycastHit)(ref val3)).transform.position);
					lastTimeSinceScan = Time.time;
				}
				if (lastTimeSincePing + pingdelay < Time.time)
				{
					src.PlayOneShot(pingClip);
					lastTimeSincePing = Time.time;
				}
			}
			else
			{
				line.SetPosition(1, ((Component)blankEnd).transform.position);
				pingdelay = 100f;
				((Component)this).GetComponent<LineRenderer>().startColor = new Color(1f, 1f, 1f, 1f);
				((Component)this).GetComponent<LineRenderer>().endColor = new Color(1f, 1f, 1f, 1f);
			}
		}
		else
		{
			line.SetPosition(0, ((Component)blankEnd).transform.position);
			line.SetPosition(1, ((Component)blankEnd).transform.position);
		}
	}

	public Vector3 navmeshRaycast()
	{
		//IL_0007: 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_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: 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_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Vector3.Normalize(blankEnd.position - ((Component)this).transform.position);
		NavMeshHit val3 = default(NavMeshHit);
		for (int i = 0; (float)i < scanSteps; i++)
		{
			Vector3 val2 = ((Component)this).transform.position + val * ((float)i * scanPrecision);
			if (NavMesh.SamplePosition(val2, ref val3, scanPrecision, -1))
			{
				return ((NavMeshHit)(ref val3)).position;
			}
		}
		return Vector3.zero;
	}

	public void scanArea(Vector3 position)
	{
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0368: Unknown result type (might be due to invalid IL or missing references)
		if (lastTimeSinceFind + 10f < Time.time)
		{
			currentObjects = Object.FindObjectsOfType<GrabbableObject>();
			currentEnemies = Object.FindObjectsOfType<EnemyAI>();
			currentTeleports = Object.FindObjectsOfType<EntranceTeleport>();
			lastTimeSinceFind = Time.time;
		}
		GameObject val = null;
		float num = 9999f;
		string text = "";
		GrabbableObject[] array = currentObjects;
		foreach (GrabbableObject val2 in array)
		{
			float num2 = Vector3.Distance(((Component)val2).transform.position, position);
			if (num2 < num && !val2.isHeld && !val2.isInShipRoom)
			{
				if (((Object)val2).name.ToLower().Contains("gold"))
				{
					num = num2;
					text = "gold";
					val = ((Component)val2).gameObject;
				}
				else
				{
					num = num2;
					text = "object";
					val = ((Component)val2).gameObject;
				}
			}
		}
		EnemyAI[] array2 = currentEnemies;
		foreach (EnemyAI val3 in array2)
		{
			float num3 = Vector3.Distance(((Component)val3).transform.position, position);
			if (num3 < num)
			{
				num = num3;
				text = "enemy";
				val = ((Component)val3).gameObject;
			}
		}
		EntranceTeleport[] array3 = currentTeleports;
		foreach (EntranceTeleport val4 in array3)
		{
			float num4 = Vector3.Distance(((Component)val4).transform.position, position);
			if (num4 < num)
			{
				num = num4;
				text = "door";
				val = ((Component)val4).gameObject;
			}
		}
		Debug.Log((object)("closestObj: " + (object)val));
		Debug.Log((object)("closestDistance: " + num));
		Debug.Log((object)("closestType: " + text));
		if (!((Object)(object)val == (Object)null))
		{
			if (text.Equals("gold"))
			{
				((Component)this).GetComponent<LineRenderer>().startColor = new Color(1f, 1f, 0f, 1f);
				((Component)this).GetComponent<LineRenderer>().endColor = new Color(1f, 1f, 0f, 1f);
			}
			if (text.Equals("object"))
			{
				((Component)this).GetComponent<LineRenderer>().startColor = new Color(0f, 1f, 0f, 1f);
				((Component)this).GetComponent<LineRenderer>().endColor = new Color(0f, 1f, 0f, 1f);
			}
			if (text.Equals("enemy"))
			{
				((Component)this).GetComponent<LineRenderer>().startColor = new Color(1f, 0f, 0f, 1f);
				((Component)this).GetComponent<LineRenderer>().endColor = new Color(1f, 0f, 0f, 1f);
			}
			if (text.Equals("door"))
			{
				((Component)this).GetComponent<LineRenderer>().startColor = new Color(0f, 0f, 1f, 1f);
				((Component)this).GetComponent<LineRenderer>().endColor = new Color(0f, 0f, 1f, 1f);
			}
			pingdelay = num / pingDivisor + minDelay;
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_TechRadarItem()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(1197722204u, new RpcReceiveHandler(__rpc_handler_1197722204));
		NetworkManager.__rpc_func_table.Add(2945946867u, new RpcReceiveHandler(__rpc_handler_2945946867));
	}

	private static void __rpc_handler_1197722204(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;
			((TechRadarItem)(object)target).spawnLineServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	protected internal override string __getTypeName()
	{
		return "TechRadarItem";
	}
}
public class MeteorScript : MonoBehaviour
{
	private AudioSource src;

	public ParticleSystem part;

	public List<ParticleCollisionEvent> collisionEvents;

	private void Start()
	{
		src = ((Component)this).GetComponent<AudioSource>();
		part = ((Component)this).GetComponent<ParticleSystem>();
		collisionEvents = new List<ParticleCollisionEvent>();
	}

	private void Update()
	{
	}

	private void OnParticleCollision(GameObject other)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: 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)
		int num = ParticlePhysicsExtensions.GetCollisionEvents(part, other, collisionEvents);
		for (int i = 0; i < num; i++)
		{
			ParticleCollisionEvent val = collisionEvents[i];
			Vector3 intersection = ((ParticleCollisionEvent)(ref val)).intersection;
			spawnExplosionClientRpc(intersection);
		}
	}

	[ClientRpc]
	private async void spawnExplosionClientRpc(Vector3 position)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		Landmine.SpawnExplosion(position + Vector3.up, true, 18f, 22f, 50, 0f, (GameObject)null, false);
		GameObject gSource = new GameObject();
		gSource.transform.position = position;
		AudioSource source = gSource.AddComponent<AudioSource>();
		source.clip = src.clip;
		source.priority = src.priority;
		source.bypassReverbZones = src.bypassReverbZones;
		source.bypassEffects = src.bypassEffects;
		source.loop = src.loop;
		source.playOnAwake = src.playOnAwake;
		source.spatialBlend = src.spatialBlend;
		source.volume = src.volume;
		source.minDistance = src.minDistance;
		source.maxDistance = src.maxDistance;
		source.rolloffMode = src.rolloffMode;
		source.outputAudioMixerGroup = src.outputAudioMixerGroup;
		source.Play();
		await Task.Delay(8000);
		Object.Destroy((Object)(object)gSource);
	}
}
public class Spewer : NetworkBehaviour
{
	public int eruptHour;

	public int currentHour = -2;

	public bool noErupt;

	public int hoursForce = 0;

	private void Start()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		Spewer[] array = Object.FindObjectsOfType<Spewer>();
		Plugin.destroyOnLoad.Add(((Component)this).gameObject);
		try
		{
			ItemDropship val = Object.FindObjectsOfType<ItemDropship>()[0];
			GameObject val2 = new GameObject();
			LineRenderer val3 = val2.AddComponent<LineRenderer>();
			val2.SetActive(false);
			LineRenderer[] ropes = (LineRenderer[])(object)new LineRenderer[1] { val3 };
			val.ropes = ropes;
		}
		catch (Exception ex)
		{
			Debug.LogError((object)ex);
		}
		Spewer[] array2 = array;
		foreach (Spewer spewer in array2)
		{
			if ((Object)(object)spewer != (Object)(object)this)
			{
				Object.Destroy((Object)(object)spewer);
			}
		}
		GameObject gameObject = ((Component)((Component)this).transform.Find("meteors")).gameObject;
		gameObject.GetComponent<ParticleSystem>().Stop();
		if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			if ((double)Random.Range(0f, 1f) < 0.5)
			{
				eruptHour = 1001;
				noErupt = true;
			}
			else
			{
				eruptHour = 2 + Random.Range(2, 17);
				noErupt = false;
			}
			fogTick();
		}
	}

	private void fogTick()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			return;
		}
		int num = eruptHour - getHour();
		if (noErupt || num < 0)
		{
			setFogColorClientRpc(new Color(0f, 1f, 0.80784315f));
			return;
		}
		switch (num)
		{
		case 0:
			setFogColorClientRpc(new Color(1f, 47f / 85f, 0f));
			break;
		case 1:
			setFogColorClientRpc(new Color(1f, 47f / 85f, 0f));
			break;
		case 2:
			setFogColorClientRpc(new Color(1f, 0f, 0f));
			break;
		case 3:
			setFogColorClientRpc(new Color(0f, 1f, 0f));
			break;
		case 4:
			setFogColorClientRpc(new Color(0.9372549f, 1f, 0f));
			break;
		default:
			setFogColorClientRpc(new Color(0.5294118f, 0f, 1f));
			break;
		}
	}

	private int getHour()
	{
		return TimeOfDay.Instance.hour;
	}

	private void Update()
	{
		if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			return;
		}
		if (currentHour != getHour())
		{
			if (hoursForce > 0)
			{
				hoursForce--;
			}
			currentHour = getHour();
			fogTick();
			GameObject gameObject = ((Component)((Component)this).transform.Find("meteors")).gameObject;
			if (getHour() == eruptHour)
			{
				uint seed = (uint)Random.Range(0, 255000);
				playParticleSystemClientRpc(seed);
			}
			else
			{
				stopParticleSystemClientRpc();
			}
		}
		if (hoursForce > 0)
		{
			uint seed2 = (uint)Random.Range(0, 255000);
			playParticleSystemClientRpc(seed2);
		}
	}

	[ClientRpc]
	private void setFogColorClientRpc(Color color)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Expected O, but got Unknown
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3595457311u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref color);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3595457311u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		Debug.Log((object)"MOAI: setFogColorClientRpc Called");
		Transform transform = GameObject.Find("VolcanoMeters").transform;
		foreach (Transform item in transform)
		{
			Transform val3 = item;
			if (((Object)val3).name.Contains("Fog"))
			{
				LocalVolumetricFog component = ((Component)val3).GetComponent<LocalVolumetricFog>();
				component.parameters.albedo = color;
			}
		}
	}

	[ClientRpc]
	private void playParticleSystemClientRpc(uint seed)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(151241951u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, seed);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 151241951u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"MOAI: playParticleSystemClientRpc Called");
				GameObject gameObject = ((Component)((Component)this).transform.Find("meteors")).gameObject;
				ParticleSystem component = gameObject.GetComponent<ParticleSystem>();
				component.randomSeed = seed;
				((Component)component).GetComponent<ParticleSystem>().Play();
			}
		}
	}

	[ClientRpc]
	private void stopParticleSystemClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(361439863u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 361439863u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"MOAI: stopParticleSystemClientRpc Called");
				GameObject gameObject = ((Component)((Component)this).transform.Find("meteors")).gameObject;
				ParticleSystem component = gameObject.GetComponent<ParticleSystem>();
				component.Stop();
			}
		}
	}

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

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_Spewer()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(3595457311u, new RpcReceiveHandler(__rpc_handler_3595457311));
		NetworkManager.__rpc_func_table.Add(151241951u, new RpcReceiveHandler(__rpc_handler_151241951));
		NetworkManager.__rpc_func_table.Add(361439863u, new RpcReceiveHandler(__rpc_handler_361439863));
	}

	private static void __rpc_handler_3595457311(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			Color fogColorClientRpc = default(Color);
			((FastBufferReader)(ref reader)).ReadValueSafe(ref fogColorClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((Spewer)(object)target).setFogColorClientRpc(fogColorClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_151241951(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			uint seed = default(uint);
			ByteUnpacker.ReadValueBitPacked(reader, ref seed);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((Spewer)(object)target).playParticleSystemClientRpc(seed);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	protected internal override string __getTypeName()
	{
		return "Spewer";
	}
}
public class SpewerSpawner : MonoBehaviour
{
	private GameObject controller;

	private int checkLoop = 75;

	private void Start()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)RoundManager.Instance == (Object)null) && ((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			Debug.Log((object)"IsHost is true, spawning EruptionController");
			controller = Object.Instantiate<GameObject>(Plugin.EruptionController, ((Component)this).transform.position, Quaternion.Euler(Vector3.zero));
			controller.SetActive(true);
			NetworkObject component = controller.GetComponent<NetworkObject>();
			if ((Object)(object)component != (Object)null)
			{
				component.Spawn(false);
				Debug.Log((object)"NetworkObject spawned successfully");
			}
		}
	}

	private void Update()
	{
		if (checkLoop > 0)
		{
			checkLoop--;
			return;
		}
		checkLoop = 75;
		if (!Object.op_Implicit((Object)(object)controller))
		{
			Start();
		}
	}
}
namespace DayNightCycles
{
	public class DayAndNightCycle : MonoBehaviour
	{
		[Header("Time Settings")]
		[Range(0f, 24f)]
		[Tooltip("Slider allows you to set the starting time. Range 0-24")]
		public float currentTime;

		[Tooltip("Time elapsed multiplier. When set to 1, one second of real time equals one minute of script time. A negative value turns back time.")]
		public float timeSpeed = 1f;

		private float timeDivider = 60f;

		[Header("Current Time")]
		[Tooltip("Current time in the hh:mm:ss system.")]
		public string currentTimeString;

		[Header("Sun Settings")]
		[Tooltip("A light source simulating the Sun.")]
		public Light sunLight;

		[Range(0f, 90f)]
		[Tooltip("Sun latitude determines the maximum height of the Sun. Range 0-90")]
		public float sunLatitude = 20f;

		[Range(-180f, 180f)]
		[Tooltip("Sun longitude determines position of the Sun. Range -180, 180")]
		public float sunLongitude = -90f;

		[Tooltip("Basic Sun intensity value. Together with Sun Intensity Multiplier affects the brightness of the Sun during the cycle.")]
		public float sunIntensity = 60000f;

		[Tooltip("Decreases or increases Sun intensity over time. 0 - Midnight | 0.25 - Dawn | 0.5 - Noon | 0.75 - Dusk | 1 - Midnight")]
		public AnimationCurve sunIntensityMultiplier;

		[Range(1500f, 7000f)]
		[Tooltip("Basic Sun temperature value in Kelvin. Together with Sun Temperature Curve affects the temperature of the Sun during the cycle.")]
		public float sunTemperature = 6500f;

		[Tooltip("Decreases or increases Sun temperature over time. 0 - Midnight | 0.25 - Dawn | 0.5 - Noon | 0.75 - Dusk | 1 - Midnight")]
		public AnimationCurve sunTemperatureCurve;

		[Header("Moon Settings")]
		[Tooltip("A light source simulating the Moon.")]
		public Light moonLight;

		[Range(0f, 90f)]
		[Tooltip("Moon latitude determines the maximum height of the Moon. For best results, the value should be the same as star latitude. Range 0-90")]
		public float moonLatitude = 40f;

		[Range(-180f, 180f)]
		[Tooltip("Moon longitude determines position of the Moon. For best results, the value should be the same as star longitude. Range -180, 180")]
		public float moonLongitude = 90f;

		[Tooltip("Basic moon intensity value. Together with Moon Intensity Multiplier affects the brightness of the Moon during the cycle.")]
		public float moonIntensity = 12000f;

		public AnimationCurve moonIntensityMultiplier;

		[Range(6500f, 20000f)]
		[Tooltip("Basic Moon temperature value in Kelvin. Together with Moon Temperature Curve affects the temperature of the Moon during the cycle.")]
		public float moonTempera