Decompiled source of Chocobo Getaway Moons v1.0.1

plugins/BlindPups.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BlindPups.NetcodePatcher;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Animations.Rigging;

[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("BlindPups")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BlindPups")]
[assembly: AssemblyTitle("BlindPups")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
		}
	}
}
namespace BlindPups
{
	[BepInPlugin("JacobG5.BlindPups", "BlindPups", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "JacobG5.BlindPups";

		private const string modName = "BlindPups";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("JacobG5.BlindPups");

		public static Plugin Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("JacobG5.BlindPups");
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			foreach (Type type in types)
			{
				try
				{
					MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array = methods;
					foreach (MethodInfo methodInfo in array)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
				catch
				{
					mls.LogInfo((object)"Skipping Netcode Class");
				}
			}
			mls.LogInfo((object)"Netcode Successfully Patched!");
		}
	}
}
namespace BlindPups.Components
{
	public class BlindPupAI : EnemyAI, INoiseListener, IVisibleThreat
	{
		[Header("Blind Pup")]
		public int playerDamage = 50;

		public int enemyDamage = 2;

		public float hearingThreshold = 18f;

		[Header("Vanilla Mouth Dog")]
		public float noiseApproximation = 14f;

		public int suspicionLevel;

		private Vector3 previousPosition;

		public DampedTransform neckDampedTransform;

		private float AITimer;

		private bool hasEnteredChaseModeFully;

		private bool startedChaseModeCoroutine;

		public AudioClip screamSFX;

		public AudioClip breathingSFX;

		public AudioClip killPlayerSFX;

		private float hearNoiseCooldown;

		private bool inLunge;

		private float lungeCooldown;

		private bool inKillAnimation;

		public Transform mouthGrip;

		public bool endingLunge;

		private Ray ray;

		private RaycastHit rayHit;

		private Vector3 lastHeardNoisePosition;

		private Vector3 noisePositionGuess;

		private float lastHeardNoiseDistanceWhenHeard;

		private bool heardOtherHowl;

		private DeadBodyInfo? carryingBody;

		private Coroutine killPlayerCoroutine;

		public AISearchRoutine roamPlanet;

		private Collider debugCollider;

		private float timeSinceHittingOtherEnemy;

		private float coweringMeter;

		private bool coweringOnFloor;

		private bool coweringOnFloorDebounce;

		ThreatType IVisibleThreat.type => (ThreatType)3;

		int IVisibleThreat.SendSpecialBehaviour(int id)
		{
			return 0;
		}

		int IVisibleThreat.GetThreatLevel(Vector3 seenByPosition)
		{
			int num = ((base.enemyHP >= 2) ? 5 : 3);
			if (base.creatureAnimator.GetBool("StartedChase"))
			{
				num += 3;
			}
			return num;
		}

		int IVisibleThreat.GetInterestLevel()
		{
			return 0;
		}

		Transform IVisibleThreat.GetThreatLookTransform()
		{
			return base.eye;
		}

		Transform IVisibleThreat.GetThreatTransform()
		{
			return ((Component)this).transform;
		}

		Vector3 IVisibleThreat.GetThreatVelocity()
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsOwner)
			{
				return base.agent.velocity;
			}
			return Vector3.zero;
		}

		float IVisibleThreat.GetVisibility()
		{
			if (base.isEnemyDead)
			{
				return 0f;
			}
			if (base.creatureAnimator.GetBool("StartedChase"))
			{
				return 1f;
			}
			return 0.75f;
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			_ = StartOfRound.Instance.livingPlayers;
		}

		public override void Start()
		{
			((EnemyAI)this).Start();
			base.useSecondaryAudiosOnAnimatedObjects = true;
			if (Random.Range(0, 10) < 2)
			{
				base.creatureVoice.pitch = Random.Range(0.6f, 1.3f);
			}
			else
			{
				base.creatureVoice.pitch = Random.Range(0.9f, 1.1f);
			}
		}

