Decompiled source of Fallout NewVegas v1.0.2

FNV.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FNV;
using FNV.NetcodePatcher;
using FNV.NewFolder;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Mathematics;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("FNV")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A Fallout Mod Made for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FNV")]
[assembly: AssemblyTitle("FNV")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class IntercomsManager : NetworkBehaviour
{
	[CompilerGenerated]
	private sealed class <GatherLoudspeakers>d__21 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public IntercomsManager <>4__this;

		private IEnumerable<GameObject> <searchedSpeakers>5__1;

		private IEnumerable<GameObject> <Breakers>5__2;

		private IEnumerator<GameObject> <>s__3;

		private GameObject <Speaker>5__4;

		private IEnumerator<GameObject> <>s__5;

		private GameObject <Breaker>5__6;

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

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

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

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<searchedSpeakers>5__1 = null;
			<Breakers>5__2 = null;
			<>s__3 = null;
			<Speaker>5__4 = null;
			<>s__5 = null;
			<Breaker>5__6 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(7f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				MonoBehaviour.print((object)"New Vegas: Collecting Loudspeakers");
				<searchedSpeakers>5__1 = from obj in Object.FindObjectsOfType<GameObject>()
					where (((Object)obj).name.IndexOf("LoudSpeaker") > -1) & ((Object)(object)obj != (Object)(object)<>4__this.Manager) & (((Object)obj).name.IndexOf("Manager") <= 0)
					select obj;
				<>s__3 = <searchedSpeakers>5__1.GetEnumerator();
				try
				{
					while (<>s__3.MoveNext())
					{
						<Speaker>5__4 = <>s__3.Current;
						MonoBehaviour.print((object)(((object)<Speaker>5__4)?.ToString() + " Loudspeaker Debug"));
						<Speaker>5__4.AddComponent(typeof(AudioSource));
						<Speaker>5__4.AddComponent<AudioLowPassFilter>();
						<Speaker>5__4.AddComponent<AudioReverbFilter>();
						<Speaker>5__4.GetComponent<AudioSource>().playOnAwake = false;
						<>4__this.Loudspeakers = CollectionExtensions.AddToArray<GameObject>(<>4__this.Loudspeakers, <Speaker>5__4);
						<Speaker>5__4 = null;
					}
				}
				finally
				{
					if (<>s__3 != null)
					{
						<>s__3.Dispose();
					}
				}
				<>s__3 = null;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				<Breakers>5__2 = from obj in Object.FindObjectsOfType<GameObject>()
					where (Object)(object)obj.GetComponent<BreakerBox>() != (Object)null
					select obj;
				if (<Breakers>5__2 != null)
				{
					<>s__5 = <Breakers>5__2.GetEnumerator();
					try
					{
						while (<>s__5.MoveNext())
						{
							<Breaker>5__6 = <>s__5.Current;
							if ((Object)(object)<Breaker>5__6.GetComponent<BreakerBox>() != (Object)null)
							{
								<>4__this.BreakerBoxInWorld = <Breaker>5__6.GetComponent<BreakerBox>();
							}
							<Breaker>5__6 = null;
						}
					}
					finally
					{
						if (<>s__5 != null)
						{
							<>s__5.Dispose();
						}
					}
					<>s__5 = null;
				}
				if (((NetworkBehaviour)<>4__this).IsHost)
				{
					MonoBehaviour.print((object)("Host will be controlling the loudspeakers" + <>4__this.DebugSignature));
					<>4__this.LoudspeakerSystem();
				}
				else if (((NetworkBehaviour)<>4__this).IsServer)
				{
					MonoBehaviour.print((object)("Loudspeaker currently is on: Server" + <>4__this.DebugSignature));
				}
				else if (((NetworkBehaviour)<>4__this).IsClient)
				{
					MonoBehaviour.print((object)("Loudspeaker is currently on: CLient" + <>4__this.DebugSignature));
				}
				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 <PlayTrack>d__22 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public IntercomsManager <>4__this;

		private int <ChosenInteger>5__1;

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

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

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

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

		private bool MoveNext()
		{
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<ChosenInteger>5__1 = CustomScrapSpawnNV.NevadaRandom.Next(0, <>4__this.Songs.Length);
				Clip = <>4__this.Songs[<ChosenInteger>5__1];
				if (<>4__this.PlayedClips.Length >= <>4__this.Songs.Length)
				{
					<>4__this.PlayedClips = Array.Empty<RadioTrack>();
				}
				if (<>4__this.PlayedClips.Contains(Clip))
				{
					goto IL_0117;
				}
				goto IL_0131;
			case 1:
				<>1__state = -1;
				goto IL_0117;
			case 2:
				<>1__state = -1;
				<>4__this.ClipTime = Clip.TrackClip.length + (float)CustomScrapSpawnNV.NevadaRandom.Next(1, 4);
				<>2__current = (object)new WaitForSeconds(<>4__this.ClipTime);
				<>1__state = 3;
				return true;
			case 3:
				{
					<>1__state = -1;
					<>4__this.isPlayingTrack = false;
					<>4__this.LoudspeakerSystem();
					return false;
				}
				IL_0131:
				<>4__this.PlayedClips = CollectionExtensions.AddToArray<RadioTrack>(<>4__this.PlayedClips, Clip);
				<>4__this.SyncAudiosClientRpc(<ChosenInteger>5__1);
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 2;
				return true;
				IL_0117:
				if (<>4__this.PlayedClips.Contains(Clip))
				{
					<ChosenInteger>5__1 = CustomScrapSpawnNV.NevadaRandom.Next(0, <>4__this.Songs.Length);
					Clip = <>4__this.Songs[<ChosenInteger>5__1];
					<>2__current = (object)new WaitForSeconds(0.5f);
					<>1__state = 1;
					return true;
				}
				goto IL_0131;
			}
		}

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

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

	[Header("Loudspeaker Data")]
	[Space(5f)]
	public GameObject Manager;

	public GameObject[] Loudspeakers;

	public RadioTrack[] RadioTracks;

	public RadioTrack[] Songs;

	public RadioTrack[] PlayedClips;

	[Header("Speaker Settings")]
	[Space(5f)]
	public float AudioVolume;

	[Space(5f)]
	public float MinRange;

	public float MaxRange;

	public AudioRolloffMode RolloffMd;

	public AudioMixerGroup AudioMix;

	public bool EnableLowPassFilter = false;

	public bool EnableReverbFilter = false;

	public static RadioTrack Clip;

	private bool isPlayingTrack = false;

	private bool startedSequence = false;

	private bool areSpeakersPowered = true;

	private float ClipTime;

	private string DebugSignature = " Loudspeaker Debug / FNV";

	private BreakerBox BreakerBoxInWorld;

	private MyModConfig Config = Plugin.VegasConfig;

	private void Awake()
	{
		if (startedSequence)
		{
			return;
		}
		startedSequence = true;
		bool flag = true;
		if (Config != null)
		{
			flag = Config.radio_UseCopyrightedAudio.Value;
			if (flag)
			{
				MonoBehaviour.print((object)("Mixing copyrighted & royalty free audio! " + DebugSignature));
			}
			else
			{
				MonoBehaviour.print((object)("Eliminating copyrighted audio! " + DebugSignature));
			}
		}
		if (!flag)
		{
			RadioTrack[] radioTracks = RadioTracks;
			foreach (RadioTrack radioTrack in radioTracks)
			{
				if (!radioTrack.IsCopyrighted)
				{
					Songs = CollectionExtensions.AddToArray<RadioTrack>(Songs, radioTrack);
				}
			}
		}
		else
		{
			RadioTrack[] radioTracks2 = RadioTracks;
			foreach (RadioTrack radioTrack2 in radioTracks2)
			{
				Songs = CollectionExtensions.AddToArray<RadioTrack>(Songs, radioTrack2);
			}
		}
		((MonoBehaviour)this).StartCoroutine(GatherLoudspeakers());
	}

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

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

	private void LoudspeakerSystem()
	{
		isPlayingTrack = true;
		((MonoBehaviour)this).StartCoroutine(PlayTrack());
	}

	private void LateUpdate()
	{
		if ((Object)(object)BreakerBoxInWorld != (Object)null && ((NetworkBehaviour)this).IsHost)
		{
			if (BreakerBoxInWorld.isPowerOn & !areSpeakersPowered)
			{
				areSpeakersPowered = true;
				ToggleSpeakerStateClientRpc();
			}
			else if (!BreakerBoxInWorld.isPowerOn & areSpeakersPowered)
			{
				areSpeakersPowered = false;
				ToggleSpeakerStateClientRpc(poweredOn: false);
			}
		}
	}

	[ClientRpc]
	public void ToggleSpeakerStateClientRpc(bool poweredOn = true)
	{
		//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)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1585278065u, val, (RpcDelivery)0);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref poweredOn, default(ForPrimitives));
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1585278065u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		base.__rpc_exec_stage = (__RpcExecStage)0;
		try
		{
			GameObject[] loudspeakers = Loudspeakers;
			foreach (GameObject val3 in loudspeakers)
			{
				if ((Object)(object)val3 != (Object)null)
				{
					AudioSource component = val3.GetComponent<AudioSource>();
					AudioLowPassFilter component2 = val3.GetComponent<AudioLowPassFilter>();
					AudioReverbFilter component3 = val3.GetComponent<AudioReverbFilter>();
					if (poweredOn)
					{
						component.volume = AudioVolume;
					}
					else
					{
						component.volume = 0f;
					}
				}
			}
		}
		catch
		{
		}
	}

	[ClientRpc]
	public void SyncAudiosClientRpc(int SongPosition = 1)
	{
		//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)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1502762950u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, SongPosition);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1502762950u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
		{
			return;
		}
		base.__rpc_exec_stage = (__RpcExecStage)0;
		try
		{
			RadioTrack radioTrack = Songs[SongPosition];
			GameObject[] loudspeakers = Loudspeakers;
			foreach (GameObject val3 in loudspeakers)
			{
				if ((Object)(object)val3 != (Object)null)
				{
					AudioSource component = val3.GetComponent<AudioSource>();
					AudioLowPassFilter component2 = val3.GetComponent<AudioLowPassFilter>();
					AudioReverbFilter component3 = val3.GetComponent<AudioReverbFilter>();
					component3.decayTime = 2f;
					component3.decayHFRatio = 0.5f;
					component3.reverbLevel = 1f;
					((Behaviour)component3).enabled = EnableReverbFilter;
					((Behaviour)component2).enabled = EnableLowPassFilter;
					component2.lowpassResonanceQ = 1f;
					component2.cutoffFrequency = CustomScrapSpawnNV.NevadaRandom.Next(4500, 5000);
					component.clip = radioTrack.TrackClip;
					component.minDistance = MinRange;
					component.maxDistance = MaxRange;
					component.spatialBlend = 1f;
					component.spread = 120f;
					component.rolloffMode = RolloffMd;
					component.outputAudioMixerGroup = AudioMix;
					if (areSpeakersPowered)
					{
						component.volume = AudioVolume;
					}
					else
					{
						component.volume = 0f;
					}
					component.reverbZoneMix = 1f;
					component.dopplerLevel = 0f;
					component.Play();
				}
			}
		}
		catch
		{
		}
	}

	protected override void __initializeVariables()
	{
		((NetworkBehaviour)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(1585278065u, new RpcReceiveHandler(__rpc_handler_1585278065), "ToggleSpeakerStateClientRpc");
		((NetworkBehaviour)this).__registerRpc(1502762950u, new RpcReceiveHandler(__rpc_handler_1502762950), "SyncAudiosClientRpc");
		((NetworkBehaviour)this).__initializeRpcs();
	}

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

	private static void __rpc_handler_1502762950(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 songPosition = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref songPosition);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((IntercomsManager)(object)target).SyncAudiosClientRpc(songPosition);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "IntercomsManager";
	}
}
[Serializable]
public class SyncedInstance<T>
{
	[NonSerialized]
	protected static int IntSize = 4;

	internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

	internal static bool IsClient => NetworkManager.Singleton.IsClient;

	internal static bool IsHost => NetworkManager.Singleton.IsHost;

	public static T Default { get; private set; }

	public static T Instance { get; private set; }

	public static bool Synced { get; internal set; }

	protected void InitInstance(T instance)
	{
		Default = instance;
		Instance = instance;
		IntSize = 4;
	}

	internal static void SyncInstance(byte[] data)
	{
		Instance = DeserializeFromBytes(data);
		Synced = true;
	}

	internal static void RevertSync()
	{
		Instance = Default;
		Synced = false;
	}

	public static byte[] SerializeToBytes(T val)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		using MemoryStream memoryStream = new MemoryStream();
		try
		{
			binaryFormatter.Serialize(memoryStream, val);
			return memoryStream.ToArray();
		}
		catch (Exception)
		{
			return null;
		}
	}

	public static T DeserializeFromBytes(byte[] data)
	{
		BinaryFormatter binaryFormatter = new BinaryFormatter();
		using MemoryStream serializationStream = new MemoryStream(data);
		try
		{
			return (T)binaryFormatter.Deserialize(serializationStream);
		}
		catch (Exception)
		{
			return default(T);
		}
	}
}
public class Vault11Door : MonoBehaviour
{
	[CompilerGenerated]
	private sealed class <AnimateDoor>d__17 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public string DoorState;

