Decompiled source of MOGBETORNiAModdd v1.0.0

BepInEx/plugins/PlayerAvatarLoader.dll

Decompiled 11 months ago
using System;
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.Xml;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("PlayerAvatarLoader")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PlayerAvatarLoader")]
[assembly: AssemblyTitle("PlayerAvatarLoader")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PlayerAvatarLoader
{
	public class BodyReplacement : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			PlayerControllerB component = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			ulong playerSteamId = component.playerSteamId;
			string playerUsername = component.playerUsername;
			int currentSuitID = component.currentSuitID;
			string text = StartOfRound.Instance.unlockablesList.unlockables[currentSuitID].unlockableName;
			if (text == "Default")
			{
				Debug.LogWarning((object)"Detected An Attempt To Load Suit 'Default'. This Is Likely Because MoreSuits Is Installed. Falling Back To 'Orange suit'.");
				text = "Orange suit";
			}
			Debug.LogWarning((object)("Attempting To Load '" + text + "' For " + playerUsername + "(" + playerSteamId + ")"));
			if (Assets.loadedBundleIds.FirstOrDefault((string stringToCheck) => stringToCheck.Contains(playerSteamId.ToString())) != null)
			{
				Debug.LogWarning((object)("Found Previously Loaded Bundle For " + playerUsername + "(" + playerSteamId + ")"));
				int index = Assets.loadedBundleIds.FindIndex((string x) => x.Contains(playerSteamId.ToString()));
				GameObject val = Assets.loadedAssetBundles[index].LoadAsset<GameObject>(text);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
				Debug.LogError((object)("No '" + text + "' Model Found For " + playerSteamId + "!!! Falling Back To Default"));
				val = Assets.initAssetBundle.LoadAsset<GameObject>(text);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogError((object)("No '" + text + "' Model Found Inside Default Bundle!!! Falling Back To 'Orange suit'"));
					return Assets.initAssetBundle.LoadAsset<GameObject>("Orange suit");
				}
				return val;
			}
			Debug.LogWarning((object)("Bundle Not Yet Loaded For " + playerUsername + "(" + playerSteamId + "). Attempting To Load New Bundle..."));
			AssetBundle val2 = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Avatars", playerSteamId.ToString()));
			if ((Object)(object)val2 != (Object)null)
			{
				Assets.PopulateAssets(check: true, playerSteamId.ToString(), val2);
				GameObject val3 = val2.LoadAsset<GameObject>(text);
				if ((Object)(object)val3 != (Object)null)
				{
					return val3;
				}
				Debug.LogError((object)("No '" + text + "' Model Found For " + playerSteamId + "!!! Falling Back To Default"));
				return Assets.initAssetBundle.LoadAsset<GameObject>(text);
			}
			Debug.LogError((object)(playerUsername + "(" + playerSteamId + ") Does Not Have A Bundle!!! Falling Back To Default."));
			return Assets.initAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnEmoteStart(int emoteId)
		{
			PlayerControllerB component = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			ulong playerSteamId = component.playerSteamId;
			string playerUsername = component.playerUsername;
			int currentSuitID = component.currentSuitID;
			string text = StartOfRound.Instance.unlockablesList.unlockables[currentSuitID].unlockableName;
			if (text == "Default")
			{
				text = "Orange suit";
			}
			string path = playerSteamId + ".xml";
			if (!File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Avatars", path)))
			{
				return;
			}
			Debug.LogWarning((object)("Blend Shapes Found For " + playerUsername + "(" + playerSteamId + "). Checking Settings For '" + text + "'..."));
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Avatars", path));
			string text2 = string.Concat(text.Where((char c) => !char.IsWhiteSpace(c)));
			XmlNode xmlNode = xmlDocument.SelectSingleNode("/root/" + text2);
			if (xmlNode == null)
			{
				return;
			}
			XmlNode xmlNode2 = xmlDocument.SelectSingleNode("/root/" + text2 + "/BlendShapes");
			if (xmlNode2 != null)
			{
				bool flag = false;
				int num = 1;
				while (!flag)
				{
					XmlNode xmlNode3 = xmlDocument.SelectSingleNode("/root/" + text2 + "/BlendShapes/Default/Blend" + num);
					if (xmlNode3 != null)
					{
						string[] array = xmlNode3.InnerText.Split("%/");
						base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(int.Parse(array[0]), float.Parse(array[1]));
						num++;
					}
					else
					{
						flag = true;
					}
				}
				if (emoteId == 1)
				{
					bool flag2 = false;
					int num2 = 1;
					while (!flag2)
					{
						XmlNode xmlNode4 = xmlDocument.SelectSingleNode("/root/" + text2 + "/BlendShapes/Emote1/Blend" + num2);
						if (xmlNode4 != null)
						{
							string[] array2 = xmlNode4.InnerText.Split("%/");
							base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(int.Parse(array2[0]), float.Parse(array2[1]));
							num2++;
						}
						else
						{
							flag2 = true;
						}
					}
				}
				if (emoteId != 2)
				{
					return;
				}
				bool flag3 = false;
				int num3 = 1;
				while (!flag3)
				{
					XmlNode xmlNode5 = xmlDocument.SelectSingleNode("/root/" + text2 + "/BlendShapes/Emote2/Blend" + num3);
					if (xmlNode5 != null)
					{
						string[] array3 = xmlNode5.InnerText.Split("%/");
						base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(int.Parse(array3[0]), float.Parse(array3[1]));
						num3++;
					}
					else
					{
						flag3 = true;
					}
				}
			}
			else
			{
				Debug.LogWarning((object)("No BlendShapes Found For '" + text + "'"));
			}
		}

		protected override void OnEmoteEnd()
		{
			PlayerControllerB component = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
			ulong playerSteamId = component.playerSteamId;
			string playerUsername = component.playerUsername;
			int currentSuitID = component.currentSuitID;
			string text = StartOfRound.Instance.unlockablesList.unlockables[currentSuitID].unlockableName;
			if (text == "Default")
			{
				text = "Orange suit";
			}
			string path = playerSteamId + ".xml";
			if (!File.Exists(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Avatars", path)))
			{
				return;
			}
			XmlDocument xmlDocument = new XmlDocument();
			xmlDocument.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Avatars", path));
			string text2 = string.Concat(text.Where((char c) => !char.IsWhiteSpace(c)));
			XmlNode xmlNode = xmlDocument.SelectSingleNode("/root/" + text2);
			if (xmlNode == null)
			{
				return;
			}
			XmlNodeList xmlNodeList = xmlDocument.SelectNodes("/root/" + text2 + "/BlendShapes");
			if (xmlNodeList == null)
			{
				return;
			}
			bool flag = false;
			int num = 1;
			while (!flag)
			{
				XmlNode xmlNode2 = xmlDocument.SelectSingleNode("/root/" + text2 + "/BlendShapes/Default/Blend" + num);
				if (xmlNode2 != null)
				{
					string[] array = xmlNode2.InnerText.Split("%/");
					base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>().SetBlendShapeWeight(int.Parse(array[0]), float.Parse(array[1]));
					num++;
				}
				else
				{
					flag = true;
				}
			}
		}
	}
	[BepInPlugin("NotAustinVT.PlayerAvatarLoader", "Player Avatar Loader", "1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerControllerB))]
		public class PlayerControllerBPatch
		{
			[HarmonyPatch("Update")]
			[HarmonyPostfix]
			public static void UpdatePatch(ref PlayerControllerB __instance)
			{
				if (__instance.playerSteamId != 0)
				{
				}
			}
		}

		public static readonly Harmony Harmony = new Harmony("NotAustinVT.PlayerAvatarLoader");

		public static ConfigEntry<string> SuitsToReg = null;

		private void Awake()
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			SuitsToReg = ((BaseUnityPlugin)this).Config.Bind<string>("Suits - ONLY EDIT FOR SUIT MOD COMPATIBILITY", "Suits", "Orange suit,Green suit,Hazard suit,Pajama suit", "Include all suits being loaded. (If using More_Suits, DO NOT INCLUDE 'Default' IN THE LIST OF SUITS TO LOAD");
			char[] separator = new char[1] { ',' };
			string[] array = SuitsToReg.Value.Split(separator);
			ModelReplacementAPI.RegisterSuitModelReplacement("Default", typeof(BodyReplacement));
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i] != "Default")
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(array[i], typeof(BodyReplacement));
				}
			}
			Assets.PopulateAssets(check: false, "if you see this you're gay", null);
			Harmony val = new Harmony("NotAustinVT.AvatarLoader");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin NotAustinVT.PlayerAvatarLoader is loaded!");
		}
	}
	public static class Assets
	{
		public static AssetBundle initAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Avatars", "default"));

		public static List<string> loadedBundleIds = new List<string>();

		public static List<AssetBundle> loadedAssetBundles = new List<AssetBundle>();

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().FullName.Split(',')[0];
		}

		public static void PopulateAssets(bool check, string playerSteamId, AssetBundle playerAssetBundle)
		{
			if (check)
			{
				loadedBundleIds.Add(playerSteamId);
				loadedAssetBundles.Add(playerAssetBundle);
			}
		}
	}
}

BepInEx/plugins/Welcome_To_Ooblterra.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen.Adapters;
using DunGen.Graph;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using Welcome_To_Ooblterra.Enemies;
using Welcome_To_Ooblterra.Patches;
using Welcome_To_Ooblterra.Properties;
using Welcome_To_Ooblterra.Things;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Welcome_To_Ooblterra")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Welcome_To_Ooblterra")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ef012de-dac8-42a5-b383-0c7886f684ae")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Welcome_To_Ooblterra
{
	internal class WTONetworkHandler : NetworkBehaviour
	{
		public static WTONetworkHandler Instance { get; private set; }

		public static event Action<string> LevelEvent;

		public override void OnNetworkSpawn()
		{
			WTONetworkHandler.LevelEvent = null;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				WTONetworkHandler instance = Instance;
				if (instance != null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
			}
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		[ClientRpc]
		public void EventClientRpc(string eventName)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1907558404u, val, (RpcDelivery)0);
				bool flag = eventName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(eventName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1907558404u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				WTONetworkHandler.LevelEvent?.Invoke(eventName);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_WTONetworkHandler()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1907558404u, new RpcReceiveHandler(__rpc_handler_1907558404));
		}

		private static void __rpc_handler_1907558404(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 eventName = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref eventName, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((WTONetworkHandler)(object)target).EventClientRpc(eventName);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "WTONetworkHandler";
		}
	}
}
namespace Welcome_To_Ooblterra.Properties
{
	internal class WTOConfig
	{
		public static ConfigEntry<bool> OoblterraEnabled;

		public static ConfigEntry<string> CustomInteriorEnabled;

		public static ConfigEntry<bool> WTOCustomSuits;

		public static ConfigEntry<string> SpawnScrapStatus;

