Decompiled source of Wither v1.0.0

ScienceBird.Wither.dll

Decompiled 5 hours ago
using System;
using System.Collections;
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 BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ScienceBird.Wither.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;

[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("ScienceBird.Wither")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Wither")]
[assembly: AssemblyTitle("ScienceBird.Wither")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class RunAnim : NetworkBehaviour
{
	public AnimatedObjectTrigger animatedObjectTrigger;

	public void DoAnimation()
	{
		animatedObjectTrigger.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
	}

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

	protected internal override string __getTypeName()
	{
		return "RunAnim";
	}
}
namespace Wither
{
	public class BridgeTriggerType3 : NetworkBehaviour
	{
		private int timesTriggered = 0;

		private int triggerThreshold;

		public int maxTriggers = 5;

		public AnimatedObjectTrigger animatedObjectTriggerShake;

		public AnimatedObjectTrigger animatedObjectTriggerFall;

		private bool initialSet = true;

		private bool bridgeFell;

		private void Update()
		{
			if (initialSet)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					triggerThreshold = Random.Range(2, maxTriggers + 1);
					Wither.Logger.LogDebug((object)$"Catwalk triggers: {triggerThreshold}");
					SetThresholdClientRpc(triggerThreshold);
				}
				initialSet = false;
			}
		}

		[ClientRpc]
		public void SetThresholdClientRpc(int threshold)
		{
			//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(3153522774u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, threshold);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3153522774u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
				{
					triggerThreshold = threshold;
				}
			}
		}

		private void OnTriggerEnter(Collider other)
		{
			if (!bridgeFell)
			{
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)component)
				{
					AddToBridgeInstabilityServerRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AddToBridgeInstabilityServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3956335988u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3956335988u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				timesTriggered++;
				if (timesTriggered < triggerThreshold)
				{
					animatedObjectTriggerShake.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				}
				if (timesTriggered >= triggerThreshold)
				{
					bridgeFell = true;
					animatedObjectTriggerFall.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				}
			}
		}

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

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

		private static void __rpc_handler_3153522774(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)
			{
				int thresholdClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref thresholdClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BridgeTriggerType3)(object)target).SetThresholdClientRpc(thresholdClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3956335988(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;
				((BridgeTriggerType3)(object)target).AddToBridgeInstabilityServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BridgeTriggerType3";
		}
	}
	public class EnableScrapSpawn : NetworkBehaviour
	{
		public int rarityPoint = 100;

		public void SetRarity(bool configVal)
		{
			if ((Object)(object)RoundManager.Instance.currentLevel != (Object)null)
			{
				int num = 0;
				for (int i = 0; i < RoundManager.Instance.currentLevel.spawnableScrap.Count; i++)
				{
					if (RoundManager.Instance.currentLevel.spawnableScrap[i].spawnableItem.itemName == "Ricardorb")
					{
						num = i;
						break;
					}
				}
				Wither.Logger.LogDebug((object)$"Setting spawning to {configVal} for strange scrap (rarity {rarityPoint}, index {num}).");
				if (configVal)
				{
					RoundManager.Instance.currentLevel.spawnableScrap[num].rarity = rarityPoint;
				}
				else
				{
					RoundManager.Instance.currentLevel.spawnableScrap[num].rarity = 0;
				}
			}
			else
			{
				Wither.Logger.LogDebug((object)"No selectable level found, skipping scrap config check.");
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "EnableScrapSpawn";
		}
	}
	public class InFactoryTrigger : NetworkBehaviour
	{
		public StartOfRound playersManager;

		private void Awake()
		{
			playersManager = Object.FindObjectOfType<StartOfRound>();
		}

		private void OnTriggerEnter(Collider other)
		{
			GameNetworkManager.Instance.localPlayerController.isInElevator = false;
			GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = false;
			SetPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
			GameNetworkManager.Instance.localPlayerController.isInsideFactory = true;
		}

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

		[ClientRpc]
		public void SetPlayerClientRpc(int playerObj)
		{
			//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(921270800u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerObj);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 921270800u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					playersManager.allPlayerScripts[playerObj].isInElevator = false;
					playersManager.allPlayerScripts[playerObj].isInHangarShipRoom = false;
					playersManager.allPlayerScripts[playerObj].isInsideFactory = true;
				}
			}
		}

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

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

		private static void __rpc_handler_3936933453(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)
			{
				int playerServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((InFactoryTrigger)(object)target).SetPlayerServerRpc(playerServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_921270800(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)
			{
				int playerClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((InFactoryTrigger)(object)target).SetPlayerClientRpc(playerClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "InFactoryTrigger";
		}
	}
	public class InsertApparatus : NetworkBehaviour
	{
		public StartOfRound playersManager;

		public AnimatedObjectTrigger objectsEnableTrigger;

		public InteractTrigger insertTrigger;

		public AnimatedObjectTrigger animatedDoorTrigger;

		public bool isInserted;

		private void Update()
		{
			if (isInserted)
			{
				return;
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemName == "Apparatus")
			{
				if (StartOfRound.Instance.localPlayerUsingController)
				{
					insertTrigger.hoverTip = "Insert apparatus: [D-pad up]";
				}
				else
				{
					insertTrigger.hoverTip = "Insert apparatus: [ E ]";
				}
			}
			else
			{
				insertTrigger.hoverTip = "Nothing to insert";
			}
		}

		public void InsertItem()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null && localPlayerController.currentlyHeldObjectServer.itemProperties.itemName == "Apparatus" && !localPlayerController.isGrabbingObjectAnimation)
			{
				localPlayerController.DespawnHeldObject();
				objectsEnableTrigger.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
				animatedDoorTrigger.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "InsertApparatus";
		}
	}
	public class LoopAudibleHorn : NetworkBehaviour
	{
		public Transform noisePosition;

		public AudioSource hornPlayer;

		public bool isPlaying = true;

		public int loopCounter = 16;

		private float loopTimer = 2f;

		private void Update()
		{
			if (isPlaying)
			{
				LoopAudio();
			}
		}

		public void LoopAudio()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (!hornPlayer.isPlaying)
			{
				hornPlayer.Play();
				loopCounter--;
			}
			if (loopTimer <= 0f)
			{
				RoundManager.Instance.PlayAudibleNoise(noisePosition.position, 20f, 0.6f, 0, false, 0);
				loopTimer = 2f;
			}
			else
			{
				loopTimer -= Time.deltaTime;
			}
			if (loopCounter <= 0)
			{
				isPlaying = false;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "LoopAudibleHorn";
		}
	}
	public class NetworkHandler : NetworkBehaviour
	{
		public static NetworkHandler Instance { get; private set; }

		public static event Action<string> LevelEvent;

		public override void OnNetworkSpawn()
		{
			NetworkHandler.LevelEvent = null;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				NetworkHandler instance = Instance;
				if (instance != null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
			}
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		[ClientRpc]
		public void EventClientRpc(string eventName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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(1849323834u, val, (RpcDelivery)0);
				bool flag = eventName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1849323834u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkHandler.LevelEvent?.Invoke(eventName);
			}
		}

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

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

		private static void __rpc_handler_1849323834(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string eventName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((NetworkHandler)(object)target).EventClientRpc(eventName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "NetworkHandler";
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManager
	{
		private static GameObject networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = (GameObject)Wither.NetworkAssets.LoadAsset("WitherNetworkHandler");
				networkPrefab.AddComponent<NetworkHandler>();
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//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)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}
	}
	public class OldElevatorController : NetworkBehaviour
	{
		public Animator elevatorAnimator;

		public Transform elevatorPoint;

		public bool elevatorFinishedMoving;

		public float elevatorFinishTimer;

		public bool elevatorIsAtBottom;

		public bool elevatorCalled;

		public bool elevatorMovingDown;

		private bool movingDownLastFrame = true;

		public bool calledDown;

		public float callCooldown;

		public AudioSource elevatorAudio;

		public AudioClip elevatorStartUpSFX;

		public AudioClip elevatorStartDownSFX;

		public AudioClip elevatorTravelSFX;

		public AudioClip elevatorFinishUpSFX;

		public AudioClip elevatorFinishDownSFX;

		public GameObject elevatorCalledBottomButton;

		public GameObject elevatorCalledTopButton;

		public Transform elevatorTopPoint;

		public Transform elevatorBottomPoint;

		public Transform elevatorInsidePoint;

		public Vector3 previousElevatorPosition;

		public bool elevatorDoorOpen;

		public AudioSource elevatorJingleMusic;

		private bool playMusic;

		private bool startedMusic;

		private float stopPlayingMusicTimer;

		public AudioClip[] elevatorHalloweenClips;

		public AudioClip[] elevatorHalloweenClipsLoop;

		private int selectedTrack = 0;

		[ServerRpc]
		public void SetElevatorMusicServerRpc(bool setOn, int track)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_00c3: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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(909026737u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOn, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, track);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 909026737u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetElevatorMusicClientRpc(setOn, track);
			}
		}

		[ClientRpc]
		public void SetElevatorMusicClientRpc(bool setOn, int track)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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(2448796174u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setOn, default(ForPrimitives));
					BytePacker.WriteValueBitPacked(val2, track);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2448796174u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
				{
					selectedTrack = track;
					playMusic = setOn;
				}
			}
		}

		private void OnEnable()
		{
			Wither.Logger.LogDebug((object)"Skipping elevator instance.");
		}

		private void OnDisable()
		{
			Wither.Logger.LogDebug((object)"Skipping elevator instance.");
		}

		public void LateUpdate()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			previousElevatorPosition = elevatorInsidePoint.position;
		}

		public void Update()
		{
			if (!playMusic)
			{
				if (stopPlayingMusicTimer <= 0f)
				{
					if (elevatorJingleMusic.isPlaying)
					{
						if (elevatorJingleMusic.pitch < 0.5f)
						{
							AudioSource obj = elevatorJingleMusic;
							obj.volume -= Time.deltaTime * 3f;
							if (elevatorJingleMusic.volume <= 0.01f)
							{
								elevatorJingleMusic.Stop();
							}
						}
						else
						{
							AudioSource obj2 = elevatorJingleMusic;
							obj2.pitch -= Time.deltaTime;
							elevatorJingleMusic.volume = Mathf.Max(elevatorJingleMusic.volume - Time.deltaTime * 2f, 0.4f);
						}
					}
				}
				else
				{
					stopPlayingMusicTimer -= Time.deltaTime;
				}
			}
			else
			{
				stopPlayingMusicTimer = 1.5f;
				if (!elevatorJingleMusic.isPlaying)
				{
					Wither.Logger.LogDebug((object)$"Elevator playing track {selectedTrack}");
					if (elevatorMovingDown)
					{
						elevatorJingleMusic.clip = elevatorHalloweenClips[selectedTrack];
						elevatorJingleMusic.Play();
						elevatorJingleMusic.volume = 1f;
					}
					else
					{
						elevatorJingleMusic.clip = elevatorHalloweenClipsLoop[selectedTrack];
						elevatorJingleMusic.Play();
						elevatorJingleMusic.volume = 1f;
					}
				}
				AudioSource obj3 = elevatorJingleMusic;
				AudioSource obj4 = elevatorJingleMusic;
				float num2 = (obj4.pitch += Time.deltaTime * 2f);
				obj3.pitch = Mathf.Clamp(num2, 0.3f, 1f);
			}
			elevatorAnimator.SetBool("ElevatorGoingUp", !elevatorMovingDown);
			elevatorCalledTopButton.SetActive(!elevatorMovingDown || elevatorCalled);
			elevatorCalledBottomButton.SetActive(elevatorMovingDown || elevatorCalled);
			if (elevatorMovingDown != movingDownLastFrame)
			{
				movingDownLastFrame = elevatorMovingDown;
				if (elevatorMovingDown)
				{
					elevatorAudio.PlayOneShot(elevatorStartDownSFX);
				}
				else
				{
					elevatorAudio.PlayOneShot(elevatorStartUpSFX);
				}
				if (((NetworkBehaviour)this).IsServer)
				{
					SetElevatorMovingServerRpc(elevatorMovingDown);
				}
			}
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			if (elevatorFinishedMoving)
			{
				if (((NetworkBehaviour)this).IsServer && startedMusic)
				{
					playMusic = false;
					startedMusic = false;
					SetElevatorMusicServerRpc(setOn: false, selectedTrack);
				}
			}
			else if (((NetworkBehaviour)this).IsServer && !startedMusic)
			{
				startedMusic = true;
				playMusic = true;
				selectedTrack = Random.Range(0, elevatorHalloweenClips.Length);
				SetElevatorMusicServerRpc(setOn: true, selectedTrack);
			}
			if (elevatorFinishedMoving)
			{
				if (elevatorCalled)
				{
					if (callCooldown <= 0f)
					{
						SwitchElevatorDirection();
						SetElevatorCalledClientRpc(setCalled: false, elevatorMovingDown);
					}
					else
					{
						callCooldown -= Time.deltaTime;
					}
				}
			}
			else if (elevatorFinishTimer <= 0f)
			{
				elevatorFinishedMoving = true;
				Wither.Logger.LogDebug((object)"Elevator finished moving!");
				PlayFinishAudio(!elevatorMovingDown);
				ElevatorFinishServerRpc(!elevatorMovingDown);
			}
			else
			{
				elevatorFinishTimer -= Time.deltaTime;
			}
		}

		private void SwitchElevatorDirection()
		{
			elevatorMovingDown = !elevatorMovingDown;
			elevatorFinishedMoving = false;
			elevatorFinishTimer = 14f;
			elevatorCalled = false;
			SetElevatorFinishedMovingClientRpc(finished: false);
		}

		[ClientRpc]
		public void SetElevatorFinishedMovingClientRpc(bool finished)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3386253705u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref finished, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3386253705u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
				{
					elevatorFinishedMoving = finished;
				}
			}
		}

		public void AnimationEvent_ElevatorFinishTop()
		{
			if (!elevatorMovingDown && !elevatorFinishedMoving)
			{
				elevatorFinishedMoving = true;
				if (((NetworkBehaviour)this).IsServer)
				{
					PlayFinishAudio(!elevatorMovingDown);
					ElevatorFinishServerRpc(!elevatorMovingDown);
				}
			}
		}

		public void AnimationEvent_ElevatorStartFromBottom()
		{
			ShakePlayerCamera(shakeHard: false);
		}

		public void AnimationEvent_ElevatorHitBottom()
		{
			ShakePlayerCamera(shakeHard: true);
		}

		public void AnimationEvent_ElevatorTravel()
		{
			elevatorAudio.PlayOneShot(elevatorTravelSFX);
		}

		public void AnimationEvent_ElevatorFinishBottom()
		{
			if (elevatorMovingDown && !elevatorFinishedMoving)
			{
				elevatorFinishedMoving = true;
				if (((NetworkBehaviour)this).IsServer)
				{
					Wither.Logger.LogDebug((object)"Elevator finished moving B!");
					PlayFinishAudio(!elevatorMovingDown);
					ElevatorFinishServerRpc(!elevatorMovingDown);
				}
			}
		}

		private void ShakePlayerCamera(bool shakeHard)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, elevatorPoint.position) < 4f)
			{
				if (shakeHard)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
				}
				else
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
				}
			}
		}

		[ServerRpc]
		public void ElevatorFinishServerRpc(bool atTop)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00c3: 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_00dd: 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(795077385u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref atTop, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 795077385u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ElevatorFinishClientRpc(atTop);
			}
		}

		[ClientRpc]
		public void ElevatorFinishClientRpc(bool atTop)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4862135u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref atTop, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4862135u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
				{
					PlayFinishAudio(atTop);
					elevatorFinishedMoving = true;
				}
			}
		}

		private void PlayFinishAudio(bool atTop)
		{
			if (atTop)
			{
				elevatorAudio.PlayOneShot(elevatorFinishUpSFX);
			}
			else
			{
				elevatorAudio.PlayOneShot(elevatorFinishDownSFX);
			}
		}

		[ServerRpc]
		public void SetElevatorMovingServerRpc(bool movingDown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_00c3: 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_00dd: 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(2034514025u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref movingDown, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2034514025u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SetElevatorMovingClientRpc(movingDown);
			}
		}

		[ClientRpc]
		public void SetElevatorMovingClientRpc(bool movingDown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(767682336u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref movingDown, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 767682336u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
				{
					elevatorMovingDown = movingDown;
				}
			}
		}

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

		public void CallElevatorOnServer(bool callDown)
		{
			if (elevatorMovingDown != callDown)
			{
				elevatorCalled = true;
				callCooldown = 4f;
				SetElevatorCalledClientRpc(elevatorCalled, elevatorMovingDown);
			}
		}

		public void SetElevatorDoorOpen()
		{
			elevatorDoorOpen = true;
		}

		public void SetElevatorDoorClosed()
		{
			elevatorDoorOpen = false;
		}

		[ClientRpc]
		public void SetElevatorCalledClientRpc(bool setCalled, bool elevatorDown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00b2: 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(574678194u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setCalled, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref elevatorDown, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 574678194u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
				{
					elevatorCalled = setCalled;
					elevatorMovingDown = elevatorDown;
				}
			}
		}

		public void CallElevator(bool callDown)
		{
			Wither.Logger.LogDebug((object)$"Call elevator 0; call down: {callDown}; elevator moving down: {elevatorMovingDown}");
			CallElevatorServerRpc(callDown);
		}

		[ServerRpc(RequireOwnership = false)]
		public void PressElevatorButtonServerRpc()
		{
			//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(1302763586u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1302763586u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PressElevatorButtonOnServer();
				}
			}
		}

		public void PressElevatorButtonOnServer(bool requireFinishedMoving = false)
		{
			if (elevatorFinishedMoving || (elevatorFinishTimer < 0.16f && !requireFinishedMoving))
			{
				SwitchElevatorDirection();
			}
		}

		public void PressElevatorButton()
		{
			PressElevatorButtonServerRpc();
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_OldElevatorController()
		{
			//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
			NetworkManager.__rpc_func_table.Add(909026737u, new RpcReceiveHandler(__rpc_handler_909026737));
			NetworkManager.__rpc_func_table.Add(2448796174u, new RpcReceiveHandler(__rpc_handler_2448796174));
			NetworkManager.__rpc_func_table.Add(3386253705u, new RpcReceiveHandler(__rpc_handler_3386253705));
			NetworkManager.__rpc_func_table.Add(795077385u, new RpcReceiveHandler(__rpc_handler_795077385));
			NetworkManager.__rpc_func_table.Add(4862135u, new RpcReceiveHandler(__rpc_handler_4862135));
			NetworkManager.__rpc_func_table.Add(2034514025u, new RpcReceiveHandler(__rpc_handler_2034514025));
			NetworkManager.__rpc_func_table.Add(767682336u, new RpcReceiveHandler(__rpc_handler_767682336));
			NetworkManager.__rpc_func_table.Add(3609940504u, new RpcReceiveHandler(__rpc_handler_3609940504));
			NetworkManager.__rpc_func_table.Add(574678194u, new RpcReceiveHandler(__rpc_handler_574678194));
			NetworkManager.__rpc_func_table.Add(1302763586u, new RpcReceiveHandler(__rpc_handler_1302763586));
		}

		private static void __rpc_handler_909026737(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_007c: 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_008b: 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_00bc: 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
			{
				bool setOn = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setOn, default(ForPrimitives));
				int track = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref track);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OldElevatorController)(object)target).SetElevatorMusicServerRpc(setOn, track);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2448796174(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool setOn = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setOn, default(ForPrimitives));
				int track = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref track);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((OldElevatorController)(object)target).SetElevatorMusicClientRpc(setOn, track);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_795077385(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_007c: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_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
			{
				bool atTop = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref atTop, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OldElevatorController)(object)target).ElevatorFinishServerRpc(atTop);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2034514025(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_007c: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_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
			{
				bool elevatorMovingServerRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref elevatorMovingServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((OldElevatorController)(object)target).SetElevatorMovingServerRpc(elevatorMovingServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		private static void __rpc_handler_574678194(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			//IL_005f: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool setCalled = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setCalled, default(ForPrimitives));
				bool elevatorDown = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref elevatorDown, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((OldElevatorController)(object)target).SetElevatorCalledClientRpc(setCalled, elevatorDown);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1302763586(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;
				((OldElevatorController)(object)target).PressElevatorButtonServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "OldElevatorController";
		}
	}
	public class PropTP : NetworkBehaviour
	{
		public GameObject[] scrapProps;

		public Vector3 telePosition;

		public GameObject[] scanNodes;

		private int scrapIndex = 0;

		private bool wasFallingLastFrame = false;

		private bool doingTP = false;

		public AudioSource clangPlayer;

		public float percentOfQuota = 20f;

		private Vector3 posDiff;

		private Vector3 posDiff1;

		private Vector3 posDiff2;

		private float fallTimeLastFrame;

		private float yLastFrame = 0f;

		private int scrapValue;

		private void Start()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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)
			//IL_001f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			posDiff = telePosition - scrapProps[0].transform.position;
			posDiff1 = scrapProps[1].transform.position - scrapProps[0].transform.position;
			posDiff2 = scrapProps[2].transform.position - scrapProps[0].transform.position;
		}

		private void Update()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			if (!doingTP)
			{
				return;
			}
			if ((scrapProps[scrapIndex].GetComponent<GrabbableObject>().fallTime >= 1f || scrapProps[scrapIndex].GetComponent<GrabbableObject>().fallTime < fallTimeLastFrame || (scrapProps[scrapIndex].transform.position.y == yLastFrame && yLastFrame < 112f)) && wasFallingLastFrame && ((NetworkBehaviour)this).IsServer)
			{
				CyclePropClientRpc();
				if (!doingTP || scrapIndex > 2)
				{
					Wither.Logger.LogDebug((object)"Prop TP finished.");
					return;
				}
			}
			if (scrapProps[scrapIndex].GetComponent<GrabbableObject>().fallTime < 1f)
			{
				wasFallingLastFrame = true;
			}
			fallTimeLastFrame = scrapProps[scrapIndex].GetComponent<GrabbableObject>().fallTime;
			yLastFrame = scrapProps[scrapIndex].transform.position.y;
		}

		public void TeleportProp()
		{
			doingTP = true;
			((MonoBehaviour)this).StartCoroutine(waitToEndOfFrameToFall());
		}

		private IEnumerator waitToEndOfFrameToFall()
		{
			yield return (object)new WaitForEndOfFrame();
			PropsTeleport();
		}

		public void PropsTeleport()
		{
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: 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_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: 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_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			int num = scrapIndex;
			int num2 = 0;
			switch (num)
			{
			case 0:
				scrapProps[num].transform.Rotate(0f, 0f, 227f, (Space)1);
				num2 = 227;
				break;
			case 1:
				scrapProps[num].transform.Rotate(0f, 0f, 45f, (Space)1);
				num2 = 45;
				break;
			default:
				scrapProps[num].transform.Rotate(0f, 0f, 110f, (Space)1);
				num2 = 110;
				break;
			}
			scrapProps[num].transform.position = scrapProps[num].transform.position + posDiff;
			float num3 = (float)TimeOfDay.Instance.profitQuota * (percentOfQuota / 300f);
			scrapValue = Mathf.RoundToInt(num3);
			if (scrapValue < 50)
			{
				scrapValue = 50;
			}
			else if (scrapValue > 250)
			{
				scrapValue = 250;
			}
			scrapProps[num].GetComponent<GrabbableObject>().scrapValue = scrapValue;
			scanNodes[num].GetComponentInChildren<ScanNodeProperties>().scrapValue = scrapValue;
			scanNodes[num].GetComponentInChildren<ScanNodeProperties>().subText = $"Value: {scrapValue}";
			Transform val = null;
			Ray val2 = default(Ray);
			((Ray)(ref val2))..ctor(scrapProps[num].transform.position, -Vector3.up);
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val2, ref val3, 80f, 1342179585, (QueryTriggerInteraction)1))
			{
				Debug.DrawRay(scrapProps[num].transform.position, -Vector3.up * 80f, Color.blue, 2f);
				val = ((Component)((RaycastHit)(ref val3)).collider).gameObject.transform;
			}
			if ((Object)(object)val != (Object)null)
			{
				Vector3 val4 = ((RaycastHit)(ref val3)).point + Vector3.up * 0.04f + scrapProps[num].GetComponent<GrabbableObject>().itemProperties.verticalOffset * Vector3.up;
				GrabbableObject component = scrapProps[num].GetComponent<GrabbableObject>();
				component.parentObject = null;
				component.EnablePhysics(true);
				component.EnableItemMeshes(true);
				component.isHeld = false;
				component.isPocketed = false;
				component.heldByPlayerOnServer = false;
				((Component)component).transform.localScale = component.originalScale;
				((Component)component).transform.position = ((Component)component).transform.position;
				component.startFallingPosition = ((Component)component).transform.position;
				component.targetFloorPosition = val4;
				component.floorYRot = num2;
				component.fallTime = 0f;
				DropObjectServerRpc(num2, val4, NetworkObjectReference.op_Implicit(scrapProps[num].GetComponent<NetworkObject>()), num);
			}
			else
			{
				Wither.Logger.LogDebug((object)$"Null transform at {num}");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void DropObjectServerRpc(int floorYRot, Vector3 hitPoint, NetworkObjectReference grabbedObject, int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			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(189131659u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, floorYRot);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref hitPoint);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref grabbedObject, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, index);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 189131659u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DropObjectClientRpc(floorYRot, hitPoint, grabbedObject, index);
				}
			}
		}

		[ClientRpc]
		private void DropObjectClientRpc(int floorYRot, Vector3 hitPoint, NetworkObjectReference grabbedObject, int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: 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(2629469171u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, floorYRot);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref hitPoint);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref grabbedObject, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2629469171u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			NetworkObject val3 = default(NetworkObject);
			if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val3, (NetworkManager)null))
			{
				GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
				component.parentObject = null;
				component.scrapValue = scrapValue;
				((Component)val3).GetComponentInChildren<ScanNodeProperties>().scrapValue = scrapValue;
				((Component)val3).GetComponentInChildren<ScanNodeProperties>().subText = $"Value: {scrapValue}";
				component.EnablePhysics(true);
				component.EnableItemMeshes(true);
				component.isHeld = false;
				component.isPocketed = false;
				component.heldByPlayerOnServer = false;
				((Component)component).transform.localScale = component.originalScale;
				switch (index)
				{
				case 0:
					((Component)component).transform.position = telePosition;
					component.startFallingPosition = telePosition;
					break;
				case 1:
					((Component)component).transform.position = telePosition + posDiff1;
					component.startFallingPosition = telePosition + posDiff1;
					break;
				case 2:
					((Component)component).transform.position = telePosition + posDiff2;
					component.startFallingPosition = telePosition + posDiff2;
					break;
				}
				component.startFallingPosition = ((Component)component).transform.position;
				component.targetFloorPosition = hitPoint;
				component.floorYRot = floorYRot;
				component.fallTime = 0f;
				if (!component.itemProperties.syncDiscardFunction)
				{
					component.playerHeldBy = null;
				}
			}
			else
			{
				Wither.Logger.LogDebug((object)"The server did not have a reference to the held object (when attempting to PLACE object on client.)");
			}
		}

		[ClientRpc]
		public void CyclePropClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2217024285u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2217024285u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				clangPlayer.PlayOneShot(scrapProps[scrapIndex].GetComponent<GrabbableObject>().itemProperties.dropSFX);
				WalkieTalkie.TransmitOneShotAudio(clangPlayer, scrapProps[scrapIndex].GetComponent<GrabbableObject>().itemProperties.dropSFX, 1f);
				wasFallingLastFrame = false;
				if (scrapIndex < 2)
				{
					scrapIndex++;
					TeleportProp();
				}
				else
				{
					doingTP = false;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_PropTP()
		{
			//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(189131659u, new RpcReceiveHandler(__rpc_handler_189131659));
			NetworkManager.__rpc_func_table.Add(2629469171u, new RpcReceiveHandler(__rpc_handler_2629469171));
			NetworkManager.__rpc_func_table.Add(2217024285u, new RpcReceiveHandler(__rpc_handler_2217024285));
		}

		private static void __rpc_handler_189131659(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int floorYRot = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref floorYRot);
				Vector3 hitPoint = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref hitPoint);
				NetworkObjectReference grabbedObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref grabbedObject, default(ForNetworkSerializable));
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PropTP)(object)target).DropObjectServerRpc(floorYRot, hitPoint, grabbedObject, index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2629469171(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int floorYRot = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref floorYRot);
				Vector3 hitPoint = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref hitPoint);
				NetworkObjectReference grabbedObject = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref grabbedObject, default(ForNetworkSerializable));
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((PropTP)(object)target).DropObjectClientRpc(floorYRot, hitPoint, grabbedObject, index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2217024285(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;
				((PropTP)(object)target).CyclePropClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "PropTP";
		}
	}
	public class RunAnimScripts : NetworkBehaviour
	{
		public GameObject scriptEvent;

		public AnimatedObjectTrigger animatedObjectTrigger;

		private void OnEnable()
		{
			animatedObjectTrigger.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
			scriptEvent.GetComponent<PropTP>().TeleportProp();
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}

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

		protected internal override string __getTypeName()
		{
			return "RunAnimScripts";
		}
	}
	public class TeleportDirect : NetworkBehaviour
	{
		public Transform destPoint;

		public StartOfRound playersManager;

		public int audioReverbPreset = -1;

		public AudioSource entrancePointAudio;

		public AudioSource destPointAudio;

		public AudioClip[] doorAudios;

		private InteractTrigger triggerScript;

		public float timeAtLastUse;

		public bool isEntrance = false;

		private void Awake()
		{
			playersManager = Object.FindObjectOfType<StartOfRound>();
			triggerScript = ((Component)this).gameObject.GetComponent<InteractTrigger>();
		}

		public void TeleportPlayer()
		{
			//IL_0021: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			Transform thisPlayerBody = GameNetworkManager.Instance.localPlayerController.thisPlayerBody;
			GameNetworkManager.Instance.localPlayerController.TeleportPlayer(destPoint.position, false, 0f, false, true);
			GameNetworkManager.Instance.localPlayerController.isInElevator = false;
			GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom = false;
			thisPlayerBody.eulerAngles = new Vector3(destPoint.eulerAngles.x, destPoint.eulerAngles.y, destPoint.eulerAngles.z);
			SetAudioPreset((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
			timeAtLastUse = Time.realtimeSinceStartup;
			TeleportDirectPlayerServerRpc((int)GameNetworkManager.Instance.localPlayerController.playerClientId);
			GameNetworkManager.Instance.localPlayerController.isInsideFactory = isEntrance;
		}

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

		[ClientRpc]
		public void TeleportDirectPlayerClientRpc(int playerObj)
		{
			//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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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(3599238303u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObj);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3599238303u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				playersManager.allPlayerScripts[playerObj].TeleportPlayer(destPoint.position, true, destPoint.eulerAngles.y, false, true);
				playersManager.allPlayerScripts[playerObj].isInElevator = false;
				playersManager.allPlayerScripts[playerObj].isInHangarShipRoom = false;
				PlayAudioAtTeleportPositions();
				playersManager.allPlayerScripts[playerObj].isInsideFactory = isEntrance;
				if (GameNetworkManager.Instance.localPlayerController.isPlayerDead && (Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript)
				{
					SetAudioPreset(playerObj);
				}
				timeAtLastUse = Time.realtimeSinceStartup;
			}
		}

		private void SetAudioPreset(int playerObj)
		{
			if (audioReverbPreset != -1)
			{
				Object.FindObjectOfType<AudioReverbPresets>().audioPresets[audioReverbPreset].ChangeAudioReverbForPlayer(StartOfRound.Instance.allPlayerScripts[playerObj]);
				if ((Object)(object)entrancePointAudio != (Object)null)
				{
					PlayAudioAtTeleportPositions();
				}
			}
		}

		public void PlayAudioAtTeleportPositions()
		{
			if (doorAudios.Length != 0)
			{
				entrancePointAudio.PlayOneShot(doorAudios[Random.Range(0, doorAudios.Length)]);
				destPointAudio.PlayOneShot(doorAudios[Random.Range(0, doorAudios.Length)]);
			}
		}

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

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

		private static void __rpc_handler_1357693788(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)
			{
				int playerObj = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObj);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((TeleportDirect)(object)target).TeleportDirectPlayerServerRpc(playerObj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3599238303(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)
			{
				int playerObj = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObj);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((TeleportDirect)(object)target).TeleportDirectPlayerClientRpc(playerObj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "TeleportDirect";
		}
	}
	[BepInPlugin("ScienceBird.Wither", "Wither", "1.0.0")]
	public class Wither : BaseUnityPlugin
	{
		public static AssetBundle NetworkAssets;

		public static Wither Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"ScienceBird.Wither v1.0.0 has loaded!");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			NetworkAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "withernetworkasset"));
			if (!((Object)(object)NetworkAssets == (Object)null))
			{
				NetcodePatcher();
			}
		}

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

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

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

		public const string PLUGIN_NAME = "Wither";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ScienceBird.Wither.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}