Decompiled source of SCP3166 v1.0.0

SCP3166/ProjectSCP.SCP3166.dll

Decompiled 2 weeks ago
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 HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ProjectSCP.SCP3166.NetcodePatcher;
using TMPro;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;

[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("ProjectSCP.SCP3166")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ae32e59ac0d9593dee06040e1d5f98584a357a3d")]
[assembly: AssemblyProduct("SCP3166")]
[assembly: AssemblyTitle("ProjectSCP.SCP3166")]
[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 SCP3166
{
	internal class GarfieldPhoneBehavior : PhysicsProp
	{
		public enum State
		{
			Off,
			Main,
			Orbit
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public AudioSource ItemAudio;

		public AudioClip WelcomeSFX;

		public AudioClip PingSFX;

		public TextMeshProUGUI GorefieldDistanceText;

		public TextMeshProUGUI ClosestLasagnaText;

		public TextMeshProUGUI LocatingLasagnaText;

		public GameObject FlashlightIcon;

		public Slider BatterySlider;

		public SpriteRenderer GorefieldStatusRenderer;

		public GameObject MainPanel;

		public GameObject OrbitPanel;

		private PlayerControllerB? previousPlayerHeldBy;

		public State CurrentState = State.Off;

		private bool flashlightToggle;

		public static int flashlightID = 1;

		private bool scanningForLasagna;

		private float lasagnaDetectorTime = 5f;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			lasagnaDetectorTime = Plugin.configGarfieldPhoneLasagnaLocatorTime.Value;
			SwitchState(State.Off);
			((GrabbableObject)this).insertedBattery.charge = 1f;
		}

		public override void Update()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			BatterySlider.value = ((GrabbableObject)this).insertedBattery.charge;
			if (StartOfRound.Instance.inShipPhase && CurrentState != State.Orbit && CurrentState != 0)
			{
				SwitchState(State.Orbit);
			}
			if (CurrentState == State.Main)
			{
				float closestLasagnaDistance = GetClosestLasagnaDistance(2000f);
				if (closestLasagnaDistance == -1f)
				{
					((TMP_Text)ClosestLasagnaText).text = "Closest Lasagna: N/A";
				}
				else
				{
					((TMP_Text)ClosestLasagnaText).text = "Closest Lasagna: " + closestLasagnaDistance.ToString("F1");
				}
				if ((Object)(object)SCP3166AI.Instance != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && ((GrabbableObject)this).isInFactory)
				{
					((TMP_Text)GorefieldDistanceText).text = "Distance To Gorefield: " + Vector3.Distance(((Component)((GrabbableObject)this).playerHeldBy).transform.position, ((Component)SCP3166AI.Instance).gameObject.transform.position).ToString("F1");
				}
				else
				{
					((TMP_Text)GorefieldDistanceText).text = "Distance To Gorefield: N/A";
				}
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (buttonDown && CurrentState == State.Main && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null))
			{
				flashlightToggle = !flashlightToggle;
				FlashlightIcon.SetActive(flashlightToggle);
				((GrabbableObject)this).playerHeldBy.ChangeHelmetLight(flashlightID, flashlightToggle);
				((GrabbableObject)this).UseItemBatteries(false, true);
			}
		}

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null))
			{
				previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true;
			}
		}

		public override void PocketItem()
		{
			SwitchState(State.Off);
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			((GrabbableObject)this).PocketItem();
		}

		public override void DiscardItem()
		{
			flashlightToggle = false;
			FlashlightIcon.SetActive(flashlightToggle);
			previousPlayerHeldBy.ChangeHelmetLight(flashlightID, flashlightToggle);
			((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false;
			((GrabbableObject)this).DiscardItem();
		}

		public override void UseUpBatteries()
		{
			((GrabbableObject)this).UseUpBatteries();
			SwitchState(State.Off);
		}

		public override void ItemInteractLeftRight(bool right)
		{
			((GrabbableObject)this).ItemInteractLeftRight(right);
			if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || scanningForLasagna || ((GrabbableObject)this).insertedBattery.empty)
			{
				return;
			}
			if (!right)
			{
				logger.LogDebug((object)"Toggle power");
				if (CurrentState == State.Off)
				{
					if (StartOfRound.Instance.inShipPhase)
					{
						SwitchState(State.Orbit);
					}
					else
					{
						SwitchState(State.Main);
					}
				}
				else
				{
					SwitchState(State.Off);
				}
			}
			else
			{
				logger.LogDebug((object)"Locate lasagna");
				if (!StartOfRound.Instance.inShipPhase && ((GrabbableObject)this).playerHeldBy.isInsideFactory && CurrentState != 0)
				{
					scanningForLasagna = true;
					((MonoBehaviour)this).StartCoroutine(LocateLasagnaCoroutine());
				}
			}
		}

		private IEnumerator LocateLasagnaCoroutine()
		{
			float waitTimeIntervals = Plugin.configGarfieldPhoneLasagnaLocatorScanTime.Value / 3f;
			((TMP_Text)LocatingLasagnaText).text = "Locating Lasagna";
			yield return (object)new WaitForSeconds(waitTimeIntervals);
			((TMP_Text)LocatingLasagnaText).text = "Locating Lasagna.";
			yield return (object)new WaitForSeconds(waitTimeIntervals);
			((TMP_Text)LocatingLasagnaText).text = "Locating Lasagna..";
			yield return (object)new WaitForSeconds(waitTimeIntervals);
			((TMP_Text)LocatingLasagnaText).text = "Locating Lasagna...";
			yield return (object)new WaitForSeconds(1f);
			if ((Object)(object)Plugin.localPlayer == (Object)(object)previousPlayerHeldBy)
			{
				foreach (LasagnaBehavior lasagna in LasagnaBehavior.SpawnedLasagna)
				{
					lasagna.ShowLocation(lasagnaDetectorTime);
				}
			}
			((TMP_Text)LocatingLasagnaText).text = $"Found {LasagnaBehavior.SpawnedLasagna.Count} lasagna";
			yield return (object)new WaitForSeconds(lasagnaDetectorTime);
			((TMP_Text)LocatingLasagnaText).text = "";
			scanningForLasagna = false;
		}

		public void SwitchState(State state)
		{
			logger.LogDebug((object)("Switching state to " + state));
			State currentState = CurrentState;
			CurrentState = state;
			MainPanel.SetActive(false);
			OrbitPanel.SetActive(false);
			switch (CurrentState)
			{
			case State.Off:
				((GrabbableObject)this).UseItemBatteries(false, false);
				flashlightToggle = false;
				FlashlightIcon.SetActive(flashlightToggle);
				if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null))
				{
					((GrabbableObject)this).playerHeldBy.ChangeHelmetLight(flashlightID, flashlightToggle);
				}
				break;
			case State.Main:
				MainPanel.SetActive(true);
				((GrabbableObject)this).UseItemBatteries(false, true);
				if (currentState != 0)
				{
				}
				break;
			case State.Orbit:
				OrbitPanel.SetActive(true);
				((GrabbableObject)this).UseItemBatteries(false, true);
				break;
			}
		}

		private float GetClosestLasagnaDistance(float maxDistance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			float num = maxDistance;
			foreach (LasagnaBehavior item in LasagnaBehavior.SpawnedLasagna)
			{
				float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position);
				if (!(num2 > num))
				{
					num = num2;
				}
			}
			if (num == maxDistance)
			{
				return -1f;
			}
			return num;
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "GarfieldPhoneBehavior";
		}
	}
	internal class GarfieldPhoneStatusAnimator : MonoBehaviour
	{
		public Animator StatusAnimator;

		public void Update()
		{
			if ((Object)(object)SCP3166AI.Instance != (Object)null)
			{
				StatusAnimator.SetInteger("state", ((EnemyAI)SCP3166AI.Instance).currentBehaviourStateIndex);
			}
			else
			{
				StatusAnimator.SetInteger("state", -1);
			}
		}
	}
	public class LasagnaBehavior : PhysicsProp
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		public Material MainMaterial;

		public Material OverlayMaterial;

		public static List<LasagnaBehavior> SpawnedLasagna = new List<LasagnaBehavior>();

		public override void Start()
		{
			((GrabbableObject)this).Start();
			SpawnedLasagna.Add(this);
		}

		public void ShowLocation(float time)
		{
			((MonoBehaviour)this).StartCoroutine(ShowLocationCoroutine(time));
		}

		private IEnumerator ShowLocationCoroutine(float time)
		{
			logger.LogDebug((object)"ShowLocationCoroutine()");
			((Renderer)((GrabbableObject)this).mainObjectRenderer).material = OverlayMaterial;
			yield return (object)new WaitForSeconds(time);
			((Renderer)((GrabbableObject)this).mainObjectRenderer).material = MainMaterial;
		}

		public override void OnDestroy()
		{
			((NetworkBehaviour)this).OnDestroy();
			SpawnedLasagna.Remove(this);
		}

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "LasagnaBehavior";
		}
	}
	internal class TESTING : MonoBehaviour
	{
		public static bool testing;

		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			try
			{
				string text = __instance.chatTextField.text;
				string[] array = text.Split(" ");
				switch (array[0])
				{
				case "/play":
					SCP3166AI.Instance.PlayClip(array[1]);
					break;
				case "/testing":
					testing = !testing;
					HUDManager.Instance.DisplayTip("Testing", testing.ToString(), false, false, "LC_Tip1");
					break;
				case "/refresh":
					RoundManager.Instance.RefreshEnemiesList();
					HoarderBugAI.RefreshGrabbableObjectsInMapList();
					break;
				case "/levels":
				{
					SelectableLevel[] levels = StartOfRound.Instance.levels;
					foreach (SelectableLevel val2 in levels)
					{
						logger.LogDebug((object)((Object)val2).name);
					}
					break;
				}
				case "/dungeon":
					logger.LogDebug((object)((Object)RoundManager.Instance.dungeonGenerator.Generator.DungeonFlow).name);
					break;
				case "/dungeons":
				{
					IndoorMapType[] dungeonFlowTypes = RoundManager.Instance.dungeonFlowTypes;
					foreach (IndoorMapType val in dungeonFlowTypes)
					{
						logger.LogDebug((object)((Object)val.dungeonFlow).name);
					}
					break;
				}
				}
			}
			catch
			{
				logger.LogError((object)"Invalid chat command");
			}
		}
	}
	[BepInPlugin("ProjectSCP.SCP3166", "SCP3166", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

		private readonly Harmony harmony = new Harmony("ProjectSCP.SCP3166");

		public static AssetBundle? ModAssets;

		public static ConfigEntry<string> configGorefieldLevelRarities;

		public static ConfigEntry<string> configGorefieldCustomLevelRarities;

		public static ConfigEntry<int> configStartingLasagna;

		public static ConfigEntry<float> configHungerPhaseCooldown;

		public static ConfigEntry<float> configHungerRagePhaseTime;

		public static ConfigEntry<float> configDistanceToLoseGorefield;

		public static ConfigEntry<float> configDistanceToLoseHungryGorefield;

		public static ConfigEntry<float> configStartingSize;

		public static ConfigEntry<float> configMaxSize;

		public static ConfigEntry<float> configSizeIncreasePerLasagna;

		public static ConfigEntry<int> configStartDamage;

		public static ConfigEntry<int> configDamageIncreasePerLasagna;

		public static ConfigEntry<float> configTimeToEat;

		public static ConfigEntry<float> configFollowPlayerCooldown;

		public static ConfigEntry<float> configHungerMultiplierIncreasePerLasagna;

		public static ConfigEntry<string> configLasagnaLevelRarities;

		public static ConfigEntry<string> configLasagnaCustomLevelRarities;

		public static ConfigEntry<int> configLasagnaMinValue;

		public static ConfigEntry<int> configLasagnaMaxValue;

		public static ConfigEntry<int> configGarfieldPhoneStorePrice;

		public static ConfigEntry<float> configGarfieldPhoneLasagnaLocatorTime;

		public static ConfigEntry<float> configGarfieldPhoneLasagnaLocatorScanTime;

		public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController;

		public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;

		public static PlayerControllerB PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB x) => x.actualClientId == id).First();
		}

		private void Awake()
		{
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			configGorefieldLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Gorefield", "Level Rarities", "All: 50", "Rarities for each level. See default for formatting.");
			configGorefieldCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Gorefield", "Custom Level Rarities", "", "Rarities for modded levels. Same formatting as level rarities.");
			configStartingLasagna = ((BaseUnityPlugin)this).Config.Bind<int>("Gorefield", "Starting Lasagna", 5, "Amount of lasagna Gorefield spawns when he spawns.");
			configHungerPhaseCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Hunger Phase Cooldown", 60f, "Cooldown before Gorefield enters hunger phase (seconds).");
			configHungerRagePhaseTime = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Hunger Rage Phase Time", 60f, "Cooldown before Gorefield enters hunger rage phase after the hunger phase (seconds).");
			configDistanceToLoseGorefield = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Distance To Lose Gorefield", 20f, "Distance required to lose Gorefield.");
			configDistanceToLoseHungryGorefield = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Distance To Lose Hungry Gorefield", 5000f, "Distance required to lose hungry Gorefield.");
			configStartingSize = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Starting Size", 1f, "Initial size of Gorefield.");
			configMaxSize = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Max Size", 2f, "Maximum size Gorefield can reach.");
			configSizeIncreasePerLasagna = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Size Increase Per Lasagna", 0.1f, "Size increase per lasagna eaten.");
			configStartDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Gorefield", "Starting Damage", 20, "Base damage Gorefield deals.");
			configDamageIncreasePerLasagna = ((BaseUnityPlugin)this).Config.Bind<int>("Gorefield", "Damage Increase Per Lasagna", 8, "Damage increase per lasagna eaten.");
			configTimeToEat = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Time To Eat", 10f, "Time it takes Gorefield to eat a lasagna (seconds).");
			configFollowPlayerCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Follow Player Cooldown", 10f, "Cooldown before Gorefield follows a player again (seconds).");
			configHungerMultiplierIncreasePerLasagna = ((BaseUnityPlugin)this).Config.Bind<float>("Gorefield", "Hunger Multiplier Increase Per Lasagna", 0.05f, "Hunger multiplier increase per lasagna eaten.");
			configLasagnaLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Lasagna", "Level Rarities", "All: 30", "Rarities for each level. See default for formatting.");
			configLasagnaCustomLevelRarities = ((BaseUnityPlugin)this).Config.Bind<string>("Lasagna", "Custom Level Rarities", "", "Rarities for modded levels. Same formatting as level rarities.");
			configLasagnaMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("Lasagna", "Min Value", 80, "Minimum scrap value.");
			configLasagnaMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Lasagna", "Max Value", 150, "Maximum scrap value.");
			configGarfieldPhoneStorePrice = ((BaseUnityPlugin)this).Config.Bind<int>("Garfield Phone", "Store Price", 20, "The price of the garfield phone in the store.");
			configGarfieldPhoneLasagnaLocatorTime = ((BaseUnityPlugin)this).Config.Bind<float>("Garfield Phone", "Lasagna Locator Time", 5f, "The amount of time the lasagna locator function will show lasagna through walls.");
			configGarfieldPhoneLasagnaLocatorScanTime = ((BaseUnityPlugin)this).Config.Bind<float>("Garfield Phone", "Lasagna Locator Scan Time", 3f, "The time it takes for the lasagna locator to start showing lasagna through walls.");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scp3166_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "scp3166_assets")));
			EnemyType val = ModAssets.LoadAsset<EnemyType>("Assets/ModAssets/GorefieldEnemy.asset");
			if ((Object)(object)val == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get Gorefield from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Got Gorefield prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			Utilities.FixMixerGroups(val.enemyPrefab);
			Enemies.RegisterEnemy(val, GetLevelRarities(configGorefieldLevelRarities.Value), GetCustomLevelRarities(configGorefieldCustomLevelRarities.Value), (TerminalNode)null, (TerminalKeyword)null);
			Item val2 = ModAssets.LoadAsset<Item>("Assets/ModAssets/LasagnaItem.asset");
			if ((Object)(object)val2 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get Lasagna from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Got Lasagna prefab");
			val2.minValue = configLasagnaMinValue.Value;
			val2.maxValue = configLasagnaMaxValue.Value;
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Utilities.FixMixerGroups(val2.spawnPrefab);
			Items.RegisterScrap(val2, GetLevelRarities(configLasagnaLevelRarities.Value), GetCustomLevelRarities(configLasagnaCustomLevelRarities.Value));
			Item val3 = ModAssets.LoadAsset<Item>("Assets/ModAssets/GarfieldPhoneItem.asset");
			if ((Object)(object)val3 == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get GarfieldPhone from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Got GarfieldPhone prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Utilities.FixMixerGroups(val3.spawnPrefab);
			Items.RegisterShopItem(val3, configGarfieldPhoneStorePrice.Value);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ProjectSCP.SCP3166 v1.0.0 has loaded!");
		}

		public Dictionary<LevelTypes, int> GetLevelRarities(string levelsString)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
				if (levelsString != null && levelsString != "")
				{
					string[] array = levelsString.Split(',');
					string[] array2 = array;
					foreach (string text in array2)
					{
						string[] array3 = text.Split(':');
						if (array3.Length == 2)
						{
							string text2 = array3[0].Trim();
							string text3 = array3[1].Trim();
							if (Enum.TryParse<LevelTypes>(text2, out LevelTypes result) && int.TryParse(text3, out var result2))
							{
								dictionary.Add(result, result2);
							}
							else
							{
								LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
							}
						}
					}
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
				return null;
			}
		}

		public Dictionary<string, int> GetCustomLevelRarities(string levelsString)
		{
			try
			{
				Dictionary<string, int> dictionary = new Dictionary<string, int>();
				if (levelsString != null)
				{
					string[] array = levelsString.Split(',');
					string[] array2 = array;
					foreach (string text in array2)
					{
						string[] array3 = text.Split(':');
						if (array3.Length == 2)
						{
							string text2 = array3[0].Trim();
							string text3 = array3[1].Trim();
							if (int.TryParse(text3, out var result))
							{
								dictionary.Add(text2, result);
							}
							else
							{
								LoggerInstance.LogError((object)("Error: Invalid level rarity: " + text2 + ":" + text3));
							}
						}
					}
				}
				return dictionary;
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)$"Error: {arg}");
				return null;
			}
		}

		public static void FreezePlayer(PlayerControllerB player, bool value)
		{
			player.disableInteract = value;
			player.disableLookInput = value;
			player.disableMoveInput = value;
		}

		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);
					}
				}
			}
			LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	internal class SCP3166AI : EnemyAI
	{
		public enum State
		{
			Roaming,
			Following,
			Hunger,
			Rage
		}

		private static ManualLogSource logger = Plugin.LoggerInstance;

		public static SCP3166AI? Instance;

		public NetworkAnimator networkAnimator;

		public Transform turnCompass;

		public GameObject LasagnaPrefab;

		public InteractTrigger LasagnaTrigger;

		public Transform EatingPlayerTransform;

		public AudioClip EatingPlayerSFX;

		public AudioClip EatingLasagnaSFX;

		public AudioClip[] FootstepSFX;

		public AudioClip[] FoundPlayerSFX;

		public AudioClip[] DemandLasagnaSFX;

		public AudioClip[] HalfHungerSFX;

		public AudioClip[] SmellsLasagnaSFX;

		public AudioClip[] FollowingChatterSFX;

		public AudioClip[] RageChatterSFX;

		public AudioClip[] StartRageSFX;

		public AudioClip[] PostEatingLasagnaSFX;

		public AudioClip[] PostEatingPlayerSFX;

		public AudioClip[] HurtByPlayerSFX;

		public AudioClip[] ShotByPlayerSFX;

		private int gorefieldDamage;

		public Dictionary<string, AudioClip[]> VoiceLines = new Dictionary<string, AudioClip[]>();

		private float timeSinceEatingLasagna;

		private float timeSinceDemandLasagna;

		private float timeSinceDamagePlayer;

		private float timeSinceFollowPlayer;

		private float timeSinceChatter;

		private float nextChatterTime = 10f;

		private float currentHungerMultiplier = 1f;

		private float hungerMultiplier = 1f;

		private float lasagnaHeldHungerMultiplier = 1.5f;

		private bool playedHalfHungerSFX;

		private bool targetPlayerHasLasagna;

		private bool reachedPlayerWithLasagna;

		private float halfwayToRageTime;

		private float demandLasagnaCooldown;

		private Coroutine? roamCoroutine;

		private Vector3 mainEntrancePosition;

		private Vector3 mainEntranceOutsidePosition;

		private int hashRunSpeed;

		private const float sniffDistance = 7f;

		private const float followDistance = 5f;

		private const int demandLasagnaAmount = 5;

		private const float idleTime = 1f;

		private const float minFollowChatterTime = 30f;

		private const float maxFollowChatterTime = 60f;

		private const float minChaseChatterTime = 10f;

		private const float maxChaseChatterTime = 20f;

		private int startingLasagna = 5;

		private float hungerPhaseCooldown = 60f;

		private float hungerRagePhaseCooldown = 120f;

		private float distanceToLoseGorefield = 20f;

		private float distanceToLoseHungryGorefield = 5000f;

		private float startingSize = 1f;

		private float maxSize = 2f;

		private float sizeIncreasePerLasagna = 0.1f;

		private int startDamage = 20;

		private int damageIncreasePerLasagna = 8;

		private float timeToEat = 10f;

		private float followPlayerCooldown = 10f;

		private float hungerMultiplierIncreasePerLasagna = 0.05f;

		private bool IsSearching => base.currentSearch != null && base.currentSearch.inProgress;

		public float Size
		{
			get
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				return ((Component)this).transform.localScale.y;
			}
			private set
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).transform.localScale = new Vector3(value, value, value);
			}
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				if (Plugin.IsServerOrHost)
				{
					logger.LogDebug((object)"There is already a Gorefield in the scene. Removing this one.");
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
					logger.LogDebug((object)"Despawned");
				}
			}
			else
			{
				Instance = this;
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		public override void Start()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			base.overlapColliders = (Collider[])(object)new Collider[1];
			base.thisNetworkObject = ((NetworkBehaviour)this).NetworkObject;
			base.thisEnemyIndex = RoundManager.Instance.numberOfEnemiesInScene;
			RoundManager instance = RoundManager.Instance;
			instance.numberOfEnemiesInScene++;
			base.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			if (!((NetworkBehaviour)this).IsServer)
			{
				RoundManager.Instance.SpawnedEnemies.Add((EnemyAI)(object)this);
			}
			base.path1 = new NavMeshPath();
			base.openDoorSpeedMultiplier = base.enemyType.doorSpeedMultiplier;
			base.serverPosition = ((Component)this).transform.position;
			base.ventAnimationFinished = true;
			startingLasagna = Plugin.configStartingLasagna.Value;
			startingLasagna = Plugin.configStartingLasagna.Value;
			hungerPhaseCooldown = Plugin.configHungerPhaseCooldown.Value;
			hungerRagePhaseCooldown = Plugin.configHungerRagePhaseTime.Value;
			distanceToLoseGorefield = Plugin.configDistanceToLoseGorefield.Value;
			distanceToLoseHungryGorefield = Plugin.configDistanceToLoseHungryGorefield.Value;
			startingSize = Plugin.configStartingSize.Value;
			maxSize = Plugin.configMaxSize.Value;
			sizeIncreasePerLasagna = Plugin.configSizeIncreasePerLasagna.Value;
			startDamage = Plugin.configStartDamage.Value;
			damageIncreasePerLasagna = Plugin.configDamageIncreasePerLasagna.Value;
			timeToEat = Plugin.configTimeToEat.Value;
			followPlayerCooldown = Plugin.configFollowPlayerCooldown.Value;
			hungerMultiplierIncreasePerLasagna = Plugin.configHungerMultiplierIncreasePerLasagna.Value;
			try
			{
				mainEntrancePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, false), default(NavMeshHit), 5f, -1);
				mainEntranceOutsidePosition = RoundManager.Instance.GetNavMeshPosition(RoundManager.FindMainEntrancePosition(true, true), default(NavMeshHit), 5f, -1);
			}
			catch
			{
				logger.LogError((object)"Couldnt find entrance positions");
			}
			base.currentBehaviourStateIndex = 0;
			hashRunSpeed = Animator.StringToHash("runSpeed");
			halfwayToRageTime = hungerPhaseCooldown + hungerRagePhaseCooldown / 2f;
			logger.LogDebug((object)("halfwayToRageTime: " + halfwayToRageTime));
			demandLasagnaCooldown = hungerRagePhaseCooldown / 5f;
			logger.LogDebug((object)("demandLasagnaCooldown: " + demandLasagnaCooldown));
			Size = startingSize;
			gorefieldDamage = startDamage;
			VoiceLines.Add("FoundPlayerSFX", FoundPlayerSFX);
			VoiceLines.Add("DemandLasagnaSFX", DemandLasagnaSFX);
			VoiceLines.Add("HalfHungerSFX", HalfHungerSFX);
			VoiceLines.Add("SmellsLasagnaSFX", SmellsLasagnaSFX);
			VoiceLines.Add("FollowingChatterSFX", FollowingChatterSFX);
			VoiceLines.Add("RageChatterSFX", RageChatterSFX);
			VoiceLines.Add("StartRageSFX", StartRageSFX);
			VoiceLines.Add("PostEatingLasagnaSFX", PostEatingLasagnaSFX);
			VoiceLines.Add("PostEatingPlayerSFX", PostEatingPlayerSFX);
			VoiceLines.Add("HurtByPlayerSFX", HurtByPlayerSFX);
			VoiceLines.Add("ShotByPlayerSFX", ShotByPlayerSFX);
			if (Plugin.IsServerOrHost)
			{
				SpawnLasagna(startingLasagna);
				RoamStart();
			}
		}

		public override void Update()
		{
			if (StartOfRound.Instance.allPlayersDead || base.inSpecialAnimation)
			{
				return;
			}
			timeSinceDamagePlayer += Time.deltaTime;
			timeSinceFollowPlayer += Time.deltaTime;
			timeSinceChatter += Time.deltaTime;
			timeSinceEatingLasagna += Time.deltaTime * currentHungerMultiplier;
			timeSinceDemandLasagna += Time.deltaTime * currentHungerMultiplier;
			if (Plugin.IsServerOrHost)
			{
				if (base.updateDestinationInterval >= 0f)
				{
					base.updateDestinationInterval -= Time.deltaTime;
				}
				else
				{
					((EnemyAI)this).DoAIInterval();
					base.updateDestinationInterval = base.AIIntervalTime + Random.Range(-0.015f, 0.015f);
				}
			}
			if (PlayerHasLasagna(Plugin.localPlayer, checkIfHolding: true))
			{
				LasagnaTrigger.interactable = true;
			}
			else
			{
				LasagnaTrigger.interactable = false;
			}
		}

		public void LateUpdate()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Animator creatureAnimator = base.creatureAnimator;
			int num = hashRunSpeed;
			Vector3 velocity = base.agent.velocity;
			creatureAnimator.SetFloat(num, ((Vector3)(ref velocity)).magnitude / 2f);
		}

		public override void DoAIInterval()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: 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_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				base.agent.speed = 5f;
				base.agent.stoppingDistance = 0f;
				if (base.isOutside && ((EnemyAI)this).SetDestinationToPosition(mainEntranceOutsidePosition, true))
				{
					RoamStop();
					if (Vector3.Distance(((Component)this).transform.position, mainEntranceOutsidePosition) < 1f)
					{
						Teleport(mainEntrancePosition, outside: false);
					}
					break;
				}
				RoamStart();
				if (timeSinceFollowPlayer > followPlayerCooldown && TargetClosestPlayer(distanceToLoseGorefield, requireLineOfSight: true))
				{
					SwitchToBehaviourClientRpc(1);
				}
				else if (timeSinceEatingLasagna > hungerPhaseCooldown)
				{
					SwitchToBehaviourClientRpc(2);
				}
				break;
			case 1:
				base.agent.speed = 5f;
				base.agent.stoppingDistance = 5f;
				RoamStop();
				if (timeSinceEatingLasagna > hungerPhaseCooldown)
				{
					SwitchToBehaviourClientRpc(2);
					break;
				}
				if (!TargetClosestPlayer(distanceToLoseGorefield))
				{
					logger.LogDebug((object)"Following: Lost target player...");
					base.targetPlayer = null;
					timeSinceFollowPlayer = 0f;
					SwitchToBehaviourClientRpc(0);
					break;
				}
				if (targetPlayerHasLasagna && !reachedPlayerWithLasagna && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 7f)
				{
					reachedPlayerWithLasagna = true;
					networkAnimator.SetTrigger("smell");
					PlayClip("SmellsLasagnaSFX");
					break;
				}
				if (timeSinceChatter > nextChatterTime)
				{
					timeSinceChatter = 0f;
					nextChatterTime = Random.Range(30f, 60f);
					PlayClip("FollowingChatterSFX");
				}
				((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				break;
			case 2:
				base.agent.speed = 6f;
				base.agent.stoppingDistance = 5f;
				if (timeSinceEatingLasagna > hungerRagePhaseCooldown + hungerPhaseCooldown)
				{
					SwitchToBehaviourClientRpc(3);
				}
				else if ((Object)(object)base.targetPlayer != (Object)null)
				{
					if (!TargetClosestPlayer(distanceToLoseHungryGorefield))
					{
						logger.LogDebug((object)"Hunger: Lost target player...");
						base.targetPlayer = null;
						timeSinceFollowPlayer = 0f;
						break;
					}
					RoamStop();
					if (targetPlayerHasLasagna && !reachedPlayerWithLasagna && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < 7f)
					{
						reachedPlayerWithLasagna = true;
						networkAnimator.SetTrigger("smell");
						PlayClip("SmellsLasagnaSFX");
						break;
					}
					if (timeSinceEatingLasagna > halfwayToRageTime && !playedHalfHungerSFX)
					{
						playedHalfHungerSFX = true;
						timeSinceDemandLasagna = 0f;
						PlayClip("HalfHungerSFX");
					}
					if (timeSinceDemandLasagna > demandLasagnaCooldown)
					{
						timeSinceDemandLasagna = 0f;
						PlayClip("DemandLasagnaSFX");
					}
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				else if (!TargetClosestPlayer(distanceToLoseHungryGorefield, requireLineOfSight: true))
				{
					RoamStart();
				}
				break;
			case 3:
				base.agent.speed = 10f;
				base.agent.stoppingDistance = 0f;
				RoamStop();
				if (CheckForDeadBodies(3f))
				{
					break;
				}
				TargetClosestPlayerInAnyCase();
				if (!((Object)(object)base.targetPlayer != (Object)null))
				{
					break;
				}
				if (timeSinceChatter > nextChatterTime)
				{
					timeSinceChatter = 0f;
					nextChatterTime = Random.Range(10f, 20f);
					PlayClip("RageChatterSFX");
				}
				if (!base.targetPlayer.isInsideFactory && !base.isOutside && ((EnemyAI)this).SetDestinationToPosition(mainEntrancePosition, true))
				{
					if (Vector3.Distance(((Component)this).transform.position, mainEntrancePosition) < 1f)
					{
						Teleport(mainEntranceOutsidePosition, outside: true);
					}
				}
				else if (base.targetPlayer.isInsideFactory && base.isOutside && ((EnemyAI)this).SetDestinationToPosition(mainEntranceOutsidePosition, true))
				{
					if (Vector3.Distance(((Component)this).transform.position, mainEntranceOutsidePosition) < 1f)
					{
						Teleport(mainEntrancePosition, outside: false);
					}
				}
				else
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
				}
				break;
			default:
				logger.LogWarning((object)("Invalid state: " + base.currentBehaviourStateIndex));
				break;
			}
		}

		public bool CheckForDeadBodies(float range)
		{
			//IL_003a: 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)
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerDead && !((Object)(object)val.deadBody == (Object)null) && !(Vector3.Distance(((Component)this).transform.position, ((Component)val.deadBody).transform.position) > range))
				{
					base.inSpecialAnimation = true;
					EatPlayerClientRpc(val.actualClientId);
					return true;
				}
			}
			return false;
		}

		public void Teleport(Vector3 position, bool outside)
		{
			//IL_0017: 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)
			logger.LogDebug((object)"Teleporting");
			base.agent.Warp(position);
			((Component)this).transform.position = position;
			SetOutsideClientRpc(outside);
		}

		private void RoamStart()
		{
			if (roamCoroutine == null)
			{
				roamCoroutine = ((MonoBehaviour)this).StartCoroutine(RoamCoroutine());
			}
		}

		private void RoamStop()
		{
			if (roamCoroutine != null)
			{
				((MonoBehaviour)this).StopAllCoroutines();
				roamCoroutine = null;
			}
		}

		private IEnumerator RoamCoroutine()
		{
			yield return null;
			while (roamCoroutine != null && ((Behaviour)base.agent).enabled)
			{
				float timeStopped = 0f;
				base.targetNode = GetRandomAINode(base.allAINodes.ToList()).transform;
				if ((Object)(object)base.targetNode == (Object)null)
				{
					continue;
				}
				Vector3 position = ((Component)base.targetNode).transform.position;
				if (!((EnemyAI)this).SetDestinationToPosition(position, false))
				{
					continue;
				}
				while (((Behaviour)base.agent).enabled)
				{
					yield return (object)new WaitForSeconds(base.AIIntervalTime);
					if (timeStopped > 1f)
					{
						break;
					}
					if (base.agent.velocity == Vector3.zero)
					{
						timeStopped += base.AIIntervalTime;
					}
				}
			}
		}

		public void SpawnLasagna(int amount = 1)
		{
			//IL_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < amount; i++)
			{
				Vector3 position = GetRandomAINode(base.allAINodes.ToList()).transform.position;
				PhysicsProp component = Object.Instantiate<GameObject>(LasagnaPrefab, position, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform).GetComponent<PhysicsProp>();
				((NetworkBehaviour)component).NetworkObject.Spawn(true);
				SetLasagnaScrapValueClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component).NetworkObject), Random.Range(Plugin.configLasagnaMinValue.Value, Plugin.configLasagnaMaxValue.Value + 1));
			}
		}

		private GameObject GetRandomAINode(List<GameObject> nodes)
		{
			int index = Random.Range(0, nodes.Count);
			return nodes[index];
		}

		public bool TargetClosestPlayer(float mostOptimalDistance, bool requireLineOfSight = false, float viewWidth = 70f)
		{
			//IL_0046: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			base.targetPlayer = null;
			targetPlayerHasLasagna = false;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (((EnemyAI)this).PlayerIsTargetable(val, false, false) && PlayerHasLasagna(val))
				{
					base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
					if (base.tempDist < mostOptimalDistance)
					{
						mostOptimalDistance = base.tempDist;
						base.targetPlayer = val;
						targetPlayerHasLasagna = true;
					}
				}
			}
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val2 in allPlayerScripts2)
				{
					if (((EnemyAI)this).PlayerIsTargetable(val2, false, false) && (!requireLineOfSight || ((EnemyAI)this).CheckLineOfSightForPosition(((Component)val2.gameplayCamera).transform.position, viewWidth, 40, -1f, (Transform)null)))
					{
						base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
						if (base.tempDist < mostOptimalDistance)
						{
							mostOptimalDistance = base.tempDist;
							base.targetPlayer = val2;
						}
					}
				}
			}
			if (targetPlayerHasLasagna && currentHungerMultiplier != lasagnaHeldHungerMultiplier)
			{
				currentHungerMultiplier = lasagnaHeldHungerMultiplier;
				SetHungerMultiplierClientRpc(lasagnaHeldHungerMultiplier);
			}
			else if (!targetPlayerHasLasagna && currentHungerMultiplier != hungerMultiplier)
			{
				currentHungerMultiplier = hungerMultiplier;
				reachedPlayerWithLasagna = false;
				SetHungerMultiplierClientRpc(hungerMultiplier);
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private bool TargetClosestPlayerInAnyCase()
		{
			//IL_0050: 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)
			base.mostOptimalDistance = float.PositiveInfinity;
			base.targetPlayer = null;
			if ((Object)(object)base.targetPlayer == (Object)null)
			{
				PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
				foreach (PlayerControllerB val in allPlayerScripts)
				{
					if (((EnemyAI)this).PlayerIsTargetable(val, false, true))
					{
						base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position);
						if (base.tempDist < base.mostOptimalDistance)
						{
							base.mostOptimalDistance = base.tempDist;
							base.targetPlayer = val;
						}
					}
				}
			}
			return (Object)(object)base.targetPlayer != (Object)null;
		}

		private bool PlayerHasLasagna(PlayerControllerB player, bool checkIfHolding = false)
		{
			if ((Object)(object)player.currentlyHeldObjectServer != (Object)null && ((Object)player.currentlyHeldObjectServer.itemProperties).name == "LasagnaItem")
			{
				return true;
			}
			if (checkIfHolding)
			{
				return false;
			}
			foreach (GrabbableObject item in player.ItemSlots.ToList())
			{
				if ((Object)(object)item != (Object)null && ((Object)item.itemProperties).name == "LasagnaItem")
				{
					return true;
				}
			}
			return false;
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			//IL_00ad: 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)
			((EnemyAI)this).OnCollideWithPlayer(other);
			PlayerControllerB val = default(PlayerControllerB);
			if (!base.inSpecialAnimation && base.currentBehaviourStateIndex == 3 && ((Component)other).gameObject.TryGetComponent<PlayerControllerB>(ref val) && !((Object)(object)val == (Object)null) && !(timeSinceDamagePlayer <= 1f) && !((Object)(object)Plugin.localPlayer != (Object)(object)val))
			{
				timeSinceDamagePlayer = 0f;
				AttackPlayerServerRpc(Plugin.localPlayer.actualClientId);
				val.DamagePlayer(gorefieldDamage, true, true, (CauseOfDeath)6, 0, false, default(Vector3));
			}
		}

		private IEnumerator EatPlayerCoroutine(PlayerControllerB player, float eatTime)
		{
			logger.LogDebug((object)$"Eating player for {eatTime} seconds");
			yield return null;
			base.inSpecialAnimation = true;
			DeadBodyInfo body = player.deadBody;
			body.attachedTo = EatingPlayerTransform;
			body.attachedLimb = body.bodyParts[5];
			body.matchPositionExactly = true;
			base.creatureVoice.Stop();
			base.creatureVoice.clip = EatingPlayerSFX;
			base.creatureVoice.loop = true;
			base.creatureVoice.Play();
			base.creatureAnimator.SetBool("eating", true);
			yield return (object)new WaitForSeconds(eatTime);
			body.attachedTo = null;
			body.attachedLimb = null;
			body.matchPositionExactly = false;
			body.DeactivateBody(false);
			base.creatureAnimator.SetBool("eating", false);
			base.creatureVoice.Stop();
			base.creatureVoice.loop = false;
			base.inSpecialAnimation = false;
			base.targetPlayer = null;
			timeSinceEatingLasagna = 0f;
			playedHalfHungerSFX = false;
			if (Size + sizeIncreasePerLasagna <= maxSize)
			{
				Size += sizeIncreasePerLasagna;
				gorefieldDamage += damageIncreasePerLasagna;
			}
			timeSinceChatter = 0f;
			if (Plugin.IsServerOrHost)
			{
				PlayClip("PostEatingPlayerSFX");
			}
			SwitchToBehaviourStateOnLocalClient(0);
		}

		private IEnumerator EatLasagnaCoroutine(float eatTime)
		{
			logger.LogDebug((object)$"Eating lasagna for {eatTime} seconds");
			yield return null;
			base.inSpecialAnimation = true;
			base.creatureVoice.Stop();
			base.creatureVoice.clip = EatingLasagnaSFX;
			base.creatureVoice.loop = true;
			base.creatureVoice.Play();
			base.creatureAnimator.SetBool("eating", true);
			yield return (object)new WaitForSeconds(eatTime);
			base.creatureAnimator.SetBool("eating", false);
			base.creatureVoice.Stop();
			base.creatureVoice.loop = false;
			base.inSpecialAnimation = false;
			base.targetPlayer = null;
			timeSinceEatingLasagna = 0f;
			playedHalfHungerSFX = false;
			if (Size + sizeIncreasePerLasagna <= maxSize || maxSize == -1f)
			{
				Size += sizeIncreasePerLasagna;
				gorefieldDamage += damageIncreasePerLasagna;
			}
			timeSinceChatter = 0f;
			if (Plugin.IsServerOrHost)
			{
				PlayClip("PostEatingLasagnaSFX");
			}
			SwitchToBehaviourStateOnLocalClient(0);
			if (Plugin.IsServerOrHost)
			{
				SpawnLasagna();
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB? playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			timeSinceChatter = 0f;
			logger.LogDebug((object)"HitEnemy()");
			if (hitID == -1)
			{
				logger.LogDebug((object)"Attempting to play clip: ShotByPlayerSFX");
				PlayClip("ShotByPlayerSFX");
			}
			else
			{
				logger.LogDebug((object)"Attempting to play clip: HurtByPlayerSFX");
				PlayClip("HurtByPlayerSFX");
			}
		}

		public void FeedLasagna()
		{
			if (!base.inSpecialAnimation)
			{
				logger.LogDebug((object)"Feeding Lasagna");
				Plugin.localPlayer.DespawnHeldObject();
				base.inSpecialAnimation = true;
				FeedLasagnaServerRpc();
			}
		}

		public void PlayFootstepSFX()
		{
			RoundManager.PlayRandomClip(base.creatureSFX, FootstepSFX, true, 1f, 0, 1000);
		}

		public void FinishAttackAnimation()
		{
		}

		public void SetInSpecialAnimation()
		{
			logger.LogDebug((object)"SetInSpecialAnimation");
			base.inSpecialAnimation = true;
		}

		public void UnsetInSpecialAnimation()
		{
			logger.LogDebug((object)"UnsetInSpecialAnimation");
			base.inSpecialAnimation = false;
		}

		public void SwitchToBehaviourStateOnLocalClient(int stateIndex)
		{
			if (base.currentBehaviourStateIndex != stateIndex)
			{
				ManualLogSource obj = logger;
				State state = (State)stateIndex;
				obj.LogDebug((object)("Switching behavior to: " + state));
				base.previousBehaviourStateIndex = base.currentBehaviourStateIndex;
				base.currentBehaviourStateIndex = stateIndex;
				base.currentBehaviourState = base.enemyBehaviourStates[stateIndex];
				timeSinceChatter = 0f;
				timeSinceDemandLasagna = 0f;
				playedHalfHungerSFX = false;
				reachedPlayerWithLasagna = false;
				switch (stateIndex)
				{
				case 0:
					timeSinceFollowPlayer = 0f;
					base.creatureAnimator.SetBool("rage", false);
					break;
				case 1:
					PlayClip("FoundPlayerSFX");
					break;
				case 2:
					PlayClip("DemandLasagnaSFX");
					break;
				case 3:
					PlayClip("StartRageSFX");
					base.creatureAnimator.SetBool("rage", true);
					break;
				}
			}
		}

		public void PlayClip(string clipName)
		{
			logger.LogDebug((object)"In PlayClip()");
			AudioClip[] array = VoiceLines[clipName];
			float num = Random.Range(0.9f, 1.1f);
			int num2 = Random.Range(0, array.Length);
			logger.LogDebug((object)$"Running PlayClipClientRpc({clipName}, {num2}, {num})");
			PlayClipServerRpc(clipName, num2, num);
		}

		[ClientRpc]
		public void EatPlayerClientRpc(ulong clientId)
		{
			//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)
			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(646144598u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 646144598u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayerControllerB player = Plugin.PlayerFromId(clientId);
					((MonoBehaviour)this).StartCoroutine(EatPlayerCoroutine(player, timeToEat));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AttackPlayerServerRpc(ulong clientId)
		{
			//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)
			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(1265526476u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1265526476u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost)
				{
					networkAnimator.SetTrigger("attack");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlayClipServerRpc(string clipName, int index, float pitch)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1529781u, val, (RpcDelivery)0);
				bool flag = clipName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false);
				}
				BytePacker.WriteValueBitPacked(val2, index);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1529781u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost)
			{
				PlayClipClientRpc(clipName, index, pitch);
			}
		}

		[ClientRpc]
		public void PlayClipClientRpc(string clipName, int index, float pitch)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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)
			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(764069451u, val, (RpcDelivery)0);
				bool flag = clipName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(clipName, false);
				}
				BytePacker.WriteValueBitPacked(val2, index);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 764069451u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				logger.LogDebug((object)"In PlayClipClientRpc()");
				logger.LogDebug((object)("Playing clip " + clipName));
				base.creatureVoice.Stop();
				AudioClip[] array = VoiceLines[clipName];
				base.creatureVoice.pitch = pitch;
				base.creatureVoice.clip = array[index];
				base.creatureVoice.Play();
				WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, array[index], 0.85f);
			}
		}

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

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

		[ServerRpc(RequireOwnership = false)]
		public void FeedLasagnaServerRpc()
		{
			//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(3528172920u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3528172920u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost)
				{
					hungerMultiplier += hungerMultiplierIncreasePerLasagna;
					lasagnaHeldHungerMultiplier += hungerMultiplierIncreasePerLasagna;
					FeedLasagnaClientRpc();
				}
			}
		}

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

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

		[ClientRpc]
		public void SetLasagnaScrapValueClientRpc(NetworkObjectReference netRef, int value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			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(1304089431u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, value);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1304089431u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject val3 = default(NetworkObject);
				if (!((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null))
				{
					logger.LogError((object)"Couldnt get netObj for lasagna in SetLasagnaScrapValueClientRpc");
					return;
				}
				PhysicsProp component = ((Component)val3).GetComponent<PhysicsProp>();
				((GrabbableObject)component).SetScrapValue(value);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SCP3166AI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(646144598u, new RpcReceiveHandler(__rpc_handler_646144598));
			NetworkManager.__rpc_func_table.Add(1265526476u, new RpcReceiveHandler(__rpc_handler_1265526476));
			NetworkManager.__rpc_func_table.Add(1529781u, new RpcReceiveHandler(__rpc_handler_1529781));
			NetworkManager.__rpc_func_table.Add(764069451u, new RpcReceiveHandler(__rpc_handler_764069451));
			NetworkManager.__rpc_func_table.Add(2579341352u, new RpcReceiveHandler(__rpc_handler_2579341352));
			NetworkManager.__rpc_func_table.Add(1562468122u, new RpcReceiveHandler(__rpc_handler_1562468122));
			NetworkManager.__rpc_func_table.Add(3528172920u, new RpcReceiveHandler(__rpc_handler_3528172920));
			NetworkManager.__rpc_func_table.Add(3200112956u, new RpcReceiveHandler(__rpc_handler_3200112956));
			NetworkManager.__rpc_func_table.Add(3967995770u, new RpcReceiveHandler(__rpc_handler_3967995770));
			NetworkManager.__rpc_func_table.Add(1304089431u, new RpcReceiveHandler(__rpc_handler_1304089431));
		}

		private static void __rpc_handler_646144598(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP3166AI)(object)target).EatPlayerClientRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1265526476(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)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP3166AI)(object)target).AttackPlayerServerRpc(clientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1529781(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_00ab: 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 clipName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref clipName, false);
				}
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				float pitch = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SCP3166AI)(object)target).PlayClipServerRpc(clipName, index, pitch);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_764069451(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_00ab: 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 clipName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref clipName, false);
				}
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				float pitch = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP3166AI)(object)target).PlayClipClientRpc(clipName, index, pitch);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2579341352(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 stateIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref stateIndex);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP3166AI)(object)target).SwitchToBehaviourClientRpc(stateIndex);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_3528172920(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;
				((SCP3166AI)(object)target).FeedLasagnaServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3200112956(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;
				((SCP3166AI)(object)target).FeedLasagnaClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_1304089431(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_003e: 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_005c: 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)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SCP3166AI)(object)target).SetLasagnaScrapValueClientRpc(netRef, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "SCP3166AI";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ProjectSCP.SCP3166";

		public const string PLUGIN_NAME = "SCP3166";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ProjectSCP.SCP3166.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}