Decompiled source of PingMark v1.0.4

PingMark.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using JoksterCube.PingMark.Common;
using JoksterCube.PingMark.Common.Networking;
using JoksterCube.PingMark.Domain;
using JoksterCube.PingMark.Domain.Collections;
using JoksterCube.PingMark.Domain.Enums;
using JoksterCube.PingMark.Domain.Models;
using JoksterCube.PingMark.Domain.Networking;
using JoksterCube.PingMark.Domain.PingTargets;
using JoksterCube.PingMark.Patches.PingLabels;
using JoksterCube.PingMark.Settings;
using Microsoft.CodeAnalysis;
using ServerSync;
using SoftReferenceableAssets;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.UI;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Core.Tokens;
using YamlDotNet.Helpers;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.BufferedDeserialization;
using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators;
using YamlDotNet.Serialization.Converters;
using YamlDotNet.Serialization.EventEmitters;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization.NodeDeserializers;
using YamlDotNet.Serialization.NodeTypeResolvers;
using YamlDotNet.Serialization.ObjectFactories;
using YamlDotNet.Serialization.ObjectGraphTraversalStrategies;
using YamlDotNet.Serialization.ObjectGraphVisitors;
using YamlDotNet.Serialization.Schemas;
using YamlDotNet.Serialization.TypeInspectors;
using YamlDotNet.Serialization.TypeResolvers;
using YamlDotNet.Serialization.Utilities;
using YamlDotNet.Serialization.ValueDeserializers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("PingMark")]
[assembly: AssemblyDescription("Mark loot, creatures, and locations with named pings, colored outlines, and live distances. Share discoveries with your party.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("JoksterCube")]
[assembly: AssemblyProduct("PingMark")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7b25968d-61be-412f-b20f-36c18da9de86")]
[assembly: AssemblyFileVersion("1.0.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.4.0")]
[module: RefSafetyRules(11)]
[CompilerGenerated]
internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	int ICollection.Count => _items.Length;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => _items.Length;

	T IReadOnlyList<T>.this[int index] => _items[index];

	int ICollection<T>.Count => _items.Length;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			return _items[index];
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlyArray(T[] items)
	{
		_items = items;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return ((IEnumerable)_items).GetEnumerator();
	}

	void ICollection.CopyTo(Array array, int index)
	{
		((ICollection)_items).CopyTo(array, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return ((IList)_items).Contains(value);
	}

	int IList.IndexOf(object value)
	{
		return ((IList)_items).IndexOf(value);
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return ((IEnumerable<T>)_items).GetEnumerator();
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return ((ICollection<T>)_items).Contains(item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		((ICollection<T>)_items).CopyTo(array, arrayIndex);
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return ((IList<T>)_items).IndexOf(item);
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
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 JoksterCube.PingMark
{
	[BepInPlugin("JoksterCube.PingMark", "PingMark", "1.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		internal static readonly ManualLogSource ModLogger = Logger.CreateLogSource("PingMark");

		internal static string ConnectionError = string.Empty;

		private static readonly ConfigSync ConfigSync = new ConfigSync("JoksterCube.PingMark")
		{
			DisplayName = "PingMark",
			CurrentVersion = "1.0.4",
			MinimumRequiredVersion = "1.0.4"
		};

		private readonly string ConfigFileFullPath;

		private FileSystemWatcher? _configWatcher;

		private readonly Harmony _harmony;

		internal static bool InitialConfigSyncDone => ConfigSync.InitialSyncDone;

		internal static bool CanEditPrefabCollections
		{
			get
			{
				if (!ConfigSync.IsSourceOfTruth)
				{
					return ConfigSync.IsAdmin;
				}
				return true;
			}
		}

		internal static bool IsPrefabConfigSource => ConfigSync.IsSourceOfTruth;

		private void Awake()
		{
			PluginConfig.Build(((BaseUnityPlugin)this).Config, ConfigSync);
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			_harmony.PatchAll(executingAssembly);
			OutlineManager.Initialize();
			SetupWatcher();
		}

		private void Update()
		{
			ZPingNetwork.Update();
			MobHighlight.Update();
			InputManager.Update(this);
		}

		private void OnDestroy()
		{
			PrefabCollectionEditor.Close();
			OutlineManager.Dispose();
			_configWatcher?.Dispose();
			((BaseUnityPlugin)this).Config.Save();
		}

		private void OnGUI()
		{
			PrefabCollectionEditor.Draw(this);
		}

		private void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, "JoksterCube.PingMark.cfg");
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			_configWatcher = fileSystemWatcher;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				ModLogger.LogDebug((object)"ReadConfigCalled called");
				((BaseUnityPlugin)this).Config.Reload();
			}
			catch
			{
				ModLogger.LogError((object)"There was an issue loading your JoksterCube.PingMark.cfg");
				ModLogger.LogError((object)"Please check your config entries for spelling and format!");
			}
		}

		public Plugin()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + "JoksterCube.PingMark.cfg";
			_harmony = new Harmony("JoksterCube.PingMark");
			((BaseUnityPlugin)this)..ctor();
		}
	}
}
namespace JoksterCube.PingMark.Settings
{
	internal sealed class ConfigInfo<T>
	{
		internal string Group { get; }

		internal string Name { get; }

		internal ConfigDescription Description { get; }

		internal T DefaultValue { get; }

		internal bool Synchronized { get; }

		internal ConfigInfo(string group, string name, string description, T defaultValue, bool synchronized = true)
			: this(group, name, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), defaultValue, synchronized)
		{
		}//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown


		internal ConfigInfo(string group, string name, ConfigDescription description, T defaultValue, bool synchronized = true)
		{
			Group = group;
			Name = name;
			Description = description;
			DefaultValue = defaultValue;
			Synchronized = synchronized;
		}
	}
	internal static class ConfigOptions
	{
		private static ConfigFile? _configFile;

		private static ConfigSync? _configSync;

		internal static void Initialize(ConfigFile config, ConfigSync configSync)
		{
			_configFile = config;
			_configSync = configSync;
		}

		internal static ConfigEntry<T> Config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = (_configFile ?? throw new InvalidOperationException("ConfigOptions is not initialized.")).Bind<T>(group, name, value, val);
			(_configSync ?? throw new InvalidOperationException("ConfigOptions is not initialized.")).AddConfigEntry<T>(val2).SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		internal static ConfigEntry<T> Config<T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			return Config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		internal static ConfigEntry<T> Config<T>(ConfigInfo<T> configInfo)
		{
			return Config(configInfo.Group, configInfo.Name, configInfo.DefaultValue, configInfo.Description, configInfo.Synchronized);
		}

		internal static ConfigEntry<T> Config<T>(ConfigInfo<T> configInfo, string legacyGroup)
		{
			ConfigFile? obj = _configFile ?? throw new InvalidOperationException("ConfigOptions is not initialized.");
			ConfigEntry<T> val = obj.Bind<T>(legacyGroup, configInfo.Name, configInfo.DefaultValue, configInfo.Description);
			T value = val.Value;
			obj.Remove(((ConfigEntryBase)val).Definition);
			ConfigEntry<T> val2 = Config(configInfo);
			if (!EqualityComparer<T>.Default.Equals(value, configInfo.DefaultValue))
			{
				val2.Value = value;
			}
			return val2;
		}
	}
	internal static class Constants
	{
		internal static class Plugin
		{
			internal const string ModName = "PingMark";

			internal const string ModVersion = "1.0.4";

			internal const string Author = "JoksterCube";

			internal const string ModGUID = "JoksterCube.PingMark";

			internal const string Description = "Mark loot, creatures, and locations with named pings, colored outlines, and live distances. Share discoveries with your party.";

			internal const string Copyright = "Copyright ©  2026";

			internal const string Guid = "7b25968d-61be-412f-b20f-36c18da9de86";

			internal const string ConfigFileName = "JoksterCube.PingMark.cfg";
		}

		internal static class DebugMessages
		{
			internal const string ReadConfigCalled = "ReadConfigCalled called";

			internal const string ErrorLoadingConfig = "There was an issue loading your JoksterCube.PingMark.cfg";

			internal const string RequestCheckConfig = "Please check your config entries for spelling and format!";
		}

		internal static class LayerMasks
		{
			internal static readonly int MobHighlight = LayerMask.GetMask(new string[12]
			{
				"Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "vehicle", "character", "character_net", "character_ghost",
				"character_noenv", "item"
			});
		}

		internal static class Groups
		{
			internal static class General
			{
				internal const string Group = "1 - General";

				internal static readonly ConfigInfo<Toggle> Enabled = new ConfigInfo<Toggle>("1 - General", "Enabled", "Enable all PingMark features.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<Toggle> Lock = new ConfigInfo<Toggle>("1 - General", "Lock Configuration", "If on, synchronized configuration is locked and can be changed by server admins only.", Toggle.On);

				internal static readonly ConfigInfo<float> RefreshInterval = new ConfigInfo<float>("1 - General", "Refresh Interval", new ConfigDescription("How often, in seconds, distances on visible pings and highlighted mobs are recalculated.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 5f), Array.Empty<object>()), 0.25f);

				internal static readonly ConfigInfo<float> PingCooldown = new ConfigInfo<float>("1 - General", "Ping Cooldown", new ConfigDescription("Minimum seconds between location pings sent with Z. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>()), 0f);

				internal static readonly ConfigInfo<float> ZPingBroadcastDistance = new ConfigInfo<float>("1 - General", "Z Ping Broadcast Distance", new ConfigDescription("Maximum distance in meters from the sending player to PingMark recipients of Z location pings and character highlights. Map pings remain global. Set to 0 for unlimited. Without a modded server, the sender's setting is used.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10000f), Array.Empty<object>()), 200f);

				internal static readonly ConfigInfo<Toggle> SendZPingsToUnmoddedPlayers = new ConfigInfo<Toggle>("1 - General", "Send Z Pings To Unmodded Players", "Send Z pings as ordinary location pings to players without PingMark, regardless of distance. Character pings use the character's current position. If off, players without PingMark receive no Z pings.", Toggle.On);

				internal static readonly ConfigInfo<Toggle> DebugPrefabId = new ConfigInfo<Toggle>("1 - General", "Debug Ping Names", "Show all names found on the hit object (prefab ID, location ID, hover, piece, etc.) in a top-left message when camera pinging.", Toggle.Off, synchronized: false);
			}

			internal static class PingLabel
			{
				internal const string Group = "2 - Ping Label";

				internal static readonly ConfigInfo<Toggle> ShowPingerName = new ConfigInfo<Toggle>("2 - Ping Label", "Show Pinger Name", "Show the pinger's name on world/map ping labels and above highlighted mobs and players.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<Toggle> ShowDistance = new ConfigInfo<Toggle>("2 - Ping Label", "Show Distance", "Show distance on world/map ping labels and above highlighted mobs and players.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<string> EmptyLabelText = new ConfigInfo<string>("2 - Ping Label", "Empty Label Text", "Text shown when the pinger name, target name, and distance are all hidden.", "PING", synchronized: false);

				internal static readonly ConfigInfo<Toggle> UseKilometers = new ConfigInfo<Toggle>("2 - Ping Label", "Use Kilometers", "Show distances of 1000 meters or more in kilometers with two decimal places.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<Toggle> ShowTargetName = new ConfigInfo<Toggle>("2 - Ping Label", "Show Target Name", "Show the pinged location/object name on this client. Target names are sent regardless of the sender's display setting.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<Color> PingColor = new ConfigInfo<Color>("2 - Ping Label", "Ping Color", "Color of in-world ping labels (name and distance) when not matched to an outline color.", Color.white, synchronized: false);

				internal static readonly ConfigInfo<Toggle> MatchTextToOutline = new ConfigInfo<Toggle>("2 - Ping Label", "Match Ping Text To Outline", "Color the ping label with the outline color of the pinged target.", Toggle.Off, synchronized: false);
			}

			internal static class Outlines
			{
				internal const string Group = "5 - Outlines";

				internal static readonly ConfigInfo<Toggle> PingOutlineEnabled = new ConfigInfo<Toggle>("5 - Outlines", "Enable Ping Outline", "Draw an outline around pinged locations, valuables/resources, drops and other models.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<float> OutlineWidth = new ConfigInfo<float>("5 - Outlines", "Outline Width", new ConfigDescription("Width in pixels of outlines around highlighted mobs and pinged models. Visible through obstacles. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()), 2f, synchronized: false);

				internal static readonly ConfigInfo<Color> PingDropColor = new ConfigInfo<Color>("5 - Outlines", "Ping Drop Color", "Outline color for pinged dropped items (weapons, armor, materials on the ground).", new Color(0.7f, 0.5f, 1f), synchronized: false);

				internal static readonly ConfigInfo<Color> PingPlayerColor = new ConfigInfo<Color>("5 - Outlines", "Ping Gravestone/Player Color", "Outline color for pinged gravestones and other players.", new Color(1f, 0.5f, 0.15f), synchronized: false);

				internal static readonly ConfigInfo<Color> PingAnythingColor = new ConfigInfo<Color>("5 - Outlines", "Ping Anything Color", "Outline color for any other pinged model.", Color.white, synchronized: false);

				internal static readonly ConfigInfo<Color> HostileOutlineColor = new ConfigInfo<Color>("5 - Outlines", "Hostile Outline Color", "Outline color for highlighted hostile mobs.", new Color(0.9f, 0.18f, 0.12f), synchronized: false);

				internal static readonly ConfigInfo<Color> AllyOutlineColor = new ConfigInfo<Color>("5 - Outlines", "Ally Outline Color", "Outline color for highlighted ally and tamed mobs.", new Color(0.5f, 0.85f, 0.3f), synchronized: false);
			}

			internal static class PrefabCollections
			{
				internal const string Group = "7 - Prefab Collections";

				internal const int Color1Id = 1;

				internal const int Color2Id = 2;

				internal const int Color3Id = 3;

				internal const int Color4Id = 4;

				internal const int Color5Id = 5;

				internal const int Color6Id = 6;

				internal const int Color7Id = 7;

				internal const int Color8Id = 8;

				internal const int Color9Id = 9;

				internal const int Color10Id = 10;

				internal const int Color11Id = 11;

				internal const int Color12Id = 12;

				internal static readonly ConfigInfo<Color> Color1 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 1", "Section palette color 1.", new Color(0.8f, 0.8f, 0.8f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color2 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 2", "Section palette color 2.", Color.white, synchronized: false);

				internal static readonly ConfigInfo<Color> Color3 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 3", "Section palette color 3.", new Color(0.95f, 0.25f, 0.2f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color4 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 4", "Section palette color 4.", new Color(1f, 0.5f, 0.15f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color5 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 5", "Section palette color 5.", new Color(1f, 0.82f, 0.3f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color6 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 6", "Section palette color 6.", new Color(0.65f, 0.85f, 0.25f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color7 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 7", "Section palette color 7.", new Color(0.25f, 0.75f, 0.35f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color8 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 8", "Section palette color 8.", new Color(0.25f, 0.8f, 0.7f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color9 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 9", "Section palette color 9.", new Color(0.25f, 0.75f, 1f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color10 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 10", "Section palette color 10.", new Color(0.35f, 0.45f, 1f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color11 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 11", "Section palette color 11.", new Color(0.7f, 0.45f, 0.9f), synchronized: false);

				internal static readonly ConfigInfo<Color> Color12 = new ConfigInfo<Color>("7 - Prefab Collections", "Color 12", "Section palette color 12.", new Color(1f, 0.45f, 0.7f), synchronized: false);

				internal static readonly ConfigInfo<Color>[] Colors = new ConfigInfo<Color>[12]
				{
					Color1, Color2, Color3, Color4, Color5, Color6, Color7, Color8, Color9, Color10,
					Color11, Color12
				};

				internal static readonly ConfigInfo<int> UnassignedColorId = new ConfigInfo<int>("7 - Prefab Collections", "Unassigned Section Color ID", new ConfigDescription("Palette color ID for the Unassigned section.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 12), Array.Empty<object>()), 1, synchronized: false);
			}

			internal static class MobHighlight
			{
				internal const string Group = "6 - Mob Highlight";

				internal static readonly ConfigInfo<Toggle> Enabled = new ConfigInfo<Toggle>("6 - Mob Highlight", "Enable Mob Highlight", "Enable temporarily highlighting mobs with a visible nameplate.", Toggle.On);

				internal static readonly ConfigInfo<Toggle> OutlineEnabled = new ConfigInfo<Toggle>("6 - Mob Highlight", "Enable Mob Outline", "Draw an outline around highlighted mobs.", Toggle.On, synchronized: false);

				internal static readonly ConfigInfo<float> MobHighlightDuration = new ConfigInfo<float>("6 - Mob Highlight", "Mob Highlight Duration", new ConfigDescription("Seconds a highlighted mob's nameplate remains visible.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), Array.Empty<object>()), 10f);

				internal static readonly ConfigInfo<int> MaxHighlightedMobs = new ConfigInfo<int>("6 - Mob Highlight", "Max Highlighted Mobs", new ConfigDescription("Maximum number of mob or player nameplates highlighted at once per sending player. Highlighting another replaces only that player's oldest highlight.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()), 1);
			}

			internal static class Inputs
			{
				internal const string Group = "9 - Inputs";

				internal static readonly ConfigInfo<KeyboardShortcut> ToggleModShortcut = new ConfigInfo<KeyboardShortcut>("9 - Inputs", "Toggle Mod Shortcut", "Toggle all PingMark features.", new KeyboardShortcut((KeyCode)112, (KeyCode[])(object)new KeyCode[1] { (KeyCode)305 }), synchronized: false);

				internal static readonly ConfigInfo<KeyboardShortcut> PrefabEditorShortcut = new ConfigInfo<KeyboardShortcut>("9 - Inputs", "Prefab Editor Shortcut", "Press to open the prefab collection editor when its shortcut is enabled. With server-synced lists, only admins can edit.", new KeyboardShortcut((KeyCode)112, (KeyCode[])(object)new KeyCode[2]
				{
					(KeyCode)305,
					(KeyCode)303
				}), synchronized: false);

				internal static readonly ConfigInfo<KeyboardShortcut> MobHighlightShortcut = new ConfigInfo<KeyboardShortcut>("9 - Inputs", "Mob Highlight Shortcut", "Temporarily highlight a mob or enabled player under the camera crosshair, or ping the aimed location otherwise.", new KeyboardShortcut((KeyCode)122, Array.Empty<KeyCode>()), synchronized: false);

				internal static readonly ConfigInfo<Toggle> PrefabEditorShortcutEnabled = new ConfigInfo<Toggle>("9 - Inputs", "Enable Prefab Editor Shortcut", "Enable the Prefab Editor Shortcut.", Toggle.On, synchronized: false);
			}

			internal static class PlayerHighlight
			{
				internal const string Group = "8 - Player Highlight";

				internal static readonly ConfigInfo<float> Duration = new ConfigInfo<float>("8 - Player Highlight", "Player Highlight Duration", new ConfigDescription("Seconds a pinged player remains highlighted.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 120f), Array.Empty<object>()), 5f);

				internal static readonly ConfigInfo<Toggle> HideOwnOutline = new ConfigInfo<Toggle>("8 - Player Highlight", "Hide Own Player Outline", "Hide the outline on your own character when another player pings you. Other recipients still see your outline when player pinging is enabled.", Toggle.On);
			}

			internal static class CameraPing
			{
				internal const string Group = "3 - Camera Ping";

				internal static readonly ConfigInfo<float> MaxDistance = new ConfigInfo<float>("3 - Camera Ping", "Max Distance", new ConfigDescription("Maximum camera ping distance in meters. If nothing is hit, ping this far along the view direction.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 2000f), Array.Empty<object>()), 500f, synchronized: false);

				internal static readonly ConfigInfo<float> MaxUnderwaterDepth = new ConfigInfo<float>("3 - Camera Ping", "Max Underwater Depth", new ConfigDescription("Maximum depth in meters below the water surface at which objects can be pinged. Deeper targets ping the water surface instead.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()), 10f, synchronized: false);
			}

			internal static class PingTargets
			{
				internal const string Group = "4 - Ping Targets";

				internal static readonly ConfigInfo<string> PrefabSections = new ConfigInfo<string>("4 - Ping Targets", "Prefab Sections", "Section definitions managed in the Prefab Collections editor.", "Version: 1\r\nSections:\r\n- Name: Valuables\r\n  Prefabs: AshCrow, AshlandsBush2, Ashlands_floor_large_fractured, Ashlands_Fortress_Wall_PillarTopStone_frac, Ashlands_Fortress_Wall_PillarTop_frac, Ashlands_Fortress_Wall_Pillar_base_frac, Ashlands_Fortress_Wall_Pillar_frac, Barnacle, BarnacleLava, barrell, barreltrap, Beehive_Destruction, BlackIceShard_01, BlackIceShard_02, blackmarble_altar_crystal, blackmarble_post01, BlueberryBush, Bush01, Bush01_deepnorth, Bush01_heath, CargoCrate, CastleKit_brazier, caverock_ice_stalagmite, Charred_altar_bellfragment, Chest, cliff_ashlands1_frac, cliff_ashlands2_frac, cliff_ashlands4_frac, cliff_ashlands6_frac, cliff_ashlands7_HalfArch_frac, cliff_ashlandsflowrock_frac, cliff_ashlands_Arch_frac, cliff_mistlands1_creep_frac, cliff_mistlands1_frac, cliff_mistlands2_frac, cloth_hanging_door, cloth_hanging_long, CloudberryBush, Crow, dungeon_iron_pile, dvergrprops_barrel, DvergrProps_extractor_crate, dvergrprops_pickaxe, dvergrtown_wood_beam, dvergrtown_wood_pole, dvergrtown_wood_support, dvergrtown_wood_wall01, dvergrtown_wood_wall02, dvergrtown_wood_wall03, elaking_trashpile, fenrirhide_hanging, FernFiddleHeadAshlands, FlametalRockstand, FlametalRockstand_frac, giant_brain, giant_brain_frac, giant_helmet1, giant_helmet1_destruction, giant_helmet2, giant_helmet2_destruction, giant_ribs, giant_ribs_frac, giant_skull, giant_skull_frac, giant_sword1, giant_sword1_destruction, giant_sword2, giant_sword2_destruction, goblin_totempole, goblin_trashpile, goldvein, goldvein_frac, GraveStone_Broken_CharredTwitcherNest, GraveStone_CharredTwitcherNest, GraveStone_Elite_Broken_CharredTwitcherNest, GraveStone_Elite_CharredTwitcherNest, Greydwarf_Root, Greydwarf_Surprise, GuckSack, GuckSack_small, hanging_hairstrands, HeathRockPillar_frac, highstone_2_frac, highstone_frac, HoleRock_root1, HoleRock_rootBush1, HoleRock_rootFloor1, HugeRoot1, ice1, IcePond_rock_frac, IceShard_01, IceShard_02, IceShard_03, IceShard_04, IceShard_05, IceShard_06, IceShore, IceShore_frac, Ice_floor_fractured, ice_rock1, ice_rock1_frac, incinerator, IronOre_scraps, LargeBone, LargeBone_half01, LargeBone_half02, Leviathan, LeviathanLava, LingonberryBush, loot_chest_stone, loot_chest_wood, loot_deepNorth_Granary, loot_deepNorth_TimberHall, LuredFaderEmber, LuredWisp, marker01, marker02, MemorialStone_Large, MemorialStone_Medium, MemorialStone_Small, MineRock_Copper, MineRock_Iron, MineRock_Meteorite, MineRock_Meteorite_frac, MineRock_Obsidian, MineRock_Obsidian_frac, MineRock_Stone, MineRock_Tin, MineRock_Tin_frac, morgenhole_pile, Morkhalla_Bedroll1, Morkhalla_Bedroll2, Morkhalla_ChestAncient, Morkhalla_Eye1, Morkhalla_Eye2, Morkhalla_Eye3, Morkhalla_Eye4, Morkhalla_Eye5_gemstone, Morkhalla_Eye6_gemstone, Morkhalla_Eye7_gemstone, Morkhalla_Rubble1, Morkhalla_Rubble2, Morkhalla_Rubble3, Morkhalla_Rubble4, Morkhalla_rubble_trashpile, Morkhalla_Rug_corner, Morkhalla_Rug_end1, Morkhalla_Rug_end2, Morkhalla_Rug_middle, Morkhalla_Rug_stair, Morkhalla_WeaponStand, MountainGraveStone01, MountainKit_brazier, MountainKit_brazier_blue, mountainkit_chair, mountainkit_table, mudpile, mudpile2, mudpile2_frac, mudpile_beacon, mudpile_frac, mudpile_fragile, mudpile_old, Pickable_Ashstone, Pickable_Barley, Pickable_Barley_Wild, Pickable_BlackCoreStand, Pickable_Bloodbag, Pickable_BogIronOre, Pickable_Branch, Pickable_Branch_Snow, Pickable_Carrot, Pickable_Charredskull, Pickable_Dandelion, Pickable_DolmenTreasure, Pickable_DragonEgg, Pickable_DvergerThing, Pickable_DvergrLantern, Pickable_DvergrMineTreasure, Pickable_DvergrStein, Pickable_Fiddlehead, Pickable_Fishingrod, Pickable_Flax, Pickable_Flax_Wild, Pickable_Flint, Pickable_ForestCryptRandom, Pickable_ForestCryptRemains01, Pickable_ForestCryptRemains02, Pickable_ForestCryptRemains03, Pickable_ForestCryptRemains04, Pickable_FrostCoreHanger, Pickable_GlowWorm, Pickable_Guck, Pickable_Hairstrands, Pickable_Hairstrands01, Pickable_Hairstrands02, Pickable_HardRockOffspring, Pickable_Item, Pickable_Kale, Pickable_MeatPile, Pickable_MeatRemains, Pickable_Meteorite, Pickable_MoltenCoreStand, Pickable_MorkHallaTreasure, Pickable_MountainCaveCrystal, Pickable_MountainCaveObsidian, Pickable_MountainCaveRandom, Pickable_MountainRemains01_buried, Pickable_Mushroom, Pickable_Mushroom_blue, Pickable_Mushroom_JotunPuffs, Pickable_Mushroom_Magecap, Pickable_Mushroom_yellow, Pickable_Oat, Pickable_Obsidian, Pickable_Onion, Pickable_Poteitr, Pickable_Pot_Shard, Pickable_RandomFood, Pickable_RoyalJelly, Pickable_SeedCarrot, Pickable_SeedKale, Pickable_SeedOnion, Pickable_SeedTurnip, Pickable_SmokePuff, Pickable_Snowball, Pickable_Stone, Pickable_StoneRock, Pickable_SulfurRock, Pickable_SunkenCryptRandom, Pickable_SurtlingCoreStand, Pickable_Swordpiece1, Pickable_Swordpiece2, Pickable_Swordpiece3, Pickable_Tar, Pickable_TarBig, Pickable_Thistle, Pickable_Tin, Pickable_Turnip, Pickable_VoltureEgg, piece_beehive, piece_birdnest, piece_chest, piece_chest_barrel, piece_chest_blackmetal, piece_chest_grausten, piece_chest_private, piece_chest_warderobe, piece_chest_wood, piece_gift1, piece_gift2, piece_gift3, piece_pot1, piece_pot1_cracked, piece_pot1_red, piece_pot2, piece_pot2_cracked, piece_pot2_red, piece_pot3, piece_pot3_cracked, piece_pot3_red, piece_sapcollector, Placeable_Stone, PropFeastDeepNorth, prop_ashwood_bed, prop_bed02, prop_bonfire, prop_cauldron_ext1_spice, prop_cauldron_ext3_butchertable, prop_cauldron_ext5_mortarandpestle, prop_cauldron_ext6_rollingpins, prop_chest_warderobe, prop_FeastAshlands, prop_FeastMeadows, prop_forge_ext2, prop_forge_ext5, prop_hearth, prop_itemstand, prop_itemstand_TrophyDraugrElite, prop_itemstand_TrophyGoblinBrute, prop_itemstand_TrophyGoblinShaman, prop_itemstand_TrophyGreydwarf, prop_itemstand_TrophyGreydwarfBrute, prop_itemstand_TrophySeekerBrute, prop_piece_bench_runed, prop_piece_brazierfloor01, prop_piece_cauldron, prop_piece_chair03, prop_piece_cookingstation, prop_piece_MeadCauldron, prop_piece_workbench_ext1, prop_piece_workbench_ext2, prop_piece_workbench_ext3, prop_piece_workbench_ext4, prop_preptable, prop_Tankard, prop_wood_stack, RaspberryBush, rock1_mountain_frac, rock2_heath_frac, rock2_mountain_frac, rock3_ice_frac, rock3_mountain_1_frac, rock3_mountain_frac, rock3_silver, rock3_silver_frac, rock4_ashlands_frac, rock4_bigrock_frac, rock4_coast_frac, rock4_copper, rock4_copper_frac, rock4_forest_frac, rock4_heath_frac, RockFingerBroken_frac, RockFinger_frac, RockThumb_frac, Rock_3_deepnorth_frac, Rock_3_frac, Rock_destructible_test, rock_mistlands1_frac, root07, root08, root11, root12, Seagal, ShimmeringSand_rock_frac, shipwreck_karve_chest, shipwreck_vikingship_chest, shrub_2, shrub_2_heath, silvervein, silvervein_frac, stoneblock_fracture, stonechest, stonewall_2, stonewall_3, stubbe_spawner, StumpHut_frac, SulfurArch, tarlump1_frac, trader_wagon_destructable, TreasureChest_ashlands, TreasureChest_ashlands_fortress, TreasureChest_ashland_stone, TreasureChest_blackforest, TreasureChest_charredfortress, TreasureChest_deepnorth_village, TreasureChest_dvergrtower, TreasureChest_dvergrtown, TreasureChest_dvergr_loose_stone, TreasureChest_fCrypt, TreasureChest_forestcrypt, TreasureChest_forestcrypt_hildir, TreasureChest_heath, TreasureChest_heath_hildir, TreasureChest_meadows, TreasureChest_meadows_01, TreasureChest_meadows_02, TreasureChest_meadows_buried, TreasureChest_meadows_combat, TreasureChest_memorial_buried, TreasureChest_mistlands, TreasureChest_morkhalla, TreasureChest_mountaincave, TreasureChest_mountaincave_hildir, TreasureChest_mountains, TreasureChest_plains, TreasureChest_plainsfortress_hildir, TreasureChest_plains_stone, TreasureChest_sunkencrypt, TreasureChest_swamp, TreasureChest_trollcave, TrollFrost_Dead, TrollFrost_Frac, TrollFrost_Frac_arm, TrollFrost_Frac_legs, UnstableLavaRock, veg_skull_Ashlands, VineAsh, VineGreen, widestone_2_frac, widestone_frac, YggdrasilRoot\r\n  Enabled: true\r\n  ColorId: 5\r\n- Name: Locations\r\n  Prefabs: AbandonedLogCabin02, AbandonedLogCabin03, AbandonedLogCabin04, altar, AncientUpgradeStation, AshlandRuins, BearCave, BigRockClearing, BogWitch_Camp, Castle, CharredFortress, CharredRuins1, CharredRuins2, CharredRuins3, CharredRuins4, CharredTowerRuins1, CharredTowerRuins1_dvergr, CharredTowerRuins2, CharredTowerRuins3, CombatRuin01, Crypt3, Crypt4, DevBedchamber, DevCombatRange, DevCombatRing, DevDressingRoom, DevFloor1, DevForge, DevGarden, DevGround1, DevGround2, DevHouse1, DevHouse2, DevHouse3, DevHouse4, DevHouse5, DevHouseStart, DevKitchen, DevMageRoom, DevSoundTest, DevWall1, DevWall2, DevWallAsh, DG_Cave, DG_DvergrBoss, DG_DvergrTown, DG_ForestCrypt, DG_HalfBurried_ForestCrypt, DG_Hildir_Cave, DG_Hildir_ForestCrypt, DG_Hildir_PlainsFortress, DG_Hole, DG_MorkHalla, DG_SunkenCrypt, dirtfloor, DN_Bossroom, DN_hut01, Dolmen01, Dolmen02, Dolmen03, FimbulLocation01, Floor, forestcrypt_Bend1, forestcrypt_Bend2, forestcrypt_Corridor1, forestcrypt_Corridor2, forestcrypt_Corridor3, forestcrypt_EndCap, forestcrypt_EndCap2, forestcrypt_EndCap3, forestcrypt_entrance_large, forestcrypt_room1, Fort1, FortressRuins, FrozenShip01_DN, FrozenShip02_DN, FrozenShip03_DN, GoblinCamp1, GoblinCamp2, GoblinCamp2_1, GoblinHut01, GoblinHut02, GoblinHut03, Grave1, Greydwarf_camp2, Greydwarf_camp3, HalfBurried_ForestCrypt, Hildir_camp, Hildir_cave, Hildir_crypt, Hildir_plainsfortress, HotSpring1, HotSpring2, HotSpring3, Hugintest, IcePond1, InfestedTree01, LumberCamp, Maypole, Mistlands_DvergrBossEntrance1, Mistlands_DvergrTownEntrance1, Mistlands_DvergrTownEntrance2, Mistlands_Excavation1, Mistlands_Excavation2, Mistlands_Excavation3, Mistlands_Giant1, Mistlands_Giant2, Mistlands_GuardTower1_new, Mistlands_GuardTower1_ruined_new, Mistlands_GuardTower1_ruined_new2, Mistlands_GuardTower2_new, Mistlands_GuardTower3_new, Mistlands_GuardTower3_ruined_new, Mistlands_Harbour1, Mistlands_Lighthouse1_new, Mistlands_RockSpire1, Mistlands_Swords1, Mistlands_Swords2, Mistlands_Swords3, Mistlands_Viaduct1, Mistlands_Viaduct2, MorgenHole1, MorgenHole2, MorgenHole3, MorkBorg, MountainCave01, MountainCave02, MountainGrave01, MountainWell1, NorthMemorialPlace, NorthVillage, Pillar1, Pillar2, PlaceofMystery1, PlaceofMystery2, PlaceofMystery3, Props, Ruin1, Ruin2, Ruin3, shields, ShipSetting01, ShipSetting02, ShipSetting03, ShipWreck01, ShipWreck01_DN, ShipWreck02, ShipWreck02_DN, ShipWreck03, ShipWreck04, Skull1, StoneCircle, StoneHenge1, StoneHenge2, StoneHenge3, StoneHenge4, StoneHenge5, StoneHenge6, StoneHouse1, StoneHouse1_heath, StoneHouse2, StoneHouse2_heath, StoneHouse3, StoneHouse4, StoneHouse5, StoneHouse5_heath, StoneTower1, StoneTower2, StoneTower3, StoneTower4, StoneTowerRuins03, StoneTowerRuins04, StoneTowerRuins05, StoneTowerRuins05_leet, StoneTowerRuins07, StoneTowerRuins07_sunk, StoneTowerRuins08, StoneTowerRuins08_sunk, StoneTowerRuins09, StoneTowerRuins09_sunk, StoneTowerRuins10, StoneTowerRuins10_sunk, stonewall, SunkenCrypt1, SunkenCrypt2, SunkenCrypt3, SunkenCrypt4, SwampHut1, SwampHut1_1, SwampHut2, SwampHut2_1, SwampHut3, SwampHut3_1, SwampHut4, SwampHut5, SwampRuin1, SwampRuin2, SwampWell1, TarPit1, TarPit1_1, TarPit2, TarPit2_1, TarPit3, TarPit3_1, TheDarkestHole, TheHole01, TrollCave, TrollCave02, Vendor_BlackForest, Walls, WoodFarm1, WoodHouse1, WoodHouse10, WoodHouse11, WoodHouse12, WoodHouse13, WoodHouse2, WoodHouse3, WoodHouse4, WoodHouse5, WoodHouse6, WoodHouse7, WoodHouse8, WoodHouse9, WoodVillage1, WoodVillage2, xmastree\r\n  Enabled: true\r\n  ColorId: 9\r\n- Name: Useful\r\n  Prefabs: artisan_ext1, ashwood_bed, ashwood_door, BatteringRam, bed, blackforge, blackforge_ext1, blackforge_ext2_vise, blackforge_ext3_metalcutter, blackforge_ext4_gemcutter, blackforge_ext5_apron, BlackIce_Core, blastfurnace, BlobMorkBig, BogWitch, BogWitch_Fire_Pit, Bonemass, BonePileSpawner, BonePileSpawner_swamp, bonfire, BossStone_Bonemass, BossStone_DragonQueen, BossStone_Eikthyr, BossStone_Fader, BossStone_Moder, BossStone_TheElder, BossStone_TheQueen, BossStone_Yagluth, bow_projectile_fire, Candle_resin, Cart, CastleKit_groundtorch_unlit, Catapult, cauldron_ext1_spice, cauldron_ext3_butchertable, cauldron_ext4_pots, cauldron_ext5_mortarandpestle, cauldron_ext6_rollingpins, cauldron_ext7_smoker, caverock_ice_pillar_wall, CelestialShard, charcoal_kiln, CharredStone_Spawner, cloth_hanging_door_double, Crypt2, darkwood_gate, DN_gammeltrollFrac01, DN_gammeltrollFrac02, Dragonqueen, DrakeLorestone, DrakeNest01, dungeon_forestcrypt_door, dungeon_queen_door, dungeon_sunkencrypt_irongate, dvergrtown_secretdoor, dvergrtown_slidingdoor, Eikthyrnir, eitrrefinery, EvilHeart_Forest, EvilHeart_Swamp, FaderLocation, fader_bellholder, fermenter, Fire, FireHole, fire_pit, fire_pit_haldor, fire_pit_hildir, fire_pit_iron, flametal_gate, forestcrypt_new_Burialchamber04, forge, forge_ext1, forge_ext2, forge_ext3, forge_ext4, forge_ext5, forge_ext6, FrozenGD, FrozenSkeleton_Pose1, FrozenSkeleton_Pose2, fuling_turret, GDKing, GoblinKing, GrapplingPoint, GrapplingPointSecondary, GraveStone_Broken_World, Greydwarf_camp1, Haldor, hearth, Hildir, HildirChest1, HildirChest2, HildirChest3, HoleRock_rootWall1, hole_destructableDoor, hole_destructableDoor1, hole_destructableDoor2, HouseFire, iron_grate, Karve, LavaRock, LootSpawner_pineforest, Mistlands_RoadPost1, Mistlands_Statue1, Mistlands_Statue2, Mistlands_StatueGroup1, Morkborg_gate, Morkhalla_Drawbridge, Morkhalla_firepit, Morkhalla_jotun_gate, MountainKit_wood_gate, offeraltar_FrozenKing_bossroom, piece_artisanstation, piece_bathtub, piece_bed02, piece_brazierceiling01, piece_brazierfloor01, piece_brazierfloor02, piece_cartographytable, piece_cauldron, piece_Charred_Balista, piece_cookingstation, piece_cookingstation_iron, piece_drawbridge, piece_drawbridge_log, piece_dvergr_wood_door, piece_EternalPyre, piece_FaderEmbers, piece_FrostFoundry, piece_FrostKiln, piece_groundtorch, piece_groundtorch_blue, piece_groundtorch_green, piece_groundtorch_wood, piece_hexagonal_door, piece_jackoturnip, piece_magetable, piece_magetable_ext, piece_magetable_ext2, piece_magetable_ext3, piece_magetable_ext4, piece_MeadCauldron, piece_oven, piece_preptable, piece_snowlantern, piece_spinningwheel, piece_stonecutter, piece_turret, piece_walltorch, piece_wisplure, piece_workbench, piece_workbench_ext1, piece_workbench_ext2, piece_workbench_ext3, piece_workbench_ext4, portal, portal_stone, portal_wood, projectile_meteor, Raft, Runestone_Ashlands, Runestone_BlackForest, Runestone_Boars, Runestone_DeepNorth, Runestone_Draugr, Runestone_Greydwarfs, Runestone_Meadows, Runestone_Mistlands, Runestone_Mountains, Runestone_Plains, Runestone_Swamps, Sled, smelter, Spawner_Bat, Spawner_Bjorn_sleeping, Spawner_Blob, Spawner_BlobElite, Spawner_BlobTar, Spawner_BlobTar_respawn_30, Spawner_Boar, Spawner_BogWitchKvastur_respawn_30, Spawner_Brood, Spawner_Charred, Spawner_CharredCross, Spawner_CharredStone, Spawner_CharredStone_Elite, Spawner_CharredStone_event, Spawner_Charred_Archer, Spawner_Charred_balista, Spawner_Charred_Dyrnwyn, Spawner_Charred_Mage, Spawner_Chicken, Spawner_Cultist, Spawner_Cultist_Hildir, Spawner_Cultist_Hildir_bossroom, Spawner_Draugr, Spawner_DraugrPile, Spawner_Draugr_Elite, Spawner_Draugr_Noise, Spawner_Draugr_Ranged, Spawner_Draugr_Ranged_Noise, Spawner_Draugr_respawn_30, Spawner_DvergerArbalest, Spawner_DvergerAshlands, Spawner_DvergerDeepNorth, Spawner_DvergerMage, Spawner_DvergerRandom, Spawner_ElakingMole_Wakeup, Spawner_FallenValkyrie, Spawner_Fenring, Spawner_Fish4, Spawner_Frysling, Spawner_Frysling_respawn_30, Spawner_Ghost, Spawner_Ghost_sleeping, Spawner_Ghost_Void, Spawner_Goblin, Spawner_GoblinArcher, Spawner_GoblinBrute, Spawner_GoblinBrute_Hildir, Spawner_GoblinDeepNorth, Spawner_GoblinShaman, Spawner_Greydwarf, Spawner_GreydwarfNest, Spawner_Greydwarf_Elite, Spawner_Greydwarf_Shaman, Spawner_Greydwarf_Surprise, Spawner_Hatchling, Spawner_Hen, Spawner_Hole, Spawner_Hole_double, Spawner_imp, Spawner_imp_respawn, Spawner_JotunDualWield, Spawner_JotunWarrior, Spawner_JotunWitch, Spawner_Kvastur, Spawner_Leech_cave, Spawner_Location_Elite, Spawner_Location_Greydwarf, Spawner_Location_Shaman, Spawner_Morgen, Spawner_Morgen_wakeup, Spawner_Seeker, Spawner_SeekerBrute, Spawner_SeekerBrute_respawn_240, Spawner_Seeker_respawn_240, Spawner_ShadowPerson, Spawner_Skeleton, Spawner_Skeleton_hildir, Spawner_Skeleton_hildir_bossroom, Spawner_Skeleton_Meadows, Spawner_Skeleton_Meadows_night_noarcher, Spawner_Skeleton_Mountains, Spawner_Skeleton_Mountains_night_noarcher, Spawner_Skeleton_night_noarcher, Spawner_Skeleton_poison, Spawner_Skeleton_respawn_30, Spawner_Skeleton_rise, Spawner_Skeleton_Swamp, Spawner_Skeleton_Swamp_night_noarcher, Spawner_StoneGolem, Spawner_Tick, Spawner_Tick_stared, Spawner_Tick_stared_respawn_240, Spawner_Troll, Spawner_TrollFrost, Spawner_Twitcher, Spawner_Ulv, Spawner_Volture, Spawner_Wraith, Spawner_Writhan, staff_fireball_projectile, StartPlatform, StartTemple, StatueEvil, stave_gate, sunken_crypt_gate, Trailership, TriggerSpawner_Brood, TriggerSpawner_Seeker, Troll_Summoned, UpgradeStation, Vegvisir_Bonemass, Vegvisir_DNBoss, Vegvisir_Eikthyr, Vegvisir_Fader, Vegvisir_GDKing, Vegvisir_Hildir_Cave, Vegvisir_Hildir_Crypt, Vegvisir_Hildir_Tower, Vegvisir_Moder, Vegvisir_Queen, Vegvisir_Yagluth, VikingShip, VikingShip_Ashlands, VoltureNest, Waymarker01, Waymarker02, windmill, wood_door, wood_fence_gate, wood_gate, wood_window\r\n  Enabled: true\r\n  ColorId: 8");

				internal static readonly ConfigInfo<Toggle> DropsEnabled = new ConfigInfo<Toggle>("4 - Ping Targets", "Enable Drops", "Outline and name pinged dropped items (weapons, armor, materials on the ground).", Toggle.On);

				internal static readonly ConfigInfo<Toggle> GravestonesEnabled = new ConfigInfo<Toggle>("4 - Ping Targets", "Enable Gravestones", "Outline and name pinged gravestones.", Toggle.On);

				internal static readonly ConfigInfo<Toggle> PlayersEnabled = new ConfigInfo<Toggle>("4 - Ping Targets", "Enable Other Players", "Temporarily highlight pinged players instead of sending a ground ping. Player nameplates show distance when Show Distance is on.", Toggle.Off);

				internal static readonly ConfigInfo<float> PlayerHighlightDuration = PlayerHighlight.Duration;

				internal static readonly ConfigInfo<Toggle> HideOwnPlayerOutline = PlayerHighlight.HideOwnOutline;

				internal static readonly ConfigInfo<Toggle> OthersEnabled = new ConfigInfo<Toggle>("4 - Ping Targets", "Enable All Other", "Outline and name any other pinged model that is not in the lists or a dropped item.", Toggle.Off);
			}
		}
	}
	internal static class PluginConfig
	{
		private static ConfigEntry<Toggle> _serverConfigLocked = null;

		internal static ConfigEntry<Toggle> Enabled = null;

		internal static ConfigEntry<float> RefreshInterval = null;

		internal static ConfigEntry<float> PingCooldown = null;

		internal static ConfigEntry<float> ZPingBroadcastDistance = null;

		internal static ConfigEntry<Toggle> SendZPingsToUnmoddedPlayers = null;

		internal static ConfigEntry<Toggle> DebugPrefabId = null;

		internal static ConfigEntry<Toggle> ShowPingerName = null;

		internal static ConfigEntry<Toggle> ShowDistance = null;

		internal static ConfigEntry<string> EmptyLabelText = null;

		internal static ConfigEntry<Toggle> UseKilometers = null;

		internal static ConfigEntry<Toggle> ShowTargetName = null;

		internal static ConfigEntry<Color> PingColor = null;

		internal static ConfigEntry<Toggle> MatchTextToOutline = null;

		internal static ConfigEntry<float> CameraPingMaxDistance = null;

		internal static ConfigEntry<float> MaxUnderwaterDepth = null;

		internal static ConfigEntry<string> PrefabSections = null;

		internal static ConfigEntry<Toggle> DropsEnabled = null;

		internal static ConfigEntry<Toggle> GravestonesEnabled = null;

		internal static ConfigEntry<Toggle> PlayersEnabled = null;

		internal static ConfigEntry<float> PlayerHighlightDuration = null;

		internal static ConfigEntry<Toggle> HideOwnPlayerOutline = null;

		internal static ConfigEntry<Toggle> OthersEnabled = null;

		internal static ConfigEntry<Toggle> PingOutlineEnabled = null;

		internal static ConfigEntry<float> OutlineWidth = null;

		internal static ConfigEntry<Color> PingDropColor = null;

		internal static ConfigEntry<Color> PingPlayerColor = null;

		internal static ConfigEntry<Color> PingAnythingColor = null;

		internal static ConfigEntry<Color> HostileOutlineColor = null;

		internal static ConfigEntry<Color> AllyOutlineColor = null;

		internal static ConfigEntry<Color>[] PrefabSectionColors = Array.Empty<ConfigEntry<Color>>();

		internal static ConfigEntry<int> UnassignedSectionColorId = null;

		internal static ConfigEntry<Toggle> MobHighlightEnabled = null;

		internal static ConfigEntry<Toggle> MobOutlineEnabled = null;

		internal static ConfigEntry<float> MobHighlightDuration = null;

		internal static ConfigEntry<int> MaxHighlightedMobs = null;

		internal static ConfigEntry<KeyboardShortcut> ToggleModShortcut = null;

		internal static ConfigEntry<KeyboardShortcut> PrefabEditorShortcut = null;

		internal static ConfigEntry<KeyboardShortcut> MobHighlightShortcut = null;

		internal static ConfigEntry<Toggle> PrefabEditorShortcutEnabled = null;

		internal static void Build(ConfigFile config, ConfigSync configSync)
		{
			ConfigOptions.Initialize(config, configSync);
			_serverConfigLocked = ConfigOptions.Config(Constants.Groups.General.Lock);
			configSync.AddLockingConfigEntry<Toggle>(_serverConfigLocked);
			Enabled = ConfigOptions.Config(Constants.Groups.General.Enabled);
			RefreshInterval = ConfigOptions.Config(Constants.Groups.General.RefreshInterval);
			PingCooldown = ConfigOptions.Config(Constants.Groups.General.PingCooldown);
			ZPingBroadcastDistance = ConfigOptions.Config(Constants.Groups.General.ZPingBroadcastDistance);
			SendZPingsToUnmoddedPlayers = ConfigOptions.Config(Constants.Groups.General.SendZPingsToUnmoddedPlayers);
			DebugPrefabId = ConfigOptions.Config(Constants.Groups.General.DebugPrefabId);
			ShowPingerName = ConfigOptions.Config(Constants.Groups.PingLabel.ShowPingerName);
			ShowDistance = ConfigOptions.Config(Constants.Groups.PingLabel.ShowDistance);
			EmptyLabelText = ConfigOptions.Config(Constants.Groups.PingLabel.EmptyLabelText);
			UseKilometers = ConfigOptions.Config(Constants.Groups.PingLabel.UseKilometers);
			ShowTargetName = ConfigOptions.Config(Constants.Groups.PingLabel.ShowTargetName);
			PingColor = ConfigOptions.Config(Constants.Groups.PingLabel.PingColor);
			MatchTextToOutline = ConfigOptions.Config(Constants.Groups.PingLabel.MatchTextToOutline);
			CameraPingMaxDistance = ConfigOptions.Config(Constants.Groups.CameraPing.MaxDistance);
			MaxUnderwaterDepth = ConfigOptions.Config(Constants.Groups.CameraPing.MaxUnderwaterDepth);
			PrefabSections = ConfigOptions.Config(Constants.Groups.PingTargets.PrefabSections);
			DropsEnabled = ConfigOptions.Config(Constants.Groups.PingTargets.DropsEnabled);
			GravestonesEnabled = ConfigOptions.Config(Constants.Groups.PingTargets.GravestonesEnabled);
			PlayersEnabled = ConfigOptions.Config(Constants.Groups.PingTargets.PlayersEnabled);
			PlayerHighlightDuration = ConfigOptions.Config(Constants.Groups.PlayerHighlight.Duration, "4 - Ping Targets");
			HideOwnPlayerOutline = ConfigOptions.Config(Constants.Groups.PlayerHighlight.HideOwnOutline, "4 - Ping Targets");
			OthersEnabled = ConfigOptions.Config(Constants.Groups.PingTargets.OthersEnabled);
			PingOutlineEnabled = ConfigOptions.Config(Constants.Groups.Outlines.PingOutlineEnabled);
			OutlineWidth = ConfigOptions.Config(Constants.Groups.Outlines.OutlineWidth);
			PingDropColor = ConfigOptions.Config(Constants.Groups.Outlines.PingDropColor);
			PingPlayerColor = ConfigOptions.Config(Constants.Groups.Outlines.PingPlayerColor);
			PingAnythingColor = ConfigOptions.Config(Constants.Groups.Outlines.PingAnythingColor);
			HostileOutlineColor = ConfigOptions.Config(Constants.Groups.Outlines.HostileOutlineColor);
			AllyOutlineColor = ConfigOptions.Config(Constants.Groups.Outlines.AllyOutlineColor);
			PrefabSectionColors = new ConfigEntry<Color>[12]
			{
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color1),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color2),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color3),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color4),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color5),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color6),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color7),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color8),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color9),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color10),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color11),
				ConfigOptions.Config(Constants.Groups.PrefabCollections.Color12)
			};
			UnassignedSectionColorId = ConfigOptions.Config(Constants.Groups.PrefabCollections.UnassignedColorId);
			MobHighlightEnabled = ConfigOptions.Config(Constants.Groups.MobHighlight.Enabled);
			MobOutlineEnabled = ConfigOptions.Config(Constants.Groups.MobHighlight.OutlineEnabled);
			MobHighlightDuration = ConfigOptions.Config(Constants.Groups.MobHighlight.MobHighlightDuration);
			MaxHighlightedMobs = ConfigOptions.Config(Constants.Groups.MobHighlight.MaxHighlightedMobs);
			ToggleModShortcut = ConfigOptions.Config(Constants.Groups.Inputs.ToggleModShortcut);
			PrefabEditorShortcut = ConfigOptions.Config(Constants.Groups.Inputs.PrefabEditorShortcut);
			MobHighlightShortcut = ConfigOptions.Config(Constants.Groups.Inputs.MobHighlightShortcut);
			PrefabEditorShortcutEnabled = ConfigOptions.Config(Constants.Groups.Inputs.PrefabEditorShortcutEnabled);
		}

		internal static Color GetPrefabSectionColor(int colorId)
		{
			//IL_0028: 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)
			if (PrefabSectionColors.Length == 0)
			{
				return Color.white;
			}
			int num = Mathf.Clamp(colorId - 1, 0, PrefabSectionColors.Length - 1);
			return PrefabSectionColors[num].Value;
		}
	}
}
namespace JoksterCube.PingMark.Patches.ZPing
{
	[HarmonyPatch(typeof(ZRoutedRpc), "RouteRPC")]
	internal static class ZPingServerRoutingPatch
	{
		private static bool Prefix(RoutedRPCData rpcData)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			ZNet instance = ZNet.instance;
			if (!Object.op_Implicit((Object)(object)instance) || !instance.IsServer() || rpcData.m_targetPeerID != 0L || !((ZDOID)(ref rpcData.m_targetZDO)).IsNone())
			{
				return true;
			}
			bool flag = false;
			if (rpcData.m_methodHash == StringExtensionMethods.GetStableHashCode("ChatMessage"))
			{
				rpcData.m_parameters.SetPos(0);
				rpcData.m_parameters.ReadVector3();
				int num = rpcData.m_parameters.ReadInt();
				new UserInfo().Deserialize(ref rpcData.m_parameters);
				string text = rpcData.m_parameters.ReadString();
				rpcData.m_parameters.SetPos(0);
				if (num != 3 || text != "JoksterCube.PingMark.ZPingFallback")
				{
					return true;
				}
				if (!PluginConfig.SendZPingsToUnmoddedPlayers.IsOn())
				{
					return false;
				}
				flag = true;
			}
			else if (rpcData.m_methodHash != StringExtensionMethods.GetStableHashCode("JoksterCube.PingMark.ZLocationPing") && rpcData.m_methodHash != StringExtensionMethods.GetStableHashCode("JoksterCube.PingMark.ZMobPing") && rpcData.m_methodHash != StringExtensionMethods.GetStableHashCode("JoksterCube.PingMark.ZPlayerPing"))
			{
				return true;
			}
			rpcData.m_parameters.SetPos(0);
			Vector3 origin = rpcData.m_parameters.ReadVector3();
			rpcData.m_parameters.SetPos(0);
			ZNetPeer peer = instance.GetPeer(rpcData.m_senderPeerID);
			if (peer != null)
			{
				origin = peer.m_refPos;
			}
			ZPackage val = new ZPackage();
			rpcData.Serialize(val);
			foreach (ZNetPeer connectedPeer in instance.GetConnectedPeers())
			{
				if (connectedPeer.m_uid == rpcData.m_senderPeerID || !connectedPeer.IsReady())
				{
					continue;
				}
				bool flag2 = RpcHandlers.ValidatedPeers.Contains(connectedPeer.m_rpc);
				bool num2;
				if (!flag)
				{
					if (!flag2)
					{
						continue;
					}
					num2 = ZPingNetwork.IsInRange(origin, connectedPeer.m_refPos, PluginConfig.ZPingBroadcastDistance.Value);
				}
				else
				{
					num2 = !flag2;
				}
				if (num2)
				{
					connectedPeer.m_rpc.Invoke("RoutedRPC", new object[1] { val });
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Chat), "RPC_ChatMessage")]
	internal static class ZPingVanillaFallbackPatch
	{
		private static bool Prefix(int type, string text)
		{
			if (type == 3)
			{
				return text != "JoksterCube.PingMark.ZPingFallback";
			}
			return true;
		}
	}
}
namespace JoksterCube.PingMark.Patches.PrefabEditor
{
	[HarmonyPatch(typeof(Menu), "IsActive")]
	internal static class PrefabEditorActivePatch
	{
		private static void Postfix(ref bool __result)
		{
			__result |= PrefabCollectionEditor.BlocksInput;
		}
	}
	[HarmonyPatch(typeof(Menu), "Update")]
	internal static class PrefabEditorMenuInputPatch
	{
		private static bool Prefix()
		{
			return !PrefabCollectionEditor.BlocksInput;
		}
	}
	[HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")]
	internal static class PrefabEditorMouseCapturePatch
	{
		private static bool Prefix()
		{
			if (!PrefabCollectionEditor.IsOpen)
			{
				return true;
			}
			PrefabCollectionEditor.ReleaseMouse();
			return false;
		}
	}
	[HarmonyPatch(typeof(Menu), "IsVisible")]
	internal static class PrefabEditorVisiblePatch
	{
		private static void Postfix(ref bool __result)
		{
			__result |= PrefabCollectionEditor.BlocksInput;
		}
	}
}
namespace JoksterCube.PingMark.Patches.MobHighlight
{
	[HarmonyPatch(typeof(EnemyHud), "LateUpdate")]
	internal static class MobHighlightNamePatch
	{
		private static readonly Dictionary<TMP_Text, string> OriginalNames = new Dictionary<TMP_Text, string>();

		private static readonly Dictionary<TMP_Text, TMP_Text> PlayerLabels = new Dictionary<TMP_Text, TMP_Text>();

		private static readonly Dictionary<TMP_Text, List<(Transform Transform, Vector3 Position)>> OriginalMarkers = new Dictionary<TMP_Text, List<(Transform, Vector3)>>();

		private static readonly Dictionary<TMP_Text, string> Distances = new Dictionary<TMP_Text, string>();

		private static readonly Dictionary<TMP_Text, (ZDOID Id, long Order, string Distance, bool ShowName, bool ShowDistance, string Text)> Labels = new Dictionary<TMP_Text, (ZDOID, long, string, bool, bool, string)>();

		private static readonly Dictionary<TMP_Text, (Bounds Bounds, Rect Rect)> NameLayouts = new Dictionary<TMP_Text, (Bounds, Rect)>();

		private static readonly Dictionary<TMP_Text, (TMP_Text Label, TMP_FontAsset? Font, float Size, bool Auto, float Min, float Max, FontStyles Style, float Line, float Character, float Word, float Paragraph, float Width)> LabelStyles = new Dictionary<TMP_Text, (TMP_Text, TMP_FontAsset, float, bool, float, float, FontStyles, float, float, float, float, float)>();

		private static readonly List<TMP_Text> Expired = new List<TMP_Text>();

		private static float _distanceTimer;

		private static void Prefix(Dictionary<Character, HudData> ___m_huds)
		{
			foreach (KeyValuePair<Character, HudData> ___m_hud in ___m_huds)
			{
				if (JoksterCube.PingMark.Domain.MobHighlight.IsMarked(___m_hud.Key))
				{
					___m_hud.Value.m_hoverTimer = 0f;
				}
			}
		}

		private static void Postfix(Dictionary<Character, HudData> ___m_huds)
		{
			//IL_01b6: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: 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_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0608: Unknown result type (might be due to invalid IL or missing references)
			//IL_0619: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			_distanceTimer += Time.deltaTime;
			if (_distanceTimer >= PluginConfig.RefreshInterval.Value)
			{
				_distanceTimer = 0f;
				Distances.Clear();
			}
			Player localPlayer = Player.m_localPlayer;
			Vector2 val5 = default(Vector2);
			foreach (KeyValuePair<Character, HudData> ___m_hud in ___m_huds)
			{
				TMP_Text name = (TMP_Text)(object)___m_hud.Value.m_name;
				if (!Object.op_Implicit((Object)(object)name))
				{
					continue;
				}
				if (!JoksterCube.PingMark.Domain.MobHighlight.IsMarked(___m_hud.Key))
				{
					if (OriginalNames.TryGetValue(name, out string value))
					{
						name.text = value;
						OriginalNames.Remove(name);
					}
					if (PlayerLabels.TryGetValue(name, out TMP_Text value2))
					{
						if (Object.op_Implicit((Object)(object)value2))
						{
							Object.Destroy((Object)(object)((Component)value2).gameObject);
						}
						PlayerLabels.Remove(name);
					}
					if (OriginalMarkers.TryGetValue(name, out List<(Transform, Vector3)> value3))
					{
						foreach (var (val, localPosition) in value3)
						{
							if (Object.op_Implicit((Object)(object)val))
							{
								val.localPosition = localPosition;
							}
						}
						OriginalMarkers.Remove(name);
					}
					Distances.Remove(name);
					Labels.Remove(name);
					NameLayouts.Remove(name);
					LabelStyles.Remove(name);
					continue;
				}
				if (!OriginalNames.TryGetValue(name, out string value4))
				{
					value4 = (OriginalNames[name] = name.text);
				}
				if (!Object.op_Implicit((Object)(object)localPlayer))
				{
					continue;
				}
				if (!Distances.TryGetValue(name, out string value5))
				{
					value5 = (Distances[name] = PingMarkLabels.FormatDistance(((Component)___m_hud.Key).transform.position, localPlayer));
				}
				if (name.text != value4)
				{
					name.text = value4;
				}
				if (Object.op_Implicit((Object)(object)PingMarkLabels.MapFont) && (!PlayerLabels.TryGetValue(name, out TMP_Text value6) || !Object.op_Implicit((Object)(object)value6)))
				{
					RectTransform rectTransform = name.rectTransform;
					GameObject val2 = Object.Instantiate<GameObject>(((Component)name).gameObject, name.transform.parent, false);
					((Object)val2).name = ((Object)((Component)name).gameObject).name + " PingMark";
					TMP_Text component = val2.GetComponent<TMP_Text>();
					RectTransform rectTransform2 = component.rectTransform;
					TMP_Text val3 = PingMarkLabels.MapLabelTemplate ?? name;
					float y = val3.GetPreferredValues("Mg").y;
					List<(Transform, Vector3)> list = new List<(Transform, Vector3)>();
					Transform[] array = new Transform[2];
					RectTransform alerted = ___m_hud.Value.m_alerted;
					array[0] = ((alerted != null) ? ((Component)alerted).transform : null);
					RectTransform aware = ___m_hud.Value.m_aware;
					array[1] = ((aware != null) ? ((Component)aware).transform : null);
					Transform[] array2 = (Transform[])(object)array;
					foreach (Transform val4 in array2)
					{
						if (Object.op_Implicit((Object)(object)val4))
						{
							list.Add((val4, val4.localPosition));
							val4.localPosition += Vector3.up * (y * 2f);
						}
					}
					OriginalMarkers[name] = list;
					((Transform)rectTransform2).SetParent((Transform)(object)rectTransform, false);
					rectTransform2.anchorMin = rectTransform.pivot;
					rectTransform2.anchorMax = rectTransform.pivot;
					rectTransform2.pivot = new Vector2(0.5f, 0f);
					Rect rect = rectTransform.rect;
					rectTransform2.sizeDelta = new Vector2(((Rect)(ref rect)).width, y * 2f);
					((Transform)rectTransform2).localScale = Vector3.one;
					for (int j = 0; j < val2.transform.childCount; j++)
					{
						((Component)val2.transform.GetChild(j)).gameObject.SetActive(false);
					}
					component.font = PingMarkLabels.MapFont;
					component.fontSize = val3.fontSize;
					component.enableAutoSizing = val3.enableAutoSizing;
					component.fontSizeMin = val3.fontSizeMin;
					component.fontSizeMax = val3.fontSizeMax;
					component.fontStyle = val3.fontStyle;
					component.alignment = (TextAlignmentOptions)1026;
					component.lineSpacing = val3.lineSpacing;
					component.characterSpacing = val3.characterSpacing;
					component.wordSpacing = val3.wordSpacing;
					component.paragraphSpacing = val3.paragraphSpacing;
					((Graphic)component).color = Color.white;
					((Graphic)component).raycastTarget = false;
					PlayerLabels[name] = component;
				}
				if (PlayerLabels.TryGetValue(name, out TMP_Text value7) && Object.op_Implicit((Object)(object)value7))
				{
					ZDOID zDOID = ___m_hud.Key.GetZDOID();
					long pingerOrder = JoksterCube.PingMark.Domain.MobHighlight.GetPingerOrder(___m_hud.Key);
					bool flag = PluginConfig.ShowPingerName.IsOn();
					bool flag2 = PluginConfig.ShowDistance.IsOn();
					if (!Labels.TryGetValue(name, out (ZDOID, long, string, bool, bool, string) value8) || !((ZDOID)(ref value8.Item1)).Equals(zDOID) || value8.Item2 != pingerOrder || value8.Item3 != value5 || value8.Item4 != flag || value8.Item5 != flag2)
					{
						string characterLabel = PingMarkLabels.GetCharacterLabel(___m_hud.Key, value5);
						value8 = (Labels[name] = (zDOID, pingerOrder, value5, flag, flag2, characterLabel));
					}
					if (value7.text != value8.Item6)
					{
						value7.text = value8.Item6;
					}
					bool flag3 = value8.Item6.Length > 0;
					if (((Component)value7).gameObject.activeSelf != flag3)
					{
						((Component)value7).gameObject.SetActive(flag3);
					}
					UpdateLabelStyle(name, value7);
					Rect rect2 = name.rectTransform.rect;
					if (!NameLayouts.TryGetValue(name, out (Bounds, Rect) value9) || name.havePropertiesChanged || value9.Item2 != rect2)
					{
						name.ForceMeshUpdate(false, false);
						value9 = (NameLayouts[name] = (name.textBounds, rect2));
					}
					((Vector2)(ref val5))..ctor(((Bounds)(ref value9.Item1)).center.x, ((Bounds)(ref value9.Item1)).max.y + 2f);
					if (value7.rectTransform.anchoredPosition != val5)
					{
						value7.rectTransform.anchoredPosition = val5;
					}
				}
			}
			foreach (TMP_Text key in OriginalNames.Keys)
			{
				if (!Object.op_Implicit((Object)(object)key))
				{
					Expired.Add(key);
				}
			}
			foreach (TMP_Text item in Expired)
			{
				if (PlayerLabels.TryGetValue(item, out TMP_Text value10) && Object.op_Implicit((Object)(object)value10))
				{
					Object.Destroy((Object)(object)((Component)value10).gameObject);
				}
				OriginalNames.Remove(item);
				PlayerLabels.Remove(item);
				OriginalMarkers.Remove(item);
				Distances.Remove(item);
				Labels.Remove(item);
				NameLayouts.Remove(item);
				LabelStyles.Remove(item);
			}
			Expired.Clear();
		}

		private static void UpdateLabelStyle(TMP_Text name, TMP_Text label)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			TMP_Text val = PingMarkLabels.MapLabelTemplate ?? name;
			TMP_FontAsset? mapFont = PingMarkLabels.MapFont;
			float fontSize = val.fontSize;
			bool enableAutoSizing = val.enableAutoSizing;
			float fontSizeMin = val.fontSizeMin;
			float fontSizeMax = val.fontSizeMax;
			FontStyles fontStyle = val.fontStyle;
			float lineSpacing = val.lineSpacing;
			float characterSpacing = val.characterSpacing;
			float wordSpacing = val.wordSpacing;
			float paragraphSpacing = val.paragraphSpacing;
			Rect rect = name.rectTransform.rect;
			(TMP_Text, TMP_FontAsset, float, bool, float, float, FontStyles, float, float, float, float, float) tuple = (label, mapFont, fontSize, enableAutoSizing, fontSizeMin, fontSizeMax, fontStyle, lineSpacing, characterSpacing, wordSpacing, paragraphSpacing, ((Rect)(ref rect)).width);
			if (LabelStyles.TryGetValue(name, out (TMP_Text, TMP_FontAsset, float, bool, float, float, FontStyles, float, float, float, float, float) value) && value.Equals(tuple))
			{
				return;
			}
			LabelStyles[name] = tuple;
			label.font = PingMarkLabels.MapFont;
			label.fontSize = val.fontSize;
			label.enableAutoSizing = val.enableAutoSizing;
			label.fontSizeMin = val.fontSizeMin;
			label.fontSizeMax = val.fontSizeMax;
			label.fontStyle = val.fontStyle;
			label.lineSpacing = val.lineSpacing;
			label.characterSpacing = val.characterSpacing;
			label.wordSpacing = val.wordSpacing;
			label.paragraphSpacing = val.paragraphSpacing;
			float y = val.GetPreferredValues("Mg").y;
			RectTransform rectTransform = label.rectTransform;
			rect = name.rectTransform.rect;
			rectTransform.sizeDelta = new Vector2(((Rect)(ref rect)).width, y * 2f);
			if (!OriginalMarkers.TryGetValue(name, out List<(Transform, Vector3)> value2))
			{
				return;
			}
			foreach (var (val2, val3) in value2)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.localPosition = val3 + Vector3.up * (y * 2f);
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyHud), "TestShow")]
	internal static class MobHighlightVisibilityPatch
	{
		private static void Postfix(Character __0, ref bool __result)
		{
			if (JoksterCube.PingMark.Domain.MobHighlight.IsMarked(__0))
			{
				__result = true;
			}
		}
	}
}
namespace JoksterCube.PingMark.Patches.GroundPing
{
	[HarmonyPatch(typeof(Chat), "AddInworldText")]
	internal static class GroundPingAddLabelPatch
	{
		private static void Prefix(string text, out string __state)
		{
			__state = text;
		}

		private static void Postfix(long senderID, Vector3 position, Type type, string __state, List<WorldTextInstance> ___m_worldTexts)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Invalid comparison between Unknown and I4
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Invalid comparison between Unknown and I4
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			string text = __state;
			WorldTextInstance val = ___m_worldTexts.Find((WorldTextInstance world) => world.m_talkerID == senderID);
			if (val == null)
			{
				return;
			}
			OutlineManager.SetPingTarget(val, null);
			if (!PluginConfig.Enabled.IsOn())
			{
				GroundPingLabelAnchors.Anchors.Remove(val);
				return;
			}
			if ((int)type == 3)
			{
				GroundPingLabelAnchors.Anchors[val] = position;
			}
			else
			{
				GroundPingLabelAnchors.Anchors.Remove(val);
			}
			if ((int)type == 3 && Object.op_Implicit((Object)(object)ZNet.instance) && senderID == ZNet.GetUID() && MobTargeting.TryConsumeGroundPing(position, out string targetName, out PingTarget? target))
			{
				OutlineManager.SetPingTarget(val, target ?? PingTargetResolver.FindTarget(position));
				if (!string.IsNullOrWhiteSpace(targetName))
				{
					text = targetName;
				}
			}
			else if ((int)type == 3)
			{
				OutlineManager.SetPingTarget(val, PingTargetResolver.FindTarget(position));
			}
			if ((int)type == 3 && !string.IsNullOrWhiteSpace(text))
			{
				val.m_text = text;
				PingMarkLabels.Invalidate(val);
				Player localPlayer = Player.m_localPlayer;
				if (Object.op_Implicit((Object)(object)localPlayer) && Object.op_Implicit((Object)(object)val.m_textMeshField))
				{
					((TMP_Text)val.m_textMeshField).text = PingMarkLabels.Get(val, localPlayer);
				}
			}
		}
	}
	internal static class GroundPingLabelAnchors
	{
		internal const float LabelOffset = 0.3f;

		internal const float RiseSpeed = 0.15f;

		internal static readonly Dictionary<WorldTextInstance, Vector3> Anchors = new Dictionary<WorldTextInstance, Vector3>();
	}
	[HarmonyPatch(typeof(Chat), "UpdateWorldTexts")]
	internal static class GroundPingUpdateLabelPatch
	{
		private static readonly List<WorldTextInstance> Expired = new List<WorldTextInstance>();

		private static void Prefix(float dt)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!PluginConfig.Enabled.IsOn())
			{
				GroundPingLabelAnchors.Anchors.Clear();
				return;
			}
			foreach (KeyValuePair<WorldTextInstance, Vector3> anchor in GroundPingLabelAnchors.Anchors)
			{
				if (!Object.op_Implicit((Object)(object)anchor.Key.m_gui))
				{
					Expired.Add(anchor.Key);
				}
				else
				{
					anchor.Key.m_position = anchor.Value - Vector3.up * (0.3f + dt * 0.15f);
				}
			}
			foreach (WorldTextInstance item in Expired)
			{
				GroundPingLabelAnchors.Anchors.Remove(item);
			}
			Expired.Clear();
		}

		private static void Postfix(List<WorldTextInstance> ___m_worldTexts)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			OutlineManager.UpdatePings(___m_worldTexts);
			if (!PluginConfig.Enabled.IsOn())
			{
				return;
			}
			foreach (KeyValuePair<WorldTextInstance, Vector3> anchor in GroundPingLabelAnchors.Anchors)
			{
				anchor.Key.m_position = anchor.Value;
			}
		}
	}
}
namespace JoksterCube.PingMark.Patches.PingLabels
{
	[HarmonyPatch(typeof(Minimap), "UpdatePingPins")]
	internal static class PingMapLabelPatch
	{
		private static readonly FieldInfo PinNameField = AccessTools.Field(typeof(PinData), "m_name");

		private static void Postfix(List<PinData> ___m_pingPins, List<WorldTextInstance> ___m_tempShouts)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			if (!PluginConfig.Enabled.IsOn())
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				return;
			}
			int num = Mathf.Min(___m_pingPins.Count, ___m_tempShouts.Count);
			for (int i = 0; i < num; i++)
			{
				WorldTextInstance val = ___m_tempShouts[i];
				if ((int)val.m_type == 3)
				{
					PinData val2 = ___m_pingPins[i];
					string text = PingMarkLabels.Get(val, localPlayer);
					PinNameField.SetValue(val2, text);
					if (val2.m_NamePinData != null && Object.op_Implicit((Object)(object)val2.m_NamePinData.PinNameText))
					{
						val2.m_NamePinData.PinNameText.text = text;
					}
				}
			}
		}
	}
	internal static class PingMarkLabels
	{
		private static readonly Dictionary<WorldTextInstance, string> Cache = new Dictionary<WorldTextInstance, string>();

		private static float _timer;

		internal static TMP_FontAsset? MapFont { get; set; }

		internal static TMP_Text? MapLabelTemplate { get; set; }

		internal static string Get(WorldTextInstance worldText, Player localPlayer)
		{
			if (!Cache.TryGetValue(worldText, out string value))
			{
				value = (Cache[worldText] = Build(worldText, localPlayer));
			}
			return value;
		}

		internal static void Invalidate(WorldTextInstance worldText)
		{
			Cache.Remove(worldText);
		}

		internal static void Tick(float dt, List<WorldTextInstance> worldTexts, Player localPlayer)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Invalid comparison between Unknown and I4
			_timer += dt;
			if (_timer < PluginConfig.RefreshInterval.Value)
			{
				return;
			}
			_timer = 0f;
			Cache.Clear();
			foreach (WorldTextInstance worldText in worldTexts)
			{
				if ((int)worldText.m_type == 3)
				{
					((TMP_Text)worldText.m_textMeshField).text = Get(worldText, localPlayer);
				}
			}
		}

		private static string Build(WorldTextInstance worldText, Player localPlayer)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			if (PluginConfig.ShowPingerName.IsOn())
			{
				list.Add(worldText.m_userInfo.GetDisplayName());
			}
			string text = worldText.m_text.Trim();
			if (PluginConfig.ShowTargetName.IsOn() && !string.IsNullOrWhiteSpace(text) && !string.Equals(text, "Ping", StringComparison.OrdinalIgnoreCase))
			{
				list.Add(text);
			}
			if (PluginConfig.ShowDistance.IsOn())
			{
				list.Add(FormatDistance(worldText.m_position, localPlayer));
			}
			if (list.Count > 0)
			{
				return string.Join("\n", list);
			}
			if (!string.IsNullOrWhiteSpace(PluginConfig.EmptyLabelText.Value))
			{
				return PluginConfig.EmptyLabelText.Value.Trim();
			}
			return "PING";
		}

		internal static string FormatDistance(Vector3 position, Player localPlayer)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector3.Distance(((Component)localPlayer).transform.position, position);
			if (!PluginConfig.UseKilometers.IsOn() || !(num >= 1000f))
			{
				return $"{Mathf.RoundToInt(num)} m";
			}
			return (num / 1000f).ToString("F2", CultureInfo.InvariantCulture) + " km";
		}

		internal static string GetCharacterLabel(Character character, string distance)
		{
			if (PluginConfig.ShowPingerName.IsOn())
			{
				string pingerName = JoksterCube.PingMark.Domain.MobHighlight.GetPingerName(character);
				if (!PluginConfig.ShowDistance.IsOn())
				{
					return pingerName;
				}
				return pingerName + "\n" + distance;
			}
			if (!PluginConfig.ShowDistance.IsOn())
			{
				return string.Empty;
			}
			return distance;
		}
	}
	[HarmonyPatch(typeof(Chat), "UpdateWorldTextField")]
	internal static class PingWorldTextLabelPatch
	{
		private static void Postfix(WorldTextInstance __0)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			if ((int)__0.m_type == 3 && PluginConfig.Enabled.IsOn())
			{
				Player localPlayer = Player.m_localPlayer;
				if (Object.op_Implicit((Object)(object)localPlayer))
				{
					PingMarkLabels.Invalidate(__0);
					((TMP_Text)__0.m_textMeshField).text = PingMarkLabels.Get(__0, localPlayer);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Chat), "UpdateWorldTexts")]
	internal static class PingWorldTextRefreshPatch
	{
		private static readonly FieldInfo PinNamePrefabField = AccessTools.Field(typeof(Minimap), "m_pinNamePrefab");

		private static TMP_FontAsset? _mapFont;

		private static void Postfix(float dt, List<WorldTextInstance> ___m_worldTexts)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			if (!PluginConfig.Enabled.IsOn())
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)_mapFont) && Object.op_Implicit((Object)(object)Minimap.instance))
			{
				object? value = PinNamePrefabField.GetValue(Minimap.instance);
				GameObject val = (GameObject)((value is GameObject) ? value : null);
				if (val != null && Object.op_Implicit((Object)(object)val))
				{
					PingMarkLabels.MapLabelTemplate = val.GetComponentInChildren<TMP_Text>(true);
					TMP_Text? mapLabelTemplate = PingMarkLabels.MapLabelTemplate;
					_mapFont = ((mapLabelTemplate != null) ? mapLabelTemplate.font : null);
				}
			}
			PingMarkLabels.MapFont = _mapFont;
			foreach (WorldTextInstance ___m_worldText in ___m_worldTexts)
			{
				if ((int)___m_worldText.m_type == 3 && Object.op_Implicit((Object)(object)___m_worldText.m_textMeshField))
				{
					TMP_Text textMeshField = (TMP_Text)(object)___m_worldText.m_textMeshField;
					if (Object.op_Implicit((Object)(object)_mapFont) && (Object)(object)textMeshField.font != (Object)(object)_mapFont)
					{
						textMeshField.font = _mapFont;
					}
					Color color;
					Color val2 = ((PluginConfig.MatchTextToOutline.IsOn() && OutlineManager.TryGetPingColor(___m_worldText, out color)) ? color : PluginConfig.PingColor.Value);
					if (((Graphic)textMeshField).color != val2)
					{
						((Graphic)textMeshField).color = val2;
					}
					PingMarkLabels.MapLabelTemplate = textMeshField;
				}
			}
			Player localPlayer = Player.m_localPlayer;
			if (Object.op_Implicit((Object)(object)localPlayer))
			{
				PingMarkLabels.Tick(dt, ___m_worldTexts, localPlayer);
			}
		}
	}
}
namespace JoksterCube.PingMark.Domain
{
	internal static class MobHighlight
	{
		private static readonly Dictionary<long, Dictionary<ZDOID, (float Expiration, long Order, UserInfo User, bool IsPlayer)>> Highlights = new Dictionary<long, Dictionary<ZDOID, (float, long, UserInfo, bool)>>();