		public override void Update()
		{
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				base.creatureAnimator.SetLayerWeight(1, 0f);
			}
			else
			{
				if (!base.ventAnimationFinished)
				{
					return;
				}
				if (base.stunNormalizedTimer > 0f && !base.isEnemyDead)
				{
					if ((Object)(object)base.stunnedByPlayer != (Object)null && base.currentBehaviourStateIndex != 2 && ((NetworkBehaviour)this).IsOwner)
					{
						EnrageDogOnLocalClient(((Component)base.stunnedByPlayer).transform.position, Vector3.Distance(((Component)this).transform.position, ((Component)base.stunnedByPlayer).transform.position));
					}
					base.creatureAnimator.SetLayerWeight(1, 1f);
				}
				else
				{
					base.creatureAnimator.SetLayerWeight(1, 0f);
				}
				base.hitsPhysicsObjects = base.currentBehaviourStateIndex >= 2;
				if (!coweringOnFloor)
				{
					if (!coweringOnFloorDebounce)
					{
						coweringOnFloorDebounce = true;
						base.creatureAnimator.SetBool("Cower", false);
					}
					if (coweringMeter >= 0f)
					{
						coweringMeter -= Time.deltaTime;
					}
				}
				else
				{
					if (coweringOnFloorDebounce)
					{
						coweringOnFloorDebounce = false;
						base.creatureAnimator.SetBool("Cower", true);
						base.creatureAnimator.SetTrigger("StartCowering");
					}
					if (coweringMeter < 0.7f)
					{
						coweringMeter += Time.deltaTime;
					}
				}
				hearNoiseCooldown -= Time.deltaTime;
				timeSinceHittingOtherEnemy += Time.deltaTime;
				Animator creatureAnimator = base.creatureAnimator;
				Vector3 val = Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f);
				creatureAnimator.SetFloat("speedMultiplier", ((Vector3)(ref val)).sqrMagnitude / (Time.deltaTime / 4f));
				previousPosition = ((Component)this).transform.position;
				if (base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 3)
				{
					if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 50f, 25, 10f))
					{
						GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.4f, 0.5f);
					}
				}
				else if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)this).transform.position, 50f, 30, 5f))
				{
					GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.25f, 0.3f);
				}
				switch (base.currentBehaviourStateIndex)
				{
				case 0:
					((RigConstraint<DampedTransformJob, DampedTransformData, DampedTransformJobBinder<DampedTransformData>>)(object)neckDampedTransform).weight = 1f;
					base.creatureAnimator.SetInteger("BehaviourState", 0);
					if (((NetworkBehaviour)this).IsOwner)
					{
						base.agent.speed = 3.5f;
						if (base.stunNormalizedTimer > 0f || coweringOnFloor)
						{
							base.agent.speed = 0f;
						}
						if (((NetworkBehaviour)this).IsOwner && !roamPlanet.inProgress)
						{
							((EnemyAI)this).StartSearch(((Component)this).transform.position, roamPlanet);
						}
					}
					break;
				case 1:
					if (hasEnteredChaseModeFully)
					{
						hasEnteredChaseModeFully = false;
						base.creatureVoice.Stop();
						startedChaseModeCoroutine = false;
						base.creatureAnimator.SetBool("StartedChase", false);
					}
					((RigConstraint<DampedTransformJob, DampedTransformData, DampedTransformJobBinder<DampedTransformData>>)(object)neckDampedTransform).weight = Mathf.Lerp(((RigConstraint<DampedTransformJob, DampedTransformData, DampedTransformJobBinder<DampedTransformData>>)(object)neckDampedTransform).weight, 1f, 8f * Time.deltaTime);
					base.creatureAnimator.SetInteger("BehaviourState", 1);
					if (!((NetworkBehaviour)this).IsOwner)
					{
						break;
					}
					if (((NetworkBehaviour)this).IsOwner && roamPlanet.inProgress)
					{
						((EnemyAI)this).StopSearch(roamPlanet, true);
					}
					base.agent.speed = 4.5f;
					if (base.stunNormalizedTimer > 0f || coweringOnFloor)
					{
						base.agent.speed = 0f;
					}
					AITimer -= Time.deltaTime;
					if (AITimer <= 0f)
					{
						AITimer = 4f;
						suspicionLevel--;
						if (suspicionLevel <= 1)
						{
							((EnemyAI)this).SwitchToBehaviourState(0);
						}
					}
					break;
				case 2:
					if (!hasEnteredChaseModeFully)
					{
						if (!startedChaseModeCoroutine)
						{
							startedChaseModeCoroutine = true;
							((MonoBehaviour)this).StartCoroutine(EnterChaseMode());
						}
						break;
					}
					((RigConstraint<DampedTransformJob, DampedTransformData, DampedTransformJobBinder<DampedTransformData>>)(object)neckDampedTransform).weight = Mathf.Lerp(((RigConstraint<DampedTransformJob, DampedTransformData, DampedTransformJobBinder<DampedTransformData>>)(object)neckDampedTransform).weight, 0.2f, 8f * Time.deltaTime);
					base.creatureAnimator.SetInteger("BehaviourState", 2);
					if (!((NetworkBehaviour)this).IsOwner)
					{
						break;
					}
					if (((NetworkBehaviour)this).IsOwner && roamPlanet.inProgress)
					{
						((EnemyAI)this).StopSearch(roamPlanet, true);
					}
					if (!inLunge)
					{
						lungeCooldown -= Time.deltaTime;
						if (Vector3.Distance(((Component)this).transform.position, noisePositionGuess) < 4f && lungeCooldown <= 0f)
						{
							inLunge = true;
							EnterLunge();
							break;
						}
					}
					base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime, 13f, 18f);
					if (base.stunNormalizedTimer > 0f || coweringOnFloor)
					{
						base.agent.speed = 0f;
					}
					AITimer -= Time.deltaTime;
					if (AITimer <= 0f)
					{
						AITimer = 3f;
						suspicionLevel--;
						if (Vector3.Distance(((Component)this).transform.position, base.agent.destination) < 3f)
						{
							SearchForPreviouslyHeardSound();
						}
						if (suspicionLevel <= 8)
						{
							((EnemyAI)this).SwitchToBehaviourState(1);
						}
					}
					break;
				case 3:
					if (((NetworkBehaviour)this).IsOwner)
					{
						NavMeshAgent agent = base.agent;
						agent.speed -= Time.deltaTime * 5f;
						if (!endingLunge && base.agent.speed < 1.5f && !inKillAnimation)
						{
							endingLunge = true;
							lungeCooldown = 0.25f;
							EndLungeServerRpc();
						}
					}
					break;
				}
			}
		}

		private void SearchForPreviouslyHeardSound()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			Vector3 val = ((Component)this).transform.position;
			while (num < 5 && Vector3.Distance(val, ((Component)this).transform.position) < 4f)
			{
				num++;
				val = RoundManager.Instance.GetRandomNavMeshPositionInRadius(lastHeardNoisePosition, lastHeardNoiseDistanceWhenHeard / noiseApproximation, default(NavMeshHit));
			}
			((EnemyAI)this).SetDestinationToPosition(val, false);
			noisePositionGuess = val;
		}

		private IEnumerator EnterChaseMode()
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				base.agent.speed = 0.05f;
			}
			DropCarriedBody();
			base.creatureVoice.PlayOneShot(screamSFX);
			if (!base.isEnemyDead)
			{
				base.creatureAnimator.SetTrigger("ChaseHowl");
			}
			if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 16f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
				GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(0.5f, true);
			}
			yield return (object)new WaitForSeconds(0.5f);
			if (!heardOtherHowl)
			{
				CallAllDogsWithHowl();
			}
			heardOtherHowl = false;
			yield return (object)new WaitForSeconds(0.2f);
			base.creatureVoice.clip = breathingSFX;
			base.creatureVoice.Play();
			base.creatureAnimator.SetBool("StartedChase", true);
			hasEnteredChaseModeFully = true;
			base.creatureVoice.PlayOneShot(breathingSFX);
		}

		private void CallAllDogsWithHowl()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			MouthDogAI[] array = Object.FindObjectsOfType<MouthDogAI>();
			for (int i = 0; i < array.Length; i++)
			{
				if (!((Object)(object)array[i] == (Object)(object)this))
				{
					array[i].ReactToOtherDogHowl(((Component)this).transform.position);
				}
			}
		}

		public void ReactToOtherDogHowl(Vector3 howlPosition)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_0074: 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)
			heardOtherHowl = true;
			lastHeardNoiseDistanceWhenHeard = Vector3.Distance(((Component)this).transform.position, howlPosition);
			noisePositionGuess = RoundManager.Instance.GetRandomNavMeshPositionInRadius(howlPosition, lastHeardNoiseDistanceWhenHeard / noiseApproximation, default(NavMeshHit));
			((EnemyAI)this).SetDestinationToPosition(noisePositionGuess, false);
			if (base.currentBehaviourStateIndex < 2)
			{
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			}
			suspicionLevel = 8;
			lastHeardNoisePosition = howlPosition;
			Debug.Log((object)$"Setting lastHeardNoisePosition to {howlPosition}");
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesNoisePlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesNoisePlayedInOneSpot, noiseID);
			if (base.stunNormalizedTimer > 0f || noiseID == 7 || noiseID == 546 || inKillAnimation || hearNoiseCooldown >= 0f || timesNoisePlayedInOneSpot > 15)
			{
				return;
			}
			hearNoiseCooldown = 0.03f;
			float num = Vector3.Distance(((Component)this).transform.position, noisePosition);
			Debug.Log((object)$"dog '{((Object)((Component)this).gameObject).name}': Heard noise! Distance: {num} meters");
			float num2 = hearingThreshold * noiseLoudness;
			if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
			{
				noiseLoudness /= 2f;
				num2 /= 2f;
			}
			if (noiseLoudness < 0.25f)
			{
				return;
			}
			if (base.currentBehaviourStateIndex < 2 && num < num2)
			{
				suspicionLevel = 9;
			}
			else
			{
				suspicionLevel++;
			}
			bool fullyEnrage = false;
			if (suspicionLevel >= 9)
			{
				if (base.currentBehaviourStateIndex < 2)
				{
					fullyEnrage = true;
				}
			}
			else if (suspicionLevel >= 5 && base.currentBehaviourStateIndex == 0)
			{
				fullyEnrage = false;
			}
			AITimer = 3f;
			EnrageDogOnLocalClient(noisePosition, num, approximatePosition: true, fullyEnrage);
		}

		private void EnrageDogOnLocalClient(Vector3 targetPosition, float distanceToNoise, bool approximatePosition = true, bool fullyEnrage = false)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)$"Mouth dog targetPos 1: {targetPosition}; distanceToNoise: {distanceToNoise}");
			if (approximatePosition)
			{
				targetPosition = RoundManager.Instance.GetRandomNavMeshPositionInRadius(targetPosition, distanceToNoise / noiseApproximation, default(NavMeshHit));
			}
			noisePositionGuess = targetPosition;
			Debug.Log((object)$"Mouth dog targetPos 2: {targetPosition}");
			if (fullyEnrage)
			{
				if (base.currentBehaviourStateIndex < 2)
				{
					((EnemyAI)this).SwitchToBehaviourState(2);
					hearNoiseCooldown = 1f;
					suspicionLevel = 12;
				}
				suspicionLevel = Mathf.Clamp(suspicionLevel, 0, 11);
			}
			else if (base.currentBehaviourStateIndex == 0)
			{
				((EnemyAI)this).SwitchToBehaviourState(1);
			}
			if (!((NetworkBehaviour)this).IsOwner)
			{
				((EnemyAI)this).ChangeOwnershipOfEnemy(NetworkManager.Singleton.LocalClientId);
			}
			if (!inLunge)
			{
				((EnemyAI)this).SetDestinationToPosition(noisePositionGuess, false);
			}
			lastHeardNoiseDistanceWhenHeard = distanceToNoise;
			lastHeardNoisePosition = targetPosition;
			Debug.Log((object)$"Dog lastheardnoisePosition: {lastHeardNoisePosition}");
		}

		private void EnterLunge()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsOwner)
			{
				((EnemyAI)this).ChangeOwnershipOfEnemy(NetworkManager.Singleton.LocalClientId);
			}
			((EnemyAI)this).SwitchToBehaviourState(3);
			endingLunge = false;
			ray = new Ray(((Component)this).transform.position + Vector3.up, ((Component)this).transform.forward);
			Vector3 val = ((!Physics.Raycast(ray, ref rayHit, 17f, StartOfRound.Instance.collidersAndRoomMask)) ? ((Ray)(ref ray)).GetPoint(17f) : ((RaycastHit)(ref rayHit)).point);
			val = RoundManager.Instance.GetNavMeshPosition(val, default(NavMeshHit), 5f, -1);
			((EnemyAI)this).SetDestinationToPosition(val, false);
			base.agent.speed = 13f;
		}

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

		[ClientRpc]
		public void EndLungeClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3443765605u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3443765605u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
				if (!base.isEnemyDead)
				{
					base.creatureAnimator.SetTrigger("EndLungeNoKill");
				}
				inLunge = false;
				Debug.Log((object)"Ending lunge");
			}
		}

		private void ChaseLocalPlayer()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).SwitchToBehaviourState(2);
			((EnemyAI)this).ChangeOwnershipOfEnemy(NetworkManager.Singleton.LocalClientId);
			((EnemyAI)this).SetDestinationToPosition(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, false);
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (base.enemyHP <= 0)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
					return;
				}
				if (inKillAnimation)
				{
					StopKillAnimationServerRpc();
				}
			}
			if ((Object)(object)playerWhoHit != (Object)null && base.currentBehaviourStateIndex != 2 && ((NetworkBehaviour)this).IsOwner)
			{
				EnrageDogOnLocalClient(((Component)playerWhoHit).transform.position, Vector3.Distance(((Component)this).transform.position, ((Component)playerWhoHit).transform.position));
			}
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI? collidedEnemy = null)
		{
			//IL_0067: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
			if ((Object)(object)collidedEnemy != (Object)null && (Object)(object)collidedEnemy.enemyType != (Object)(object)base.enemyType && timeSinceHittingOtherEnemy >= 1f)
			{
				if (base.currentBehaviourStateIndex == 2 && !inLunge)
				{
					((Component)this).transform.LookAt(((Component)other).transform.position);
					((Component)this).transform.localEulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
					inLunge = true;
					EnterLunge();
				}
				timeSinceHittingOtherEnemy = 0f;
				collidedEnemy.HitEnemy(enemyDamage, (PlayerControllerB)null, true, -1);
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, inKillAnimation, false);
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			VehicleController val2 = Object.FindObjectOfType<VehicleController>();
			if ((Object)(object)val2 != (Object)null && (Object)(object)val.physicsParent != (Object)null && (Object)(object)val.physicsParent == (Object)(object)((Component)val2).transform && !val2.backDoorOpen)
			{
				return;
			}
			Vector3 val3 = Vector3.Normalize((((Component)this).transform.position + Vector3.up - ((Component)val.gameplayCamera).transform.position) * 100f);
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Linecast(((Component)this).transform.position + Vector3.up + val3 * 0.5f, ((Component)val.gameplayCamera).transform.position, ref val4, StartOfRound.Instance.collidersAndRoomMask, (QueryTriggerInteraction)1))
			{
				if (!((Object)(object)((RaycastHit)(ref val4)).collider == (Object)(object)debugCollider))
				{
					debugCollider = ((RaycastHit)(ref val4)).collider;
				}
			}
			else if (!val.inVehicleAnimation || !(Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) > 3f))
			{
				if (base.currentBehaviourStateIndex == 3)
				{
					val.inAnimationWithEnemy = (EnemyAI)(object)this;
					KillPlayerServerRpc((int)val.playerClientId);
				}
				else if (base.currentBehaviourStateIndex == 0 || base.currentBehaviourStateIndex == 1)
				{
					ChaseLocalPlayer();
				}
				else if (base.currentBehaviourStateIndex == 2 && !inLunge)
				{
					((Component)this).transform.LookAt(((Component)other).transform.position);
					((Component)this).transform.localEulerAngles = new Vector3(0f, ((Component)this).transform.eulerAngles.y, 0f);
					inLunge = true;
					EnterLunge();
				}
			}
		}

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

		[ClientRpc]
		public void CancelKillAnimationWithPlayerClientRpc(int playerObjectId)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1417954382u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerObjectId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1417954382u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					StartOfRound.Instance.allPlayerScripts[playerObjectId].inAnimationWithEnemy = null;
				}
			}
		}

		[ClientRpc]
		public void KillPlayerClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(233721520u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 233721520u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Debug.Log((object)"Kill player rpc");
				if (killPlayerCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(killPlayerCoroutine);
				}
				killPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(KillPlayer(playerId));
			}
		}

		private IEnumerator KillPlayer(int playerId)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				base.agent.speed = Mathf.Clamp(base.agent.speed, 2f, 0f);
			}
			base.creatureVoice.pitch = Random.Range(0.96f, 1.04f);
			base.creatureVoice.PlayOneShot(killPlayerSFX, 1f);
			PlayerControllerB killPlayer = StartOfRound.Instance.allPlayerScripts[playerId];
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)killPlayer)
			{
				killPlayer.DamagePlayer(playerDamage, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
			}
			float startTime = Time.timeSinceLevelLoad;
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)killPlayer.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 2f));
			if ((Object)(object)killPlayer.deadBody == (Object)null)
			{
				Debug.Log((object)"Giant dog: Player body was not spawned or found within 2 seconds.");
				killPlayer.inAnimationWithEnemy = null;
				inKillAnimation = false;
				yield break;
			}
			TakeBodyInMouth(killPlayer.deadBody);
			startTime = Time.timeSinceLevelLoad;
			Quaternion rotateTo = Quaternion.Euler(new Vector3(0f, RoundManager.Instance.YRotationThatFacesTheFarthestFromPosition(((Component)this).transform.position + Vector3.up * 0.6f, 25f, 6), 0f));
			Quaternion rotateFrom = ((Component)this).transform.rotation;
			while (Time.timeSinceLevelLoad - startTime < 2f)
			{
				yield return null;
				if (((NetworkBehaviour)this).IsOwner)
				{
					((Component)this).transform.rotation = Quaternion.RotateTowards(rotateFrom, rotateTo, 60f * Time.deltaTime);
				}
			}
			yield return (object)new WaitForSeconds(3.01f);
			DropCarriedBody();
			suspicionLevel = 2;
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			endingLunge = true;
			inKillAnimation = false;
		}

		private void StopKillAnimation()
		{
			if (killPlayerCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(killPlayerCoroutine);
			}
			base.creatureVoice.Stop();
			DropCarriedBody();
			suspicionLevel = 2;
			((EnemyAI)this).SwitchToBehaviourStateOnLocalClient(2);
			endingLunge = true;
			inKillAnimation = false;
		}

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

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

		private void TakeBodyInMouth(DeadBodyInfo body)
		{
			carryingBody = body;
			carryingBody.attachedTo = mouthGrip;
			carryingBody.attachedLimb = body.bodyParts[5];
			carryingBody.matchPositionExactly = true;
		}

		private void DropCarriedBody()
		{
			if (!((Object)(object)carryingBody == (Object)null))
			{
				carryingBody.speedMultiplier = 12f;
				carryingBody.attachedTo = null;
				carryingBody.attachedLimb = null;
				carryingBody.matchPositionExactly = false;
				carryingBody = null;
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			StopKillAnimation();
			base.creatureVoice.Stop();
			base.creatureSFX.Stop();
			((EnemyAI)this).KillEnemy(destroy);
		}

		public override void ReceiveLoudNoiseBlast(Vector3 position, float angle)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).ReceiveLoudNoiseBlast(position, angle);
			if (angle < 30f)
			{
				coweringOnFloor = true;
			}
		}

		public override void EnableEnemyMesh(bool enable, bool overrideDoNotSet = false)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).EnableEnemyMesh(enable, false);
			ParticleSystem[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<ParticleSystem>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				MainModule main = componentsInChildren[i].main;
				((MainModule)(ref main)).playOnAwake = ((Behaviour)this).enabled;
			}
		}

		public override void OnDrawGizmos()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).OnDrawGizmos();
			if (base.debugEnemyAI)
			{
				Gizmos.DrawCube(noisePositionGuess, Vector3.one);
				Gizmos.DrawLine(noisePositionGuess, ((Component)this).transform.position + Vector3.up);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BlindPupAI()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3106330922u, new RpcReceiveHandler(__rpc_handler_3106330922));
			NetworkManager.__rpc_func_table.Add(3443765605u, new RpcReceiveHandler(__rpc_handler_3443765605));
			NetworkManager.__rpc_func_table.Add(4001558559u, new RpcReceiveHandler(__rpc_handler_4001558559));
			NetworkManager.__rpc_func_table.Add(1417954382u, new RpcReceiveHandler(__rpc_handler_1417954382));
			NetworkManager.__rpc_func_table.Add(233721520u, new RpcReceiveHandler(__rpc_handler_233721520));
			NetworkManager.__rpc_func_table.Add(3999301457u, new RpcReceiveHandler(__rpc_handler_3999301457));
			NetworkManager.__rpc_func_table.Add(776545170u, new RpcReceiveHandler(__rpc_handler_776545170));
		}

		private static void __rpc_handler_3106330922(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;
				((BlindPupAI)(object)target).EndLungeServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3443765605(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;
				((BlindPupAI)(object)target).EndLungeClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4001558559(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BlindPupAI)(object)target).KillPlayerServerRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1417954382(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 playerObjectId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BlindPupAI)(object)target).CancelKillAnimationWithPlayerClientRpc(playerObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_233721520(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 playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BlindPupAI)(object)target).KillPlayerClientRpc(playerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3999301457(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;
				((BlindPupAI)(object)target).StopKillAnimationServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_776545170(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;
				((BlindPupAI)(object)target).StopKillAnimationClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BlindPupAI";
		}
	}
}
namespace BlindPups.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}

