Decompiled source of QuestTracker v1.3.2

plugins/QuestTracker/QuestTracker.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using Actors.Enemies;
using Assets.Scripts.Actors.Enemies;
using Assets.Scripts.Actors.Player;
using Assets.Scripts.Camera;
using Assets.Scripts.Inventory__Items__Pickups;
using Assets.Scripts.Inventory__Items__Pickups.Chests;
using Assets.Scripts.Inventory__Items__Pickups.Interactables;
using Assets.Scripts.Inventory__Items__Pickups.Items;
using Assets.Scripts.Inventory__Items__Pickups.Weapons;
using Assets.Scripts.Managers;
using Assets.Scripts.Saves___Serialization.Progression.Achievements;
using Assets.Scripts._Data.MapsAndStages;
using Assets.Scripts._Data.Tomes;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using Rewired;
using UnityEngine;
using UnityEngine.EventSystems;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("QuestTracker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyInformationalVersion("1.3.2")]
[assembly: AssemblyProduct("QuestTracker")]
[assembly: AssemblyTitle("QuestTracker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.2.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 QuestTracker
{
	internal class GuideTarget
	{
		public TrackedQuest Quest;

		public Transform Transform;

		public string Label;

		public Color Color;

		public float Height;

		public bool Find;
	}
	internal static class Guide
	{
		private static readonly Color[] QuestColors = (Color[])(object)new Color[3]
		{
			new Color(1f, 0.82f, 0.25f),
			new Color(0.45f, 0.85f, 1f),
			new Color(1f, 0.5f, 0.85f)
		};

		private static readonly List<GuideTarget> Targets = new List<GuideTarget>();

		private static string _mapHint;

		private static float _mapHintUntil;

		private static int _hintStage = -1;

		private static float _nextScan;

		private static bool _loggedError;

		private static readonly HashSet<IntPtr> OurMinimapArrows = new HashSet<IntPtr>();

		private static readonly Dictionary<IntPtr, Transform> MinimapTransforms = new Dictionary<IntPtr, Transform>();

		private static bool _minimapBroken;

		private static Texture2D _arrow;

		private static readonly HashSet<IntPtr> Discovered = new HashSet<IntPtr>();

		private static int _discoveredStage = -1;

		private static bool _sawHidden;

		private static Camera _cam;

		private static Vector3 _player;

		private static float _minimapRange;

		private static readonly List<(Bounds Box, int Area)> Areas = new List<(Bounds, int)>();

		private static readonly HashSet<IntPtr> AreaSources = new HashSet<IntPtr>();

		private static int _playerArea = -1;

		private static bool _ignoreAreas;

		public static bool Visible => Plugin.Cfg.ShowGuide.Value;

		public static void Tick()
		{
			if (!Tracker.InRun || !Visible)
			{
				Targets.Clear();
				ClearMinimap();
				_hintStage = -1;
			}
			else if (!(Time.unscaledTime < _nextScan))
			{
				_nextScan = Time.unscaledTime + 0.5f;
				try
				{
					Scan();
				}
				catch (Exception e)
				{
					Targets.Clear();
					LogOnce("Could not find quest targets", e);
				}
				try
				{
					SyncMinimap();
				}
				catch (Exception e2)
				{
					_minimapBroken = true;
					LogOnce("Could not mark the minimap", e2);
				}
			}
		}

		private static void Scan()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: 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_0339: 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_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			Targets.Clear();
			Vector3 val = PlayerPosition();
			List<string> list = new List<string>();
			RefreshAreas();
			_playerArea = AreaOf(val);
			_cam = Camera.main;
			_player = val;
			_minimapRange = MinimapRange();
			int stageIndex = Tracker.StageIndex;
			if (stageIndex != _discoveredStage)
			{
				Discovered.Clear();
				_discoveredStage = stageIndex;
			}
			int num = 0;
			foreach (TrackedQuest item in Tracker.Pinned)
			{
				if ((Object)(object)item.Ach == (Object)null || Tracker.IsHidden(item))
				{
					continue;
				}
				QuestStatus status = item.Status;
				if ((uint)(status - 5) <= 1u)
				{
					continue;
				}
				string text = QuestPlaces.Mismatch(item.Place);
				if (text != null)
				{
					list.Add(L.T(item.Title + ": play on " + text, item.Title + ": العب في " + text));
					continue;
				}
				status = item.Status;
				if ((status == QuestStatus.Failed || status == QuestStatus.NotThisStage) ? true : false)
				{
					continue;
				}
				GuideRule guideRule = GuideTargets.For(item);
				if (guideRule == null)
				{
					continue;
				}
				Color color = QuestColors[num++ % QuestColors.Length];
				if (item.Place != null && item.Place.StageFrom && Tracker.StageIndex < item.Place.Stage)
				{
					list.Add(L.T($"{item.Title}: shows up from stage {item.Place.Stage}", $"{item.Title}: يظهر من المرحلة {item.Place.Stage}"));
					continue;
				}
				(Transform, string, float, bool) tuple = FirstTarget(guideRule, val);
				if ((Object)(object)tuple.Item1 == (Object)null && !tuple.Item4 && _playerArea >= 0)
				{
					_ignoreAreas = true;
					(Transform, string, float, bool) tuple2 = FirstTarget(guideRule, val);
					_ignoreAreas = false;
					if ((Object)(object)tuple2.Item1 != (Object)null || tuple2.Item4)
					{
						_sawHidden = false;
						(Transform, string, float) tuple3 = Closest<InteractableCryptLeave>(val, (Func<InteractableCryptLeave, bool>)((InteractableCryptLeave c) => !c.hasInteracted), L.T("Leave the crypt", "اخرج من السرداب"));
						if ((Object)(object)tuple3.Item1 != (Object)null)
						{
							tuple = (tuple3.Item1, tuple3.Item2, tuple3.Item3, false);
						}
						else if (_sawHidden)
						{
							tuple = (null, L.T("Crypt exit", "مخرج السرداب"), 0f, true);
						}
					}
				}
				if ((Object)(object)tuple.Item1 != (Object)null)
				{
					Targets.Add(new GuideTarget
					{
						Quest = item,
						Transform = tuple.Item1,
						Label = tuple.Item2,
						Color = color,
						Height = tuple.Item3
					});
				}
				else if (tuple.Item4)
				{
					Targets.Add(new GuideTarget
					{
						Quest = item,
						Label = L.T("Find the " + tuple.Item2, "ابحث عن " + tuple.Item2),
						Color = color,
						Find = true
					});
				}
			}
			if (Tracker.StageIndex != _hintStage)
			{
				_hintStage = Tracker.StageIndex;
				_mapHint = ((list.Count > 0) ? string.Join("\n", list) : null);
				_mapHintUntil = -1f;
			}
		}

		private static (Transform Transform, string Label, float Height, bool Find) FirstTarget(GuideRule rule, Vector3 player)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			TargetKind[] kinds = rule.Kinds;
			foreach (TargetKind kind in kinds)
			{
				_sawHidden = false;
				(Transform, string, float) tuple = Nearest(kind, player);
				if ((Object)(object)tuple.Item1 != (Object)null)
				{
					return (Transform: tuple.Item1, Label: tuple.Item2, Height: tuple.Item3, Find: false);
				}
				if (_sawHidden)
				{
					return (Transform: null, Label: tuple.Item2, Height: 0f, Find: true);
				}
			}
			return default((Transform, string, float, bool));
		}

		private static float MinimapRange()
		{
			try
			{
				MyPlayer instance = MyPlayer.Instance;
				Camera val = (((Object)(object)instance != (Object)null) ? instance.minimapCamera : null);
				if ((Object)(object)val != (Object)null && val.orthographic)
				{
					return val.orthographicSize * 0.95f;
				}
			}
			catch
			{
			}
			return 0f;
		}

		private static bool IsDiscovered(Transform t)
		{
			if (Discovered.Contains(((Il2CppObjectBase)t).Pointer))
			{
				return true;
			}
			if (!SeenNow(t))
			{
				_sawHidden = true;
				return false;
			}
			Discovered.Add(((Il2CppObjectBase)t).Pointer);
			return true;
		}

		private static bool SeenNow(Transform t)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0081: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = t.position;
			float num = Vector3.Distance(_player, position);
			if (num < 18f)
			{
				return true;
			}
			Vector3 val = position - _player;
			val.y = 0f;
			if (_minimapRange > 0f && ((Vector3)(ref val)).magnitude <= _minimapRange)
			{
				return true;
			}
			if (num > 75f || (Object)(object)_cam == (Object)null)
			{
				return false;
			}
			Vector3 val2 = position + Vector3.up;
			Vector3 val3 = _cam.WorldToViewportPoint(val2);
			if (val3.z <= 0f || val3.x < 0f || val3.x > 1f || val3.y < 0f || val3.y > 1f)
			{
				return false;
			}
			Vector3 position2 = ((Component)_cam).transform.position;
			Vector3 val4 = val2 - position2;
			float magnitude = ((Vector3)(ref val4)).magnitude;
			RaycastHit val5 = default(RaycastHit);
			if (!Physics.Raycast(position2, val4 / magnitude, ref val5, magnitude - 1.5f, -1, (QueryTriggerInteraction)1))
			{
				return true;
			}
			Transform root = t.root;
			if ((Object)(object)((RaycastHit)(ref val5)).transform != (Object)null)
			{
				if (!((Object)(object)((RaycastHit)(ref val5)).transform == (Object)(object)t))
				{
					return ((RaycastHit)(ref val5)).transform.IsChildOf(root);
				}
				return true;
			}
			return false;
		}

		private static void RefreshAreas()
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			Il2CppReferenceArray<Object> val = Object.FindObjectsOfType(Il2CppType.Of<RsgController>());
			HashSet<IntPtr> hashSet = new HashSet<IntPtr>();
			foreach (Object item in (Il2CppArrayBase<Object>)(object)val)
			{
				hashSet.Add(((Il2CppObjectBase)item).Pointer);
			}
			if (hashSet.SetEquals(AreaSources) && Areas.Count > 0)
			{
				return;
			}
			Areas.Clear();
			AreaSources.Clear();
			int num = 0;
			foreach (Object item2 in (Il2CppArrayBase<Object>)(object)val)
			{
				RsgController val2 = ((Il2CppObjectBase)item2).TryCast<RsgController>();
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				AreaSources.Add(((Il2CppObjectBase)item2).Pointer);
				try
				{
					if (val2.allPieces != null)
					{
						Enumerator<RsgPiece> enumerator2 = val2.allPieces.GetEnumerator();
						while (enumerator2.MoveNext())
						{
							RsgPiece current3 = enumerator2.Current;
							if ((Object)(object)current3 != (Object)null)
							{
								AddArea(current3.GetBounds(), num);
							}
						}
					}
					if ((Object)(object)val2.rsgStart != (Object)null)
					{
						AddRendererArea(((Component)val2.rsgStart).gameObject, num);
					}
					if ((Object)(object)val2.rsgEnd != (Object)null)
					{
						AddRendererArea(((Object)(object)((Component)val2.rsgEnd).transform.parent != (Object)null) ? ((Component)((Component)val2.rsgEnd).transform.parent).gameObject : ((Component)val2.rsgEnd).gameObject, num);
					}
				}
				catch (Exception e)
				{
					LogOnce("Could not read a crypt's shape", e);
				}
				num++;
			}
		}

		private static void AddRendererArea(GameObject root, int area)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			Bounds b = default(Bounds);
			foreach (Renderer componentsInChild in root.GetComponentsInChildren<Renderer>())
			{
				if (!flag)
				{
					b = componentsInChild.bounds;
					flag = true;
				}
				else
				{
					((Bounds)(ref b)).Encapsulate(componentsInChild.bounds);
				}
			}
			if (flag)
			{
				Vector3 size = ((Bounds)(ref b)).size;
				if (((Vector3)(ref size)).magnitude < 300f)
				{
					AddArea(b, area);
				}
			}
		}

		private static void AddArea(Bounds b, int area)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((Bounds)(ref b)).Expand(4f);
			Areas.Add((b, area));
		}

		private static int AreaOf(Vector3 p)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			foreach (var area in Areas)
			{
				var (val, result) = area;
				if (((Bounds)(ref val)).Contains(p))
				{
					return result;
				}
			}
			return -1;
		}

		private static bool InReach(Vector3 p)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if (!_ignoreAreas)
			{
				return AreaOf(p) == _playerArea;
			}
			return true;
		}

		private static Vector3 PlayerPosition()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				MyPlayer instance = MyPlayer.Instance;
				if ((Object)(object)instance != (Object)null)
				{
					return ((Component)instance).transform.position;
				}
			}
			catch
			{
			}
			Camera main = Camera.main;
			if (!((Object)(object)main != (Object)null))
			{
				return Vector3.zero;
			}
			return ((Component)main).transform.position;
		}

		private static (Transform Transform, string Label, float Height) Nearest(TargetKind kind, Vector3 from)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: 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_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: 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_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			switch (kind)
			{
			case TargetKind.Boombox:
				return Closest<InteractableBoombox>(from, (Func<InteractableBoombox, bool>)((InteractableBoombox val) => !val.done), L.T("Boombox", "مكبر الصوت"));
			case TargetKind.MonkeCage:
				return Closest<InteractableCage>(from, (Func<InteractableCage, bool>)((InteractableCage c) => !c.done), L.T("Monke's cage", "قفص مونكي"));
			case TargetKind.Bush:
				return Closest<InteractableCharacterFight>(from, (Func<InteractableCharacterFight, bool>)((InteractableCharacterFight f) => !f.done && IsEnemy(f.enemyData, (EEnemy)38)), L.T("Bush", "الشجيرة"));
			case TargetKind.Bandit:
				return Closest<InteractableCharacterFight>(from, (Func<InteractableCharacterFight, bool>)((InteractableCharacterFight f) => !f.done && IsEnemy(f.enemyData, (EEnemy)37)), L.T("Bandit", "اللص"));
			case TargetKind.Bananarang:
				return Closest<InteractableBananarang>(from, (Func<InteractableBananarang, bool>)((InteractableBananarang val) => !val.done), L.T("Hidden banana", "الموزة المخفية"));
			case TargetKind.Gift:
				return Closest<InteractableGift>(from, (Func<InteractableGift, bool>)((InteractableGift g) => !g.done), L.T("Hidden gift", "الهدية المخفية"));
			case TargetKind.FrogEgg:
				return Closest<InteractableEgg>(from, (Func<InteractableEgg, bool>)((InteractableEgg e) => !e.done), L.T("Frog egg", "بيضة الضفادع"));
			case TargetKind.QuestUnlock:
				return Closest<InteractableUnlock>(from, (Func<InteractableUnlock, bool>)((InteractableUnlock u) => !u.done), L.T("Hidden item", "غرض مخفي"));
			case TargetKind.SkeletonStatue:
				return Closest<InteractableSkeletonKingStatue>(from, (Func<InteractableSkeletonKingStatue, bool>)((InteractableSkeletonKingStatue s) => !s.done), L.T("Undead statue", "تمثال الموتى الأحياء"));
			case TargetKind.DesertGrave:
				return Closest<InteractableDesertGrave>(from, (Func<InteractableDesertGrave, bool>)((InteractableDesertGrave g) => !g.done), L.T("Grave", "قبر"));
			case TargetKind.Coffin:
				return Closest<InteractableCoffin>(from, (Func<InteractableCoffin, bool>)((InteractableCoffin c) => !c.interacted), L.T("Coffin", "تابوت"));
			case TargetKind.Crypt:
				return Closest<InteractableCrypt>(from, (Func<InteractableCrypt, bool>)((InteractableCrypt c) => !c.isDone), L.T("Crypt", "السرداب"));
			case TargetKind.CryptExit:
				return Closest<InteractableCryptLeave>(from, (Func<InteractableCryptLeave, bool>)((InteractableCryptLeave c) => !c.hasInteracted), L.T("Crypt exit", "مخرج السرداب"));
			case TargetKind.CryptLoot:
			{
				(Transform, string, float) a = Closest<InteractablePot>(from, (Func<InteractablePot, bool>)((InteractablePot p) => p.isInCrypt && !p.broken), L.T("Crypt pot", "جرة السرداب"));
				(Transform, string, float) b = Closest<InteractableChest>(from, (Func<InteractableChest, bool>)((InteractableChest c) => c.isInCrypt && !c.opening), L.T("Crypt chest", "صندوق السرداب"));
				return Nearer(from, a, b);
			}
			case TargetKind.ChargeShrine:
				return Closest<ChargeShrine>(from, (Func<ChargeShrine, bool>)((ChargeShrine s) => !s.completed && !s.rewardGiven), L.T("Charge shrine", "مزار الشحن"));
			case TargetKind.MagnetShrine:
				return Closest<InteractableShrineMagnet>(from, (Func<InteractableShrineMagnet, bool>)((InteractableShrineMagnet s) => !s.done), L.T("Magnet shrine", "مزار الشفط"));
			case TargetKind.CursedShrine:
				return Closest<InteractableShrineCursed>(from, (Func<InteractableShrineCursed, bool>)((InteractableShrineCursed s) => !s.done), L.T("Boss curse shrine", "مزار لعنة الزعيم"));
			case TargetKind.Microwave:
				return Closest<InteractableMicrowave>(from, (Func<InteractableMicrowave, bool>)((InteractableMicrowave m) => m.usesLeft > 0), L.T("Microwave", "الميكروويف"));
			case TargetKind.ShadyCommon:
				return Shady(from, (EItemRarity)0);
			case TargetKind.ShadyRare:
				return Shady(from, (EItemRarity)1);
			case TargetKind.ShadyEpic:
				return Shady(from, (EItemRarity)2);
			case TargetKind.ShadyLegendary:
				return Shady(from, (EItemRarity)3);
			case TargetKind.Chest:
				return Closest<InteractableChest>(from, (Func<InteractableChest, bool>)((InteractableChest c) => !c.opening && !c.isInCrypt), L.T("Chest", "صندوق"));
			case TargetKind.Pot:
				return Closest<InteractablePot>(from, (Func<InteractablePot, bool>)((InteractablePot p) => !p.broken), L.T("Pot", "جرة"));
			case TargetKind.Tumbleweed:
				return Closest<InteractableTumbleWeed>(from, (Func<InteractableTumbleWeed, bool>)((InteractableTumbleWeed t) => !t.broken), L.T("Tumbleweed", "شجيرة متدحرجة"));
			case TargetKind.Boss:
				return Boss(from);
			case TargetKind.Miniboss:
				return ClosestEnemy(from, (Enemy e) => IsMiniboss(e), L.T("Miniboss", "زعيم مصغر"));
			case TargetKind.Frogs:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Frog", "ضفدع"));
			case TargetKind.Scorpion:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Scorpion miniboss", "العقربوسي"));
			case TargetKind.Skeletons:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Skeleton", "هيكل عظمي"));
			case TargetKind.Goblins:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Goblin", "عفريت"));
			case TargetKind.Spectres:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Spectre", "طيف"));
			case TargetKind.Cactus:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Cactus", "صبار"));
			case TargetKind.SpookySteve:
				return ClosestEnemy(from, (Enemy e) => GuideTargets.Matches(e.enemyData.enemyName, kind), L.T("Spooky Steve", "ستيف المخيف"));
			case TargetKind.Pumpkin:
				return Closest<InteractablePot>(from, (Func<InteractablePot, bool>)((InteractablePot p) => !p.broken && IsPumpkin(p)), L.T("Pumpkin", "يقطينة"));
			default:
				return default((Transform, string, float));
			}
		}

		private static (Transform, string, float) Shady(Vector3 from, EItemRarity rarity)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return Closest<InteractableShadyGuy>(from, (Func<InteractableShadyGuy, bool>)((InteractableShadyGuy s) => !s.done && s.rarity == rarity), L.T("Shady Guy", "الرجل المريب"));
		}

		private static (Transform, string, float) Boss(Vector3 from)
		{
			//IL_00f3: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_0231: Unknown result type (might be due to invalid IL or missing references)
			EnemyManager instance = EnemyManager.Instance;
			string text = L.T("Boss", "الزعيم");
			_sawHidden = false;
			if ((Object)(object)instance != (Object)null && instance.stageBosses != null)
			{
				Transform val = null;
				float num = float.MaxValue;
				Enumerator<Enemy> enumerator = instance.stageBosses.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Enemy current = enumerator.Current;
					if (!((Object)(object)current == (Object)null) && !(current.hp <= 0f) && InReach(((Component)current).transform.position) && IsDiscovered(((Component)current).transform))
					{
						Vector3 val2 = ((Component)current).transform.position - from;
						float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
						if (sqrMagnitude < num)
						{
							num = sqrMagnitude;
							val = ((Component)current).transform;
						}
					}
				}
				if ((Object)(object)val != (Object)null)
				{
					return (val, text, 4f);
				}
			}
			if (_sawHidden)
			{
				return (null, text, 0f);
			}
			(Transform, string, float) result = ClosestEnemy(from, (Enemy e) => (e.enemyFlag & 0x24) != 0 || (int)e.enemyData.enemyName == 43, text);
			if ((Object)(object)result.Item1 != (Object)null || _sawHidden)
			{
				return result;
			}
			(Transform, string, float) result2 = Nearer(from, Closest<InteractablePortal>(from, (Func<InteractablePortal, bool>)((InteractablePortal p) => !p.done), L.T("Portal", "البوابة")), Closest<InteractablePortalFinal>(from, (Func<InteractablePortalFinal, bool>)((InteractablePortalFinal p) => !p.done), L.T("Portal", "البوابة")));
			if ((Object)(object)result2.Item1 != (Object)null || _sawHidden)
			{
				if (!((Object)(object)result2.Item1 != (Object)null))
				{
					return (null, L.T("Portal", "البوابة"), 0f);
				}
				return result2;
			}
			if ((Object)(object)instance != (Object)null && instance.stageBossIsDead)
			{
				return default((Transform, string, float));
			}
			(Transform, string, float) result3 = Nearer(from, Closest<InteractableBossSpawner>(from, (Func<InteractableBossSpawner, bool>)((InteractableBossSpawner _) => true), L.T("Boss Portal", "بوابة الزعيم")), Closest<InteractableBossSpawnerFinal>(from, (Func<InteractableBossSpawnerFinal, bool>)((InteractableBossSpawnerFinal s) => !s.done), L.T("Final boss portal", "بوابة الزعيم الأخير")));
			if (!((Object)(object)result3.Item1 != (Object)null))
			{
				return (null, L.T("Boss Portal", "بوابة الزعيم"), 0f);
			}
			return result3;
		}

		private static bool IsPumpkin(InteractablePot p)
		{
			string debugGraveyardName = InteractablePot.debugGraveyardName;
			if (!string.IsNullOrEmpty(debugGraveyardName) && ((BaseInteractable)p).GetDebugName() == debugGraveyardName)
			{
				return true;
			}
			return ((Object)((Component)p).gameObject).name.IndexOf("pumpkin", StringComparison.OrdinalIgnoreCase) >= 0;
		}

		private static bool IsEnemy(EnemyData data, EEnemy which)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return (Object)(object)data != (Object)null && data.enemyName == which;
			}
			catch
			{
				return false;
			}
		}

		private static bool IsMiniboss(Enemy e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Invalid comparison between Unknown and I4
			EEnemyFlag enemyFlag = e.enemyFlag;
			if ((enemyFlag & 0x26) != 0)
			{
				return false;
			}
			if ((enemyFlag & 0x11) != 0)
			{
				return true;
			}
			EEnemy enemyName = e.enemyData.enemyName;
			if ((int)enemyName <= 15)
			{
				if ((int)enemyName == 7 || (int)enemyName == 15)
				{
					goto IL_003d;
				}
			}
			else if ((int)enemyName == 25 || (int)enemyName == 27)
			{
				goto IL_003d;
			}
			return false;
			IL_003d:
			return true;
		}

		private static (Transform, string, float) Closest<T>(Vector3 from, Func<T, bool> wanted, string label) where T : Component
		{
			//IL_0053: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			Transform item = null;
			float num = float.MaxValue;
			foreach (Object item2 in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<T>()))
			{
				T val = ((Il2CppObjectBase)item2).TryCast<T>();
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				try
				{
					if (!wanted(val))
					{
						continue;
					}
				}
				catch
				{
					continue;
				}
				if (InReach(((Component)val).transform.position) && IsDiscovered(((Component)val).transform))
				{
					Vector3 val2 = ((Component)val).transform.position - from;
					float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						item = ((Component)val).transform;
					}
				}
			}
			return (item, label, 2.5f);
		}

		private static (Transform, string, float) ClosestEnemy(Vector3 from, Func<Enemy, bool> wanted, string label)
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			EnemyManager instance = EnemyManager.Instance;
			if ((Object)(object)instance == (Object)null || instance.enemies == null)
			{
				return default((Transform, string, float));
			}
			Transform item = null;
			float num = float.MaxValue;
			Enumerator<uint, Enemy> enumerator = instance.enemies.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Enemy value = enumerator.Current.Value;
				if ((Object)(object)value == (Object)null || value.hp <= 0f || (Object)(object)value.enemyData == (Object)null)
				{
					continue;
				}
				try
				{
					if (!wanted(value))
					{
						continue;
					}
				}
				catch
				{
					continue;
				}
				if (InReach(((Component)value).transform.position) && IsDiscovered(((Component)value).transform))
				{
					Vector3 val = ((Component)value).transform.position - from;
					float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
					if (sqrMagnitude < num)
					{
						num = sqrMagnitude;
						item = ((Component)value).transform;
					}
				}
			}
			return (item, label, 3f);
		}

		private static (Transform, string, float) Nearer(Vector3 from, (Transform T, string L, float H) a, (Transform T, string L, float H) b)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)a.T == (Object)null)
			{
				return b;
			}
			if ((Object)(object)b.T == (Object)null)
			{
				return a;
			}
			Vector3 val = a.T.position - from;
			float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
			val = b.T.position - from;
			if (!(sqrMagnitude <= ((Vector3)(ref val)).sqrMagnitude))
			{
				return b;
			}
			return a;
		}

		private static void SyncMinimap()
		{
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			if (_minimapBroken)
			{
				return;
			}
			if (!Plugin.Cfg.GuideMinimap.Value)
			{
				ClearMinimap();
				return;
			}
			MinimapCamera val = MinimapScript();
			if ((Object)(object)val == (Object)null)
			{
				OurMinimapArrows.Clear();
				MinimapTransforms.Clear();
				return;
			}
			Dictionary<IntPtr, GuideTarget> dictionary = (from t in Targets
				where (Object)(object)t.Transform != (Object)null
				group t by ((Il2CppObjectBase)t.Transform).Pointer).ToDictionary((IGrouping<IntPtr, GuideTarget> g) => g.Key, (IGrouping<IntPtr, GuideTarget> g) => g.First());
			foreach (IntPtr item in OurMinimapArrows.ToList())
			{
				if (!dictionary.ContainsKey(item))
				{
					if (MinimapTransforms.TryGetValue(item, out var value) && (Object)(object)value != (Object)null && val.arrowDict.ContainsKey(value))
					{
						val.RemoveArrow(value);
					}
					OurMinimapArrows.Remove(item);
					MinimapTransforms.Remove(item);
				}
			}
			foreach (var (intPtr2, guideTarget2) in dictionary)
			{
				if (!OurMinimapArrows.Contains(intPtr2) && !val.arrowDict.ContainsKey(guideTarget2.Transform))
				{
					val.AddArrow(guideTarget2.Transform, guideTarget2.Color);
					OurMinimapArrows.Add(intPtr2);
					MinimapTransforms[intPtr2] = guideTarget2.Transform;
				}
			}
		}

		private static void ClearMinimap()
		{
			if (OurMinimapArrows.Count == 0)
			{
				return;
			}
			try
			{
				MinimapCamera val = MinimapScript();
				if ((Object)(object)val != (Object)null)
				{
					foreach (Transform value in MinimapTransforms.Values)
					{
						if ((Object)(object)value != (Object)null && val.arrowDict.ContainsKey(value))
						{
							val.RemoveArrow(value);
						}
					}
				}
			}
			catch (Exception e)
			{
				LogOnce("Could not clear the minimap", e);
			}
			OurMinimapArrows.Clear();
			MinimapTransforms.Clear();
		}

		private static MinimapCamera MinimapScript()
		{
			MyPlayer instance = MyPlayer.Instance;
			if (!((Object)(object)instance != (Object)null))
			{
				return null;
			}
			return instance.minimapCameraScript;
		}

		public static void Draw()
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: 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_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			if (!Visible || !Tracker.InRun || Time.timeScale <= 0f || Picker.Open || KeyBinder.Open || Hud.LayoutMode || Cursor.visible || (int)Event.current.type != 7)
			{
				return;
			}
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				return;
			}
			EnsureArrow();
			float num = Hud.BaseScale * Mathf.Clamp(Plugin.Cfg.GuideScale.Value, 0.5f, 2.5f);
			Vector3 val = PlayerPosition();
			Vector3 val2 = main.WorldToScreenPoint(val + Vector3.up);
			if (val2.z < 0f)
			{
				return;
			}
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(val2.x, (float)Screen.height - val2.y);
			Vector3 val4 = ((Component)main).transform.forward;
			val4.y = 0f;
			if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f)
			{
				val4 = ((Component)main).transform.up;
			}
			val4.y = 0f;
			((Vector3)(ref val4)).Normalize();
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(val4.z, 0f, 0f - val4.x);
			Matrix4x4 matrix = GUI.matrix;
			int num2 = 0;
			int num3 = 0;
			foreach (GuideTarget target in Targets)
			{
				if (target.Find)
				{
					DrawText(val3 + new Vector2(0f, (70f + (float)num3++ * 26f) * num), "?  " + target.Label, target.Color, num);
					continue;
				}
				Vector3 position;
				try
				{
					if ((Object)(object)target.Transform == (Object)null)
					{
						continue;
					}
					position = target.Transform.position;
					goto IL_01c7;
				}
				catch
				{
				}
				continue;
				IL_01c7:
				Vector3 val6 = position - val;
				val6.y = 0f;
				if (!(((Vector3)(ref val6)).magnitude < 6f))
				{
					Vector2 val7 = new Vector2(Vector3.Dot(val6, val5), 0f - Vector3.Dot(val6, val4));
					Vector2 normalized = ((Vector2)(ref val7)).normalized;
					float num4 = (120f + (float)num2 * 34f) * num;
					num2++;
					Vector2 val8 = val3 + normalized * num4;
					float angle = Mathf.Atan2(normalized.y, normalized.x) * 57.29578f;
					float num5 = 1f + 0.08f * Mathf.Sin(Time.unscaledTime * 4f + (float)num2);
					DrawArrow(val8, angle, 30f * num * num5, target.Color);
					DrawText(val8 + normalized * 30f * num, target.Label, target.Color, num);
				}
			}
			GUI.matrix = matrix;
			if (_mapHint != null)
			{
				if (_mapHintUntil < 0f)
				{
					_mapHintUntil = Time.unscaledTime + 10f;
				}
				if (Time.unscaledTime < _mapHintUntil)
				{
					DrawMapHint(num);
				}
			}
		}

		private static void DrawArrow(Vector2 pivot, float angle, float size, 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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 matrix = GUI.matrix;
			GUI.matrix = Matrix4x4.TRS(Vector2.op_Implicit(pivot), Quaternion.Euler(0f, 0f, angle), Vector3.one) * Matrix4x4.TRS(Vector2.op_Implicit(-pivot), Quaternion.identity, Vector3.one);
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(new Rect(pivot.x - size / 2f, pivot.y - size / 2f, size, size), (Texture)(object)_arrow);
			GUI.color = color2;
			GUI.matrix = matrix;
		}

		private static void DrawText(Vector2 anchor, string text, Color color, float s)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 matrix = GUI.matrix;
			GUI.matrix = Matrix4x4.Scale(new Vector3(s, s, 1f));
			Vector2 val = anchor / s;
			GUIStyle tagStyle = Hud.TagStyle;
			Vector2 val2 = Hud.Measure(text, tagStyle);
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(val.x - val2.x / 2f, val.y - val2.y / 2f, val2.x, val2.y);
			((Rect)(ref r)).x = Mathf.Clamp(((Rect)(ref r)).x, 4f, (float)Screen.width / s - val2.x - 4f);
			((Rect)(ref r)).y = Mathf.Clamp(((Rect)(ref r)).y, 4f, (float)Screen.height / s - val2.y - 4f);
			Hud.Fill(new Rect(((Rect)(ref r)).x - 4f, ((Rect)(ref r)).y - 1f, ((Rect)(ref r)).width + 8f, ((Rect)(ref r)).height + 2f), new Color(0f, 0f, 0f, 0.5f));
			Hud.Label(r, text, tagStyle, color);
			GUI.matrix = matrix;
		}

		private static void DrawMapHint(float s)
		{
			//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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			Matrix4x4 matrix = GUI.matrix;
			GUI.matrix = Matrix4x4.Scale(new Vector3(s, s, 1f));
			float num = (float)Screen.width / s;
			GUIStyle hintStyle = Hud.HintStyle;
			float num2 = 130f;
			string[] array = _mapHint.Split('\n');
			Rect r = default(Rect);
			foreach (string text in array)
			{
				Vector2 val = Hud.Measure(text, hintStyle);
				((Rect)(ref r))..ctor((num - val.x) / 2f, num2, val.x, val.y);
				Hud.Fill(new Rect(((Rect)(ref r)).x - 10f, ((Rect)(ref r)).y - 4f, ((Rect)(ref r)).width + 20f, ((Rect)(ref r)).height + 8f), new Color(0f, 0f, 0f, 0.75f));
				Hud.Label(r, text, hintStyle, Hud.GoldColor);
				num2 += val.y + 12f;
			}
			GUI.matrix = matrix;
		}

		private static void EnsureArrow()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00e8: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_arrow != (Object)null)
			{
				return;
			}
			Vector2[] array = (Vector2[])(object)new Vector2[4]
			{
				new Vector2(60f, 32f),
				new Vector2(8f, 58f),
				new Vector2(22f, 32f),
				new Vector2(8f, 6f)
			};
			_arrow = new Texture2D(64, 64, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61,
				filterMode = (FilterMode)1
			};
			Color val = default(Color);
			((Color)(ref val))..ctor(0.08f, 0.08f, 0.1f, 1f);
			Vector2 p = default(Vector2);
			Color val2 = default(Color);
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					((Vector2)(ref p))..ctor((float)j + 0.5f, (float)i + 0.5f);
					((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
					if (Inside(array, p))
					{
						float num = float.MaxValue;
						for (int k = 0; k < array.Length; k++)
						{
							num = Mathf.Min(num, SegmentDistance(p, array[k], array[(k + 1) % array.Length]));
						}
						val2 = ((num < 3.5f) ? val : Color.white);
					}
					_arrow.SetPixel(j, i, val2);
				}
			}
			_arrow.Apply();
		}

		private static bool Inside(Vector2[] poly, Vector2 p)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			bool flag = false;
			int num = 0;
			int num2 = poly.Length - 1;
			while (num < poly.Length)
			{
				if (poly[num].y > p.y != poly[num2].y > p.y && p.x < (poly[num2].x - poly[num].x) * (p.y - poly[num].y) / (poly[num2].y - poly[num].y) + poly[num].x)
				{
					flag = !flag;
				}
				num2 = num++;
			}
			return flag;
		}

		private static float SegmentDistance(Vector2 p, Vector2 a, Vector2 b)
		{
			//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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = b - a;
			float num = Mathf.Clamp01(Vector2.Dot(p - a, val) / ((Vector2)(ref val)).sqrMagnitude);
			return Vector2.Distance(p, a + val * num);
		}

		private static void LogOnce(string what, Exception e)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if (!_loggedError)
			{
				_loggedError = true;
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(39, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Quest guide: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(what);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (further errors hidden)");
				}
				logger.LogWarning(val);
			}
		}
	}
	internal enum TargetKind
	{
		Boombox,
		MonkeCage,
		Bush,
		Bandit,
		Bananarang,
		Gift,
		FrogEgg,
		Frogs,
		QuestUnlock,
		SkeletonStatue,
		Crypt,
		CryptLoot,
		CryptExit,
		ChargeShrine,
		MagnetShrine,
		CursedShrine,
		Microwave,
		ShadyCommon,
		ShadyRare,
		ShadyEpic,
		ShadyLegendary,
		Chest,
		Pot,
		Tumbleweed,
		Boss,
		Miniboss,
		Scorpion,
		Skeletons,
		Goblins,
		Spectres,
		Cactus,
		SpookySteve,
		Pumpkin,
		Coffin,
		DesertGrave
	}
	internal class GuideRule
	{
		public TargetKind[] Kinds;

		public EMap Map;

		private string _howEn;

		private string _howAr;

		public string HowTo
		{
			get
			{
				if (_howEn != null)
				{
					return L.T(_howEn, _howAr);
				}
				return null;
			}
		}

		public GuideRule(EMap map, params TargetKind[] kinds)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Map = map;
			Kinds = kinds;
		}

		public GuideRule How(string en, string ar)
		{
			_howEn = en;
			_howAr = ar;
			return this;
		}
	}
	internal static class GuideTargets
	{
		private static readonly Dictionary<string, GuideRule> ById = new Dictionary<string, GuideRule>(StringComparer.OrdinalIgnoreCase)
		{
			["a_boombox"] = new GuideRule((EMap)1, default(TargetKind)).How("Find the 3 boomboxes hidden around the Forest and turn each one on.", "ابحث عن مكبرات الصوت الثلاثة المخفية في الغابة وشغ\u0651ل كل واحد منها."),
			["a_monke"] = new GuideRule((EMap)1, TargetKind.MonkeCage).How("Find Monke's cage somewhere in the Forest and open it to free him.", "ابحث عن قفص مونكي في مكان ما في الغابة وافتحه لتحريره."),
			["a_bush"] = new GuideRule((EMap)1, TargetKind.Bush).How("Find the Bush hiding in the Forest, talk to it, then beat it in the fight.", "ابحث عن الشجيرة المختبئة في الغابة، تفاعل معها ثم اهزمها في القتال."),
			["a_bandit"] = new GuideRule((EMap)2, TargetKind.Bandit).How("Find the Bandit hiding in the Desert, talk to him, then beat him in the fight.", "ابحث عن اللص المختبئ في الصحراء، تفاعل معه ثم اهزمه في القتال."),
			["a_bananarang"] = new GuideRule((EMap)0, TargetKind.Bananarang).How("A banana is hidden somewhere on the map. Find it and pick it up.", "توجد موزة مخفية في مكان ما على الخريطة. ابحث عنها والتقطها."),
			["a_santaHat"] = new GuideRule((EMap)1, TargetKind.Gift).How("A present is hidden somewhere in the Forest. Find it and open it.", "توجد هدية مخفية في مكان ما في الغابة. ابحث عنها وافتحها."),
			["a_hatFrog1"] = new GuideRule((EMap)1, TargetKind.Frogs, TargetKind.FrogEgg).How("On Forest stage 1, break the frog egg, then catch the frogs that hop out.", "في المرحلة 1 من الغابة، اكسر بيضة الضفادع ثم امسك الضفادع التي تخرج منها."),
			["a_hatFrog2"] = new GuideRule((EMap)1, TargetKind.Frogs, TargetKind.FrogEgg).How("On Forest stage 2, break the frog egg, then catch the frogs that hop out.", "في المرحلة 2 من الغابة، اكسر بيضة الضفادع ثم امسك الضفادع التي تخرج منها."),
			["a_hatFrog3"] = new GuideRule((EMap)1, TargetKind.Frogs, TargetKind.FrogEgg).How("On Forest stage 3, break the frog egg, then catch the frogs that hop out.", "في المرحلة 3 من الغابة، اكسر بيضة الضفادع ثم امسك الضفادع التي تخرج منها."),
			["a_oldMask"] = new GuideRule((EMap)8, TargetKind.QuestUnlock).How("The mask is hidden somewhere on the Graveyard. Find it and pick it up.", "القناع مخفي في مكان ما في المقبرة. ابحث عنه والتقطه."),
			["a_snek"] = new GuideRule((EMap)8, TargetKind.QuestUnlock, TargetKind.Crypt).How("Enter the crypt on the Graveyard. The snake is hidden inside.", "ادخل السرداب في المقبرة. الأفعى مخفية بداخله."),
			["a_graveyard"] = new GuideRule((EMap)2, TargetKind.DesertGrave, TargetKind.SkeletonStatue).How("As Calcium on Desert Tier 2: disturb the 4 graves and beat their ghosts, then touch the skeleton statue to summon the undead boss and beat it.", "بشخصية كالسيوم في الصحراء المستوى 2: أزعج القبور الأربعة واهزم أشباحها، ثم المس تمثال الهيكل العظمي لاستدعاء زعيم الموتى الأحياء واهزمه."),
			["a_potSteel"] = new GuideRule((EMap)8, TargetKind.CryptLoot, TargetKind.Crypt).How("Enter the first crypt on the Graveyard and break every pot and open every chest inside.", "ادخل السرداب الأول في المقبرة واكسر كل جرة وافتح كل صندوق بداخله."),
			["a_roberto"] = new GuideRule((EMap)8, TargetKind.SpookySteve, TargetKind.Coffin, TargetKind.Crypt).How("On the Graveyard, Spooky Steve comes out of the crypt: enter the crypt (guides say open the 4 coffins for crypt keys first, or fail the crypt escape), then kill him.", "في المقبرة، يخرج ستيف المخيف من السرداب: ادخل السرداب (تقول الأدلة افتح التوابيت الأربعة أولا لتحصل على مفاتيح السرداب، أو افشل في الهروب من السرداب)، ثم اقتله."),
			["a_pumpkin"] = new GuideRule((EMap)8, TargetKind.Pumpkin).How("As Roberto on the Graveyard, break every pumpkin on the map.", "بشخصية روبرتو في المقبرة، اكسر كل يقطينة على الخريطة."),
			["a_suckyMagnet"] = new GuideRule((EMap)0, TargetKind.ChargeShrine),
			["a_chaosTome"] = new GuideRule((EMap)0, TargetKind.ChargeShrine),
			["a_tornado"] = new GuideRule((EMap)2, TargetKind.ChargeShrine).How("On the Desert, wait for a sandstorm, then charge a charge shrine while it lasts.", "في الصحراء، انتظر العاصفة الرملية ثم اشحن مزار شحن أثناءها."),
			["a_attractionTome"] = new GuideRule((EMap)0, TargetKind.MagnetShrine),
			["a_speedBoi"] = new GuideRule((EMap)0, TargetKind.CursedShrine, TargetKind.Boss).How("Use at least 2 boss curse shrines, then finish the stage.", "استخدم مزاري لعنة الزعيم على الأقل، ثم أكمل المرحلة."),
			["a_hatHeadset"] = new GuideRule((EMap)2, TargetKind.CursedShrine, TargetKind.Boss).How("As Ninja on Desert stage 1, use at least 2 boss curse shrines, then finish the stage.", "بشخصية النينجا في المرحلة 1 من الصحراء، استخدم مزاري لعنة الزعيم على الأقل، ثم أكمل المرحلة."),
			["a_hatMicrowave"] = new GuideRule((EMap)0, TargetKind.Microwave).How("Keep using microwaves until they blow up.", "استمر في استخدام أجهزة الميكروويف حتى تنفجر."),
			["a_noelle"] = new GuideRule((EMap)0, TargetKind.Microwave).How("Put an Ice Crystal in a microwave to copy it, 3 times in a row.", "ضع بلورة الجليد في الميكروويف لنسخها 3 مرات متتالية."),
			["a_poisonGloves"] = new GuideRule((EMap)0, TargetKind.Microwave).How("Put a Moldy Cheese in a microwave to copy it, 3 times in a row.", "ضع الجبنة المتعفنة في الميكروويف لنسخها 3 مرات متتالية."),
			["a_hatShadyBlack"] = new GuideRule((EMap)0, TargetKind.ShadyCommon),
			["a_hatShadyBlue"] = new GuideRule((EMap)0, TargetKind.ShadyRare),
			["a_hatShadyPink"] = new GuideRule((EMap)0, TargetKind.ShadyEpic),
			["a_hatShadyGold"] = new GuideRule((EMap)0, TargetKind.ShadyLegendary),
			["a_key"] = new GuideRule((EMap)0, TargetKind.Chest),
			["a_goldenSneakers"] = new GuideRule((EMap)0, TargetKind.Pot),
			["a_xpTome"] = new GuideRule((EMap)0, TargetKind.Pot),
			["a_katana"] = new GuideRule((EMap)2, TargetKind.Tumbleweed).How("On Desert stage 1, break rolling tumbleweeds. Each has a small chance to drop it.", "في المرحلة 1 من الصحراء، اكسر الشجيرات المتدحرجة. لكل واحدة فرصة صغيرة لإسقاطه."),
			["a_shotgun"] = new GuideRule((EMap)2, TargetKind.Tumbleweed).How("On Desert stage 2, break rolling tumbleweeds. Each has a small chance to drop it.", "في المرحلة 2 من الصحراء، اكسر الشجيرات المتدحرجة. لكل واحدة فرصة صغيرة لإسقاطه."),
			["a_poisonFlask"] = new GuideRule((EMap)2, TargetKind.Scorpion).How("The Scorpion miniboss spawns on the Desert. Kill it 3 times (across runs).", "يظهر الزعيم المصغر العقربوسي في الصحراء. اقتله 3 مرات (عبر عدة جولات)."),
			["a_tacticalGlasses"] = new GuideRule((EMap)0, TargetKind.Miniboss),
			["a_hatSheriff"] = new GuideRule((EMap)0, TargetKind.Miniboss, TargetKind.Boss),
			["a_calcium"] = new GuideRule((EMap)0, TargetKind.Skeletons),
			["a_ogre"] = new GuideRule((EMap)0, TargetKind.Goblins),
			["a_dragonsBreath"] = new GuideRule((EMap)2, TargetKind.Spectres),
			["a_cactus"] = new GuideRule((EMap)2, TargetKind.Cactus),
			["a_scythe"] = new GuideRule((EMap)8, TargetKind.Boss, TargetKind.Coffin).How("On the Graveyard, open the 4 coffins and beat each ghost for a crypt key, then fight Big Bob and kill him.", "في المقبرة، افتح التوابيت الأربعة واهزم كل شبح لتحصل على مفتاح سرداب، ثم قاتل بوب الكبير واقتله."),
			["a_bobsLantern"] = new GuideRule((EMap)8, TargetKind.Boss, TargetKind.Coffin).How("Reach Big Bob on the Graveyard (open the 4 coffins for crypt keys) and land the killing blow with a lamp.", "صل إلى بوب الكبير في المقبرة (افتح التوابيت الأربعة لتحصل على مفاتيح السرداب) واجعل الضربة القاضية بمصباح."),
			["a_hatSunglasses"] = new GuideRule((EMap)8, TargetKind.Boss, TargetKind.Coffin).How("As Calcium, reach Big Bob on the Graveyard (open the 4 coffins first) and win the fight in under 60 seconds.", "بشخصية كالسيوم، صل إلى بوب الكبير في المقبرة (افتح التوابيت الأربعة أولا) واربح القتال في أقل من 60 ثانية."),
			["a_desert"] = new GuideRule((EMap)1, TargetKind.Boss),
			["a_chadwell"] = new GuideRule((EMap)1, TargetKind.Boss),
			["a_clank"] = new GuideRule((EMap)1, TargetKind.Boss),
			["a_robinette"] = new GuideRule((EMap)1, TargetKind.Boss),
			["a_ninja"] = new GuideRule((EMap)2, TargetKind.Boss),
			["a_vlad"] = new GuideRule((EMap)2, TargetKind.Boss),
			["a_spaceNoodle"] = new GuideRule((EMap)2, TargetKind.Boss),
			["a_skin_megachadKevin"] = new GuideRule((EMap)1, TargetKind.Boss),
			["a_hatMedieval"] = new GuideRule((EMap)1, TargetKind.Boss),
			["a_hatCheese"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_energyCore"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_bossBuster"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_cursedTome"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_heroSword"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_holyBook"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_gamerGoggles"] = new GuideRule((EMap)0, TargetKind.Boss),
			["a_quinsMask"] = new GuideRule((EMap)0, TargetKind.Boss)
		};

		private const string CryptEn = "On the Graveyard, enter the first crypt and reach its exit before the timer runs out.";

		private const string CryptAr = "في المقبرة، ادخل السرداب الأول واصل إلى مخرجه قبل انتهاء الوقت.";

		public static GuideRule For(TrackedQuest q)
		{
			if (q == null || q.Id == null)
			{
				return null;
			}
			if (ById.TryGetValue(q.Id, out var value))
			{
				return value;
			}
			string id = q.Id;
			if (id.StartsWith("a_skin_", StringComparison.OrdinalIgnoreCase))
			{
				if (id.EndsWith("Crypt", StringComparison.OrdinalIgnoreCase))
				{
					return new GuideRule((EMap)8, TargetKind.CryptExit, TargetKind.Crypt).How("On the Graveyard, enter the first crypt and reach its exit before the timer runs out.", "في المقبرة، ادخل السرداب الأول واصل إلى مخرجه قبل انتهاء الوقت.");
				}
				if (id.EndsWith("Speedrun", StringComparison.OrdinalIgnoreCase) || id.EndsWith("FinalBoss", StringComparison.OrdinalIgnoreCase))
				{
					return new GuideRule((EMap)0, TargetKind.Boss);
				}
				return null;
			}
			if (id.StartsWith("a_graveyard1_crypt", StringComparison.OrdinalIgnoreCase))
			{
				return new GuideRule((EMap)8, TargetKind.CryptExit, TargetKind.Crypt).How("On the Graveyard, enter the first crypt and reach its exit before the timer runs out.", "في المقبرة، ادخل السرداب الأول واصل إلى مخرجه قبل انتهاء الوقت.");
			}
			if (id.StartsWith("a_forest", StringComparison.OrdinalIgnoreCase))
			{
				return new GuideRule((EMap)1, TargetKind.Boss);
			}
			if (id.StartsWith("a_desert", StringComparison.OrdinalIgnoreCase))
			{
				return new GuideRule((EMap)2, TargetKind.Boss);
			}
			if (id.StartsWith("a_graveyard", StringComparison.OrdinalIgnoreCase))
			{
				return new GuideRule((EMap)8, TargetKind.Boss);
			}
			return FromText(q.Description);
		}

		private static GuideRule FromText(string text)
		{
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			string t = text.ToLowerInvariant();
			if (Has(new string[2] { "charge shrine", "مزار الشحن" }))
			{
				return new GuideRule((EMap)0, TargetKind.ChargeShrine);
			}
			if (Has(new string[2] { "crypt", "السرداب" }))
			{
				return new GuideRule((EMap)8, TargetKind.CryptExit, TargetKind.Crypt);
			}
			if (Has(new string[2] { "microwave", "ميكروويف" }))
			{
				return new GuideRule((EMap)0, TargetKind.Microwave);
			}
			if (Has(new string[3] { "miniboss", "mini boss", "زعيم مصغر" }))
			{
				return new GuideRule((EMap)0, TargetKind.Miniboss);
			}
			if (Has(new string[2] { "boss", "زعيم" }))
			{
				return new GuideRule((EMap)0, TargetKind.Boss);
			}
			return null;
			bool Has(params string[] words)
			{
				foreach (string value in words)
				{
					if (t.Contains(value))
					{
						return true;
					}
				}
				return false;
			}
		}

		public static EEnemy? EnemyFor(TargetKind kind)
		{
			return kind switch
			{
				TargetKind.SpookySteve => (EEnemy)48, 
				TargetKind.Scorpion => (EEnemy)27, 
				TargetKind.Cactus => (EEnemy)29, 
				TargetKind.Spectres => (EEnemy)28, 
				_ => null, 
			};
		}

		public static bool Matches(EEnemy e, TargetKind kind)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Invalid comparison between Unknown and I4
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Invalid comparison between Unknown and I4
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Invalid comparison between Unknown and I4
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Invalid comparison between Unknown and I4
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Invalid comparison between Unknown and I4
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			return kind switch
			{
				TargetKind.Frogs => e - 51 <= 1, 
				TargetKind.Scorpion => (int)e == 27, 
				TargetKind.Skeletons => ((int)e <= 5 || (int)e == 18 || (int)e == 33) ? true : false, 
				TargetKind.Goblins => e - 12 <= 2, 
				TargetKind.Spectres => (int)e == 28, 
				TargetKind.Cactus => (int)e == 29, 
				TargetKind.SpookySteve => (int)e == 48, 
				_ => false, 
			};
		}
	}
	internal static class Hud
	{
		private enum Drag
		{
			None,
			Move,
			Resize
		}

		private const float PanelWidth = 400f;

		private const float Pad = 12f;

		private const float TitleRow = 26f;

		private const float StatusRow = 24f;

		private const float BarRow = 16f;

		private const float Handle = 22f;

		private const float RemoveSize = 22f;

		private static bool _stylesReady;

		private static GUIStyle _title;

		private static GUIStyle _desc;

		private static GUIStyle _status;

		private static GUIStyle _timer;

		private static GUIStyle _hint;

		private static GUIStyle _tag;

		private static GUIStyle _header;

		private static GUIStyle _rowTitle;

		private static GUIStyle _rowDesc;

		private static GUIStyle _button;

		private static GUIStyle _tab;

		private static GUIStyle _tabOn;

		private static GUIStyle _field;

		private static Texture2D _white;

		private static readonly Color Gold = new Color(1f, 0.82f, 0.25f);

		private static readonly Color Green = new Color(0.35f, 0.95f, 0.45f);

		private static readonly Color Yellow = new Color(1f, 0.85f, 0.2f);

		private static readonly Color Red = new Color(1f, 0.33f, 0.3f);

		private static readonly Color Grey = new Color(0.72f, 0.72f, 0.78f);

		private static readonly Color Blue = new Color(0.45f, 0.78f, 1f);

		private static string _toast;

		private static float _toastUntil;

		private static Color _toastColor = new Color(1f, 0.82f, 0.25f);

		private static bool _mouseHeld;

		private static Drag _drag;

		private static Vector2 _dragStart;

		private static float _startX;

		private static float _startY;

		private static float _startScale;

		private static readonly TrackedQuest Sample = new TrackedQuest
		{
			Id = "_sample",
			Title = L.T("Example quest", "مهمة تجريبية"),
			Description = L.T("Kill 15,000 enemies as Ogre", "اقتل 15,000 من الأعداء بشخصية الغول"),
			HasCount = true,
			Current = 11162,
			Target = 15000,
			Progress = 0.744f,
			Status = QuestStatus.InProgress,
			StatusText = L.T("3,838 left  ·  +312 this run", "متبقي 3,838  ·  +312 في هذه الجولة")
		};

		private static readonly Dictionary<IntPtr, GUIStyle> RightStyles = new Dictionary<IntPtr, GUIStyle>();

		public static bool LayoutMode { get; private set; }

		internal static float BaseScale => Mathf.Clamp((float)Screen.height / 1080f, 0.6f, 3f);

		private static float PanelScale => BaseScale * Mathf.Clamp(Plugin.Cfg.Scale.Value, 0.5f, 2.5f);

		internal static GUIStyle HintStyle => _hint;

		internal static GUIStyle TagStyle => _tag;

		internal static GUIStyle Header => _header;

		internal static GUIStyle RowTitle => _rowTitle;

		internal static GUIStyle RowDesc => _rowDesc;

		internal static GUIStyle Button => _button;

		internal static GUIStyle Tab => _tab;

		internal static GUIStyle TabOn => _tabOn;

		internal static GUIStyle Field => _field;

		internal static Color GoldColor => Gold;

		internal static Color GreenColor => Green;

		internal static Color GreyColor => Grey;

		internal static Color RedColor => Red;

		public static void Draw()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EnsureStyles();
				Event current = Event.current;
				Settings cfg = Plugin.Cfg;
				Vector2 mousePosition = current.mousePosition;
				HandleKeys(current);
				UiHoverScanner.Scan(current);
				if ((int)current.type == 0)
				{
					_mouseHeld = true;
				}
				else if ((int)current.type == 1)
				{
					_mouseHeld = false;
				}
				int num;
				int block;
				if (!Picker.Open && !LayoutMode)
				{
					num = (KeyBinder.Open ? 1 : 0);
					if (num == 0)
					{
						block = ((InputBlocker.Blocking && _mouseHeld) ? 1 : 0);
						goto IL_006e;
					}
				}
				else
				{
					num = 1;
				}
				block = 1;
				goto IL_006e;
				IL_006e:
				InputBlocker.Update((byte)block != 0);
				if (num != 0)
				{
					CursorGuard.Hold();
				}
				else if (!InputBlocker.Blocking)
				{
					CursorGuard.Release();
				}
				List<TrackedQuest> list = PanelCards();
				bool num2 = LayoutMode || (cfg.ShowHud.Value && list.Count > 0 && (Tracker.InRun || cfg.ShowInMenus.Value));
				Guide.Draw();
				Matrix4x4 matrix = GUI.matrix;
				Rect? val = null;
				if (num2)
				{
					float panelScale = PanelScale;
					List<float> list2 = list.Select((TrackedQuest q) => CardHeight(q, 376f)).ToList();
					float num3 = 12f + list2.Sum((float x) => x + 12f);
					Rect val2 = PanelScreenRect(panelScale, num3);
					if (LayoutMode)
					{
						HandleLayoutMouse(current, val2, panelScale, list, list2);
					}
					val2 = PanelScreenRect(panelScale, num3);
					if (!LayoutMode && !Picker.Open && Cursor.visible && ((Rect)(ref val2)).Contains(current.mousePosition))
					{
						val = val2;
					}
					GUI.matrix = Matrix4x4.Scale(new Vector3(panelScale, panelScale, 1f));
					DrawPanel(list, list2, ((Rect)(ref val2)).x / panelScale, ((Rect)(ref val2)).y / panelScale, num3);
					GUI.matrix = matrix;
				}
				float baseScale = BaseScale;
				GUI.matrix = Matrix4x4.Scale(new Vector3(baseScale, baseScale, 1f));
				float sw = (float)Screen.width / baseScale;
				float sh = (float)Screen.height / baseScale;
				if (LayoutMode)
				{
					DrawLayoutHelp(sw);
				}
				if (val.HasValue)
				{
					DrawPanelTag(val.Value, baseScale, sh);
				}
				if (Tracker.HoveredId != null && !Picker.Open && !LayoutMode)
				{
					DrawHoverHint(mousePosition / baseScale);
				}
				if (Picker.Open)
				{
					Picker.Draw(sw, sh, mousePosition / baseScale);
				}
				if (KeyBinder.Open)
				{
					KeyBinder.Draw(sw, sh, mousePosition / baseScale);
				}
				if (_toast != null && Time.unscaledTime < _toastUntil)
				{
					DrawToast(sw);
				}
				GUI.matrix = matrix;
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Quest Tracker draw error: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message);
				}
				logger.LogWarning(val3);
			}
		}

		private static List<TrackedQuest> PanelCards()
		{
			if (LayoutMode)
			{
				if (Tracker.Pinned.Count != 0)
				{
					return Tracker.Pinned.ToList();
				}
				return new List<TrackedQuest> { Sample };
			}
			return Tracker.Pinned.Where((TrackedQuest q) => !Tracker.IsHidden(q)).ToList();
		}

		private static List<Rect> CardRects(float x, float y, List<float> heights)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			List<Rect> list = new List<Rect>();
			float num = y + 12f;
			foreach (float height in heights)
			{
				list.Add(new Rect(x + 12f + 4f, num, 372f, height));
				num += height + 12f;
			}
			return list;
		}

		private static Rect RemoveButton(Rect card)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			return new Rect(((Rect)(ref card)).xMax - 22f, ((Rect)(ref card)).y + 2f, 22f, 22f);
		}

		private static Rect PanelScreenRect(float s, float h)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			Settings cfg = Plugin.Cfg;
			float num = 400f * s;
			float num2 = h * s;
			float num3 = Mathf.Clamp(cfg.PosX.Value * (float)Screen.width, 0f, Mathf.Max(0f, (float)Screen.width - num));
			float num4 = Mathf.Clamp(cfg.PosY.Value * (float)Screen.height, 0f, Mathf.Max(0f, (float)Screen.height - num2));
			return new Rect(num3, num4, num, num2);
		}

		private static void HandleKeys(Event e)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Invalid comparison between Unknown and I4
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Invalid comparison between Unknown and I4
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Invalid comparison between Unknown and I4
			//IL_0163: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_017d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Invalid comparison between Unknown and I4
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Invalid comparison between Unknown and I4
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			if (e == null || (int)e.type != 4 || (int)e.keyCode == 0)
			{
				return;
			}
			Settings cfg = Plugin.Cfg;
			if (KeyBinder.Open)
			{
				KeyBinder.HandleKey(e);
			}
			else
			{
				if (Picker.SearchFocused && e.keyCode != cfg.PickerKey.Value)
				{
					return;
				}
				if (LayoutMode)
				{
					if ((int)e.keyCode == 27 || e.keyCode == cfg.LayoutKey.Value || (int)e.keyCode == 13)
					{
						SetLayoutMode(on: false);
						return;
					}
					if ((int)e.keyCode == 114)
					{
						ResetLayout();
						return;
					}
					KeyCode keyCode = e.keyCode;
					if (((int)keyCode == 43 || (int)keyCode == 61 || (int)keyCode == 270) ? true : false)
					{
						Resize(0.1f);
						return;
					}
					keyCode = e.keyCode;
					if (((int)keyCode == 45 || (int)keyCode == 269) ? true : false)
					{
						Resize(-0.1f);
					}
				}
				else if (e.keyCode == cfg.PinKey.Value && Tracker.HoveredId != null)
				{
					bool num = Tracker.IsPinned(Tracker.HoveredId);
					Tracker.TogglePinHovered();
					Toast(num ? L.T("Quest untracked", "تم إلغاء تتبع المهمة") : L.T("Quest tracked!", "تم تتبع المهمة!"));
				}
				else if (e.keyCode == cfg.PickerKey.Value)
				{
					Picker.Toggle();
				}
				else if ((int)e.keyCode == 27 && Picker.Open)
				{
					Picker.Toggle();
				}
				else if (e.keyCode == cfg.LayoutKey.Value)
				{
					SetLayoutMode(on: true);
				}
				else if (e.keyCode == cfg.HudKey.Value)
				{
					cfg.ShowHud.Value = !cfg.ShowHud.Value;
					cfg.Save();
					Toast(cfg.ShowHud.Value ? L.T("Quest tracker shown", "تم إظهار متتبع المهام") : L.T("Quest tracker hidden", "تم إخفاء متتبع المهام"));
				}
				else if (e.keyCode == cfg.GuideKey.Value)
				{
					cfg.ShowGuide.Value = !cfg.ShowGuide.Value;
					cfg.Save();
					Toast(cfg.ShowGuide.Value ? L.T("Quest guide shown", "تم إظهار دليل المهام") : L.T("Quest guide hidden", "تم إخفاء دليل المهام"));
				}
				else if (e.keyCode == cfg.DumpKey.Value)
				{
					try
					{
						Toast(L.T("Quest list saved to ", "تم حفظ قائمة المهام في ") + Path.GetFileName(Tracker.ExportAll()));
					}
					catch (Exception ex)
					{
						Toast(L.T("Export failed: ", "فشل التصدير: ") + ex.Message);
					}
				}
			}
		}

		public static void SetLayoutMode(bool on)
		{
			LayoutMode = on;
			_drag = Drag.None;
			if (on)
			{
				if (Picker.Open)
				{
					Picker.Toggle();
				}
				Plugin.Cfg.ShowHud.Value = true;
			}
			else
			{
				Plugin.Cfg.Save();
				Toast(L.T("Tracker position saved", "تم حفظ موضع المتتبع"));
			}
		}

		private static void ResetLayout()
		{
			Settings cfg = Plugin.Cfg;
			cfg.PosX.Value = 0.012f;
			cfg.PosY.Value = 0.36f;
			cfg.Scale.Value = 1f;
			Toast(L.T("Tracker reset to default", "تمت إعادة المتتبع للوضع الافتراضي"));
		}

		private static void Resize(float delta)
		{
			Settings cfg = Plugin.Cfg;
			cfg.Scale.Value = Mathf.Clamp((float)Math.Round(cfg.Scale.Value + delta, 2), 0.5f, 2.5f);
		}

		private static void HandleLayoutMouse(Event e, Rect r, float s, List<TrackedQuest> cards, List<float> heights)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected I4, but got Unknown
			//IL_0257: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			Settings cfg = Plugin.Cfg;
			Vector2 mousePosition = e.mousePosition;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref r)).xMax - 22f * s, ((Rect)(ref r)).yMax - 22f * s, 22f * s, 22f * s);
			if ((int)e.type == 0 && e.button == 0)
			{
				List<Rect> list = CardRects(((Rect)(ref r)).x / s, ((Rect)(ref r)).y / s, heights);
				Rect val3 = default(Rect);
				for (int i = 0; i < cards.Count; i++)
				{
					if (cards[i] != Sample)
					{
						Rect val2 = RemoveButton(list[i]);
						((Rect)(ref val3))..ctor(((Rect)(ref val2)).x * s, ((Rect)(ref val2)).y * s, ((Rect)(ref val2)).width * s, ((Rect)(ref val2)).height * s);
						if (((Rect)(ref val3)).Contains(mousePosition))
						{
							Tracker.Untrack(cards[i]);
							Toast(L.T("Quest untracked", "تم إلغاء تتبع المهمة"));
							e.Use();
							return;
						}
					}
				}
			}
			EventType type = e.type;
			switch ((int)type)
			{
			case 0:
				if (e.button == 0 && ((Rect)(ref r)).Contains(mousePosition))
				{
					_drag = ((!((Rect)(ref val)).Contains(mousePosition)) ? Drag.Move : Drag.Resize);
					_dragStart = mousePosition;
					_startX = ((Rect)(ref r)).x;
					_startY = ((Rect)(ref r)).y;
					_startScale = cfg.Scale.Value;
					e.Use();
				}
				break;
			case 3:
				if (_drag != Drag.None)
				{
					Vector2 val4 = mousePosition - _dragStart;
					if (_drag == Drag.Move)
					{
						cfg.PosX.Value = Mathf.Clamp01((_startX + val4.x) / (float)Screen.width);
						cfg.PosY.Value = Mathf.Clamp01((_startY + val4.y) / (float)Screen.height);
					}
					else
					{
						float num = 400f * BaseScale * _startScale;
						cfg.Scale.Value = Mathf.Clamp(_startScale * (num + val4.x) / num, 0.5f, 2.5f);
					}
					e.Use();
				}
				break;
			case 1:
				if (_drag != Drag.None)
				{
					_drag = Drag.None;
					e.Use();
				}
				break;
			case 6:
				Resize((e.delta.y > 0f) ? (-0.05f) : 0.05f);
				e.Use();
				break;
			case 2:
			case 4:
			case 5:
				break;
			}
		}

		public static void Toast(string text)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Toast(text, Gold, 2.5f);
		}

		public static void Toast(string text, Color color, float seconds)
		{
			//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)
			_toast = text;
			_toastColor = color;
			_toastUntil = Time.unscaledTime + seconds;
		}

		private static void DrawPanel(List<TrackedQuest> cards, List<float> heights, float x, float y, float total)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			Settings cfg = Plugin.Cfg;
			Fill(new Rect(x, y, 400f, total), new Color(0.05f, 0.05f, 0.08f, Mathf.Max(cfg.Opacity.Value, LayoutMode ? 0.85f : 0f)));
			Fill(new Rect(x, y, 4f, total), Gold);
			if (LayoutMode)
			{
				Outline(new Rect(x, y, 400f, total), Gold, 2f);
				Rect r = default(Rect);
				((Rect)(ref r))..ctor(x + 400f - 22f, y + total - 22f, 22f, 22f);
				Fill(r, Gold);
				Fill(new Rect(((Rect)(ref r)).x + 5f, ((Rect)(ref r)).yMax - 8f, 12f, 3f), Color.black);
				Fill(new Rect(((Rect)(ref r)).xMax - 8f, ((Rect)(ref r)).y + 5f, 3f, 12f), Color.black);
			}
			List<Rect> list = CardRects(x, y, heights);
			for (int i = 0; i < cards.Count; i++)
			{
				TrackedQuest trackedQuest = cards[i];
				if (LayoutMode && Tracker.IsHidden(trackedQuest))
				{
					Fill(list[i], new Color(1f, 1f, 1f, 0.06f));
				}
				DrawCard(trackedQuest, list[i]);
				if (LayoutMode && trackedQuest != Sample)
				{
					Rect r2 = RemoveButton(list[i]);
					Fill(r2, Red);
					Fill(new Rect(((Rect)(ref r2)).x + 5f, ((Rect)(ref r2)).center.y - 1.5f, ((Rect)(ref r2)).width - 10f, 3f), Color.white);
				}
			}
		}

		private static string HowTo(TrackedQuest q)
		{
			bool flag = !Guide.Visible || q == Sample;
			if (!flag)
			{
				QuestStatus status = q.Status;
				bool flag2 = (uint)(status - 5) <= 1u;
				flag = flag2;
			}
			if (flag)
			{
				return null;
			}
			string text = GuideTargets.For(q)?.HowTo;
			if (text != null)
			{
				return L.T("How: ", "الطريقة: ") + text;
			}
			return null;
		}

		private static float CardHeight(TrackedQuest q, float w)
		{
			float num = 26f;
			num += TextHeight(q.Description, _desc, w - 4f);
			string text = HowTo(q);
			if (text != null)
			{
				num += TextHeight(text, _desc, w - 4f) + 2f;
			}
			if (ShowsBar(q))
			{
				num += 16f;
			}
			return num + 24f;
		}

		private static bool ShowsBar(TrackedQuest q)
		{
			if (!q.HasCount)
			{
				return q.TimerFraction >= 0f;
			}
			return true;
		}

		private static void DrawCard(TrackedQuest q, Rect r)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references