Decompiled source of QuickPing v1.7.1

plugins/QuickPing.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using QuickPing.Patches;
using QuickPing.Utilities;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.U2D;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("QuickPing")]
[assembly: AssemblyDescription("Ping what you see !")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Atopy")]
[assembly: AssemblyProduct("QuickPing")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("31e0f113-b41a-497c-89f8-8db164e0b3eb")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyFileVersion("1.7.1.0")]
[assembly: AssemblyInformationalVersion("1.7.1+3.Branch.master.Sha.5fc108c0676f7e5706cf13104295e5b0bc481fd6")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.7.1.0")]
namespace QuickPing
{
	public enum HoverType
	{
		GameObject,
		Character,
		Hoverable,
		Piece,
		Location
	}
	public class HoverObject : MonoBehaviour
	{
		public GameObject Hover;

		public IDestructible Destructible;

		public Vector3 pos;

		public Vector3 center;

		public HoverType type;

		public bool pinable;

		public string Name { get; set; }
	}
	[BepInPlugin("com.atopy.plugins.quickping", "QuickPing", "1.7.1")]
	public class QuickPingPlugin : BaseUnityPlugin
	{
		public static QuickPingPlugin Instance { get; set; }

		public static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Settings.Init();
			Patch(typeof(Localization_Patch));
			Localization_Patch.AddTranslations();
			Patch(typeof(InputBlocker));
			Patch(typeof(Player_Patch));
			Patch(typeof(ChatPing_Patch));
			Patch(typeof(Minimap_Patch));
			Patch(typeof(Terminal_Patch));
			Patch(typeof(SaveCollection_Patch));
			Patch(typeof(MineRock5_Patch));
			Patch(typeof(Destructible_Patch));
			Patch(typeof(ZNet_Patch));
			Patch(typeof(WearNTear_Patch));
			Patch(typeof(Character_Patch));
			Patch(typeof(Leviathan_Patch));
			Player_Patch.OnPlayerPing.AddListener((UnityAction<HoverObject>)Player_Patch.SendPing);
			Player_Patch.OnPlayerPing.AddListener((UnityAction<HoverObject>)Minimap_Patch.AddPin);
			Player_Patch.OnPlayerForcePing.AddListener((UnityAction<HoverObject>)Player_Patch.SendPing);
			Player_Patch.OnPlayerForcePing.AddListener((UnityAction<HoverObject>)Minimap_Patch.ForceAddPin);
			Player_Patch.OnPlayerCustomNamePing.AddListener((UnityAction<HoverObject>)Player_Patch.SendPing);
			Player_Patch.OnPlayerCustomNamePing.AddListener((UnityAction<HoverObject>)Minimap_Patch.OpenCustomNamePing);
		}

		private static void Patch(Type patchClass)
		{
			try
			{
				Harmony.CreateAndPatchAll(patchClass, "com.atopy.plugins.quickping");
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Failed to patch {patchClass.Name}, this part of the mod is disabled: {arg}");
			}
		}
	}
	internal static class Settings
	{
		public const string DefaultPingText = "PING !";

		public static ConfigEntry<bool> PingWhereLooking { get; private set; }

		public static ConfigEntry<bool> AddPin { get; private set; }

		public static ConfigEntry<KeyCode> PingKey { get; private set; }

		public static ConfigEntry<KeyCode> PinEverythingKey { get; internal set; }

		public static ConfigEntry<KeyboardShortcut> CustomNamePingKey { get; internal set; }

		public static ConfigEntry<PinType> DefaultPinType { get; internal set; }

		public static ConfigEntry<Color> PlayerColor { get; private set; }

		public static ConfigEntry<Color> ShoutColor { get; private set; }

		public static ConfigEntry<Color> WhisperColor { get; private set; }

		public static ConfigEntry<Color> PingColor { get; private set; }

		public static ConfigEntry<Color> DefaultColor { get; private set; }

		public static ConfigEntry<float> ClosestPinRange { get; private set; }

		public static ConfigEntry<bool> ShowDistance { get; private set; }

		public static void Init()
		{
			//IL_00cd: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			PingWhereLooking = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<bool>("General", "PingWhereLooking", true, "Create a ping where you are looking when you press <PingKey>");
			AddPin = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<bool>("General", "AddPinOnMap", true, "If true, add a pin when useful resources (copper, berries, campfire, portals etc.) are pinged.");
			ClosestPinRange = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<float>("General", "ClosestPinRange", 2f, "Minimum distance between objects to pin/replace portal tag");
			ShowDistance = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<bool>("Ping", "ShowDistance", false, "Show your distance to the ping below its text.");
			DefaultPinType = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<PinType>("General", "DefaultPinType", (PinType)11, "Default pin when forcing adding a pin on map");
			PlayerColor = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<Color>("Colors", "PlayerColor", Color.green, "Color for Player name in pings/messages.");
			ShoutColor = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<Color>("Colors", "ShoutColor", Color.yellow, "Color for Shout ping.");
			WhisperColor = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<Color>("Colors", "WhisperColor", new Color(1f, 1f, 1f, 0.75f), "Color for Whisper ping.");
			PingColor = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<Color>("Colors", "PingColor", new Color(0.6f, 0.7f, 1f, 1f), "Color for \"Ping\" ping.");
			DefaultColor = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<Color>("Colors", "DefaultColor", Color.white, "Default color");
			PingKey = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<KeyCode>("Bindings", "PingInputKey", (KeyCode)116, "The keybind to trigger a ping where you are looking");
			PinEverythingKey = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<KeyCode>("Bindings", "PingEverythingInputKey", (KeyCode)103, "Add a pin on minimap to whatever you're looking at.");
			KeyboardShortcut val = default(KeyboardShortcut);
			((KeyboardShortcut)(ref val))..ctor(PingKey.Value, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 });
			CustomNamePingKey = ((BaseUnityPlugin)QuickPingPlugin.Instance).Config.Bind<KeyboardShortcut>("Bindings", "CustomNamePingInputKey", val, "Ping where you are looking and choose the name and icon of its pin (also where there is no pin yet).");
			MigrateKey(((BaseUnityPlugin)QuickPingPlugin.Instance).Config, "RenameInputKey", CustomNamePingKey, val);
		}

		internal static void MigrateKey(ConfigFile config, string oldKey, ConfigEntry<KeyboardShortcut> entry, KeyboardShortcut defaultValue)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<KeyboardShortcut> val = config.Bind<KeyboardShortcut>(((ConfigEntryBase)entry).Definition.Section, oldKey, defaultValue, (ConfigDescription)null);
			if (!((object)val.Value/*cast due to .constrained prefix*/).Equals((object?)defaultValue))
			{
				entry.Value = val.Value;
			}
			config.Remove(((ConfigEntryBase)val).Definition);
			config.Save();
		}

		public static bool IsDown(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			if ((int)key != 0)
			{
				return ZInput.GetKeyDown(key, false);
			}
			return false;
		}

		public static bool IsDown(KeyboardShortcut shortcut)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			if (IsDown(((KeyboardShortcut)(ref shortcut)).MainKey))
			{
				return ((KeyboardShortcut)(ref shortcut)).Modifiers.All((KeyCode key) => ZInput.GetKey(key, false));
			}
			return false;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.atopy.plugins.quickping";

		public const string PLUGIN_NAME = "QuickPing";

		public const string PLUGIN_VERSION = "1.7.1";
	}
}
namespace QuickPing.Utilities
{
	internal static class DataManager
	{
		public static Dictionary<ZDOID, PinData> PinnedObjects = new Dictionary<ZDOID, PinData>();

		public static Dictionary<string, string> CustomNames = new Dictionary<string, string>();

		public static bool Save(World world, PlayerProfile playerProfile)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			bool num = WritePackage(GetPath(world, playerProfile, "customNames"), world.m_fileSource, PackCustomNames());
			bool flag = WritePackage(GetPath(world, playerProfile, "pinned"), world.m_fileSource, PackPinnedObjects());
			return num || flag;
		}

