Decompiled source of Moai Enemy v2.3.8

MoaiEnemy.dll

Decompiled 2 weeks 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.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using MoaiEnemy.NetcodePatcher;
using MoaiEnemy.src.MoaiGold;
using MoaiEnemy.src.MoaiGreen;
using MoaiEnemy.src.MoaiNormal;
using MoaiEnemy.src.Utilities;
using On;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("bcs4313")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Moai Enemy for Lethal Company.")]
[assembly: AssemblyFileVersion("1.6.6")]
[assembly: AssemblyInformationalVersion("2.2.5+de30a7b4fd06f505c14721da353043ab3517b186")]
[assembly: AssemblyProduct("MoaiEnemy")]
[assembly: AssemblyTitle("MoaiEnemy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.6.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MoaiEnemy
{
	internal class ConfigModel
	{
		public static ConfigEntry<float> moaiGlobalSize;

		public static ConfigEntry<float> moaiGlobalMusicVol;

		public static ConfigEntry<float> moaiGlobalRarity;

		public static ConfigEntry<float> moaiGlobalSpeed;

		public static void setupConfig()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0028: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_002e: 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_003e: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0078: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//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_008e: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a0: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			ConfigEntry<float> obj = moaiGlobalSize;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = 0.05f;
			((BaseRangeOptions<float>)val).Max = 5f;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(obj, val);
			ConfigEntry<float> obj2 = moaiGlobalMusicVol;
			FloatSliderOptions val3 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = 2f;
			FloatSliderConfigItem val4 = new FloatSliderConfigItem(obj2, val3);
			ConfigEntry<float> obj3 = moaiGlobalRarity;
			FloatSliderOptions val5 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val5).Min = 0f;
			((BaseRangeOptions<float>)val5).Max = 10f;
			FloatSliderConfigItem val6 = new FloatSliderConfigItem(obj3, val5);
			ConfigEntry<float> obj4 = moaiGlobalSpeed;
			FloatSliderOptions val7 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val7).Min = 0f;
			((BaseRangeOptions<float>)val7).Max = 5f;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj4, val7);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("MoaiEnemy", "MoaiEnemy", "2.2.5")]
	public class Plugin : BaseUnityPlugin
	{
		public static class Assets
		{
			public static AssetBundle MainAssetBundle;

			public static void PopulateAssets()
			{
				string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "moaibundle"));
				if ((Object)(object)MainAssetBundle == (Object)null)
				{
					Logger.LogError((object)"Failed to load custom assets.");
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_LoadNewLevel <>9__24_0;

			internal void <Awake>b__24_0(orig_LoadNewLevel orig, RoundManager self, int randomSeed, SelectableLevel newLevel)
			{
				if (newLevel.PlanetName.Contains("Easter"))
				{
					rawSpawnMultiplier = RawspawnHandler.getSpawnMultiplier(pickMax: true);
				}
				else
				{
					rawSpawnMultiplier = RawspawnHandler.getSpawnMultiplier();
				}
				RawspawnHandler.enemyRarityPkg enemyRarityPkg = default(RawspawnHandler.enemyRarityPkg);
				enemyRarityPkg.name = ((Object)MoaiEnemy).name;
				enemyRarityPkg.rarity = (int)(70f * baseRarity.Value * rawSpawnMultiplier);
				RawspawnHandler.enemyRarityPkg enemyRarityPkg2 = default(RawspawnHandler.enemyRarityPkg);
				enemyRarityPkg2.name = ((Object)MoaiGreen).name;
				enemyRarityPkg2.rarity = (int)(40f * greenRarity.Value * rawSpawnMultiplier);
				RawspawnHandler.enemyRarityPkg enemyRarityPkg3 = default(RawspawnHandler.enemyRarityPkg);
				enemyRarityPkg3.name = ((Object)MoaiBlue).name;
				enemyRarityPkg3.rarity = (int)(30f * blueRarity.Value * rawSpawnMultiplier);
				RawspawnHandler.enemyRarityPkg enemyRarityPkg4 = default(RawspawnHandler.enemyRarityPkg);
				enemyRarityPkg4.name = ((Object)MoaiRed).name;
				enemyRarityPkg4.rarity = (int)(50f * redRarity.Value * rawSpawnMultiplier);
				RawspawnHandler.enemyRarityPkg enemyRarityPkg5 = default(RawspawnHandler.enemyRarityPkg);
				enemyRarityPkg5.name = ((Object)MoaiGold).name;
				enemyRarityPkg5.rarity = (int)(3f * goldRarity.Value * rawSpawnMultiplier);
				RawspawnHandler.setLevelSpawnWeights(new RawspawnHandler.enemyRarityPkg[5] { enemyRarityPkg, enemyRarityPkg5, enemyRarityPkg3, enemyRarityPkg4, enemyRarityPkg2 }, Array.Empty<RawspawnHandler.enemyRarityPkg>());
				orig.Invoke(self, randomSeed, newLevel);
				try
				{
					GreenEnemyAI.getMapObjects();
					GreenEnemyAI.findTraps();
					EntityWarp.mapEntrances = Object.FindObjectsOfType<EntranceTeleport>(false);
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("Moai Enemy: Error during map initialization process. " + ex.ToString()));
				}
			}
		}

		public static Harmony _harmony;

		public static EnemyType ExampleEnemy;

		public static ManualLogSource Logger;

		public static MoaiNormalNet networkHandler = new MoaiNormalNet();

		public static EnemyType MoaiEnemy;

		public static TerminalNode tlTerminalNode;

		public static TerminalKeyword tlTerminalKeyword;

		public static EnemyType MoaiBlue;

		public static TerminalNode MoaiBlueTerminalNode;

		public static TerminalKeyword MoaiBlueTerminalKeyword;

		public static EnemyType MoaiRed;

		public static TerminalNode MoaiRedTerminalNode;

		public static TerminalKeyword MoaiRedTerminalKeyword;

		public static EnemyType MoaiGreen;

		public static TerminalNode MoaiGreenTerminalNode;

		public static TerminalKeyword MoaiGreenTerminalKeyword;

		public static GameObject plasmaProjectile;

		public static GameObject consumptionCircle;

		public static EnemyType MoaiGold;

		public static TerminalNode MoaiGoldTerminalNode;

		public static TerminalKeyword MoaiGoldTerminalKeyword;

		public static float rawSpawnMultiplier = 0f;

		public static ConfigEntry<float> moaiGlobalSize;

		public static ConfigEntry<float> moaiGlobalSizeVar;

		public static ConfigEntry<float> moaiSizeCap;

		public static ConfigEntry<float> moaiGlobalMusicVol;

		public static ConfigEntry<float> moaiGlobalSpeed;

		public static ConfigEntry<string> moaiSpawnDistribution;

		public static ConfigEntry<float> baseRarity;

		public static ConfigEntry<float> blueRarity;

		public static ConfigEntry<float> redRarity;

		public static ConfigEntry<float> greenRarity;

		public static ConfigEntry<float> goldRarity;

		public static void LogDebug(string text)
		{
			Logger.LogInfo((object)text);
		}

		public static void LogProduction(string text)
		{
			Logger.LogInfo((object)text);
		}

		private void Awake()
		{
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Assets.PopulateAssets();
			bindVars();
			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);
					}
				}
			}
			MoaiEnemy = Assets.MainAssetBundle.LoadAsset<EnemyType>("MoaiEnemy");
			tlTerminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("MoaiEnemyTN");
			tlTerminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("MoaiEnemyTK");
			MoaiBlue = Assets.MainAssetBundle.LoadAsset<EnemyType>("MoaiBlue");
			MoaiBlueTerminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("MoaiBlueTN");
			MoaiBlueTerminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("MoaiBlueTK");
			MoaiRed = Assets.MainAssetBundle.LoadAsset<EnemyType>("MoaiRed");
			MoaiRedTerminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("MoaiRedTN");
			MoaiRedTerminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("MoaiRedTK");
			MoaiGreen = Assets.MainAssetBundle.LoadAsset<EnemyType>("MoaiGreen");
			MoaiGreenTerminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("MoaiGreenTN");
			MoaiGreenTerminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("MoaiGreenTK");
			MoaiGold = Assets.MainAssetBundle.LoadAsset<EnemyType>("MoaiGold");
			MoaiGoldTerminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("MoaiGoldTN");
			MoaiGoldTerminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("MoaiGoldTK");
			plasmaProjectile = Assets.MainAssetBundle.LoadAsset<GameObject>("PlasmaBall01");
			consumptionCircle = Assets.MainAssetBundle.LoadAsset<GameObject>("ConsumptionCircle");
			Debug.Log((object)("MOAI ENEMY BUNDLE: " + ((object)Assets.MainAssetBundle).ToString()));
			Debug.Log((object)("MOAI GOLD: " + (object)MoaiGold));
			Debug.Log((object)("MOAI GOLD TN: " + (object)MoaiGoldTerminalNode));
			Debug.Log((object)("MOAI GOLD TK: " + (object)MoaiGoldTerminalKeyword));
			Random.InitState((int)DateTime.Now.Ticks);
			NetworkPrefabs.RegisterNetworkPrefab(MoaiEnemy.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(MoaiBlue.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(MoaiRed.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(MoaiGreen.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(MoaiGold.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(plasmaProjectile);
			NetworkPrefabs.RegisterNetworkPrefab(consumptionCircle);
			rawSpawnMultiplier = RawspawnHandler.getSpawnMultiplier();
			Enemies.RegisterEnemy(MoaiEnemy, 0, (LevelTypes)(-1), (SpawnType)1, tlTerminalNode, tlTerminalKeyword);
			Enemies.RegisterEnemy(MoaiBlue, 0, (LevelTypes)(-1), (SpawnType)1, MoaiBlueTerminalNode, MoaiBlueTerminalKeyword);
			Enemies.RegisterEnemy(MoaiRed, 0, (LevelTypes)(-1), (SpawnType)1, MoaiRedTerminalNode, MoaiRedTerminalKeyword);
			Enemies.RegisterEnemy(MoaiGreen, 0, (LevelTypes)(-1), (SpawnType)1, MoaiGreenTerminalNode, MoaiGreenTerminalKeyword);
			Enemies.RegisterEnemy(MoaiGold, 0, (LevelTypes)(-1), (SpawnType)1, MoaiGreenTerminalNode, MoaiGreenTerminalKeyword);
			Debug.Log((object)"MOAI: Registering Moai Net Messages");
			networkHandler.setup();
			object obj = <>c.<>9__24_0;
			if (obj == null)
			{
				hook_LoadNewLevel val = delegate(orig_LoadNewLevel orig, RoundManager self, int randomSeed, SelectableLevel newLevel)
				{
					if (newLevel.PlanetName.Contains("Easter"))
					{
						rawSpawnMultiplier = RawspawnHandler.getSpawnMultiplier(pickMax: true);
					}
					else
					{
						rawSpawnMultiplier = RawspawnHandler.getSpawnMultiplier();
					}
					RawspawnHandler.enemyRarityPkg enemyRarityPkg = default(RawspawnHandler.enemyRarityPkg);
					enemyRarityPkg.name = ((Object)MoaiEnemy).name;
					enemyRarityPkg.rarity = (int)(70f * baseRarity.Value * rawSpawnMultiplier);
					RawspawnHandler.enemyRarityPkg enemyRarityPkg2 = default(RawspawnHandler.enemyRarityPkg);
					enemyRarityPkg2.name = ((Object)MoaiGreen).name;
					enemyRarityPkg2.rarity = (int)(40f * greenRarity.Value * rawSpawnMultiplier);
					RawspawnHandler.enemyRarityPkg enemyRarityPkg3 = default(RawspawnHandler.enemyRarityPkg);
					enemyRarityPkg3.name = ((Object)MoaiBlue).name;
					enemyRarityPkg3.rarity = (int)(30f * blueRarity.Value * rawSpawnMultiplier);
					RawspawnHandler.enemyRarityPkg enemyRarityPkg4 = default(RawspawnHandler.enemyRarityPkg);
					enemyRarityPkg4.name = ((Object)MoaiRed).name;
					enemyRarityPkg4.rarity = (int)(50f * redRarity.Value * rawSpawnMultiplier);
					RawspawnHandler.enemyRarityPkg enemyRarityPkg5 = default(RawspawnHandler.enemyRarityPkg);
					enemyRarityPkg5.name = ((Object)MoaiGold).name;
					enemyRarityPkg5.rarity = (int)(3f * goldRarity.Value * rawSpawnMultiplier);
					RawspawnHandler.setLevelSpawnWeights(new RawspawnHandler.enemyRarityPkg[5] { enemyRarityPkg, enemyRarityPkg5, enemyRarityPkg3, enemyRarityPkg4, enemyRarityPkg2 }, Array.Empty<RawspawnHandler.enemyRarityPkg>());
					orig.Invoke(self, randomSeed, newLevel);
					try
					{
						GreenEnemyAI.getMapObjects();
						GreenEnemyAI.findTraps();
						EntityWarp.mapEntrances = Object.FindObjectsOfType<EntranceTeleport>(false);
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)("Moai Enemy: Error during map initialization process. " + ex.ToString()));
					}
				};
				<>c.<>9__24_0 = val;
				obj = (object)val;
			}
			RoundManager.LoadNewLevel += (hook_LoadNewLevel)obj;
			Logger.LogInfo((object)"Plugin MoaiEnemy is loaded!");
		}

		public void bindVars()
		{
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Expected O, but got Unknown
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01bc: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			//IL_01ec: Expected O, but got Unknown
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Expected O, but got Unknown
			//IL_021c: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_024c: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Expected O, but got Unknown
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Expected O, but got Unknown
			//IL_027c: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Expected O, but got Unknown
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02c6: Expected O, but got Unknown
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Expected O, but got Unknown
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_02f7: Expected O, but got Unknown
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Expected O, but got Unknown
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Expected O, but got Unknown
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Expected O, but got Unknown
			//IL_0328: Expected O, but got Unknown
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Expected O, but got Unknown
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Expected O, but got Unknown
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Expected O, but got Unknown
			//IL_0359: Expected O, but got Unknown
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Expected O, but got Unknown
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Expected O, but got Unknown
			//IL_038a: Expected O, but got Unknown
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Expected O, but got Unknown
			moaiGlobalMusicVol = ((BaseUnityPlugin)this).Config.Bind<float>("Global", "Enemy Sound Volume", 0.6f, "Changes the volume of all moai sounds. May make moai more sneaky as well.");
			moaiGlobalSizeVar = ((BaseUnityPlugin)this).Config.Bind<float>("Global", "Size Variant Chance", 0.2f, "The chance of a moai to spawn in a randomly scaled size. Affects their pitch too.");
			moaiGlobalSize = ((BaseUnityPlugin)this).Config.Bind<float>("Global", "Size Multiplier", 1f, "Changes the size of all moai models. Scales pretty violently. Affects SFX pitch.");
			moaiSizeCap = ((BaseUnityPlugin)this).Config.Bind<float>("Advanced", "Size Variant Cap", 100f, "Caps the max size of a moai with the size variant. Normal size is 1. 1.5 is slightly taller than the ship. 2 is very large. 3.5+ is giant tier (with 5 being the largest usually)");
			moaiGlobalSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Global", "Enemy Speed Multiplier", 1f, "Changes the speed of all moai. 4x would mean they are 4 times faster, 0.5x would be 2 times slower.");
			moaiSpawnDistribution = ((BaseUnityPlugin)this).Config.Bind<string>("Advanced", "Enemy Spawn Distribution", "4%100%, 6%50%, 10%25%", "For fine tuning spawn multipliers day to day. Value is a comma separated list. Each value follows the format C%M%, with C being the chance for the spawnrate multiplier to activate on a day (0-100%) and M being the multiplier (0-inf%). If a multiplier isn't activated, the spawnrate will be 0%.");
			baseRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Variants", "Basic Moai Spawnrate", 1f, "Changes the spawnrate of the variant.");
			blueRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Variants", "Blue Moai Spawnrate", 1f, "Changes the spawnrate of the variant.");
			redRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Variants", "Red Moai Spawnrate", 1f, "Changes the spawnrate of the variant.");
			greenRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Variants", "Green Moai Spawnrate", 1f, "Changes the spawnrate of the variant.");
			goldRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Variants", "Gold Moai Spawnrate", 1f, "Changes the spawnrate of the variant.");
			ConfigEntry<float> obj = moaiGlobalSize;
			FloatSliderOptions val = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val).Min = 0.05f;
			((BaseRangeOptions<float>)val).Max = 5f;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(obj, val);
			ConfigEntry<float> obj2 = moaiGlobalSizeVar;
			FloatSliderOptions val3 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = 1f;
			FloatSliderConfigItem val4 = new FloatSliderConfigItem(obj2, val3);
			ConfigEntry<float> obj3 = moaiSizeCap;
			FloatInputFieldOptions val5 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val5).Min = 0.01f;
			((BaseRangeOptions<float>)val5).Max = 100f;
			FloatInputFieldConfigItem val6 = new FloatInputFieldConfigItem(obj3, val5);
			ConfigEntry<float> obj4 = moaiGlobalMusicVol;
			FloatSliderOptions val7 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val7).Min = 0f;
			((BaseRangeOptions<float>)val7).Max = 1f;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj4, val7);
			ConfigEntry<float> obj5 = moaiGlobalSpeed;
			FloatSliderOptions val9 = new FloatSliderOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val9).Min = 0f;
			((BaseRangeOptions<float>)val9).Max = 5f;
			FloatSliderConfigItem val10 = new FloatSliderConfigItem(obj5, val9);
			TextInputFieldConfigItem val11 = new TextInputFieldConfigItem(moaiSpawnDistribution, new TextInputFieldOptions
			{
				RequiresRestart = false
			});
			ConfigEntry<float> obj6 = baseRarity;
			FloatInputFieldOptions val12 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val12).Min = 0f;
			((BaseRangeOptions<float>)val12).Max = 10000f;
			FloatInputFieldConfigItem val13 = new FloatInputFieldConfigItem(obj6, val12);
			ConfigEntry<float> obj7 = greenRarity;
			FloatInputFieldOptions val14 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val14).Min = 0f;
			((BaseRangeOptions<float>)val14).Max = 10000f;
			FloatInputFieldConfigItem val15 = new FloatInputFieldConfigItem(obj7, val14);
			ConfigEntry<float> obj8 = redRarity;
			FloatInputFieldOptions val16 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val16).Min = 0f;
			((BaseRangeOptions<float>)val16).Max = 10000f;
			FloatInputFieldConfigItem val17 = new FloatInputFieldConfigItem(obj8, val16);
			ConfigEntry<float> obj9 = blueRarity;
			FloatInputFieldOptions val18 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val18).Min = 0f;
			((BaseRangeOptions<float>)val18).Max = 10000f;
			FloatInputFieldConfigItem val19 = new FloatInputFieldConfigItem(obj9, val18);
			ConfigEntry<float> obj10 = goldRarity;
			FloatInputFieldOptions val20 = new FloatInputFieldOptions
			{
				RequiresRestart = false
			};
			((BaseRangeOptions<float>)val20).Min = 0f;
			((BaseRangeOptions<float>)val20).Max = 10000f;
			FloatInputFieldConfigItem val21 = new FloatInputFieldConfigItem(obj10, val20);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val13);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val19);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val17);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val11);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val15);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val21);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "MoaiEnemy";

		public const string PLUGIN_NAME = "MoaiEnemy";

		public const string PLUGIN_VERSION = "2.2.5";
	}
}
namespace MoaiEnemy.src.Utilities
{
	internal class EntityWarp
	{
		public struct entrancePack
		{
			public EntranceTeleport tele;

