Decompiled source of LethalMenu v1.1.1

LethalMenu.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using GameNetcodeStuff;
using HarmonyLib;
using LethalMenu.Cheats;
using LethalMenu.Components;
using LethalMenu.Handler;
using LethalMenu.Handler.EnemyControl;
using LethalMenu.Language;
using LethalMenu.Manager;
using LethalMenu.Menu.Core;
using LethalMenu.Menu.Popup;
using LethalMenu.Menu.Tab;
using LethalMenu.Themes;
using LethalMenu.Types;
using LethalMenu.Util;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Steamworks;
using Steamworks.Data;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalMenu")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+9895821835330a32fd071f7791aa6e052a99f61a")]
[assembly: AssemblyProduct("LethalMenu")]
[assembly: AssemblyTitle("LethalMenu")]
[assembly: AssemblyVersion("1.0.0.0")]
[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;
		}
	}
}
namespace LethalMenu
{
	public class Cheat : MonoBehaviour
	{
		protected static bool WorldToScreen(Camera camera, Vector3 world, out Vector3 screen)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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 (double)screen.z > 0.0;
		}

		protected static bool WorldToScreen(Vector3 world, out Vector3 screen)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			screen = CameraManager.ActiveCamera.WorldToViewportPoint(world);
			screen.x *= Screen.width;
			screen.y *= Screen.height;
			screen.y = (float)Screen.height - screen.y;
			return (double)screen.z > 0.0;
		}

		protected void DrawLabel(Vector3 pos, string text, Color color, float distance)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			VisualUtil.DrawString(new Vector2(pos.x, pos.y), text + "\n" + distance + "m", color, centered: true, alignMiddle: true);
		}

		protected float GetDistanceToPlayer(Vector3 position)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return (float)Math.Round(Vector3.Distance(((Component)CameraManager.ActiveCamera).transform.position, position));
		}

		public virtual void OnGui()
		{
		}

		public virtual void Update()
		{
		}

		public virtual void FixedUpdate()
		{
		}
	}
	public enum Hack
	{
		OpenMenu,
		UnloadMenu,
		ToggleCursor,
		GodMode,
		SuperJump,
		FastClimb,
		NightVision,
		UnlimitedStamina,
		UnlimitedBattery,
		UnlimitedOxygen,
		UnlimitedZapGun,
		LootThroughWalls,
		InteractThroughWalls,
		Reach,
		UnlockDoors,
		UnlockDoorAction,
		SuperSpeed,
		NoClip,
		Experience,
		Teleport,
		TeleportShip,
		TeleportSavedPosition,
		SaveTeleportPosition,
		BuildAnywhere,
		Weight,
		GhostMode,
		UnlimitedAmmo,
		FreeCam,
		NoCooldown,
		InstantInteract,
		SuperShovel,
		StrongHands,
		Invisibility,
		NoFallDamage,
		HearAllAlivePeople,
		HearAllDeadPeople,
		NoFlash,
		NoCameraShake,
		NoQuicksand,
		TeleportWithItems,
		SuperKnife,
		BridgeNeverFalls,
		DeleteHeldItem,
		DropAllItems,
		UnlimitedPresents,
		VoteShipLeaveEarly,
		VehicleGodMode,
		EggsNeverExplode,
		UnlockAllDoors,
		OpenAllBigDoors,
		CloseAllBigDoors,
		GrabItemsBeforeGame,
		ClickTeleport,
		ClickTeleportAction,
		ToggleAllDisplays,
		DisplayBodyCount,
		DisplayEnemyCount,
		DisplayObjectCount,
		DisplayObjectValue,
		DisplayShipObjectCount,
		DisplayShipObjectValue,
		DisplayQuota,
		DisplayDeadline,
		DisplayBuyingRate,
		ModifyCredits,
		ModifyQuota,
		EndGame,
		StartGame,
		SpawnMoreScrap,
		UnlockUnlockable,
		UnlockUnlockableSuit,
		Shoplifter,
		NeverLoseScrap,
		ShowOffensiveLobbyNames,
		JoinLobby,
		Disconnect,
		Message,
		ResetShip,
		ItemSlots,
		ToggleShipLights,
		ToggleFactoryLights,
		ToggleShipHorn,
		ToggleCarHorn,
		ToggleTerminalSound,
		ForceBridgeFall,
		ForceSmallBridgeFall,
		BlowUpAllLandmines,
		ToggleAllLandmines,
		ToggleAllTurrets,
		KillAllEnemies,
		KillNearbyEnemies,
		StunAllEnemies,
		ForceTentacleAttack,
		FlickerLights,
		FixAllValves,
		ModifyScrap,
		SpawnMaskedEnemy,
		BreakAllWebs,
		SpawnLandmine,
		SpawnTurret,
		SpawnSpikeRoofTrap,
		SpawnMapObjects,
		SellEverything,
		TeleportAllItems,
		TeleportOneItem,
		EjectEveryone,
		OpenShipDoorSpace,
		BerserkAllTurrets,
		PJSpammer,
		ToggleAllESP,
		ObjectESP,
		EnemyESP,
		PlayerESP,
		DoorESP,
		LandmineESP,
		TurretESP,
		ShipESP,
		BreakerESP,
		SteamHazardESP,
		BigDoorESP,
		DoorLockESP,
		SpikeRoofTrapESP,
		AlwaysShowClock,
		SimpleClock,
		Crosshair,
		Breadcrumbs,
		NoFog,
		NoVisor,
		NoFieldOfDepth,
		FOV,
		KillPlayer,
		HealPlayer,
		LightningStrikePlayer,
		DeathNotifications,
		DeathNotify,
		SpectatePlayer,
		MiniCam,
		TeleportEnemy,
		SpiderWebPlayer,
		LureAllEnemies,
		ExplodeClosestMine,
		ForceBleed,
		EnemyControl,
		ToggleTip
	}
	public static class HackExtensions
	{
		private static readonly Hack[] KeyBindIgnore = new Hack[20]
		{
			Hack.ModifyQuota,
			Hack.ModifyCredits,
			Hack.KillPlayer,
			Hack.HealPlayer,
			Hack.LightningStrikePlayer,
			Hack.Experience,
			Hack.Teleport,
			Hack.DeathNotify,
			Hack.SpectatePlayer,
			Hack.MiniCam,
			Hack.UnlockUnlockable,
			Hack.ModifyScrap,
			Hack.Message,
			Hack.SpiderWebPlayer,
			Hack.TeleportEnemy,
			Hack.EnemyControl,
			Hack.LureAllEnemies,
			Hack.ExplodeClosestMine,
			Hack.ForceBleed,
			Hack.SpawnMapObjects
		};

		private static List<Hack> Waiting = new List<Hack>();

		public static readonly Dictionary<Hack, bool> ToggleFlags = new Dictionary<Hack, bool>
		{
			{
				Hack.OpenMenu,
				false
			},
			{
				Hack.ToggleCursor,
				false
			},
			{
				Hack.GodMode,
				false
			},
			{
				Hack.SuperJump,
				false
			},
			{
				Hack.FastClimb,
				false
			},
			{
				Hack.NightVision,
				false
			},
			{
				Hack.UnlimitedStamina,
				false
			},
			{
				Hack.UnlimitedBattery,
				false
			},
			{
				Hack.UnlimitedOxygen,
				false
			},
			{
				Hack.LootThroughWalls,
				false
			},
			{
				Hack.InteractThroughWalls,
				false
			},
			{
				Hack.Reach,
				false
			},
			{
				Hack.UnlockDoors,
				false
			},
			{
				Hack.AlwaysShowClock,
				false
			},
			{
				Hack.SimpleClock,
				false
			},
			{
				Hack.SuperSpeed,
				false
			},
			{
				Hack.NoClip,
				false
			},
			{
				Hack.ObjectESP,
				false
			},
			{
				Hack.EnemyESP,
				false
			},
			{
				Hack.PlayerESP,
				false
			},
			{
				Hack.DoorESP,
				false
			},
			{
				Hack.LandmineESP,
				false
			},
			{
				Hack.TurretESP,
				false
			},
			{
				Hack.ShipESP,
				false
			},
			{
				Hack.BreakerESP,
				false
			},
			{
				Hack.SteamHazardESP,
				false
			},
			{
				Hack.BigDoorESP,
				false
			},
			{
				Hack.DoorLockESP,
				false
			},
			{
				Hack.SpikeRoofTrapESP,
				false
			},
			{
				Hack.Crosshair,
				false
			},
			{
				Hack.DisplayBodyCount,
				false
			},
			{
				Hack.DisplayEnemyCount,
				false
			},
			{
				Hack.DisplayObjectCount,
				false
			},
			{
				Hack.DisplayObjectValue,
				false
			},
			{
				Hack.DisplayShipObjectCount,
				false
			},
			{
				Hack.DisplayShipObjectValue,
				false
			},
			{
				Hack.DisplayQuota,
				false
			},
			{
				Hack.DisplayDeadline,
				false
			},
			{
				Hack.DisplayBuyingRate,
				false
			},
			{
				Hack.ToggleAllLandmines,
				false
			},
			{
				Hack.ToggleAllTurrets,
				false
			},
			{
				Hack.ToggleShipHorn,
				false
			},
			{
				Hack.ToggleCarHorn,
				false
			},
			{
				Hack.Breadcrumbs,
				false
			},
			{
				Hack.DeathNotifications,
				false
			},
			{
				Hack.NoFog,
				false
			},
			{
				Hack.BuildAnywhere,
				false
			},
			{
				Hack.Weight,
				false
			},
			{
				Hack.GhostMode,
				false
			},
			{
				Hack.UnlimitedAmmo,
				false
			},
			{
				Hack.FreeCam,
				false
			},
			{
				Hack.SpectatePlayer,
				false
			},
			{
				Hack.MiniCam,
				false
			},
			{
				Hack.EnemyControl,
				false
			},
			{
				Hack.NoCooldown,
				false
			},
			{
				Hack.InstantInteract,
				false
			},
			{
				Hack.SuperShovel,
				false
			},
			{
				Hack.StrongHands,
				false
			},
			{
				Hack.Invisibility,
				false
			},
			{
				Hack.NoFallDamage,
				false
			},
			{
				Hack.Shoplifter,
				false
			},
			{
				Hack.HearAllAlivePeople,
				false
			},
			{
				Hack.HearAllDeadPeople,
				false
			},
			{
				Hack.NoVisor,
				false
			},
			{
				Hack.NoFieldOfDepth,
				false
			},
			{
				Hack.NeverLoseScrap,
				false
			},
			{
				Hack.NoFlash,
				false
			},
			{
				Hack.TeleportWithItems,
				false
			},
			{
				Hack.OpenShipDoorSpace,
				false
			},
			{
				Hack.UnlimitedPresents,
				false
			},
			{
				Hack.ShowOffensiveLobbyNames,
				false
			},
			{
				Hack.NoCameraShake,
				false
			},
			{
				Hack.SuperKnife,
				false
			},
			{
				Hack.NoQuicksand,
				false
			},
			{
				Hack.BerserkAllTurrets,
				false
			},
			{
				Hack.BridgeNeverFalls,
				false
			},
			{
				Hack.VehicleGodMode,
				false
			},
			{
				Hack.EggsNeverExplode,
				false
			},
			{
				Hack.ForceBleed,
				false
			},
			{
				Hack.UnlimitedZapGun,
				false
			},
			{
				Hack.ToggleTerminalSound,
				false
			},
			{
				Hack.GrabItemsBeforeGame,
				false
			},
			{
				Hack.ClickTeleport,
				false
			},
			{
				Hack.PJSpammer,
				false
			},
			{
				Hack.ItemSlots,
				false
			},
			{
				Hack.FOV,
				false
			},
			{
				Hack.ToggleTip,
				true
			}
		};

		private static readonly Dictionary<Hack, Delegate> Executors = new Dictionary<Hack, Delegate>
		{
			{
				Hack.ToggleCursor,
				new Action(HackExecutor.ToggleCursor)
			},
			{
				Hack.OpenMenu,
				new Action(HackExecutor.OpenMenu)
			},
			{
				Hack.UnloadMenu,
				new Action(HackExecutor.UnloadMenu)
			},
			{
				Hack.Experience,
				new Action<int, ActionType>(HackExecutor.ModExperience)
			},
			{
				Hack.Teleport,
				new Action<Vector3, bool, bool, bool>(HackExecutor.Teleport)
			},
			{
				Hack.TeleportShip,
				new Action(HackExecutor.TeleportShip)
			},
			{
				Hack.TeleportSavedPosition,
				new Action(HackExecutor.TeleportSavedPosition)
			},
			{
				Hack.SaveTeleportPosition,
				new Action(HackExecutor.SaveTeleportPosition)
			},
			{
				Hack.ModifyCredits,
				new Action<int, ActionType>(HackExecutor.ModCredits)
			},
			{
				Hack.ModifyQuota,
				new Action<int>(HackExecutor.ModQuota)
			},
			{
				Hack.Message,
				new Action<string, int, int>(HackExecutor.Message)
			},
			{
				Hack.SpawnMoreScrap,
				new Action(HackExecutor.SpawnMoreScrap)
			},
			{
				Hack.EndGame,
				new Action(HackExecutor.EndGame)
			},
			{
				Hack.StartGame,
				new Action(HackExecutor.StartGame)
			},
			{
				Hack.ToggleShipLights,
				new Action(HackExecutor.ToggleShipLights)
			},
			{
				Hack.ToggleCarHorn,
				new Action(HackExecutor.ToggleCarHorn)
			},
			{
				Hack.ToggleFactoryLights,
				new Action(HackExecutor.ToggleFactoryLights)
			},
			{
				Hack.ToggleShipHorn,
				new Action(HackExecutor.ToggleShipHorn)
			},
			{
				Hack.ForceBridgeFall,
				new Action(HackExecutor.ForceBridgeFall)
			},
			{
				Hack.ForceSmallBridgeFall,
				new Action(HackExecutor.ForceSmallBridgeFall)
			},
			{
				Hack.BlowUpAllLandmines,
				new Action(HackExecutor.BlowUpAllLandmines)
			},
			{
				Hack.KillAllEnemies,
				new Action(HackExecutor.KillAllEnemies)
			},
			{
				Hack.KillNearbyEnemies,
				new Action<int>(HackExecutor.KillNearbyEnemies)
			},
			{
				Hack.StunAllEnemies,
				new Action(HackExecutor.StunAllEnemies)
			},
			{
				Hack.ForceTentacleAttack,
				new Action(HackExecutor.ForceTentacleAttack)
			},
			{
				Hack.ToggleAllLandmines,
				new Action(HackExecutor.ToggleAllLandmines)
			},
			{
				Hack.ToggleAllTurrets,
				new Action(HackExecutor.ToggleAllTurrets)
			},
			{
				Hack.KillPlayer,
				new Action<PlayerControllerB>(HackExecutor.KillPlayer)
			},
			{
				Hack.HealPlayer,
				new Action<PlayerControllerB>(HackExecutor.HealPlayer)
			},
			{
				Hack.LightningStrikePlayer,
				new Action<PlayerControllerB>(HackExecutor.LightningStrikePlayer)
			},
			{
				Hack.UnlockDoorAction,
				new Action(HackExecutor.UnlockDoor)
			},
			{
				Hack.ToggleAllESP,
				new Action(HackExecutor.ToggleAllESP)
			},
			{
				Hack.DeathNotify,
				new Action<PlayerControllerB, CauseOfDeath>(HackExecutor.NotifyDeath)
			},
			{
				Hack.SpectatePlayer,
				new Action<PlayerControllerB>(HackExecutor.SpectatePlayer)
			},
			{
				Hack.MiniCam,
				new Action<PlayerControllerB>(HackExecutor.MiniCam)
			},
			{
				Hack.UnlockUnlockable,
				new Action<Unlockable, bool, bool>(HackExecutor.UnlockUnlockable)
			},
			{
				Hack.UnlockUnlockableSuit,
				new Action<Unlockable, bool, bool, bool>(HackExecutor.UnlockUnlockableSuit)
			},
			{
				Hack.FlickerLights,
				new Action(HackExecutor.FlickerLights)
			},
			{
				Hack.FixAllValves,
				new Action(HackExecutor.FixAllValves)
			},
			{
				Hack.ModifyScrap,
				new Action<int, int>(HackExecutor.ModScrap)
			},
			{
				Hack.TeleportEnemy,
				new Action<PlayerControllerB, EnemyAI[]>(HackExecutor.TeleportEnemy)
			},
			{
				Hack.EnemyControl,
				new Action<EnemyAI>(HackExecutor.ControlEnemy)
			},
			{
				Hack.SpawnMaskedEnemy,
				new Action(HackExecutor.SpawnMaskedEnemy)
			},
			{
				Hack.SpiderWebPlayer,
				new Action<PlayerControllerB>(HackExecutor.SpiderWebPlayer)
			},
			{
				Hack.BreakAllWebs,
				new Action(HackExecutor.BreakAllWebs)
			},
			{
				Hack.LureAllEnemies,
				new Action<PlayerControllerB>(HackExecutor.LureAllEnemies)
			},
			{
				Hack.SpawnMapObjects,
				new Action<MapObject>(HackExecutor.SpawnMapObjects)
			},
			{
				Hack.SpawnLandmine,
				new Action(HackExecutor.SpawnLandmine)
			},
			{
				Hack.SpawnTurret,
				new Action(HackExecutor.SpawnTurret)
			},
			{
				Hack.SpawnSpikeRoofTrap,
				new Action(HackExecutor.SpawnSpikeRoofTrap)
			},
			{
				Hack.ExplodeClosestMine,
				new Action<PlayerControllerB>(HackExecutor.ExplodeClosestMine)
			},
			{
				Hack.ForceBleed,
				new Action<PlayerControllerB>(HackExecutor.ForceBleed)
			},
			{
				Hack.SellEverything,
				new Action(HackExecutor.SellEverything)
			},
			{
				Hack.TeleportAllItems,
				new Action(HackExecutor.TeleportAllItems)
			},
			{
				Hack.TeleportOneItem,
				new Action(HackExecutor.TeleportOneItem)
			},
			{
				Hack.EjectEveryone,
				new Action(HackExecutor.EjectEveryone)
			},
			{
				Hack.JoinLobby,
				new Action<SteamId>(HackExecutor.JoinLobby)
			},
			{
				Hack.Disconnect,
				new Action(HackExecutor.Disconnect)
			},
			{
				Hack.VoteShipLeaveEarly,
				new Action(HackExecutor.VoteShipLeaveEarly)
			},
			{
				Hack.UnlockAllDoors,
				new Action(HackExecutor.UnlockAllDoors)
			},
			{
				Hack.DropAllItems,
				new Action(HackExecutor.DropAllItems)
			},
			{
				Hack.BerserkAllTurrets,
				new Action(HackExecutor.BerserkAllTurrets)
			},
			{
				Hack.ResetShip,
				new Action(HackExecutor.ResetShip)
			},
			{
				Hack.ToggleAllDisplays,
				new Action(HackExecutor.ToggleAllDisplays)
			},
			{
				Hack.ToggleTerminalSound,
				new Action(HackExecutor.ToggleTerminalSound)
			},
			{
				Hack.DeleteHeldItem,
				new Action(HackExecutor.DeleteHeldItem)
			},
			{
				Hack.ClickTeleportAction,
				new Action(HackExecutor.ClickTeleport)
			}
		};

		public static readonly Dictionary<Hack, ButtonControl> KeyBinds = new Dictionary<Hack, ButtonControl>
		{
			{
				Hack.OpenMenu,
				(ButtonControl)(object)Keyboard.current.insertKey
			},
			{
				Hack.ToggleCursor,
				(ButtonControl)(object)Keyboard.current.leftAltKey
			},
			{
				Hack.UnloadMenu,
				(ButtonControl)(object)Keyboard.current.pauseKey
			},
			{
				Hack.UnlockDoorAction,
				(ButtonControl)(object)Keyboard.current.f1Key
			},
			{
				Hack.ClickTeleportAction,
				Mouse.current.middleButton
			}
		};

		public static void Execute(this Hack hack, params object[] param)
		{
			if (hack.CanBeToggled())
			{
				hack.Toggle();
			}
			if (Executors.TryGetValue(hack, out var value))
			{
				if (value is Action action)
				{
					action();
				}
				else
				{
					value.DynamicInvoke(param);
				}
			}
		}

		public static void Invoke(this Hack hack, params object[] param)
		{
			if (Executors.TryGetValue(hack, out var value))
			{
				if (value is Action action)
				{
					action();
				}
				else
				{
					value.DynamicInvoke(param);
				}
			}
		}

		public static bool CanBeToggled(this Hack hack)
		{
			return ToggleFlags.ContainsKey(hack);
		}

		public static bool CanBeExecuted(this Hack hack)
		{
			return Executors.ContainsKey(hack);
		}

		public static bool IsEnabled(this Hack hack)
		{
			return ToggleFlags[hack];
		}

		public static void Toggle(this Hack hack)
		{
			ToggleFlags[hack] = !ToggleFlags[hack];
		}

		public static void SetToggle(this Hack hack, bool b)
		{
			ToggleFlags[hack] = b;
		}

		public static void RemoveKeyBind(this Hack hack)
		{
			if (KeyBinds.ContainsKey(hack))
			{
				KeyBinds.Remove(hack);
			}
		}

		public static void SetKeyBind(this Hack hack, ButtonControl btn)
		{
			if (!KeyBindIgnore.Contains(hack) && btn != null)
			{
				if (KeyBinds.ContainsKey(hack))
				{
					KeyBinds[hack] = btn;
				}
				else
				{
					KeyBinds.Add(hack, btn);
				}
			}
		}

		public static bool Button(this Hack hack)
		{
			return GUILayout.Button(Localization.Localize(hack.ToBtnText()), Array.Empty<GUILayoutOption>());
		}

		public static string ToBtnText(this Hack hack)
		{
			if (!hack.CanBeToggled())
			{
				return "General.Execute";
			}
			if (!ToggleFlags[hack])
			{
				return "General.Enable";
			}
			return "General.Disable";
		}

		public static ButtonControl GetKeyBind(this Hack hack)
		{
			if (!KeyBinds.ContainsKey(hack))
			{
				return null;
			}
			return KeyBinds[hack];
		}

		public static bool HasKeyBind(this Hack hack)
		{
			return KeyBinds.ContainsKey(hack);
		}

		public static bool CanHaveKeyBind(this Hack hack)
		{
			return !KeyBindIgnore.Contains(hack);
		}

		public static bool IsWaiting(this Hack hack)
		{
			return Waiting.Contains(hack);
		}

		public static bool IsAnyHackWaiting(this Hack hack)
		{
			return Waiting.Count > 0;
		}

		public static void SetWaiting(this Hack hack, bool b)
		{
			if (b && !Waiting.Contains(hack))
			{
				Waiting.Add(hack);
			}
			if (!b && Waiting.Contains(hack))
			{
				Waiting.Remove(hack);
			}
		}

		public static bool KeyBindInUse(ButtonControl btn)
		{
			foreach (Hack key in KeyBinds.Keys)
			{
				if (KeyBinds[key] == btn)
				{
					return true;
				}
			}
			return false;
		}
	}
	public class HackExecutor
	{
		public static void ToggleAllESP()
		{
			Hack.ObjectESP.Execute();
			Hack.EnemyESP.Execute();
			Hack.PlayerESP.Execute();
			Hack.DoorESP.Execute();
			Hack.LandmineESP.Execute();
			Hack.TurretESP.Execute();
			Hack.ShipESP.Execute();
			Hack.SteamHazardESP.Execute();
			Hack.BigDoorESP.Execute();
			Hack.DoorLockESP.Execute();
			Hack.BreakerESP.Execute();
			Hack.SpikeRoofTrapESP.Execute();
		}

		public static void ToggleAllDisplays()
		{
			Hack.DisplayBodyCount.Execute();
			Hack.DisplayBuyingRate.Execute();
			Hack.DisplayDeadline.Execute();
			Hack.DisplayEnemyCount.Execute();
			Hack.DisplayObjectCount.Execute();
			Hack.DisplayObjectValue.Execute();
			Hack.DisplayQuota.Execute();
			Hack.DisplayShipObjectCount.Execute();
			Hack.DisplayShipObjectValue.Execute();
		}

		public static void UnlockDoor()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			if (!Hack.UnlockDoors.IsEnabled())
			{
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				return;
			}
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(new Ray(((Component)CameraManager.ActiveCamera).transform.position, ((Component)CameraManager.ActiveCamera).transform.forward), ref val, 5f, LayerMask.GetMask(new string[1] { "InteractableObject" })))
			{
				DoorLock component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<DoorLock>();
				if ((Object)(object)component != (Object)null && component.isLocked && !component.isPickingLock)
				{
					component.UnlockDoorSyncWithServer();
					HUDManager.Instance.DisplayTip("Lethal Menu", "Door Unlocked", false, false, "LC_Tip1");
				}
				return;
			}
			LethalMenu.turrets.ForEach(delegate(Turret turret)
			{
				((Component)turret).gameObject.GetComponent<TerminalAccessibleObject>().CallFunctionFromTerminal();
			});
			foreach (TerminalAccessibleObject allTerminalObject in LethalMenu.allTerminalObjects)
			{
				Vector3 val2 = ((Component)allTerminalObject).transform.position - ((Component)localPlayerController).transform.position;
				if (Vector3.Angle(((Component)localPlayerController).transform.forward, val2) < 60f && ((Vector3)(ref val2)).magnitude < 5f)
				{
					string text = "Terminal Object";
					text = (allTerminalObject.isBigDoor ? "Big Door" : ((((Object)allTerminalObject).name == "TurretScript") ? "Turret" : ((!(((Object)allTerminalObject).name == "Landmine")) ? ((Object)allTerminalObject).name : "Landmine")));
					allTerminalObject.CallFunctionFromTerminal();
					HUDManager.Instance.DisplayTip("Lethal Menu", text + " ( " + allTerminalObject.objectCode + " ) has been called from the terminal.", false, false, "LC_Tip1");
				}
			}
		}

		public static void ClickTeleport()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (Hack.ClickTeleport.IsEnabled())
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(new Ray(((Component)CameraManager.ActiveCamera).transform.position, ((Component)CameraManager.ActiveCamera).transform.forward), ref val, 1000f, LayerMask.GetMask(new string[1] { "Room" })))
				{
					localPlayerController.TeleportPlayer(((RaycastHit)(ref val)).point, false, 0f, false, true);
				}
			}
		}

		public static void ModExperience(int amt, ActionType type)
		{
			int localPlayerXP = amt;
			if (type == ActionType.Add)
			{
				localPlayerXP = HUDManager.Instance.localPlayerXP + amt;
			}
			if (type == ActionType.Remove)
			{
				localPlayerXP = HUDManager.Instance.localPlayerXP - amt;
			}
			HUDManager.Instance.localPlayerXP = localPlayerXP;
		}

		public static void ToggleCursor()
		{
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				if (Cursor.visible)
				{
					MenuUtil.HideCursor();
				}
				else
				{
					MenuUtil.ShowCursor();
				}
			}
		}

		public static void OpenMenu()
		{
			if (Hack.OpenMenu.IsEnabled())
			{
				MenuUtil.ShowCursor();
			}
			else
			{
				MenuUtil.HideCursor();
			}
		}

		public static void UnloadMenu()
		{
			LethalMenu.Instance.Unload();
		}

		public static void NotifyDeath(PlayerControllerB died, CauseOfDeath cause)
		{
			HUDManager.Instance.DisplayTip("Lethal Menu", died.playerUsername + " has died from " + ((object)(CauseOfDeath)(ref cause)).ToString(), false, false, "LC_Tip1");
		}

		public static void SpawnEnemy(EnemyType type, int num, bool outside)
		{
			RoundHandler.SpawnEnemy(type, num, outside);
		}

		public static void SpawnMaskedEnemy()
		{
			RoundHandler.SpawnMimicFromMasks();
		}

		public static void ToggleAllLandmines()
		{
			RoundHandler.ToggleAllLandmines();
		}

		public static void ToggleAllTurrets()
		{
			RoundHandler.ToggleAllTurrets();
		}

		public static void BlowUpAllLandmines()
		{
			RoundHandler.BlowUpAllLandmines();
		}

		public static void FixAllValves()
		{
			RoundHandler.FixAllValves();
		}

		public static void ToggleShipHorn()
		{
			RoundHandler.ToggleShipHorn();
		}

		public static void ForceBridgeFall()
		{
			RoundHandler.ForceBridgeFall();
		}

		public static void ForceSmallBridgeFall()
		{
			RoundHandler.ForceSmallBridgeFall();
		}

		public static void ForceTentacleAttack()
		{
			RoundHandler.ForceTentacleAttack();
		}

		public static void ModScrap(int value, int type)
		{
			RoundHandler.ModScrap(value, type);
		}

		public static void FlickerLights()
		{
			RoundHandler.FlickerLights();
		}

		public static void SpawnMoreScrap()
		{
			RoundHandler.SpawnScrap();
		}

		public static void ResetShip()
		{
			RoundHandler.ResetShip();
		}

		public static void UnlockUnlockable(Unlockable unlockable, bool all, bool enabled)
		{
			RoundHandler.BuyUnlockable(unlockable, all, enabled);
		}

		public static void UnlockUnlockableSuit(Unlockable unlockablesuit, bool wearbuy, bool buy, bool sound)
		{
			RoundHandler.BuyUnlockableSuit(unlockablesuit, wearbuy, buy, sound);
		}

		public static void EndGame()
		{
			RoundHandler.EndGame();
		}

		public static void StartGame()
		{
			RoundHandler.StartGame();
		}

		public static void ModQuota(int amt)
		{
			RoundHandler.SetQuota(amt);
		}

		public static void Message(string msg, int type, int id)
		{
			RoundHandler.Message(msg, type, id);
		}

		public static void ModCredits(int amt, ActionType type)
		{
			RoundHandler.ModCredits(amt, type);
		}

		public static void BreakAllWebs()
		{
			RoundHandler.BreakAllWebs();
		}

		public static void SpawnLandmine()
		{
			RoundHandler.SpawnMapObject(MapObject.Landmine);
		}

		public static void SpawnTurret()
		{
			RoundHandler.SpawnMapObject(MapObject.TurretContainer);
		}

		public static void SpawnSpikeRoofTrap()
		{
			RoundHandler.SpawnMapObject(MapObject.SpikeRoofTrapHazard);
		}

		public static void SpawnMapObjects(MapObject type)
		{
			RoundHandler.SpawnMapObjects(type);
		}

		public static void SellEverything()
		{
			LethalMenu.localPlayer.Handle().PlaceEverythingOnDesk();
		}

		public static void ExplodeClosestMine(PlayerControllerB player)
		{
			player.Handle().ExplodeClosestLandmine();
		}

		public static void ForceBleed(PlayerControllerB player)
		{
			player.Handle().ForceBleed();
		}

		public static void LureAllEnemies(PlayerControllerB player)
		{
			player.Handle().LureAllEnemies();
		}

		public static void SpiderWebPlayer(PlayerControllerB player)
		{
			player.Handle().SpawnSpiderWebs(6);
		}

		public static void SpectatePlayer(PlayerControllerB player)
		{
			player.Handle().Spectate();
		}

		public static void MiniCam(PlayerControllerB player)
		{
			player.Handle().MiniCam();
		}

		public static void SaveTeleportPosition()
		{
			LethalMenu.localPlayer.Handle().SavePosition();
		}

		public static void TeleportShip()
		{
			LethalMenu.localPlayer.Handle().TeleportShip();
		}

		public static void TeleportSavedPosition()
		{
			LethalMenu.localPlayer.Handle().TeleportSaved();
		}

		public static void Teleport(Vector3 pos, bool elevator = false, bool ship = false, bool factory = false)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			LethalMenu.localPlayer.Handle().Teleport(pos, elevator, ship, factory);
		}

		public static void KillPlayer(PlayerControllerB player)
		{
			player.Handle().Kill();
		}

		public static void HealPlayer(PlayerControllerB player)
		{
			player.Handle().Heal();
		}

		public static void LightningStrikePlayer(PlayerControllerB player)
		{
			player.Handle().Strike();
		}

		public static void ControlEnemy(EnemyAI enemy)
		{
			enemy.Handle().Control();
		}

		public static void TeleportEnemy(PlayerControllerB player, EnemyAI[] enemies)
		{
			enemies.ToList().FindAll((EnemyAI e) => !e.isEnemyDead).ForEach(delegate(EnemyAI e)
			{
				e.Handle().Teleport(player);
			});
		}

		public static void StunAllEnemies()
		{
			LethalMenu.enemies.ForEach(delegate(EnemyAI enemy)
			{
				enemy.Handle().Stun();
			});
		}

		public static void KillAllEnemies()
		{
			LethalMenu.enemies.ForEach(delegate(EnemyAI enemy)
			{
				enemy.Handle().Kill();
			});
		}

		public static void KillNearbyEnemies(int distance = -1)
		{
			LethalMenu.enemies.FindAll((EnemyAI e) => GameUtil.GetDistanceToPlayer(((Component)e).transform.position) <= (float)distance).ForEach(delegate(EnemyAI enemy)
			{
				enemy.Handle().Kill();
			});
		}

		public static void ToggleShipLights()
		{
			RoundHandler.ToggleShipLights();
		}

		public static void ToggleCarHorn()
		{
			RoundHandler.ToggleCarHorn();
		}

		public static void ToggleFactoryLights()
		{
			RoundHandler.ToggleFactoryLights();
		}

		public static void TeleportAllItems()
		{
			RoundHandler.TeleportAllItems();
		}

		public static void TeleportOneItem()
		{
			RoundHandler.TeleportOneItem();
		}

		public static void EjectEveryone()
		{
			StartOfRound.Instance.ManuallyEjectPlayersServerRpc();
		}

		public static void JoinLobby(SteamId id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			RoundHandler.JoinLobby(id);
		}

		public static void Disconnect()
		{
			RoundHandler.Disconnect();
		}

		public static void VoteShipLeaveEarly()
		{
			TimeOfDay.Instance.VoteShipToLeaveEarly();
		}

		public static void BerserkAllTurrets()
		{
			RoundHandler.BerserkAllTurrets();
		}

		public static void DropAllItems()
		{
			RoundHandler.DropAllItems();
		}

		public static void ToggleTerminalSound()
		{
			RoundHandler.ToggleTerminalSound();
		}

		public static void DeleteHeldItem()
		{
			RoundHandler.DeleteHeldItem();
		}

		public static void UnlockAllDoors()
		{
			RoundHandler.UnlockAllDoors();
		}

		public static void OpenAllBigDoors()
		{
			RoundHandler.OpenAllBigDoors();
		}

		public static void CloseAllBigDoors()
		{
			RoundHandler.CloseAllBigDoors();
		}
	}
	public class LethalMenu : MonoBehaviour
	{
		private List<Cheat> cheats;

		public static List<GrabbableObject> items = new List<GrabbableObject>();

		public static List<Landmine> landmines = new List<Landmine>();

		public static List<Turret> turrets = new List<Turret>();

		public static List<EntranceTeleport> doors = new List<EntranceTeleport>();

		public static List<PlayerControllerB> players = new List<PlayerControllerB>();

		public static List<EnemyAI> enemies = new List<EnemyAI>();

		public static List<SteamValveHazard> steamValves = new List<SteamValveHazard>();

		public static List<TerminalAccessibleObject> bigDoors = new List<TerminalAccessibleObject>();

		public static List<TerminalAccessibleObject> allTerminalObjects = new List<TerminalAccessibleObject>();

		public static List<DoorLock> doorLocks = new List<DoorLock>();

		public static List<ShipTeleporter> teleporters = new List<ShipTeleporter>();

		public static List<InteractTrigger> interactTriggers = new List<InteractTrigger>();

		public static List<SpikeRoofTrap> spikeRoofTraps = new List<SpikeRoofTrap>();

		public static List<MoldSpore> vainShrouds = new List<MoldSpore>();

		public static List<AnimatedObjectTrigger> animatedTriggers = new List<AnimatedObjectTrigger>();

		public static HangarShipDoor shipDoor;

		public static BreakerBox breaker;

		public static PlayerControllerB localPlayer;

		public static VehicleController vehicle;

		public static Volume volume;

		public static PatcherTool ZapGun;

		public static int selectedPlayer = -1;

		public int fps;

		private Harmony harmony;

		private HackMenu menu;

		private static LethalMenu instance;

		public Dictionary<string, string> LMUsers { get; set; } = new Dictionary<string, string>();


		public static LethalMenu Instance
		{
			get
			{
				if ((Object)(object)instance == (Object)null)
				{
					instance = new LethalMenu();
				}
				return instance;
			}
		}

		public void Start()
		{
			instance = this;
			try
			{
				Initialize();
			}
			catch (Exception ex)
			{
				Settings.debugMessage = ex.Message + "\n" + ex.StackTrace;
			}
		}

		private void Initialize()
		{
			Localization.Initialize();
			Theme.Initialize();
			HarmonyPatching();
			LoadCheats();
			MenuUtil.LMUser();
			((MonoBehaviour)this).StartCoroutine(CollectObjects());
			((MonoBehaviour)this).StartCoroutine(FPSCounter());
		}

		private void HarmonyPatching()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			harmony = new Harmony("LethalMenu");
			Harmony.DEBUG = false;
			harmony.PatchAll(Assembly.GetExecutingAssembly());
		}

		private void LoadCheats()
		{
			try
			{
				Settings.Changelog.ReadChanges();
				cheats = new List<Cheat>();
				menu = new HackMenu();
				foreach (Type item in from t in Assembly.GetExecutingAssembly().GetTypes()
					where string.Equals(t.Namespace, "LethalMenu.Cheats", StringComparison.Ordinal) && t.IsSubclassOf(typeof(Cheat))
					select t)
				{
					cheats.Add((Cheat)Activator.CreateInstance(item));
				}
				Settings.Config.SaveDefaultConfig();
				Settings.Config.LoadConfig();
			}
			catch (Exception ex)
			{
				Settings.debugMessage = ex.Message;
			}
		}

		public void FixedUpdate()
		{
			try
			{
				if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
				{
					cheats.ForEach(delegate(Cheat cheat)
					{
						cheat.FixedUpdate();
					});
				}
			}
			catch (Exception ex)
			{
				Settings.debugMessage = "Msg: " + ex.Message + "\nSrc: " + ex.Source + "\n" + ex.StackTrace;
			}
		}

		public void Update()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)StartOfRound.Instance) || StartOfRound.Instance.inShipPhase)
			{
				Settings.v_savedLocation = Vector3.zero;
			}
			try
			{
				foreach (Hack value in Enum.GetValues(typeof(Hack)))
				{
					if ((!Object.op_Implicit((Object)(object)StartOfRound.Instance) || !((Object)(object)localPlayer != (Object)null) || (!localPlayer.isTypingChat && !localPlayer.quickMenuManager.isMenuOpen && !localPlayer.inTerminalMenu)) && value.HasKeyBind() && value.GetKeyBind().wasPressedThisFrame && !value.IsAnyHackWaiting())
					{
						value.Execute();
					}
				}
				if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
				{
					cheats.ForEach(delegate(Cheat cheat)
					{
						cheat.Update();
					});
				}
			}
			catch (Exception ex)
			{
				Settings.debugMessage = "Msg: " + ex.Message + "\nSrc: " + ex.Source + "\n" + ex.StackTrace;
			}
		}

		public IEnumerator FPSCounter()
		{
			while (true)
			{
				fps = (int)(1f / Time.deltaTime);
				yield return (object)new WaitForSeconds(1f);
			}
		}

		public void OnGUI()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((int)Event.current.type == 7)
				{
					string text = "Lethal Menu " + Settings.version + " By IcyRelic, and Dustin";
					text += (Settings.b_FPSCounter ? $" | FPS: {fps}" : "");
					VisualUtil.DrawString(new Vector2(5f, 2f), text, Settings.c_primary, centered: false, alignMiddle: false, bold: true, 14);
					if (MenuUtil.resizing)
					{
						VisualUtil.DrawString(new Vector2((float)(Screen.width / 2), 35f), Localization.Localize(new string[3]
						{
							"SettingsTab.ResizeTitle",
							"SettingsTab.ResizeConfirm",
							$"{((Rect)(ref HackMenu.Instance.windowRect)).width}x{((Rect)(ref HackMenu.Instance.windowRect)).height}"
						}, newLine: true), Settings.c_playerESP, centered: true, alignMiddle: true, bold: true, 22);
						MenuUtil.ResizeMenu();
					}
					if (Settings.DebugMode)
					{
						VisualUtil.DrawString(new Vector2(5f, 20f), "[DEBUG MODE]", new RGBAColor(50, 205, 50, 1f), centered: false, alignMiddle: false, bold: false, 10);
						VisualUtil.DrawString(new Vector2(10f, 65f), new RGBAColor(255, 195, 0, 1f).AsString(Settings.debugMessage), centered: false, alignMiddle: false, bold: false, 22);
					}
					if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
					{
						cheats.ForEach(delegate(Cheat cheat)
						{
							cheat.OnGui();
						});
					}
				}
				menu.Draw();
			}
			catch (Exception ex)
			{
				Settings.debugMessage = "Msg: " + ex.Message + "\nSrc: " + ex.Source + "\n" + ex.StackTrace;
			}
		}

		public IEnumerator CollectObjects()
		{
			while (true)
			{
				CollectObjects<GrabbableObject>(items, (Func<GrabbableObject, bool>)null);
				CollectObjects<Landmine>(landmines, (Func<Landmine, bool>)null);
				CollectObjects<Turret>(turrets, (Func<Turret, bool>)null);
				CollectObjects<EntranceTeleport>(doors, (Func<EntranceTeleport, bool>)null);
				CollectObjects<PlayerControllerB>(players, (Func<PlayerControllerB, bool>)((PlayerControllerB obj) => !obj.playerUsername.StartsWith("Player #") && !obj.disconnectedMidGame));
				CollectObjects<EnemyAI>(enemies, (Func<EnemyAI, bool>)null);
				CollectObjects<SteamValveHazard>(steamValves, (Func<SteamValveHazard, bool>)null);
				CollectObjects<TerminalAccessibleObject>(allTerminalObjects, (Func<TerminalAccessibleObject, bool>)null);
				CollectObjects<ShipTeleporter>(teleporters, (Func<ShipTeleporter, bool>)null);
				CollectObjects<InteractTrigger>(interactTriggers, (Func<InteractTrigger, bool>)null);
				CollectObjects<TerminalAccessibleObject>(bigDoors, (Func<TerminalAccessibleObject, bool>)((TerminalAccessibleObject obj) => obj.isBigDoor));
				CollectObjects<DoorLock>(doorLocks, (Func<DoorLock, bool>)null);
				CollectObjects<SpikeRoofTrap>(spikeRoofTraps, (Func<SpikeRoofTrap, bool>)null);
				CollectObjects<AnimatedObjectTrigger>(animatedTriggers, (Func<AnimatedObjectTrigger, bool>)null);
				shipDoor = Object.FindObjectOfType<HangarShipDoor>();
				breaker = Object.FindObjectOfType<BreakerBox>();
				localPlayer = GameNetworkManager.Instance?.localPlayerController;
				yield return (object)new WaitForSeconds(1f);
			}
		}

		private void CollectObjects<T>(List<T> list, Func<T, bool> filter = null) where T : MonoBehaviour
		{
			list.Clear();
			IEnumerable<T> collection;
			if (filter != null)
			{
				collection = Object.FindObjectsOfType<T>().Where(filter);
			}
			else
			{
				IEnumerable<T> enumerable = Object.FindObjectsOfType<T>();
				collection = enumerable;
			}
			list.AddRange(collection);
		}

		public void Unload()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			Loader.Unload();
		}
	}
	public class Loader : MonoBehaviour
	{
		private static GameObject Load;

		public static bool harmonyLoaded;

		public static void Init()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if ((Object)(object)Load == (Object)null)
			{
				LoadHarmony();
				Load = new GameObject();
				Load.AddComponent<LethalMenu>();
				Object.DontDestroyOnLoad((Object)(object)Load);
			}
		}

		public static void LoadHarmony()
		{
			string name = "LethalMenu.Resources.0Harmony.dll";
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
			byte[] array = new byte[manifestResourceStream.Length];
			manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length);
			AppDomain.CurrentDomain.Load(array);
			harmonyLoaded = true;
		}

		public static void Unload()
		{
			Object.Destroy((Object)(object)Load);
		}
	}
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
		public static void Disconnect(GameNetworkManager __instance)
		{
			SpectatePlayer.Reset();
			Freecam.Reset();
			LethalMenu.Instance.LMUsers.Clear();
			Shoplifter.Clear();
			ServerTab.ClearPlayerOptions();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "SendNewPlayerValuesClientRpc")]
		public static void SendNewPlayerValuesClientRpc(PlayerControllerB __instance)
		{
			MenuUtil.LMUser();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
		public static void OnClientConnect(StartOfRound __instance)
		{
			MenuUtil.LMUser();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartClient")]
		public static void StartClient(SteamId id)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Settings.s_lobbyid = id;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DepositItemsDesk), "AttackPlayersServerRpc")]
		public static void CompanyAttackPrefix(ref bool ___attacking, ref bool ___inGrabbingObjectsAnimation, ref bool __state)
		{
			__state = ___inGrabbingObjectsAnimation;
			___attacking = false;
			___inGrabbingObjectsAnimation = false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerControllerB), "AllowPlayerDeath")]
		public static bool AllowPlayerDeath(ref bool __result)
		{
			if (Settings.DebugMode)
			{
				__result = true;
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(QuickMenuManager), "CanEnableDebugMenu")]
		public static bool CanEnableDebugMenu(ref bool __result)
		{
			if (Settings.DebugMode)
			{
				__result = true;
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DepositItemsDesk), "AttackPlayersServerRpc")]
		public static void CompanyAttackPostfix(ref bool ___inGrabbingObjectsAnimation, ref bool __state)
		{
			___inGrabbingObjectsAnimation = __state;
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(DepositItemsDesk), "PlaceItemOnCounter")]
		public static IEnumerable<CodeInstruction> CompanyInfiniteSell(IEnumerable<CodeInstruction> instructions)
		{
			foreach (CodeInstruction instruction in instructions)
			{
				yield return (CodeInstruction)((!(instruction.opcode == OpCodes.Ldc_I4_S) || !instruction.operand.ToString().Equals("12")) ? ((object)instruction) : ((object)new CodeInstruction(OpCodes.Ldc_I4, (object)int.MaxValue)));
			}
		}
	}
	internal class Settings
	{
		internal class Changelog
		{
			public static List<string> changes;

			public static void ReadChanges()
			{
				changes = new List<string>();
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LethalMenu.Resources.Changelog.txt");
				using StreamReader streamReader = new StreamReader(stream);
				while (!streamReader.EndOfStream)
				{
					changes.Add(streamReader.ReadLine());
				}
			}
		}

		internal class Config
		{
			public static string config = "lethelmenu.config.json";

			public static string defaultConf = "lethalmenu.default.config.json";

			public static void CreateConfigIfNotExists()
			{
				if (!HasConfig())
				{
					SaveConfig();
				}
			}

			public static void SaveDefaultConfig()
			{
				SaveConfig(defaultConf);
			}

			public static bool HasConfig()
			{
				if (config != null)
				{
					return File.Exists(config);
				}
				return false;
			}

			public static void SaveConfig()
			{
				SaveConfig(config);
			}

			public static void SaveConfig(string conf)
			{
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0199: Expected O, but got Unknown
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Expected O, but got Unknown
				//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Expected O, but got Unknown
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Expected O, but got Unknown
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b5: Expected O, but got Unknown
				Dictionary<string, string> dictionary = new Dictionary<string, string>();
				Dictionary<string, string> dictionary2 = new Dictionary<string, string>();
				Dictionary<string, string> dictionary3 = new Dictionary<string, string>();
				foreach (KeyValuePair<Hack, ButtonControl> keyBind in HackExtensions.KeyBinds)
				{
					string key = keyBind.Key.ToString();
					string? text;
					if (!(((object)keyBind.Value).GetType() == typeof(KeyControl)))
					{
						text = ((InputControl)keyBind.Value).displayName;
					}
					else
					{
						Key keyCode = ((KeyControl)keyBind.Value).keyCode;
						text = ((object)(Key)(ref keyCode)).ToString();
					}
					string value = text;
					dictionary.Add(key, value);
				}
				foreach (KeyValuePair<Hack, bool> toggleFlag in HackExtensions.ToggleFlags)
				{
					if (!toggleFlag.Key.CanBeExecuted())
					{
						string key2 = toggleFlag.Key.ToString();
						string value2 = toggleFlag.Value.ToString();
						dictionary2.Add(key2, value2);
					}
				}
				foreach (KeyValuePair<EnemyAIType, bool> item in EnemyAITypeExtensions.EnemyFilter)
				{
					if (item.Key != 0)
					{
						string key3 = item.Key.ToString();
						string value3 = item.Value.ToString();
						dictionary3.Add(key3, value3);
					}
				}
				JObject val = new JObject();
				JObject val2 = new JObject();
				JObject val3 = new JObject();
				JObject val4 = new JObject();
				JObject val5 = new JObject();
				val4["NightVisionIntensity"] = JToken.op_Implicit(f_nvIntensity.ToString());
				val4["NightVisionRange"] = JToken.op_Implicit(f_nvRange.ToString());
				val4["ClimbSpeed"] = JToken.op_Implicit(f_climbSpeed.ToString());
				val4["JumpForce"] = JToken.op_Implicit(f_jumpForce.ToString());
				val4["GrabDistance"] = JToken.op_Implicit(f_grabDistance.ToString());
				val4["MovementSpeed"] = JToken.op_Implicit(f_movementSpeed.ToString());
				val4["NoClipSpeed"] = JToken.op_Implicit(f_noclipSpeed.ToString());
				val4["BreadcrumbInterval"] = JToken.op_Implicit(f_breadcrumbInterval.ToString());
				val4["CrosshairThickness"] = JToken.op_Implicit(f_crosshairThickness.ToString());
				val4["CrosshairType"] = JToken.op_Implicit(ct_crosshairType.ToString());
				val4["CrosshairScale"] = JToken.op_Implicit(f_crosshairScale.ToString());
				val4["ESPDistance"] = JToken.op_Implicit(f_espDistance.ToString());
				val4["DisableSpectatorModels"] = JToken.op_Implicit(b_disableSpectatorModels.ToString());
				val4["VCDisplay"] = JToken.op_Implicit(b_VCDisplay.ToString());
				val4["UseScrapTiers"] = JToken.op_Implicit(b_useScrapTiers.ToString());
				val4["HPDisplay"] = JToken.op_Implicit(b_HPDisplay.ToString());
				val4["ShowShipItems"] = JToken.op_Implicit(b_ShowShipItems.ToString());
				val4["FPSCounter"] = JToken.op_Implicit(b_FPSCounter.ToString());
				val4["DisplayLMUsers"] = JToken.op_Implicit(b_DisplayLMUsers.ToString());
				val4["HackHighlight"] = JToken.op_Implicit(b_HackHighlight.ToString());
				val4["FOV"] = JToken.op_Implicit(f_fov.ToString());
				val4["EnemyFilter"] = (JToken)(object)JObject.FromObject((object)dictionary3);
				val4["PJSpamSpeed"] = JToken.op_Implicit(f_pjSpamSpeed.ToString());
				val5["Distance"] = JToken.op_Implicit(f_chamDistance.ToString());
				val5["Object"] = JToken.op_Implicit(b_chamsObject.ToString());
				val5["Enemy"] = JToken.op_Implicit(b_chamsEnemy.ToString());
				val5["Player"] = JToken.op_Implicit(b_chamsPlayer.ToString());
				val5["Landmine"] = JToken.op_Implicit(b_chamsLandmine.ToString());
				val5["Turret"] = JToken.op_Implicit(b_chamsTurret.ToString());
				val5["BigDoor"] = JToken.op_Implicit(b_chamsBigDoor.ToString());
				val5["DoorLock"] = JToken.op_Implicit(b_chamsDoorLock.ToString());
				val5["SteamHazard"] = JToken.op_Implicit(b_chamsSteamHazard.ToString());
				val5["Breaker"] = JToken.op_Implicit(b_chamsBreaker.ToString());
				val5["Ship"] = JToken.op_Implicit(b_chamsShip.ToString());
				val5["SpikeRoofTrap"] = JToken.op_Implicit(b_chamsSpikeRoofTrap.ToString());
				val5["UseDefaultChams"] = JToken.op_Implicit(b_UseDefaultChams.ToString());
				val4["Chams"] = (JToken)(object)val5;
				val3["Background"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_background));
				val3["Primary"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_primary));
				val3["MenuText"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_menuText));
				val3["Crosshair"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_crosshair));
				val3["HackHighlightColor"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_hackhighlight));
				val3["Chams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_chams));
				val3["ObjectChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_objectChams));
				val3["PlayerChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_playerChams));
				val3["EnemyChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_enemyChams));
				val3["ShipChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_shipChams));
				val3["BreakerChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_breakerChams));
				val3["LandmineChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_landmineChams));
				val3["TurretChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_turretChams));
				val3["BigDoorChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_bigDoorChams));
				val3["DoorLockChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_doorLockChams));
				val3["SteamHazardChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_steamHazardChams));
				val3["SpikeRoofTrapChams"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_spikeRoofTrapChams));
				val3["ObjectESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_objectESP));
				val3["PlayerESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_playerESP));
				val3["EnemyESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_enemyESP));
				val3["ShipESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_shipESP));
				val3["BreakerESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_breakerESP));
				val3["LandmineESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_landmineESP));
				val3["TurretESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_turretESP));
				val3["BigDoorESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_bigDoorESP));
				val3["DoorLockESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_doorLockESP));
				val3["EntranceExitESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_entranceExitESP));
				val3["SteamHazardESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_steamHazardESP));
				val3["SpikeRoofTrapESP"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_spikeRoofTrapESP));
				val3["CauseOfDeath"] = JToken.op_Implicit(JsonConvert.SerializeObject((object)c_causeOfDeath));
				val2["FirstLaunch"] = JToken.op_Implicit(isFirstLaunch.ToString());
				val2["MenuFontSize"] = JToken.op_Implicit(i_menuFontSize.ToString());
				val2["MenuWidth"] = JToken.op_Implicit(i_menuWidth.ToString());
				val2["MenuHeight"] = JToken.op_Implicit(i_menuHeight.ToString());
				val2["SliderWidth"] = JToken.op_Implicit(i_sliderWidth.ToString());
				val2["TextboxWidth"] = JToken.op_Implicit(i_textboxWidth.ToString());
				val2["MenuAlpha"] = JToken.op_Implicit(f_menuAlpha.ToString());
				val2["DebugMode"] = JToken.op_Implicit(DebugMode.ToString());
				val["Theme"] = JToken.op_Implicit(Theme.name);
				val["Language"] = JToken.op_Implicit(Localization.Language.Name);
				val["Colors"] = (JToken)(object)val3;
				val["HackSettings"] = (JToken)(object)val4;
				val["MenuSettings"] = (JToken)(object)val2;
				val["KeyBinds"] = (JToken)(object)JObject.FromObject((object)dictionary);
				val["Toggles"] = (JToken)(object)JObject.FromObject((object)dictionary2);
				File.WriteAllText(conf, ((object)val).ToString());
			}

			public static void LoadConfig()
			{
				//IL_09b6: Unknown result type (might be due to invalid IL or missing references)
				CreateConfigIfNotExists();
				JObject val = JObject.Parse(File.ReadAllText(config));
				JToken val2 = default(JToken);
				if (val.TryGetValue("Language", ref val2))
				{
					Localization.SetLanguage(((object)val2).ToString());
				}
				JToken val3 = default(JToken);
				if (val.TryGetValue("Theme", ref val3))
				{
					Theme.SetTheme(((object)val3).ToString());
				}
				JToken val4 = default(JToken);
				if (val.TryGetValue("MenuSettings", ref val4))
				{
					JObject obj = val4.ToObject<JObject>();
					JToken val5 = default(JToken);
					if (obj.TryGetValue("FirstLaunch", ref val5))
					{
						isFirstLaunch = bool.Parse(((object)val5).ToString());
					}
					JToken val6 = default(JToken);
					if (obj.TryGetValue("MenuFontSize", ref val6))
					{
						i_menuFontSize = int.Parse(((object)val6).ToString());
					}
					JToken val7 = default(JToken);
					if (obj.TryGetValue("MenuWidth", ref val7))
					{
						i_menuWidth = int.Parse(((object)val7).ToString());
					}
					JToken val8 = default(JToken);
					if (obj.TryGetValue("MenuHeight", ref val8))
					{
						i_menuHeight = int.Parse(((object)val8).ToString());
					}
					JToken val9 = default(JToken);
					if (obj.TryGetValue("SliderWidth", ref val9))
					{
						i_sliderWidth = int.Parse(((object)val9).ToString());
					}
					JToken val10 = default(JToken);
					if (obj.TryGetValue("TextboxWidth", ref val10))
					{
						i_textboxWidth = int.Parse(((object)val10).ToString());
					}
					JToken val11 = default(JToken);
					if (obj.TryGetValue("MenuAlpha", ref val11))
					{
						f_menuAlpha = float.Parse(((object)val11).ToString());
					}
					JToken val12 = default(JToken);
					if (obj.TryGetValue("DebugMode", ref val12))
					{
						DebugMode = bool.Parse(((object)val12).ToString());
						HackMenu.Instance.ToggleDebugTab(DebugMode);
					}
				}
				JToken val13 = default(JToken);
				if (val.TryGetValue("HackSettings", ref val13))
				{
					JObject val14 = val13.ToObject<JObject>();
					JToken val15 = default(JToken);
					if (val14.TryGetValue("NightVisionIntensity", ref val15))
					{
						f_nvIntensity = float.Parse(((object)val15).ToString());
					}
					JToken val16 = default(JToken);
					if (val14.TryGetValue("NightVisionRange", ref val16))
					{
						f_nvRange = float.Parse(((object)val16).ToString());
					}
					JToken val17 = default(JToken);
					if (val14.TryGetValue("ClimbSpeed", ref val17))
					{
						f_climbSpeed = float.Parse(((object)val17).ToString());
					}
					JToken val18 = default(JToken);
					if (val14.TryGetValue("JumpForce", ref val18))
					{
						f_jumpForce = float.Parse(((object)val18).ToString());
					}
					JToken val19 = default(JToken);
					if (val14.TryGetValue("GrabDistance", ref val19))
					{
						f_grabDistance = float.Parse(((object)val19).ToString());
					}
					JToken val20 = default(JToken);
					if (val14.TryGetValue("MovementSpeed", ref val20))
					{
						f_movementSpeed = float.Parse(((object)val20).ToString());
					}
					JToken val21 = default(JToken);
					if (val14.TryGetValue("NoClipSpeed", ref val21))
					{
						f_noclipSpeed = float.Parse(((object)val21).ToString());
					}
					JToken val22 = default(JToken);
					if (val14.TryGetValue("BreadcrumbInterval", ref val22))
					{
						f_breadcrumbInterval = int.Parse(((object)val22).ToString());
					}
					JToken val23 = default(JToken);
					if (val14.TryGetValue("CrosshairThickness", ref val23))
					{
						f_crosshairThickness = float.Parse(((object)val23).ToString());
					}
					JToken val24 = default(JToken);
					if (val14.TryGetValue("CrosshairType", ref val24))
					{
						ct_crosshairType = (CrosshairType)Enum.Parse(typeof(CrosshairType), ((object)val24).ToString());
					}
					JToken val25 = default(JToken);
					if (val14.TryGetValue("CrosshairScale", ref val25))
					{
						f_crosshairScale = float.Parse(((object)val25).ToString());
					}
					JToken val26 = default(JToken);
					if (val14.TryGetValue("ESPDistance", ref val26))
					{
						f_espDistance = int.Parse(((object)val26).ToString());
					}
					JToken val27 = default(JToken);
					if (val14.TryGetValue("DisableSpectatorModels", ref val27))
					{
						b_disableSpectatorModels = bool.Parse(((object)val27).ToString());
					}
					JToken val28 = default(JToken);
					if (val14.TryGetValue("VCDisplay", ref val28))
					{
						b_VCDisplay = bool.Parse(((object)val28).ToString());
					}
					JToken val29 = default(JToken);
					if (val14.TryGetValue("UseScrapTiers", ref val29))
					{
						b_useScrapTiers = bool.Parse(((object)val29).ToString());
					}
					JToken val30 = default(JToken);
					if (val14.TryGetValue("HPDisplay", ref val30))
					{
						b_HPDisplay = bool.Parse(((object)val30).ToString());
					}
					JToken val31 = default(JToken);
					if (val14.TryGetValue("ShowShipItems", ref val31))
					{
						b_ShowShipItems = bool.Parse(((object)val31).ToString());
					}
					JToken val32 = default(JToken);
					if (val14.TryGetValue("FPSCounter", ref val32))
					{
						b_FPSCounter = bool.Parse(((object)val32).ToString());
					}
					JToken val33 = default(JToken);
					if (val14.TryGetValue("HackHighlight", ref val33))
					{
						b_HackHighlight = bool.Parse(((object)val33).ToString());
					}
					JToken val34 = default(JToken);
					if (val14.TryGetValue("DisplayLMUsers", ref val34))
					{
						b_DisplayLMUsers = bool.Parse(((object)val34).ToString());
					}
					JToken val35 = default(JToken);
					if (val14.TryGetValue("FOV", ref val35))
					{
						f_fov = float.Parse(((object)val35).ToString());
					}
					JToken val36 = default(JToken);
					if (val14.TryGetValue("PJSpamSpeed", ref val36))
					{
						f_pjSpamSpeed = float.Parse(((object)val36).ToString());
					}
					JToken val37 = default(JToken);
					if (val14.TryGetValue("EnemyFilter", ref val37))
					{
						foreach (KeyValuePair<string, string> item in val37.ToObject<Dictionary<string, string>>())
						{
							string key = item.Key;
							string value = item.Value;
							if (Enum.TryParse<EnemyAIType>(key, out var result) && result != 0)
							{
								bool result2;
								bool value2 = bool.TryParse(value, out result2) && result2;
								EnemyAITypeExtensions.EnemyFilter[result] = value2;
							}
						}
					}
					JToken val38 = default(JToken);
					if (val14.TryGetValue("Chams", ref val38))
					{
						JObject obj2 = val38.ToObject<JObject>();
						JToken val39 = default(JToken);
						if (obj2.TryGetValue("Distance", ref val39))
						{
							f_chamDistance = float.Parse(((object)val39).ToString());
						}
						JToken val40 = default(JToken);
						if (obj2.TryGetValue("Object", ref val40))
						{
							b_chamsObject = bool.Parse(((object)val40).ToString());
						}
						JToken val41 = default(JToken);
						if (obj2.TryGetValue("Enemy", ref val41))
						{
							b_chamsEnemy = bool.Parse(((object)val41).ToString());
						}
						JToken val42 = default(JToken);
						if (obj2.TryGetValue("Player", ref val42))
						{
							b_chamsPlayer = bool.Parse(((object)val42).ToString());
						}
						JToken val43 = default(JToken);
						if (obj2.TryGetValue("Landmine", ref val43))
						{
							b_chamsLandmine = bool.Parse(((object)val43).ToString());
						}
						JToken val44 = default(JToken);
						if (obj2.TryGetValue("Turret", ref val44))
						{
							b_chamsTurret = bool.Parse(((object)val44).ToString());
						}
						JToken val45 = default(JToken);
						if (obj2.TryGetValue("BigDoor", ref val45))
						{
							b_chamsBigDoor = bool.Parse(((object)val45).ToString());
						}
						JToken val46 = default(JToken);
						if (obj2.TryGetValue("DoorLock", ref val46))
						{
							b_chamsDoorLock = bool.Parse(((object)val46).ToString());
						}
						JToken val47 = default(JToken);
						if (obj2.TryGetValue("SteamHazard", ref val47))
						{
							b_chamsSteamHazard = bool.Parse(((object)val47).ToString());
						}
						JToken val48 = default(JToken);
						if (obj2.TryGetValue("Breaker", ref val48))
						{
							b_chamsBreaker = bool.Parse(((object)val48).ToString());
						}
						JToken val49 = default(JToken);
						if (obj2.TryGetValue("Ship", ref val49))
						{
							b_chamsShip = bool.Parse(((object)val49).ToString());
						}
						JToken val50 = default(JToken);
						if (obj2.TryGetValue("SpikeRoofTrap", ref val50))
						{
							b_chamsSpikeRoofTrap = bool.Parse(((object)val50).ToString());
						}
					}
				}
				JToken val51 = default(JToken);
				if (val.TryGetValue("Colors", ref val51))
				{
					JObject obj3 = val51.ToObject<JObject>();
					JToken val52 = default(JToken);
					if (obj3.TryGetValue("Background", ref val52))
					{
						c_background = JsonConvert.DeserializeObject<RGBAColor>(((object)val52).ToString());
					}
					JToken val53 = default(JToken);
					if (obj3.TryGetValue("Primary", ref val53))
					{
						c_primary = JsonConvert.DeserializeObject<RGBAColor>(((object)val53).ToString());
					}
					JToken val54 = default(JToken);
					if (obj3.TryGetValue("MenuText", ref val54))
					{
						c_menuText = JsonConvert.DeserializeObject<RGBAColor>(((object)val54).ToString());
					}
					JToken val55 = default(JToken);
					if (obj3.TryGetValue("Crosshair", ref val55))
					{
						c_crosshair = JsonConvert.DeserializeObject<RGBAColor>(((object)val55).ToString());
					}
					JToken val56 = default(JToken);
					if (obj3.TryGetValue("HackHighlightColor", ref val56))
					{
						c_hackhighlight = JsonConvert.DeserializeObject<RGBAColor>(((object)val56).ToString());
					}
					JToken val57 = default(JToken);
					if (obj3.TryGetValue("Chams", ref val57))
					{
						c_chams = JsonConvert.DeserializeObject<RGBAColor>(((object)val57).ToString());
					}
					JToken val58 = default(JToken);
					if (obj3.TryGetValue("ObjectESP", ref val58))
					{
						c_objectESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val58).ToString());
					}
					JToken val59 = default(JToken);
					if (obj3.TryGetValue("PlayerESP", ref val59))
					{
						c_playerESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val59).ToString());
					}
					JToken val60 = default(JToken);
					if (obj3.TryGetValue("EnemyESP", ref val60))
					{
						c_enemyESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val60).ToString());
					}
					JToken val61 = default(JToken);
					if (obj3.TryGetValue("ShipESP", ref val61))
					{
						c_shipESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val61).ToString());
					}
					JToken val62 = default(JToken);
					if (obj3.TryGetValue("BreakerESP", ref val62))
					{
						c_breakerESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val62).ToString());
					}
					JToken val63 = default(JToken);
					if (obj3.TryGetValue("LandmineESP", ref val63))
					{
						c_landmineESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val63).ToString());
					}
					JToken val64 = default(JToken);
					if (obj3.TryGetValue("TurretESP", ref val64))
					{
						c_turretESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val64).ToString());
					}
					JToken val65 = default(JToken);
					if (obj3.TryGetValue("BigDoorESP", ref val65))
					{
						c_bigDoorESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val65).ToString());
					}
					JToken val66 = default(JToken);
					if (obj3.TryGetValue("DoorLockESP", ref val66))
					{
						c_doorLockESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val66).ToString());
					}
					JToken val67 = default(JToken);
					if (obj3.TryGetValue("EntranceExitESP", ref val67))
					{
						c_entranceExitESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val67).ToString());
					}
					JToken val68 = default(JToken);
					if (obj3.TryGetValue("SteamHazardESP", ref val68))
					{
						c_steamHazardESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val68).ToString());
					}
					JToken val69 = default(JToken);
					if (obj3.TryGetValue("SpikeRoofTrapESP", ref val69))
					{
						c_spikeRoofTrapESP = JsonConvert.DeserializeObject<RGBAColor>(((object)val69).ToString());
					}
					JToken val70 = default(JToken);
					if (obj3.TryGetValue("CauseOfDeath", ref val70))
					{
						c_causeOfDeath = JsonConvert.DeserializeObject<RGBAColor>(((object)val70).ToString());
					}
				}
				JToken val71 = default(JToken);
				if (val.TryGetValue("KeyBinds", ref val71))
				{
					HackExtensions.KeyBinds.Clear();
					ButtonControl[] source = (ButtonControl[])(object)new ButtonControl[5]
					{
						Mouse.current.leftButton,
						Mouse.current.rightButton,
						Mouse.current.middleButton,
						Mouse.current.forwardButton,
						Mouse.current.backButton
					};
					foreach (KeyValuePair<string, string> item2 in val71.ToObject<Dictionary<string, string>>())
					{
						string key2 = item2.Key;
						string s_key = item2.Value;
						ButtonControl val72 = ((IEnumerable<ButtonControl>)source).FirstOrDefault((Func<ButtonControl, bool>)((ButtonControl k) => ((InputControl)k).displayName == s_key));
						ButtonControl val73 = (ButtonControl)(object)((IEnumerable<KeyControl>)(object)Keyboard.current.allKeys).FirstOrDefault((Func<KeyControl, bool>)delegate(KeyControl k)
						{
							//IL_0001: Unknown result type (might be due to invalid IL or missing references)
							//IL_0006: Unknown result type (might be due to invalid IL or missing references)
							Key keyCode = k.keyCode;
							return ((object)(Key)(ref keyCode)).ToString() == s_key;
						});
						if (Enum.TryParse<Hack>(key2, out var result3) && (val72 != null || val73 != null))
						{
							result3.SetKeyBind(val72 ?? val73);
						}
					}
				}
				JToken val74 = default(JToken);
				if (!val.TryGetValue("Toggles", ref val74))
				{
					return;
				}
				foreach (KeyValuePair<string, string> item3 in val74.ToObject<Dictionary<string, string>>())
				{
					string key3 = item3.Key;
					string value3 = item3.Value;
					if (Enum.TryParse<Hack>(key3, out var result4) && !result4.CanBeExecuted())
					{
						bool result5;
						bool b = bool.TryParse(value3, out result5) && result5;
						result4.SetToggle(b);
					}
				}
			}

			public static void RegenerateConfig()
			{
				if (HasConfig())
				{
					File.Delete(config);
				}
				File.Copy(defaultConf, config);
				HackExtensions.KeyBinds.Clear();
				LoadConfig();
			}
		}

		public static string version = "v1.4.4";

		public static bool DebugMode = false;

		public static bool isFirstLaunch = true;

		public static int i_menuFontSize = 14;

		public static int i_menuWidth = 810;

		public static int i_menuHeight = 410;

		public static int i_sliderWidth = 100;

		public static int i_textboxWidth = 85;

		public static float f_menuAlpha = 1f;

		public static RGBAColor c_background = new RGBAColor(51, 51, 51, 1f);

		public static RGBAColor c_primary = new RGBAColor(165, 55, 253, 1f);

		public static RGBAColor c_menuText = new RGBAColor(255, 255, 255, 1f);

		public static RGBAColor c_crosshair = new RGBAColor(255, 43, 43, 1f);

		public static RGBAColor c_hackhighlight = new RGBAColor(165, 55, 253, 1f);

		public static RGBAColor c_objectESP = new RGBAColor(255, 255, 255, 1f);

		public static RGBAColor c_playerESP = new RGBAColor(0, 255, 0, 1f);

		public static RGBAColor c_enemyESP = new RGBAColor(255, 0, 0, 1f);

		public static RGBAColor c_shipESP = new RGBAColor(0, 0, 255, 1f);

		public static RGBAColor c_landmineESP = new RGBAColor(255, 0, 0, 1f);

		public static RGBAColor c_turretESP = new RGBAColor(255, 0, 0, 1f);

		public static RGBAColor c_bigDoorESP = new RGBAColor(0, 255, 255, 1f);

		public static RGBAColor c_doorLockESP = new RGBAColor(0.5f, 0.5f, 0.5f, 1f);

		public static RGBAColor c_entranceExitESP = new RGBAColor(0, 0, 255, 1f);

		public static RGBAColor c_steamHazardESP = new RGBAColor(255, 0, 255, 1f);

		public static RGBAColor c_breakerESP = new RGBAColor(255, 0, 116, 1f);

		public static RGBAColor c_spikeRoofTrapESP = new RGBAColor(139, 69, 19, 1f);

		public static RGBAColor c_objectChams = new RGBAColor(255, 255, 255, 0.1f);

		public static RGBAColor c_playerChams = new RGBAColor(0, 255, 0, 0.1f);

		public static RGBAColor c_enemyChams = new RGBAColor(255, 0, 0, 0.1f);

		public static RGBAColor c_shipChams = new RGBAColor(0, 0, 255, 0.1f);

		public static RGBAColor c_landmineChams = new RGBAColor(255, 0, 0, 0.1f);

		public static RGBAColor c_turretChams = new RGBAColor(255, 0, 0, 0.1f);

		public static RGBAColor c_bigDoorChams = new RGBAColor(0, 255, 255, 0.1f);

		public static RGBAColor c_doorLockChams = new RGBAColor(0.5f, 0.5f, 0.5f, 0.1f);

		public static RGBAColor c_steamHazardChams = new RGBAColor(255, 0, 255, 0.1f);

		public static RGBAColor c_breakerChams = new RGBAColor(255, 0, 116, 0.1f);

		public static RGBAColor c_spikeRoofTrapChams = new RGBAColor(139, 69, 19, 0.1f);

		public static RGBAColor c_chams = new RGBAColor(238, 111, 255, 0.1f);

		public static RGBAColor c_error = new RGBAColor(221, 11, 11, 1f);

		public static RGBAColor c_deadPlayer = new RGBAColor(255, 0, 0, 1f);

		public static RGBAColor c_causeOfDeath = new RGBAColor(1f, 47f / 51f, 0.015686275f, 1f);

		public static Vector3 v_savedLocation = Vector3.zero;

		public static float f_nvIntensity = 3000f;

		public static float f_nvRange = 10000f;

		public static float f_climbSpeed = 4f;

		public static float f_jumpForce = 5f;

		public static float f_grabDistance = 10000f;

		public static float f_movementSpeed = 0.5f;

		public static float f_noclipSpeed = 10f;

		public static float f_crosshairScale = 14f;

		public static float f_crosshairThickness = 1.75f;

		public static float f_breadcrumbInterval = 1f;

		public static float f_espDistance = 5000f;

		public static float f_chamDistance = 15f;

		public static float f_enemyKillDistance = 15f;

		public static float f_fov = 66f;

		public static float f_mouseSensitivity = 0.15f;

		public static float f_inputMovementSpeed = 15f;

		public static float f_carAcceleration = 5f;

		public static float f_carMaxSpeed = 7f;

		public static float f_brakeSpeed = 7f;

		public static float f_pjSpamSpeed = 0.5f;

		public static bool b_disableSpectatorModels = true;

		public static bool b_useScrapTiers = false;

		public static bool b_VCDisplay = false;

		public static bool b_HPDisplay = false;

		public static bool b_ShowShipItems = false;

		public static bool b_DropItems = false;

		public static bool b_HackHighlight = false;

		public static bool b_FPSCounter = false;

		public static bool b_DisplayLMUsers = false;

		public static bool b_WearBuy = false;

		public static CrosshairType ct_crosshairType = CrosshairType.Plus;

		public static bool b_chamsObject = false;

		public static bool b_chamsEnemy = false;

		public static bool b_chamsPlayer = false;

		public static bool b_chamsLandmine = false;

		public static bool b_chamsTurret = false;

		public static bool b_chamsBigDoor = false;

		public static bool b_chamsDoorLock = false;

		public static bool b_chamsSteamHazard = false;

		public static bool b_chamsBreaker = false;

		public static bool b_chamsShip = false;

		public static bool b_chamsSpikeRoofTrap = false;

		public static bool b_UseDefaultChams = false;

		public static float f_defaultGrabDistance = -1f;

		public static float f_defaultClimbSpeed = 3f;

		public static float f_defaultJumpForce = 13f;

		public static float f_defaultMovementSpeed = 4.6f;

		public static float f_defaultNightVisionIntensity = 360f;

		public static float f_defaultNightVisionRange = 12f;

		public static float f_defaultFOV = 66f;

		public static float f_slots = 4f;

		public static int[] i_scrapValueThresholds = new int[4] { 30, 50, 75, 100 };

		public static SteamId s_lobbyid;

		public static RGBAColor[] c_scrapValueColors = new RGBAColor[4]
		{
			new RGBAColor(0.5f, 0.5f, 0.5f, 1f),
			new RGBAColor(10, 187, 10, 1f),
			new RGBAColor(255, 0, 255, 1f),
			new RGBAColor(255, 165, 0, 1f)
		};

		public static CursorLockMode clm_lastCursorState = Cursor.lockState;

		public static string debugMessage = "";

		public static bool isMenuOpen
		{
			get
			{
				return Hack.OpenMenu.IsEnabled();
			}
			set
			{
				Hack.OpenMenu.SetToggle(value);
			}
		}
	}
}
namespace LethalMenu.Util
{
	internal class GameObjectUtil
	{
		public static Camera CreateCamera(string name, Transform pos, bool copyPlayerTexture = true)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			Camera obj = new GameObject(name).AddComponent<Camera>();
			((Component)obj).transform.position = pos.position;
			((Component)obj).transform.rotation = pos.rotation;
			obj.targetTexture = (RenderTexture)(copyPlayerTexture ? ((object)localPlayerController.gameplayCamera.targetTexture) : ((object)new RenderTexture(1920, 1080, 24)));
			obj.cullingMask = localPlayerController.gameplayCamera.cullingMask;
			obj.farClipPlane = localPlayerController.gameplayCamera.farClipPlane;
			obj.nearClipPlane = localPlayerController.gameplayCamera.nearClipPlane;
			return obj;
		}

