Decompiled source of KarelianCompany v1.0.0

Sita320341.KarelianCompany.dll

Decompiled 4 hours ago
#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using KarelianCompany.Configuration;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Sita320341.KarelianCompany.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace KarelianCompany
{
	internal class AndruhaAI : EnemyAI
	{
		private enum State
		{
			SearchingForPlayer,
			FollowingPlayer,
			ChasingPlayer
		}

		private const int KNIFE_INDEX = 7;

		private const int PHONE_INDEX = 15;

		private const int LEFT_EYE_INDEX = 17;

		private const int RIGHT_EYE_INDEX = 18;

		public Transform turnCompass = null;

		public Transform attackArea = null;

		public AudioSource murderMusicSFX = null;

		private float timeSinceHittingLocalPlayer;

		private float timeSinceNewRandPos;

		private float angerMeterCapacity;

		private float timeSinceLastStab = 0f;

		private Vector3 positionRandomness;

		private Vector3 StalkPos;

		private Random enemyRandom = null;

		private float angerMeter = 0f;

		private bool isBerserkMode = false;

		private bool isDeadAnimationDone;

		private Vector3 previousPosition;

		private float timeSinceStartedFollowingPlayer;

		public AudioSource andruhaMouth = null;

		public AudioClip rageClip = null;

		public AudioClip stab = null;

		public AudioClip stabVoice = null;

		public GameObject phone = null;

		public GameObject bloodParticles = null;

		private State? previousState = null;

		[Conditional("DEBUG")]
		private void LogIfDebugBuild(string text)
		{
			if (text == null)
			{
				Plugin.Logger.LogError((object)"Attempted to log a null string.");
			}
			else
			{
				Plugin.Logger.LogInfo((object)text);
			}
		}

		public override void Start()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			LogIfDebugBuild("Example Enemy Spawned");
			angerMeterCapacity = Random.Range(10f, 15f);
			LogIfDebugBuild("Anger Meter Capacity: " + angerMeterCapacity);
			angerMeter = 0f;
			timeSinceHittingLocalPlayer = 0f;
			timeSinceNewRandPos = 0f;
			positionRandomness = new Vector3(0f, 0f, 0f);
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			base.currentBehaviourStateIndex = 0;
			((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
		}

		public override void Update()
		{
			//IL_005e: 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_0081: 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_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0757: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_079d: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_083b: Unknown result type (might be due to invalid IL or missing references)
			//IL_084b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_08da: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0561: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				LogIfDebugBuild("Enemy is dead or all players are dead, stopping AI.");
				murderMusicSFX.Stop();
				return;
			}
			if ((Object)(object)base.targetPlayer != (Object)null)
			{
				Vector3 position = ((Component)base.targetPlayer).transform.position;
				Transform transform = ((Component)((Component)this).gameObject.transform.GetChild(20)).gameObject.transform;
				Vector3 val = new Vector3(position.x, position.y + 4f, position.z) - ((Component)transform).transform.position;
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)transform).transform.rotation = Quaternion.Inverse(val2);
				((Component)((Component)((Component)this).gameObject.transform.GetChild(17)).gameObject.transform).transform.rotation = val2;
				((Component)((Component)((Component)this).gameObject.transform.GetChild(18)).gameObject.transform).transform.rotation = val2;
			}
			Vector3 val4;
			AnimatorStateInfo currentAnimatorStateInfo;
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (previousState != State.SearchingForPlayer)
				{
					LogIfDebugBuild("Switched to SearchingForPlayer");
					DoAnimationClientRpc("idle");
					previousState = State.SearchingForPlayer;
				}
				((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
				base.agent.speed = 3f;
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					LogIfDebugBuild("Moving towards Target Player");
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					ChooseClosestNodeToPlayer();
				}
				if ((Object)(object)base.targetPlayer != (Object)null && ((EnemyAI)this).TargetClosestPlayer(3f, true, 360f) && base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f))
				{
					LogIfDebugBuild("Sight: " + base.targetPlayer.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f));
					val4 = ((Component)this).transform.position;
					LogIfDebugBuild(" " + ((object)(Vector3)(ref val4)).ToString());
					if (base.currentSearch.inProgress)
					{
						((EnemyAI)this).StopSearch(base.currentSearch, true);
					}
					LogIfDebugBuild("Found Player, Start Following Player");
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
					base.currentBehaviourStateIndex = 1;
				}
				break;
			case 1:
				if (previousState != State.FollowingPlayer)
				{
					LogIfDebugBuild("Switched to FollowingPlayer");
					previousState = State.FollowingPlayer;
					timeSinceStartedFollowingPlayer = 0f;
				}
				CalculateWalkingAnimationSpeed(5f);
				timeSinceStartedFollowingPlayer += Time.deltaTime;
				val4 = base.agent.velocity;
				if (((Vector3)(ref val4)).magnitude < 0.1f)
				{
					currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
					if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("walk"))
					{
						DoAnimationClientRpc("idle");
						goto IL_040d;
					}
				}
				val4 = base.agent.velocity;
				if (((Vector3)(ref val4)).magnitude > 0.1f)
				{
					currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
					if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("idle"))
					{
						DoAnimationClientRpc("walk");
					}
				}
				goto IL_040d;
			case 2:
			{
				if (previousState != State.ChasingPlayer)
				{
					LogIfDebugBuild("Switched to ChasingPlayer");
					PullKnifeOutServerRpc();
					andruhaMouth.PlayOneShot(rageClip);
					previousState = State.ChasingPlayer;
				}
				CalculateWRunningAnimationSpeed(4f);
				if ((Object)(object)base.targetPlayer != (Object)null)
				{
					CheckCollisionWithPlayer(base.targetPlayer);
				}
				base.agent.speed = Mathf.Clamp(base.agent.speed + Time.deltaTime * 6f, 0f, 8f);
				base.agent.angularSpeed = 720f;
				base.agent.acceleration = 100f;
				base.addPlayerVelocityToDestination = Mathf.Lerp(base.addPlayerVelocityToDestination, 2f, Time.deltaTime);
				if (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 2f)
				{
					base.agent.stoppingDistance = 0f;
				}
				else
				{
					base.agent.stoppingDistance = 0.5f;
				}
				float num = 0f;
				float num2 = 40f;
				float num3 = 1.1f;
				float num4 = 0.9f;
				float pitch = num3 + (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) - num) / (num2 - num) * (num4 - num3);
				murderMusicSFX.pitch = pitch;
				murderMusicSFX.volume = Mathf.Clamp(Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) / 40f, 0.8f, 1.1f);
				if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) < 15f)
				{
					GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
				}
				timeSinceLastStab += Time.deltaTime;
				if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 100f && !((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);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					base.currentBehaviourStateIndex = 0;
				}
				else
				{
					Vector3 val3 = ((Component)base.targetPlayer).transform.position + ((Component)base.targetPlayer).GetComponent<Rigidbody>().velocity * 0.5f;
					((EnemyAI)this).SetDestinationToPosition(val3, false);
				}
				break;
			}
			default:
				{
					LogIfDebugBuild("This Behavior State doesn't exist!");
					break;
				}
				IL_040d:
				base.addPlayerVelocityToDestination = 0f;
				currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
				if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("transition"))
				{
					base.agent.speed = 0f;
				}
				else
				{
					base.agent.speed = 4f;
				}
				base.agent.stoppingDistance = 4f;
				if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 40f && !((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);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					base.currentBehaviourStateIndex = 0;
				}
				else if (angerMeter < angerMeterCapacity)
				{
					angerMeter += Time.deltaTime;
					float num5 = 20f;
					if (timeSinceStartedFollowingPlayer > 5f)
					{
						num5 = 8f;
					}
					if (TargetClosestPlayerInAnyCase() && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > num5)
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
					}
					else
					{
						((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false);
					}
				}
				else
				{
					currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
					if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("transition"))
					{
						SwitchToChasingPlayer();
					}
				}
				break;
			}
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
		}

		[ServerRpc(RequireOwnership = false)]
		public void StabPlayerServerRpc(int playerId, bool setBerserkMode)
		{
			//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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3756768730u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setBerserkMode, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3756768730u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					StabPlayerClientRpc(playerId, setBerserkMode);
				}
			}
		}

		[ClientRpc]
		public void StabPlayerClientRpc(int playerId, bool setBerserkMode)
		{
			//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)
			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(1095208204u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, playerId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setBerserkMode, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1095208204u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine((IEnumerator)StabPlayer(playerId, setBerserkMode));
				}
			}
		}

		private IEnumerator<WaitForSeconds> StabPlayer(int playerId, bool setBerserkMode)
		{
			if (Random.Range(0, 2) == 0)
			{
				andruhaMouth.PlayOneShot(stabVoice);
			}
			base.creatureAnimator.SetBool("run", false);
			base.creatureAnimator.Play("attack");
			yield return new WaitForSeconds(0.25f);
			andruhaMouth.PlayOneShot(stab);
			yield return new WaitForSeconds(0.9f);
			base.creatureAnimator.Play("attack");
			base.creatureAnimator.SetBool("run", true);
		}

		public void CheckCollisionWithPlayer(PlayerControllerB other)
		{
			//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)
			//IL_00a1: 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_00bf: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			if (!base.isEnemyDead && base.currentBehaviourStateIndex == 2 && !(timeSinceLastStab < 1.15f) && !((Object)(object)other == (Object)null) && !(Vector3.Distance(((Component)other).transform.position, ((Component)this).transform.position) > 1.5f))
			{
				timeSinceLastStab = 0f;
				if ((Object)(object)other == (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					Vector3 val = default(Vector3);
					other.DamagePlayer(30, true, true, (CauseOfDeath)14, 0, false, val);
					other.DropBlood(new Vector3(0f, 0f, 0f), true, false);
					Quaternion rotation = ((Component)other.gameplayCamera).transform.rotation;
					val = ((Quaternion)(ref rotation)).eulerAngles;
					LogIfDebugBuild("Boold particle " + ((object)(Vector3)(ref val)).ToString());
					GameObject obj = bloodParticles;
					Vector3 val2 = new Vector3(((Component)other.gameplayCamera).transform.position.x, ((Component)other.gameplayCamera).transform.position.y - 0.2f, ((Component)other.gameplayCamera).transform.position.z);
					rotation = ((Component)other.gameplayCamera).transform.rotation;
					GameObject val3 = Object.Instantiate<GameObject>(obj, val2, Quaternion.Euler(((Quaternion)(ref rotation)).eulerAngles));
					val3.GetComponent<NetworkObject>().Spawn(false);
					val3.transform.SetParent(((Component)base.targetPlayer).transform);
					val3.AddComponent(typeof(BloodParticle));
					StabPlayerServerRpc((int)other.playerClientId, base.currentBehaviourStateIndex != 2);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void InstantiateBloodParticleServerRPC(Vector3 pos, Quaternion rot)
		{
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(233444369u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 233444369u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					InstantiateBloodParticleClientRPC(pos, rot);
				}
			}
		}

		[ClientRpc]
		public void InstantiateBloodParticleClientRPC(Vector3 pos, Quaternion rot)
		{
			//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_0096: 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_00dd: 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(356528112u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 356528112u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					GameObject val3 = Object.Instantiate<GameObject>(bloodParticles, pos, rot);
					val3.transform.SetParent(((Component)base.targetPlayer).transform);
					val3.GetComponent<NetworkObject>().Spawn(false);
					val3.AddComponent(typeof(BloodParticle));
				}
			}
		}

		private void CalculateWalkingAnimationSpeed(float maxSpeed = 1f)
		{
			//IL_0007: 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_0018: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, maxSpeed);
			float num = ((Vector3)(ref val)).magnitude / (Time.deltaTime * 2f);
			base.creatureAnimator.SetFloat("speedOfMovement", num);
			previousPosition = ((Component)this).transform.position;
		}

		private void CalculateWRunningAnimationSpeed(float maxSpeed = 1f)
		{
			//IL_0007: 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_0018: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, maxSpeed);
			float num = ((Vector3)(ref val)).magnitude / (Time.deltaTime * 5f);
			base.creatureAnimator.SetFloat("speedOfMovement", num);
			previousPosition = ((Component)this).transform.position;
		}

		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;
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_001f: 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)
			base.mostOptimalDistance = 2000f;
			base.targetPlayer = null;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
				if (base.tempDist < base.mostOptimalDistance)
				{
					base.mostOptimalDistance = base.tempDist;
					base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				return false;
			}
			return true;
		}

		public void ChooseClosestNodeToPlayer()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			base.agent.stoppingDistance = 0f;
			if ((Object)(object)base.targetNode == (Object)null)
			{
				base.targetNode = base.allAINodes[0].transform;
			}
			Transform val = ChooseClosestInvisibleNodeToPosition(((Component)base.targetPlayer).transform.position, avoidLineOfSight: true);
			((EnemyAI)this).SetDestinationToPosition(val.position, false);
		}

		public Transform ChooseClosestInvisibleNodeToPosition(Vector3 pos, bool avoidLineOfSight = false)
		{
			//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_0057: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			List<int> list = new List<int>();
			base.nodesTempArray = base.allAINodes.OrderBy((GameObject x) => Vector3.Distance(pos, x.transform.position)).ToArray();
			Transform transform = base.nodesTempArray[0].transform;
			for (int i = 0; i < base.nodesTempArray.Length; i++)
			{
				if (((EnemyAI)this).PathIsIntersectedByLineOfSight(base.nodesTempArray[i].transform.position, false, avoidLineOfSight, false))
				{
					list.Add(i);
				}
			}
			for (int j = 0; j < base.nodesTempArray.Length; j++)
			{
				if (!list.Contains(j))
				{
					transform = base.nodesTempArray[j].transform;
					base.mostOptimalDistance = Vector3.Distance(pos, base.nodesTempArray[j].transform.position);
					break;
				}
			}
			return transform;
		}

		private void SwitchToChasingPlayer()
		{
			isBerserkMode = true;
			LogIfDebugBuild("Anger full, Start Chasing Player");
			((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			base.currentBehaviourStateIndex = 2;
			murderMusicSFX.Play();
			angerMeter = 0f;
			base.creatureAnimator.SetBool("run", true);
		}

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

		[ClientRpc]
		public void PullKnifeOutClientRpc()
		{
			//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(3322360426u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3322360426u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					StartTransitionAnimation();
				}
			}
		}

		private void StartTransitionAnimation()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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)
			//IL_0076: 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_0090: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false);
			Vector3 position = ((Component)this).transform.position;
			base.inSpecialAnimation = true;
			((Behaviour)base.agent).enabled = false;
			Vector3 val = (base.serverPosition = RoundManager.Instance.GetNavMeshPosition(position, default(NavMeshHit), 10f, -1));
			((Component)this).transform.position = val;
			((Component)this).transform.localEulerAngles = new Vector3(0f, ((Component)this).transform.localEulerAngles.y, 0f);
			position = val;
			((MonoBehaviour)this).StartCoroutine((IEnumerator)TransitionAnimation(position));
		}

		private IEnumerator<WaitForSeconds> TransitionAnimation(Vector3 setToPos)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			base.creatureAnimator.SetBool("transition", true);
			yield return new WaitForSeconds(1.5f);
			base.inSpecialAnimation = false;
			if (((NetworkBehaviour)this).IsOwner)
			{
				((Component)this).transform.position = setToPos;
				((Behaviour)base.agent).enabled = true;
			}
			base.creatureAnimator.SetBool("transition", false);
			base.creatureAnimator.SetBool("run", true);
			Debug.DrawRay(setToPos, Vector3.up * 2f, Color.magenta, 7f);
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			if (!base.isEnemyDead && timesPlayedInOneSpot <= 1)
			{
			}
		}

		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)
			{
				base.enemyHP -= force;
				base.targetPlayer = playerWhoHit;
				((EnemyAI)this).SwitchToBehaviourServerRpc(2);
				if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
				{
					((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
			}
		}

		[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(3987900853u, 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, 3987900853u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.creatureAnimator.SetTrigger(animationName);
			}
		}

		[ClientRpc]
		public void SwingAttackHitClientRpc()
		{
			//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_00c4: 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_012a: 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)
			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(964239439u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 964239439u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			int num = 8;
			Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num);
			if (array.Length == 0)
			{
				return;
			}
			Collider[] array2 = array;
			foreach (Collider val3 in array2)
			{
				PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
				if ((Object)(object)val4 != (Object)null)
				{
					timeSinceHittingLocalPlayer = 0f;
					val4.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AndruhaAI()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3756768730u, new RpcReceiveHandler(__rpc_handler_3756768730));
			NetworkManager.__rpc_func_table.Add(1095208204u, new RpcReceiveHandler(__rpc_handler_1095208204));
			NetworkManager.__rpc_func_table.Add(233444369u, new RpcReceiveHandler(__rpc_handler_233444369));
			NetworkManager.__rpc_func_table.Add(356528112u, new RpcReceiveHandler(__rpc_handler_356528112));
			NetworkManager.__rpc_func_table.Add(1741764620u, new RpcReceiveHandler(__rpc_handler_1741764620));
			NetworkManager.__rpc_func_table.Add(3322360426u, new RpcReceiveHandler(__rpc_handler_3322360426));
			NetworkManager.__rpc_func_table.Add(3987900853u, new RpcReceiveHandler(__rpc_handler_3987900853));
			NetworkManager.__rpc_func_table.Add(964239439u, new RpcReceiveHandler(__rpc_handler_964239439));
		}

		private static void __rpc_handler_3756768730(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool setBerserkMode = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setBerserkMode, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AndruhaAI)(object)target).StabPlayerServerRpc(playerId, setBerserkMode);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1095208204(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
				bool setBerserkMode = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref setBerserkMode, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AndruhaAI)(object)target).StabPlayerClientRpc(playerId, setBerserkMode);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_233444369(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0043: 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_0052: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				Quaternion rot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AndruhaAI)(object)target).InstantiateBloodParticleServerRPC(pos, rot);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_356528112(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0043: 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_0052: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 pos = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref pos);
				Quaternion rot = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref rot);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AndruhaAI)(object)target).InstantiateBloodParticleClientRPC(pos, rot);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_3322360426(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;
				((AndruhaAI)(object)target).PullKnifeOutClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3987900853(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;
				((AndruhaAI)(object)target).DoAnimationClientRpc(animationName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_964239439(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;
				((AndruhaAI)(object)target).SwingAttackHitClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AndruhaAI";
		}
	}
	internal class BloodParticle : NetworkBehaviour
	{
		public void Start()
		{
			DestroyBlood();
		}

		private void DestroyBlood()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject, 2f);
		}

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

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

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

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

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

		private static void __rpc_handler_2596258972(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;
				((BloodParticle)(object)target).DestroyBloodClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BloodParticle";
		}
	}
	[BepInPlugin("Sita320341.KarelianCompany", "KarelianCompany", "1.0.0")]
	[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;
			Logger.LogInfo((object)"Sita320341.KarelianCompany СОСНИ ХУЙЦА!!!");
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "kareliancompanyassets";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			Logger.LogInfo((object)("Path: " + 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>("AndruhaObj");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("AndruhaTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("AndruhaTK");
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom Andruha.");
				return;
			}
			Logger.LogInfo((object)"Andruha loaded");
			if ((Object)(object)val2 == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom AndruhaTN.");
				return;
			}
			Logger.LogInfo((object)"AndruhaTN loaded");
			if ((Object)(object)val3 == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom AndruhaTK.");
				return;
			}
			Logger.LogInfo((object)"AndruhaTK loaded");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
			Logger.LogInfo((object)"Plugin Sita320341.KarelianCompany is loaded!");
		}

		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 = "Sita320341.KarelianCompany";

		public const string PLUGIN_NAME = "KarelianCompany";

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

		public PluginConfig(ConfigFile cfg)
		{
			SpawnWeight = cfg.Bind<int>("General", "Spawn weight", 20, "The spawn chance weight for KarelianCompany, 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 Sita320341.KarelianCompany.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}