Decompiled source of ph3sxcc v1.0.0

ph3sxcc.dll

Decompiled 4 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ph3sxcc")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ph3sxcc")]
[assembly: AssemblyTitle("ph3sxcc")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 PackFinder
{
	[BepInPlugin("local.packfinder", "ph3sx.cc", "1.1.1")]
	public class Plugin : BasePlugin
	{
		internal static ManualLogSource Logger;

		internal static ConfigEntry<string> TargetNames;

		internal static ConfigEntry<string> PlayerNames;

		internal static ConfigEntry<bool> IncludeInactive;

		internal static ConfigEntry<bool> HideCollected;

		internal static ConfigEntry<bool> SortByName;

		internal static ConfigEntry<bool> CloseOnTeleport;

		internal static ConfigEntry<bool> UseNativeJump;

		internal static ConfigEntry<bool> FlyStabilize;

		internal static ConfigEntry<bool> ShowKeybindList;

		internal static ConfigEntry<float> EspFontSize;

		internal static ConfigEntry<float> ScanIntervalSec;

		internal static ConfigEntry<float> EspDistance;

		internal static ConfigEntry<float> TeleportHeightM;

		internal static ConfigEntry<float> AutoCollectRadius;

		internal static ConfigEntry<float> FrameBudgetMs;

		internal static ConfigEntry<float> FlySpeed;

		internal static ConfigEntry<float> JumpMult;

		internal static ConfigEntry<float> JumpBaseHeight;

		internal static ConfigEntry<float> MenuHue;

		internal static ConfigEntry<bool> ShowWatermark;

		internal static ConfigEntry<string> EspKey;

		internal static ConfigEntry<string> NearestKey;

		internal static ConfigEntry<string> NextKey;

		internal static ConfigEntry<string> MenuKey;

		internal static ConfigEntry<string> FlyKey;

		internal static ConfigEntry<string> NextLevelKey;

		internal static ConfigEntry<string> JumpKey;

		public override void Load()
		{
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Expected O, but got Unknown
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BasePlugin)this).Log;
			TargetNames = ((BasePlugin)this).Config.Bind<string>("General", "TargetNames", "pack,mystery", "Comma-separated name fragments of pack objects (case-insensitive). Press the dump key once and look at packfinder_dump.txt to find the real name.");
			PlayerNames = ((BasePlugin)this).Config.Bind<string>("General", "PlayerNames", "flippy,player,phone", "Name fragments of the object you control (the one with the Rigidbody). If nothing matches, the dynamic Rigidbody closest to the camera is used.");
			IncludeInactive = ((BasePlugin)this).Config.Bind<bool>("General", "IncludeInactive", false, "Also list disabled objects (may show already collected packs).");
			HideCollected = ((BasePlugin)this).Config.Bind<bool>("General", "HideCollected", true, "Hide packs that look collected.");
			SortByName = ((BasePlugin)this).Config.Bind<bool>("Menu", "SortByName", false, "Sort the pack list by name instead of distance.");
			CloseOnTeleport = ((BasePlugin)this).Config.Bind<bool>("Menu", "CloseOnTeleport", false, "Close the menu after teleporting from a list.");
			EspFontSize = ((BasePlugin)this).Config.Bind<float>("Menu", "EspFontSize", 14f, "ESP label text size.");
			ShowKeybindList = ((BasePlugin)this).Config.Bind<bool>("Menu", "ShowKeybindList", false, "Show the small keybind list window with active functions.");
			ShowWatermark = ((BasePlugin)this).Config.Bind<bool>("Menu", "ShowWatermark", true, "Small ph3sx.cc bar (FPS and time) in the top right corner.");
			MenuHue = ((BasePlugin)this).Config.Bind<float>("Menu", "MenuHueGS", 0.212f, "Menu accent color (hue 0..1).");
			ScanIntervalSec = ((BasePlugin)this).Config.Bind<float>("Performance", "ScanIntervalSec", 4f, "Seconds between background rescans (scan is spread across frames, so no freezes).");
			FrameBudgetMs = ((BasePlugin)this).Config.Bind<float>("Performance", "FrameBudgetMs", 2f, "Max milliseconds per frame spent scanning.");
			EspDistance = ((BasePlugin)this).Config.Bind<float>("General", "EspDistance", 150f, "Draw labels only closer than this (0 = no limit).");
			TeleportHeightM = ((BasePlugin)this).Config.Bind<float>("General", "TeleportHeightM", 1f, "Meters above the target to teleport to.");
			AutoCollectRadius = ((BasePlugin)this).Config.Bind<float>("General", "AutoCollectRadius", 2.5f, "If you get this close (meters) to a pack, it is treated as collected and hidden (0 = off).");
			FlySpeed = ((BasePlugin)this).Config.Bind<float>("Movement", "FlySpeed", 15f, "Fly speed (m/s). Hold Shift for x2.5.");
			FlyStabilize = ((BasePlugin)this).Config.Bind<bool>("Movement", "FlyStabilize", true, "Zero the rotation while flying.");
			JumpMult = ((BasePlugin)this).Config.Bind<float>("Movement", "JumpHeightMultiplier", 1f, "Jump height multiplier.");
			JumpBaseHeight = ((BasePlugin)this).Config.Bind<float>("Movement", "OwnJumpBaseHeight", 2f, "Base height (m) of the plugin's own air-jump (only used if the game's native jump fields are not found).");
			UseNativeJump = ((BasePlugin)this).Config.Bind<bool>("Movement", "UseNativeJump", true, "Try to set the game's own 'unlimited jumps' / 'jump height multiplier' fields (found by name).");
			MenuKey = ((BasePlugin)this).Config.Bind<string>("Keys", "OpenMenu", "F6", "Open/close the menu.");
			NearestKey = ((BasePlugin)this).Config.Bind<string>("Keys", "TeleportNearest", "F7", "Teleport to the nearest pack.");
			NextKey = ((BasePlugin)this).Config.Bind<string>("Keys", "TeleportNext", "F8", "Teleport to the nearest pack other than the last one.");
			FlyKey = ((BasePlugin)this).Config.Bind<string>("Keys", "ToggleFly", "F9", "Toggle fly.");
			NextLevelKey = ((BasePlugin)this).Config.Bind<string>("Keys", "NextLevel", "F10", "Teleport to the start of the next level.");
			JumpKey = ((BasePlugin)this).Config.Bind<string>("Keys", "AirJump", "Space", "Key for the plugin's own air-jump (when Unlimited jump is on).");
			EspKey = ((BasePlugin)this).Config.Bind<string>("Keys", "ToggleESPHotkey", "None", "Optional hotkey to toggle ESP (None = only via the menu).");
			ClassInjector.RegisterTypeInIl2Cpp<PackFinderBehaviour>();
			GameObject val = new GameObject("PackFinder");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<PackFinderBehaviour>();
			Logger.LogInfo((object)"ph3sx.cc loaded. F6 menu, F7 nearest, F8 next, F9 fly, F10 next level.");
		}
	}
	public class PackInfo
	{
		public Transform t;

		public int id;

		public string key;

		public string name;

		public float dist;

		public bool collected;
	}
	public class NativeMember
	{
		public object target;

		public PropertyInfo prop;

		public bool isBool;

		public string label;
	}
	public class PackFinderBehaviour : MonoBehaviour
	{
		private static bool inputBroken;

		private bool esp;

		private bool menuOpen;

		private bool fly;

		private bool unlimitedJump;

		private Transform player;

		private Camera cam;

		private float nextCamSearch;

		private float nextPlayerSearch;

		private Transform lastTarget;

		private int lastLevelIdx = -1;

		private static readonly string[] LevelLabels = new string[11]
		{
			"0  Lazy Stock", "1  Cardboard Fort", "2  Playground", "3  Candyland", "4  Toy Chest", "5  The Network", "6  Fridge", "7  Blanket Kingdom", "8  Recycling Center", "9  Pre-Finale",
			"10  Finale"
		};

		private static readonly Vector3[] DefaultLevels = (Vector3[])(object)new Vector3[11]
		{
			new Vector3(107.04f, -22.693f, 427.27f),
			new Vector3(5.116f, 16.076f, 179.122f),
			new Vector3(7.575f, 130.105f, -52.343f),
			new Vector3(-36.015f, 374.906f, -14.134f),
			new Vector3(-55.893f, 985.367f, 75.715f),
			new Vector3(-30.947f, 1484.29f, -55.038f),
			new Vector3(-5.738f, 2288.446f, -41.436f),
			new Vector3(34.003f, 2663.495f, -171.497f),
			new Vector3(108.257f, 3132.23f, -180.828f),
			new Vector3(-161.927f, 3511.64f, -80.288f),
			new Vector3(-311.779f, 3493.873f, 19.19f)
		};

		private readonly bool[] levelSet = new bool[11];

		private readonly Vector3[] levelPos = (Vector3[])(object)new Vector3[11];

		private bool levelsLoaded;

		private float lastScanDone = -999f;

		private float nextTick;

		private string toast = "";

		private float toastUntil;

		private readonly List<PackInfo> targets = new List<PackInfo>();

		private readonly HashSet<string> collected = new HashSet<string>();

		private readonly HashSet<int> seenVisible = new HashSet<int>();

		private readonly HashSet<int> ignored = new HashSet<int>();

		private string lastKeysString = "";

		private bool scanning;

		private float nextScan;

		private Il2CppArrayBase<Transform> scanArr;

		private int scanIdx;

		private string[] scanKeys;

		private readonly List<Transform> scanFound = new List<Transform>();

		private readonly Stopwatch sw = new Stopwatch();

		private Transform rbPlayer;

		private readonly List<Rigidbody> playerRbs = new List<Rigidbody>();

		private bool flyWasOn;

		private readonly List<NativeMember> native = new List<NativeMember>();

		private readonly Dictionary<string, Type> wrapperCache = new Dictionary<string, Type>();

		private string nativeStatus = "";

		private bool nativeSearched;

		private bool nativeWasActive;

		private float nextNativeApply;

		private Rect win = new Rect(60f, 60f, 720f, 540f);

		private bool dragging;

		private Vector2 dragOff;

		private Vector2 scrollPacks;

		private Vector2 scrollLevels;

		private CursorLockMode prevLock;

		private bool prevVisible;

		private bool cursorTaken;

		private bool stylesReady;

		private ConfigEntry<string> listening;

		private static KeyCode[] allKeys;

		private readonly Dictionary<int, RigidbodyConstraints> origConstraints = new Dictionary<int, RigidbodyConstraints>();

		private readonly Dictionary<int, Quaternion> lockedRot = new Dictionary<int, Quaternion>();

		private Color cAccent = new Color(0.6f, 0.76862746f, 13f / 85f, 1f);

		private Color cAccentDark = new Color(0.4862745f, 0.61960787f, 0.1254902f, 1f);

		private const int PatW = 712;

		private Texture2D white;

		private Texture2D gradTex;

		private Texture2D patternTex;

		private GUIStyle sTitleC;

		private GUIStyle sBindDimR;

		private GUIStyle sBindOnR;

		private GUIStyle sBind;

		private GUIStyle sBindOn;

		private GUIStyle sText;

		private GUIStyle sTextR;

		private GUIStyle sTextC;

		private GUIStyle sTextDim;

		private GUIStyle sTextDimR;

		private GUIStyle sTitle;

		private GUIStyle sTab;

		private GUIStyle sEsp;

		private GUIStyle sEspShadow;

		private GUIStyle sBrand;

		private GUIStyle sBrandAcc;

		private GUIStyle sToast;

		private int activeSlider = -1;

		private int tab;

		private Rect kbWin = new Rect(0f, 0f, 190f, 40f);

		private bool kbInit;

		private bool draggingKb;

		private Vector2 dragOffKb;

		private float fpsSmooth = 60f;

		private Texture2D[] icons;

		public PackFinderBehaviour(IntPtr ptr)
			: base(ptr)
		{
		}//IL_00c5: 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_00fa: 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_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)


		private static bool Pressed(ConfigEntry<string> entry)
		{
			//IL_001b: 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)
			if (inputBroken)
			{
				return false;
			}
			if (!Enum.TryParse<KeyCode>(entry.Value, ignoreCase: true, out KeyCode result))
			{
				return false;
			}
			if ((int)result == 0)
			{
				return false;
			}
			try
			{
				return Input.GetKeyDown(result);
			}
			catch (Exception ex)
			{
				inputBroken = true;
				Plugin.Logger.LogError((object)("Input.GetKeyDown failed: " + ex.Message));
				return false;
			}
		}

		private static bool Held(KeyCode key)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			if (inputBroken)
			{
				return false;
			}
			try
			{
				return Input.GetKey(key);
			}
			catch (Exception)
			{
				inputBroken = true;
				return false;
			}
		}

		private unsafe void PollRebind()
		{
			//IL_0040: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_005a: 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_0065: Invalid comparison between Unknown and I4
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Invalid comparison between Unknown and I4
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Invalid comparison between Unknown and I4
			if (inputBroken)
			{
				listening = null;
				return;
			}
			try
			{
				if (allKeys == null)
				{
					allKeys = (KeyCode[])Enum.GetValues(typeof(KeyCode));
				}
				KeyCode[] array = allKeys;
				for (int i = 0; i < array.Length; i++)
				{
					KeyCode val = array[i];
					if ((int)val != 0 && (int)val != 323 && (int)val != 324 && Input.GetKeyDown(val))
					{
						if ((int)val == 27)
						{
							Notify("Bind change cancelled");
						}
						else if ((int)val == 8 || (int)val == 127)
						{
							listening.Value = "None";
							Notify("Bind removed");
						}
						else
						{
							listening.Value = ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString();
							Notify("Bound to " + ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString());
						}
						listening = null;
						break;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("Rebind failed: " + ex.Message));
				listening = null;
			}
		}

		private void Update()
		{
			if (listening != null)
			{
				PollRebind();
				HandleCursor();
				UpdateFly();
				return;
			}
			if (Pressed(Plugin.MenuKey))
			{
				menuOpen = !menuOpen;
			}
			if (Pressed(Plugin.EspKey))
			{
				SetEsp(!esp);
			}
			if (Pressed(Plugin.NearestKey))
			{
				TeleportBest(next: false);
			}
			if (Pressed(Plugin.NextKey))
			{
				TeleportBest(next: true);
			}
			if (Pressed(Plugin.FlyKey))
			{
				SetFly(!fly);
			}
			if (Pressed(Plugin.NextLevelKey))
			{
				TeleportLevel(1);
			}
			HandleCursor();
			if (esp || menuOpen)
			{
				if (!scanning && Time.unscaledTime >= nextScan)
				{
					StartScan();
				}
				if (scanning)
				{
					StepScan(Plugin.FrameBudgetMs.Value);
				}
			}
			if (Time.unscaledTime >= nextTick)
			{
				nextTick = Time.unscaledTime + 0.5f;
				if (targets.Count > 0)
				{
					Tick();
				}
			}
			UpdateFly();
			UpdateJump();
		}

		private void LateUpdate()
		{
			if (menuOpen)
			{
				try
				{
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
				}
				catch (Exception)
				{
				}
			}
		}

		private void SetEsp(bool on)
		{
			esp = on;
			if (esp)
			{
				nextScan = 0f;
			}
			Notify("ESP " + (esp ? "on" : "off"));
		}

		private void SetFly(bool on)
		{
			fly = on;
			Notify("Fly " + (fly ? "on" : "off"));
		}

		private void HandleCursor()
		{
			//IL_0043: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			if (menuOpen)
			{
				if (!cursorTaken)
				{
					prevLock = Cursor.lockState;
					prevVisible = Cursor.visible;
					cursorTaken = true;
				}
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
			else if (cursorTaken)
			{
				Cursor.lockState = prevLock;
				Cursor.visible = prevVisible;
				cursorTaken = false;
			}
		}

		private void Notify(string msg)
		{
			toast = msg;
			toastUntil = Time.unscaledTime + 3f;
			Plugin.Logger.LogInfo((object)msg);
		}

		private static string[] Split(string csv)
		{
			List<string> list = new List<string>();
			string[] array = csv.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim().ToLowerInvariant();
				if (text.Length > 0)
				{
					list.Add(text);
				}
			}
			return list.ToArray();
		}

		private static bool Matches(string name, string[] keys)
		{
			string text = name.ToLowerInvariant();
			foreach (string value in keys)
			{
				if (text.Contains(value))
				{
					return true;
				}
			}
			return false;
		}

		private static string GetPath(Transform t)
		{
			StringBuilder stringBuilder = new StringBuilder(((Object)t).name);
			Transform parent = t.parent;
			while ((Object)(object)parent != (Object)null)
			{
				stringBuilder.Insert(0, ((Object)parent).name + "/");
				parent = parent.parent;
			}
			return stringBuilder.ToString();
		}

		private static string Short(string n)
		{
			return n.Replace("Interactable_", "");
		}

		private static string ShortList(string n)
		{
			return n.Replace("Interactable_", "").Replace("SkinPack_", "");
		}

		private static string PosKey(Vector3 p)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			return Mathf.RoundToInt(p.x * 2f) + "_" + Mathf.RoundToInt(p.y * 2f) + "_" + Mathf.RoundToInt(p.z * 2f);
		}

		private static int NatCmp(string a, string b)
		{
			int i = 0;
			int j = 0;
			while (i < a.Length && j < b.Length)
			{
				if (char.IsDigit(a[i]) && char.IsDigit(b[j]))
				{
					int num = i;
					for (; i < a.Length && char.IsDigit(a[i]); i++)
					{
					}
					int num2 = j;
					for (; j < b.Length && char.IsDigit(b[j]); j++)
					{
					}
					string text = a.Substring(num, i - num).TrimStart('0');
					string text2 = b.Substring(num2, j - num2).TrimStart('0');
					if (text.Length != text2.Length)
					{
						return text.Length.CompareTo(text2.Length);
					}
					int num3 = string.CompareOrdinal(text, text2);
					if (num3 != 0)
					{
						return num3;
					}
				}
				else
				{
					int num4 = char.ToLowerInvariant(a[i]).CompareTo(char.ToLowerInvariant(b[j]));
					if (num4 != 0)
					{
						return num4;
					}
					i++;
					j++;
				}
			}
			return (a.Length - i).CompareTo(b.Length - j);
		}

		private Camera GetCam()
		{
			if ((Object)(object)cam != (Object)null)
			{
				return cam;
			}
			if (Time.unscaledTime < nextCamSearch)
			{
				return null;
			}
			nextCamSearch = Time.unscaledTime + 1f;
			cam = Camera.main;
			if ((Object)(object)cam == (Object)null && Camera.allCamerasCount > 0)
			{
				cam = ((Il2CppArrayBase<Camera>)(object)Camera.allCameras)[0];
			}
			return cam;
		}

		private Vector3 RefPosition()
		{
			//IL_0014: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null)
			{
				return player.position;
			}
			Camera val = GetCam();
			if ((Object)(object)val != (Object)null)
			{
				return ((Component)val).transform.position;
			}
			return Vector3.zero;
		}

		private Transform FindPlayer(bool force)
		{
			//IL_007e: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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)
			if ((Object)(object)player != (Object)null)
			{
				if (((Component)player).gameObject.activeInHierarchy)
				{
					return player;
				}
				player = null;
			}
			if (!force && Time.unscaledTime < nextPlayerSearch)
			{
				return null;
			}
			nextPlayerSearch = Time.unscaledTime + 3f;
			string[] keys = Split(Plugin.PlayerNames.Value);
			Camera val = GetCam();
			Vector3 val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : Vector3.zero);
			Rigidbody val3 = null;
			float num = float.MaxValue;
			foreach (Rigidbody item in Resources.FindObjectsOfTypeAll<Rigidbody>())
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				Scene scene = ((Component)item).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid() || !((Component)item).gameObject.activeInHierarchy)
				{
					continue;
				}
				bool flag = Matches(((Object)item).name, keys);
				if (flag || !item.isKinematic)
				{
					Vector3 val4 = item.position - val2;
					float num2 = ((Vector3)(ref val4)).sqrMagnitude + (flag ? 0f : 1E+09f);
					if (num2 < num)
					{
						num = num2;
						val3 = item;
					}
				}
			}
			if ((Object)(object)val3 != (Object)null)
			{
				player = ((Component)val3).transform;
				Plugin.Logger.LogInfo((object)("Player object: " + GetPath(player)));
			}
			return player;
		}

		private List<Rigidbody> GetPlayerRbs()
		{
			//IL_00cd: 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_00d8: 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)
			Transform val = FindPlayer(force: false);
			if ((Object)(object)val == (Object)null)
			{
				playerRbs.Clear();
				rbPlayer = null;
				return playerRbs;
			}
			if ((Object)(object)rbPlayer == (Object)(object)val && playerRbs.Count > 0 && (Object)(object)playerRbs[0] != (Object)null)
			{
				return playerRbs;
			}
			rbPlayer = val;
			playerRbs.Clear();
			Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				playerRbs.Add(component);
			}
			Il2CppArrayBase<Rigidbody> componentsInChildren = ((Component)val.root).GetComponentsInChildren<Rigidbody>(true);
			if (componentsInChildren.Length <= 40)
			{
				foreach (Rigidbody item in componentsInChildren)
				{
					if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)component))
					{
						Vector3 val2 = item.position - val.position;
						if (((Vector3)(ref val2)).sqrMagnitude <= 25f)
						{
							playerRbs.Add(item);
						}
					}
				}
			}
			return playerRbs;
		}

		private void RestoreRotation(Rigidbody rb)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			int instanceID = ((Object)rb).GetInstanceID();
			if (origConstraints.TryGetValue(instanceID, out var value))
			{
				try
				{
					rb.constraints = value;
				}
				catch (Exception)
				{
				}
				origConstraints.Remove(instanceID);
			}
			lockedRot.Remove(instanceID);
		}

		private void UpdateFly()
		{
			//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_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_010a: 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_00b8: 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_00c4: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: 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_01e5: 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_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			if (!fly)
			{
				if (!flyWasOn)
				{
					return;
				}
				flyWasOn = false;
				foreach (Rigidbody playerRb in playerRbs)
				{
					if (!((Object)(object)playerRb == (Object)null))
					{
						try
						{
							playerRb.useGravity = true;
						}
						catch (Exception)
						{
						}
						RestoreRotation(playerRb);
					}
				}
				origConstraints.Clear();
				lockedRot.Clear();
				return;
			}
			List<Rigidbody> list = GetPlayerRbs();
			if (list.Count == 0)
			{
				return;
			}
			flyWasOn = true;
			Camera val = GetCam();
			Vector3 val2 = Vector3.forward;
			Vector3 right = Vector3.right;
			if ((Object)(object)val != (Object)null)
			{
				val2 = ((Component)val).transform.forward;
				right = ((Component)val).transform.right;
				val2.y = 0f;
				right.y = 0f;
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = ((Component)val).transform.up;
				}
				((Vector3)(ref val2)).Normalize();
				((Vector3)(ref right)).Normalize();
			}
			Vector3 val3 = Vector3.zero;
			if (!menuOpen)
			{
				if (Held((KeyCode)119))
				{
					val3 += val2;
				}
				if (Held((KeyCode)115))
				{
					val3 -= val2;
				}
				if (Held((KeyCode)100))
				{
					val3 += right;
				}
				if (Held((KeyCode)97))
				{
					val3 -= right;
				}
				if (Held((KeyCode)32))
				{
					val3 += Vector3.up;
				}
				if (Held((KeyCode)306) || Held((KeyCode)99))
				{
					val3 -= Vector3.up;
				}
			}
			float num = Plugin.FlySpeed.Value * (Held((KeyCode)304) ? 2.5f : 1f);
			Vector3 velocity = ((((Vector3)(ref val3)).sqrMagnitude > 0.0001f) ? (((Vector3)(ref val3)).normalized * num) : Vector3.zero);
			bool value = Plugin.FlyStabilize.Value;
			foreach (Rigidbody item in list)
			{
				if ((Object)(object)item == (Object)null)
				{
					continue;
				}
				try
				{
					item.useGravity = false;
					item.velocity = velocity;
					if (value)
					{
						int instanceID = ((Object)item).GetInstanceID();
						if (!origConstraints.ContainsKey(instanceID))
						{
							origConstraints[instanceID] = item.constraints;
						}
						if (!lockedRot.ContainsKey(instanceID))
						{
							lockedRot[instanceID] = item.rotation;
						}
						item.constraints = (RigidbodyConstraints)(origConstraints[instanceID] | 0x70);
						item.angularVelocity = Vector3.zero;
						item.rotation = lockedRot[instanceID];
					}
					else
					{
						RestoreRotation(item);
					}
				}
				catch (Exception)
				{
				}
			}
		}

		private bool HasNativeUnlimited()
		{
			foreach (NativeMember item in native)
			{
				if (item.isBool)
				{
					return true;
				}
			}
			return false;
		}

		private void UpdateJump()
		{
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			bool flag = unlimitedJump || Plugin.JumpMult.Value > 1.001f;
			if (Plugin.UseNativeJump.Value)
			{
				if (flag && !nativeSearched)
				{
					DiscoverNative();
				}
				if (native.Count > 0)
				{
					if (flag && Time.unscaledTime >= nextNativeApply)
					{
						nextNativeApply = Time.unscaledTime + 1f;
						ApplyNative(on: true);
						nativeWasActive = true;
					}
					else if (!flag && nativeWasActive)
					{
						ApplyNative(on: false);
						nativeWasActive = false;
					}
				}
			}
			if (!unlimitedJump || (Plugin.UseNativeJump.Value && HasNativeUnlimited()) || menuOpen || !Pressed(Plugin.JumpKey))
			{
				return;
			}
			List<Rigidbody> list = GetPlayerRbs();
			float num = Mathf.Abs(Physics.gravity.y);
			float num2 = Plugin.JumpBaseHeight.Value * Mathf.Max(0.1f, Plugin.JumpMult.Value);
			float num3 = Mathf.Sqrt(2f * num * num2);
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					try
					{
						Vector3 velocity = item.velocity;
						item.velocity = new Vector3(velocity.x, num3, velocity.z);
					}
					catch (Exception)
					{
					}
				}
			}
		}

		private Type FindWrapper(string tn)
		{
			if (wrapperCache.TryGetValue(tn, out var value))
			{
				return value;
			}
			value = null;
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			foreach (Assembly assembly in assemblies)
			{
				try
				{
					value = assembly.GetType(tn, throwOnError: false);
				}
				catch (Exception)
				{
					value = null;
				}
				if (value != null)
				{
					break;
				}
			}
			wrapperCache[tn] = value;
			return value;
		}

		private void DiscoverNative()
		{
			//IL_004a: 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)
			nativeSearched = true;
			native.Clear();
			StringBuilder stringBuilder = new StringBuilder();
			int num = 0;
			int num2 = 0;
			try
			{
				List<Object> list = new List<Object>();
				foreach (MonoBehaviour item in Resources.FindObjectsOfTypeAll<MonoBehaviour>())
				{
					if (!((Object)(object)item == (Object)null))
					{
						Scene scene = ((Component)item).gameObject.scene;
						if (((Scene)(ref scene)).IsValid())
						{
							list.Add((Object)(object)item);
						}
					}
				}
				foreach (ScriptableObject item2 in Resources.FindObjectsOfTypeAll<ScriptableObject>())
				{
					if ((Object)(object)item2 != (Object)null)
					{
						list.Add((Object)(object)item2);
					}
				}
				MethodInfo method = typeof(MonoBehaviour).GetMethod("TryCast");
				foreach (Object item3 in list)
				{
					string text;
					try
					{
						text = ((Object)item3).ToString();
					}
					catch (Exception)
					{
						continue;
					}
					int num3 = text.LastIndexOf('(');
					if (num3 < 0)
					{
						continue;
					}
					string text2 = text.Substring(num3 + 1).Trim(')', ' ');
					if (text2.StartsWith("UnityEngine") || text2.StartsWith("Unity.") || text2.StartsWith("TMPro"))
					{
						continue;
					}
					Type type = FindWrapper(text2);
					if (type == null)
					{
						continue;
					}
					object obj = null;
					try
					{
						obj = method.MakeGenericMethod(type).Invoke(item3, null);
					}
					catch (Exception)
					{
						continue;
					}
					if (obj == null)
					{
						continue;
					}
					num2++;
					Type type2 = type;
					while (type2 != null && type2 != typeof(object))
					{
						string text3 = type2.Namespace ?? "";
						if (text3.StartsWith("UnityEngine") || text3.StartsWith("Il2Cpp") || text3.StartsWith("System"))
						{
							break;
						}
						PropertyInfo[] properties;
						try
						{
							properties = type2.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public);
						}
						catch (Exception)
						{
							break;
						}
						PropertyInfo[] array = properties;
						foreach (PropertyInfo propertyInfo in array)
						{
							string text4 = propertyInfo.Name.ToLowerInvariant();
							if (!text4.Contains("jump"))
							{
								continue;
							}
							num++;
							object obj2 = null;
							try
							{
								if (propertyInfo.CanRead && propertyInfo.GetIndexParameters().Length == 0)
								{
									obj2 = propertyInfo.GetValue(obj, null);
								}
							}
							catch (Exception)
							{
							}
							stringBuilder.AppendLine(text2 + "." + propertyInfo.Name + " : " + propertyInfo.PropertyType.Name + " = " + obj2);
							if (propertyInfo.CanWrite)
							{
								bool flag = propertyInfo.PropertyType == typeof(bool) && (text4.Contains("unlimited") || text4.Contains("infinite"));
								bool flag2 = (propertyInfo.PropertyType == typeof(float) || propertyInfo.PropertyType == typeof(double)) && text4.Contains("mult");
								if (flag || flag2)
								{
									NativeMember nativeMember = new NativeMember();
									nativeMember.target = obj;
									nativeMember.prop = propertyInfo;
									nativeMember.isBool = flag;
									nativeMember.label = text2 + "." + propertyInfo.Name;
									native.Add(nativeMember);
								}
							}
						}
						type2 = type2.BaseType;
					}
				}
			}
			catch (Exception ex5)
			{
				Plugin.Logger.LogError((object)("DiscoverNative failed: " + ex5.Message));
			}
			try
			{
				File.WriteAllText(Path.Combine(Paths.BepInExRootPath, "packfinder_jump_members.txt"), stringBuilder.ToString());
			}
			catch (Exception)
			{
			}
			nativeStatus = "Game fields: " + native.Count + " (jump fields total: " + num + ")";
			Notify(nativeStatus);
		}

		private void ApplyNative(bool on)
		{
			for (int num = native.Count - 1; num >= 0; num--)
			{
				NativeMember nativeMember = native[num];
				try
				{
					object value = ((!nativeMember.isBool) ? Convert.ChangeType(on ? Plugin.JumpMult.Value : 1f, nativeMember.prop.PropertyType) : ((object)(on && unlimitedJump)));
					nativeMember.prop.SetValue(nativeMember.target, value, null);
				}
				catch (Exception)
				{
					native.RemoveAt(num);
				}
			}
		}

		private void StartScan()
		{
			if (!scanning)
			{
				string value = Plugin.TargetNames.Value;
				if (value != lastKeysString)
				{
					lastKeysString = value;
					ignored.Clear();
				}
				scanKeys = Split(value);
				if (scanKeys.Length == 0)
				{
					targets.Clear();
					nextScan = Time.unscaledTime + Plugin.ScanIntervalSec.Value;
					return;
				}
				scanArr = Resources.FindObjectsOfTypeAll<Transform>();
				scanIdx = 0;
				scanFound.Clear();
				scanning = true;
			}
		}

		private void StepScan(double budgetMs)
		{
			//IL_007d: 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)
			if (!scanning)
			{
				return;
			}
			sw.Restart();
			int length = scanArr.Length;
			bool value = Plugin.IncludeInactive.Value;
			while (scanIdx < length)
			{
				Transform val = scanArr[scanIdx++];
				if ((Object)(object)val != (Object)null)
				{
					int instanceID = ((Object)val).GetInstanceID();
					if (!ignored.Contains(instanceID))
					{
						GameObject gameObject = ((Component)val).gameObject;
						Scene scene = gameObject.scene;
						if (!((Scene)(ref scene)).IsValid() || !Matches(((Object)val).name, scanKeys))
						{
							ignored.Add(instanceID);
						}
						else if ((Object)(object)val.parent != (Object)null && Matches(((Object)val.parent).name, scanKeys))
						{
							ignored.Add(instanceID);
						}
						else if (value || gameObject.activeInHierarchy)
						{
							scanFound.Add(val);
						}
					}
				}
				if ((scanIdx & 0x3F) == 0 && sw.Elapsed.TotalMilliseconds > budgetMs)
				{
					return;
				}
			}
			FinishScan();
		}

		private void ScanNowSync()
		{
			if (!scanning)
			{
				StartScan();
			}
			while (scanning)
			{
				StepScan(double.MaxValue);
			}
		}

		private static bool HasVisibleRenderer(Transform t)
		{
			foreach (Renderer componentsInChild in ((Component)t).GetComponentsInChildren<Renderer>(false))
			{
				if ((Object)(object)componentsInChild != (Object)null && componentsInChild.enabled)
				{
					return true;
				}
			}
			return false;
		}

		private void FinishScan()
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			scanning = false;
			scanArr = null;
			lastScanDone = Time.unscaledTime;
			nextScan = Time.unscaledTime + Plugin.ScanIntervalSec.Value;
			targets.Clear();
			foreach (Transform item in scanFound)
			{
				if (!((Object)(object)item == (Object)null))
				{
					PackInfo packInfo = new PackInfo();
					packInfo.t = item;
					packInfo.id = ((Object)item).GetInstanceID();
					packInfo.key = PosKey(item.position);
					packInfo.name = ((Object)item).name;
					if (HasVisibleRenderer(item))
					{
						seenVisible.Add(packInfo.id);
					}
					else if (seenVisible.Contains(packInfo.id))
					{
						collected.Add(packInfo.key);
					}
					packInfo.collected = collected.Contains(packInfo.key);
					targets.Add(packInfo);
				}
			}
			scanFound.Clear();
			Tick();
		}

		private void Tick()
		{
			//IL_0009: 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_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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00af: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			Transform val = FindPlayer(force: false);
			Vector3 val2 = RefPosition();
			float value = Plugin.AutoCollectRadius.Value;
			float num = value * value;
			for (int num2 = targets.Count - 1; num2 >= 0; num2--)
			{
				PackInfo packInfo = targets[num2];
				if ((Object)(object)packInfo.t == (Object)null)
				{
					collected.Add(packInfo.key);
					targets.RemoveAt(num2);
				}
				else
				{
					Vector3 position = packInfo.t.position;
					packInfo.dist = Vector3.Distance(val2, position);
					if ((Object)(object)val != (Object)null && value > 0f && !packInfo.collected)
					{
						Vector3 val3 = val.position - position;
						if (((Vector3)(ref val3)).sqrMagnitude <= num)
						{
							packInfo.collected = true;
							collected.Add(packInfo.key);
						}
					}
				}
			}
			targets.Sort((PackInfo a, PackInfo b) => a.dist.CompareTo(b.dist));
		}

		private int VisibleCount()
		{
			int num = 0;
			foreach (PackInfo target in targets)
			{
				if (!Plugin.HideCollected.Value || !target.collected)
				{
					num++;
				}
			}
			return num;
		}

		private void EnsureFreshScan()
		{
			if (scanning)
			{
				ScanNowSync();
			}
			else if (targets.Count == 0 || Time.unscaledTime - lastScanDone > 8f)
			{
				ScanNowSync();
			}
			Tick();
		}

		private void TeleportBest(bool next)
		{
			EnsureFreshScan();
			PackInfo packInfo = null;
			PackInfo packInfo2 = null;
			foreach (PackInfo target in targets)
			{
				if (!target.collected)
				{
					if (packInfo2 == null)
					{
						packInfo2 = target;
					}
					if (!next || !((Object)(object)lastTarget != (Object)null) || !((Object)(object)target.t == (Object)(object)lastTarget))
					{
						packInfo = target;
						break;
					}
				}
			}
			if (packInfo == null)
			{
				packInfo = packInfo2;
			}
			if (packInfo == null)
			{
				Notify("No packs found (or all collected)");
			}
			else
			{
				Teleport(packInfo);
			}
		}

		private void Teleport(PackInfo p)
		{
			//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_0041: 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)
			if ((Object)(object)p.t == (Object)null)
			{
				Notify("Pack is gone");
				return;
			}
			lastTarget = p.t;
			TeleportTo(p.t.position + Vector3.up * Plugin.TeleportHeightM.Value, Short(p.name));
		}

		private void InitLevels()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			levelsLoaded = true;
			for (int i = 0; i < levelSet.Length; i++)
			{
				levelPos[i] = DefaultLevels[i];
				levelSet[i] = true;
			}
		}

		private void TeleportLevel(int dir)
		{
			//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_003c: 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_006a: 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)
			if (!levelsLoaded)
			{
				InitLevels();
			}
			Vector3 val = RefPosition();
			int num = -1;
			if (lastLevelIdx >= 0 && lastLevelIdx < levelSet.Length && Vector3.Distance(levelPos[lastLevelIdx], val) < 80f)
			{
				num = lastLevelIdx;
			}
			else
			{
				float num2 = float.MaxValue;
				for (int i = 0; i < levelSet.Length; i++)
				{
					float num3 = Vector3.Distance(levelPos[i], val);
					if (num3 < num2)
					{
						num2 = num3;
						num = i;
					}
				}
			}
			int num4 = num + dir;
			if (num4 < 0 || num4 >= levelSet.Length)
			{
				Notify((dir > 0) ? "This is the last level" : "This is the first level");
			}
			else
			{
				TeleportLevelTo(num4);
			}
		}

		private void TeleportLevelTo(int idx)
		{
			//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_003c: 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)
			if (!levelsLoaded)
			{
				InitLevels();
			}
			if (idx >= 0 && idx < levelSet.Length)
			{
				lastLevelIdx = idx;
				TeleportTo(levelPos[idx] + Vector3.up * 0.5f, LevelLabels[idx].Trim());
			}
		}

		private void TeleportTo(Vector3 dest, string label)
		{
			//IL_001d: 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_0024: 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_0032: 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_00d6: 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_0076: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			Transform val = FindPlayer(force: true);
			if ((Object)(object)val == (Object)null)
			{
				Notify("Player not found! Check PlayerNames in the config");
				return;
			}
			Vector3 val2 = dest - val.position;
			List<Rigidbody> list = GetPlayerRbs();
			val.position = dest;
			foreach (Rigidbody item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					Transform transform = ((Component)item).transform;
					if (!((Object)(object)transform == (Object)(object)val) && !transform.IsChildOf(val))
					{
						transform.position += val2;
					}
				}
			}
			try
			{
				Physics.SyncTransforms();
			}
			catch (Exception)
			{
			}
			foreach (Rigidbody item2 in list)
			{
				if (!((Object)(object)item2 == (Object)null))
				{
					try
					{
						item2.velocity = Vector3.zero;
						item2.angularVelocity = Vector3.zero;
					}
					catch (Exception)
					{
					}
				}
			}
			Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				try
				{
					component.position = dest;
				}
				catch (Exception)
				{
				}
			}
			if (Plugin.CloseOnTeleport.Value)
			{
				menuOpen = false;
			}
			Notify("Teleported: " + label);
		}

		private static Color G(float v)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return new Color(v, v, v, 1f);
		}

		private static Texture2D Tex(float r, float g, float b, float a)
		{
			//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_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, new Color(r, g, b, a));
			val.Apply();
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private static GUIStyle MakeStyle(int size, Color col, TextAnchor anchor, bool bold)
		{
			//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_000c: 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)
			//IL_001a: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			GUIStyle val = new GUIStyle
			{
				fontSize = size,
				fontStyle = (FontStyle)(bold ? 1 : 0),
				alignment = anchor
			};
			val.normal.textColor = col;
			return val;
		}

		private void InitStyles()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//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_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00de: 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_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: 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)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: 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)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			stylesReady = true;
			white = Tex(1f, 1f, 1f, 1f);
			icons = (Texture2D[])(object)new Texture2D[5];
			for (int i = 0; i < 5; i++)
			{
				icons[i] = MakeIcon(i);
			}
			gradTex = new Texture2D(256, 1);
			Color val = default(Color);
			((Color)(ref val))..ctor(0.3f, 0.6f, 1f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.72f, 0.35f, 0.95f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.98f, 0.8f, 0.25f);
			for (int j = 0; j < 256; j++)
			{
				float num = (float)j / 255f;
				Color val4 = ((num < 0.5f) ? Color.Lerp(val, val2, num * 2f) : Color.Lerp(val2, val3, (num - 0.5f) * 2f));
				gradTex.SetPixel(j, 0, val4);
			}
			((Texture)gradTex).wrapMode = (TextureWrapMode)1;
			gradTex.Apply();
			((Object)gradTex).hideFlags = (HideFlags)61;
			patternTex = new Texture2D(712, 8);
			for (int k = 0; k < 8; k++)
			{
				for (int l = 0; l < 712; l++)
				{
					patternTex.SetPixel(l, k, (((l + k) & 1) == 0) ? G(0.047f) : G(0.078f));
				}
			}
			((Texture)patternTex).filterMode = (FilterMode)0;
			((Texture)patternTex).wrapMode = (TextureWrapMode)1;
			patternTex.Apply();
			((Object)patternTex).hideFlags = (HideFlags)61;
			sText = MakeStyle(11, G(0.8f), (TextAnchor)3, bold: false);
			sTextR = MakeStyle(11, G(0.62f), (TextAnchor)5, bold: false);
			sTextC = MakeStyle(11, G(0.88f), (TextAnchor)4, bold: false);
			sTextDim = MakeStyle(11, G(0.48f), (TextAnchor)3, bold: false);
			sTextDimR = MakeStyle(11, G(0.48f), (TextAnchor)5, bold: false);
			sTitle = MakeStyle(11, G(0.92f), (TextAnchor)3, bold: true);
			sTab = MakeStyle(9, G(0.5f), (TextAnchor)4, bold: true);
			sBrand = MakeStyle(13, G(0.95f), (TextAnchor)3, bold: true);
			sBrandAcc = MakeStyle(13, cAccent, (TextAnchor)3, bold: true);
			sBindDimR = MakeStyle(11, G(0.42f), (TextAnchor)5, bold: false);
			sBindOnR = MakeStyle(11, cAccent, (TextAnchor)5, bold: true);
			sBind = MakeStyle(11, G(0.8f), (TextAnchor)4, bold: false);
			sBindOn = MakeStyle(11, cAccent, (TextAnchor)4, bold: true);
			sEsp = MakeStyle(14, Color.yellow, (TextAnchor)0, bold: true);
			sEspShadow = MakeStyle(14, new Color(0f, 0f, 0f, 0.85f), (TextAnchor)0, bold: true);
			sTitleC = MakeStyle(11, G(0.92f), (TextAnchor)4, bold: true);
			sToast = MakeStyle(15, Color.white, (TextAnchor)4, bold: true);
			sToast.normal.background = Tex(0f, 0f, 0f, 0.7f);
		}

		private void UpdateAccent()
		{
			//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_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_0048: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01(Plugin.MenuHue.Value);
			cAccent = Color.HSVToRGB(num, 0.8f, 0.77f);
			cAccentDark = Color.HSVToRGB(num, 0.8f, 0.62f);
			sBrandAcc.normal.textColor = cAccent;
			sBindOn.normal.textColor = cAccent;
			sBindOnR.normal.textColor = cAccent;
		}

		private void FillRect(Rect r, Color c)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color = GUI.color;
			GUI.color = c;
			GUI.DrawTexture(r, (Texture)(object)white);
			GUI.color = color;
		}

		private void PatternRect(Rect r)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003f: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			FillRect(r, G(0.0625f));
			if (!((Object)(object)patternTex == (Object)null) && !(Mathf.Abs(((Rect)(ref r)).width - 712f) > 0.5f))
			{
				Color color = GUI.color;
				GUI.color = Color.white;
				for (float num = ((Rect)(ref r)).y; num + 8f <= ((Rect)(ref r)).yMax + 0.01f; num += 8f)
				{
					GUI.DrawTexture(new Rect(((Rect)(ref r)).x, num, 712f, 8f), (Texture)(object)patternTex);
				}
				GUI.color = color;
			}
		}

		private void BorderRect(Rect r, Color c)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), c);
			FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 1f, ((Rect)(ref r)).width, 1f), c);
			FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), c);
			FillRect(new Rect(((Rect)(ref r)).xMax - 1f, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), c);
		}

		private static Rect Inset(Rect r, float d)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref r)).x + d, ((Rect)(ref r)).y + d, ((Rect)(ref r)).width - d * 2f, ((Rect)(ref r)).height - d * 2f);
		}

		private void OnGUI()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			if (!stylesReady)
			{
				InitStyles();
			}
			Event current = Event.current;
			if ((int)current.type == 7)
			{
				if (esp)
				{
					DrawEsp();
				}
				DrawToast();
				DrawWatermark();
			}
			UpdateAccent();
			if (menuOpen)
			{
				DrawMenu(current);
			}
		}

		private static string KeyText(ConfigEntry<string> en)
		{
			if (!(en.Value == "None"))
			{
				return en.Value;
			}
			return "none";
		}

		private void DrawKeybindList(Event e)
		{
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: 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_01a4: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Invalid comparison between Unknown and I4
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Invalid comparison between Unknown and I4
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0408: Invalid comparison between Unknown and I4
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			if (!Plugin.ShowKeybindList.Value)
			{
				return;
			}
			if (!kbInit)
			{
				kbInit = true;
				((Rect)(ref kbWin)).x = (float)Screen.width - 220f;
				((Rect)(ref kbWin)).y = 100f;
			}
			List<string> list = new List<string>();
			List<string> list2 = new List<string>();
			if (esp)
			{
				list.Add("ESP");
				list2.Add(KeyText(Plugin.EspKey));
			}
			if (fly)
			{
				list.Add("Fly");
				list2.Add(KeyText(Plugin.FlyKey));
			}
			if (unlimitedJump)
			{
				list.Add("Unlimited jump");
				list2.Add(KeyText(Plugin.JumpKey));
			}
			if (Plugin.JumpMult.Value > 1.001f)
			{
				list.Add("Jump height");
				list2.Add("x" + Plugin.JumpMult.Value.ToString("0.0"));
			}
			float num = 16f;
			((Rect)(ref kbWin)).width = 190f;
			((Rect)(ref kbWin)).height = 32f + (float)Mathf.Max(1, list.Count) * num + 4f;
			FillRect(kbWin, G(0.047f));
			FillRect(Inset(kbWin, 1f), G(0.235f));
			FillRect(Inset(kbWin, 2f), G(0.157f));
			FillRect(Inset(kbWin, 3f), G(0.235f));
			FillRect(Inset(kbWin, 4f), G(0.078f));
			if ((int)e.type == 7)
			{
				PatternRect(Inset(kbWin, 4f));
				GUI.DrawTexture(new Rect(((Rect)(ref kbWin)).x + 4f, ((Rect)(ref kbWin)).y + 4f, ((Rect)(ref kbWin)).width - 8f, 2f), (Texture)(object)gradTex);
			}
			GUI.Label(new Rect(((Rect)(ref kbWin)).x, ((Rect)(ref kbWin)).y + 7f, ((Rect)(ref kbWin)).width, 18f), "Keybinds", sTitleC);
			float num2 = ((Rect)(ref kbWin)).y + 28f;
			if (list.Count == 0)
			{
				GUI.Label(new Rect(((Rect)(ref kbWin)).x + 12f, num2, ((Rect)(ref kbWin)).width - 24f, num), "nothing active", sTextDim);
			}
			for (int i = 0; i < list.Count; i++)
			{
				GUI.Label(new Rect(((Rect)(ref kbWin)).x + 12f, num2, ((Rect)(ref kbWin)).width - 24f, num), list[i], sText);
				GUI.Label(new Rect(((Rect)(ref kbWin)).x + 12f, num2, ((Rect)(ref kbWin)).width - 24f, num), list2[i], sBindDimR);
				num2 += num;
			}
			if ((int)e.type == 1)
			{
				draggingKb = false;
			}
			if (menuOpen)
			{
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref kbWin)).x, ((Rect)(ref kbWin)).y, ((Rect)(ref kbWin)).width, 24f);
				if ((int)e.type == 0 && e.button == 0 && ((Rect)(ref val)).Contains(e.mousePosition))
				{
					draggingKb = true;
					dragOffKb = e.mousePosition - new Vector2(((Rect)(ref kbWin)).x, ((Rect)(ref kbWin)).y);
					e.Use();
				}
				else if ((int)e.type == 3 && draggingKb)
				{
					((Rect)(ref kbWin)).x = Mathf.Clamp(e.mousePosition.x - dragOffKb.x, 0f, (float)Screen.width - 60f);
					((Rect)(ref kbWin)).y = Mathf.Clamp(e.mousePosition.y - dragOffKb.y, 0f, (float)Screen.height - 40f);
				}
			}
		}

		private void DrawWatermark()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0071: 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_0091: Expected O, but got Unknown
			//IL_008c: 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_00b4: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: 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)
			if (Plugin.ShowWatermark.Value)
			{
				float unscaledDeltaTime = Time.unscaledDeltaTime;
				if (unscaledDeltaTime > 0.0001f)
				{
					fpsSmooth = Mathf.Lerp(fpsSmooth, 1f / unscaledDeltaTime, 0.05f);
				}
				string text = Mathf.RoundToInt(fpsSmooth).ToString();
				string text2 = DateTime.Now.ToString("HH:mm:ss");
				float x = sBrand.CalcSize(new GUIContent("ph3sx")).x;
				float x2 = sBrandAcc.CalcSize(new GUIContent(".cc")).x;
				float x3 = sText.CalcSize(new GUIContent(text + " FPS   " + text2)).x;
				float num = x + x2 + x3 + 44f;
				Rect r = default(Rect);
				((Rect)(ref r))..ctor((float)Screen.width - num - 6f, 6f, num, 20f);
				FillRect(r, new Color(0f, 0f, 0f, 0.62f));
				BorderRect(r, new Color(1f, 1f, 1f, 0.1f));
				float num2 = ((Rect)(ref r)).x + 12f;
				GUI.Label(new Rect(num2, ((Rect)(ref r)).y, x + 2f, ((Rect)(ref r)).height), "ph3sx", sBrand);
				float num3 = num2 + (x - 2f);
				GUI.Label(new Rect(num3, ((Rect)(ref r)).y, x2 + 2f, ((Rect)(ref r)).height), ".cc", sBrandAcc);
				GUI.Label(new Rect(num3 + (x2 + 12f), ((Rect)(ref r)).y, x3 + 4f, ((Rect)(ref r)).height), text + " FPS   " + text2, sText);
			}
		}

		private void DrawToast()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (!(Time.unscaledTime > toastUntil) && toast.Length != 0)
			{
				float num = 560f;
				GUI.Label(new Rect(((float)Screen.width - num) * 0.5f, 40f, num, 32f), toast, sToast);
			}
		}

		private void DrawEspLabel(Camera c, Vector3 wp, string name, Color col, float maxD)
		{
			//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_0008: 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)
			//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_006e: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = c.WorldToScreenPoint(wp);
			if (!(val.z <= 0f))
			{
				float z = val.z;
				if (!(maxD > 0f) || !(z > maxD))
				{
					string text = string.Format("[+] {0}  {1:F0}{2}", name, z, "m");
					float num = val.x - 60f;
					float num2 = (float)Screen.height - val.y - 10f;
					sEsp.normal.textColor = col;
					GUI.Label(new Rect(num + 1f, num2 + 1f, 560f, 28f), text, sEspShadow);
					GUI.Label(new Rect(num, num2, 560f, 28f), text, sEsp);
				}
			}
		}

		private void DrawEsp()
		{
			//IL_008e: 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)
			Camera val = GetCam();
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			int fontSize = Mathf.RoundToInt(Plugin.EspFontSize.Value);
			sEsp.fontSize = fontSize;
			sEspShadow.fontSize = fontSize;
			float value = Plugin.EspDistance.Value;
			bool value2 = Plugin.HideCollected.Value;
			int num = 0;
			foreach (PackInfo target in targets)
			{
				if (!((Object)(object)target.t == (Object)null) && (!value2 || !target.collected))
				{
					DrawEspLabel(val, target.t.position, Short(target.name), Color.yellow, value);
					if (++num >= 80)
					{
						break;
					}
				}
			}
		}

		private bool Check(Event e, float x, ref float y, float w, string label, bool v, ConfigEntry<string> bind = null)
		{
			//IL_0024: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_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_00cb: 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_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			float num = ((bind != null) ? (w - 62f) : w);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(x, y, num, 15f);
			bool flag = ((Rect)(ref val)).Contains(e.mousePosition);
			FillRect(new Rect(x, y + 3f, 9f, 9f), G(0.047f));
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(x + 1f, y + 4f, 7f, 7f);
			if (v)
			{
				FillRect(r, cAccentDark);
				FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 4f), cAccent);
			}
			else
			{
				FillRect(r, flag ? G(0.3f) : G(0.27f));
				FillRect(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 3f, ((Rect)(ref r)).width, 4f), flag ? G(0.26f) : G(0.23f));
			}
			GUI.Label(new Rect(x + 16f, y - 1f, num - 16f, 17f), label, sText);
			if (bind != null)
			{
				BindInline(e, new Rect(x + w - 58f, y - 1f, 58f, 17f), bind);
			}
			y += 18f;
			if ((int)e.type == 0 && e.button == 0 && flag)
			{
				e.Use();
				return !v;
			}
			return v;
		}

		private float Slide(Event e, int id, float x, ref float y, float w, string label, string valueText, float v, float min, float max, float step)
		{
			//IL_0011: 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_006b: 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_011e: 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)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: 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)
			//IL_009a: 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_01b4: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00a8: Invalid comparison between Unknown and I4
			GUI.Label(new Rect(x, y - 2f, w, 15f), label, sText);
			GUI.Label(new Rect(x, y - 2f, w, 15f), valueText, sTextR);
			y += 15f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(x, y - 3f, w, 14f);
			if ((int)e.type == 0 && e.button == 0 && ((Rect)(ref val)).Contains(e.mousePosition))
			{
				activeSlider = id;
			}
			if (activeSlider == id && ((int)e.type == 0 || (int)e.type == 3))
			{
				float num = Mathf.Clamp01((e.mousePosition.x - x) / w);
				v = min + num * (max - min);
				if (step > 0f)
				{
					v = Mathf.Round(v / step) * step;
				}
				v = Mathf.Clamp(v, min, max);
				e.Use();
			}
			float num2 = Mathf.Clamp01((v - min) / (max - min));
			FillRect(new Rect(x, y, w, 7f), G(0.047f));
			FillRect(new Rect(x + 1f, y + 1f, w - 2f, 5f), G(0.27f));
			FillRect(new Rect(x + 1f, y + 3f, w - 2f, 3f), G(0.24f));
			if (num2 > 0f)
			{
				FillRect(new Rect(x + 1f, y + 1f, (w - 2f) * num2, 5f), cAccent);
				FillRect(new Rect(x + 1f, y + 3f, (w - 2f) * num2, 3f), cAccentDark);
			}
			y += 16f;
			return v;
		}

		private bool Btn(Event e, Rect r, string text)
		{
			//IL_0003: 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_0015: 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_0026: 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_0041: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00ca: 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)
			bool flag = ((Rect)(ref r)).Contains(e.mousePosition);
			FillRect(r, G(0.047f));
			FillRect(Inset(r, 1f), G(0.196f));
			FillRect(Inset(r, 2f), flag ? G(0.2f) : G(0.153f));
			FillRect(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.5f, ((Rect)(ref r)).width - 4f, ((Rect)(ref r)).height * 0.5f - 2f), flag ? G(0.18f) : G(0.137f));
			GUI.Label(r, text, sTextC);
			if ((int)e.type == 0 && e.button == 0 && flag)
			{
				e.Use();
				return true;
			}
			return false;
		}

		private void BindInline(Event e, Rect r, ConfigEntry<string> entry)
		{
			//IL_0034: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			bool flag = listening == entry;
			string text = (flag ? "..." : ((entry.Value == "None") ? "none" : entry.Value));
			GUI.Label(r, text, flag ? sBindOnR : sBindDimR);
			if ((int)e.type == 0 && e.button == 1 && ((Rect)(ref r)).Contains(e.mousePosition))
			{
				listening = (flag ? null : entry);
				e.Use();
			}
		}

		private bool BtnBind(Event e, Rect r, string text, ConfigEntry<string> entry)
		{
			//IL_0003: 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_003c: 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_004d: 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_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)
			//IL_0081: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			bool flag = ((Rect)(ref r)).Contains(e.mousePosition);
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(((Rect)(ref r)).xMax - 52f, ((Rect)(ref r)).y, 46f, ((Rect)(ref r)).height);
			FillRect(r, G(0.047f));
			FillRect(Inset(r, 1f), G(0.196f));
			FillRect(Inset(r, 2f), flag ? G(0.2f) : G(0.153f));
			FillRect(new Rect(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + ((Rect)(ref r)).height * 0.5f, ((Rect)(ref r)).width - 4f, ((Rect)(ref r)).height * 0.5f - 2f), flag ? G(0.18f) : G(0.137f));
			GUI.Label(new Rect(((Rect)(ref r)).x + 8f, ((Rect)(ref r)).y, ((Rect)(ref r)).width - 60f, ((Rect)(ref r)).height), text, sText);
			BindInline(e, r2, entry);
			if ((int)e.type == 0 && e.button == 0 && flag && !((Rect)(ref r2)).Contains(e.mousePosition))
			{
				e.Use();
				return true;
			}
			return false;
		}

		private void Group(Rect r, string title)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0033: 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_007c: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			FillRect(r, G(0.047f));
			FillRect(Inset(r, 1f), G(0.157f));
			FillRect(Inset(r, 2f), G(0.09f));
			float num = (float)title.Length * 6.4f + 10f;
			FillRect(new Rect(((Rect)(ref r)).x + 8f, ((Rect)(ref r)).y - 1f, num, 4f), G(0.078f));
			GUI.Label(new Rect(((Rect)(ref r)).x + 12f, ((Rect)(ref r)).y - 8f, num, 16f), title, sTitle);
		}

		private static bool Gear(float px, float py, float R, int n, float hole)
		{
			float num = Mathf.Sqrt(px * px + py * py);
			if (num > R || num < hole)
			{
				return false;
			}
			if (num <= R * 0.78f)
			{
				return true;
			}
			return Mathf.Cos((float)n * Mathf.Atan2(py, px)) > 0.15f;
		}

		private static bool IconHit(int kind, float x, float y)
		{
			float num = x - 22f;
			float num2 = y - 22f;
			float num3 = Mathf.Sqrt(num * num + num2 * num2);
			switch (kind)
			{
			case 0:
				if (num3 <= 12.5f)
				{
					if (!(num3 >= 10f))
					{
						return num < 0f;
					}
					return true;
				}
				if (num3 >= 15.5f && num3 <= 20f)
				{
					float num9 = Mathf.Repeat(Mathf.Atan2(num2, num) + (float)Math.PI / 8f, (float)Math.PI / 4f) - (float)Math.PI / 8f;
					return num3 * Mathf.Abs(Mathf.Sin(num9)) <= 1.2f;
				}
				return false;
			case 1:
				if (num3 >= 11f && num3 <= 13.5f)
				{
					return true;
				}
				if (num3 <= 1.8f)
				{
					return true;
				}
				if (Mathf.Abs(num) <= 1.1f && Mathf.Abs(num2) >= 6f && Mathf.Abs(num2) <= 19f)
				{
					return true;
				}
				if (Mathf.Abs(num2) <= 1.1f && Mathf.Abs(num) >= 6f && Mathf.Abs(num) <= 19f)
				{
					return true;
				}
				return false;
			case 2:
			{
				float num6 = num2 + 9.5f;
				if (num * num + num6 * num6 <= 38.44f)
				{
					return true;
				}
				float num7 = num / 13.5f;
				float num8 = (num2 - 17f) / 17f;
				if (num7 * num7 + num8 * num8 <= 1f && num2 <= 16f)
				{
					return num2 >= -1.5f;
				}
				return false;
			}
			case 4:
			{
				if (num < -17f || num >= 17f || num2 > 14f)
				{
					return false;
				}
				int num4 = Mathf.FloorToInt((num + 17f) / 8.5f);
				float num5 = 14f - 7f * (float)(num4 + 1);
				return num2 >= num5;
			}
			default:
				if (Gear(num + 3f, num2 - 4f, 11f, 8, 4f))
				{
					return true;
				}
				if (Gear(num - 10f, num2 + 10f, 7.5f, 6, 2.5f))
				{
					return true;
				}
				return false;
			}
		}

		private static Texture2D MakeIcon(int kind)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(44, 44);
			for (int i = 0; i < 44; i++)
			{
				for (int j = 0; j < 44; j++)
				{
					int num = 0;
					for (int k = 0; k < 3; k++)
					{
						for (int l = 0; l < 3; l++)
						{
							if (IconHit(kind, (float)j + ((float)l + 0.5f) / 3f, (float)i + ((float)k + 0.5f) / 3f))
							{
								num++;
							}
						}
					}
					val.SetPixel(j, 43 - i, new Color(1f, 1f, 1f, (float)num / 9f));
				}
			}
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			val.Apply();
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private void DrawIcon(int i, float cx, float cy, Color col)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			if (icons != null && i >= 0 && i < icons.Length)
			{
				Color color = GUI.color;
				GUI.color = col;
				GUI.DrawTexture(new Rect(cx - 22f, cy - 22f, 44f, 44f), (Texture)(object)icons[i]);
				GUI.color = color;
			}
		}

		private void DrawMenu(Event e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0680: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Invalid comparison between Unknown and I4
			//IL_0018: 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_0042: 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_0058: 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_006e: 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_0082: 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_0098: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between Unknown and I4
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_01a6: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Invalid comparison between Unknown and I4
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0323: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Invalid comparison between Unknown and I4
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_051c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			if ((int)e.type == 1)
			{
				dragging = false;
				activeSlider = -1;
			}
			if ((int)e.type == 0 && e.button == 0 && listening != null)
			{
				listening = null;
			}
			FillRect(win, G(0.047f));
			FillRect(Inset(win, 1f), G(0.235f));
			FillRect(Inset(win, 2f), G(0.157f));
			FillRect(Inset(win, 3f), G(0.235f));
			FillRect(Inset(win, 4f), G(0.078f));
			if ((int)e.type == 7)
			{
				PatternRect(Inset(win, 4f));
				GUI.DrawTexture(new Rect(((Rect)(ref win)).x + 4f, ((Rect)(ref win)).y + 4f, ((Rect)(ref win)).width - 8f, 2f), (Texture)(object)gradTex);
			}
			float num = 64f;
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((Rect)(ref win)).x + 3f, ((Rect)(ref win)).y + 5f, num, ((Rect)(ref win)).height - 8f);
			FillRect(r, G(0.047f));
			FillRect(new Rect(((Rect)(ref r)).xMax - 1f, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), G(0.157f));
			FillRect(new Rect(((Rect)(ref r)).xMax, ((Rect)(ref r)).y, 1f, ((Rect)(ref r)).height), G(0f));
			string[] array = new string[4] { "ESP", "Levels", "Movement", "Misc" };
			int[] array2 = new int[4] { 0, 4, 2, 3 };
			Rect val = default(Rect);
			for (int i = 0; i < array.Length; i++)
			{
				((Rect)(ref val))..ctor(((Rect)(ref r)).x, ((Rect)(ref r)).y + 6f + (float)i * 58f, ((Rect)(ref r)).width, 58f);
				bool num2 = tab == i;
				bool flag = ((Rect)(ref val)).Contains(e.mousePosition);
				if (num2)
				{
					FillRect(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width + 1f, ((Rect)(ref val)).height), G(0f));
					FillRect(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 1f, ((Rect)(ref val)).width + 1f, ((Rect)(ref val)).height - 2f), G(0.157f));
					FillRect(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 2f, ((Rect)(ref val)).width + 1f, ((Rect)(ref val)).height - 4f), G(0.078f));
				}
				Color col = (num2 ? G(0.82f) : (flag ? G(0.66f) : G(0.35f)));
				DrawIcon(array2[i], ((Rect)(ref val)).x + ((Rect)(ref val)).width * 0.5f, ((Rect)(ref val)).y + ((Rect)(ref val)).height * 0.5f, col);
				if ((int)e.type == 0 && e.button == 0 && flag)
				{
					tab = i;
					e.Use();
				}
			}
			float num3 = ((Rect)(ref r)).xMax + 16f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(((Rect)(ref r)).xMax + 1f, ((Rect)(ref win)).y + 5f, ((Rect)(ref win)).xMax - ((Rect)(ref r)).xMax - 4f, 26f);
			GUI.Label(new Rect(num3, ((Rect)(ref win)).y + 9f, 60f, 18f), "ph3sx", sBrand);
			GUI.Label(new Rect(num3 + 40f, ((Rect)(ref win)).y + 9f, 40f, 18f), ".cc", sBrandAcc);
			GUI.Label(new Rect(((Rect)(ref win)).xMax - 240f, ((Rect)(ref win)).y + 9f, 226f, 18f), array[tab] + "  |  v1.1.1", sTextDimR);
			if ((int)e.type == 0 && e.button == 0 && ((Rect)(ref val2)).Contains(e.mousePosition))
			{
				dragging = true;
				dragOff = e.mousePosition - new Vector2(((Rect)(ref win)).x, ((Rect)(ref win)).y);
				e.Use();
			}
			else if ((int)e.type == 3 && dragging)
			{
				((Rect)(ref win)).x = Mathf.Clamp(e.mousePosition.x - dragOff.x, 0f, (float)Screen.width - 80f);
				((Rect)(ref win)).y = Mathf.Clamp(e.mousePosition.y - dragOff.y, 0f, (float)Screen.height - 60f);
			}
			float num4 = num3;
			float num5 = ((Rect)(ref win)).y + 44f;
			float num6 = ((Rect)(ref win)).xMax - num4 - 16f;
			float ch = ((Rect)(ref win)).yMax - num5 - 16f;
			try
			{
				if (tab == 0)
				{
					DrawTabEsp(e, num4, num5, num6, ch);
				}
				else if (tab == 1)
				{
					DrawTabLevels(e, num4, num5, num6, ch);
				}
				else if (tab == 2)
				{
					DrawTabMovement(e, num4, num5, num6, ch);
				}
				else
				{
					DrawTabMisc(e, num4, num5, num6, ch);
				}
			}
			catch (Exception ex)
			{
				GUI.Label(new Rect(num4, num5, num6, 60f), "UI error: " + ex.Message, sTextDim);
				if ((int)e.type == 7)
				{
					Plugin.Logger.LogError((object)("UI error: " + ex));
				}
			}
			if (((int)e.type == 0 || (int)e.type == 6) && ((Rect)(ref win)).Contains(e.mousePosition))
			{
				e.Use();
			}
		}

		private void DrawTabEsp(Event e, float cx, float cy, float cw, float ch)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			float num = (cw - 16f) / 2f;
			float num2 = 190f;
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(cx, cy, num, num2);
			Group(r, "ESP");
			float y = ((Rect)(ref r)).y + 18f;
			float x = ((Rect)(ref r)).x + 14f;
			float w = ((Rect)(ref r)).width - 28f;
			bool flag = Check(e, x, ref y, w, "Enable ESP", esp, Plugin.EspKey);
			if (flag != esp)
			{
				SetEsp(flag);
			}
			bool flag2 = Check(e, x, ref y, w, "Hide collected", Plugin.HideCollected.Value);
			if (flag2 != Plugin.HideCollected.Value)
			{
				Plugin.HideCollected.Value = flag2;
			}
			y += 8f;
			float value = Plugin.EspDistance.Value;
			string valueText = ((value <= 0f) ? "unlimited" : (Mathf.RoundToInt(value) + " m"));
			float num3 = Slide(e, 1, x, ref y, w, "Range", valueText, value, 0f, 500f, 10f);
			if (Mathf.Abs(num3 - value) > 0.01f)
			{
				Plugin.EspDistance.Value = num3;
			}
			float value2 = Plugin.EspFontSize.Value;
			float num4 = Slide(e, 2, x, ref y, w, "Text size", Mathf.RoundToInt(value2) + " px", value2, 10f, 28f, 1f);
			if (Mathf.Abs(num4 - value2) > 0.01f)
			{
				Plugin.EspFontSize.Value = num4;
			}
			Rect r2 = default(Rect);
			((Rect)(ref r2))..ctor(cx + num + 16f, cy, num, num2);
			Group(r2, "Collect / scan");
			y = ((Rect)(ref r2)).y + 18f;
			x = ((Rect)(ref r2)).x + 14f;
			w = ((Rect)(ref r2)).width - 28f;
			float value3 = Plugin.AutoCollectRadius.Value;
			string valueText2 = ((value3 <= 0f) ? "off" : (value3.ToString("0.0") + " m"));
			float num5 = Slide(e, 3, x, ref y, w, "Auto-collect radius", valueText2, value3, 0f, 10f, 0.5f);
			if (Mathf.Abs(num5 - value3) > 0.01f)
			{
				Plugin.AutoCollectRadius.Value = num5;
			}
			float value4 = Plugin.ScanIntervalSec.Value;
			float num6 = Slide(e, 4, x, ref y, w, "Scan interval", value4.ToString("0.0") + " s", value4, 1f, 15f, 0.5f);
			if (Mathf.Abs(num6 - value4) > 0.01f)
			{
				Plugin.ScanIntervalSec.Value = num6;
			}
			y += 4f;
			float num7 = (w - 8f) / 2f;
			if (Btn(e, new Rect(x, y, num7, 22f), "Rescan"))
			{
				ScanNowSync();
				Notify("Found: " + VisibleCount());
			}
			if (Btn(e, new Rect(x + num7 + 8f, y, num7, 22f), "Reset collected"))
			{
				collected.Clear();
				seenVisible.Clear();
				foreach (PackInfo target in targets)
				{
					target.collected = false;
				}
				Notify("Collected list reset");
			}
			y += 30f;
			int num8 = targets.Count - VisibleCount();
			GUI.Label(new Rect(x, y, w, 16f), "Packs: " + VisibleCount() + "   hidden: " + num8, sTextDim);
			List<PackInfo> list = new List<PackInfo>();
			bool value5 = Plugin.HideCollected.Value;
			foreach (PackInfo target2 in targets)
			{
				if (!value5 || !target2.collected)
				{
					list.Add(target2);
				}
			}
			if (Plugin.SortByName.Value)
			{
				list.Sort((PackInfo a, PackInfo b) => string.CompareOrdinal(a.name, b.name));
			}
			float num9 = ((Rect)(ref r)).yMax + 16f;
			Rect r3 = default(Rect);
			((Rect)(ref r3))..ctor(cx, num9, cw, cy + ch - num9);
			Group(r3, "Packs (" + list.Count + ")");
			x = ((Rect)(ref r3)).x + 14f;
			w = ((Rect)(ref r3)).width - 28f;
			y = ((Rect)(ref r3)).y + 16f;
			float num10 = (w - 8f) / 2f;
			if (BtnBind(e, new Rect(x, y, num10, 24f), "Teleport to nearest", Plugin.NearestKey))
			{
				TeleportBest(next: false);
			}
			if (BtnBind(e, new Rect(x + num10 + 8f, y, num10, 24f), "Teleport to next", Plugin.NextKey))
			{
				TeleportBest(next: true);
			}
			y += 32f;
			float y2 = y;
			bool flag3 = Check(e, x, ref y2, w / 2f, "Sort by name", Plugin.SortByName.Value);
			if (flag3 != Plugin.SortByName.Value)
			{
				Plugin.SortByName.Value = flag3;
			}
			y2 = y;
			bool flag4 = Check(e, x + w / 2f, ref y2, w / 2f, "Close menu after TP", Plugin.CloseOnTeleport.Value);
			if (flag4 != Plugin.CloseOnTeleport.Value)
			{
				Plugin.CloseOnTeleport.Value = flag4;
			}
			y += 24f;
			Rect listRect = default(Rect);
			((Rect)(ref listRect))..ctor(((Rect)(ref r3)).x + 10f, y, ((Rect)(ref r3)).width - 20f, ((Rect)(ref r3)).yMax - y - 10f);
			DrawList(e, listRect, list, ref scrollPacks, out var tp, out var hide, "No packs found. Press Rescan or move closer.");
			if (hide != null)
			{
				hide.collected = true;
				collected.Add(hide.key);
			}
			if (tp != null)
			{
				Teleport(tp);
			}
		}

		private void DrawList(Event e, Rect listRect, List<PackInfo> items, ref Vector2 sc, out PackInfo tp, out PackInfo hide, string emptyText)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Invalid comparison between Unknown and I4
			//IL_003e: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: 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_0239: 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)
			tp = null;
			hide = null;
			float num = 22f;
			int num2 = Mathf.Max(1, Mathf.FloorToInt(((Rect)(ref listRect)).height / num));
			int num3 = Mathf.Max(0, items.Count - num2);
			if ((int)e.type == 6 && ((Rect)(ref listRect)).Contains(e.mousePosition))
			{
				sc.y = Mathf.Clamp(sc.y + ((e.delta.y > 0f) ? 2f : (-2f)), 0f, (float)num3);
				e.Use();
			}
			sc.y = Mathf.Clamp(Mathf.Round(sc.y), 0f, (float)num3);
			if (items.Count == 0)
			{
				GUI.Label(listRect, emptyText, sTextDim);
				return;
			}
			int num4 = (int)sc.y;
			float num5 = ((Rect)(ref listRect)).width - 8f;
			PackInfo packInfo = null;
			PackInfo packInfo2 = null;
			Rect r = default(Rect);
			Rect r2 = default(Rect);
			for (int i = 0; i < num2 && num4 + i < items.Count; i++)
			{
				PackInfo pack