Decompiled source of LongArm v1.0.0

plugins/LongArm/Jiren.LongArm.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExampleEnemy.Configuration;
using GameNetcodeStuff;
using Jiren.LongArm.NetcodePatcher;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Jiren.LongArm")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LongArm")]
[assembly: AssemblyTitle("Jiren.LongArm")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExampleEnemy
{
	internal class ExampleEnemyAI : EnemyAI
	{
		private enum State
		{
			Roaming,
			Stalking,
			Fleeing,
			Enraged
		}

		private enum AttackKind
		{
			None,
			Bite,
			Lunge,
			Recover
		}

		private class Flicker
		{
			public float bulb;

			public float glow;

			public float helmetBase;

			public float until;

			public float nextToggle;

			public float nextBuzz;

			public bool off;

			public Light? helmet;
		}

		public Transform turnCompass;

		public Transform attackArea;

		public Transform? leftHandTarget;

		public Transform? rightHandTarget;

		public AudioClip? screamSFX;

		public AudioClip? rageSFX;

		private const float RoamSpeed = 3.5f;

		private const float StalkSpeed = 2.5f;

		private const float FleeSpeed = 8f;

		private const float RageSpeed = 9.5f;

		private const float FlashRange = 18f;

		private const float FlashAngle = 24f;

		private const float FlashTimeNeeded = 0.2f;

		private const float FlashCooldown = 2f;

		private const float FleeDuration = 5f;

		private const float ScreamFreeze = 1.3f;

		private const float LightAvoidRange = 8f;

		private const float StalkDetectRange = 12f;

		private const float RoomLightRadius = 3f;

		private const float ModelHeight = 2.58f;

		private const float ArmReach = 2f;

		private const float ArmLength = 1.75f;

		private const float DuckDrop = 0.6f;

		private const float DuckLean = 90f;

		private const float BiteRange = 1.45f;

		private const float BiteReach = 1.75f;

		private const float BiteHitTime = 0.33f;

		private const float BiteDuration = 0.9f;

		private const float LungeRange = 2.4f;

		private const float LungeReach = 2.75f;

		private const float LungeHitTime = 0.66f;

		private const float LungeDuration = 0.9f;

		private const float RecoverMiss = 5.5f;

		private const float RecoverHit = 2.2f;

		private int flashCount;

		private float flashTimer;

		private float timeSinceLastFlash = 999f;

		private float fleeUntil;

		private float screamUntil;

		private float avoidLightUntil;

		private float timeSinceHitLocalPlayer;

		private Transform model;

		private Transform? headBone;

		private Transform? chestBone;

		private readonly Transform?[] upperArm = (Transform?[])(object)new Transform[2];

		private readonly Transform?[] foreArm = (Transform?[])(object)new Transform[2];

		private readonly Transform?[] handBone = (Transform?[])(object)new Transform[2];

		private Transform? hipsBone;

		private Transform? spineBone;

		private readonly Transform?[] thighBone = (Transform?[])(object)new Transform[2];

		private readonly Transform?[] shinBone = (Transform?[])(object)new Transform[2];

		private readonly Transform?[] footBone = (Transform?[])(object)new Transform[2];

		private readonly List<Transform> poseBones = new List<Transform>();

		private Quaternion[] poseBase = (Quaternion[])(object)new Quaternion[0];

		private Quaternion[] poseApplied = (Quaternion[])(object)new Quaternion[0];

		private Vector3 hipsBase;

		private Vector3 hipsApplied;

		private readonly Vector3[] footPos = (Vector3[])(object)new Vector3[2];

		private readonly Quaternion[] footRot = (Quaternion[])(object)new Quaternion[2];

		private float duck;

		private float duckTarget;

		private float duckHoldUntil;

		private float duckClear = 3f;

		private float clearTimer;

		private float duckHands;

		private bool doorGrab;

		private float doorGrabStart;

		private float doorGrabCooldown;

		private float pendingScale;

		private float pendingSince;

		private bool scaleInitialized;

		private AttackKind curAttack;

		private float attackStart;

		private float attackEnd;

		private bool attackHitDone;

		private bool lungeHit;

		private bool lungeResolved;

		private float nextAttackTime;

		private float nextLungeRoll;

		private float lungeCooldownUntil;

		private bool hasBiteParam;

		private bool hasLungeParam;

		private bool hasRecoverState;

		private float stepDistance;

		private float lastStepTime;

		private float nextCroakTime;

		private float nextGroanTime;

		private int groansLeft;

		private float nextWailTime;

		private bool wailToggle;

		private bool lightsTurnedOff;

		private bool lightsWereOffBefore;

		private readonly List<LungProp> dockedLungs = new List<LungProp>();

		private float modelScale = 1f;

		private float targetScale = 1f;

		private float scaleCheckTimer;

		private bool loggedCeiling;

		public bool isWallCrawling;

		public float wallCrawlBlend;

		private float ikWeight;

		private readonly Vector3[] planted = (Vector3[])(object)new Vector3[2];

		private readonly Vector3[] handPos = (Vector3[])(object)new Vector3[2];

		private int nextHand;

		private float handStepTimer;

		private float wallCheckTimer;

		private Vector3 lastPosition;

		private float moveSpeed;

		private bool hasWallCrawlParam;

		private bool hasSpeedParam;

		private bool hasScreamParam;

		private bool hasRageParam;

		private bool hasEnragedParam;

		private readonly Dictionary<FlashlightItem, Flicker> flickers = new Dictionary<FlashlightItem, Flicker>();

		private readonly List<FlashlightItem> flickerDone = new List<FlashlightItem>();

		private float flickerCheckTimer;

		private const float FlickerHold = 0.35f;

		private static int Mask => StartOfRound.Instance.collidersAndRoomMask;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			Plugin.Logger.LogInfo((object)text);
		}

		public override void Start()
		{
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: 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_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			EnsureBehaviourStates();
			((EnemyAI)this).Start();
			base.creatureVoice.Stop();
			SetupAudio(base.creatureVoice, 55f);
			SetupAudio(base.creatureSFX, 32f);
			if ((Object)(object)base.dieSFX == (Object)null)
			{
				base.dieSFX = Sounds.Get("death");
			}
			nextCroakTime = Time.time + Random.Range(4f, 9f);
			if (((NetworkBehaviour)this).IsServer && Plugin.BoundConfig.LightsOut.Value)
			{
				LightsOutClientRpc();
			}
			model = ((Component)base.creatureAnimator).transform;
			headBone = FindDeep("Head");
			chestBone = FindDeep("Chest");
			for (int i = 0; i < 2; i++)
			{
				string text = ((i == 0) ? "L" : "R");
				upperArm[i] = FindDeep("UpperArm." + text);
				foreArm[i] = FindDeep("Forearm." + text);
				handBone[i] = FindDeep("Hand." + text);
				thighBone[i] = FindDeep("Thigh." + text);
				shinBone[i] = FindDeep("Shin." + text);
				footBone[i] = FindDeep("Foot." + text);
			}
			hipsBone = FindDeep("Hips");
			spineBone = FindDeep("Spine");
			Transform[] array = (Transform[])(object)new Transform[14]
			{
				hipsBone,
				spineBone,
				chestBone,
				headBone,
				upperArm[0],
				upperArm[1],
				foreArm[0],
				foreArm[1],
				thighBone[0],
				thighBone[1],
				shinBone[0],
				shinBone[1],
				footBone[0],
				footBone[1]
			};
			foreach (Transform val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					poseBones.Add(val);
				}
			}
			poseBase = (Quaternion[])(object)new Quaternion[poseBones.Count];
			poseApplied = (Quaternion[])(object)new Quaternion[poseBones.Count];
			for (int k = 0; k < poseBones.Count; k++)
			{
				poseBase[k] = (poseApplied[k] = poseBones[k].localRotation);
			}
			if ((Object)(object)hipsBone != (Object)null)
			{
				hipsBase = (hipsApplied = hipsBone.localPosition);
			}
			hasWallCrawlParam = HasAnimatorParam("WallCrawl");
			hasSpeedParam = HasAnimatorParam("Speed");
			hasScreamParam = HasAnimatorParam("Scream");
			hasRageParam = HasAnimatorParam("RageScream");
			hasEnragedParam = HasAnimatorParam("Enraged");
			hasBiteParam = HasAnimatorParam("Bite");
			hasLungeParam = HasAnimatorParam("Lunge");
			hasRecoverState = base.creatureAnimator.HasState(0, Animator.StringToHash("Recover"));
			if (HasAnimatorParam("startWalk"))
			{
				base.creatureAnimator.SetTrigger("startWalk");
			}
			lastPosition = ((Component)this).transform.position;
			for (int l = 0; l < 2; l++)
			{
				planted[l] = (handPos[l] = ((Component)this).transform.position);
			}
			scaleCheckTimer = 0f;
			UpdateScale();
			modelScale = targetScale;
			model.localScale = Vector3.one * modelScale;
			base.currentBehaviourStateIndex = 0;
		}

		private Transform? FindDeep(string boneName)
		{
			string text = boneName.Replace('.', '_');
			Transform[] componentsInChildren = ((Component)model).GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				if (((Object)val).name == boneName || ((Object)val).name == text)
				{
					return val;
				}
			}
			return null;
		}

		private void EnsureBehaviourStates()
		{
			//IL_0045: 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_005a: Expected O, but got Unknown
			string[] array = new string[4] { "Roaming", "Stalking", "Fleeing", "Enraged" };
			List<EnemyBehaviourState> list = ((base.enemyBehaviourStates != null) ? base.enemyBehaviourStates.ToList() : new List<EnemyBehaviourState>());
			while (list.Count < array.Length)
			{
				list.Add(new EnemyBehaviourState
				{
					parameterString = ""
				});
			}
			for (int i = 0; i < array.Length; i++)
			{
				list[i].name = array[i];
			}
			base.enemyBehaviourStates = list.ToArray();
		}

		private bool HasAnimatorParam(string paramName)
		{
			if ((Object)(object)base.creatureAnimator == (Object)null)
			{
				return false;
			}
			AnimatorControllerParameter[] parameters = base.creatureAnimator.parameters;
			foreach (AnimatorControllerParameter val in parameters)
			{
				if (val.name == paramName)
				{
					return true;
				}
			}
			return false;
		}

		public override void Update()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (!base.isEnemyDead)
			{
				timeSinceHitLocalPlayer += Time.deltaTime;
				timeSinceLastFlash += Time.deltaTime;
				UpdateScale();
				Vector3 val = ((Component)this).transform.position - lastPosition;
				moveSpeed = ((Vector3)(ref val)).magnitude / Mathf.Max(Time.deltaTime, 0.0001f);
				lastPosition = ((Component)this).transform.position;
				if (hasSpeedParam)
				{
					base.creatureAnimator.SetFloat("Speed", moveSpeed);
				}
				if (hasEnragedParam)
				{
					base.creatureAnimator.SetBool("Enraged", base.currentBehaviourStateIndex == 3);
				}
				UpdateClearance();
				UpdateWallCrawl();
				UpdateAttack();
				UpdateSounds();
				if (base.stunNormalizedTimer > 0f)
				{
					base.agent.speed = 0f;
				}
				else if (((NetworkBehaviour)this).IsOwner)
				{
					CheckFlashlights();
					UpdateAttackOwner();
				}
			}
		}

		private void UpdateScale()
		{
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			PluginConfig boundConfig = Plugin.BoundConfig;
			scaleCheckTimer -= Time.deltaTime;
			if (scaleCheckTimer <= 0f)
			{
				scaleCheckTimer = 0.4f;
				float value = boundConfig.SizeMin.Value;
				float num = Mathf.Max(boundConfig.SizeMax.Value, value);
				RaycastHit val = default(RaycastHit);
				float num3;
				if (boundConfig.AutoSize.Value && Physics.Raycast(((Component)this).transform.position + Vector3.up * 0.6f, Vector3.up, ref val, 14f, Mask, (QueryTriggerInteraction)1))
				{
					float num2 = ((RaycastHit)(ref val)).distance + 0.6f;
					num3 = Mathf.Clamp(num2 * Mathf.Clamp(boundConfig.SizeFraction.Value, 0.3f, 1f) / 2.58f, value, num);
					if (!loggedCeiling)
					{
						loggedCeiling = true;
					}
				}
				else
				{
					num3 = Mathf.Clamp(boundConfig.SizeFixed.Value, value, num);
				}
				if (!scaleInitialized)
				{
					scaleInitialized = true;
					targetScale = num3;
					pendingSince = Time.time;
				}
				else if (Mathf.Abs(num3 - targetScale) < 0.03f)
				{
					pendingSince = Time.time;
				}
				else if (Mathf.Abs(num3 - pendingScale) > 0.05f)
				{
					pendingScale = num3;
					pendingSince = Time.time;
				}
				else if (Time.time - pendingSince > ((num3 < targetScale) ? 2.5f : 1f))
				{
					targetScale = num3;
				}
			}
			modelScale = Mathf.MoveTowards(modelScale, targetScale, Time.deltaTime * 0.8f);
			model.localScale = Vector3.one * modelScale;
		}

		private static float DuckHeight(float t)
		{
			float num = 90f * t * (MathF.PI / 180f);
			return 1.3f * (1f - 0.6f * t) + 0.32f * Mathf.Cos(0.55f * num) + 0.28f * Mathf.Cos(0.8f * num) + 0.34f * Mathf.Cos(num) + 0.3f * Mathf.Cos(0.5f * num) + 0.12f * Mathf.Sin(num) + 0.04f;
		}

		private static float DuckFor(float heightAtScaleOne)
		{
			if (DuckHeight(1f) >= heightAtScaleOne)
			{
				return 1f;
			}
			float num = 0f;
			float num2 = 1f;
			for (int i = 0; i < 10; i++)
			{
				float num3 = (num + num2) * 0.5f;
				if (DuckHeight(num3) > heightAtScaleOne)
				{
					num = num3;
				}
				else
				{
					num2 = num3;
				}
			}
			return num2;
		}

		private static void ProbeClearance(Vector3 p, float offset, float maxUp, ref float minClear, ref float minOffset)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(p, Vector3.up, ref val, maxUp, Mask, (QueryTriggerInteraction)1))
			{
				float num = ((RaycastHit)(ref val)).distance + 0.5f;
				if (num < minClear)
				{
					minClear = num;
					minOffset = offset;
				}
			}
		}

		private void UpdateClearance()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_005b: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: 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_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: 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_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			clearTimer -= Time.deltaTime;
			if (clearTimer > 0f)
			{
				return;
			}
			clearTimer = 0.1f;
			float num = modelScale;
			float num2 = 2.58f * num;
			Vector3 forward = ((Component)this).transform.forward;
			Vector3 val = ((Component)this).transform.position + Vector3.up * 0.5f;
			float num3 = 0.3f * num + 0.3f;
			float num4 = 0.9f * num + 0.9f;
			float minClear = 99f;
			float minOffset = 0f;
			int num5 = Mathf.CeilToInt((num4 + num3) / 0.25f);
			for (int i = 0; i <= num5; i++)
			{
				float num6 = 0f - num3 + (num4 + num3) * (float)i / (float)num5;
				Vector3 val2 = val + forward * num6;
				if (Mathf.Abs(num6) > 0.05f && Physics.Linecast(val, val2, Mask, (QueryTriggerInteraction)1))
				{
					if (num6 > 0f)
					{
						break;
					}
				}
				else
				{
					ProbeClearance(val2, num6, num2 + 0.6f, ref minClear, ref minOffset);
				}
			}
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(((Component)this).transform.position + Vector3.up * (num2 - 0.1f * num), forward, ref val3, num4, Mask, (QueryTriggerInteraction)1))
			{
				float num7 = ((RaycastHit)(ref val3)).distance + 0.06f;
				Vector3 val4 = val + forward * num7;
				if (!Physics.Linecast(val, val4, Mask, (QueryTriggerInteraction)1))
				{
					ProbeClearance(val4, num7, num2 + 0.6f, ref minClear, ref minOffset);
				}
			}
			bool flag = minClear < num2 + 0.05f;
			float num8 = (flag ? DuckFor((minClear - 0.12f) / num) : 0f);
			if (flag)
			{
				duckClear = minClear;
			}
			if (num8 >= duckTarget)
			{
				duckTarget = num8;
				duckHoldUntil = Time.time + 0.4f;
			}
			else if (Time.time > duckHoldUntil)
			{
				duckTarget = num8;
			}
			if (flag && !doorGrab && minOffset > 0.3f && Time.time > doorGrabCooldown)
			{
				float num9 = Mathf.Clamp(minClear - 0.35f, 0.8f, 1.6f * num);
				Vector3 val5 = ((Component)this).transform.position + forward * (minOffset + 0.05f) + Vector3.up * num9;
				float num10 = 2f * num;
				RaycastHit val6 = default(RaycastHit);
				RaycastHit val7 = default(RaycastHit);
				if (Physics.Raycast(val5, -((Component)this).transform.right, ref val6, num10, Mask, (QueryTriggerInteraction)1) && Physics.Raycast(val5, ((Component)this).transform.right, ref val7, num10, Mask, (QueryTriggerInteraction)1))
				{
					planted[0] = ((RaycastHit)(ref val6)).point + ((RaycastHit)(ref val6)).normal * (0.1f * num);
					planted[1] = ((RaycastHit)(ref val7)).point + ((RaycastHit)(ref val7)).normal * (0.1f * num);
					doorGrab = true;
					doorGrabStart = Time.time;
					Sfx("slap", 0.9f);
				}
			}
		}

		private void ApplyDuck()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			float num = ((curAttack != AttackKind.None) ? 0f : duckTarget);
			duck = Mathf.MoveTowards(duck, num, Time.deltaTime * ((curAttack != AttackKind.None) ? 4f : ((num > duck) ? 2.4f : 1.4f)));
			if (duck < 0.005f || (Object)(object)hipsBone == (Object)null)
			{
				return;
			}
			float num2 = modelScale;
			Vector3 right = ((Component)this).transform.right;
			for (int i = 0; i < 2; i++)
			{
				if ((Object)(object)footBone[i] != (Object)null)
				{
					footPos[i] = footBone[i].position;
					footRot[i] = footBone[i].rotation;
				}
			}
			float num3 = 90f * duck;
			Transform? obj = hipsBone;
			obj.position += Vector3.down * (0.78000003f * num2 * duck) - ((Component)this).transform.forward * (0.25f * num2 * duck);
			hipsBone.rotation = Quaternion.AngleAxis(num3 * 0.55f, right) * hipsBone.rotation;
			if ((Object)(object)spineBone != (Object)null)
			{
				spineBone.rotation = Quaternion.AngleAxis(num3 * 0.25f, right) * spineBone.rotation;
			}
			if ((Object)(object)chestBone != (Object)null)
			{
				chestBone.rotation = Quaternion.AngleAxis(num3 * 0.2f, right) * chestBone.rotation;
			}
			if ((Object)(object)headBone != (Object)null)
			{
				headBone.rotation = Quaternion.AngleAxis((0f - num3) * 0.5f, right) * headBone.rotation;
			}
			for (int j = 0; j < 2; j++)
			{
				if (!((Object)(object)thighBone[j] == (Object)null) && !((Object)(object)shinBone[j] == (Object)null) && !((Object)(object)footBone[j] == (Object)null))
				{
					SolveLimb(thighBone[j], shinBone[j], footBone[j], footPos[j], 1f, -right);
					footBone[j].rotation = footRot[j];
				}
			}
		}

		private void BeginPose()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < poseBones.Count; i++)
			{
				Transform val = poseBones[i];
				if (!((Object)(object)val == (Object)null))
				{
					if (val.localRotation == poseApplied[i])
					{
						val.localRotation = poseBase[i];
					}
					poseBase[i] = val.localRotation;
				}
			}
			if ((Object)(object)hipsBone != (Object)null)
			{
				if (hipsBone.localPosition == hipsApplied)
				{
					hipsBone.localPosition = hipsBase;
				}
				hipsBase = hipsBone.localPosition;
			}
		}

		private void EndPose()
		{
			//IL_002b: 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_005c: 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)
			for (int i = 0; i < poseBones.Count; i++)
			{
				if ((Object)(object)poseBones[i] != (Object)null)
				{
					poseApplied[i] = poseBones[i].localRotation;
				}
			}
			if ((Object)(object)hipsBone != (Object)null)
			{
				hipsApplied = hipsBone.localPosition;
			}
		}

		public override void DoAIInterval()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead || curAttack != AttackKind.None)
			{
				return;
			}
			switch ((State)base.currentBehaviourStateIndex)
			{
			case State.Roaming:
			{
				base.agent.speed = 3.5f;
				if (Time.time < avoidLightUntil)
				{
					break;
				}
				PlayerControllerB val = NearbyPlayerWithLight();
				if ((Object)(object)val != (Object)null)
				{
					if (base.currentSearch.inProgress)
					{
						((EnemyAI)this).StopSearch(base.currentSearch, true);
					}
					MoveAwayFrom(((Component)val).transform.position);
					avoidLightUntil = Time.time + 4f;
					break;
				}
				PlayerControllerB val2 = FindPreyInDarkness();
				if ((Object)(object)val2 != (Object)null)
				{
					base.targetPlayer = val2;
					if (base.currentSearch.inProgress)
					{
						((EnemyAI)this).StopSearch(base.currentSearch, true);
					}
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				else if (!base.currentSearch.inProgress)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				}
				break;
			}
			case State.Stalking:
				base.agent.speed = 2.5f;
				if ((Object)(object)base.targetPlayer == (Object)null || !IsActivePlayer(base.targetPlayer) || PlayerHasLightOn(base.targetPlayer) || Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 18f)
				{
					base.targetPlayer = null;
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				break;
			case State.Fleeing:
				base.agent.speed = ((Time.time < screamUntil) ? 0f : 8f);
				if (Time.time >= fleeUntil)
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				break;
			case State.Enraged:
				base.agent.speed = ((Time.time < screamUntil) ? 0f : 9.5f);
				if ((Object)(object)base.targetPlayer == (Object)null || !IsActivePlayer(base.targetPlayer))
				{
					base.targetPlayer = null;
					SetRageTargetClientRpc(-1);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				break;
			}
		}

		private void CheckFlashlights()
		{
			if (base.currentBehaviourStateIndex == 3 || curAttack != AttackKind.None)
			{
				flashTimer = 0f;
				return;
			}
			PlayerControllerB playerShiningAtMe = GetPlayerShiningAtMe();
			if ((Object)(object)playerShiningAtMe == (Object)null)
			{
				flashTimer = Mathf.Max(0f, flashTimer - Time.deltaTime * 0.5f);
				return;
			}
			flashTimer += Time.deltaTime;
			if (!(flashTimer < 0.2f) && !(timeSinceLastFlash < 2f))
			{
				flashTimer = 0f;
				timeSinceLastFlash = 0f;
				OnFlashed(playerShiningAtMe);
			}
		}

		private static bool HasFlashlightOn(PlayerControllerB player)
		{
			GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
			FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
			if (val != null && ((GrabbableObject)val).isBeingUsed)
			{
				return true;
			}
			if (player.ItemSlots != null)
			{
				GrabbableObject[] itemSlots = player.ItemSlots;
				foreach (GrabbableObject val2 in itemSlots)
				{
					FlashlightItem val3 = (FlashlightItem)(object)((val2 is FlashlightItem) ? val2 : null);
					if (val3 != null && ((GrabbableObject)val3).isBeingUsed)
					{
						return true;
					}
				}
			}
			return false;
		}

		private PlayerControllerB? GetPlayerShiningAtMe()
		{
			//IL_0040: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_005a: 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_0069: 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_0079: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			Vector3 point = (((Object)(object)headBone != (Object)null) ? headBone.position : (((Component)this).transform.position + Vector3.up * 2.2f * modelScale));
			Vector3 point2 = (((Object)(object)chestBone != (Object)null) ? chestBone.position : (((Component)this).transform.position + Vector3.up * 1.7f * modelScale));
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (IsActivePlayer(val) && HasFlashlightOn(val))
				{
					Transform transform = ((Component)val.gameplayCamera).transform;
					if (LitFrom(transform, point) || LitFrom(transform, point2))
					{
						return val;
					}
				}
			}
			return null;
		}

		private static bool LitFrom(Transform cam, Vector3 point)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = point - cam.position;
			if (((Vector3)(ref val)).magnitude > 18f)
			{
				return false;
			}
			if (Vector3.Angle(cam.forward, val) > 24f)
			{
				return false;
			}
			return !Physics.Linecast(cam.position, point, Mask, (QueryTriggerInteraction)1);
		}

		private void OnFlashed(PlayerControllerB flasher)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			flashCount++;
			int value = Plugin.BoundConfig.FlashesUntilRage.Value;
			if (base.currentSearch.inProgress)
			{
				((EnemyAI)this).StopSearch(base.currentSearch, true);
			}
			if (flashCount >= value)
			{
				StartRage(flasher);
				return;
			}
			ScreamClientRpc(rage: false);
			screamUntil = Time.time + 1.3f;
			fleeUntil = screamUntil + 5f;
			((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			MoveAwayFrom(((Component)flasher).transform.position);
		}

		private void StartRage(PlayerControllerB target)
		{
			flashCount = 0;
			base.targetPlayer = target;
			screamUntil = Time.time + 1.3f;
			ScreamClientRpc(rage: true);
			SetRageTargetClientRpc((int)target.playerClientId);
			((EnemyAI)this).SwitchToBehaviourClientRpc(3);
		}

		private void MoveAwayFrom(Vector3 position)
		{
			//IL_0001: 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)
			Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(position, false, 0, false, 50, -1);
			if ((Object)(object)val != (Object)null)
			{
				((EnemyAI)this).SetDestinationToPosition(val.position, false);
			}
		}

		private static bool IsActivePlayer(PlayerControllerB? player)
		{
			if ((Object)(object)player != (Object)null && player.isPlayerControlled && !player.isPlayerDead)
			{
				return player.isInsideFactory;
			}
			return false;
		}

		private static bool PlayerHasLightOn(PlayerControllerB player)
		{
			if (HasFlashlightOn(player))
			{
				return true;
			}
			if ((Object)(object)player.helmetLight != (Object)null)
			{
				return ((Behaviour)player.helmetLight).enabled;
			}
			return false;
		}

		private PlayerControllerB? NearbyPlayerWithLight()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (IsActivePlayer(val) && PlayerHasLightOn(val) && Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) < 8f)
				{
					return val;
				}
			}
			return null;
		}

		private PlayerControllerB? FindPreyInDarkness()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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)
			PlayerControllerB result = null;
			float num = 12f;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (IsActivePlayer(val) && !PlayerHasLightOn(val) && !IsNearRoomLight(((Component)val).transform.position))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (num2 < num && ((EnemyAI)this).CheckLineOfSightForPosition(((Component)val.gameplayCamera).transform.position, 70f, 12, -1f, (Transform)null))
					{
						result = val;
						num = num2;
					}
				}
			}
			return result;
		}

		private static bool IsNearRoomLight(Vector3 position)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			List<Light> allPoweredLights = RoundManager.Instance.allPoweredLights;
			if (allPoweredLights == null)
			{
				return false;
			}
			foreach (Light item in allPoweredLights)
			{
				if (!((Object)(object)item == (Object)null) && ((Behaviour)item).enabled && ((Component)item).gameObject.activeInHierarchy && !(item.intensity <= 0f))
				{
					Vector3 val = ((Component)item).transform.position - position;
					if (((Vector3)(ref val)).sqrMagnitude < 9f)
					{
						return true;
					}
				}
			}
			return false;
		}

		private void UpdateWallCrawl()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: 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_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: 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_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0500: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			float num = 2f * modelScale;
			Vector3 val = ((Component)this).transform.position + Vector3.up * (1.55f * modelScale);
			wallCheckTimer -= Time.deltaTime;
			if (wallCheckTimer <= 0f)
			{
				wallCheckTimer = 0.1f;
				RaycastHit val2 = default(RaycastHit);
				bool flag = Physics.Raycast(val, -((Component)this).transform.right, ref val2, num, Mask, (QueryTriggerInteraction)1);
				RaycastHit val3 = default(RaycastHit);
				bool flag2 = Physics.Raycast(val, ((Component)this).transform.right, ref val3, num, Mask, (QueryTriggerInteraction)1);
				bool flag3 = flag && flag2;
				if (flag3 != isWallCrawling)
				{
					isWallCrawling = flag3;
					if (hasWallCrawlParam)
					{
						base.creatureAnimator.SetBool("WallCrawl", flag3);
					}
					if (flag3 && !doorGrab)
					{
						planted[0] = ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * (0.2f * modelScale);
						planted[1] = ((RaycastHit)(ref val3)).point + ((RaycastHit)(ref val3)).normal * (0.2f * modelScale);
						if (wallCrawlBlend < 0.05f)
						{
							handPos[0] = planted[0];
							handPos[1] = planted[1];
						}
					}
				}
			}
			wallCrawlBlend = Mathf.MoveTowards(wallCrawlBlend, isWallCrawling ? 1f : 0f, Time.deltaTime * 3f);
			duckHands = Mathf.MoveTowards(duckHands, (doorGrab || duck > 0.05f) ? 1f : 0f, Time.deltaTime * 3f);
			if (doorGrab)
			{
				bool flag4 = Time.time - doorGrabStart > 5f || (duckTarget <= 0f && duck < 0.05f && Time.time - doorGrabStart > 0.6f);
				for (int i = 0; i < 2; i++)
				{
					Vector3 val4 = (((Object)(object)upperArm[i] != (Object)null) ? upperArm[i].position : val);
					if (Vector3.Dot(planted[i] - val4, ((Component)this).transform.forward) < -0.35f * modelScale)
					{
						flag4 = true;
					}
				}
				if (flag4)
				{
					doorGrab = false;
					doorGrabCooldown = Time.time + 1f;
				}
				return;
			}
			if (!isWallCrawling)
			{
				if (duck > 0.05f)
				{
					float num2 = Mathf.Clamp(duckClear * 0.5f, 0.5f, 1.2f * modelScale);
					for (int j = 0; j < 2; j++)
					{
						planted[j] = ((Component)this).transform.position + ((Component)this).transform.forward * (1f * modelScale) + ((Component)this).transform.right * (((j == 0) ? (-0.45f) : 0.45f) * modelScale) + Vector3.up * num2;
					}
				}
				return;
			}
			float num3 = 1.75f * modelScale;
			int num4 = -1;
			for (int k = 0; k < 2; k++)
			{
				Vector3 val5 = (((Object)(object)upperArm[k] != (Object)null) ? upperArm[k].position : val);
				Vector3 val6 = planted[k] - val5;
				if (((Vector3)(ref val6)).magnitude > num3 * 0.97f)
				{
					num4 = k;
				}
			}
			handStepTimer -= Time.deltaTime;
			if (num4 >= 0 || (!(handStepTimer > 0f) && !(moveSpeed < 0.2f)))
			{
				handStepTimer = Mathf.Clamp(1.4f * modelScale / Mathf.Max(moveSpeed, 0.5f), 0.3f, 1.3f);
				int num5 = ((num4 >= 0) ? num4 : nextHand);
				Vector3 val7 = val + ((Component)this).transform.forward * (0.9f * modelScale) + Vector3.up * (Random.Range(-0.25f, 0.4f) * modelScale);
				Vector3 val8 = ((num5 == 0) ? (-((Component)this).transform.right) : ((Component)this).transform.right);
				RaycastHit val9 = default(RaycastHit);
				if (Physics.Raycast(val7, val8, ref val9, num * 1.15f, Mask, (QueryTriggerInteraction)1))
				{
					planted[num5] = ((RaycastHit)(ref val9)).point + ((RaycastHit)(ref val9)).normal * (0.2f * modelScale);
					Sfx("slap", 0.7f);
				}
				if (num4 < 0)
				{
					nextHand = 1 - nextHand;
				}
			}
		}

		private void LateUpdate()
		{
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			UpdateFlicker();
			if ((Object)(object)model == (Object)null)
			{
				return;
			}
			BeginPose();
			if (!base.isEnemyDead)
			{
				ApplyDuck();
				float num = ((base.currentBehaviourStateIndex == 3) ? duckHands : Mathf.Max(wallCrawlBlend, duckHands));
				if (Time.time < screamUntil || curAttack != AttackKind.None)
				{
					num = 0f;
				}
				ikWeight = Mathf.MoveTowards(ikWeight, num, Time.deltaTime * 4f);
				for (int i = 0; i < 2; i++)
				{
					handPos[i] = ((ikWeight < 0.02f) ? planted[i] : Vector3.MoveTowards(handPos[i], planted[i], Time.deltaTime * 9f * modelScale));
					if (ikWeight > 0.01f && (Object)(object)upperArm[i] != (Object)null && (Object)(object)foreArm[i] != (Object)null && (Object)(object)handBone[i] != (Object)null)
					{
						SolveLimb(upperArm[i], foreArm[i], handBone[i], handPos[i], ikWeight, Vector3.zero);
					}
				}
			}
			if ((Object)(object)base.eye != (Object)null && (Object)(object)headBone != (Object)null)
			{
				base.eye.position = headBone.position;
			}
			EndPose();
			if ((Object)(object)leftHandTarget != (Object)null)
			{
				leftHandTarget.position = handPos[0];
			}
			if ((Object)(object)rightHandTarget != (Object)null)
			{
				rightHandTarget.position = handPos[1];
			}
		}

		private static void SolveLimb(Transform a, Transform b, Transform c, Vector3 target, float weight, Vector3 hint)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0057: 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_005d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: 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_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: 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_01fb: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: 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_0289: 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_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = a.position;
			Vector3 position2 = b.position;
			Vector3 position3 = c.position;
			Vector3 val = Vector3.Lerp(position3, target, weight);
			Vector3 val2 = position2 - position;
			float magnitude = ((Vector3)(ref val2)).magnitude;
			val2 = position2 - position3;
			float magnitude2 = ((Vector3)(ref val2)).magnitude;
			if (magnitude < 0.001f || magnitude2 < 0.001f)
			{
				return;
			}
			val2 = val - position;
			float num = Mathf.Clamp(((Vector3)(ref val2)).magnitude, 0.01f, magnitude + magnitude2 - 0.01f);
			val2 = position3 - position;
			Vector3 normalized = ((Vector3)(ref val2)).normalized;
			val2 = position2 - position;
			float num2 = Mathf.Acos(Mathf.Clamp(Vector3.Dot(normalized, ((Vector3)(ref val2)).normalized), -1f, 1f));
			val2 = position - position2;
			Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
			val2 = position3 - position2;
			float num3 = Mathf.Acos(Mathf.Clamp(Vector3.Dot(normalized2, ((Vector3)(ref val2)).normalized), -1f, 1f));
			val2 = position3 - position;
			Vector3 normalized3 = ((Vector3)(ref val2)).normalized;
			val2 = val - position;
			float num4 = Mathf.Acos(Mathf.Clamp(Vector3.Dot(normalized3, ((Vector3)(ref val2)).normalized), -1f, 1f));
			float num5 = Mathf.Acos(Mathf.Clamp((magnitude2 * magnitude2 - magnitude * magnitude - num * num) / (-2f * magnitude * num), -1f, 1f));
			float num6 = Mathf.Acos(Mathf.Clamp((num * num - magnitude * magnitude - magnitude2 * magnitude2) / (-2f * magnitude * magnitude2), -1f, 1f));
			val2 = position3 - position;
			Vector3 normalized4 = ((Vector3)(ref val2)).normalized;
			val2 = position2 - position;
			Vector3 val3 = Vector3.Cross(normalized4, ((Vector3)(ref val2)).normalized);
			if (hint != Vector3.zero)
			{
				if (((Vector3)(ref val3)).magnitude < 0.02f || Vector3.Dot(val3, hint) <= 0f)
				{
					val3 = hint;
				}
			}
			else if (((Vector3)(ref val3)).magnitude < 0.0001f)
			{
				val3 = Vector3.Cross(position3 - position, Vector3.up);
			}
			((Vector3)(ref val3)).Normalize();
			Vector3 val4 = Vector3.Cross(position3 - position, val - position);
			a.rotation = Quaternion.AngleAxis((num5 - num2) * 57.29578f, val3) * a.rotation;
			b.rotation = Quaternion.AngleAxis((num6 - num3) * 57.29578f, val3) * b.rotation;
			if (((Vector3)(ref val4)).sqrMagnitude > 1E-08f)
			{
				a.rotation = Quaternion.AngleAxis(num4 * 57.29578f, ((Vector3)(ref val4)).normalized) * a.rotation;
			}
		}

		private static FlashlightItem? ActiveFlashlight(PlayerControllerB player)
		{
			GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
			FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null);
			if (val != null && ((GrabbableObject)val).isBeingUsed)
			{
				return val;
			}
			if (player.ItemSlots != null)
			{
				GrabbableObject[] itemSlots = player.ItemSlots;
				foreach (GrabbableObject val2 in itemSlots)
				{
					FlashlightItem val3 = (FlashlightItem)(object)((val2 is FlashlightItem) ? val2 : null);
					if (val3 != null && ((GrabbableObject)val3).isBeingUsed)
					{
						return val3;
					}
				}
			}
			return null;
		}

		private void UpdateFlicker()
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008c: 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_00df: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			flickerCheckTimer -= Time.deltaTime;
			if (flickerCheckTimer <= 0f && !base.isEnemyDead && (Object)(object)model != (Object)null && (Object)(object)StartOfRound.Instance != (Object)null)
			{
				flickerCheckTimer = 0.08f;
				Vector3 point = (((Object)(object)headBone != (Object)null) ? headBone.position : (((Component)this).transform.position + Vector3.up * 2.2f * modelScale));
				Vector3 point2 = (((Object)(object)chestBone != (Object)null) ? chestBone.position : (((Component)this).transform.position + Vector3.up * 1.7f * modelScale));
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					if (!IsActivePlayer(val))
					{
						continue;
					}
					FlashlightItem val2 = ActiveFlashlight(val);
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					Transform transform = ((Component)val.gameplayCamera).transform;
					if (LitFrom(transform, point) || LitFrom(transform, point2))
					{
						if (!flickers.TryGetValue(val2, out Flicker value))
						{
							value = new Flicker
							{
								bulb = (((Object)(object)val2.flashlightBulb != (Object)null) ? val2.flashlightBulb.intensity : 0f),
								glow = (((Object)(object)val2.flashlightBulbGlow != (Object)null) ? val2.flashlightBulbGlow.intensity : 0f),
								helmet = val.helmetLight,
								helmetBase = (((Object)(object)val.helmetLight != (Object)null) ? val.helmetLight.intensity : 0f),
								off = true,
								nextToggle = Time.time + 0.05f
							};
							flickers[val2] = value;
						}
						value.until = Time.time + 0.35f;
					}
				}
			}
			if (flickers.Count == 0)
			{
				return;
			}
			flickerDone.Clear();
			foreach (KeyValuePair<FlashlightItem, Flicker> flicker in flickers)
			{
				FlashlightItem key = flicker.Key;
				Flicker value2 = flicker.Value;
				bool flag = (Object)(object)key == (Object)null || !((GrabbableObject)key).isBeingUsed || Time.time >= value2.until;
				if (!flag && Time.time >= value2.nextToggle)
				{
					value2.off = !value2.off;
					value2.nextToggle = Time.time + Random.Range(0.03f, 0.1f);
				}
				if (!flag && (Object)(object)key != (Object)null && Time.time >= value2.nextBuzz)
				{
					value2.nextBuzz = Time.time + 0.42f;
					AudioClip val3 = Sounds.Get("flicker");
					if ((Object)(object)val3 != (Object)null && (Object)(object)key.flashlightAudio != (Object)null)
					{
						key.flashlightAudio.PlayOneShot(val3, 0.8f);
					}
				}
				float num = ((flag || !value2.off) ? 1f : 0f);
				if ((Object)(object)key != (Object)null)
				{
					if ((Object)(object)key.flashlightBulb != (Object)null)
					{
						key.flashlightBulb.intensity = value2.bulb * num;
					}
					if ((Object)(object)key.flashlightBulbGlow != (Object)null)
					{
						key.flashlightBulbGlow.intensity = value2.glow * num;
					}
				}
				if ((Object)(object)value2.helmet != (Object)null)
				{
					value2.helmet.intensity = value2.helmetBase * num;
				}
				if (flag)
				{
					flickerDone.Add(key);
				}
			}
			foreach (FlashlightItem item in flickerDone)
			{
				flickers.Remove(item);
			}
		}

		private void RestoreFlicker()
		{
			foreach (KeyValuePair<FlashlightItem, Flicker> flicker in flickers)
			{
				FlashlightItem key = flicker.Key;
				Flicker value = flicker.Value;
				if ((Object)(object)key != (Object)null)
				{
					if ((Object)(object)key.flashlightBulb != (Object)null)
					{
						key.flashlightBulb.intensity = value.bulb;
					}
					if ((Object)(object)key.flashlightBulbGlow != (Object)null)
					{
						key.flashlightBulbGlow.intensity = value.glow;
					}
				}
				if ((Object)(object)value.helmet != (Object)null)
				{
					value.helmet.intensity = value.helmetBase;
				}
			}
			flickers.Clear();
		}

		public override void OnDestroy()
		{
			RestoreFlicker();
			((EnemyAI)this).OnDestroy();
		}

		private void FaceTowards(Vector3 position, float degreesPerSecond)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_003e: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position - ((Component)this).transform.position;
			val.y = 0f;
			if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f))
			{
				((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, Quaternion.LookRotation(val), degreesPerSecond * Time.deltaTime);
			}
		}

		private void UpdateAttackOwner()
		{
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: 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_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			float num = modelScale;
			bool flag = base.currentBehaviourStateIndex == 3;
			if (curAttack != AttackKind.None)
			{
				float num2 = Time.time - attackStart;
				bool flag2 = ((curAttack == AttackKind.Bite) ? (num2 < 0.25f) : (curAttack == AttackKind.Lunge && num2 < 0.45f));
				base.agent.speed = ((curAttack == AttackKind.Bite && flag && num2 < 0.33f) ? 6.65f : 0f);
				if (flag2 && (Object)(object)base.targetPlayer != (Object)null)
				{
					FaceTowards(((Component)base.targetPlayer).transform.position, 300f);
				}
				if (curAttack == AttackKind.Lunge && !lungeResolved && num2 >= 1.1f)
				{
					lungeResolved = true;
					lungeCooldownUntil = Time.time + 10f;
					RecoverClientRpc(lungeHit);
				}
			}
			else
			{
				if ((!flag && base.currentBehaviourStateIndex != 1) || (Object)(object)base.targetPlayer == (Object)null || !IsActivePlayer(base.targetPlayer) || Time.time < nextAttackTime || Time.time < screamUntil || duck > 0.25f)
				{
					return;
				}
				Vector3 val = ((Component)base.targetPlayer).transform.position - ((Component)this).transform.position;
				if (Mathf.Abs(val.y) > 2.5f)
				{
					return;
				}
				val.y = 0f;
				float magnitude = ((Vector3)(ref val)).magnitude;
				if (magnitude < 1.45f * num)
				{
					AttackClientRpc(1);
				}
				else
				{
					if (!(magnitude < 2.4f * num) || !(Time.time >= nextLungeRoll))
					{
						return;
					}
					nextLungeRoll = Time.time + 1f;
					if (!(Time.time < lungeCooldownUntil) && !(Random.value > Plugin.BoundConfig.LungeChance.Value))
					{
						Vector3 val2 = ((Component)this).transform.position + Vector3.up;
						if (!Physics.Linecast(val2, val2 + ((Vector3)(ref val)).normalized * (2.3f * num), Mask, (QueryTriggerInteraction)1))
						{
							AttackClientRpc(2);
						}
					}
				}
			}
		}

		private void UpdateAttack()
		{
			//IL_0083: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			if (curAttack == AttackKind.None)
			{
				return;
			}
			float num = Time.time - attackStart;
			bool flag = curAttack == AttackKind.Lunge;
			if ((flag || curAttack == AttackKind.Bite) && !attackHitDone && num >= (flag ? 0.66f : 0.33f))
			{
				attackHitDone = true;
				if (flag)
				{
					Sfx("thud", 1f);
					PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
					if ((Object)(object)localPlayerController != (Object)null && Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)this).transform.position) < 12f)
					{
						HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
					}
				}
				PlayerControllerB localPlayerController2 = GameNetworkManager.Instance.localPlayerController;
				if ((Object)(object)localPlayerController2 != (Object)null && IsActivePlayer(localPlayerController2) && InAttackZone(((Component)localPlayerController2).transform.position, curAttack))
				{
					if (base.currentBehaviourStateIndex == 3)
					{
						localPlayerController2.KillPlayer(Vector3.zero, true, (CauseOfDeath)6, 0, default(Vector3), false);
					}
					else
					{
						localPlayerController2.DamagePlayer(flag ? 50 : 30, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
					}
					if (flag)
					{
						LungeHitServerRpc();
					}
				}
			}
			if (curAttack == AttackKind.Recover && groansLeft > 0 && Time.time >= nextGroanTime)
			{
				groansLeft--;
				nextGroanTime = Time.time + 1.9f;
				Voice("groan", 0.9f);
			}
			if (Time.time >= attackEnd)
			{
				curAttack = AttackKind.None;
			}
		}

		private bool InAttackZone(Vector3 position, AttackKind kind)
		{
			//IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			float num = modelScale;
			Vector3 val = position - ((Component)this).transform.position;
			if (Mathf.Abs(val.y) > 3f)
			{
				return false;
			}
			float num2 = Vector3.Dot(val, ((Component)this).transform.forward);
			float num3 = Mathf.Abs(Vector3.Dot(val, ((Component)this).transform.right));
			if (kind == AttackKind.Bite)
			{
				if (num2 > -0.3f && num2 < 1.75f * num)
				{
					return num3 < 0.5f * num + 0.3f;
				}
				return false;
			}
			if (num2 > 0f && num2 < 2.75f * num)
			{
				return num3 < 0.42f * num + 0.4f;
			}
			return false;
		}

		[ClientRpc]
		public void AttackClientRpc(int kind)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2412836500u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, kind);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2412836500u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				curAttack = (AttackKind)kind;
				bool flag = curAttack == AttackKind.Bite;
				attackStart = Time.time;
				attackHitDone = false;
				lungeHit = false;
				lungeResolved = false;
				attackEnd = Time.time + (flag ? 0.9f : 3.9f);
				nextAttackTime = attackEnd + 0.7f;
				if (flag ? hasBiteParam : hasLungeParam)
				{
					base.creatureAnimator.SetTrigger(flag ? "Bite" : "Lunge");
				}
				Voice(flag ? "bite" : "lunge", 1f, transmit: true);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void LungeHitServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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 val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2308472203u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 2308472203u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					lungeHit = true;
				}
			}
		}

		[ClientRpc]
		public void RecoverClientRpc(bool hit)
		{
			//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_00dc: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1330315616u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref hit, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1330315616u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				curAttack = AttackKind.Recover;
				attackStart = Time.time;
				attackEnd = Time.time + (hit ? 2.2f : 5.5f);
				nextAttackTime = attackEnd + 0.5f;
				groansLeft = ((!hit) ? 2 : 0);
				nextGroanTime = Time.time + 1.5f;
				if (hasRecoverState)
				{
					base.creatureAnimator.CrossFadeInFixedTime("Recover", 0.1f, 0, hit ? 3.3f : 0f);
				}
			}
		}

		[ClientRpc]
		public void LightsOutClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3862888381u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3862888381u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			RoundManager instance = RoundManager.Instance;
			if ((Object)(object)instance == (Object)null || lightsTurnedOff)
			{
				return;
			}
			lightsTurnedOff = true;
			lightsWereOffBefore = instance.powerOffPermanently;
			dockedLungs.Clear();
			LungProp[] array = Object.FindObjectsOfType<LungProp>();
			foreach (LungProp val3 in array)
			{
				if (val3.isLungDocked)
				{
					dockedLungs.Add(val3);
				}
			}
			instance.powerOffPermanently = true;
			instance.TurnOnAllLights(false);
			BreakerBox val4 = Object.FindObjectOfType<BreakerBox>();
			if ((Object)(object)val4 != (Object)null && (Object)(object)val4.breakerBoxHum != (Object)null)
			{
				val4.breakerBoxHum.Stop();
			}
		}

		private void RestoreLights()
		{
			if (!lightsTurnedOff)
			{
				return;
			}
			lightsTurnedOff = false;
			RoundManager instance = RoundManager.Instance;
			if ((Object)(object)instance == (Object)null || lightsWereOffBefore)
			{
				return;
			}
			foreach (LungProp dockedLung in dockedLungs)
			{
				if ((Object)(object)dockedLung == (Object)null || !dockedLung.isLungDocked)
				{
					return;
				}
			}
			instance.powerOffPermanently = false;
			BreakerBox val = Object.FindObjectOfType<BreakerBox>();
			if (!((Object)(object)val != (Object)null) || val.leversSwitchedOff <= 0)
			{
				instance.TurnOnAllLights(true);
				if ((Object)(object)val != (Object)null && (Object)(object)val.breakerBoxHum != (Object)null)
				{
					val.breakerBoxHum.Play();
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			((EnemyAI)this).KillEnemy(destroy);
			RestoreLights();
		}

		private static void SetupAudio(AudioSource? source, float maxDistance)
		{
			if (!((Object)(object)source == (Object)null))
			{
				source.spatialBlend = 1f;
				source.rolloffMode = (AudioRolloffMode)1;
				source.minDistance = 4f;
				source.maxDistance = maxDistance;
				source.dopplerLevel = 0f;
			}
		}

		private void Voice(string sound, float volume, bool transmit = false)
		{
			AudioClip val = Sounds.Get(sound);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)base.creatureVoice == (Object)null))
			{
				base.creatureVoice.PlayOneShot(val, volume);
				if (transmit)
				{
					WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume);
				}
			}
		}

		private void Sfx(string sound, float volume)
		{
			AudioClip val = Sounds.Get(sound);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)base.creatureSFX == (Object)null))
			{
				base.creatureSFX.pitch = Random.Range(0.92f, 1.08f);
				base.creatureSFX.PlayOneShot(val, volume);
			}
		}

		private void UpdateSounds()
		{
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			bool flag = curAttack != AttackKind.None || Time.time < screamUntil;
			if (!flag && moveSpeed > 0.4f)
			{
				stepDistance += moveSpeed * Time.deltaTime;
				bool flag2 = currentBehaviourStateIndex == 3;
				if (stepDistance >= (flag2 ? 2.1f : 1.35f) && Time.time - lastStepTime > 0.2f)
				{
					stepDistance = 0f;
					lastStepTime = Time.time;
					Sfx("step", flag2 ? 1f : ((currentBehaviourStateIndex == 1) ? 0.35f : Mathf.Clamp(0.4f + moveSpeed * 0.07f, 0.5f, 0.9f)));
				}
			}
			if (currentBehaviourStateIndex == 3 && Time.time >= nextWailTime && Time.time >= screamUntil && curAttack != AttackKind.Lunge && curAttack != AttackKind.Recover)
			{
				wailToggle = !wailToggle;
				AudioClip val = Sounds.Get(wailToggle ? "wail" : "sob");
				nextWailTime = Time.time + (((Object)(object)val != (Object)null) ? (val.length * 0.93f) : 2f);
				if ((Object)(object)val != (Object)null && (Object)(object)base.creatureVoice != (Object)null)
				{
					base.creatureVoice.PlayOneShot(val, 1f);
				}
			}
			if (Time.time >= nextCroakTime)
			{
				nextCroakTime = Time.time + Random.Range(6f, 14f);
				if (!flag && currentBehaviourStateIndex == 0)
				{
					Voice("croak", 0.75f);
				}
				else if (!flag && currentBehaviourStateIndex == 1)
				{
					Voice("croak", 0.4f);
				}
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (base.isEnemyDead)
			{
				return;
			}
			Voice("hurt", 0.9f);
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0)
			{
				if (base.currentSearch.inProgress)
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
				}
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
		}

		[ClientRpc]
		public void ScreamClientRpc(bool rage)
		{
			//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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(412599039u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref rage, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 412599039u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				screamUntil = Mathf.Max(screamUntil, Time.time + 1.3f);
				if (rage ? hasRageParam : hasScreamParam)
				{
					base.creatureAnimator.SetTrigger(rage ? "RageScream" : "Scream");
				}
				AudioClip val3 = Sounds.Get(rage ? "rage" : "scream") ?? ((rage && (Object)(object)rageSFX != (Object)null) ? rageSFX : screamSFX);
				if ((Object)(object)val3 != (Object)null)
				{
					base.creatureVoice.PlayOneShot(val3);
					WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val3, 1f);
				}
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if ((Object)(object)localPlayerController != (Object)null && Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)this).transform.position) < 15f)
				{
					HUDManager.Instance.ShakeCamera((ScreenShakeType)(rage ? 1 : 0));
				}
			}
		}

		[ClientRpc]
		public void SetRageTargetClientRpc(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)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1833162655u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1833162655u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (playerId >= 0)
				{
					nextWailTime = Time.time + 1.4f;
				}
				base.targetPlayer = ((playerId < 0) ? null : StartOfRound.Instance.allPlayerScripts[playerId]);
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2412836500u, new RpcReceiveHandler(__rpc_handler_2412836500), "AttackClientRpc");
			((NetworkBehaviour)this).__registerRpc(2308472203u, new RpcReceiveHandler(__rpc_handler_2308472203), "LungeHitServerRpc");
			((NetworkBehaviour)this).__registerRpc(1330315616u, new RpcReceiveHandler(__rpc_handler_1330315616), "RecoverClientRpc");
			((NetworkBehaviour)this).__registerRpc(3862888381u, new RpcReceiveHandler(__rpc_handler_3862888381), "LightsOutClientRpc");
			((NetworkBehaviour)this).__registerRpc(412599039u, new RpcReceiveHandler(__rpc_handler_412599039), "ScreamClientRpc");
			((NetworkBehaviour)this).__registerRpc(1833162655u, new RpcReceiveHandler(__rpc_handler_1833162655), "SetRageTargetClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_2412836500(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 kind = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref kind);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ExampleEnemyAI)(object)target).AttackClientRpc(kind);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2308472203(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;
				((ExampleEnemyAI)(object)target).LungeHitServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1330315616(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 hit = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hit, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ExampleEnemyAI)(object)target).RecoverClientRpc(hit);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3862888381(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;
				((ExampleEnemyAI)(object)target).LightsOutClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_412599039(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 rage = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref rage, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((ExampleEnemyAI)(object)target).ScreamClientRpc(rage);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1833162655(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 = targ