Decompiled source of Lethal Menu v1.1.0

Lethal-Company-Mod-Menu.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyHacks.MainMenuPatch;
using Lethal_Company_Mod_Menu.MainMenu;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Lethal_Company_Mod_Menu.MainMenu
{
	[BepInPlugin("lethalcompany.GUI", "notfishvr", "1.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;

		internal static bool EnemyCannotBeSpawned;

		internal static bool InfiniteSprint;

		internal static bool UnlimitedItemPower;

		internal static bool HighScrapValue;

		internal static bool UnlimitedScanRange;

		private Texture2D button;

		private Texture2D buttonHovered;

		private Texture2D buttonActive;

		private Texture2D windowBackground;

		private Texture2D textArea;

		private Texture2D textAreaHovered;

		private Texture2D textAreaActive;

		private GameObject directionalLightClone;

		private Texture2D box;

		private static MainGUI _instance;

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

		private bool joining = false;

		public bool shouldSpawnEnemy;

		public AudioReverbTrigger currentAudioTrigger;

		public KeyCode toggleKey = (KeyCode)277;

		private int numberDeadLastRound;

		private int SpeedSelection = 0;

		public static GameObject pointer;

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

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

		private float Speed = 1.7f;

		internal static bool playerManagerEnabled = false;

		public string guiSelectedEnemy;

		private static bool hasGUISynced;

		private float cacheRefreshInterval = 1.5f;

		private int enemyCount = 0;

		private bool addMoney = false;

		private static RoundManager currentRound;

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

		private static SelectableLevel currentLevel;

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

		private static int selectedTab = 0;

		private static readonly string[] tabNames = new string[5] { "Main", "Misc", "Info", "Player List", "Settings" };

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

		private bool[] ToggleMain = new bool[999];

		private bool[] ToggleMic = new bool[999];

		private bool toggled = true;

		private PlayerControllerB selectedPlayer;

		public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;

		public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns;

		public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;

		private static EnemyVent[] currentLevelVents;

		private static SpawnableEnemyWithRarity jesterRef;

		internal static float nightVisionIntensity;

		internal static float nightVisionRange;

		internal static Color nightVisionColor;

		public float toggleDelay = 0.5f;

		private float lastToggleTime;

		private Vector2 scrollPosition = Vector2.zero;

		public static MainGUI Instance => _instance;

		private void DrawMainTab()
		{
			//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>());
			ToggleMain[1] = ToggleButton("Night Vision", ToggleMain[1]);
			ToggleMain[2] = ToggleButton("God Mode", ToggleMain[2]);
			ToggleMain[3] = ToggleButton("Enemy Cant Be Spawned", ToggleMain[3]);
			ToggleMain[4] = ToggleButton("Speed", ToggleMain[4]);
			ToggleMain[5] = ToggleButton("Fly", ToggleMain[5]);
			ToggleMain[6] = ToggleButton("SpawnBody", ToggleMain[6]);
			ToggleMain[7] = ToggleButton("Explosion", ToggleMain[7]);
			ToggleMain[8] = ToggleButton("Infinite Sprint", ToggleMain[8]);
			ToggleMain[9] = ToggleButton("Unlimited Item Power", ToggleMain[9]);
			GUILayout.EndScrollView();
		}

		private void DrawMicModsTab()
		{
			//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>());
			ToggleMic[1] = ToggleButton("Tp All", ToggleMic[1]);
			ToggleMic[2] = ToggleButton("Give Ownership", ToggleMic[2]);
			ToggleMic[3] = ToggleButton("Add Money", ToggleMic[3]);
			ToggleMic[4] = ToggleButton("High Scrap Value", ToggleMic[4]);
			ToggleMic[5] = ToggleButton("Unlimited Scan Range", ToggleMic[5]);
			ToggleMic[6] = ToggleButton("Object ESP", ToggleMic[6]);
			ToggleMic[7] = ToggleButton("Player ESP", ToggleMic[7]);
			ToggleMic[8] = ToggleButton("Enemy ESP", ToggleMic[8]);
			ToggleMic[9] = ToggleButton("Add 100k Cash", ToggleMic[9]);
			ToggleMic[10] = ToggleButton("Remove 100k Cash", ToggleMic[10]);
			ToggleMic[11] = ToggleButton("Remove Current Cash", ToggleMic[11]);
			ToggleMic[12] = ToggleButton("Set Level High", ToggleMic[12]);
			GUILayout.EndScrollView();
		}

		private void DrawInfoTab()
		{
			//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>());
			GUILayout.Label(logs, Array.Empty<GUILayoutOption>());
			if ((Object)(object)HUDManager.Instance != (Object)null)
			{
				GUILayout.Label("Current XP: " + HUDManager.Instance.localPlayerXP, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Current Level: " + HUDManager.Instance.localPlayerLevel, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Label("Current XP: ???", Array.Empty<GUILayoutOption>());
				GUILayout.Label("Current Level: ???", Array.Empty<GUILayoutOption>());
			}
			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()
		{
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: 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_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: 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_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0862: Unknown result type (might be due to invalid IL or missing references)
			//IL_0869: Expected O, but got Unknown
			//IL_098a: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0c: Expected O, but got Unknown
			//IL_0a31: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0906: Unknown result type (might be due to invalid IL or missing references)
			//IL_090d: Unknown result type (might be due to invalid IL or missing references)
			//IL_091e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a60: Unknown result type (might be due to invalid IL or missing references)
			GUIToggleCheck();
			DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>();
			foreach (DeadBodyInfo val in array)
			{
				int num = Object.FindObjectsOfType<DeadBodyInfo>().Length;
				if (num > numberDeadLastRound)
				{
					logs = logs + val.playerScript.playerUsername + " has died!!!\n";
					numberDeadLastRound++;
				}
			}
			if (ToggleMain[1])
			{
				nightVision = true;
				HDAdditionalLightData[] array2 = Object.FindObjectsOfType<HDAdditionalLightData>();
				foreach (HDAdditionalLightData val2 in array2)
				{
					TimeOfDay[] array3 = Object.FindObjectsOfType<TimeOfDay>();
					foreach (TimeOfDay val3 in array3)
					{
						StartOfRound[] array4 = Object.FindObjectsOfType<StartOfRound>();
						foreach (StartOfRound val4 in array4)
						{
							val2.lightDimmer = float.MaxValue;
							val2.distance = float.MaxValue;
							val3.insideLighting = false;
							val4.blackSkyVolume.weight = 0f;
						}
					}
				}
			}
			else
			{
				nightVision = false;
			}
			if (ToggleMain[2])
			{
				enableGod = true;
			}
			else
			{
				enableGod = false;
			}
			if (ToggleMain[3])
			{
				EnemyCannotBeSpawned = true;
			}
			else
			{
				EnemyCannotBeSpawned = false;
			}
			if (ToggleMain[4])
			{
				PlayerControllerB[] array5 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val5 in array5)
				{
					val5.isSpeedCheating = false;
					val5.sprintTime = 2.1474836E+09f;
					val5.sprintMeter = 2.1474836E+09f;
					val5.movementSpeed = 10f;
					InfiniteSprint = true;
				}
			}
			if (ToggleMain[5])
			{
				float num2 = Speed * Time.deltaTime;
				PlayerControllerB[] array6 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val6 in array6)
				{
					if (UnityInput.Current.GetKey((KeyCode)304))
					{
						num2 *= 2.2f;
					}
					if (UnityInput.Current.GetKey((KeyCode)119))
					{
						Transform transform = ((Component)val6.playerRigidbody).transform;
						transform.position += ((Component)val6.playerGlobalHead).transform.forward * num2;
						val6.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
					}
					if (UnityInput.Current.GetKey((KeyCode)97))
					{
						Transform transform2 = ((Component)val6.playerRigidbody).transform;
						transform2.position += ((Component)val6.playerGlobalHead).transform.right * (0f - num2);
						val6.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
					}
					if (UnityInput.Current.GetKey((KeyCode)115))
					{
						Transform transform3 = ((Component)val6.playerRigidbody).transform;
						transform3.position += ((Component)val6.playerGlobalHead).transform.forward * (0f - num2);
						val6.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
					}
					if (UnityInput.Current.GetKey((KeyCode)100))
					{
						Transform transform4 = ((Component)val6.playerRigidbody).transform;
						transform4.position += ((Component)val6.playerGlobalHead).transform.right * num2;
						val6.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
					}
					if (UnityInput.Current.GetKey((KeyCode)32))
					{
						Transform transform5 = ((Component)val6.playerRigidbody).transform;
						transform5.position += ((Component)val6.playerGlobalHead).transform.up * num2;
						val6.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
					}
					if (UnityInput.Current.GetKey((KeyCode)306))
					{
						Transform transform6 = ((Component)val6.playerRigidbody).transform;
						transform6.position += ((Component)val6.playerGlobalHead).transform.up * (0f - num2);
						val6.playerRigidbody.velocity = new Vector3(0f, 0f, 0f);
					}
				}
			}
			if (ToggleMain[6] && Doonce)
			{
				Doonce = true;
				PlayerControllerB[] array7 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val7 in array7)
				{
					PlayerControllerB component = val7.playersManager.allPlayerObjects[0].GetComponent<PlayerControllerB>();
					val7.SpawnDeadBody(val7.playersManager.thisClientPlayerId, new Vector3(0f, 10f, 0f), 0, component, 0, (Transform)null);
				}
			}
			if (ToggleMain[7])
			{
				PlayerControllerB[] array8 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val8 in array8)
				{
					Landmine.SpawnExplosion(val8.serverPlayerPosition, true, 999f, 999f);
				}
			}
			if (ToggleMain[8])
			{
				InfiniteSprint = true;
				PlayerControllerB[] array9 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val9 in array9)
				{
					val9.sprintTime = 9999f;
					val9.sprintMeter = 1f;
					val9.isExhausted = false;
				}
			}
			else
			{
				InfiniteSprint = false;
			}
			if (ToggleMain[9] && (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null && ((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer)
			{
				GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.insertedBattery.charge = 1f;
			}
			if (ToggleMic[1])
			{
				PlayerControllerB[] array10 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val10 in array10)
				{
					PlayerControllerB component2 = val10.playersManager.allPlayerObjects[0].GetComponent<PlayerControllerB>();
					val10.TeleportPlayer(new Vector3(0f, float.NegativeInfinity, 0f), false, 0f, false, true);
				}
			}
			if (ToggleMic[2])
			{
				StartOfRound[] array11 = Object.FindObjectsOfType<StartOfRound>();
				foreach (StartOfRound val11 in array11)
				{
					((Component)val11.localPlayerController).GetComponent<NetworkObject>().ChangeOwnership(val11.localPlayerController.actualClientId);
				}
			}
			if (ToggleMic[3])
			{
				Terminal[] array12 = Object.FindObjectsOfType<Terminal>();
				foreach (Terminal val12 in array12)
				{
					if ((Object)(object)val12 != (Object)null && addMoney)
					{
						if (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer)
						{
							val12.groupCredits += 200;
							addMoney = false;
							ToggleMic[3] = false;
						}
						else
						{
							val12.groupCredits += 200;
							val12.SyncGroupCreditsServerRpc(val12.groupCredits, val12.numberOfItemsInDropship);
							addMoney = false;
							ToggleMic[3] = false;
						}
					}
				}
			}
			if (ToggleMic[4])
			{
				HighScrapValue = true;
			}
			else
			{
				HighScrapValue = false;
			}
			if (ToggleMic[5])
			{
				UnlimitedScanRange = true;
			}
			else
			{
				UnlimitedScanRange = false;
			}
			if (ToggleMic[6])
			{
				Object[] array13 = Object.FindObjectsOfType(typeof(GrabbableObject));
				for (int num9 = 0; num9 < array13.Length; num9++)
				{
					GrabbableObject val13 = (GrabbableObject)array13[num9];
					string text = "Object";
					if ((Object)(object)val13.itemProperties != (Object)null)
					{
						if (val13.itemProperties.itemName != null)
						{
							text = val13.itemProperties.itemName;
						}
						int creditsWorth = val13.itemProperties.creditsWorth;
						text = text + " (" + val13.itemProperties.creditsWorth + ")";
					}
					if (WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)val13).transform.position, out var screen))
					{
						GUI.Label(new Rect(screen.x, screen.y, 100f, 25f), text);
					}
				}
			}
			if (ToggleMic[7])
			{
				PlayerControllerB[] array14 = Object.FindObjectsOfType<PlayerControllerB>();
				foreach (PlayerControllerB val14 in array14)
				{
					string playerUsername = val14.playerUsername;
					if (WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)val14.playerGlobalHead).transform.position, out var screen2))
					{
						GUI.Label(new Rect(screen2.x, screen2.y, 100f, 25f), playerUsername);
					}
				}
			}
			if (ToggleMic[8])
			{
				Object[] array15 = Object.FindObjectsOfType(typeof(EnemyAI));
				for (int num11 = 0; num11 < array15.Length; num11++)
				{
					EnemyAI val15 = (EnemyAI)array15[num11];
					string enemyName = val15.enemyType.enemyName;
					if (WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)val15).transform.position, out var screen3))
					{
						GUI.Label(new Rect(screen3.x, screen3.y, 100f, 100f), enemyName);
					}
				}
			}
			if (ToggleMic[9])
			{
				Terminal obj = Object.FindObjectOfType<Terminal>();
				obj.groupCredits += 100000;
			}
			if (ToggleMic[10])
			{
				Terminal obj2 = Object.FindObjectOfType<Terminal>();
				obj2.groupCredits -= 100000;
			}
			if (ToggleMic[11])
			{
				int groupCredits = Object.FindObjectOfType<Terminal>().groupCredits;
				Terminal obj3 = Object.FindObjectOfType<Terminal>();
				obj3.groupCredits -= groupCredits;
			}
			if (ToggleMic[12])
			{
				HUDManager obj4 = Object.FindObjectOfType<HUDManager>();
				obj4.localPlayerXP += 999;
			}
		}

		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_00ed: 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.DrawMainTab();
			}
			else if (selectedTab == 1)
			{
				_instance.DrawMicModsTab();
			}
			else if (selectedTab == 2)
			{
				_instance.DrawInfoTab();
			}
			else if (selectedTab == 3)
			{
				_instance.DrawPlayerListTab();
			}
			else if (selectedTab == 4)
			{
				_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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
			levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
			enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
			EnemyCannotBeSpawned = false;
			_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;
		}

		public static void PermaLockDoor()
		{
			DoorLock[] array = Object.FindObjectsOfType<DoorLock>();
			foreach (DoorLock val in array)
			{
				val.LockDoor(float.PositiveInfinity);
			}
		}

		public static void UnLockDoor()
		{
			DoorLock[] array = Object.FindObjectsOfType<DoorLock>();
			foreach (DoorLock val in array)
			{
				val.UnlockDoor();
			}
		}

		[HarmonyPatch(typeof(RoundManager), "EnemyCannotBeSpawned")]
		[HarmonyPrefix]
		private static bool OverrideCannotSpawn()
		{
			if (EnemyCannotBeSpawned)
			{
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPrefix]
		private static bool ModifyLevel(ref SelectableLevel newLevel)
		{
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			currentRound = RoundManager.Instance;
			if (!levelEnemySpawns.ContainsKey(newLevel))
			{
				List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
				{
					list.Add(enemy);
				}
				levelEnemySpawns.Add(newLevel, list);
			}
			levelEnemySpawns.TryGetValue(newLevel, out var value);
			newLevel.Enemies = value;
			foreach (SpawnableEnemyWithRarity enemy2 in newLevel.Enemies)
			{
				Debug.Log((object)("Inside: " + enemy2.enemyType.enemyName));
				if (!enemyRaritys.ContainsKey(enemy2))
				{
					enemyRaritys.Add(enemy2, enemy2.rarity);
				}
				int value2 = 0;
				enemyRaritys.TryGetValue(enemy2, out value2);
				enemy2.rarity = value2;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies)
			{
				Debug.Log((object)("Outside: " + outsideEnemy.enemyType.enemyName));
				if (!enemyRaritys.ContainsKey(outsideEnemy))
				{
					enemyRaritys.Add(outsideEnemy, outsideEnemy.rarity);
				}
				int value3 = 0;
				enemyRaritys.TryGetValue(outsideEnemy, out value3);
				outsideEnemy.rarity = value3;
			}
			foreach (SpawnableEnemyWithRarity enemy3 in newLevel.Enemies)
			{
				if (!enemyPropCurves.ContainsKey(enemy3))
				{
					enemyPropCurves.Add(enemy3, enemy3.enemyType.probabilityCurve);
				}
				AnimationCurve value4 = new AnimationCurve();
				enemyPropCurves.TryGetValue(enemy3, out value4);
				enemy3.enemyType.probabilityCurve = value4;
			}
			HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
			SelectableLevel val = newLevel;
			SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects;
			for (int i = 0; i < spawnableMapObjects.Length; i++)
			{
			}
			newLevel = val;
			return true;
		}
	}
	[BepInPlugin("com.notfishvr.lethalcompany", "notfishvr", "1.0.0")]
	public class Loader : BaseUnityPlugin
	{
		public void FixedUpdate()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)GameObject.Find("Loader")))
			{
				GameObject val = new GameObject("Loader");
				((Object)val).hideFlags = (HideFlags)0;
				((Object)val.AddComponent<MainGUI>()).hideFlags = (HideFlags)0;
				((Object)val.AddComponent<PlayerControllerBPatch>()).hideFlags = (HideFlags)0;
				((Object)val.AddComponent<OtuherPatch>()).hideFlags = (HideFlags)0;
			}
		}
	}
}
namespace LethalCompanyHacks.MainMenuPatch
{
	internal class JoinGameAfteStart
	{
		[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
		[HarmonyWrapSafe]
		internal class OnClientConnect_Patch
		{
			[HarmonyPatch(typeof(GameNetworkManager), "LeaveLobbyAtGameStart")]
			[HarmonyWrapSafe]
			internal static class LeaveLobbyAtGameStart_Patch
			{
				[HarmonyPrefix]
				private static bool Prefix()
				{
					return false;
				}
			}

			[HarmonyPatch(typeof(GameNetworkManager), "ConnectionApproval")]
			[HarmonyWrapSafe]
			internal static class ConnectionApproval_Patch
			{
				[HarmonyPostfix]
				private static void Postfix(ConnectionApprovalRequest request, ConnectionApprovalResponse response)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					if (request.ClientNetworkId != NetworkManager.Singleton.LocalClientId && response.Reason.Contains("Game has already started") && GameNetworkManager.Instance.gameHasStarted)
					{
						Debug.Log((object)"Uhh, no i do actually want this one to connect.");
						response.Reason = "";
						response.CreatePlayerObject = false;
						response.Approved = true;
						response.Pending = false;
					}
				}
			}

			[HarmonyPostfix]
			private static void Postfix(ulong clientId)
			{
				//IL_005a: 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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: 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_00cf: 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_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Unknown result type (might be due to invalid IL or missing references)
				StartOfRound instance = StartOfRound.Instance;
				if (((NetworkBehaviour)instance).IsServer && !instance.inShipPhase)
				{
					RoundManager instance2 = RoundManager.Instance;
					MethodInfo method = typeof(RoundManager).GetMethod("__beginSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic);
					MethodInfo method2 = typeof(RoundManager).GetMethod("__endSendClientRpc", BindingFlags.Instance | BindingFlags.NonPublic);
					ClientRpcParams val = default(ClientRpcParams);
					val.Send = new ClientRpcSendParams
					{
						TargetClientIds = new List<ulong> { clientId }
					};
					ClientRpcParams val2 = val;
					FastBufferWriter val3 = (FastBufferWriter)method.Invoke(instance2, new object[3] { 1193916134u, val2, 0 });
					BytePacker.WriteValueBitPacked(val3, StartOfRound.Instance.randomMapSeed);
					BytePacker.WriteValueBitPacked(val3, StartOfRound.Instance.currentLevelID);
					method2.Invoke(instance2, new object[4] { val3, 1193916134u, val2, 0 });
					FastBufferWriter val4 = (FastBufferWriter)method.Invoke(instance2, new object[3] { 2729232387u, val2, 0 });
					method2.Invoke(instance2, new object[4] { val4, 2729232387u, val2, 0 });
				}
			}
		}
	}
	public class OtuherPatch : MonoBehaviour
	{
		[HarmonyPatch(typeof(HUDManager))]
		public class ScanRangePatch
		{
			[HarmonyPatch("AssignNewNodes")]
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
			{
				if (!MainGUI.UnlimitedScanRange)
				{
					yield break;
				}
				foreach (CodeInstruction instruction in instructions)
				{
					if (instruction.opcode == OpCodes.Ldc_R4 && instruction.operand.Equals(20f))
					{
						instruction.operand = 500f;
					}
					yield return instruction;
				}
			}

