Decompiled source of Legend of The Moai v1.2.5

EasterIsland.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 EasterIsland;
using EasterIsland.NetcodePatcher;
using EasterIsland.src;
using EasterIsland.src.EasterIslandScripts;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using On;
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;
		}
	}
}
[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;

	public void Awake()
	{
		doorTrigger = ((Component)this).gameObject.GetComponent<InteractTrigger>();
		lockPickTimeLeft = maxTimeLeft;
		navMeshObstacle = ((Component)this).GetComponent<NavMeshObstacle>();
		LockDoor();
		if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			loadTriggerItem();
		}
	}

	public async void loadTriggerItem()
	{
		if (!((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)GameObject.Find("X8957")))
		{
			Object.Destroy((Object)(object)GameObject.Find("X8957"));
		}
		demandMet = false;
		while (RoundManager.Instance.currentEnemyPower == 0f)
		{
			await Task.Delay(1000);
		}
		string name = "";
		GrabbableObject obj = null;
		int highestValue = -1;
		for (int i = 0; i < 4; i++)
		{
			while (name.Equals("") || name.Contains("goldenhead") || name.ToLower().Contains("techradaritem"))
			{
				GrabbableObject[] objs = Object.FindObjectsOfType<GrabbableObject>();
				Random rnd = new Random();
				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.op_Implicit((Object)(object)obj))
		{
			GrabbableObject newObj = Object.Instantiate<GrabbableObject>(obj);
			((NetworkBehaviour)newObj).NetworkObject.Spawn(false);
			setItemClientRpc(((NetworkBehaviour)newObj).NetworkObject.NetworkObjectId);
		}
	}

	[ClientRpc]
	public void setItemClientRpc(ulong uid)
	{
		//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_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: 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(2703823705u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, uid);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2703823705u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
		Vector3 position = default(Vector3);
		foreach (GrabbableObject val3 in array)
		{
			if (((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == uid)
			{
				requestedObjectID = val3.itemProperties.itemName;
				GameObject gameObject = ((Component)val3).gameObject;
				((NetworkBehaviour)val3).NetworkObject.DestroyWithScene = true;
				Object.Destroy((Object)(object)gameObject.GetComponent<GrabbableObject>());
				((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);
				((Object)gameObject).name = "X8957";
			}
		}
	}

	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 (!isLocked)
			{
				return;
			}
			if (val.itemProperties.itemName == 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();
			}
		}
	}

	[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
		NetworkManager.__rpc_func_table.Add(2703823705u, new RpcReceiveHandler(__rpc_handler_2703823705));
		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_2703823705(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 itemClientRpc = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref itemClientRpc);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((EasterDoorLock)(object)target).setItemClientRpc(itemClientRpc);
			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 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 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;
			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(false);
			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 Spewer : NetworkBehaviour
{
	private int eruptHour;

	private int currentHour = -1;

	private bool noErupt;

	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 && currentHour != getHour())
		{
			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();
			}
		}
	}

	[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();
		}
	}
}
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;

	private GrabbableObject[] currentObjects;

	private EnemyAI[] currentEnemies;

	private EntranceTeleport[] currentTeleports;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		if (!((NetworkBehaviour)this).NetworkObject.IsSpawned && ((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			((NetworkBehaviour)this).NetworkObject.Spawn(false);
			Object.Destroy((Object)(object)this);
		}
		else
		{
			src = ((Component)this).GetComponent<AudioSource>();
			line = ((Component)this).GetComponent<LineRenderer>();
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		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_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		if (!src.isPlaying && toggle)
		{
			src.PlayOneShot(continueClip);
		}
		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();
	}

	protected internal override string __getTypeName()
	{
		return "TechRadarItem";
	}
}
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 moonTemperature = 10000f;

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

		[Header("Stars")]
		public VolumeProfile volumeProfile;

		private PhysicallyBasedSky skySettings;

		[Range(0f, 90f)]
		[Tooltip("Star latitude determines the height of the stars rotation point (Polar Star). Range 0-90")]
		public float polarStarLatitude = 40f;

		[Range(-180f, 180f)]
		[Tooltip("Star longitude determines the position of the stars rotation point (Polar Star). Range -180, 180")]
		public float polarStarLongitude = 90f;

		[Tooltip("Star intensity value. Together with Star Curve affects the brightness of the skybox during the cycle.")]
		public float starsIntensity = 8000f;

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

		[Tooltip("The curve of the horizon tint changing over time")]
		public AnimationCurve horizonTintCurve;

		[Tooltip("The curve of the zenit tint changing over time")]
		public AnimationCurve zenithTintCurve;

		[Header("Control Indicators")]
		[Tooltip("Displays a marker whether it is day or night")]
		public bool isDay = true;

		[Tooltip("Displays a marker whether it Sun is active or not")]
		public bool sunActive = true;

		[Tooltip("Displays a marker whether it Moon is active or not")]
		public bool moonActive = true;

		[Header("Moon Activation Trigger")]
		[Tooltip("Determines when the moon turns on and off.")]
		public float moonActivationStart = 6.3f;

		public float moonActivationEnd = 17.7f;

		private HDAdditionalLightData sunLightData;

		private HDAdditionalLightData moonLightData;

		private Light sunLightComponent;

		private Light moonLightComponent;

		public GameObject stormyFog;

		public GameObject normalSun;

		public GameObject normalVolume;

		public GameObject eclipseSun;

		public GameObject eclipseVolume;

		private void Awake()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Invalid comparison between Unknown and I4
			sunLightData = ((Component)sunLight).GetComponent<HDAdditionalLightData>();
			moonLightData = ((Component)moonLight).GetComponent<HDAdditionalLightData>();
			sunLightComponent = ((Component)sunLight).GetComponent<Light>();
			moonLightComponent = ((Component)moonLight).GetComponent<Light>();
			if ((int)StartOfRound.Instance.currentLevel.currentWeather == 2 || (int)StartOfRound.Instance.currentLevel.currentWeather == 1)
			{
				stormyFog.SetActive(true);
			}
			else
			{
				stormyFog.SetActive(false);
			}
			if ((int)StartOfRound.Instance.currentLevel.currentWeather == 5)
			{
				eclipseSun.SetActive(true);
				eclipseVolume.SetActive(true);
				normalSun.SetActive(false);
				normalVolume.SetActive(false);
			}
		}

		private void Update()
		{
			currentTime += Time.deltaTime * timeSpeed / timeDivider;
			if (currentTime >= 24f)
			{
				currentTime = 0f;
			}
			if (currentTime < 0f)
			{
				currentTime = 23.99999f;
			}
			UpdateTimeText();
			UpdateLight();
			CheckShadowStatus();
			SkyStar();
		}

		private void OnValidate()
		{
			if ((((Object)(object)sunLightData == (Object)null) & ((Object)(object)sunLightComponent == (Object)null)) || (((Object)(object)moonLightData == (Object)null) & ((Object)(object)moonLightComponent == (Object)null)))
			{
				Awake();
			}
			UpdateLight();
			CheckShadowStatus();
			SkyStar();
		}

		private void UpdateTimeText()
		{
			currentTimeString = Mathf.Floor(currentTime).ToString("00") + ":" + Mathf.Floor(currentTime * 60f % 60f).ToString("00") + ":" + Mathf.Floor(currentTime * 3600f % 60f).ToString("00");
		}

		private void UpdateLight()
		{
			//IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			float num = currentTime / 24f * 360f;
			((Component)sunLight).transform.localRotation = Quaternion.Euler(sunLatitude - 90f, sunLongitude, 0f) * Quaternion.Euler(0f, num, 0f);
			((Component)moonLight).transform.localRotation = Quaternion.Euler(90f - moonLatitude, moonLongitude, 0f) * Quaternion.Euler(0f, num, 0f);
			float num2 = currentTime / 24f;
			float num3 = sunIntensityMultiplier.Evaluate(num2);
			float num4 = moonIntensityMultiplier.Evaluate(num2);
			float num5 = sunTemperatureCurve.Evaluate(num2);
			float num6 = moonTemperatureCurve.Evaluate(num2);
			if ((Object)(object)sunLightData != (Object)null)
			{
				sunLightData.intensity = num3 * sunIntensity;
			}
			if ((Object)(object)moonLightData != (Object)null)
			{
				moonLightData.intensity = num4 * moonIntensity;
			}
			if ((Object)(object)sunLightComponent != (Object)null)
			{
				sunLightComponent.colorTemperature = num5 * sunTemperature;
			}
			if ((Object)(object)moonLightComponent != (Object)null)
			{
				moonLightComponent.colorTemperature = num6 * moonTemperature;
			}
		}

		private void CheckShadowStatus()
		{
			float num = currentTime;
			if (num >= 5.9f && num <= 18.1f)
			{
				sunLightData.EnableShadows(true);
				moonLightData.EnableShadows(false);
				isDay = true;
			}
			else
			{
				sunLightData.EnableShadows(false);
				moonLightData.EnableShadows(true);
				isDay = false;
			}
			if (num >= 5.7f && num <= 18.3f)
			{
				((Component)sunLight).gameObject.SetActive(true);
				sunActive = true;
			}
			else
			{
				((Component)sunLight).gameObject.SetActive(false);
				sunActive = false;
			}
			if (num >= moonActivationStart && num <= moonActivationEnd)
			{
				((Component)moonLight).gameObject.SetActive(false);
				moonActive = false;
			}
			else
			{
				((Component)moonLight).gameObject.SetActive(true);
				moonActive = true;
			}
		}

		private void SkyStar()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			volumeProfile.TryGet<PhysicallyBasedSky>(ref skySettings);
			((VolumeParameter<float>)(object)skySettings.spaceEmissionMultiplier).value = starsCurve.Evaluate(currentTime / 24f) * starsIntensity;
			Vector3Parameter spaceRotation = skySettings.spaceRotation;
			Quaternion val = Quaternion.Euler(90f - polarStarLatitude, polarStarLongitude, 0f) * Quaternion.Euler(0f, currentTime / 24f * 360f, 60f);
			((VolumeParameter<Vector3>)(object)spaceRotation).value = ((Quaternion)(ref val)).eulerAngles;
			float num = horizonTintCurve.Evaluate(currentTime / 24f);
			((VolumeParameter<Color>)(object)skySettings.horizonTint).value = new Color(num, num, num);
			float num2 = zenithTintCurve.Evaluate(currentTime / 24f);
			((VolumeParameter<Color>)(object)skySettings.zenithTint).value = new Color(num2, num2, num2);
		}
	}
}
namespace EasterIsland
{
	internal class ConfigModel
	{
		public static ConfigEntry<float> moaiGlobalSize;