		public static ConfigEntry<string> SpawnIndoorEnemyStatus;

		public static ConfigEntry<string> SpawnOutdoorEnemyStatus;

		public static ConfigEntry<string> SpawnAmbientEnemyStatus;

		public static ConfigEntry<string> SpawnSecurityStatus;

		private void Load()
		{
			OoblterraEnabled = WTOBase.ConfigFile.Bind<bool>("General", "Enable Ooblterra", true, "Whether or not to enable Ooblterra in the moons list and allow navigation to it. \n Default value: true \n Accepted values: true, false \n\n");
			CustomInteriorEnabled = WTOBase.ConfigFile.Bind<string>("General", "Enable Ooblterra Interior", "CustomLevelOnly", "If the custom interior map is allowed to spawn, and where. Draws over the \"Manor\" configuration.\n Default value: CustomLevelOnly \n Accepted values: Off, CustomLevelOnly, AllLevels \n The Off value will cause Ooblterra to use the \"Manor\" interior map by default. \n\n ");
			WTOCustomSuits = WTOBase.ConfigFile.Bind<bool>("Items", "Add Suits", true, "Whether or not to add WTO's custom suits. \n Default value: true \n Accepted values: true, false \n Turn off if you have other custom suit mods and are at risk of exceeding the 12 suit limit.\n\n");
			SpawnScrapStatus = WTOBase.ConfigFile.Bind<string>("Items", "Custom Scrap", "CustomLevelOnly", "If custom scrap should be allowed to spawn, and where.\n Default value: CustomLevelOnly \n Accepted values: Off, CustomLevelOnly, AllLevels \n\n");
			SpawnIndoorEnemyStatus = WTOBase.ConfigFile.Bind<string>("Enemies", "Custom Enemies (Indoors)", "CustomLevelOnly", "If custom indoor enemies should be allowed to spawn, and where.\n Default value: CustomLevelOnly \n Accepted values: Off, CustomLevelOnly, AllLevels \n\n");
			SpawnOutdoorEnemyStatus = WTOBase.ConfigFile.Bind<string>("Enemies", "Custom Enemies (Outdoor)", "CustomLevelOnly", "If custom outdoor enemies should be allowed to spawn, and where.\n Default value: CustomLevelOnly \n Accepted values: Off, CustomLevelOnly, AllLevels \n\n");
			SpawnAmbientEnemyStatus = WTOBase.ConfigFile.Bind<string>("Enemies", "Custom Enemies (Daytime)", "CustomLevelOnly", "If custom daytime enemies should be allowed to spawn, and where.\n Default value: CustomLevelOnly \n Accepted values: Off, CustomLevelOnly, AllLevels \n Daytime Enemies are ambient types that spawn before you land, such as birds, bees, and locusts. \n\n");
			SpawnSecurityStatus = WTOBase.ConfigFile.Bind<string>("Enemies", "Custom Security", "CustomLevelOnly", "If custom security objects should be allowed to spawn, and where.\n Default value: CustomLevelOnly \n Accepted values: Off, CustomLevelOnly, AllLevels \n Security objects are objects such as Landmines and Turrets that can be disabled via the terminal. \n\n");
		}
	}
	[BepInPlugin("SkullCrusher.WTO", "Welcome To Ooblterra", "0.7.5")]
	public class WTOBase : BaseUnityPlugin
	{
		public enum AllowedState
		{
			Off,
			CustomLevelOnly,
			AllLevels
		}

		public static ConfigFile ConfigFile;

		private const string modGUID = "SkullCrusher.WTO";

		private const string modName = "Welcome To Ooblterra";

		private const string modVersion = "0.7.5";

		private readonly Harmony WTOHarmony = new Harmony("SkullCrusher.WTO");

		internal ManualLogSource WTOLogSource;

		public static WTOBase Instance;

		public static AssetBundle LevelAssetBundle;

		public static AssetBundle ItemAssetBundle;

		public static AssetBundle FactoryAssetBundle;

		public static AssetBundle MonsterAssetBundle;

		public static bool DoInteractCheck;

		public static int InteractNumber;

		public static void LogToConsole(string text)
		{
			text = "=======" + text + "=======";
			Debug.Log((object)text);
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			WTOLogSource = Logger.CreateLogSource("SkullCrusher.WTO");
			WTOLogSource.LogInfo((object)"Welcome to Ooblterra! ");
			WTOHarmony.PatchAll(typeof(WTOBase));
			WTOHarmony.PatchAll(typeof(FactoryPatch));
			WTOHarmony.PatchAll(typeof(ItemPatch));
			WTOHarmony.PatchAll(typeof(MonsterPatch));
			WTOHarmony.PatchAll(typeof(MoonPatch));
			WTOHarmony.PatchAll(typeof(SuitPatch));
			WTOHarmony.PatchAll(typeof(TerminalPatch));
			bool flag = true;
			LogToConsole("BEGIN PRINTING LOADED ASSETS");
			bool flag2 = true;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "customdungeon");
			FactoryAssetBundle = AssetBundle.LoadFromFile(text);
			bool flag3 = true;
			string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "customitems");
			ItemAssetBundle = AssetBundle.LoadFromFile(text2);
			bool flag4 = true;
			string text3 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "custommoon");
			LevelAssetBundle = AssetBundle.LoadFromFile(text3);
			string text4 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "customenemies");
			MonsterAssetBundle = AssetBundle.LoadFromFile(text4);
			FactoryPatch.Start();
			ItemPatch.Start();
			MonsterPatch.Start();
			MoonPatch.Start();
			SuitPatch.Start();
			TerminalPatch.Start();
			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);
					}
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Update")]
		[HarmonyPostfix]
		public static void DebugHelper(StartOfRound __instance)
		{
			if (!((ButtonControl)Keyboard.current.f8Key).wasPressedThisFrame)
			{
			}
		}
	}
}
namespace Welcome_To_Ooblterra.Patches
{
	internal class ItemPatch
	{
		public class ItemData
		{
			private string AssetName;

			private int Rarity;

			private Item Itemref;

			public ItemData(string name, int rarity)
			{
				AssetName = "Assets/CustomItems/" + name;
				Rarity = rarity;
			}

			public string GetItemPath()
			{
				return AssetName;
			}

			public int GetRarity()
			{
				return Rarity;
			}

			public void SetItem(Item ItemToSet)
			{
				Itemref = ItemToSet;
			}

			public Item GetItem()
			{
				return Itemref;
			}
		}

		private const string ItemPath = "Assets/CustomItems/";

		private static List<SpawnableItemWithRarity> MoonScrap = new List<SpawnableItemWithRarity>();

		public static ItemData[] ItemList = new ItemData[7]
		{
			new ItemData("AlienCrate.asset", 30),
			new ItemData("FiveSixShovel.asset", 10),
			new ItemData("HandCrystal.asset", 30),
			new ItemData("OoblCorpse.asset", 5),
			new ItemData("StatueSmall.asset", 40),
			new ItemData("WandCorpse.asset", 5),
			new ItemData("WandFeed.asset", 20)
		};

		public static void Start()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			ItemData[] itemList = ItemList;
			foreach (ItemData itemData in itemList)
			{
				Item val = WTOBase.ItemAssetBundle.LoadAsset<Item>(itemData.GetItemPath());
				NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
				Items.RegisterScrap(val, itemData.GetRarity(), (LevelTypes)1, new string[1] { "OoblterraLevel" });
				itemData.SetItem(val);
				SpawnableItemWithRarity val2 = new SpawnableItemWithRarity
				{
					spawnableItem = val,
					rarity = itemData.GetRarity()
				};
				MoonScrap.Add(val2);
				Debug.Log((object)("Item Loaded: " + ((Object)val2.spawnableItem).name));
			}
		}

		public static void SetMoonItemList(SelectableLevel Moon)
		{
			Moon.spawnableScrap = MoonScrap;
		}

		public static void SetMoonItemList(SelectableLevel Moon, List<SpawnableItemWithRarity> ItemList)
		{
			Moon.spawnableScrap = ItemList;
		}