		public Vault11Door <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (!<>4__this.inProgress & (<>4__this.CurrentState != DoorState))
				{
					<>4__this.inProgress = true;
					<>4__this.CurrentState = DoorState;
					if (DoorState == "Open")
					{
						((Collider)<>4__this.DoorCollision).enabled = false;
						<>4__this.DoorAudio.PlayOneShot(<>4__this.OpenSFX);
						<>2__current = (object)new WaitForSeconds(0f);
						<>1__state = 1;
						return true;
					}
					((Collider)<>4__this.DoorCollision).enabled = true;
					<>4__this.DoorAudio.PlayOneShot(<>4__this.CloseSFX);
					<>2__current = (object)new WaitForSeconds(0f);
					<>1__state = 2;
					return true;
				}
				break;
			case 1:
				<>1__state = -1;
				<>4__this.DoorAnimator.Play("Open", 0, 0f);
				<>4__this.DoorAnimator.CrossFade("Open", 0.25f);
				goto IL_01ae;
			case 2:
				<>1__state = -1;
				<>4__this.DoorAnimator.Play("Closed", 0, 0f);
				<>4__this.DoorAnimator.CrossFade("Closed", 2f);
				goto IL_01ae;
			case 3:
				{
					<>1__state = -1;
					<>4__this.inProgress = false;
					break;
				}
				IL_01ae:
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 3;
				return true;
			}
			if ((<>4__this.CurrentState == "Open") & (<>4__this.DoorPassers <= 0f))
			{
				((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.AnimateDoor("Closed"));
			}
			<>4__this.deBounce = false;
			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 <Timer>d__15 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public int seconds;

		public Vault11Door <>4__this;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds((float)seconds);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				Debug.Log((object)"Door Timer Up!");
				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 <WaitForBreaker>d__16 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public Vault11Door <>4__this;

		private IEnumerable<GameObject> <Breakers>5__1;

		private IEnumerator<GameObject> <>s__2;

		private GameObject <Breaker>5__3;

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

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

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

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

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<Breakers>5__1 = from obj in Object.FindObjectsOfType<GameObject>()
					where (Object)(object)obj.GetComponent<BreakerBox>() != (Object)null
					select obj;
				if (<Breakers>5__1 != null)
				{
					<>s__2 = <Breakers>5__1.GetEnumerator();
					try
					{
						while (<>s__2.MoveNext())
						{
							<Breaker>5__3 = <>s__2.Current;
							if ((Object)(object)<Breaker>5__3.GetComponent<BreakerBox>() != (Object)null)
							{
								<>4__this.BreakerBoxInWorld = <Breaker>5__3.GetComponent<BreakerBox>();
							}
							<Breaker>5__3 = null;
						}
					}
					finally
					{
						if (<>s__2 != null)
						{
							<>s__2.Dispose();
						}
					}
					<>s__2 = null;
				}
				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 DoorAudio;

	public AudioClip OpenSFX;

	public AudioClip CloseSFX;

	public Animator DoorAnimator;

	public BoxCollider DoorCollision;

	private float DoorPassers = 0f;

	private bool inUse = false;

	private bool inProgress = false;

	private bool deBounce = false;

	private string CurrentState = "Closed";

	private BreakerBox BreakerBoxInWorld;

	private void Awake()
	{
		((MonoBehaviour)this).StartCoroutine(WaitForBreaker());
	}

	private void OnTriggerStay(Collider other)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		Bounds bounds = ((Collider)((Component)this).gameObject.GetComponent<BoxCollider>()).bounds;
		if (((Bounds)(ref bounds)).Intersects(other.bounds))
		{
			if (DoorPassers < 50f)
			{
				DoorPassers += 5f;
			}
			return;
		}
		DoorPassers -= 1f;
		if (DoorPassers <= 0f)
		{
			DoorPassers = 0f;
		}
		Debug.Log((object)"Entity left");
	}

	private void Update()
	{
		if (DoorPassers > 0f)
		{
			DoorPassers -= 1f;
		}
		if ((Object)(object)BreakerBoxInWorld != (Object)null && !BreakerBoxInWorld.isPowerOn)
		{
			DoorPassers = 50f;
		}
		UpdateCount();
	}

	private void UpdateCount()
	{
		if (!deBounce)
		{
			deBounce = true;
			if (DoorPassers <= 0f)
			{
				((MonoBehaviour)this).StartCoroutine(AnimateDoor("Closed"));
			}
			if (DoorPassers > 0f)
			{
				((MonoBehaviour)this).StartCoroutine(AnimateDoor("Open"));
			}
		}
	}

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

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

	[IteratorStateMachine(typeof(<AnimateDoor>d__17))]
	private IEnumerator AnimateDoor(string DoorState)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <AnimateDoor>d__17(0)
		{
			<>4__this = this,
			DoorState = DoorState
		};
	}
}
namespace FNV
{
	internal class MyModConfig
	{
		public readonly ConfigEntry<string> greeting;

		public readonly ConfigEntry<bool> displayLogs;

		public readonly ConfigEntry<bool> radio_UseCopyrightedAudio;

		public MyModConfig(ConfigFile cfg)
		{
			cfg.SaveOnConfigSet = false;
			displayLogs = cfg.Bind<bool>("Debugging", "EnableDebugging", true, "Enable console output text");
			radio_UseCopyrightedAudio = cfg.Bind<bool>("NewVegas", "EnableCopyrightedTracks", true, "Use Copyrighted New Vegas Radio Tracks");
			ClearOrphanedEntries(cfg);
			cfg.Save();
			cfg.SaveOnConfigSet = true;
		}

		private static void ClearOrphanedEntries(ConfigFile cfg)
		{
			PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg);
			dictionary.Clear();
		}
	}
	[BepInPlugin("lostpoet.NewVegasMod", "NewVegasMod", "1.0.2")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource VegasLogger;

		internal static LogLevel VegasLoggerLevel = (LogLevel)16;

		private string ASCII_Watermark = "\r\n\r\n\r\n%%%%%##***#######*********+*+===++++***##%%%@@@@@@@@@@@@@@@@%++++*+++++****########*#%#########%%%%%\r\n%%%%%#*******************++++++++***####%@@@@@@@@@@@@@@@%%%%%@@%*+***+*****#####*****+*********#####\r\n%%%###**************+***++++++==++**##%%%@@@@@@@@@@%@%%%%%@%%%%%%%++++++*+++*##****************#####\r\n%%####*****************+++++++==***%%%%@@%%%%%%%%%%%%%%%%%%%%%##%###+++++++***************####**####\r\n%#####*+*****+++++**+*+++++++++*###@@@%%%%%###%%%%#%%%%%%%##%##*#####*++***####****##*#*#####*######\r\n######***++++++++++++++++++=++=+*#%%%@%%%%#####+*###%%%#####%#%%##%%%##########****#*###########%##%\r\n#######***+++++===============+*#%%%%%%%%%#***++*###%#%#####%%%%%#%%%%%#########################%##%\r\n#*####****++=+=====+@========***%%@@%%%%%##+++*****#%######%%#%%%%%%%%########%%%###############%%%%\r\n##*###***++=========@=-===-=-+*#%@@@%%%%##*+=+***+**#*###%%%%#%#%%%%%#%#%%#%%%%%%%%############%%%%%\r\n****#%#***+++=======#===-====+#%@@@@%%%####*=******###%#%%%%%%@%%%%%#%%%%%%%%%%%#%##########%%%%%%%%\r\n##****#****++++===-=*#===***@@@@@@@%%%%%#*#*+*+******##%%%%%@%%%%%%%%%%%%%%%%%%%%%##########%%%%%%%%\r\n#####******++++++====@-+=#%%@@@@@@@%%%%%####*++##**####%%%#**##%%%**%#%%%%%%%%%%%##########%%%%%%%%%\r\n##*###******+*+++++++@**%@*@@%@@@%%@%%%%#########**###########%%%####%%%%%%%%%%%%%%%%#######%%%%%%%%\r\n###########****+*+***@@#@@@@@@@@@@@%%%####*++++-==+=+*******+*#######%%%%%%%%%%%%%%%##%####%%%%%%%%%\r\n%%%%####%%%%######***@@#@%%@@@@@@@@%%#*#*+=---:---==+++**++==+***##*##%%#%%%%%%%%%%###%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%######@*#*%%%%@@@@%%%###*#++*%**+*+*+++*********#****##%@@*%#%###%%%%%%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%%%%%#@@@@@%@@%@@@@@@%#@@@@@@@@%%%%%@@@@#%##%%@@%%%*@@@*#@@@@*###%%%%%%%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%%%%%@@@@@@%@@%@@@@@@%#%%%%%%##**+=#%%%%*==+=+**#%%+%@@@*@@@@@@#%%%%%%%%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@%%%+##%#####*++=*%##@+==+-+#*###=#%%@@@@@@@@@@*%%%%%%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@%%%**##*#**++*%%%##@%*==++#*+*+**#%@@@@@@@@@@@%*%%%%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@@%%%%##%@@@%%***====++*%@%#***+*%@%@@@@@@@@@%%%%*%%%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@@@@@%%#%%%%%##%**--=+==+**###**#%@@@@@@@@@@@@%%%%%#*%%%%%%%%%%%%%%\r\n%%%%%%%%%%%%%%%+=@@@@@@@@@@@@@@@@@@@@@@#**#%%###%@%*=+*%%+=+#*+*#*@@@*%@@@@@@@@%%%%###*%%%%%%%%%%%%%\r\n%%%%%%%%%%%%+==*#%@@@@@@@@@@@@@@@@@@@@@@#**##@%%%*+-::-==**#*+**+##%*#@@@@@@%%%%%%%%###++%%%%%*#++=*\r\n%%%%%%%%%%-=+#%%#%@@@@@@@@@@@%%%%%%##@@@#%##%%#%#%%##**#*===:=#%#*#+#@@@@@@%%%%%%%%#####**+**+++--#%\r\n%%%%%%%==+#%%%@@#%%@@@@@@%%%%@#%%@%@%@@@@@%#%%%*%%%%%%%%#+#--+@@*#+#%@@@@@@%%####%%#%##**=**=:=#%@+*\r\n%%%%%*@%%@%@@@@@%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@#%*###*==+%@%%%@#%**#@@@@@@@%%%%#%%%%#*#*-=+*#%@@=::+\r\n%%%%=%@@@@@@@@%#%%%%@@@@@@@@@@@@@@@@@@+@@@@@@%%%@@@@@@@@@%#@%@@%%*%@@@@@@@@@%%######=:+*+--::=*--**#\r\n%%-+#%@@%#%%@@@%%%%%%%%@@@@@@@@@@@@%@#@@@@@@@@@@%@@*#@@##@@@@@@@%#@@@@@@@@@%%#**==+%%=-:::-+@%-@%*=#\r\n++#%@@@*%%%@@@@#%%%####%%@@@@@@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@%@@%@@@@@@@@@@%%**##*=-:--=*@%=:-@@+-=%\r\n*%%@@@@@@@@@@@%%%######%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#**%@@@@@@@%@@#*=*-=:-=+##*--+@@#**=:+%\r\n%%%@%@@@@@%%%%%#%%#######%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@***#%@@@@%%@%*++#@@=***##%@@@@**##--%%%@\r\n%%%%%%%%%%%%%%%#%#**##*###%%%@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%#%###%@@@@@@%%%%%#@@%%#%%%@#**#*-:=@@%##%\r\n%%%%%%%%%%%%%%#####*###%#%%%%%@@@@@@@@@@@@@@@@@@@@@@@@@@%%%%%%##*+##%@@@%%%##*#%%######*=:-##%##**#%\r\n%%%%%%%%%%%#%%##########%%%%%%%%@@@@@@@@@@%@@%%@@@@@@%%##**+***####%%@@@%%%%*+=#+**#@+=:#@#=*###%##@\r\n%%#%%%%%%%%%%%%##########%%%%%#%@@@%@@%@%@%@%%#******####%%##%%%%##%%%%%%%%%%%%#*****####*#@=#%%#%%@\r\n@@%#%#%%%%%%%%%########%###%%%%%%@@@%@@%%%%%%#######%%%%%%%%%%#%%%%%****###%%%@@%%@%@@@%%%%@+#%#%#@@\r\n###%%%#%%%%%%%%#%#########%%%%%%%@@@#%@@#@@%%@%%%%%%%%%##%%#*%%*%%%%%%%%%@@@@@@@@@@%#%%*#%+%@%%%#%@@\r\n#%#%%%%%%%%%%%%###########%%%%%%%%@@@%#@@@@@@@@@@%%%##%#*%%##%%%%%#%#***##%%%@@%@@@%*%%##%%%%%#%%@@@\r\n%#%%%%%%%%%%%%%######*#####%#%%%%%%@@@#*#@@@@@@@@@@%#%%%*%%%%#%#%%%%####%@@@@%%@@%%%#%@%%%@@@%%@#*@%\r\n%%#%%%%%%%%%%%%%########%##%%%%%%%%%%@@###%@@%@@@@%@#%%@%@@#=--@@+-+@%-*%@+-@@@+:--%=-*-@=---@%#@@*#\r\n%##%%%%%%%%%%%@%#######%#%%#%%%%%%%%%%@%#***%@%%@%%%%%%@@@@%=++#@==-%%:#%@*-@@@--+=%=-*-@%+=@@*+%%@@\r\n###%%%%%%%%@@@@@##########%%%%%%@%%%%%%%#######@%%%%%@@%%##%-%@%#-=-%%-*@@*=@@@+=+-%+-*-@%+=@%*=%%%@\r\n%%%%@%%%@@@@@@@@*#########%%%%%%%%%%%%%%%%%*%%%@@###%@@%*#%%+%%%+-@-*%---%*---@@*+%%%==#%%*+@%@@%@%#\r\n%%@@@@@@@@@@@@@@%%%%%%@@@%@@@@@@@%@%%%@@*+*#%%%@%%#%%@%%%@%%%%%%#@%@%@@@%%@@%%%#%%%%%%%%%%@%@@%%%%%*\r\n@@@@@@@@@@@@@@=--=@#-+%%-------@+=-#%=--*%*:-#@#@%%---@%=--%+-------%#--=---#@%@+:--*%%%*------#@%%#\r\n%%@@@@@@@@@@@@=---##--%%:--*#####=-+%-:-*%---@%%#%%+==#%+++%+---##%@@--=*#---@@@--:--%%@:--%@---@@%@\r\n@@%@@@@@@@@@@@*=---+:-%@--=%%%%%@::=%:-=*@==+@%##%@%***%**%%*:-#@@@@@:--@@@%%#@@--+-:*@@++**%@@@@@@@\r\n@@@@@@@@@@@@@@*==---:-%@------*%@=--*:--=*=+#%%%%#@%==+*+=%%%++++=+@@---%--=+@@*-@@@=-@@@@+--+%@@@@@\r\n@@@@@@@@@@@%%@==-%---:##===@@@%#@#-::-%*=+-*%+#%%%%@*-=+=+@@#-+*%@@@@=--@+--:@@:--%---@@@@@@---=@@@@\r\n@@@@@@%%%%%%%@=++@+---%%=+=@@@%#@@-::=@#:-=*@%+#%%%%@--==#@@+-+*@@@@@=--%%:::@@----:--+#---@%--+@@@@\r\n@@@@@@@@@%@%@%---@@-==#@*#*++++#@@=::=@@---%@%%%*@@@@+--=@@@+===----%#-------@#+=+%*=--%+---==+%@@@@\r\n@@@@@@@@%@%*#@%*#@@@#%@@@@@@@@%%@@@#*@@@%##@%@@%@#+@@@##%@@@@%%#%###@@@%%%@@@@%##@@@#%#%%@@##%@@@@@%\r\n@@@@@@@***%@@@#%@@@%@@@@@@@@@%%#@@@@@@@@@@@@@@@@%%@@@@@@@@@@@@%%%%@@@@@@@%%@@@@@%@%%%%%%%%@@@@@@#@@@\r\n@@@#@*#*###*@@@@@@@%@@@@@@@@@@@%@@@@@@@@@@@@@@@@@@@@@@@@@@@@%@@@%%#%%%@@@@@@@@@@@@%%%%%%%%%@@@%%@%@@\r\n\r\n\r\n\r\n        ";

		internal static MyModConfig VegasConfig { get; private set; } = null;


		private static void NetcodePatcher()
		{
			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);
					}
				}
			}
		}

		private void Awake()
		{
			VegasConfig = new MyModConfig(((BaseUnityPlugin)this).Config);
			if (VegasConfig.displayLogs.Value)
			{
				VegasLogger = ((BaseUnityPlugin)this).Logger;
			}
			VegasLogger.LogInfo((object)"<--WELCOME TO THE WASTELAND-->");
			VegasLogger.LogInfo((object)ASCII_Watermark);
			VegasLogger.LogInfo((object)"<--WELCOME TO THE WASTELAND-->");
			NewVegasLoader.PopulateAssets();
			NetcodePatcher();
			Harmony.CreateAndPatchAll(typeof(VegasPatches), (string)null);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "FNV";

		public const string PLUGIN_NAME = "FNV";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FNV.NewFolder
{
	public class CustomScrapSpawnNV : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <GatherSpawnPoints>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CustomScrapSpawnNV <>4__this;

			private IEnumerable<GameObject> <searchedSpawns>5__1;

			private IEnumerator<GameObject> <>s__2;

			private GameObject <spawn>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected O, but got Unknown
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_017f: Expected O, but got Unknown
				//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01af: Expected O, but got Unknown
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(7f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					MonoBehaviour.print((object)"New Vegas: Spawning scrap");
					<searchedSpawns>5__1 = from obj in Object.FindObjectsOfType<GameObject>()
						where (Object)(object)obj.GetComponent<NVSpawnProperty>() != (Object)null
						select obj;
					if (<searchedSpawns>5__1 != null)
					{
						<>s__2 = <searchedSpawns>5__1.GetEnumerator();
						try
						{
							while (<>s__2.MoveNext())
							{
								<spawn>5__3 = <>s__2.Current;
								<>4__this.ScrapSpawnPoints = CollectionExtensions.AddToArray<GameObject>(<>4__this.ScrapSpawnPoints, <spawn>5__3);
								<spawn>5__3 = null;
							}
						}
						finally
						{
							if (<>s__2 != null)
							{
								<>s__2.Dispose();
							}
						}
						<>s__2 = null;
					}
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					if ((<>4__this.ScrapSpawnPoints != null) & ((NetworkBehaviour)<>4__this).IsClient)
					{
						<>4__this.EmptySpawnsforServerRpc();
					}
					<>2__current = (object)new WaitForSeconds(5f);
					<>1__state = 3;
					return true;
				case 3:
					<>1__state = -1;
					if (((NetworkBehaviour)<>4__this).IsHost)
					{
						<>2__current = (object)new WaitForSeconds(5f);
						<>1__state = 4;
						return true;
					}
					break;
				case 4:
					<>1__state = -1;
					<>4__this.readyToSync = true;
					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();
			}
		}

		[Header("Spawn Settings")]
		[Space(5f)]
		public GameObject[] ScrapSpawnPoints;

		public static GameObject[] SpawnedItems;

		public static int[] ItemValues;

		private bool SpawnedScrap = false;

		private bool readyToSync = false;

		private float ScrapCount = 0f;

		public static Random NevadaRandom = new Random(10101997);

		public static CustomScrapSpawnNV SpawnerInstance;

		public Item ReturnRandomItemFromGroup(NVGroupProperty ItemGroup)
		{
			Item result = null;
			if (ItemGroup.Items.Length > 1)
			{
				result = ItemGroup.Items[NevadaRandom.Next(0, ItemGroup.Items.Length)];
			}
			return result;
		}

		public void SpawnScrap(Item Scrap, Transform ScrapOrigin, NVGroupProperty ScrapGroup)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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)
			int num = NevadaRandom.Next(ScrapGroup.ItemValueRange.x, ScrapGroup.ItemValueRange.y);
			GameObject val = Object.Instantiate<GameObject>(Scrap.spawnPrefab, ((Component)ScrapOrigin).transform.position, Quaternion.identity, (Transform)null);
			val.transform.SetParent(ScrapOrigin);
			GrabbableObject component = val.GetComponent<GrabbableObject>();
			((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
			component.fallTime = 0f;
			component.scrapValue = num;
			ScanNodeProperties[] componentsInChildren = val.GetComponentsInChildren<ScanNodeProperties>();
			if (componentsInChildren != null)
			{
				ScanNodeProperties[] array = componentsInChildren;
				foreach (ScanNodeProperties val2 in array)
				{
					val2.subText = "Value: " + num;
					val2.scrapValue = num;
					val.GetComponent<GrabbableObject>().scrapValue = num;
				}
			}
			NetworkObject component2 = val.GetComponent<NetworkObject>();
			component2.Spawn(false);
			SpawnedItems = CollectionExtensions.AddToArray<GameObject>(SpawnedItems, val);
			ItemValues = CollectionExtensions.AddToArray<int>(ItemValues, num);
			UpdateScanNodeforClientRpc(new NetworkObjectReference(val), num);
		}

		[ClientRpc]
		public void UpdateScanNodeforClientRpc(NetworkObjectReference Node, int Value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2262514626u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref Node, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, Value);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2262514626u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			NetworkObject val3 = default(NetworkObject);
			((NetworkObjectReference)(ref Node)).TryGet(ref val3, (NetworkManager)null);
			if ((Object)(object)val3 != (Object)null)
			{
				GrabbableObject val4 = default(GrabbableObject);
				if (((Component)val3).TryGetComponent<GrabbableObject>(ref val4))
				{
					val4.SetScrapValue(Value);
				}
				ScanNodeProperties componentInChildren = ((Component)val3).GetComponentInChildren<ScanNodeProperties>();
				componentInChildren.subText = "Value: " + Value;
				componentInChildren.scrapValue = Value;
			}
		}

		[ClientRpc]
		public void SyncScrapValuesforClientRpc()
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1562523839u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1562523839u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			int num = 0;
			GameObject[] spawnedItems = SpawnedItems;
			foreach (GameObject val3 in spawnedItems)
			{
				GrabbableObject component = val3.GetComponent<GrabbableObject>();
				ScanNodeProperties[] componentsInChildren = val3.GetComponentsInChildren<ScanNodeProperties>();
				if (componentsInChildren != null)
				{
					ScanNodeProperties[] array = componentsInChildren;
					foreach (ScanNodeProperties val4 in array)
					{
						component.SetScrapValue(ItemValues[num]);
						val4.subText = "Value: " + ItemValues[num];
						val4.scrapValue = ItemValues[num];
						num++;
					}
				}
			}
			ScrapCount = SpawnedItems.Length;
		}

		[ServerRpc(RequireOwnership = false)]
		private void EmptySpawnsforServerRpc()
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2801191227u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2801191227u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (ScrapSpawnPoints == null)
			{
				return;
			}
			GameObject[] scrapSpawnPoints = ScrapSpawnPoints;
			foreach (GameObject val3 in scrapSpawnPoints)
			{
				NVSpawnProperty component = val3.GetComponent<NVSpawnProperty>();
				if (!(((Object)(object)component != (Object)null) & (component.SpawnGroups.Length != 0) & !component.spawnWasUsed))
				{
					continue;
				}
				component.spawnWasUsed = true;
				NVGroupProperty nVGroupProperty = ((component.SpawnGroups.Length != 1) ? component.SpawnGroups[NevadaRandom.Next(0, component.SpawnGroups.Length)] : component.SpawnGroups.First());
				if (nVGroupProperty.Items.Length == 0)
				{
					continue;
				}
				int num = NevadaRandom.Next(0, nVGroupProperty.Items.Length);
				if (nVGroupProperty.randomGeneration)
				{
					if (NevadaRandom.Next(nVGroupProperty.ItemValueRange.x, nVGroupProperty.ItemValueRange.y) <= NevadaRandom.Next(0, nVGroupProperty.ItemValueRange.y))
					{
						SpawnScrap(nVGroupProperty.Items[num], component.SpawnOrigin, nVGroupProperty);
					}
				}
				else
				{
					SpawnScrap(nVGroupProperty.Items[num], component.SpawnOrigin, nVGroupProperty);
				}
			}
		}

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

		private void Awake()
		{
			if (!SpawnedScrap)
			{
				SpawnedScrap = true;
				SpawnerInstance = ((Component)this).gameObject.GetComponent<CustomScrapSpawnNV>();
				((MonoBehaviour)this).StartCoroutine(GatherSpawnPoints());
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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
			((NetworkBehaviour)this).__registerRpc(2262514626u, new RpcReceiveHandler(__rpc_handler_2262514626), "UpdateScanNodeforClientRpc");
			((NetworkBehaviour)this).__registerRpc(1562523839u, new RpcReceiveHandler(__rpc_handler_1562523839), "SyncScrapValuesforClientRpc");
			((NetworkBehaviour)this).__registerRpc(2801191227u, new RpcReceiveHandler(__rpc_handler_2801191227), "EmptySpawnsforServerRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2262514626(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference node = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref node, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CustomScrapSpawnNV)(object)target).UpdateScanNodeforClientRpc(node, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1562523839(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;
				((CustomScrapSpawnNV)(object)target).SyncScrapValuesforClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2801191227(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;
				((CustomScrapSpawnNV)(object)target).EmptySpawnsforServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "CustomScrapSpawnNV";
		}
	}
	public class IntercomsClient : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <SyncCall>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public IntercomsClient <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.SyncAudioClientRpc();
					<>2__current = (object)new WaitForSeconds(2f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SyncCall());
					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 IntercomsManager RadioHost;

		private bool Debounce = false;

		[ClientRpc]
		public void SyncAudioClientRpc()
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1393423406u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1393423406u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (RadioHost.Loudspeakers.Length != 0)
			{
				GameObject[] loudspeakers = RadioHost.Loudspeakers;
				foreach (GameObject val3 in loudspeakers)
				{
				}
			}
		}

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

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine(SyncCall());
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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(1393423406u, new RpcReceiveHandler(__rpc_handler_1393423406), "SyncAudioClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1393423406(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;
				((IntercomsClient)(object)target).SyncAudioClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "IntercomsClient";
		}
	}
	public class LootboxObject : NetworkBehaviour
	{
		[Header("Lootbox Settings")]
		[Space(5f)]
		public Animator BoxAnimator;

		public AnimationClip OpenAnimation;

		public AnimationClip CloseAnimation;

		public Transform ScrapSpawnPosition;

		[Header("Item Spawn Settings")]
		[Space(10f)]
		public NVGroupProperty ScrapPool;

		public AudioSource SoundEmitter;

		public AudioClip OpenSFX;

		public AudioClip CloseSFX;

		public float SpawnAmount = 1f;

		public InteractTrigger LootboxInteraction;

		public int DropRarity;

		public bool isOpened = false;

		public bool inUse = false;

		public bool scrapSpawned = false;

		public void AnimateLootbox(bool setOpen = true)
		{
			if (setOpen)
			{
				BoxAnimator.Play(((Object)OpenAnimation).name, 0, 0f);
				SoundEmitter.clip = OpenSFX;
			}
			else
			{
				BoxAnimator.Play(((Object)CloseAnimation).name, 0, 0f);
				SoundEmitter.clip = CloseSFX;
			}
			SoundEmitter.Play();
		}

		[ClientRpc]
		public void InteractionOpenClientRpc(bool doorValue = false)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1416259159u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref doorValue, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1416259159u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (doorValue)
				{
					AnimateLootbox();
					MonoBehaviour.print((object)"Server contacted: Door open");
				}
			}
		}

		[ClientRpc]
		public void InteractionCloseClientRpc(bool doorValue = true)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(340841365u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref doorValue, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 340841365u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (!doorValue)
				{
					AnimateLootbox(setOpen: false);
					MonoBehaviour.print((object)"Server contacted: Door Close");
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void InteractionServerRpc()
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1171617115u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1171617115u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (!inUse)
			{
				MonoBehaviour.print((object)"Client contacted: Loot Int");
				if (!isOpened)
				{
					InteractionOpenClientRpc(doorValue: true);
					SpawnInScrap();
				}
				else
				{
					InteractionCloseClientRpc(doorValue: false);
				}
				isOpened = !isOpened;
			}
		}

		public void SpawnInScrap()
		{
			if (scrapSpawned)
			{
				return;
			}
			MonoBehaviour.print((object)"Fridge Scrap Triggered debug!");
			scrapSpawned = true;
			int num = CustomScrapSpawnNV.NevadaRandom.Next(DropRarity, DropRarity + 2);
			if (num <= DropRarity || DropRarity == 0)
			{
				Item val = CustomScrapSpawnNV.SpawnerInstance.ReturnRandomItemFromGroup(ScrapPool);
				if ((Object)(object)val != (Object)null)
				{
					CustomScrapSpawnNV.SpawnerInstance.SpawnScrap(val, ScrapSpawnPosition, ScrapPool);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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
			((NetworkBehaviour)this).__registerRpc(1416259159u, new RpcReceiveHandler(__rpc_handler_1416259159), "InteractionOpenClientRpc");
			((NetworkBehaviour)this).__registerRpc(340841365u, new RpcReceiveHandler(__rpc_handler_340841365), "InteractionCloseClientRpc");
			((NetworkBehaviour)this).__registerRpc(1171617115u, new RpcReceiveHandler(__rpc_handler_1171617115), "InteractionServerRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

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

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

		private static void __rpc_handler_1171617115(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;
				((LootboxObject)(object)target).InteractionServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "LootboxObject";
		}
	}
	public class NevadaWastelandEnviro : NetworkBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayForComponents>d__6 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public NevadaWastelandEnviro <>4__this;

			private IEnumerable<GameObject> <Breakers>5__1;

			private IEnumerable<GameObject> <SetPieces>5__2;

			private IEnumerator<GameObject> <>s__3;

			private GameObject <Breaker>5__4;

			private IEnumerator<GameObject> <>s__5;

			private GameObject <Set>5__6;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<Breakers>5__1 = null;
				<SetPieces>5__2 = null;
				<>s__3 = null;
				<Breaker>5__4 = null;
				<>s__5 = null;
				<Set>5__6 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(8f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					MonoBehaviour.print((object)"New Vegas: Surverying Environment");
					<Breakers>5__1 = from obj in Object.FindObjectsOfType<GameObject>()
						where (Object)(object)obj.GetComponent<BreakerBox>() != (Object)null
						select obj;
					<SetPieces>5__2 = from obj in Object.FindObjectsOfType<GameObject>()
						where (Object)(object)obj.GetComponent<EnviroDetail>() != (Object)null
						select obj;
					if (<Breakers>5__1 != null)
					{
						<>s__3 = <Breakers>5__1.GetEnumerator();
						try
						{
							while (<>s__3.MoveNext())
							{
								<Breaker>5__4 = <>s__3.Current;
								if ((Object)(object)<Breaker>5__4.GetComponent<BreakerBox>() != (Object)null)
								{
									<>4__this.BreakerInWorld = <Breaker>5__4.GetComponent<BreakerBox>();
								}
								<Breaker>5__4 = null;
							}
						}
						finally
						{
							if (<>s__3 != null)
							{
								<>s__3.Dispose();
							}
						}
						<>s__3 = null;
					}
					if (<SetPieces>5__2 != null)
					{
						<>s__5 = <SetPieces>5__2.GetEnumerator();
						try
						{
							while (<>s__5.MoveNext())
							{
								<Set>5__6 = <>s__5.Current;
								if ((Object)(object)<Set>5__6.GetComponent<EnviroDetail>() != (Object)null)
								{
									<>4__this.EnvironmentalDetails = CollectionExtensions.AddToArray<EnviroDetail>(<>4__this.EnvironmentalDetails, <Set>5__6.GetComponent<EnviroDetail>());
								}
								<Set>5__6 = null;
							}
						}
						finally
						{
							if (<>s__5 != null)
							{
								<>s__5.Dispose();
							}
						}
						<>s__5 = null;
					}
					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 EnviroDetail[] EnvironmentalDetails;

		public BreakerBox BreakerInWorld;

		public float CurrentTime;

		public bool hitMidnight = false;

		public bool isNighttime = false;

		[ClientRpc]
		private void UpdateEnvironmentStateForClientRpc(bool setActive = false)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1683332142u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref setActive, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1683332142u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			if (EnvironmentalDetails == null)
			{
				return;
			}
			EnviroDetail[] environmentalDetails = EnvironmentalDetails;
			foreach (EnviroDetail enviroDetail in environmentalDetails)
			{
				if (setActive)
				{
					try
					{
						enviroDetail.BuildingLights.SetActive(true);
						enviroDetail.BuildingAnimator.Play(((Object)enviroDetail.Nighttime).name);
					}
					catch
					{
					}
				}
			}
		}

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

		private void Awake()
		{
			((MonoBehaviour)this).StartCoroutine(DelayForComponents());
		}

		private void LateUpdate()
		{
			if (!((Object)(object)RoundManager.Instance != (Object)null))
			{
				return;
			}
			CurrentTime = RoundManager.Instance.currentHour;
			if ((CurrentTime >= 12f) & !hitMidnight)
			{
				hitMidnight = true;
				if (((NetworkBehaviour)this).IsHost)
				{
					UpdateEnvironmentStateForClientRpc(setActive: true);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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(1683332142u, new RpcReceiveHandler(__rpc_handler_1683332142), "UpdateEnvironmentStateForClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

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

		protected internal override string __getTypeName()
		{
			return "NevadaWastelandEnviro";
		}
	}
	public class EnviroDetail : MonoBehaviour
	{
		public Animator BuildingAnimator;

		public GameObject BuildingLights;

		public bool isActive = false;

		[Space(5f)]
		[Header("Daytime/Nighttime Clips")]
		public AnimationClip Daytime;

		public AnimationClip Nighttime;

		private void Awake()
		{
			if ((Object)(object)BuildingLights != (Object)null)
			{
				BuildingLights.SetActive(false);
			}
		}
	}
	public static class NewVegasLoader
	{
		public static AssetBundle VegasAssetBundle;

		public static void PopulateAssets()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			VegasAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "VegasBundle"));
			if ((Object)(object)VegasAssetBundle == (Object)null)
			{
				Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)"Failed to load custom assets for New Vegas.");
			}
			else
			{
				Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)"Loaded New Vegas Assets");
			}
		}
	}
	public class VegasPatches
	{
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		[HarmonyPostfix]
		public static void GameNetworkManager_Start(GameNetworkManager __instance)
		{
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)NewVegasLoader.VegasAssetBundle == (Object)null)
			{
				return;
			}
			Item[] array = Resources.FindObjectsOfTypeAll<Item>();
			NevadaWastelandEnviro[] array2 = Resources.FindObjectsOfTypeAll<NevadaWastelandEnviro>();
			if (array.Length == 0)
			{
				Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)"Items list returned at zero");
			}
			else
			{
				Item[] array3 = array;
				foreach (Item val in array3)
				{
					try
					{
						((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(val.spawnPrefab);
						Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)("Added Vegas Asset prefabs to Network Manager: " + ((Object)val.spawnPrefab).name));
					}
					catch (Exception ex)
					{
						Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)("Ran into an error: " + ex));
					}
				}
			}
			if (array2.Length != 0)
			{
				NevadaWastelandEnviro[] array4 = array2;
				foreach (NevadaWastelandEnviro nevadaWastelandEnviro in array4)
				{
					try
					{
						((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(((Component)nevadaWastelandEnviro).gameObject);
						Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)("Added Vegas Asset prefabs to Network Manager: " + ((Object)((Component)nevadaWastelandEnviro).gameObject).name));
					}
					catch (Exception ex2)
					{
						Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)("Ran into an error: " + ex2));
					}
				}
			}
			else
			{
				Plugin.VegasLogger.Log(Plugin.VegasLoggerLevel, (object)"Wasteland manager list returned at zero");
			}
		}
	}
	[CreateAssetMenu(menuName = "NewVegas/ScriptableObjects/GroupProperty", order = 1)]
	public class NVGroupProperty : ScriptableObject
	{
		public Item[] Items;

		public int2 ItemValueRange;

		public bool randomGeneration = false;
	}
	public class NVScrapProperty
	{
		[Header("Scrap Properties")]
		[Space(5f)]
		public Item ScrapItem;

		public Transform ScrapOrigin;
	}
	public class NVSpawnProperty : MonoBehaviour
	{
		[Header("Spawn Properties")]
		[Space(5f)]
		public Transform SpawnOrigin;

		public NVGroupProperty[] SpawnGroups;

		public bool forceScrapGroup = true;

		public bool spawnWasUsed = false;
	}
	[Serializable]
	public class RadioTrack
	{
		public AudioClip TrackClip;

		[Space(5f)]
		[Header("Track Info")]
		public float Volume;

		public string SongName;

		public string Artist;

		public string YearReleased;

		public bool IsCopyrighted;
	}
}
namespace FNV.NewFolder.PlayerInteractive
{
	public class VegasCabin : NetworkBehaviour
	{
		[Header("Cabin Settings")]
		public Transform CabinPoint;