			public Vector3 navPosition;
		}

		public static EntranceTeleport[] mapEntrances;

		public static entrancePack findNearestEntrance(EnemyAI __instance)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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)
			//IL_00cc: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			float num = 100000000f;
			EntranceTeleport val = null;
			EntranceTeleport[] array = mapEntrances;
			for (int i = 0; i < array.Length; i++)
			{
				if (__instance.isOutside == array[i].isEntranceToBuilding && Vector3.Distance(((Component)__instance).transform.position, ((Component)array[i]).transform.position) < num)
				{
					num = Vector3.Distance(((Component)__instance).transform.position, ((Component)array[i]).transform.position);
					val = array[i];
				}
			}
			entrancePack result = default(entrancePack);
			NavMeshHit val2 = default(NavMeshHit);
			if ((Object)(object)val != (Object)null && NavMesh.SamplePosition(((Component)val).transform.position, ref val2, 10f, -1))
			{
				result.navPosition = ((NavMeshHit)(ref val2)).position;
			}
			result.tele = val;
			return result;
		}

		public static void SendEnemyInside(EnemyAI __instance)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = false;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("AINode");
			EntranceTeleport tele = findNearestEntrance(__instance).tele;
			if (!Object.op_Implicit((Object)(object)tele))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport.");
			}
			Transform entrancePoint = tele.entrancePoint;
			if (!Object.op_Implicit((Object)(object)entrancePoint))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position.");
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1))
			{
				__instance.serverPosition = ((NavMeshHit)(ref val)).position;
				((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position;
				__instance.agent.Warp(__instance.serverPosition);
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position");
			}
		}

		public static Transform findExitPoint(EntranceTeleport referenceDoor)
		{
			return referenceDoor.exitPoint;
		}

		public static void SendEnemyOutside(EnemyAI __instance, bool SpawnOnDoor = true)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			__instance.isOutside = true;
			__instance.allAINodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			EntranceTeleport tele = findNearestEntrance(__instance).tele;
			if (!Object.op_Implicit((Object)(object)tele))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find entrance teleport.");
			}
			Transform entrancePoint = tele.entrancePoint;
			if (!Object.op_Implicit((Object)(object)entrancePoint))
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find best exit position.");
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)entrancePoint).transform.position, ref val, 10f, -1))
			{
				__instance.serverPosition = ((NavMeshHit)(ref val)).position;
				((Component)__instance).transform.position = ((NavMeshHit)(ref val)).position;
				__instance.agent.Warp(__instance.serverPosition);
				__instance.SyncPositionToClients();
			}
			else
			{
				Debug.LogError((object)"MOAI EntranceTeleport: Failed to find exit NavmeshHit position");
			}
		}
	}
	public class RawspawnHandler
	{
		public struct enemyRarityPkg
		{
			public string name;

			public int rarity;
		}

		public static void setLevelSpawnWeights(enemyRarityPkg[] dayReferences, enemyRarityPkg[] nightReferences)
		{
			RoundManager instance = RoundManager.Instance;
			SelectableLevel currentLevel = instance.currentLevel;
			for (int i = 0; i < currentLevel.DaytimeEnemies.Count; i++)
			{
				SpawnableEnemyWithRarity val = currentLevel.DaytimeEnemies[i];
				for (int j = 0; j < dayReferences.Length; j++)
				{
					enemyRarityPkg enemyRarityPkg = dayReferences[j];
					if (((Object)val.enemyType).name.Equals(enemyRarityPkg.name))
					{
						currentLevel.DaytimeEnemies[i].rarity = enemyRarityPkg.rarity;
					}
				}
			}
			for (int k = 0; k < currentLevel.OutsideEnemies.Count; k++)
			{
				SpawnableEnemyWithRarity val2 = currentLevel.OutsideEnemies[k];
				for (int l = 0; l < nightReferences.Length; l++)
				{
					enemyRarityPkg enemyRarityPkg2 = nightReferences[l];
					if (((Object)val2.enemyType).name.Equals(enemyRarityPkg2.name))
					{
						currentLevel.OutsideEnemies[k].rarity = enemyRarityPkg2.rarity;
					}
				}
			}
		}

		public static float getSpawnMultiplier(bool pickMax = false)
		{
			float num = 0f;
			float num2 = Random.Range(0f, 1f);
			List<float> list = new List<float>();
			List<float> list2 = new List<float>();
			string value = Plugin.moaiSpawnDistribution.Value;
			string[] array = value.Split(",");
			try
			{
				string[] array2 = array;
				foreach (string text in array2)
				{
					string[] array3 = text.Split("%");
					list.Add(float.Parse(array3[0]) / 100f);
					list2.Add(float.Parse(array3[1]) / 100f);
				}
				if (pickMax)
				{
					float num3 = 0f;
					for (int j = 0; j < list2.Count; j++)
					{
						float num4 = list2[j];
						if (num4 > num3)
						{
							num3 = num4;
							num = num4;
						}
					}
				}
				else
				{
					float num5 = 0f;
					for (int k = 0; k < list.Count; k++)
					{
						float num6 = list[k];
						float num7 = list2[k];
						if (num2 > num5 && num2 < num6 + num5)
						{
							num = num7;
							break;
						}
						num5 += num6;
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Moai Enemy: Exception when parsing spawn distribution chances! Error is: " + ex.ToString()));
			}
			Debug.Log((object)"Moai Enemy: Spawn Distribution Parsed is -->");
			if (pickMax)
			{
				Debug.Log((object)"Moai Enemy: Picked largest spawn multiplier due to being in easter island.");
				Debug.Log((object)"Moai Enemy: Multipliers:");
				Debug.Log((object)string.Join(",", list2));
				Debug.Log((object)("Moai Enemy: Selected multiplier for the day is " + num * 100f + "%"));
			}
			else
			{
				Debug.Log((object)"Moai Enemy: Chances:");
				Debug.Log((object)string.Join(",", list));
				Debug.Log((object)"Moai Enemy: Multipliers:");
				Debug.Log((object)string.Join(",", list2));
				Debug.Log((object)"Moai Enemy: Random chance roll:");
				Debug.Log((object)num2);
				Debug.Log((object)("Moai Enemy: Selected multiplier for the day is " + num * 100f + "%"));
			}
			return num;
		}
	}
}
namespace MoaiEnemy.src.MoaiGreen
{
	public class NavMeshSpaceChecker : MonoBehaviour
	{
		public GameObject prefabToPlace;

		public LayerMask navMeshLayer;

		public static bool CanPlacePrefab(string target, Vector3 position, SpawnableOutsideObject obj = null)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			Vector3 prefabSize = GetPrefabSize(target, obj);
			NavMeshHit val = default(NavMeshHit);
			if (!NavMesh.SamplePosition(position, ref val, 1f, -1))
			{
				Debug.LogWarning((object)"Moai: - NavMeshSpaceChecker Position is not on NavMesh.");
				return false;
			}
			Vector3 val2 = prefabSize * 0.5f;
			Vector3 val3 = position + val2;
			NavMeshPath val4 = new NavMeshPath();
			if (!NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, val3, -1, val4))
			{
				Vector3 val5 = position;
				Debug.LogWarning((object)("Not enough space to place prefab " + target + " at position: " + ((object)(Vector3)(ref val5)).ToString()));
				return false;
			}
			GameObject val6 = GameObject.Find("HangarShip");
			if (Object.op_Implicit((Object)(object)val6))
			{
				if (Vector3.Distance(val6.transform.position, position) < 30f)
				{
					return false;
				}
			}
			else
			{
				Debug.LogWarning((object)"Moai - NavMeshSpaceChecker - Can not find HangarShip");
			}
			return true;
		}

		private static Vector3 GetPrefabSize(string prefab, SpawnableOutsideObject obj = null)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			return (Vector3)(prefab switch
			{
				"Turret" => new Vector3(1f, 1.22f, 1f) + new Vector3(0.73f, 0f, 0.36f) * 1.4f, 
				"Mine" => new Vector3(1f, 1.22f, 1f) + new Vector3(0.73f, 0f, 0.36f) * 1.4f, 
				"Circle" => new Vector3(18f, 8f, 18f) + new Vector3(0.73f, 0f, 0.36f) * 1.4f, 
				"MapObject" => new Vector3((float)obj.objectWidth, (float)obj.objectWidth, (float)obj.objectWidth), 
				_ => Vector3.one, 
			});
		}

		public static Vector3 GetRandomNavMeshPoint(float sampleRadius, Vector3 refPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = refPosition;
			Vector3 val = Random.insideUnitSphere * sampleRadius;
			val += refPosition;
			NavMeshHit val2 = default(NavMeshHit);
			if (NavMesh.SamplePosition(val, ref val2, sampleRadius, -1))
			{
				result = ((NavMeshHit)(ref val2)).position;
			}
			return result;
		}
	}
}
namespace MoaiEnemy.src.MoaiGold
{
	internal class GoldInteract : NetworkBehaviour
	{
		public GoldEnemyAI moai;

