Decompiled source of A Certain Thai Cat v1.0.1

plugins/ThaiCat/AlexGM311.ThaiCat.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 AlexGM311.ThaiCat.NetcodePatcher;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ThaiCat.Configuration;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AlexGM311.ThaiCat")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+bdf56d37381e73349ca02c8db8234ee2bcbbf8fd")]
[assembly: AssemblyProduct("A_Certain_Thai_Cat")]
[assembly: AssemblyTitle("AlexGM311.ThaiCat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 ThaiCat
{
	[BepInPlugin("AlexGM311.ThaiCat", "A_Certain_Thai_Cat", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		public static Dictionary<string, AudioClip>? soundEffects;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "thaicatbundle";
			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;
			}
			Logger.LogInfo((object)"Loaded the bundle");
			EnemyType val = ModAssets.LoadAsset<EnemyType>("ThaiCat");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("ThaiCatTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("ThaiCatTK");
			string[] allAssetNames = ModAssets.GetAllAssetNames();
			soundEffects = new Dictionary<string, AudioClip>
			{
				{
					"running",
					ModAssets.LoadAsset<AudioClip>("running.sfx")
				},
				{
					"purring",
					ModAssets.LoadAsset<AudioClip>("purring.sfx")
				}
			};
			if ((Object)(object)val == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val2 == (Object)null)
			{
				Logger.LogError((object)"Failed to load asset(s)");
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogError((object)"Failed to load the model");
				}
				if ((Object)(object)val3 == (Object)null)
				{
					Debug.LogError((object)"Failed to load the terminal keywords");
				}
				if ((Object)(object)val2 == (Object)null)
				{
					Debug.LogError((object)"Failed to load the terminal node");
				}
			}
			else
			{
				Logger.LogInfo((object)"Succesfully loaded all assets");
				NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
				Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), val2, val3);
				Logger.LogInfo((object)"Plugin AlexGM311.ThaiCat 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);
					}
				}
			}
		}
	}
	internal class ThaiCatAI : EnemyAI
	{
		private enum State
		{
			GoToSleep,
			Sleep,
			WakeUp,
			Patrol,
			Stalking,
			Attack,
			Rage,
			Dead
		}

		public Transform turnCompass;

		public Transform attackArea;

		private float timeSinceHittingLocalPlayer;

		private Random enemyRandom;

		private bool isDeadAnimationDone;

		private Tile? entranceTile;

		private Tile? mostSpreadRoom;

		private float timeSinceLastCheck;

		private float timeBetweenChecks = 2f;

		private float wakeMeter;

		private float hearNoiseCooldown;

		private bool inKillAnimation;

		private bool spottedPlayer;

		private float timeSinceSpottingPlayer;

		private AISearchRoutine circularSearch = new AISearchRoutine();

		private int attackCount;

		private float timeSinceLastPathfind;

		private bool playersInDoors;

		private float lostLOSTimer;

		private bool lostPlayerInChase;

		private Transform? stareAtTransform;

		public Tile? EntranceTile
		{
			get
			{
				return entranceTile;
			}
			private set
			{
				entranceTile = value;
			}
		}

		public Tile? MostSpreadRoom
		{
			get
			{
				return mostSpreadRoom;
			}
			private set
			{
				mostSpreadRoom = value;
			}
		}

		public void SFX_Running()
		{
			if (Plugin.soundEffects == null)
			{
				Debug.LogError((object)"No running sound effect provided!");
			}
			else
			{
				base.creatureSFX.PlayOneShot(Plugin.soundEffects["running"], 0.15f);
			}
		}

		public void SFX_Purring()
		{
			if (Plugin.soundEffects == null)
			{
				Debug.LogError((object)"No purring sound effect provided!");
			}
			else if (!base.isEnemyDead)
			{
				base.creatureSFX.PlayOneShot(Plugin.soundEffects["purring"], 0.2f);
			}
		}

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

		public override void Start()
		{
			((EnemyAI)this).Start();
			base.creatureSFX.volume = 1.5f;
			base.creatureVoice.volume = 2f;
			DoAnimationClientRpc("");
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			isDeadAnimationDone = false;
			GoToSleep();
			base.enemyType.MaxCount = 1;
			((MonoBehaviour)this).StartCoroutine(SendData());
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
			if (!base.isEnemyDead)
			{
				timeSinceHittingLocalPlayer += Time.deltaTime;
				hearNoiseCooldown -= Time.deltaTime;
				hearNoiseCooldown = ((hearNoiseCooldown < 0f) ? 0f : hearNoiseCooldown);
			}
		}

		public override void DoAIInterval()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0374: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 12f;
				wakeMeter = 0f;
				if (Vector3.Distance(((Component)this).transform.position, base.favoriteSpot.position) <= 1f)
				{
					Sleep();
				}
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Running.Begin");
				}
				break;
			case 1:
				base.agent.speed = 0f;
				if (timeSinceLastCheck >= timeBetweenChecks)
				{
					timeSinceLastCheck = 0f;
					if (enemyRandom.NextDouble() < (double)wakeMeter)
					{
						((MonoBehaviour)this).StartCoroutine(WakeUp());
					}
					if (wakeMeter > 0.1f)
					{
						wakeMeter -= 0.05f;
					}
					wakeMeter = Math.Max(0f, wakeMeter);
				}
				timeSinceLastCheck += base.AIIntervalTime;
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Sleeping.Begin");
				}
				break;
			case 3:
				base.agent.speed = 6f;
				timeSinceSpottingPlayer += base.AIIntervalTime;
				if (timeSinceSpottingPlayer > 5f)
				{
					spottedPlayer = false;
					PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(60f, 60, -1, 0f);
					if (Object.op_Implicit((Object)(object)val) && !val.HasLineOfSightToPosition(((Component)this).transform.position, 30f, 60, -1f))
					{
						base.agent.speed = 0f;
						DoAnimationClientRpc("Walking.End");
						((MonoBehaviour)this).StartCoroutine(SpottedPlayer(val));
					}
				}
				if (base.currentSearch.unsearchedNodes.Count <= 0)
				{
					CircularSearch();
				}
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Walking.Begin");
				}
				break;
			case 4:
				base.agent.speed = 10f;
				if (Vector3.Distance(((Component)base.targetPlayer).transform.position, ((Component)this).transform.position) < 4f)
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(5);
					((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer);
					attackCount = 0;
				}
				else if (Time.realtimeSinceStartup - timeSinceLastPathfind > 1f)
				{
					if (((EnemyAI)this).PathIsIntersectedByLineOfSight(base.destination, false, true))
					{
						AvoidClosestPlayer();
					}
					else if (!((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true))
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(3);
						DoAnimationClientRpc("Running.Stop");
						CircularSearch();
					}
					else
					{
						((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
						base.destination += Vector3.Normalize(base.targetPlayer.thisController.velocity * 100f) * -1.5f;
					}
				}
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Running.Begin");
				}
				break;
			case 5:
			{
				PlayerControllerB val3 = ((EnemyAI)this).CheckLineOfSightForClosestPlayer(60f, 50, 1, 3f);
				base.agent.speed = 12f;
				if (attackCount >= 5)
				{
					GoToSleep();
				}
				if ((Object)(object)val3 != (Object)null)
				{
					stareAtTransform = ((Component)val3.gameplayCamera).transform;
					lostPlayerInChase = false;
					lostLOSTimer = 0f;
					if ((Object)(object)val3 != (Object)(object)base.targetPlayer)
					{
						((EnemyAI)this).SetMovingTowardsTargetPlayer(val3);
						LookAtPlayerServerRpc((int)val3.playerClientId);
					}
				}
				lostLOSTimer += base.AIIntervalTime;
				if (lostLOSTimer > 10f)
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(3);
					DoAnimationClientRpc("Running.Stop");
				}
				else if (lostLOSTimer > 3.5f)
				{
					lostPlayerInChase = true;
					StopLookingAtTransformServerRpc();
					base.targetPlayer = null;
				}
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Running.Begin");
				}
				break;
			}
			case 6:
			{
				base.agent.speed = 16f;
				base.agent.angularSpeed = 480f;
				base.agent.acceleration = 24f;
				playersInDoors = false;
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val2 in allPlayerScripts)
				{
					if (val2.isInsideFactory)
					{
						playersInDoors = true;
						break;
					}
				}
				if (!playersInDoors)
				{
					GoToSleep();
					base.agent.angularSpeed = 240f;
					base.agent.acceleration = 8f;
				}
				else
				{
					((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
					base.movingTowardsTargetPlayer = true;
				}
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Running.Begin");
				}
				break;
			}
			case 7:
				base.creatureSFX.volume = 0f;
				base.creatureVoice.volume = 0f;
				base.agent.speed = 0f;
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name == "Idle")
				{
					DoAnimationClientRpc("Sleeping.Begin");
				}
				else if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name.Split('.')[0] != "Sleeping")
				{
					EndAnimation();
				}
				break;
			case 2:
				break;
			}
		}

		public IEnumerator SendData()
		{
			while (true)
			{
				yield return (object)new WaitForSeconds(2f);
				_ = base.currentBehaviourStateIndex;
				_ = base.currentBehaviourStateIndex;
				if (3 != base.currentBehaviourStateIndex)
				{
				}
			}
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
			if (noiseID == 7 || noiseID == 546 || 6 == base.currentBehaviourStateIndex || base.currentBehaviourStateIndex == 0 || hearNoiseCooldown > 0f)
			{
				return;
			}
			hearNoiseCooldown = 0.03f;
			float num = Vector3.Distance(((Component)this).transform.position, noisePosition);
			if (Physics.Linecast(((Component)this).transform.position, noisePosition, 256))
			{
				noiseLoudness /= 2f;
			}
			if (!(noiseLoudness < 0.25f))
			{
				if (1 == base.currentBehaviourStateIndex)
				{
					wakeMeter += 0.065f * noiseLoudness / num;
				}
				if (3 == base.currentBehaviourStateIndex)
				{
					base.targetNode = ((EnemyAI)this).ChooseClosestNodeToPosition(noisePosition, false, 0);
				}
			}
		}

		public void AttackPlayer()
		{
			switch (enemyRandom.Next(0, 2))
			{
			case 0:
				DoAnimationClientRpc("Attack.1");
				if (base.currentBehaviourStateIndex == 5)
				{
					attackCount++;
				}
				break;
			case 1:
				DoAnimationClientRpc("Attack.2");
				if (base.currentBehaviourStateIndex == 5)
				{
					attackCount++;
				}
				break;
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_0115: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			if (base.currentBehaviourStateIndex == 0 || 2 == base.currentBehaviourStateIndex)
			{
				return;
			}
			if (1 == base.currentBehaviourStateIndex)
			{
				wakeMeter = 1f;
			}
			else
			{
				if (timeSinceHittingLocalPlayer < 1f)
				{
					return;
				}
				if (base.currentBehaviourStateIndex == 5 || (base.currentBehaviourStateIndex == 6 && ((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name != "Attack.1" && ((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name != "Attack.2"))
				{
					AttackPlayer();
				}
				((EnemyAI)this).OnCollideWithPlayer(other);
				PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, inKillAnimation, false);
				if (base.currentBehaviourStateIndex == 3)
				{
					AttackPlayer();
					((EnemyAI)this).SwitchToBehaviourClientRpc(5);
					((EnemyAI)this).SetMovingTowardsTargetPlayer(val);
					attackCount = 0;
				}
				if ((Object)(object)val != (Object)null)
				{
					timeSinceHittingLocalPlayer = 0f;
					if (6 == base.currentBehaviourStateIndex)
					{
						val.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					}
					else
					{
						val.DamagePlayer(25, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					}
				}
			}
		}

		private void GoToSleep()
		{
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)base.favoriteSpot == (Object)null)
			{
				if ((Object)(object)RoundManager.Instance.dungeonGenerator == (Object)null)
				{
					Plugin.Logger.LogWarning((object)"dungeonGenerator instance is not present!");
					base.favoriteSpot = ((Component)this).transform;
					base.targetNode = base.favoriteSpot;
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					return;
				}
				ReadOnlyCollection<Tile> allTiles = RoundManager.Instance.dungeonGenerator.Generator.CurrentDungeon.AllTiles;
				if (allTiles == null)
				{
					Plugin.Logger.LogError((object)"Dungeon has not generated yet!");
					return;
				}
				mostSpreadRoom = allTiles[0];
				foreach (Tile item in allTiles)
				{
					if (item.Placement.Depth == 0)
					{
						entranceTile = item;
					}
					else if (item.UsedDoorways.Count >= mostSpreadRoom.UsedDoorways.Count)
					{
						mostSpreadRoom = item;
					}
				}
				if ((Object)(object)entranceTile == (Object)null)
				{
					Plugin.Logger.LogWarning((object)"Failed to find the Main tile");
				}
				Transform favoriteSpot = ((EnemyAI)this).ChooseClosestNodeToPosition(mostSpreadRoom.Placement.Position, false, 0);
				base.favoriteSpot = favoriteSpot;
			}
			if (!((EnemyAI)this).SetDestinationToPosition(base.favoriteSpot.position, true))
			{
				Plugin.Logger.LogWarning((object)"Failed to pathfind to the favorite spot");
				base.favoriteSpot = ((Component)this).transform;
			}
			else
			{
				base.targetNode = base.favoriteSpot;
				((EnemyAI)this).SwitchToBehaviourClientRpc(0);
			}
		}

		public IEnumerator SpottedPlayer(PlayerControllerB player)
		{
			base.targetPlayer = null;
			timeSinceSpottingPlayer = 0f;
			spottedPlayer = true;
			LookAtPlayerServerRpc((int)player.playerClientId);
			yield return (object)new WaitForSeconds(2.5f);
			if (player.HasLineOfSightToPosition(((Component)this).transform.position, 30f, 60, -1f))
			{
				spottedPlayer = false;
				yield break;
			}
			((EnemyAI)this).SwitchToBehaviourClientRpc(4);
			DoAnimationClientRpc("Walking.End");
			base.targetPlayer = player;
		}

		private void Sleep()
		{
			base.agent.speed = 0f;
			DoAnimationClientRpc("Running.End");
			((EnemyAI)this).SwitchToBehaviourClientRpc(1);
			wakeMeter = 0f;
		}

		public IEnumerator WakeUp()
		{
			base.agent.speed = 0f;
			((EnemyAI)this).SwitchToBehaviourClientRpc(2);
			DoAnimationClientRpc("Sleeping.End");
			yield return (object)new WaitForSeconds(2f);
			((EnemyAI)this).SwitchToBehaviourClientRpc(3);
		}

		public int Compare(GameObject x, GameObject y)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.Distance(x.transform.position, ((Component)this).transform.position).CompareTo(Vector3.Distance(y.transform.position, ((Component)this).transform.position));
		}

		public void CircularSearch()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			circularSearch.loopSearch = false;
			circularSearch.unsearchedNodes = base.allAINodes.ToList();
			circularSearch.unsearchedNodes.Sort(Compare);
			((EnemyAI)this).StartSearch(((Component)this).transform.position, circularSearch);
		}

		public void AvoidClosestPlayer()
		{
			//IL_000c: 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_004b: 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)
			Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)base.targetPlayer).transform.position, true, 0, true);
			if ((Object)(object)val != (Object)null && base.mostOptimalDistance > 5f && Physics.Linecast(((Component)val).transform.position, ((Component)base.targetPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				base.targetNode = val;
				((EnemyAI)this).SetDestinationToPosition(base.targetNode.position, false);
			}
			else
			{
				base.agent.speed = 0f;
			}
		}

		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;
			}
			base.enemyHP -= force;
			if (6 != base.currentBehaviourStateIndex)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(6);
				if (((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name != "Running")
				{
					EndAnimation();
				}
			}
			if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
			{
				if (base.searchCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
				}
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
		}

		public void EndAnimation()
		{
			string[] array = ((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name.Split('.', StringSplitOptions.RemoveEmptyEntries);
			_ = array.Length;
			_ = 2;
			if (array.Length == 1)
			{
				if (array[0] != "idle")
				{
					DoAnimationClientRpc(array[0] + ".End");
				}
			}
			else if (array[1] == "begin")
			{
				executeAfterTimer(EndAnimation, 2.01f);
			}
		}

		public IEnumerator executeAfterTimer(Action doSomething, float afterTime)
		{
			yield return (object)new WaitForSeconds(afterTime);
			doSomething();
		}

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

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

		[ServerRpc]
		public void LookAtPlayerServerRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Invalid comparison between Unknown and I4
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Invalid comparison between Unknown and I4
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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(3236213200u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3236213200u, 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))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager2.LocalClientId)
				{
					if ((int)networkManager2.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val3 = default(ServerRpcParams);
				FastBufferWriter val4 = ((NetworkBehaviour)this).__beginSendServerRpc(1141953697u, val3, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val4, playerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val4, 1141953697u, val3, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost))
			{
				LookAtPlayerClientRpc(playerId);
			}
		}

		[ClientRpc]
		public void LookAtPlayerClientRpc(int playerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_010c: 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)
			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(743166271u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 743166271u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager2 != null && networkManager2.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager2.IsServer || networkManager2.IsHost))
				{
					ClientRpcParams val3 = default(ClientRpcParams);
					FastBufferWriter val4 = ((NetworkBehaviour)this).__beginSendClientRpc(2397761797u, val3, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val4, playerId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val4, 2397761797u, val3, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager2.IsClient || networkManager2.IsHost))
				{
					stareAtTransform = ((Component)StartOfRound.Instance.allPlayerScripts[playerId].gameplayCamera).transform;
				}
			}
		}

		[ServerRpc]
		public void StopLookingAtTransformServerRpc()
		{
			//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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Invalid comparison between Unknown and I4
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Invalid comparison between Unknown and I4
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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(3481228311u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3481228311u, 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))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager2.LocalClientId)
				{
					if ((int)networkManager2.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val3 = default(ServerRpcParams);
				FastBufferWriter val4 = ((NetworkBehaviour)this).__beginSendServerRpc(1407409549u, val3, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val4, 1407409549u, val3, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager2.IsServer || networkManager2.IsHost))
			{
				StopLookingAtTransformClientRpc();
			}
		}

		[ClientRpc]
		public void StopLookingAtTransformClientRpc()
		{
			//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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Invalid comparison between Unknown and I4
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			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(1996530213u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1996530213u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			NetworkManager networkManager2 = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager2 != null && networkManager2.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager2.IsServer || networkManager2.IsHost))
				{
					ClientRpcParams val3 = default(ClientRpcParams);
					FastBufferWriter val4 = ((NetworkBehaviour)this).__beginSendClientRpc(1561581057u, val3, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val4, 1561581057u, val3, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager2.IsClient || networkManager2.IsHost))
				{
					stareAtTransform = null;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_ThaiCatAI()
		{
			//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
			NetworkManager.__rpc_func_table.Add(959857723u, new RpcReceiveHandler(__rpc_handler_959857723));
			NetworkManager.__rpc_func_table.Add(3236213200u, new RpcReceiveHandler(__rpc_handler_3236213200));
			NetworkManager.__rpc_func_table.Add(743166271u, new RpcReceiveHandler(__rpc_handler_743166271));
			NetworkManager.__rpc_func_table.Add(3481228311u, new RpcReceiveHandler(__rpc_handler_3481228311));
			NetworkManager.__rpc_func_table.Add(1996530213u, new RpcReceiveHandler(__rpc_handler_1996530213));
		}

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

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

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

		private static void __rpc_handler_3481228311(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;
				((ThaiCatAI)(object)target).StopLookingAtTransformServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1996530213(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;
				((ThaiCatAI)(object)target).StopLookingAtTransformClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ThaiCatAI";
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AlexGM311.ThaiCat";

		public const string PLUGIN_NAME = "A_Certain_Thai_Cat";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace ThaiCat.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 the Thai cat, 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 AlexGM311.ThaiCat.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}