Decompiled source of AlwaysMap v1.1.0

plugins/AlwaysMap/AlwaysMap.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AlwaysMap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("AlwaysMap")]
[assembly: AssemblyTitle("AlwaysMap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[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 AlwaysMap
{
	internal static class Lang
	{
		internal sealed class Row
		{
			internal readonly string Id;

			internal readonly string LegacySection;

			internal readonly string LegacyKey;

			internal readonly string[] Sections;

			internal readonly string[] Names;

			internal readonly string[] Descriptions;

			internal Row(string id, string legacySection, string legacyKey, string[] sections, string en, string zh, string enDesc, string zhDesc)
			{
				Id = id;
				LegacySection = legacySection;
				LegacyKey = legacyKey;
				Sections = sections;
				Names = new string[2] { en, zh };
				Descriptions = new string[2] { enDesc, zhDesc };
			}

			internal bool Matches(ConfigDefinition definition)
			{
				if (definition.Section == LegacySection && definition.Key == LegacyKey)
				{
					return true;
				}
				for (int i = 0; i < 2; i++)
				{
					if (definition.Section == Sections[i] && definition.Key == Names[i])
					{
						return true;
					}
				}
				return false;
			}
		}

		internal static readonly string[] Options = new string[3] { "Auto", "English", "中文" };

		internal static ConfigEntry<string> Cur;

		private static int _gameLanguage;

		private static float _gameAt = -99f;

		private static readonly string[] General = new string[2] { "1.General", "1.常规" };

		private static readonly string[] Keys = new string[2] { "2.Keys", "2.按键" };

		private static readonly string[] Map = new string[2] { "3.Map", "3.地图" };

		private static readonly string[] Markers = new string[2] { "4.Markers", "4.标记" };

		private static readonly string[] Window = new string[2] { "5.Window", "5.窗口" };

		internal static readonly Row Language = new Row("language", "0.Language", "Language", new string[2] { "0.Language", "0.语言" }, "Language", "语言", "Auto = follow the game language; unsupported languages use English. Choose English or 中文 to override.", "Auto = 跟随游戏语言;不支持的语言使用英文。选择 English 或 中文 可手动覆盖。");

		internal static readonly Row[] Rows = new Row[22]
		{
			new Row("visible", "General", "Visible", General, "Show map", "显示地图", "Keep the map visible. Use the configured map toggle key to show or hide it.", "常驻显示地图;使用配置的地图开关按键显示或隐藏。"),
			new Row("toggle", "Keys", "Toggle", Keys, "Map toggle key", "地图开关按键", "Press to show or hide the map.", "按下以显示或隐藏地图。"),
			new Row("edit", "Keys", "Edit", Keys, "Map edit key", "地图编辑按键", "Enter or exit edit mode. Drag the map with the mouse while editing; Escape also exits.", "进入或退出编辑模式;编辑时可用鼠标拖动地图,Esc 也可退出。"),
			new Row("reveal", "Map", "RevealAllRooms", Map, "Reveal all rooms", "显示全部房间", "Show all rooms locally only. Does not change exploration progress or send RPCs.", "仅本机显示全部房间,不修改探索进度或发送 RPC。"),
			new Row("follow", "Map", "FollowPlayer", Map, "Follow player", "跟随自己", "Center on yourself. When disabled, center on the entire map instead.", "跟随自己;关闭后以全图中心定位。"),
			new Row("players", "Markers", "Players", Markers, "Show players", "显示玩家", "Show teammates as blue dots. Your own arrow has a separate switch.", "以蓝色小点显示队友;自己箭头由单独开关控制。"),
			new Row("self", "Markers", "Self", Markers, "Show own arrow", "显示自己箭头", "Show yourself as a blue directional arrow.", "以蓝色方向箭头显示自己。"),
			new Row("carts", "Markers", "Carts", Markers, "Show carts", "显示推车", "Show carts as blue square outlines, independently of weapons/items.", "以蓝色小方框显示推车,与武器道具开关独立。"),
			new Row("enemies", "Markers", "Enemies", Markers, "Show enemies", "显示怪物", "Show enemies that are currently spawned and alive.", "显示当前已生成且活着的怪物。"),
			new Row("valuables", "Markers", "Valuables", Markers, "Show valuables", "显示贵重物品", "Show valuables not yet committed to extraction, including undiscovered items.", "显示未结算的贵重物品,包含未发现物品。"),
			new Row("labels", "Markers", "Labels", Markers, "Show labels", "显示标签", "Show names and item values on the current floor only.", "显示本层名称与物品价值,不显示上下层。"),
			new Row("minvalue", "Markers", "MinimumValue", Markers, "Minimum item value", "物品最低价值", "Minimum current value of valuables to display.", "显示贵重物品的最低当前价值。"),
			new Row("x", "Window", "X", Window, "Horizontal position", "横向位置", "Horizontal position as a fraction of the available screen space.", "横向位置占可用屏幕空间的比例。"),
			new Row("y", "Window", "Y", Window, "Vertical position", "纵向位置", "Vertical position as a fraction of the available screen space.", "纵向位置占可用屏幕空间的比例。"),
			new Row("size", "Window", "Size", Window, "Map size", "地图大小", "Map width in screen pixels. Drag the bottom-right corner in edit mode to resize.", "地图宽度(屏幕像素);编辑时拖动右下角调整。"),
			new Row("zoom", "Map", "Zoom", Map, "Zoom", "缩放", "Pixels per world unit. Use the mouse wheel in edit mode to zoom.", "每世界单位的像素数;编辑时使用鼠标滚轮缩放。"),
			new Row("hints", "Window", "ShowHints", Window, "Show map hints", "显示地图提示", "Show the title, shortcut hints, compass and zoom text. Can be hidden independently of entity labels.", "显示标题、快捷键、方位与缩放文字;可关闭,不影响实体标签。"),
			new Row("legend", "Window", "ShowLegend", Window, "Show marker legend", "显示标记图例", "Show the text legend below the map. Disable for a clean transparent map.", "显示地图下方的符号图例;关闭可获得干净的透明地图。"),
			new Row("items", "Markers", "Items", Markers, "Show weapons and items", "显示武器道具", "Show spawned weapons, equipment and consumables on this floor.", "显示本层已生成的武器、装备和消耗道具。"),
			new Row("navigation", "Markers", "Navigation", Markers, "Show vanilla navigation", "显示原版导航", "Follow the game's selected extraction target, then the truck after the final extraction. Current floor only.", "跟随原版选中的提取点,最终提交后指向卡车;仅本层显示。"),
			new Row("fps", "Map", "RefreshRate", Map, "Map refresh rate", "地图刷新频率", "Background map frames per second. Lower values reduce rendering/readback cost. Entity dots remain independent.", "底图每秒刷新次数;调低可减少渲染和读回开销,不限制实体小点更新。"),
			new Row("resolution", "Map", "Resolution", Map, "Map render resolution", "地图渲染分辨率", "Longest texture edge. 256 is the default; 128 reduces cost, 384/512 improves detail at higher cost.", "底图纹理最长边像素;默认256,128更省性能,384/512更清晰但开销较大。")
		};

		internal static int Idx
		{
			get
			{
				string text = Cur?.Value ?? "Auto";
				if (text == "English")
				{
					return 0;
				}
				if (text == "中文")
				{
					return 1;
				}
				if (Time.unscaledTime - _gameAt >= 1f)
				{
					_gameAt = Time.unscaledTime;
					try
					{
						_gameLanguage = ((SemiFunc.LocaleGetCode() ?? "en").StartsWith("zh", StringComparison.OrdinalIgnoreCase) ? 1 : 0);
					}
					catch
					{
						_gameLanguage = 0;
					}
				}
				return _gameLanguage;
			}
		}

		internal static string You => Pick("YOU", "自己");

		internal static string Legend => Pick("Blue: you/ally/cart · Red: enemy · Yellow: value · White: gear", "蓝:自己/队友/推车  红:怪物  黄:财物  白:道具");

		internal static string Reset => Pick("Reset", "重置");

		internal static string EditHint => Pick("LMB move · RMB pan · corner resize", "左键拖位置 · 右键平移 · 右下角改大小");

		internal static string Pick(string en, string zh)
		{
			if (Idx != 1)
			{
				return en;
			}
			return zh;
		}

		internal unsafe static string Title(bool editing, KeyCode edit, KeyCode toggle)
		{
			if (!editing)
			{
				return Pick("MAP · " + ((object)(*(KeyCode*)(&edit))/*cast due to .constrained prefix*/).ToString() + " edit · " + ((object)(*(KeyCode*)(&toggle))/*cast due to .constrained prefix*/).ToString() + " hide", "地图 · " + ((object)(*(KeyCode*)(&edit))/*cast due to .constrained prefix*/).ToString() + " 编辑 · " + ((object)(*(KeyCode*)(&toggle))/*cast due to .constrained prefix*/).ToString() + " 隐藏");
			}
			return Pick("MAP EDIT · drag / scroll to zoom", "地图编辑 · 拖动移动 / 滚轮缩放");
		}

		internal static string Position(int floor, float zoom)
		{
			return Pick("N ↑ | Floor ", "北 ↑ | 楼层 ") + floor + " | x" + zoom.ToString("0.0");
		}

		internal static string Follow(bool on)
		{
			if (!on)
			{
				return Pick("Follow: OFF", "跟随自己:关");
			}
			return Pick("Follow: ON", "跟随自己:开");
		}

		internal unsafe static string SaveExit(KeyCode edit)
		{
			return Pick("Save / Exit ", "保存 / 退出 ") + ((object)(*(KeyCode*)(&edit))/*cast due to .constrained prefix*/).ToString();
		}

		internal static Row Find(string id)
		{
			Row[] rows = Rows;
			foreach (Row row in rows)
			{
				if (row.Id == id)
				{
					return row;
				}
			}
			throw new ArgumentException("Unknown config row: " + id);
		}
	}
	internal static class LangHost
	{
		private static ConfigFile _config;

		private static readonly Dictionary<string, ConfigEntryBase> Entries = new Dictionary<string, ConfigEntryBase>();

		private static readonly Dictionary<ConfigDefinition, string> Saved = new Dictionary<ConfigDefinition, string>();

		private static int _applied = -1;

		private static float _refreshAt = -1f;

		internal static void Init(ConfigFile config)
		{
			_config = config;
			if (GetMember(config, "OrphanedEntries") is IDictionary dictionary)
			{
				foreach (DictionaryEntry item in dictionary)
				{
					object key = item.Key;
					ConfigDefinition val = (ConfigDefinition)((key is ConfigDefinition) ? key : null);
					if (val != null && item.Value is string value)
					{
						Saved[val] = value;
					}
				}
			}
			Lang.Cur = config.Bind<string>(Lang.Language.Sections[0], Lang.Language.Names[0], "Auto", Description(Lang.Language, 0, (AcceptableValueBase)(object)new AcceptableValueList<string>(Lang.Options)));
			Restore((ConfigEntryBase)(object)Lang.Cur, FindSaved(Lang.Language));
			_applied = Lang.Idx;
			Lang.Cur.SettingChanged += delegate
			{
				Apply();
			};
		}

		internal static ConfigEntry<T> B<T>(string id, T defaultValue, AcceptableValueBase range = null)
		{
			Lang.Row row = Lang.Find(id);
			int idx = Lang.Idx;
			ConfigEntry<T> val = _config.Bind<T>(row.Sections[idx], row.Names[idx], defaultValue, Description(row, idx, range));
			Restore((ConfigEntryBase)(object)val, FindSaved(row));
			Entries[id] = (ConfigEntryBase)(object)val;
			return val;
		}

		private static ConfigDescription Description(Lang.Row row, int i, AcceptableValueBase range)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			return new ConfigDescription(row.Descriptions[i], range, Array.Empty<object>());
		}

		private static string FindSaved(Lang.Row row)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			if (Saved.TryGetValue(new ConfigDefinition(row.Sections[Lang.Idx], row.Names[Lang.Idx]), out var value))
			{
				return value;
			}
			if (Saved.TryGetValue(new ConfigDefinition(row.LegacySection, row.LegacyKey), out value))
			{
				return value;
			}
			if (!Saved.TryGetValue(new ConfigDefinition(row.Sections[1 - Lang.Idx], row.Names[1 - Lang.Idx]), out value))
			{
				return null;
			}
			return value;
		}

		private static void Restore(ConfigEntryBase entry, string value)
		{
			if (value == null)
			{
				return;
			}
			try
			{
				entry.SetSerializedValue(value);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Could not restore " + ((object)entry.Definition)?.ToString() + ": " + ex.Message));
			}
		}

		internal static void Finish()
		{
			Apply();
			Saved.Clear();
		}

		internal static void Tick()
		{
			if (_applied >= 0 && Lang.Idx != _applied)
			{
				Apply();
			}
			if (_refreshAt >= 0f && Time.unscaledTime >= _refreshAt)
			{
				_refreshAt = -1f;
				RefreshMenu();
			}
		}

		private static void Apply()
		{
			if (_config == null)
			{
				return;
			}
			try
			{
				int idx = Lang.Idx;
				if (!(GetMember(_config, "Entries") is IDictionary dictionary))
				{
					throw new MissingMemberException("ConfigFile.Entries");
				}
				List<ConfigEntryBase> list = new List<ConfigEntryBase>(Entries.Values) { (ConfigEntryBase)(object)Lang.Cur };
				foreach (ConfigEntryBase item in list)
				{
					RequireBacking(item, "Definition");
					RequireBacking(item, "Description");
				}
				foreach (ConfigEntryBase item2 in list)
				{
					dictionary.Remove(item2.Definition);
				}
				foreach (KeyValuePair<string, ConfigEntryBase> entry in Entries)
				{
					Localize(entry.Value, Lang.Find(entry.Key), idx);
				}
				Localize((ConfigEntryBase)(object)Lang.Cur, Lang.Language, idx);
				foreach (ConfigEntryBase item3 in list)
				{
					dictionary[item3.Definition] = item3;
				}
				if (GetMember(_config, "OrphanedEntries") is IDictionary dictionary2)
				{
					List<ConfigDefinition> list2 = new List<ConfigDefinition>();
					foreach (DictionaryEntry item4 in dictionary2)
					{
						object key = item4.Key;
						ConfigDefinition val = (ConfigDefinition)((key is ConfigDefinition) ? key : null);
						if (val != null)
						{
							bool flag = Lang.Language.Matches(val);
							Lang.Row[] rows = Lang.Rows;
							foreach (Lang.Row row in rows)
							{
								flag |= row.Matches(val);
							}
							if (flag)
							{
								list2.Add(val);
							}
						}
					}
					foreach (ConfigDefinition item5 in list2)
					{
						dictionary2.Remove(item5);
					}
				}
				_config.Save();
				_applied = idx;
				_refreshAt = Time.unscaledTime + 0.15f;
				Plugin.Log.LogInfo((object)("Language -> " + Lang.Options[idx + 1]));
			}
			catch (Exception ex)
			{
				_applied = Lang.Idx;
				Plugin.Log.LogWarning((object)("Language/config text switch failed: " + ex.Message));
			}
		}

		private static void Localize(ConfigEntryBase entry, Lang.Row row, int i)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			RequireBacking(entry, "Definition").SetValue(entry, (object?)new ConfigDefinition(row.Sections[i], row.Names[i]));
			FieldInfo fieldInfo = RequireBacking(entry, "Description");
			string obj = row.Descriptions[i];
			ConfigDescription description = entry.Description;
			AcceptableValueBase obj2 = ((description != null) ? description.AcceptableValues : null);
			ConfigDescription description2 = entry.Description;
			fieldInfo.SetValue(entry, (object?)new ConfigDescription(obj, obj2, ((description2 != null) ? description2.Tags : null) ?? new object[0]));
		}

		private static object GetMember(object target, string name)
		{
			Type type = target.GetType();
			while (type != null)
			{
				FieldInfo fieldInfo = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("<" + name + ">k__BackingField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (fieldInfo != null)
				{
					return fieldInfo.GetValue(target);
				}
				PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && property.GetIndexParameters().Length == 0)
				{
					return property.GetValue(target);
				}
				type = type.BaseType;
			}
			return null;
		}

		private static FieldInfo RequireBacking(object target, string name)
		{
			Type type = target.GetType();
			while (type != null)
			{
				FieldInfo field = type.GetField("<" + name + ">k__BackingField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					return field;
				}
				type = type.BaseType;
			}
			throw new MissingFieldException(target.GetType().Name, name);
		}

		private static void RefreshMenu()
		{
			try
			{
				Type type = FindType("MenuLib.MenuAPI");
				Type type2 = FindType("REPOConfig.ConfigMenu");
				if (type == null || type2 == null)
				{
					return;
				}
				FieldInfo field = type2.GetField("hasPopupMenuOpened", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (!(field == null))
				{
					object value = field.GetValue(null);
					if (value is bool && (bool)value)
					{
						type.GetMethod("CloseAllPagesAddedOnTop", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null)?.Invoke(null, null);
						type2.GetMethod("CreateModMenu", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null)?.Invoke(null, null);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Menu refresh: " + ex.Message));
			}
		}

		private static Type FindType(string name)
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				Type type = assemblies[i].GetType(name, throwOnError: false);
				if (type != null)
				{
					return type;
				}
			}
			return null;
		}
	}
	internal static class MapExtras
	{
		internal struct MarkerData
		{
			public Vector3 Position;

			public string Symbol;

			public string Label;

			public Color Color;
		}

		private struct CartData
		{
			public PhysGrabCart Cart;

			public PhysGrabObject Physics;

			public ItemAttributes Attributes;
		}

		private struct LocalizedResult
		{
			public string Value;

			public float Expires;
		}

		private static ItemAttributes[] items = Array.Empty<ItemAttributes>();

		private static CartData[] carts = Array.Empty<CartData>();

		private static readonly Dictionary<LocaleAsset, Dictionary<LocalizedAsset, LocalizedResult>> localizedCache = new Dictionary<LocaleAsset, Dictionary<LocalizedAsset, LocalizedResult>>();

		private static readonly Dictionary<Type, PropertyInfo> localeOverrideProperties = new Dictionary<Type, PropertyInfo>();

		private static readonly string[] chineseLocales = new string[4] { "zh-Hans", "zh-CN", "zh-Hant", "zh-TW" };

		private static readonly string[] englishLocales = new string[3] { "en-US", "en-GB", "en" };

		private static int scene = -1;

		private static float nextScan;

		private static readonly Color navigationColor = new Color(0.1f, 1f, 0.85f);

		private static readonly Color itemColor = Color.white;

		private static readonly Color cartColor = new Color(0.4f, 0.75f, 1f);

		private static readonly MethodInfo localizedString = FindLocalizedStringMethod();

		private static readonly FieldInfo localeReference = typeof(LocaleAsset).GetField("LocaleReference");

		private static readonly FieldInfo stringReference = typeof(LocalizedAsset).GetField("stringReference", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly Dictionary<string, string> enemyChinese = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Animal", "畜生" },
			{ "Bang", "自爆骷髅" },
			{ "Beamer", "小丑" },
			{ "Birthday Boy", "寿星男孩" },
			{ "Bomb Thrower", "清道夫" },
			{ "Bowtie", "领结怪" },
			{ "Ceiling Eye", "天眼" },
			{ "Duck", "掠食系霸主" },
			{ "Elsa", "艾尔莎" },
			{ "Floater", "念力大师" },
			{ "Gnome", "侏儒" },
			{ "Head", "大头" },
			{ "Head Grabber", "掠头崽" },
			{ "Heart Hugger", "爱心抱抱狂" },
			{ "Hidden", "隐身怪" },
			{ "Hunter", "猎人" },
			{ "Oogly", "飞蝇" },
			{ "Robe", "长袍怪" },
			{ "Runner", "杀戮狂" },
			{ "Shadow", "织布老妇" },
			{ "Slow Mouth", "呕吐怪" },
			{ "Slow Walker", "重锤肉坦" },
			{ "Spinny", "赌徒" },
			{ "Thin Man", "暗影幼童" },
			{ "Tick", "蜱虫" },
			{ "Tricycle", "贝拉" },
			{ "Tumbler", "主厨" },
			{ "Upscream", "尖叫蛛" },
			{ "Valuable Thrower", "熊孩子" },
			{ "Snatcher", "小马" }
		};

		internal static void Scan()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_007f: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			int num = SceneHandle.op_Implicit(((Scene)(ref activeScene)).handle);
			if (scene != num)
			{
				localizedCache.Clear();
			}
			scene = num;
			nextScan = Time.unscaledTime + 1f;
			items = Object.FindObjectsByType<ItemAttributes>((FindObjectsSortMode)0);
			List<CartData> list = new List<CartData>();
			PhysGrabCart[] array = Object.FindObjectsByType<PhysGrabCart>((FindObjectsSortMode)0);
			foreach (PhysGrabCart val in array)
			{
				if (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).isActiveAndEnabled)
				{
					continue;
				}
				activeScene = ((Component)val).gameObject.scene;
				if (!(((Scene)(ref activeScene)).handle != SceneHandle.op_Implicit(scene)))
				{
					PhysGrabObject component = ((Component)val).GetComponent<PhysGrabObject>();
					if (Object.op_Implicit((Object)(object)component))
					{
						list.Add(new CartData
						{
							Cart = val,
							Physics = component,
							Attributes = ((Component)val).GetComponent<ItemAttributes>()
						});
					}
				}
			}
			carts = list.ToArray();
		}

		internal static IEnumerable<MarkerData> Carts(bool chinese)
		{
			SceneHandle val = SceneHandle.op_Implicit(scene);
			Scene activeScene = SceneManager.GetActiveScene();
			if (val != ((Scene)(ref activeScene)).handle || Time.unscaledTime >= nextScan)
			{
				Scan();
			}
			CartData[] array = carts;
			for (int i = 0; i < array.Length; i++)
			{
				CartData cartData = array[i];
				PhysGrabCart cart = cartData.Cart;
				PhysGrabObject physics = cartData.Physics;
				if (!Object.op_Implicit((Object)(object)cart) || !((Behaviour)cart).isActiveAndEnabled)
				{
					continue;
				}
				activeScene = ((Component)cart).gameObject.scene;
				if (!(((Scene)(ref activeScene)).handle != SceneHandle.op_Implicit(scene)) && Object.op_Implicit((Object)(object)physics) && ((Behaviour)physics).isActiveAndEnabled && physics.spawned && !physics.dead)
				{
					string text = ItemName(cartData.Attributes, chinese);
					if (string.IsNullOrWhiteSpace(text))
					{
						text = (chinese ? "推车" : "Cart");
					}
					yield return new MarkerData
					{
						Position = ((Component)physics).transform.position,
						Symbol = "□",
						Label = text,
						Color = cartColor
					};
				}
			}
		}

		private static string ItemName(ItemAttributes attributes, bool chinese)
		{
			if (!Object.op_Implicit((Object)(object)attributes))
			{
				return null;
			}
			string text = (Object.op_Implicit((Object)(object)attributes.item) ? Localized(attributes.item.itemNameLocalized, chinese) : null);
			if (string.IsNullOrWhiteSpace(text) && Object.op_Implicit((Object)(object)attributes.item))
			{
				text = attributes.item.itemName;
			}
			if (!string.IsNullOrWhiteSpace(text))
			{
				return text;
			}
			return attributes.itemName;
		}

		internal static IEnumerable<MarkerData> Navigation(bool chinese)
		{
			LevelGenerator instance = LevelGenerator.Instance;
			RoundDirector instance2 = RoundDirector.instance;
			if (!Object.op_Implicit((Object)(object)instance) || !instance.Generated || !Object.op_Implicit((Object)(object)instance2) || SemiFunc.RunIsShop())
			{
				yield break;
			}
			if (instance2.allExtractionPointsCompleted)
			{
				foreach (LevelPoint levelPathPoint in instance.LevelPathPoints)
				{
					if (Object.op_Implicit((Object)(object)levelPathPoint) && Object.op_Implicit((Object)(object)levelPathPoint.Room) && levelPathPoint.Room.Truck)
					{
						yield return new MarkerData
						{
							Position = ((Component)levelPathPoint).transform.position,
							Symbol = "T",
							Label = (chinese ? "返回卡车" : "Return to truck"),
							Color = navigationColor
						};
						yield break;
					}
				}
			}
			else
			{
				ExtractionPoint extractionPointCurrent = instance2.extractionPointCurrent;
				if (Object.op_Implicit((Object)(object)extractionPointCurrent))
				{
					yield return new MarkerData
					{
						Position = ((Component)extractionPointCurrent).transform.position,
						Symbol = "E",
						Label = (chinese ? "提取点" : "Extraction point"),
						Color = navigationColor
					};
				}
			}
		}

		internal static IEnumerable<MarkerData> Items(bool chinese)
		{
			SceneHandle val = SceneHandle.op_Implicit(scene);
			Scene activeScene = SceneManager.GetActiveScene();
			if (val != ((Scene)(ref activeScene)).handle || Time.unscaledTime >= nextScan)
			{
				Scan();
			}
			ItemAttributes[] array = items;
			foreach (ItemAttributes val2 in array)
			{
				if (!Object.op_Implicit((Object)(object)val2) || !((Behaviour)val2).isActiveAndEnabled || !Object.op_Implicit((Object)(object)val2.item))
				{
					continue;
				}
				activeScene = ((Component)val2).gameObject.scene;
				if (((Scene)(ref activeScene)).handle != SceneHandle.op_Implicit(scene))
				{
					continue;
				}
				PhysGrabObject component = ((Component)val2).GetComponent<PhysGrabObject>();
				if (Object.op_Implicit((Object)(object)component) && ((Behaviour)component).isActiveAndEnabled && component.spawned && !component.dead && !component.isValuable && !Object.op_Implicit((Object)(object)((Component)val2).GetComponent<ValuableObject>()) && !Object.op_Implicit((Object)(object)((Component)component).GetComponent<PhysGrabCart>()))
				{
					string text = ItemName(val2, chinese);
					if (string.IsNullOrWhiteSpace(text))
					{
						text = (chinese ? "道具" : "Item");
					}
					yield return new MarkerData
					{
						Position = ((Component)component).transform.position,
						Symbol = "I",
						Label = text,
						Color = itemColor
					};
				}
			}
		}

		internal static string EnemyName(EnemyParent e, bool chinese)
		{
			if (!Object.op_Implicit((Object)(object)e))
			{
				if (!chinese)
				{
					return "Enemy";
				}
				return "敌人";
			}
			string text = Localized(e.enemyNameLocalized, chinese);
			if (!string.IsNullOrWhiteSpace(text) && (!chinese || ContainsChinese(text)))
			{
				return text;
			}
			string enemyName = e.enemyName;
			if (string.IsNullOrWhiteSpace(enemyName))
			{
				if (!chinese)
				{
					return "Enemy";
				}
				return "敌人";
			}
			if (!chinese || !enemyChinese.TryGetValue(enemyName, out var value))
			{
				return enemyName;
			}
			return value;
		}

		private static bool ContainsChinese(string value)
		{
			foreach (char c in value)
			{
				if (c >= '㐀' && c <= '鿿')
				{
					return true;
				}
			}
			return false;
		}

		private static MethodInfo FindLocalizedStringMethod()
		{
			MethodInfo[] methods = typeof(LocalizedAsset).GetMethods(BindingFlags.Instance | BindingFlags.Public);
			foreach (MethodInfo methodInfo in methods)
			{
				ParameterInfo[] parameters = methodInfo.GetParameters();
				if (methodInfo.Name == "GetLocalizedString" && methodInfo.ReturnType == typeof(string) && parameters.Length == 1 && parameters[0].ParameterType.FullName == "UnityEngine.Localization.Locale")
				{
					return methodInfo;
				}
			}
			return null;
		}

		private static string Localized(LocalizedAsset asset, bool chinese)
		{
			if (!Object.op_Implicit((Object)(object)asset) || localizedString == null || localeReference == null)
			{
				return null;
			}
			LocalizationManager instance = LocalizationManager.instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				return null;
			}
			LocaleAsset value = null;
			string[] array = (chinese ? chineseLocales : englishLocales);
			foreach (string key in array)
			{
				if (instance.Locales.TryGetValue(key, out value) && Object.op_Implicit((Object)(object)value))
				{
					break;
				}
				value = null;
			}
			if (!Object.op_Implicit((Object)(object)value))
			{
				foreach (KeyValuePair<string, LocaleAsset> locale in instance.Locales)
				{
					if (locale.Key.StartsWith(chinese ? "zh" : "en", StringComparison.OrdinalIgnoreCase) && Object.op_Implicit((Object)(object)locale.Value))
					{
						value = locale.Value;
						break;
					}
				}
			}
			if (!Object.op_Implicit((Object)(object)value))
			{
				return null;
			}
			if (!localizedCache.TryGetValue(value, out var value2))
			{
				value2 = new Dictionary<LocalizedAsset, LocalizedResult>();
				localizedCache.Add(value, value2);
			}
			float unscaledTime = Time.unscaledTime;
			if (value2.TryGetValue(asset, out var value3) && unscaledTime < value3.Expires)
			{
				return value3.Value;
			}
			string text = ResolveLocalized(asset, value);
			value2[asset] = new LocalizedResult
			{
				Value = text,
				Expires = unscaledTime + 1f
			};
			return text;
		}

		private static string ResolveLocalized(LocalizedAsset asset, LocaleAsset selected)
		{
			try
			{
				object value = localeReference.GetValue(selected);
				if (value == null)
				{
					return null;
				}
				object obj = stringReference?.GetValue(asset);
				if (obj == null)
				{
					return null;
				}
				Type type = obj.GetType();
				if (!localeOverrideProperties.TryGetValue(type, out var value2))
				{
					value2 = type.GetProperty("LocaleOverride");
					localeOverrideProperties.Add(type, value2);
				}
				if (value2 == null || !value2.CanRead || !value2.CanWrite)
				{
					return null;
				}
				object value3 = value2.GetValue(obj);
				string text;
				try
				{
					text = localizedString.Invoke(asset, new object[1] { value }) as string;
				}
				finally
				{
					if (value2 != null)
					{
						value2.SetValue(obj, value3);
					}
				}
				return (string.IsNullOrWhiteSpace(text) || text.StartsWith("No translation found", StringComparison.OrdinalIgnoreCase)) ? null : text;
			}
			catch (Exception)
			{
				return null;
			}
		}
	}
	[DefaultExecutionOrder(-1000)]
	[BepInPlugin("com.yanyan.repo.alwaysmap", "Always Map 常驻地图", "1.1.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string Id = "com.yanyan.repo.alwaysmap";

		internal static ManualLogSource Log;

		private ConfigEntry<bool> visible;

		private ConfigEntry<bool> reveal;

		private ConfigEntry<bool> playersOn;

		private ConfigEntry<bool> enemiesOn;

		private ConfigEntry<bool> valuablesOn;

		private ConfigEntry<bool> namesOn;

		private ConfigEntry<bool> follow;

		private ConfigEntry<bool> itemsOn;

		private ConfigEntry<bool> navigationOn;

		private ConfigEntry<bool> hintsOn;

		private ConfigEntry<bool> legendOn;

		private ConfigEntry<bool> selfOn;

		private ConfigEntry<bool> cartsOn;

		private ConfigEntry<KeyCode> toggleKey;

		private ConfigEntry<KeyCode> editKey;

		private ConfigEntry<float> x;

		private ConfigEntry<float> y;

		private ConfigEntry<float> size;

		private ConfigEntry<float> zoom;

		private ConfigEntry<float> minValue;

		private ConfigEntry<float> mapFps;

		private ConfigEntry<int> mapResolution;

		private Texture2D dotTexture;

		private Texture2D arrowTexture;

		private static readonly Color MarkerBlue = new Color(0.1f, 0.55f, 1f);

		private float nextBounds;

		private int boundsFloor = int.MinValue;

		private Vector2 mapCenter;

		private Rect currentMapRect;

		private readonly NavMeshPath navigationPath = new NavMeshPath();

		private float nextPath;

		private Vector3 lastDestination;

		private Vector3[] route = Array.Empty<Vector3>();

		private readonly VanillaMapRenderer vanilla = new VanillaMapRenderer();

		private float nextRender;

		private bool frameReady;

		private Map frameMap;

		private readonly List<InputKey> noGameKeys = new List<InputKey>();

		private PlayerAvatar[] players = Array.Empty<PlayerAvatar>();

		private EnemyParent[] enemies = Array.Empty<EnemyParent>();

		private ValuableObject[] valuables = Array.Empty<ValuableObject>();

		private float nextScan;

		private float nextError;

		private bool editing;

		private bool dragging;

		private bool resizing;

		private bool panning;

		private Vector2 lastMouse;

		private Vector2 pan;

		private Rect window;

		private GUIStyle text;

		private GUIStyle small;

		private CursorLockMode previousLock;

		private bool previousVisible;

		private int scene = -1;

		private void Awake()
		{
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			LangHost.Init(((BaseUnityPlugin)this).Config);
			visible = LangHost.B("visible", defaultValue: true);
			toggleKey = LangHost.B<KeyCode>("toggle", (KeyCode)285);
			editKey = LangHost.B<KeyCode>("edit", (KeyCode)286);
			reveal = LangHost.B("reveal", defaultValue: true);
			follow = LangHost.B("follow", defaultValue: true);
			playersOn = LangHost.B("players", defaultValue: true);
			selfOn = LangHost.B("self", defaultValue: true);
			cartsOn = LangHost.B("carts", defaultValue: true);
			enemiesOn = LangHost.B("enemies", defaultValue: true);
			valuablesOn = LangHost.B("valuables", defaultValue: true);
			namesOn = LangHost.B("labels", defaultValue: true);
			itemsOn = LangHost.B("items", defaultValue: true);
			navigationOn = LangHost.B("navigation", defaultValue: true);
			hintsOn = LangHost.B("hints", defaultValue: true);
			legendOn = LangHost.B("legend", defaultValue: true);
			minValue = LangHost.B("minvalue", 0f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000000f));
			x = LangHost.B("x", 0.74f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			y = LangHost.B("y", 0.04f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f));
			size = LangHost.B("size", 360f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(240f, 900f));
			zoom = LangHost.B("zoom", 5f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f));
			mapFps = LangHost.B("fps", 10f, (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 30f));
			mapResolution = LangHost.B("resolution", 256, (AcceptableValueBase)(object)new AcceptableValueRange<int>(128, 512));
			LangHost.Finish();
			Log.LogInfo((object)("Always Map 1.1.0 loaded: " + ((object)toggleKey.Value/*cast due to .constrained prefix*/).ToString() + " toggle, " + ((object)editKey.Value/*cast due to .constrained prefix*/).ToString() + " edit. Local display only."));
		}

		private bool InLevel()
		{
			if (Object.op_Implicit((Object)(object)Map.Instance) && !SemiFunc.MenuLevel() && !SemiFunc.RunIsLobby())
			{
				return !SemiFunc.RunIsArena();
			}
			return false;
		}

		private bool InputAllowed()
		{
			if (SemiFunc.NoTextInputsActive())
			{
				if (Object.op_Implicit((Object)(object)MenuManager.instance))
				{
					return !Object.op_Implicit((Object)(object)MenuManager.instance.currentMenuPage);
				}
				return true;
			}
			return false;
		}

		private void Update()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				LangHost.Tick();
				if (!InLevel())
				{
					StopEditing();
					return;
				}
				if (!InputAllowed())
				{
					StopEditing();
					return;
				}
				if (Input.GetKeyDown(toggleKey.Value))
				{
					visible.Value = !visible.Value;
					if (!visible.Value)
					{
						StopEditing();
					}
					((BaseUnityPlugin)this).Config.Save();
				}
				if (visible.Value && Input.GetKeyDown(editKey.Value))
				{
					if (editing)
					{
						StopEditing();
					}
					else
					{
						previousLock = Cursor.lockState;
						previousVisible = Cursor.visible;
						editing = true;
					}
				}
				if (editing && Input.GetKeyDown((KeyCode)27))
				{
					StopEditing();
				}
				if (editing && Object.op_Implicit((Object)(object)InputManager.instance))
				{
					InputManager.instance.DisableControlsExcept(0.1f, noGameKeys);
				}
				Scene activeScene = SceneManager.GetActiveScene();
				int num = SceneHandle.op_Implicit(((Scene)(ref activeScene)).handle);
				if (num != scene)
				{
					scene = num;
					pan = Vector2.zero;
					frameReady = false;
					frameMap = null;
					boundsFloor = int.MinValue;
					nextBounds = 0f;
					nextScan = (nextRender = 0f);
				}
				if (visible.Value && Time.unscaledTime >= nextScan)
				{
					nextScan = Time.unscaledTime + 1f;
					players = Object.FindObjectsByType<PlayerAvatar>((FindObjectsSortMode)0);
					enemies = Object.FindObjectsByType<EnemyParent>((FindObjectsSortMode)0);
					valuables = Object.FindObjectsByType<ValuableObject>((FindObjectsSortMode)0);
					MapExtras.Scan();
				}
			}
			catch (Exception e)
			{
				Report(e);
				StopEditing();
			}
		}

		private void LateUpdate()
		{
			if (!editing)
			{
				return;
			}
			if (!InLevel() || !InputAllowed())
			{
				StopEditing();
				return;
			}
			SemiFunc.CursorUnlock(0.1f);
			if (Object.op_Implicit((Object)(object)InputManager.instance))
			{
				InputManager.instance.DisableControlsExcept(0.1f, noGameKeys);
				SemiFunc.InputDisableAiming();
				SemiFunc.InputDisableMovement();
			}
			if (Object.op_Implicit((Object)(object)PlayerController.instance))
			{
				PlayerController.instance.InputDisable(0.1f);
			}
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}

		private void StopEditing()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (editing)
			{
				editing = (dragging = (resizing = (panning = false)));
				Cursor.lockState = previousLock;
				Cursor.visible = previousVisible;
				((BaseUnityPlugin)this).Config.Save();
			}
		}

		private void OnDisable()
		{
			StopEditing();
			frameReady = false;
		}

		private void OnDestroy()
		{
			StopEditing();
			vanilla.Dispose();
			if (Object.op_Implicit((Object)(object)dotTexture))
			{
				Object.Destroy((Object)(object)dotTexture);
			}
			if (Object.op_Implicit((Object)(object)arrowTexture))
			{
				Object.Destroy((Object)(object)arrowTexture);
			}
		}

		private void Report(Exception e)
		{
			if (!(Time.unscaledTime < nextError))
			{
				nextError = Time.unscaledTime + 10f;
				((BaseUnityPlugin)this).Logger.LogWarning((object)e.ToString());
			}
		}

		private static int Floor(float height)
		{
			return Mathf.FloorToInt((height + 0.1f) / 4f);
		}

		private void OnGUI()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			if (!visible.Value || !InLevel() || ((int)Event.current.type != 7 && !editing))
			{
				return;
			}
			try
			{
				Draw();
			}
			catch (Exception e)
			{
				Report(e);
			}
		}

		private void Draw()
		{
			//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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_012d: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: 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_020d: 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_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Invalid comparison between Unknown and I4
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Invalid comparison between Unknown and I4
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Invalid comparison between Unknown and I4
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_070e: Invalid comparison between Unknown and I4
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a1: Invalid comparison between Unknown and I4
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0805: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Invalid comparison between Unknown and I4
			//IL_0898: Unknown result type (might be due to invalid IL or missing references)
			//IL_089e: Invalid comparison between Unknown and I4
			//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b10: Unknown result type (might be due to invalid IL or missing references)
			//IL_07da: Unknown result type (might be due to invalid IL or missing references)
			//IL_07de: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0847: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Unknown result type (might be due to invalid IL or missing references)
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0873: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0971: Unknown result type (might be due to invalid IL or missing references)
			//IL_0995: Unknown result type (might be due to invalid IL or missing references)
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_099c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0982: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09df: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a76: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a07: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a30: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3e: Unknown result type (might be due to invalid IL or missing references)
			if (text == null)
			{
				text = new GUIStyle(GUI.skin.label)
				{
					fontSize = 12,
					alignment = (TextAnchor)3
				};
				text.normal.textColor = Color.white;
				small = new GUIStyle(text)
				{
					fontSize = 11
				};
			}
			float num = Mathf.Min(new float[3]
			{
				size.Value,
				Screen.width - 12,
				Screen.height - 12
			});
			float num2 = (hintsOn.Value ? 28f : 0f);
			float num3 = (legendOn.Value ? 22f : 0f);
			float num4 = (editing ? 82f : 0f);
			float num5 = Mathf.Min(num + num2 + num3 + num4, (float)(Screen.height - 12));
			window = new Rect(x.Value * Mathf.Max(0f, (float)Screen.width - num), y.Value * Mathf.Max(0f, (float)Screen.height - num5), num, num5);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref window)).x, ((Rect)(ref window)).y + num2, num, num5 - num2 - num3 - num4);
			currentMapRect = val;
			HandleMouse();
			if (hintsOn.Value)
			{
				GUI.Label(new Rect(((Rect)(ref window)).x + 6f, ((Rect)(ref window)).y + 2f, num - 12f, 24f), Lang.Title(editing, editKey.Value, toggleKey.Value), text);
			}
			Vector3 val2 = (Object.op_Implicit((Object)(object)PlayerController.instance) ? ((Component)PlayerController.instance).transform.position : Vector3.zero);
			int num6 = Floor(val2.y);
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(val2.x, val2.z);
			if (!follow.Value)
			{
				if (Time.unscaledTime >= nextBounds || boundsFloor != num6)
				{
					nextBounds = Time.unscaledTime + 2f;
					boundsFloor = num6;
					bool flag = true;
					Vector2 val4 = Vector2.zero;
					Vector2 val5 = Vector2.zero;
					MapObject[] componentsInChildren = ((Component)Map.Instance).GetComponentsInChildren<MapObject>(true);
					Vector2 val7 = default(Vector2);
					foreach (MapObject val6 in componentsInChildren)
					{
						if (Object.op_Implicit((Object)(object)val6) && Object.op_Implicit((Object)(object)val6.parent) && Floor(val6.parent.position.y) == num6)
						{
							Vector3 position = val6.parent.position;
							((Vector2)(ref val7))..ctor(position.x, position.z);
							if (flag)
							{
								val4 = (val5 = val7);
								flag = false;
							}
							else
							{
								val4 = Vector2.Min(val4, val7);
								val5 = Vector2.Max(val5, val7);
							}
						}
					}
					mapCenter = (flag ? val3 : ((val4 + val5) * 0.5f));
				}
				val3 = mapCenter;
			}
			val3 += pan;
			GUI.BeginGroup(val);
			try
			{
				Vector2 origin = default(Vector2);
				((Vector2)(ref origin))..ctor(((Rect)(ref val)).width / 2f, ((Rect)(ref val)).height / 2f);
				if ((int)Event.current.type == 7 && (Time.unscaledTime >= nextRender || (Object)(object)frameMap != (Object)(object)Map.Instance))
				{
					nextRender = Time.unscaledTime + 1f / mapFps.Value;
					vanilla.RefreshRate = mapFps.Value;
					vanilla.Resolution = mapResolution.Value;
					frameReady = vanilla.Render(Map.Instance, new Vector3(val3.x, val2.y, val3.y), num6, zoom.Value, ((Rect)(ref val)).width, ((Rect)(ref val)).height, reveal.Value);
					frameMap = Map.Instance;
				}
				if (frameReady && Object.op_Implicit((Object)(object)vanilla.Texture))
				{
					GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), vanilla.Texture, (ScaleMode)0, true);
				}
				else
				{
					GUI.Label(new Rect(12f, 28f, ((Rect)(ref val)).width - 24f, 50f), Lang.Pick("Waiting for vanilla map...", "等待原版地图生成…"), text);
				}
				if ((int)Event.current.type == 7 && frameReady && valuablesOn.Value)
				{
					ValuableObject[] array = valuables;
					foreach (ValuableObject val8 in array)
					{
						if (Object.op_Implicit((Object)(object)val8) && ((Behaviour)val8).isActiveAndEnabled && !val8.committedToExtraction && (!Object.op_Implicit((Object)(object)val8.physGrabObject) || !val8.physGrabObject.dead) && val8.dollarValueSet && !(val8.dollarValueCurrent <= 0f) && !(val8.dollarValueCurrent < minValue.Value))
						{
							Marker(((Component)val8).transform.position, "dot", namesOn.Value ? ("$" + Mathf.RoundToInt(val8.dollarValueCurrent)) : "", Color.yellow, num6, val3, origin);
						}
					}
				}
				if ((int)Event.current.type == 7 && frameReady && enemiesOn.Value)
				{
					EnemyParent[] array2 = enemies;
					foreach (EnemyParent val9 in array2)
					{
						if (Object.op_Implicit((Object)(object)val9) && val9.Spawned && Object.op_Implicit((Object)(object)val9.Enemy) && ((Behaviour)val9.Enemy).isActiveAndEnabled && (!Object.op_Implicit((Object)(object)val9.Enemy.Health) || (!val9.Enemy.Health.dead && !val9.Enemy.Health.deadImpulse)))
						{
							Marker(((Component)val9.Enemy).transform.position, "dot", namesOn.Value ? MapExtras.EnemyName(val9, Lang.Idx == 1) : "", Color.red, num6, val3, origin);
						}
					}
				}
				if ((int)Event.current.type == 7 && frameReady && itemsOn.Value)
				{
					foreach (MapExtras.MarkerData item in MapExtras.Items(Lang.Idx == 1))
					{
						Marker(item.Position, "dot", namesOn.Value ? item.Label : "", Color.white, num6, val3, origin);
					}
				}
				if ((int)Event.current.type == 7 && frameReady && navigationOn.Value)
				{
					foreach (MapExtras.MarkerData item2 in MapExtras.Navigation(Lang.Idx == 1))
					{
						NavigationMarker(item2, val2, num6, val3, origin, val);
					}
				}
				if ((int)Event.current.type == 7 && frameReady && cartsOn.Value)
				{
					foreach (MapExtras.MarkerData item3 in MapExtras.Carts(Lang.Idx == 1))
					{
						Marker(item3.Position, "box", namesOn.Value ? item3.Label : "", MarkerBlue, num6, val3, origin);
					}
				}
				if ((int)Event.current.type == 7 && frameReady && (playersOn.Value || selfOn.Value))
				{
					PlayerAvatar[] array3 = players;
					foreach (PlayerAvatar val10 in array3)
					{
						if (!Object.op_Implicit((Object)(object)val10) || !((Behaviour)val10).isActiveAndEnabled || !val10.spawned || (val10.isLocal ? (!selfOn.Value) : (!playersOn.Value)))
						{
							continue;
						}
						Vector3 val11 = (((val10.deadSet || val10.isDisabled) && Object.op_Implicit((Object)(object)val10.playerDeathHead)) ? ((Component)val10.playerDeathHead).transform.position : ((val10.isLocal && Object.op_Implicit((Object)(object)PlayerController.instance)) ? ((Component)PlayerController.instance).transform.position : ((Component)val10).transform.position));
						if (Floor(val11.y) != num6)
						{
							continue;
						}
						if (val10.isLocal)
						{
							Vector3 val12 = (Object.op_Implicit((Object)(object)PlayerController.instance) ? ((Component)PlayerController.instance).transform.forward : ((Component)val10).transform.forward);
							float angle = Mathf.Atan2(val12.x, val12.z) * 57.29578f;
							DrawIcon(Project(val11, val3, origin), "arrow", MarkerBlue, angle);
							if (namesOn.Value)
							{
								DrawMarkerLabel(Project(val11, val3, origin), Lang.You, MarkerBlue);
							}
						}
						else
						{
							Marker(val11, "dot", namesOn.Value ? val10.playerName : "", MarkerBlue, num6, val3, origin);
						}
					}
				}
				if (hintsOn.Value)
				{
					GUI.Label(new Rect(4f, 0f, 240f, 20f), Lang.Position(num6, zoom.Value), small);
				}
			}
			finally
			{
				GUI.EndGroup();
			}
			if (legendOn.Value)
			{
				GUI.Label(new Rect(((Rect)(ref window)).x + 6f, ((Rect)(ref val)).yMax + 1f, num - 12f, 20f), Lang.Legend, small);
			}
			if (editing)
			{
				DrawControls(((Rect)(ref val)).yMax + num3 + 2f);
			}
		}

		private void DrawControls(float top)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref window)).x + 7f;
			float num2 = (((Rect)(ref window)).width - 14f) / 2f;
			if (GUI.Button(new Rect(num, top, num2, 23f), Lang.Reset))
			{
				pan = Vector2.zero;
				zoom.Value = 5f;
			}
			if (GUI.Button(new Rect(num + num2, top, num2, 23f), Lang.Follow(follow.Value)))
			{
				follow.Value = !follow.Value;
				pan = Vector2.zero;
			}
			if (GUI.Button(new Rect(num, top + 26f, num2 * 2f, 23f), Lang.SaveExit(editKey.Value)))
			{
				StopEditing();
			}
			if (hintsOn.Value)
			{
				GUI.Label(new Rect(num, top + 51f, ((Rect)(ref window)).width - 25f, 19f), Lang.EditHint, small);
			}
			Fill(new Rect(((Rect)(ref window)).xMax - 14f, ((Rect)(ref window)).yMax - 14f, 10f, 10f), Color.cyan);
		}

		private void HandleMouse()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Invalid comparison between Unknown and I4
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Invalid comparison between Unknown and I4
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Invalid comparison between Unknown and I4
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: 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_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: 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_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			if (!editing)
			{
				return;
			}
			Event current = Event.current;
			Vector2 mousePosition = current.mousePosition;
			if ((int)current.type == 0 && ((Rect)(ref window)).Contains(mousePosition))
			{
				if (current.button == 0)
				{
					Rect val = new Rect(((Rect)(ref window)).xMax - 22f, ((Rect)(ref window)).yMax - 22f, 22f, 22f);
					resizing = ((Rect)(ref val)).Contains(mousePosition);
					dragging = !resizing && mousePosition.y <= ((Rect)(ref currentMapRect)).yMax;
				}
				if (current.button == 1 && ((Rect)(ref currentMapRect)).Contains(mousePosition))
				{
					panning = true;
				}
				if (dragging || resizing || panning)
				{
					lastMouse = mousePosition;
					current.Use();
				}
			}
			if ((int)current.type == 3 && (dragging || resizing || panning))
			{
				Vector2 val2 = mousePosition - lastMouse;
				lastMouse = mousePosition;
				if (resizing)
				{
					size.Value = Mathf.Clamp(size.Value + val2.x, 240f, 900f);
				}
				else if (panning)
				{
					pan += new Vector2(0f - val2.x, val2.y) / zoom.Value;
				}
				else
				{
					x.Value = Mathf.Clamp01((((Rect)(ref window)).x + val2.x) / Mathf.Max(1f, (float)Screen.width - ((Rect)(ref window)).width));
					y.Value = Mathf.Clamp01((((Rect)(ref window)).y + val2.y) / Mathf.Max(1f, (float)Screen.height - ((Rect)(ref window)).height));
				}
				current.Use();
			}
			if ((int)current.type == 1 && (dragging || resizing || panning))
			{
				dragging = (resizing = (panning = false));
				((BaseUnityPlugin)this).Config.Save();
				current.Use();
			}
			if ((int)current.type == 6 && ((Rect)(ref window)).Contains(mousePosition))
			{
				zoom.Value = Mathf.Clamp(zoom.Value * Mathf.Pow(1.12f, 0f - current.delta.y), 0.5f, 30f);
				current.Use();
			}
		}

		private Vector2 Project(Vector3 p, Vector2 center, Vector2 origin)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return vanilla.Project(p);
		}

		private void Marker(Vector3 position, string symbol, string label, Color color, int floor, Vector2 center, Vector2 origin)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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)
			if ((int)Event.current.type != 7 || Floor(position.y) != floor)
			{
				return;
			}
			Vector2 val = Project(position, center, origin);
			if (!(val.x < -180f) && !(val.y < -24f) && !(val.x > ((Rect)(ref currentMapRect)).width + 12f) && !(val.y > ((Rect)(ref currentMapRect)).height + 24f))
			{
				Color color2 = GUI.color;
				GUI.color = color;
				DrawIcon(val, symbol, color, 0f);
				if (label.Length > 0)
				{
					GUI.Label(new Rect(val.x + 9f, val.y - 8f, 170f, 20f), label, small);
				}
				GUI.color = color2;
			}
		}

		private void DrawMarkerLabel(Vector2 point, string label, Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.Label(new Rect(point.x + 9f, point.y - 8f, 170f, 20f), label, small);
			GUI.color = color2;
		}

		private void DrawIcon(Vector2 point, string shape, Color color, float angle)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0103: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00c0: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Event.current.type != 7)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)dotTexture))
			{
				dotTexture = MakeIcon(arrow: false);
			}
			if (!Object.op_Implicit((Object)(object)arrowTexture))
			{
				arrowTexture = MakeIcon(arrow: true);
			}
			if (shape == "box")
			{
				float num = 5f;
				Fill(new Rect(point.x - num, point.y - num, 10f, 1.5f), color);
				Fill(new Rect(point.x - num, point.y + num - 1.5f, 10f, 1.5f), color);
				Fill(new Rect(point.x - num, point.y - num, 1.5f, 10f), color);
				Fill(new Rect(point.x + num - 1.5f, point.y - num, 1.5f, 10f), color);
				return;
			}
			Color color2 = GUI.color;
			Matrix4x4 matrix = GUI.matrix;
			GUI.color = color;
			try
			{
				float num2 = ((shape == "arrow") ? 17 : 7);
				if (shape == "arrow")
				{
					GUIUtility.RotateAroundPivot(angle, point);
				}
				GUI.DrawTexture(new Rect(point.x - num2 / 2f, point.y - num2 / 2f, num2, num2), (Texture)(object)((shape == "arrow") ? arrowTexture : dotTexture));
			}
			finally
			{
				GUI.matrix = matrix;
				GUI.color = color2;
			}
		}

		private static Texture2D MakeIcon(bool arrow)
		{
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			Color32[] array = (Color32[])(object)new Color32[1024];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = ((float)j + 0.5f - 16f) / 16f;
					float num2 = ((float)i + 0.5f - 16f) / 16f;
					bool flag = (arrow ? (num2 >= -0.72f && num2 <= 0.95f && Mathf.Abs(num) <= (0.95f - num2) * 0.48f && (num2 > -0.3f || Mathf.Abs(num) > (0f - num2) * 0.25f)) : (num * num + num2 * num2 <= 0.88f));
					array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(flag ? byte.MaxValue : 0));
				}
			}
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61,
				filterMode = (FilterMode)1,
				wrapMode = (TextureWrapMode)1
			};
			val.SetPixels32(array);
			val.Apply(false, true);
			return val;
		}

		private void NavigationMarker(MapExtras.MarkerData target, Vector3 local, int floor, Vector2 center, Vector2 origin, Rect viewport)
		{
			//IL_0001: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0121: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			if (Floor(target.Position.y) != floor)
			{
				return;
			}
			if (!(Time.unscaledTime >= nextPath))
			{
				Vector3 val = target.Position - lastDestination;
				if (!(((Vector3)(ref val)).sqrMagnitude > 1f))
				{
					goto IL_00be;
				}
			}
			nextPath = Time.unscaledTime + 0.75f;
			lastDestination = target.Position;
			Vector3 val2 = ((Object.op_Implicit((Object)(object)PlayerController.instance) && Object.op_Implicit((Object)(object)PlayerController.instance.playerAvatarScript)) ? PlayerController.instance.playerAvatarScript.LastNavmeshPosition : local);
			route = (NavMesh.CalculatePath(val2, target.Position, -1, navigationPath) ? navigationPath.corners : Array.Empty<Vector3>());
			goto IL_00be;
			IL_00be:
			for (int i = 1; i < route.Length; i++)
			{
				if (Floor(route[i - 1].y) == floor && Floor(route[i].y) == floor)
				{
					Vector2 a = Project(route[i - 1], center, origin);
					Vector2 b = Project(route[i], center, origin);
					Line(a, b, new Color(target.Color.r, target.Color.g, target.Color.b, 0.65f), 2f);
				}
			}
			Vector2 val3 = Project(target.Position, center, origin);
			float num = 15f;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(((Rect)(ref viewport)).width / 2f, ((Rect)(ref viewport)).height / 2f);
			Vector2 val5 = val3 - val4;
			float num2 = Mathf.Max(1f, val4.x - num);
			float num3 = Mathf.Max(1f, val4.y - num);
			float num4 = Mathf.Max(Mathf.Abs(val5.x) / num2, Mathf.Abs(val5.y) / num3);
			bool num5 = num4 > 1f;
			if (num5)
			{
				val3 = val4 + val5 / num4;
			}
			Color color = GUI.color;
			GUI.color = target.Color;
			GUI.Label(new Rect(val3.x - 7f, val3.y - 10f, 24f, 22f), target.Symbol, this.text);
			string text = Mathf.RoundToInt(Vector3.Distance(local, target.Position)) + "m";
			string text2 = (namesOn.Value ? (target.Label + " " + text) : text);
			float num6 = Mathf.Clamp(val3.x + 10f, 2f, Mathf.Max(2f, ((Rect)(ref viewport)).width - 150f));
			float num7 = Mathf.Clamp(val3.y - 9f, 2f, Mathf.Max(2f, ((Rect)(ref viewport)).height - 22f));
			GUI.Label(new Rect(num6, num7, 150f, 22f), text2, small);
			GUI.color = color;
			if (num5 && ((Vector2)(ref val5)).sqrMagnitude > 0.01f)
			{
				Vector2 normalized = ((Vector2)(ref val5)).normalized;
				Vector2 val6 = default(Vector2);
				((Vector2)(ref val6))..ctor(0f - normalized.y, normalized.x);
				Line(val3 - normalized * 12f, val3, target.Color, 2f);
				Line(val3, val3 - normalized * 6f + val6 * 4f, target.Color, 2f);
				Line(val3, val3 - normalized * 6f - val6 * 4f, target.Color, 2f);
			}
		}

		private static void Fill(Rect r, Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Color color = GUI.color;
			GUI.color = c;
			GUI.DrawTexture(r, (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
		}

		private static void Line(Vector2 a, Vector2 b, Color color, float thickness)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_001c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0056: 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)
			Vector2 val = b - a;
			if (((Vector2)(ref val)).sqrMagnitude < 0.001f)
			{
				return;
			}
			Matrix4x4 matrix = GUI.matrix;
			try
			{
				GUIUtility.RotateAroundPivot(Mathf.Atan2(val.y, val.x) * 57.29578f, a);
				Fill(new Rect(a.x, a.y - thickness / 2f, ((Vector2)(ref val)).magnitude, thickness), color);
			}
			finally
			{
				GUI.matrix = matrix;
			}
		}
	}
	internal sealed class VanillaMapRenderer : IDisposable
	{
		private sealed class Source
		{
			internal MeshRenderer renderer;

			internal MeshFilter filter;

			internal MapLayer layer;

			internal MapModule module;

			internal DirtFinderMapDoorTarget door;

			internal Transform doorTarget;

			internal Transform doorHinge;

			internal PhysGrabHinge physicalHinge;

			internal bool doorLeaf;

			internal bool hadPhysicalHinge;
		}

		private sealed class Proxy
		{
			internal MeshRenderer source;

			internal MeshRenderer renderer;

			internal MeshFilter filter;

			internal int materialCount;

			internal float nextMaterialSync;

			internal readonly List<Material> materials = new List<Material>();
		}

		private struct Draw
		{
			internal Source source;

			internal Mesh mesh;

			internal Matrix4x4 matrix;
		}

		private const int ProxyLayer = 30;

		private static readonly Vector3 IsolationOffset = new Vector3(0f, -10000f, 0f);

		private Camera camera;

		private RenderTexture target;

		private Texture2D output;

		private bool disposed;

		private bool rendering;

		private bool hasFrame;

		private bool diagnosedFrame;

		private int sourceMapId;

		private int sourceScene;

		private float nextScan;

		private float frameWidth;

		private float frameHeight;

		private float frameScale;

		private float frameSpan;

		private Vector3 frameOrigin;

		private Vector3 frameCenter;

		private readonly Dictionary<int, Source> sources = new Dictionary<int, Source>();

		private readonly Dictionary<int, Proxy> proxies = new Dictionary<int, Proxy>();

		private readonly List<MeshRenderer> scanBuffer = new List<MeshRenderer>();

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

		private readonly HashSet<MapLayer> layers = new HashSet<MapLayer>();

		private readonly List<int> stale = new List<int>();

		private readonly List<Draw> draws = new List<Draw>();

		private readonly MaterialPropertyBlock properties = new MaterialPropertyBlock();

		private int resolution = 256;

		private float refreshRate = 10f;

		internal int Resolution
		{
			get
			{
				return resolution;
			}
			set
			{
				resolution = Mathf.Clamp(value, 64, 1024);
			}
		}

		internal float RefreshRate
		{
			get
			{
				return refreshRate;
			}
			set
			{
				refreshRate = (Finite(value) ? Mathf.Clamp(value, 1f, 60f) : 10f);
			}
		}

		public Texture Texture => (Texture)(object)output;

		public bool Render(Map map, Vector3 worldCenter, int selectedFloor, float pixelsPerWorldUnit, float viewportWidth, float viewportHeight, bool reveal)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_056e: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_060a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0619: Unknown result type (might be due to invalid IL or missing references)
			//IL_0626: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_074e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			if (disposed || rendering)
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)map))
			{
				ClearProxies();
				sourceMapId = (sourceScene = 0);
				hasFrame = false;
				return false;
			}
			Scene scene;
			if (sourceMapId == ((Object)map).GetInstanceID())
			{
				SceneHandle val = SceneHandle.op_Implicit(sourceScene);
				scene = ((Component)map).gameObject.scene;
				if (!(val != ((Scene)(ref scene)).handle))
				{
					goto IL_00b0;
				}
			}
			ClearProxies();
			sourceMapId = ((Object)map).GetInstanceID();
			scene = ((Component)map).gameObject.scene;
			sourceScene = SceneHandle.op_Implicit(((Scene)(ref scene)).handle);
			hasFrame = (diagnosedFrame = false);
			goto IL_00b0;
			IL_00b0:
			if (!Finite(pixelsPerWorldUnit) || pixelsPerWorldUnit <= 0f || !Finite(viewportWidth) || !Finite(viewportHeight) || viewportWidth <= 0f || viewportHeight <= 0f || !Finite(map.Scale) || map.Scale <= 0f || !Finite(worldCenter.x) || !Finite(worldCenter.z))
			{
				return false;
			}
			float unscaledTime = Time.unscaledTime;
			if (unscaledTime >= nextScan)
			{
				Scan(map);
				bool flag = Object.op_Implicit((Object)(object)LevelGenerator.Instance) && !LevelGenerator.Instance.Generated;
				nextScan = unscaledTime + (flag ? 0.1f : 1.5f);
			}
			MapLayer val2 = null;
			foreach (MapLayer layer2 in map.Layers)
			{
				if (Object.op_Implicit((Object)(object)layer2) && (!Object.op_Implicit((Object)(object)val2) || Math.Abs((long)layer2.layer - (long)selectedFloor) < Math.Abs((long)val2.layer - (long)selectedFloor)))
				{
					val2 = layer2;
				}
			}
			draws.Clear();
			foreach (Proxy value in proxies.Values)
			{
				if (Object.op_Implicit((Object)(object)value.renderer))
				{
					((Renderer)value.renderer).enabled = false;
				}
			}
			Vector3 val5 = default(Vector3);
			foreach (Source value2 in sources.Values)
			{
				MeshRenderer renderer = value2.renderer;
				MapLayer layer = value2.layer;
				if (!Object.op_Implicit((Object)(object)renderer) || !((Renderer)renderer).enabled || !Object.op_Implicit((Object)(object)value2.filter) || !Object.op_Implicit((Object)(object)value2.filter.sharedMesh) || !Object.op_Implicit((Object)(object)layer) || layer.layer != selectedFloor || (reveal && Object.op_Implicit((Object)(object)value2.module)))
				{
					continue;
				}
				bool flag2 = false;
				Transform val3 = ((Component)renderer).transform;
				while (Object.op_Implicit((Object)(object)val3) && (Object)(object)val3 != (Object)(object)((Component)layer).transform)
				{
					if (!((Component)val3).gameObject.activeSelf)
					{
						flag2 = true;
						break;
					}
					val3 = val3.parent;
				}
				if (flag2)
				{
					continue;
				}
				Matrix4x4 val4 = ((Renderer)renderer).localToWorldMatrix;
				if (value2.doorLeaf)
				{
					if (!Object.op_Implicit((Object)(object)value2.door) || !Object.op_Implicit((Object)(object)value2.doorTarget) || !Object.op_Implicit((Object)(object)value2.doorHinge) || !((Component)value2.doorTarget).gameObject.activeInHierarchy || (value2.hadPhysicalHinge && !Object.op_Implicit((Object)(object)value2.physicalHinge)) || (Object.op_Implicit((Object)(object)value2.physicalHinge) && (value2.physicalHinge.broken || value2.physicalHinge.dead)))
					{
						continue;
					}
					val4 = Matrix4x4.TRS(value2.doorTarget.position * map.Scale + ((Component)layer).transform.position + map.GetLayerPosition(layer.layer), value2.doorTarget.rotation, value2.doorHinge.lossyScale) * value2.doorHinge.worldToLocalMatrix * val4;
				}
				((Vector3)(ref val5))..ctor(0f, 0f - ((Component)layer).transform.localPosition.y, 0f);
				if (Object.op_Implicit((Object)(object)((Component)layer).transform.parent))
				{
					val5 = ((Component)layer).transform.parent.TransformVector(val5);
				}
				val4 = Matrix4x4.Translate(val5) * val4;
				draws.Add(new Draw
				{
					source = value2,
					mesh = value2.filter.sharedMesh,
					matrix = val4
				});
			}
			if (draws.Count == 0)
			{
				hasFrame = false;
				return false;
			}
			rendering = true;
			hasFrame = false;
			RenderTexture active = RenderTexture.active;
			try
			{
				EnsureResources(viewportWidth / viewportHeight);
				Vector3 val6 = (Object.op_Implicit((Object)(object)val2) ? ((Component)val2).transform.position : (Object.op_Implicit((Object)(object)map.OverLayerParent) ? map.OverLayerParent.position : ((Component)map).transform.position));
				Vector3 val7 = worldCenter * map.Scale + val6;
				float num = val7.y;
				float num2 = val7.y;
				foreach (Draw draw in draws)
				{
					Draw current4 = draw;
					SyncProxy(current4, unscaledTime);
					ref Matrix4x4 matrix = ref current4.matrix;
					Bounds bounds = current4.mesh.bounds;
					Vector3 val8 = ((Matrix4x4)(ref matrix)).MultiplyPoint3x4(((Bounds)(ref bounds)).center);
					bounds = current4.mesh.bounds;
					Vector3 extents = ((Bounds)(ref bounds)).extents;
					float num3 = Mathf.Abs(current4.matrix.m10) * extents.x + Mathf.Abs(current4.matrix.m11) * extents.y + Mathf.Abs(current4.matrix.m12) * extents.z;
					num = Mathf.Max(num, val8.y + num3);
					num2 = Mathf.Min(num2, val8.y - num3);
				}
				((Behaviour)camera).enabled = false;
				camera.targetTexture = target;
				camera.cullingMask = 1073741824;
				camera.renderingPath = (RenderingPath)1;
				camera.depthTextureMode = (DepthTextureMode)1;
				camera.orthographic = true;
				camera.aspect = viewportWidth / viewportHeight;
				camera.orthographicSize = viewportHeight * map.Scale / (2f * pixelsPerWorldUnit);
				camera.clearFlags = (CameraClearFlags)2;
				camera.backgroundColor = Color.black;
				camera.useOcclusionCulling = false;
				Camera obj = camera;
				bool allowHDR = (camera.allowMSAA = false);
				obj.allowHDR = allowHDR;
				((Component)camera).transform.SetPositionAndRotation(new Vector3(val7.x, num + 10f, val7.z) + IsolationOffset, Quaternion.Euler(90f, 0f, 0f));
				camera.nearClipPlane = 0.01f;
				camera.farClipPlane = Mathf.Max(20f, num - num2 + 20f);
				camera.Render();
				ReadTransparentOutput(sources.Count);
				frameWidth = viewportWidth;
				frameHeight = viewportHeight;
				frameScale = map.Scale;
				frameSpan = camera.orthographicSize * 2f;
				frameOrigin = val6;
				frameCenter = val7;
				hasFrame = true;
				return true;
			}
			finally
			{
				RenderTexture.active = active;
				rendering = false;
			}
		}

		private void Scan(Map map)
		{
			scanned.Clear();
			layers.Clear();
			foreach (MapLayer layer in map.Layers)
			{
				if (Object.op_Implicit((Object)(object)layer))
				{
					layers.Add(layer);
				}
			}
			AddRenderers(((Component)map).transform);
			if (Object.op_Implicit((Object)(object)map.ActiveParent))
			{
				AddRenderers(map.ActiveParent.transform);
			}
			if (Object.op_Implicit((Object)(object)map.OverLayerParent))
			{
				AddRenderers(map.OverLayerParent);
			}
			foreach (MapLayer layer2 in