		public InteractTrigger triggerLink;

		public void interactAction()
		{
			commandMoaiServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		public void commandMoaiServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3486980499u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3486980499u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			switch (moai.currentCommand)
			{
			case "Guard":
				moai.searchStatus = "Searching";
				moai.currentCommand = "Loot";
				break;
			case "Loot":
				moai.searchStatus = "Searching";
				moai.currentCommand = "Guard";
				((EnemyAI)moai).SwitchToBehaviourClientRpc(1);
				moai.stopAllSoundsClientRpc();
				break;
			case "Done":
				moai.searchStatus = "Searching";
				moai.currentCommand = "Guard";
				moai.stopAllSoundsClientRpc();
				((EnemyAI)moai).SwitchToBehaviourClientRpc(1);
				if (Object.op_Implicit((Object)(object)moai.holdingItem))
				{
					moai.detachItemClientRpc(((NetworkBehaviour)moai.holdingItem).NetworkObject.NetworkObjectId);
				}
				break;
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_GoldInteract()
		{
			//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(3486980499u, new RpcReceiveHandler(__rpc_handler_3486980499));
		}

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

		protected internal override string __getTypeName()
		{
			return "GoldInteract";
		}
	}
}
namespace MoaiEnemy.src.MoaiNormal
{
	internal class GoldEnemyAI : MOAIAICORE
	{
		private new enum State
		{
			SearchingForPlayer,
			Guard,
			StickingInFrontOfEnemy,
			StickingInFrontOfPlayer,
			HeadSwingAttackInProgress,
			HeadingToEntrance,
			Scavenging,
			PickingUpItem,
			ReportingToPlayer
		}