		public static RawImage CreateMiniCamDisplay(Texture targetTexture)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			RawImage obj = new GameObject("SpectateMiniCamDisplay").AddComponent<RawImage>();
			((Graphic)obj).rectTransform.anchorMin = new Vector2(1f, 1f);
			((Graphic)obj).rectTransform.anchorMax = new Vector2(1f, 1f);
			((Graphic)obj).rectTransform.pivot = new Vector2(1f, 1f);
			((Graphic)obj).rectTransform.sizeDelta = new Vector2(192f, 108f);
			((Graphic)obj).rectTransform.anchoredPosition = new Vector2(1f, 1f);
			obj.texture = targetTexture;
			((Component)obj).transform.SetParent(((Component)HUDManager.Instance.playerScreenTexture).transform, false);
			return obj;
		}

		public static Light CreateLight()
		{
			Light obj = Object.Instantiate<Light>(LethalMenu.localPlayer.nightVision);
			((Behaviour)obj).enabled = true;
			obj.intensity = Settings.f_nvIntensity;
			obj.range = Settings.f_nvRange;
			return obj;
		}
	}
	public static class GameUtil
	{
		public static List<EnemyType> GetEnemyTypes()
		{
			List<EnemyType> types = new List<EnemyType>();
			if (!Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				return types;
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel obj in levels)
			{
				obj.Enemies.ForEach(delegate(SpawnableEnemyWithRarity enemy)
				{
					if (!types.Contains(enemy.enemyType))
					{
						types.Add(enemy.enemyType);
					}
				});
				obj.DaytimeEnemies.ForEach(delegate(SpawnableEnemyWithRarity enemy)
				{
					if (!types.Contains(enemy.enemyType))
					{
						types.Add(enemy.enemyType);
					}
				});
				obj.OutsideEnemies.ForEach(delegate(SpawnableEnemyWithRarity enemy)
				{
					if (!types.Contains(enemy.enemyType))
					{
						types.Add(enemy.enemyType);
					}
				});
			}
			return types;
		}

		public static List<SpawnableMapObject> GetSpawnableMapObjects()
		{
			List<SpawnableMapObject> list = new List<SpawnableMapObject>();
			if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.levels == null)
			{
				return list;
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				if (val.spawnableMapObjects == null)
				{
					continue;
				}
				SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects;
				foreach (SpawnableMapObject spawnableObject in spawnableMapObjects)
				{
					if (!list.Any((SpawnableMapObject x) => ((Object)x.prefabToSpawn).name == ((Object)spawnableObject.prefabToSpawn).name))
					{
						list.Add(spawnableObject);
					}
				}
			}
			return list;
		}

		public static void InitializeMapObjects()
		{
			if (Object.op_Implicit((Object)(object)StartOfRound.Instance))
			{
				LethalMenu.turrets.ForEach(delegate(Turret t)
				{
					((Component)t).GetComponent<TerminalAccessibleObject>().InitializeValues();
				});
				LethalMenu.landmines.ForEach(delegate(Landmine l)
				{
					((Component)l).GetComponent<TerminalAccessibleObject>().InitializeValues();
				});
			}
		}

		public static float GetDistanceToPlayer(Vector3 position)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Round(Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, position));
		}

		public static float GetDistance(Vector3 from, Vector3 to)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Round(Vector3.Distance(from, to));
		}

		public static int SphereCastForward(this RaycastHit[] array, Transform transform, float sphereRadius = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return Physics.SphereCastNonAlloc(transform.position + transform.forward * (sphereRadius + 1.75f), sphereRadius, transform.forward, array, float.MaxValue);
			}
			catch (NullReferenceException)
			{
				return 0;
			}
		}

		public static RaycastHit[] SphereCastForward(this Transform transform, float sphereRadius = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return Physics.SphereCastAll(transform.position + transform.forward * (sphereRadius + 1.75f), sphereRadius, transform.forward, float.MaxValue);
			}
			catch (NullReferenceException)
			{
				return null;
			}
		}

		public static RaycastHit StraightCastForward(this Transform transform, float distance = 1000f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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)
			RaycastHit result = default(RaycastHit);
			Physics.Raycast(transform.position, transform.forward, ref result, distance);
			return result;
		}

		public static void RenderPlayerModels()
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (Hack.SpectatePlayer.IsEnabled() || Hack.FreeCam.IsEnabled())
			{
				localPlayerController.DisablePlayerModel(((Component)localPlayerController).gameObject, true, false);
				((Renderer)localPlayerController.thisPlayerModelArms).enabled = false;
			}
			else
			{
				localPlayerController.DisablePlayerModel(((Component)localPlayerController).gameObject, false, false);
				((Renderer)localPlayerController.thisPlayerModelArms).enabled = true;
			}
			PlayerControllerB[] allPlayerScripts = localPlayerController.playersManager.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (localPlayerController.playerClientId != val.playerClientId)
				{
					if ((SpectatePlayer.isSpectatingPlayer(val) || SpectatePlayer.isCamPlayer(val)) && Settings.b_disableSpectatorModels)
					{
						val.DisablePlayerModel(((Component)val).gameObject, false, false);
						((Renderer)val.thisPlayerModelArms).enabled = true;
					}
					else
					{
						val.DisablePlayerModel(((Component)val).gameObject, true, true);
						((Renderer)val.thisPlayerModelArms).enabled = false;
					}
				}
			}
		}
	}
	public class KBUtil
	{
		internal class KBCallback
		{
			private Hack hack;

			public KBCallback(Hack hack)
			{
				this.hack = hack;
			}

			public async void Invoke(ButtonControl btn)
			{
				hack.SetKeyBind(btn);
				await Task.Delay(100);
				hack.SetWaiting(b: false);
				Settings.Config.SaveConfig();
			}
		}

		public static void BeginChangeKeyBind(Hack hack, params Action[] callbacks)
		{
			hack.SetWaiting(b: true);
			TryGetPressedKeyTask(new KBCallback(hack).Invoke, callbacks);
		}

		private static async Task TryGetPressedKeyTask(Action<ButtonControl> callback, params Action[] otherCallbacks)
		{
			await Task.Run(async delegate
			{
				await Task.Delay(250);
				float time = Time.time;
				ButtonControl val = null;
				do
				{
					ButtonControl pressedBtn = GetPressedBtn();
					if (pressedBtn != null)
					{
						val = pressedBtn;
					}
				}
				while (!(Time.time - time > 15f) && val == null);
				if (val != null)
				{
					callback?.Invoke(val);
					otherCallbacks.ToList().ForEach(delegate(Action cb)
					{
						cb?.Invoke();
					});
				}
			});
		}

		private static ButtonControl GetPressedBtn()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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)
			Enumerator<KeyControl> enumerator = Keyboard.current.allKeys.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					KeyControl current = enumerator.Current;
					if (((ButtonControl)current).wasPressedThisFrame)
					{
						return (ButtonControl)(object)current;
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			ButtonControl[] array = (ButtonControl[])(object)new ButtonControl[5]
			{
				Mouse.current.leftButton,
				Mouse.current.rightButton,
				Mouse.current.middleButton,
				Mouse.current.forwardButton,
				Mouse.current.backButton
			};
			foreach (ButtonControl val in array)
			{
				if (val.wasPressedThisFrame)
				{
					return val;
				}
			}
			return null;
		}
	}
	public class MenuUtil
	{
		public static bool resizing = false;

		public static float maxWidth = (float)Screen.width - (float)Screen.width * 0.1f;

		public static float maxHeight = (float)Screen.height - (float)Screen.height * 0.1f;

		private static int oldWidth;

		private static int oldHeight;

		public static float MouseX => ((Vector2)((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).value).x;

		public static float MouseY => (float)Screen.height - ((Vector2)((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).value).y;

		public static void BeginResizeMenu()
		{
			if (!resizing)
			{
				WarpCursor();
				resizing = true;
				oldWidth = Settings.i_menuWidth;
				oldHeight = Settings.i_menuHeight;
			}
		}

		public static void WarpCursor()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref HackMenu.Instance.windowRect)).x + ((Rect)(ref HackMenu.Instance.windowRect)).width;
			float num2 = (float)Screen.height - (((Rect)(ref HackMenu.Instance.windowRect)).y + ((Rect)(ref HackMenu.Instance.windowRect)).height);
			Mouse.current.WarpCursorPosition(new Vector2(num, num2));
		}

		public static void ResizeMenu()
		{
			if (resizing)
			{
				if (Mouse.current.leftButton.wasPressedThisFrame)
				{
					resizing = false;
					Settings.Config.SaveConfig();
				}
				else if (Mouse.current.rightButton.wasPressedThisFrame)
				{
					resizing = false;
					Settings.i_menuWidth = oldWidth;
					Settings.i_menuHeight = oldHeight;
					Settings.Config.SaveConfig();
				}
				else
				{
					_ = ((Rect)(ref HackMenu.Instance.windowRect)).x;
					_ = ((Rect)(ref HackMenu.Instance.windowRect)).width;
					_ = ((Rect)(ref HackMenu.Instance.windowRect)).y;
					_ = ((Rect)(ref HackMenu.Instance.windowRect)).height;
					Settings.i_menuWidth = (int)Mathf.Clamp(MouseX - ((Rect)(ref HackMenu.Instance.windowRect)).x, 500f, maxWidth);
					Settings.i_menuHeight = (int)Mathf.Clamp(MouseY - ((Rect)(ref HackMenu.Instance.windowRect)).y, 250f, maxHeight);
					HackMenu.Instance.Resize();
				}
			}
		}

		public static void ShowCursor()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayer = LethalMenu.localPlayer;
			if (localPlayer != null)
			{
				localPlayer.playerActions.Disable();
			}
			Cursor.visible = true;
			Settings.clm_lastCursorState = Cursor.lockState;
			Cursor.lockState = (CursorLockMode)0;
		}

		public static void HideCursor()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayer = LethalMenu.localPlayer;
			if (localPlayer != null)
			{
				localPlayer.playerActions.Enable();
			}
			Cursor.visible = false;
			Cursor.lockState = Settings.clm_lastCursorState;
			if ((Object)(object)LethalMenu.localPlayer == (Object)null)
			{
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
			}
		}

		public static async void LMUser()
		{
			await RunLMUser();
		}

		public static async Task RunLMUser()
		{
			while ((Object)(object)HUDManager.Instance == (Object)null)
			{
				await Task.Delay(10000);
			}
			while ((Object)(object)LethalMenu.localPlayer == (Object)null)
			{
				await Task.Delay(10000);
			}
			HUDManager.Instance.Reflect<HUDManager>().Invoke("AddTextMessageServerRpc", $"<size=0>{LethalMenu.localPlayer.playerSteamId}, {Settings.version}</size>");
			Regex r = new Regex("\\b\\d{17,19}\\b");
			while (true)
			{
				foreach (string item in HUDManager.Instance.ChatMessageHistory)
				{
					if (!string.IsNullOrEmpty(r.Match(item)?.Value))
					{
						LethalMenu.Instance.LMUsers[r.Match(item)?.Value] = Settings.version;
					}
				}
				await Task.Delay(15000);
			}
		}
	}
	public class ReflectionUtil<R>
	{
		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 R @object { get; }

		private Type type { get; }

		internal ReflectionUtil(R obj)
		{
			@object = obj;
			type = typeof(R);
		}

		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<R>? SetValue(string variableName, object value, BindingFlags flags)
		{
			try
			{
				type.GetField(variableName, flags).SetValue(@object, value);
				return this;
			}
			catch (Exception)
			{
				return null;
			}
		}

		private ReflectionUtil<R>? 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);
			}
		}

		public 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)));
			if (!isProperty)
			{
				return GetValue<T>(fieldName, flags);
			}
			return GetProperty<T>(fieldName, flags);
		}

		public ReflectionUtil<R>? 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)));
			if (!isProperty)
			{
				return SetValue(fieldName, value, flags);
			}
			return SetProperty(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<R>(fieldName, isStatic, isProperty);
		}

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

		public ReflectionUtil<R>? Invoke(string methodName, params object[] args)
		{
			R val = Invoke<R>(methodName, isStatic: false, args);
			if (val == null)
			{
				return null;
			}
			return val.Reflect();
		}
	}
	public static class ReflectorExtensions
	{
		public static ReflectionUtil<R> Reflect<R>(this R obj)
		{
			return new ReflectionUtil<R>(obj);
		}
	}
	public class UIButton
	{
		public string label;

		public Action action;

		private GUIStyle style;

		public UIButton(string label, Action action, GUIStyle style = null)
		{
			this.label = Localization.Localize(label);
			this.action = action;
			this.style = style;
		}

		public void Draw()
		{
			if ((style != null) ? GUILayout.Button(label, style, Array.Empty<GUILayoutOption>()) : GUILayout.Button(label, Array.Empty<GUILayoutOption>()))
			{
				action();
			}
		}
	}
	public class UIOption
	{
		public string label;

		public object value;

		public Action action;

		public UIOption(string label, object value)
		{
			this.label = label;
			this.value = value;
		}

		public UIOption(string label, Action action)
		{
			this.label = Localization.Localize(label);
			this.action = action;
		}

		public void Draw(ref object refValue)
		{
			if (GUILayout.Button(label, Array.Empty<GUILayoutOption>()))
			{
				refValue = value;
			}
		}

		public void Draw()
		{
			if (GUILayout.Button(label, Array.Empty<GUILayoutOption>()))
			{
				action?.Invoke();
			}
		}
	}
	public class UI
	{
		public static void Header(string header, bool space = false)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (space)
			{
				GUILayout.Space(20f);
			}
			GUILayout.Label(Localization.Localize(header), new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
		}

		public static void SubHeader(string header, bool space = false)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			if (space)
			{
				GUILayout.Space(20f);
			}
			GUILayout.Label(Localization.Localize(header), new GUIStyle(GUI.skin.label)
			{
				fontStyle = (FontStyle)1
			}, Array.Empty<GUILayoutOption>());
		}

		public static void Label(string header, string label, RGBAColor color = null)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Localization.Localize(header), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			GUILayout.Label((color == null) ? Localization.Localize(label) : color.AsString(label), Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
		}

		public static void Label(string label, RGBAColor color = null)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label((color == null) ? Localization.Localize(label) : color.AsString(label), Array.Empty<GUILayoutOption>());
			GUILayout.EndHorizontal();
		}

		public static void Hack(Hack hack, string header, params object[] param)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0042: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label);
			if (Settings.b_HackHighlight)
			{
				val.normal.textColor = ((!Settings.b_HackHighlight || !HackExtensions.ToggleFlags.TryGetValue(hack, out var value)) ? GUI.skin.label.normal.textColor : (value ? Settings.c_hackhighlight.GetColor() : GUI.skin.label.normal.textColor));
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Localization.Localize(header), val, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (hack.Button())
			{
				hack.Execute(param);
			}
			GUILayout.EndHorizontal();
		}

		public static void Hack(Hack hack, string[] header, params object[] param)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0042: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label);
			if (Settings.b_HackHighlight)
			{
				val.normal.textColor = ((!Settings.b_HackHighlight || !HackExtensions.ToggleFlags.TryGetValue(hack, out var value)) ? GUI.skin.label.normal.textColor : (value ? Settings.c_hackhighlight.GetColor() : GUI.skin.label.normal.textColor));
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Localization.Localize(header), val, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (hack.Button())
			{
				hack.Execute(param);
			}
			GUILayout.EndHorizontal();
		}

		public static void Hack(Hack hack, string header, string buttonText, params object[] param)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Localization.Localize(header), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(Localization.Localize(buttonText), Array.Empty<GUILayoutOption>()))
			{
				hack.Execute(param);
			}
			GUILayout.EndHorizontal();
		}

		public static void Button(string header, Action action, string btnText = "General.Execute")
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Localization.Localize(header), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(Localization.Localize(btnText), Array.Empty<GUILayoutOption>()))
			{
				action();
			}
			GUILayout.EndHorizontal();
		}

		public static void Button(string[] header, Action action, string btnText = "General.Execute")
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Localization.Localize(header), Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(Localization.Localize(btnText), Array.Empty<GUILayoutOption>()))
			{
				action();
			}
			GUILayout.EndHorizontal();
		}

		public static void Toggle(string header, ref bool value, string enabled, string disabled, params Action<bool>[] action)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.label);
			if (Settings.b_HackHighlight)
			{
				val.normal.textColor = (value ? Settings.c_hackhighlight.GetColor() : GUI.skin.button.norma