Decompiled source of BrolyCulo v1.2.2

FrenchPlatypus.BrolyCulo.dll

Decompiled 2 weeks ago
#define DEBUG
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomEnnemies.Configuration;
using FrenchPlatypus.BrolyCulo.NetcodePatcher;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("FrenchPlatypus.BrolyCulo")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: AssemblyInformationalVersion("1.2.1")]
[assembly: AssemblyProduct("BrolyCulo")]
[assembly: AssemblyTitle("FrenchPlatypus.BrolyCulo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace CustomEnnemies
{
	internal class BrolyAI : EnemyAI
	{
		private enum State
		{
			SearchingForPlayer,
			ChasePlayer,
			ChaseBracken,
			AttackPlayer,
			AttackBracken,
			Flea
		}

		public Transform turnCompass = null;

		public Transform attackArea = null;

		public Transform assParent = null;

		public Transform playerParent = null;

		public AudioSource stepSound = null;

		private float timeSinceHittingLocalPlayer;

		private float timeSinceNewRandPos;

		private Vector3 positionRandomness;

		private Vector3 spawnPos;

		private Random enemyRandom = null;

		private bool isDeadAnimationDone;

		private bool attackingPlayer;

		private bool isInterrupted;

		private float fleaTimer;

		private Coroutine attackingPlayerCoroutine;

		private Ray playerRay;

		public bool carryingPlayerBody;

		private Vector3 targetLastPos;

		public DeadBodyInfo bodyBeingCarried;

		private FlowermanAI flowermanTarget = null;

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

		public override void Start()
		{
			//IL_0065: 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_0098: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			LogIfDebugBuild("Broly Spawned");
			LogIfDebugBuild("Is Host : " + ((NetworkBehaviour)this).IsServer);
			timeSinceHittingLocalPlayer = 0f;
			timeSinceNewRandPos = 0f;
			DoAnimationClientRpc("startWalk");
			positionRandomness = new Vector3(0f, 0f, 0f);
			base.agent.acceleration = 15f;
			base.agent.angularSpeed = 1000f;
			spawnPos = ((Component)this).transform.position;
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			MuteVoiceClientRpc(mute: true);
			MuteStepsClientRpc(mute: false);
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_008d: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead)
			{
				if (!isDeadAnimationDone)
				{
					LogIfDebugBuild("Stopping enemy voice with janky code.");
					isDeadAnimationDone = true;
					MuteVoiceClientRpc(mute: true);
					MuteStepsClientRpc(mute: true);
					DoAnimationClientRpc("killEnemy");
					PlayDeathSoundClientRpc();
				}
				return;
			}
			int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
			if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 1)
			{
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
				((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
				if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 2f)
				{
					((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position, 3f * Time.deltaTime);
				}
			}
			if (base.stunNormalizedTimer > 0f)
			{
				base.agent.speed = 0f;
			}
			if (fleaTimer > 0f)
			{
				fleaTimer -= Time.deltaTime;
			}
		}

		public override void OnGainedOwnership()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			((NetworkBehaviour)this).OnGainedOwnership();
			if (((NetworkBehaviour)this).IsOwner)
			{
				LogIfDebugBuild("Get ownership");
				if (base.currentBehaviourStateIndex == 0)
				{
					LogIfDebugBuild("restart search coroutine");
					DoAnimationClientRpc("startWalk");
					MuteVoiceClientRpc(mute: true);
					MuteStepsClientRpc(mute: false);
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				}
				if (base.currentBehaviourStateIndex == 1)
				{
					FoundClosestPlayerInRange(20f, 4f);
				}
			}
		}

		public override void DoAIInterval()
		{
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 2.5f;
				if (!((NetworkBehaviour)this).IsServer && ((NetworkBehaviour)this).IsOwner)
				{
					LogIfDebugBuild("Set Ownership back to : " + StartOfRound.Instance.allPlayerScripts[0].playerUsername);
					((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
				}
				else if (FoundBrackenInMap() && (Object)(object)flowermanTarget != (Object)null)
				{
					LogIfDebugBuild("found bracken");
					DoAnimationClientRpc("chaseBracken");
					((EnemyAI)this).SwitchToBehaviourState(2);
					MuteStepsClientRpc(mute: true);
					MuteVoiceClientRpc(mute: true);
				}
				else if (FoundClosestPlayerInRange(20f, 4f) && (Object)(object)base.targetPlayer != (Object)null)
				{
					LogIfDebugBuild("chasing Player : " + base.targetPlayer.playerUsername);
					DoAnimationClientRpc("chasePlayer");
					((EnemyAI)this).SwitchToBehaviourState(1);
					MuteStepsClientRpc(mute: true);
					MuteVoiceClientRpc(mute: false);
				}
				break;
			case 1:
				base.agent.speed = 7f;
				if ((Object)(object)base.targetPlayer == (Object)null)
				{
					FoundClosestPlayerInRange(20f, 4f);
				}
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)base.targetPlayer != (Object)null && (Object)(object)base.targetPlayer != (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					((EnemyAI)this).ChangeOwnershipOfEnemy(base.targetPlayer.actualClientId);
				}
				if ((Object)(object)base.targetPlayer == (Object)null || FoundBrackenInMap() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 12f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
				{
					LogIfDebugBuild("Stop Target Player");
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					DoAnimationClientRpc("startWalk");
					((EnemyAI)this).SwitchToBehaviourState(0);
					MuteStepsClientRpc(mute: false);
					MuteVoiceClientRpc(mute: true);
				}
				break;
			case 2:
				base.agent.speed = 15f;
				if ((Object)(object)flowermanTarget == (Object)null || ((EnemyAI)flowermanTarget).isEnemyDead)
				{
					LogIfDebugBuild("Stop Target Bracken");
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					DoAnimationClientRpc("startWalk");
					((EnemyAI)this).SwitchToBehaviourState(0);
					MuteVoiceClientRpc(mute: true);
					MuteStepsClientRpc(mute: false);
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)flowermanTarget).transform.position, false);
				}
				break;
			case 3:
				base.agent.speed = 2f;
				break;
			case 4:
				base.agent.speed = 2f;
				break;
			case 5:
				base.agent.speed = 15f;
				if (fleaTimer <= 0f || Vector3.Distance(((Component)this).transform.position, spawnPos) < 1f)
				{
					fleaTimer = 0f;
					LogIfDebugBuild("Stop fleeing");
					if (carryingPlayerBody)
					{
						DropPlayerBody();
						DropPlayerBodyServerRpc();
					}
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					DoAnimationClientRpc("startWalk");
					((EnemyAI)this).SwitchToBehaviourState(0);
					MuteVoiceClientRpc(mute: true);
					MuteStepsClientRpc(mute: false);
				}
				break;
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
		}

		private bool FoundBrackenInMap()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			flowermanTarget = null;
			base.mostOptimalDistance = 2000f;
			if (Object.FindObjectsOfType<FlowermanAI>().Length != 0)
			{
				for (int i = 0; i < Object.FindObjectsOfType<FlowermanAI>().Length; i++)
				{
					if (!((EnemyAI)Object.FindObjectsOfType<FlowermanAI>()[i]).isEnemyDead && Vector3.Distance(((Component)this).transform.position, ((Component)Object.FindObjectsOfType<FlowermanAI>()[i]).transform.position) < base.mostOptimalDistance)
					{
						flowermanTarget = Object.FindObjectsOfType<FlowermanAI>()[i];
						base.mostOptimalDistance = Vector3.Distance(((Component)this).transform.position, ((Component)Object.FindObjectsOfType<FlowermanAI>()[i]).transform.position);
						break;
					}
				}
				return (Object)(object)flowermanTarget != (Object)null;
			}
			return false;
		}

		private bool FoundClosestPlayerInRange(float range, float senseRange)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				range = senseRange;
			}
			return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
		}

		[ServerRpc]
		public void DropPlayerBodyServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Invalid comparison between Unknown and I4
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Invalid comparison between Unknown and I4
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2264131894u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2264131894u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager2 == null || !networkManager2.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager2.IsClient || networkManager2.IsHost) && ((NetworkBehaviour)this).OwnerClientId != networkManager2.LocalClientId)
			{
				if ((int)networkManager2.LogLevel <= 1)
				{
					LogIfDebugBuild("Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost))
			{
				DropPlayerBodyClientRpc();
			}
		}

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

		private void DropPlayerBody()
		{
			if (carryingPlayerBody)
			{
				LogIfDebugBuild("Drop player body : " + bodyBeingCarried.playerScript.playerUsername);
				carryingPlayerBody = false;
				bodyBeingCarried.matchPositionExactly = false;
				bodyBeingCarried.attachedTo = null;
				bodyBeingCarried = null;
			}
		}

		private IEnumerator FleaPlayer(bool carryingBody = true)
		{
			LogIfDebugBuild("Flea player");
			if (attackingPlayerCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(attackingPlayerCoroutine);
			}
			base.inSpecialAnimation = false;
			attackingPlayer = false;
			DoAnimationClientRpc("startWalk");
			MuteVoiceClientRpc(mute: true);
			MuteStepsClientRpc(mute: true);
			fleaTimer = 8f;
			if ((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)
			{
				LogIfDebugBuild("Release player : " + base.inSpecialAnimationWithPlayer.playerUsername);
				base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = false;
				base.inSpecialAnimationWithPlayer.snapToServerPosition = false;
				base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = null;
				if (carryingBody && (Object)(object)base.inSpecialAnimationWithPlayer.deadBody != (Object)null)
				{
					bodyBeingCarried = base.inSpecialAnimationWithPlayer.deadBody;
					bodyBeingCarried.attachedTo = assParent;
					bodyBeingCarried.attachedLimb = base.inSpecialAnimationWithPlayer.deadBody.bodyParts[0];
					bodyBeingCarried.matchPositionExactly = true;
					carryingPlayerBody = true;
				}
			}
			if (carryingBody)
			{
				yield return (object)new WaitForSeconds(1f);
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Behaviour)base.agent).enabled = true;
				base.isClientCalculatingAI = true;
			}
			((EnemyAI)this).SwitchToBehaviourState(5);
			((EnemyAI)this).SetDestinationToPosition(spawnPos, false);
		}

		[ServerRpc]
		private void AttackPlayerServerRpc(int playerObjectId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Invalid comparison between Unknown and I4
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(80314820u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObjectId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 80314820u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost) && !attackingPlayer && !carryingPlayerBody)
				{
					isInterrupted = false;
					attackingPlayer = true;
					base.inSpecialAnimation = true;
					base.isClientCalculatingAI = false;
					base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId];
					base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this;
					((Component)this).transform.position = new Vector3(((Component)base.inSpecialAnimationWithPlayer).transform.position.x, ((Component)base.inSpecialAnimationWithPlayer).transform.position.y + 0.5f, ((Component)base.inSpecialAnimationWithPlayer).transform.position.z);
					AttackPlayerClientRpc(playerObjectId);
				}
			}
		}

		[ClientRpc]
		private void AttackPlayerClientRpc(int playerObjectId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Invalid comparison between Unknown and I4
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1519574150u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObjectId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1519574150u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			LogIfDebugBuild("attack CLIENT rpc");
			NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager2.IsClient || networkManager2.IsHost))
			{
				isInterrupted = false;
				LogIfDebugBuild("attack test");
				base.inSpecialAnimationWithPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId];
				base.inSpecialAnimationWithPlayer.inAnimationWithEnemy = (EnemyAI)(object)this;
				((Component)this).transform.position = new Vector3(((Component)base.inSpecialAnimationWithPlayer).transform.position.x, ((Component)base.inSpecialAnimationWithPlayer).transform.position.y + 0.5f, ((Component)base.inSpecialAnimationWithPlayer).transform.position.z);
				((EnemyAI)this).SyncPositionToClients();
				base.inSpecialAnimationWithPlayer.SyncBodyPositionWithClients();
				base.inSpecialAnimationWithPlayer.DropAllHeldItems(true, false);
				base.inSpecialAnimationWithPlayer.voiceMuffledByEnemy = true;
				attackingPlayer = true;
				base.inSpecialAnimation = true;
				((Behaviour)base.agent).enabled = false;
				base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = true;
				base.inSpecialAnimationWithPlayer.snapToServerPosition = true;
				Vector3 val3 = ((!((NetworkBehaviour)base.inSpecialAnimationWithPlayer).IsOwner) ? ((Component)base.inSpecialAnimationWithPlayer).transform.parent.TransformPoint(base.inSpecialAnimationWithPlayer.serverPlayerPosition) : ((Component)base.inSpecialAnimationWithPlayer).transform.position);
				Vector3 position = ((Component)this).transform.position;
				position.y = ((Component)base.inSpecialAnimationWithPlayer).transform.position.y;
				playerRay = new Ray(val3, position - ((Component)base.inSpecialAnimationWithPlayer).transform.position);
				turnCompass.LookAt(val3);
				position = ((Component)this).transform.eulerAngles;
				position.y = turnCompass.eulerAngles.y;
				((Component)this).transform.eulerAngles = position;
				if (attackingPlayerCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(attackingPlayerCoroutine);
				}
				attackingPlayerCoroutine = ((MonoBehaviour)this).StartCoroutine(AttackPlayer());
			}
		}

		private IEnumerator AttackPlayer()
		{
			Vector3 endPosition = ((Ray)(ref playerRay)).GetPoint(1f);
			if (endPosition.y < -80f)
			{
				_ = ((Component)this).transform.position;
				for (int i = 0; i < 15; i++)
				{
					yield return null;
				}
				((Component)this).transform.position = endPosition;
			}
			DoAnimationClientRpc("attack");
			((EnemyAI)this).SwitchToBehaviourState(3);
			MuteStepsClientRpc(mute: true);
			MuteVoiceClientRpc(mute: true);
			yield return (object)new WaitForSeconds(0.1f);
			InterruptClientRpc(interrupt: false);
			int hitCount = 0;
			if (!((Object)(object)base.inSpecialAnimationWithPlayer != (Object)null))
			{
				yield break;
			}
			while (hitCount < 10 || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody == (Object)null || !isInterrupted)
			{
				yield return (object)new WaitForSeconds(0.5f);
				base.inSpecialAnimationWithPlayer.DamagePlayer(15, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				hitCount++;
				LogIfDebugBuild("attacking : " + base.inSpecialAnimationWithPlayer.playerUsername + " - Hp : " + base.inSpecialAnimationWithPlayer.health + " - HitCount : " + hitCount);
				if (hitCount >= 10 || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody != (Object)null || isInterrupted)
				{
					break;
				}
				yield return null;
			}
			if ((Object)(object)base.inSpecialAnimationWithPlayer == (Object)null || (Object)(object)base.inSpecialAnimationWithPlayer.deadBody == (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(FleaPlayer(carryingBody: false));
				yield break;
			}
			base.inSpecialAnimationWithPlayer.snapToServerPosition = false;
			base.inSpecialAnimationWithPlayer.deadBody.causeOfDeath = (CauseOfDeath)5;
			base.inSpecialAnimationWithPlayer.deadBody.bodyBleedingHeavily = true;
			((MonoBehaviour)this).StartCoroutine(FleaPlayer());
		}

		[ServerRpc]
		private void AttackBrackenServerRpc(int flowermanId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1208731014u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, flowermanId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1208731014u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost))
				{
					AttackBrackenClientRpc(flowermanId);
				}
			}
		}

		[ClientRpc]
		private void AttackBrackenClientRpc(int flowermanId)
		{
			//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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(950252022u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, flowermanId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 950252022u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && !networkManager2.IsClient && !networkManager2.IsHost)
				{
				}
			}
		}

		private IEnumerator AttackBracken()
		{
			LogIfDebugBuild("Attack Bracken");
			((EnemyAI)this).SwitchToBehaviourClientRpc(4);
			MuteStepsClientRpc(mute: true);
			MuteVoiceClientRpc(mute: false);
			yield return (object)new WaitForSeconds(4f);
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
			DoAnimationClientRpc("attack");
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			MuteVoiceClientRpc(mute: true);
			MuteStepsClientRpc(mute: false);
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
		{
			((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
			FlowermanAI componentInParent = ((Component)other).GetComponentInParent<FlowermanAI>();
			if ((Object)(object)componentInParent != (Object)null && !((EnemyAI)componentInParent).isEnemyDead)
			{
				LogIfDebugBuild("Broly Collision with Bracken!");
				((EnemyAI)componentInParent).KillEnemyOnOwnerClient(false);
				AttackBracken();
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, attackingPlayer || carryingPlayerBody || fleaTimer > 0f, false);
			if ((Object)(object)val != (Object)null)
			{
				LogIfDebugBuild("Broly Collision with Player!");
				if (((NetworkBehaviour)this).IsOwner)
				{
					AttackPlayerServerRpc((int)val.playerClientId);
				}
			}
		}

		public override void KillEnemy(bool destroy = false)
		{
			if ((Object)(object)base.creatureVoice != (Object)null)
			{
				base.creatureVoice.Stop();
			}
			base.creatureSFX.Stop();
			stepSound.Stop();
			base.creatureAnimator.SetLayerWeight(2, 0f);
			((EnemyAI)this).KillEnemy(false);
			if (carryingPlayerBody)
			{
				carryingPlayerBody = false;
				if ((Object)(object)bodyBeingCarried != (Object)null)
				{
					bodyBeingCarried.matchPositionExactly = false;
					bodyBeingCarried.attachedTo = null;
				}
			}
			if (attackingPlayer && (Object)(object)base.inSpecialAnimationWithPlayer != (Object)null)
			{
				base.inSpecialAnimationWithPlayer.inSpecialInteractAnimation = false;
				base.inSpecialAnimationWithPlayer.snapToServerPosition = false;
				base.inSpecialAnimationWithPlayer.voiceMuffledByEnemy = false;
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (base.isEnemyDead)
			{
				return;
			}
			if (!isInterrupted)
			{
				LogIfDebugBuild("Interrupt enemy");
				InterruptClientRpc(interrupt: true);
			}
			if (base.currentBehaviourStateIndex == 0 && (Object)(object)playerWhoHit != (Object)null)
			{
				LogIfDebugBuild("Chase " + ((object)playerWhoHit)?.ToString() + " after being hit");
				base.targetPlayer = playerWhoHit;
				DoAnimationClientRpc("chasePlayer");
				((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				MuteVoiceClientRpc(mute: false);
				MuteStepsClientRpc(mute: true);
			}
			base.enemyHP -= force;
			if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0)
			{
				((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
				if (attackingPlayerCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(attackingPlayerCoroutine);
				}
				MuteVoiceClientRpc(mute: false);
				MuteStepsClientRpc(mute: true);
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
		}

		[ClientRpc]
		public void InterruptClientRpc(bool interrupt)
		{
			//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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3895719221u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3895719221u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager2.IsClient || networkManager2.IsHost))
				{
					isInterrupted = interrupt;
				}
			}
		}

		[ServerRpc]
		public void StartSearchServerRpc(Vector3 pos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Invalid comparison between Unknown and I4
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2532362991u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2532362991u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost))
				{
					StartSearchClientRpc(pos);
				}
			}
		}

		[ClientRpc]
		public void StartSearchClientRpc(Vector3 pos)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Invalid comparison between Unknown and I4
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(474068667u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 474068667u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager2.IsClient || networkManager2.IsHost))
				{
					((EnemyAI)this).StartSearch(pos, (AISearchRoutine)null);
				}
			}
		}

		[ServerRpc]
		public void SetTargetPlayerServerRpc(int playerObjectId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(215736678u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObjectId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 215736678u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost))
				{
					SetTargetPlayerClientRpc(playerObjectId);
				}
			}
		}

		[ClientRpc]
		public void SetTargetPlayerClientRpc(int playerObjectId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2896326104u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerObjectId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2896326104u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
				if (networkManager2 != null && networkManager2.IsListening && (int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager2.IsClient || networkManager2.IsHost))
				{
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[playerObjectId];
				}
			}
		}

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

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

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

		[ClientRpc]
		public void DoAnimationClientRpc(string animationName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2774538724u, val, (RpcDelivery)0);
				bool flag = animationName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2774538724u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				LogIfDebugBuild("Animation: " + animationName);
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BrolyAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2264131894u, new RpcReceiveHandler(__rpc_handler_2264131894));
			NetworkManager.__rpc_func_table.Add(1375837799u, new RpcReceiveHandler(__rpc_handler_1375837799));
			NetworkManager.__rpc_func_table.Add(80314820u, new RpcReceiveHandler(__rpc_handler_80314820));
			NetworkManager.__rpc_func_table.Add(1519574150u, new RpcReceiveHandler(__rpc_handler_1519574150));
			NetworkManager.__rpc_func_table.Add(1208731014u, new RpcReceiveHandler(__rpc_handler_1208731014));
			NetworkManager.__rpc_func_table.Add(950252022u, new RpcReceiveHandler(__rpc_handler_950252022));
			NetworkManager.__rpc_func_table.Add(3895719221u, new RpcReceiveHandler(__rpc_handler_3895719221));
			NetworkManager.__rpc_func_table.Add(2532362991u, new RpcReceiveHandler(__rpc_handler_2532362991));
			NetworkManager.__rpc_func_table.Add(474068667u, new RpcReceiveHandler(__rpc_handler_474068667));
			NetworkManager.__rpc_func_table.Add(215736678u, new RpcReceiveHandler(__rpc_handler_215736678));
			NetworkManager.__rpc_func_table.Add(2896326104u, new RpcReceiveHandler(__rpc_handler_2896326104));
			NetworkManager.__rpc_func_table.Add(1971215388u, new RpcReceiveHandler(__rpc_handler_1971215388));
			NetworkManager.__rpc_func_table.Add(3845829698u, new RpcReceiveHandler(__rpc_handler_3845829698));
			NetworkManager.__rpc_func_table.Add(121225373u, new RpcReceiveHandler(__rpc_handler_121225373));
			NetworkManager.__rpc_func_table.Add(2774538724u, new RpcReceiveHandler(__rpc_handler_2774538724));
		}

		private static void __rpc_handler_2264131894(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BrolyAI)(object)target).DropPlayerBodyServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1375837799(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BrolyAI)(object)target).DropPlayerBodyClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_80314820(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int playerObjectId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BrolyAI)(object)target).AttackPlayerServerRpc(playerObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1519574150(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerObjectId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BrolyAI)(object)target).AttackPlayerClientRpc(playerObjectId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1208731014(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int flowermanId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref flowermanId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BrolyAI)(object)target).AttackBrackenServerRpc(flowermanId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_950252022(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int flowermanId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref flowermanId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BrolyAI)(object)target).AttackBrackenClientRpc(flowermanId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_2532362991(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BrolyAI)(object)target).StartSearchServerRpc(pos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_474068667(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BrolyAI)(object)target).StartSearchClientRpc(pos);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_215736678(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				int targetPlayerServerRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BrolyAI)(object)target).SetTargetPlayerServerRpc(targetPlayerServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2896326104(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int targetPlayerClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BrolyAI)(object)target).SetTargetPlayerClientRpc(targetPlayerClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1971215388(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BrolyAI)(object)target).PlayDeathSoundClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

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

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

		protected internal override string __getTypeName()
		{
			return "BrolyAI";
		}
	}
	[BepInPlugin("FrenchPlatypus.BrolyCulo", "BrolyCulo", "1.2.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "modassets_broly";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("BrolyCulo");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("BrolyCuloTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("BrolyCuloTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
			Logger.LogInfo((object)"Plugin FrenchPlatypus.BrolyCulo is loaded!");
			Logger.LogInfo((object)"KAKAROOOOOOOT!");
		}

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

		public const string PLUGIN_NAME = "BrolyCulo";

		public const string PLUGIN_VERSION = "1.2.1";
	}
}
namespace CustomEnnemies.Configuration
{
	public class PluginConfig
	{
		public ConfigEntry<int> SpawnWeight;

		public PluginConfig(ConfigFile cfg)
		{
			SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 200, "The spawn chance weight for RandyOrton, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
			ClearUnusedEntries(cfg);
		}

		private void ClearUnusedEntries(ConfigFile cfg)
		{
			PropertyInfo property = ((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(cfg, null);
			dictionary.Clear();
			cfg.Save();
		}
	}
}
namespace FrenchPlatypus.BrolyCulo.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}