Decompiled source of LethalAnomalies v0.3.0

BepInEx/plugins/Zeldahu.LethalAnomalies.dll

Decompiled 2 weeks ago
#define DEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DigitalRuby.ThunderAndLightning;
using GameNetcodeStuff;
using HarmonyLib;
using LethalAnomalies.Configuration;
using LethalAnomalies.External;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.VFX;
using Zeldahu.LethalAnomalies.NetcodePatcher;

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

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalAnomalies
{
	internal class ScrapBunnyAI : EnemyAI
	{
		public class BunnyType
		{
			public string name = null;

			public int pickweight = 100;

			public string scanName = null;

			public BunnyType(string name, int pickweight, string scanName)
			{
				this.name = name;
				this.pickweight = pickweight;
				this.scanName = scanName;
			}
		}

		private enum State
		{
			Roaming,
			Playful,
			Latching
		}

		public Transform turnCompass = null;

		public Transform attackArea = null;

		public BunnyType currentBunnyType = null;

		public List<BunnyType> bunnyTypesList = new List<BunnyType>
		{
			new BunnyType("Acid", 120, "Burp Bunny"),
			new BunnyType("Broken", 200, "Broken Bunny"),
			new BunnyType("Charge", 100, "Hopped-Up Hare"),
			new BunnyType("Electric", 150, "Bolt Bunny"),
			new BunnyType("Explosive", 80, "Boom Bunny"),
			new BunnyType("Heal", 60, "Happy Hare"),
			new BunnyType("Radioactive", 180, "Dust Bunny")
		};

		public ScanNodeProperties scanNode = null;

		public bool hasAttacked = false;

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

		public override void Start()
		{
			((EnemyAI)this).Start();
			PickBunnyType();
			LogIfDebugBuild("Bunny Type selected : " + currentBunnyType.scanName);
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
		}

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

		public override void DoAIInterval()
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (!base.currentSearch.inProgress)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				}
				if (!hasAttacked)
				{
					AttackClientRpc();
				}
				break;
			case 1:
				break;
			case 2:
				break;
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
		}

		public void PickBunnyType()
		{
			int num = 0;
			foreach (BunnyType bunnyTypes in bunnyTypesList)
			{
				num += bunnyTypes.pickweight;
			}
			int num2 = Random.RandomRangeInt(1, num + 1);
			foreach (BunnyType bunnyTypes2 in bunnyTypesList)
			{
				num2 -= bunnyTypes2.pickweight;
				if (num2 <= 0)
				{
					currentBunnyType = bunnyTypes2;
					scanNode.headerText = bunnyTypes2.scanName;
					break;
				}
			}
			if (currentBunnyType.name == "Charge" || currentBunnyType.name == "Heal")
			{
				scanNode.nodeType = 2;
			}
		}

		[ClientRpc]
		private void AttackClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3450315788u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3450315788u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[i];
				if (((EnemyAI)this).PlayerIsTargetable(val3, false, false) && Vector3.Distance(((Component)this).transform.position, ((Component)val3).transform.position) < 10f && !hasAttacked)
				{
					LogIfDebugBuild("Affecting player with acid");
					((Component)val3).GetComponentInChildren<DamageTypeHandler>().DamageRadioactive(40);
					hasAttacked = true;
				}
			}
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3450315788u, new RpcReceiveHandler(__rpc_handler_3450315788), "AttackClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_3450315788(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;
				((ScrapBunnyAI)(object)target).AttackClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "ScrapBunnyAI";
		}
	}
	internal class SparkTowerAI : EnemyAI
	{
		private enum State
		{
			DetectingPlayers,
			AttackAndCooldown
		}

		[CompilerGenerated]
		private sealed class <AttackCoroutine>d__42 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float attackCooldown;

			public SparkTowerAI <>4__this;

			private List<Vector3> <lightningpositions>5__1;

			private MaskedPlayerEnemy[] <array>5__2;

			private int <i>5__3;

			private int <i>5__4;

			private List<Vector3>.Enumerator <>s__5;

			private Vector3 <position>5__6;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <AttackCoroutine>d__42(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<lightningpositions>5__1 = null;
				<array>5__2 = null;
				<>s__5 = default(List<Vector3>.Enumerator);
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Expected O, but got Unknown
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Expected O, but got Unknown
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_021b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0254: 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)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0316: Unknown result type (might be due to invalid IL or missing references)
				//IL_0320: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					((EnemyAI)<>4__this).creatureAnimator.Play("Attack");
					<>4__this.attackAudio.Play();
					<>4__this.attackAudioFar.Play();
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<lightningpositions>5__1 = new List<Vector3>();
					<i>5__3 = 0;
					while (<i>5__3 < StartOfRound.Instance.connectedPlayersAmount + 1)
					{
						if (((EnemyAI)<>4__this).PlayerIsTargetable(StartOfRound.Instance.allPlayerScripts[<i>5__3], true, false) && Vector3.Distance(((Component)((EnemyAI)<>4__this).eye).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[<i>5__3]).transform.position) <= <>4__this.effectiveRange && !Physics.Linecast(<>4__this.lightningPosition.position, ((Component)StartOfRound.Instance.allPlayerScripts[<i>5__3]).transform.position + new Vector3(0f, 0.5f, 0f), StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1))
						{
							<lightningpositions>5__1.Add(((Component)StartOfRound.Instance.allPlayerScripts[<i>5__3]).transform.position);
						}
						<i>5__3++;
					}
					<>2__current = (object)new WaitForSeconds(0.63f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					<array>5__2 = Object.FindObjectsOfType<MaskedPlayerEnemy>();
					<i>5__4 = 0;
					while (<i>5__4 < <array>5__2.Length)
					{
						if (Vector3.Distance(((Component)((EnemyAI)<>4__this).eye).transform.position, ((Component)<array>5__2[<i>5__4]).transform.position) <= <>4__this.effectiveRange)
						{
							<lightningpositions>5__1.Add(((Component)<array>5__2[<i>5__4]).transform.position);
						}
						<i>5__4++;
					}
					if (StartOfRound.Instance.inShipPhase)
					{
						return false;
					}
					<>s__5 = <lightningpositions>5__1.GetEnumerator();
					try
					{
						while (<>s__5.MoveNext())
						{
							<position>5__6 = <>s__5.Current;
							ExternalScripts.SpawnLightningBolt(<position>5__6, isLethal: true, <>4__this.lightningPosition.position);
						}
					}
					finally
					{
						((IDisposable)<>s__5).Dispose();
					}
					<>s__5 = default(List<Vector3>.Enumerator);
					<>2__current = (object)new WaitForSeconds(attackCooldown);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					<>4__this.detectionValue = 0f;
					<>4__this.isWarningSoundReady = 0;
					((EnemyAI)<>4__this).SwitchToBehaviourClientRpc(0);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public Transform turnCompass = null;

		public Transform attackArea = null;

		private float detectionValue = 0f;

		private int detectedPlayersAmount = 0;

		private int isWarningSoundReady = 0;

		private bool isAlreadyAttacking = false;

		private Vector3 staticPosition = Vector3.zero;

		private Quaternion staticRotation = Quaternion.Euler(0f, 0f, 0f);

		public AudioSource attackAudio = null;

		public AudioSource attackAudioFar = null;

		public AudioSource warningAudio = null;

		public Dictionary<AudioClip, int> talkieAnomalies = new Dictionary<AudioClip, int>();

		public List<AudioClip> talkieAnomaliesClips = new List<AudioClip>();

		public List<int> talkieAnomaliesWeights = new List<int>();

		public AudioClip threeNotesOddity = null;

		public float timeSinceLastBroadcastAnomaly = 0f;

		public ParticleSystem warningParticles = null;

		public ParticleSystem continuousWarningParticles = null;

		public Transform lightningPosition = null;

		public List<GameObject> spawnedLightningPrefabs = new List<GameObject>();

		private float effectiveRange = Plugin.BoundConfig.SparkTowerEffectiveRange.Value;

		private float detectionThreshold = Plugin.BoundConfig.SparkTowerDetectionThreshold.Value;

		private float cooldownMutiplier = Plugin.BoundConfig.SparkTowerCooldownMultiplier.Value;

		public GameObject colliders = null;

		public List<PlayerControllerB> warnedPlayers = new List<PlayerControllerB>();

		private bool altBehaviour = Plugin.BoundConfig.SparkTowerAltBehaviorEnabled.Value;

		private int altAttackThreshold = Plugin.BoundConfig.SparkTowerAltAttackThreshold.Value;

		public List<PlayerControllerB> detectedPlayersList = new List<PlayerControllerB>();

		public Dictionary<PlayerControllerB, int> playerTargets = new Dictionary<PlayerControllerB, int>();

		public GameObject smallLightningLineRenderer = null;

		public ParticleSystem altAttackBigExplosion = null;

		public AudioSource altAttackAudio = null;

		public AudioSource altAttackAudioFar = null;

		public TemporaryAudioSource abibabouAudioSource = null;

		public VisualEffectAsset smallLightningVFX = null;

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

		public override void Start()
		{
			//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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			staticPosition = ((Component)this).transform.position;
			staticRotation = ((Component)this).transform.rotation;
			warningAudio.maxDistance = effectiveRange + 10f;
			for (int i = 0; i < talkieAnomaliesClips.Count; i++)
			{
				talkieAnomalies.Add(talkieAnomaliesClips[i], talkieAnomaliesWeights[i]);
			}
			LogIfDebugBuild("count : " + talkieAnomalies.Count);
			if (altBehaviour)
			{
				base.AIIntervalTime = 0.5f;
			}
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
		}

		public override void Update()
		{
			//IL_000f: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Update();
			((Component)this).transform.position = staticPosition;
			((Component)this).transform.rotation = staticRotation;
			timeSinceLastBroadcastAnomaly += Time.deltaTime;
			if (timeSinceLastBroadcastAnomaly > 15f)
			{
				AudioClip val = null;
				int num = 0;
				foreach (AudioClip key in talkieAnomalies.Keys)
				{
					num += talkieAnomalies[key];
				}
				int num2 = Random.RandomRangeInt(1, num + 1);
				foreach (AudioClip key2 in talkieAnomalies.Keys)
				{
					num2 -= talkieAnomalies[key2];
					if (num2 <= 0)
					{
						val = key2;
						break;
					}
				}
				if ((Object)(object)val != (Object)null)
				{
					for (int i = 0; i < WalkieTalkie.allWalkieTalkies.Count; i++)
					{
						if (Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[i]).transform.position, lightningPosition.position) < 30f && ((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).isBeingUsed)
						{
							WalkieTalkie.allWalkieTalkies[i].target.PlayOneShot(val);
						}
					}
					timeSinceLastBroadcastAnomaly = 0f;
				}
			}
			if (StartOfRound.Instance.shipIsLeaving && colliders.activeInHierarchy)
			{
				colliders.SetActive(false);
			}
		}

		public override void DoAIInterval()
		{
			//IL_008b: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Invalid comparison between Unknown and I4
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).DoAIInterval();
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (!altBehaviour)
				{
					float num = 0f;
					detectedPlayersAmount = 0;
					isAlreadyAttacking = false;
					for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
					{
						PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
						num = Vector3.Distance(((Component)base.eye).transform.position, ((Component)val).transform.position);
						if (!((EnemyAI)this).PlayerIsTargetable(val, true, false) || num >= effectiveRange)
						{
							if (warnedPlayers.Contains(val))
							{
								warnedPlayers.Remove(val);
							}
							continue;
						}
						detectedPlayersAmount++;
						detectionValue += 0.05f;
						if ((int)TimeOfDay.Instance.currentLevelWeather == 2)
						{
							detectionValue += 0.05f;
						}
						if (!warnedPlayers.Contains(val))
						{
							SmallLightningClientRpc(((Component)val).transform.position);
							warnedPlayers.Add(val);
						}
						if (!(num >= effectiveRange / 2f))
						{
							detectionValue += 0.05f;
						}
					}
					if (detectedPlayersAmount > 0 && isWarningSoundReady == 0)
					{
						PlayWarningSequenceClientRPC();
						isWarningSoundReady = 4;
					}
					if (detectedPlayersAmount == 0)
					{
						detectionValue = Mathf.Max(detectionValue - 0.1f, 0f);
						isWarningSoundReady = Mathf.Max(isWarningSoundReady - 1, 0);
					}
					if (detectionValue > detectionThreshold)
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(1);
					}
				}
				else
				{
					AltAttackClientRpc();
				}
				break;
			case 1:
				if (!isAlreadyAttacking)
				{
					isAlreadyAttacking = true;
					float attackCooldown = Random.Range(3f, 10f) * cooldownMutiplier;
					LogIfDebugBuild("Attack cooldown is set " + attackCooldown);
					AttackClientRpc(attackCooldown);
				}
				break;
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
		}

		[ClientRpc]
		private void PlayWarningSequenceClientRPC()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2237309077u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2237309077u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					float pitch = Random.Range(0.85f, 1.15f);
					warningAudio.pitch = pitch;
					warningAudio.Play();
					warningParticles.Play();
				}
			}
		}

		[ClientRpc]
		private void AttackClientRpc(float attackCooldown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2700346574u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref attackCooldown, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2700346574u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					((MonoBehaviour)this).StartCoroutine(AttackCoroutine(attackCooldown));
				}
			}
		}

		[IteratorStateMachine(typeof(<AttackCoroutine>d__42))]
		private IEnumerator AttackCoroutine(float attackCooldown)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AttackCoroutine>d__42(0)
			{
				<>4__this = this,
				attackCooldown = attackCooldown
			};
		}

		[ClientRpc]
		private void AltAttackClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1419460867u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1419460867u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			detectedPlayersList.Clear();
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[i];
				if (((EnemyAI)this).PlayerIsTargetable(val3, true, false) && Vector3.Distance(((Component)val3).transform.position + new Vector3(0f, 0.5f, 0f), base.eye.position) <= effectiveRange && !Physics.Linecast(base.eye.position, ((Component)val3).transform.position + new Vector3(0f, 0.5f, 0f), StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1))
				{
					detectedPlayersList.Add(val3);
					if (!playerTargets.ContainsKey(val3))
					{
						playerTargets.Add(val3, 0);
					}
				}
				else if (playerTargets.ContainsKey(val3))
				{
					playerTargets.Remove(val3);
				}
			}
			if (detectedPlayersList.Count == 0)
			{
				isWarningSoundReady = 1;
				continuousWarningParticles.Stop();
			}
			else if (isWarningSoundReady == 1)
			{
				continuousWarningParticles.Play();
				warningAudio.Play();
				isWarningSoundReady = 0;
			}
			foreach (PlayerControllerB detectedPlayers in detectedPlayersList)
			{
				playerTargets[detectedPlayers]++;
				if (playerTargets[detectedPlayers] == 1)
				{
					for (int j = 0; j < spawnedLightningPrefabs.Count; j++)
					{
						Object.Destroy((Object)(object)spawnedLightningPrefabs[j]);
					}
					spawnedLightningPrefabs.Clear();
				}
				if (playerTargets[detectedPlayers] == altAttackThreshold - 2)
				{
					altAttackBigExplosion.Play();
					altAttackAudio.Play();
					altAttackAudioFar.Play();
				}
				if (playerTargets[detectedPlayers] >= altAttackThreshold)
				{
					ExternalScripts.SpawnLightningBolt(((Component)detectedPlayers).transform.position, isLethal: true, lightningPosition.position);
					playerTargets[detectedPlayers] = 0;
					for (int k = 0; k < spawnedLightningPrefabs.Count; k++)
					{
						Object.Destroy((Object)(object)spawnedLightningPrefabs[k]);
					}
					spawnedLightningPrefabs.Clear();
					continue;
				}
				foreach (PlayerControllerB detectedPlayers2 in detectedPlayersList)
				{
					SmallLightning(lightningPosition.position, ((Component)detectedPlayers2).transform.position);
					Object.Instantiate<TemporaryAudioSource>(abibabouAudioSource, ((Component)detectedPlayers2).transform.position, ((Component)detectedPlayers2).transform.rotation);
				}
			}
		}

		[ClientRpc]
		private void SmallLightningClientRpc(Vector3 playerLocation)
		{
			//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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2188015345u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerLocation);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2188015345u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SmallLightning(lightningPosition.position, playerLocation);
					Object.Instantiate<TemporaryAudioSource>(abibabouAudioSource, playerLocation, new Quaternion(0f, 0f, 0f, 0f));
				}
			}
		}

		public void SmallLightning(Vector3 source, Vector3 strikePosition)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			LightningBoltPrefabScript val = Object.Instantiate<LightningBoltPrefabScript>(Object.FindObjectOfType<StormyWeather>(true).targetedThunder);
			((Behaviour)val).enabled = true;
			((LightningBoltScript)val).Camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
			((LightningBoltPrefabScriptBase)val).AutomaticModeSeconds = 0.2f;
			((LightningBoltScript)val).LightningTintColor = new Color(1f, 0.98f, 0.71f, 1f);
			((LightningBoltScript)val).GlowTintColor = new Color(1f, 0.98f, 0.71f, 1f);
			((LightningBoltPrefabScriptBase)val).Generations = 2;
			((LightningBoltPrefabScriptBase)val).GrowthMultiplier = 0.2f;
			val.Source.transform.position = source;
			val.Destination.transform.position = strikePosition;
			((LightningBoltPrefabScriptBase)val).GlowIntensity = 4f;
			((LightningBoltPrefabScriptBase)val).Intensity = 10f;
			((LightningBoltPrefabScriptBase)val).LightParameters.LightIntensity = 0.2f;
			((LightningBoltPrefabScriptBase)val).CreateLightningBoltsNow();
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2237309077u, new RpcReceiveHandler(__rpc_handler_2237309077), "PlayWarningSequenceClientRPC");
			((NetworkBehaviour)this).__registerRpc(2700346574u, new RpcReceiveHandler(__rpc_handler_2700346574), "AttackClientRpc");
			((NetworkBehaviour)this).__registerRpc(1419460867u, new RpcReceiveHandler(__rpc_handler_1419460867), "AltAttackClientRpc");
			((NetworkBehaviour)this).__registerRpc(2188015345u, new RpcReceiveHandler(__rpc_handler_2188015345), "SmallLightningClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_2237309077(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;
				((SparkTowerAI)(object)target).PlayWarningSequenceClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		private static void __rpc_handler_1419460867(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;
				((SparkTowerAI)(object)target).AltAttackClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2188015345(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 playerLocation = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref playerLocation);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SparkTowerAI)(object)target).SmallLightningClientRpc(playerLocation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "SparkTowerAI";
		}
	}
	internal class TourBusAI : EnemyAI
	{
		private enum State
		{
			Generic
		}

		[CompilerGenerated]
		private sealed class <ExplosionCoroutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TourBusAI <>4__this;

			private TouristAI[] <>s__1;

			private int <>s__2;

			private TouristAI <tourist>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ExplosionCoroutine>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>s__1 = null;
				<tourist>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Debug.Log((object)"Exploding tour bus");
					((EnemyAI)<>4__this).creatureAnimator.Play("ExplosionPriming");
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Landmine.SpawnExplosion(((Component)<>4__this).transform.position + new Vector3(0f, 3f, 0f), false, 30f, 35f, 50, 200f, (GameObject)null, true);
					<>s__1 = Object.FindObjectsOfType<TouristAI>();
					for (<>s__2 = 0; <>s__2 < <>s__1.Length; <>s__2++)
					{
						<tourist>5__3 = <>s__1[<>s__2];
						<tourist>5__3.isExplodingFromTourBus = true;
						<tourist>5__3.ExplodeFromTourBus();
						<tourist>5__3 = null;
					}
					<>s__1 = null;
					<>4__this.hasExploded = true;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private bool hasStartedExploding = false;

		public bool hasExploded = false;

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

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			if (((NetworkBehaviour)this).IsServer && !hasStartedExploding)
			{
				hasStartedExploding = true;
				ExplosionClientRpc();
			}
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
		{
			((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
			if (((NetworkBehaviour)this).IsServer && !hasStartedExploding && Plugin.BoundConfig.CanMobsTriggerTourBus.Value)
			{
				hasStartedExploding = true;
				ExplosionClientRpc();
			}
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if ((Object)(object)playerWhoHit != (Object)null && playerWhoHit.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				hasStartedExploding = true;
				ExplosionServerRpc();
			}
		}

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

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

		[IteratorStateMachine(typeof(<ExplosionCoroutine>d__9))]
		private IEnumerator ExplosionCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ExplosionCoroutine>d__9(0)
			{
				<>4__this = this
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2274146457u, new RpcReceiveHandler(__rpc_handler_2274146457), "ExplosionServerRpc");
			((NetworkBehaviour)this).__registerRpc(2110141822u, new RpcReceiveHandler(__rpc_handler_2110141822), "ExplosionClientRpc");
			((EnemyAI)this).__initializeRpcs();
		}

		private static void __rpc_handler_2274146457(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;
				((TourBusAI)(object)target).ExplosionServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2110141822(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;
				((TourBusAI)(object)target).ExplosionClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "TourBusAI";
		}
	}
	internal class TouristAI : EnemyAI
	{
		public class ObjectInterest
		{
			public float interestValue = 2f;

			public int objectType = 0;

			public float defaultInterestValue = 2f;

			public bool isBrightWhenPocketed = false;

			public ObjectInterest(float interestValue, int objectType = 0, float defaultInterestValue = 2f, bool isBrightWhenPocketed = false)
			{
				this.interestValue = interestValue;
				this.objectType = objectType;
				this.defaultInterestValue = defaultInterestValue;
				this.isBrightWhenPocketed = isBrightWhenPocketed;
			}
		}

		private enum State
		{
			Roaming,
			Reaching,
			Stalking
		}

		[CompilerGenerated]
		private sealed class <AttackCoroutine>d__42 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TouristAI <>4__this;

			private TouristAI[] <array>5__1;

			private int <i>5__2;

			private NetworkObject <touristNetworkObject>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <AttackCoroutine>d__42(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<array>5__1 = null;
				<touristNetworkObject>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: 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_019e: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					((EnemyAI)<>4__this).creatureAnimator.Play("Death");
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<array>5__1 = Object.FindObjectsOfType<TouristAI>();
					<i>5__2 = 0;
					while (<i>5__2 < <array>5__1.Length)
					{
						if (Vector3.Distance(((Component)<>4__this).transform.position, ((Component)<array>5__1[<i>5__2]).transform.position) <= 10f)
						{
							<>4__this.collisionBox.SetActive(false);
							if (((NetworkBehaviour)<>4__this).IsServer && !<>4__this.isExplodingFromTourBus)
							{
								((Component)<array>5__1[<i>5__2]).SendMessage("RemoteExplode");
							}
						}
						<i>5__2++;
					}
					Landmine.SpawnExplosion(((Component)<>4__this).transform.position, true, 3f, 10f, 50, 10f, (GameObject)null, false);
					<>4__this.posesList[<>4__this.currentPose].SetActive(false);
					if (((NetworkBehaviour)<>4__this).IsServer)
					{
						<>2__current = (object)new WaitForSeconds(1f);
						<>1__state = 2;
						return true;
					}
					break;
				case 2:
					<>1__state = -1;
					<touristNetworkObject>5__3 = ((Component)<>4__this).GetComponent<NetworkObject>();
					if ((Object)(object)<touristNetworkObject>5__3 != (Object)null && <touristNetworkObject>5__3.IsSpawned)
					{
						<touristNetworkObject>5__3.Despawn(true);
					}
					<touristNetworkObject>5__3 = null;
					break;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <NaturalSpawnCoroutine>d__45 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TouristAI <>4__this;

			private TourBusAI <tourBus>5__1;

			private int <i>5__2;

			private Vector3 <spawnPosition>5__3;

			private NetworkObjectReference <spawnTourist>5__4;

			private NetworkObject <spawnedTouristNetworkObject>5__5;

			private float <startTime>5__6;

			private TouristAI <tourist>5__7;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <NaturalSpawnCoroutine>d__45(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<tourBus>5__1 = null;
				<spawnedTouristNetworkObject>5__5 = null;
				<tourist>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Expected O, but got Unknown
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: 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_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_013e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Expected O, but got Unknown
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e0: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<tourBus>5__1 = Object.FindObjectOfType<TourBusAI>();
					if (!<>4__this.isNaturallySpawned || (!((Object)(object)<tourBus>5__1 == (Object)null) && <tourBus>5__1.hasExploded))
					{
						break;
					}
					<i>5__2 = 0;
					goto IL_0233;
				case 2:
					<>1__state = -1;
					goto IL_017e;
				case 3:
					{
						<>1__state = -1;
						<tourist>5__7 = NetworkObjectReference.op_Implicit(<spawnTourist>5__4).GetComponent<TouristAI>();
						<tourist>5__7.isNaturallySpawned = false;
						<spawnedTouristNetworkObject>5__5 = null;
						<tourist>5__7 = null;
						<i>5__2++;
						goto IL_0233;
					}
					IL_017e:
					if (Time.realtimeSinceStartup - <startTime>5__6 < 8f && !((NetworkObjectReference)(ref <spawnTourist>5__4)).TryGet(ref <spawnedTouristNetworkObject>5__5, (NetworkManager)null))
					{
						<>2__current = (object)new WaitForSeconds(0.03f);
						<>1__state = 2;
						return true;
					}
					if ((Object)(object)<spawnedTouristNetworkObject>5__5 == (Object)null)
					{
						<>4__this.LogIfDebugBuild("spawnedTouristNetworkObject is null!");
						return false;
					}
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 3;
					return true;
					IL_0233:
					if (<i>5__2 >= Random.RandomRangeInt(Plugin.BoundConfig.TouristMinGroupSize.Value, Plugin.BoundConfig.TouristMaxGroupSize.Value + 1))
					{
						break;
					}
					<spawnPosition>5__3 = ((Component)<>4__this).transform.position + new Vector3((float)Random.Range(-10, 10), 0f, (float)Random.Range(-10, 10));
					<spawnPosition>5__3 = RoundManager.Instance.GetNavMeshPosition(<spawnPosition>5__3, default(NavMeshHit), 5f, -1);
					if (!RoundManager.Instance.GotNavMeshPositionResult)
					{
						<spawnPosition>5__3 = ((Component)<>4__this).transform.position;
					}
					<spawnTourist>5__4 = ExternalScripts.Spawn(GetEnemies.Tourist, <spawnPosition>5__3);
					<spawnedTouristNetworkObject>5__5 = null;
					<startTime>5__6 = Time.realtimeSinceStartup;
					goto IL_017e;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public Dictionary<string, ObjectInterest> grabbableObjectInterest = new Dictionary<string, ObjectInterest>
		{
			{
				"Apparatus",
				new ObjectInterest(0.4f)
			},
			{
				"Fancy lamp",
				new ObjectInterest(0.7f, 1)
			},
			{
				"Flashlight",
				new ObjectInterest(0.8f, 1, 2f, isBrightWhenPocketed: true)
			},
			{
				"Radar-booster",
				new ObjectInterest(0.9f, 2)
			},
			{
				"Rubber Ducky",
				new ObjectInterest(0.5f, 0, 2f, isBrightWhenPocketed: true)
			},
			{
				"Pro-flashlight",
				new ObjectInterest(0.5f, 1, 2f, isBrightWhenPocketed: true)
			},
			{
				"Ainz Ooal Gown",
				new ObjectInterest(1f)
			},
			{
				"Mystic Cristal",
				new ObjectInterest(0.6f, 0, 2f, isBrightWhenPocketed: true)
			},
			{
				"Balan Statue",
				new ObjectInterest(1.5f)
			},
			{
				"The talking orb",
				new ObjectInterest(0.85f)
			},
			{
				"Nokia",
				new ObjectInterest(1.7f, 1)
			},
			{
				"Uno Reverse Card DX",
				new ObjectInterest(1.1f, 0, 2f, isBrightWhenPocketed: true)
			},
			{
				"Emergency Die",
				new ObjectInterest(1.5f)
			},
			{
				"Gambler",
				new ObjectInterest(1.3f)
			},
			{
				"The Saint",
				new ObjectInterest(1.9f)
			},
			{
				"Moon's Tear",
				new ObjectInterest(0.6f, 0, 2f, isBrightWhenPocketed: true)
			}
		};

		public List<int> checkedItems = new List<int>();

		public Transform feet = null;

		public KeyValuePair<Transform, float> bestTarget = default(KeyValuePair<Transform, float>);

		public Transform currentTarget = null;

		public bool isBeingLookedAt = false;

		public float currentTargetInterest = 0f;

		public float losingInterestTimer = 0f;

		public float timeSpentMoving = 0f;

		public float timeSpentStalking = 0f;

		public float adhdValue = 0f;

		public float stalkAdhdValue = 0f;

		public float walkSpeed = 12f;

		public bool hasChangedPose = false;

		public int currentPose = 0;

		public bool isAlreadyAttacking = false;

		public List<GameObject> posesList = new List<GameObject>();

		public List<GameObject> boxEdgesList = new List<GameObject>();

		public GameObject collisionBox = null;

		public GameObject tourBusPrefab = null;

		private Vector3 fixedPosition = Vector3.zero;

		private bool hasFixedPosition = false;

		public bool isExplodingFromTourBus = false;

		public Light chestLight = null;

		public float chestLightIntensity = 0f;

		public bool isNaturallySpawned = true;

		private float detectionRange = Plugin.BoundConfig.TouristDetectionRange.Value;

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

		public override void Start()
		{
			//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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			((EnemyAI)this).Start();
			if (((NetworkBehaviour)this).IsServer)
			{
				adhdValue = Random.Range(4, 8);
				stalkAdhdValue = Random.Range(25, 35);
				walkSpeed = Random.Range(12f, 15f) * Plugin.BoundConfig.TouristSpeed.Value;
				((MonoBehaviour)this).StartCoroutine(NaturalSpawnCoroutine());
				int poseID = Random.RandomRangeInt(0, 7);
				ChangePoseClientRPC(poseID);
				List<TouristAI> list = Object.FindObjectsOfType<TouristAI>().ToList();
				if (list.Count > 20 && (Object)(object)Object.FindObjectOfType<TourBusAI>() == (Object)null)
				{
					LogIfDebugBuild("There are more than 20 tourists, spawning tour bus SOMEWHERE");
					Vector3 position = base.allAINodes[Random.RandomRangeInt(0, base.allAINodes.Count())].transform.position;
					ExternalScripts.Spawn(GetEnemies.TourBus, position);
				}
			}
			base.creatureAnimator.Play("Spawn");
			((EnemyAI)this).SwitchToBehaviourClientRpc(0);
		}

		public override void DoAIInterval()
		{
			//IL_00dd: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: 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_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
			{
				return;
			}
			switch (base.currentBehaviourStateIndex)
			{
			case 0:
				if (!base.currentSearch.inProgress)
				{
					((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
				}
				ScanForTargets();
				if ((Object)(object)bestTarget.Key != (Object)null)
				{
					currentTarget = bestTarget.Key;
					currentTargetInterest = bestTarget.Value;
					timeSpentMoving = 0f;
					((EnemyAI)this).StopSearch(base.currentSearch, true);
					((EnemyAI)this).SwitchToBehaviourClientRpc(1);
				}
				break;
			case 1:
				if (Physics.Linecast(((Component)base.eye).transform.position, currentTarget.position + Vector3.up * 0.5f, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1))
				{
					losingInterestTimer += base.AIIntervalTime;
					if (losingInterestTimer >= adhdValue)
					{
						((EnemyAI)this).SwitchToBehaviourClientRpc(0);
					}
				}
				else
				{
					losingInterestTimer = 0f;
				}
				if (timeSpentMoving >= 30f)
				{
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				ScanForTargets();
				if ((Object)(object)bestTarget.Key != (Object)(object)currentTarget && bestTarget.Value <= currentTargetInterest * 0.75f)
				{
					currentTarget = bestTarget.Key;
					currentTargetInterest = bestTarget.Value;
				}
				((EnemyAI)this).SetDestinationToPosition(currentTarget.position, false);
				if (Vector3.Distance(((Component)this).transform.position, currentTarget.position) <= 7f)
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false);
					timeSpentStalking = 0f;
					chestLightIntensity = 3f;
					((EnemyAI)this).SwitchToBehaviourClientRpc(2);
				}
				break;
			case 2:
			{
				float num = Vector3.Distance(currentTarget.position, ((Component)this).transform.position);
				if (num >= 12f)
				{
					((EnemyAI)this).SetDestinationToPosition(currentTarget.position, false);
				}
				if (num <= 7f)
				{
					((EnemyAI)this).SetDestinationToPosition(((Component)this).transform.position, false);
				}
				timeSpentStalking += base.AIIntervalTime;
				if (timeSpentStalking >= 30f)
				{
					if (checkedItems.Contains(((Object)((Component)currentTarget).gameObject).GetInstanceID()))
					{
						LogIfDebugBuild("ERROR : checkedItems already contained item " + ((object)((Component)currentTarget).gameObject)?.ToString() + ", ID " + ((Object)((Component)currentTarget).gameObject).GetInstanceID() + "!");
					}
					else
					{
						checkedItems.Add(((Object)((Component)currentTarget).gameObject).GetInstanceID());
					}
					chestLightIntensity = 0f;
					((EnemyAI)this).SwitchToBehaviourClientRpc(0);
				}
				break;
			}
			default:
				LogIfDebugBuild("This Behavior State doesn't exist!");
				break;
			}
			((EnemyAI)this).DoAIInterval();
		}

		public override void Update()
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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)
			((EnemyAI)this).Update();
			isBeingLookedAt = false;
			for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if (!((EnemyAI)this).PlayerIsTargetable(val, false, false))
				{
					continue;
				}
				for (int j = 0; j < boxEdgesList.Count; j++)
				{
					if (val.HasLineOfSightToPosition(boxEdgesList[j].transform.position, 45f, 150, -1f) && PlayerHasHorizontalLOS(val))
					{
						isBeingLookedAt = true;
					}
				}
			}
			if (isBeingLookedAt)
			{
				hasChangedPose = false;
				base.agent.speed = 0f;
				if (!hasFixedPosition)
				{
					fixedPosition = ((Component)this).transform.position;
					hasFixedPosition = true;
				}
				else
				{
					((Component)this).transform.position = fixedPosition;
				}
			}
			else
			{
				hasFixedPosition = false;
				base.agent.speed = walkSpeed;
				timeSpentMoving += Time.deltaTime;
				if (!hasChangedPose && ((NetworkBehaviour)this).IsServer)
				{
					int poseID = Random.RandomRangeInt(0, 7);
					ChangePoseClientRPC(poseID);
					hasChangedPose = true;
				}
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				((EnemyAI)this).SyncPositionToClients();
				SetChestLightIntensityClientRPC(chestLightIntensity);
			}
		}

		public KeyValuePair<Transform, float> ScanForTargets()
		{
			//IL_003b: 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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			bestTarget = new KeyValuePair<Transform, float>(null, detectionRange * 4f);
			for (int i = 0; i < array.Length; i++)
			{
				string itemName = array[i].itemProperties.itemName;
				float num = Vector3.Distance(((Component)this).transform.position, ((Component)array[i]).transform.position);
				float num2 = detectionRange * 2f;
				if (num >= detectionRange || checkedItems.Contains(((Object)((Component)((Component)array[i]).transform).gameObject).GetInstanceID()) || (array[i].isPocketed && (!grabbableObjectInterest.ContainsKey(itemName) || !grabbableObjectInterest[itemName].isBrightWhenPocketed)) || Physics.Linecast(((Component)base.eye).transform.position, ((Component)array[i]).transform.position + Vector3.up * 0.5f, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1) || !grabbableObjectInterest.ContainsKey(itemName))
				{
					continue;
				}
				bool flag = false;
				int num3;
				switch (grabbableObjectInterest[itemName].objectType)
				{
				case 0:
					flag = true;
					break;
				case 1:
					flag = array[i].isBeingUsed;
					break;
				case 2:
					{
						if (itemName == "Radar-booster")
						{
							GrabbableObject obj = array[i];
							RadarBoosterItem val = (RadarBoosterItem)(object)((obj is RadarBoosterItem) ? obj : null);
							if (val != null)
							{
								num3 = (val.radarEnabled ? 1 : 0);
								goto IL_019c;
							}
						}
						num3 = 0;
						goto IL_019c;
					}
					IL_019c:
					flag = (byte)num3 != 0;
					break;
				}
				num2 = ((!flag) ? (num * grabbableObjectInterest[itemName].defaultInterestValue) : (num * grabbableObjectInterest[itemName].interestValue));
				if (bestTarget.Value > num2)
				{
					bestTarget = new KeyValuePair<Transform, float>(((Component)array[i]).transform, num2);
				}
			}
			for (int j = 0; j < StartOfRound.Instance.connectedPlayersAmount + 1; j++)
			{
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[j];
				float num4 = Vector3.Distance(((Component)this).transform.position, ((Component)val2).transform.position);
				if (!(num4 >= detectionRange) && ((EnemyAI)this).PlayerIsTargetable(val2, false, false) && !Physics.Linecast(((Component)base.eye).transform.position, ((Component)val2).transform.position + Vector3.up * 1.5f, StartOfRound.Instance.collidersRoomDefaultAndFoliage, (QueryTriggerInteraction)1) && bestTarget.Value > num4)
				{
					bestTarget = new KeyValuePair<Transform, float>(((Component)val2).transform, num4);
				}
			}
			return bestTarget;
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = true, int hitID = -1)
		{
			((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
			if (!isAlreadyAttacking && (Object)(object)playerWhoHit != (Object)null && playerWhoHit.playerClientId == GameNetworkManager.Instance.localPlayerController.playerClientId)
			{
				AttackServerRPC();
			}
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
		{
			((EnemyAI)this).OnCollideWithEnemy(other, collidedEnemy);
			if (!collidedEnemy.isEnemyDead && isBeingLookedAt)
			{
				RemoteExplode();
			}
		}

		public override void OnCollideWithPlayer(Collider other)
		{
			((EnemyAI)this).OnCollideWithPlayer(other);
			ExplodeFromTourBus();
		}

		public void RemoteExplode()
		{
			if (!isAlreadyAttacking && ((NetworkBehaviour)this).IsServer)
			{
				isAlreadyAttacking = true;
				AttackClientRPC();
			}
		}

		[ClientRpc]
		public void ChangePoseClientRPC(int poseID)
		{
			//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_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(696813103u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, poseID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 696813103u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			foreach (GameObject poses in posesList)
			{
				poses.SetActive(false);
			}
			posesList[poseID].SetActive(true);
			currentPose = poseID;
		}

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

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

		public void ExplodeFromTourBus()
		{
			if (!isAlreadyAttacking)
			{
				isAlreadyAttacking = true;
				((MonoBehaviour)this).StartCoroutine(AttackCoroutine());
			}
		}

		[IteratorStateMachine(typeof(<AttackCoroutine>d__42))]
		private IEnumerator AttackCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <AttackCoroutine>d__42(0)
			{
				<>4__this = this
			};
		}

		[ClientRpc]
		public void SetChestLightIntensityClientRPC(float intensity)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(465799006u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref intensity, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 465799006u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					float num = Mathf.Clamp(Time.deltaTime * 0.4f, 0f, 1f);
					chestLight.intensity = Mathf.Lerp(chestLight.intensity, intensity, num);
				}
			}
		}

		public bool PlayerHasHorizontalLOS(PlayerControllerB player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//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_002f: 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 val = ((Component)this).transform.position - ((Component)player).transform.position;
			val.y = 0f;
			return Vector3.Angle(((Component)player).transform.forward, val) < 120f;
		}

		[IteratorStateMachine(typeof(<NaturalSpawnCoroutine>d__45))]
		private IEnumerator NaturalSpawnCoroutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <NaturalSpawnCoroutine>d__45(0)
			{
				<>4__this = this
			};
		}

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

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(696813103u, new RpcReceiveHandler(__rpc_handler_696813103), "ChangePoseClientRPC");
			((NetworkBehaviour)this).__registerRpc(2027024575u, new RpcReceiveHandler(__rpc_handler_2027024575), "AttackServerRPC");
			((NetworkBehaviour)this).__registerRpc(580428264u, new RpcReceiveHandler(__rpc_handler_580428264), "AttackClientRPC");
			((NetworkBehaviour)this).__registerRpc(465799006u, new RpcReceiveHandler(__rpc_handler_465799006), "SetChestLightIntensityClientRPC");
			((EnemyAI)this).__initializeRpcs();
		}

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

		private static void __rpc_handler_2027024575(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;
				((TouristAI)(object)target).AttackServerRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_580428264(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;
				((TouristAI)(object)target).AttackClientRPC();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected internal override string __getTypeName()
		{
			return "TouristAI";
		}
	}
	internal class DamageTypeHandler : NetworkBehaviour
	{
		public PlayerControllerB player = null;

		private float acidEffectTimer = -1f;

		public GameObject? acidParticles = null;

		private float stunEffectTimer = -1f;

		public ParticleSystem? electricBurstParticles = null;

		public ParticleSystem? electricLingeringParticles = null;

		public int radioactiveStacks = 0;

		public float timeSinceLastRadioactiveDamage = 0f;

		public bool shouldRadioactiveTickDamageAllies = false;

		public void Start()
		{
			player = ((Component)((Component)this).transform.parent).gameObject.GetComponent<PlayerControllerB>();
		}

		public void Update()
		{
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			if (acidEffectTimer >= 0f)
			{
				acidEffectTimer -= Time.deltaTime;
			}
			else
			{
				acidEffectTimer = -1f;
				acidParticles.SetActive(false);
			}
			if (stunEffectTimer >= 0f)
			{
				stunEffectTimer -= Time.deltaTime;
			}
			else
			{
				stunEffectTimer = -1f;
			}
			timeSinceLastRadioactiveDamage += Time.deltaTime;
			if (!(timeSinceLastRadioactiveDamage >= 0.25f) || radioactiveStacks <= 0)
			{
				return;
			}
			if (shouldRadioactiveTickDamageAllies)
			{
				for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
				{
					if (Vector3.Distance(((Component)player).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position) <= 10f)
					{
						StartOfRound.Instance.allPlayerScripts[i].DamagePlayer(1, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					}
				}
				shouldRadioactiveTickDamageAllies = false;
			}
			else
			{
				player.DamagePlayer(1, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
				shouldRadioactiveTickDamageAllies = true;
			}
			timeSinceLastRadioactiveDamage = 0f;
			radioactiveStacks--;
		}

		public void OnPlayerDamaged(int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3))
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (acidEffectTimer >= 0f)
			{
				acidEffectTimer = -1f;
				acidParticles.SetActive(false);
				player.DamagePlayer(damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
			}
		}

		public void DamageAcid(int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3))
		{
			//IL_000a: 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)
			player.DamagePlayer(damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
			acidEffectTimer = damageNumber * 2;
			acidParticles.SetActive(true);
			HUDManager.Instance.DisplayTip("Acid damage detected!", "The next hit will deal twice the damage, stay out of trouble until the acid dries off", true, true, "LA_AcidDamageTip");
		}

		public void DamageElectric(int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3))
		{
			//IL_000a: 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_002a: 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)
			player.DamagePlayer(damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
			electricBurstParticles.Play();
			MainModule main = electricLingeringParticles.main;
			((MainModule)(ref main)).duration = damageNumber / 5;
			electricLingeringParticles.Play();
			stunEffectTimer = Mathf.Clamp(damageNumber / 5, 0, 10);
			GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
			GrabbableObject[] array2 = array;
			foreach (GrabbableObject val in array2)
			{
				if ((Object)(object)val.playerHeldBy == (Object)(object)player && val.itemProperties.requiresBattery)
				{
					val.insertedBattery.charge = Mathf.Clamp(val.insertedBattery.charge - 0.2f, 0f, 100f);
				}
			}
			HUDManager.Instance.DisplayTip("Electric damage detected!", "Your batteries have been drained, and your movement is slowed", true, true, "LA_ElectricDamageTip");
		}

		public void DamageRadioactive(int damageNumber)
		{
			radioactiveStacks += damageNumber;
			HUDManager.Instance.DisplayTip("Radioactive damage detected!", "You take damage over, and apply some of to nearby allies too", true, true, "LA_AcidDamageTip");
		}

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

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

		protected internal override string? __getTypeName()
		{
			return "DamageTypeHandler";
		}
	}
	internal class DamageTypes
	{
		public static Dictionary<PlayerControllerB, float> acidAffectedPlayers = new Dictionary<PlayerControllerB, float>();

		public List<string> anomalyTextList = new List<string> { "PG0xsC0oqHSiNG0t2FfNEzvQEQKapyg4", "d0GlG0mptRfurrbcmB2A6camoHKB7nZL", "U12YtGQyDFHay5h9jc1GIUGsOjQrJYnt", "mqcYY9dOrJvX2bNY7NNgFvbhSq1eLC4B", "--.. . .-.. -.. .- .... ..-", "... is this coming through? ...Mike... Hello?", "Next season of Night Springs airing oNNS%$$£µ!§<\u00a8ù", "                                  " };

		public List<string> anomalyShopItemList = new List<string>
		{
			"Zeldahu", "Zigzag_Awaka", "Abibabou", "XyphireTV", "Halgard", "Cowboy_Bigbop", "Xplozivo", "                 ", "?????????", "Vacations straight to hell",
			"...", "PLEASE HELP PLEASE HELP PLEASE HELP"
		};

		public List<string> anomalyShopPriceList = new List<string>
		{
			"$4.99", "$9.99", "$19.99", "$99.99", "50 quids", "AAAAAAAAAA", "12 kromer", "20% off !", "50% off!!", "80% off!!!",
			"FREE!!!!", "-48£???", "Two sticks and one stone", "A smile :)"
		};

		public GameObject? acidParticlesPrefab = null;

		public void DamagePlayerAcid(PlayerControllerB target, int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3))
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			target.DamagePlayer(damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
			if (!acidAffectedPlayers.ContainsKey(target))
			{
				acidAffectedPlayers.Add(target, damageNumber * 2);
			}
		}

		public void DamagePlayerElectromagnetic(PlayerControllerB target, int damageNumber, bool hasDamageSFX = true, bool callRPC = true, CauseOfDeath causeOfDeath = 0, int deathAnimation = 0, bool fallDamage = false, Vector3 force = default(Vector3))
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			target.DamagePlayer(damageNumber, hasDamageSFX, callRPC, causeOfDeath, deathAnimation, fallDamage, force);
			switch (Random.RandomRangeInt(0, 5))
			{
			case 0:
				HUDManager.Instance.DisplayTip("ERROR", anomalyTextList[Random.RandomRangeInt(0, anomalyTextList.Count - 1)], false, false, "LC_Tip1");
				break;
			case 1:
				HUDManager.Instance.DisplayTip("ERROR", anomalyTextList[Random.RandomRangeInt(0, anomalyTextList.Count - 1)], true, false, "LC_Tip1");
				break;
			case 2:
				HUDManager.Instance.BeginDisplayAd(anomalyShopItemList[Random.RandomRangeInt(0, anomalyShopItemList.Count - 1)], anomalyShopPriceList[Random.RandomRangeInt(0, anomalyShopPriceList.Count - 1)]);
				break;
			case 3:
				HUDManager.Instance.DisplayStatusEffect(anomalyTextList[Random.RandomRangeInt(0, anomalyTextList.Count - 1)]);
				break;
			case 4:
				HUDManager.Instance.RadiationWarningHUD();
				break;
			}
		}
	}
	internal class LineRendererController : MonoBehaviour
	{
		public List<LineRenderer> lineRenderers = new List<LineRenderer>();

		public void SetPosition(Transform startPos, Transform endPos)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (lineRenderers.Count > 0)
			{
				for (int i = 0; i < lineRenderers.Count; i++)
				{
					if (lineRenderers[i].positionCount >= 2)
					{
						lineRenderers[i].SetPosition(0, startPos.position);
						lineRenderers[i].SetPosition(1, endPos.position);
					}
					else
					{
						Debug.LogError((object)"The line renderer should have at least 2 positions!");
					}
				}
			}
			else
			{
				Debug.LogError((object)"Line Renderers list is empty!");
			}
		}
	}
	internal class TemporaryAudioSource : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <Despawn>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public TemporaryAudioSource <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <Despawn>d__6(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(<>4__this.despawnTime);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		public AudioSource source = null;

		public float despawnTime = 5f;

		public float randomPitchMin = 1f;

		public float randomPitchMax = 1f;

		public List<AudioClip> audioClips = new List<AudioClip>();

		public void Start()
		{
			source.pitch = Random.Range(randomPitchMin, randomPitchMax);
			if (audioClips.Count == 0)
			{
				source.Play();
				((MonoBehaviour)this).StartCoroutine(Despawn());
			}
			else
			{
				source.clip = audioClips[Random.RandomRangeInt(0, audioClips.Count)];
				source.Play();
				((MonoBehaviour)this).StartCoroutine(Despawn());
			}
		}

		[IteratorStateMachine(typeof(<Despawn>d__6))]
		private IEnumerator Despawn()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <Despawn>d__6(0)
			{
				<>4__this = this
			};
		}
	}
	[BepInPlugin("Zeldahu.LethalAnomalies", "Lethal Anomalies", "0.3.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string PLUGIN_GUID = "Zeldahu.LethalAnomalies";

		private const string PLUGIN_NAME = "Lethal Anomalies";

		private const string PLUGIN_VERSION = "0.3.0";

		internal static ManualLogSource Logger;

		public static AssetBundle? ModAssets;

		private readonly Harmony harmony = new Harmony("Zeldahu.LethalAnomalies");

		public static GameObject? damageTypesHandler;

		internal static PluginConfig BoundConfig { get; private set; }

		private void Awake()
		{
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			BoundConfig = new PluginConfig(((BaseUnityPlugin)this).Config);
			InitializeNetworkBehaviours();
			string path = "lethalanomalies";
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
			if ((Object)(object)ModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			EnemyType val = ModAssets.LoadAsset<EnemyType>("Spark Tower");
			TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("SparkTowerTN");
			TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("SparkTowerTK");
			EnemyType val4 = ModAssets.LoadAsset<EnemyType>("Tourist");
			TerminalNode val5 = ModAssets.LoadAsset<TerminalNode>("TouristTN");
			TerminalKeyword val6 = ModAssets.LoadAsset<TerminalKeyword>("TouristTK");
			EnemyType val7 = ModAssets.LoadAsset<EnemyType>("Tour Bus");
			TerminalNode val8 = ModAssets.LoadAsset<TerminalNode>("TourBusTN");
			TerminalKeyword val9 = ModAssets.LoadAsset<TerminalKeyword>("TourBusTK");
			EnemyType val10 = ModAssets.LoadAsset<EnemyType>("Scrap Bunny");
			TerminalNode val11 = ModAssets.LoadAsset<TerminalNode>("ScrapBunnyTN");
			TerminalKeyword val12 = ModAssets.LoadAsset<TerminalKeyword>("ScrapBunnyTK");
			NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.nestSpawnPrefab);
			val.PowerLevel = BoundConfig.SparkTowerPowerLevel.Value;
			val.MaxCount = BoundConfig.SparkTowerMaxCount.Value;
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			Dictionary<LevelTypes, int> dictionary2 = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary3 = new Dictionary<string, int>();
			Dictionary<LevelTypes, int> dictionary4 = new Dictionary<LevelTypes, int>();
			string[] array = BoundConfig.SparkTowerSpawnWeight.Value.Split(',');
			foreach (string text in array)
			{
				string[] array2 = text.Split(':');
				if (array2.Length == 2 && int.TryParse(array2[1], out var result))
				{
					if (Enum.TryParse<LevelTypes>(array2[0], ignoreCase: true, out LevelTypes result2))
					{
						dictionary2[result2] = result;
					}
					else
					{
						dictionary[array2[0]] = result;
					}
				}
			}
			Enemies.RegisterEnemy(val, dictionary2, dictionary, val2, val3);
			string[] array3 = BoundConfig.TouristSpawnWeight.Value.Split(',');
			foreach (string text2 in array3)
			{
				string[] array4 = text2.Split(':');
				if (array4.Length == 2 && int.TryParse(array4[1], out var result3))
				{
					if (Enum.TryParse<LevelTypes>(array4[0], ignoreCase: true, out LevelTypes result4))
					{
						dictionary4[result4] = result3;
					}
					else
					{
						dictionary3[array4[0]] = result3;
					}
				}
			}
			NetworkPrefabs.RegisterNetworkPrefab(val4.enemyPrefab);
			Enemies.RegisterEnemy(val4, dictionary4, dictionary3, val5, val6);
			NetworkPrefabs.RegisterNetworkPrefab(val7.enemyPrefab);
			Enemies.RegisterEnemy(val7, 0, (LevelTypes)(-1), val11, val12);
			harmony.PatchAll();
			Logger.LogInfo((object)"Plugin Zeldahu.LethalAnomalies is loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Zeldahu.LethalAnomalies";

		public const string PLUGIN_NAME = "LethalAnomalies";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LethalAnomalies.External
{
	internal class ExternalScripts
	{
		public static void SpawnLightningBolt(Vector3 strikePosition, bool isLethal, Vector3 origin = default(Vector3))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0087: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or mis