			[HarmonyPatch("MeetsScanNodeRequirements")]
			public static bool Prefix(ScanNodeProperties node, ref bool __result)
			{
				if ((Object)(object)node == (Object)null)
				{
					return true;
				}
				__result = true;
				return false;
			}
		}

		[HarmonyPatch(typeof(GrabbableObject))]
		[HarmonyPatch("SyncBatteryServerRpc")]
		public static bool UnlimitedItemPower(GrabbableObject __instance, ref int charge)
		{
			if (MainGUI.UnlimitedItemPower && __instance.itemProperties.requiresBattery)
			{
				__instance.insertedBattery.empty = false;
				__instance.insertedBattery.charge = 1f;
				charge = 100;
			}
			return true;
		}

		[HarmonyPatch(typeof(RoundManager))]
		[HarmonyPatch("SyncScrapValuesClientRpc")]
		public static bool HighScrapValue(NetworkObjectReference[] spawnedScrap, ref int[] allScrapValue)
		{
			if (MainGUI.HighScrapValue)
			{
				return true;
			}
			if (spawnedScrap != null)
			{
				NetworkObject val = default(NetworkObject);
				for (int i = 0; i < spawnedScrap.Length; i++)
				{
					if (((NetworkObjectReference)(ref spawnedScrap[i])).TryGet(ref val, (NetworkManager)null))
					{
						GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>();
						if ((Object)(object)component != (Object)null)
						{
							allScrapValue[i] = 420;
						}
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerBPatch : MonoBehaviour
	{
		[HarmonyPatch(typeof(PlayerControllerB))]
		[HarmonyPatch("AllowPlayerDeath")]
		public static bool OverrideDeath()
		{
			return !MainGUI.enableGod;
		}

		[HarmonyPatch(typeof(PlayerControllerB))]
		[HarmonyPatch("Update")]
		public static void ReadInput(PlayerControllerB playerController)
		{
			FlashlightItem[] array = Object.FindObjectsOfType<FlashlightItem>();
			foreach (FlashlightItem val in array)
			{
				((Behaviour)playerController.helmetLight).enabled = true;
				val.usingPlayerHelmetLight = false;
				((GrabbableObject)val).UseItemOnClient(true);
				val.PocketFlashlightServerRpc(true);
			}
		}
	}
}