Decompiled source of BestModMenu v1.0.0

BepInEx/plugins/BestModMenu/ValuableESP.dll

Decompiled a day ago
using System;
using System.Collections;
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 Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ValuableESP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ValuableESP")]
[assembly: AssemblyTitle("ValuableESP")]
[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 ValuableESP
{
	internal static class EnemySpawner
	{
		internal sealed class Entry
		{
			internal string Name;

			internal object Setup;

			internal GameObject Prefab;

			internal string Path;
		}

		private static readonly List<Entry> s_catalog = new List<Entry>();

		private static bool s_resolved;

		private static string s_builtScene = "\0";

		private static Type s_setupType;

		private static Type s_prefabRefType;

		private static Type s_enemyType;

		private static Type s_parentType;

		private static FieldInfo s_directorInstance;

		private static FieldInfo s_enemyList;

		private static FieldInfo s_debugEnemy;

		private static FieldInfo s_diff1;

		private static FieldInfo s_diff2;

		private static FieldInfo s_diff3;

		private static FieldInfo s_spawnObjects;

		private static FieldInfo s_prefabName;

		private static FieldInfo s_enemyName;

		private static FieldInfo s_parentSetupDone;

		private static FieldInfo s_generatorInstance;

		private static MethodInfo s_enemySpawn;

		private static MethodInfo s_enemyTeleported;

		private static MethodInfo s_setPrefab;

		private static FieldInfo s_runManagerInstance;

		private static FieldInfo s_multiplayerPool;

		private static FieldInfo s_singleplayerPool;

		private static FieldInfo s_resourceCache;

		internal static int SelectedIndex;

		internal static int Count => s_catalog.Count;

		internal static string SelectedName
		{
			get
			{
				if (s_catalog.Count == 0)
				{
					return "(no enemies yet)";
				}
				SelectedIndex = Mathf.Clamp(SelectedIndex, 0, s_catalog.Count - 1);
				return s_catalog[SelectedIndex].Name;
			}
		}

		internal static string NameAt(int index)
		{
			if (index < 0 || index >= s_catalog.Count)
			{
				return string.Empty;
			}
			return s_catalog[index].Name;
		}

		private static void Resolve()
		{
			if (!s_resolved)
			{
				s_resolved = true;
				Assembly assembly = typeof(ValuableObject).Assembly;
				s_setupType = assembly.GetType("EnemySetup");
				s_prefabRefType = assembly.GetType("PrefabRef");
				s_enemyType = assembly.GetType("Enemy");
				s_parentType = assembly.GetType("EnemyParent");
				Type type = assembly.GetType("EnemyDirector");
				Type type2 = assembly.GetType("LevelGenerator");
				Type type3 = assembly.GetType("RunManager");
				Type type4 = assembly.GetType("MultiplayerPool");
				if (type != null)
				{
					s_directorInstance = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					s_enemyList = type.GetField("enemyList", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					s_debugEnemy = type.GetField("debugEnemy", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					s_diff1 = type.GetField("enemiesDifficulty1", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					s_diff2 = type.GetField("enemiesDifficulty2", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					s_diff3 = type.GetField("enemiesDifficulty3", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				}
				if (s_setupType != null)
				{
					s_spawnObjects = s_setupType.GetField("spawnObjects", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				}
				if (s_prefabRefType != null)
				{
					s_prefabName = FindField(s_prefabRefType, "prefabName");
					s_setPrefab = s_prefabRefType.GetMethod("SetPrefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
					{
						typeof(GameObject),
						typeof(string)
					}, null);
				}
				if (s_parentType != null)
				{
					s_enemyName = s_parentType.GetField("enemyName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					s_parentSetupDone = s_parentType.GetField("SetupDone", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				}
				if (s_enemyType != null)
				{
					s_enemyTeleported = s_enemyType.GetMethod("EnemyTeleported", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Vector3) }, null);
				}
				if (type2 != null)
				{
					s_generatorInstance = type2.GetField("Instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					s_enemySpawn = type2.GetMethod("EnemySpawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
					{
						s_setupType,
						typeof(Vector3)
					}, null);
				}
				if (type3 != null)
				{
					s_runManagerInstance = type3.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					s_multiplayerPool = type3.GetField("multiplayerPool", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					s_singleplayerPool = type3.GetField("singleplayerPool", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				}
				if (type4 != null)
				{
					s_resourceCache = type4.GetField("ResourceCache", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				}
				ModLog.Info("enemy spawn: setup=" + (s_setupType != null) + " ref=" + (s_prefabRefType != null) + " list=" + (s_enemyList != null) + " debug=" + (s_debugEnemy != null) + " diff=" + (s_diff1 != null && s_diff2 != null && s_diff3 != null) + " assets=" + (s_spawnObjects != null) + " spawn=" + (s_enemySpawn != null) + " prefab=" + (s_setPrefab != null));
			}
		}

		internal static void EnsureCatalog()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Resolve();
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (name == s_builtScene && s_catalog.Count > 0)
			{
				return;
			}
			s_builtScene = name;
			if (s_setupType == null)
			{
				return;
			}
			List<Entry> list = new List<Entry>();
			MergeDirector(list);
			MergeSetups(list, Resources.FindObjectsOfTypeAll(s_setupType));
			MergePrefabs(list, Resources.FindObjectsOfTypeAll(s_parentType));
			if (list.Count == 0)
			{
				return;
			}
			Dictionary<GameObject, string> dictionary = CachePaths();
			HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			s_catalog.Clear();
			for (int i = 0; i < list.Count; i++)
			{
				Entry entry = list[i];
				if (!string.IsNullOrEmpty(entry.Name) && hashSet.Add(entry.Name) && (entry.Setup != null || !((Object)(object)entry.Prefab == (Object)null)))
				{
					if ((Object)(object)entry.Prefab != (Object)null && entry.Path == null && dictionary.TryGetValue(entry.Prefab, out var value))
					{
						entry.Path = value;
					}
					s_catalog.Add(entry);
				}
			}
			s_catalog.Sort((Entry a, Entry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
			if (s_catalog.Count == 0)
			{
				s_builtScene = "\0";
			}
			ModLog.Info("enemy spawn: " + s_catalog.Count + " enemies, sample=" + Sample());
		}

		private static void MergeDirector(List<Entry> found)
		{
			if (s_directorInstance == null)
			{
				return;
			}
			object value = s_directorInstance.GetValue(null);
			if (value == null)
			{
				return;
			}
			MergeList(found, (s_enemyList == null) ? null : (s_enemyList.GetValue(value) as IList));
			MergeList(found, (s_diff1 == null) ? null : (s_diff1.GetValue(value) as IList));
			MergeList(found, (s_diff2 == null) ? null : (s_diff2.GetValue(value) as IList));
			MergeList(found, (s_diff3 == null) ? null : (s_diff3.GetValue(value) as IList));
			Array array = ((s_debugEnemy == null) ? null : (s_debugEnemy.GetValue(value) as Array));
			if (array != null)
			{
				for (int i = 0; i < array.Length; i++)
				{
					AddSetup(found, array.GetValue(i));
				}
			}
		}

		private static void MergeList(List<Entry> found, IList list)
		{
			if (list != null)
			{
				for (int i = 0; i < list.Count; i++)
				{
					AddSetup(found, list[i]);
				}
			}
		}

		private static void MergeSetups(List<Entry> found, Object[] assets)
		{
			if (assets == null)
			{
				return;
			}
			for (int i = 0; i < assets.Length; i++)
			{
				if (assets[i] != (Object)null)
				{
					AddSetup(found, assets[i]);
				}
			}
		}

		private static void AddSetup(List<Entry> found, object setup)
		{
			if (setup != null && !(s_spawnObjects == null))
			{
				string text = NameOfSetup(setup);
				if (!string.IsNullOrEmpty(text))
				{
					found.Add(new Entry
					{
						Name = text,
						Setup = setup
					});
				}
			}
		}

		private static void MergePrefabs(List<Entry> found, Object[] assets)
		{
			//IL_0032: 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)
			if (assets == null || s_parentType == null)
			{
				return;
			}
			foreach (Object obj in assets)
			{
				Component val = (Component)(object)((obj is Component) ? obj : null);
				if (!((Object)(object)val == (Object)null))
				{
					GameObject gameObject = val.gameObject;
					_ = gameObject.scene;
					Scene scene = gameObject.scene;
					if (!((Scene)(ref scene)).IsValid() && (!(s_enemyType != null) || !((Object)(object)gameObject.GetComponentInChildren(s_enemyType, true) == (Object)null)))
					{
						string name = Pretty(ParentName(val) ?? ((Object)gameObject).name);
						found.Add(new Entry
						{
							Name = name,
							Prefab = gameObject
						});
					}
				}
			}
		}

		private static string NameOfSetup(object setup)
		{
			IList list = ((s_spawnObjects == null) ? null : (s_spawnObjects.GetValue(setup) as IList));
			if (list == null || list.Count == 0)
			{
				return null;
			}
			object obj = list[0];
			if (obj == null || s_prefabName == null)
			{
				return null;
			}
			string text = s_prefabName.GetValue(obj) as string;
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			return Pretty(text);
		}

		private static string ParentName(Component parent)
		{
			if (s_enemyName == null)
			{
				return null;
			}
			string text = s_enemyName.GetValue(parent) as string;
			if (!string.IsNullOrEmpty(text))
			{
				return text;
			}
			return null;
		}

		private static Dictionary<GameObject, string> CachePaths()
		{
			Dictionary<GameObject, string> dictionary = new Dictionary<GameObject, string>();
			object obj = ((s_runManagerInstance == null) ? null : s_runManagerInstance.GetValue(null));
			if (obj == null)
			{
				return dictionary;
			}
			object obj2 = ((s_multiplayerPool == null) ? null : s_multiplayerPool.GetValue(obj));
			IDictionary dictionary2 = ((obj2 == null || s_resourceCache == null) ? null : (s_resourceCache.GetValue(obj2) as IDictionary));
			if (dictionary2 != null)
			{
				foreach (DictionaryEntry item in dictionary2)
				{
					string text = item.Key as string;
					object? value = item.Value;
					GameObject val = (GameObject)((value is GameObject) ? value : null);
					if (text != null && (Object)(object)val != (Object)null)
					{
						dictionary[val] = text;
					}
				}
			}
			IDictionary dictionary3 = ((s_singleplayerPool == null) ? null : (s_singleplayerPool.GetValue(obj) as IDictionary));
			if (dictionary3 != null)
			{
				foreach (DictionaryEntry item2 in dictionary3)
				{
					string text2 = item2.Key as string;
					object? value2 = item2.Value;
					GameObject val2 = (GameObject)((value2 is GameObject) ? value2 : null);
					if (text2 != null && (Object)(object)val2 != (Object)null && !dictionary.ContainsKey(val2))
					{
						dictionary[val2] = text2;
					}
				}
			}
			return dictionary;
		}

		private static string Sample()
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < s_catalog.Count && i < 8; i++)
			{
				if (i > 0)
				{
					stringBuilder.Append(", ");
				}
				stringBuilder.Append(s_catalog[i].Name);
			}
			if (s_catalog.Count <= 8)
			{
				return stringBuilder.ToString();
			}
			return stringBuilder?.ToString() + ", ...";
		}

		internal static bool SpawnSelected(Camera cam)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_006a: 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_011c: 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)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			EnsureCatalog();
			if ((Object)(object)cam == (Object)null || s_catalog.Count == 0)
			{
				ModLog.Info("enemy spawn: nothing to spawn yet");
				return false;
			}
			Entry entry = s_catalog[Mathf.Clamp(SelectedIndex, 0, s_catalog.Count - 1)];
			Transform transform = ((Component)cam).transform;
			Vector3 position = transform.position + transform.forward * 4f;
			if (entry.Setup != null && (Object)(object)entry.Prefab == (Object)null)
			{
				return SpawnSetup(entry, position);
			}
			object obj = ((s_generatorInstance == null) ? null : s_generatorInstance.GetValue(null));
			bool flag = (Object)(object)GameManager.instance == (Object)null || GameManager.instance.gameMode != 0;
			if (entry.Setup != null && (flag || obj == null))
			{
				return SpawnSetup(entry, position);
			}
			if (flag && !string.IsNullOrEmpty(entry.Path) && obj != null)
			{
				object obj2 = BuildSetup(entry);
				if (obj2 != null)
				{
					return SpawnSetup(new Entry
					{
						Name = entry.Name,
						Setup = obj2
					}, position);
				}
			}
			return SpawnPrefab(entry, position);
		}

		private unsafe static bool SpawnSetup(Entry entry, Vector3 position)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			object obj = ((s_generatorInstance == null) ? null : s_generatorInstance.GetValue(null));
			if (obj == null || s_enemySpawn == null)
			{
				ModLog.Info("enemy spawn: no LevelGenerator in this scene");
				return false;
			}
			try
			{
				s_enemySpawn.Invoke(obj, new object[2] { entry.Setup, position });
			}
			catch (Exception e)
			{
				ModLog.Error("enemy spawn: " + entry.Name, e);
				return false;
			}
			string name = entry.Name;
			Vector3 val = position;
			ModLog.Info("enemy spawn: " + name + " at " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString());
			return true;
		}

		private static object BuildSetup(Entry entry)
		{
			if ((Object)(object)entry.Prefab == (Object)null || string.IsNullOrEmpty(entry.Path) || s_setPrefab == null)
			{
				return null;
			}
			try
			{
				object obj = ScriptableObject.CreateInstance(s_setupType);
				object obj2 = Activator.CreateInstance(s_prefabRefType);
				s_setPrefab.Invoke(obj2, new object[2] { entry.Prefab, entry.Path });
				IList list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(s_prefabRefType));
				list.Add(obj2);
				s_spawnObjects.SetValue(obj, list);
				return obj;
			}
			catch (Exception e)
			{
				ModLog.Error("enemy spawn: could not build a setup for " + entry.Name, e);
				return null;
			}
		}

		private unsafe static bool SpawnPrefab(Entry entry, Vector3 position)
		{
			//IL_0017: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)entry.Prefab == (Object)null)
			{
				return false;
			}
			try
			{
				GameObject val = Object.Instantiate<GameObject>(entry.Prefab, position, Quaternion.identity);
				Component component = val.GetComponent(s_parentType);
				if ((Object)(object)component != (Object)null && s_parentSetupDone != null)
				{
					s_parentSetupDone.SetValue(component, true);
				}
				Component val2 = ((s_enemyType == null) ? null : val.GetComponentInChildren(s_enemyType, true));
				if ((Object)(object)val2 != (Object)null && s_enemyTeleported != null)
				{
					s_enemyTeleported.Invoke(val2, new object[1] { position });
				}
				string[] obj = new string[5] { "enemy spawn: ", entry.Name, " at ", null, null };
				Vector3 val3 = position;
				obj[3] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString();
				obj[4] = " (local, no resource path)";
				ModLog.Info(string.Concat(obj));
				return true;
			}
			catch (Exception e)
			{
				ModLog.Error("enemy spawn: " + entry.Name, e);
				return false;
			}
		}

		private static string Pretty(string raw)
		{
			string text = raw ?? string.Empty;
			int num = text.LastIndexOf('/');
			if (num >= 0)
			{
				text = text.Substring(num + 1);
			}
			if (text.StartsWith("Enemy - "))
			{
				text = text.Substring("Enemy - ".Length);
			}
			if (text.StartsWith("Enemy Group - "))
			{
				text = text.Substring("Enemy Group - ".Length);
			}
			if (text.EndsWith("(Clone)"))
			{
				text = text.Substring(0, text.Length - "(Clone)".Length);
			}
			text = text.Trim();
			if (text.Length != 0)
			{
				return text;
			}
			return raw;
		}

		private static FieldInfo FindField(Type type, string name)
		{
			while (type != null)
			{
				FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					return field;
				}
				type = type.BaseType;
			}
			return null;
		}
	}
	internal static class ItemSpawner
	{
		internal sealed class Entry
		{
			internal string Name;

			internal object Item;
		}

		private static bool s_resolved;

		private static bool s_available;

		private static FieldInfo s_statsInstance;

		private static FieldInfo s_itemDictionary;

		private static FieldInfo s_prefabField;

		private static FieldInfo s_itemNameField;

		private static FieldInfo s_disabledField;

		private static MethodInfo s_prefabGet;

		private static MethodInfo s_resourcePathGet;

		private static readonly List<Entry> s_catalog = new List<Entry>();

		private static bool s_loggedFailure;

		internal static int SelectedIndex;

		internal static int Count => s_catalog.Count;

		internal static bool Ready => s_catalog.Count > 0;

		internal static string SelectedName
		{
			get
			{
				if (s_catalog.Count == 0)
				{
					return "(no items)";
				}
				SelectedIndex = Mathf.Clamp(SelectedIndex, 0, s_catalog.Count - 1);
				return s_catalog[SelectedIndex].Name;
			}
		}

		internal static string NameAt(int index)
		{
			if (index < 0 || index >= s_catalog.Count)
			{
				return string.Empty;
			}
			return s_catalog[index].Name;
		}

		private static void Resolve()
		{
			if (s_resolved)
			{
				return;
			}
			s_resolved = true;
			Assembly assembly = typeof(ValuableObject).Assembly;
			Type type = assembly.GetType("StatsManager");
			Type type2 = assembly.GetType("Item");
			if (type == null || type2 == null)
			{
				ModLog.Info("item spawn: StatsManager or Item type not found");
				return;
			}
			s_statsInstance = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			s_itemDictionary = type.GetField("itemDictionary", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			s_prefabField = type2.GetField("prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			s_itemNameField = type2.GetField("itemName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			s_disabledField = type2.GetField("disabled", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (s_prefabField != null)
			{
				Type fieldType = s_prefabField.FieldType;
				s_prefabGet = fieldType.GetMethod("get_Prefab", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				s_resourcePathGet = fieldType.GetMethod("get_ResourcePath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			}
			s_available = s_statsInstance != null && s_itemDictionary != null && s_prefabField != null;
			ModLog.Info("item spawn: stats=" + (s_statsInstance != null) + " dictionary=" + (s_itemDictionary != null) + " prefab=" + (s_prefabField != null) + " path=" + (s_resourcePathGet != null));
		}

		internal static void EnsureCatalog()
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (s_catalog.Count > 0)
			{
				return;
			}
			Resolve();
			if (!s_available)
			{
				return;
			}
			object value = s_statsInstance.GetValue(null);
			if (value == null || !(s_itemDictionary.GetValue(value) is IDictionary { Count: not 0 } dictionary))
			{
				return;
			}
			s_catalog.Clear();
			bool flag = default(bool);
			foreach (DictionaryEntry item in dictionary)
			{
				object value2 = item.Value;
				if (value2 == null)
				{
					continue;
				}
				if (s_disabledField != null)
				{
					object value3 = s_disabledField.GetValue(value2);
					int num;
					if (value3 is bool)
					{
						flag = (bool)value3;
						num = 1;
					}
					else
					{
						num = 0;
					}
					if (((uint)num & (flag ? 1u : 0u)) != 0)
					{
						continue;
					}
				}
				string text = null;
				if (s_itemNameField != null)
				{
					text = s_itemNameField.GetValue(value2) as string;
				}
				if (string.IsNullOrEmpty(text))
				{
					text = item.Key as string;
				}
				if (string.IsNullOrEmpty(text))
				{
					text = ((Object)value2).name;
				}
				if (!string.IsNullOrEmpty(text))
				{
					s_catalog.Add(new Entry
					{
						Name = text,
						Item = value2
					});
				}
			}
			s_catalog.Sort((Entry a, Entry b) => string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase));
			ModLog.Info("item spawn: " + s_catalog.Count + " items in the catalogue");
		}

		internal static bool SpawnSelected(Camera cam)
		{
			//IL_0107: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			EnsureCatalog();
			if ((Object)(object)cam == (Object)null || s_catalog.Count == 0)
			{
				if (!s_loggedFailure)
				{
					s_loggedFailure = true;
					ModLog.Info("item spawn: nothing to spawn yet");
				}
				return false;
			}
			Entry entry = s_catalog[Mathf.Clamp(SelectedIndex, 0, s_catalog.Count - 1)];
			object value = s_prefabField.GetValue(entry.Item);
			if (value == null)
			{
				ModLog.Info("item spawn: " + entry.Name + " has no prefab");
				return false;
			}
			if (s_prefabGet == null)
			{
				ModLog.Info("item spawn: PrefabRef.Prefab getter not found");
				return false;
			}
			object? obj = s_prefabGet.Invoke(value, null);
			GameObject val = (GameObject)((obj is GameObject) ? obj : null);
			if ((Object)(object)val == (Object)null)
			{
				ModLog.Info("item spawn: " + entry.Name + " prefab not loaded");
				return false;
			}
			string resourcePath = null;
			if (s_resourcePathGet != null)
			{
				try
				{
					resourcePath = s_resourcePathGet.Invoke(value, null) as string;
				}
				catch (Exception)
				{
					resourcePath = null;
				}
			}
			Transform transform = ((Component)cam).transform;
			Vector3 position = transform.position + transform.forward * 2.2f;
			Quaternion rotation = transform.rotation;
			GameObject val2 = NetworkSpawn.Spawn(resourcePath, val, position, rotation, "item spawn");
			if ((Object)(object)val2 == (Object)null)
			{
				return false;
			}
			((Object)val2).name = ((Object)val).name;
			return true;
		}
	}
	internal class MenuUi : MonoBehaviour
	{
		private class Page
		{
			internal string Name;

			internal GameObject Root;

			internal Image NavBackground;

			internal Image NavBar;

			internal Text NavLabel;
		}

		private sealed class UiList
		{
			internal RectTransform Content;

			internal readonly List<Image> Rows = new List<Image>();

			internal string Built;
		}

		private const float RefWidth = 1920f;

		private const float RefHeight = 1080f;

		private const float PanelWidth = 1100f;

		private const float PanelHeight = 720f;

		private const float HeaderHeight = 76f;

		private const float SidebarWidth = 232f;

		private const float LeftX = 18f;

		private const float RightX = 443f;

		private const float CardWidth = 407f;

		private const float WideWidth = 832f;

		private const float CardPad = 14f;

		private const float CardHeader = 38f;

		private static readonly Color PanelColour = new Color(0.055f, 0.062f, 0.085f, 0.975f);

		private static readonly Color BorderColour = new Color(0.24f, 0.85f, 0.88f, 0.85f);

		private static readonly Color CardColour = new Color(1f, 1f, 1f, 0.035f);

		private static readonly Color RowColour = new Color(1f, 1f, 1f, 0.035f);

		private static readonly Color AccentColour = new Color(0.24f, 0.85f, 0.88f, 1f);

		private static readonly Color GreenColour = new Color(0.38f, 1f, 0.52f, 1f);

		private static readonly Color RedColour = new Color(1f, 0.38f, 0.38f, 1f);

		private static readonly Color TextColour = new Color(0.93f, 0.95f, 0.98f, 1f);

		private static readonly Color DimColour = new Color(0.6f, 0.65f, 0.72f, 1f);

		private static readonly Color OffColour = new Color(1f, 1f, 1f, 0.13f);

		private static readonly Color TrackColour = new Color(1f, 1f, 1f, 0.12f);

		private static readonly Color NavIdleColour = new Color(1f, 1f, 1f, 0.02f);

		private static readonly Color NavActiveColour = new Color(0.24f, 0.85f, 0.88f, 0.14f);

		private static readonly Color ItemRowColour = new Color(1f, 1f, 1f, 0.03f);

		private static readonly Color ItemRowSelected = new Color(0.24f, 0.85f, 0.88f, 0.3f);

		private static readonly Color ListColour = new Color(0f, 0f, 0f, 0.32f);

		private static Font s_font;

		private Canvas _canvas;

		private RectTransform _pagesRoot;

		private RectTransform _navBar;

		private RectTransform _cursor;

		private readonly List<Page> _pages = new List<Page>();

		private readonly List<Action> _refreshers = new List<Action>();

		private UiList _players;

		private UiList _items;

		private UiList _valuables;

		private UiList _enemies;

		private Text _targetText;

		private static Sprite s_cursorSprite;

		private void Awake()
		{
			try
			{
				Build();
			}
			catch (Exception e)
			{
				ModLog.Error("MenuUi.Build", e);
			}
		}

		private void Update()
		{
			try
			{
				if ((Object)(object)_canvas == (Object)null)
				{
					return;
				}
				bool menuOpen = Settings.MenuOpen;
				if (((Component)_canvas).gameObject.activeSelf != menuOpen)
				{
					((Component)_canvas).gameObject.SetActive(menuOpen);
				}
				if (menuOpen)
				{
					for (int i = 0; i < _refreshers.Count; i++)
					{
						_refreshers[i]();
					}
					MoveCursor();
				}
			}
			catch (Exception e)
			{
				ModLog.Error("MenuUi.Update", e);
			}
		}

		private void Build()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_016f: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)EventSystem.current == (Object)null)
			{
				GameObject val = new GameObject("ValuableEspEventSystem");
				val.transform.SetParent(((Component)this).transform, false);
				val.AddComponent<EventSystem>();
				val.AddComponent<StandaloneInputModule>();
			}
			GameObject val2 = new GameObject("ValuableEspCanvas", new Type[4]
			{
				typeof(RectTransform),
				typeof(Canvas),
				typeof(CanvasScaler),
				typeof(GraphicRaycaster)
			});
			val2.transform.SetParent(((Component)this).transform, false);
			_canvas = val2.GetComponent<Canvas>();
			_canvas.renderMode = (RenderMode)0;
			_canvas.overrideSorting = true;
			_canvas.sortingOrder = 32000;
			CanvasScaler component = val2.GetComponent<CanvasScaler>();
			component.uiScaleMode = (ScaleMode)1;
			component.referenceResolution = new Vector2(1920f, 1080f);
			component.screenMatchMode = (ScreenMatchMode)0;
			component.matchWidthOrHeight = 0.5f;
			RectTransform val3 = NewRect("Panel", val2.transform);
			val3.anchorMin = new Vector2(0.5f, 0.5f);
			val3.anchorMax = new Vector2(0.5f, 0.5f);
			val3.pivot = new Vector2(0.5f, 0.5f);
			val3.anchoredPosition = Vector2.zero;
			val3.sizeDelta = new Vector2(1100f, 720f);
			((Graphic)((Component)val3).gameObject.AddComponent<Image>()).color = PanelColour;
			Outline obj = ((Component)val3).gameObject.AddComponent<Outline>();
			((Shadow)obj).effectColor = BorderColour;
			((Shadow)obj).effectDistance = new Vector2(1.5f, 1.5f);
			BuildHeader(val3);
			BuildSidebar(val3);
			_pagesRoot = NewRect("Pages", (Transform)(object)val3);
			_pagesRoot.anchorMin = Vector2.zero;
			_pagesRoot.anchorMax = Vector2.one;
			_pagesRoot.offsetMin = new Vector2(232f, 0f);
			_pagesRoot.offsetMax = new Vector2(0f, -76f);
			Page page = AddPage("Self");
			Page page2 = AddPage("Players");
			Page page3 = AddPage("Enemies");
			Page page4 = AddPage("Valuables");
			Page page5 = AddPage("Items");
			Page page6 = AddPage("World");
			Page page7 = AddPage("Misc");
			BuildSelfPage(page.Root.transform);
			BuildPlayersPage(page2.Root.transform);
			BuildEnemiesPage(page3.Root.transform);
			BuildValuablesPage(page4.Root.transform);
			BuildItemsPage(page5.Root.transform);
			BuildWorldPage(page6.Root.transform);
			BuildMiscPage(page7.Root.transform);
			ShowPage(0);
			BuildCursor(val2.transform);
			((Component)_canvas).gameObject.SetActive(Settings.MenuOpen);
		}

		private void BuildCursor(Transform canvas)
		{
			//IL_0021: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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)
			_cursor = NewRect("Cursor", canvas);
			_cursor.anchorMin = new Vector2(0.5f, 0.5f);
			_cursor.anchorMax = new Vector2(0.5f, 0.5f);
			_cursor.pivot = new Vector2(0f, 1f);
			_cursor.sizeDelta = new Vector2(24f, 32f);
			_cursor.anchoredPosition = new Vector2(-2000f, -2000f);
			Image obj = ((Component)_cursor).gameObject.AddComponent<Image>();
			obj.sprite = CursorSprite();
			((Graphic)obj).color = Color.white;
			((Graphic)obj).raycastTarget = false;
			obj.preserveAspect = true;
		}

		private void MoveCursor()
		{
			//IL_001a: 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_0031: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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)
			if (!((Object)(object)_cursor == (Object)null))
			{
				Vector2 anchoredPosition = default(Vector2);
				if (RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)((Component)_canvas).transform, Vector2.op_Implicit(Input.mousePosition), (Camera)null, ref anchoredPosition))
				{
					_cursor.anchoredPosition = anchoredPosition;
				}
				((Transform)_cursor).localScale = (Vector3)(Input.GetMouseButton(0) ? new Vector3(0.86f, 0.86f, 1f) : Vector3.one);
				if (((Transform)_cursor).GetSiblingIndex() != ((Transform)_cursor).parent.childCount - 1)
				{
					((Transform)_cursor).SetAsLastSibling();
				}
			}
		}

		private static Sprite CursorSprite()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0093: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Expected O, but got Unknown
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)s_cursorSprite != (Object)null)
			{
				return s_cursorSprite;
			}
			Vector2[] polygon = (Vector2[])(object)new Vector2[7]
			{
				new Vector2(2f, 30f),
				new Vector2(2f, 4f),
				new Vector2(8f, 11f),
				new Vector2(13f, 0f),
				new Vector2(18f, 1f),
				new Vector2(13f, 12f),
				new Vector2(21f, 12f)
			};
			Color val = default(Color);
			((Color)(ref val))..ctor(0.93f, 0.96f, 1f, 1f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.03f, 0.05f, 0.09f, 1f);
			Texture2D val3 = new Texture2D(24, 32, (TextureFormat)4, false);
			((Texture)val3).filterMode = (FilterMode)1;
			((Texture)val3).wrapMode = (TextureWrapMode)1;
			Color[] array = (Color[])(object)new Color[768];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 24; j++)
				{
					if (!Inside(polygon, (float)j + 0.5f, (float)i + 0.5f))
					{
						array[i * 24 + j] = Color.clear;
						continue;
					}
					bool flag = !Inside(polygon, (float)j - 0.5f, (float)i + 0.5f) || !Inside(polygon, (float)j + 1.5f, (float)i + 0.5f) || !Inside(polygon, (float)j + 0.5f, (float)i - 0.5f) || !Inside(polygon, (float)j + 0.5f, (float)i + 1.5f);
					array[i * 24 + j] = (flag ? val2 : val);
				}
			}
			val3.SetPixels(array);
			val3.Apply();
			s_cursorSprite = Sprite.Create(val3, new Rect(0f, 0f, 24f, 32f), new Vector2(0f, 1f), 100f);
			return s_cursorSprite;
		}

		private static bool Inside(Vector2[] polygon, float x, float y)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			int num = 0;
			int num2 = polygon.Length - 1;
			while (num < polygon.Length)
			{
				Vector2 val = polygon[num];
				Vector2 val2 = polygon[num2];
				if (val.y > y != val2.y > y && x < (val2.x - val.x) * (y - val.y) / (val2.y - val.y) + val.x)
				{
					flag = !flag;
				}
				num2 = num++;
			}
			return flag;
		}

		private void BuildHeader(RectTransform panel)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_005b: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00d7: 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_0114: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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)
			Text obj = Label((Transform)(object)panel, "Title", "VALUABLE ESP", 32, TextColour, (TextAnchor)3);
			obj.fontStyle = (FontStyle)1;
			Anchor(((Graphic)obj).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(600f, 40f), new Vector2(26f, -14f));
			Anchor(((Graphic)Label((Transform)(object)panel, "Hint", "G / Esc to close", 17, DimColour, (TextAnchor)5)).rectTransform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(320f, 30f), new Vector2(-26f, -20f));
			Anchor(((Graphic)NewImage("HeaderLine", (Transform)(object)panel, new Color(1f, 1f, 1f, 0.07f))).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(-52f, 1.5f), new Vector2(0f, -72f));
		}

		private void BuildSidebar(RectTransform panel)
		{
			//IL_0017: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_014f: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = NewRect("Sidebar", (Transform)(object)panel);
			val.anchorMin = new Vector2(0f, 0f);
			val.anchorMax = new Vector2(0f, 1f);
			val.pivot = new Vector2(0f, 1f);
			val.offsetMin = new Vector2(0f, 0f);
			val.offsetMax = new Vector2(232f, -76f);
			Image obj = ((Component)val).gameObject.AddComponent<Image>();
			((Graphic)obj).color = new Color(1f, 1f, 1f, 0.018f);
			((Graphic)obj).raycastTarget = false;
			_navBar = val;
			Anchor(((Graphic)Label((Transform)(object)val, "Caption", "MODULES", 13, DimColour, (TextAnchor)3)).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(-32f, 20f), new Vector2(0f, -14f));
			Anchor(((Graphic)Label((Transform)(object)val, "Footer", "All modules start off.", 13, DimColour, (TextAnchor)3)).rectTransform, new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0.5f, 0f), new Vector2(-32f, 20f), new Vector2(0f, 14f));
		}

		private Page AddPage(string name)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			Page page = new Page
			{
				Name = name
			};
			GameObject gameObject = ((Component)NewRect("Page_" + name, (Transform)(object)_pagesRoot)).gameObject;
			Stretch((RectTransform)gameObject.transform, 0f, 0f, 0f, 0f);
			int index = _pages.Count;
			Image val = NewImage("Nav_" + name, (Transform)(object)_navBar, NavIdleColour);
			Anchor(((Graphic)val).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(200f, 42f), new Vector2(16f, -42f - (float)index * 48f));
			Image val2 = NewImage("Accent", (Transform)(object)((Graphic)val).rectTransform, AccentColour);
			Anchor(((Graphic)val2).rectTransform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(3f, 20f), new Vector2(0f, 0f));
			((Behaviour)val2).enabled = false;
			Text val3 = Label((Transform)(object)((Graphic)val).rectTransform, "Label", name.ToUpperInvariant(), 18, DimColour, (TextAnchor)3);
			Stretch(((Graphic)val3).rectTransform, 18f, 10f, 0f, 0f);
			Button obj = ((Component)val).gameObject.AddComponent<Button>();
			((Selectable)obj).targetGraphic = (Graphic)(object)val;
			ColorBlock colors = ((Selectable)obj).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).highlightedColor = new Color(1.5f, 1.5f, 1.5f, 1f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.7f, 0.7f, 0.7f, 1f);
			((ColorBlock)(ref colors)).selectedColor = Color.white;
			((Selectable)obj).colors = colors;
			((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
			{
				ShowPage(index);
			});
			page.Root = gameObject;
			page.NavBackground = val;
			page.NavBar = val2;
			page.NavLabel = val3;
			_pages.Add(page);
			return page;
		}

		private void ShowPage(int index)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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)
			for (int i = 0; i < _pages.Count; i++)
			{
				bool flag = i == index;
				if ((Object)(object)_pages[i].Root != (Object)null)
				{
					_pages[i].Root.SetActive(flag);
				}
				if ((Object)(object)_pages[i].NavBackground != (Object)null)
				{
					((Graphic)_pages[i].NavBackground).color = (flag ? NavActiveColour : NavIdleColour);
				}
				if ((Object)(object)_pages[i].NavBar != (Object)null)
				{
					((Behaviour)_pages[i].NavBar).enabled = flag;
				}
				if ((Object)(object)_pages[i].NavLabel != (Object)null)
				{
					((Graphic)_pages[i].NavLabel).color = (flag ? AccentColour : DimColour);
				}
			}
		}

		private static RectTransform Card(Transform page, float x, float y, float width, float height, string title)
		{
			//IL_001e: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_00bc: 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_00da: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = NewRect("Card_" + title, page);
			val.anchorMin = new Vector2(0f, 1f);
			val.anchorMax = new Vector2(0f, 1f);
			val.pivot = new Vector2(0f, 1f);
			val.anchoredPosition = new Vector2(x, 0f - y);
			val.sizeDelta = new Vector2(width, height);
			Image obj = ((Component)val).gameObject.AddComponent<Image>();
			((Graphic)obj).color = CardColour;
			((Graphic)obj).raycastTarget = false;
			if (!string.IsNullOrEmpty(title))
			{
				Anchor(((Graphic)Label((Transform)(object)val, "Title", title.ToUpperInvariant(), 13, DimColour, (TextAnchor)3)).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(-28f, 20f), new Vector2(0f, -9f));
			}
			return val;
		}

		private static RectTransform CardRow(Transform card, string name, float y, float height)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = NewRect("Row_" + name, card);
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(1f, 1f);
			obj.pivot = new Vector2(0.5f, 1f);
			obj.anchoredPosition = new Vector2(0f, 0f - y);
			obj.sizeDelta = new Vector2(-28f, height);
			return obj;
		}

		private void CardToggle(RectTransform card, float y, string label, string note, Func<bool> get, Action<bool> set)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: 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_0164: 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_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			float height = (string.IsNullOrEmpty(note) ? 46f : 56f);
			RectTransform val = CardRow((Transform)(object)card, label, y, height);
			Image val2 = ((Component)val).gameObject.AddComponent<Image>();
			((Graphic)val2).color = RowColour;
			Anchor(((Graphic)Label((Transform)(object)val, "Label", label, 19, TextColour, (TextAnchor)3)).rectTransform, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(0f, 0.5f), new Vector2(-90f, 24f), new Vector2(14f, string.IsNullOrEmpty(note) ? 0f : 9f));
			if (!string.IsNullOrEmpty(note))
			{
				Anchor(((Graphic)Label((Transform)(object)val, "Note", note, 14, DimColour, (TextAnchor)3)).rectTransform, new Vector2(0f, 0.5f), new Vector2(1f, 0.5f), new Vector2(0f, 0.5f), new Vector2(-90f, 18f), new Vector2(14f, -11f));
			}
			Image track = NewImage("Switch", (Transform)(object)val, OffColour);
			Anchor(((Graphic)track).rectTransform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(44f, 22f), new Vector2(-14f, 0f));
			Image knob = NewImage("Knob", (Transform)(object)((Graphic)track).rectTransform, Color.white);
			Anchor(((Graphic)knob).rectTransform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(16f, 16f), new Vector2(3f, 0f));
			((UnityEvent)Clickable(val, val2).onClick).AddListener((UnityAction)delegate
			{
				set(!get());
			});
			_refreshers.Add(delegate
			{
				//IL_001c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
				bool flag = get();
				((Graphic)track).color = (flag ? AccentColour : OffColour);
				((Graphic)knob).rectTransform.anchoredPosition = new Vector2(flag ? 25f : 3f, 0f);
			});
		}

		private void CardSlider(RectTransform card, float y, string label, float min, float max, Func<float> get, Action<float> set, string format)
		{
			//IL_002f: 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_005c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = CardRow((Transform)(object)card, label, y, 64f);
			((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = RowColour;
			Anchor(((Graphic)Label((Transform)(object)val, "Label", label, 19, TextColour, (TextAnchor)3)).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 1f), new Vector2(-90f, 24f), new Vector2(14f, -8f));
			Text value = Label((Transform)(object)val, "Value", "", 18, AccentColour, (TextAnchor)5);
			Anchor(((Graphic)value).rectTransform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(90f, 24f), new Vector2(-14f, -8f));
			RectTransform val2 = NewRect("Track", (Transform)(object)val);
			val2.anchorMin = new Vector2(0f, 0f);
			val2.anchorMax = new Vector2(1f, 0f);
			val2.pivot = new Vector2(0.5f, 0f);
			val2.offsetMin = new Vector2(14f, 12f);
			val2.offsetMax = new Vector2(-14f, 30f);
			Slider slider = BuildSlider(val2, min, max, set);
			_refreshers.Add(delegate
			{
				float num = get();
				if (!Mathf.Approximately(slider.value, num))
				{
					slider.SetValueWithoutNotify(num);
				}
				value.text = num.ToString(format);
			});
		}

		private static void CardButton(RectTransform card, float x, float y, float width, float height, string label, Color colour, Action onClick)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			RectTransform obj = NewRect("Button_" + label, (Transform)(object)card);
			obj.anchorMin = new Vector2(0f, 1f);
			obj.anchorMax = new Vector2(0f, 1f);
			obj.pivot = new Vector2(0f, 1f);
			obj.anchoredPosition = new Vector2(x, 0f - y);
			obj.sizeDelta = new Vector2(width, height);
			Image val = ((Component)obj).gameObject.AddComponent<Image>();
			((Graphic)val).color = new Color(colour.r, colour.g, colour.b, 0.16f);
			Stretch(((Graphic)Label((Transform)(object)obj, "Label", label, 18, colour, (TextAnchor)4)).rectTransform, 0f, 0f, 0f, 0f);
			((UnityEvent)Clickable(obj, val).onClick).AddListener((UnityAction)delegate
			{
				onClick();
			});
		}

		private static Text CardHint(RectTransform card, float y, string content)
		{
			//IL_0009: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			Text obj = Label((Transform)(object)card, "Hint", content, 15, DimColour, (TextAnchor)0);
			obj.horizontalOverflow = (HorizontalWrapMode)0;
			obj.verticalOverflow = (VerticalWrapMode)0;
			Anchor(((Graphic)obj).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(-28f, 42f), new Vector2(0f, 0f - y));
			return obj;
		}

		private void BuildSelfPage(Transform page)
		{
			RectTransform card = Card(page, 18f, 14f, 407f, 142f, "Health");
			CardToggle(card, 38f, "God mode", null, () => Settings.GodMode, delegate(bool v)
			{
				Settings.GodMode = v;
			});
			CardToggle(card, 88f, "Infinite battery", null, () => Settings.InfiniteBattery, delegate(bool v)
			{
				Settings.InfiniteBattery = v;
			});
			RectTransform card2 = Card(page, 18f, 172f, 407f, 142f, "Movement");
			CardToggle(card2, 38f, "Infinite stamina", null, () => Settings.InfiniteStamina, delegate(bool v)
			{
				Settings.InfiniteStamina = v;
			});
			CardToggle(card2, 88f, "Infinite jump", null, () => Settings.InfiniteJump, delegate(bool v)
			{
				Settings.InfiniteJump = v;
			});
			RectTransform card3 = Card(page, 443f, 14f, 407f, 142f, "Grab");
			CardToggle(card3, 38f, "High strength", null, () => Settings.HighStrength, delegate(bool v)
			{
				Settings.HighStrength = v;
			});
			CardToggle(card3, 88f, "Infinite range", null, () => Settings.InfiniteRange, delegate(bool v)
			{
				Settings.InfiniteRange = v;
			});
			RectTransform card4 = Card(page, 443f, 172f, 407f, 142f, "Vision");
			CardToggle(card4, 38f, "Player ESP", null, () => Settings.PlayerEsp, delegate(bool v)
			{
				Settings.PlayerEsp = v;
			});
			CardToggle(card4, 88f, "Fullbright", null, () => Settings.Fullbright, delegate(bool v)
			{
				Settings.Fullbright = v;
			});
			CardHint(Card(page, 18f, 330f, 832f, 76f, "About"), 32f, "Every module applies the moment it is switched on and puts the game's own values back when it is switched off.");
		}

		private void BuildPlayersPage(Transform page)
		{
			//IL_0075: 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_00a9: 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_00c7: 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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			RectTransform card = Card(page, 18f, 14f, 832f, 330f, "Session");
			_players = CreateList(card, 40f, 250f);
			CardHint(card, 296f, "Click a player to choose who the actions apply to.");
			RectTransform val = Card(page, 18f, 360f, 832f, 214f, "Actions");
			_targetText = Label((Transform)(object)val, "Target", "", 13, AccentColour, (TextAnchor)5);
			Anchor(((Graphic)_targetText).rectTransform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(420f, 20f), new Vector2(-14f, -9f));
			CardToggle(val, 38f, "Ragdoll", "Knocks the selected player over, or helps them up.", () => PlayerSession.SelectedTumbling(), delegate(bool v)
			{
				PlayerSession.SetTumbling(v);
			});
			CardButton(val, 14f, 108f, 260f, 48f, "Kill", RedColour, PlayerSession.Kill);
			CardButton(val, 286f, 108f, 260f, 48f, "Revive", GreenColour, PlayerSession.Revive);
			CardButton(val, 558f, 108f, 260f, 48f, "Heal to max", AccentColour, PlayerSession.Heal);
			CardHint(val, 168f, "Kill, revive and ragdoll are the game's own networked events, so they reach the other player's machine. Healing uses HealOther for the same reason.");
			_refreshers.Add(delegate
			{
				PlayerSession.Refresh();
				RefreshList(_players, PlayerSession.Signature(), PlayerSession.Count, "Waiting for the session", PlayerSession.DisplayNameAt, PlayerSession.SelectedIndex, PlayerSession.Select);
				if ((Object)(object)_targetText != (Object)null)
				{
					_targetText.text = "TARGET  " + PlayerSession.TargetName().ToUpperInvariant();
				}
			});
		}

		private void BuildEnemiesPage(Transform page)
		{
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			RectTransform card = Card(page, 18f, 14f, 407f, 164f, "Vision");
			CardToggle(card, 38f, "Enemy ESP", null, () => Settings.EnemyEsp, delegate(bool v)
			{
				Settings.EnemyEsp = v;
			});
			CardSlider(card, 88f, "Max distance", 10f, 250f, () => Settings.EnemyDistance, delegate(float v)
			{
				Settings.EnemyDistance = v;
			}, "0 m");
			CardHint(Card(page, 18f, 192f, 407f, 128f, "Notes"), 32f, "Enemies are boxed in red with their name.\nSpawning puts one right in front of you and only works inside a level.");
			RectTransform card2 = Card(page, 443f, 14f, 407f, 470f, "Spawn enemy");
			CardHint(card2, 32f, "Pick one, then spawn it in front of the camera.");
			_enemies = CreateList(card2, 58f, 340f);
			CardButton(card2, 14f, 410f, 379f, 44f, "Spawn enemy", AccentColour, delegate
			{
				EnemySpawner.SpawnSelected(Overlay.ResolveCamera());
			});
			_refreshers.Add(delegate
			{
				EnemySpawner.EnsureCatalog();
				RefreshList(_enemies, "e" + EnemySpawner.Count, EnemySpawner.Count, "Loading the enemy list...", EnemySpawner.NameAt, () => EnemySpawner.SelectedIndex, delegate(int i)
				{
					EnemySpawner.SelectedIndex = i;
				});
			});
		}

		private void BuildValuablesPage(Transform page)
		{
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			RectTransform card = Card(page, 18f, 8f, 407f, 190f, "Vision");
			CardToggle(card, 38f, "Valuables ESP", null, () => Settings.EspEnabled, delegate(bool v)
			{
				Settings.EspEnabled = v;
			});
			CardToggle(card, 88f, "Show name", null, () => Settings.ShowName, delegate(bool v)
			{
				Settings.ShowName = v;
			});
			CardToggle(card, 138f, "Show value", null, () => Settings.ShowValue, delegate(bool v)
			{
				Settings.ShowValue = v;
			});
			RectTransform card2 = Card(page, 18f, 202f, 407f, 164f, "Value");
			CardToggle(card2, 38f, "Keep max value", "Restores damaged valuables to full value.", () => Settings.KeepValue, delegate(bool v)
			{
				Settings.KeepValue = v;
			});
			CardToggle(card2, 98f, "No damage", "Valuables never lose value or break.", () => Settings.ProtectValuables, delegate(bool v)
			{
				Settings.ProtectValuables = v;
			});
			RectTransform card3 = Card(page, 18f, 370f, 407f, 272f, "Labels");
			CardToggle(card3, 38f, "Show distance", null, () => Settings.ShowDistance, delegate(bool v)
			{
				Settings.ShowDistance = v;
			});
			CardToggle(card3, 88f, "Line to closest", null, () => Settings.PointerLine, delegate(bool v)
			{
				Settings.PointerLine = v;
			});
			CardSlider(card3, 138f, "Max distance", 10f, 250f, () => Settings.MaxDistance, delegate(float v)
			{
				Settings.MaxDistance = v;
			}, "0 m");
			CardSlider(card3, 202f, "Label distance", 5f, 80f, () => Settings.LabelDistance, delegate(float v)
			{
				Settings.LabelDistance = v;
			}, "0 m");
			RectTransform card4 = Card(page, 443f, 8f, 407f, 470f, "Spawn valuable");
			CardHint(card4, 32f, "Pick one, then spawn it in front of the camera.");
			_valuables = CreateList(card4, 58f, 340f);
			CardButton(card4, 14f, 410f, 379f, 44f, "Spawn valuable", AccentColour, delegate
			{
				ValuableSpawner.SpawnSelected(Overlay.ResolveCamera());
			});
			_refreshers.Add(delegate
			{
				ValuableSpawner.EnsureCatalog();
				ValuableSpawner.EnsureFallback();
				RefreshList(_valuables, "v" + ValuableSpawner.Count, ValuableSpawner.Count, "No valuables found yet", ValuableSpawner.NameAt, () => ValuableSpawner.SelectedIndex, delegate(int i)
				{
					ValuableSpawner.SelectedIndex = i;
				});
			});
		}

		private void BuildItemsPage(Transform page)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			RectTransform card = Card(page, 18f, 14f, 832f, 580f, "Spawn item");
			CardHint(card, 32f, "Pick one, then spawn it in front of the camera. Spawned items are created on the host, so friends can see and grab them.");
			_items = CreateList(card, 58f, 440f);
			CardButton(card, 14f, 510f, 804f, 48f, "Spawn item", AccentColour, delegate
			{
				ItemSpawner.SpawnSelected(Overlay.ResolveCamera());
			});
			_refreshers.Add(delegate
			{
				ItemSpawner.EnsureCatalog();
				RefreshList(_items, "i" + ItemSpawner.Count, ItemSpawner.Count, "Item list not loaded yet", ItemSpawner.NameAt, () => ItemSpawner.SelectedIndex, delegate(int i)
				{
					ItemSpawner.SelectedIndex = i;
				});
			});
		}

		private void BuildWorldPage(Transform page)
		{
			RectTransform card = Card(page, 18f, 14f, 832f, 200f, "Markers");
			CardToggle(card, 38f, "Truck ESP", null, () => Settings.TruckEsp, delegate(bool v)
			{
				Settings.TruckEsp = v;
			});
			CardToggle(card, 88f, "Extraction point ESP", null, () => Settings.ExtractionEsp, delegate(bool v)
			{
				Settings.ExtractionEsp = v;
			});
			CardHint(card, 142f, "The truck gets a cyan truck symbol. Extraction points get three orange stacked boxes, which stay small even at a distance.");
		}

		private void BuildMiscPage(Transform page)
		{
			RectTransform card = Card(page, 18f, 14f, 407f, 160f, "Camera");
			CardToggle(card, 38f, "FOV hack", null, () => Settings.FovEnabled, delegate(bool v)
			{
				Settings.FovEnabled = v;
			});
			CardSlider(card, 88f, "Field of view", 40f, 120f, () => Settings.Fov, delegate(float v)
			{
				Settings.Fov = v;
			}, "0");
			RectTransform card2 = Card(page, 443f, 14f, 407f, 96f, "Shop");
			CardToggle(card2, 38f, "Shop items $1K", null, () => Settings.CheapShop, delegate(bool v)
			{
				Settings.CheapShop = v;
			});
		}

		private static UiList CreateList(RectTransform card, float y, float height)
		{
			//IL_0017: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_00cc: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = NewRect("List", (Transform)(object)card);
			val.anchorMin = new Vector2(0f, 1f);
			val.anchorMax = new Vector2(1f, 1f);
			val.pivot = new Vector2(0.5f, 1f);
			val.anchoredPosition = new Vector2(0f, 0f - y);
			val.sizeDelta = new Vector2(-28f, height);
			((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = ListColour;
			RectTransform val2 = NewRect("Viewport", (Transform)(object)val);
			Stretch(val2, 6f, 6f, 6f, 6f);
			((Component)val2).gameObject.AddComponent<RectMask2D>();
			RectTransform val3 = NewRect("Content", (Transform)(object)val2);
			val3.anchorMin = new Vector2(0f, 1f);
			val3.anchorMax = new Vector2(1f, 1f);
			val3.pivot = new Vector2(0.5f, 1f);
			val3.anchoredPosition = Vector2.zero;
			val3.sizeDelta = new Vector2(0f, height);
			ScrollRect obj = ((Component)val).gameObject.AddComponent<ScrollRect>();
			obj.viewport = val2;
			obj.content = val3;
			obj.horizontal = false;
			obj.vertical = true;
			obj.movementType = (MovementType)2;
			obj.scrollSensitivity = 40f;
			return new UiList
			{
				Content = val3
			};
		}

		private void RefreshList(UiList list, string signature, int count, string empty, Func<int, string> nameAt, Func<int> selected, Action<int> select)
		{
			//IL_0092: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			if (list == null || (Object)(object)list.Content == (Object)null)
			{
				return;
			}
			if (list.Built != signature)
			{
				list.Built = signature;
				list.Rows.Clear();
				for (int num = ((Transform)list.Content).childCount - 1; num >= 0; num--)
				{
					Object.Destroy((Object)(object)((Component)((Transform)list.Content).GetChild(num)).gameObject);
				}
				if (count == 0)
				{
					RectTransform obj = NewRect("Empty", (Transform)(object)list.Content);
					obj.anchorMin = new Vector2(0f, 1f);
					obj.anchorMax = new Vector2(1f, 1f);
					obj.pivot = new Vector2(0.5f, 1f);
					obj.anchoredPosition = Vector2.zero;
					obj.sizeDelta = new Vector2(0f, 32f);
					Stretch(((Graphic)Label((Transform)(object)obj, "Label", empty, 17, DimColour, (TextAnchor)4)).rectTransform, 0f, 0f, 0f, 0f);
					list.Content.sizeDelta = new Vector2(0f, 32f);
				}
				else
				{
					for (int i = 0; i < count; i++)
					{
						int index = i;
						RectTransform obj2 = NewRect("Row_" + i, (Transform)(object)list.Content);
						obj2.anchorMin = new Vector2(0f, 1f);
						obj2.anchorMax = new Vector2(1f, 1f);
						obj2.pivot = new Vector2(0.5f, 1f);
						obj2.anchoredPosition = new Vector2(0f, (float)(-i) * 32f);
						obj2.sizeDelta = new Vector2(0f, 32f);
						Image val = ((Component)obj2).gameObject.AddComponent<Image>();
						((Graphic)val).color = ItemRowColour;
						list.Rows.Add(val);
						Stretch(((Graphic)Label((Transform)(object)obj2, "Label", nameAt(i), 17, TextColour, (TextAnchor)3)).rectTransform, 12f, 12f, 0f, 0f);
						((UnityEvent)Clickable(obj2, val).onClick).AddListener((UnityAction)delegate
						{
							select(index);
						});
					}
					list.Content.sizeDelta = new Vector2(0f, (float)count * 32f);
				}
			}
			int num2 = ((count == 0) ? (-1) : selected());
			for (int num3 = 0; num3 < list.Rows.Count; num3++)
			{
				if (!((Object)(object)list.Rows[num3] == (Object)null))
				{
					((Graphic)list.Rows[num3]).color = ((num3 == num2) ? ItemRowSelected : ItemRowColour);
				}
			}
		}

		private static Slider BuildSlider(RectTransform root, float min, float max, Action<float> set)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			Band(((Graphic)NewImage("Background", (Transform)(object)root, TrackColour)).rectTransform, 0f, 4.5f);
			RectTransform val = NewRect("Fill Area", (Transform)(object)root);
			Band(val, 0f, 4.5f);
			Image val2 = NewImage("Fill", (Transform)(object)val, AccentColour);
			Stretch(((Graphic)val2).rectTransform, 0f, 0f, 0f, 0f);
			RectTransform val3 = NewRect("Handle Slide Area", (Transform)(object)root);
			Band(val3, 0f, 15f);
			Image val4 = NewImage("Handle", (Transform)(object)val3, Color.white);
			((Graphic)val4).rectTransform.sizeDelta = new Vector2(16f, 0f);
			Slider obj = ((Component)root).gameObject.AddComponent<Slider>();
			obj.fillRect = ((Graphic)val2).rectTransform;
			obj.handleRect = ((Graphic)val4).rectTransform;
			((Selectable)obj).targetGraphic = (Graphic)(object)val4;
			obj.direction = (Direction)0;
			obj.wholeNumbers = false;
			obj.minValue = min;
			obj.maxValue = max;
			((UnityEvent<float>)(object)obj.onValueChanged).AddListener((UnityAction<float>)delegate(float v)
			{
				set(v);
			});
			return obj;
		}

		private static Button Clickable(RectTransform row, Image background)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			Button obj = ((Component)row).gameObject.AddComponent<Button>();
			((Selectable)obj).targetGraphic = (Graphic)(object)background;
			ColorBlock colors = ((Selectable)obj).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).highlightedColor = new Color(1.6f, 1.6f, 1.6f, 1f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.7f, 0.7f, 0.7f, 1f);
			((ColorBlock)(ref colors)).selectedColor = Color.white;
			((Selectable)obj).colors = colors;
			return obj;
		}

		private static RectTransform NewRect(string name, Transform parent)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			return (RectTransform)val.transform;
		}

		private static void Stretch(RectTransform rt, float left, float right, float bottom, float top)
		{
			//IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			rt.pivot = new Vector2(0.5f, 0.5f);
			rt.offsetMin = new Vector2(left, bottom);
			rt.offsetMax = new Vector2(0f - right, 0f - top);
		}

		private static void Band(RectTransform rt, float margin, float halfHeight)
		{
			//IL_000b: 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_0035: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = new Vector2(0f, 0.5f);
			rt.anchorMax = new Vector2(1f, 0.5f);
			rt.pivot = new Vector2(0.5f, 0.5f);
			rt.offsetMin = new Vector2(margin, 0f - halfHeight);
			rt.offsetMax = new Vector2(0f - margin, halfHeight);
		}

		private static void Anchor(RectTransform rt, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 size, Vector2 position)
		{
			//IL_0001: 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_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = anchorMin;
			rt.anchorMax = anchorMax;
			rt.pivot = pivot;
			rt.sizeDelta = size;
			rt.anchoredPosition = position;
		}

		private static Image NewImage(string name, Transform parent, Color colour)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Image obj = ((Component)NewRect(name, parent)).gameObject.AddComponent<Image>();
			((Graphic)obj).color = colour;
			return obj;
		}

		private static Text Label(Transform parent, string name, string content, int size, Color colour, TextAnchor alignment)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			Text obj = ((Component)NewRect(name, parent)).gameObject.AddComponent<Text>();
			obj.font = Font();
			obj.fontSize = size;
			obj.text = content;
			((Graphic)obj).color = colour;
			obj.alignment = alignment;
			((Graphic)obj).raycastTarget = false;
			obj.horizontalOverflow = (HorizontalWrapMode)1;
			obj.verticalOverflow = (VerticalWrapMode)1;
			obj.supportRichText = false;
			return obj;
		}

		private static Font Font()
		{
			if ((Object)(object)s_font != (Object)null)
			{
				return s_font;
			}
			s_font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf") ?? Resources.GetBuiltinResource<Font>("Arial.ttf") ?? Font.CreateDynamicFontFromOSFont("Segoe UI", 20) ?? Font.CreateDynamicFontFromOSFont("Arial", 20);
			return s_font;
		}
	}
	internal static class ModLog
	{
		private static readonly object Gate = new object();

		private static string _path;

		internal static void Init()
		{
			if (_path != null)
			{
				return;
			}
			try
			{
				_path = Path.Combine(Path.GetFullPath(Path.Combine(Application.dataPath, "..")), "valuable_esp.log");
				if (File.Exists(_path))
				{
					File.Delete(_path);
				}
				Write("session started " + DateTime.Now.ToString("O"));
			}
			catch
			{
				_path = null;
			}
		}

		internal static void Info(string message)
		{
			Write(message);
		}

		private static void Write(string message)
		{
			if (_path == null)
			{
				return;
			}
			try
			{
				lock (Gate)
				{
					File.AppendAllText(_path, DateTime.Now.ToString("HH:mm:ss.fff") + "  " + message + Environment.NewLine);
				}
			}
			catch
			{
			}
		}

		internal static void Error(string where, Exception e)
		{
			if (_path != null)
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.Append("ERROR in ").Append(where).Append(": ")
					.Append(e.GetType().Name)
					.Append(": ")
					.Append(e.Message)
					.Append(Environment.NewLine)
					.Append(e.StackTrace);
				Write(stringBuilder.ToString());
			}
		}
	}
	internal static class NetworkSpawn
	{
		internal unsafe static GameObject Spawn(string resourcePath, GameObject prefab, Vector3 position, Quaternion rotation, string label)
		{
			//IL_014e: 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)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)prefab == (Object)null)
			{
				return null;
			}
			if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null)
			{
				return Local(prefab, position, rotation, label, "singleplayer");
			}
			if (string.IsNullOrEmpty(resourcePath))
			{
				ModLog.Info(label + ": no Resources path for " + ((Object)prefab).name + ", spawning locally");
				return Local(prefab, position, rotation, label, "no path");
			}
			try
			{
				if (PhotonNetwork.IsMasterClient)
				{
					GameObject val = PhotonNetwork.InstantiateRoomObject(resourcePath, position, rotation, (byte)0, (object[])null);
					if ((Object)(object)val != (Object)null)
					{
						string[] obj = new string[5] { label, ": ", resourcePath, " as a room object at ", null };
						Vector3 val2 = position;
						obj[4] = ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString();
						ModLog.Info(string.Concat(obj));
						return val;
					}
					ModLog.Info(label + ": room object refused for " + resourcePath);
				}
				else
				{
					GameObject val3 = PhotonNetwork.Instantiate(resourcePath, position, rotation, (byte)0, (object[])null);
					if ((Object)(object)val3 != (Object)null)
					{
						string[] obj2 = new string[5] { label, ": ", resourcePath, " as a player object at ", null };
						Vector3 val2 = position;
						obj2[4] = ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString();
						ModLog.Info(string.Concat(obj2));
						return val3;
					}
					ModLog.Info(label + ": Photon refused " + resourcePath);
				}
			}
			catch (Exception e)
			{
				ModLog.Error(label + ": Photon spawn", e);
			}
			return Local(prefab, position, rotation, label, "local fallback");
		}

		private unsafe static GameObject Local(GameObject prefab, Vector3 position, Quaternion rotation, string label, string why)
		{
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(prefab, position, rotation);
			if ((Object)(object)val != (Object)null)
			{
				((Object)val).name = ((Object)prefab).name;
			}
			string[] obj = new string[7]
			{
				label,
				": ",
				((Object)prefab).name,
				" ",
				why,
				" at ",
				null
			};
			Vector3 val2 = position;
			obj[6] = ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString();
			ModLog.Info(string.Concat(obj));
			return val;
		}
	}
	internal class Overlay : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static CameraCallback <0>__OnCameraPreRender;
		}

		private const float RefreshSeconds = 0.5f;

		private float _sinceRefresh;

		private float _statusTimer;

		private float _lastGuiLog = -99f;

		private CursorLockMode _savedLock;

		private bool _savedVisible;

		private static int s_drawn;

		private static float _maxBoxSize;

		private static string _maxBoxName = "";

		private readonly List<ValuableObject> _valuables = new List<ValuableObject>();

		private readonly List<ItemBattery> _batteries = new List<ItemBattery>();

		internal static Overlay Instance;

		private readonly List<Component> _extractionPoints = new List<Component>();

		private readonly List<Component> _enemies = new List<Component>();

		private static Transform s_truck;

		private static string s_truckSource = "";

		private static int s_playersDrawn;

		private static int s_playersTotal;

		private static int s_iconsDrawn;

		private readonly List<Rect> _labelRects = new List<Rect>();

		private Texture2D _pixel;

		private GUIStyle _label;

		private static float s_defaultFov;

		private static bool s_defaultFovCaptured;

		private static bool s_lightingSaved;

		private static string s_lightingScene;

		private static AmbientMode s_ambientMode;

		private static Color s_ambientLight;

		private static float s_ambientIntensity;

		private static bool s_fog;

		private static Color s_fogColor;

		private static float s_fogDensity;

		private static bool s_fullbrightLogged;

		private static bool s_playerResolved;

		private static FieldInfo s_pcInstance;

		private static FieldInfo s_energyCurrent;

		private static FieldInfo s_energyStart;

		private static FieldInfo s_jumpExtraCurrent;

		private static FieldInfo s_jumpCooldown;

		private static bool s_strengthResolved;

		private static FieldInfo s_grabberInstance;

		private static FieldInfo s_grabStrengthField;

		private static object s_strengthTarget;

		private static float s_grabStrengthOriginal;

		private const float RangeValue = 500f;

		private static bool s_rangeResolved;

		private static FieldInfo s_grabRangeField;

		private static FieldInfo s_grabReleaseField;

		private static FieldInfo s_grabMaxDistanceField;

		private static object s_rangeTarget;

		private static float s_rangeOriginal;

		private static float s_releaseOriginal;

		private static float s_maxDistanceOriginal;

		private static readonly FieldInfo s_itemValueField = typeof(ItemAttributes).GetField("value", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private static readonly FieldInfo s_shopItemField = typeof(ItemAttributes).GetField("shopItem", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private readonly List<ItemAttributes> _shopItems = new List<ItemAttributes>();

		private readonly Dictionary<ItemAttributes, int> _shopOriginal = new Dictionary<ItemAttributes, int>();

		private readonly List<ItemAttributes> _shopStale = new List<ItemAttributes>();

		private int _shopLoggedCount = -1;

		private static readonly FieldInfo s_batteryBarsField = typeof(ItemBattery).GetField("batteryBars", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private static readonly FieldInfo s_batteryLifeIntField = typeof(ItemBattery).GetField("batteryLifeInt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		private const float BatteryFull = 100f;

		private static bool s_worldResolved;

		private static FieldInfo s_directorInstance;

		private static FieldInfo s_playerList;

		private static FieldInfo s_playerIsLocal;

		private static FieldInfo s_playerName;

		private static FieldInfo s_extractionPlatform;

		private static FieldInfo s_extractionArea;

		private static bool s_enemyResolved;

		private static Type s_enemyType;

		private static FieldInfo s_enemyParentField;

		private static FieldInfo s_enemyNameField;

		private static int s_enemiesDrawn;

		private static bool s_guardResolved;

		private static FieldInfo s_impactField;

		private static FieldInfo s_currentField;

		private static FieldInfo s_originalField;

		private static FieldInfo s_physField;

		private static FieldInfo s_indestructibleField;

		private static MethodInfo s_healMethod;

		private static MethodInfo s_indestructibleMethod;

		private static int s_guardHealed;

		private const float MinBoxPixels = 5f;

		private static readonly FieldInfo s_valueField = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		internal static List<ItemBattery> Batteries
		{
			get
			{
				if (!((Object)(object)Instance == (Object)null))
				{
					return Instance._batteries;
				}
				return null;
			}
		}

		private void Start()
		{
			Instance = this;
			ModLog.Info("Overlay started. ValuableObject resolved: " + typeof(ValuableObject).FullName);
			string[] commandLineArgs = Environment.GetCommandLineArgs();
			for (int i = 0; i < commandLineArgs.Length; i++)
			{
				if (string.Equals(commandLineArgs[i], "-esp-menu", StringComparison.OrdinalIgnoreCase))
				{
					SetMenuOpen(open: true);
					break;
				}
			}
		}

		private void Update()
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Input.GetKeyDown((KeyCode)103))
				{
					SetMenuOpen(!Settings.MenuOpen);
				}
				if (Input.GetKeyDown((KeyCode)27) && Settings.MenuOpen)
				{
					SetMenuOpen(open: false);
				}
				if (Settings.MenuOpen)
				{
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = false;
				}
				_sinceRefresh += Time.deltaTime;
				if (_sinceRefresh >= 0.5f)
				{
					_sinceRefresh = 0f;
					RefreshValuables();
					if (Settings.KeepValue || Settings.ProtectValuables)
					{
						ApplyValuableGuard();
					}
					if (Settings.CheapShop)
					{
						RefreshShopItems();
					}
					if (Settings.InfiniteBattery)
					{
						RefreshBatteries();
					}
					if (Settings.PlayerEsp || Settings.TruckEsp || Settings.ExtractionEsp || Settings.EnemyEsp)
					{
						RefreshWorldObjects();
					}
					_statusTimer += 0.5f;
					if (_statusTimer >= 5f)
					{
						_statusTimer = 0f;
						string[] array = new string[48];
						array[0] = "status: scene=";
						Scene activeScene = SceneManager.GetActiveScene();
						array[1] = ((Scene)(ref activeScene)).name;
						array[2] = " found=";
						array[3] = _valuables.Count.ToString();
						array[4] = " drawn=";
						array[5] = s_drawn.ToString();
						array[6] = " menu=";
						array[7] = Settings.MenuOpen.ToString();
						array[8] = " fov=";
						array[9] = Settings.Fov.ToString("0");
						array[10] = "/";
						array[11] = FovNow().ToString("0");
						array[12] = " fovOn=";
						array[13] = Settings.FovEnabled.ToString();
						array[14] = " fb=";
						array[15] = Settings.Fullbright.ToString();
						array[16] = " stam=";
						array[17] = (Settings.InfiniteStamina ? "on" : "off");
						array[18] = "/";
						array[19] = StaminaNow();
						array[20] = " str=";
						array[21] = (Settings.HighStrength ? StrengthNow() : "off");
						array[22] = " range=";
						array[23] = (Settings.InfiniteRange ? RangeNow() : "off");
						array[24] = " jump=";
						array[25] = Settings.InfiniteJump.ToString();
						array[26] = " god=";
						array[27] = (Settings.GodMode ? "on" : "off");
						array[28] = " tgt=";
						array[29] = PlayerSession.TargetName();
						array[30] = " enemy=";
						array[31] = (Settings.EnemyEsp ? (s_enemiesDrawn + "/" + _enemies.Count) : "off");
						array[32] = " shop=";
						array[33] = (Settings.CheapShop ? _shopItems.Count.ToString() : "off");
						array[34] = " bat=";
						array[35] = (Settings.InfiniteBattery ? _batteries.Count.ToString() : "off");
						array[36] = " pl=";
						array[37] = (Settings.PlayerEsp ? (s_playersDrawn + "/" + s_playersTotal) : "off");
						array[38] = " truck=";
						array[39] = ((!Settings.TruckEsp) ? "off" : (((Object)(object)s_truck != (Object)null) ? s_truckSource : "none"));
						array[40] = " ext=";
						array[41] = (Settings.ExtractionEsp ? _extractionPoints.Count.ToString() : "off");
						array[42] = " icon=";
						array[43] = s_iconsDrawn.ToString();
						array[44] = " biggest=";
						array[45] = _maxBoxName;
						array[46] = "/";
						array[47] = _maxBoxSize.ToString("0.0");
						ModLog.Info(string.Concat(array));
					}
				}
			}
			catch (Exception e)
			{
				ModLog.Error("Update", e);
			}
		}

		private void LateUpdate()
		{
			if (Settings.FovEnabled)
			{
				ApplyFov();
			}
			else
			{
				RestoreFov();
			}
			if (Settings.Fullbright)
			{
				ApplyFullbright();
			}
			else
			{
				RestoreLighting();
			}
			if (Settings.InfiniteStamina)
			{
				ApplyInfiniteStamina();
			}
			if (Settings.HighStrength)
			{
				ApplyHighStrength();
			}
			else
			{
				RestoreStrength();
			}
			if (Settings.InfiniteJump)
			{
				ApplyInfiniteJump();
			}
			if (Settings.InfiniteRange)
			{
				ApplyInfiniteRange();
			}
			else
			{
				RestoreRange();
			}
			if (Settings.CheapShop)
			{
				ApplyShopPrice();
			}
			else
			{
				RestoreShopPrices();
			}
			if (Settings.InfiniteBattery)
			{
				ApplyInfiniteBattery();
			}
			PlayerSession.Apply();
		}

		private void SetMenuOpen(bool open)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (open != Settings.MenuOpen)
			{
				Settings.MenuOpen = open;
				if (open)
				{
					_savedLock = Cursor.lockState;
					_savedVisible = Cursor.visible;
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = false;
					ModLog.Info("menu OPEN");
				}
				else
				{
					Cursor.lockState = _savedLock;
					Cursor.visible = _savedVisible;
					ModLog.Info("menu closed");
				}
			}
		}

		private void OnGUI()
		{
			//IL_003d: 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)
			try
			{
				if (Time.unscaledTime - _lastGuiLog > 5f)
				{
					_lastGuiLog = Time.unscaledTime;
					ModLog.Info("OnGUI alive, event=" + ((Event.current == null) ? "null" : ((object)Event.current.type/*cast due to .constrained prefix*/).ToString()) + " esp=" + Settings.EspEnabled + " pixel=" + ((Object)(object)_pixel != (Object)null));
				}
				EnsureStyles();
				if (Settings.EspEnabled)
				{
					DrawEsp();
				}
				if (Settings.PlayerEsp || Settings.TruckEsp || Settings.ExtractionEsp || Settings.EnemyEsp)
				{
					DrawWorldEsp();
				}
			}
			catch (Exception e)
			{
				ModLog.Error("OnGUI", e);
			}
		}

		private void OnEnable()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			CameraCallback onPreRender = Camera.onPreRender;
			object obj = <>O.<0>__OnCameraPreRender;
			if (obj == null)
			{
				CameraCallback val = OnCameraPreRender;
				<>O.<0>__OnCameraPreRender = val;
				obj = (object)val;
			}
			Camera.onPreRender = (CameraCallback)Delegate.Combine((Delegate?)(object)onPreRender, (Delegate?)obj);
		}

		private void OnDisable()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			CameraCallback onPreRender = Camera.onPreRender;
			object obj = <>O.<0>__OnCameraPreRender;
			if (obj == null)
			{
				CameraCallback val = OnCameraPreRender;
				<>O.<0>__OnCameraPreRender = val;
				obj