		public static ConfigEntry<float> moaiGlobalMusicVol;

		public static ConfigEntry<float> moaiGlobalRarity;

		public static ConfigEntry<float> moaiGlobalSpeed;

		public static void setupConfig()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0028: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0078: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a0: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			ConfigEntry<float> obj = moaiGlobalSize;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = 0.05f;
			((BaseRangeOptions<float>)val).Max = 5f;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(obj, val);
			ConfigEntry<float> obj2 = moaiGlobalMusicVol;
			FloatSliderOptions val3 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = 2f;
			FloatSliderConfigItem val4 = new FloatSliderConfigItem(obj2, val3);
			ConfigEntry<float> obj3 = moaiGlobalRarity;
			FloatSliderOptions val5 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val5).Min = 0f;
			((BaseRangeOptions<float>)val5).Max = 10f;
			FloatSliderConfigItem val6 = new FloatSliderConfigItem(obj3, val5);
			ConfigEntry<float> obj4 = moaiGlobalSpeed;
			FloatSliderOptions val7 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val7).Min = 0f;
			((BaseRangeOptions<float>)val7).Max = 5f;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj4, val7);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("LegendOfTheMoai", "Legend of The Moai", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_LoadNewLevel <>9__12_0;

			public static hook_BeginUsingTerminal <>9__12_1;

			internal void <Awake>b__12_0(orig_LoadNewLevel orig, RoundManager self, int randomSeed, SelectableLevel newLevel)
			{
				foreach (GameObject item in destroyOnLoad)
				{
					if (Object.op_Implicit((Object)(object)item))
					{
						Object.Destroy((Object)(object)item);
					}
				}
				QuantumItemScript.itemsTeleportedTo.Clear();
				PortalScript.instances.Clear();
				orig.Invoke(self, randomSeed, newLevel);
			}

			internal void <Awake>b__12_1(orig_BeginUsingTerminal orig, Terminal self)
			{
				orig.Invoke(self);
				try
				{
					if (Object.op_Implicit((Object)(object)easterislandNode))
					{
						easterislandNode.itemCost = easterIslandCost.Value;
						return;
					}
					attemptGetIslandNode();
					if (Object.op_Implicit((Object)(object)easterislandNode))
					{
						easterislandNode.itemCost = easterIslandCost.Value;
					}
					if (Object.op_Implicit((Object)(object)easterrouteNode))
					{
						easterrouteNode.itemCost = easterIslandCost.Value;
					}
				}
				catch (Exception ex)
				{
					Debug.LogError((object)ex);
				}
			}
		}

		public static Harmony _harmony;

		public static EnemyType ExampleEnemy;

		public static ManualLogSource Logger;

		public static AssetBundle easterislandBundle;

		public static GameObject EruptionController;

		public static GameObject QuantumObject;

		public static GameObject portalPair;

		internal static InputMap controls;

		public static TerminalNode easterislandNode = null;

		public static TerminalNode easterrouteNode = null;

		public static List<GameObject> destroyOnLoad = new List<GameObject>();

		public static ConfigEntry<int> easterIslandCost;

		public void LogIfDebugBuild(string text)
		{
			Logger.LogInfo((object)text);
		}

		private void Awake()
		{
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			PopulateAssets();
			bindVars();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			EruptionController = easterislandBundle.LoadAsset<GameObject>("EruptionController");
			QuantumObject = easterislandBundle.LoadAsset<GameObject>("QuantumItem");
			portalPair = easterislandBundle.LoadAsset<GameObject>("PortalPair");
			Random.InitState((int)DateTime.Now.Ticks);
			NetworkPrefabs.RegisterNetworkPrefab(EruptionController);
			NetworkPrefabs.RegisterNetworkPrefab(QuantumObject);
			NetworkPrefabs.RegisterNetworkPrefab(portalPair);
			Logger.LogInfo((object)"Easter island NET Assets");
			object obj = <>c.<>9__12_0;
			if (obj == null)
			{
				hook_LoadNewLevel val = delegate(orig_LoadNewLevel orig, RoundManager self, int randomSeed, SelectableLevel newLevel)
				{
					foreach (GameObject item in destroyOnLoad)
					{
						if (Object.op_Implicit((Object)(object)item))
						{
							Object.Destroy((Object)(object)item);
						}
					}
					QuantumItemScript.itemsTeleportedTo.Clear();
					PortalScript.instances.Clear();
					orig.Invoke(self, randomSeed, newLevel);
				};
				<>c.<>9__12_0 = val;
				obj = (object)val;
			}
			RoundManager.LoadNewLevel += (hook_LoadNewLevel)obj;
			object obj2 = <>c.<>9__12_1;
			if (obj2 == null)
			{
				hook_BeginUsingTerminal val2 = delegate(orig_BeginUsingTerminal orig, Terminal self)
				{
					orig.Invoke(self);
					try
					{
						if (Object.op_Implicit((Object)(object)easterislandNode))
						{
							easterislandNode.itemCost = easterIslandCost.Value;
						}
						else
						{
							attemptGetIslandNode();
							if (Object.op_Implicit((Object)(object)easterislandNode))
							{
								easterislandNode.itemCost = easterIslandCost.Value;
							}
							if (Object.op_Implicit((Object)(object)easterrouteNode))
							{
								easterrouteNode.itemCost = easterIslandCost.Value;
							}
						}
					}
					catch (Exception ex2)
					{
						Debug.LogError((object)ex2);
					}
				};
				<>c.<>9__12_1 = val2;
				obj2 = (object)val2;
			}
			Terminal.BeginUsingTerminal += (hook_BeginUsingTerminal)obj2;
			Landmine.SpawnExplosion += (hook_SpawnExplosion)delegate(orig_SpawnExplosion orig, Vector3 explosionPosition, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, GameObject overridePrefab, bool goThroughCar)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar);
				if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
				{
					return;
				}
				try
				{
					foreach (PortalScript instance in PortalScript.instances)
					{
						GameObject gameObject = ((Component)instance).gameObject;
						if (Vector3.Distance(gameObject.transform.position, explosionPosition) < 4f)
						{
							Logger.LogInfo((object)"Moai Portal: Checking nearby objects to quantumfy");
							GrabbableObject[] array3 = Object.FindObjectsOfType<GrabbableObject>(false);
							foreach (GrabbableObject val3 in array3)
							{
								if (Vector3.Distance(((Component)val3).transform.position, explosionPosition) < 4f)
								{
									Logger.LogInfo((object)("Moai Portal: Object found: " + ((Object)val3).name + " ... quantumfying"));
									if (!Object.op_Implicit((Object)(object)((Component)((Component)val3).transform).GetComponentInChildren<QuantumItemScript>()))
									{
										GameObject val4 = Object.Instantiate<GameObject>(QuantumObject);
										val4.GetComponent<NetworkObject>().Spawn(false);
										quantumLoop(val3, val4);
									}
								}
							}
						}
					}
				}
				catch (Exception ex)
				{
					Debug.LogError((object)ex);
				}
			};
			controls = new InputMap();
		}

		public async void quantumLoop(GrabbableObject obj, GameObject quantumObj)
		{
			Logger.LogInfo((object)"Moai Portal: Awaiting Spawn of quantum object");
			while (!quantumObj.GetComponent<NetworkObject>().IsSpawned)
			{
				Logger.LogInfo((object)"Moai Portal: Awaiting Spawn of quantum object...");
				await Task.Delay(200);
			}
			Logger.LogInfo((object)"Moai Portal: Quantum Object spawned: now initializing variables for all clients");
			quantumObj.GetComponent<QuantumItemScript>().initClientRpc(((NetworkBehaviour)obj).NetworkObject.NetworkObjectId);
		}

		public static void attemptGetIslandNode()
		{
			Logger.LogInfo((object)"Attempting to get Easter Island node...");
			TerminalNode[] array = Object.FindObjectsOfType<TerminalNode>();
			TerminalNode[] array2 = array;
			foreach (TerminalNode val in array2)
			{
				if (((Object)val).name.ToLower().Equals("easterislandroute"))
				{
					Logger.LogInfo((object)"Success!");
					easterislandNode = val;
					break;
				}
				if (((Object)val).name.ToLower().Equals("easterislandrouteconfirm"))
				{
					Logger.LogInfo((object)"Success!");
					easterrouteNode = val;
					break;
				}
			}
		}

		public void bindVars()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			easterIslandCost = ((BaseUnityPlugin)this).Config.Bind<int>("Global", "Easter Island Moon Cost", 650, "Cost to travel to the moon. ");
			ConfigEntry<int> obj = easterIslandCost;
			IntInputFieldOptions val = new IntInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<int>)val).Min = 0;
			((BaseRangeOptions<int>)val).Max = 100000000;
			IntInputFieldConfigItem val2 = new IntInputFieldConfigItem(obj, val);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
		}

		public static void PopulateAssets()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			easterislandBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "eastermoonnetobjects"));
			Debug.Log((object)("Easter Bundle::: " + (object)easterislandBundle));
		}
	}
}
namespace EasterIsland.src
{
	internal class InputMap : LcInputActions
	{
		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction summonGeorge { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K1 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K2 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K3 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K4 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K5 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K6 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K7 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K8 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K9 { get; set; }

		[InputAction(/*Could not decode attribute arguments.*/)]
		public InputAction K0 { get; set; }
	}
}
namespace EasterIsland.src.EasterIslandScripts
{
	internal class GoldenCompassScript
	{
	}
	internal class GoldenHeadScript : NetworkBehaviour
	{
		private GameObject summonedMoai;