		private static readonly Dictionary<ZDOID, (float Expiration, long Order, UserInfo User, bool IsPlayer)> ActiveHighlights = new Dictionary<ZDOID, (float, long, UserInfo, bool)>();

		private static readonly List<ZDOID> Expired = new List<ZDOID>();

		private static readonly List<long> ExpiredPlayers = new List<long>();

		private static long _nextOrder;

		private static ZRoutedRpc? _registeredRpc;

		private static int _indexedFrame = -1;

		private static int _indexedLimit;

		private static bool _indexedMobsEnabled;

		private static bool _indexedPlayersEnabled;

		internal static void Update()
		{
			ZRoutedRpc instance = ZRoutedRpc.instance;
			if (instance != _registeredRpc)
			{
				Highlights.Clear();
				ActiveHighlights.Clear();
				_indexedFrame = -1;
				_registeredRpc = instance;
			}
			if (!PluginConfig.Enabled.IsOn() || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || (!PluginConfig.MobHighlightEnabled.IsOn() && !PluginConfig.PlayersEnabled.IsOn()))
			{
				Highlights.Clear();
				ActiveHighlights.Clear();
				_indexedFrame = -1;
			}
			else if (_indexedFrame != Time.frameCount || _indexedLimit != PluginConfig.MaxHighlightedMobs.Value || _indexedMobsEnabled != PluginConfig.MobHighlightEnabled.IsOn() || _indexedPlayersEnabled != PluginConfig.PlayersEnabled.IsOn())
			{
				Trim();
			}
		}

