Decompiled source of LethalMod v0.0.13

LethalMod.dll

Decompiled 6 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;

[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("LethalMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("0.0.11.0")]
[assembly: AssemblyInformationalVersion("0.0.11+d0f5e666cd6368ebf9095a964fefd98e7509007a")]
[assembly: AssemblyProduct("LethalMod")]
[assembly: AssemblyTitle("LethalMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.11.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalMod
{
	[BepInPlugin("LethalMod", "LethalMod", "0.0.11")]
	public class Plugin : BaseUnityPlugin
	{
		private Dictionary<Type, List<Component>> objectCache = new Dictionary<Type, List<Component>>();

		private Dictionary<Type, Dictionary<Component, NavMeshPath>> pathCache = new Dictionary<Type, Dictionary<Component, NavMeshPath>>();

		private float cacheRefreshInterval = 2.5f;

		private static ConfigEntry<bool> isUIEnabled;

		private static ConfigEntry<bool> isESPEnabled;

		private static ConfigEntry<bool> isEnemyESPEnabled;

		private static ConfigEntry<bool> isItemsESPEnabled;

		private static ConfigEntry<bool> isPlayerESPEnabled;

		private static ConfigEntry<bool> isDoorsESPEnabled;

		private static ConfigEntry<bool> isPartialESPEnabled;

		private ConfigEntry<short> config_ColorESP;

		private ConfigEntry<short> config_ColorESPEnemies;

		private ConfigEntry<short> config_ColorESPPlayers;

		private ConfigEntry<short> config_ColorESPDoors;

		private ConfigEntry<short> config_ColorESPItems;

		private ConfigEntry<short> config_ColorESPPartial;

		private float lastToggleTime;

		private const float toggleCooldown = 0.5f;

		public static string[] keybinds;

		private ConfigEntry<string> config_KeyUI;

		private ConfigEntry<string> config_KeyESP;

		private ConfigEntry<string> config_KeyESPEnemies;

		private ConfigEntry<string> config_KeyESPPlayers;

		private ConfigEntry<string> config_KeyESPDoors;

		private ConfigEntry<string> config_KeyESPItems;

		private ConfigEntry<string> config_KeyESPPartial;

		private ConfigEntry<string> config_KeyOpenCloseDoor;

		private ConfigEntry<string> config_KeyOpenAllDoors;

		private ConfigEntry<string> config_KeyCloseAllDoors;

		private bool IsKeyDown(string key)
		{
			return InputControlExtensions.IsPressed(((InputControl)Keyboard.current)[key], 0f);
		}

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading LethalMod - 0.0.11.");
			ConfigFile();
			((MonoBehaviour)this).StartCoroutine(CacheRefreshRoutine());
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalMod is loaded!");
		}

		private void ConfigFile()
		{
			isUIEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Enable UI", true, "Enable UI?");
			isESPEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ESP", "Enable ESP", true, "Enable ESP?");
			isEnemyESPEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ESP", "Enable Enemy ESP", true, "Enable Enemy ESP?");
			isItemsESPEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ESP", "Enable Items ESP", true, "Enable Items ESP?");
			isPlayerESPEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ESP", "Enable Players ESP", true, "Enable Players ESP?");
			isDoorsESPEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ESP", "Enable Doors ESP", true, "Enable Doors ESP?");
			isPartialESPEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("ESP", "Enable Partial ESP", false, "Enable Partial ESP?");
			keybinds = new string[10];
			config_KeyESP = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Enable ESP", "3", (ConfigDescription)null);
			keybinds[0] = config_KeyESP.Value.Replace(" ", "");
			config_KeyESPEnemies = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Toggle Enemy ESP", "4", (ConfigDescription)null);
			keybinds[1] = config_KeyESPEnemies.Value.Replace(" ", "");
			config_KeyESPPlayers = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Toggle Player ESP", "5", (ConfigDescription)null);
			keybinds[2] = config_KeyESPPlayers.Value.Replace(" ", "");
			config_KeyESPDoors = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Toggle Door ESP", "6", (ConfigDescription)null);
			keybinds[3] = config_KeyESPDoors.Value.Replace(" ", "");
			config_KeyESPItems = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Toggle Items ESP", "7", (ConfigDescription)null);
			keybinds[4] = config_KeyESPItems.Value.Replace(" ", "");
			config_KeyESPPartial = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Toggle incomplete paths", "8", (ConfigDescription)null);
			keybinds[5] = config_KeyESPPartial.Value.Replace(" ", "");
			config_KeyOpenCloseDoor = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Open closest door to player", "f", (ConfigDescription)null);
			keybinds[6] = config_KeyOpenCloseDoor.Value.Replace(" ", "");
			config_KeyOpenAllDoors = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Open all doors", "c", (ConfigDescription)null);
			keybinds[7] = config_KeyOpenAllDoors.Value.Replace(" ", "");
			config_KeyCloseAllDoors = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Close all doors", "x", (ConfigDescription)null);
			keybinds[8] = config_KeyCloseAllDoors.Value.Replace(" ", "");
			config_KeyUI = ((BaseUnityPlugin)this).Config.Bind<string>("Keybindings", "Toggle UI", "p", (ConfigDescription)null);
			keybinds[9] = config_KeyUI.Value.Replace(" ", "");
		}

		private IEnumerator CacheRefreshRoutine()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Starting background caching");
			while (true)
			{
				((BaseUnityPlugin)this).Logger.LogDebug((object)"Refreshing object cache.");
				RefreshCache();
				yield return (object)new WaitForSeconds(cacheRefreshInterval);
			}
		}

		private void RefreshCache()
		{
			objectCache.Clear();
			CacheObjects<EntranceTeleport>();
			CacheObjects<GrabbableObject>();
			CacheObjects<Landmine>();
			CacheObjects<Turret>();
			CacheObjects<Terminal>();
			CacheObjects<PlayerControllerB>();
			CacheObjects<SteamValveHazard>();
			CacheObjects<EnemyAI>();
			CacheObjects<TerminalAccessibleObject>();
			CacheObjects<DoorLock>();
			pathCache.Clear();
			try
			{
				if ((Object)(object)GameNetworkManager.Instance?.localPlayerController?.gameplayCamera != (Object)null)
				{
					CachePaths<EntranceTeleport>();
					CachePaths<GrabbableObject>();
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Failed to calculate paths: " + ex.Message));
			}
		}

		private void CacheObjects<T>() where T : Component
		{
			objectCache[typeof(T)] = new List<Component>((IEnumerable<Component>)(object)Object.FindObjectsOfType<T>());
			if (objectCache[typeof(T)].Count > 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Cached {objectCache[typeof(T)].Count} objects of type {typeof(T)}.");
			}
		}

		private void CachePaths<T>() where T : Component
		{
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Invalid comparison between Unknown and I4
			if ((Object)(object)GameNetworkManager.Instance == (Object)null)
			{
				return;
			}
			pathCache[typeof(T)] = new Dictionary<Component, NavMeshPath>();
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || !objectCache.TryGetValue(typeof(T), out var value))
			{
				return;
			}
			NavMeshAgent val = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.GetComponent<NavMeshAgent>();
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Attaching NavMeshAgent to Player");
				val = ((Component)GameNetworkManager.Instance.localPlayerController).gameObject.AddComponent<NavMeshAgent>();
				val.updatePosition = false;
				val.updateRotation = false;
				val.updateUpAxis = false;
			}
			((Component)val).transform.position = ((Component)GameNetworkManager.Instance.localPlayerController).transform.position;
			val.nextPosition = ((Component)GameNetworkManager.Instance.localPlayerController).transform.position;
			((Behaviour)val).enabled = false;
			((Behaviour)val).enabled = true;
			foreach (T item in value.Cast<T>())
			{
				try
				{
					NavMeshPath val2 = new NavMeshPath();
					Vector3 position = ((Component)item).transform.position;
					if (item is EntranceTeleport)
					{
						position.y -= 1.5f;
					}
					if (item is GrabbableObject && ((Object)(object)item).name.Contains("Apparatus"))
					{
						position.y -= 3f;
					}
					val.CalculatePath(position, val2);
					if (val2.corners.Length >= 3)
					{
						if ((int)val2.status == 0)
						{
							pathCache[typeof(T)][(Component)(object)item] = val2;
						}
						else if (isPartialESPEnabled.Value && (int)val2.status == 1)
						{
							pathCache[typeof(T)][(Component)(object)item] = val2;
						}
					}
				}
				catch (NullReferenceException)
				{
				}
			}
			if (pathCache[typeof(T)].Count > 0)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)$"Cached {pathCache[typeof(T)].Count} ESP Paths for type {typeof(T)}.");
			}
		}

		public void Update()
		{
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Expected O, but got Unknown
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Expected O, but got Unknown
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Expected O, but got Unknown
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			bool num = IsKeyDown(keybinds[0]);
			bool flag = IsKeyDown(keybinds[1]);
			bool flag2 = IsKeyDown(keybinds[2]);
			bool flag3 = IsKeyDown(keybinds[3]);
			bool flag4 = IsKeyDown(keybinds[4]);
			bool flag5 = IsKeyDown(keybinds[5]);
			bool flag6 = IsKeyDown(keybinds[6]);
			bool flag7 = IsKeyDown(keybinds[7]);
			bool flag8 = IsKeyDown(keybinds[8]);
			if (IsKeyDown(keybinds[9]) && Time.time - lastToggleTime > 0.5f)
			{
				isUIEnabled.Value = !isUIEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (num && Time.time - lastToggleTime > 0.5f)
			{
				isESPEnabled.Value = !isESPEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (flag && Time.time - lastToggleTime > 0.5f)
			{
				isEnemyESPEnabled.Value = !isEnemyESPEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (flag3 && Time.time - lastToggleTime > 0.5f)
			{
				isDoorsESPEnabled.Value = !isDoorsESPEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (flag4 && Time.time - lastToggleTime > 0.5f)
			{
				isItemsESPEnabled.Value = !isItemsESPEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (flag2 && Time.time - lastToggleTime > 0.5f)
			{
				isPlayerESPEnabled.Value = !isPlayerESPEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (flag5 && Time.time - lastToggleTime > 0.5f)
			{
				isPartialESPEnabled.Value = !isPartialESPEnabled.Value;
				lastToggleTime = Time.time;
			}
			if (flag6 && Time.time - lastToggleTime > 0.5f)
			{
				TerminalAccessibleObject val = null;
				foreach (TerminalAccessibleObject item in objectCache[typeof(TerminalAccessibleObject)])
				{
					TerminalAccessibleObject val2 = item;
					if (val2.isBigDoor && ((Object)(object)val == (Object)null || distance(((Component)val).transform.position) > distance(((Component)val2).transform.position)))
					{
						val = val2;
					}
				}
				if (Object.op_Implicit((Object)(object)val))
				{
					val.SetDoorOpen(true);
				}
				lastToggleTime = Time.time;
			}
			if (flag8 && Time.time - lastToggleTime > 0.5f)
			{
				foreach (TerminalAccessibleObject item2 in objectCache[typeof(TerminalAccessibleObject)])
				{
					TerminalAccessibleObject val3 = item2;
					if (val3.isBigDoor)
					{
						val3.SetDoorOpen(false);
					}
				}
				lastToggleTime = Time.time;
			}
			if (!flag7 || !(Time.time - lastToggleTime > 0.5f))
			{
				return;
			}
			foreach (TerminalAccessibleObject item3 in objectCache[typeof(TerminalAccessibleObject)])
			{
				TerminalAccessibleObject val4 = item3;
				if (val4.isBigDoor)
				{
					val4.SetDoorOpen(true);
				}
			}
			foreach (DoorLock item4 in objectCache[typeof(DoorLock)])
			{
				item4.UnlockDoorSyncWithServer();
			}
			lastToggleTime = Time.time;
		}

		public void OnGUI()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			if (isUIEnabled.Value)
			{
				string text = (isUIEnabled.Value ? "On" : "Off");
				GUI.contentColor = Color.white;
				GUI.Label(new Rect(10f, 10f, 200f, 30f), keybinds[9] + " - UI is: " + text);
				text = (isESPEnabled.Value ? "On" : "Off");
				GUI.contentColor = (isESPEnabled.Value ? Color.green : Color.red);
				GUI.Label(new Rect(10f, 25f, 200f, 30f), keybinds[0] + " - ESP is: " + text);
				text = (isEnemyESPEnabled.Value ? "On" : "Off");
				GUI.contentColor = ((isESPEnabled.Value && isEnemyESPEnabled.Value) ? Color.green : Color.red);
				GUI.Label(new Rect(10f, 40f, 200f, 30f), keybinds[1] + " - Enemy ESP is: " + text);
				text = (isPlayerESPEnabled.Value ? "On" : "Off");
				GUI.contentColor = ((isESPEnabled.Value && isPlayerESPEnabled.Value) ? Color.green : Color.red);
				GUI.Label(new Rect(10f, 55f, 200f, 30f), keybinds[2] + " - Player ESP is: " + text);
				text = (isDoorsESPEnabled.Value ? "On" : "Off");
				GUI.contentColor = ((isESPEnabled.Value && isDoorsESPEnabled.Value) ? Color.green : Color.red);
				GUI.Label(new Rect(10f, 70f, 200f, 30f), keybinds[3] + " - Doors ESP is: " + text);
				text = (isItemsESPEnabled.Value ? "On" : "Off");
				GUI.contentColor = ((isESPEnabled.Value && isItemsESPEnabled.Value) ? Color.green : Color.red);
				GUI.Label(new Rect(10f, 85f, 200f, 30f), keybinds[4] + " - Items ESP is: " + text);
				text = (isPartialESPEnabled.Value ? "On" : "Off");
				GUI.contentColor = ((isESPEnabled.Value && isPartialESPEnabled.Value) ? Color.green : Color.red);
				GUI.Label(new Rect(10f, 100f, 200f, 30f), keybinds[5] + " - Incomplete Path ESP is: " + text);
				GUI.contentColor = Color.white;
				GUI.Label(new Rect(10f, 115f, 200f, 30f), keybinds[6] + " - Open nearest big door");
				GUI.Label(new Rect(10f, 130f, 200f, 30f), keybinds[7] + " - Open/Unlock all doors");
				GUI.Label(new Rect(10f, 145f, 200f, 30f), keybinds[8] + " - Close all big doors");
			}
			if (!isESPEnabled.Value)
			{
				return;
			}
			ProcessObjects<Terminal>((Func<Terminal, Vector3, string>)((Terminal terminal, Vector3 vector) => "SHIP TERMINAL "));
			ProcessObjects<SteamValveHazard>((Func<SteamValveHazard, Vector3, string>)((SteamValveHazard valve, Vector3 vector) => "Steam Valve "));
			if (isItemsESPEnabled.Value)
			{
				ProcessObjects<GrabbableObject>((Func<GrabbableObject, Vector3, string>)((GrabbableObject grabbableObject, Vector3 vector) => grabbableObject.itemProperties.itemName + " - " + grabbableObject.scrapValue + "\n"));
			}
			if (isPlayerESPEnabled.Value)
			{
				ProcessPlayers();
			}
			if (isDoorsESPEnabled.Value)
			{
				ProcessObjects<EntranceTeleport>((Func<EntranceTeleport, Vector3, string>)((EntranceTeleport entrance, Vector3 vector) => (!entrance.isEntranceToBuilding) ? " Exit " : " Entrance "));
			}
			if (isEnemyESPEnabled.Value)
			{
				ProcessEnemies();
				ProcessObjects<Landmine>((Func<Landmine, Vector3, string>)((Landmine landmine, Vector3 vector) => "LANDMINE "));
				ProcessObjects<Turret>((Func<Turret, Vector3, string>)((Turret turret, Vector3 vector) => "TURRET "));
			}
		}

		private Vector3 world_to_screen(Vector3 world)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = GameNetworkManager.Instance.localPlayerController.gameplayCamera.WorldToViewportPoint(world);
			val.x *= Screen.width;
			val.y *= Screen.height;
			val.y = (float)Screen.height - val.y;
			return val;
		}

		private float distance(Vector3 world_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 Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, world_position);
		}

		public 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 screen.z > 0f;
		}

		private void ProcessObjects<T>(Func<T, Vector3, string> labelBuilder) where T : Component
		{
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			if (!objectCache.TryGetValue(typeof(T), out var value))
			{
				return;
			}
			foreach (T item in value.Cast<T>())
			{
				try
				{
					if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || (Object)(object)item == (Object)null)
					{
						continue;
					}
					object obj = item;
					GrabbableObject val = (GrabbableObject)((obj is GrabbableObject) ? obj : null);
					if (val != null && (val.isPocketed || val.isHeld || (val.itemProperties.itemName == "Gift" && !((Component)val).gameObject.GetComponent<Renderer>().isVisible)))
					{
						continue;
					}
					object obj2 = item;
					GrabbableObject val2 = (GrabbableObject)((obj2 is GrabbableObject) ? obj2 : null);
					bool flag = val2 != null;
					if (flag)
					{
						string itemName = val2.itemProperties.itemName;
						bool flag2 = ((itemName == "clipboard" || itemName == "Sticky note") ? true : false);
						flag = flag2;
					}
					if (flag)
					{
						continue;
					}
					object obj3 = item;
					SteamValveHazard val3 = (SteamValveHazard)((obj3 is SteamValveHazard) ? obj3 : null);
					if ((val3 == null || val3.triggerScript.interactable) && WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)item).transform.position, out var screen))
					{
						string text = labelBuilder(item, screen);
						float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, ((Component)item).transform.position);
						num = (float)Math.Round(num);
						DrawLabel(screen, text, GetColorForObject<T>(), num);
						if (item is EntranceTeleport)
						{
							DrawPath(item, GetColorForObject<T>(), 2f);
						}
						else if (item is GrabbableObject && GameNetworkManager.Instance.localPlayerController.isInsideFactory)
						{
							DrawPath(item, GetColorForObject<T>(), 2f);
						}
					}
				}
				catch (NullReferenceException ex)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to render {typeof(T)}:\n{ex.Message}");
				}
			}
		}

		private void ProcessPlayers()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			if (!objectCache.TryGetValue(typeof(PlayerControllerB), out var value))
			{
				return;
			}
			foreach (PlayerControllerB item in value.Cast<PlayerControllerB>())
			{
				try
				{
					if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !((Object)(object)item == (Object)null) && !item.isPlayerDead && !((NetworkBehaviour)item).IsLocalPlayer && !(item.playerUsername == GameNetworkManager.Instance.localPlayerController.playerUsername) && !item.disconnectedMidGame && !item.playerUsername.Contains("Player #") && WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)item).transform.position, out var screen))
					{
						string text = item.playerUsername + " ";
						float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, ((Component)item).transform.position);
						num = (float)Math.Round(num);
						DrawLabel(screen, text, Color.green, num);
					}
				}
				catch (NullReferenceException ex)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to render {typeof(PlayerControllerB)}:\n{ex.Message}");
				}
			}
		}

		private void ProcessEnemies()
		{
			if (!objectCache.TryGetValue(typeof(EnemyAI), out var value))
			{
				return;
			}
			Action<EnemyAI> action = delegate(EnemyAI enemyAI)
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && (Object)(object)enemyAI != (Object)null && WorldToScreen(GameNetworkManager.Instance.localPlayerController.gameplayCamera, ((Component)enemyAI).transform.position, out var screen))
				{
					string text = ((!string.IsNullOrWhiteSpace(enemyAI.enemyType.enemyName)) ? (enemyAI.enemyType.enemyName + " ") : "Unknown Enemy ");
					float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, ((Component)enemyAI).transform.position);
					num = (float)Math.Round(num);
					DrawLabel(screen, text, Color.red, num);
				}
			};
			foreach (EnemyAI item in value.Cast<EnemyAI>())
			{
				action(item);
			}
		}

		private void DrawLabel(Vector3 screenPosition, 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_001c: Unknown result type (might be due to invalid IL or missing references)
			GUI.contentColor = color;
			GUI.Label(new Rect(screenPosition.x, screenPosition.y, 75f, 50f), text + distance + "m");
		}

		private Color GetColorForObject<T>()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(typeof(T).Name switch
			{
				"EntranceTeleport" => Color.cyan, 
				"GrabbableObject" => Color.blue, 
				"Landmine" => Color.red, 
				"Turret" => Color.red, 
				"SteamValveHazard" => Color.magenta, 
				"Terminal" => Color.magenta, 
				_ => Color.white, 
			});
		}

		private void DrawPath<T>(T obj, Color color, float width) where T : Component
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Invalid comparison between Unknown and I4
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: 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)
			if (!pathCache.TryGetValue(typeof(T), out var value) || !value.TryGetValue((Component)(object)obj, out var value2))
			{
				return;
			}
			Vector2 val2 = default(Vector2);
			if ((int)value2.status == 0)
			{
				Vector2 pointA = Vector2.op_Implicit(world_to_screen(value2.corners[1]));
				for (int i = 2; i < value2.corners.Length - 1; i++)
				{
					Vector3 val = world_to_screen(value2.corners[i]);
					((Vector2)(ref val2))..ctor(val.x, val.y);
					render.draw_line(pointA, val2, color, width);
					pointA = val2;
				}
				Vector3 val3 = world_to_screen(((Component)obj).transform.position);
				render.draw_line(pointA, Vector2.op_Implicit(val3), color, width);
			}
			else if (isPartialESPEnabled.Value && (int)value2.status == 1)
			{
				Vector2 pointA = Vector2.op_Implicit(world_to_screen(value2.corners[1]));
				for (int j = 2; j < value2.corners.Length - 1; j++)
				{
					Vector3 val4 = world_to_screen(value2.corners[j]);
					((Vector2)(ref val2))..ctor(val4.x, val4.y);
					render.draw_line(pointA, val2, Color.yellow, width);
					pointA = val2;
				}
			}
		}
	}
	public class render : MonoBehaviour
	{
		public static Texture2D lineTex;

		public static GUIStyle StringStyle { get; set; } = new GUIStyle(GUI.skin.label);


		public static Color Color
		{
			get
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return GUI.color;
			}
			set
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				GUI.color = value;
			}
		}

		public static void draw_line(Vector2 pointA, Vector2 pointB, Color color, float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			if ((pointA.x > 0f && pointA.x < (float)Screen.width && pointA.y > 0f && pointA.y < (float)Screen.height) || (pointB.x > 0f && pointB.x < (float)Screen.width && pointB.y > 0f && pointB.y < (float)Screen.height))
			{
				Matrix4x4 matrix = GUI.matrix;
				if (!Object.op_Implicit((Object)(object)lineTex))
				{
					lineTex = new Texture2D(1, 1);
				}
				Color color2 = GUI.color;
				GUI.color = color;
				float num = Vector3.Angle(Vector2.op_Implicit(pointB - pointA), Vector2.op_Implicit(Vector2.right));
				if (pointA.y > pointB.y)
				{
					num = 0f - num;
				}
				Vector2 val = pointB - pointA;
				GUIUtility.ScaleAroundPivot(new Vector2(((Vector2)(ref val)).magnitude, width), new Vector2(pointA.x, pointA.y + 0.5f));
				GUIUtility.RotateAroundPivot(num, pointA);
				GUI.DrawTexture(new Rect(pointA.x, pointA.y, 1f, 1f), (Texture)(object)lineTex);
				GUI.matrix = matrix;
				GUI.color = color2;
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalMod";

		public const string PLUGIN_NAME = "LethalMod";

		public const string PLUGIN_VERSION = "0.0.11";
	}
}