		public GrabbableObject item;

		public AudioSource moaiBelch;

		private void Update()
		{
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			InputMap controls = Plugin.controls;
			if (!Object.op_Implicit((Object)(object)item.playerHeldBy) || !item.playerHeldBy.isPlayerControlled)
			{
				return;
			}
			if (controls.K1.triggered)
			{
				playBelch(0.5f);
			}
			if (controls.K2.triggered)
			{
				playBelch(0.6667f);
			}
			if (controls.K3.triggered)
			{
				playBelch(0.8333f);
			}
			if (controls.K4.triggered)
			{
				playBelch(1f);
			}
			if (controls.K5.triggered)
			{
				playBelch(1.1667f);
			}
			if (controls.K6.triggered)
			{
				playBelch(1.3333f);
			}
			if (controls.K7.triggered)
			{
				playBelch(1.5f);
			}
			if (controls.K8.triggered)
			{
				playBelch(1.6667f);
			}
			if (controls.K9.triggered)
			{
				playBelch(1.8333f);
			}
			if (controls.K0.triggered)
			{
				playBelch(2f);
			}
			if (controls.summonGeorge.triggered)
			{
				if (!Object.op_Implicit((Object)(object)summonedMoai) || !summonedMoai.activeInHierarchy)
				{
					summonGeorgeKeyServerRpc(((Component)item.playerHeldBy).transform.position);
				}
				else
				{
					summonGeorgeKeyServerRpc(((Component)item.playerHeldBy).transform.position);
				}
			}
		}

		[ServerRpc]
		public void summonGeorgeKeyServerRpc(Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00cf: 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
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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))
			{
				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(3493489530u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3493489530u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (!Object.op_Implicit((Object)(object)summonedMoai) || !summonedMoai.activeInHierarchy)
				{
					summonGeorge(position);
				}
				else
				{
					teleportGeorge(position);
				}
			}
		}

		public void summonGeorge(Vector3 playerPosition)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003f: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			EnemyType val = findGeorgeInMods();
			if (Object.op_Implicit((Object)(object)val))
			{
				Vector3 val2 = GenerateRandomPosition(playerPosition, 5f);
				if (val