Decompiled source of LeadMeOut v1.0.1

BepInEx/plugins/LeadMeOut/LeadMeOut.dll

Decompiled 2 months ago
using System;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("LeadMeOut")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("LeadMeOut")]
[assembly: AssemblyTitle("LeadMeOut")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace LeadMeOut;

public class ExitFinder
{
	private struct PathResult
	{
		public List<Vector3> Points;

		public bool IsLockedDoor;
	}

	private bool isActive;

	private Transform mainEntranceTarget;

	private List<Transform> fireExitTargets = new List<Transform>();

	private List<LineRenderer> mainEntranceSegments = new List<LineRenderer>();

	private List<LineRenderer> mainEntranceDiamonds = new List<LineRenderer>();

	private List<GameObject> mainEntranceShapes = new List<GameObject>();

	private GameObject mainEntranceRoot;

	private List<List<LineRenderer>> fireExitSegmentSets = new List<List<LineRenderer>>();

	private List<List<LineRenderer>> fireExitDiamondSets = new List<List<LineRenderer>>();

	private List<List<GameObject>> fireExitShapeSets = new List<List<GameObject>>();

	private List<GameObject> fireExitRoots = new List<GameObject>();

	private GameObject compassOverlayRoot;

	private RectTransform mainEntrancePip;

	private RectTransform fireExitPip;

	private float updateInterval = 0.1f;

	private float updateTimer = 999f;

	private float pulseTimer;

	private bool wasInsideFactory;

	private Vector3 smoothedPlayerPos = Vector3.zero;

	private bool smoothedPosInitialized;

	private float smoothSpeed = 8f;

	private int bezierSteps = 12;

	private NavigationMode lastNavMode;

	private const string COMPASS_PATH = "Systems/UI/Canvas/IngamePlayerHUD";

	private const float COMPASS_WIDTH = 500f;

	private const float COMPASS_HEIGHT_UI = 36.39f;

	private const float COMPASS_ANCHOR_X = 0f;

	private const float COMPASS_ANCHOR_Y = -28f;

	private const float COMPASS_FOV = 240f;

	private const float COMPASS_VERTICAL_OFFSET = 12f;

	private const float COMPASS_FADE_ZONE = 0.15f;

	private const float COMPASS_HIDE_MARGIN = 5f;

	public void Toggle()
	{
		PlayerControllerB localPlayer = GetLocalPlayer();
		bool flag = (Object)(object)localPlayer != (Object)null && localPlayer.isInsideFactory;
		if (Plugin.AutoEnableOnEntry.Value && flag && isActive)
		{
			isActive = false;
			Plugin.Logger.LogInfo((object)"LeadMeOut: Temporarily disabled by hotkey.");
			ClearAll();
			return;
		}
		if (!flag)
		{
			Plugin.Logger.LogInfo((object)"LeadMeOut: Not inside facility, ignoring toggle.");
			return;
		}
		isActive = !isActive;
		Plugin.Logger.LogInfo((object)("LeadMeOut: " + (isActive ? "ON" : "OFF")));
		if (isActive)
		{
			smoothedPosInitialized = false;
			FindExits();
			if (Plugin.NavMode.Value == NavigationMode.CompassMode)
			{
				CreateCompassOverlay();
			}
			else
			{
				CreateLineRoots();
			}
		}
		else
		{
			ClearAll();
		}
	}

	public void Tick(float deltaTime)
	{
		//IL_00bd: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		PlayerControllerB localPlayer = GetLocalPlayer();
		if ((Object)(object)localPlayer != (Object)null)
		{
			bool isInsideFactory = localPlayer.isInsideFactory;
			if (!wasInsideFactory && isInsideFactory && Plugin.AutoEnableOnEntry.Value && !isActive)
			{
				Plugin.Logger.LogInfo((object)"LeadMeOut: Auto-enabling on facility entry.");
				isActive = true;
				smoothedPosInitialized = false;
				FindExits();
				if (Plugin.NavMode.Value == NavigationMode.CompassMode)
				{
					CreateCompassOverlay();
				}
				else
				{
					CreateLineRoots();
				}
			}
			if (wasInsideFactory && !isInsideFactory && isActive)
			{
				Plugin.Logger.LogInfo((object)"LeadMeOut: Player left facility, clearing.");
				isActive = false;
				ClearAll();
			}
			wasInsideFactory = isInsideFactory;
			if (isActive)
			{
				Vector3 position = ((Component)localPlayer).transform.position;
				if (!smoothedPosInitialized)
				{
					smoothedPlayerPos = position;
					smoothedPosInitialized = true;
				}
				else
				{
					smoothedPlayerPos = Vector3.Lerp(smoothedPlayerPos, position, deltaTime * smoothSpeed);
				}
			}
		}
		if (isActive && Plugin.NavMode.Value != lastNavMode)
		{
			lastNavMode = Plugin.NavMode.Value;
			ClearAll();
			FindExits();
			if (lastNavMode == NavigationMode.CompassMode)
			{
				CreateCompassOverlay();
			}
			else
			{
				CreateLineRoots();
			}
		}
		if (!isActive)
		{
			return;
		}
		pulseTimer += deltaTime;
		updateTimer += deltaTime;
		if (updateTimer >= updateInterval)
		{
			updateTimer = 0f;
			if (Plugin.NavMode.Value == NavigationMode.CompassMode)
			{
				UpdateCompassOverlay();
			}
			else
			{
				UpdatePaths();
			}
		}
	}

	private PlayerControllerB GetLocalPlayer()
	{
		GameNetworkManager instance = GameNetworkManager.Instance;
		if ((Object)(object)instance != (Object)null && (Object)(object)instance.localPlayerController != (Object)null)
		{
			return instance.localPlayerController;
		}
		return null;
	}

	private void FindExits()
	{
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		mainEntranceTarget = null;
		fireExitTargets.Clear();
		GameObject[] array = Object.FindObjectsOfType<GameObject>();
		foreach (GameObject val in array)
		{
			if (((Object)val).name.Contains("EntranceTeleportA") && ((Object)val).name.Contains("Clone"))
			{
				mainEntranceTarget = val.transform;
				Plugin.Logger.LogInfo((object)$"LeadMeOut: Main entrance at {val.transform.position}");
			}
			if (((Object)val).name.Contains("EntranceTeleportB") && ((Object)val).name.Contains("Clone"))
			{
				fireExitTargets.Add(val.transform);
				Plugin.Logger.LogInfo((object)$"LeadMeOut: Fire exit #{fireExitTargets.Count} at {val.transform.position}");
			}
		}
		Plugin.Logger.LogInfo((object)$"LeadMeOut: Found {fireExitTargets.Count} fire exit(s).");
	}

	private void CreateCompassOverlay()
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_0073: 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_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		ClearCompassOverlay();
		GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD");
		if ((Object)(object)val == (Object)null)
		{
			Plugin.Logger.LogInfo((object)"LeadMeOut: Could not find HUD canvas path.");
			return;
		}
		compassOverlayRoot = new GameObject("LeadMeOut_CompassOverlay");
		compassOverlayRoot.transform.SetParent(val.transform, false);
		compassOverlayRoot.AddComponent<CanvasRenderer>();
		RectTransform obj = compassOverlayRoot.AddComponent<RectTransform>();
		obj.anchorMin = new Vector2(0.5f, 0f);
		obj.anchorMax = new Vector2(0.5f, 0f);
		obj.anchoredPosition = new Vector2(0f, 20.39f);
		obj.sizeDelta = new Vector2(500f, 36.39f);
		compassOverlayRoot.transform.SetAsLastSibling();
		ShowLinesPreset value = Plugin.ShowLines.Value;
		if ((Object)(object)mainEntranceTarget != (Object)null && value != ShowLinesPreset.FireExitsOnly)
		{
			Color color = Plugin.ApplyBrightness(Plugin.ResolveColor(Plugin.MainEntranceColorPreset.Value, Plugin.MainEntranceCustomColor.Value, Color.green));
			float width = Plugin.ResolvePipWidth(Plugin.MainEntranceLineWidth.Value);
			mainEntrancePip = CreatePip(compassOverlayRoot, color, width);
		}
		if (fireExitTargets.Count > 0 && value != ShowLinesPreset.MainEntranceOnly)
		{
			Color color2 = Plugin.ApplyBrightness(Plugin.ResolveColor(Plugin.FireExitColorPreset.Value, Plugin.FireExitCustomColor.Value, Color.red));
			float width2 = Plugin.ResolvePipWidth(Plugin.FireExitLineWidth.Value);
			fireExitPip = CreatePip(compassOverlayRoot, color2, width2);
		}
		RectTransform component = compassOverlayRoot.GetComponent<RectTransform>();
		Plugin.Logger.LogInfo((object)$"LeadMeOut: Compass overlay created. Parent={((Object)val).name} anchorPos={component.anchoredPosition} size={component.sizeDelta} siblingIndex={compassOverlayRoot.transform.GetSiblingIndex()}");
	}

	private RectTransform CreatePip(GameObject parent, Color color, float width)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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_008e: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("Pip");
		val.transform.SetParent(parent.transform, false);
		RectTransform obj = val.AddComponent<RectTransform>();
		obj.sizeDelta = new Vector2(width, 18f);
		obj.anchorMin = new Vector2(0.5f, 0.5f);
		obj.anchorMax = new Vector2(0.5f, 0.5f);
		obj.pivot = new Vector2(0.5f, 0.5f);
		obj.anchoredPosition = new Vector2(0f, 0f);
		((Graphic)val.AddComponent<Image>()).color = color;
		Plugin.Logger.LogDebug((object)"LeadMeOut: Pip created as Image");
		return obj;
	}

	private void UpdateCompassOverlay()
	{
		//IL_004d: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: 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_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)compassOverlayRoot == (Object)null)
		{
			return;
		}
		PlayerControllerB localPlayer = GetLocalPlayer();
		if ((Object)(object)localPlayer == (Object)null)
		{
			return;
		}
		Transform val = ((Component)localPlayer).transform.Find("ScavengerModel/metarig/CameraContainer");
		float num = (((Object)(object)val != (Object)null) ? val.eulerAngles.y : ((Component)localPlayer).transform.eulerAngles.y);
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor(Mathf.Sin(num * ((float)Math.PI / 180f)), 0f, Mathf.Cos(num * ((float)Math.PI / 180f)));
		ShowLinesPreset value = Plugin.ShowLines.Value;
		Plugin.Logger.LogDebug((object)$"LeadMeOut: UpdateCompass - forward={val2}, mainPip={(Object)(object)mainEntrancePip != (Object)null}, firePip={(Object)(object)fireExitPip != (Object)null}, mainTarget={(Object)(object)mainEntranceTarget != (Object)null}, fireCount={fireExitTargets.Count}, showLines={Plugin.ShowLines.Value}");
		if ((Object)(object)mainEntrancePip != (Object)null && (Object)(object)mainEntranceTarget != (Object)null)
		{
			((Component)mainEntrancePip).gameObject.SetActive(value != ShowLinesPreset.FireExitsOnly);
			if (value != ShowLinesPreset.FireExitsOnly)
			{
				Color color = Plugin.ApplyBrightness(Plugin.ResolveColor(Plugin.MainEntranceColorPreset.Value, Plugin.MainEntranceCustomColor.Value, Color.green));
				float num2 = Plugin.ResolvePipWidth(Plugin.MainEntranceLineWidth.Value);
				mainEntrancePip.sizeDelta = new Vector2(num2, mainEntrancePip.sizeDelta.y);
				UpdatePipPosition(mainEntrancePip, ((Component)localPlayer).transform.position, mainEntranceTarget.position, val2, color);
			}
		}
		if ((Object)(object)fireExitPip != (Object)null && fireExitTargets.Count > 0)
		{
			((Component)fireExitPip).gameObject.SetActive(value != ShowLinesPreset.MainEntranceOnly);
			if (value != ShowLinesPreset.MainEntranceOnly)
			{
				Color color2 = Plugin.ApplyBrightness(Plugin.ResolveColor(Plugin.FireExitColorPreset.Value, Plugin.FireExitCustomColor.Value, Color.red));
				float num3 = Plugin.ResolvePipWidth(Plugin.FireExitLineWidth.Value);
				fireExitPip.sizeDelta = new Vector2(num3, fireExitPip.sizeDelta.y);
				UpdatePipPosition(fireExitPip, ((Component)localPlayer).transform.position, fireExitTargets[0].position, val2, color2);
			}
		}
	}

	private void UpdatePipPosition(RectTransform pip, Vector3 playerPos, Vector3 targetPos, Vector3 forward, Color color)
	{
		//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)
		//IL_0002: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			Vector3 val = targetPos - playerPos;
			val.y = 0f;
			if (((Vector3)(ref val)).magnitude < 0.01f)
			{
				return;
			}
			((Vector3)(ref val)).Normalize();
			float num = Vector3.SignedAngle(forward, val, Vector3.up);
			float num2 = 120f;
			float num3 = Mathf.Abs(num);
			if (num3 > num2 + 5f)
			{
				((Component)pip).gameObject.SetActive(false);
				return;
			}
			((Component)pip).gameObject.SetActive(true);
			float num4 = Mathf.Clamp(num, 0f - num2, num2) / num2 * 250f;
			pip.anchoredPosition = new Vector2(num4, 0f);
			float num5 = 1f;
			float num6 = num3 / num2;
			float num7 = 0.85f;
			if (num6 > num7)
			{
				num5 = Mathf.InverseLerp(1f, num7, num6);
				num5 = Mathf.Clamp01(num5);
			}
			Plugin.Logger.LogDebug((object)$"LeadMeOut: PipPos angle={num:F1} xPos={num4:F1} alpha={num5:F2} active={((Component)pip).gameObject.activeSelf}");
			Image componentInChildren = ((Component)pip).GetComponentInChildren<Image>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				Color color2 = color;
				color2.a = num5;
				((Graphic)componentInChildren).color = color2;
			}
		}
		catch (Exception ex)
		{
			Plugin.Logger.LogInfo((object)("LeadMeOut: PipPos exception: " + ex.Message));
		}
	}

	private void ClearCompassOverlay()
	{
		if ((Object)(object)compassOverlayRoot != (Object)null)
		{
			Object.Destroy((Object)(object)compassOverlayRoot);
			compassOverlayRoot = null;
		}
		mainEntrancePip = null;
		fireExitPip = null;
	}

	private void CreateLineRoots()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		ClearLineRoots();
		ShowLinesPreset value = Plugin.ShowLines.Value;
		if ((Object)(object)mainEntranceTarget != (Object)null && value != ShowLinesPreset.FireExitsOnly)
		{
			mainEntranceRoot = new GameObject("LeadMeOut_MainLine");
			Object.DontDestroyOnLoad((Object)(object)mainEntranceRoot);
		}
		if (value != ShowLinesPreset.MainEntranceOnly)
		{
			for (int i = 0; i < fireExitTargets.Count; i++)
			{
				GameObject val = new GameObject($"LeadMeOut_FireLine_{i}");
				Object.DontDestroyOnLoad((Object)(object)val);
				fireExitRoots.Add(val);
				fireExitSegmentSets.Add(new List<LineRenderer>());
				fireExitDiamondSets.Add(new List<LineRenderer>());
				fireExitShapeSets.Add(new List<GameObject>());
			}
		}
		updateTimer = 999f;
	}

	private void UpdatePaths()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_006c: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: 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_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Unknown result type (might be due to invalid IL or missing references)
		if (!smoothedPosInitialized)
		{
			return;
		}
		ShowLinesPreset value = Plugin.ShowLines.Value;
		Color color = Plugin.ApplyBrightness(Plugin.ResolveColor(Plugin.MainEntranceColorPreset.Value, Plugin.MainEntranceCustomColor.Value, Color.green));
		LineStyle value2 = Plugin.MainEntranceLineStyle.Value;
		float width = Plugin.ResolveWidth(Plugin.MainEntranceLineWidth.Value);
		Color val = Plugin.ApplyBrightness(Plugin.ResolveColor(Plugin.FireExitColorPreset.Value, Plugin.FireExitCustomColor.Value, Color.red));
		LineStyle value3 = Plugin.FireExitLineStyle.Value;
		float width2 = Plugin.ResolveWidth(Plugin.FireExitLineWidth.Value);
		float num = 0.18f;
		if ((Object)(object)mainEntranceRoot != (Object)null && (Object)(object)mainEntranceTarget != (Object)null && value != ShowLinesPreset.FireExitsOnly)
		{
			mainEntranceRoot.SetActive(true);
			PathResult? path = GetPath(smoothedPlayerPos, mainEntranceTarget.position);
			if (path.HasValue)
			{
				RenderPath(mainEntranceRoot, mainEntranceSegments, mainEntranceDiamonds, mainEntranceShapes, path.Value.Points, color, value2, width, 0f, 0f, mainEntranceTarget.position, path.Value.IsLockedDoor);
			}
			else
			{
				HideSegments(mainEntranceSegments);
				HideShapes(mainEntranceShapes);
			}
		}
		else if ((Object)(object)mainEntranceRoot != (Object)null)
		{
			mainEntranceRoot.SetActive(false);
		}
		if (value != ShowLinesPreset.MainEntranceOnly)
		{
			for (int i = 0; i < fireExitTargets.Count && i < fireExitRoots.Count; i++)
			{
				fireExitRoots[i].SetActive(true);
				float lateralOffset = num * (float)(i + 1);
				Color color2 = ((i == 0) ? val : DarkenColor(val, 0.15f * (float)i));
				PathResult? path2 = GetPath(smoothedPlayerPos, fireExitTargets[i].position);
				if (path2.HasValue)
				{
					RenderPath(fireExitRoots[i], fireExitSegmentSets[i], fireExitDiamondSets[i], fireExitShapeSets[i], path2.Value.Points, color2, value3, width2, lateralOffset, 0f, fireExitTargets[i].position, path2.Value.IsLockedDoor);
					continue;
				}
				HideSegments(fireExitSegmentSets[i]);
				HideShapes(fireExitShapeSets[i]);
			}
			return;
		}
		foreach (GameObject fireExitRoot in fireExitRoots)
		{
			if ((Object)(object)fireExitRoot != (Object)null)
			{
				fireExitRoot.SetActive(false);
			}
		}
	}

	private Color DarkenColor(Color c, float amount)
	{
		//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		if (c.r < 0.05f && c.g < 0.05f && c.b < 0.05f)
		{
			return new Color(Mathf.Min(1f, c.r + amount), Mathf.Min(1f, c.g + amount), Mathf.Min(1f, c.b + amount), c.a);
		}
		return new Color(Mathf.Max(0f, c.r - amount), Mathf.Max(0f, c.g - amount), Mathf.Max(0f, c.b - amount), c.a);
	}

	private PathResult? GetPath(Vector3 from, Vector3 to)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Invalid comparison between Unknown and I4
		//IL_00ad: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//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_00f0: 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_0131: Unknown result type (might be due to invalid IL or missing references)
		NavMeshHit val = default(NavMeshHit);
		bool num = NavMesh.SamplePosition(from, ref val, 15f, -1);
		NavMeshHit val2 = default(NavMeshHit);
		bool flag = NavMesh.SamplePosition(to, ref val2, 15f, -1);
		if (!flag)
		{
			flag = NavMesh.SamplePosition(to, ref val2, 30f, -1);
		}
		if (!flag)
		{
			flag = NavMesh.SamplePosition(to, ref val2, 50f, -1);
		}
		if (!num || !flag)
		{
			return null;
		}
		NavMeshPath val3 = new NavMeshPath();
		NavMesh.CalculatePath(((NavMeshHit)(ref val)).position, ((NavMeshHit)(ref val2)).position, -1, val3);
		bool flag2 = (int)val3.status > 0;
		List<Vector3> list;
		if (val3.corners.Length >= 2)
		{
			list = new List<Vector3>(val3.corners);
			list[0] = from;
			if (flag2)
			{
				list.Add(to);
			}
		}
		else
		{
			list = new List<Vector3> { from, to };
			flag2 = true;
		}
		List<Vector3> list2 = SmoothPath(CenterCorners(list.ToArray()));
		for (int i = 0; i < list2.Count; i++)
		{
			list2[i] += Vector3.up * 0.1f;
		}
		float num2 = Plugin.ResolveRenderDistance(Plugin.RenderDistance.Value);
		if (num2 < float.MaxValue && !flag2)
		{
			list2 = CullByDistance(list2, from, num2);
		}
		if (list2.Count < 2)
		{
			return null;
		}
		PathResult value = default(PathResult);
		value.Points = list2;
		value.IsLockedDoor = flag2;
		return value;
	}

	private List<Vector3> CullByDistance(List<Vector3> points, Vector3 origin, float maxDist)
	{
		//IL_000f: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_0065: 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_0073: Unknown result type (might be due to invalid IL or missing references)
		List<Vector3> list = new List<Vector3>();
		float num = 0f;
		list.Add(points[0]);
		for (int i = 1; i < points.Count; i++)
		{
			num += Vector3.Distance(points[i - 1], points[i]);
			if (num > maxDist)
			{
				float num2 = num - maxDist;
				float num3 = Vector3.Distance(points[i - 1], points[i]);
				float num4 = 1f - num2 / num3;
				list.Add(Vector3.Lerp(points[i - 1], points[i], num4));
				break;
			}
			list.Add(points[i]);
		}
		return list;
	}

	private void RenderPath(GameObject root, List<LineRenderer> segments, List<LineRenderer> diamonds, List<GameObject> shapes, List<Vector3> points, Color color, LineStyle style, float width, float lateralOffset, float phaseOffset, Vector3 targetPos, bool isLockedDoor = false)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: 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_0112: Unknown result type (might be due to invalid IL or missing references)
		if (isLockedDoor)
		{
			float num = Mathf.Sin(pulseTimer * 4f) * 0.5f + 0.5f;
			float num2 = Mathf.Lerp(0.3f, 1f, num);
			((Color)(ref color))..ctor(color.r * num2, color.g * num2, color.b * num2, color.a);
		}
		if (lateralOffset != 0f)
		{
			points = ApplyLateralOffset(points, lateralOffset);
		}
		if (style == LineStyle.Arrow || style == LineStyle.Triangle || style == LineStyle.Diamond || style == LineStyle.Heart || style == LineStyle.Pawprint)
		{
			HideSegments(segments);
			HideSegments(diamonds);
			RenderShapes(root, shapes, points, color, style, width, targetPos);
			return;
		}
		HideShapes(shapes);
		float dashLength;
		float gapLength;
		if (style == LineStyle.Dotted)
		{
			dashLength = width;
			gapLength = width * 8f + 0.2f;
		}
		else
		{
			dashLength = 0.4f;
			gapLength = 0.35f;
		}
		List<(Vector3, Vector3)> dashes = ((style == LineStyle.Solid) ? BuildSolid(points) : BuildDashes(points, dashLength, gapLength, phaseOffset));
		UpdateLineSegments(root, segments, dashes, color, width);
		if (style == LineStyle.Dotted)
		{
			UpdateDiamonds(root, diamonds, dashes, color, width);
		}
		else
		{
			HideSegments(diamonds);
		}
	}

	private void RenderShapes(GameObject root, List<GameObject> shapes, List<Vector3> points, Color color, LineStyle style, float width, Vector3 targetPos)
	{
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		float num = ((style != LineStyle.Heart && style != LineStyle.Pawprint) ? (width * 20f + 0.6f) : (width * 12f + 0.4f));
		if (num < 0.05f)
		{
			num = 0.05f;
		}
		List<(Vector3, Vector3)> shapePlacements = GetShapePlacements(points, num);
		for (int i = 0; i < shapes.Count; i++)
		{
			if (i < shapePlacements.Count)
			{
				shapes[i].SetActive(true);
				MeshFilter component = shapes[i].GetComponent<MeshFilter>();
				if ((Object)(object)component != (Object)null)
				{
					component.mesh = (Mesh)(style switch
					{
						LineStyle.Pawprint => BuildPawprintMesh(), 
						LineStyle.Diamond => BuildDiamondMesh(), 
						LineStyle.Triangle => BuildTriangleMesh(), 
						LineStyle.Arrow => BuildArrowMesh(), 
						_ => BuildHeartMesh(), 
					});
				}
				ApplyShapeTransform(shapes[i], shapePlacements[i].Item1, shapePlacements[i].Item2, width);
				((Renderer)shapes[i].GetComponent<MeshRenderer>()).material.color = color;
			}
			else
			{
				shapes[i].SetActive(false);
			}
		}
		for (int j = shapes.Count; j < shapePlacements.Count; j++)
		{
			GameObject val = CreateShapeMesh(root, style, color, width);
			ApplyShapeTransform(val, shapePlacements[j].Item1, shapePlacements[j].Item2, width);
			shapes.Add(val);
		}
	}

	private List<(Vector3 pos, Vector3 dir)> GetShapePlacements(List<Vector3> points, float spacing)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_003b: 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_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		List<(Vector3, Vector3)> list = new List<(Vector3, Vector3)>();
		int num = 200;
		float num2 = spacing * 0.5f;
		for (int i = 1; i < points.Count; i++)
		{
			if (list.Count >= num)
			{
				break;
			}
			Vector3 val = points[i - 1];
			Vector3 val2 = points[i];
			float num3 = Vector3.Distance(val, val2);
			if (num3 < 0.001f)
			{
				continue;
			}
			Vector3 val3 = val2 - val;
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num4 = 0f;
			while (num4 < num3 && list.Count < num)
			{
				float num5 = spacing - num2;
				if (num4 + num5 <= num3)
				{
					num4 += num5;
					list.Add((val + normalized * num4, normalized));
					num2 = 0f;
				}
				else
				{
					num2 += num3 - num4;
					num4 = num3;
				}
			}
		}
		return list;
	}

	private void ApplyShapeTransform(GameObject shape, Vector3 pos, Vector3 dir, float width)
	{
		//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_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: 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_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		shape.transform.position = pos;
		if (dir != Vector3.zero)
		{
			shape.transform.rotation = Quaternion.LookRotation(dir, Vector3.up);
		}
		float num = width * 6f;
		shape.transform.localScale = new Vector3(num, num, num);
	}

	private GameObject CreateShapeMesh(GameObject root, LineStyle style, Color color, float width)
	{
		//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_001b: 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_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Expected O, but got Unknown
		GameObject val = new GameObject("Shape");
		val.transform.SetParent(root.transform);
		MeshFilter val2 = val.AddComponent<MeshFilter>();
		MeshRenderer obj = val.AddComponent<MeshRenderer>();
		val2.mesh = (Mesh)(style switch
		{
			LineStyle.Pawprint => BuildPawprintMesh(), 
			LineStyle.Diamond => BuildDiamondMesh(), 
			LineStyle.Triangle => BuildTriangleMesh(), 
			LineStyle.Arrow => BuildArrowMesh(), 
			_ => BuildHeartMesh(), 
		});
		Material val3 = new Material(Shader.Find("HDRP/Unlit"));
		val3.color = color;
		((Renderer)obj).material = val3;
		((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)obj).receiveShadows = false;
		return val;
	}

	private Mesh BuildArrowMesh()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//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_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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = new Mesh();
		Vector3[] vertices = (Vector3[])(object)new Vector3[7]
		{
			new Vector3(-0.15f, 0f, -0.5f),
			new Vector3(0.15f, 0f, -0.5f),
			new Vector3(0.15f, 0f, 0.1f),
			new Vector3(-0.15f, 0f, 0.1f),
			new Vector3(-0.35f, 0f, 0.1f),
			new Vector3(0.35f, 0f, 0.1f),
			new Vector3(0f, 0f, 0.5f)
		};
		val.vertices = vertices;
		val.triangles = new int[18]
		{
			0, 1, 2, 0, 2, 3, 4, 5, 6, 2,
			1, 0, 3, 2, 0, 6, 5, 4
		};
		val.RecalculateNormals();
		return val;
	}

	private Mesh BuildTriangleMesh()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: 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_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = new Mesh();
		val.vertices = (Vector3[])(object)new Vector3[3]
		{
			new Vector3(0f, 0f, 0.5f),
			new Vector3(-0.5f, 0f, -0.4f),
			new Vector3(0.5f, 0f, -0.4f)
		};
		val.triangles = new int[6] { 0, 1, 2, 2, 1, 0 };
		val.RecalculateNormals();
		return val;
	}

	private Mesh BuildHeartMesh()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = new Mesh();
		int num = 20;
		List<Vector3> list = new List<Vector3>();
		List<int> list2 = new List<int>();
		list.Add(new Vector3(0f, 0f, 0f));
		for (int i = 0; i <= num; i++)
		{
			float num2 = (float)i / (float)num * (float)Math.PI * 2f;
			float num3 = 0.4f * Mathf.Pow(Mathf.Sin(num2), 3f);
			float num4 = 0.4f * (0.8125f * Mathf.Cos(num2) - 0.3125f * Mathf.Cos(2f * num2) - 0.125f * Mathf.Cos(3f * num2) - 0.0625f * Mathf.Cos(4f * num2));
			list.Add(new Vector3(num3, 0f, num4));
		}
		int num5 = num;
		for (int j = 1; j <= num5; j++)
		{
			list2.Add(0);
			list2.Add(j);
			list2.Add((j >= num5) ? 1 : (j + 1));
		}
		int count = list2.Count;
		for (int k = 0; k < count; k += 3)
		{
			list2.Add(list2[k + 2]);
			list2.Add(list2[k + 1]);
			list2.Add(list2[k]);
		}
		val.vertices = list.ToArray();
		val.triangles = list2.ToArray();
		val.RecalculateNormals();
		return val;
	}

	private Mesh BuildDiamondMesh()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: 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_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		Mesh val = new Mesh();
		val.vertices = (Vector3[])(object)new Vector3[4]
		{
			new Vector3(0f, 0f, 0.6f),
			new Vector3(0.28f, 0f, 0f),
			new Vector3(0f, 0f, -0.6f),
			new Vector3(-0.28f, 0f, 0f)
		};
		val.triangles = new int[12]
		{
			0, 1, 2, 0, 2, 3, 2, 1, 0, 3,
			2, 0
		};
		val.RecalculateNormals();
		return val;
	}

	private Mesh BuildPawprintMesh()
	{
		//IL_0000: 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_00be: 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_00d6: Expected O, but got Unknown
		Mesh val = new Mesh();
		List<Vector3> verts = new List<Vector3>();
		List<int> tris = new List<int>();
		int circleSegments = 12;
		AddEllipse(0f, -0.15f, 0.22f, 0.22f);
		AddEllipse(-0.1f, 0.22f, 0.09f, 0.11f);
		AddEllipse(0.1f, 0.22f, 0.09f, 0.11f);
		AddEllipse(-0.24f, 0.08f, 0.08f, 0.1f);
		AddEllipse(0.24f, 0.08f, 0.08f, 0.1f);
		val.vertices = verts.ToArray();
		val.triangles = tris.ToArray();
		val.RecalculateNormals();
		return val;
		void AddEllipse(float cx, float cz, float rx, float rz)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			int count = verts.Count;
			verts.Add(new Vector3(cx, 0f, cz));
			int count2 = verts.Count;
			for (int i = 0; i < circleSegments; i++)
			{
				float num = (float)i / (float)circleSegments * (float)Math.PI * 2f;
				verts.Add(new Vector3(cx + rx * Mathf.Cos(num), 0f, cz + rz * Mathf.Sin(num)));
			}
			for (int j = 0; j < circleSegments; j++)
			{
				int item = count2 + j;
				int item2 = count2 + (j + 1) % circleSegments;
				tris.Add(count);
				tris.Add(item);
				tris.Add(item2);
				tris.Add(count);
				tris.Add(item2);
				tris.Add(item);
			}
		}
	}

	private List<(Vector3, Vector3)> BuildSolid(List<Vector3> points)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		List<(Vector3, Vector3)> list = new List<(Vector3, Vector3)>();
		for (int i = 1; i < points.Count; i++)
		{
			list.Add((points[i - 1], points[i]));
		}
		return list;
	}

	private List<(Vector3, Vector3)> BuildDashes(List<Vector3> points, float dashLength, float gapLength, float phaseOffset)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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)
		List<(Vector3, Vector3)> list = new List<(Vector3, Vector3)>();
		float num = phaseOffset % (dashLength + gapLength);
		bool flag = num < dashLength;
		float num2 = (flag ? (dashLength - num) : (gapLength - (num - dashLength)));
		for (int i = 1; i < points.Count; i++)
		{
			Vector3 val = points[i - 1];
			Vector3 val2 = points[i];
			float num3 = Vector3.Distance(val, val2);
			float num4 = 0f;
			while (num4 < num3)
			{
				float num5 = Mathf.Min(num2, num3 - num4);
				Vector3 item = Vector3.Lerp(val, val2, num4 / num3);
				Vector3 item2 = Vector3.Lerp(val, val2, (num4 + num5) / num3);
				if (flag)
				{
					list.Add((item, item2));
				}
				num4 += num5;
				num2 -= num5;
				if (num2 <= 0.001f)
				{
					flag = !flag;
					num2 = (flag ? dashLength : gapLength);
				}
			}
		}
		return list;
	}

	private void UpdateLineSegments(GameObject root, List<LineRenderer> segments, List<(Vector3 start, Vector3 end)> dashes, Color color, float width)
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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)
		for (int i = 0; i < segments.Count; i++)
		{
			if (i < dashes.Count)
			{
				((Component)segments[i]).gameObject.SetActive(true);
				segments[i].startWidth = width;
				segments[i].endWidth = width;
				segments[i].startColor = color;
				segments[i].endColor = color;
				((Renderer)segments[i]).material.color = color;
				segments[i].SetPosition(0, dashes[i].start);
				segments[i].SetPosition(1, dashes[i].end);
			}
			else
			{
				((Component)segments[i]).gameObject.SetActive(false);
			}
		}
		for (int j = segments.Count; j < dashes.Count; j++)
		{
			GameObject val = new GameObject($"Seg_{j}");
			val.transform.SetParent(root.transform);
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			SetupLineRenderer(val2, color, width);
			val2.SetPosition(0, dashes[j].start);
			val2.SetPosition(1, dashes[j].end);
			segments.Add(val2);
		}
	}

	private void UpdateDiamonds(GameObject root, List<LineRenderer> diamonds, List<(Vector3 start, Vector3 end)> dashes, Color color, float width)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: 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_00f1: 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_0102: 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_010e: 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_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		float[] array = new float[3] { 22.5f, 45f, 158.5f };
		int count = dashes.Count;
		int num = count * array.Length;
		for (int i = 0; i < diamonds.Count; i++)
		{
			if (i < num)
			{
				int index = i % count;
				float num2 = array[i / count];
				Vector3 val = (dashes[index].start + dashes[index].end) * 0.5f;
				Vector3 val2 = Quaternion.Euler(0f, num2, 0f) * (dashes[index].end - dashes[index].start);
				((Component)diamonds[i]).gameObject.SetActive(true);
				diamonds[i].startWidth = width;
				diamonds[i].endWidth = width;
				diamonds[i].startColor = color;
				diamonds[i].endColor = color;
				((Renderer)diamonds[i]).material.color = color;
				diamonds[i].SetPosition(0, val - val2 * 0.5f);
				diamonds[i].SetPosition(1, val + val2 * 0.5f);
			}
			else
			{
				((Component)diamonds[i]).gameObject.SetActive(false);
			}
		}
		for (int j = diamonds.Count; j < num; j++)
		{
			int index2 = j % count;
			float num3 = array[j / count];
			GameObject val3 = new GameObject($"Diamond_{j}");
			val3.transform.SetParent(root.transform);
			LineRenderer val4 = val3.AddComponent<LineRenderer>();
			SetupLineRenderer(val4, color, width);
			Vector3 val5 = (dashes[index2].start + dashes[index2].end) * 0.5f;
			Vector3 val6 = Quaternion.Euler(0f, num3, 0f) * (dashes[index2].end - dashes[index2].start);
			val4.SetPosition(0, val5 - val6 * 0.5f);
			val4.SetPosition(1, val5 + val6 * 0.5f);
			diamonds.Add(val4);
		}
	}

	private void SetupLineRenderer(LineRenderer lr, Color color, float width)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_001b: 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)
		((Renderer)lr).material = new Material(Shader.Find("HDRP/Unlit"));
		((Renderer)lr).material.color = color;
		lr.startColor = color;
		lr.endColor = color;
		lr.startWidth = width;
		lr.endWidth = width;
		lr.useWorldSpace = true;
		lr.positionCount = 2;
		((Renderer)lr).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)lr).receiveShadows = false;
	}

	private List<Vector3> ApplyLateralOffset(List<Vector3> points, float offset)
	{
		//IL_0020: 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_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_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: 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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: 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_009e: 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_009f: Unknown result type (might be due to invalid IL or missing references)
		List<Vector3> list = new List<Vector3>(points.Count);
		Vector3 val7 = default(Vector3);
		for (int i = 0; i < points.Count; i++)
		{
			Vector3 val;
			Vector3 val2;
			if (i <= 0)
			{
				val = Vector3.zero;
			}
			else
			{
				val2 = points[i] - points[i - 1];
				val = ((Vector3)(ref val2)).normalized;
			}
			Vector3 val3 = val;
			Vector3 val4;
			if (i >= points.Count - 1)
			{
				val4 = Vector3.zero;
			}
			else
			{
				val2 = points[i + 1] - points[i];
				val4 = ((Vector3)(ref val2)).normalized;
			}
			Vector3 val5 = val4;
			val2 = val3 + val5;
			Vector3 val6 = ((Vector3)(ref val2)).normalized;
			if (val6 == Vector3.zero)
			{
				val6 = ((val3 != Vector3.zero) ? val3 : val5);
			}
			((Vector3)(ref val7))..ctor(0f - val6.z, 0f, val6.x);
			list.Add(points[i] + val7 * offset);
		}
		return list;
	}

	private void HideSegments(List<LineRenderer> segments)
	{
		foreach (LineRenderer segment in segments)
		{
			if ((Object)(object)segment != (Object)null)
			{
				((Component)segment).gameObject.SetActive(false);
			}
		}
	}

	private void HideShapes(List<GameObject> shapes)
	{
		foreach (GameObject shape in shapes)
		{
			if ((Object)(object)shape != (Object)null)
			{
				shape.SetActive(false);
			}
		}
	}

	private Vector3[] CenterCorners(Vector3[] corners)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: 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)
		if (corners.Length < 3)
		{
			return corners;
		}
		Vector3[] array = (Vector3[])(object)new Vector3[corners.Length];
		array[0] = corners[0];
		array[corners.Length - 1] = corners[^1];
		for (int i = 1; i < corners.Length - 1; i++)
		{
			Vector3 forward = corners[i + 1] - corners[i - 1];
			forward.y = 0f;
			if (((Vector3)(ref forward)).sqrMagnitude < 0.001f)
			{
				array[i] = corners[i];
				continue;
			}
			((Vector3)(ref forward)).Normalize();
			if (Mathf.Abs(corners[i + 1].y - corners[i - 1].y) > 0.75f)
			{
				array[i] = corners[i];
			}
			else
			{
				array[i] = CenterInCorridor(corners[i], forward);
			}
		}
		return array;
	}

	private Vector3 CenterInCorridor(Vector3 point, Vector3 forward)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: 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_000b: 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)
		//IL_0014: 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_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_0047: 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_004e: 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_0077: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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)
		Vector3 val = Vector3.Cross(Vector3.up, forward);
		Vector3 normalized = ((Vector3)(ref val)).normalized;
		float num = 3f;
		float num2 = 3f;
		NavMeshHit val2 = default(NavMeshHit);
		if (NavMesh.Raycast(point, point + normalized * 3f, ref val2, -1))
		{
			num = ((NavMeshHit)(ref val2)).distance;
		}
		NavMeshHit val3 = default(NavMeshHit);
		if (NavMesh.Raycast(point, point - normalized * 3f, ref val3, -1))
		{
			num2 = ((NavMeshHit)(ref val3)).distance;
		}
		float num3 = (num - num2) * 0.5f;
		NavMeshHit val4 = default(NavMeshHit);
		if (NavMesh.SamplePosition(point + normalized * num3, ref val4, 0.5f, -1))
		{
			return ((NavMeshHit)(ref val4)).position;
		}
		return point;
	}

	private List<Vector3> SmoothPath(Vector3[] corners)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		List<Vector3> list = new List<Vector3>();
		if (corners.Length < 2)
		{
			list.AddRange(corners);
			return list;
		}
		list.Add(corners[0]);
		for (int i = 1; i < corners.Length - 1; i++)
		{
			Vector3 val = Vector3.Lerp(corners[i], corners[i - 1], 0.5f);
			Vector3 val2 = Vector3.Lerp(corners[i], corners[i + 1], 0.5f);
			for (int j = 0; j <= bezierSteps; j++)
			{
				float num = (float)j / (float)bezierSteps;
				float num2 = 1f - num;
				list.Add(num2 * num2 * val + 2f * num2 * num * corners[i] + num * num * val2);
			}
		}
		list.Add(corners[^1]);
		return list;
	}

	private void ClearLineRoots()
	{
		if ((Object)(object)mainEntranceRoot != (Object)null)
		{
			Object.Destroy((Object)(object)mainEntranceRoot);
			mainEntranceRoot = null;
		}
		mainEntranceSegments.Clear();
		mainEntranceDiamonds.Clear();
		mainEntranceShapes.Clear();
		foreach (GameObject fireExitRoot in fireExitRoots)
		{
			if ((Object)(object)fireExitRoot != (Object)null)
			{
				Object.Destroy((Object)(object)fireExitRoot);
			}
		}
		fireExitRoots.Clear();
		fireExitSegmentSets.Clear();
		fireExitDiamondSets.Clear();
		fireExitShapeSets.Clear();
	}

	private void ClearAll()
	{
		ClearLineRoots();
		ClearCompassOverlay();
		mainEntranceTarget = null;
		fireExitTargets.Clear();
	}
}
public class LeadMeOutInputActions : LcInputActions
{
	[InputAction("<Keyboard>/l", Name = "Toggle Exit Markers")]
	public InputAction ToggleKey { get; set; }
}
public class SolidColorGraphic : Graphic
{
	public override Material defaultMaterial => Canvas.GetDefaultCanvasMaterial();

	protected override void OnPopulateMesh(VertexHelper vh)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: 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_0038: 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_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: 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_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
		vh.Clear();
		Rect rect = ((Graphic)this).rectTransform.rect;
		UIVertex val = default(UIVertex);
		val.uv0 = Vector4.op_Implicit(Vector2.zero);
		val.color = Color32.op_Implicit(((Graphic)this).color);
		val.position = new Vector3(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin);
		vh.AddVert(val);
		val.position = new Vector3(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMax);
		vh.AddVert(val);
		val.position = new Vector3(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMax);
		vh.AddVert(val);
		val.position = new Vector3(((Rect)(ref rect)).xMax, ((Rect)(ref rect)).yMin);
		vh.AddVert(val);
		vh.AddTriangle(0, 1, 2);
		vh.AddTriangle(2, 3, 0);
	}
}
public class LeadMeOutRunner : MonoBehaviour
{
	private void Awake()
	{
		Plugin.Logger.LogInfo((object)"LeadMeOut: Runner Awake.");
	}

	private void Start()
	{
		Plugin.Logger.LogInfo((object)"LeadMeOut: Runner Start.");
	}

	private void Update()
	{
		if (Plugin.InputActions != null && Plugin.InputActions.ToggleKey.WasPressedThisFrame())
		{
			Plugin.Logger.LogInfo((object)"LeadMeOut: Toggle via InputUtils.");
			Plugin.ExitFinderInstance?.Toggle();
		}
		else if (Keyboard.current != null && ((ButtonControl)Keyboard.current.lKey).wasPressedThisFrame)
		{
			Plugin.Logger.LogInfo((object)"LeadMeOut: Toggle via raw keyboard.");
			Plugin.ExitFinderInstance?.Toggle();
		}
		Plugin.ExitFinderInstance?.Tick(Time.deltaTime);
	}
}
public static class LethalConfigHelper
{
	public static void Register()
	{
		//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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Expected O, but got Unknown
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Expected O, but got Unknown
		//IL_009d: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Expected O, but got Unknown
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_00ef: Expected O, but got Unknown
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: 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_0115: 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_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Expected O, but got Unknown
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Expected O, but got Unknown
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Expected O, but got Unknown
		//IL_016b: 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_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Expected O, but got Unknown
		//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_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Expected O, but got Unknown
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Expected O, but got Unknown
		//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Expected O, but got Unknown
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Expected O, but got Unknown
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<NavigationMode>(Plugin.NavMode, new EnumDropDownOptions
		{
			Name = "Navigation Mode",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<ShowLinesPreset>(Plugin.ShowLines, new EnumDropDownOptions
		{
			Name = "Show Lines",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<RenderDistancePreset>(Plugin.RenderDistance, new EnumDropDownOptions
		{
			Name = "Render Distance",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(Plugin.AutoEnableOnEntry, new BoolCheckBoxOptions
		{
			Name = "Auto-Enable On Entry",
			RequiresRestart = false
		}));
		ConfigEntry<int> brightness = Plugin.Brightness;
		IntSliderOptions val = new IntSliderOptions
		{
			Name = "Brightness (%)"
		};
		((BaseRangeOptions<int>)val).Min = 20;
		((BaseRangeOptions<int>)val).Max = 100;
		((BaseOptions)val).RequiresRestart = false;
		LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(brightness, val));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<LineStyle>(Plugin.MainEntranceLineStyle, new EnumDropDownOptions
		{
			Name = "Main Entrance - Line Style",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<LineWidthPreset>(Plugin.MainEntranceLineWidth, new EnumDropDownOptions
		{
			Name = "Main Entrance - Line Width",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<LineColorPreset>(Plugin.MainEntranceColorPreset, new EnumDropDownOptions
		{
			Name = "Main Entrance - Color",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(Plugin.MainEntranceCustomColor, new TextInputFieldOptions
		{
			Name = "Main Entrance - Custom Hex",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<LineStyle>(Plugin.FireExitLineStyle, new EnumDropDownOptions
		{
			Name = "Fire Exit - Line Style",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<LineWidthPreset>(Plugin.FireExitLineWidth, new EnumDropDownOptions
		{
			Name = "Fire Exit - Line Width",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<LineColorPreset>(Plugin.FireExitColorPreset, new EnumDropDownOptions
		{
			Name = "Fire Exit - Color",
			RequiresRestart = false
		}));
		LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(Plugin.FireExitCustomColor, new TextInputFieldOptions
		{
			Name = "Fire Exit - Custom Hex",
			RequiresRestart = false
		}));
	}
}
[HarmonyPatch(typeof(NetworkManager))]
internal static class NetworkPrefabPatch
{
	private static readonly string MOD_GUID = "LeadMeOut";

	[HarmonyPostfix]
	[HarmonyPatch("SetSingleton")]
	private static void RegisterPrefab()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(MOD_GUID + " Prefab");
		((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D);
		Object.DontDestroyOnLoad((Object)(object)val);
		NetworkObject obj = val.AddComponent<NetworkObject>();
		typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(obj, GetHash(MOD_GUID));
		NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val);
		static uint GetHash(string value)
		{
			return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0;
		}
	}
}
public enum LineStyle
{
	Solid,
	Dashed,
	Dotted,
	Arrow,
	Triangle,
	Diamond,
	Heart,
	Pawprint
}
public enum LineColorPreset
{
	Green,
	Red,
	Cyan,
	Magenta,
	Yellow,
	White,
	Blue,
	Orange,
	Purple,
	Black,
	Custom
}
public enum LineWidthPreset
{
	Hairline,
	Thin,
	Standard,
	Heavy,
	Thiccc
}
public enum ShowLinesPreset
{
	ShowBoth,
	MainEntranceOnly,
	FireExitsOnly
}
public enum NavigationMode
{
	LinearMode,
	CompassMode
}
public enum RenderDistancePreset
{
	Short,
	Medium,
	Long,
	Full
}
[BepInPlugin("LeadMeOut", "LeadMeOut", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	internal static ManualLogSource Logger;

	internal static LeadMeOutInputActions InputActions;

	internal static ExitFinder ExitFinderInstance;

	internal static ConfigEntry<LineStyle> MainEntranceLineStyle;

	internal static ConfigEntry<LineWidthPreset> MainEntranceLineWidth;

	internal static ConfigEntry<LineColorPreset> MainEntranceColorPreset;

	internal static ConfigEntry<string> MainEntranceCustomColor;

	internal static ConfigEntry<LineStyle> FireExitLineStyle;

	internal static ConfigEntry<LineWidthPreset> FireExitLineWidth;

	internal static ConfigEntry<LineColorPreset> FireExitColorPreset;

	internal static ConfigEntry<string> FireExitCustomColor;

	internal static ConfigEntry<NavigationMode> NavMode;

	internal static ConfigEntry<ShowLinesPreset> ShowLines;

	internal static ConfigEntry<RenderDistancePreset> RenderDistance;

	internal static ConfigEntry<bool> AutoEnableOnEntry;

	internal static ConfigEntry<int> Brightness;

	private static GameObject runnerObject;

	private void Awake()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Expected O, but got Unknown
		Logger = ((BaseUnityPlugin)this).Logger;
		Logger.LogInfo((object)"Plugin LeadMeOut is loaded!");
		new Harmony("LeadMeOut").PatchAll();
		MainEntranceLineStyle = ((BaseUnityPlugin)this).Config.Bind<LineStyle>("Main Entrance", "LineStyle", LineStyle.Solid, "Line style for the main entrance path.\nStyle options do not affect Compass mode.");
		MainEntranceLineWidth = ((BaseUnityPlugin)this).Config.Bind<LineWidthPreset>("Main Entrance", "LineWidth", LineWidthPreset.Standard, "Line width for the main entrance path.");
		MainEntranceColorPreset = ((BaseUnityPlugin)this).Config.Bind<LineColorPreset>("Main Entrance", "Color", LineColorPreset.Green, "Color of the main entrance line.");
		MainEntranceCustomColor = ((BaseUnityPlugin)this).Config.Bind<string>("Main Entrance", "CustomHex", "#00FF00", "Custom hex color for main entrance. Only used when Color is set to Custom.");
		FireExitLineStyle = ((BaseUnityPlugin)this).Config.Bind<LineStyle>("Fire Exit", "LineStyle", LineStyle.Solid, "Line style for the fire exit path.\nStyle options do not affect Compass mode.");
		FireExitLineWidth = ((BaseUnityPlugin)this).Config.Bind<LineWidthPreset>("Fire Exit", "LineWidth", LineWidthPreset.Standard, "Line width for the fire exit path.");
		FireExitColorPreset = ((BaseUnityPlugin)this).Config.Bind<LineColorPreset>("Fire Exit", "Color", LineColorPreset.Red, "Color of the fire exit line.");
		FireExitCustomColor = ((BaseUnityPlugin)this).Config.Bind<string>("Fire Exit", "CustomHex", "#FF0000", "Custom hex color for fire exit. Only used when Color is set to Custom.");
		NavMode = ((BaseUnityPlugin)this).Config.Bind<NavigationMode>("Behavior", "NavigationMode", NavigationMode.LinearMode, "LinearMode shows navigational path lines on the floor.\nCompassMode overlays directional markers on the HUD compass.\nLine Style options only affect Linear Mode and do not affect Compass Mode.");
		ShowLines = ((BaseUnityPlugin)this).Config.Bind<ShowLinesPreset>("Behavior", "ShowLines", ShowLinesPreset.ShowBoth, "Choose which exit lines to show.");
		RenderDistance = ((BaseUnityPlugin)this).Config.Bind<RenderDistancePreset>("Behavior", "RenderDistance", RenderDistancePreset.Medium, "How far ahead the path line renders. Short=15, Medium=30, Long=50, Full=unlimited.");
		AutoEnableOnEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Behavior", "AutoEnableOnEntry", false, "Automatically show lines when entering a facility. Hotkey toggles navigation off/on.");
		Brightness = ((BaseUnityPlugin)this).Config.Bind<int>("Behavior", "Brightness", 80, new ConfigDescription("Brightness of exit markers (lines and compass pips). Enter a value between 20 and 100.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 100), Array.Empty<object>()));
		if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
		{
			LethalConfigHelper.Register();
			Logger.LogInfo((object)"LeadMeOut: LethalConfig registered.");
		}
		InputActions = new LeadMeOutInputActions();
		((LcInputActions)InputActions).Enable();
		ExitFinderInstance = new ExitFinder();
		SceneManager.sceneLoaded += OnSceneLoaded;
		Logger.LogInfo((object)"LeadMeOut: Waiting for scene to create runner.");
	}

	private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Expected O, but got Unknown
		Logger.LogInfo((object)("LeadMeOut: Scene loaded - " + ((Scene)(ref scene)).name));
		if ((Object)(object)runnerObject == (Object)null)
		{
			runnerObject = new GameObject("LeadMeOut_Runner");
			runnerObject.AddComponent<LeadMeOutRunner>();
			Object.DontDestroyOnLoad((Object)(object)runnerObject);
			Logger.LogInfo((object)"LeadMeOut: Runner created.");
		}
	}

	internal static Color ResolveColor(LineColorPreset preset, string customHex, Color fallback)
	{
		//IL_0046: 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)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
		switch (preset)
		{
		case LineColorPreset.Green:
			return new Color(0f, 1f, 0f);
		case LineColorPreset.Red:
			return new Color(1f, 0f, 0f);
		case LineColorPreset.Cyan:
			return new Color(0f, 0.94f, 1f);
		case LineColorPreset.Magenta:
			return new Color(1f, 0.01f, 0.74f);
		case LineColorPreset.Yellow:
			return new Color(0.88f, 1f, 0f);
		case LineColorPreset.White:
			return Color.white;
		case LineColorPreset.Blue:
			return new Color(0f, 0.37f, 1f);
		case LineColorPreset.Orange:
			return new Color(1f, 0.5f, 0f);
		case LineColorPreset.Purple:
			return new Color(0.51f, 0f, 1f);
		case LineColorPreset.Black:
			return Color.black;
		case LineColorPreset.Custom:
		{
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(customHex, ref result))
			{
				return result;
			}
			return fallback;
		}
		default:
			return fallback;
		}
	}

	internal static float ResolveRenderDistance(RenderDistancePreset preset)
	{
		return preset switch
		{
			RenderDistancePreset.Short => 15f, 
			RenderDistancePreset.Medium => 30f, 
			RenderDistancePreset.Long => 50f, 
			RenderDistancePreset.Full => float.MaxValue, 
			_ => 30f, 
		};
	}

	internal static float ResolveWidth(LineWidthPreset preset)
	{
		return preset switch
		{
			LineWidthPreset.Hairline => 0.0125f, 
			LineWidthPreset.Thin => 0.025f, 
			LineWidthPreset.Standard => 0.05f, 
			LineWidthPreset.Heavy => 0.1f, 
			LineWidthPreset.Thiccc => 0.2f, 
			_ => 0.05f, 
		};
	}

	internal static float ResolvePipWidth(LineWidthPreset preset)
	{
		return preset switch
		{
			LineWidthPreset.Hairline => 0.5f, 
			LineWidthPreset.Thin => 1f, 
			LineWidthPreset.Standard => 2f, 
			LineWidthPreset.Heavy => 5f, 
			LineWidthPreset.Thiccc => 8f, 
			_ => 2f, 
		};
	}

	internal static Color ApplyBrightness(Color c)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		float num = (float)Mathf.Clamp(Brightness.Value, 20, 100) / 100f;
		return new Color(c.r * num, c.g * num, c.b * num, c.a);
	}
}
public static class MyPluginInfo
{
	public const string PLUGIN_GUID = "LeadMeOut";

	public const string PLUGIN_NAME = "LeadMeOut";

	public const string PLUGIN_VERSION = "1.0.1";
}