		internal static void Mark(Character character)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			if (!PluginConfig.Enabled.IsOn() || !Object.op_Implicit((Object)(object)character) || character.IsDead() || !(character.IsPlayer() ? PluginConfig.PlayersEnabled.IsOn() : PluginConfig.MobHighlightEnabled.IsOn()))
			{
				return;
			}
			ZDOID zDOID = character.GetZDOID();
			if (!((ZDOID)(ref zDOID)).IsNone())
			{
				Update();
				if (character.IsPlayer())
				{
					ZPingNetwork.SendPlayer(zDOID, ((Component)character).transform.position);
				}
				else
				{
					ZPingNetwork.SendMob(zDOID, ((Component)character).transform.position);
				}
			}
		}

		internal static bool IsMarked(Character character)
		{
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			if (!PluginConfig.Enabled.IsOn() || !Object.op_Implicit((Object)(object)character) || !(character.IsPlayer() ? PluginConfig.PlayersEnabled.IsOn() : PluginConfig.MobHighlightEnabled.IsOn()))
			{
				return false;
			}
			Update();
			ZDOID zDOID = character.GetZDOID();
			if (character.IsDead())
			{
				foreach (Dictionary<ZDOID, (float, long, UserInfo, bool)> value in Highlights.Values)
				{
					value.Remove(zDOID);
				}
				ActiveHighlights.Remove(zDOID);
				return false;
			}
			return ActiveHighlights.ContainsKey(zDOID);
		}

		internal static void GetMarkedIds(List<ZDOID> ids)
		{
			Update();
			ids.Clear();
			ids.AddRange(ActiveHighlights.Keys);
		}

		internal static bool ShouldDrawOutline(Character character)
		{
			if (IsMarked(character))
			{
				if (!character.IsPlayer())
				{
					return PluginConfig.MobOutlineEnabled.IsOn();
				}
				if (PluginConfig.PingOutlineEnabled.IsOn())
				{
					if (PluginConfig.HideOwnPlayerOutline.IsOn())
					{
						return (Object)(object)character != (Object)(object)Player.m_localPlayer;
					}
					return true;
				}
				return false;
			}
			return false;
		}

		internal static string GetPingerName(Character character)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Update();
			if (!ActiveHighlights.TryGetValue(character.GetZDOID(), out (float, long, UserInfo, bool) value))
			{
				return string.Empty;
			}
			return value.Item3.GetDisplayName();
		}

		internal static long GetPingerOrder(Character character)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Update();
			if (!ActiveHighlights.TryGetValue(character.GetZDOID(), out (float, long, UserInfo, bool) value))
			{
				return 0L;
			}
			return value.Item2;
		}

		internal static void Highlight(long sender, ZDOID id, UserInfo user, bool isPlayer = false)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			if (PluginConfig.Enabled.IsOn() && (isPlayer ? PluginConfig.PlayersEnabled.IsOn() : PluginConfig.MobHighlightEnabled.IsOn()) && !((ZDOID)(ref id)).IsNone() && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				Update();
				if (!Highlights.TryGetValue(sender, out Dictionary<ZDOID, (float, long, UserInfo, bool)> value))
				{
					value = (Highlights[sender] = new Dictionary<ZDOID, (float, long, UserInfo, bool)>());
				}
				float num = (isPlayer ? PluginConfig.PlayerHighlightDuration.Value : PluginConfig.MobHighlightDuration.Value);
				value[id] = (Time.unscaledTime + num, ++_nextOrder, user, isPlayer);
				Trim();
			}
		}

		private static void Trim()
		{
			//IL_008f: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			ActiveHighlights.Clear();
			bool flag = PluginConfig.MobHighlightEnabled.IsOn();
			bool flag2 = PluginConfig.PlayersEnabled.IsOn();
			int value = PluginConfig.MaxHighlightedMobs.Value;
			foreach (KeyValuePair<long, Dictionary<ZDOID, (float, long, UserInfo, bool)>> highlight in Highlights)
			{
				Dictionary<ZDOID, (float, long, UserInfo, bool)> value2 = highlight.Value;
				foreach (KeyValuePair<ZDOID, (float, long, UserInfo, bool)> item in value2)
				{
					if (item.Value.Item1 <= Time.unscaledTime || !(item.Value.Item4 ? flag2 : flag))
					{
						Expired.Add(item.Key);
					}
				}
				foreach (ZDOID item2 in Expired)
				{
					value2.Remove(item2);
				}
				Expired.Clear();
				while (value2.Count > value)
				{
					ZDOID key = ZDOID.None;
					long num = long.MaxValue;
					foreach (KeyValuePair<ZDOID, (float, long, UserInfo, bool)> item3 in value2)
					{
						if (item3.Value.Item2 < num)
						{
							key = item3.Key;
							num = item3.Value.Item2;
						}
					}
					value2.Remove(key);
				}
				foreach (KeyValuePair<ZDOID, (float, long, UserInfo, bool)> item4 in value2)
				{
					if (!ActiveHighlights.TryGetValue(item4.Key, out (float, long, UserInfo, bool) value3) || item4.Value.Item2 > value3.Item2)
					{
						ActiveHighlights[item4.Key] = item4.Value;
					}
				}
				if (value2.Count == 0)
				{
					ExpiredPlayers.Add(highlight.Key);
				}
			}
			foreach (long expiredPlayer in ExpiredPlayers)
			{
				Highlights.Remove(expiredPlayer);
			}
			ExpiredPlayers.Clear();
			_indexedFrame = Time.frameCount;
			_indexedLimit = value;
			_indexedMobsEnabled = flag;
			_indexedPlayersEnabled = flag2;
		}
	}
	internal static class OutlineManager
	{
		private sealed class RendererCache
		{
			internal readonly List<Renderer> Renderers = new List<Renderer>();

			internal readonly List<Transform> Transforms = new List<Transform>();

			internal readonly List<int> ChildCounts = new List<int>();

			internal float NextRefresh;
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static CameraCallback <0>__OnPreRender;
		}

		private const CameraEvent RenderEvent = (CameraEvent)17;

		private const int StencilBit = 64;

		private const float Diagonal = 0.70710677f;

		private static readonly int ColorId = Shader.PropertyToID("_Color");

		private static readonly FieldRef<EnemyHud, Dictionary<Character, HudData>> HudsRef = AccessTools.FieldRefAccess<EnemyHud, Dictionary<Character, HudData>>("m_huds");

		private static readonly Vector2[] Directions = (Vector2[])(object)new Vector2[8]
		{
			new Vector2(1f, 0f),
			new Vector2(-1f, 0f),
			new Vector2(0f, 1f),
			new Vector2(0f, -1f),
			new Vector2(0.70710677f, 0.70710677f),
			new Vector2(-0.70710677f, 0.70710677f),
			new Vector2(0.70710677f, -0.70710677f),
			new Vector2(-0.70710677f, -0.70710677f)
		};

		private static readonly List<ZDOID> MarkedIds = new List<ZDOID>();

		private static readonly Dictionary<GameObject, RendererCache> RendererCaches = new Dictionary<GameObject, RendererCache>();

		private static readonly HashSet<GameObject> ActiveOutlineTargets = new HashSet<GameObject>();

		private static readonly List<GameObject> ExpiredOutlineTargets = new List<GameObject>();

		private static readonly HashSet<Renderer> CollectedRenderers = new HashSet<Renderer>();

		private static readonly List<(Renderer Renderer, int SubMeshCount)> Targets = new List<(Renderer, int)>();

		private static readonly Dictionary<Color32, Material> OutlineMaterials = new Dictionary<Color32, Material>();

		private static readonly Dictionary<WorldTextInstance, PingTarget> PingTargets = new Dictionary<WorldTextInstance, PingTarget>();

		private static readonly List<WorldTextInstance> ExpiredPings = new List<WorldTextInstance>();

		private static readonly HashSet<WorldTextInstance> ExistingPings = new HashSet<WorldTextInstance>();

		private static CommandBuffer? _buffer;

		private static Camera? _camera;

		private static Shader? _shader;

		private static Material? _clearMaterial;

		private static Material? _maskMaterial;

		private static bool _shaderMissing;

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

		internal static void SetPingTarget(WorldTextInstance ping, PingTarget? target)
		{
			if (target.HasValue)
			{
				PingTargets[ping] = target.Value;
			}
			else
			{
				PingTargets.Remove(ping);
			}
		}

		internal static bool TryGetPingColor(WorldTextInstance ping, out Color color)
		{
			//IL_001f: 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_001a: 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)
			PingTarget value;
			bool flag = PingTargets.TryGetValue(ping, out value);
			color = (Color)(flag ? value.Color : default(Color));
			return flag;
		}

		internal static void UpdatePings(List<WorldTextInstance> worldTexts)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Invalid comparison between Unknown and I4
			if (!PluginConfig.Enabled.IsOn())
			{
				PingTargets.Clear();
			}
			else
			{
				if (PingTargets.Count == 0)
				{
					return;
				}
				ExistingPings.Clear();
				foreach (WorldTextInstance worldText in worldTexts)
				{
					ExistingPings.Add(worldText);
				}
				foreach (KeyValuePair<WorldTextInstance, PingTarget> pingTarget in PingTargets)
				{
					if (!Object.op_Implicit((Object)(object)pingTarget.Key.m_gui) || (int)pingTarget.Key.m_type != 3 || !ExistingPings.Contains(pingTarget.Key))
					{
						ExpiredPings.Add(pingTarget.Key);
					}
				}
				foreach (WorldTextInstance expiredPing in ExpiredPings)
				{
					PingTargets.Remove(expiredPing);
				}
				ExpiredPings.Clear();
				ExistingPings.Clear();
			}
		}

		internal static void Dispose()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			CameraCallback onPreRender = Camera.onPreRender;
			object obj = <>O.<0>__OnPreRender;
			if (obj == null)
			{
				CameraCallback val = OnPreRender;
				<>O.<0>__OnPreRender = val;
				obj = (object)val;
			}
			Camera.onPreRender = (CameraCallback)Delegate.Remove((Delegate?)(object)onPreRender, (Delegate?)obj);
			Detach();
			CommandBuffer? buffer = _buffer;
			if (buffer != null)
			{
				buffer.Release();
			}
			_buffer = null;
			if (Object.op_Implicit((Object)(object)_clearMaterial))
			{
				Object.Destroy((Object)(object)_clearMaterial);
			}
			if (Object.op_Implicit((Object)(object)_maskMaterial))
			{
				Object.Destroy((Object)(object)_maskMaterial);
			}
			foreach (Material value in OutlineMaterials.Values)
			{
				if (Object.op_Implicit((Object)(object)value))
				{
					Object.Destroy((Object)(object)value);
				}
			}
			OutlineMaterials.Clear();
			PingTargets.Clear();
			ExpiredPings.Clear();
			ExistingPings.Clear();
			RendererCaches.Clear();
			ActiveOutlineTargets.Clear();
			ExpiredOutlineTargets.Clear();
		}

		private static void OnPreRender(Camera camera)
		{
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Invalid comparison between Unknown and I4
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to