Decompiled source of ItemDisplay v1.5.1

plugins\youxia173.ItemDisplay.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("youxia173")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyInformationalVersion("1.5.1")]
[assembly: AssemblyProduct("ItemDisplay")]
[assembly: AssemblyTitle("youxia173.ItemDisplay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LuggageDistanceMarkers
{
	internal static class AmuletRegistry
	{
		private static readonly HashSet<int> KnownIds = new HashSet<int>();

		private static readonly Dictionary<int, Item> Known = new Dictionary<int, Item>();

		private static readonly HashSet<int> KnownFakeIds = new HashSet<int>();

		private static readonly Dictionary<int, FakeItem> KnownFake = new Dictionary<int, FakeItem>();

		private static readonly List<int> ScratchIds = new List<int>();

		internal static int KnownCount => Known.Count + KnownFake.Count;

		internal static string LastHoverInfo { get; private set; } = "-";

		internal static string LastRejectReason { get; private set; } = "-";

		internal static void Register(Item? item, string reason)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)item == (Object)null)
			{
				LastRejectReason = reason + ": null";
				return;
			}
			try
			{
				Scene scene = ((Component)item).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					LastRejectReason = reason + ": prefab/no-scene";
					return;
				}
			}
			catch
			{
				LastRejectReason = reason + ": scene-check-fail";
				return;
			}
			if (!LooksLikeScoutAmulet(item, out string _))
			{
				LastRejectReason = reason + ": not-amulet (" + SafeName(item) + ")";
				return;
			}
			int instanceID = ((Object)item).GetInstanceID();
			if (KnownIds.Add(instanceID))
			{
				Known[instanceID] = item;
			}
			else
			{
				Known[instanceID] = item;
			}
		}

		internal static void NoteInteractible(IInteractible? interactible, string reason)
		{
			if (interactible == null)
			{
				LastHoverInfo = "null";
				return;
			}
			try
			{
				LastHoverInfo = ((object)interactible).GetType().Name + ":" + interactible.GetName();
			}
			catch
			{
				LastHoverInfo = ((object)interactible).GetType().Name;
			}
			FakeItem val = (FakeItem)(object)((interactible is FakeItem) ? interactible : null);
			if ((Object)(object)val != (Object)null)
			{
				RegisterFake(val, reason);
				return;
			}
			Item val2 = (Item)(object)((interactible is Item) ? interactible : null);
			if ((Object)(object)val2 == (Object)null)
			{
				try
				{
					Transform transform = interactible.GetTransform();
					if ((Object)(object)transform != (Object)null)
					{
						val2 = ((Component)transform).GetComponentInParent<Item>();
					}
				}
				catch
				{
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				Register(val2, reason);
			}
			else
			{
				LastRejectReason = reason + ": hover-unknown (" + LastHoverInfo + ")";
			}
		}

		internal static void RegisterFake(FakeItem? fake, string reason)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)fake == (Object)null)
			{
				LastRejectReason = reason + ": null-fake";
				return;
			}
			try
			{
				Scene scene = ((Component)fake).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					LastRejectReason = reason + ": fake-prefab/no-scene";
					return;
				}
			}
			catch
			{
				LastRejectReason = reason + ": fake-scene-check-fail";
				return;
			}
			if (!LooksLikeScoutAmulet(fake, out string _))
			{
				LastRejectReason = reason + ": fake-not-amulet (" + SafeName(fake) + ")";
				return;
			}
			int instanceID = ((Object)fake).GetInstanceID();
			if (KnownFakeIds.Add(instanceID))
			{
				KnownFake[instanceID] = fake;
			}
			else
			{
				KnownFake[instanceID] = fake;
			}
		}

		internal static void CollectMarkableFake(List<FakeItem> into)
		{
			into.Clear();
			ScratchIds.Clear();
			foreach (KeyValuePair<int, FakeItem> item in KnownFake)
			{
				FakeItem value = item.Value;
				if ((Object)(object)value == (Object)null)
				{
					ScratchIds.Add(item.Key);
					continue;
				}
				try
				{
					if (((object)value).Equals((object?)null))
					{
						ScratchIds.Add(item.Key);
						continue;
					}
				}
				catch
				{
					ScratchIds.Add(item.Key);
					continue;
				}
				if (!LooksLikeScoutAmulet(value, out string _))
				{
					ScratchIds.Add(item.Key);
				}
				else if (IsMarkableWorldAmulet(value))
				{
					into.Add(value);
				}
			}
			for (int i = 0; i < ScratchIds.Count; i++)
			{
				int num = ScratchIds[i];
				KnownFakeIds.Remove(num);
				KnownFake.Remove(num);
			}
		}

		internal static void CollectMarkable(List<Item> into)
		{
			into.Clear();
			ScratchIds.Clear();
			foreach (KeyValuePair<int, Item> item in Known)
			{
				Item value = item.Value;
				if ((Object)(object)value == (Object)null)
				{
					ScratchIds.Add(item.Key);
					continue;
				}
				try
				{
					if (((object)value).Equals((object?)null))
					{
						ScratchIds.Add(item.Key);
						continue;
					}
				}
				catch
				{
					ScratchIds.Add(item.Key);
					continue;
				}
				if (!LooksLikeScoutAmulet(value, out string _))
				{
					ScratchIds.Add(item.Key);
				}
				else if (IsMarkableWorldAmulet(value))
				{
					into.Add(value);
				}
			}
			for (int i = 0; i < ScratchIds.Count; i++)
			{
				int num = ScratchIds[i];
				KnownIds.Remove(num);
				Known.Remove(num);
			}
		}

		internal static bool LooksLikeScoutAmulet(Item item, out string how)
		{
			return IsScoutAmuletCore(item, out how);
		}

		internal static bool LooksLikeScoutAmulet(FakeItem fake, out string how)
		{
			how = "";
			if ((Object)(object)fake == (Object)null)
			{
				return false;
			}
			try
			{
				return IsScoutAmuletCore(fake.realItemPrefab, out how);
			}
			catch
			{
				return false;
			}
		}

		private static bool IsScoutAmuletCore(Item? item, out string how)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			how = "";
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			try
			{
				if (((Enum)item.itemTags).HasFlag((Enum)(object)(ItemTags)512))
				{
					how = "tag";
					return true;
				}
			}
			catch
			{
			}
			try
			{
				if ((Object)(object)((Component)item).GetComponent<AmuletBase>() != (Object)null)
				{
					how = "AmuletBase";
					return true;
				}
			}
			catch
			{
			}
			return false;
		}

		internal static bool IsMarkableWorldAmulet(Item? item)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Invalid comparison between Unknown and I4
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			try
			{
				Scene scene = ((Component)item).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					return false;
				}
				if (!LooksLikeScoutAmulet(item, out string _))
				{
					return false;
				}
				if ((Object)(object)item.holderCharacter != (Object)null)
				{
					return false;
				}
				if ((Object)(object)item.wearerCharacter != (Object)null)
				{
					return false;
				}
				if ((int)item.itemState == 2)
				{
					return false;
				}
				return true;
			}
			catch
			{
				return false;
			}
		}

		internal static bool IsMarkableWorldAmulet(FakeItem? fake)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)fake == (Object)null)
			{
				return false;
			}
			try
			{
				Scene scene = ((Component)fake).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					return false;
				}
				if (!LooksLikeScoutAmulet(fake, out string _))
				{
					return false;
				}
				if (fake.pickedUp)
				{
					return false;
				}
				if (!((Component)fake).gameObject.activeInHierarchy)
				{
					return false;
				}
				return true;
			}
			catch
			{
				return false;
			}
		}

		internal static string SafeName(Item item)
		{
			try
			{
				string itemName = item.GetItemName((ItemInstanceData)null);
				if (!string.IsNullOrEmpty(itemName) && !MarkerL10n.LooksLikeRawKey(itemName))
				{
					return itemName;
				}
			}
			catch
			{
			}
			try
			{
				string name = item.GetName();
				if (!string.IsNullOrEmpty(name) && !MarkerL10n.LooksLikeRawKey(name))
				{
					return name;
				}
			}
			catch
			{
			}
			try
			{
				if (item.UIData != null && !string.IsNullOrEmpty(item.UIData.itemName))
				{
					return item.UIData.itemName;
				}
			}
			catch
			{
			}
			if (!((Object)(object)((Component)item).gameObject != (Object)null))
			{
				return "?";
			}
			return ((Object)((Component)item).gameObject).name;
		}

		internal static string SafeName(FakeItem fake)
		{
			try
			{
				string name = fake.GetName();
				if (!string.IsNullOrEmpty(name) && !MarkerL10n.LooksLikeRawKey(name))
				{
					return name;
				}
			}
			catch
			{
			}
			if (!string.IsNullOrEmpty(fake.itemName))
			{
				return fake.itemName;
			}
			if (!((Object)(object)((Component)fake).gameObject != (Object)null))
			{
				return "?";
			}
			return ((Object)((Component)fake).gameObject).name;
		}

		internal static Vector3 GetWorldPos(Item item)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)item.mainRenderer != (Object)null)
				{
					Bounds bounds = item.mainRenderer.bounds;
					return ((Bounds)(ref bounds)).center;
				}
			}
			catch
			{
			}
			try
			{
				return item.Center();
			}
			catch
			{
				return ((Component)item).transform.position;
			}
		}

		internal static Vector3 GetWorldPos(FakeItem fake)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)fake.mainRenderer != (Object)null)
				{
					Bounds bounds = fake.mainRenderer.bounds;
					return ((Bounds)(ref bounds)).center;
				}
			}
			catch
			{
			}
			try
			{
				return fake.Center();
			}
			catch
			{
				return ((Component)fake).transform.position;
			}
		}

		internal static void SweepFakeAmulets(string reason)
		{
			if (!Plugin.ShowScoutAmulets.Value)
			{
				return;
			}
			try
			{
				FakeItem[] array = Object.FindObjectsByType<FakeItem>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				if (array != null)
				{
					for (int i = 0; i < array.Length; i++)
					{
						RegisterFake(array[i], reason);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Amulet FakeItem sweep failed: " + ex.Message));
			}
		}

		internal static void RefreshActiveAmuletItems()
		{
			if (!Plugin.ShowScoutAmulets.Value)
			{
				return;
			}
			try
			{
				List<Item> aLL_ACTIVE_ITEMS = Item.ALL_ACTIVE_ITEMS;
				if (aLL_ACTIVE_ITEMS != null)
				{
					for (int i = 0; i < aLL_ACTIVE_ITEMS.Count; i++)
					{
						Register(aLL_ACTIVE_ITEMS[i], "ALL_ACTIVE");
					}
				}
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(FakeItem), "HoverEnter")]
	internal static class FakeItemHoverEnterAmuletPatch
	{
		private static void Postfix(FakeItem __instance)
		{
			if (Plugin.ShowScoutAmulets.Value)
			{
				AmuletRegistry.NoteInteractible((IInteractible?)(object)__instance, "FakeHoverEnter");
			}
		}
	}
	[HarmonyPatch(typeof(Item), "HoverEnter")]
	internal static class ItemHoverEnterAmuletPatch
	{
		private static void Postfix(Item __instance)
		{
			if (Plugin.ShowScoutAmulets.Value)
			{
				AmuletRegistry.NoteInteractible((IInteractible?)(object)__instance, "HoverEnter");
			}
		}
	}
	[HarmonyPatch(typeof(GUIManager), "RefreshInteractablePrompt")]
	internal static class GuiRefreshAmuletPatch
	{
		private static void Postfix(GUIManager __instance)
		{
			if (!Plugin.ShowScoutAmulets.Value)
			{
				return;
			}
			try
			{
				if ((Object)(object)Interaction.instance != (Object)null)
				{
					AmuletRegistry.NoteInteractible(Interaction.instance.currentHovered, "GUIRefresh");
				}
			}
			catch
			{
			}
		}
	}
	[HarmonyPatch(typeof(Spawner), "InitializePhysics")]
	internal static class SpawnerInitAmuletPatch
	{
		private static void Postfix(Item newItem)
		{
			if (Plugin.ShowScoutAmulets.Value)
			{
				AmuletRegistry.Register(newItem, "Spawner.InitPhys");
			}
		}
	}
	[HarmonyPatch(typeof(Item), "SetKinematic")]
	internal static class ItemSetKinematicAmuletPatch
	{
		private static void Postfix(Item __instance)
		{
			if (Plugin.ShowScoutAmulets.Value)
			{
				AmuletRegistry.Register(__instance, "SetKinematic");
			}
		}
	}
	internal static class DefaultFoodMarkItems
	{
		internal static readonly ushort[] Ids = new ushort[36]
		{
			3, 4, 5, 9, 10, 11, 12, 19, 20, 21,
			36, 40, 41, 46, 56, 57, 60, 75, 76, 83,
			84, 88, 89, 93, 97, 102, 103, 108, 153, 154,
			158, 159, 160, 161, 162, 178
		};

		internal static readonly HashSet<ushort> ForceFoodCategory = new HashSet<ushort>(Ids);
	}
	internal static class DefaultMarkItems
	{
		internal static readonly string DefaultConfigIds = BuildDefaultConfigIds();

		private static string BuildDefaultConfigIds()
		{
			HashSet<ushort> hashSet = new HashSet<ushort>();
			AddAll(hashSet, DefaultFoodMarkItems.Ids);
			AddAll(hashSet, DefaultOtherMarkItems.Ids);
			List<ushort> list = new List<ushort>(hashSet);
			list.Sort();
			StringBuilder stringBuilder = new StringBuilder(list.Count * 4);
			for (int i = 0; i < list.Count; i++)
			{
				if (i > 0)
				{
					stringBuilder.Append(',');
				}
				stringBuilder.Append(list[i]);
			}
			return stringBuilder.ToString();
		}

		private static void AddAll(HashSet<ushort> into, ushort[] source)
		{
			for (int i = 0; i < source.Length; i++)
			{
				into.Add(source[i]);
			}
		}
	}
	internal static class DefaultOtherMarkItems
	{
		internal static readonly ushort[] SortPriority = new ushort[18]
		{
			181, 45, 68, 117, 90, 79, 155, 81, 110, 106,
			111, 184, 172, 95, 101, 48, 8, 165
		};

		internal static readonly ushort[] Ids = SortPriority;

		internal static readonly HashSet<ushort> ForcePropCategory = new HashSet<ushort>(Ids);

		internal static int GetSortIndex(ushort id)
		{
			for (int i = 0; i < SortPriority.Length; i++)
			{
				if (SortPriority[i] == id)
				{
					return i;
				}
			}
			return 1000 + id;
		}

		internal static int CompareSort(ushort a, ushort b)
		{
			return GetSortIndex(a).CompareTo(GetSortIndex(b));
		}
	}
	internal static class GloomBellRegistry
	{
		internal static void CopyUnlit(List<GhostFire> into)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			into.Clear();
			List<GloomSafeZone> aLL_GLOOM_SAFE_ZONES = GloomSafeZone.ALL_GLOOM_SAFE_ZONES;
			for (int i = 0; i < aLL_GLOOM_SAFE_ZONES.Count; i++)
			{
				GloomSafeZone obj = aLL_GLOOM_SAFE_ZONES[i];
				GhostFire val = (GhostFire)(object)((obj is GhostFire) ? obj : null);
				if (val == null)
				{
					continue;
				}
				try
				{
					if (!((GloomSafeZone)val).isLit && ((Component)val).gameObject.activeInHierarchy)
					{
						Scene scene = ((Component)val).gameObject.scene;
						if (((Scene)(ref scene)).IsValid())
						{
							goto IL_0056;
						}
					}
				}
				catch
				{
				}
				continue;
				IL_0056:
				into.Add(val);
			}
		}

		internal static string SafeName(GhostFire bell)
		{
			try
			{
				string name = bell.GetName();
				if (!string.IsNullOrEmpty(name) && !MarkerL10n.LooksLikeRawKey(name))
				{
					return name;
				}
			}
			catch
			{
			}
			return "钟楼";
		}

		internal static Vector3 GetWorldPos(GhostFire bell)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return bell.Center();
			}
			catch
			{
				return ((Component)bell).transform.position;
			}
		}
	}
	internal static class HiddenConfig
	{
		internal static ConfigDescription Desc(string text)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			return new ConfigDescription(text, (AcceptableValueBase)null, new object[1] { "Hidden" });
		}

		internal static ConfigDescription Desc(string text, AcceptableValueBase range)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			return new ConfigDescription(text, range, new object[1] { "Hidden" });
		}

		internal static ConfigDescription Desc(string text, AcceptableValueList<string> list)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			return new ConfigDescription(text, (AcceptableValueBase)(object)list, new object[1] { "Hidden" });
		}
	}
	internal static class ImGuiColorPicker
	{
		private static Texture2D? _hueBar;

		private static GUIStyle? _miniLabel;

		private static GUIStyle? _channelField;

		internal static void Draw(ref MarkerRgb rgb, float scale, GUIStyle labelStyle, GUIStyle fieldStyle)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			EnsureStyles(labelStyle, fieldStyle);
			float num2 = default(float);
			float num3 = default(float);
			float num = default(float);
			Color.RGBToHSV(rgb.Color, ref num, ref num2, ref num3);
			num = Mathf.Clamp01(num);
			num2 = Mathf.Clamp01(num2);
			num3 = Mathf.Clamp01(num3);
			float num4 = 32f * scale;
			float num5 = 16f * scale;
			float rowH = 24f * scale;
			Event current = Event.current;
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(Mathf.Max(num4, num5)) });
			DrawSwatchRect(rgb.Color, num4, num4);
			num = DrawHueBar(GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(num5),
				GUILayout.ExpandWidth(true)
			}), num, current);
			ApplyHsv(ref rgb, num, num2, num3);
			GUILayout.EndHorizontal();
			rgb.R = DrawChannelRow("R", rgb.R, rowH, scale);
			rgb.G = DrawChannelRow("G", rgb.G, rowH, scale);
			rgb.B = DrawChannelRow("B", rgb.B, rowH, scale);
		}

		private static void ApplyHsv(ref MarkerRgb rgb, float h, float s, float v)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			Color val = Color.HSVToRGB(h, s, v);
			rgb.R = Mathf.Clamp(Mathf.RoundToInt(val.r * 255f), 0, 255);
			rgb.G = Mathf.Clamp(Mathf.RoundToInt(val.g * 255f), 0, 255);
			rgb.B = Mathf.Clamp(Mathf.RoundToInt(val.b * 255f), 0, 255);
		}

		private static int DrawChannelRow(string channel, int value, float rowH, float scale)
		{
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(rowH) });
			GUILayout.Label(channel, _miniLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(16f * scale) });
			if (int.TryParse(GUILayout.TextField(value.ToString(), _channelField, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(42f * scale),
				GUILayout.Height(rowH - 2f)
			}), out var result))
			{
				value = Mathf.Clamp(result, 0, 255);
			}
			value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value, 0f, 255f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(16f * scale) }));
			GUILayout.Label(value.ToString(), _miniLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(32f * scale) });
			GUILayout.EndHorizontal();
			return value;
		}

		private static void DrawSwatchRect(Color color, float w, float h)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = GUILayoutUtility.GetRect(w, h, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(w),
				GUILayout.Height(h)
			});
			Color color2 = GUI.color;
			GUI.color = color;
			GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture, (ScaleMode)0);
			GUI.color = color2;
			DrawBorder(rect);
		}

		private static float DrawHueBar(Rect rect, float currentH, Event ev)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: 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_0081: Invalid comparison between Unknown and I4
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			EnsureHueBar();
			GUI.DrawTexture(rect, (Texture)(object)_hueBar, (ScaleMode)0);
			DrawBorder(rect);
			float num = ((Rect)(ref rect)).x + currentH * ((Rect)(ref rect)).width;
			Color color = GUI.color;
			GUI.color = Color.white;
			GUI.DrawTexture(new Rect(num - 1f, ((Rect)(ref rect)).y - 1f, 2f, ((Rect)(ref rect)).height + 2f), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
			if ((int)ev.type != 0 && (int)ev.type != 3)
			{
				return currentH;
			}
			if (!((Rect)(ref rect)).Contains(ev.mousePosition))
			{
				return currentH;
			}
			ev.Use();
			return Mathf.Clamp01((ev.mousePosition.x - ((Rect)(ref rect)).x) / ((Rect)(ref rect)).width);
		}

		private static void EnsureHueBar()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_hueBar != (Object)null)
			{
				return;
			}
			_hueBar = new Texture2D(256, 8, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)1
			};
			for (int i = 0; i < 256; i++)
			{
				Color val = Color.HSVToRGB((float)i / 255f, 1f, 1f);
				for (int j = 0; j < 8; j++)
				{
					_hueBar.SetPixel(i, j, val);
				}
			}
			_hueBar.Apply();
		}

		private static void DrawBorder(Rect rect)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			Color color = GUI.color;
			GUI.color = new Color(1f, 1f, 1f, 0.35f);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 1f, ((Rect)(ref rect)).width, 1f), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture);
			GUI.DrawTexture(new Rect(((Rect)(ref rect)).xMax - 1f, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), (Texture)(object)Texture2D.whiteTexture);
			GUI.color = color;
		}

		private static void EnsureStyles(GUIStyle labelStyle, GUIStyle fieldStyle)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (_miniLabel == null)
			{
				_miniLabel = new GUIStyle(labelStyle)
				{
					alignment = (TextAnchor)3,
					clipping = (TextClipping)0,
					wordWrap = false
				};
				_channelField = new GUIStyle(fieldStyle)
				{
					alignment = (TextAnchor)4
				};
			}
		}
	}
	internal enum ItemPickerCategory
	{
		Food,
		Prop
	}
	internal sealed class ItemCatalogEntry
	{
		internal ushort ItemId;

		internal string PrefabName = "";

		internal string DisplayName = "";

		internal ItemPickerCategory Category;

		internal string SearchText = "";

		internal Texture? Icon;
	}
	internal static class ItemCatalog
	{
		private static readonly List<ItemCatalogEntry> Entries = new List<ItemCatalogEntry>();

		private static Language _loadedLanguage;

		private static bool _ready;

		internal static IReadOnlyList<ItemCatalogEntry> EntriesReadonly => Entries;

		internal static bool IsReady => _ready;

		internal static void EnsureLoaded()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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)
			Language val = MarkerL10n.CurrentLanguage();
			if (_ready && _loadedLanguage == val)
			{
				return;
			}
			Entries.Clear();
			_ready = false;
			try
			{
				ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
				if (((DatabaseAsset<ItemDatabase, Item>)(object)instance)?.Objects == null)
				{
					return;
				}
				for (int i = 0; i < ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects.Count; i++)
				{
					Item val2 = ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects[i];
					if (!((Object)(object)val2 == (Object)null) && !ShouldHide(val2) && IsPickerItem(val2.itemID))
					{
						string text = ((Object)val2).name ?? "";
						string text2 = ResolveDisplayName(val2);
						if (string.IsNullOrWhiteSpace(text2))
						{
							text2 = text;
						}
						ItemCatalogEntry item = new ItemCatalogEntry
						{
							ItemId = val2.itemID,
							PrefabName = text,
							DisplayName = text2,
							Category = Classify(val2, text2),
							SearchText = $"{text2} {text} {val2.itemID}".ToLowerInvariant(),
							Icon = ResolveIcon(val2)
						};
						Entries.Add(item);
					}
				}
				Entries.Sort(CompareEntries);
				_loadedLanguage = val;
				_ready = true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("ItemCatalog load failed: " + ex.Message));
			}
		}

		internal static void Reset()
		{
			_ready = false;
			Entries.Clear();
		}

		private static Texture? ResolveIcon(Item prefab)
		{
			try
			{
				return (Texture?)(object)prefab.UIData?.icon;
			}
			catch
			{
				return null;
			}
		}

		private static string ResolveDisplayName(Item prefab)
		{
			try
			{
				string name = prefab.GetName();
				if (!string.IsNullOrWhiteSpace(name) && !MarkerL10n.LooksLikeRawKey(name))
				{
					return name.Trim();
				}
			}
			catch
			{
			}
			try
			{
				string itemName = prefab.GetItemName((ItemInstanceData)null);
				if (!string.IsNullOrWhiteSpace(itemName) && !MarkerL10n.LooksLikeRawKey(itemName))
				{
					return itemName.Trim();
				}
			}
			catch
			{
			}
			return ((Object)prefab).name ?? "";
		}

		private static bool ShouldHide(Item item)
		{
			string text = ((Object)item).name ?? "";
			if (string.IsNullOrWhiteSpace(text))
			{
				return true;
			}
			if (text.StartsWith("C_", StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (text.IndexOf("_Prop", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("_TEMP", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("_UNUSED", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("_Hidden", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			return string.Equals(text, "Skull", StringComparison.OrdinalIgnoreCase);
		}

		private static bool IsPickerItem(ushort id)
		{
			if (!DefaultFoodMarkItems.ForceFoodCategory.Contains(id))
			{
				return DefaultOtherMarkItems.ForcePropCategory.Contains(id);
			}
			return true;
		}

		private static ItemPickerCategory Classify(Item item, string displayName)
		{
			if (DefaultFoodMarkItems.ForceFoodCategory.Contains(item.itemID))
			{
				return ItemPickerCategory.Food;
			}
			return ItemPickerCategory.Prop;
		}

		private static int CompareEntries(ItemCatalogEntry a, ItemCatalogEntry b)
		{
			int num = a.Category.CompareTo(b.Category);
			if (num != 0)
			{
				return num;
			}
			if (a.Category == ItemPickerCategory.Prop)
			{
				return DefaultOtherMarkItems.CompareSort(a.ItemId, b.ItemId);
			}
			return string.Compare(a.DisplayName, b.DisplayName, StringComparison.CurrentCultureIgnoreCase);
		}
	}
	[HarmonyPatch(typeof(CharacterMovement), "CameraLook")]
	internal static class ItemPickerCameraLookPatch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			return !ItemPickerWindow.IsUiOpen;
		}
	}
	[HarmonyPatch(typeof(CursorHandler), "Update")]
	internal static class ItemPickerCursorPatch
	{
		[HarmonyPostfix]
		private static void Postfix()
		{
			if (ItemPickerWindow.IsUiOpen)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}
	}
	internal enum MarkerPanelTab
	{
		Settings,
		Luggage,
		Items
	}
	internal sealed class ItemPickerWindow
	{
		private const int WindowId = 1279544656;

		private const float ReferenceHeight = 1440f;

		private bool _open;

		private Vector2 _scroll;

		private Vector2 _settingsScroll;

		private Vector2 _luggageScroll;

		private string _search = "";

		private ItemPickerCategory _category;

		private bool _showSelectedOnly;

		private MarkerPanelTab _tab;

		private readonly HashSet<ushort> _workingItems = new HashSet<ushort>();

		private readonly MarkerPanelState _state = new MarkerPanelState();

		private string? _listeningKeyId;

		private CursorLockMode _prevLock;

		private bool _prevCursorVisible;

		private GUIStyle? _windowStyle;

		private GUIStyle? _labelStyle;

		private GUIStyle? _buttonStyle;

		private GUIStyle? _toggleStyle;

		private GUIStyle? _textFieldStyle;

		private Texture2D? _windowTex;

		private Texture2D? _buttonTex;

		private Texture2D? _buttonHoverTex;

		internal bool IsOpen => _open;

		internal static bool IsUiOpen { get; private set; }

		private static float UiScale => Mathf.Clamp((float)Screen.height / 1440f, 0.65f, 2.5f);

		internal void Toggle()
		{
			if (_open)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		internal void Open()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			ItemCatalog.EnsureLoaded();
			_state.LoadFromConfig();
			_workingItems.Clear();
			foreach (ushort selectedId in SelectedItemStore.SelectedIds)
			{
				_workingItems.Add(selectedId);
			}
			_search = "";
			_category = ItemPickerCategory.Food;
			_showSelectedOnly = false;
			_tab = MarkerPanelTab.Settings;
			_scroll = Vector2.zero;
			_settingsScroll = Vector2.zero;
			_luggageScroll = Vector2.zero;
			_listeningKeyId = null;
			_open = true;
			IsUiOpen = true;
			_prevLock = Cursor.lockState;
			_prevCursorVisible = Cursor.visible;
			ApplyUiCursorState();
			Plugin.Log.LogInfo((object)$"标记设置面板:已打开(物品目录 {ItemCatalog.EntriesReadonly.Count} 项,已选 {_workingItems.Count} 项)");
		}

		internal void Close()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (_open)
			{
				_open = false;
				IsUiOpen = false;
				Cursor.lockState = _prevLock;
				Cursor.visible = _prevCursorVisible;
				Plugin.Log.LogInfo((object)"标记设置面板:已关闭");
			}
		}

		internal void MaintainUiCursor()
		{
			if (_open)
			{
				ApplyUiCursorState();
			}
		}

		private static void ApplyUiCursorState()
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}

		internal void Draw()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			if (_open)
			{
				EnsureStyles();
				float uiScale = UiScale;
				float num = 820f * uiScale;
				float num2 = 900f * uiScale;
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2);
				GUI.ModalWindow(1279544656, val, new WindowFunction(DrawWindow), PanelL10n.Get(PanelL10n.Key.Title), _windowStyle);
			}
		}

		private void DrawWindow(int id)
		{
			float uiScale = UiScale;
			HandleKeyCapture();
			DrawMainTabs(uiScale);
			GUILayout.Space(6f * uiScale);
			switch (_tab)
			{
			case MarkerPanelTab.Settings:
				DrawSettingsTab(uiScale);
				break;
			case MarkerPanelTab.Luggage:
				DrawLuggageTab(uiScale);
				break;
			case MarkerPanelTab.Items:
				DrawItemsTab(uiScale);
				break;
			}
			GUILayout.Space(4f * uiScale);
			DrawFooter(uiScale);
		}

		private void DrawMainTabs(float scale)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			DrawMainTab(PanelL10n.Get(PanelL10n.Key.TabSettings), MarkerPanelTab.Settings, scale);
			DrawMainTab(PanelL10n.Get(PanelL10n.Key.TabLuggage), MarkerPanelTab.Luggage, scale);
			DrawMainTab(PanelL10n.Get(PanelL10n.Key.TabItems), MarkerPanelTab.Items, scale);
			GUILayout.EndHorizontal();
		}

		private void DrawMainTab(string label, MarkerPanelTab tab, float scale)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (_tab == tab)
			{
				GUI.backgroundColor = new Color(0.55f, 0.75f, 1f);
			}
			if (GUILayout.Button(label, _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * scale) }))
			{
				_tab = tab;
			}
			GUI.backgroundColor = Color.white;
		}

		private void DrawSettingsTab(float scale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			_settingsScroll = GUILayout.BeginScrollView(_settingsScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			_state.ModEnabled = DrawToggle(PanelL10n.Get(PanelL10n.Key.EnableMod), _state.ModEnabled, scale);
			GUILayout.Space(4f * scale);
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.SectionDisplay), _labelStyle, Array.Empty<GUILayoutOption>());
			_state.ShowDistance = DrawToggle(PanelL10n.Get(PanelL10n.Key.ShowDistance), _state.ShowDistance, scale);
			_state.ShowTypePrefix = DrawToggle(PanelL10n.Get(PanelL10n.Key.ShowNames), _state.ShowTypePrefix, scale);
			_state.StartVisible = DrawToggle(PanelL10n.Get(PanelL10n.Key.StartVisible), _state.StartVisible, scale);
			_state.DisplayMode = DrawModeButtons(_state.DisplayMode, scale);
			if (string.Equals(_state.DisplayMode, "Timed", StringComparison.OrdinalIgnoreCase))
			{
				_state.TimedSeconds = DrawFloatSliderRow(PanelL10n.Get(PanelL10n.Key.TimedSeconds), _state.TimedSeconds, 1f, 120f, scale);
			}
			_state.MaxDistanceMeters = DrawFloatSliderRow(PanelL10n.Get(PanelL10n.Key.LuggageMaxDistance), _state.MaxDistanceMeters, 0f, 5000f, scale);
			_state.HeightOffset = DrawFloatSliderRow(PanelL10n.Get(PanelL10n.Key.HeightOffset), _state.HeightOffset, 0f, 10f, scale);
			_state.FontSize = DrawIntSliderRow(PanelL10n.Get(PanelL10n.Key.FontSize), _state.FontSize, 10, 48, scale);
			GUILayout.Space(6f * scale);
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.SectionHotkeys), _labelStyle, Array.Empty<GUILayoutOption>());
			DrawHotkeysSection(scale);
			GUILayout.Space(6f * scale);
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.SectionOtherMarkers), _labelStyle, Array.Empty<GUILayoutOption>());
			_state.ShowScoutAmulets = DrawToggle(PanelL10n.Get(PanelL10n.Key.ScoutAmulets), _state.ShowScoutAmulets, scale);
			if (_state.ShowScoutAmulets)
			{
				_state.AmuletMaxDistanceMeters = DrawFloatSliderRow(PanelL10n.Get(PanelL10n.Key.AmuletMaxDistance), _state.AmuletMaxDistanceMeters, 0f, 5000f, scale);
			}
			_state.MarkGloomBells = DrawToggle(PanelL10n.Get(PanelL10n.Key.GloomBells), _state.MarkGloomBells, scale);
			if (_state.MarkGloomBells)
			{
				_state.GloomBellMaxDistanceMeters = DrawFloatSliderRow(PanelL10n.Get(PanelL10n.Key.GloomMaxDistance), _state.GloomBellMaxDistanceMeters, 0f, 5000f, scale);
			}
			_state.OtherItemsMaxDistanceMeters = DrawFloatSliderRow(PanelL10n.Get(PanelL10n.Key.CustomItemsMaxDistance), _state.OtherItemsMaxDistanceMeters, 0f, 5000f, scale);
			GUILayout.Space(6f * scale);
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.SectionOtherColors), _labelStyle, Array.Empty<GUILayoutOption>());
			DrawColorBlock(PanelL10n.Get(PanelL10n.Key.ColorAmulet), ref _state.ColorAmulet, MarkerDefaultColors.Amulet, scale);
			DrawColorBlock(PanelL10n.Get(PanelL10n.Key.ColorGloom), ref _state.ColorGloomBell, MarkerDefaultColors.GloomBell, scale);
			DrawColorBlock(PanelL10n.Get(PanelL10n.Key.ColorCustom), ref _state.ColorOtherItem, MarkerDefaultColors.OtherItem, scale);
			GUILayout.EndScrollView();
		}

		private void DrawLuggageTab(float scale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			_luggageScroll = GUILayout.BeginScrollView(_luggageScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.LuggageHint), _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f * scale);
			DrawLuggageRow(LuggageKind.Regular, ref _state.ShowLuggageRegular, ref _state.ColorRegular, scale);
			DrawLuggageRow(LuggageKind.Big, ref _state.ShowLuggageBig, ref _state.ColorBig, scale);
			DrawLuggageRow(LuggageKind.Explorer, ref _state.ShowLuggageExplorer, ref _state.ColorExplorer, scale);
			DrawLuggageRow(LuggageKind.Ancient, ref _state.ShowLuggageAncient, ref _state.ColorAncient, scale);
			DrawLuggageRow(LuggageKind.Clown, ref _state.ShowLuggageClown, ref _state.ColorClown, scale);
			DrawLuggageRow(LuggageKind.Trick, ref _state.ShowLuggageTrick, ref _state.ColorTrick, scale);
			DrawLuggageRow(LuggageKind.Respawn, ref _state.MarkRespawnChests, ref _state.ColorRespawn, scale);
			GUILayout.EndScrollView();
		}

		private void DrawLuggageRow(LuggageKind kind, ref bool enabled, ref MarkerRgb rgb, float scale)
		{
			MarkerRgb defaultRgb = MarkerDefaultColors.ForLuggage(kind);
			GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>());
			string label = MarkerL10n.LuggageTypeLabel(kind);
			enabled = DrawToggle(label, enabled, scale);
			if (enabled)
			{
				GUILayout.Space(2f * scale);
				DrawColorBlock(label, ref rgb, defaultRgb, scale);
			}
			GUILayout.EndVertical();
			GUILayout.Space(4f * scale);
		}

		private void DrawItemsTab(float scale)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.SearchHint), _labelStyle, Array.Empty<GUILayoutOption>());
			_search = GUILayout.TextField(_search ?? "", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f * scale) });
			DrawCategoryTabs(scale);
			GUILayout.Space(4f * scale);
			int num = 0;
			int num2 = 0;
			_scroll = GUILayout.BeginScrollView(_scroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			IReadOnlyList<ItemCatalogEntry> entriesReadonly = ItemCatalog.EntriesReadonly;
			string q = (_search ?? "").Trim().ToLowerInvariant();
			for (int i = 0; i < entriesReadonly.Count; i++)
			{
				ItemCatalogEntry itemCatalogEntry = entriesReadonly[i];
				if (!PassesFilter(itemCatalogEntry, q))
				{
					continue;
				}
				num++;
				bool flag = _workingItems.Contains(itemCatalogEntry.ItemId);
				if (flag)
				{
					num2++;
				}
				string label = $"{itemCatalogEntry.DisplayName}  ({itemCatalogEntry.PrefabName})  #{itemCatalogEntry.ItemId}";
				bool flag2 = DrawItemRow(flag, label, itemCatalogEntry.Icon, scale);
				if (flag2 != flag)
				{
					if (flag2)
					{
						_workingItems.Add(itemCatalogEntry.ItemId);
					}
					else
					{
						_workingItems.Remove(itemCatalogEntry.ItemId);
					}
				}
			}
			if (num == 0)
			{
				GUILayout.Label(ItemCatalog.IsReady ? PanelL10n.Get(PanelL10n.Key.NoMatches) : PanelL10n.Get(PanelL10n.Key.Loading), _labelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndScrollView();
			GUILayout.Label(PanelL10n.ItemCountLine(num, num2, _workingItems.Count), _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.SelectFiltered), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * scale) }))
			{
				SelectFiltered(q, select: true);
			}
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.ClearFiltered), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * scale) }))
			{
				SelectFiltered(q, select: false);
			}
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.ClearAll), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f * scale) }))
			{
				_workingItems.Clear();
			}
			GUILayout.EndHorizontal();
		}

		private void DrawFooter(float scale)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.Save), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f * scale) }))
			{
				SaveAndClose();
			}
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.Cancel), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f * scale) }))
			{
				Close();
			}
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.CloseEsc), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f * scale) }))
			{
				Close();
			}
			GUILayout.EndHorizontal();
		}

		private void SaveAndClose()
		{
			_state.SaveToConfig(((BaseUnityPlugin)Plugin.Instance).Config);
			SelectedItemStore.ApplyWorkingSet(_workingItems);
			SelectedItemStore.SaveIfDirty();
			Plugin.Instance.NotifyPanelSaved(_state.StartVisible);
			Plugin.Log.LogInfo((object)$"标记设置已保存(自定义物品 {_workingItems.Count} 项)");
			Close();
		}

		private bool DrawToggle(string label, bool value, float scale)
		{
			return GUILayout.Toggle(value, label, _toggleStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f * scale) });
		}

		private string DrawModeButtons(string mode, float scale)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(PanelL10n.Get(PanelL10n.Key.DisplayMode), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f * scale) });
			bool flag = string.Equals(mode, "Toggle", StringComparison.OrdinalIgnoreCase);
			string text = PanelL10n.Get(PanelL10n.Key.ModeToggle);
			string text2 = PanelL10n.Get(PanelL10n.Key.ModeTimed);
			if (GUILayout.Button(flag ? ("[ " + text + " ]") : text, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f * scale) }))
			{
				mode = "Toggle";
			}
			if (GUILayout.Button((!flag) ? ("[ " + text2 + " ]") : text2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f * scale) }))
			{
				mode = "Timed";
			}
			GUILayout.EndHorizontal();
			return mode;
		}

		private void HandleKeyCapture()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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)
			if (_listeningKeyId == null)
			{
				return;
			}
			Event current = Event.current;
			if ((int)current.type != 4)
			{
				return;
			}
			if ((int)current.keyCode != 27)
			{
				if (_listeningKeyId == "toggle")
				{
					_state.ToggleKeyCode = current.keyCode;
				}
				else if (_listeningKeyId == "panel")
				{
					_state.ItemPanelKeyCode = current.keyCode;
				}
			}
			_listeningKeyId = null;
			current.Use();
		}

		private void DrawHotkeysSection(float scale)
		{
			DrawKeyBindRow(PanelL10n.Get(PanelL10n.Key.ToggleMarkers), ref _state.ToggleKeyCode, "toggle", scale);
			DrawKeyBindRow(PanelL10n.Get(PanelL10n.Key.OpenPanel), ref _state.ItemPanelKeyCode, "panel", scale);
			_state.ItemPanelUseAlt = DrawToggle(PanelL10n.Get(PanelL10n.Key.PanelNeedAlt), _state.ItemPanelUseAlt, scale);
			_state.ItemPanelAllowLeftCtrl = DrawToggle(PanelL10n.Get(PanelL10n.Key.PanelAllowLeftCtrl), _state.ItemPanelAllowLeftCtrl, scale);
		}

		private void DrawKeyBindRow(string label, ref KeyCode key, string id, float scale)
		{
			float num = 28f * scale;
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			GUILayout.Label(label, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f * scale) });
			bool flag = _listeningKeyId == id;
			if (GUILayout.Button(flag ? PanelL10n.Get(PanelL10n.Key.PressKey) : KeyLabel(key), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(160f * scale),
				GUILayout.Height(num - 2f)
			}))
			{
				_listeningKeyId = (flag ? null : id);
			}
			GUILayout.EndHorizontal();
		}

		private unsafe static string KeyLabel(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((int)key != 0)
			{
				return ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString();
			}
			return PanelL10n.Get(PanelL10n.Key.KeyUnset);
		}

		private float DrawFloatSliderRow(string label, float value, float min, float max, float scale)
		{
			float num = 28f * scale;
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			GUILayout.Label(label, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f * scale) });
			if (float.TryParse(GUILayout.TextField(value.ToString("0.##"), _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(72f * scale),
				GUILayout.Height(num - 2f)
			}), out var result))
			{
				value = result;
			}
			value = Mathf.Clamp(value, min, max);
			value = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.MinWidth(160f * scale),
				GUILayout.Height(18f * scale)
			});
			GUILayout.EndHorizontal();
			return Mathf.Clamp(value, min, max);
		}

		private int DrawIntSliderRow(string label, int value, int min, int max, float scale)
		{
			float num = 28f * scale;
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			GUILayout.Label(label, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f * scale) });
			if (int.TryParse(GUILayout.TextField(value.ToString(), _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(72f * scale),
				GUILayout.Height(num - 2f)
			}), out var result))
			{
				value = result;
			}
			value = Mathf.Clamp(value, min, max);
			value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value, (float)min, (float)max, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.MinWidth(160f * scale),
				GUILayout.Height(18f * scale)
			}));
			GUILayout.EndHorizontal();
			return Mathf.Clamp(value, min, max);
		}

		private void DrawColorBlock(string label, ref MarkerRgb rgb, MarkerRgb defaultRgb, float scale)
		{
			float num = 26f * scale;
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			GUILayout.Label(label, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.Reset), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Width(72f * scale),
				GUILayout.Height(num - 2f)
			}))
			{
				rgb = defaultRgb;
			}
			GUILayout.EndHorizontal();
			ImGuiColorPicker.Draw(ref rgb, scale, _labelStyle, _textFieldStyle);
			GUILayout.Space(2f * scale);
		}

		private bool DrawItemRow(bool on, string label, Texture? icon, float scale)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			float num = 32f * scale;
			float num2 = 24f * scale;
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			if ((Object)(object)icon != (Object)null)
			{
				GUILayout.Label(GUIContent.none, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(num2 + 8f),
					GUILayout.Height(num)
				});
				Rect lastRect = GUILayoutUtility.GetLastRect();
				((Rect)(ref lastRect)).x = ((Rect)(ref lastRect)).x + 4f;
				((Rect)(ref lastRect)).y = ((Rect)(ref lastRect)).y + (num - num2) * 0.5f;
				((Rect)(ref lastRect)).width = num2;
				((Rect)(ref lastRect)).height = num2;
				GUI.DrawTexture(lastRect, icon, (ScaleMode)2);
			}
			bool result = GUILayout.Toggle(on, label, _toggleStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(num) });
			GUILayout.EndHorizontal();
			return result;
		}

		private bool PassesFilter(ItemCatalogEntry entry, string q)
		{
			if (_showSelectedOnly && !_workingItems.Contains(entry.ItemId))
			{
				return false;
			}
			if (!_showSelectedOnly && entry.Category != _category)
			{
				return false;
			}
			if (!string.IsNullOrEmpty(q) && entry.SearchText.IndexOf(q, StringComparison.Ordinal) < 0)
			{
				return false;
			}
			return true;
		}

		private void SelectFiltered(string q, bool select)
		{
			IReadOnlyList<ItemCatalogEntry> entriesReadonly = ItemCatalog.EntriesReadonly;
			for (int i = 0; i < entriesReadonly.Count; i++)
			{
				ItemCatalogEntry itemCatalogEntry = entriesReadonly[i];
				if (PassesFilter(itemCatalogEntry, q))
				{
					if (select)
					{
						_workingItems.Add(itemCatalogEntry.ItemId);
					}
					else
					{
						_workingItems.Remove(itemCatalogEntry.ItemId);
					}
				}
			}
		}

		private void DrawCategoryTabs(float scale)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			DrawSelectedOnlyTab(scale);
			DrawTab(PanelL10n.Get(PanelL10n.Key.TabFood), ItemPickerCategory.Food, scale);
			DrawTab(PanelL10n.Get(PanelL10n.Key.TabProp), ItemPickerCategory.Prop, scale);
			GUILayout.EndHorizontal();
		}

		private void DrawSelectedOnlyTab(float scale)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (_showSelectedOnly)
			{
				GUI.backgroundColor = new Color(0.55f, 0.85f, 0.55f);
			}
			if (GUILayout.Button(PanelL10n.Get(PanelL10n.Key.TabSelected), _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f * scale) }))
			{
				_showSelectedOnly = !_showSelectedOnly;
			}
			GUI.backgroundColor = Color.white;
		}

		private void DrawTab(string label, ItemPickerCategory cat, float scale)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!_showSelectedOnly && _category == cat)
			{
				GUI.backgroundColor = new Color(0.55f, 0.75f, 1f);
			}
			if (GUILayout.Button(label, _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f * scale) }))
			{
				_showSelectedOnly = false;
				_category = cat;
			}
			GUI.backgroundColor = Color.white;
		}

		private void EnsureStyles()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Expected O, but got Unknown
			if (_windowStyle == null)
			{
				_windowTex = MakeTex(new Color(0.08f, 0.09f, 0.12f, 0.96f));
				_buttonTex = MakeTex(new Color(0.18f, 0.2f, 0.26f, 1f));
				_buttonHoverTex = MakeTex(new Color(0.28f, 0.32f, 0.42f, 1f));
				int num = Mathf.RoundToInt(16f * UiScale);
				_windowStyle = new GUIStyle(GUI.skin.window)
				{
					fontSize = num + 2,
					fontStyle = (FontStyle)1
				};
				_labelStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = num,
					wordWrap = true
				};
				GUIStyle val = new GUIStyle(GUI.skin.button)
				{
					fontSize = num
				};
				val.normal.background = _buttonTex;
				val.normal.textColor = Color.white;
				val.hover.background = _buttonHoverTex;
				val.hover.textColor = Color.white;
				val.active.background = _buttonHoverTex;
				val.active.textColor = Color.white;
				_buttonStyle = val;
				_toggleStyle = new GUIStyle(GUI.skin.toggle)
				{
					fontSize = num,
					wordWrap = false
				};
				_textFieldStyle = new GUIStyle(GUI.skin.textField)
				{
					fontSize = num
				};
				_windowStyle.normal.background = _windowTex;
			}
		}

		private static Texture2D MakeTex(Color c)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			val.SetPixel(0, 0, c);
			val.Apply();
			return val;
		}
	}
	internal sealed class MarkerColorConfig
	{
		internal ConfigEntry<int> R;

		internal ConfigEntry<int> G;

		internal ConfigEntry<int> B;

		internal Color Color => new Color((float)R.Value / 255f, (float)G.Value / 255f, (float)B.Value / 255f, 1f);

		internal static MarkerColorConfig Bind(ConfigFile config, string section, string labelEn, string labelZh, Color defaultColor)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Clamp(Mathf.RoundToInt(defaultColor.r * 255f), 0, 255);
			int num2 = Mathf.Clamp(Mathf.RoundToInt(defaultColor.g * 255f), 0, 255);
			int num3 = Mathf.Clamp(Mathf.RoundToInt(defaultColor.b * 255f), 0, 255);
			AcceptableValueRange<int> range = new AcceptableValueRange<int>(0, 255);
			string text = "EN: " + labelEn + " marker color.\n中文:" + labelZh + "标记颜色。";
			return new MarkerColorConfig
			{
				R = config.Bind<int>(section, labelEn + " Color R " + labelZh + "颜色R", num, HiddenConfig.Desc(text + " Red 0-255 / 红 0-255。", (AcceptableValueBase)(object)range)),
				G = config.Bind<int>(section, labelEn + " Color G " + labelZh + "颜色G", num2, HiddenConfig.Desc(text + " Green 0-255 / 绿 0-255。", (AcceptableValueBase)(object)range)),
				B = config.Bind<int>(section, labelEn + " Color B " + labelZh + "颜色B", num3, HiddenConfig.Desc(text + " Blue 0-255 / 蓝 0-255。", (AcceptableValueBase)(object)range))
			};
		}
	}
	internal static class MarkerDefaultColors
	{
		internal static readonly MarkerRgb Regular = MarkerRgb.FromColor(Color.white);

		internal static readonly MarkerRgb Big = MarkerRgb.FromColor(new Color(0.12f, 1f, 0f));

		internal static readonly MarkerRgb Explorer = MarkerRgb.FromColor(new Color(0f, 0.44f, 0.87f));

		internal static readonly MarkerRgb Ancient = MarkerRgb.FromColor(new Color(0.64f, 0.21f, 0.93f));

		internal static readonly MarkerRgb Clown = MarkerRgb.FromColor(new Color(1f, 0.5f, 0f));

		internal static readonly MarkerRgb Trick = MarkerRgb.FromColor(new Color(1f, 0.5f, 0f));

		internal static readonly MarkerRgb Respawn = MarkerRgb.FromColor(new Color(1f, 0.13f, 0.13f));

		internal static readonly MarkerRgb Amulet = MarkerRgb.FromColor(new Color(1f, 0.35f, 0.72f));

		internal static readonly MarkerRgb GloomBell = MarkerRgb.FromColor(new Color(0.95f, 0.78f, 0.22f));

		internal static readonly MarkerRgb OtherItem = MarkerRgb.FromColor(new Color(0.35f, 0.88f, 1f));

		internal static MarkerRgb ForLuggage(LuggageKind kind)
		{
			return kind switch
			{
				LuggageKind.Regular => Regular, 
				LuggageKind.Big => Big, 
				LuggageKind.Explorer => Explorer, 
				LuggageKind.Ancient => Ancient, 
				LuggageKind.Clown => Clown, 
				LuggageKind.Trick => Trick, 
				LuggageKind.Respawn => Respawn, 
				_ => Regular, 
			};
		}
	}
	internal static class MarkerL10n
	{
		private static readonly Dictionary<LuggageKind, string> En = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Luggage",
			[LuggageKind.Big] = "Large",
			[LuggageKind.Explorer] = "Explorer",
			[LuggageKind.Ancient] = "Ancient",
			[LuggageKind.Clown] = "Clown",
			[LuggageKind.Trick] = "Trick",
			[LuggageKind.Respawn] = "Statue",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> ZhCn = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "普通",
			[LuggageKind.Big] = "大型",
			[LuggageKind.Explorer] = "探险",
			[LuggageKind.Ancient] = "古代",
			[LuggageKind.Clown] = "小丑",
			[LuggageKind.Trick] = "假箱",
			[LuggageKind.Respawn] = "雕像",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> ZhTw = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "普通",
			[LuggageKind.Big] = "大型",
			[LuggageKind.Explorer] = "探險",
			[LuggageKind.Ancient] = "古代",
			[LuggageKind.Clown] = "小丑",
			[LuggageKind.Trick] = "假箱",
			[LuggageKind.Respawn] = "雕像",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Ja = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "荷物",
			[LuggageKind.Big] = "大型",
			[LuggageKind.Explorer] = "探検",
			[LuggageKind.Ancient] = "古代",
			[LuggageKind.Clown] = "ピエロ",
			[LuggageKind.Trick] = "偽物",
			[LuggageKind.Respawn] = "像",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Ko = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "일반",
			[LuggageKind.Big] = "대형",
			[LuggageKind.Explorer] = "탐험",
			[LuggageKind.Ancient] = "고대",
			[LuggageKind.Clown] = "광대",
			[LuggageKind.Trick] = "가짜",
			[LuggageKind.Respawn] = "동상",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Fr = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Bagage",
			[LuggageKind.Big] = "Grand",
			[LuggageKind.Explorer] = "Explorateur",
			[LuggageKind.Ancient] = "Ancien",
			[LuggageKind.Clown] = "Clown",
			[LuggageKind.Trick] = "Faux",
			[LuggageKind.Respawn] = "Statue",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> It = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Bagaglio",
			[LuggageKind.Big] = "Grande",
			[LuggageKind.Explorer] = "Esploratore",
			[LuggageKind.Ancient] = "Antico",
			[LuggageKind.Clown] = "Clown",
			[LuggageKind.Trick] = "Finto",
			[LuggageKind.Respawn] = "Statua",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> De = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Gepäck",
			[LuggageKind.Big] = "Groß",
			[LuggageKind.Explorer] = "Entdecker",
			[LuggageKind.Ancient] = "Antik",
			[LuggageKind.Clown] = "Clown",
			[LuggageKind.Trick] = "Trick",
			[LuggageKind.Respawn] = "Statue",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Es = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Equipaje",
			[LuggageKind.Big] = "Grande",
			[LuggageKind.Explorer] = "Explorador",
			[LuggageKind.Ancient] = "Antiguo",
			[LuggageKind.Clown] = "Payaso",
			[LuggageKind.Trick] = "Truco",
			[LuggageKind.Respawn] = "Estatua",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Pt = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Bagagem",
			[LuggageKind.Big] = "Grande",
			[LuggageKind.Explorer] = "Explorador",
			[LuggageKind.Ancient] = "Antigo",
			[LuggageKind.Clown] = "Palhaço",
			[LuggageKind.Trick] = "Truque",
			[LuggageKind.Respawn] = "Estátua",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Ru = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Багаж",
			[LuggageKind.Big] = "Большой",
			[LuggageKind.Explorer] = "Исслед.",
			[LuggageKind.Ancient] = "Древний",
			[LuggageKind.Clown] = "Клоун",
			[LuggageKind.Trick] = "Обман",
			[LuggageKind.Respawn] = "Статуя",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Uk = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Багаж",
			[LuggageKind.Big] = "Великий",
			[LuggageKind.Explorer] = "Дослід.",
			[LuggageKind.Ancient] = "Стародав.",
			[LuggageKind.Clown] = "Клоун",
			[LuggageKind.Trick] = "Обман",
			[LuggageKind.Respawn] = "Статуя",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Pl = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Bagaż",
			[LuggageKind.Big] = "Duży",
			[LuggageKind.Explorer] = "Odkrywca",
			[LuggageKind.Ancient] = "Starożytny",
			[LuggageKind.Clown] = "Klaun",
			[LuggageKind.Trick] = "Podróbka",
			[LuggageKind.Respawn] = "Posąg",
			[LuggageKind.Unknown] = "?"
		};

		private static readonly Dictionary<LuggageKind, string> Tr = new Dictionary<LuggageKind, string>
		{
			[LuggageKind.Regular] = "Bagaj",
			[LuggageKind.Big] = "Büyük",
			[LuggageKind.Explorer] = "Kaşif",
			[LuggageKind.Ancient] = "Antik",
			[LuggageKind.Clown] = "Palyaço",
			[LuggageKind.Trick] = "Sahte",
			[LuggageKind.Respawn] = "Heykel",
			[LuggageKind.Unknown] = "?"
		};

		internal static Language CurrentLanguage()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return LocalizedText.CURRENT_LANGUAGE;
			}
			catch
			{
			}
			return (Language)0;
		}

		internal static string LuggageTypeLabel(LuggageKind kind)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (!TableFor(CurrentLanguage()).TryGetValue(kind, out string value) || string.IsNullOrEmpty(value))
			{
				return En[kind];
			}
			return value;
		}

		private static Dictionary<LuggageKind, string> TableFor(Language lang)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected I4, but got Unknown
			return (lang - 1) switch
			{
				8 => ZhCn, 
				9 => ZhTw, 
				10 => Ja, 
				11 => Ko, 
				0 => Fr, 
				1 => It, 
				2 => De, 
				3 => Es, 
				4 => Es, 
				5 => Pt, 
				6 => Ru, 
				7 => Uk, 
				12 => Pl, 
				13 => Tr, 
				_ => En, 
			};
		}

		internal static bool LooksLikeRawKey(string text)
		{
			if (string.IsNullOrWhiteSpace(text))
			{
				return true;
			}
			if (text.IndexOf(' ') < 0 && text.IndexOf('_') >= 0 && text == text.ToUpperInvariant())
			{
				return true;
			}
			return false;
		}
	}
	internal struct MarkerRgb
	{
		internal int R;

		internal int G;

		internal int B;

		internal Color Color => new Color((float)R / 255f, (float)G / 255f, (float)B / 255f, 1f);

		internal static MarkerRgb From(MarkerColorConfig cfg)
		{
			return new MarkerRgb
			{
				R = cfg.R.Value,
				G = cfg.G.Value,
				B = cfg.B.Value
			};
		}

		internal void ApplyTo(MarkerColorConfig cfg)
		{
			cfg.R.Value = R;
			cfg.G.Value = G;
			cfg.B.Value = B;
		}

		internal static MarkerRgb FromColor(Color c)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			return new MarkerRgb
			{
				R = Mathf.Clamp(Mathf.RoundToInt(c.r * 255f), 0, 255),
				G = Mathf.Clamp(Mathf.RoundToInt(c.g * 255f), 0, 255),
				B = Mathf.Clamp(Mathf.RoundToInt(c.b * 255f), 0, 255)
			};
		}
	}
	internal sealed class MarkerPanelState
	{
		internal bool ModEnabled;

		internal bool ShowDistance;

		internal bool ShowTypePrefix;

		internal float MaxDistanceMeters;

		internal float HeightOffset;

		internal int FontSize;

		internal bool MarkGloomBells;

		internal float GloomBellMaxDistanceMeters;

		internal bool ShowScoutAmulets;

		internal float AmuletMaxDistanceMeters;

		internal float OtherItemsMaxDistanceMeters;

		internal string DisplayMode = "Toggle";

		internal float TimedSeconds;

		internal bool StartVisible;

		internal KeyCode ToggleKeyCode;

		internal KeyCode ItemPanelKeyCode;

		internal bool ItemPanelUseAlt;

		internal bool ItemPanelAllowLeftCtrl;

		internal bool ShowLuggageRegular;

		internal bool ShowLuggageBig;

		internal bool ShowLuggageExplorer;

		internal bool ShowLuggageAncient;

		internal bool ShowLuggageClown;

		internal bool ShowLuggageTrick;

		internal bool MarkRespawnChests;

		internal MarkerRgb ColorRegular;

		internal MarkerRgb ColorBig;

		internal MarkerRgb ColorExplorer;

		internal MarkerRgb ColorAncient;

		internal MarkerRgb ColorClown;

		internal MarkerRgb ColorTrick;

		internal MarkerRgb ColorRespawn;

		internal MarkerRgb ColorAmulet;

		internal MarkerRgb ColorGloomBell;

		internal MarkerRgb ColorOtherItem;

		internal void LoadFromConfig()
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			ModEnabled = Plugin.ModEnabled.Value;
			ShowDistance = Plugin.ShowDistance.Value;
			ShowTypePrefix = Plugin.ShowTypePrefix.Value;
			MaxDistanceMeters = Plugin.MaxDistanceMeters.Value;
			HeightOffset = Plugin.HeightOffset.Value;
			FontSize = Plugin.FontSize.Value;
			MarkGloomBells = Plugin.MarkGloomBells.Value;
			GloomBellMaxDistanceMeters = Plugin.GloomBellMaxDistanceMeters.Value;
			ShowScoutAmulets = Plugin.ShowScoutAmulets.Value;
			AmuletMaxDistanceMeters = Plugin.AmuletMaxDistanceMeters.Value;
			OtherItemsMaxDistanceMeters = Plugin.OtherItemsMaxDistanceMeters.Value;
			DisplayMode = Plugin.DisplayMode.Value ?? "Toggle";
			TimedSeconds = Plugin.TimedSeconds.Value;
			StartVisible = Plugin.StartVisible.Value;
			KeyboardShortcut value = Plugin.ToggleKey.Value;
			ToggleKeyCode = ((KeyboardShortcut)(ref value)).MainKey;
			ItemPanelKeyCode = Plugin.ItemPanelKey.Value;
			ItemPanelUseAlt = Plugin.ItemPanelUseAlt.Value;
			ItemPanelAllowLeftCtrl = Plugin.ItemPanelAllowLeftCtrl.Value;
			ShowLuggageRegular = Plugin.ShowLuggageRegular.Value;
			ShowLuggageBig = Plugin.ShowLuggageBig.Value;
			ShowLuggageExplorer = Plugin.ShowLuggageExplorer.Value;
			ShowLuggageAncient = Plugin.ShowLuggageAncient.Value;
			ShowLuggageClown = Plugin.ShowLuggageClown.Value;
			ShowLuggageTrick = Plugin.ShowLuggageTrick.Value;
			MarkRespawnChests = Plugin.MarkRespawnChests.Value;
			ColorRegular = MarkerRgb.From(Plugin.ColorRegularCfg);
			ColorBig = MarkerRgb.From(Plugin.ColorBigCfg);
			ColorExplorer = MarkerRgb.From(Plugin.ColorExplorerCfg);
			ColorAncient = MarkerRgb.From(Plugin.ColorAncientCfg);
			ColorClown = MarkerRgb.From(Plugin.ColorClownCfg);
			ColorTrick = MarkerRgb.From(Plugin.ColorTrickCfg);
			ColorRespawn = MarkerRgb.From(Plugin.ColorRespawnCfg);
			ColorAmulet = MarkerRgb.From(Plugin.ColorAmuletCfg);
			ColorGloomBell = MarkerRgb.From(Plugin.ColorGloomBellCfg);
			ColorOtherItem = MarkerRgb.From(Plugin.ColorOtherItemCfg);
		}

		internal void SaveToConfig(ConfigFile config)
		{
			//IL_00e6: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			Plugin.ModEnabled.Value = ModEnabled;
			Plugin.ShowDistance.Value = ShowDistance;
			Plugin.ShowTypePrefix.Value = ShowTypePrefix;
			Plugin.MaxDistanceMeters.Value = MaxDistanceMeters;
			Plugin.HeightOffset.Value = HeightOffset;
			Plugin.FontSize.Value = FontSize;
			Plugin.MarkGloomBells.Value = MarkGloomBells;
			Plugin.GloomBellMaxDistanceMeters.Value = GloomBellMaxDistanceMeters;
			Plugin.ShowScoutAmulets.Value = ShowScoutAmulets;
			Plugin.AmuletMaxDistanceMeters.Value = AmuletMaxDistanceMeters;
			Plugin.OtherItemsMaxDistanceMeters.Value = OtherItemsMaxDistanceMeters;
			Plugin.DisplayMode.Value = DisplayMode;
			Plugin.TimedSeconds.Value = TimedSeconds;
			Plugin.StartVisible.Value = StartVisible;
			Plugin.ToggleKey.Value = new KeyboardShortcut(ToggleKeyCode, Array.Empty<KeyCode>());
			Plugin.ItemPanelKey.Value = ItemPanelKeyCode;
			Plugin.ItemPanelUseAlt.Value = ItemPanelUseAlt;
			Plugin.ItemPanelAllowLeftCtrl.Value = ItemPanelAllowLeftCtrl;
			Plugin.ShowLuggageRegular.Value = ShowLuggageRegular;
			Plugin.ShowLuggageBig.Value = ShowLuggageBig;
			Plugin.ShowLuggageExplorer.Value = ShowLuggageExplorer;
			Plugin.ShowLuggageAncient.Value = ShowLuggageAncient;
			Plugin.ShowLuggageClown.Value = ShowLuggageClown;
			Plugin.ShowLuggageTrick.Value = ShowLuggageTrick;
			Plugin.MarkRespawnChests.Value = MarkRespawnChests;
			ColorRegular.ApplyTo(Plugin.ColorRegularCfg);
			ColorBig.ApplyTo(Plugin.ColorBigCfg);
			ColorExplorer.ApplyTo(Plugin.ColorExplorerCfg);
			ColorAncient.ApplyTo(Plugin.ColorAncientCfg);
			ColorClown.ApplyTo(Plugin.ColorClownCfg);
			ColorTrick.ApplyTo(Plugin.ColorTrickCfg);
			ColorRespawn.ApplyTo(Plugin.ColorRespawnCfg);
			ColorAmulet.ApplyTo(Plugin.ColorAmuletCfg);
			ColorGloomBell.ApplyTo(Plugin.ColorGloomBellCfg);
			ColorOtherItem.ApplyTo(Plugin.ColorOtherItemCfg);
			config.Save();
		}
	}
	internal readonly struct SpawnerMarker
	{
		internal readonly Vector3 Position;

		internal readonly string Label;

		internal SpawnerMarker(Vector3 position, string label)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Position = position;
			Label = label;
		}
	}
	internal static class OtherItemRegistry
	{
		private static readonly List<Item> CachedItems = new List<Item>();

		private static readonly List<Item> CachedKinematicItems = new List<Item>();

		private static readonly List<FakeItem> CachedFakes = new List<FakeItem>();

		private static readonly List<SpawnerMarker> CachedSpawnerMarkers = new List<SpawnerMarker>();

		private static readonly HashSet<int> ScratchIds = new HashSet<int>();

		private static float _nextRefreshAt;

		internal const float RefreshIntervalSeconds = 2f;

		private const float SpawnerItemMatchRadius = 2f;

		internal static void TickRefresh(bool shouldRun)
		{
			if (!shouldRun || SelectedItemStore.Count == 0)
			{
				CachedItems.Clear();
				CachedKinematicItems.Clear();
				CachedFakes.Clear();
				CachedSpawnerMarkers.Clear();
			}
			else if (!(Time.unscaledTime < _nextRefreshAt))
			{
				_nextRefreshAt = Time.unscaledTime + 2f;
				RefreshKinematicItems();
				RefreshItems();
				RefreshFakes();
				RefreshSpawnerMarkers();
			}
		}

		internal static void CopyCachedItems(List<Item> into)
		{
			into.Clear();
			ScratchIds.Clear();
			AddUniqueItems(into, CachedItems);
			AddUniqueItems(into, CachedKinematicItems);
		}

		internal static void CopyCachedFakes(List<FakeItem> into)
		{
			into.Clear();
			for (int i = 0; i < CachedFakes.Count; i++)
			{
				FakeItem val = CachedFakes[i];
				if ((Object)(object)val != (Object)null && IsMarkableWorldFakeItem(val))
				{
					into.Add(val);
				}
			}
		}

		internal static void CopyCachedSpawnerMarkers(List<SpawnerMarker> into)
		{
			into.Clear();
			into.AddRange(CachedSpawnerMarkers);
		}

		internal static void Invalidate()
		{
			_nextRefreshAt = 0f;
			CachedItems.Clear();
			CachedKinematicItems.Clear();
			CachedFakes.Clear();
			CachedSpawnerMarkers.Clear();
		}

		private static void AddUniqueItems(List<Item> into, List<Item> source)
		{
			for (int i = 0; i < source.Count; i++)
			{
				Item val = source[i];
				if (!((Object)(object)val == (Object)null) && IsMarkableWorldItem(val))
				{
					int instanceID = ((Object)val).GetInstanceID();
					if (ScratchIds.Add(instanceID))
					{
						into.Add(val);
					}
				}
			}
		}

		private static void RefreshItems()
		{
			CachedItems.Clear();
			if (SelectedItemStore.Count == 0)
			{
				return;
			}
			try
			{
				List<Item> aLL_ACTIVE_ITEMS = Item.ALL_ACTIVE_ITEMS;
				if (aLL_ACTIVE_ITEMS == null)
				{
					return;
				}
				for (int i = 0; i < aLL_ACTIVE_ITEMS.Count; i++)
				{
					Item val = aLL_ACTIVE_ITEMS[i];
					if (!((Object)(object)val == (Object)null) && IsMarkableWorldItem(val) && SelectedItemStore.Contains(val.itemID))
					{
						CachedItems.Add(val);
					}
				}
			}
			catch
			{
			}
		}

		private static void RefreshKinematicItems()
		{
			CachedKinematicItems.Clear();
			if (SelectedItemStore.Count == 0)
			{
				return;
			}
			try
			{
				Item[] array = Object.FindObjectsByType<Item>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				if (array == null)
				{
					return;
				}
				foreach (Item val in array)
				{
					if ((Object)(object)val == (Object)null || !IsMarkableWorldItem(val) || !SelectedItemStore.Contains(val.itemID))
					{
						continue;
					}
					try
					{
						if ((Object)(object)val.rig == (Object)null || !val.rig.isKinematic)
						{
							continue;
						}
						goto IL_0069;
					}
					catch
					{
					}
					continue;
					IL_0069:
					CachedKinematicItems.Add(val);
				}
			}
			catch
			{
			}
		}

		private static void RefreshSpawnerMarkers()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			CachedSpawnerMarkers.Clear();
			if (SelectedItemStore.Count == 0)
			{
				return;
			}
			try
			{
				SingleItemSpawner[] array = Object.FindObjectsByType<SingleItemSpawner>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				if (array == null)
				{
					return;
				}
				foreach (SingleItemSpawner val in array)
				{
					if ((Object)(object)val == (Object)null || (Object)(object)val.prefab == (Object)null)
					{
						continue;
					}
					Item component = val.prefab.GetComponent<Item>();
					if (!((Object)(object)component == (Object)null) && SelectedItemStore.Contains(component.itemID))
					{
						Vector3 position = ((Component)val).transform.position;
						if (!HasTrackedItemNear(position, component.itemID))
						{
							string label = SafeName(component);
							CachedSpawnerMarkers.Add(new SpawnerMarker(position, label));
						}
					}
				}
			}
			catch
			{
			}
		}

		private static bool HasTrackedItemNear(Vector3 pos, ushort itemId)
		{
			//IL_0005: 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)
			if (HasItemNear(CachedKinematicItems, pos, itemId))
			{
				return true;
			}
			if (HasItemNear(CachedItems, pos, itemId))
			{
				return true;
			}
			return false;
		}

		private static bool HasItemNear(List<Item> items, Vector3 pos, ushort itemId)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			float num = 4f;
			for (int i = 0; i < items.Count; i++)
			{
				Item val = items[i];
				if (!((Object)(object)val == (Object)null) && val.itemID == itemId)
				{
					Vector3 val2 = ((Component)val).transform.position - pos;
					if (((Vector3)(ref val2)).sqrMagnitude <= num)
					{
						return true;
					}
				}
			}
			return false;
		}

		private static void RefreshFakes()
		{
			CachedFakes.Clear();
			if (SelectedItemStore.Count == 0)
			{
				return;
			}
			try
			{
				FakeItem[] array = Object.FindObjectsByType<FakeItem>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				if (array == null)
				{
					return;
				}
				foreach (FakeItem val in array)
				{
					if (!((Object)(object)val == (Object)null) && IsMarkableWorldFakeItem(val))
					{
						Item realItemPrefab = val.realItemPrefab;
						if (!((Object)(object)realItemPrefab == (Object)null) && SelectedItemStore.Contains(realItemPrefab.itemID))
						{
							CachedFakes.Add(val);
						}
					}
				}
			}
			catch
			{
			}
		}

		internal static bool IsMarkableWorldItem(Item? item)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Invalid comparison between Unknown and I4
			if ((Object)(object)item == (Object)null)
			{
				return false;
			}
			try
			{
				Scene scene = ((Component)item).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					return false;
				}
				if ((Object)(object)item.holderCharacter != (Object)null)
				{
					return false;
				}
				if ((Object)(object)item.wearerCharacter != (Object)null)
				{
					return false;
				}
				if ((int)item.itemState == 2)
				{
					return false;
				}
				if ((int)item.itemState == 1)
				{
					return false;
				}
				return true;
			}
			catch
			{
				return false;
			}
		}

		internal static bool IsMarkableWorldFakeItem(FakeItem? fake)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)fake == (Object)null)
			{
				return false;
			}
			try
			{
				Scene scene = ((Component)fake).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					return false;
				}
				if (fake.pickedUp)
				{
					return false;
				}
				if (!((Component)fake).gameObject.activeInHierarchy)
				{
					return false;
				}
				if ((Object)(object)fake.realItemPrefab == (Object)null)
				{
					return false;
				}
				return true;
			}
			catch
			{
				return false;
			}
		}

		internal static string SafeName(Item item)
		{
			try
			{
				string itemName = item.GetItemName((ItemInstanceData)null);
				if (!string.IsNullOrEmpty(itemName) && !MarkerL10n.LooksLikeRawKey(itemName))
				{
					return itemName;
				}
			}
			catch
			{
			}
			try
			{
				string name = item.GetName();
				if (!string.IsNullOrEmpty(name) && !MarkerL10n.LooksLikeRawKey(name))
				{
					return name;
				}
			}
			catch
			{
			}
			if (!((Object)(object)((Component)item).gameObject != (Object)null))
			{
				return "?";
			}
			return ((Object)((Component)item).gameObject).name;
		}

		internal static string SafeName(FakeItem fake)
		{
			try
			{
				string name = fake.GetName();
				if (!string.IsNullOrEmpty(name) && !MarkerL10n.LooksLikeRawKey(name))
				{
					return name;
				}
			}
			catch
			{
			}
			Item realItemPrefab = fake.realItemPrefab;
			if ((Object)(object)realItemPrefab != (Object)null)
			{
				try
				{
					string name2 = realItemPrefab.GetName();
					if (!string.IsNullOrEmpty(name2) && !MarkerL10n.LooksLikeRawKey(name2))
					{
						return name2;
					}
				}
				catch
				{
				}
			}
			if (!((Object)(object)((Component)fake).gameObject != (Object)null))
			{
				return "?";
			}
			return ((Object)((Component)fake).gameObject).name;
		}

		internal static Vector3 GetWorldPos(Item item)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)item.mainRenderer != (Object)null)
				{
					Bounds bounds = item.mainRenderer.bounds;
					return ((Bounds)(ref bounds)).center;
				}
			}
			catch
			{
			}
			try
			{
				return item.Center();
			}
			catch
			{
				return ((Component)item).transform.position;
			}
		}

		internal static Vector3 GetWorldPos(FakeItem fake)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)fake.mainRenderer != (Object)null)
				{
					Bounds bounds = fake.mainRenderer.bounds;
					return ((Bounds)(ref bounds)).center;
				}
			}
			catch
			{
			}
			try
			{
				return fake.Center();
			}
			catch
			{
				return ((Component)fake).transform.position;
			}
		}
	}
	internal static class PanelL10n
	{
		internal enum Key
		{
			Title,
			TabSettings,
			TabLuggage,
			TabItems,
			EnableMod,
			SectionDisplay,
			ShowDistance,
			ShowNames,
			StartVisible,
			DisplayMode,
			ModeToggle,
			ModeTimed,
			TimedSeconds,
			LuggageMaxDistance,
			HeightOffset,
			FontSize,
			SectionHotkeys,
			ToggleMarkers,
			OpenPanel,
			PanelNeedAlt,
			PanelAllowLeftCtrl,
			PressKey,
			KeyUnset,
			SectionOtherMarkers,
			ScoutAmulets,
			AmuletMaxDistance,
			GloomBells,
			GloomMaxDistance,
			CustomItemsMaxDistance,
			SectionOtherColors,
			ColorAmulet,
			ColorGloom,
			ColorCustom,
			LuggageHint,
			SearchHint,
			TabSelected,
			TabFood,
			TabProp,
			NoMatches,
			Loading,
			ItemCount,
			SelectFiltered,
			ClearFiltered,
			ClearAll,
			Save,
			Cancel,
			CloseEsc,
			Reset
		}

		private static readonly Dictionary<Key, string> En = new Dictionary<Key, string>
		{
			[Key.Title] = "Item Display Settings (O)",
			[Key.TabSettings] = "Settings",
			[Key.TabLuggage] = "Luggage",
			[Key.TabItems] = "Items",
			[Key.EnableMod] = "Enable mod",
			[Key.SectionDisplay] = "— Display —",
			[Key.ShowDistance] = "Show distance",
			[Key.ShowNames] = "Show names",
			[Key.StartVisible] = "Start visible",
			[Key.DisplayMode] = "Display mode:",
			[Key.ModeToggle] = "Toggle",
			[Key.ModeTimed] = "Timed",
			[Key.TimedSeconds] = "Timed seconds",
			[Key.LuggageMaxDistance] = "Luggage max distance (m)",
			[Key.HeightOffset] = "Height offset",
			[Key.FontSize] = "Font size",
			[Key.SectionHotkeys] = "— Hotkeys —",
			[Key.ToggleMarkers] = "Toggle markers",
			[Key.OpenPanel] = "Open this panel",
			[Key.PanelNeedAlt] = "Hold Alt to open panel",
			[Key.PanelAllowLeftCtrl] = "Allow Left Ctrl to open panel",
			[Key.PressKey] = "Press a key… (Esc cancel)",
			[Key.KeyUnset] = "Not set",
			[Key.SectionOtherMarkers] = "— Other markers —",
			[Key.ScoutAmulets] = "Scout Amulets",
			[Key.AmuletMaxDistance] = "  Amulet max distance (m)",
			[Key.GloomBells] = "Gloom bell towers",
			[Key.GloomMaxDistance] = "  Bell max distance (m)",
			[Key.CustomItemsMaxDistance] = "Custom items max distance (m)",
			[Key.SectionOtherColors] = "— Other marker colors —",
			[Key.ColorAmulet] = "Scout Amulet",
			[Key.ColorGloom] = "Gloom bell",
			[Key.ColorCustom] = "Custom items",
			[Key.LuggageHint] = "Toggle luggage types and colors",
			[Key.SearchHint] = "Search name, prefab or ID",
			[Key.TabSelected] = "Selected",
			[Key.TabFood] = "Food",
			[Key.TabProp] = "Items",
			[Key.NoMatches] = "No matches",
			[Key.Loading] = "Loading…",
			[Key.ItemCount] = "Showing {0}, selected {1} / total {2}",
			[Key.SelectFiltered] = "Select filtered",
			[Key.ClearFiltered] = "Clear filtered",
			[Key.ClearAll] = "Clear all",
			[Key.Save] = "Save",
			[Key.Cancel] = "Cancel",
			[Key.CloseEsc] = "Close (Esc)",
			[Key.Reset] = "Reset"
		};

		private static readonly Dictionary<Key, string> ZhCn = new Dictionary<Key, string>
		{
			[Key.Title] = "物品显示设置 (O)",
			[Key.TabSettings] = "设置",
			[Key.TabLuggage] = "行李箱",
			[Key.TabItems] = "物品",
			[Key.EnableMod] = "启用模组",
			[Key.SectionDisplay] = "— 显示 —",
			[Key.ShowDistance] = "显示距离",
			[Key.ShowNames] = "显示名称",
			[Key.StartVisible] = "开局默认显示",
			[Key.DisplayMode] = "显示模式:",
			[Key.ModeToggle] = "切换",
			[Key.ModeTimed] = "限时",
			[Key.TimedSeconds] = "限时秒数",
			[Key.LuggageMaxDistance] = "行李箱最大距离(米)",
			[Key.HeightOffset] = "高度偏移",
			[Key.FontSize] = "字号",
			[Key.SectionHotkeys] = "— 快捷键 —",
			[Key.ToggleMarkers] = "切换显示",
			[Key.OpenPanel] = "打开本面板",
			[Key.PanelNeedAlt] = "打开面板需按住 Alt",
			[Key.PanelAllowLeftCtrl] = "打开面板允许左 Ctrl",
			[Key.PressKey] = "请按键… (Esc取消)",
			[Key.KeyUnset] = "未设置",
			[Key.SectionOtherMarkers] = "— 其它标记 —",
			[Key.ScoutAmulets] = "童子军徽章",
			[Key.AmuletMaxDistance] = "  徽章最大距离(米)",
			[Key.GloomBells] = "雾沼钟楼",
			[Key.GloomMaxDistance] = "  钟楼最大距离(米)",
			[Key.CustomItemsMaxDistance] = "自定义物品最大距离(米)",
			[Key.SectionOtherColors] = "— 其它标记颜色 —",
			[Key.ColorAmulet] = "童子军徽章",
			[Key.ColorGloom] = "雾沼钟楼",
			[Key.ColorCustom] = "自定义物品",
			[Key.LuggageHint] = "勾选要显示的行李箱类型,并调整颜色",
			[Key.SearchHint] = "搜索名称、预制体名或 ID",
			[Key.TabSelected] = "已勾选",
			[Key.TabFood] = "食物",
			[Key.TabProp] = "道具",
			[Key.NoMatches] = "无匹配物品",
			[Key.Loading] = "物品列表加载中…",
			[Key.ItemCount] = "显示 {0} 项,已选 {1} / 总计 {2}",
			[Key.SelectFiltered] = "全选当前",
			[Key.ClearFiltered] = "取消当前",
			[Key.ClearAll] = "清空全部",
			[Key.Save] = "保存",
			[Key.Cancel] = "取消",
			[Key.CloseEsc] = "关闭 (Esc)",
			[Key.Reset] = "重置"
		};

		private static readonly Dictionary<Key, string> ZhTw = new Dictionary<Key, string>
		{
			[Key.Title] = "物品顯示設定 (O)",
			[Key.TabSettings] = "設定",
			[Key.TabLuggage] = "行李箱",
			[Key.TabItems] = "物品",
			[Key.EnableMod] = "啟用模組",
			[Key.SectionDisplay] = "— 顯示 —",
			[Key.ShowDistance] = "顯示距離",
			[Key.ShowNames] = "顯示名稱",
			[Key.StartVisible] = "開局預設顯示",
			[Key.DisplayMode] = "顯示模式:",
			[Key.ModeToggle] = "切換",
			[Key.ModeTimed] = "限時",
			[Key.TimedSeconds] = "限時秒數",
			[Key.LuggageMaxDistance] = "行李箱最大距離(米)",
			[Key.HeightOffset] = "高度偏移",
			[Key.FontSize] = "字級",
			[Key.SectionHotkeys] = "— 快捷鍵 —",
			[Key.ToggleMarkers] = "切換顯示",
			[Key.OpenPanel] = "開啟本面板",
			[Key.PanelNeedAlt] = "開啟面板需按住 Alt",
			[Key.PanelAllowLeftCtrl] = "開啟面板允許左 Ctrl",
			[Key.PressKey] = "請按鍵… (Esc取消)",
			[Key.KeyUnset] = "未設定",
			[Key.SectionOtherMarkers] = "— 其他標記 —",
			[Key.ScoutAmulets] = "童子軍徽章",
			[Key.AmuletMaxDistance] = "  徽章最大距離(米)",
			[Key.GloomBells] = "霧沼鐘樓",
			[Key.GloomMaxDistance] = "  鐘樓最大距離(米)",
			[Key.CustomItemsMaxDistance] = "自訂物品最大距離(米)",
			[Key.SectionOtherColors] = "— 其他標記顏色 —",
			[Key.ColorAmulet] = "童子軍徽章",
			[Key.ColorGloom] = "霧沼鐘樓",
			[Key.ColorCustom] = "自訂物品",
			[Key.LuggageHint] = "勾選要顯示的行李箱類型,並調整顏色",
			[Key.SearchHint] = "搜尋名稱、預製體名或 ID",
			[Key.TabSelected] = "已勾選",
			[Key.TabFood] = "食物",
			[Key.TabProp] = "道具",
			[Key.NoMatches] = "無符合物品",
			[Key.Loading] = "物品列表載入中…",
			[Key.ItemCount] = "顯示 {0} 項,已選 {1} / 總計 {2}",
			[Key.SelectFiltered] = "全選目前",
			[Key.ClearFiltered] = "取消目前",
			[Key.ClearAll] = "清空全部",
			[Key.Save] = "儲存",
			[Key.Cancel] = "取消",
			[Key.CloseEsc] = "關閉 (Esc)",
			[Key.Reset] = "重設"
		};

		private static readonly Dictionary<Key, string> Ja = new Dictionary<Key, string>
		{
			[Key.Title] = "アイテム表示設定 (O)",
			[Key.TabSettings] = "設定",
			[Key.TabLuggage] = "荷物",
			[Key.TabItems] = "アイテム",
			[Key.EnableMod] = "MODを有効化",
			[Key.SectionDisplay] = "— 表示 —",
			[Key.ShowDistance] = "距離を表示",
			[Key.ShowNames] = "名前を表示",
			[Key.StartVisible] = "開始時に表示",
			[Key.DisplayMode] = "表示モード:",
			[Key.ModeToggle] = "切替",
			[Key.ModeTimed] = "時間制限",
			[Key.TimedSeconds] = "表示秒数",
			[Key.LuggageMaxDistance] = "荷物の最大距離(m)",
			[Key.HeightOffset] = "高さオフセット",
			[Key.FontSize] = "フォントサイズ",
			[Key.SectionHotkeys] = "— ホットキー —",
			[Key.ToggleMarkers] = "表示切替",
			[Key.OpenPanel] = "このパネルを開く",
			[Key.PanelNeedAlt] = "パネルを開く時にAltを押す",
			[Key.PanelAllowLeftCtrl] = "左Ctrlでもパネルを開く",
			[Key.PressKey] = "キーを押してください… (Escで取消)",
			[Key.KeyUnset] = "未設定",
			[Key.SectionOtherMarkers] = "— その他のマーカー —",
			[Key.ScoutAmulets] = "スカウトアミュレット",
			[Key.AmuletMaxDistance] = "  アミュレット最大距離(m)",
			[Key.GloomBells] = "グルームの鐘楼",
			[Key.GloomMaxDistance] = "  鐘楼の最大距離(m)",
			[Key.CustomItemsMaxDistance] = "カスタムアイテム最大距離(m)",
			[Key.SectionOtherColors] = "— その他の色 —",
			[Key.ColorAmulet] = "スカウトアミュレット",
			[Key.ColorGloom] = "グルームの鐘楼",
			[Key.ColorCustom] = "カスタムアイテム",
			[Key.LuggageHint] = "表示する荷物の種類と色を設定",
			[Key.S