		public static void Load(World world, PlayerProfile playerProfile)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			CustomNames.Clear();
			ZPackage val = ReadPackage(GetPath(world, playerProfile, "customNames"), world.m_fileSource);
			if (val != null)
			{
				UnpackCustomNames(val);
			}
			else
			{
				QuickPingPlugin.Log.LogWarning((object)("Failed to load custom names. World: " + world.m_name + " - Profile: " + playerProfile.m_playerName));
			}
			PinnedObjects.Clear();
			ZPackage val2 = ReadPackage(GetPath(world, playerProfile, "pinned"), world.m_fileSource);
			if (val2 != null)
			{
				UnpackPinnedObjects(val2);
			}
			else
			{
				QuickPingPlugin.Log.LogWarning((object)("Failed to load pinned objects. World: " + world.m_name + " - Profile: " + playerProfile.m_playerName));
			}
		}

		public static void RepairMisnamedCloudFiles()
		{
			if (!FileHelpers.CloudStorageSupported || !FileHelpers.CloudStorageSupportedAndEnabled)
			{
				return;
			}
			string[] array;
			try
			{
				array = FileHelpers.GetFiles((FileSource)4, SaveSystem.GetSavePath((SaveDataType)0, (FileSource)4), (string)null, (string)null) ?? Array.Empty<string>();
			}
			catch (Exception ex)
			{
				QuickPingPlugin.Log.LogWarning((object)("Could not list cloud files: " + ex.Message));
				return;
			}
			string text = SaveSystem.GetWorldsSaveRootPath((FileSource)4).Trim(new char[1] { '/' });
			string[] array2 = array;
			foreach (string text2 in array2)
			{
				string text3 = text2.Replace('\\', '/').TrimStart(new char[1] { '/' });
				if (text3.Contains("/") || !text3.StartsWith(text) || !text3.Contains(".mod.quickping."))
				{
					continue;
				}
				string text4 = text + "/" + text3.Substring(text.Length);
				try
				{
					if (text3.EndsWith(".old"))
					{
						goto IL_011f;
					}
					ZPackage val = ReadPackage(text2, (FileSource)4);
					if (val != null && !WritePackage(text4, (FileSource)4, val))
					{
						goto IL_011f;
					}
					QuickPingPlugin.Log.LogWarning((object)("Could not move misnamed cloud file " + text2 + " to " + text4));
					goto end_IL_00d8;
					IL_011f:
					FileHelpers.Delete(text2, (FileSource)4);
					QuickPingPlugin.Log.LogInfo((object)("Moved misnamed cloud file " + text2 + " to " + text4));
					end_IL_00d8:;
				}
				catch (Exception ex2)
				{
					QuickPingPlugin.Log.LogWarning((object)("Could not repair misnamed cloud file " + text2 + ": " + ex2.Message));
				}
			}
		}

		private static ZPackage ReadPackage(string path, FileSource fileSource)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			FileReader val;
			try
			{
				val = new FileReader(path, fileSource, (FileHelperType)0);
			}
			catch
			{
				return null;
			}
			try
			{
				BinaryReader binary = val.m_binary;
				int count = binary.ReadInt32();
				return new ZPackage(binary.ReadBytes(count));
			}
			catch
			{
				return null;
			}
			finally
			{
				val.Dispose();
			}
		}

		private static bool WritePackage(string path, FileSource fileSource, ZPackage zPackage)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Invalid comparison between Unknown and I4
			//IL_0004: 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_0062: Invalid comparison between Unknown and I4
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			if ((int)fileSource != 4)
			{
				Directory.CreateDirectory(SaveSystem.GetWorldsSaveRootPath(fileSource));
			}
			string text = path + ".new";
			string text2 = path + ".old";
			byte[] array = zPackage.GetArray();
			FileWriter val = new FileWriter(text, (CloudStorageFileGrouping)2, (FileHelperType)0, fileSource);
			val.m_binary.Write(array.Length);
			val.m_binary.Write(array);
			val.Finish();
			int num;
			if ((int)val.Status != 2)
			{
				num = (((int)fileSource == 4) ? 1 : 0);
				if (num != 0)
				{
					goto IL_0074;
				}
			}
			else
			{
				num = 0;
			}
			FileHelpers.ReplaceOldFile(path, text, text2, (CloudStorageFileGrouping)2, fileSource);
			goto IL_0074;
			IL_0074:
			return (byte)num != 0;
		}

		private static string GetPath(World world, PlayerProfile playerProfile, string extension)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			return SaveSystem.GetWorldsSaveRootPath(world.m_fileSource) + "/" + world.m_worldName + "." + playerProfile.m_playerName + ".mod.quickping." + extension;
		}

		private static ZPackage PackPinnedObjects()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			ZPackage val = new ZPackage();
			foreach (KeyValuePair<ZDOID, PinData> pinnedObject in PinnedObjects)
			{
				val.Write(pinnedObject.Key);
				val.Write(pinnedObject.Value);
			}
			return val;
		}

		private static ZPackage PackCustomNames()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			ZPackage val = new ZPackage();
			foreach (KeyValuePair<string, string> customName in CustomNames)
			{
				string key = customName.Key;
				if ((key != null && !(key == "")) || 1 == 0)
				{
					val.Write(customName.Key);
					val.Write(customName.Value);
				}
			}
			return val;
		}

		private static void UnpackCustomNames(ZPackage zPackage)
		{
			CustomNames.Clear();
			while (zPackage.GetPos() < zPackage.Size())
			{
				string text = zPackage.ReadString();
				string value = zPackage.ReadString();
				if ((text != null && !(text == "")) || 1 == 0)
				{
					CustomNames.Add(text, value);
				}
			}
		}

		private static void UnpackPinnedObjects(ZPackage zPackage)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<ZDOID, PinData> dictionary = new Dictionary<ZDOID, PinData>();
			if (zPackage == null)
			{
				return;
			}
			while (zPackage.GetPos() < zPackage.Size())
			{
				ZDOID key = zPackage.ReadZDOID();
				PinData value = zPackage.ReadPinData();
				if (!dictionary.ContainsKey(key))
				{
					dictionary.Add(key, value);
				}
			}
			PinnedObjects = dictionary;
		}

		private static void Write(this ZPackage zPackage, PinData pinData)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			zPackage.Write(pinData.m_name);
			zPackage.Write(((object)Unsafe.As<PinType, PinType>(ref pinData.m_type)/*cast due to .constrained prefix*/).ToString());
			zPackage.Write(pinData.m_pos);
		}

		private static PinData ReadPinData(this ZPackage package)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return new PinData
			{
				m_name = package.ReadString(),
				m_type = (PinType)Enum.Parse(typeof(PinType), package.ReadString()),
				m_pos = package.ReadVector3()
			};
		}
	}
	internal static class GameUI
	{
		private class DragWindow : MonoBehaviour, IDragHandler, IEventSystemHandler
		{
			public void OnDrag(PointerEventData eventData)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				Canvas componentInParent = ((Component)this).GetComponentInParent<Canvas>();
				RectTransform val = (RectTransform)((Component)this).transform;
				val.anchoredPosition += eventData.delta / (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.scaleFactor : 1f);
			}
		}

		private static readonly Color PlaceholderColor = Color.grey;

		private static readonly Color CheckmarkColor = new Color(1f, 0.678f, 0.103f, 1f);

		private static readonly ColorBlock ToggleColors;

		private static readonly Dictionary<string, Object> assets;

		private static GameObject canvas;

		public static Transform Canvas
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)canvas))
				{
					canvas = CreateCanvas();
				}
				if (!Object.op_Implicit((Object)(object)canvas))
				{
					return null;
				}
				return canvas.transform;
			}
		}

		public static GameObject CreateWoodPanel(Transform parent, float width, float height)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = DefaultControls.CreatePanel(Resources());
			obj.layer = 5;
			obj.transform.SetParent(parent, false);
			RectTransform val = (RectTransform)obj.transform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			val.anchorMax = val2;
			val.anchorMin = val2;
			val.anchoredPosition = Vector2.zero;
			val.SetSizeWithCurrentAnchors((Axis)0, width);
			val.SetSizeWithCurrentAnchors((Axis)1, height);
			Image component = obj.GetComponent<Image>();
			component.sprite = GetSprite("woodpanel_trophys");
			component.type = (Type)1;
			((Graphic)component).material = Get<Material>("litpanel");
			((Graphic)component).color = Color.white;
			obj.AddComponent<DragWindow>();
			return obj;
		}

		public static InputField CreateInputField(Transform parent, string placeholder, int fontSize, float width, float height)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = DefaultControls.CreateInputField(Resources());
			obj.transform.SetParent(parent, false);
			((RectTransform)obj.transform).sizeDelta = new Vector2(width, height);
			InputField component = obj.GetComponent<InputField>();
			component.contentType = (ContentType)0;
			Graphic targetGraphic = ((Selectable)component).targetGraphic;
			Image val = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
			if (val != null)
			{
				((Graphic)val).color = Color.white;
				val.sprite = GetSprite("text_field");
			}
			Graphic placeholder2 = component.placeholder;
			Text val2 = (Text)(object)((placeholder2 is Text) ? placeholder2 : null);
			if (val2 != null)
			{
				val2.text = placeholder;
				StyleText(val2, PlaceholderColor, fontSize, outline: false);
			}
			StyleText(component.textComponent, Color.white, fontSize, outline: true);
			return component;
		}

		public static Toggle CreateToggle(Transform parent, string label, float size)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = DefaultControls.CreateToggle(Resources());
			val.transform.SetParent(parent, false);
			((RectTransform)val.transform).sizeDelta = new Vector2(size, size);
			((RectTransform)val.transform.Find("Background")).sizeDelta = new Vector2(size, size);
			((RectTransform)val.transform.Find("Background/Checkmark")).sizeDelta = new Vector2(size, size);
			Toggle component = val.GetComponent<Toggle>();
			component.isOn = false;
			component.toggleTransition = (ToggleTransition)1;
			((Selectable)component).colors = ToggleColors;
			Graphic targetGraphic = ((Selectable)component).targetGraphic;
			Image val2 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
			if (val2 != null)
			{
				val2.sprite = GetSprite("checkbox");
			}
			Graphic graphic = component.graphic;
			Image val3 = (Image)(object)((graphic is Image) ? graphic : null);
			if (val3 != null)
			{
				val3.sprite = GetSprite("checkbox_marker");
				((Graphic)val3).color = CheckmarkColor;
			}
			Text component2 = ((Component)val.transform.Find("Label")).GetComponent<Text>();
			component2.text = label;
			StyleText(component2, Color.white, 16, outline: true);
			component2.horizontalOverflow = (HorizontalWrapMode)1;
			return component;
		}

		private static void StyleText(Text text, Color color, int fontSize, bool outline)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			text.font = Get<Font>("AveriaSerifLibre-Bold");
			text.fontSize = fontSize;
			((Graphic)text).color = color;
			text.verticalOverflow = (VerticalWrapMode)1;
			text.alignment = (TextAnchor)3;
			if (outline && !Object.op_Implicit((Object)(object)((Component)text).GetComponent<Outline>()))
			{
				((Shadow)((Component)text).gameObject.AddComponent<Outline>()).effectColor = Color.black;
			}
		}

		private static Resources Resources()
		{
			//IL_0002: 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)
			return new Resources
			{
				standard = GetSprite("button"),
				background = GetSprite("text_field"),
				inputField = GetSprite("text_field"),
				knob = GetSprite("checkbox_marker"),
				checkmark = GetSprite("checkbox_marker"),
				dropdown = GetSprite("checkbox_marker")
			};
		}

		private static Sprite GetSprite(string name)
		{
			SpriteAtlas val = Get<SpriteAtlas>("UIAtlas");
			Sprite val2 = (Object.op_Implicit((Object)(object)val) ? val.GetSprite(name) : null);
			if (!Object.op_Implicit((Object)(object)val2))
			{
				return Get<Sprite>(name);
			}
			return val2;
		}

		private static T Get<T>(string name) where T : Object
		{
			string text = typeof(T).Name + "/" + name;
			if (assets.TryGetValue(text, out var value) && Object.op_Implicit(value))
			{
				return (T)(object)value;
			}
			T val = Resources.FindObjectsOfTypeAll<T>().FirstOrDefault((T a) => ((Object)a).name == name);
			if (!Object.op_Implicit((Object)(object)val))
			{
				QuickPingPlugin.Log.LogWarning((object)("UI asset not found: " + text));
			}
			assets[text] = (Object)(object)val;
			return val;
		}

		private static GameObject CreateCanvas()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			Scene activeScene = SceneManager.GetActiveScene();
			GameObject? obj = ((IEnumerable<GameObject>)((Scene)(ref activeScene)).GetRootGameObjects()).FirstOrDefault((Func<GameObject, bool>)((GameObject go) => ((Object)go).name == "_GameMain"));
			Transform val = ((obj != null) ? obj.transform.Find("LoadingGUI") : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				QuickPingPlugin.Log.LogError((object)"Game GUI not found");
				return null;
			}
			GameObject val2 = new GameObject("QuickPingGUI", new Type[5]
			{
				typeof(RectTransform),
				typeof(GuiPixelFix),
				typeof(Canvas),
				typeof(CanvasScaler),
				typeof(GraphicRaycaster)
			})
			{
				layer = 5
			};
			val2.transform.SetParent(val, false);
			val2.transform.SetAsLastSibling();
			RectTransform val3 = (RectTransform)val2.transform;
			val3.anchorMin = Vector2.zero;
			val3.anchorMax = Vector2.one;
			Vector2 offsetMin = (val3.offsetMax = Vector2.zero);
			val3.offsetMin = offsetMin;
			Canvas component = val2.GetComponent<Canvas>();
			component.renderMode = (RenderMode)0;
			component.overrideSorting = true;
			component.sortingOrder = 2000;
			component.additionalShaderChannels = (AdditionalCanvasShaderChannels)25;
			val2.GetComponent<CanvasScaler>().referencePixelsPerUnit = 50f;
			return val2;
		}

		static GameUI()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock toggleColors = default(ColorBlock);
			((ColorBlock)(ref toggleColors)).normalColor = new Color(0.61f, 0.61f, 0.61f, 1f);
			((ColorBlock)(ref toggleColors)).highlightedColor = Color.white;
			((ColorBlock)(ref toggleColors)).pressedColor = new Color(0.784f, 0.784f, 0.784f, 1f);
			((ColorBlock)(ref toggleColors)).selectedColor = Color.white;
			((ColorBlock)(ref toggleColors)).disabledColor = new Color(0.784f, 0.784f, 0.784f, 0.502f);
			((ColorBlock)(ref toggleColors)).colorMultiplier = 1f;
			((ColorBlock)(ref toggleColors)).fadeDuration = 0.1f;
			ToggleColors = toggleColors;
			assets = new Dictionary<string, Object>();
		}
	}
	internal static class InputBlocker
	{
		public static bool Blocked { get; private set; }

		public static void Block(bool state)
		{
			if (Blocked != state)
			{
				Blocked = state;
				if (Object.op_Implicit((Object)(object)GameCamera.instance))
				{
					GameCamera.instance.m_mouseCapture = !state;
					GameCamera.instance.UpdateMouseCapture();
				}
			}
		}

		[HarmonyPatch(typeof(Game), "Start")]
		[HarmonyPostfix]
		private static void GameStart()
		{
			Blocked = false;
		}

		[HarmonyPatch(typeof(PlayerController), "TakeInput")]
		[HarmonyPatch(typeof(Player), "TakeInput")]
		[HarmonyPostfix]
		private static void TakeInput(ref bool __result)
		{
			if (Blocked)
			{
				__result = false;
			}
		}

		[HarmonyPatch(typeof(TextInput), "IsVisible")]
		[HarmonyPostfix]
		private static void TextInputIsVisible(ref bool __result)
		{
			if (Blocked)
			{
				__result = true;
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Update")]
		[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> SkipWhenBlocked(IEnumerable<CodeInstruction> instructions, MethodBase original)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			Label? skip = null;
			CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Calls(i, AccessTools.Method(typeof(Menu), "IsVisible", (Type[])null, (Type[])null))), (string)null),
				new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => CodeInstructionExtensions.Branches(i, ref skip)), (string)null)
			});
			if (val.IsInvalid)
			{
				QuickPingPlugin.Log.LogWarning((object)(original.DeclaringType.Name + "." + original.Name + ": menu check not found, input not blocked there"));
				return val.InstructionEnumeration();
			}
			return val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
			{
				new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(InputBlocker), "Blocked")),
				new CodeInstruction(OpCodes.Brtrue, (object)skip)
			}).InstructionEnumeration();
		}
	}
	internal static class GO_Ext
	{
		public static T GetRecursiveComponentInParents<T>(Transform root)
		{
			if ((Object)(object)root.parent == (Object)null)
			{
				return default(T);
			}
			T componentInParent = ((Component)root).GetComponentInParent<T>();
			if (componentInParent != null)
			{
				return componentInParent;
			}
			return GetRecursiveComponentInParents<T>(root.parent);
		}

		public static GameObject GetRecursiveParentWithComponent<T>(Transform root)
		{
			if (!Object.op_Implicit((Object)(object)root.parent))
			{
				return null;
			}
			T val = default(T);
			if (((Component)root.parent).gameObject.TryGetComponent<T>(ref val))
			{
				return ((Component)root.parent).gameObject;
			}
			return GetRecursiveParentWithComponent<T>(root.parent);
		}
	}
	internal static class DataUtils
	{
		public static bool Compare(this PinData x, PinData y)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if (x.m_pos == y.m_pos)
			{
				return x.m_name == y.m_name;
			}
			return false;
		}
	}
}
namespace QuickPing.Patches
{
	public class ChatPing_Patch
	{
		[HarmonyPatch(typeof(Chat))]
		[HarmonyPatch("AddInworldText")]
		[HarmonyPrefix]
		public static bool AddInworldText(Chat __instance, GameObject go, long senderID, Vector3 position, Type type, UserInfo user, string text)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected I4, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			WorldTextInstance val = __instance.FindExistingWorldText(senderID);
			if (val == null)
			{
				val = new WorldTextInstance();
				val.m_talkerID = senderID;
				val.m_gui = Object.Instantiate<GameObject>(__instance.m_worldTextBase, ((Component)__instance).transform);
				val.m_gui.gameObject.SetActive(true);
				Transform val2 = val.m_gui.transform.Find("Text");
				val.m_textMeshField = ((Component)val2).GetComponent<TextMeshProUGUI>();
				__instance.m_worldTexts.Add(val);
			}
			val.m_userInfo = user;
			val.m_type = type;
			val.m_go = go;
			val.m_position = position;
			Color value;
			switch ((int)type)
			{
			case 2:
				value = Settings.ShoutColor.Value;
				text = text.ToUpper();
				break;
			case 0:
				value = Settings.WhisperColor.Value;
				text = text.ToLowerInvariant();
				break;
			case 3:
				value = Settings.PingColor.Value;
				if (text == string.Empty)
				{
					text = "PING !";
				}
				break;
			default:
				value = Settings.DefaultColor.Value;
				break;
			}
			((TMP_Text)val.m_textMeshField).richText = true;
			((Graphic)val.m_textMeshField).color = value;
			val.m_timer = 0f;
			val.m_text = text;
			__instance.UpdateWorldTextField(val);
			return false;
		}