		public static void SpawnItem(Vector3 location, int internalID)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager val = Object.FindObjectOfType<NetworkManager>();
			GameObject val2 = Object.Instantiate<GameObject>(ItemList[internalID].GetItem().spawnPrefab, location, Quaternion.identity);
			GrabbableObject component = val2.GetComponent<GrabbableObject>();
			NetworkObject component2 = val2.GetComponent<NetworkObject>();
			component.scrapValue = (int)((float)RoundManager.Instance.AnomalyRandom.Next(ItemList[internalID].GetItem().minValue, ItemList[internalID].GetItem().maxValue) * RoundManager.Instance.scrapValueMultiplier);
			if (val.IsHost)
			{
				component2.Spawn(false);
			}
			WTOBase.LogToConsole("Custom item spawned...");
		}
	}
	internal class TerminalPatch
	{
		private static readonly AssetBundle LevelBundle = WTOBase.LevelAssetBundle;

		private static Terminal ActiveTerminal;

		private static TerminalKeyword RouteKeyword;

		private static TerminalKeyword CancelKeyword;

		private static TerminalKeyword ConfirmKeyword;

		private static TerminalKeyword MoonTerminalWord;

		private static bool DontRun = false;

		private const string TerminalPath = "Assets/CustomTerminal/";

		public static TerminalKeyword InfoKeyword { get; private set; }

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void ExpandTerminal(StartOfRound __instance)
		{
			GrabActiveTerminal();
			AddMoonToList("Ooblterra");
			CreateRoute();
			AddToKeyword(InfoKeyword, MoonTerminalWord, LevelBundle.LoadAsset<TerminalNode>("Assets/CustomTerminal/OoblterraInfo.asset"));
		}

		public static void Start()
		{
		}

		private static void GrabActiveTerminal()
		{
			ActiveTerminal = GameObject.Find("TerminalScript").GetComponent<Terminal>();
			RouteKeyword = ActiveTerminal.terminalNodes.allKeywords[26];
			InfoKeyword = ActiveTerminal.terminalNodes.allKeywords[6];
			CancelKeyword = ActiveTerminal.terminalNodes.allKeywords[4];
			ConfirmKeyword = ActiveTerminal.terminalNodes.allKeywords[3];
		}

		public static void AddToKeyword(TerminalKeyword KeywordToAddTo, TerminalKeyword NewNoun, TerminalNode NewResult)
		{
			//IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			Array.Resize(ref KeywordToAddTo.compatibleNouns, KeywordToAddTo.compatibleNouns.Length + 1);
			KeywordToAddTo.compatibleNouns[KeywordToAddTo.compatibleNouns.Length - 1] = new CompatibleNoun
			{
				noun = NewNoun,
				result = NewResult
			};
		}

		public static void AddMoonToList(string MoonName)
		{
			if (!DontRun)
			{
				Array.Resize(ref ActiveTerminal.moonsCatalogueList, ActiveTerminal.moonsCatalogueList.Length + 1);
				ActiveTerminal.moonsCatalogueList[ActiveTerminal.moonsCatalogueList.Length - 1] = MoonPatch.MyNewMoon;
				MoonTerminalWord = LevelBundle.LoadAsset<TerminalKeyword>("Assets/CustomTerminal/523-Ooblterra.asset");
				MoonTerminalWord.defaultVerb = RouteKeyword;
				Array.Resize(ref ActiveTerminal.terminalNodes.allKeywords, ActiveTerminal.terminalNodes.allKeywords.Length + 1);
				ActiveTerminal.terminalNodes.allKeywords[ActiveTerminal.terminalNodes.allKeywords.Length - 1] = MoonTerminalWord;
				TerminalNode specialKeywordResult = ActiveTerminal.terminalNodes.allKeywords[21].specialKeywordResult;
				specialKeywordResult.displayText.Substring(specialKeywordResult.displayText.Length - 3);
				specialKeywordResult.displayText = specialKeywordResult.displayText + "\n* " + MoonName + " [planetTime]\n\n";
				DontRun = true;
			}
		}

		public static void CreateRoute()
		{
			TerminalNode val = LevelBundle.LoadAsset<TerminalNode>("Assets/CustomTerminal/523route.asset");
			val.terminalOptions[0].noun = CancelKeyword;
			val.terminalOptions[1].noun = ConfirmKeyword;
			AddToKeyword(RouteKeyword, MoonTerminalWord, val);
		}
	}
	internal class FactoryPatch
	{
		public static EntranceTeleport MainExit;

		public static EntranceTeleport FireExit;

		private static readonly AssetBundle FactoryBundle = WTOBase.FactoryAssetBundle;

		private static NetworkManager networkManagerRef;

		private const string DungeonPath = "Assets/CustomDungeon/Data/";

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPostfix]
		private static void GetNetworkManager(StartOfRound __instance)
		{
			networkManagerRef = ((NetworkBehaviour)__instance).NetworkManager;
		}

		[HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")]
		[HarmonyPrefix]
		private static void ScrapValueAdjuster(RoundManager __instance)
		{
			if (__instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName)
			{
				__instance.scrapValueMultiplier = 0.4f;
			}
			else
			{
				__instance.scrapValueMultiplier = 1f;
			}
		}

		[HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")]
		[HarmonyPostfix]
		private static void CreateCorrespondingExits(RoundManager __instance)
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			if (__instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName)
			{
				return;
			}
			EntranceTeleport existingEntrance = null;
			EntranceTeleport val = null;
			EntranceTeleport[] array = Object.FindObjectsOfType<EntranceTeleport>(false);
			WTOBase.LogToConsole($"Found {array.Length} fire exits to iterate over...");
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].entranceId == 0)
				{
					existingEntrance = array[i];
				}
				else
				{
					val = array[i];
				}
			}
			MainExit = CreateExit("SpawnEntranceTrigger", existingEntrance);
			FireExit = CreateExit("SpawnEntranceBTrigger", val);
			((Component)val).transform.Rotate(0f, -90f, 0f);
			((Component)FireExit).transform.Rotate(0f, -90f, 0f);
			Object[] array2 = (Object[])(object)Object.FindObjectsOfType<EntranceTeleport>(false);
			Object[] array3 = array2;
			Object[] array4 = array3;
			for (int j = 0; j < array4.Length; j++)
			{
				EntranceTeleport val2 = (EntranceTeleport)array4[j];
				val2.FindExitPoint();
				WTOBase.LogToConsole($"Entrance #{Array.IndexOf(array3, (Object)(object)val2)} exitPoint: {val2.exitPoint}");
			}
			ReplaceVents();
		}

		[HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")]
		[HarmonyPrefix]
		private static void DestroyExitsOnLeave(StartOfRound __instance)
		{
			DestroyExit(MainExit);
			DestroyExit(FireExit);
		}

		[HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")]
		[HarmonyPrefix]
		private static void CheckTeleport(EntranceTeleport __instance)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			WTOBase.LogToConsole("Attempting Teleport");
			if (!(RoundManager.Instance.currentLevel.PlanetName != MoonPatch.MoonFriendlyName))
			{
				Vector3 position = ((Component)GameNetworkManager.Instance.localPlayerController).transform.position;
				WTOBase.LogToConsole("Player Location: " + ((object)(Vector3)(ref position)).ToString());
				TimeOfDay.Instance.insideLighting = __instance.isEntranceToBuilding;
			}
		}

		public static void Start()
		{
			DungeonFlow dungeonFlow = FactoryBundle.LoadAsset<DungeonFlow>("Assets/CustomDungeon/Data/WTOFlow.asset");
			DungeonDef val = ScriptableObject.CreateInstance<DungeonDef>();
			((Object)val).name = "Oobl Laboratory";
			val.dungeonFlow = dungeonFlow;
			val.rarity = 99999;
			Dungeon.AddDungeon(val, (LevelTypes)1, new string[1] { "OoblterraLevel" });
			Debug.Log((object)("Dungeon Loaded: " + ((Object)val).name));
		}

		private static void DestroyExit(EntranceTeleport ExitToDestroy)
		{
			if (!((Object)(object)ExitToDestroy == (Object)null))
			{
				if (networkManagerRef.IsHost)
				{
					((Component)ExitToDestroy).GetComponent<NetworkObject>().Despawn(true);
				}
				Object.Destroy((Object)(object)ExitToDestroy);
			}
		}

		private static void ReplaceVents()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			SpawnSyncedObject[] source = Object.FindObjectsOfType<SpawnSyncedObject>();
			NetworkPrefab val = networkManagerRef.NetworkConfig.Prefabs.m_Prefabs.First((NetworkPrefab x) => ((Object)x.Prefab).name == "VentEntrance");
			if (val == null)
			{
				WTOBase.LogToConsole("LC Vent Prefab not found!!");
				return;
			}
			foreach (SpawnSyncedObject item in source.Where((SpawnSyncedObject objectToTest) => ((Object)objectToTest.spawnPrefab).name == "VentDummy"))
			{
				num++;
				Object.Instantiate<GameObject>(val.Prefab);
				val.Prefab.transform.position = ((Component)item).transform.position;
				val.Prefab.transform.rotation = ((Component)item).transform.rotation;
			}
			WTOBase.LogToConsole("Vents Found: " + num);
		}

		private static EntranceTeleport CreateExit(string SpawnLocationName, EntranceTeleport ExistingEntrance)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] source = Object.FindObjectsOfType<GameObject>();
			EntranceTeleport NewExit = Object.Instantiate<EntranceTeleport>(ExistingEntrance);
			if (networkManagerRef.IsHost)
			{
				((Component)NewExit).GetComponent<NetworkObject>().Spawn(false);
			}
			using (IEnumerator<GameObject> enumerator = source.Where((GameObject Obj) => ((Object)Obj).name.Contains(SpawnLocationName)).GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					GameObject current = enumerator.Current;
					((Component)NewExit).transform.position = current.transform.position;
					((Component)NewExit).transform.rotation = current.transform.rotation;
					InteractTrigger component = ((Component)NewExit).GetComponent<InteractTrigger>();
					((UnityEventBase)component.onInteract).RemoveAllListeners();
					((UnityEvent<PlayerControllerB>)(object)component.onInteract).AddListener((UnityAction<PlayerControllerB>)delegate
					{
						NewExit.TeleportPlayer();
					});
					NewExit.isEntranceToBuilding = false;
					return NewExit;
				}
			}
			WTOBase.LogToConsole("Exit Spawn not found!!!!");
			return null;
		}
	}
	internal class MonsterPatch
	{
		public static List<SpawnableEnemyWithRarity> InsideEnemies = new List<SpawnableEnemyWithRarity>();

		public static List<SpawnableEnemyWithRarity> OutsideEnemies = new List<SpawnableEnemyWithRarity>();

		public static List<SpawnableEnemyWithRarity> DaytimeEnemies = new List<SpawnableEnemyWithRarity>();

		public static List<SpawnableEnemyWithRarity> AdultWandererContainer = new List<SpawnableEnemyWithRarity>();

		public static List<SpawnableMapObject> SecurityList = new List<SpawnableMapObject>();

		private const string EnemyPathRoot = "Assets/CustomEnemies/";

		private static bool enemiesInList;

		[HarmonyPatch(typeof(QuickMenuManager), "Debug_SetEnemyDropdownOptions")]
		[HarmonyPrefix]
		private static void AddMonstersToDebug(QuickMenuManager __instance)
		{
			//IL_0089: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			if (enemiesInList)
			{
				return;
			}
			SelectableLevel testAllEnemiesLevel = __instance.testAllEnemiesLevel;
			SpawnableEnemyWithRarity val = testAllEnemiesLevel.Enemies.FirstOrDefault();
			if (val == null)
			{
				Debug.Log((object)"Failed to get first enemy for debug list!");
				return;
			}
			List<SpawnableEnemyWithRarity> enemies = testAllEnemiesLevel.Enemies;
			List<SpawnableEnemyWithRarity> outsideEnemies = testAllEnemiesLevel.OutsideEnemies;
			List<SpawnableEnemyWithRarity> daytimeEnemies = testAllEnemiesLevel.DaytimeEnemies;
			enemies.Clear();
			foreach (SpawnableEnemyWithRarity insideEnemy in InsideEnemies)
			{
				if (!enemies.Contains(insideEnemy))
				{
					enemies.Add(new SpawnableEnemyWithRarity
					{
						enemyType = insideEnemy.enemyType,
						rarity = insideEnemy.rarity
					});
					Debug.Log((object)("Added " + ((Object)insideEnemy.enemyType).name + "To debug list"));
				}
			}
			daytimeEnemies.Clear();
			foreach (SpawnableEnemyWithRarity daytimeEnemy in DaytimeEnemies)
			{
				if (!daytimeEnemies.Contains(daytimeEnemy))
				{
					daytimeEnemies.Add(new SpawnableEnemyWithRarity
					{
						enemyType = daytimeEnemy.enemyType,
						rarity = daytimeEnemy.rarity
					});
					Debug.Log((object)("Added " + ((Object)daytimeEnemy.enemyType).name + "To debug list"));
				}
			}
			outsideEnemies.Clear();
			outsideEnemies.Add(new SpawnableEnemyWithRarity
			{
				enemyType = AdultWandererContainer[0].enemyType,
				rarity = AdultWandererContainer[0].rarity
			});
			Debug.Log((object)("Added " + ((Object)AdultWandererContainer[0].enemyType).name + "To debug list"));
			enemiesInList = true;
		}

		public static void SetInsideMonsters(SelectableLevel Moon)
		{
			Moon.Enemies = InsideEnemies;
		}

		public static void SetInsideMonsters(SelectableLevel Moon, List<SpawnableEnemyWithRarity> EnemyList)
		{
			Moon.Enemies = EnemyList;
		}

		public static void SetOutsideMonsters(SelectableLevel Moon)
		{
			Moon.OutsideEnemies = OutsideEnemies;
		}

		public static void SetOutsideMonsters(SelectableLevel Moon, List<SpawnableEnemyWithRarity> EnemyList)
		{
			Moon.OutsideEnemies = EnemyList;
		}

		public static void SetDaytimeMonsters(SelectableLevel Moon)
		{
			Moon.DaytimeEnemies = DaytimeEnemies;
		}

		public static void SetDaytimeMonsters(SelectableLevel Moon, List<SpawnableEnemyWithRarity> EnemyList)
		{
			Moon.DaytimeEnemies = EnemyList;
		}

		public static void SetSecurityObjects(SelectableLevel Moon)
		{
			SpawnableMapObject[] spawnableMapObjects = (SpawnableMapObject[])(object)new SpawnableMapObject[SecurityList.Count];
			Moon.spawnableMapObjects = spawnableMapObjects;
			for (int i = 0; i < SecurityList.Count; i++)
			{
				Moon.spawnableMapObjects.SetValue(SecurityList[i], i);
			}
		}

		public static void SetSecurityObjects(SelectableLevel Moon, SpawnableMapObject[] Objects)
		{
			Moon.spawnableMapObjects = Objects;
		}

		public static void CreateEnemy(string EnemyName, List<SpawnableEnemyWithRarity> EnemyList, int rarity, SpawnType SpawnType, string InfoName = null, string KeywordName = null)
		{
			//IL_009a: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			string text = EnemyName.Remove(EnemyName.Length - 6, 6) + "/";
			TerminalNode val = null;
			TerminalKeyword val2 = null;
			EnemyType val3 = WTOBase.MonsterAssetBundle.LoadAsset<EnemyType>("Assets/CustomEnemies/" + text + EnemyName);
			if (InfoName != null)
			{
				val = WTOBase.MonsterAssetBundle.LoadAsset<TerminalNode>("Assets/CustomEnemies/" + text + InfoName);
			}
			if (KeywordName != null)
			{
				val2 = WTOBase.MonsterAssetBundle.LoadAsset<TerminalKeyword>("Assets/CustomEnemies/" + text + KeywordName);
				val2.defaultVerb = TerminalPatch.InfoKeyword;
			}
			NetworkPrefabs.RegisterNetworkPrefab(val3.enemyPrefab);
			Enemies.RegisterEnemy(val3, rarity, (LevelTypes)1, SpawnType, new string[1] { "OoblterraLevel" }, val, val2);
			EnemyList?.Add(new SpawnableEnemyWithRarity
			{
				enemyType = val3,
				rarity = rarity
			});
			Debug.Log((object)("Monster Loaded: " + EnemyName.Remove(EnemyName.Length - 6, 6)));
		}

		public static void Start()
		{
			CreateEnemy("Wanderer.asset", DaytimeEnemies, 50, (SpawnType)1, "WandererTerminal.asset", "WandererKeyword.asset");
			CreateEnemy("AdultWanderer.asset", AdultWandererContainer, 0, (SpawnType)2, "AdultWandererTerminal.asset", "AdultWandererKeyword.asset");
			CreateEnemy("Gallenarma.asset", InsideEnemies, 30, (SpawnType)0, "GallenTerminal.asset", "GallenKeyword.asset");
			CreateEnemy("EyeSecurity.asset", InsideEnemies, 20, (SpawnType)0, "EyeSecTerminal.asset", "EyeSecKeyword.asset");
			CreateEnemy("Lurker.asset", InsideEnemies, 20, (SpawnType)0, "LurkerTerminal.asset", "LurkerKeyword.asset");
		}
	}
	internal class MoonPatch
	{
		public static string MoonFriendlyName;

		public static SelectableLevel MyNewMoon;

		public static Animator OoblFogAnimator;

		private static readonly AssetBundle LevelBundle = WTOBase.LevelAssetBundle;

		private static Object LevelPrefab = null;

		private static readonly string[] ObjectNamesToDestroy = new string[8] { "CompletedVowTerrain", "tree", "Tree", "Rock", "StaticLightingSky", "Sky and Fog Global Volume", "Local Volumetric Fog", "SunTexture" };

		private static bool LevelLoaded;

		private static bool LevelStartHasBeenRun = false;

		private const string MoonPath = "Assets/CustomMoon/";

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		private static void FuckThePlanet(StartOfRound __instance)
		{
			if (__instance.currentLevel.PlanetName != MoonFriendlyName)
			{
				DestroyOoblterraPrefab();
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		private static void AddMoonToList(StartOfRound __instance)
		{
			SetMoonVariables(MyNewMoon, __instance);
			AddToMoons(MyNewMoon, __instance);
			LevelStartHasBeenRun = false;
		}

		[HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")]
		[HarmonyPostfix]
		private static void InitCustomLevel(StartOfRound __instance)
		{
			NetworkManager val = Object.FindObjectOfType<NetworkManager>();
			if (val.IsHost && !GameNetworkManager.Instance.gameHasStarted)
			{
				return;
			}
			if (__instance.currentLevel.PlanetName != MoonFriendlyName)
			{
				DestroyOoblterraPrefab();
				LevelStartHasBeenRun = false;
				return;
			}
			WTOBase.LogToConsole("Has level start been run? " + LevelStartHasBeenRun);
			if (!LevelStartHasBeenRun)
			{
				WTOBase.LogToConsole("Loading into level " + MoonFriendlyName);
				DestroyVowObjects();
				LevelPrefab = Object.Instantiate(WTOBase.LevelAssetBundle.LoadAsset("Assets/CustomMoon/customlevel.prefab"));
				LevelLoaded = true;
				WTOBase.LogToConsole("Loaded custom terrain object!");
				MoveDoors();
				ManageCustomSun();
				MoveNavNodesToNewPositions();
				HandleInsideNavigation();
				ManageFootsteps();
				LevelStartHasBeenRun = true;
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")]
		[HarmonyPostfix]
		public static void DestroyLevel(StartOfRound __instance)
		{
			if (__instance.currentLevel.PlanetName == MoonFriendlyName)
			{
				DestroyOoblterraPrefab();
				LevelStartHasBeenRun = false;
			}
		}

		[HarmonyPatch(typeof(TimeOfDay), "PlayTimeMusicDelayed")]
		[HarmonyPrefix]
		private static bool SkipTODMusic()
		{
			return false;
		}

		[HarmonyPatch(typeof(StartOfRound), "OnShipLandedMiscEvents")]
		[HarmonyPostfix]
		private static void SetFogTies(StartOfRound __instance)
		{
			if (!(__instance.currentLevel.PlanetName != MoonFriendlyName))
			{
				OoblFogAnimator = GameObject.Find("OoblFog").gameObject.GetComponent<Animator>();
				WTOBase.LogToConsole($"Fog animator found : {(Object)(object)OoblFogAnimator != (Object)null}");
				if (!((Object)(object)TimeOfDay.Instance.sunAnimator == (Object)(object)OoblFogAnimator))
				{
					TimeOfDay.Instance.sunAnimator = OoblFogAnimator;
				}
			}
		}

		public static void Start()
		{
			MyNewMoon = LevelBundle.LoadAsset<SelectableLevel>("Assets/CustomMoon/OoblterraLevel.asset");
			MoonFriendlyName = MyNewMoon.PlanetName;
			Debug.Log((object)(MoonFriendlyName + " Level Object found: " + ((Object)(object)MyNewMoon != (Object)null)));
		}

		private static void SetMoonVariables(SelectableLevel Moon, StartOfRound Instance)
		{
			Moon.planetPrefab = Instance.levels[2].planetPrefab;
			Moon.spawnableOutsideObjects = (SpawnableOutsideObjectWithRarity[])(object)new SpawnableOutsideObjectWithRarity[0];
			Moon.levelAmbienceClips = Instance.levels[2].levelAmbienceClips;
			MonsterPatch.SetSecurityObjects(Moon, Instance.levels[5].spawnableMapObjects);
			ItemPatch.SetMoonItemList(Moon);
		}

		public static T[] ResizeArray<T>(T[] oldArray, int newSize)
		{
			T[] array = new T[newSize];
			oldArray.CopyTo(array, 0);
			return array;
		}

		private static int AddToMoons(SelectableLevel Moon, StartOfRound Instance)
		{
			Instance.levels = ResizeArray(Instance.levels, Instance.levels.Length + 1);
			int num = -1;
			for (int i = 0; i < Instance.levels.Length; i++)
			{
				if ((Object)(object)Instance.levels[i] == (Object)null)
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				throw new NullReferenceException("No null value found in StartOfRound.levels");
			}
			Instance.levels[num] = Moon;
			SelectableLevel[] levels = Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				WTOBase.LogToConsole(((Object)val).name);
			}
			return num;
		}

		private static void DestroyOoblterraPrefab()
		{
			if (LevelLoaded)
			{
				Object.Destroy(LevelPrefab);
			}
			LevelLoaded = false;
		}

		private static void HandleInsideNavigation()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			UnityNavMeshAdapter val = Object.FindObjectOfType<UnityNavMeshAdapter>();
			if ((Object)(object)val != (Object)null)
			{
				WTOBase.LogToConsole("Found Navmesh adapter! Setting bake mode to FullDungeonBake...");
			}
			val.BakeMode = (RuntimeNavMeshBakeMode)3;
			val.AddNavMeshLinksBetweenRooms = true;
		}

		private static void MoveNavNodesToNewPositions()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
			List<GameObject> list = new List<GameObject>();
			IEnumerable<GameObject> enumerable = from obj in Object.FindObjectsOfType<GameObject>()
				where ((Object)obj).name == "OoblOutsideNode"
				select obj;
			foreach (GameObject item in enumerable)
			{
				list.Add(item);
			}
			WTOBase.LogToConsole("Outside nav points: " + enumerable.Count());
			for (int i = 0; i < array.Count(); i++)
			{
				if (list.Count() > i)
				{
					array[i].transform.position = list[i].transform.position;
				}
				else
				{
					Object.Destroy((Object)(object)array[i]);
				}
			}
		}

		private static void ManageCustomSun()
		{
			GameObject val = GameObject.Find("SunWithShadows");
			GameObject val2 = GameObject.Find("SunAnimContainer");
			GameObject val3 = GameObject.Find("Indirect");
			val2.GetComponent<animatedSun>().directLight = GameObject.Find("OoblSun").GetComponent<Light>();
			val2.GetComponent<animatedSun>().indirectLight = GameObject.Find("OoblIndirect").GetComponent<Light>();
			Object.Destroy((Object)(object)val);
			Object.Destroy((Object)(object)val3);
			OoblFogAnimator = GameObject.Find("OoblFog").gameObject.GetComponent<Animator>();
		}

		private static void ManageFootsteps()
		{
			FootstepSurface[] footstepSurfaces = StartOfRound.Instance.footstepSurfaces;
			foreach (FootstepSurface val in footstepSurfaces)
			{
				if (val.surfaceTag == "Grass")
				{
					val.clips = (AudioClip[])(object)new AudioClip[5]
					{
						LevelBundle.LoadAsset<AudioClip>("Assets/CustomMoon/Sound/Footsteps/TENTACLESTEP01.wav"),
						LevelBundle.LoadAsset<AudioClip>("Assets/CustomMoon/Sound/Footsteps/TENTACLESTEP02.wav"),
						LevelBundle.LoadAsset<AudioClip>("Assets/CustomMoon/Sound/Footsteps/TENTACLESTEP03.wav"),
						LevelBundle.LoadAsset<AudioClip>("Assets/CustomMoon/Sound/Footsteps/TENTACLESTEP04.wav"),
						LevelBundle.LoadAsset<AudioClip>("Assets/CustomMoon/Sound/Footsteps/TENTACLESTEP05.wav")
					};
					val.hitSurfaceSFX = LevelBundle.LoadAsset<AudioClip>("Assets/CustomMoon/Sound/Footsteps/TENTACLE_Fall.wav");
				}
			}
		}

		private static void DestroyVowObjects()
		{
			IEnumerable<GameObject> enumerable = from obj in Object.FindObjectsOfType<GameObject>()
				where ObjectNamesToDestroy.Any(((Object)obj).name.Contains)
				select obj;
			foreach (GameObject item in enumerable)
			{
				Object.Destroy((Object)(object)item);
			}
			GameObject val = GameObject.Find("Models2VowFactory");
			val.SetActive(false);
		}

		private static void MoveDoors()
		{
			//IL_0023: 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)
			GameObject val = GameObject.Find("EntranceTeleportA");
			GameObject val2 = GameObject.Find("TeleportSnapLocation");
			val.transform.position = val2.transform.position;
			GameObject val3 = GameObject.Find("EntranceTeleportB");
			GameObject val4 = GameObject.Find("FireExitSnapLocation");
			val3.transform.position = val4.transform.position;
		}
	}
	internal class SuitPatch
	{
		private const string SuitPath = "Assets/CustomSuits/";

		private const string PosterGameObject = "HangarShip/Plane.001";

		private static string[] SuitMaterialPaths = new string[2] { "Assets/CustomSuits/ProtSuit.mat", "Assets/CustomSuits/MackSuit.mat" };

		public static bool SuitsLoaded = false;

		[HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")]
		[HarmonyPrefix]
		private static void StartPatch(ref StartOfRound __instance)
		{
			if (SuitsLoaded)
			{
				return;
			}
			for (int i = 0; i < __instance.unlockablesList.unlockables.Count; i++)
			{
				UnlockableItem val = __instance.unlockablesList.unlockables[i];
				WTOBase.LogToConsole("Processing unlockable {index=" + i + ", name=" + val.unlockableName + "}");
				if (!((Object)(object)val.suitMaterial == (Object)null) && val.alreadyUnlocked)
				{
					string[] suitMaterialPaths = SuitMaterialPaths;
					foreach (string text in suitMaterialPaths)
					{
						UnlockableItem val2 = JsonUtility.FromJson<UnlockableItem>(JsonUtility.ToJson((object)val));
						val2.suitMaterial = WTOBase.ItemAssetBundle.LoadAsset<Material>(text);
						string unlockableName = text.Substring(19, 8);
						val2.unlockableName = unlockableName;
						__instance.unlockablesList.unlockables.Add(val2);
					}
					SuitsLoaded = true;
					break;
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")]
		[HarmonyPostfix]
		[HarmonyPriority(0)]
		private static void PatchPosters(StartOfRound __instance)
		{
			Material[] materials = ((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials;
			materials[1] = WTOBase.ItemAssetBundle.LoadAsset<Material>("Assets/CustomSuits/Poster.mat");
			((Renderer)GameObject.Find("HangarShip/Plane.001").GetComponent<MeshRenderer>()).materials = materials;
		}

		public static void Start()
		{
		}
	}
}
namespace Welcome_To_Ooblterra.Things
{
	public class BabyLurkerEgg : NetworkBehaviour
	{
		private Random enemyRandom;

		private int TimeUntilBabySpawns;

		private int TimeInRange;

		public bool BabySpawned;

		private void Start()
		{
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed);
			TimeUntilBabySpawns = enemyRandom.Next(180, 1200);
		}

		private void OnTriggerStay(Collider other)
		{
			if (!BabySpawned)
			{
				if (TimeInRange > TimeUntilBabySpawns)
				{
					SpawnBabyLurker();
				}
				TimeInRange++;
			}
		}

		private void SpawnBabyLurker()
		{
			BabySpawned = true;
		}

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

		protected internal override string __getTypeName()
		{
			return "BabyLurkerEgg";
		}
	}
	public class AcidWater : MonoBehaviour
	{
		public int DamageAmount;

		private float TimeSincePlayerDamaged = 0f;

		private void OnTriggerStay(Collider other)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if (((Component)other).gameObject.CompareTag("Player"))
			{
				if (TimeSincePlayerDamaged < 0.5f)
				{
					TimeSincePlayerDamaged += Time.deltaTime;
				}
				else if ((Object)(object)component != (Object)null)
				{
					TimeSincePlayerDamaged = 0f;
					component.DamagePlayer(DamageAmount, true, true, (CauseOfDeath)9, 0, false, default(Vector3));
					WTOBase.LogToConsole("New health amount: " + component.health);
				}
			}
		}
	}
	public class BatteryRoom
	{
	}
	public class EyeSecLaser : MonoBehaviour
	{
		public Transform StartPoint;

		public Transform EndPoint;

		public LineRenderer Laser;

		private float timeElapsed;

		private float LerpDuration = 2f;

		private Color myColor;

		public bool IsActive;

		private void Start()
		{
			if ((Object)(object)Laser == (Object)null)
			{
				Laser = ((Component)this).GetComponent<LineRenderer>();
			}
			((Renderer)Laser).enabled = false;
			Laser.startWidth = 0.5f;
			Laser.endWidth = 0.5f;
		}

		private void Update()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			Laser.SetPosition(0, StartPoint.position);
			Laser.SetPosition(1, EndPoint.position);
			if (timeElapsed < LerpDuration)
			{
				myColor = Color.Lerp(Color.green, Color.red, timeElapsed / LerpDuration);
				Laser.startColor = myColor;
				Laser.endColor = myColor;
				timeElapsed += Time.deltaTime;
			}
			else
			{
				timeElapsed = 0f;
			}
		}

		public void SetLaserEnabled(bool NewEnabled)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)Laser).enabled = NewEnabled;
			if (!NewEnabled)
			{
				Laser.startColor = Color.green;
				Laser.endColor = Color.green;
				timeElapsed = 0f;
			}
		}
	}
	internal class KitchenCrusher : MonoBehaviour
	{
		public GameObject Crusher;

		private Random CrusherRandom = new Random();

		private bool ActivateCrusher;

		private bool RetractCrusher;

		public Vector3 CrusherStartPos;

		public Vector3 CrusherEndPos;

		private PlayerControllerB victim;

		public AudioSource CrusherSound;

		public AudioClip SoundToPlay;

		private float LerpDuration = 0.3f;

		private float timeElapsed;

		private void OnTriggerEnter(Collider other)
		{
			if (((Component)other).gameObject.CompareTag("Player"))
			{
				victim = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				WTOBase.LogToConsole("Player colliding");
				if (CrusherRandom.Next(1, 100) > 45 && !ActivateCrusher)
				{
					WTOBase.LogToConsole("activate crusher!");
					ActivateCrusher = true;
					CrusherSound.PlayOneShot(SoundToPlay);
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if ((Object)(object)victim == (Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>())
			{
				victim = null;
			}
		}

		private void Start()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			CrusherStartPos = Crusher.transform.position;
			CrusherEndPos = Crusher.transform.position + Vector3.Scale(new Vector3(-6f, 0f, -6f), Crusher.transform.right);
		}

		private void SetCrusherRetract()
		{
			RetractCrusher = true;
		}

		private void Update()
		{
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			if (ActivateCrusher)
			{
				if (timeElapsed < LerpDuration)
				{
					Crusher.transform.position = Vector3.Lerp(CrusherStartPos, CrusherEndPos, timeElapsed / LerpDuration);
					timeElapsed += Time.deltaTime;
					if ((double)(timeElapsed / LerpDuration) > 0.75 && !((Object)(object)victim == (Object)null))
					{
						victim.DamagePlayer(100, true, true, (CauseOfDeath)8, 0, false, default(Vector3));
					}
					return;
				}
				((MonoBehaviour)this).Invoke("SetCrusherRetract", 3f);
				ActivateCrusher = false;
				timeElapsed = 0f;
			}
			if (RetractCrusher)
			{
				Crusher.transform.position = Vector3.Lerp(CrusherEndPos, CrusherStartPos, timeElapsed / LerpDuration);
				timeElapsed += Time.deltaTime;
			}
		}
	}
	public class EnforcerWeapon : GrabbableObject
	{
		public int RemainingRockets;

		public int RemainingLaserBlasts;

		public bool isTargetingLaser;

		public bool isLaunchingRocket;

		public void TargetLaser(Object target)
		{
		}

		public void LaunchRocket(Object target)
		{
		}

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

		protected internal override string __getTypeName()
		{
			return "EnforcerWeapon";
		}
	}
	internal class EyeSecScanner : MonoBehaviour
	{
		public EyeSecAI myAI;

		private void OnTriggerStay(Collider other)
		{
			myAI.ScanOurEnemy(other);
		}
	}
	public class FrankensteinTerminal
	{
		public FrankensteinBodyPoint TargetBodyPoint;

		private bool TableHasBody()
		{
			return TargetBodyPoint.HasBody;
		}
	}
	public class FrankensteinBodyPoint : NetworkBehaviour
	{
		public InteractTrigger triggerScript;

		public bool HasBody;

		public NetworkObject deskObjectsContainer;

		private float updateInterval;

		private BoxCollider triggerCollider;

		private void Update()
		{
			if ((Object)(object)NetworkManager.Singleton == (Object)null)
			{
				return;
			}
			if (updateInterval > 1f)
			{
				updateInterval = 0f;
				if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					triggerScript.interactable = (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.itemName == "Body";
				}
			}
			else
			{
				updateInterval += Time.deltaTime;
			}
		}

		private void AttachBody(PlayerControllerB player)
		{
			//IL_003f: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)deskObjectsContainer).GetComponentsInChildren<GrabbableObject>().Length < 1 && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				Vector3 val = RoundManager.RandomPointInBounds(((Collider)triggerCollider).bounds);
				Bounds bounds = ((Collider)triggerCollider).bounds;
				val.y = ((Bounds)(ref bounds)).min.y;
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(new Ray(val + Vector3.up * 3f, Vector3.down), ref val2, 8f, 1048640, (QueryTriggerInteraction)2))
				{
					val = ((RaycastHit)(ref val2)).point;
				}
				val.y += player.currentlyHeldObjectServer.itemProperties.verticalOffset;
				val = ((Component)deskObjectsContainer).transform.InverseTransformPoint(val);
				player.DiscardHeldObject(true, deskObjectsContainer, val, false);
				Debug.Log((object)"discard held object called from deposit items desk");
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "FrankensteinBodyPoint";
		}
	}
	public class HideSpot
	{
	}
	public class TripLaser : NetworkBehaviour
	{
		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "TripLaser";
		}
	}
}
namespace Welcome_To_Ooblterra.Enemies
{
	public class AdultWandererAI : WTOEnemy
	{
		private class Spawn : BehaviorState
		{
			private int SpawnTimer;

			private int SpawnTime = 80;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new EvaluateEnemyState()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				WTOBase.LogToConsole("SPAWN WANDERER");
				creatureAnimator.SetBool("Spawn", true);
				((EnemyAI)AWandList[enemyIndex]).creatureSFX.PlayOneShot(AWandList[enemyIndex].SpawnSound);
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				if (SpawnTimer > SpawnTime)
				{
					AWandList[enemyIndex].spawnFinished = true;
				}
				else
				{
					SpawnTimer++;
				}
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Spawn", false);
			}
		}

		private class WaitForTargetLook : BehaviorState
		{
			private int LookWaitTime = 0;

			private int LookWaitTimer = 3500;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new EvaluatePlayerLook()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Moving", false);
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				if (LookWaitTime > LookWaitTimer)
				{
					AWandList[enemyIndex].LostPatience = true;
				}
				else
				{
					LookWaitTime++;
				}
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
			}
		}

		private class Attack : BehaviorState
		{
			private bool HasAttacked;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new EnemyLeftRange(),
				new EnemyKilled()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				AWandList[enemyIndex].AttackCooldownSeconds = 1.5f;
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_0016: 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)
				if (Vector3.Distance(((Component)AWandList[enemyIndex].MainTarget).transform.position, ((Component)AWandList[enemyIndex]).transform.position) < (float)AWandList[enemyIndex].AttackRange)
				{
					if (AWandList[enemyIndex].AttackCooldownSeconds <= 0f)
					{
						AWandList[enemyIndex].LogMessage("Attacking!");
						AWandList[enemyIndex].AttackCooldownSeconds = 1.5f;
						HasAttacked = false;
						return;
					}
					if (AWandList[enemyIndex].AttackCooldownSeconds <= 1.2f)
					{
						creatureAnimator.SetBool("Attacking", true);
					}
					if (AWandList[enemyIndex].AttackCooldownSeconds <= 0.76f && !HasAttacked)
					{
						AWandList[enemyIndex].MeleeAttackPlayer(AWandList[enemyIndex].MainTarget);
						HasAttacked = true;
					}
				}
				else
				{
					AWandList[enemyIndex].AttackCooldownSeconds = 0f;
				}
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Attacking", false);
			}
		}

		private class Roam : BehaviorState
		{
			public bool SearchInProgress;

			public bool investigating;

			public int investigateTimer;

			public int TotalInvestigateTime;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new EnemyInOverworld()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Moving", true);
				TotalInvestigateTime = enemyRandom.Next(100, 300);
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_00bc: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
				if (investigating)
				{
					investigateTimer++;
					return;
				}
				if (investigateTimer > TotalInvestigateTime)
				{
					investigating = false;
					SearchInProgress = false;
				}
				if (!SearchInProgress)
				{
					((EnemyAI)AWandList[base.enemyIndex]).agent.speed = 7f;
					((EnemyAI)AWandList[base.enemyIndex]).SetDestinationToPosition(RoundManager.Instance.GetRandomNavMeshPositionInRadius(((EnemyAI)AWandList[enemyIndex]).allAINodes[enemyRandom.Next(((EnemyAI)AWandList[base.enemyIndex]).allAINodes.Length - 1)].transform.position, 15f, default(NavMeshHit)), true);
					SearchInProgress = true;
				}
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Moving", false);
			}
		}

		private class Chase : BehaviorState
		{
			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new EnemyInShipOrFacility(),
				new EnemyEnteredRange()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Moving", true);
				((EnemyAI)AWandList[enemyIndex]).agent.speed = 8f;
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				((EnemyAI)AWandList[enemyIndex]).SetDestinationToPosition(((Component)AWandList[enemyIndex].MainTarget).transform.position, false);
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Moving", false);
			}
		}

		private class Stunned : BehaviorState
		{
			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new NoLongerStunned()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Stunned", true);
				((EnemyAI)AWandList[enemyIndex]).agent.speed = 0f;
				((EnemyAI)AWandList[enemyIndex]).targetPlayer = ((EnemyAI)AWandList[enemyIndex]).stunnedByPlayer;
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Stunned", false);
				((EnemyAI)AWandList[enemyIndex]).agent.speed = 8f;
			}
		}

		private class EvaluateEnemyState : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return AWandList[enemyIndex].spawnFinished;
			}

			public override BehaviorState NextState()
			{
				if ((Object)(object)AWandList[enemyIndex].MainTarget == (Object)null)
				{
					return new Roam();
				}
				return new WaitForTargetLook();
			}
		}

		private class EvaluatePlayerLook : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				WTOBase.LogToConsole("Player sees Adult Wanderer: " + AWandList[enemyIndex].CheckForPlayerLOS());
				if (AWandList[enemyIndex].CheckForPlayerLOS())
				{
					return true;
				}
				return AWandList[enemyIndex].LostPatience;
			}

			public override BehaviorState NextState()
			{
				return new Attack();
			}
		}

		private class EnemyInShipOrFacility : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return !((EnemyAI)AWandList[enemyIndex]).PlayerIsTargetable(AWandList[enemyIndex].MainTarget, false, false);
			}

			public override BehaviorState NextState()
			{
				return new Roam();
			}
		}

		private class EnemyInOverworld : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				if ((Object)(object)((EnemyAI)AWandList[enemyIndex]).targetPlayer == (Object)null)
				{
					return false;
				}
				return AWandList[enemyIndex].PlayerCanBeTargeted(AWandList[enemyIndex].MainTarget);
			}

			public override BehaviorState NextState()
			{
				return new Chase();
			}
		}

		private class EnemyLeftRange : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				return ((EnemyAI)AWandList[enemyIndex]).PlayerIsTargetable(AWandList[enemyIndex].MainTarget, false, false) && Vector3.Distance(((Component)AWandList[enemyIndex]).transform.position, ((Component)AWandList[enemyIndex].MainTarget).transform.position) > (float)AWandList[enemyIndex].AttackRange;
			}

			public override BehaviorState NextState()
			{
				return new Roam();
			}
		}

		private class EnemyKilled : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return AWandList[enemyIndex].MainTarget.health < 0;
			}

			public override BehaviorState NextState()
			{
				AWandList[enemyIndex].MainTarget = null;
				return new Roam();
			}
		}

		private class EnemyEnteredRange : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				//IL_0042: 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)
				return AWandList[enemyIndex].PlayerCanBeTargeted(AWandList[enemyIndex].MainTarget) && Vector3.Distance(((Component)AWandList[enemyIndex]).transform.position, ((Component)AWandList[enemyIndex].MainTarget).transform.position) < (float)AWandList[enemyIndex].AttackRange;
			}

			public override BehaviorState NextState()
			{
				return new Attack();
			}
		}

		private class HitByStunGun : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return ((EnemyAI)AWandList[enemyIndex]).stunNormalizedTimer > 0f && !(AWandList[enemyIndex].ActiveState is Stunned);
			}

			public override BehaviorState NextState()
			{
				return new Stunned();
			}
		}

		private class NoLongerStunned : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return ((EnemyAI)AWandList[enemyIndex]).stunNormalizedTimer <= 0f;
			}

			public override BehaviorState NextState()
			{
				return new Chase();
			}
		}

		private bool spawnFinished = false;

		public PlayerControllerB MainTarget = null;

		private bool LostPatience = false;

		private float AttackCooldownSeconds = 1.2f;

		public int AttackRange = 7;

		public static Dictionary<int, AdultWandererAI> AWandList = new Dictionary<int, AdultWandererAI>();

		public static int AWandID;

		public AudioClip SpawnSound;

		public override void Start()
		{
			base.InitialState = new Spawn();
			AWandID++;
			WTOEnemyID = AWandID;
			LogMessage($"Adding Adult Wanderer {this} #{AWandID}");
			AWandList.Add(AWandID, this);
			MyValidState = PlayerState.Outside;
			((EnemyAI)this).enemyHP = 10;
			GlobalTransitions.Add(new HitByStunGun());
			base.Start();
		}

		public override void Update()
		{
			LowerTimerValue(ref AttackCooldownSeconds);
			base.Update();
		}

		private void MeleeAttackPlayer(PlayerControllerB Target)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			LogMessage("Attacking player!");
			Target.DamagePlayer(40, true, true, (CauseOfDeath)1, 0, false, default(Vector3));
			Target.JumpToFearLevel(1f, true);
		}

		public void SetMyTarget(PlayerControllerB player)
		{
			((EnemyAI)this).targetPlayer = player;
			MainTarget = player;
		}

		public bool CheckForPlayerLOS()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return MainTarget.HasLineOfSightToPosition(((Component)this).transform.position + Vector3.up * 1.6f, 68f, 60, -1f);
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
		{
			if (!((EnemyAI)this).isEnemyDead)
			{
				((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX);
				((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force;
				LogMessage("Adult Wanderer HP remaining: " + ((EnemyAI)this).enemyHP);
				((EnemyAI)this).creatureAnimator.SetTrigger("Hit");
				if (((NetworkBehaviour)this).IsOwner && ((EnemyAI)this).enemyHP <= 0)
				{
					((EnemyAI)this).isEnemyDead = true;
					((EnemyAI)this).creatureAnimator.SetTrigger("Killed");
					((EnemyAI)this).creatureVoice.Stop();
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
				}
				else
				{
					((EnemyAI)this).targetPlayer = playerWhoHit;
					MainTarget = playerWhoHit;
					OverrideState(new Attack());
				}
			}
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		protected internal override string __getTypeName()
		{
			return "AdultWandererAI";
		}
	}
	public class EyeSecAI : WTOEnemy
	{
		private class Patrol : BehaviorState
		{
			public bool SearchInProgress;

			private int PatrolPointAttempts;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new ShouldStartScanTransition()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				creatureAnimator.SetBool("Moving", true);
				((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 9f;
				((EnemyAI)EyeSecList[enemyIndex]).StartSearch(((Component)EyeSecList[enemyIndex]).transform.position, EyeSecList[enemyIndex].SearchLab);
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				if (!EyeSecList[enemyIndex].SearchLab.inProgress)
				{
					((EnemyAI)EyeSecList[enemyIndex]).StartSearch(((Component)EyeSecList[enemyIndex]).transform.position, EyeSecList[enemyIndex].SearchLab);
				}
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				creatureAnimator.SetBool("Moving", false);
				((EnemyAI)EyeSecList[enemyIndex]).StopSearch(EyeSecList[enemyIndex].SearchLab, true);
			}
		}

		private class ScanEnemies : BehaviorState
		{
			public int AnimWaiter = 0;

			public int investigateTimer;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new ReturnToPatrol(),
				new BeginAttack()
			};


			public ScanEnemies()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				RandomRange = new Vector2(5f, 8f);
			}

			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				EyeSecList[enemyIndex].StartScanVisuals();
				investigateTimer = 0;
				((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 0f;
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				if (AnimWaiter < 15)
				{
					AnimWaiter++;
					return;
				}
				if (investigateTimer <= 360)
				{
					EyeSecList[enemyIndex].ScanRoom();
				}
				else
				{
					EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].EndScanSFX, MyRandomInt);
				}
				investigateTimer++;
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				((Collider)EyeSecList[enemyIndex].ScannerCollider).enabled = false;
			}
		}

		private class Attack : BehaviorState
		{
			private float laserTimer = 0f;

			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new FinishKill(),
				new PlayerOutOfRange(),
				new PlayerLeft(),
				new Stunned()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				EyeSecList[enemyIndex].StartAttackVisuals();
				((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 0f;
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				EyeSecList[enemyIndex].TryFlash();
				EyeSecList[enemyIndex].TrackPlayerWithHead();
				laserTimer += Time.deltaTime;
				if (laserTimer > 2f)
				{
					((EnemyAI)EyeSecList[enemyIndex]).targetPlayer.DamagePlayer(150, true, true, (CauseOfDeath)3, 0, false, default(Vector3));
					((EnemyAI)EyeSecList[enemyIndex]).creatureVoice.PlayOneShot(EyeSecList[enemyIndex].BurnSFX);
				}
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				EyeSecList[enemyIndex].StopAttackVisuals();
			}
		}

		private class MoveToAttackPosition : BehaviorState
		{
			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new InRangeOfPlayer(),
				new PlayerLeft(),
				new Stunned()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_0052: 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_0094: Unknown result type (might be due to invalid IL or missing references)
				((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 9f;
				EyeSecList[enemyIndex].StopAttackVisuals();
				((Component)EyeSecList[enemyIndex].PlayerTracker).transform.position = ((Component)EyeSecList[enemyIndex]).transform.position;
				((EnemyAI)EyeSecList[enemyIndex]).SetDestinationToPosition(((EnemyAI)EyeSecList[enemyIndex]).ChooseClosestNodeToPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, true, 0).position, false);
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				((EnemyAI)EyeSecList[enemyIndex]).SetDestinationToPosition(((EnemyAI)EyeSecList[enemyIndex]).ChooseClosestNodeToPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, false, 0).position, false);
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
			}
		}

		private class ShutDown : BehaviorState
		{
			public override List<StateTransition> transitions { get; set; } = new List<StateTransition>
			{
				new WakeBackUp()
			};


			public override void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
				((EnemyAI)EyeSecList[enemyIndex]).agent.speed = 0f;
				EyeSecList[enemyIndex].LogMessage("Eyesec shut down!");
			}

			public override void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
			}

			public override void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator)
			{
			}
		}

		private class ShouldStartScanTransition : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				bool flag = EyeSecList[enemyIndex].enemyRandom.Next(0, 50) > 35;
				PlayerControllerB[] allPlayersInLineOfSight = ((EnemyAI)EyeSecList[enemyIndex]).GetAllPlayersInLineOfSight(180f, 3, (Transform)null, -1f, -1);
				if (allPlayersInLineOfSight == null || EyeSecList[enemyIndex].ScanCooldownSeconds > 0f)
				{
					return false;
				}
				if (allPlayersInLineOfSight.Length != 0 && flag)
				{
					return true;
				}
				return false;
			}

			public override BehaviorState NextState()
			{
				return new ScanEnemies();
			}
		}

		private class ReturnToPatrol : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				if (EyeSecList[enemyIndex].ScanFinished)
				{
					return !EyeSecList[enemyIndex].FoundPlayerHoldingScrap;
				}
				return false;
			}

			public override BehaviorState NextState()
			{
				return new Patrol();
			}
		}

		private class BeginAttack : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return EyeSecList[enemyIndex].FoundPlayerHoldingScrap;
			}

			public override BehaviorState NextState()
			{
				EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].EndScanSFX, 0);
				return new Attack();
			}
		}

		private class FinishKill : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				if ((Object)(object)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer == (Object)null || ((EnemyAI)EyeSecList[enemyIndex]).targetPlayer.isPlayerDead)
				{
					return true;
				}
				return false;
			}

			public override BehaviorState NextState()
			{
				EyeSecList[enemyIndex].FoundPlayerHoldingScrap = false;
				((EnemyAI)EyeSecList[enemyIndex]).targetPlayer = null;
				return new Patrol();
			}
		}

		private class PlayerOutOfRange : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				return !((EnemyAI)EyeSecList[enemyIndex]).HasLineOfSightToPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, 360f, 60, -1f);
			}

			public override BehaviorState NextState()
			{
				if (!((EnemyAI)EyeSecList[enemyIndex]).PlayerIsTargetable(((EnemyAI)EyeSecList[enemyIndex]).targetPlayer, false, false))
				{
					return new Patrol();
				}
				return new MoveToAttackPosition();
			}
		}

		private class InRangeOfPlayer : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				if (!((EnemyAI)EyeSecList[enemyIndex]).PlayerIsTargetable(((EnemyAI)EyeSecList[enemyIndex]).targetPlayer, false, false))
				{
					return true;
				}
				return ((EnemyAI)EyeSecList[enemyIndex]).HasLineOfSightToPosition(((Component)((EnemyAI)EyeSecList[enemyIndex]).targetPlayer).transform.position, 360f, 60, -1f);
			}

			public override BehaviorState NextState()
			{
				if (!((EnemyAI)EyeSecList[enemyIndex]).PlayerIsTargetable(((EnemyAI)EyeSecList[enemyIndex]).targetPlayer, false, false))
				{
					return new Patrol();
				}
				return new Attack();
			}
		}

		private class PlayerLeft : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return !EyeSecList[enemyIndex].PlayerCanBeTargeted(((EnemyAI)EyeSecList[enemyIndex]).targetPlayer);
			}

			public override BehaviorState NextState()
			{
				((EnemyAI)EyeSecList[enemyIndex]).targetPlayer = null;
				return new Patrol();
			}
		}

		private class Stunned : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return ((EnemyAI)EyeSecList[enemyIndex]).stunNormalizedTimer > 0f;
			}

			public override BehaviorState NextState()
			{
				EyeSecList[enemyIndex].StopAttackVisuals();
				EyeSecList[enemyIndex].StopScanVisuals(EyeSecList[enemyIndex].ShutdownSFX, 0);
				EyeSecList[enemyIndex].ShutdownTimerSeconds = 30f;
				((EnemyAI)EyeSecList[enemyIndex]).targetPlayer = null;
				return new ShutDown();
			}
		}

		private class WakeBackUp : StateTransition
		{
			public override bool CanTransitionBeTaken()
			{
				return ((EnemyAI)EyeSecList[enemyIndex]).stunNormalizedTimer <= 0f && EyeSecList[enemyIndex].ShutdownTimerSeconds <= 0f;
			}

			public override BehaviorState NextState()
			{
				EyeSecList[enemyIndex].ScanCooldownSeconds = 0f;
				return new Patrol();
			}
		}

		[SerializeField]
		public GameObject Head;

		public BoxCollider ScannerCollider;

		public GameObject Wheel;

		public Animator ScanAnim;

		public EyeSecLaser MyLaser;

		public Transform PlayerTracker;

		public static Dictionary<int, EyeSecAI> EyeSecList = new Dictionary<int, EyeSecAI>();

		public static int EyeSecID;

		public AudioClip flashSFX;

		public AudioClip StartScanSFX;

		public AudioClip EndScanSFX;

		public AudioClip AttackSFX;

		public AudioClip MoveSFX;

		public AudioClip ScanSFX;

		public AudioClip BurnSFX;

		public AudioClip ShutdownSFX;

		[HideInInspector]
		private static List<GrabbableObject> grabbableObjectsInMap = new List<GrabbableObject>();

		private bool FoundPlayerHoldingScrap = false;

		private bool ScanFinished = false;

		private bool IsScanning;

		private float ScanCooldownSeconds = 0f;

		private float FlashCooldownSeconds = 10f;

		private float ShutdownTimerSeconds = 0f;

		private bool PlayingMoveSound;

		private AISearchRoutine SearchLab = new AISearchRoutine();

		public override void Start()
		{
			base.InitialState = new Patrol();
			RefreshGrabbableObjectsInMapList();
			PrintDebugs = true;
			EyeSecID++;
			WTOEnemyID = EyeSecID;
			LogMessage($"Adding EyeSec {this} at {EyeSecID}");
			EyeSecList.Add(EyeSecID, this);
			base.Start();
		}

		public override void Update()
		{
			LowerTimerValue(ref ScanCooldownSeconds);
			LowerTimerValue(ref FlashCooldownSeconds);
			LowerTimerValue(ref ShutdownTimerSeconds);
			SpinWheel();
			base.Update();
		}

		public static void RefreshGrabbableObjectsInMapList()
		{
			grabbableObjectsInMap.Clear();
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].scrapValue != 0)
				{
					grabbableObjectsInMap.Add(array[i]);
				}
			}
		}

		private void ScanRoom()
		{
			Head.transform.Rotate(0f, 1f, 0f);
		}

		public void ScanOurEnemy(Collider other)
		{
			if (!IsScanning)
			{
				return;
			}
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if (!((Object)(object)component == (Object)null) && PlayerCanBeTargeted(component))
			{
				LogMessage("Player found, time to scan him...");
				if (grabbableObjectsInMap.Contains(component.currentlyHeldObjectServer))
				{
					LogMessage("Player is guilty!");
					FoundPlayerHoldingScrap = true;
					ScanFinished = true;
					((EnemyAI)this).targetPlayer = component;
					((EnemyAI)this).ChangeOwnershipOfEnemy(component.actualClientId);
					ScanCooldownSeconds = 5f;
					IsScanning = false;
				}
			}
		}

		private void SpinWheel()
		{
			if (((EnemyAI)this).agent.speed > 0f)
			{
				Wheel.transform.Rotate(-160f * Time.deltaTime, 0f, 0f);
				if (!PlayingMoveSound)
				{
					((EnemyAI)this).creatureSFX.clip = MoveSFX;
					((EnemyAI)this).creatureSFX.Play();
					PlayingMoveSound = true;
				}
			}
			else if (PlayingMoveSound)
			{
				((EnemyAI)this).creatureSFX.Stop();
				PlayingMoveSound = false;
			}
		}

		private void TryFlash()
		{
			if (FlashCooldownSeconds <= 0f)
			{
				((EnemyAI)this).postStunInvincibilityTimer = 0.05f;
				Flash();
				FlashCooldownSeconds = 10f;
			}
		}

		public void Flash()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).creatureVoice.PlayOneShot(flashSFX);
			WalkieTalkie.TransmitOneShotAudio(((EnemyAI)this).creatureVoice, flashSFX, 1f);
			StunGrenadeItem.StunExplosion(((Component)this).transform.position, false, 2f, 4f, 2f, false, (PlayerControllerB)null, (PlayerControllerB)null);
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX);
			((EnemyAI)this).targetPlayer = playerWhoHit;
			((EnemyAI)this).ChangeOwnershipOfEnemy(playerWhoHit.actualClientId);
			LogMessage("Player hit us!");
			if (!(ActiveState is ShutDown))
			{
				OverrideState(new Attack());
			}
		}

		[ServerRpc]
		internal void SetScannerBoolOnServerRpc(string name, bool state)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_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 != 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(783733510u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(name, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 783733510u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer)
			{
				LogMessage("Changing anim!");
				ScanAnim.SetBool(name, state);
			}
		}

		public void StartScanVisuals()
		{
			((EnemyAI)this).creatureVoice.PlayOneShot(StartScanSFX);
			((EnemyAI)this).creatureVoice.clip = ScanSFX;
			((EnemyAI)this).creatureVoice.loop = true;
			((EnemyAI)this).creatureVoice.Play();
			SetScannerBoolOnServerRpc("Scanning", state: true);
			((Collider)ScannerCollider).enabled = true;
			ScanFinished = false;
			IsScanning = true;
		}

		public void StopScanVisuals(AudioClip StopSound, int NextScanTime)
		{
			((EnemyAI)this).creatureVoice.Stop();
			((EnemyAI)this).creatureVoice.loop = false;
			if ((Object)(object)StopSound != (Object)null)
			{
				((EnemyAI)this).creatureVoice.PlayOneShot(StopSound);
			}
			SetScannerBoolOnServerRpc("Scanning", state: false);
			((Collider)ScannerCollider).enabled = false;
			ScanFinished = true;
			IsScanning = false;
			ScanCooldownSeconds = NextScanTime;
		}

		public void StartAttackVisuals()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			MyLaser.SetLaserEnabled(NewEnabled: true);
			((EnemyAI)this).creatureVoice.PlayOneShot(AttackSFX);
			((Component)PlayerTracker).transform.position = ((Component)((EnemyAI)this).targetPlayer).transform.position;
		}

		public void StopAttackVisuals()
		{
			MyLaser.SetLaserEnabled(NewEnabled: false);
		}

		public void TrackPlayerWithHead()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Quaternion rotation = default(Quaternion);
			((Quaternion)(ref rotation)).SetLookRotation((((Component)((EnemyAI)this).targetPlayer).transform.position - ((Component)this).transform.position) * -1f);
			Head.transform.rotation = rotation;
		}

		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_EyeSecAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(783733510u, new RpcReceiveHandler(__rpc_handler_783733510));
		}

		private static void __rpc_handler_783733510(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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			//IL_00b4: 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)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			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!");
				}
				return;
			}
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string name = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref name, false);
			}
			bool state = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref state, default(ForPrimitives));
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EyeSecAI)(object)target).SetScannerBoolOnServerRpc(name, state);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}

		protected internal override string __getTypeName()
		{
			return "EyeSecAI";
		}
	}
	public class WTOEnemy : EnemyAI
	{
		public abstract class BehaviorState
		{
			public Vector2 RandomRange = new Vector2(0f, 0f);

			public int MyRandomInt = 0;

			public int enemyIndex;

			public virtual List<StateTransition> transitions { get; set; }

			public abstract void OnStateEntered(int enemyIndex, Random enemyRandom, Animator creatureAnimator);

			public abstract void UpdateBehavior(int enemyIndex, Random enemyRandom, Animator creatureAnimator);

			public abstract void OnStateExit(int enemyIndex, Random enemyRandom, Animator creatureAnimator);
		}

		public abstract class StateTransition
		{
			public int enemyIndex;

			public abstract bool CanTransitionBeTaken();

			public abstract BehaviorState NextState();
		}

		public enum PlayerState
		{
			Dead,
			Outside,
			Inside
		}

		internal BehaviorState ActiveState = null;

		internal Random enemyRandom;

		internal int AITimer;

		internal RoundManager roundManager;

		internal bool PrintDebugs = false;

		internal PlayerState MyValidState = PlayerState.Inside;

		internal StateTransition nextTransition;

		internal List<StateTransition> GlobalTransitions = new List<StateTransition>();

		internal List<StateTransition> AllTransitions = new List<StateTransition>();

		internal int WTOEnemyID;

		internal BehaviorState InitialState { get; set; }

		public override string __getTypeName()
		{
			return ((object)this).GetType().Name;
		}

		public override void DoAIInterval()
		{
			((EnemyAI)this).DoAIInterval();
			_ = StartOfRound.Instance.livingPlayers;
		}

		public override void Start()
		{
			((EnemyAI)this).Start();
			ActiveState = InitialState;
			roundManager = Object.FindObjectOfType<RoundManager>();
			enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
			if (base.enemyType.isOutsideEnemy)
			{
				MyValidState = PlayerState.Outside;
			}
			else
			{
				MyValidState = PlayerState.Inside;
			}
			if (!base.agent.isOnNavMesh && ((NetworkBehaviour)this).IsOwner)
			{
				WTOBase.LogToConsole("CREATURE " + ((NetworkBehaviour)this).__getTypeName() + " WAS NOT PLACED ON NAVMESH, DESTROYING...");
				((EnemyAI)this).KillEnemyOnOwnerClient(false);
			}
			base.creatureAnimator.Rebind();
			ActiveState.enemyIndex = WTOEnemyID;
			ActiveState.OnStateEntered(WTOEnemyID, enemyRandom, base.creatureAnimator);
		}

		public override void Update()
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			AITimer++;
			if (base.isEnemyDead || !base.ventAnimationFinished)
			{
				return;
			}
			bool flag = true;
			AllTransitions.Clear();
			AllTransitions.AddRange(GlobalTransitions);
			AllTransitions.AddRange(ActiveState.transitions);
			foreach (StateTransition allTransition in AllTransitions)
			{
				allTransition.enemyIndex = WTOEnemyID;
				if (allTransition.CanTransitionBeTaken())
				{
					flag = false;
					nextTransition = allTransition;
					TransitionStateServerRpc(nextTransition.ToString(), GenerateNextRandomInt(nextTransition.NextState().RandomRange));
					return;
				}
			}
			if (flag)
			{
				ActiveState.UpdateBehavior(WTOEnemyID, enemyRandom, base.creatureAnimator);
			}
		}

		internal void LogMessage(string message)
		{
			if (PrintDebugs)
			{
				Debug.Log((object)message);
			}
		}

		internal bool PlayerCanBeTargeted(PlayerControllerB myPlayer)
		{
			return GetPlayerState(myPlayer) == MyValidState;
		}

		internal PlayerState GetPlayerState(PlayerControllerB myPlayer)
		{
			if (myPlayer.isPlayerDead)
			{
				return PlayerState.Dead;
			}
			if (myPlayer.isInsideFactory)
			{
				return PlayerState.Inside;
			}
			return PlayerState.Outside;
		}

		[ServerRpc]
		internal void TransitionStateServerRpc(string StateName, int RandomInt)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1493140252u, val, (RpcDelivery)0);
				bool flag = StateName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(StateName, false);
				}
				BytePacker.WriteValueBitPacked(val2, RandomInt);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1493140252u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				TransitionStateClientRpc(StateName, RandomInt);
			}
		}

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

		internal void TransitionState(string StateName, int RandomInt)
		{
			Type type = Type.GetType(StateName);
			StateTransition stateTransition = (StateTransition)Activator.CreateInstance(type);
			stateTransition.enemyIndex = WTOEnemyID;
			if (!(stateTransition.NextState().GetType() == ActiveState.GetType()))
			{
				LogMessage($"{((NetworkBehaviour)this).__getTypeName()} #{WTOEnemyID} is Exiting:  {ActiveState}");
				ActiveState.OnStateExit(WTOEnemyID, enemyRandom, base.creatureAnimator);
				LogMessage($"{((NetworkBehaviour)this).__getTypeName()} #{WTOEnemyID} is Transitioning via:  {stateTransition}");
				ActiveState = stateTransition.NextState();
				ActiveState.MyRandomInt = RandomInt;
				ActiveState.enemyIndex = WTOEnemyID;
				LogMessage($"{((NetworkBehaviour)this).__getTypeName()} #{WTOEnemyID} is Entering:  {ActiveState}");
				ActiveState.OnStateEntered(WTOEnemyID, enemyRandom, base.creatureAnimator);
				StartOfRound.Instance.ClientPlayerList.TryGetValue(NetworkManager.Singleton.LocalClientId, out var value);
				LogMessage($"CREATURE: {((Object)base.enemyType).name} #{WTOEnemyID} STATE: {ActiveState} ON PLAYER: #{value} ({StartOfRound.Instance.allPlayerScripts[value].playerUsername})");
			}
		}

		internal void LowerTimerValue(ref float Timer)
		{
			if (Timer != 0f)
			{
				Timer -= Time.deltaTime;
			}
		}

		internal void OverrideState(BehaviorState state)
		{
			ActiveState = state;
			ActiveState.OnStateEntered(WTOEnemyID, enemyRandom, base.creatureAnimator);
		}

		internal float DistanceFromPlayer(PlayerControllerB player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return Vector3.Distance(((Component)player).transform.position, ((Component)this).transform.position);
		}

		internal bool AnimationIsFinished(string AnimName)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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)
			AnimatorStateInfo currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
			if (!((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName(AnimName))
			{
				LogMessage(((NetworkBehaviour)this).__getTypeName() + ": Checking for animation " + AnimName + ", but current animation is " + ((Object)((AnimatorClipInfo)(ref base.creatureAnimator.GetCurrentAnimatorClipInfo(0)[0])).clip).name);
				return true;
			}
			currentAnimatorStateInfo = base.creatureAnimator.GetCurrentAnimatorStateInfo(0);
			return ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime >= 1f;
		}

		[ServerRpc]
		internal void SetAnimTriggerOnServerRpc(string name)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(670847578u, val, (RpcDelivery)0);
				bool flag = name != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives