Decompiled source of Mod menu notfishvr v1.0.0

plugins/Fish-Lethal-Company-Menu.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyMenu.MainMenu.Patch;
using LethalCompanyMenu.MainMenu.Stuff;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyProduct("NIKO Mod Menu")]
[assembly: AssemblyTitle("NIKO Mod Menu")]
[assembly: AssemblyDescription("This Is NIKO Mod Menu\rMade By discord.gg/nikomods/notfishvr")]
[assembly: AssemblyCompany("NIKO Mods")]
[assembly: AssemblyCopyright("Copyright © 2023 NIKO Mods")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyInformationalVersion("1.0")]
[assembly: AssemblyTrademark("NIKO Mods")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal static class RandomExtensionsHelpers
{
	public static void Shuffle<T>(this Random rng, T[] array)
	{
		int num = array.Length;
		while (num > 1)
		{
			int num2 = rng.Next(num--);
			T val = array[num];
			array[num] = array[num2];
			array[num2] = val;
		}
	}
}
namespace LethalCompanyMenu.MainMenu
{
	[BepInPlugin("lethalcompany.GUI", "notfishvr", "1.0.0")]
	internal class MainGUI : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static WindowFunction <0>__OnGUI;
		}

		public static bool Doonce = false;

		internal static bool nightVision;

		internal static bool enableGod;

		public Texture2D button;

		public Texture2D buttonHovered;

		public Texture2D buttonActive;

		public Texture2D windowBackground;

		public Texture2D textArea;

		public Texture2D textAreaHovered;

		public Texture2D textAreaActive;

		public Texture2D box;

		public GameObject directionalLightClone;

		public PlayerControllerHandler playerControllerHandler;

		public static PlayerManager _playerManager;

		public Dictionary<Type, List<Component>> objectCache = new Dictionary<Type, List<Component>>();

		public bool joining = false;

		public bool shouldSpawnEnemy;

		public AudioReverbTrigger currentAudioTrigger;

		public KeyCode toggleKey = (KeyCode)277;

		public int numberDeadLastRound;

		public static bool Cursorlock = false;

		public int SpeedSelection = 0;

		public static GameObject pointer;

		public string[] SpeedOptions = new string[5] { "Slow", "Default", "Fast", "Super Fast", "FASTTTTTTTS" };

		public float[] SpeedValues = new float[5] { 5f, 7.5f, 15f, 17.5f, 20f };

		public float Speed = 1.7f;

		internal static bool playerManagerEnabled = false;

		public string guiSelectedEnemy;

		public static bool hasGUISynced;

		public Random random = new Random();

		public float cacheRefreshInterval = 1.5f;

		public int enemyCount = 0;

		public bool addMoney = false;

		public static RoundManager currentRound;

		public string logs = "Logs (Only shows player deaths for now):\n";

		public static SelectableLevel currentLevel;

		public static Rect GUIRect = new Rect(0f, 0f, 540f, 240f);

		public static int selectedTab = 0;

		public static readonly string[] tabNames = new string[6] { "Self Tab", "Server Tab", "Visuals Tab", "Host", "Player List", "Settings" };

		public bool[] TogglePlayerList = new bool[999];

		public bool[] ToggleSelf = new bool[999];

		public bool[] ToggleServer = new bool[999];

		public bool[] ToggleVisuals = new bool[999];

		public bool[] ToggleHost = new bool[999];

		public bool toggled = true;

		public PlayerControllerB selectedPlayer;

		internal static float nightVisionIntensity;

		internal static float nightVisionRange;

		internal static Color nightVisionColor;

		public float toggleDelay = 0.5f;

		public float lastToggleTime;

		public Vector2 scrollPosition = Vector2.zero;

		private static MainGUI _instance;

		public static MainGUI Instance => _instance;

		private void DrawSelfTab()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			ToggleSelf[1] = ToggleButton("No Fog", ToggleSelf[1]);
			ToggleSelf[2] = ToggleButton("Night Vision", ToggleSelf[2]);
			ToggleSelf[3] = ToggleButton("God Mode", ToggleSelf[3]);
			ToggleSelf[4] = ToggleButton("Speed", ToggleSelf[4]);
			ToggleSelf[5] = ToggleButton("Fly", ToggleSelf[5]);
			ToggleSelf[6] = ToggleButton("No Weight", ToggleSelf[6]);
			ToggleSelf[7] = ToggleButton("No Fall Damage", ToggleSelf[7]);
			ToggleSelf[8] = ToggleButton("Loot Through Walls", ToggleSelf[8]);
			ToggleSelf[9] = ToggleButton("Invisibility", ToggleSelf[9]);
			GUILayout.EndScrollView();
		}

		private void DrawServerTab()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			ToggleServer[1] = ToggleButton("Enemy Cant Be Spawned", ToggleServer[1]);
			ToggleServer[2] = ToggleButton("Gets All Scrap", ToggleServer[2]);
			ToggleServer[3] = ToggleButton("Never Lose Scrap", ToggleServer[3]);
			GUILayout.EndScrollView();
		}

		private void DrawVisualsTab()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			ToggleVisuals[1] = ToggleButton("Object ESP", ToggleVisuals[1]);
			ToggleVisuals[2] = ToggleButton("Player ESP", ToggleVisuals[2]);
			ToggleVisuals[3] = ToggleButton("Enemy ESP", ToggleVisuals[3]);
			GUILayout.EndScrollView();
		}

		private void DrawHostTab()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			ToggleHost[1] = ToggleButton("Revive all players", ToggleHost[1]);
			ToggleHost[2] = ToggleButton("Spawn enemy on localpos", ToggleHost[2]);
			GUILayout.EndScrollView();
		}

		private void DrawPlayerListTab()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			_instance.scrollPosition = GUILayout.BeginScrollView(_instance.scrollPosition, Array.Empty<GUILayoutOption>());
			int num = 1;
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			foreach (PlayerControllerB val in array)
			{
				string playerUsername = val.playerUsername;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("Player " + num + ": " + playerUsername, Array.Empty<GUILayoutOption>());
				if (GUILayout.Button("i", (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(20f),
					GUILayout.Height(20f)
				}))
				{
					selectedPlayer = val;
					playerManagerEnabled = true;
				}
				GUILayout.EndHorizontal();
				if (playerManagerEnabled && (Object)(object)selectedPlayer == (Object)(object)val)
				{
					if (GUILayout.Button("Kill", Array.Empty<GUILayoutOption>()))
					{
						selectedPlayer.DamagePlayerFromOtherClientServerRpc(int.MaxValue, Vector3.zero, -1);
					}
					if (GUILayout.Button("TP", Array.Empty<GUILayoutOption>()))
					{
						((Component)GameNetworkManager.Instance.localPlayerController).transform.position = ((Component)selectedPlayer).transform.position;
					}
					if (GUILayout.Button("Back", Array.Empty<GUILayoutOption>()))
					{
						selectedPlayer = null;
						playerManagerEnabled = false;
					}
				}
				num++;
			}
			GUILayout.EndScrollView();
		}

		private void DrawSettingsTab()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			_instance.scrollPosition = GUILayout.BeginScrollView(_instance.scrollPosition, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Speed: " + SpeedOptions[SpeedSelection], Array.Empty<GUILayoutOption>());
			SpeedSelection = (int)GUILayout.HorizontalSlider((float)SpeedSelection, 0f, (float)(SpeedOptions.Length - 1), Array.Empty<GUILayoutOption>());
			Speed = SpeedValues[SpeedSelection];
			GUILayout.EndScrollView();
		}

		public void Update()
		{
			GUIToggleCheck();
			_playerManager.UpdatePlayers();
			playerControllerHandler.Update();
		}

		private void OnGUI()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			GUI.skin = (GUISkin)(((object)GUI.skin) ?? ((object)new GUISkin()));
			UpdateStyles();
			Update();
			if (toggled)
			{
				Rect gUIRect = GUIRect;
				object obj = <>O.<0>__OnGUI;
				if (obj == null)
				{
					WindowFunction val = OnGUI;
					<>O.<0>__OnGUI = val;
					obj = (object)val;
				}
				GUIRect = GUI.Window(69, gUIRect, (WindowFunction)obj, "Lethal Company GUI | Toggle: " + ((object)(KeyCode)(ref toggleKey)).ToString());
			}
		}

		public static void OnGUI(int windowId)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginArea(new Rect(10f, 10f, ((Rect)(ref GUIRect)).width - 20f, ((Rect)(ref GUIRect)).height - 20f));
			GUILayout.Space(10f);
			DrawTabButtons();
			if (selectedTab == 0)
			{
				_instance.DrawSelfTab();
			}
			else if (selectedTab == 1)
			{
				_instance.DrawServerTab();
			}
			else if (selectedTab == 2)
			{
				_instance.DrawVisualsTab();
			}
			else if (selectedTab == 3)
			{
				_instance.DrawHostTab();
			}
			else if (selectedTab == 4)
			{
				_instance.DrawPlayerListTab();
			}
			else if (selectedTab == 5)
			{
				_instance.DrawSettingsTab();
			}
			GUILayout.EndArea();
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref GUIRect)).width, 20f));
		}

		private void GUIToggleCheck()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if (UnityInput.Current.GetKey(toggleKey) && Time.time - lastToggleTime >= toggleDelay)
			{
				toggled = !toggled;
				lastToggleTime = Time.time;
			}
		}

		private static void DrawTabButtons()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < tabNames.Length; i++)
			{
				if (selectedTab == i)
				{
					GUIStyle val = Instance.CreateButtonStyle(Instance.buttonActive, Instance.buttonHovered, Instance.buttonActive);
					if (GUILayout.Button(tabNames[i], val, Array.Empty<GUILayoutOption>()))
					{
						selectedTab = i;
					}
				}
				else
				{
					GUIStyle val2 = Instance.CreateButtonStyle(Instance.button, Instance.buttonHovered, Instance.buttonActive);
					if (GUILayout.Button(tabNames[i], val2, Array.Empty<GUILayoutOption>()))
					{
						selectedTab = i;
					}
				}
			}
			GUILayout.EndHorizontal();
		}

		private bool ToggleButton(string text, bool toggle)
		{
			GUIStyle val = CreateButtonStyle(toggle ? buttonActive : button, buttonHovered, buttonActive);
			if (GUILayout.Button(text, val, Array.Empty<GUILayoutOption>()))
			{
				return !toggle;
			}
			return toggle;
		}

		private void Awake()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			_playerManager = new PlayerManager();
			playerControllerHandler = new PlayerControllerHandler();
			_instance = this;
			button = CreateTexture(new Color32((byte)64, (byte)64, (byte)64, byte.MaxValue));
			buttonHovered = CreateTexture(new Color32((byte)75, (byte)75, (byte)75, byte.MaxValue));
			buttonActive = CreateTexture(new Color32((byte)100, (byte)100, (byte)100, byte.MaxValue));
			windowBackground = CreateTexture(new Color32((byte)30, (byte)30, (byte)30, byte.MaxValue));
			textArea = CreateTexture(new Color32((byte)64, (byte)64, (byte)64, byte.MaxValue));
			textAreaHovered = CreateTexture(new Color32((byte)75, (byte)75, (byte)75, byte.MaxValue));
			textAreaActive = CreateTexture(new Color32((byte)100, (byte)100, (byte)100, byte.MaxValue));
			box = CreateTexture(new Color32((byte)40, (byte)40, (byte)40, byte.MaxValue));
		}

		private void UpdateStyles()
		{
			GUI.skin.button = CreateButtonStyle(button, buttonHovered, buttonActive);
			GUI.skin.window = CreateWindowStyle(windowBackground);
			GUI.skin.textArea = CreateTextFieldStyle(textArea, textAreaHovered, textAreaActive);
			GUI.skin.textField = CreateTextFieldStyle(textArea, textAreaHovered, textAreaActive);
			GUI.skin.box = CreateBoxStyle(box);
		}

		public Texture2D CreateTexture(Color32 color)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, Color32.op_Implicit(color));
			val.Apply();
			return val;
		}

		public GUIStyle CreateButtonStyle(Texture2D normal, Texture2D hover, Texture2D active)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.normal.background = normal;
			val.hover.background = hover;
			val.active.background = active;
			val.normal.textColor = Color.white;
			val.hover.textColor = Color.white;
			val.active.textColor = Color.white;
			return val;
		}

		public GUIStyle CreateWindowStyle(Texture2D background)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.window);
			val.normal.background = background;
			val.onNormal.background = background;
			val.normal.textColor = Color.white;
			val.onNormal.textColor = Color.white;
			return val;
		}

		public GUIStyle CreateTextFieldStyle(Texture2D normal, Texture2D hover, Texture2D active)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_004b: 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_006d: 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)
			GUIStyle val = new GUIStyle(GUI.skin.textField);
			val.normal.background = normal;
			val.hover.background = hover;
			val.active.background = active;
			val.focused.background = active;
			val.normal.textColor = Color.white;
			val.hover.textColor = Color.white;
			val.active.textColor = Color.white;
			val.focused.textColor = Color.white;
			return val;
		}

		public GUIStyle CreateBoxStyle(Texture2D normal)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.box);
			val.normal.background = normal;
			val.hover.background = normal;
			val.active.background = normal;
			val.normal.textColor = Color.white;
			val.hover.textColor = Color.white;
			val.active.textColor = Color.white;
			return val;
		}

		public static bool WorldToScreen(Camera camera, Vector3 world, out Vector3 screen)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			screen = camera.WorldToViewportPoint(world);
			screen.x *= Screen.width;
			screen.y *= Screen.height;
			screen.y = (float)Screen.height - screen.y;
			return screen.z > 0f;
		}
	}
	[BepInPlugin("com.notfishvr.lethalcompany", "notfishvr", "1.0.0")]
	public class Loader : BaseUnityPlugin
	{
		public void FixedUpdate()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			Awake();
			if (!Object.op_Implicit((Object)(object)GameObject.Find("Loader")))
			{
				GameObject val = new GameObject("Loader");
				val.AddComponent<LocalPlayer>();
				val.AddComponent<MainGUI>();
			}
		}

		private void Awake()
		{
			try
			{
				string path = Paths.ConfigPath + "/BepInEx.cfg";
				string input = File.ReadAllText(path);
				input = Regex.Replace(input, "HideManagerGameObject = .+", "HideManagerGameObject = true");
				File.WriteAllText(path, input);
			}
			catch (Exception)
			{
			}
		}
	}
}
namespace LethalCompanyMenu.MainMenu.Patch
{
	public class ReflectionUtil
	{
		private const BindingFlags privateInst = BindingFlags.Instance | BindingFlags.NonPublic;

		private const BindingFlags privateStatic = BindingFlags.Static | BindingFlags.NonPublic;

		private const BindingFlags privateField = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField;

		private const BindingFlags privateProp = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty;

		private const BindingFlags privateMethod = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod;

		private const BindingFlags staticField = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField;

		private const BindingFlags staticProp = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty;

		private const BindingFlags staticMethod = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod;

		private object @object { get; }

		private Type type { get; }

		private ReflectionUtil(object obj)
		{
			@object = obj;
			type = obj.GetType();
		}

		private T? GetValue<T>(string variableName, BindingFlags flags)
		{
			try
			{
				return (T)type.GetField(variableName, flags).GetValue(@object);
			}
			catch (InvalidCastException)
			{
				return default(T);
			}
		}

		private T? GetProperty<T>(string propertyName, BindingFlags flags)
		{
			try
			{
				return (T)type.GetProperty(propertyName, flags).GetValue(@object);
			}
			catch (InvalidCastException)
			{
				return default(T);
			}
		}

		private ReflectionUtil SetValue(string variableName, object value, BindingFlags flags)
		{
			try
			{
				type.GetField(variableName, flags).SetValue(@object, value);
				return this;
			}
			catch (Exception)
			{
				return null;
			}
		}

		private ReflectionUtil SetProperty(string propertyName, object value, BindingFlags flags)
		{
			try
			{
				type.GetProperty(propertyName, flags).SetValue(@object, value);
				return this;
			}
			catch (Exception)
			{
				return null;
			}
		}

		private T? Invoke<T>(string methodName, BindingFlags flags, params object[] args)
		{
			try
			{
				return (T)type.GetMethod(methodName, flags).Invoke(@object, args);
			}
			catch (InvalidCastException)
			{
				return default(T);
			}
		}

		private T? GetValue<T>(string fieldName, bool isStatic = false, bool isProperty = false)
		{
			BindingFlags flags = ((!isProperty) ? (isStatic ? (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField) : (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField)) : (isStatic ? (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty) : (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty)));
			return isProperty ? GetProperty<T>(fieldName, flags) : GetValue<T>(fieldName, flags);
		}

		public ReflectionUtil SetValue(string fieldName, object value, bool isStatic = false, bool isProperty = false)
		{
			BindingFlags flags = ((!isProperty) ? (isStatic ? (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField) : (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField)) : (isStatic ? (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetProperty) : (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetProperty)));
			return isProperty ? SetProperty(fieldName, value, flags) : SetValue(fieldName, value, flags);
		}

		private T? Invoke<T>(string methodName, bool isStatic = false, params object[] args)
		{
			return Invoke<T>(methodName, isStatic ? (BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod) : (BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod), args);
		}

		public object GetValue(string fieldName, bool isStatic = false, bool isProperty = false)
		{
			return GetValue<object>(fieldName, isStatic, isProperty);
		}

		public ReflectionUtil Invoke(string methodName, bool isStatic = false, params object[] args)
		{
			return Invoke<object>(methodName, isStatic, args)?.Reflect();
		}

		public ReflectionUtil Invoke(string methodName, params object[] args)
		{
			return Invoke<object>(methodName, isStatic: false, args)?.Reflect();
		}

		public static ReflectionUtil GetReflection(object obj)
		{
			return new ReflectionUtil(obj);
		}
	}
	public static class ReflectorExtensions
	{
		public static ReflectionUtil Reflect(this object obj)
		{
			return ReflectionUtil.GetReflection(obj);
		}
	}
}
namespace LethalCompanyMenu.MainMenu.Stuff
{
	public class PlayerManager : MonoBehaviour
	{
		private List<PlayerControllerB> _players = new List<PlayerControllerB>();

		private void Start()
		{
			UpdatePlayers();
		}

		public void UpdatePlayers()
		{
			_players.Clear();
			if (!LocalPlayer.IsValid())
			{
				FindLocalPlayer();
			}
			_players.AddRange(Object.FindObjectsOfType<PlayerControllerB>());
			_players.RemoveAll((PlayerControllerB player) => !IsValidPlayer(player));
		}

		private void FindLocalPlayer()
		{
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				if ((Object)(object)val != (Object)null && val.isPlayerControlled && ((NetworkBehaviour)val).IsOwner)
				{
					LocalPlayer.localPlayer = new LocalPlayer(val);
					break;
				}
			}
		}

		private bool IsValidPlayer(PlayerControllerB player)
		{
			return (Object)(object)player != (Object)null && (Object)(object)player != (Object)(object)LocalPlayer.localPlayer?.PlayerController && (Object)(object)((Component)player).gameObject != (Object)null && player.playerSteamId != 0;
		}

		public IEnumerable<PlayerControllerB> GetPlayers()
		{
			return _players;
		}
	}
	public class LocalPlayer : MonoBehaviour
	{
		public static LocalPlayer localPlayer;

		public PlayerControllerB PlayerController { get; set; }

		public LocalPlayer(PlayerControllerB playerController)
		{
			PlayerController = playerController;
		}

		public static bool IsValid()
		{
			return (Object)(object)localPlayer != (Object)null && (Object)(object)localPlayer.PlayerController != (Object)null && (Object)(object)((Component)localPlayer.PlayerController).gameObject != (Object)null && localPlayer.PlayerController.isPlayerControlled;
		}
	}
	public class PlayerControllerHandler
	{
		internal class Weight
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(PlayerControllerB), "Update")]
			public static void WeightUpdate(PlayerControllerB __instance)
			{
				if (!((Object)(object)LocalPlayer.localPlayer.PlayerController == (Object)null) && __instance.playerClientId == LocalPlayer.localPlayer.PlayerController.playerClientId)
				{
					__instance.carryWeight = (MainGUI.Instance.ToggleSelf[6] ? 1f : GetHeldWeight(__instance));
				}
			}

			private static float GetHeldWeight(PlayerControllerB player)
			{
				float num = 1f;
				if (player.ItemSlots == null)
				{
					return num;
				}
				GrabbableObject[] itemSlots = player.ItemSlots;
				foreach (GrabbableObject val in itemSlots)
				{
					if (!((Object)(object)val == (Object)null) && !((Object)(object)val.itemProperties == (Object)null))
					{
						num += Mathf.Clamp(val.itemProperties.weight - 1f, 0f, 10f);
					}
				}
				return num;
			}
		}

		internal class NoFallDamage
		{
			[HarmonyPatch(typeof(PlayerControllerB), "PlayerHitGroundEffects")]
			public static bool NoFallDamagePatch(PlayerControllerB __instance)
			{
				if (MainGUI.Instance.ToggleSelf[7])
				{
					__instance.takingFallDamage = false;
					LocalPlayer.localPlayer.PlayerController.twoHanded = false;
				}
				return true;
			}
		}

		internal class EnemyCannotBeSpawned
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(RoundManager), "EnemyCannotBeSpawned")]
			public static bool EnemyCannotBeSpawnedPatch()
			{
				if (MainGUI.Instance.ToggleServer[1])
				{
					return false;
				}
				return true;
			}
		}

		internal class InteractThroughWalls
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")]
			public static void InteractThroughWallsPatch(PlayerControllerB __instance)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				if (MainGUI.Instance.ToggleSelf[8])
				{
					__instance.grabDistance = 10000f;
					LayerMask val = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Props" }));
					val = LayerMask.op_Implicit(LayerMask.GetMask(new string[2] { "Props", "InteractableObject" }));
					typeof(PlayerControllerB).GetField("interactableObjectsMask", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).SetValue(__instance, ((LayerMask)(ref val)).value);
				}
				else
				{
					typeof(PlayerControllerB).GetField("interactableObjectsMask", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).SetValue(__instance, 832);
				}
			}
		}

		public static GrabbableObject[] grabbableObjectsUsed = (GrabbableObject[])(object)new GrabbableObject[0];

		public void NeverLoseScrap()
		{
			if (MainGUI.Instance.ToggleServer[3] && StartOfRound.Instance.allPlayersDead)
			{
				StartOfRound.Instance.allPlayersDead = false;
			}
		}

		public void Invisibility()
		{
			//IL_0044: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)LocalPlayer.localPlayer == (Object)null) && MainGUI.Instance.ToggleSelf[9])
			{
				Vector3 val = (StartOfRound.Instance.shipHasLanded ? StartOfRound.Instance.notSpawnedPosition.position : Vector3.zero);
				LocalPlayer.localPlayer.Reflect().Invoke("UpdatePlayerPositionServerRpc", val, true, false, false, true);
			}
		}

		public void SetLocalPlayerHealth(int health = int.MaxValue)
		{
			if ((Object)(object)LocalPlayer.localPlayer.PlayerController != (Object)null && LocalPlayer.localPlayer.PlayerController.isPlayerControlled && ((NetworkBehaviour)LocalPlayer.localPlayer.PlayerController).IsOwner)
			{
				LocalPlayer.localPlayer.PlayerController.health = health;
			}
		}

		public void Fly()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			float num = MainGUI.Instance.Speed * Time.deltaTime;
			PlayerControllerB playerController = LocalPlayer.localPlayer.PlayerController;
			if (UnityInput.Current.GetKey((KeyCode)304))
			{
				num *= 2.2f;
			}
			if (UnityInput.Current.GetKey((KeyCode)119))
			{
				Transform transform = ((Component)playerController.playerRigidbody).transform;
				transform.position += ((Component)playerController.playerGlobalHead).transform.forward * num;
				playerController.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
			}
			if (UnityInput.Current.GetKey((KeyCode)97))
			{
				Transform transform2 = ((Component)playerController.playerRigidbody).transform;
				transform2.position += ((Component)playerController.playerGlobalHead).transform.right * (0f - num);
				playerController.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
			}
			if (UnityInput.Current.GetKey((KeyCode)115))
			{
				Transform transform3 = ((Component)playerController.playerRigidbody).transform;
				transform3.position += ((Component)playerController.playerGlobalHead).transform.forward * (0f - num);
				playerController.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
			}
			if (UnityInput.Current.GetKey((KeyCode)100))
			{
				Transform transform4 = ((Component)playerController.playerRigidbody).transform;
				transform4.position += ((Component)playerController.playerGlobalHead).transform.right * num;
				playerController.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
			}
			if (UnityInput.Current.GetKey((KeyCode)32))
			{
				Transform transform5 = ((Component)playerController.playerRigidbody).transform;
				transform5.position += ((Component)playerController.playerGlobalHead).transform.up * num;
				playerController.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
			}
			if (UnityInput.Current.GetKey((KeyCode)306))
			{
				Transform transform6 = ((Component)playerController.playerRigidbody).transform;
				transform6.position += ((Component)playerController.playerGlobalHead).transform.up * (0f - num);
				playerController.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
			}
		}

		public void Speed()
		{
			LocalPlayer.localPlayer.PlayerController.isSpeedCheating = false;
			LocalPlayer.localPlayer.PlayerController.sprintTime = 2.1474836E+09f;
			LocalPlayer.localPlayer.PlayerController.sprintMeter = 2.1474836E+09f;
			LocalPlayer.localPlayer.PlayerController.movementSpeed = 10f;
			LocalPlayer.localPlayer.PlayerController.isExhausted = false;
		}

		public void Update()
		{
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Expected O, but got Unknown
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Expected O, but got Unknown
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			if (MainGUI.Instance.ToggleSelf[1])
			{
				MainGUI.nightVision = true;
				GameObject val = GameObject.Find("Systems");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				((Component)val.transform.Find("Rendering").Find("VolumeMain")).gameObject.SetActive(!MainGUI.nightVision);
			}
			else
			{
				MainGUI.nightVision = false;
			}
			if (MainGUI.Instance.ToggleSelf[2])
			{
				GameObject val2 = GameObject.Find("Environment");
				if ((Object)(object)val2 != (Object)null)
				{
					Transform val3 = val2.transform.Find("TestRoom");
					if ((Object)(object)val3 != (Object)null)
					{
						Transform val4 = ((Component)val3).transform.Find("Directional Light Test");
						if ((Object)(object)val4 != (Object)null)
						{
							if ((Object)(object)MainGUI.Instance.directionalLightClone == (Object)null)
							{
								MainGUI.Instance.directionalLightClone = Object.Instantiate<GameObject>(((Component)val4).gameObject);
								MainGUI.Instance.directionalLightClone.transform.parent = val2.transform;
								MainGUI.Instance.directionalLightClone.SetActive(true);
							}
							else
							{
								MainGUI.Instance.directionalLightClone.SetActive(!MainGUI.Instance.directionalLightClone.activeSelf);
							}
						}
					}
				}
			}
			if (MainGUI.Instance.ToggleSelf[3])
			{
				SetLocalPlayerHealth();
			}
			if (MainGUI.Instance.ToggleSelf[4])
			{
				Speed();
			}
			if (MainGUI.Instance.ToggleSelf[5])
			{
				Fly();
			}
			if (MainGUI.Instance.ToggleSelf[6])
			{
				Weight.WeightUpdate(LocalPlayer.localPlayer.PlayerController);
			}
			if (MainGUI.Instance.ToggleSelf[7])
			{
				NoFallDamage.NoFallDamagePatch(LocalPlayer.localPlayer.PlayerController);
			}
			if (MainGUI.Instance.ToggleSelf[8])
			{
				InteractThroughWalls.InteractThroughWallsPatch(LocalPlayer.localPlayer.PlayerController);
			}
			if (MainGUI.Instance.ToggleSelf[9])
			{
				Invisibility();
			}
			if (MainGUI.Instance.ToggleServer[1])
			{
				EnemyCannotBeSpawned.EnemyCannotBeSpawnedPatch();
			}
			if (MainGUI.Instance.ToggleServer[2])
			{
				GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>();
				MainGUI.Instance.random.Shuffle(array);
				GrabbableObject[] array2 = array;
				foreach (GrabbableObject val5 in array2)
				{
					if (val5.grabbable && !((Object)(object)val5.playerHeldBy != (Object)null) && !((Object)(object)val5 == (Object)null) && !grabbableObjectsUsed.Contains(val5) && val5.itemProperties.isScrap && !val5.isInElevator)
					{
						LocalPlayer.localPlayer.PlayerController.TeleportPlayer(((Component)val5).transform.position, false, 0f, false, true);
						InteractTrigger component = ((Component)val5).GetComponent<InteractTrigger>();
						if ((Object)(object)component != (Object)null)
						{
							Debug.Log((object)"Found interact trigger");
						}
						grabbableObjectsUsed = grabbableObjectsUsed.Append(val5).ToArray();
						break;
					}
				}
			}
			if (MainGUI.Instance.ToggleServer[3])
			{
				NeverLoseScrap();
			}
			if (MainGUI.Instance.ToggleVisuals[1])
			{
				Object[] array3 = Object.FindObjectsOfType(typeof(GrabbableObject));
				for (int j = 0; j < array3.Length; j++)
				{
					GrabbableObject val6 = (GrabbableObject)array3[j];
					string text = "Object";
					if ((Object)(object)val6.itemProperties != (Object)null)
					{
						if (val6.itemProperties.itemName != null)
						{
							text = val6.itemProperties.itemName;
						}
						int creditsWorth = val6.itemProperties.creditsWorth;
						text = text + " (" + val6.itemProperties.creditsWorth + ")";
					}
					if (MainGUI.WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)val6).transform.position, out var screen))
					{
						GUI.Label(new Rect(screen.x, screen.y, 100f, 25f), text);
					}
				}
			}
			if (MainGUI.Instance.ToggleVisuals[2])
			{
				PlayerControllerB[] array4 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val7 in array4)
				{
					string playerUsername = val7.playerUsername;
					if (MainGUI.WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)val7.playerGlobalHead).transform.position, out var screen2))
					{
						GUI.Label(new Rect(screen2.x, screen2.y, 100f, 25f), playerUsername);
					}
				}
			}
			if (MainGUI.Instance.ToggleVisuals[3])
			{
				Object[] array5 = Object.FindObjectsOfType(typeof(EnemyAI));
				for (int l = 0; l < array5.Length; l++)
				{
					EnemyAI val8 = (EnemyAI)array5[l];
					string enemyName = val8.enemyType.enemyName;
					if (MainGUI.WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)val8).transform.position, out var screen3))
					{
						GUI.Label(new Rect(screen3.x, screen3.y, 100f, 100f), enemyName);
					}
				}
			}
			if (MainGUI.Instance.ToggleHost[1])
			{
				StartOfRound val9 = Object.FindObjectOfType<StartOfRound>();
				if ((Object)(object)val9 != (Object)null)
				{
					val9.ReviveDeadPlayers();
					val9.PlayerHasRevivedServerRpc();
					val9.AllPlayersHaveRevivedClientRpc();
					MainGUI.Instance.ToggleHost[1] = false;
				}
			}
			if (MainGUI.Instance.ToggleHost[2])
			{
				RoundManager val10 = Object.FindObjectOfType<RoundManager>();
				SpawnEnemyClass.SpawnEnemyWithConfigManager("ForestGiant");
				SpawnableEnemyWithRarity enemy = val10.currentLevel.OutsideEnemies[Random.Range(0, val10.currentLevel.OutsideEnemies.Count)];
				SpawnEnemyClass.SpawnEnemyAtLocalPlayer(enemy, 3);
				MainGUI.Instance.ToggleHost[2] = false;
			}
		}
	}
	internal class SpawnEnemyClass
	{
		public static void SpawnEnemyWithConfigManager(string enemyName)
		{
			RoundManager val = Object.FindObjectOfType<RoundManager>();
			bool flag = false;
			foreach (SpawnableEnemyWithRarity enemy in val.currentLevel.Enemies)
			{
				if (enemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower()))
				{
					try
					{
						flag = true;
						string enemyName2 = enemy.enemyType.enemyName;
						SpawnEnemy(enemy, 1, inside: true);
					}
					catch
					{
					}
					break;
				}
			}
			if (flag)
			{
				return;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in val.currentLevel.OutsideEnemies)
			{
				if (outsideEnemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower()))
				{
					try
					{
						flag = true;
						string enemyName3 = outsideEnemy.enemyType.enemyName;
						SpawnEnemy(outsideEnemy, 1, inside: false);
						break;
					}
					catch (Exception)
					{
						break;
					}
				}
			}
		}

		public static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside)
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			RoundManager val = Object.FindObjectOfType<RoundManager>();
			if (inside)
			{
				try
				{
					for (int i = 0; i < amount; i++)
					{
						val.SpawnEnemyOnServer(((Component)LocalPlayer.localPlayer.PlayerController).transform.position, 0f, val.currentLevel.Enemies.IndexOf(enemy));
						GameObject val2 = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, ((Component)LocalPlayer.localPlayer.PlayerController).transform.position, Quaternion.Euler(Vector3.zero));
					}
					return;
				}
				catch
				{
					return;
				}
			}
			for (int j = 0; j < amount; j++)
			{
				GameObject enemyPrefab = val.currentLevel.OutsideEnemies[val.currentLevel.OutsideEnemies.IndexOf(enemy)].enemyType.enemyPrefab;
				GameObject[] array = GameObject.FindGameObjectsWithTag("OutsideAINode");
				Vector3 position = array[Random.Range(0, array.Length - 1)].transform.position;
				Vector3 position2 = ((Component)LocalPlayer.localPlayer.PlayerController).transform.position;
				GameObject val3 = Object.Instantiate<GameObject>(enemyPrefab, position, Quaternion.Euler(Vector3.zero));
				val3.GetComponentInChildren<NetworkObject>().Spawn(true);
				GameObject val4 = Object.Instantiate<GameObject>(enemyPrefab, position2, Quaternion.Euler(Vector3.zero));
				val4.GetComponentInChildren<NetworkObject>().Spawn(true);
			}
		}

		public static void SpawnEnemyAtLocalPlayer(SpawnableEnemyWithRarity enemy, int amount)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			RoundManager val = Object.FindObjectOfType<RoundManager>();
			if ((Object)(object)val == (Object)null || (Object)(object)LocalPlayer.localPlayer == (Object)null || (Object)(object)LocalPlayer.localPlayer.PlayerController == (Object)null)
			{
				return;
			}
			Vector3 position = ((Component)LocalPlayer.localPlayer.PlayerController).transform.position;
			NavMeshHit val2 = default(NavMeshHit);
			if (!NavMesh.SamplePosition(position, ref val2, 10f, -1))
			{
				return;
			}
			for (int i = 0; i < amount; i++)
			{
				int num = val.currentLevel.OutsideEnemies.IndexOf(enemy);
				if (num == -1)
				{
					continue;
				}
				EnemyType enemyType = val.currentLevel.OutsideEnemies[num].enemyType;
				if ((Object)(object)enemyType == (Object)null)
				{
					continue;
				}
				GameObject enemyPrefab = enemyType.enemyPrefab;
				if ((Object)(object)enemyPrefab == (Object)null)
				{
					continue;
				}
				GameObject val3 = Object.Instantiate<GameObject>(enemyPrefab, ((NavMeshHit)(ref val2)).position, Quaternion.Euler(Vector3.zero));
				if (!((Object)(object)val3 == (Object)null))
				{
					NetworkObject componentInChildren = val3.GetComponentInChildren<NetworkObject>();
					if (!((Object)(object)componentInChildren == (Object)null))
					{
						componentInChildren.Spawn(true);
						MethodInfo method = typeof(RoundManager).GetMethod("__beginSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic);
						MethodInfo method2 = typeof(RoundManager).GetMethod("__endSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic);
						ClientRpcParams val4 = default(ClientRpcParams);
						val4.Send = new ClientRpcSendParams
						{
							TargetClientIds = new List<ulong> { LocalPlayer.localPlayer.PlayerController.playerClientId }
						};
						ClientRpcParams val5 = val4;
						ServerRpcParams val6 = default(ServerRpcParams);
						FastBufferWriter val7 = (FastBufferWriter)method.Invoke(val, new object[3] { 46494176u, val5, 0 });
						((FastBufferWriter)(ref val7)).WriteValueSafe(ref position);
						((FastBufferWriter)(ref val7)).WriteValueSafe<int>(ref num, default(ForPrimitives));
						BytePacker.WriteValueBitPacked(val7, 1);
						method2.Invoke(val, new object[4]
						{
							val7,
							46494176u,
							val6,
							(object)(RpcDelivery)0
						});
					}
				}
			}
		}
	}
}