		[HarmonyPatch(typeof(Chat), "UpdateWorldTextField")]
		[HarmonyPrefix]
		public static bool UpdateWorldTextField(WorldTextInstance wt)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Invalid comparison between Unknown and I4
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			if ((int)wt.m_type == 2 || (int)wt.m_type == 3)
			{
				text = "<color=#" + ColorUtility.ToHtmlStringRGBA(Settings.PlayerColor.Value) + ">" + wt.m_name + "</color>: ";
			}
			text = text + "<color=#" + ColorUtility.ToHtmlStringRGBA(((Graphic)wt.m_textMeshField).color) + ">" + wt.m_text + "</color>";
			if ((int)wt.m_type == 3 && Settings.ShowDistance.Value && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				int num = Mathf.RoundToInt(Vector3.Distance(((Component)Player.m_localPlayer).transform.position, wt.m_position));
				text += $"\n<size=75%><color=#{ColorUtility.ToHtmlStringRGBA(((Graphic)wt.m_textMeshField).color)}>{num} m</color></size>";
			}
			((TMP_Text)wt.m_textMeshField).text = text;
			return false;
		}
	}
	public static class Localization_Patch
	{
		private static readonly Dictionary<string, string> LocationNames = new Dictionary<string, string>
		{
			{ "Hildir_camp", "Hildir" },
			{ "Eikthyrnir", "$enemy_eikthyr" },
			{ "TrollCave", "$location_forestcave" },
			{ "TrollCave02", "$location_forestcave" },
			{ "Crypt2", "$location_forestcrypt" },
			{ "Crypt3", "$location_forestcrypt" },
			{ "Crypt4", "$location_forestcrypt" },
			{ "BearCave", "$location_bearcave" },
			{ "Vendor_BlackForest", "Haldor" },
			{ "GDKing", "$enemy_gdking" },
			{ "Hildir_crypt", "$hud_pin_hildir1" },
			{ "SunkenCrypt1", "$location_sunkencrypt" },
			{ "SunkenCrypt2", "$location_sunkencrypt" },
			{ "SunkenCrypt3", "$location_sunkencrypt" },
			{ "SunkenCrypt4", "$location_sunkencrypt" },
			{ "BogWitch_Camp", "$npc_bogwitch" },
			{ "Bonemass", "$enemy_bonemass" },
			{ "DrakeNest01", "$item_dragonegg" },
			{ "Dragonqueen", "$enemy_dragon" },
			{ "MountainCave01", "$location_mountaincave" },
			{ "MountainCave02", "$location_mountaincave" },
			{ "Hildir_cave", "$hud_pin_hildir2" },
			{ "GoblinCamp1", "GoblinCamp" },
			{ "GoblinCamp2", "GoblinCamp" },
			{ "GoblinCamp2_1", "GoblinCamp" },
			{ "StoneHenge1", "Stone Henge" },
			{ "StoneHenge2", "Stone Henge" },
			{ "StoneHenge3", "Stone Henge" },
			{ "StoneHenge4", "Stone Henge" },
			{ "StoneHenge5", "Stone Henge" },
			{ "StoneHenge6", "Stone Henge" },
			{ "Hildir_plainsfortress", "$hud_pin_hildir3" },
			{ "GoblinKing", "$enemy_goblinking" },
			{ "Mistlands_DvergrTownEntrance1", "$location_dvergrtown" },
			{ "Mistlands_DvergrTownEntrance2", "$location_dvergrtown" },
			{ "Mistlands_DvergrBossEntrance1", "$location_dvergrboss" },
			{ "MorgenHole1", "$location_morgenhole" },
			{ "MorgenHole2", "$location_morgenhole" },
			{ "MorgenHole3", "$location_morgenhole" },
			{ "CharredFortress", "$charredfortress" },
			{ "FaderLocation", "$enemy_fader" },
			{ "TheHole01", "$location_thehole" },
			{ "TheDarkestHole", "$location_darkesthole" },
			{ "WoodVillage1", "$quickping_location_village" },
			{ "WoodVillage2", "$quickping_location_village" },
			{ "NorthVillage", "$quickping_location_village" },
			{ "WoodFarm1", "$quickping_location_farm" },
			{ "LumberCamp", "$quickping_location_lumbercamp" },
			{ "Mistlands_Harbour1", "$quickping_location_harbour" },
			{ "Mistlands_Lighthouse1_new", "$quickping_location_lighthouse" },
			{ "WoodHouse1", "$quickping_location_house" },
			{ "WoodHouse2", "$quickping_location_house" },
			{ "WoodHouse3", "$quickping_location_house" },
			{ "WoodHouse4", "$quickping_location_house" },
			{ "WoodHouse5", "$quickping_location_house" },
			{ "WoodHouse6", "$quickping_location_house" },
			{ "WoodHouse7", "$quickping_location_house" },
			{ "WoodHouse8", "$quickping_location_house" },
			{ "WoodHouse9", "$quickping_location_house" },
			{ "WoodHouse10", "$quickping_location_house" },
			{ "WoodHouse11", "$quickping_location_house" },
			{ "WoodHouse12", "$quickping_location_house" },
			{ "WoodHouse13", "$quickping_location_house" },
			{ "StoneHouse3", "$quickping_location_house" },
			{ "StoneHouse4", "$quickping_location_house" },
			{ "StoneHouse1_heath", "$quickping_location_house" },
			{ "StoneHouse2_heath", "$quickping_location_house" },
			{ "StoneHouse5_heath", "$quickping_location_house" },
			{ "AbandonedLogCabin02", "$quickping_location_house" },
			{ "AbandonedLogCabin03", "$quickping_location_house" },
			{ "AbandonedLogCabin04", "$quickping_location_house" },
			{ "DN_hut01", "$quickping_location_house" },
			{ "SwampHut1", "$quickping_location_swamphut" },
			{ "SwampHut1_1", "$quickping_location_swamphut" },
			{ "SwampHut2", "$quickping_location_swamphut" },
			{ "SwampHut2_1", "$quickping_location_swamphut" },
			{ "SwampHut3", "$quickping_location_swamphut" },
			{ "SwampHut3_1", "$quickping_location_swamphut" },
			{ "SwampHut4", "$quickping_location_swamphut" },
			{ "SwampHut5", "$quickping_location_swamphut" },
			{ "GoblinHut01", "GoblinCamp" },
			{ "GoblinHut02", "GoblinCamp" },
			{ "GoblinHut03", "GoblinCamp" },
			{ "StoneTower1", "$quickping_location_tower" },
			{ "StoneTower3", "$quickping_location_tower" },
			{ "Mistlands_GuardTower1_new", "$quickping_location_tower" },
			{ "Mistlands_GuardTower2_new", "$quickping_location_tower" },
			{ "Mistlands_GuardTower3_new", "$quickping_location_tower" },
			{ "Ruin1", "$quickping_location_ruins" },
			{ "Ruin2", "$quickping_location_ruins" },
			{ "Ruin3", "$quickping_location_ruins" },
			{ "CombatRuin01", "$quickping_location_ruins" },
			{ "SwampRuin1", "$quickping_location_ruins" },
			{ "SwampRuin2", "$quickping_location_ruins" },
			{ "StoneTowerRuins03", "$quickping_location_ruins" },
			{ "StoneTowerRuins04", "$quickping_location_ruins" },
			{ "StoneTowerRuins05", "$quickping_location_ruins" },
			{ "StoneTowerRuins05_leet", "$quickping_location_ruins" },
			{ "StoneTowerRuins07", "$quickping_location_ruins" },
			{ "StoneTowerRuins07_sunk", "$quickping_location_ruins" },
			{ "StoneTowerRuins08", "$quickping_location_ruins" },
			{ "StoneTowerRuins08_sunk", "$quickping_location_ruins" },
			{ "StoneTowerRuins09", "$quickping_location_ruins" },
			{ "StoneTowerRuins09_sunk", "$quickping_location_ruins" },
			{ "StoneTowerRuins10", "$quickping_location_ruins" },
			{ "StoneTowerRuins10_sunk", "$quickping_location_ruins" },
			{ "Mistlands_GuardTower1_ruined_new", "$quickping_location_ruins" },
			{ "Mistlands_GuardTower1_ruined_new2", "$quickping_location_ruins" },
			{ "Mistlands_GuardTower3_ruined_new", "$quickping_location_ruins" },
			{ "AshlandRuins", "$quickping_location_ruins" },
			{ "FortressRuins", "$quickping_location_ruins" },
			{ "CharredRuins1", "$quickping_location_ruins" },
			{ "CharredRuins2", "$quickping_location_ruins" },
			{ "CharredRuins3", "$quickping_location_ruins" },
			{ "CharredRuins4", "$quickping_location_ruins" },
			{ "CharredTowerRuins1", "$quickping_location_ruins" },
			{ "CharredTowerRuins1_dvergr", "$quickping_location_ruins" },
			{ "CharredTowerRuins2", "$quickping_location_ruins" },
			{ "CharredTowerRuins3", "$quickping_location_ruins" },
			{ "ShipWreck01", "$quickping_location_shipwreck" },
			{ "ShipWreck02", "$quickping_location_shipwreck" },
			{ "ShipWreck03", "$quickping_location_shipwreck" },
			{ "ShipWreck04", "$quickping_location_shipwreck" },
			{ "ShipWreck01_DN", "$quickping_location_shipwreck" },
			{ "ShipWreck02_DN", "$quickping_location_shipwreck" },
			{ "FrozenShip01_DN", "$quickping_location_shipwreck" },
			{ "FrozenShip02_DN", "$quickping_location_shipwreck" },
			{ "FrozenShip03_DN", "$quickping_location_shipwreck" }
		};

		private static readonly Dictionary<string, string> Translations = new Dictionary<string, string>
		{
			{ "quickping_location_village", "Village" },
			{ "quickping_location_farm", "Farm" },
			{ "quickping_location_lumbercamp", "Lumber Camp" },
			{ "quickping_location_harbour", "Harbour" },
			{ "quickping_location_lighthouse", "Lighthouse" },
			{ "quickping_location_house", "Abandoned House" },
			{ "quickping_location_swamphut", "Swamp Hut" },
			{ "quickping_location_tower", "Tower" },
			{ "quickping_location_ruins", "Ruins" },
			{ "quickping_location_shipwreck", "Shipwreck" },
			{ "quickping_leviathan", "Leviathan" }
		};

		public static void AddTranslations()
		{
			if (Localization.m_instance != null)
			{
				AddWords(Localization.m_instance);
			}
		}

		[HarmonyPatch(typeof(Localization), "SetupLanguage")]
		[HarmonyPostfix]
		private static void SetupLanguage(Localization __instance)
		{
			AddWords(__instance);
		}

		private static void AddWords(Localization localization)
		{
			foreach (KeyValuePair<string, string> translation in Translations)
			{
				if (!localization.m_translations.ContainsKey(translation.Key))
				{
					localization.AddWord(translation.Key, translation.Value);
				}
			}
		}

		public static string Localize(Location location)
		{
			string token = GetToken(location);
			if (!(token == ""))
			{
				return Localization.instance.Localize(token);
			}
			return "";
		}

		public static string GetToken(Location location)
		{
			string key = ((Object)location).name.Replace("(Clone)", "").Trim();
			if (LocationNames.TryGetValue(key, out var value))
			{
				return value;
			}
			return location.m_discoverLabel ?? "";
		}

		public static string GetBaseTranslation(string str)
		{
			if (str == "")
			{
				return "noStr";
			}
			string key = Localization.instance.m_translations.FirstOrDefault((KeyValuePair<string, string> x) => x.Value == str).Key;
			return "$" + key;
		}
	}
	[HarmonyPatch(typeof(MineRock5))]
	internal static class MineRock5_Patch
	{
		[HarmonyPatch(typeof(MineRock5), "AllDestroyed")]
		[HarmonyPostfix]
		public static void AllDestroyed(MineRock5 __instance, bool __result)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (__result && Object.op_Implicit((Object)(object)__instance.m_nview))
			{
				ZDOID uid = __instance.m_nview.GetZDO().m_uid;
				if (DataManager.PinnedObjects.ContainsKey(uid))
				{
					Minimap.instance.RemovePin(DataManager.PinnedObjects[uid]);
				}
			}
		}
	}
	[HarmonyPatch(typeof(WearNTear))]
	internal static class WearNTear_Patch
	{
		[HarmonyPatch(typeof(WearNTear), "Destroy")]
		[HarmonyPrefix]
		public static void Destroy(WearNTear __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance.m_nview) && __instance.m_nview.GetZDO() != null)
			{
				ZDOID uid = __instance.m_nview.GetZDO().m_uid;
				if (DataManager.PinnedObjects.ContainsKey(uid))
				{
					Minimap.instance.RemovePin(DataManager.PinnedObjects[uid]);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Destructible))]
	internal static class Destructible_Patch
	{
		[HarmonyPatch(typeof(Destructible), "Destroy")]
		[HarmonyPrefix]
		public static bool Destroy(Destructible __instance, HitData hit)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = hit?.m_point ?? Vector3.zero;
			Vector3 val2 = hit?.m_dir ?? Vector3.zero;
			Character val3 = ((hit != null) ? hit.GetAttacker() : null);
			__instance.CreateDestructionEffects(val, val2, val3);
			if (__instance.m_destroyNoise > 0f && (hit == null || (int)hit.m_hitType != 20))
			{
				Player closestPlayer = Player.GetClosestPlayer(((Component)__instance).transform.position, 10f);
				if (Object.op_Implicit((Object)(object)closestPlayer))
				{
					((Character)closestPlayer).AddNoise(__instance.m_destroyNoise);
				}
			}
			bool flag = false;
			Character obj = ((hit != null) ? hit.GetAttacker() : null);
			Player val4 = (Player)(object)((obj is Player) ? obj : null);
			if (val4 != null && Object.op_Implicit((Object)(object)val4))
			{
				flag = ((Humanoid)val4).GetInventory().CheatedDamagingItemEquipped() && !PlayerProfile.s_bypassCheatChecks;
				if (flag)
				{
					CheatUtils.SetCheated(__instance.m_nview.GetZDO(), true);
				}
			}
			ZDOID uid = __instance.m_nview.GetZDO().m_uid;
			PinData value2;
			if (Object.op_Implicit((Object)(object)__instance.m_spawnWhenDestroyed))
			{
				GameObject val5 = Object.Instantiate<GameObject>(__instance.m_spawnWhenDestroyed, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation);
				ZNetView component = val5.GetComponent<ZNetView>();
				if (component != null)
				{
					component.SetLocalScale(((Component)__instance).transform.localScale);
					if (flag)
					{
						CheatUtils.SetCheated(component.GetZDO(), true);
					}
				}
				Gibber component2 = val5.GetComponent<Gibber>();
				if (component2 != null)
				{
					component2.Setup(val, val2);
				}
				MineRock5 val6 = default(MineRock5);
				if (val5.TryGetComponent<MineRock5>(ref val6) && (Object)(object)component != (Object)null && DataManager.PinnedObjects.TryGetValue(uid, out var value))
				{
					ZDOID uid2 = component.GetZDO().m_uid;
					if (!DataManager.PinnedObjects.ContainsKey(uid2))
					{
						DataManager.PinnedObjects.Add(uid2, value);
					}
					DataManager.PinnedObjects.Remove(uid);
				}
				if (hit != null)
				{
					MineRock5 component3 = val5.GetComponent<MineRock5>();
					if (component3 != null)
					{
						component3.Damage(hit);
					}
				}
			}
			else if (DataManager.PinnedObjects.TryGetValue(uid, out value2))
			{
				Minimap.instance.RemovePin(value2);
			}
			__instance.m_onDestroyed?.Invoke();
			ZNetScene.instance.Destroy(((Component)__instance).gameObject);
			__instance.m_destroyed = true;
			return false;
		}
	}
	[HarmonyPatch(typeof(Character))]
	internal static class Character_Patch
	{
		[HarmonyPatch(typeof(Character), "OnDeath")]
		[HarmonyPrefix]
		public static void OnDeath(Character __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance.m_nview))
			{
				ZDOID uid = __instance.m_nview.GetZDO().m_uid;
				if (DataManager.PinnedObjects.ContainsKey(uid))
				{
					Minimap.instance.RemovePin(DataManager.PinnedObjects[uid]);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Leviathan))]
	internal static class Leviathan_Patch
	{
		[HarmonyPatch(typeof(Leviathan), "RPC_Left")]
		[HarmonyPostfix]
		public static void RPC_Left(Leviathan __instance)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance.m_nview) && __instance.m_nview.GetZDO() != null)
			{
				ZDOID uid = __instance.m_nview.GetZDO().m_uid;
				if (DataManager.PinnedObjects.ContainsKey(uid))
				{
					Minimap.instance.RemovePin(DataManager.PinnedObjects[uid]);
				}
			}
		}
	}
	internal static class Minimap_Patch
	{
		internal static GameObject panel;

		internal static InputField nameInput;

		internal static Toggle toggleSaveName;

		public static bool IsNaming = false;

		private static string tempOriginalText;

		private static readonly Dictionary<PinType, List<string>> Pinables = new Dictionary<PinType, List<string>>
		{
			{
				(PinType)0,
				new List<string> { "$piece_firepit", "$piece_bonfire", "$piece_fire", "GoblinCamp" }
			},
			{
				(PinType)1,
				new List<string> { "Haldor", "Hildir", "$npc_bogwitch", "$quickping_location_village", "$quickping_location_farm", "$quickping_location_lumbercamp", "$quickping_location_harbour", "$quickping_location_house", "$quickping_location_swamphut" }
			},
			{
				(PinType)2,
				new List<string>
				{
					"$piece_deposit_copper", "$piece_deposit_tin", "$piece_deposit_obsidian", "$piece_deposit_silver", "$piece_deposit_silvervein", "$piece_mudpile", "$piece_giant_brain", "$item_softtissue", "$piece_giant_bone", "$piece_giant_helmet",
					"$piece_giant_sword", "$item_flametalore", "$item_pickable_bogiron", "$item_pickable_sulfurrock", "$piece_deposit_goldvein", "$item_tar", "$item_destructible_gucksack", "$quickping_leviathan"
				}
			},
			{
				(PinType)3,
				new List<string>
				{
					"$item_raspberries", "$item_blueberries", "$item_cloudberries", "$item_lingonberries", "$item_vineberry", "$item_dragonegg", "$item_voltureegg", "$item_dandelion", "$item_mushroomcommon", "$item_mushroomyellow",
					"$item_magecap", "$item_mushroomblue", "$item_thistle", "$item_jotunpuffs", "$item_royaljelly", "$item_fiddleheadfern", "$item_smokepuff", "$item_glowworm", "$item_ancientroot", "$item_carrotseeds",
					"$item_turnipseeds", "$item_onionseeds", "$item_kaleseeds", "$peRaspberryBushName", "$peBlueberryBushName", "$peCloudberryBushName", "$pePickableMushroomName", "$pePickableYellowMushroomName", "$pePickableBlueMushroomName", "$pePickableThistleName",
					"$pePickableDandelionName", "$pePickableJotunpuffsName"
				}
			},
			{
				(PinType)6,
				new List<string>
				{
					"$location_forestcave", "$location_forestcrypt", "$location_bearcave", "Stone Henge", "$location_sunkencrypt", "$location_mountaincave", "$location_dvergrtown", "$location_dvergrboss", "$location_morgenhole", "$charredfortress",
					"$location_thehole", "$location_darkesthole", "$location_dnbossroom", "$location_dnbossroomnew", "$location_morkhalla", "$location_mausoleum", "$quickping_location_ruins", "$quickping_location_tower", "$quickping_location_lighthouse", "$quickping_location_shipwreck",
					"$piece_portal"
				}
			},
			{
				(PinType)9,
				new List<string> { "$enemy_eikthyr", "$enemy_gdking", "$enemy_bonemass", "$enemy_dragon", "$enemy_goblinking", "$enemy_fader" }
			},
			{
				(PinType)14,
				new List<string> { "$hud_pin_hildir1" }
			},
			{
				(PinType)15,
				new List<string> { "$hud_pin_hildir2" }
			},
			{
				(PinType)16,
				new List<string> { "$hud_pin_hildir3" }
			}
		};

		private static readonly PinType[] PinIcons;

		private static readonly Dictionary<PinType, Image> iconImages;

		private static PinData editedPin;

		private static Vector3 editedPos;

		private static IDestructible editedDestructible;

		private static PinType selectedType;

		private static int closingFrame;

		public static PinType IsPinable(string strID)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			string baseTranslation = Localization_Patch.GetBaseTranslation(strID);
			foreach (KeyValuePair<PinType, List<string>> pinable in Pinables)
			{
				if (pinable.Value.Contains(strID) || pinable.Value.Contains(baseTranslation))
				{
					return pinable.Key;
				}
			}
			return (PinType)8;
		}

		private static PinType GetPinType(GameObject hover, string strID)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)hover) && Object.op_Implicit((Object)(object)hover.GetComponent<ItemDrop>()))
			{
				return (PinType)8;
			}
			PinType val = IsPinable(strID);
			if ((int)val == 9 && Object.op_Implicit((Object)(object)hover) && Object.op_Implicit((Object)(object)hover.GetComponent<Character>()))
			{
				return (PinType)8;
			}
			return val;
		}

		internal static PinData FindPin(Vector3 pos)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return Minimap.instance.GetClosestPin(pos, Settings.ClosestPinRange.Value, false);
		}

		public static void AddPin(HoverObject obj)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center);
		}

		public static void ForceAddPin(HoverObject obj)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			AddPin(obj.Hover, obj.Destructible, obj.Name, obj.center, force: true);
		}

		public static void AddPin(GameObject hover, IDestructible idestructible, string strID, Vector3 pos, bool force = false)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Invalid comparison between Unknown and I4
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!Settings.AddPin.Value && !force)
			{
				return;
			}
			PinType val = GetPinType(hover, strID);
			PinData val2 = FindPin(pos);
			if (strID == "$piece_portal")
			{
				Hoverable hoverable = default(Hoverable);
				if (Object.op_Implicit((Object)(object)hover) && hover.TryGetComponent<Hoverable>(ref hoverable))
				{
					if (val2 != null)
					{
						Minimap.instance.RemovePin(val2);
					}
					AddTrackedPin(idestructible, pos, val, GetPortalTag(hoverable));
				}
			}
			else
			{
				if (val2 != null)
				{
					return;
				}
				if ((int)val == 8)
				{
					if (!force)
					{
						return;
					}
					val = Settings.DefaultPinType.Value;
				}
				AddTrackedPin(idestructible, pos, val, ResolvePinName(strID));
			}
		}

		private static string ResolvePinName(string strID)
		{
			if (string.IsNullOrEmpty(strID))
			{
				return "PING !";
			}
			if (DataManager.CustomNames.TryGetValue(strID, out var value))
			{
				return value;
			}
			string text = Localization.instance.Localize(strID);
			if (!string.IsNullOrEmpty(text))
			{
				return text;
			}
			return "PING !";
		}

		private static PinData AddTrackedPin(IDestructible idestructible, Vector3 pos, PinType type, string name)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			PinData val = Minimap.instance.AddPin(pos, type, name, true, false, 0L, default(PlatformUserID));
			QuickPingPlugin.Log.LogInfo((object)$"Add Pin : Name:{name} x:{pos.x}, y:{pos.y}, Type:{type}");
			TrackPin(idestructible, val);
			return val;
		}

		private static void TrackPin(IDestructible idestructible, PinData pinData)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			if (idestructible == null)
			{
				return;
			}
			FieldInfo field = ((object)idestructible).GetType().GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field == null)
			{
				QuickPingPlugin.Log.LogWarning((object)$"Unable to link destructible {idestructible} to pin: {pinData.m_name}. (Is it a god?)");
				return;
			}
			object? value = field.GetValue(idestructible);
			ZNetView val = (ZNetView)((value is ZNetView) ? value : null);
			if (!Object.op_Implicit((Object)(object)val) || val.GetZDO() == null)
			{
				QuickPingPlugin.Log.LogWarning((object)$"Unable to link destructible {idestructible} to pin: {pinData.m_name}. (No ZDO)");
				return;
			}
			ZDOID uid = val.GetZDO().m_uid;
			if (!DataManager.PinnedObjects.ContainsKey(uid))
			{
				DataManager.PinnedObjects[uid] = pinData;
			}
		}

		internal static void OpenCustomNamePing(HoverObject obj)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			if (IsNaming || !Object.op_Implicit((Object)(object)Minimap.instance))
			{
				return;
			}
			editedPin = FindPin(obj.center);
			editedPos = obj.center;
			editedDestructible = obj.Destructible;
			tempOriginalText = obj.Name;
			string name;
			if (editedPin != null)
			{
				name = editedPin.m_name;
				selectedType = editedPin.m_type;
			}
			else
			{
				name = ResolvePinName(obj.Name);
				selectedType = GetPinType(obj.Hover, obj.Name);
				if ((int)selectedType == 8)
				{
					selectedType = Settings.DefaultPinType.Value;
				}
			}
			if (InitNameInput(name))
			{
				closingFrame = -1;
				InputBlocker.Block(state: true);
			}
		}

		public static void UpdateNameInput()
		{
			if (closingFrame >= 0)
			{
				if (Time.frameCount > closingFrame)
				{
					closingFrame = -1;
					IsNaming = false;
					InputBlocker.Block(state: false);
				}
			}
			else if (!Object.op_Implicit((Object)(object)panel) || !Object.op_Implicit((Object)(object)nameInput))
			{
				CloseCustomNamePing();
			}
			else if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))
			{
				ConfirmCustomNamePing();
			}
			else if (Input.GetKeyDown((KeyCode)27))
			{
				CloseCustomNamePing();
			}
			else if (Object.op_Implicit((Object)(object)EventSystem.current) && !Object.op_Implicit((Object)(object)EventSystem.current.currentSelectedGameObject))
			{
				EventSystem.current.SetSelectedGameObject(((Component)nameInput).gameObject);
			}
		}

		internal static void ConfirmCustomNamePing()
		{
			ValidateNameInput(nameInput, toggleSaveName.isOn);
		}

		internal static void CloseCustomNamePing()
		{
			DestroyGUI();
			editedPin = null;
			editedDestructible = null;
			tempOriginalText = null;
			closingFrame = Time.frameCount;
		}

		private static void DestroyGUI()
		{
			iconImages.Clear();
			if (Object.op_Implicit((Object)(object)panel))
			{
				Object.Destroy((Object)(object)panel);
			}
			panel = null;
			nameInput = null;
			toggleSaveName = null;
		}

		private static void ValidateNameInput(InputField inputField, bool save)
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			string text = inputField.text;
			text = text.Replace('$', ' ');
			text = text.Replace('<', ' ');
			text = text.Replace('>', ' ');
			string text2 = tempOriginalText;
			if (editedPin != null && Minimap.instance.m_pins.Contains(editedPin))
			{
				UpdatePin(editedPin, text, selectedType);
			}
			else
			{
				AddTrackedPin(editedDestructible, editedPos, selectedType, text);
			}
			if (save && CanRememberName(text2))
			{
				if (text == "")
				{
					DataManager.CustomNames.Remove(text2);
				}
				else
				{
					QuickPingPlugin.Log.LogInfo((object)("Save name " + text + " for " + text2));
					SaveName(text, text2);
				}
			}
			CloseCustomNamePing();
		}

		private static bool CanRememberName(string originalText)
		{
			if (!string.IsNullOrEmpty(originalText))
			{
				return originalText != "PING !";
			}
			return false;
		}

		private static void UpdatePin(PinData pin, string name, PinType type)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			foreach (ZDOID item in (from p in DataManager.PinnedObjects
				where p.Value.Compare(pin)
				select p.Key).ToList())
			{
				DataManager.PinnedObjects[item] = pin;
			}
			pin.m_name = name;
			pin.m_type = type;
			pin.m_icon = Minimap.instance.GetSprite(type);
			Minimap.instance.DestroyPinMarker(pin);
			pin.m_NamePinData = (string.IsNullOrEmpty(name) ? ((PinNameData)null) : new PinNameData(pin));
			Minimap.instance.m_pinUpdateRequired = true;
		}

		private static void SaveName(string m_name, string originalName)
		{
			DataManager.CustomNames[originalName] = m_name;
		}

		internal static void SelectIcon(PinType type)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			selectedType = type;
			foreach (KeyValuePair<PinType, Image> iconImage in iconImages)
			{
				((Graphic)iconImage.Value).color = (Color)((iconImage.Key == type) ? Color.white : new Color(1f, 1f, 1f, 0.35f));
			}
		}

		private static bool InitNameInput(string name)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			Transform canvas = GameUI.Canvas;
			if (!Object.op_Implicit((Object)(object)canvas))
			{
				return false;
			}
			IsNaming = true;
			panel = GameUI.CreateWoodPanel(canvas, 260f, 150f);
			VerticalLayoutGroup obj = panel.gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f;
			((LayoutGroup)obj).padding = new RectOffset(15, 15, 15, 15);
			((LayoutGroup)obj).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			nameInput = GameUI.CreateInputField(panel.transform, "Pin Name", 16, 200f, 30f);
			((Component)nameInput).gameObject.AddComponent<LayoutElement>().preferredHeight = 30f;
			nameInput.text = name;
			GameObject val = new GameObject("Icons", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(panel.transform, false);
			val.AddComponent<LayoutElement>().preferredHeight = 32f;
			HorizontalLayoutGroup obj2 = val.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj2).spacing = 8f;
			((LayoutGroup)obj2).childAlignment = (TextAnchor)4;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
			PinType[] pinIcons = PinIcons;
			for (int i = 0; i < pinIcons.Length; i++)
			{
				PinType type = pinIcons[i];
				GameObject val2 = new GameObject(((object)Unsafe.As<PinType, PinType>(ref type)/*cast due to .constrained prefix*/).ToString(), new Type[1] { typeof(RectTransform) });
				val2.transform.SetParent(val.transform, false);
				((RectTransform)val2.transform).sizeDelta = new Vector2(32f, 32f);
				Image val3 = val2.AddComponent<Image>();
				val3.sprite = Minimap.instance.GetSprite(type);
				val3.preserveAspect = true;
				Button obj3 = val2.AddComponent<Button>();
				((Selectable)obj3).targetGraphic = (Graphic)(object)val3;
				Navigation navigation = default(Navigation);
				((Navigation)(ref navigation)).mode = (Mode)0;
				((Selectable)obj3).navigation = navigation;
				((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					SelectIcon(type);
				});
				iconImages[type] = val3;
			}
			SelectIcon(selectedType);
			toggleSaveName = GameUI.CreateToggle(panel.transform, "Remember this name", 20f);
			((Component)toggleSaveName).gameObject.AddComponent<LayoutElement>().preferredHeight = 20f;
			((Component)toggleSaveName).gameObject.SetActive(CanRememberName(tempOriginalText));
			if (Object.op_Implicit((Object)(object)EventSystem.current))
			{
				EventSystem.current.SetSelectedGameObject(((Component)nameInput).gameObject);
			}
			return true;
		}

		private static string GetPortalTag(Hoverable hoverable)
		{
			string[] array = hoverable.GetHoverText().Split(new char[1] { '"' });
			if (array.Length > 2 && array[1].Trim() != "")
			{
				return array[1];
			}
			return Localization.instance.Localize(hoverable.GetHoverName());
		}

		[HarmonyPatch(typeof(Minimap))]
		[HarmonyPatch("RemovePin", new Type[] { typeof(PinData) })]
		[HarmonyPrefix]
		public static bool RemovePin(Minimap __instance, PinData pin)
		{
			//IL_004a: 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 (pin == null || pin.m_name == null || pin.m_name == "")
			{
				return true;
			}
			foreach (KeyValuePair<ZDOID, PinData> pinnedObject in DataManager.PinnedObjects)
			{
				if (pinnedObject.Value.Compare(pin))
				{
					pin = FindPin(pinnedObject.Value.m_pos) ?? pin;
					DataManager.PinnedObjects.Remove(pinnedObject.Key);
					break;
				}
			}
			__instance.m_pinUpdateRequired = true;
			__instance.DestroyPinMarker(pin);
			__instance.m_pins.Remove(pin);
			return false;
		}

		static Minimap_Patch()
		{
			PinType[] array = new PinType[5];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			PinIcons = (PinType[])(object)array;
			iconImages = new Dictionary<PinType, Image>();
			closingFrame = -1;
		}
	}
	internal static class Player_Patch
	{
		public static UnityEvent<HoverObject> OnPlayerPing = new UnityEvent<HoverObject>();

		public static UnityEvent<HoverObject> OnPlayerForcePing = new UnityEvent<HoverObject>();

		public static UnityEvent<HoverObject> OnPlayerCustomNamePing = new UnityEvent<HoverObject>();

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

		[HarmonyPatch(typeof(Player), "Update")]
		[HarmonyPostfix]
		private static void Player_Update(Player __instance)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			if (ZInput.instance == null || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || (Object)(object)Player.m_localPlayer != (Object)(object)__instance || (!Settings.PingWhereLooking.Value && !Settings.AddPin.Value))
			{
				return;
			}
			if (Minimap_Patch.IsNaming)
			{
				Minimap_Patch.UpdateNameInput();
			}
			if (((Character)Player.m_localPlayer).TakeInput() && (int)Settings.PingKey.Value != 0)
			{
				if (Settings.IsDown(Settings.CustomNamePingKey.Value))
				{
					OnPlayerCustomNamePing.Invoke(FindPingTarget());
				}
				else if (Settings.IsDown(Settings.PingKey.Value))
				{
					OnPlayerPing.Invoke(FindPingTarget());
				}
				else if (Settings.IsDown(Settings.PinEverythingKey.Value))
				{
					OnPlayerForcePing.Invoke(FindPingTarget());
				}
			}
		}

		internal static HoverObject FindPingTarget()
		{
			HoverObject hoverObject = FindHoverObject(500f);
			hoverObject.Name = GetHoverName(hoverObject.Name, hoverObject.Hover, hoverObject.type);
			return hoverObject;
		}

		private static string GetHoverName(string pingText, GameObject hover, HoverType type)
		{
			switch (type)
			{
			case HoverType.Hoverable:
			{
				Hoverable val = default(Hoverable);
				hover.TryGetComponent<Hoverable>(ref val);
				pingText = ((!val.GetHoverName().StartsWith("$")) ? Localization_Patch.GetBaseTranslation(val.GetHoverName()) : val.GetHoverName());
				if (pingText == "$")
				{
					pingText = val.GetHoverName();
				}
				if (pingText == "noStr")
				{
					pingText = val.GetHoverName();
				}
				if (((object)val).ToString().Contains("ReadMap") || ((object)val).ToString().Contains("WriteMap") || ((object)val).ToString().Contains("add_ore") || ((object)val).ToString().Contains("add_wood") || (((object)val).ToString().Contains("door") && Object.op_Implicit((Object)(object)hover.transform.parent) && Object.op_Implicit((Object)(object)((Component)hover.transform).GetComponentInParent<Piece>())))
				{
					pingText = hover.GetComponentInParent<Piece>().m_name;
				}
				break;
			}
			case HoverType.Piece:
				pingText = hover.GetComponent<Piece>().m_name;
				break;
			case HoverType.Location:
				pingText = Localization_Patch.GetToken(hover.GetComponent<Location>());
				break;
			case HoverType.Character:
				pingText = hover.GetComponent<Character>().m_name;
				break;
			}
			return pingText;
		}

		public static HoverObject FindHoverObject(float range)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			HoverObject hoverObject = new HoverObject
			{
				type = HoverType.GameObject,
				pos = ((Character)Player.m_localPlayer).GetHeadPoint(),
				center = ((Character)Player.m_localPlayer).GetHeadPoint(),
				Name = "PING !"
			};
			RaycastHit[] array = Physics.RaycastAll(((Component)GameCamera.instance).transform.position, ((Component)GameCamera.instance).transform.forward, range + 10f, PingLayers);
			Array.Sort(array, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance));
			int num = Array.FindIndex(array, (RaycastHit hit) => !OverlappingPlayer(hit));
			if (num < 0)
			{
				Ray val = default(Ray);
				((Ray)(ref val))..ctor(((Component)GameCamera.instance).transform.position, ((Component)GameCamera.instance).transform.forward);
				hoverObject.pos = ((Ray)(ref val)).GetPoint(range);
				hoverObject.center = hoverObject.pos;
				return hoverObject;
			}
			RaycastHit val2 = array[num];
			hoverObject.pos = ((RaycastHit)(ref val2)).point;
			if (Vector3.Distance(((Character)Player.m_localPlayer).GetEyePoint(), ((RaycastHit)(ref val2)).point) < range)
			{
				Transform transform = ((Component)((RaycastHit)(ref val2)).collider).transform;
				Character val3 = (Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider.attachedRigidbody) ? ((Component)((RaycastHit)(ref val2)).collider.attachedRigidbody).GetComponent<Character>() : ((Component)((RaycastHit)(ref val2)).collider).GetComponent<Character>());
				if ((Object)(object)val3 != (Object)null && (!Object.op_Implicit((Object)(object)val3.GetBaseAI()) || !val3.GetBaseAI().IsSleeping()))
				{
					hoverObject.type = HoverType.Character;
					hoverObject.Hover = ((Component)val3).gameObject;
					hoverObject.center = ((Component)val3).transform.position;
				}
				else if ((hoverObject.type = CheckType(transform, out hoverObject.Destructible)) != HoverType.GameObject)
				{
					hoverObject.Hover = ((Component)transform).gameObject;
					hoverObject.center = hoverObject.Hover.transform.position;
				}
				else if (!TryFindInChildren(transform, hoverObject) && (Object)(object)transform.parent != (Object)null)
				{
					hoverObject.Destructible = GO_Ext.GetRecursiveComponentInParents<IDestructible>(transform);
					if (Object.op_Implicit((Object)(object)(hoverObject.Hover = GO_Ext.GetRecursiveParentWithComponent<Location>(transform))))
					{
						hoverObject.type = HoverType.Location;
					}
					else if (Object.op_Implicit((Object)(object)(hoverObject.Hover = GO_Ext.GetRecursiveParentWithComponent<Piece>(transform))))
					{
						hoverObject.type = HoverType.Piece;
					}
					else if (Object.op_Implicit((Object)(object)(hoverObject.Hover = GO_Ext.GetRecursiveParentWithComponent<Hoverable>(transform))))
					{
						hoverObject.type = HoverType.Hoverable;
					}
				}
				Leviathan componentInParent = ((Component)transform).GetComponentInParent<Leviathan>();
				if (Object.op_Implicit((Object)(object)componentInParent))
				{
					hoverObject.type = HoverType.GameObject;
					hoverObject.Hover = ((Component)componentInParent).gameObject;
					hoverObject.Name = "$quickping_leviathan";
					hoverObject.Destructible = (IDestructible)(object)componentInParent.m_mineRock;
				}
				else
				{
					TryUseLocation(hoverObject, transform, ((RaycastHit)(ref val2)).point);
				}
			}
			if (Object.op_Implicit((Object)(object)hoverObject.Hover))
			{
				hoverObject.center = hoverObject.Hover.transform.position;
			}
			else
			{
				hoverObject.center = hoverObject.pos;
			}
			return hoverObject;
		}

		private static HoverType CheckType(Transform root, out IDestructible destructible)
		{
			destructible = ((Component)root).GetComponent<IDestructible>();
			if (((Component)root).GetComponent<Hoverable>() != null)
			{
				return HoverType.Hoverable;
			}
			if ((Object)(object)((Component)root).GetComponent<Location>() != (Object)null)
			{
				return HoverType.Location;
			}
			if (Object.op_Implicit((Object)(object)((Component)root).GetComponent<Piece>()))
			{
				return HoverType.Piece;
			}
			return HoverType.GameObject;
		}

		private static void TryUseLocation(HoverObject hoverObj, Transform hitTransform, Vector3 point)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Invalid comparison between Unknown and I4
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			if (hoverObj.type == HoverType.Character)
			{
				return;
			}
			Location componentInParent = ((Component)hitTransform).GetComponentInParent<Location>();
			Piece componentInParent2 = ((Component)hitTransform).GetComponentInParent<Piece>();
			if (!Object.op_Implicit((Object)(object)componentInParent) && !(Object.op_Implicit((Object)(object)componentInParent2) ? (!componentInParent2.IsPlacedByPlayer()) : Object.op_Implicit((Object)(object)((Component)hitTransform).GetComponentInParent<WearNTear>())))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)hoverObj.Hover) && hoverObj.type != HoverType.Location)
			{
				string text;
				try
				{
					text = GetHoverName(hoverObj.Name, hoverObj.Hover, hoverObj.type);
				}
				catch (Exception)
				{
					text = null;
				}
				if (text != null && (int)Minimap_Patch.IsPinable(text) != 8)
				{
					return;
				}
			}
			Location val = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent : Location.GetLocation(point, true));
			if (Object.op_Implicit((Object)(object)val) && !(Localization_Patch.Localize(val) == ""))
			{
				hoverObj.type = HoverType.Location;
				hoverObj.Hover = ((Component)val).gameObject;
				hoverObj.Destructible = null;
			}
		}

		private static bool TryFindInChildren(Transform root, HoverObject hoverObj)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>();
			foreach (Transform val in componentsInChildren)
			{
				if (!((Object)(object)val == (Object)(object)root) && (hoverObj.type = CheckType(val, out hoverObj.Destructible)) != HoverType.GameObject)
				{
					hoverObj.Hover = ((Component)val).gameObject;
					hoverObj.center = val.position;
					return true;
				}
			}
			return false;
		}

		private static bool OverlappingPlayer(RaycastHit raycastHit)
		{
			if (Object.op_Implicit((Object)(object)((RaycastHit)(ref raycastHit)).collider.attachedRigidbody))
			{
				return (Object)(object)((Component)((RaycastHit)(ref raycastHit)).collider.attachedRigidbody).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject;
			}
			return false;
		}

		public static void SendPing(HoverObject ping)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			SendPing(ping.pos, Localization.instance.Localize(ping.Name));
		}

		internal static void SendPing(Vector3 position, string text, bool local = false)
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && Settings.PingWhereLooking.Value)
			{
				QuickPingPlugin.Log.LogInfo((object)("SendPing : " + text));
				ZRoutedRpc instance = ZRoutedRpc.instance;
				long num;
				if (!local)
				{
					num = 0L;
				}
				else
				{
					ZDOID zDOID = ((Character)Player.m_localPlayer).GetZDOID();
					num = ((ZDOID)(ref zDOID)).UserID;
				}
				instance.InvokeRoutedRPC(num, "ChatMessage", new object[4]
				{
					position,
					3,
					UserInfo.GetLocalUser(),
					text
				});
				if (Player.m_debugMode && (Object)(object)Console.instance != (Object)null && ((Terminal)Console.instance).IsCheatsEnabled())
				{
					((Terminal)Console.instance).AddString($"Pinged at: {position.x}, {position.z}");
				}
			}
		}
	}
	internal static class SaveCollection_Patch
	{
		private static bool repaired;

		[HarmonyPatch(typeof(SaveCollection), "Reload")]
		[HarmonyPrefix]
		private static void Reload(SaveCollection __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!repaired && (int)__instance.m_dataType == 0)
			{
				repaired = true;
				DataManager.RepairMisnamedCloudFiles();
			}
		}
	}
	internal class Terminal_Patch
	{
		[HarmonyPatch(typeof(Terminal), "AddString", new Type[]
		{
			typeof(PlatformUserID),
			typeof(string),
			typeof(Type),
			typeof(bool)
		})]
		[HarmonyPrefix]
		public unsafe static bool AddString(Terminal __instance, PlatformUserID user, string text, Type type, bool timestamp = false)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			Color value;
			if ((int)type != 0)
			{
				if ((int)type == 2)
				{
					value = Settings.ShoutColor.Value;
					text = text.ToUpper();
				}
				else
				{
					value = Settings.DefaultColor.Value;
				}
			}
			else
			{
				value = Settings.WhisperColor.Value;
				text = text.ToLowerInvariant();
			}
			PlayerInfo val = default(PlayerInfo);
			string text2 = (ZNet.TryGetPlayerByPlatformUserID(user, ref val) ? CensorShittyWords.FilterUGC(val.m_name, (UGCType)2, user, 0L, (GetUserProfileCompletedHandler)null) : ((object)(*(PlatformUserID*)(&user))/*cast due to .constrained prefix*/).ToString());
			string text3 = (timestamp ? ("[" + DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss") + "] ") : "");
			text3 = text3 + "<color=#" + ColorUtility.ToHtmlStringRGBA(Settings.PlayerColor.Value) + ">" + text2 + "</color>: <color=#" + ColorUtility.ToHtmlStringRGBA(value) + ">" + text + "</color>";
			__instance.AddString(text3);
			return false;
		}
	}
	public class ZNet_Patch
	{
		[HarmonyPatch(typeof(ZNet), "LoadWorld")]
		[HarmonyPostfix]
		private static void LoadWorld(ZNet __instance)
		{
			DataManager.Load(ZNet.m_world, Game.instance.GetPlayerProfile());
		}

		[HarmonyPatch(typeof(ZNet), "SaveWorldThread")]
		[HarmonyPostfix]
		private static void SaveWorldThread()
		{
			bool flag = DataManager.Save(ZNet.m_world, Game.instance.GetPlayerProfile());
			QuickPingPlugin.Log.LogInfo((object)$"cloud save : {!flag}");
		}
	}
}