plugins/ScienceBird.Wither.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ScienceBird.Wither.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using WeatherRegistry;
using Wither.Patches;

[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+fff23cf0a32e1751435014f304377d754ec02caf")]
[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;
		}
	}
}
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 static bool isInFalseInterior;

		public StartOfRound playersManager;

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

		private void OnTriggerEnter(Collider other)
		{
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			component.isInElevator = false;
			component.isInHangarShipRoom = false;
			for (int i = 0; i < component.ItemSlots.Length; i++)
			{
				if ((Object)(object)component.ItemSlots[i] != (Object)null)
				{
					component.ItemSlots[i].isInFactory = true;
				}
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)component)
			{
				isInFalseInterior = true;
			}
			component.isInsideFactory = true;
		}

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

		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;

		public NetworkObject apparatusContainer;

		public static bool doingInsertion;

		private bool initialSet = true;

		private NetworkObject networkedApp;

		private void Update()
		{
			if (initialSet)
			{
				playersManager = Object.FindObjectOfType<StartOfRound>();
				initialSet = false;
				doingInsertion = false;
			}
			if (isInserted)
			{
				return;
			}
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && (GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemName.Contains("Apparatus") || GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemName.Contains("apparatus")) && !GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemName.Contains("concept"))
			{
				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()
		{
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)localPlayerController.currentlyHeldObjectServer != (Object)null) || (!localPlayerController.currentlyHeldObjectServer.itemProperties.itemName.Contains("Apparatus") && !localPlayerController.currentlyHeldObjectServer.itemProperties.itemName.Contains("apparatus")) || localPlayerController.currentlyHeldObjectServer.itemProperties.itemName.Contains("concept") || localPlayerController.isGrabbingObjectAnimation)
			{
				return;
			}
			if ((Object)(object)localPlayerController.currentlyHeldObjectServer.radarIcon != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)localPlayerController.currentlyHeldObjectServer.radarIcon).gameObject);
			}
			if ((Object)(object)((Component)localPlayerController.currentlyHeldObjectServer).gameObject.GetComponentInChildren<ScanNodeProperties>() != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)((Component)localPlayerController.currentlyHeldObjectServer).gameObject.GetComponentInChildren<ScanNodeProperties>()).gameObject);
			}
			AudioSource[] componentsInChildren = ((Component)localPlayerController.currentlyHeldObjectServer).GetComponentsInChildren<AudioSource>();
			if (componentsInChildren != null)
			{
				AudioSource[] array = componentsInChildren;
				foreach (AudioSource val in array)
				{
					val.Stop();
				}
			}
			DestroyChildObjectsServerRpc((int)localPlayerController.playerClientId);
			ParentObjectToSlotServerRpc(NetworkObjectReference.op_Implicit(((Component)localPlayerController.currentlyHeldObjectServer).gameObject.GetComponent<NetworkObject>()));
			localPlayerController.DiscardHeldObject(true, apparatusContainer, new Vector3(0f, 0f, 0f), false);
			AudioSource component = ((Component)apparatusContainer).GetComponent<AudioSource>();
			if ((Object)(object)component != (Object)null)
			{
				component.Play();
			}
			else
			{
				Wither.Logger.LogError((object)"Null audio player!");
			}
			objectsEnableTrigger.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
			animatedDoorTrigger.TriggerAnimation(GameNetworkManager.Instance.localPlayerController);
		}

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

		[ClientRpc]
		public void DestroyChildObjectsClientRpc(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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1556476157u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObj);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1556476157u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			doingInsertion = true;
			if ((Object)(object)playersManager.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return;
			}
			if ((Object)(object)playersManager.allPlayerScripts[playerObj].currentlyHeldObjectServer.radarIcon != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)playersManager.allPlayerScripts[playerObj].currentlyHeldObjectServer.radarIcon).gameObject);
			}
			if ((Object)(object)((Component)((Component)playersManager.allPlayerScripts[playerObj].currentlyHeldObjectServer).gameObject.GetComponentInChildren<ScanNodeProperties>()).gameObject != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)((Component)playersManager.allPlayerScripts[playerObj].currentlyHeldObjectServer).gameObject.GetComponentInChildren<ScanNodeProperties>()).gameObject);
			}
			AudioSource[] componentsInChildren = ((Component)playersManager.allPlayerScripts[playerObj].currentlyHeldObjectServer).GetComponentsInChildren<AudioSource>();
			if (componentsInChildren != null)
			{
				AudioSource[] array = componentsInChildren;
				foreach (AudioSource val3 in array)
				{
					val3.Stop();
				}
			}
			AudioSource component = ((Component)apparatusContainer).GetComponent<AudioSource>();
			if ((Object)(object)component != (Object)null)
			{
				component.Play();
			}
			else
			{
				Wither.Logger.LogError((object)"Null audio player!");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ParentObjectToSlotServerRpc(NetworkObjectReference grabbableObjectNetObject)
		{
			//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)
			//IL_00eb: 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(2703564353u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref grabbableObjectNetObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2703564353u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref networkedApp, (NetworkManager)null))
				{
					ParentObjectToSlotClientRpc(grabbableObjectNetObject);
				}
				else
				{
					Wither.Logger.LogError((object)"ServerRpc: Could not find networked apparatus.");
				}
			}
		}

		[ClientRpc]
		public void ParentObjectToSlotClientRpc(NetworkObjectReference grabbableObjectNetObject)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3841800363u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref grabbableObjectNetObject, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3841800363u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkObjectReference)(ref grabbableObjectNetObject)).TryGet(ref networkedApp, (NetworkManager)null))
				{
					((Component)networkedApp).gameObject.GetComponentInChildren<GrabbableObject>().EnablePhysics(false);
					((Component)networkedApp).gameObject.GetComponentInChildren<GrabbableObject>().grabbable = false;
				}
				else
				{
					Wither.Logger.LogError((object)"ClientRpc: Could not find networked apparatus.");
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_InsertApparatus()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3932721504u, new RpcReceiveHandler(__rpc_handler_3932721504));
			NetworkManager.__rpc_func_table.Add(1556476157u, new RpcReceiveHandler(__rpc_handler_1556476157));
			NetworkManager.__rpc_func_table.Add(2703564353u, new RpcReceiveHandler(__rpc_handler_2703564353));
			NetworkManager.__rpc_func_table.Add(3841800363u, new RpcReceiveHandler(__rpc_handler_3841800363));
		}

		private static void __rpc_handler_3932721504(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;
				((InsertApparatus)(object)target).DestroyChildObjectsServerRpc(playerObj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1556476157(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;
				((InsertApparatus)(object)target).DestroyChildObjectsClientRpc(playerObj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

		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;

		public AudioClip rumbleClip;

		private float loopTimer = 2f;

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

		public void LoopAudio()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (!hornPlayer.isPlaying)
			{
				hornPlayer.Play();
				loopCounter--;
				if (!GameNetworkManager.Instance.localPlayerController.isInsideFactory)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
					SoundManager.Instance.PlaySoundAroundLocalPlayer(rumbleClip, 0.65f);
				}
			}
			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)
			{
				if ((Object)(object)Instance != (Object)null)
				{
					GameObject gameObject = ((Component)Instance).gameObject;
					if (gameObject != null)
					{
						NetworkObject component = gameObject.GetComponent<NetworkObject>();
						if (component != null)
						{
							component.Despawn(true);
						}
					}
				}
				else
				{
					Wither.Logger.LogWarning((object)"Null instance! Network object despawn failed.");
				}
			}
			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 ScanNodeProperties[] scanNodes;

		private int scrapIndex = -1;

		private bool wasFallingLastFrame = false;

		public static bool doingTP;

		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 = 0;

		private bool delayedTP = false;

		private bool foundPrefabs = false;

		private int failCount = 0;

		private string[] scrapNames = new string[3] { "WitheredRobotToy(Clone)", "WitheredOldPhone(Clone)", "WitheredDentures(Clone)" };

		private float[] randomWeights = new float[3];

		private bool initialSet = true;

		private Random weightRandom;

		public static bool propReady;

		private int propCycleFailsafe = 0;

		private void Update()
		{
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: 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_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			if (initialSet && SeedWeightRandom.randomWeightsTemp[0] > 0f)
			{
				propReady = false;
				randomWeights = SeedWeightRandom.randomWeightsTemp;
				initialSet = false;
				SeedWeightRandom.randomWeightsTemp = new float[3];
			}
			if (!foundPrefabs)
			{
				int i;
				for (i = 0; i < 3; i++)
				{
					if (Object.op_Implicit((Object)(object)GameObject.Find(scrapNames[i])))
					{
						GameObject[] array = (from obj in Resources.FindObjectsOfTypeAll<GameObject>()
							where ((Object)obj).name == scrapNames[i]
							select obj).ToArray();
						if (array.Length > 1)
						{
							GameObject[] array2 = array;
							foreach (GameObject val in array2)
							{
								if (!val.GetComponent<GrabbableObject>().isInShipRoom && !val.GetComponent<GrabbableObject>().scrapPersistedThroughRounds)
								{
									scrapProps[i] = val;
									break;
								}
							}
						}
						else
						{
							scrapProps[i] = GameObject.Find(scrapNames[i]);
						}
						if (i == 0)
						{
							Wither.Logger.LogDebug((object)"Found prefabs!");
							foundPrefabs = true;
						}
					}
					else
					{
						foundPrefabs = false;
					}
				}
				GameObject val2 = GameObject.Find("DyingLungApparatus(Clone)");
				GameObject[] array3 = (from obj in Resources.FindObjectsOfTypeAll<GameObject>()
					where ((Object)obj).name == "DyingLungApparatus(Clone)"
					select obj).ToArray();
				if (array3.Length > 1)
				{
					GameObject[] array4 = array3;
					foreach (GameObject val3 in array4)
					{
						if (!val3.GetComponent<GrabbableObject>().isInShipRoom && !val3.GetComponent<GrabbableObject>().scrapPersistedThroughRounds)
						{
							Wither.Logger.LogDebug((object)"Found apparatus!");
							val2 = val3;
							break;
						}
					}
				}
				LungProp componentInChildren = val2.GetComponentInChildren<LungProp>();
				componentInChildren.isLungPowered = true;
				componentInChildren.isLungDocked = true;
				AudioSource componentInChildren2 = val2.GetComponentInChildren<AudioSource>();
				componentInChildren2.loop = true;
				componentInChildren2.Play();
				if (foundPrefabs)
				{
					for (int l = 0; l < 3; l++)
					{
						scanNodes[l] = scrapProps[l].GetComponentInChildren<ScanNodeProperties>();
					}
					telePosition += new Vector3(0.5f, 0f, 0.5f);
					posDiff = telePosition - scrapProps[0].transform.position;
					posDiff1 = scrapProps[1].transform.position - scrapProps[0].transform.position;
					posDiff2 = scrapProps[2].transform.position - scrapProps[0].transform.position;
				}
				else
				{
					failCount++;
				}
				if (failCount >= 100)
				{
					foundPrefabs = true;
				}
			}
			if (!doingTP || scrapIndex < 0)
			{
				return;
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				propCycleFailsafe++;
				if (propCycleFailsafe >= 150)
				{
					Wither.Logger.LogWarning((object)"Never recieved fall! Falling back to failsafe...");
					propReady = true;
				}
			}
			GrabbableObject component = scrapProps[scrapIndex].GetComponent<GrabbableObject>();
			if (propReady && ((NetworkBehaviour)this).IsServer)
			{
				propCycleFailsafe = 0;
				propReady = false;
				Wither.Logger.LogDebug((object)"Cycling prop...");
				CyclePropClientRpc();
				if (!doingTP || scrapIndex > 2)
				{
					Wither.Logger.LogInfo((object)"Prop TP finished.");
					doingTP = false;
					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_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: 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_0226: 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_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			scrapIndex++;
			int num = scrapIndex;
			int num2 = 0;
			float num3 = (float)TimeOfDay.Instance.profitQuota * (percentOfQuota / 300f);
			if (num3 < 50f)
			{
				num3 = 50f;
			}
			float num4 = randomWeights[num];
			num3 *= num4;
			scrapValue = Mathf.RoundToInt(num3);
			if (scrapValue < 50)
			{
				scrapValue = 50;
			}
			else if (scrapValue > 300)
			{
				scrapValue = 300;
			}
			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].GetComponent<GrabbableObject>().grabbable = false;
			scrapProps[num].transform.position = scrapProps[num].transform.position + posDiff;
			scrapProps[num].GetComponent<GrabbableObject>().scrapValue = scrapValue;
			scanNodes[num].scrapValue = scrapValue;
			scanNodes[num].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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: 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_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: 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.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))
			{
				return;
			}
			if (scrapIndex > 2 || scrapIndex < 0)
			{
				Wither.Logger.LogError((object)$"Invalid scrap index {scrapIndex}!");
				if (scrapIndex < 0)
				{
					TeleportProp();
				}
				else if (scrapIndex > 2)
				{
					Wither.Logger.LogDebug((object)"Making props grabbable... (EDGE CASE)");
					for (int i = 0; i < 3; i++)
					{
						AnimatedItem componentInChildren = scrapProps[i].GetComponentInChildren<AnimatedItem>();
						if (componentInChildren.itemRandomChance == null)
						{
							Wither.Logger.LogInfo((object)"Fixing System.Random!");
							componentInChildren.itemRandomChance = new Random(StartOfRound.Instance.randomMapSeed + StartOfRound.Instance.currentLevelID + ((GrabbableObject)componentInChildren).itemProperties.itemId);
						}
						scrapProps[i].GetComponent<GrabbableObject>().grabbable = true;
					}
					doingTP = false;
				}
			}
			clangPlayer.PlayOneShot(scrapProps[scrapIndex].GetComponent<GrabbableObject>().itemProperties.dropSFX);
			WalkieTalkie.TransmitOneShotAudio(clangPlayer, scrapProps[scrapIndex].GetComponent<GrabbableObject>().itemProperties.dropSFX, 1f);
			wasFallingLastFrame = false;
			if (scrapIndex < 2)
			{
				TeleportProp();
				return;
			}
			Wither.Logger.LogDebug((object)"Making props grabbable...");
			for (int j = 0; j < 3; j++)
			{
				AnimatedItem componentInChildren2 = scrapProps[j].GetComponentInChildren<AnimatedItem>();
				if (componentInChildren2.itemRandomChance == null)
				{
					Wither.Logger.LogInfo((object)"Fixing System.Random!");
					componentInChildren2.itemRandomChance = new Random(StartOfRound.Instance.randomMapSeed + StartOfRound.Instance.currentLevelID + ((GrabbableObject)componentInChildren2).itemProperties.itemId);
				}
				scrapProps[j].GetComponent<GrabbableObject>().grabbable = true;
			}
			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 RunAnimSc