		public string currentCommand = "Guard";

		public string searchStatus = "Searching";

		public GrabbableObject holdingItem = null;

		public PlayerControllerB holdingCorpse = null;

		public GoldInteract interactNode;

		public AudioSource creatureUh;

		public AudioSource creatureInteract;

		public AudioSource creatureTalk;

		public override void Start()
		{
			baseInit();
			creatureUh.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureInteract.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureTalk.volume = Plugin.moaiGlobalMusicVol.Value;
		}

		public override void setPitches(float pitchAlter)
		{
			AudioSource obj = creatureUh;
			obj.pitch /= pitchAlter;
			AudioSource obj2 = creatureInteract;
			obj2.pitch /= pitchAlter;
			AudioSource obj3 = creatureTalk;
			obj3.pitch /= pitchAlter;
		}

		public override void Update()
		{
			((EnemyAI)this).Update();
			baseUpdate();
			if (((EnemyAI)this).isEnemyDead)
			{
				creatureUh.Stop();
			}
		}

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

		public override void DoAIInterval()
		{
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Invalid comparison between Unknown and I4
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: Invalid comparison between Unknown and I4
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			if (provokePoints > 0)
			{
				goodBoy = 0;
			}
			else
			{
				goodBoy = 1000;
			}
			((EnemyAI)this).DoAIInterval();
			baseAIInterval();
			((EnemyAI)this).agent.speed = 5f * Plugin.moaiGlobalSpeed.Value;
			if (currentCommand.Equals("Done") && !creatureUh.isPlaying)
			{
				playUhSoundClientRpc();
			}
			else if (!currentCommand.Equals("Done"))
			{
				stopUhSoundClientRpc();
			}
			if (currentCommand.Equals("Loot"))
			{
				if (!interactNode.triggerLink.hoverTip.Equals("Command to Guard: [LMB]"))
				{
					updateToolTipClientRpc("Command to Guard: [LMB]");
				}
			}
			else if (currentCommand.Equals("Done"))
			{
				if (!interactNode.triggerLink.hoverTip.Equals("Command to Drop Item [LMB]"))
				{
					updateToolTipClientRpc("Command to Drop Item [LMB]");
				}
			}
			else if (!interactNode.triggerLink.hoverTip.Equals("Command to Loot Factory: [LMB]"))
			{
				updateToolTipClientRpc("Command to Loot Factory: [LMB]");
			}
			if (currentCommand.Equals("Guard") && ((EnemyAI)this).isOutside == mostRecentPlayer.isInsideFactory)
			{
				((EnemyAI)this).SwitchToBehaviourClientRpc(5);
			}
			switch (((EnemyAI)this).currentBehaviourStateIndex)
			{
			case 0:
				baseSearchingForPlayer();
				break;
			case 5:
				if (!((EnemyAI)this).creatureVoice.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureVoice");
				}
				if (searchStatus.Equals("Searching") && ((EnemyAI)this).isOutside)
				{
					baseHeadingToEntrance();
				}
				else if (searchStatus.Equals("Returning") && ((EnemyAI)this).isOutside == mostRecentPlayer.isInsideFactory)
				{
					baseHeadingToEntrance();
				}
				else if (currentCommand.Equals("Done") && ((EnemyAI)this).isOutside == mostRecentPlayer.isInsideFactory)
				{
					baseHeadingToEntrance();
				}
				else if (currentCommand.Equals("Guard") && ((EnemyAI)this).isOutside == mostRecentPlayer.isInsideFactory)
				{
					baseHeadingToEntrance();
				}
				else
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				if (!((EnemyAI)this).creatureVoice.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureVoice");
				}
				if (currentCommand.Equals("Done"))
				{
					baseGuard(goldMode: true);
				}
				else
				{
					baseGuard();
				}
				if (currentCommand.Equals("Loot"))
				{
					if (((EnemyAI)this).isOutside)
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(5);
					}
					else
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(6);
					}
				}
				break;
			case 6:
			{
				if (!((EnemyAI)this).creatureVoice.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureVoice");
				}
				((EnemyAI)this).targetPlayer = null;
				((EnemyAI)this).agent.speed = 4f * Plugin.moaiGlobalSpeed.Value;
				if (guardTarget == Vector3.zero)
				{
					impatience = 0f;
					wait = 10f;
					guardTarget = pickLootSearchNode().transform.position;
				}
				((EnemyAI)this).SetDestinationToPosition(guardTarget, false);
				float num = Vector3.Distance(((Component)this).transform.position, guardTarget);
				Vector3 localScale = ((Component)this).transform.localScale;
				float magnitude = ((Vector3)(ref localScale)).magnitude;
				localScale = ((Component)this).transform.localScale;
				if (num < magnitude + ((Vector3)(ref localScale)).magnitude + impatience)
				{
					if (wait <= 0f)
					{
						guardTarget = Vector3.zero;
					}
					else
					{
						wait -= 1f;
					}
				}
				else
				{
					impatience += 0.25f;
				}
				if ((int)((EnemyAI)this).agent.pathStatus == 1 || (int)((EnemyAI)this).agent.pathStatus == 2)
				{
					guardTarget = Vector3.zero;
				}
				if (impatience == 10f)
				{
					guardTarget = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)getObj()) || corpseAvailable())
				{
					Debug.Log((object)"MOAI: found item to loot");
					((EnemyAI)this).StopSearch(((EnemyAI)this).currentSearch, true);
					impatience = 0f;
					((EnemyAI)this).SwitchToBehaviourClientRpc(7);
					break;
				}
				if (!((EnemyAI)this).creatureVoice.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureVoice");
				}
				if (goodBoy <= 0)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					Plugin.networkHandler.s_moaiHalo.SendAllClients(new MoaiNormalNet.moaiHaloPkg(((NetworkBehaviour)this).NetworkObject.NetworkObjectId, _active: false), true);
				}
				else if (Object.op_Implicit((Object)(object)ClosestEnemyInRange(5f)))
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
				break;
			}
			case 7:
			{
				eatingScrap = false;
				eatingTimer = -1;
				if (goodBoy <= 0)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					Plugin.networkHandler.s_moaiHalo.SendAllClients(new MoaiNormalNet.moaiHaloPkg(((NetworkBehaviour)this).NetworkObject.NetworkObjectId, _active: false), true);
					break;
				}
				if (Object.op_Implicit((Object)(object)ClosestEnemyInRange(5f)))
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
					break;
				}
				if (!creatureFood.isPlaying)
				{
					moaiSoundPlayClientRpc("creatureFood");
				}
				baseHeadSwingAttackInProgress(transitionOverride: true);
				GrabbableObject obj = getObj();
				PlayerControllerB playerCorpse = getPlayerCorpse();
				impatience += 1f;
				if (impatience > 100f)
				{
					unreachableItems.Add(obj);
				}
				if (eatingHuman)
				{
					searchStatus = "Returning";
					((EnemyAI)this).SwitchToBehaviourClientRpc(5);
					currentCommand = "Done";
					creatureEat.Stop();
					creatureEatHuman.Stop();
					holdingCorpse = playerCorpse;
					eatingScrap = false;
					eatingTimer = -1;
					impatience = 0f;
				}
				else if (eatingScrap)
				{
					attachItemClientRpc(((NetworkBehaviour)obj).NetworkObject.NetworkObjectId);
					searchStatus = "Returning";
					((EnemyAI)this).SwitchToBehaviourClientRpc(5);
					currentCommand = "Done";
					creatureEat.Stop();
					creatureEatHuman.Stop();
					holdingItem = obj;
					eatingScrap = false;
					eatingTimer = -1;
					impatience = 0f;
				}
				break;
			}
			case 2:
				baseStickingInFrontOfEnemy();
				break;
			case 3:
				baseStickingInFrontOfPlayer(32f);
				break;
			case 4:
				baseHeadSwingAttackInProgress();
				break;
			default:
				LogDebug("This Behavior State doesn't exist!");
				break;
			}
		}

		[ClientRpc]
		public void attachItemClientRpc(ulong netid)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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(777105181u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, netid);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 777105181u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject val3 in array)
			{
				if ((Object)(object)val3 != (Object)null && ((Object)val3).name != null && (Object)(object)((Component)val3).transform != (Object)null && ((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == netid)
				{
					val3.isHeldByEnemy = true;
					val3.isHeld = true;
					val3.hasBeenHeld = true;
					val3.EnablePhysics(false);
					((Component)val3).transform.parent = ((Component)mouth).transform;
					((Component)val3).transform.localPosition = new Vector3(0f, 0f, 0f);
				}
			}
		}

		[ClientRpc]
		public void detachItemClientRpc(ulong netid)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			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(3121421479u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, netid);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3121421479u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject val3 in array)
			{
				if ((Object)(object)val3 != (Object)null && ((Object)val3).name != null && (Object)(object)((Component)val3).transform != (Object)null && ((NetworkBehaviour)val3).NetworkObject.NetworkObjectId == netid)
				{
					Debug.Log((object)("Detaching item from gold moai: " + ((Object)val3).name));
					val3.parentObject = null;
					((Component)val3).transform.parent = null;
					val3.EnablePhysics(true);
					val3.startFallingPosition = ((Component)val3).transform.position;
					val3.targetFloorPosition = sampleObjFall(val3);
					val3.DiscardItemFromEnemy();
					val3.isHeldByEnemy = false;
					val3.isHeld = false;
				}
			}
		}

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

		public Vector3 sampleObjFall(GrabbableObject objTarget)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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)
			if (!Object.op_Implicit((Object)(object)objTarget))
			{
				return Vector3.zero;
			}
			NavMeshHit val = default(NavMeshHit);
			if (NavMesh.SamplePosition(((Component)objTarget).transform.position, ref val, 15f, -1))
			{
				return ((NavMeshHit)(ref val)).position;
			}
			return Vector3.zero;
		}

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

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

		public GameObject pickLootSearchNode()
		{
			Debug.Log((object)"MOAIGUARD: Picking Loot Node");
			return ((EnemyAI)this).allAINodes[Random.RandomRangeInt(0, ((EnemyAI)this).allAINodes.Length)];
		}

		public Vector3 generateFleeingPosition()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			//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_0030: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0046: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)this).transform.position - ((Component)((EnemyAI)this).targetPlayer).transform.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			Vector3 val2 = ((Component)this).transform.position + normalized * 5f;
			NavMeshHit val3 = default(NavMeshHit);
			if (NavMesh.SamplePosition(val2, ref val3, 15f, -1))
			{
				return ((NavMeshHit)(ref val3)).position;
			}
			return ((Component)this).transform.position;
		}

		public void facePosition(Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0043: 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)
			Vector3 val = pos - ((Component)this).transform.position;
			val.y = 0f;
			if (val != Vector3.zero)
			{
				Quaternion val2 = Quaternion.LookRotation(val);
				((Component)this).transform.rotation = Quaternion.Euler(0f, ((Quaternion)(ref val2)).eulerAngles.y, 0f);
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			base.HitEnemy(force, playerWhoHit, playHitSFX, -1);
			if (((EnemyAI)this).isEnemyDead)
			{
				return;
			}
			((EnemyAI)this).enemyHP = ((EnemyAI)this).enemyHP - force;
			if ((Object)(object)playerWhoHit != (Object)null)
			{
				provokePoints += 40 * force;
				((EnemyAI)this).targetPlayer = playerWhoHit;
			}
			stamina = 60f;
			recovering = false;
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (((EnemyAI)this).enemyHP <= 0)
				{
					((EnemyAI)this).KillEnemyOnOwnerClient(false);
					stopAllSound();
					animator.SetInteger("state", 3);
					((EnemyAI)this).isEnemyDead = true;
					moaiSoundPlayClientRpc("creatureDeath");
				}
				else
				{
					moaiSoundPlayClientRpc("creatureHit");
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_GoldEnemyAI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1140894340u, new RpcReceiveHandler(__rpc_handler_1140894340));
			NetworkManager.__rpc_func_table.Add(777105181u, new RpcReceiveHandler(__rpc_handler_777105181));
			NetworkManager.__rpc_func_table.Add(3121421479u, new RpcReceiveHandler(__rpc_handler_3121421479));
			NetworkManager.__rpc_func_table.Add(1107404285u, new RpcReceiveHandler(__rpc_handler_1107404285));
			NetworkManager.__rpc_func_table.Add(1120784331u, new RpcReceiveHandler(__rpc_handler_1120784331));
			NetworkManager.__rpc_func_table.Add(458827924u, new RpcReceiveHandler(__rpc_handler_458827924));
		}

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

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

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

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

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

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

		protected internal override string __getTypeName()
		{
			return "GoldEnemyAI";
		}
	}
	internal class GreenEnemyAI : MOAIAICORE
	{
		private struct spawnOption
		{
			private float chanceToPick;

			private bool isOutsideObj;

			private GameObject gameObject;

			private SpawnableOutsideObject outsideObject;
		}

		private new enum State
		{
			SearchingForPlayer,
			Guard,
			StickingInFrontOfEnemy,
			StickingInFrontOfPlayer,
			HeadSwingAttackInProgress,
			HeadingToEntrance,
			Constructing,
			Archery
		}

		public AudioSource creatureConstruct;

		public AudioSource creatureFinish;

		public GameObject laserPoint1;

		public GameObject laserPoint2;

		public LineRenderer lp1r;

		public LineRenderer lp2r;

		public Transform laserTarget1;

		public Transform laserTarget2;

		public GameObject consumptionCircle;

		private static GameObject landminePrefab;

		private static GameObject turretPrefab;

		public static SpawnableOutsideObject[] mapObjects;

		public static int[] mapObjectOptions;

		private int nextObject = 0;

		private double scan1 = 0.0;

		private double scan2 = 0.0;

		private int buildTimer = 0;

		private int constructionTimeLeft = 0;

		private float constructImpatience = 0.5f;

		private string currentlyBuilding = "None";

		private Vector3 constructPosition = Vector3.zero;

		private Quaternion constructRotation;

		private int constructId = 0;

		private PlayerControllerB storedTarget = null;

		private GameObject storedTargetEnemy = null;

		protected GameObject consumptionCircleMade = null;

		private int turretsLeft = 2;

		private int bodiesToMake = 0;

		private int p_ticksTillFire = 0;

		private int p_burstTickRate = 0;

		private int p_burstFire = 0;

		private int p_awaitBetweenBursts = 0;

		private int p_alternatePredict = 0;

		public AudioSource laserFire;

		public Collider col1;

		public Collider col2;

		public List<GameObject> spawnedHazards;

		public static void getMapObjects()
		{
		}

		public static void findTraps()
		{
			RoundManager instance = RoundManager.Instance;
			SpawnableMapObject[] spawnableMapObjects = instance.currentLevel.spawnableMapObjects;
			foreach (SpawnableMapObject val in spawnableMapObjects)
			{
				if (((Object)val.prefabToSpawn).name.ToLower().Contains("turret"))
				{
					turretPrefab = val.prefabToSpawn;
				}
				if (((Object)val.prefabToSpawn).name.ToLower().Contains("mine"))
				{
					landminePrefab = val.prefabToSpawn;
				}
			}
		}

		public override void Start()
		{
			baseInit();
			findTraps();
			creatureConstruct.volume = Plugin.moaiGlobalMusicVol.Value;
			creatureFinish.volume = Plugin.moaiGlobalMusicVol.Value;
			laserFire.volume = Plugin.moaiGlobalMusicVol.Value;
			buildTimer = 200;
			spawnedHazards = new List<GameObject>();
		}

		public override void OnDestroy()
		{
			for (int i = 0; i < spawnedHazards.Count; i++)
			{
				if (Object.op_Implicit((Object)(object)spawnedHazards[i]))
				{
					Object.Destroy((Object)(object)spawnedHazards[i]);
				}
			}
			base.OnDestroy();
		}

		public override void setPitches(float pitchAlter)
		{
			AudioSource obj = creatureConstruct;
			obj.pitch /= pitchAlter;
			AudioSource obj2 = creatureFinish;
			obj2.pitch /= pitchAlter;
			AudioSource obj3 = laserFire;
			obj3.pitch /= pitchAlter;
		}

		public override void Update()
		{
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			baseUpdate();
			if (((EnemyAI)this).isEnemyDead && (creatureConstruct.isPlaying || creatureFinish.isPlaying))
			{
				creatureConstruct.Stop();
				creatureFinish.Stop();
			}
			if (((EnemyAI)this).isEnemyDead)
			{
				if (laserPoint1.activeInHierarchy)
				{
					laserPoint1.SetActive(false);
					laserPoint2.SetActive(false);
				}
				return;
			}
			if ((((EnemyAI)this).currentBehaviourStateIndex == 6 || ((EnemyAI)this).currentBehaviourStateIndex == 3 || ((EnemyAI)this).currentBehaviourStateIndex == 2) && !laserPoint1.activeInHierarchy)
			{
				laserPoint1.SetActive(true);
				laserPoint2.SetActive(true);
			}
			if (buildTimer > 0 && ((EnemyAI)this).currentBehaviourStateIndex == 0)
			{
				if (!laserPoint1.activeInHierarchy)
				{
					laserPoint1.SetActive(true);
					laserPoint2.SetActive(true);
				}
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor((float)Math.Sin(scan1) * 4f, 0f, Math.Abs((float)Math.Sin(scan2) * 8f) + 4f);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor((float)Math.Cos(scan1) * 4f, 0f, Math.Abs((float)Math.Sin(scan2) * 8f) + 4f);
				Vector3 val3 = ((Component)this).transform.rotation * val;
				Vector3 val4 = ((Component)this).transform.rotation * val2;
				laserTarget1.position = ((Component)this).transform.position + val3;
				laserTarget2.position = ((Component)this).transform.position + val4;
				scan1 += enemyRandom.NextDouble() * 0.01 + 0.01;
				scan2 += enemyRandom.NextDouble() * 0.01 + 0.01;
			}
			int[] array = new int[4] { 0, 6, 3, 2 };
			if (!array.Contains(((EnemyAI)this).currentBehaviourStateIndex) && laserPoint1.activeInHierarchy)
			{
				laserPoint1.SetActive(false);
				laserPoint2.SetActive(false);
				lp1r.SetPosition(1, new Vector3(0f, 0f, 4f));
				lp2r.SetPosition(1, new Vector3(0f, 0f, 4f));
			}
			if (((NetworkBehaviour)RoundManager.Instance).IsHost)
			{
				if (((EnemyAI)this).currentBehaviourStateIndex == 3 && (Object)(object)storedTarget != (Object)null)
				{
					setLaserFocusClientRpc(((Component)storedTarget).transform.position);
					facePosition(((Component)storedTarget).transform.position);
				}
				if (((EnemyAI)this).currentBehaviourStateIndex == 2 && (Object)(object)storedTargetEnemy != (Object)null)
				{
					setLaserFocusClientRpc(storedTargetEnemy.transform.position);
					facePosition(storedTargetEnemy.transform.position);
				}
				if (buildTimer <= 0 && ((EnemyAI)this).currentBehaviourStateIndex == 0 && provokePoints <= 0)
				{
					playConstructSoundClientRpc();
					constructId = enemyRandom.Next(0, 3);
					((EnemyAI)this).SwitchToBehaviourClientRpc(6);
					pickConstructPosition();
					Debug.Log((object)("MOAI GREEN: CONSTRUCT POSITION -> " + ((object)(Vector3)(ref constructPosition)).ToString()));
					Vector3 val5 = ((Component)this).transform.position;
					Debug.Log((object)("MOAI GREEN: TRANSFORM POSITION -> " + ((object)(Vector3)(ref val5)).ToString()));
					val5 = constructPosition - ((Component)this).transform.position;
					Debug.Log((object)("MOAI GREEN: OFFSET GENERATED -> " + ((object)(Vector3)(ref val5)).ToString()));
				}
				else if (buildTimer <= 0 && ((EnemyAI)this).currentBehaviourStateIndex == 6)
				{
					setLaserFocusClientRpc(constructPosition);
				}
			}
		}

		public override void playSoundId(string id)
		{
		}

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

		public void firePlasmaProjectile(Vector3 pos, float spread, bool predictPosition, Vector3 targetVelocity)
		{
			//IL_0018: 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_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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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)
			//IL_00b9: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			if (predictPosition)
			{
				pos = PredictTargetPosition(pos, targetVelocity, 20f);
			}
			Vector3 val = pos - ((Component)mouth).transform.position + new Vector3((float)((double)(spread / 2f) - enemyRandom.NextDouble() * (double)spread), spread / 2f - (float)(enemyRandom.NextDouble() * (double)spread), spread / 2f - (float)(enemyRandom.NextDouble() * (double)spread));
			Quaternion val2 = Quaternion.identity;
			if (val != Vector3.zero)
			{
				Quaternion val3 = Quaternion.LookRotation(val);
				val2 = Quaternion.Euler(((Quaternion)(ref val3)).eulerAngles.x, ((Quaternion)(ref val3)).eulerAngles.y, ((Quaternion)(ref val3)).eulerAngles.z);
			}
			GameObject val4 = Object.Instantiate<GameObject>(Plugin.plasmaProjectile, mouth.position + ((Component)this).transform.forward * 2f, val2);
			val4.SetActive(true);
			val4.GetComponent<NetworkObject>().Spawn(false);
			val4.GetComponent<PlasmaBall>().owner = ((Object)this).GetInstanceID();
			playLaserFireClientRpc();
			Physics.IgnoreCollision(col1, (Collider)(object)val4.GetComponent<SphereCollider>());
			Physics.IgnoreCollision(col2, (Collider)(object)val4.GetComponent<SphereCollider>());
		}

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

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

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

		private Vector3 PredictTargetPosition(Vector3 targetPosition, Vector3 targetVelocity, float projectileSpeed)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//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_002d: 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)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = targetPosition - ((Component)this).transform.position;
			float magnitude = ((Vector3)(ref val)).magnitude;
			float num = magnitude / projectileSpeed;
			return targetPosition + targetVelocity * num;
		}

		public override void DoAIInterval()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0612: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_0679: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0654: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_086b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_077b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e7: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)consumptionCircleMade) && bodiesToMake > 0 && enemyRandom.NextDouble() < 0.1)
			{
				createDummyClientRpc(consumptionCircleMade.transform.position, MOAIAICORE.bdyInc, enemyRandom.Next(0, 11));
				MOAIAICORE.bdyInc++;
				bodiesToMake--;
			}
			((EnemyAI)this).DoAIInterval();
			baseAIInterval();
			buildTimer--;
			switch (((EnemyAI)this).currentBehaviourStateIndex)
			{
			case 0:
				baseSearchingForPlayer();
				setLaserColorClientRpc(1f, 1f, 1f);
				((EnemyAI)this).agent.speed = 4.2f * Plugin.moaiGlobalSpeed.Value;
				break;
			case 6: