Decompiled source of TeleportMenu v3.0.0

Mods/TeleportMenu_IL2CPP.dll

Decompiled 8 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppScheduleOne.DevUtilities;
using Il2CppScheduleOne.Economy;
using Il2CppScheduleOne.Money;
using Il2CppScheduleOne.PlayerScripts;
using Il2CppScheduleOne.Quests;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using ScheduleITeleportMenu;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "Teleport Menu", "3.0.0", "MrTibbz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("TeleportMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TeleportMenu")]
[assembly: AssemblyTitle("TeleportMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ScheduleITeleportMenu
{
	public class Main : MelonMod
	{
		private enum MenuState
		{
			Main,
			SubMenu,
			Favorites,
			Settings,
			Statistics,
			SettingsKeybinds,
			SettingsAppearance,
			SettingsCost,
			SettingsToggles,
			SettingsCategories,
			SettingsPresets,
			SettingsData
		}

		[Serializable]
		public class TeleportLocation
		{
			public string Name = "";

			public SerializableVector3 Position = new SerializableVector3(Vector3.zero);

			public bool IsFavorite = false;

			public string Category = "";
		}

		[Serializable]
		public class SerializableVector3
		{
			public float x;

			public float y;

			public float z;

			public SerializableVector3(Vector3 v)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				x = v.x;
				y = v.y;
				z = v.z;
			}

			public Vector3 ToVector3()
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				return new Vector3(x, y, z);
			}
		}

		[Serializable]
		private class CombinedData
		{
			public List<TeleportLocation> SavedLocations = new List<TeleportLocation>();

			public List<TeleportLocation> FavoriteLocations = new List<TeleportLocation>();

			public SerializableVector3 SafetyTeleportPosition = new SerializableVector3(Vector3.zero);

			public ModSettings Settings = new ModSettings();

			public TeleportStats Stats = new TeleportStats();
		}

		[Serializable]
		public class TeleportStats
		{
			public int TotalTeleports = 0;

			public int TotalMoneySpent = 0;

			public Dictionary<string, int> UsageCounts = new Dictionary<string, int>();
		}

		[HarmonyPatch(typeof(Customer), "ContractAccepted")]
		private class Patch_ContractAccepted
		{
			private static void Postfix(Customer __instance, Contract __result, EDealWindow window, bool trackContract, Dealer dealer)
			{
				//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_00c7: Unknown result type (might be due to invalid IL or missing references)
				if ((trackContract || IsDealerThePlayer(dealer)) && !((Object)(object)__result == (Object)null) && !((Object)(object)__result.DeliveryLocation == (Object)null))
				{
					Vector3 position = ((Component)__result.DeliveryLocation).transform.position;
					position.y += 1f;
					object obj = ((Quest)__result).Title;
					if (obj == null)
					{
						DeliveryLocation deliveryLocation = __result.DeliveryLocation;
						obj = ((deliveryLocation != null) ? ((Object)deliveryLocation).name : null) ?? "Deal";
					}
					string dealName = (string)obj;
					if (!Instance.allLocations.Any((TeleportLocation l) => l.Name == dealName && l.Category == "Active Deals"))
					{
						Instance.AddActiveDealTeleport(new TeleportLocation
						{
							Name = dealName,
							Position = new SerializableVector3(position),
							Category = "Active Deals"
						});
					}
				}
			}
		}

		[HarmonyPatch(typeof(Customer), "ProcessHandover")]
		private class Patch_ProcessHandover
		{
			private static void Postfix(Contract contract)
			{
				if (!((Object)(object)contract == (Object)null))
				{
					string dealName = ((Quest)contract).Title;
					if (Instance.allLocations.Any((TeleportLocation l) => l.Name == (dealName ?? "") && l.Category == "Active Deals"))
					{
						Instance.RemoveActiveDealTeleport(dealName ?? "");
					}
				}
			}
		}

		[HarmonyPatch(typeof(Input), "GetKey", new Type[] { typeof(KeyCode) })]
		private class Patch_GetKey
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetKeyDown", new Type[] { typeof(KeyCode) })]
		private class Patch_GetKeyDown
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetKeyUp", new Type[] { typeof(KeyCode) })]
		private class Patch_GetKeyUp
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetKey", new Type[] { typeof(string) })]
		private class Patch_GetKeyString
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetKeyDown", new Type[] { typeof(string) })]
		private class Patch_GetKeyDownString
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetKeyUp", new Type[] { typeof(string) })]
		private class Patch_GetKeyUpString
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetMouseButton")]
		private class Patch_GetMouseButton
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetMouseButtonDown")]
		private class Patch_GetMouseButtonDown
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(Input), "GetMouseButtonUp")]
		private class Patch_GetMouseButtonUp
		{
			private static bool Prefix(ref bool __result)
			{
				if (Instance == null || !Instance.isMenuOpen || suppressInputBlock)
				{
					return true;
				}
				__result = false;
				return false;
			}
		}

		public class ModSettings
		{
			public KeyCode menuKey = (KeyCode)283;

			public KeyCode safetyTeleportKey = (KeyCode)284;

			public KeyCode undoTeleportKey = (KeyCode)285;

			public int titleFontSize = 19;

			public int titleTextColorR = 255;

			public int titleTextColorG = 255;

			public int titleTextColorB = 255;

			public int titleBarColorR = 99;

			public int titleBarColorG = 102;

			public int titleBarColorB = 241;

			public int titleBarColorA = 255;

			public int textColorR = 226;

			public int textColorG = 228;

			public int textColorB = 235;

			public int fontSize = 14;

			public bool bold = false;

			public int buttonHoverR = 129;

			public int buttonHoverG = 140;

			public int buttonHoverB = 248;

			public int accentBarR = 99;

			public int accentBarG = 102;

			public int accentBarB = 241;

			public int accentBarA = 255;

			public int backgroundR = 24;

			public int backgroundG = 26;

			public int backgroundB = 32;

			public int backgroundA = 248;

			public bool chargeForTeleport = false;

			public int teleportCost = 30;

			public bool enableDistanceCost = false;

			public int distanceCostPercent = 3;

			public bool enableTeleportCooldown = false;

			public float teleportCooldownSeconds = 3f;

			public bool enableTeleportFade = false;

			public float teleportFadeDuration = 0.4f;

			public int cornerRadius = 0;

			public int rowSpacing = 45;

			public int scrollbarWidth = 8;

			public bool enableResizeGrip = true;

			public bool enableCloseButton = true;

			public bool showBreadcrumb = true;

			public bool showFavoriteStar = true;

			public bool enableSafetyTeleportKey = true;

			public bool enableUndoTeleportKey = true;

			public bool sortByDistance = false;

			public List<string> hiddenCategories = new List<string>();

			public List<string> categoryOrder = new List<string>();

			public Dictionary<string, string> categoryDisplayNames = new Dictionary<string, string>();

			public List<string> customCategories = new List<string>();

			public List<ThemePreset> themePresets = new List<ThemePreset>();
		}

		[Serializable]
		public class ThemePreset
		{
			public string Name = "";

			public int titleFontSize;

			public int titleTextColorR;

			public int titleTextColorG;

			public int titleTextColorB;

			public int titleBarColorR;

			public int titleBarColorG;

			public int titleBarColorB;

			public int titleBarColorA;

			public int textColorR;

			public int textColorG;

			public int textColorB;

			public int fontSize;

			public bool bold;

			public int buttonHoverR;

			public int buttonHoverG;

			public int buttonHoverB;

			public int accentBarR;

			public int accentBarG;

			public int accentBarB;

			public int accentBarA;

			public int backgroundR;

			public int backgroundG;

			public int backgroundB;

			public int backgroundA;

			public int cornerRadius;

			public int rowSpacing;

			public int scrollbarWidth;
		}

		private string? waitingForKey = null;

		private bool isMenuOpen = false;

		private Rect windowRect = new Rect(200f, 100f, 400f, 500f);

		private Vector2 scrollPosition;

		private bool isResizing = false;

		private Vector2 resizeStartMousePosition;

		private Vector2 resizeStartWindowSize;

		private bool isDragging = false;

		private Vector2 dragOffset;

		private bool cursorWasVisible;

		private CursorLockMode cursorWasLockState;

		private static bool suppressInputBlock = false;

		private Keyboard? blockedKeyboard;

		private Mouse? blockedMouse;

		private readonly float x = 15f;

		private MenuState currentMenu = MenuState.Main;

		private string currentCategory = "";

		private string newLocationName = "";

		private string? renamingCategory = null;

		private string categoryRenameBuffer = "";

		private string presetNameBuffer = "";

		private string searchQuery = "";

		private string? pendingConfirmId = null;

		private readonly List<SerializableVector3> teleportHistory = new List<SerializableVector3>();

		private const int MaxTeleportHistory = 10;

		private float lastTeleportTime = -999f;

		private Action? pendingFadeAction = null;

		private float fadeElapsed = 0f;

		private float fadeAlpha = 0f;

		private bool fadeActionExecuted = false;

		private string combinedSavePath = null;

		public static Main Instance = null;

		private SerializableVector3 safetyTeleportPosition = new SerializableVector3(Vector3.zero);

		private List<TeleportLocation> savedLocations = new List<TeleportLocation>();

		private List<TeleportLocation> favoriteLocations = new List<TeleportLocation>();

		private List<TeleportLocation> allLocations = new List<TeleportLocation>();

		private ModSettings settings = new ModSettings();

		private TeleportStats stats = new TeleportStats();

		private static readonly List<ThemePreset> BuiltInThemePresets = new List<ThemePreset>
		{
			new ThemePreset
			{
				Name = "Indigo (Default)",
				titleFontSize = 19,
				titleTextColorR = 255,
				titleTextColorG = 255,
				titleTextColorB = 255,
				titleBarColorR = 99,
				titleBarColorG = 102,
				titleBarColorB = 241,
				titleBarColorA = 255,
				textColorR = 226,
				textColorG = 228,
				textColorB = 235,
				fontSize = 14,
				bold = false,
				buttonHoverR = 129,
				buttonHoverG = 140,
				buttonHoverB = 248,
				accentBarR = 99,
				accentBarG = 102,
				accentBarB = 241,
				accentBarA = 255,
				backgroundR = 24,
				backgroundG = 26,
				backgroundB = 32,
				backgroundA = 248,
				cornerRadius = 0,
				rowSpacing = 45,
				scrollbarWidth = 8
			},
			new ThemePreset
			{
				Name = "Midnight Ocean",
				titleFontSize = 19,
				titleTextColorR = 235,
				titleTextColorG = 245,
				titleTextColorB = 248,
				titleBarColorR = 16,
				titleBarColorG = 96,
				titleBarColorB = 122,
				titleBarColorA = 255,
				textColorR = 210,
				textColorG = 230,
				textColorB = 235,
				fontSize = 14,
				bold = false,
				buttonHoverR = 34,
				buttonHoverG = 150,
				buttonHoverB = 178,
				accentBarR = 22,
				accentBarG = 168,
				accentBarB = 198,
				accentBarA = 255,
				backgroundR = 10,
				backgroundG = 20,
				backgroundB = 26,
				backgroundA = 248,
				cornerRadius = 0,
				rowSpacing = 45,
				scrollbarWidth = 8
			},
			new ThemePreset
			{
				Name = "Crimson",
				titleFontSize = 19,
				titleTextColorR = 255,
				titleTextColorG = 240,
				titleTextColorB = 240,
				titleBarColorR = 165,
				titleBarColorG = 40,
				titleBarColorB = 50,
				titleBarColorA = 255,
				textColorR = 235,
				textColorG = 222,
				textColorB = 222,
				fontSize = 14,
				bold = false,
				buttonHoverR = 205,
				buttonHoverG = 72,
				buttonHoverB = 82,
				accentBarR = 195,
				accentBarG = 52,
				accentBarB = 62,
				accentBarA = 255,
				backgroundR = 28,
				backgroundG = 18,
				backgroundB = 20,
				backgroundA = 248,
				cornerRadius = 0,
				rowSpacing = 45,
				scrollbarWidth = 8
			},
			new ThemePreset
			{
				Name = "Forest",
				titleFontSize = 19,
				titleTextColorR = 240,
				titleTextColorG = 250,
				titleTextColorB = 240,
				titleBarColorR = 42,
				titleBarColorG = 114,
				titleBarColorB = 64,
				titleBarColorA = 255,
				textColorR = 220,
				textColorG = 235,
				textColorB = 220,
				fontSize = 14,
				bold = false,
				buttonHoverR = 74,
				buttonHoverG = 156,
				buttonHoverB = 94,
				accentBarR = 62,
				accentBarG = 145,
				accentBarB = 84,
				accentBarA = 255,
				backgroundR = 16,
				backgroundG = 26,
				backgroundB = 18,
				backgroundA = 248,
				cornerRadius = 0,
				rowSpacing = 45,
				scrollbarWidth = 8
			},
			new ThemePreset
			{
				Name = "Sunset",
				titleFontSize = 19,
				titleTextColorR = 255,
				titleTextColorG = 245,
				titleTextColorB = 232,
				titleBarColorR = 214,
				titleBarColorG = 124,
				titleBarColorB = 42,
				titleBarColorA = 255,
				textColorR = 245,
				textColorG = 230,
				textColorB = 215,
				fontSize = 14,
				bold = false,
				buttonHoverR = 235,
				buttonHoverG = 154,
				buttonHoverB = 74,
				accentBarR = 224,
				accentBarG = 134,
				accentBarB = 52,
				accentBarA = 255,
				backgroundR = 30,
				backgroundG = 22,
				backgroundB = 16,
				backgroundA = 248,
				cornerRadius = 0,
				rowSpacing = 45,
				scrollbarWidth = 8
			},
			new ThemePreset
			{
				Name = "Monochrome",
				titleFontSize = 19,
				titleTextColorR = 240,
				titleTextColorG = 240,
				titleTextColorB = 240,
				titleBarColorR = 70,
				titleBarColorG = 70,
				titleBarColorB = 70,
				titleBarColorA = 255,
				textColorR = 225,
				textColorG = 225,
				textColorB = 225,
				fontSize = 14,
				bold = false,
				buttonHoverR = 120,
				buttonHoverG = 120,
				buttonHoverB = 120,
				accentBarR = 165,
				accentBarG = 165,
				accentBarB = 165,
				accentBarA = 255,
				backgroundR = 20,
				backgroundG = 20,
				backgroundB = 20,
				backgroundA = 248,
				cornerRadius = 0,
				rowSpacing = 45,
				scrollbarWidth = 8
			}
		};

		private const float CloseButtonSize = 20f;

		private const float ResizeGripSize = 16f;

		private static readonly Color AccentGold = new Color(0.85f, 0.68f, 0.15f);

		private static readonly Color DangerRed = new Color(0.7f, 0.24f, 0.24f);

		private static readonly Dictionary<string, Texture2D> solidTextureCache = new Dictionary<string, Texture2D>();

		private static readonly Dictionary<string, Texture2D> roundedTextureCache = new Dictionary<string, Texture2D>();

		private static readonly GUIStyle blitStyle = new GUIStyle
		{
			padding = new RectOffset(0, 0, 0, 0),
			border = new RectOffset(0, 0, 0, 0),
			margin = new RectOffset(0, 0, 0, 0)
		};

		private int cachedStyleSignature = int.MinValue;

		private GUIStyle? cachedLabelStyle;

		private GUIStyle? cachedButtonStyle;

		private GUIStyle? cachedDeleteButtonStyle;

		private GUIStyle? cachedConfirmDeleteButtonStyle;

		private GUIStyle? cachedFavoriteButtonStyleOn;

		private GUIStyle? cachedFavoriteButtonStyleOff;

		private GUIStyle? cachedWindowStyle;

		private GUIStyle? cachedCenteredLabelStyle;

		private GUIStyle? cachedToggleLabelStyle;

		private GUIStyle? cachedScrollbarTrackStyle;

		private GUIStyle? cachedScrollbarThumbStyle;

		private GUIStyle? cachedToggleStyle;

		private GUIStyle? cachedSliderTrackStyle;

		private GUIStyle? cachedSliderThumbStyle;

		private GUIStyle? cachedSingleLineLabelStyle;

		private GUIStyle? cachedSingleLineLabelStyleBase;

		private const float SettingsKeybindsHeight = 222f;

		private const float SettingsAppearanceHeight = 1130f;

		private const float SettingsCostHeight = 495f;

		private const float SettingsTogglesHeight = 285f;

		private const float SettingsCategoriesBaseHeight = 167f;

		private const float SettingsPresetsBaseHeight = 260f;

		private const float SettingsDataHeight = 405f;

		private const float SettingsSubPageRowHeight = 28f;

		private int CornerRadius => settings.cornerRadius;

		private float RowSpacing => settings.rowSpacing;

		private float RowButtonHeight => Mathf.Max(24f, (float)settings.rowSpacing - 5f);

		public void AddActiveDealTeleport(TeleportLocation loc)
		{
			allLocations.RemoveAll((TeleportLocation l) => l.Name == loc.Name && l.Category == "Active Deals");
			allLocations.Add(loc);
			MelonLogger.Msg("[Teleport Menu] Added Active Deal teleport: " + loc.Name);
		}

		public void RemoveActiveDealTeleport(string dealName)
		{
			allLocations.RemoveAll((TeleportLocation l) => l.Name == dealName && l.Category == "Active Deals");
			MelonLogger.Msg("[Teleport Menu] Removed Active Deal teleport: " + dealName);
		}

		private static bool IsDealerThePlayer(object? dealer)
		{
			if (dealer == null)
			{
				return true;
			}
			Type type = dealer.GetType();
			string[] array = new string[4] { "IsLocalPlayer", "isLocalPlayer", "IsPlayer", "isPlayer" };
			string[] array2 = array;
			foreach (string name in array2)
			{
				PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (property != null && property.PropertyType == typeof(bool))
				{
					return (bool)property.GetValue(dealer);
				}
				FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null && field.FieldType == typeof(bool))
				{
					return (bool)field.GetValue(dealer);
				}
			}
			PropertyInfo propertyInfo = type.GetProperty("Owner") ?? type.GetProperty("Player") ?? type.GetProperty("owner");
			if (propertyInfo != null)
			{
				object value = propertyInfo.GetValue(dealer);
				if (value != null && (Object)(object)Player.Local != (Object)null)
				{
					return value == Player.Local;
				}
			}
			return false;
		}

		private List<string> ApplyCategoryOrder(List<string> categories)
		{
			if (settings.categoryOrder.Count == 0)
			{
				return categories;
			}
			return categories.OrderBy(delegate(string c)
			{
				int num = settings.categoryOrder.IndexOf(c);
				return (num < 0) ? int.MaxValue : num;
			}).ToList();
		}

		private List<string> GetOrderedVisibleCategories()
		{
			List<string> categories = (from c in allLocations.Select((TeleportLocation l) => l.Category).Distinct()
				where !settings.hiddenCategories.Contains(c)
				select c).ToList();
			return ApplyCategoryOrder(categories);
		}

		private List<string> GetAllManagedCategories()
		{
			List<string> categories = allLocations.Select((TeleportLocation l) => l.Category).Distinct().Union(settings.customCategories)
				.Distinct()
				.ToList();
			return ApplyCategoryOrder(categories);
		}

		private string GetCategoryDisplayName(string category)
		{
			if (settings.categoryDisplayNames.TryGetValue(category, out string value) && !string.IsNullOrWhiteSpace(value))
			{
				return value;
			}
			return category;
		}

		private bool IsUserManagedCategory(string category)
		{
			return category == "Custom Teleports" || settings.customCategories.Contains(category);
		}

		private void ToggleCategoryHidden(string category)
		{
			if (settings.hiddenCategories.Contains(category))
			{
				settings.hiddenCategories.Remove(category);
			}
			else
			{
				settings.hiddenCategories.Add(category);
			}
			SaveAllData();
		}

		private void MoveCategory(string category, int direction)
		{
			List<string> allManagedCategories = GetAllManagedCategories();
			int num = allManagedCategories.IndexOf(category);
			int num2 = num + direction;
			if (num >= 0 && num2 >= 0 && num2 < allManagedCategories.Count)
			{
				List<string> list = allManagedCategories;
				int index = num;
				int index2 = num2;
				string value = allManagedCategories[num2];
				string value2 = allManagedCategories[num];
				list[index] = value;
				allManagedCategories[index2] = value2;
				settings.categoryOrder = allManagedCategories;
				SaveAllData();
			}
		}

		private void StartRenameCategory(string category)
		{
			renamingCategory = category;
			categoryRenameBuffer = GetCategoryDisplayName(category);
		}

		private void CommitCategoryRename()
		{
			string value = categoryRenameBuffer.Trim();
			if (!string.IsNullOrEmpty(value) && renamingCategory != null)
			{
				settings.categoryDisplayNames[renamingCategory] = value;
				SaveAllData();
			}
			renamingCategory = null;
			categoryRenameBuffer = "";
		}

		private void ResetCategoryDisplayNames()
		{
			settings.categoryDisplayNames.Clear();
			MelonLogger.Msg("[Teleport Menu] Category names reset to default.");
		}

		private void DeleteCustomCategory(string category)
		{
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			if (settings.customCategories.Contains(category))
			{
				settings.customCategories.Remove(category);
				settings.hiddenCategories.Remove(category);
				settings.categoryOrder.Remove(category);
				settings.categoryDisplayNames.Remove(category);
				allLocations.RemoveAll((TeleportLocation l) => l.Category == category);
				savedLocations.RemoveAll((TeleportLocation l) => l.Category == category);
				favoriteLocations.RemoveAll((TeleportLocation l) => l.Category == category);
				if (currentMenu == MenuState.SubMenu && currentCategory == category)
				{
					currentMenu = MenuState.Main;
					currentCategory = "";
					scrollPosition = Vector2.zero;
				}
				SaveAllData();
			}
		}

		private void SaveThemePreset()
		{
			string name = presetNameBuffer.Trim();
			if (!string.IsNullOrEmpty(name))
			{
				settings.themePresets.RemoveAll((ThemePreset p) => p.Name == name);
				settings.themePresets.Add(new ThemePreset
				{
					Name = name,
					titleFontSize = settings.titleFontSize,
					titleTextColorR = settings.titleTextColorR,
					titleTextColorG = settings.titleTextColorG,
					titleTextColorB = settings.titleTextColorB,
					titleBarColorR = settings.titleBarColorR,
					titleBarColorG = settings.titleBarColorG,
					titleBarColorB = settings.titleBarColorB,
					titleBarColorA = settings.titleBarColorA,
					textColorR = settings.textColorR,
					textColorG = settings.textColorG,
					textColorB = settings.textColorB,
					fontSize = settings.fontSize,
					bold = settings.bold,
					buttonHoverR = settings.buttonHoverR,
					buttonHoverG = settings.buttonHoverG,
					buttonHoverB = settings.buttonHoverB,
					accentBarR = settings.accentBarR,
					accentBarG = settings.accentBarG,
					accentBarB = settings.accentBarB,
					accentBarA = settings.accentBarA,
					backgroundR = settings.backgroundR,
					backgroundG = settings.backgroundG,
					backgroundB = settings.backgroundB,
					backgroundA = settings.backgroundA,
					cornerRadius = settings.cornerRadius,
					rowSpacing = settings.rowSpacing,
					scrollbarWidth = settings.scrollbarWidth
				});
				presetNameBuffer = "";
				SaveAllData();
				MelonLogger.Msg("[Teleport Menu] Saved theme preset: " + name);
			}
		}

		private void ApplyThemePreset(ThemePreset preset)
		{
			settings.titleFontSize = preset.titleFontSize;
			settings.titleTextColorR = preset.titleTextColorR;
			settings.titleTextColorG = preset.titleTextColorG;
			settings.titleTextColorB = preset.titleTextColorB;
			settings.titleBarColorR = preset.titleBarColorR;
			settings.titleBarColorG = preset.titleBarColorG;
			settings.titleBarColorB = preset.titleBarColorB;
			settings.titleBarColorA = preset.titleBarColorA;
			settings.textColorR = preset.textColorR;
			settings.textColorG = preset.textColorG;
			settings.textColorB = preset.textColorB;
			settings.fontSize = preset.fontSize;
			settings.bold = preset.bold;
			settings.buttonHoverR = preset.buttonHoverR;
			settings.buttonHoverG = preset.buttonHoverG;
			settings.buttonHoverB = preset.buttonHoverB;
			settings.accentBarR = preset.accentBarR;
			settings.accentBarG = preset.accentBarG;
			settings.accentBarB = preset.accentBarB;
			settings.accentBarA = preset.accentBarA;
			settings.backgroundR = preset.backgroundR;
			settings.backgroundG = preset.backgroundG;
			settings.backgroundB = preset.backgroundB;
			settings.backgroundA = preset.backgroundA;
			settings.cornerRadius = preset.cornerRadius;
			settings.rowSpacing = preset.rowSpacing;
			settings.scrollbarWidth = preset.scrollbarWidth;
			SaveAllData();
			MelonLogger.Msg("[Teleport Menu] Applied theme preset: " + preset.Name);
		}

		private void TeleportToLocation(TeleportLocation location)
		{
			if (IsTeleportOnCooldown(out var remaining))
			{
				MelonLogger.Msg($"[Teleport Menu] Teleport on cooldown ({remaining:F1}s remaining).");
			}
			else
			{
				RequestTeleport(delegate
				{
					PerformTeleport(location);
				});
			}
		}

		private void PerformTeleport(TeleportLocation location)
		{
			//IL_0023: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			Vector3? val = (((Object)(object)Player.Local != (Object)null) ? new Vector3?(((Component)Player.Local).transform.position) : ((Vector3?)null));
			if ((Object)(object)Player.Local != (Object)null)
			{
				PushTeleportHistory();
				((Component)Player.Local).transform.position = location.Position.ToVector3();
				MelonLogger.Msg($"Teleported to {location.Name} ({location.Position.x}, {location.Position.y}, {location.Position.z})");
				lastTeleportTime = Time.time;
				RecordTeleportStat(location);
			}
			if (!settings.chargeForTeleport)
			{
				return;
			}
			MoneyManager instance = NetworkSingleton<MoneyManager>.Instance;
			int num = settings.teleportCost;
			if (settings.enableDistanceCost && val.HasValue)
			{
				float num2 = Vector3.Distance(val.Value, location.Position.ToVector3());
				float num3 = 1f + num2 / 100f * ((float)settings.distanceCostPercent / 100f);
				num = Mathf.RoundToInt((float)settings.teleportCost * num3);
			}
			if ((Object)(object)instance != (Object)null)
			{
				if (instance.cashBalance >= (float)num)
				{
					instance.ChangeCashBalance((float)(-num), true, false);
					stats.TotalMoneySpent += num;
					MelonLogger.Msg($"[Teleport Menu] Charged ${num} for teleport. Remaining: ${instance.cashBalance}");
				}
				else
				{
					MelonLogger.Msg($"[Teleport Menu] Not enough money! Requires ${num}.");
				}
			}
		}

		private void RecordTeleportStat(TeleportLocation location)
		{
			stats.TotalTeleports++;
			string key = location.Category + ":" + location.Name;
			stats.UsageCounts.TryGetValue(key, out var value);
			stats.UsageCounts[key] = value + 1;
		}

		private void PushTeleportHistory()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Player.Local == (Object)null))
			{
				teleportHistory.Add(new SerializableVector3(((Component)Player.Local).transform.position));
				if (teleportHistory.Count > 10)
				{
					teleportHistory.RemoveAt(0);
				}
			}
		}

		private void UndoLastTeleport()
		{
			if (teleportHistory.Count == 0 || (Object)(object)Player.Local == (Object)null)
			{
				return;
			}
			if (IsTeleportOnCooldown(out var remaining))
			{
				MelonLogger.Msg($"[Teleport Menu] Teleport on cooldown ({remaining:F1}s remaining).");
			}
			else
			{
				SerializableVector3 last = teleportHistory[teleportHistory.Count - 1];
				teleportHistory.RemoveAt(teleportHistory.Count - 1);
				RequestTeleport(delegate
				{
					PerformUndo(last);
				});
			}
		}

		private void PerformUndo(SerializableVector3 last)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Player.Local == (Object)null))
			{
				((Component)Player.Local).transform.position = last.ToVector3();
				lastTeleportTime = Time.time;
				MelonLogger.Msg($"[Teleport Menu] Undid last teleport, returned to ({last.x}, {last.y}, {last.z})");
			}
		}

		private bool IsTeleportOnCooldown(out float remaining)
		{
			remaining = 0f;
			if (!settings.enableTeleportCooldown)
			{
				return false;
			}
			remaining = settings.teleportCooldownSeconds - (Time.time - lastTeleportTime);
			return remaining > 0f;
		}

		private void RequestTeleport(Action performAction)
		{
			if (!settings.enableTeleportFade)
			{
				performAction();
				return;
			}
			if (pendingFadeAction != null)
			{
				MelonLogger.Msg("[Teleport Menu] A teleport fade is already in progress.");
				return;
			}
			pendingFadeAction = performAction;
			fadeElapsed = 0f;
			fadeActionExecuted = false;
		}

		private void UpdateTeleportFade()
		{
			if (pendingFadeAction == null)
			{
				fadeAlpha = 0f;
				return;
			}
			fadeElapsed += Time.deltaTime;
			float num = Mathf.Max(0.05f, settings.teleportFadeDuration / 2f);
			if (fadeElapsed <= num)
			{
				fadeAlpha = fadeElapsed / num;
				return;
			}
			if (!fadeActionExecuted)
			{
				fadeActionExecuted = true;
				pendingFadeAction();
			}
			float num2 = fadeElapsed - num;
			fadeAlpha = 1f - Mathf.Clamp01(num2 / num);
			if (fadeElapsed >= num * 2f)
			{
				pendingFadeAction = null;
				fadeAlpha = 0f;
			}
		}

		public override void OnInitializeMelon()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			combinedSavePath = Path.Combine(MelonEnvironment.UserDataDirectory, "TeleportMenu/AllData.json");
			LoadAllData();
			InitializeAllLocations();
			Instance = this;
			Harmony val = new Harmony("TeleportMenuPatches");
			val.PatchAll();
			foreach (TeleportLocation saved in savedLocations)
			{
				if (!allLocations.Any((TeleportLocation l) => l.Name == saved.Name && l.Category == saved.Category))
				{
					allLocations.Add(saved);
				}
			}
			if (!allLocations.Any((TeleportLocation l) => l.Category == "Custom Teleports"))
			{
				allLocations.Add(new TeleportLocation
				{
					Name = "",
					Position = new SerializableVector3(Vector3.zero),
					Category = "Custom Teleports"
				});
			}
			foreach (string customCategory in settings.customCategories)
			{
				if (!allLocations.Any((TeleportLocation l) => l.Category == customCategory))
				{
					allLocations.Add(new TeleportLocation
					{
						Name = "",
						Position = new SerializableVector3(Vector3.zero),
						Category = customCategory
					});
				}
			}
			foreach (TeleportLocation fav in favoriteLocations)
			{
				TeleportLocation teleportLocation = allLocations.FirstOrDefault((TeleportLocation l) => l.Name == fav.Name && l.Category == fav.Category);
				if (teleportLocation != null)
				{
					teleportLocation.IsFavorite = true;
				}
			}
			MelonLogger.Msg("[Teleport Menu] Initialization complete.");
		}

		public override void OnUpdate()
		{
			suppressInputBlock = true;
			try
			{
				OnUpdateInternal();
			}
			finally
			{
				suppressInputBlock = false;
			}
		}

		private void OnUpdateInternal()
		{
			//IL_000e: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			UpdateTeleportFade();
			if (Input.GetKeyDown(settings.menuKey))
			{
				if (isMenuOpen)
				{
					CloseMenu();
				}
				else
				{
					isMenuOpen = true;
					cursorWasVisible = Cursor.visible;
					cursorWasLockState = Cursor.lockState;
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)0;
					if ((Object)(object)PlayerSingleton<PlayerMovement>.Instance != (Object)null)
					{
						((Behaviour)PlayerSingleton<PlayerMovement>.Instance).enabled = false;
					}
					if ((Object)(object)PlayerSingleton<PlayerCamera>.Instance != (Object)null)
					{
						((Behaviour)PlayerSingleton<PlayerCamera>.Instance).enabled = false;
					}
					blockedKeyboard = Keyboard.current;
					blockedMouse = Mouse.current;
					if (blockedKeyboard != null)
					{
						InputSystem.DisableDevice((InputDevice)(object)blockedKeyboard, false);
					}
					if (blockedMouse != null)
					{
						InputSystem.DisableDevice((InputDevice)(object)blockedMouse, false);
					}
				}
			}
			if (isResizing && Input.GetMouseButton(0))
			{
				Vector2 val = Vector2.op_Implicit(Input.mousePosition) - resizeStartMousePosition;
				((Rect)(ref windowRect)).width = Mathf.Max(200f, resizeStartWindowSize.x + val.x);
				((Rect)(ref windowRect)).height = Mathf.Max(200f, resizeStartWindowSize.y - val.y);
			}
			else if (Input.GetMouseButtonUp(0))
			{
				isResizing = false;
			}
			if (isDragging && Input.GetMouseButton(0))
			{
				((Rect)(ref windowRect)).position = Vector2.op_Implicit(Input.mousePosition) - dragOffset;
			}
			else if (Input.GetMouseButtonUp(0))
			{
				isDragging = false;
			}
			HandleTyping();
			if (settings.enableSafetyTeleportKey && Input.GetKeyDown(settings.safetyTeleportKey))
			{
				TeleportToLocation(new TeleportLocation
				{
					Name = "Safety Teleport",
					Position = safetyTeleportPosition,
					Category = "Custom Teleports"
				});
			}
			if (settings.enableUndoTeleportKey && Input.GetKeyDown(settings.undoTeleportKey))
			{
				UndoLastTeleport();
			}
		}

		private static MenuState GetParentMenu(MenuState state)
		{
			if ((uint)(state - 1) <= 2u)
			{
				return MenuState.Main;
			}
			return MenuState.Settings;
		}

		private void SaveCurrentLocation()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(newLocationName))
			{
				newLocationName = GenerateLocationName();
			}
			TeleportLocation newLoc = new TeleportLocation
			{
				Name = newLocationName,
				Position = new SerializableVector3(((Component)Player.Local).transform.position),
				Category = currentCategory
			};
			savedLocations.Add(newLoc);
			SaveAllData();
			if (!allLocations.Any((TeleportLocation l) => l.Name == newLoc.Name && l.Category == newLoc.Category))
			{
				allLocations.Add(newLoc);
			}
			MelonLogger.Msg("Saved location: " + newLocationName);
			newLocationName = "";
		}

		private string GenerateLocationName()
		{
			int num = 1;
			string text = "Location_";
			string name = text + num;
			while (savedLocations.Any((TeleportLocation l) => l.Name == name))
			{
				num++;
				name = text + num;
			}
			return name;
		}

		private List<string> GetMenuCategoryOrder()
		{
			List<string> list = allLocations.Select((TeleportLocation l) => l.Category).Distinct().ToList();
			if (!list.Contains("Custom Teleports"))
			{
				list.Add("Custom Teleports");
			}
			return ApplyCategoryOrder(list);
		}

		private void DrawFavoritesMenu(GUIStyle buttonStyle)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			float num2 = ((Rect)(ref windowRect)).width - 87f;
			GUIStyle deleteButtonStyle = GetDeleteButtonStyle();
			List<string> categoryOrder = GetMenuCategoryOrder();
			Vector3? playerPos = (((Object)(object)Player.Local != (Object)null) ? new Vector3?(((Component)Player.Local).transform.position) : ((Vector3?)null));
			List<TeleportLocation> list = (from f in favoriteLocations
				where string.IsNullOrEmpty(searchQuery) || f.Name.Contains(searchQuery, StringComparison.OrdinalIgnoreCase)
				orderby categoryOrder.IndexOf(f.Category), (settings.sortByDistance && playerPos.HasValue) ? Vector3.Distance(playerPos.Value, f.Position.ToVector3()) : 0f
				select f).ToList();
			GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 70f, 25f), "Search: " + searchQuery, GetSingleLineLabelStyle(GetLabelStyle()));
			if (!string.IsNullOrEmpty(searchQuery) && GUI.Button(new Rect(((Rect)(ref windowRect)).width - 45f, num, 25f, 25f), "X", GetDeleteButtonStyle()))
			{
				searchQuery = "";
			}
			num += 30f;
			if (playerPos.HasValue)
			{
				string text = (settings.sortByDistance ? "Sort: Nearest First" : "Sort: Default Order");
				if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), text, buttonStyle))
				{
					settings.sortByDistance = !settings.sortByDistance;
					SaveAllData();
				}
				num += 30f;
			}
			string text2 = "";
			float rowButtonHeight = RowButtonHeight;
			foreach (TeleportLocation loc in list)
			{
				if (loc.Category != text2)
				{
					text2 = loc.Category;
					GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), GetCategoryDisplayName(text2), GetCenteredLabelStyle());
					num += 30f;
				}
				string text3 = loc.Name;
				if (playerPos.HasValue)
				{
					text3 += $"  ({Mathf.RoundToInt(Vector3.Distance(playerPos.Value, loc.Position.ToVector3()))}m)";
				}
				if (GUI.Button(new Rect(x, num, num2, rowButtonHeight), text3, buttonStyle))
				{
					TeleportToLocation(loc);
				}
				if (GUI.Button(new Rect(x + num2 + 5f, num, 40f, rowButtonHeight), "X", deleteButtonStyle))
				{
					loc.IsFavorite = false;
					favoriteLocations.RemoveAll((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category);
					SaveAllData();
					break;
				}
				num += RowSpacing;
			}
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Back", buttonStyle))
			{
				currentMenu = MenuState.Main;
				scrollPosition = Vector2.zero;
				searchQuery = "";
				pendingConfirmId = null;
			}
		}

		private void ExportTeleports(string exportPath)
		{
			try
			{
				string directoryName = Path.GetDirectoryName(exportPath);
				if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				string contents = JsonConvert.SerializeObject((object)savedLocations, (Formatting)1);
				File.WriteAllText(exportPath, contents);
				MelonLogger.Msg($"[Teleport Menu] Exported {savedLocations.Count} custom teleports to {exportPath}");
			}
			catch (Exception value)
			{
				MelonLogger.Error($"[Teleport Menu] Failed to export teleports: {value}");
			}
		}

		private void ImportTeleports(string importPath)
		{
			try
			{
				if (!File.Exists(importPath))
				{
					MelonLogger.Error("[Teleport Menu] Import file not found: " + importPath);
					return;
				}
				string text = File.ReadAllText(importPath);
				List<TeleportLocation> list = JsonConvert.DeserializeObject<List<TeleportLocation>>(text) ?? new List<TeleportLocation>();
				foreach (TeleportLocation loc in list)
				{
					if (string.IsNullOrEmpty(loc.Category))
					{
						loc.Category = "Custom Teleports";
					}
					if (loc.Category != "Custom Teleports" && !settings.customCategories.Contains(loc.Category))
					{
						settings.customCategories.Add(loc.Category);
					}
					if (!savedLocations.Any((TeleportLocation l) => l.Name == loc.Name && l.Category == loc.Category))
					{
						savedLocations.Add(loc);
					}
					if (!allLocations.Any((TeleportLocation l) => l.Name == loc.Name && l.Category == loc.Category))
					{
						allLocations.Add(loc);
					}
					if (loc.IsFavorite && !favoriteLocations.Any((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category))
					{
						favoriteLocations.Add(loc);
					}
				}
				SaveAllData();
				MelonLogger.Msg($"[Teleport Menu] Imported {list.Count} custom teleports from {importPath}");
			}
			catch (Exception value)
			{
				MelonLogger.Error($"[Teleport Menu] Failed to import teleports: {value}");
			}
		}

		private void ExportFullConfig(string exportPath)
		{
			SaveAllData(exportPath);
		}

		private void ImportFullConfig(string importPath)
		{
			//IL_0082: 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)
			try
			{
				if (!File.Exists(importPath))
				{
					MelonLogger.Error("[Teleport Menu] Full config import file not found: " + importPath);
					return;
				}
				string text = File.ReadAllText(importPath);
				CombinedData combinedData = JsonConvert.DeserializeObject<CombinedData>(text);
				if (combinedData == null)
				{
					MelonLogger.Error("[Teleport Menu] Full config import file was empty or invalid.");
					return;
				}
				savedLocations = combinedData.SavedLocations ?? new List<TeleportLocation>();
				favoriteLocations = combinedData.FavoriteLocations ?? new List<TeleportLocation>();
				safetyTeleportPosition = combinedData.SafetyTeleportPosition ?? new SerializableVector3(Vector3.zero);
				settings = combinedData.Settings ?? new ModSettings();
				stats = combinedData.Stats ?? new TeleportStats();
				InitializeAllLocations();
				foreach (TeleportLocation fav in favoriteLocations)
				{
					TeleportLocation teleportLocation = allLocations.FirstOrDefault((TeleportLocation l) => l.Name == fav.Name && l.Category == fav.Category);
					if (teleportLocation != null)
					{
						teleportLocation.IsFavorite = true;
					}
				}
				currentMenu = MenuState.Main;
				currentCategory = "";
				scrollPosition = Vector2.zero;
				searchQuery = "";
				pendingConfirmId = null;
				SaveAllData();
				MelonLogger.Msg("[Teleport Menu] Imported full config from " + importPath);
			}
			catch (Exception value)
			{
				MelonLogger.Error($"[Teleport Menu] Failed to import full config: {value}");
			}
		}

		private void SaveAllData(string? path = null)
		{
			if (path == null)
			{
				path = combinedSavePath;
			}
			try
			{
				string directoryName = Path.GetDirectoryName(path);
				if (!string.IsNullOrEmpty(directoryName) && !Directory.Exists(directoryName))
				{
					Directory.CreateDirectory(directoryName);
				}
				CombinedData combinedData = new CombinedData
				{
					SavedLocations = savedLocations,
					FavoriteLocations = favoriteLocations,
					SafetyTeleportPosition = safetyTeleportPosition,
					Settings = settings,
					Stats = stats
				};
				string contents = JsonConvert.SerializeObject((object)combinedData, (Formatting)1);
				File.WriteAllText(path, contents);
				MelonLogger.Msg((path == combinedSavePath) ? "All data saved." : ("[Teleport Menu] Exported full config to " + path));
			}
			catch (Exception value)
			{
				MelonLogger.Error($"[Teleport Menu] Failed to save data: {value}");
			}
		}

		private void LoadAllData()
		{
			//IL_0114: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (File.Exists(combinedSavePath))
				{
					string text = File.ReadAllText(combinedSavePath);
					CombinedData combinedData = JsonConvert.DeserializeObject<CombinedData>(text);
					if (combinedData != null)
					{
						savedLocations = combinedData.SavedLocations ?? new List<TeleportLocation>();
						favoriteLocations = combinedData.FavoriteLocations ?? new List<TeleportLocation>();
						safetyTeleportPosition = combinedData.SafetyTeleportPosition ?? new SerializableVector3(Vector3.zero);
						settings = combinedData.Settings ?? new ModSettings();
						stats = combinedData.Stats ?? new TeleportStats();
					}
					MelonLogger.Msg("All data loaded.");
				}
				else
				{
					savedLocations = new List<TeleportLocation>();
					favoriteLocations = new List<TeleportLocation>();
					safetyTeleportPosition = new SerializableVector3(Vector3.zero);
					settings = new ModSettings();
					stats = new TeleportStats();
					MelonLogger.Msg(" No data found, starting fresh.");
				}
			}
			catch (Exception value)
			{
				savedLocations = new List<TeleportLocation>();
				favoriteLocations = new List<TeleportLocation>();
				safetyTeleportPosition = new SerializableVector3(Vector3.zero);
				settings = new ModSettings();
				stats = new TeleportStats();
				MelonLogger.Error($"[Teleport Menu] Failed to load data: {value}");
			}
		}

		private void DrawMainMenu(GUIStyle buttonStyle)
		{
			//IL_002b: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: 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)
			float num = 20f;
			float rowButtonHeight = RowButtonHeight;
			GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 70f, 25f), "Search: " + searchQuery, GetSingleLineLabelStyle(GetLabelStyle()));
			if (!string.IsNullOrEmpty(searchQuery) && GUI.Button(new Rect(((Rect)(ref windowRect)).width - 45f, num, 25f, 25f), "X", GetDeleteButtonStyle()))
			{
				searchQuery = "";
			}
			num += 30f;
			if (!string.IsNullOrEmpty(searchQuery))
			{
				DrawGlobalSearchResults(buttonStyle, num);
				return;
			}
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), "Favorites", buttonStyle))
			{
				currentMenu = MenuState.Favorites;
				scrollPosition = Vector2.zero;
				searchQuery = "";
				pendingConfirmId = null;
			}
			num += RowSpacing;
			foreach (string orderedVisibleCategory in GetOrderedVisibleCategories())
			{
				if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), GetCategoryDisplayName(orderedVisibleCategory), buttonStyle))
				{
					currentCategory = orderedVisibleCategory;
					currentMenu = MenuState.SubMenu;
					scrollPosition = Vector2.zero;
					searchQuery = "";
					pendingConfirmId = null;
				}
				num += RowSpacing;
			}
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), "Settings", buttonStyle))
			{
				currentMenu = MenuState.Settings;
				scrollPosition = Vector2.zero;
				searchQuery = "";
			}
		}

		private void DrawGlobalSearchResults(GUIStyle buttonStyle, float y)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			List<TeleportLocation> globalSearchResults = GetGlobalSearchResults();
			float num = 40f;
			float num2 = 40f;
			float rowButtonHeight = RowButtonHeight;
			Vector3? val = (((Object)(object)Player.Local != (Object)null) ? new Vector3?(((Component)Player.Local).transform.position) : ((Vector3?)null));
			if (globalSearchResults.Count == 0)
			{
				GUI.Label(new Rect(x, y, ((Rect)(ref windowRect)).width - 40f, 25f), "No matching locations.", GetCenteredLabelStyle());
				return;
			}
			foreach (TeleportLocation loc in globalSearchResults)
			{
				float num3 = ((Rect)(ref windowRect)).width - 40f;
				if (settings.showFavoriteStar)
				{
					num3 -= num + 5f;
				}
				bool flag = IsUserManagedCategory(loc.Category);
				if (flag)
				{
					num3 -= num2 + 5f;
				}
				string text = GetCategoryDisplayName(loc.Category) + " · " + loc.Name;
				if (val.HasValue)
				{
					text += $"  ({Mathf.RoundToInt(Vector3.Distance(val.Value, loc.Position.ToVector3()))}m)";
				}
				if (GUI.Button(new Rect(x, y, num3, rowButtonHeight), text, buttonStyle))
				{
					TeleportToLocation(loc);
				}
				float num4 = x + num3 + 5f;
				if (settings.showFavoriteStar)
				{
					string text2 = (loc.IsFavorite ? "★" : "☆");
					GUIStyle favoriteButtonStyle = GetFavoriteButtonStyle(loc.IsFavorite);
					if (GUI.Button(new Rect(num4, y, num, rowButtonHeight), text2, favoriteButtonStyle))
					{
						loc.IsFavorite = !loc.IsFavorite;
						if (loc.IsFavorite)
						{
							if (!favoriteLocations.Any((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category))
							{
								favoriteLocations.Add(loc);
							}
						}
						else
						{
							favoriteLocations.RemoveAll((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category);
						}
						SaveAllData();
					}
					num4 += num + 5f;
				}
				if (flag && ConfirmableDeleteButton(new Rect(num4, y, num2, rowButtonHeight), "loc:" + loc.Category + ":" + loc.Name))
				{
					savedLocations.RemoveAll((TeleportLocation l) => l.Name == loc.Name && l.Category == loc.Category);
					allLocations.RemoveAll((TeleportLocation l) => l.Name == loc.Name && l.Category == loc.Category);
					favoriteLocations.RemoveAll((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category);
					SaveAllData();
					break;
				}
				y += RowSpacing;
			}
		}

		private List<TeleportLocation> GetGlobalSearchResults()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrEmpty(searchQuery))
			{
				return new List<TeleportLocation>();
			}
			List<TeleportLocation> source = allLocations.Where((TeleportLocation l) => !string.IsNullOrEmpty(l.Name) && l.Name.Contains(searchQuery, StringComparison.OrdinalIgnoreCase)).ToList();
			Vector3? playerPos = (((Object)(object)Player.Local != (Object)null) ? new Vector3?(((Component)Player.Local).transform.position) : ((Vector3?)null));
			if (settings.sortByDistance && playerPos.HasValue)
			{
				return source.OrderBy((TeleportLocation l) => Vector3.Distance(playerPos.Value, l.Position.ToVector3())).ToList();
			}
			List<string> categoryOrder = GetMenuCategoryOrder();
			return (from l in source
				orderby categoryOrder.IndexOf(l.Category), l.Name
				select l).ToList();
		}

		private void DrawSettingsMenu(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			float rowButtonHeight = RowButtonHeight;
			(string, MenuState)[] array = new(string, MenuState)[8]
			{
				("Keybinds", MenuState.SettingsKeybinds),
				("Appearance", MenuState.SettingsAppearance),
				("Teleport Cost & Cooldown", MenuState.SettingsCost),
				("Feature Toggles", MenuState.SettingsToggles),
				("Category Management", MenuState.SettingsCategories),
				("Theme Presets", MenuState.SettingsPresets),
				("Statistics", MenuState.Statistics),
				("Data & Backup", MenuState.SettingsData)
			};
			(string, MenuState)[] array2 = array;
			for (int i = 0; i < array2.Length; i++)
			{
				(string, MenuState) tuple = array2[i];
				if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), tuple.Item1, buttonStyle))
				{
					currentMenu = tuple.Item2;
					scrollPosition = Vector2.zero;
					pendingConfirmId = null;
				}
				num += RowSpacing;
			}
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), "Back", buttonStyle))
			{
				currentMenu = MenuState.Main;
				scrollPosition = Vector2.zero;
				searchQuery = "";
				pendingConfirmId = null;
			}
		}

		private void DrawSettingsBackButton(GUIStyle buttonStyle, float y)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (GUI.Button(new Rect(x, y, ((Rect)(ref windowRect)).width - 40f, 40f), "Back", buttonStyle))
			{
				currentMenu = MenuState.Settings;
				scrollPosition = Vector2.zero;
				pendingConfirmId = null;
			}
		}

		private void DrawSettingsKeybinds(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_0017: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			GUI.Label(new Rect(20f, num, 400f, 25f), $"Menu Toggle Key: {settings.menuKey}", labelStyle);
			if (GUI.Button(new Rect(275f, num, 100f, 25f), (waitingForKey == "menuKey") ? "Press Key..." : "Change", buttonStyle))
			{
				waitingForKey = "menuKey";
			}
			num += 35f;
			GUI.Label(new Rect(20f, num, 400f, 25f), $"Safety Teleport Key: {settings.safetyTeleportKey}", labelStyle);
			if (GUI.Button(new Rect(275f, num, 100f, 25f), (waitingForKey == "safetyTeleportKey") ? "Press Key..." : "Change", buttonStyle))
			{
				waitingForKey = "safetyTeleportKey";
			}
			num += 35f;
			GUI.Label(new Rect(20f, num, 400f, 25f), $"Undo Teleport Key: {settings.undoTeleportKey}", labelStyle);
			if (GUI.Button(new Rect(275f, num, 100f, 25f), (waitingForKey == "undoTeleportKey") ? "Press Key..." : "Change", buttonStyle))
			{
				waitingForKey = "undoTeleportKey";
			}
			num += 35f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 35f), "Reset Keys", buttonStyle))
			{
				settings.menuKey = (KeyCode)283;
				settings.safetyTeleportKey = (KeyCode)284;
				settings.undoTeleportKey = (KeyCode)285;
				SaveAllData();
				MelonLogger.Msg("Keys reset.");
			}
			num += 45f;
			DrawSettingsBackButton(buttonStyle, num);
		}

		private void DrawSettingsAppearance(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0461: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_071a: Unknown result type (might be due to invalid IL or missing references)
			//IL_075d: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_085a: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0921: Unknown result type (might be due to invalid IL or missing references)
			//IL_0986: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c82: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0deb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e93: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe3: Unknown result type (might be due to invalid IL or missing references)
			//IL_1059: Unknown result type (might be due to invalid IL or missing references)
			//IL_1098: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1135: Unknown result type (might be due to invalid IL or missing references)
			//IL_1193: Unknown result type (might be due to invalid IL or missing references)
			//IL_11d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1238: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle sliderTrackStyle = GetSliderTrackStyle();
			GUIStyle sliderThumbStyle = GetSliderThumbStyle();
			GUIStyle toggleStyle = GetToggleStyle();
			GUIStyle toggleLabelStyle = GetToggleLabelStyle();
			float num = -1f;
			float num2 = 20f;
			DrawSectionHeader(num2, "Title Settings", labelStyle);
			num2 += 35f;
			float num3 = settings.titleTextColorR;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleTextColorR = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Red: {settings.titleTextColorR}", labelStyle);
			num2 += 25f;
			num3 = settings.titleTextColorG;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleTextColorG = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Green: {settings.titleTextColorG}", labelStyle);
			num2 += 25f;
			num3 = settings.titleTextColorB;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleTextColorB = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Blue: {settings.titleTextColorB}", labelStyle);
			num2 += 25f;
			settings.titleFontSize = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), (float)settings.titleFontSize, 10f, 30f, sliderTrackStyle, sliderThumbStyle);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Font Size: {settings.titleFontSize}", labelStyle);
			num2 += 35f;
			DrawSectionHeader(num2, "Title Bar Color", labelStyle);
			num2 += 35f;
			num3 = settings.titleBarColorR;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleBarColorR = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Red: {settings.titleBarColorR}", labelStyle);
			num2 += 25f;
			num3 = settings.titleBarColorG;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleBarColorG = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Green: {settings.titleBarColorG}", labelStyle);
			num2 += 25f;
			num3 = settings.titleBarColorB;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleBarColorB = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Blue: {settings.titleBarColorB}", labelStyle);
			num2 += 25f;
			num3 = settings.titleBarColorA;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.titleBarColorA = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Alpha: {settings.titleBarColorA}", labelStyle);
			num2 += 35f;
			DrawSectionHeader(num2, "Text Settings", labelStyle);
			num2 += 35f;
			num3 = settings.textColorR;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.textColorR = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Red: {settings.textColorR}", labelStyle);
			num2 += 25f;
			num3 = settings.textColorG;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.textColorG = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Green: {settings.textColorG}", labelStyle);
			num2 += 25f;
			num3 = settings.textColorB;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.textColorB = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Blue: {settings.textColorB}", labelStyle);
			num2 += 25f;
			settings.fontSize = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), (float)settings.fontSize, 10f, 30f, sliderTrackStyle, sliderThumbStyle);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Font Size: {settings.fontSize}", labelStyle);
			num2 += 25f;
			settings.bold = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.bold, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 200f, 20f), "Bold", toggleLabelStyle);
			num2 += 35f;
			DrawSectionHeader(num2, "Hover Color", labelStyle);
			num2 += 35f;
			num3 = settings.buttonHoverR;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.buttonHoverR = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Red: {settings.buttonHoverR}", labelStyle);
			num2 += 25f;
			num3 = settings.buttonHoverG;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.buttonHoverG = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Green: {settings.buttonHoverG}", labelStyle);
			num2 += 25f;
			num3 = settings.buttonHoverB;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.buttonHoverB = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Blue: {settings.buttonHoverB}", labelStyle);
			num2 += 35f;
			DrawSectionHeader(num2, "Accent Color & Alpha", labelStyle);
			num2 += 35f;
			num3 = settings.accentBarR;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.accentBarR = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Red: {settings.accentBarR}", labelStyle);
			num2 += 25f;
			num3 = settings.accentBarG;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.accentBarG = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Green: {settings.accentBarG}", labelStyle);
			num2 += 25f;
			num3 = settings.accentBarB;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.accentBarB = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Blue: {settings.accentBarB}", labelStyle);
			num2 += 25f;
			num3 = settings.accentBarA;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.accentBarA = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Alpha: {settings.accentBarA}", labelStyle);
			num2 += 35f;
			DrawSectionHeader(num2, "Background Settings", labelStyle);
			num2 += 35f;
			num3 = settings.backgroundR;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.backgroundR = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Red: {settings.backgroundR}", labelStyle);
			num2 += 25f;
			num3 = settings.backgroundG;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.backgroundG = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Green: {settings.backgroundG}", labelStyle);
			num2 += 25f;
			num3 = settings.backgroundB;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.backgroundB = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Blue: {settings.backgroundB}", labelStyle);
			num2 += 25f;
			num3 = settings.backgroundA;
			num3 = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), num3, 0f, 255f, sliderTrackStyle, sliderThumbStyle);
			settings.backgroundA = Mathf.RoundToInt(num3);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Alpha: {settings.backgroundA}", labelStyle);
			num2 += 35f;
			DrawSectionHeader(num2, "Layout Settings", labelStyle);
			num2 += 35f;
			settings.cornerRadius = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), (float)settings.cornerRadius, 0f, 12f, sliderTrackStyle, sliderThumbStyle);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Corner Radius: {settings.cornerRadius}", labelStyle);
			num2 += 25f;
			settings.rowSpacing = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), (float)settings.rowSpacing, 35f, 70f, sliderTrackStyle, sliderThumbStyle);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Row Spacing: {settings.rowSpacing}", labelStyle);
			num2 += 25f;
			settings.scrollbarWidth = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 20f), (float)settings.scrollbarWidth, 4f, 16f, sliderTrackStyle, sliderThumbStyle);
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Scrollbar Width: {settings.scrollbarWidth}", labelStyle);
			num2 += 35f;
			if (ConfirmableActionButton(new Rect(x, num2, ((Rect)(ref windowRect)).width - 40f, 40f), "reset:appearance", "Reset Appearance", "Click Again to Confirm", buttonStyle))
			{
				ResetAppearanceSettings();
			}
			num2 += 45f;
			DrawSettingsBackButton(buttonStyle, num2);
		}

		private void DrawSettingsCost(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_005e: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle sliderTrackStyle = GetSliderTrackStyle();
			GUIStyle sliderThumbStyle = GetSliderThumbStyle();
			GUIStyle toggleStyle = GetToggleStyle();
			GUIStyle toggleLabelStyle = GetToggleLabelStyle();
			float num = -1f;
			float num2 = 20f;
			DrawSectionHeader(num2, "Teleport Cost Settings", labelStyle);
			num2 += 35f;
			settings.chargeForTeleport = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.chargeForTeleport, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 200f, 20f), "Enable Teleport Cost", toggleLabelStyle);
			num2 += 30f;
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Cost: ${settings.teleportCost}", labelStyle);
			settings.teleportCost = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 25f), (float)settings.teleportCost, 0f, 500f, sliderTrackStyle, sliderThumbStyle);
			num2 += 45f;
			settings.enableDistanceCost = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableDistanceCost, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 300f, 20f), "Add Cost Per Distance Traveled", toggleLabelStyle);
			num2 += 30f;
			GUI.Label(new Rect(230f, num2 - 4f, 220f, 25f), $"+{settings.distanceCostPercent}% of base per 100m", labelStyle);
			settings.distanceCostPercent = (int)GUI.HorizontalSlider(new Rect(20f, num2, 200f, 25f), (float)settings.distanceCostPercent, 0f, 20f, sliderTrackStyle, sliderThumbStyle);
			num2 += 45f;
			DrawSectionHeader(num2, "Teleport Cooldown", labelStyle);
			num2 += 35f;
			settings.enableTeleportCooldown = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableTeleportCooldown, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Enable Cooldown", toggleLabelStyle);
			num2 += 30f;
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Cooldown: {settings.teleportCooldownSeconds:F1}s", labelStyle);
			settings.teleportCooldownSeconds = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 25f), settings.teleportCooldownSeconds, 0.5f, 30f, sliderTrackStyle, sliderThumbStyle);
			num2 += 45f;
			DrawSectionHeader(num2, "Teleport Fade", labelStyle);
			num2 += 35f;
			settings.enableTeleportFade = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableTeleportFade, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Enable Screen Fade", toggleLabelStyle);
			num2 += 30f;
			GUI.Label(new Rect(230f, num2 - 4f, 200f, 25f), $"Duration: {settings.teleportFadeDuration:F1}s", labelStyle);
			settings.teleportFadeDuration = GUI.HorizontalSlider(new Rect(20f, num2, 200f, 25f), settings.teleportFadeDuration, 0.2f, 2f, sliderTrackStyle, sliderThumbStyle);
			num2 += 45f;
			DrawSettingsBackButton(buttonStyle, num2);
		}

		private void DrawSettingsToggles(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_0049: 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_00aa: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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_01cd: 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_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle toggleStyle = GetToggleStyle();
			GUIStyle toggleLabelStyle = GetToggleLabelStyle();
			float num = -1f;
			float num2 = 20f;
			DrawSectionHeader(num2, "Feature Toggles", labelStyle);
			num2 += 35f;
			settings.enableResizeGrip = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableResizeGrip, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Resize Grip", toggleLabelStyle);
			num2 += 25f;
			settings.enableCloseButton = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableCloseButton, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Close Button", toggleLabelStyle);
			num2 += 25f;
			settings.showBreadcrumb = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.showBreadcrumb, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Breadcrumb Title", toggleLabelStyle);
			num2 += 25f;
			settings.showFavoriteStar = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.showFavoriteStar, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Favorite Star", toggleLabelStyle);
			num2 += 25f;
			settings.enableSafetyTeleportKey = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableSafetyTeleportKey, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Safety Teleport Hotkey", toggleLabelStyle);
			num2 += 25f;
			settings.enableUndoTeleportKey = GUI.Toggle(new Rect(20f, num2 + num, 16f, 16f), settings.enableUndoTeleportKey, "", toggleStyle);
			GUI.Label(new Rect(40f, num2, 250f, 20f), "Undo Teleport Hotkey", toggleLabelStyle);
			num2 += 35f;
			DrawSettingsBackButton(buttonStyle, num2);
		}

		private void DrawSettingsCategories(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: 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_017a: 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_01d9: 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_024e: 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)
			float num = 20f;
			DrawSectionHeader(num, "Category Management", labelStyle);
			num += 35f;
			foreach (string allManagedCategory in GetAllManagedCategories())
			{
				bool flag = settings.hiddenCategories.Contains(allManagedCategory);
				bool flag2 = settings.customCategories.Contains(allManagedCategory);
				if (renamingCategory == allManagedCategory)
				{
					float num2 = 122f;
					float num3 = Mathf.Max(60f, ((Rect)(ref windowRect)).width - 40f - num2);
					GUI.Label(new Rect(x, num, num3, 25f), "New name: " + categoryRenameBuffer, GetSingleLineLabelStyle(labelStyle));
					if (GUI.Button(new Rect(x + num3 + 5f, num, 55f, 25f), "Save", buttonStyle))
					{
						CommitCategoryRename();
					}
					if (GUI.Button(new Rect(x + num3 + 63f, num, 55f, 25f), "Cancel", buttonStyle))
					{
						renamingCategory = null;
						categoryRenameBuffer = "";
					}
				}
				else
				{
					string text = GetCategoryDisplayName(allManagedCategory) + (flag ? " (hidden)" : "");
					GUI.Label(new Rect(x, num, 100f, 25f), text, labelStyle);
					float num4 = x + 100f;
					if (GUI.Button(new Rect(num4, num, 22f, 25f), "^", buttonStyle))
					{
						MoveCategory(allManagedCategory, -1);
					}
					num4 += 24f;
					if (GUI.Button(new Rect(num4, num, 22f, 25f), "v", buttonStyle))
					{
						MoveCategory(allManagedCategory, 1);
					}
					num4 += 24f;
					if (GUI.Button(new Rect(num4, num, 45f, 25f), flag ? "Show" : "Hide", buttonStyle))
					{
						ToggleCategoryHidden(allManagedCategory);
					}
					num4 += 47f;
					if (GUI.Button(new Rect(num4, num, 65f, 25f), "Rename", buttonStyle))
					{
						StartRenameCategory(allManagedCategory);
					}
					num4 += 67f;
					if (flag2 && ConfirmableDeleteButton(new Rect(num4, num, 22f, 25f), "category:" + allManagedCategory))
					{
						DeleteCustomCategory(allManagedCategory);
					}
				}
				num += 28f;
			}
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 35f), "Reset Category Names", buttonStyle))
			{
				ResetCategoryDisplayNames();
			}
			num += 45f;
			DrawSettingsBackButton(buttonStyle, num);
		}

		private void DrawSettingsPresets(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_003a: 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_00f0: 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_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			DrawSectionHeader(num, "Theme Presets", labelStyle);
			num += 35f;
			GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), "Preset Name: " + presetNameBuffer, GetSingleLineLabelStyle(labelStyle));
			num += 30f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 35f), "Save Current As Preset", buttonStyle))
			{
				SaveThemePreset();
			}
			num += 45f;
			DrawSectionHeader(num, "Built-in Themes", labelStyle);
			num += 35f;
			foreach (ThemePreset builtInThemePreset in BuiltInThemePresets)
			{
				GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 85f, 25f), builtInThemePreset.Name, labelStyle);
				if (GUI.Button(new Rect(((Rect)(ref windowRect)).width - 60f, num, 45f, 25f), "Load", buttonStyle))
				{
					ApplyThemePreset(builtInThemePreset);
				}
				num += 28f;
			}
			num += 10f;
			DrawSectionHeader(num, "Your Presets", labelStyle);
			num += 35f;
			if (settings.themePresets.Count == 0)
			{
				GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), "No saved presets yet.", GetCenteredLabelStyle());
				num += 28f;
			}
			foreach (ThemePreset themePreset in settings.themePresets)
			{
				GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 130f, 25f), themePreset.Name, labelStyle);
				if (GUI.Button(new Rect(((Rect)(ref windowRect)).width - 105f, num, 45f, 25f), "Load", buttonStyle))
				{
					ApplyThemePreset(themePreset);
				}
				if (ConfirmableDeleteButton(new Rect(((Rect)(ref windowRect)).width - 55f, num, 40f, 25f), "preset:" + themePreset.Name))
				{
					settings.themePresets.Remove(themePreset);
					SaveAllData();
					break;
				}
				num += 28f;
			}
			DrawSettingsBackButton(buttonStyle, num);
		}

		private void DrawSettingsData(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_0024: 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_00aa: 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_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Save Settings", buttonStyle))
			{
				SaveAllData();
			}
			num += 45f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Load Settings", buttonStyle))
			{
				LoadAllData();
			}
			num += 45f;
			if (ConfirmableActionButton(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "reset:everything", "Reset Everything", "Click Again to Confirm", buttonStyle))
			{
				ResetSettings();
			}
			num += 45f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Export Teleports", buttonStyle))
			{
				string exportPath = Path.Combine(MelonEnvironment.UserDataDirectory, "TeleportMenu/ExportedTeleports.json");
				ExportTeleports(exportPath);
			}
			num += 45f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Import Teleports", buttonStyle))
			{
				string importPath = Path.Combine(MelonEnvironment.UserDataDirectory, "TeleportMenu/ExportedTeleports.json");
				ImportTeleports(importPath);
			}
			num += 45f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Export Full Config", buttonStyle))
			{
				string exportPath2 = Path.Combine(MelonEnvironment.UserDataDirectory, "TeleportMenu/ExportedFullConfig.json");
				ExportFullConfig(exportPath2);
			}
			num += 45f;
			if (ConfirmableActionButton(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "import:fullconfig", "Import Full Config", "Click Again to Confirm", buttonStyle))
			{
				string importPath2 = Path.Combine(MelonEnvironment.UserDataDirectory, "TeleportMenu/ExportedFullConfig.json");
				ImportFullConfig(importPath2);
			}
			num += 45f;
			DrawSettingsBackButton(buttonStyle, num);
		}

		private void ResetSettings()
		{
			List<ThemePreset> themePresets = settings.themePresets;
			settings = new ModSettings();
			settings.themePresets = themePresets;
			MelonLogger.Msg("[Teleport Menu] All settings reset to default (theme presets kept).");
		}

		private void ResetAppearanceSettings()
		{
			ModSettings modSettings = new ModSettings();
			settings.titleFontSize = modSettings.titleFontSize;
			settings.titleTextColorR = modSettings.titleTextColorR;
			settings.titleTextColorG = modSettings.titleTextColorG;
			settings.titleTextColorB = modSettings.titleTextColorB;
			settings.titleBarColorR = modSettings.titleBarColorR;
			settings.titleBarColorG = modSettings.titleBarColorG;
			settings.titleBarColorB = modSettings.titleBarColorB;
			settings.titleBarColorA = modSettings.titleBarColorA;
			settings.textColorR = modSettings.textColorR;
			settings.textColorG = modSettings.textColorG;
			settings.textColorB = modSettings.textColorB;
			settings.fontSize = modSettings.fontSize;
			settings.bold = modSettings.bold;
			settings.buttonHoverR = modSettings.buttonHoverR;
			settings.buttonHoverG = modSettings.buttonHoverG;
			settings.buttonHoverB = modSettings.buttonHoverB;
			settings.accentBarR = modSettings.accentBarR;
			settings.accentBarG = modSettings.accentBarG;
			settings.accentBarB = modSettings.accentBarB;
			settings.accentBarA = modSettings.accentBarA;
			settings.backgroundR = modSettings.backgroundR;
			settings.backgroundG = modSettings.backgroundG;
			settings.backgroundB = modSettings.backgroundB;
			settings.backgroundA = modSettings.backgroundA;
			settings.cornerRadius = modSettings.cornerRadius;
			settings.rowSpacing = modSettings.rowSpacing;
			settings.scrollbarWidth = modSettings.scrollbarWidth;
			MelonLogger.Msg("[Teleport Menu] Appearance settings reset to default.");
		}

		private void DrawStatisticsMenu(GUIStyle buttonStyle, GUIStyle labelStyle)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), $"Total Teleports: {stats.TotalTeleports}", labelStyle);
			num += 30f;
			GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), $"Total Money Spent: ${stats.TotalMoneySpent}", labelStyle);
			num += 30f;
			List<KeyValuePair<string, int>> list = stats.UsageCounts.OrderByDescending<KeyValuePair<string, int>, int>((KeyValuePair<string, int> kv) => kv.Value).Take(5).ToList();
			if (list.Count > 0)
			{
				DrawSectionHeader(num, "Most Used Locations", labelStyle);
				num += 35f;
				foreach (KeyValuePair<string, int> item in list)
				{
					int num2 = item.Key.IndexOf(':');
					string category = ((num2 >= 0) ? item.Key.Substring(0, num2) : item.Key);
					string value = ((num2 >= 0) ? item.Key.Substring(num2 + 1) : "");
					string text = $"{GetCategoryDisplayName(category)} · {value} — {item.Value}x";
					GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), text, GetSingleLineLabelStyle(labelStyle));
					num += 28f;
				}
			}
			else
			{
				GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), "No teleports recorded yet.", GetCenteredLabelStyle());
				num += 30f;
			}
			num += 15f;
			if (ConfirmableActionButton(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "reset:stats", "Reset Statistics", "Click Again to Confirm", buttonStyle))
			{
				stats = new TeleportStats();
				SaveAllData();
			}
			num += 45f;
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Back", buttonStyle))
			{
				currentMenu = MenuState.Settings;
				scrollPosition = Vector2.zero;
				pendingConfirmId = null;
			}
		}

		private void DrawLocationSubMenu(GUIStyle buttonStyle)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0700: Unknown result type (might be due to invalid IL or missing references)
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Unknown result type (might be due to invalid IL or missing references)
			float num = 20f;
			float num2 = 40f;
			float num3 = 40f;
			List<TeleportLocation> list = (from l in allLocations
				where l.Category == currentCategory && (!string.IsNullOrEmpty(l.Name) || !IsUserManagedCategory(currentCategory))
				where IsUserManagedCategory(currentCategory) || string.IsNullOrEmpty(searchQuery) || l.Name.Contains(searchQuery, StringComparison.OrdinalIgnoreCase)
				select l).ToList();
			Vector3? playerPos = (((Object)(object)Player.Local != (Object)null) ? new Vector3?(((Component)Player.Local).transform.position) : ((Vector3?)null));
			if (settings.sortByDistance && playerPos.HasValue)
			{
				list = list.OrderBy((TeleportLocation l) => Vector3.Distance(playerPos.Value, l.Position.ToVector3())).ToList();
			}
			float rowButtonHeight = RowButtonHeight;
			if (playerPos.HasValue)
			{
				string text = (settings.sortByDistance ? "Sort: Nearest First" : "Sort: Default Order");
				if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 25f), text, buttonStyle))
				{
					settings.sortByDistance = !settings.sortByDistance;
					SaveAllData();
				}
				num += 30f;
			}
			if (!IsUserManagedCategory(currentCategory))
			{
				GUI.Label(new Rect(x, num, ((Rect)(ref windowRect)).width - 70f, 25f), "Search: " + searchQuery, GetSingleLineLabelStyle(GetLabelStyle()));
				if (!string.IsNullOrEmpty(searchQuery) && GUI.Button(new Rect(((Rect)(ref windowRect)).width - 45f, num, 25f, 25f), "X", GetDeleteButtonStyle()))
				{
					searchQuery = "";
				}
				num += 30f;
			}
			if (IsUserManagedCategory(currentCategory))
			{
				GUI.Label(new Rect(20f, num, ((Rect)(ref windowRect)).width - 40f, 30f), "Enter Name: " + newLocationName, GetSingleLineLabelStyle(GetLabelStyle()));
				num += 35f;
				if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), "Save Current Location", buttonStyle))
				{
					SaveCurrentLocation();
				}
				num += RowSpacing;
				if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, rowButtonHeight), "Set Safety Teleport", buttonStyle) && (Object)(object)Player.Local != (Object)null)
				{
					safetyTeleportPosition = new SerializableVector3(((Component)Player.Local).transform.position);
					SaveAllData();
					MelonLogger.Msg($"Safety Teleport location saved at ({safetyTeleportPosition.x}, {safetyTeleportPosition.y}, {safetyTeleportPosition.z})");
				}
				num += RowSpacing;
			}
			foreach (TeleportLocation loc in list)
			{
				float num4 = ((Rect)(ref windowRect)).width - 40f;
				if (settings.showFavoriteStar)
				{
					num4 -= num2 + 5f;
				}
				if (IsUserManagedCategory(currentCategory))
				{
					num4 -= num3 + 5f;
				}
				string text2 = loc.Name ?? "";
				if (string.IsNullOrEmpty(loc.Name))
				{
					text2 = "Unnamed Location";
				}
				if (playerPos.HasValue)
				{
					text2 += $"  ({Mathf.RoundToInt(Vector3.Distance(playerPos.Value, loc.Position.ToVector3()))}m)";
				}
				if (GUI.Button(new Rect(x, num, num4, rowButtonHeight), text2, buttonStyle))
				{
					TeleportToLocation(loc);
				}
				float num5 = x + num4 + 5f;
				if (settings.showFavoriteStar)
				{
					string text3 = (loc.IsFavorite ? "★" : "☆");
					GUIStyle favoriteButtonStyle = GetFavoriteButtonStyle(loc.IsFavorite);
					if (GUI.Button(new Rect(num5, num, num2, rowButtonHeight), text3, favoriteButtonStyle))
					{
						loc.IsFavorite = !loc.IsFavorite;
						if (loc.IsFavorite)
						{
							if (!favoriteLocations.Any((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category))
							{
								favoriteLocations.Add(loc);
							}
						}
						else
						{
							favoriteLocations.RemoveAll((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category);
						}
						SaveAllData();
					}
					num5 += num2 + 5f;
				}
				if (IsUserManagedCategory(currentCategory) && ConfirmableDeleteButton(new Rect(num5, num, num3, rowButtonHeight), "loc:" + loc.Category + ":" + loc.Name))
				{
					savedLocations.RemoveAll((TeleportLocation l) => l.Name == loc.Name && l.Category == loc.Category);
					allLocations.RemoveAll((TeleportLocation l) => l.Name == loc.Name && l.Category == loc.Category);
					favoriteLocations.RemoveAll((TeleportLocation f) => f.Name == loc.Name && f.Category == loc.Category);
					SaveAllData();
					break;
				}
				num += RowSpacing;
			}
			if (GUI.Button(new Rect(x, num, ((Rect)(ref windowRect)).width - 40f, 40f), "Back", buttonStyle))
			{
				currentMenu = MenuState.Main;
				scrollPosition = Vector2.zero;
				searchQuery = "";
				pendingConfirmId = null;
			}
		}

		private void InitializeAllLocations()
		{
			//IL_0032: 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_00be: 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_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result