		public void TeleportUser()
		{
			MonoBehaviour.print((object)"Hello world");
		}

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

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

		protected internal override string __getTypeName()
		{
			return "VegasCabin";
		}
	}
	public class PlayerDamaging
	{
		public void DamagePlayer(PlayerControllerB PlayerController, float DamageValue)
		{
		}
	}
}
namespace FNV.NewFolder.Enemies
{
	public class NVAI : EnemyAI
	{
		[CompilerGenerated]
		private sealed class <SetTimer>d__59 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public float Seconds;

			public NVAI <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.TimerReached = false;
					<>2__current = (object)new WaitForSeconds(Seconds);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<>4__this.TimerReached = 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();
			}
		}

		[Header("New Vegas AI Properties")]
		public EnemyType EnemyType;

		public GameObject EnemyObject;

		public SphereCollider EnemyHitCollision;

		public SphereCollider EnemyBodyCollision;

		[Space(5f)]
		public SkinnedMeshRenderer SkinnedRender;

		public MeshRenderer MeshRender;

		public Animator EnemyAnimator;

		public AudioSource EnemyVoice;

		public AudioSource EnemySFX;

		public Transform Eye;

		public NavMeshAgent EnemyAgent;

		[Space(5f)]
		[Header("New Vegas AI States")]
		public bool isSleeping = true;

		public bool isDead = false;

		public int CurrentState = 0;

		[Space(5f)]
		[Header("New Vegas AI Settings")]
		public int EnemyHp = 2;

		public int StunTime = 4;

		public float WanderingDistance = 20f;

		public float SearchDistance = 35f;

		public float SightDistance = 10f;

		public float SightWidth = 42f;

		public float CombatDistance = 15f;

		public float MeleeDistance = 10f;

		public AnimationClip StunAnimation;

		public AnimationClip DeathAnimation;

		public AnimationClip[] InjuredAnimation = Array.Empty<AnimationClip>();

		public AudioClip IdleNoise;

		public AudioClip WakeupNoise;

		public AudioClip DeathNoise;

		[Space(5f)]
		[Header("AI Nodes")]
		public GameObject[] OutdoorNodes = Array.Empty<GameObject>();

		public GameObject[] IndoorNodes = Array.Empty<GameObject>();

		public bool isIndoors = false;

		[Space(5f)]
		[Header("New Vegas AI Info")]
		public GameObject TargetPointOverride;

		public Vector3 CurrentPosition;

		public PlayerControllerB PlayerTarget;

		public GameObject CurrentTarget;

		public GameObject[] TargetsInView = Array.Empty<GameObject>();

		public string isOwnedBy = "";

		public bool ResetViewTable = true;

		public bool ReachedDestination = true;

		public float DistanceFromTarget = 0f;

		public float AttackCD = 0f;

		private bool TimerReached = false;

		private float DistanceFromDest = 0f;

		private float SearchCD = 0f;

		private float ClientUpdateCD = 0f;

		private float CombatLayerWeight = 0f;

		private RaycastHit RayHit;

		private Ray EnemyRay;

		private LayerMask RaycastingMasks;

		[ClientRpc]
		public void UpdatePositionForClientRpc(Vector3 EnemyPosition)
		{
			//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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			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(1814294674u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref EnemyPosition);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1814294674u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Vector3 val3 = EnemyObject.transform.position - EnemyPosition;
				if (((Vector3)(ref val3)).magnitude > 5f)
				{
					EnemyObject.transform.position = EnemyPosition;
				}
			}
		}

		[ClientRpc]
		public void UpdateMovementStateforClientRpc(bool isMoving = false)
		{
			//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(2298773837u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMoving, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2298773837u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					EnemyAnimator.SetBool("isMoving", isMoving);
				}
			}
		}

		[ClientRpc]
		public void UpdateEnemyDestinationforClientRpc(Vector3 TargetPoint)
		{
			//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_00da: 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(3111618429u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref TargetPoint);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3111618429u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					EnemyAgent.destination = TargetPoint;
				}
			}
		}

		[ClientRpc]
		public void UpdateEnemyBehaviorforClientRpc(int CurrentBhvState = 0, int CurrentHealth = 2, float YHeight = 0f)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_007e: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			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(1393517015u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, CurrentBhvState);
				BytePacker.WriteValueBitPacked(val2, CurrentHealth);
				((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref YHeight, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1393517015u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (CurrentBhvState == 0)
				{
					base.currentBehaviourStateIndex = 1;
					base.currentBehaviourState.name = "Patrolling";
				}
				if (YHeight <= -10f)
				{
					base.isOutside = false;
				}
				else
				{
					base.isOutside = true;
				}
				base.enemyHP = CurrentHealth;
			}
		}

		public void PrepareDataForClient()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			CurrentPosition = EnemyObject.transform.position;
			Vector3 velocity = EnemyAgent.velocity;
			if (((Vector3)(ref velocity)).magnitude > 1f)
			{
				UpdateMovementStateforClientRpc(isMoving: true);
			}
			else
			{
				UpdateMovementStateforClientRpc();
			}
			if (EnemyObject.transform.position.y <= -10f)
			{
				isIndoors = true;
			}
			else
			{
				isIndoors = false;
			}
			UpdatePositionForClientRpc(CurrentPosition);
			UpdateEnemyBehaviorforClientRpc(CurrentState, base.enemyHP, EnemyObject.transform.position.y);
		}

		public void MoveTo(Vector3 Destination)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			UpdateEnemyDestinationforClientRpc(Destination);
			ReachedDestination = false;
		}

		public void Wakeup()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			RaycastingMasks = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Enemies" }));
			EnemySFX.loop = true;
			EnemyVoice.loop = false;
			EnemySFX.clip = IdleNoise;
			EnemySFX.Play();
			OutdoorNodes = GameObject.FindGameObjectsWithTag("OutsideAINode");
			IndoorNodes = GameObject.FindGameObjectsWithTag("AINode");
			isSleeping = false;
		}

		public bool CheckSight(GameObject Player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Player.transform.position - EnemyObject.transform.position;
			float num = Vector3.Angle(val, ((Component)Eye).transform.forward);
			if (((Vector3)(ref val)).magnitude <= SearchDistance && num < SightWidth)
			{
				try
				{
					Debug.DrawRay(EnemyObject.transform.position, val, Color.yellow);
				}
				catch
				{
				}
				if (Physics.Raycast(EnemyObject.transform.position, val, ref RayHit, SightDistance) && (Object)(object)((RaycastHit)(ref RayHit)).transform == (Object)(object)Player.transform)
				{
					MonoBehaviour.print((object)RayHit);
					MonoBehaviour.print((object)"Found a player");
					return true;
				}
			}
			return false;
		}

		public void ScanTargets()
		{
			SearchCD = 1f;
			if (ResetViewTable)
			{
				TargetsInView = Array.Empty<GameObject>();
			}
			IEnumerable<GameObject> enumerable = from obj in Object.FindObjectsOfType<GameObject>()
				where (Object)(object)obj.GetComponent<PlayerControllerB>() != (Object)null
				select obj;
			if (enumerable == null)
			{
				return;
			}
			foreach (GameObject item in enumerable)
			{
				if (CheckSight(item) && !TargetsInView.Contains(item))
				{
					TargetsInView = CollectionExtensions.AddToArray<GameObject>(TargetsInView, item);
				}
			}
		}

		public void Die()
		{
			isDead = true;
		}

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

		public override void OnCollideWithPlayer(Collider other)
		{
			MonoBehaviour.print((object)"Player Collide");
		}

		public override void OnCollideWithEnemy(Collider other, EnemyAI collidedEnemy = null)
		{
			MonoBehaviour.print((object)"Enemy collide");
		}

		public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			MonoBehaviour.print((object)"Enemy hit");
		}

		public override void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot = 0, int noiseID = 0)
		{
		}

		public override void Start()
		{
		}

		public override void Update()
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)this).IsServer)
			{
				isOwnedBy = "Server";
			}
			else if (((NetworkBehaviour)this).IsClient)
			{
				isOwnedBy = "Client";
			}
			else if (((NetworkBehaviour)this).IsClient & ((NetworkBehaviour)this).IsServer)
			{
				isOwnedBy = "Host";
			}
			else if (((NetworkBehaviour)this).IsHost)
			{
				isOwnedBy = "Host";
			}
			else
			{
				isOwnedBy = "Runtime";
			}
			if (isOwnedBy == "Client" || isSleeping || isDead)
			{
				return;
			}
			Vector3 val;
			if ((Object)(object)CurrentTarget != (Object)null)
			{
				val = CurrentTarget.transform.position - EnemyObject.transform.position;
				DistanceFromTarget = ((Vector3)(ref val)).magnitude;
				if ((DistanceFromTarget < CombatDistance) & (CurrentState >= 2))
				{
					EnemyAnimator.SetBool("inCombat", true);
					if (CombatLayerWeight < 2f)
					{
						CombatLayerWeight += 0.1f;
					}
					if (DistanceFromTarget < MeleeDistance)
					{
						EnemyAnimator.SetBool("isMelee", true);
					}
					else
					{
						EnemyAnimator.SetBool("isMelee", false);
					}
				}
				else
				{
					EnemyAnimator.SetBool("inCombat", false);
					if (CombatLayerWeight > 0f)
					{
						CombatLayerWeight -= 0.1f;
					}
				}
			}
			else
			{
				DistanceFromTarget = 0f;
				if (CombatL