Decompiled source of Lethal Gorilla v1.0.3

bcs4313_Gorilla.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using SolidLib.Registry;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using bcs4313_Gorilla.NetcodePatcher;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("bcs4313")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A wild Gorilla for Lethal Company.")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d281c8602246f8fa3bf4536ffca3fe971b0d7508")]
[assembly: AssemblyProduct("Gorilla")]
[assembly: AssemblyTitle("bcs4313_Gorilla")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Gorilla
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("bcs4313_Gorilla", "Gorilla", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static class Assets
		{
			public static AssetBundle MainAssetBundle;

			public static void PopulateAssets()
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "bcs_gorillaenemybundle"));
				if ((Object)(object)MainAssetBundle == (Object)null)
				{
					Logger.LogError((object)"Failed to load custom assets.");
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_SpawnScrapInLevel <>9__2_0;

			public static hook_DespawnPropsAtEndOfRound <>9__2_1;

			public static hook_DamagePlayer <>9__2_2;

			internal void <Awake>b__2_0(orig_SpawnScrapInLevel orig, RoundManager self)
			{
				orig.Invoke(self);
			}

			internal void <Awake>b__2_1(orig_DespawnPropsAtEndOfRound orig, RoundManager self, bool despawnAllItems)
			{
				orig.Invoke(self, despawnAllItems);
			}

			internal void <Awake>b__2_2(orig_DamagePlayer orig, PlayerControllerB self, int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
			{
				//IL_0008: 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)
				orig.Invoke(self, damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
			}
		}

		public static Harmony _harmony;

		public static ManualLogSource Logger;

		public static ConfigEntry<float> soulRarity;

		public static ConfigEntry<string> devourerSpawnDist;

		public static ConfigEntry<float> angerMultiplier;

		private void Awake()
		{
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			bindVars();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			Random.InitState((int)DateTime.Now.Ticks);
			try
			{
				string assetName = "GorillaEType";
				string text = ScaleAllIntegers(devourerSpawnDist.Value, soulRarity.Value);
				List<EnemyConfig> list = new List<EnemyConfig>();
				list.Add(new EnemyConfig
				{
					Name = "Gorilla Enemy",
					AssetName = assetName,
					TerminalKeywordAsset = "GorillaTK",
					TerminalNodeAsset = "GorillaTN",
					Enabled = true,
					MaxSpawnCount = 100,
					PowerLevel = 2f,
					SpawnWeights = text
				});
				EnemyInitializer.Initialize("bcs_gorillaenemybundle", list);
				Debug.Log((object)("Gorilla Enemy loaded with the following spawn weights: " + text));
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Error initializing the Gorilla Enemy, maybe the spawn distribution you entered is malformed? : error -> " + ex.ToString()));
			}
			object obj = <>c.<>9__2_0;
			if (obj == null)
			{
				hook_SpawnScrapInLevel val = delegate(orig_SpawnScrapInLevel orig, RoundManager self)
				{
					orig.Invoke(self);
				};
				<>c.<>9__2_0 = val;
				obj = (object)val;
			}
			RoundManager.SpawnScrapInLevel += (hook_SpawnScrapInLevel)obj;
			object obj2 = <>c.<>9__2_1;
			if (obj2 == null)
			{
				hook_DespawnPropsAtEndOfRound val2 = delegate(orig_DespawnPropsAtEndOfRound orig, RoundManager self, bool despawnAllItems)
				{
					orig.Invoke(self, despawnAllItems);
				};
				<>c.<>9__2_1 = val2;
				obj2 = (object)val2;
			}
			RoundManager.DespawnPropsAtEndOfRound += (hook_DespawnPropsAtEndOfRound)obj2;
			object obj3 = <>c.<>9__2_2;
			if (obj3 == null)
			{
				hook_DamagePlayer val3 = delegate(orig_DamagePlayer orig, PlayerControllerB self, int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
				{
					//IL_0008: 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)
					orig.Invoke(self, damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
				};
				<>c.<>9__2_2 = val3;
				obj3 = (object)val3;
			}
			PlayerControllerB.DamagePlayer += (hook_DamagePlayer)obj3;
			Logger.LogInfo((object)"Plugin bcs4313_Gorilla is loaded!");
		}

		public static string ScaleAllIntegers(string input, float multiplier)
		{
			return Regex.Replace(input, "\\d+", delegate(Match match)
			{
				int num = int.Parse(match.Value);
				return ((int)Math.Round((float)num * multiplier)).ToString();
			});
		}

		public void bindVars()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_008a: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_009c: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_00a2: 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_00b4: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_00e4: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			soulRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Spawning", "Enemy Spawnrate Multiplier", 1f, "Changes the spawnrate of the Gorilla across ALL planets. Decimals are accepted, 2.0 = approximately double the spawnrate. 0.5 is half the spawnrate.");
			devourerSpawnDist = ((BaseUnityPlugin)this).Config.Bind<string>("Spawning", "Enemy Spawn Weights", "ExperimentationLevel:12,AssuranceLevel:24,OffenseLevel:24,MarchLevel:80,AdamanceLevel:80,DineLevel:17,RendLevel:17,TitanLevel:17,ArtificeLevel:32,Modded:55", "The spawn weight of the Gorilla (multiplied by enemy spawnrate value) and the moons that the enemy can spawn on, in the form of a comma separated list of selectable level names and a weight value (e.g. \"ExperimentationLevel:300,DineLevel:20,RendLevel:10,Modded:10\")\r\nThe following strings: \"All\", \"Vanilla\", \"Modded\" are also valid.");
			angerMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Behaviour", "Anger Multiplier", 0.3f, "The higher the value, the quicker the gorilla gets angry from player presence. Set to 0 if you want a peaceful gorilla (towards players that don't attack).");
			ConfigEntry<float> obj = soulRarity;
			FloatInputFieldOptions val = new FloatInputFieldOptions
			{
				RequiresRestart = true
			};
			((BaseRangeOptions<float>)val).Min = 0.01f;
			((BaseRangeOptions<float>)val).Max = 100f;
			FloatInputFieldConfigItem val2 = new FloatInputFieldConfigItem(obj, val);
			TextInputFieldConfigItem val3 = new TextInputFieldConfigItem(devourerSpawnDist, new TextInputFieldOptions
			{
				RequiresRestart = true
			});
			ConfigEntry<float> obj2 = angerMultiplier;
			FloatInputFieldOptions val4 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val4).Min = 0f;
			((BaseRangeOptions<float>)val4).Max = 100f;
			FloatInputFieldConfigItem val5 = new FloatInputFieldConfigItem(obj2, val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "bcs4313_Gorilla";

		public const string PLUGIN_NAME = "Gorilla";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Gorilla.src
{
	internal class EntityWarp
	{
		public struct entrancePack
		{
			public EntranceTeleport tele;

			public Vector3 navPosition;
		}

		public static EntranceTeleport[] mapEntrances;

		public static entrancePack findNearestEntrance(EnemyAI __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			float num = 100000000f;
			EntranceTeleport val = null;
			EntranceTeleport[] array = mapEntrances;
			for (int i = 0; i < array.Length; i++)
			{
				if (__instance.isOutside == array[i].isEntranceToBuilding && Vector3.Distance(((Component)__instance).transform.position, ((Component)array[i]).transform.position) < num)
				{
					num = Vector3.Distance(((Component)__instance).transform.position, ((Component)array[i]).transform.position);
					val = array[i];
				}
			}
			entrancePack result = default(entrancePack);
			NavMeshHit val2 = default(NavMeshHit);
			if ((Object)(object)val != (Object)null && NavMesh.SamplePosition(((Component)val).transform.position, ref val2, 10f, -1))
			{
				result.navPosition = ((NavMeshHit)(ref val2)).position;
			}
			result.tele = val;
			return result;
		}

		public static void SendEnemyInside(EnemyAI __instance)
		{
			//IL_0069: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = false;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			EntranceTeleport tele = findNearestEntrance(__instance).tele;
			if (!Object.op_Implicit((Object)(object)tele))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport.");
			}
			Transform entrancePoint = tele.entrancePoint;
			if (!Object.op_Implicit((Object)(object)entrancePoint))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position.");
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1))
			{
				__instance.serverPosition = ((NavMeshHit)(ref val)).position;
				((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position;
				__instance.agent.Warp(__instance.serverPosition);
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position");
			}
		}

		public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true)
		{
			//IL_0069: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = true;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			EntranceTeleport tele = findNearestEntrance(__instance).tele;
			if (!Object.op_Implicit((Object)(object)tele))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport.");
			}
			Transform entrancePoint = tele.entrancePoint;
			if (!Object.op_Implicit((Object)(object)entrancePoint))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position.");
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1))
			{
				__instance.serverPosition = ((NavMeshHit)(ref val)).position;
				((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position;
				__instance.agent.Warp(__instance.serverPosition);
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position");
			}
		}
	}
	internal class GorillaAI : EnemyAI
	{
		public enum State
		{
			Patrol,
			AssertDom,
			Aggro,
			PerformingGrapple,
			InvestigateNoise,
			EnemyAggro
		}

		private enum AssertDomPhase
		{
			Idle,
			ChestBeat,
			Moving
		}

		public enum Personality
		{
			Normal,
			Brawler,
			Thrower,
			Friendly
		}

		private enum TreeHopKind
		{
			Climb,
			Cling,
			Leap,
			Drop
		}

		private struct TreeHopSegment
		{
			public TreeHopKind kind;

			public Vector3 from;

			public Vector3 to;

			public float duration;
		}

		public AudioSource[] GorillaPassiveSounds;

		public AudioSource[] GorillaStressedSounds;

		public AudioSource[] GorillaAngrySounds;

		public static float moveSpeed = 6f;

		public static float sightWidth = 120f;

		public static float sightRange = 60f;

		public static float loseTargetSeconds = 7.5f;

		public static float attackRange = 3f;

		public static int attackDamage = 20;

		public static float attackCooldown = 1.3f;

		public static int maxHP = 10;

		public float anger = 0f;

		public Transform grabPoint;

		public Transform slamPoint;

		public Animator animator;

		protected float timeSinceSeen = 0f;

		protected float timeSinceAttack = 0f;

		public bool willWarnThisTime = false;

		private float minimumDomCooldown = 3f;

		private float timeSinceAssertDom = 0f;

		protected float walkAnimationCoefficient = 3f;

		public static float angerBuildMultiplier = 7.2f;

		public static float angerNearRange = 25f;

		public static float angerDecayStartNear = 27f;

		public static float angerDecayStartFar = 35f;

		public static float angerDecayPerTick = 3f;

		public static float noiseIgnoreBelow = 0.34f;

		public static float noiseLoudAt = 0.45f;

		public static float noisePlayerRadius = 3f;

		public static float noiseSuperCloseRange = 2f;

		public static float noiseAngerNormalFar = 15f;

		public static float noiseAngerNormalClose = 30f;

		public static float noiseAngerLoudFar = 45f;

		public static float noiseAngerLoudClose = 120f;

		public static float noiseAngerMax = 120f;

		public static float investigateWalkTimeout = 8f;

		public static float investigateLookSeconds = 4f;

		public static float investigateTurnSpeed = 120f;

		private float investigateEndsAt;

		private float investigateLookEndsAt;

		private bool investigateArrived;

		private Vector3 investigatePoint;

		public static float chanceToWarnPlayer = 0.88f;

		private float AssertDomDistanceMin = 7f;

		private float AssertDomDistanceMax = 16f;

		public float assertDomIdleSeconds = 1.5f;

		public float assertDomChestSeconds = 2.6f;

		public float assertDomRunTimeout = 8f;

		public float assertDomTurnSpeed = 360f;

		private AssertDomPhase assertDomPhase;

		private bool assertDomActive;

		private float assertDomPhaseEndsAt;

		private Vector3 assertDomDestination;

		private readonly NavMeshPath assertDomPath = new NavMeshPath();

		private bool grappling = false;

		public static float staminaDivisor = 80f;

		public static float staminaSpeedMin = 0.75f;

		private float timeTillGrapplingAvailable = 0f;

		public static float grappleCooldown = 3f;

		private bool basicSlamming = false;

		private PlayerControllerB grabbedPlayer;

		public static int whiplashTicks = 40;

		private int basicSlamTicks = 20;

		public BoxCollider slamHitbox;

		private float beatdownTicks = 46f;

		private int beatDownSlamIndex = 36;

		private static readonly ScreenShakeType[] shakeSteps = (ScreenShakeType[])(object)new ScreenShakeType[3]
		{
			default(ScreenShakeType),
			(ScreenShakeType)1,
			(ScreenShakeType)3
		};

		public static float shakeCloseRange = 5f;

		public static float shakeMidRange = 12f;

		public static float shakeMaxRange = 20f;

		private PlayerControllerB heldPlayer;

		private PlayerControllerB pinnedPlayer = null;

		public AudioSource GorillaSlam1;

		public AudioSource GorillaSlam2;

		public static float enemyHitSearchRange = 4f;

		public static int enemyGrabDamageMin = 1;

		public static int enemyGrabDamageMax = 1;

		private EnemyAI enemyAggroTarget;

		private EnemyAI enemyGrabVictim;

		private EnemyAI heldEnemy;

		private ulong heldEnemyNetId;

		public static float allyAlertRange = 55f;

		public static float treeHopChancePerTick = 0.03f;

		public static float treeHopSearchRange = 26f;

		public static float treeHopWalkStopDistance = 1.2f;

		public static float treeHopClimbHeight = 6f;

		public static float treeHopClimbSpeed = 6f;

		public static float treeHopClingSeconds = 2.5f;

		public static float treeHopLeapSeconds = 0.6f;

		public static float treeHopLeapArc = 2f;

		public static float treeHopDropSpeed = 9f;

		public static float treeHopChainChance = 0.78f;

		public static float treeHopCooldown = 4f;

		private readonly Queue<TreeHopSegment> treeHopSegments = new Queue<TreeHopSegment>();

		private TreeHopSegment treeHopCurrent;

		private float treeHopElapsed;

		private bool treeHopActive = false;

		private List<GameObject> treeHopTrees;

		private readonly List<GameObject> treeHopCandidates = new List<GameObject>();

		private GameObject treeHopCurrentTree;

		private GameObject treeHopTargetTree;

		private Vector3 treeHopTrunk;

		private bool treeHopWalking = false;

		private float timeSinceTreeHop = 999f;

		public override void Start()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			base.enemyHP = maxHP;
			base.agent.speed = moveSpeed;
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			RerollWarnChance();
			treeHopTrees = new List<GameObject>(GameObject.FindGameObjectsWithTag("Tree"));
		}

		public override void Update()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (!base.isEnemyDead)
			{
				TickTreeHop();
				timeSinceAttack += Time.deltaTime;
				Transform transform = ((Component)this).transform;
				Quaternion rotation = ((Component)this).transform.rotation;
				transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y, 0f);
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || treeHopActive)
			{
				return;
			}
			AudioStep();
			if ((Object)(object)FindVisiblePlayer() == (Object)null)
			{
				anger -= angerDecayPerTick;
				if (anger < 0f)
				{
					anger = 0f;
				}
			}
			if (anger > 160f)
			{
				anger = 160f;
			}
			switch ((State)base.currentBehaviourStateIndex)
			{
			case State.Patrol:
				DoPatrol();
				break;
			case State.AssertDom:
				DoAssertDom();
				break;
			case State.Aggro:
				DoAggro();
				break;
			case State.InvestigateNoise:
				DoInvestigateNoise();
				break;
			case State.EnemyAggro:
				DoEnemyAggro();
				break;
			}
			timeTillGrapplingAvailable -= 0.2f;
		}

		public void AudioStep()
		{
			int num = 0;
			switch ((State)base.currentBehaviourStateIndex)
			{
			case State.Patrol:
			case State.InvestigateNoise:
			{
				num = GorillaPassiveSounds.Length;
				AudioSource[] gorillaPassiveSounds = GorillaPassiveSounds;
				foreach (AudioSource val2 in gorillaPassiveSounds)
				{
					if (val2.isPlaying)
					{
						return;
					}
				}
				break;
			}
			case State.AssertDom:
			{
				num = GorillaStressedSounds.Length;
				AudioSource[] gorillaStressedSounds = GorillaStressedSounds;
				foreach (AudioSource val3 in gorillaStressedSounds)
				{
					if (val3.isPlaying)
					{
						return;
					}
				}
				break;
			}
			case State.Aggro:
			case State.EnemyAggro:
			{
				num = GorillaAngrySounds.Length;
				AudioSource[] gorillaAngrySounds = GorillaAngrySounds;
				foreach (AudioSource val in gorillaAngrySounds)
				{
					if (val.isPlaying)
					{
						return;
					}
				}
				break;
			}
			}
			PushSoundClientRpc((State)base.currentBehaviourStateIndex, Random.Range(0, num));
		}

		[ClientRpc]
		public void PushSoundClientRpc(State aiState, int num)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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(549286129u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<State>(ref aiState, default(ForEnums));
				BytePacker.WriteValueBitPacked(val, num);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 549286129u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			switch (aiState)
			{
			case State.Patrol:
			case State.InvestigateNoise:
			{
				GorillaPassiveSounds[num].Play();
				AudioSource[] gorillaAngrySounds = GorillaAngrySounds;
				foreach (AudioSource val5 in gorillaAngrySounds)
				{
					val5.Stop();
				}
				AudioSource[] gorillaStressedSounds2 = GorillaStressedSounds;
				foreach (AudioSource val6 in gorillaStressedSounds2)
				{
					val6.Stop();
				}
				break;
			}
			case State.AssertDom:
			{
				GorillaStressedSounds[num].Play();
				AudioSource[] gorillaAngrySounds2 = GorillaAngrySounds;
				foreach (AudioSource val7 in gorillaAngrySounds2)
				{
					val7.Stop();
				}
				AudioSource[] gorillaPassiveSounds2 = GorillaPassiveSounds;
				foreach (AudioSource val8 in gorillaPassiveSounds2)
				{
					val8.Stop();
				}
				break;
			}
			case State.Aggro:
			case State.EnemyAggro:
			{
				GorillaAngrySounds[num].Play();
				AudioSource[] gorillaStressedSounds = GorillaStressedSounds;
				foreach (AudioSource val3 in gorillaStressedSounds)
				{
					val3.Stop();
				}
				AudioSource[] gorillaPassiveSounds = GorillaPassiveSounds;
				foreach (AudioSource val4 in gorillaPassiveSounds)
				{
					val4.Stop();
				}
				break;
			}
			case State.PerformingGrapple:
				break;
			}
		}

		private void DoPatrol()
		{
			base.agent.speed = moveSpeed;
			MovementAnimationBlock();
			AddAnger();
			PlayerControllerB val = FindVisiblePlayer();
			if ((Object)(object)val != (Object)null)
			{
				CancelPendingTreeHop();
				base.targetPlayer = val;
				timeSinceSeen = 0f;
				if (anger >= 100f)
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
					return;
				}
			}
			else
			{
				UpdateTreeHopRoam();
			}
			if (anger >= 40f && willWarnThisTime && Time.time - timeSinceAssertDom > minimumDomCooldown)
			{
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				timeSinceAssertDom = Time.time;
				RerollWarnChance();
			}
		}

		public void MovementAnimationBlock()
		{
			//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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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)
			Vector3 velocity = base.agent.velocity;
			AnimatorStateInfo currentAnimatorStateInfo;
			if (((Vector3)(ref velocity)).magnitude > base.agent.speed / 4f)
			{
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("GORILLARUN"))
				{
					DoAnim(1);
				}
				Animator obj = animator;
				velocity = base.agent.velocity;
				float animSpeedClientRpc = (obj.speed = ((Vector3)(ref velocity)).magnitude / walkAnimationCoefficient);
				SetAnimSpeedClientRpc(animSpeedClientRpc);
				return;
			}
			velocity = base.agent.velocity;
			if (((Vector3)(ref velocity)).magnitude <= base.agent.speed / 8f)
			{
				currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0);
				if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("GORILLA IDLE"))
				{
					DoAnim(0);
					SetAnim("GORILLA IDLE");
				}
				SetAnimSpeedClientRpc(1f);
			}
		}

		public void AddAnger()
		{
			PlayerControllerB val = FindClosestPlayer();
			if ((Object)(object)val != (Object)null)
			{
				base.targetPlayer = val;
				timeSinceSeen = 0f;
				AddAngerFromDist(base.targetPlayer);
			}
		}

		public void AddAngerFromDist(PlayerControllerB ply)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position - ((Component)ply).transform.position;
			float magnitude = ((Vector3)(ref val)).magnitude;
			Transform val2 = (((Object)(object)ply.playerEye != (Object)null) ? ((Component)ply.playerEye).transform : ((Component)ply).transform);
			float num = Mathf.Max(0f, Vector3.Dot(val2.forward, ((Vector3)(ref val)).normalized)) + 0.5f;
			float num2 = (ply.isCrouching ? 0.33f : 1f);
			if (ply.isCrouching && base.currentBehaviourStateIndex == 1)
			{
				num2 *= 0.2f;
			}
			if (ply.isCrouching && magnitude >= angerNearRange)
			{
				num2 *= 0f;
			}
			if (magnitude <= angerNearRange)
			{
				float num3 = Mathf.Lerp(0.5f, 1f, num);
				anger += 2f / (1f + (float)Math.Pow(magnitude, 0.5)) * angerBuildMultiplier * num3 * num2 * Plugin.angerMultiplier.Value;
				return;
			}
			float num4 = Mathf.Lerp(angerDecayStartNear, angerDecayStartFar, num);
			if (magnitude < num4)
			{
				float num5 = Mathf.Lerp(0.25f, 1f, num);
				anger += 2f / (1f + (float)Math.Pow(magnitude, 0.5)) * angerBuildMultiplier * num5 * num2 * Plugin.angerMultiplier.Value;
			}
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesNoisePlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesNoisePlayedInOneSpot, noiseID);
			if (base.isEnemyDead || !((NetworkBehaviour)RoundManager.Instance).IsHost || noiseID == 7)
			{
				return;
			}
			State currentBehaviourStateIndex = (State)base.currentBehaviourStateIndex;
			if ((currentBehaviourStateIndex != State.Patrol && currentBehaviourStateIndex != State.AssertDom) || noiseLoudness < noiseIgnoreBelow || (Object)(object)FindPlayerAt(noisePosition) == (Object)null)
			{
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, noisePosition);
			if (!(num > angerDecayStartFar))
			{
				bool flag = noiseLoudness >= noiseLoudAt;
				float num2 = ((num <= noiseSuperCloseRange) ? noiseAngerMax : ((!(num <= angerNearRange)) ? (flag ? noiseAngerLoudFar : noiseAngerNormalFar) : (flag ? noiseAngerLoudClose : noiseAngerNormalClose)));
				Debug.Log((object)("Noise detected: ID = " + noiseID + " loudness = " + noiseLoudness));
				if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
				{
					num2 /= 2f;
				}
				anger += num2 * Plugin.angerMultiplier.Value;
				if (flag && currentBehaviourStateIndex == State.Patrol && !treeHopActive)
				{
					StartInvestigateNoise(noisePosition);
				}
			}
		}

		private PlayerControllerB FindPlayerAt(Vector3 pos)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return null;
			}
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && Vector3.Distance(((Component)val).transform.position, pos) <= noisePlayerRadius)
				{
					return val;
				}
			}
			return null;
		}

		private void StartInvestigateNoise(Vector3 noisePosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(noisePosition, ref val, 4f, base.agent.areaMask))
			{
				CancelPendingTreeHop();
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				investigatePoint = ((NavMeshHit)(ref val)).position;
				investigateArrived = false;
				investigateEndsAt = Time.time + investigateWalkTimeout;
				base.agent.speed = moveSpeed;
				((EnemyAI)this).SwitchToBehaviourClientRpc(4);
				((EnemyAI)this).SetDestinationToPosition(investigatePoint, false);
			}
		}

		private void DoInvestigateNoise()
		{
			//IL_002d: 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_0161: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = FindVisiblePlayer();
			if ((Object)(object)val != (Object)null)
			{
				base.targetPlayer = val;
				timeSinceSeen = 0f;
				facePosition(((Component)val).transform.position);
				base.agent.ResetPath();
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
			else if (!investigateArrived)
			{
				MovementAnimationBlock();
				if ((!base.agent.pathPending && Vector3.Distance(((Component)this).transform.position, investigatePoint) <= Mathf.Max(base.agent.stoppingDistance + 0.25f, 0.75f)) || Time.time >= investigateEndsAt)
				{
					investigateArrived = true;
					investigateLookEndsAt = Time.time + investigateLookSeconds;
					base.agent.ResetPath();
					((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false);
					DoAnim(0);
				}
			}
			else
			{
				((Component)this).transform.Rotate(0f, investigateTurnSpeed * 0.2f, 0f);
				if (Time.time >= investigateLookEndsAt)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					RerollWarnChance();
				}
			}
		}

		public void RerollWarnChance()
		{
			willWarnThisTime = Random.Range(0f, 1f) < chanceToWarnPlayer;
		}

		private void DoAssertDom()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Invalid comparison between Unknown and I4
			AddAnger();
			if ((Object)(object)base.agent == (Object)null)
			{
				return;
			}
			if (anger >= 100f && assertDomPhase != AssertDomPhase.ChestBeat)
			{
				assertDomActive = false;
				base.agent.updateRotation = true;
				((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				return;
			}
			base.targetPlayer = FindClosestAssertDomPlayer();
			if (anger <= 10f)
			{
				assertDomActive = false;
				base.agent.updateRotation = true;
				base.agent.speed = moveSpeed;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				RerollWarnChance();
				return;
			}
			if (!assertDomActive)
			{
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				base.movingTowardsTargetPlayer = false;
				timeSinceSeen = 0f;
				assertDomActive = true;
				BeginAssertDomStill(AssertDomPhase.Idle, 0, assertDomIdleSeconds);
				return;
			}
			switch (assertDomPhase)
			{
			case AssertDomPhase.Idle:
				if (Object.op_Implicit((Object)(object)base.targetPlayer))
				{
					facePosition(((Component)base.targetPlayer).transform.position);
				}
				base.agent.updateRotation = true;
				if (Time.time >= assertDomPhaseEndsAt)
				{
					SetAnimSpeedClientRpc(1f);
					BeginAssertDomStill(AssertDomPhase.ChestBeat, 2, assertDomChestSeconds);
				}
				break;
			case AssertDomPhase.ChestBeat:
				base.agent.updateRotation = false;
				if (Object.op_Implicit((Object)(object)base.targetPlayer))
				{
					facePosition(((Component)base.targetPlayer).transform.position);
				}
				if (!(Time.time < assertDomPhaseEndsAt))
				{
					if (TryFindAssertDomDestination(base.targetPlayer, out assertDomDestination))
					{
						assertDomPhase = AssertDomPhase.Moving;
						assertDomPhaseEndsAt = Time.time + assertDomRunTimeout;
						base.agent.speed = moveSpeed;
						DoAnim(1);
						((EnemyAI)this).SetDestinationToPosition(assertDomDestination, false);
					}
					else
					{
						BeginAssertDomStill(AssertDomPhase.Idle, 0, assertDomIdleSeconds);
					}
				}
				break;
			case AssertDomPhase.Moving:
			{
				base.agent.updateRotation = true;
				bool flag = !base.agent.pathPending && Vector3.Distance(((Component)this).transform.position, assertDomDestination) <= Mathf.Max(base.agent.stoppingDistance + 0.25f, 0.75f);
				bool flag2 = !base.agent.pathPending && (!base.agent.hasPath || (int)base.agent.pathStatus > 0);
				if (flag || flag2 || Time.time >= assertDomPhaseEndsAt)
				{
					BeginAssertDomStill(AssertDomPhase.Idle, 0, assertDomIdleSeconds);
				}
				break;
			}
			}
		}

		private void BeginAssertDomStill(AssertDomPhase phase, int animation, float seconds)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			assertDomPhase = phase;
			assertDomPhaseEndsAt = Time.time + Mathf.Max(0f, seconds);
			base.agent.speed = 0f;
			base.agent.ResetPath();
			((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false);
			DoAnim(animation);
		}

		public void facePosition(Vector3 pos)
		{
			//IL_0001: 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_0012: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			Vector3 val = pos - ((Component)this).transform.position;
			val.y = 0f;
			if (val != Vector3.zero)
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref val2)).eulerAngles.y, 0f);
			}
		}

		private PlayerControllerB FindClosestAssertDomPlayer()
		{
			//IL_0075: 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_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return null;
			}
			PlayerControllerB result = null;
			float num = float.MaxValue;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
				{
					Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position;
					float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						result = val;
					}
				}
			}
			return result;
		}

		private bool TryFindAssertDomDestination(PlayerControllerB player, out Vector3 destination)
		{
			//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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Invalid comparison between Unknown and I4
			//IL_01b2: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: 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_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			destination = ((Component)this).transform.position;
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			Vector3 val = ((Component)this).transform.position - ((Component)player).transform.position;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude < 0.001f)
			{
				val = ((Component)this).transform.forward;
			}
			((Vector3)(ref val)).Normalize();
			float num = float.NegativeInfinity;
			bool result = false;
			NavMeshHit val4 = default(NavMeshHit);
			for (int i = 0; i < 5; i++)
			{
				Vector3 val2 = Quaternion.Euler(0f, Random.Range(-75f, 75f), 0f) * val;
				float num2 = Random.Range(AssertDomDistanceMin, AssertDomDistanceMax);
				Vector3 val3 = ((Component)player).transform.position + val2 * num2;
				val3.y = ((Component)this).transform.position.y;
				if (!NavMesh.SamplePosition(val3, ref val4, 2f, base.agent.areaMask))
				{
					continue;
				}
				float num3 = Vector3.Distance(((NavMeshHit)(ref val4)).position, ((Component)player).transform.position);
				if (!(num3 < AssertDomDistanceMin) && !(num3 > AssertDomDistanceMax) && !(Vector3.Distance(((NavMeshHit)(ref val4)).position, ((Component)this).transform.position) < 2f) && base.agent.CalculatePath(((NavMeshHit)(ref val4)).position, assertDomPath) && (int)assertDomPath.status <= 0)
				{
					Vector3 val5 = ((NavMeshHit)(ref val4)).position - ((Component)player).transform.position;
					val5.y = 0f;
					float num4 = Vector3.Dot(((Vector3)(ref val5)).normalized, val) * 10f + num3 * 0.2f;
					if (num4 > num)
					{
						num = num4;
						destination = ((NavMeshHit)(ref val4)).position;
						result = true;
					}
				}
			}
			return result;
		}

		private void DoAggro()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			base.agent.speed = moveSpeed * Math.Clamp(1.5f * (anger / staminaDivisor), 0.75f, 1.5f);
			MovementAnimationBlock();
			PlayerControllerB val = FindVisiblePlayer();
			if ((Object)(object)val != (Object)null)
			{
				base.targetPlayer = val;
				timeSinceSeen = 0f;
			}
			else
			{
				timeSinceSeen += 0.2f;
			}
			anger -= angerDecayPerTick / 4f;
			base.targetPlayer = FindClosestAssertDomPlayer();
			if (anger <= 20f && !grappling)
			{
				assertDomActive = false;
				base.agent.updateRotation = true;
				base.agent.speed = moveSpeed;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				RerollWarnChance();
			}
			else if ((Object)(object)base.targetPlayer == (Object)null || timeSinceSeen > loseTargetSeconds || !((EnemyAI)this).PlayerIsTargetable(base.targetPlayer, false, false, true))
			{
				base.targetPlayer = null;
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				RerollWarnChance();
				anger = 10f;
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			Debug.Log((object)("Gorilla Player Collide -> " + (object)other));
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if ((Object)(object)component != (Object)null && !base.isEnemyDead && timeSinceAttack >= attackCooldown && (base.currentBehaviourStateIndex == 2 || base.currentBehaviourStateIndex == 1))
			{
				timeSinceAttack = 0f;
				Attack(component);
			}
		}

		private void Attack(PlayerControllerB victim)
		{
			if (timeTillGrapplingAvailable <= 0f)
			{
				timeTillGrapplingAvailable = grappleCooldown;
				if (Random.Range(0f, 1f) > 0.5f)
				{
					StartGrab(victim, "BEATDOWN");
				}
				else
				{
					StartGrab(victim, "Whiplash");
				}
			}
			else if (!basicSlamming)
			{
				((MonoBehaviour)this).StartCoroutine(DoBasicSlam());
			}
		}

		private void StartGrab(PlayerControllerB victim, string CoroutineName)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost && !grappling && !((Object)(object)victim == (Object)null) && !((Object)(object)grabPoint == (Object)null))
			{
				grappling = true;
				grabbedPlayer = victim;
				victim.CancelSpecialTriggerAnimations();
				base.agent.ResetPath();
				base.agent.speed = 0f;
				((EnemyAI)this).SwitchToBehaviourClientRpc(3);
				GrabPlayerClientRpc(((NetworkBehaviour)victim).NetworkObject.NetworkObjectId, grab: true);
				if (CoroutineName == "BEATDOWN")
				{
					((MonoBehaviour)this).StartCoroutine(BeatdownAttack(victim));
				}
				else
				{
					((MonoBehaviour)this).StartCoroutine(WhiplashAttack(victim));
				}
			}
		}

		private void EndGrab()
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				if ((Object)(object)grabbedPlayer != (Object)null)
				{
					GrabPlayerClientRpc(((NetworkBehaviour)grabbedPlayer).NetworkObject.NetworkObjectId, grab: false);
				}
				grabbedPlayer = null;
				pinnedPlayer = null;
				heldPlayer = null;
				grappling = false;
				basicSlamming = false;
				((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			}
		}

		private IEnumerator DoBasicSlam()
		{
			basicSlamming = true;
			DoLayeredAnimClientRpc("GORILLABASEATTACK", 1);
			Vector3 direction = default(Vector3);
			float distance = default(float);
			for (int i = 0; i < basicSlamTicks; i++)
			{
				yield return (object)new WaitForSeconds(0.05f);
				if (i != 6)
				{
					continue;
				}
				PlayerControllerB[] players = RoundManager.Instance.playersManager.allPlayerScripts;
				PlayerControllerB[] array = players;
				foreach (PlayerControllerB player in array)
				{
					Collider plyCol = player.playerCollider;
					if (Physics.ComputePenetration((Collider)(object)slamHitbox, ((Component)slamHitbox).transform.position, ((Component)slamHitbox).transform.rotation, plyCol, ((Component)plyCol).transform.position, ((Component)plyCol).transform.rotation, ref direction, ref distance))
					{
						DamagePlayerClientRpc(((NetworkBehaviour)player).NetworkObject.NetworkObjectId, 15);
					}
					direction = default(Vector3);
				}
				PlaySlamClientRpc(2);
				GorillaShakeClientRpc(1);
			}
			basicSlamming = false;
		}

		private IEnumerator BeatdownAttack(PlayerControllerB victim)
		{
			SetAnimationClientRpc("GORILLABEATDOWN");
			DoAnimationClientRpc(4);
			SetAnimSpeedClientRpc(1f);
			for (int i = 0; (float)i < beatdownTicks; i++)
			{
				yield return (object)new WaitForSeconds(0.05f);
				if ((Object)(object)victim == (Object)null || victim.isPlayerDead)
				{
					break;
				}
				if (i == 12)
				{
					DamagePlayerClientRpc(((NetworkBehaviour)victim).NetworkObject.NetworkObjectId, 15);
					PlaySlamClientRpc(1);
					pinnedPlayer = grabbedPlayer;
					heldPlayer = null;
					GorillaShakeClientRpc(1);
				}
				if (i == beatDownSlamIndex)
				{
					DamagePlayerClientRpc(((NetworkBehaviour)victim).NetworkObject.NetworkObjectId, 25);
					PlaySlamClientRpc(2);
					GorillaShakeClientRpc(2);
				}
			}
			SetAnimationClientRpc("GORILLA IDLE");
			DoAnimationClientRpc(0);
			SetAnimSpeedClientRpc(1f);
			EndGrab();
		}

		[ClientRpc]
		public void GorillaShakeClientRpc(int maxStepIndex)
		{
			//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)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			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(1091064608u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, maxStepIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1091064608u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null || localPlayerController.isPlayerDead)
			{
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayerController).transform.position);
			if (!(num > shakeMaxRange))
			{
				int num2 = Mathf.Clamp(maxStepIndex, 0, shakeSteps.Length - 1);
				if (num > shakeCloseRange)
				{
					num2--;
				}
				if (num > shakeMidRange)
				{
					num2--;
				}
				if (num2 >= 0)
				{
					HUDManager.Instance.ShakeCamera(shakeSteps[num2]);
				}
			}
		}

		[ClientRpc]
		public void GrabPlayerClientRpc(ulong playerId, bool grab)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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(710552714u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref grab, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 710552714u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!grab)
			{
				if (!((Object)(object)heldPlayer == (Object)null))
				{
					NavMeshHit val3 = default(NavMeshHit);
					if (NavMesh.SamplePosition(((Component)heldPlayer).transform.position, ref val3, 15f, -1))
					{
						((Component)heldPlayer).transform.position = ((NavMeshHit)(ref val3)).position;
					}
					heldPlayer = null;
				}
				return;
			}
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val4 in allPlayerScripts)
			{
				if (((NetworkBehaviour)val4).NetworkObject.NetworkObjectId == playerId)
				{
					heldPlayer = val4;
					break;
				}
			}
		}

		public void LateUpdate()
		{
			//IL_0043: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isEnemyDead && !((Object)(object)grabPoint == (Object)null))
			{
				if ((Object)(object)heldEnemy != (Object)null)
				{
					((Component)heldEnemy).transform.position = grabPoint.position;
				}
				if ((Object)(object)heldPlayer != (Object)null)
				{
					((Component)heldPlayer).transform.position = grabPoint.position;
					heldPlayer.fallValue = 0f;
					heldPlayer.fallValueUncapped = 0f;
				}
				if ((Object)(object)pinnedPlayer != (Object)null)
				{
					((Component)pinnedPlayer).transform.position = slamPoint.position;
					pinnedPlayer.fallValue = 0f;
					pinnedPlayer.fallValueUncapped = 0f;
				}
			}
		}

		private IEnumerator WhiplashAttack(PlayerControllerB victim)
		{
			SetAnimationClientRpc("GORILLA THROW");
			DoAnimationClientRpc(5);
			SetAnimSpeedClientRpc(1f);
			for (int i = 0; i < whiplashTicks; i++)
			{
				yield return (object)new WaitForSeconds(0.05f);
				if ((Object)(object)victim == (Object)null || victim.isPlayerDead)
				{
					break;
				}
				if (i == 12)
				{
					DamagePlayerClientRpc(((NetworkBehaviour)victim).NetworkObject.NetworkObjectId, 15);
					PlaySlamClientRpc(1);
					GorillaShakeClientRpc(1);
				}
				if (i == 27)
				{
					DamagePlayerClientRpc(((NetworkBehaviour)victim).NetworkObject.NetworkObjectId, 25);
					PlaySlamClientRpc(2);
					GorillaShakeClientRpc(2);
				}
			}
			SetAnimationClientRpc("GORILLA IDLE");
			DoAnimationClientRpc(0);
			SetAnimSpeedClientRpc(1f);
			EndGrab();
		}

		[ClientRpc]
		public void PlaySlamClientRpc(int num)
		{
			//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(1584121456u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, num);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1584121456u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				switch (num)
				{
				case 1:
					GorillaSlam1.Play();
					break;
				case 2:
					GorillaSlam2.Play();
					break;
				}
			}
		}

		private PlayerControllerB FindVisiblePlayer()
		{
			//IL_0065: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			PlayerControllerB result = null;
			float num = float.MaxValue;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead && ((EnemyAI)this).PlayerIsTargetable(val, false, false, true))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (!(num2 >= num) && !(num2 > sightRange) && ((EnemyAI)this).CheckLineOfSightForPosition(((Component)val.gameplayCamera).transform.position, sightWidth, (int)sightRange, -1f, (Transform)null))
					{
						result = val;
						num = num2;
					}
				}
			}
			return result;
		}

		private PlayerControllerB FindClosestPlayer()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			PlayerControllerB result = null;
			float num = float.MaxValue;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && val.isPlayerControlled && !val.isPlayerDead)
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (!(num2 >= num) && !(num2 > sightRange))
					{
						result = val;
						num = num2;
					}
				}
			}
			return result;
		}

		private void SetAnim(string animName)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				SetAnimationClientRpc(animName);
			}
		}

		private void DoAnim(int index)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				DoAnimationClientRpc(index);
			}
		}

		[ClientRpc]
		public void DoLayeredAnimClientRpc(string animName, int layer)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3248387600u, val2, (RpcDelivery)0);
				bool flag = animName != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(animName, false);
				}
				BytePacker.WriteValueBitPacked(val, layer);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3248387600u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				animator.Play(animName, layer);
			}
		}

		[ClientRpc]
		public void DoAnimationClientRpc(int index)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_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(806515765u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, index);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 806515765u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetInteger("state", index);
				}
			}
		}

		[ClientRpc]
		public void SetAnimationClientRpc(string animName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(113522828u, val2, (RpcDelivery)0);
				bool flag = animName != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(animName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 113522828u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.Play(animName);
				}
			}
		}

		[ClientRpc]
		public void SetAnimSpeedClientRpc(float animationSpeed)
		{
			//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)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1720153217u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref animationSpeed, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1720153217u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					animator.speed = animationSpeed;
				}
			}
		}

		[ClientRpc]
		public void DamagePlayerClientRpc(ulong playerId, int amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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(2012051584u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerId);
				BytePacker.WriteValueBitPacked(val, amount);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2012051584u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val3 in allPlayerScripts)
			{
				if (((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == playerId)
				{
					val3.DamagePlayer(amount, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
				}
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, -1);
			if (base.isEnemyDead)
			{
				return;
			}
			base.enemyHP -= force;
			if ((Object)(object)playerWhoHit != (Object)null && ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				base.targetPlayer = playerWhoHit;
				timeSinceSeen = 0f;
				if (base.currentBehaviourStateIndex != 2)
				{
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
					anger = 120f;
					base.agent.updateRotation = true;
					assertDomActive = false;
				}
			}
			if ((Object)(object)playerWhoHit == (Object)null && base.enemyHP > 0 && ((NetworkBehaviour)RoundManager.Instance).IsHost && CanJoinEnemyAggro())
			{
				EnemyAI val = FindEnemyHitter();
				if ((Object)(object)val != (Object)null)
				{
					EnterEnemyAggro(val);
					AlertGorillasNearby(val);
				}
			}
			if (base.enemyHP <= 0 && ((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
		}

		private EnemyAI FindEnemyHitter()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			EnemyAI result = null;
			float num = enemyHitSearchRange;
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if (!((Object)(object)spawnedEnemy == (Object)null) && !((Object)(object)spawnedEnemy == (Object)(object)this) && !spawnedEnemy.isEnemyDead && !(spawnedEnemy is GorillaAI))
				{
					float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)spawnedEnemy).transform.position);
					if (num2 <= num)
					{
						num = num2;
						result = spawnedEnemy;
					}
				}
			}
			return result;
		}

		private void EnterEnemyAggro(EnemyAI hitter)
		{
			CancelPendingTreeHop();
			((EnemyAI)this).StopSearch(base.currentSearch, true);
			enemyAggroTarget = hitter;
			anger = 120f;
			assertDomActive = false;
			base.agent.updateRotation = true;
			((EnemyAI)this).SwitchToBehaviourClientRpc(5);
		}

		private void AlertGorillasNearby(EnemyAI hitter)
		{
			//IL_004b: 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)
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				GorillaAI gorillaAI = spawnedEnemy as GorillaAI;
				if (!((Object)(object)gorillaAI == (Object)null) && !((Object)(object)gorillaAI == (Object)(object)this) && !((EnemyAI)gorillaAI).isEnemyDead && !(Vector3.Distance(((Component)this).transform.position, ((Component)gorillaAI).transform.position) > allyAlertRange) && gorillaAI.CanJoinEnemyAggro())
				{
					gorillaAI.EnterEnemyAggro(hitter);
				}
			}
		}

		private bool CanJoinEnemyAggro()
		{
			if (grappling || treeHopActive)
			{
				return false;
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			return currentBehaviourStateIndex != 2 && currentBehaviourStateIndex != 3;
		}

		private bool IsVictimTaken(EnemyAI victim)
		{
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				GorillaAI gorillaAI = spawnedEnemy as GorillaAI;
				if ((Object)(object)gorillaAI != (Object)null && (Object)(object)gorillaAI != (Object)(object)this && gorillaAI.grappling && (Object)(object)gorillaAI.enemyGrabVictim == (Object)(object)victim)
				{
					return true;
				}
			}
			return false;
		}

		private void DoEnemyAggro()
		{
			//IL_00be: 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)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			if (grappling)
			{
				return;
			}
			base.agent.speed = moveSpeed * Math.Clamp(1.5f * (anger / staminaDivisor), staminaSpeedMin, 1.5f);
			MovementAnimationBlock();
			anger -= angerDecayPerTick / 4f;
			if (anger <= 20f)
			{
				ExitEnemyAggro();
				return;
			}
			if ((Object)(object)enemyAggroTarget == (Object)null || enemyAggroTarget.isEnemyDead)
			{
				anger = 10f;
				ExitEnemyAggro();
				return;
			}
			float num = Vector3.Distance(((Component)this).transform.position, ((Component)enemyAggroTarget).transform.position);
			if (num <= attackRange && timeTillGrapplingAvailable <= 0f && !IsVictimTaken(enemyAggroTarget))
			{
				StartEnemyGrab(enemyAggroTarget);
			}
			else
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)enemyAggroTarget).transform.position, false);
			}
		}

		private void ExitEnemyAggro()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			enemyAggroTarget = null;
			assertDomActive = false;
			base.agent.updateRotation = true;
			base.agent.speed = moveSpeed;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			RerollWarnChance();
		}

		private void StartEnemyGrab(EnemyAI victim)
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost && !grappling && !((Object)(object)victim == (Object)null) && !((Object)(object)grabPoint == (Object)null) && !IsVictimTaken(victim))
			{
				grappling = true;
				enemyGrabVictim = victim;
				heldEnemyNetId = victim.thisNetworkObject.NetworkObjectId;
				timeTillGrapplingAvailable = grappleCooldown;
				base.agent.ResetPath();
				GrabEnemyClientRpc(heldEnemyNetId, grab: true);
				bool beatdown = Random.Range(0f, 1f) > 0.5f;
				((MonoBehaviour)this).StartCoroutine(EnemyGrabAttack(victim, beatdown));
			}
		}

		private IEnumerator EnemyGrabAttack(EnemyAI victim, bool beatdown)
		{
			int totalTicks = (beatdown ? 46 : 40);
			int slam2Tick = (beatdown ? 36 : 27);
			if (beatdown)
			{
				SetAnimationClientRpc("GORILLABEATDOWN");
				DoAnimationClientRpc(4);
			}
			else
			{
				SetAnimationClientRpc("GORILLA THROW");
				DoAnimationClientRpc(5);
			}
			SetAnimSpeedClientRpc(1f);
			for (int i = 0; i < totalTicks; i++)
			{
				yield return (object)new WaitForSeconds(0.05f);
				if ((Object)(object)victim == (Object)null || victim.isEnemyDead)
				{
					break;
				}
				if (i == 12)
				{
					victim.HitEnemy(Random.Range(enemyGrabDamageMin, enemyGrabDamageMax + 1), (PlayerControllerB)null, true, -1);
					PlaySlamClientRpc(1);
					GorillaShakeClientRpc(1);
				}
				if (i == slam2Tick)
				{
					victim.HitEnemy(Random.Range(enemyGrabDamageMin, enemyGrabDamageMax + 1), (PlayerControllerB)null, true, -1);
					PlaySlamClientRpc(2);
					GorillaShakeClientRpc(2);
				}
			}
			SetAnimationClientRpc("GORILLA IDLE");
			DoAnimationClientRpc(0);
			SetAnimSpeedClientRpc(1f);
			EndEnemyGrab();
		}

		private void EndEnemyGrab()
		{
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				GrabEnemyClientRpc(heldEnemyNetId, grab: false);
				enemyGrabVictim = null;
				grappling = false;
			}
		}

		[ClientRpc]
		public void GrabEnemyClientRpc(ulong enemyId, bool grab)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_01ac: 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(1978475877u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, enemyId);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref grab, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1978475877u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (!grab)
			{
				if (!((Object)(object)heldEnemy == (Object)null))
				{
					Vector3 position = ((Component)heldEnemy).transform.position;
					NavMeshHit val3 = default(NavMeshHit);
					if (NavMesh.SamplePosition(position, ref val3, 15f, -1))
					{
						position = ((NavMeshHit)(ref val3)).position;
					}
					((Component)heldEnemy).transform.position = position;
					heldEnemy.inSpecialAnimation = false;
					if (((NetworkBehaviour)RoundManager.Instance).IsHost && !heldEnemy.isEnemyDead && (Object)(object)heldEnemy.agent != (Object)null)
					{
						((Behaviour)heldEnemy.agent).enabled = true;
						heldEnemy.agent.Warp(position);
					}
					heldEnemy = null;
				}
				return;
			}
			foreach (EnemyAI spawnedEnemy in RoundManager.Instance.SpawnedEnemies)
			{
				if ((Object)(object)spawnedEnemy != (Object)null && (Object)(object)spawnedEnemy.thisNetworkObject != (Object)null && spawnedEnemy.thisNetworkObject.NetworkObjectId == enemyId)
				{
					heldEnemy = spawnedEnemy;
					break;
				}
			}
			if (!((Object)(object)heldEnemy == (Object)null))
			{
				heldEnemy.inSpecialAnimation = true;
				if (((NetworkBehaviour)RoundManager.Instance).IsHost && (Object)(object)heldEnemy.agent != (Object)null)
				{
					heldEnemy.agent.ResetPath();
					((Behaviour)heldEnemy.agent).enabled = false;
				}
			}
		}

		private void UpdateTreeHopRoam()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Invalid comparison between Unknown and I4
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			timeSinceTreeHop += 0.2f;
			if (treeHopWalking)
			{
				if (Vector3.Distance(((Component)this).transform.position, treeHopTrunk) <= treeHopWalkStopDistance)
				{
					LaunchTreeHop();
				}
				else if (!base.agent.pathPending && (!base.agent.hasPath || (int)base.agent.pathStatus > 0))
				{
					CancelPendingTreeHop();
				}
			}
			else if (((NetworkBehaviour)RoundManager.Instance).IsHost && !(timeSinceTreeHop < treeHopCooldown) && !(Random.value > treeHopChancePerTick))
			{
				GameObject val = PickNearestHopTree(((Component)this).transform.position, treeHopCurrentTree);
				if (!((Object)(object)val == (Object)null) && TryGetTreeTrunk(val, out var trunk) && ((EnemyAI)this).SetDestinationToPosition(trunk, false))
				{
					treeHopTargetTree = val;
					treeHopTrunk = trunk;
					treeHopWalking = true;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
				}
			}
		}

		private void CancelPendingTreeHop()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (treeHopWalking)
			{
				treeHopWalking = false;
				treeHopTargetTree = null;
				if ((Object)(object)base.agent != (Object)null)
				{
					base.agent.ResetPath();
				}
				((EnemyAI)this).StopSearch(base.currentSearch, true);
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			}
		}

		private void LaunchTreeHop()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_003d: 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_0082: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = treeHopTargetTree;
			Vector3 val2 = treeHopTrunk;
			treeHopWalking = false;
			treeHopTargetTree = null;
			Vector3 val3 = val2 + Vector3.up * treeHopClimbHeight;
			bool flag = false;
			GameObject val4 = null;
			Vector3 trunk = Vector3.zero;
			if (Random.value < treeHopChainChance)
			{
				val4 = PickNearestHopTree(val2, val);
				if ((Object)(object)val4 != (Object)null && TryGetTreeTrunk(val4, out trunk))
				{
					flag = true;
				}
			}
			Vector3 nextTop = (flag ? (trunk + Vector3.up * treeHopClimbHeight) : val3);
			Vector3 dropPoint;
			if (flag)
			{
				dropPoint = trunk;
			}
			else
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 val5 = ((Vector2)(ref insideUnitCircle)).normalized * 5f;
				Vector3 val6 = val2 + new Vector3(val5.x, 0f, val5.y);
				NavMeshHit val7 = default(NavMeshHit);
				dropPoint = (NavMesh.SamplePosition(val6, ref val7, 4f, base.agent.areaMask) ? ((NavMeshHit)(ref val7)).position : val2);
			}
			treeHopCurrentTree = (flag ? val4 : val);
			timeSinceTreeHop = 0f;
			Vector3 position = ((Component)this).transform.position;
			BeginTreeHop(position, val3, nextTop, flag, dropPoint);
			StartTreeHopClientRpc(position, val3, nextTop, flag, dropPoint);
		}

		[ClientRpc]
		public void StartTreeHopClientRpc(Vector3 start, Vector3 top, Vector3 nextTop, bool chain, Vector3 dropPoint)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1675089104u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref start);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref top);
					((FastBufferWriter)(ref val)).WriteValueSafe(ref nextTop);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref chain, default(ForPrimitives));
					((FastBufferWriter)(ref val)).WriteValueSafe(ref dropPoint);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1675089104u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					BeginTreeHop(start, top, nextTop, chain, dropPoint);
				}
			}
		}

		private void BeginTreeHop(Vector3 start, Vector3 top, Vector3 nextTop, bool chain, Vector3 dropPoint)
		{
			//IL_0016: 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_002d: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00b7: 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_00bf: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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)
			if (!treeHopActive)
			{
				((Component)this).transform.position = start;
				treeHopSegments.Clear();
				Vector3 val = (chain ? nextTop : top);
				treeHopSegments.Enqueue(Seg(TreeHopKind.Climb, start, top, Mathf.Max(0.05f, Vector3.Distance(start, top) / treeHopClimbSpeed)));
				treeHopSegments.Enqueue(Seg(TreeHopKind.Cling, top, top, treeHopClingSeconds));
				if (chain)
				{
					treeHopSegments.Enqueue(Seg(TreeHopKind.Leap, top, nextTop, treeHopLeapSeconds));
					treeHopSegments.Enqueue(Seg(TreeHopKind.Cling, nextTop, nextTop, treeHopClingSeconds));
				}
				treeHopSegments.Enqueue(Seg(TreeHopKind.Drop, val, dropPoint, Mathf.Max(0.05f, Vector3.Distance(val, dropPoint) / treeHopDropSpeed)));
				treeHopActive = true;
				base.inSpecialAnimation = true;
				if ((Object)(object)base.agent != (Object)null)
				{
					base.agent.ResetPath();
					((Behaviour)base.agent).enabled = false;
				}
				AdvanceTreeHop();
			}
		}

		private static TreeHopSegment Seg(TreeHopKind kind, Vector3 from, Vector3 to, float duration)
		{
			//IL_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			return new TreeHopSegment
			{
				kind = kind,
				from = from,
				to = to,
				duration = duration
			};
		}

		private void TickTreeHop()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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)
			if (treeHopActive)
			{
				treeHopElapsed += Time.deltaTime;
				float num = ((treeHopCurrent.duration > 0f) ? Mathf.Clamp01(treeHopElapsed / treeHopCurrent.duration) : 1f);
				Vector3 position = Vector3.Lerp(treeHopCurrent.from, treeHopCurrent.to, num);
				if (treeHopCurrent.kind == TreeHopKind.Leap)
				{
					position.y += Mathf.Sin(num * MathF.PI) * treeHopLeapArc;
				}
				((Component)this).transform.position = position;
				if (num >= 1f)
				{
					AdvanceTreeHop();
				}
			}
		}

		private void AdvanceTreeHop()
		{
			if (treeHopSegments.Count == 0)
			{
				EndTreeHop();
				return;
			}
			treeHopCurrent = treeHopSegments.Dequeue();
			treeHopElapsed = 0f;
			SetTreeHopAnim(treeHopCurrent.kind);
		}

		private void SetTreeHopAnim(TreeHopKind kind)
		{
			if (!((Object)(object)animator == (Object)null))
			{
				animator.SetBool("Climbing", kind == TreeHopKind.Climb || kind == TreeHopKind.Cling);
				animator.SetBool("Leaping", kind == TreeHopKind.Leap);
			}
		}

		private void EndTreeHop()
		{
			//IL_0045: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			treeHopActive = false;
			base.inSpecialAnimation = false;
			if ((Object)(object)base.agent != (Object)null)
			{
				((Behaviour)base.agent).enabled = true;
			}
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				NavMeshHit val = default(NavMeshHit);
				if (NavMesh.SamplePosition(((Component)this).transform.position, ref val, 4f, base.agent.areaMask))
				{
					base.agent.Warp(((NavMeshHit)(ref val)).position);
				}
				((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			}
		}

		private GameObject PickNearestHopTree(Vector3 from, GameObject exclude)
		{
			//IL_0007: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or