ESP.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Data;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Service;
using TMPro;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using Visualization;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("ESP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+48d7c872a9d784a20cb3af6a7a8b2f093a4b2e45")]
[assembly: AssemblyProduct("ESP")]
[assembly: AssemblyTitle("ESP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Visualization
{
	public class Draw
	{
		public const string TriggerLayer = "character_trigger";

		private static readonly Texture2D Texture = new Texture2D(1, 1);

		private static Shader? lineShader;

		private static string shaderName = "Sprites/Default";

		private static readonly Dictionary<Color, Material> materials = new Dictionary<Color, Material>();

		private static readonly Dictionary<string, Color> colors = new Dictionary<string, Color>();

		private static readonly Dictionary<string, int> lineWidths = new Dictionary<string, int>();

		private static Shader LineShader => lineShader ?? (lineShader = ((IEnumerable<Shader>)Resources.FindObjectsOfTypeAll<Shader>()).FirstOrDefault((Func<Shader, bool>)((Shader shader) => ((Object)shader).name == shaderName)) ?? ((IEnumerable<Shader>)Resources.FindObjectsOfTypeAll<Shader>()).FirstOrDefault((Func<Shader, bool>)((Shader shader) => ((Object)shader).name == "Sprites/Default")) ?? throw new Exception("Shader not found."));

		private static int GetSegments(float angle)
		{
			return (int)Math.Floor(32f * angle / 360f);
		}

		private static Vector3 GetArcSegmentX(float angle, float radius)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(0f, Mathf.Sin((float)Math.PI / 180f * angle) * radius, Mathf.Cos((float)Math.PI / 180f * angle) * radius);
		}

		private static Vector3 GetArcSegmentY(float angle, float radius)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(Mathf.Sin((float)Math.PI / 180f * angle) * radius, 0f, Mathf.Cos((float)Math.PI / 180f * angle) * radius);
		}

		private static Vector3 GetArcSegmentZ(float angle, float radius)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			return new Vector3(Mathf.Sin((float)Math.PI / 180f * angle) * radius, Mathf.Cos((float)Math.PI / 180f * angle) * radius, 0f);
		}

		private static Vector3[] GetArcSegmentsX(Vector3 position, float angle, float radius)
		{
			//IL_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			float num = (0f - angle) / 2f;
			int segments = GetSegments(angle);
			Vector3[] array = (Vector3[])(object)new Vector3[segments + 1];
			for (int i = 0; i <= segments; i++)
			{
				array[i] = position + GetArcSegmentX(num, radius);
				num += angle / (float)segments;
			}
			return array;
		}

		private static Vector3[] GetArcSegmentsY(Vector3 position, float angle, float radius)
		{
			//IL_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			float num = (0f - angle) / 2f;
			int segments = GetSegments(angle);
			Vector3[] array = (Vector3[])(object)new Vector3[segments + 1];
			for (int i = 0; i <= segments; i++)
			{
				array[i] = position + GetArcSegmentY(num, radius);
				num += angle / (float)segments;
			}
			return array;
		}

		private static Vector3[] GetArcSegmentsZ(Vector3 position, float angle, float radius)
		{
			//IL_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			float num = (0f - angle) / 2f;
			int segments = GetSegments(angle);
			Vector3[] array = (Vector3[])(object)new Vector3[segments + 1];
			for (int i = 0; i <= segments; i++)
			{
				array[i] = position + GetArcSegmentZ(num, radius);
				num += angle / (float)segments;
			}
			return array;
		}

		private static void UpdateArcX(LineRenderer renderer, Vector3 position, float radius, float angle, float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] arcSegmentsX = GetArcSegmentsX(position, angle, radius - width / 2f);
			renderer.positionCount = arcSegmentsX.Length;
			renderer.SetPositions(arcSegmentsX);
		}

		public static void DrawArcX(GameObject obj, Vector3 position, float radius, float angle)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			UpdateArcX(CreateRenderer(obj), position, radius, angle, GetLineWidth(((Object)obj).name));
		}

		private static void UpdateArcY(LineRenderer renderer, Vector3 position, float radius, float angle, float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] arcSegmentsY = GetArcSegmentsY(position, angle, radius - width / 2f);
			renderer.positionCount = arcSegmentsY.Length;
			renderer.SetPositions(arcSegmentsY);
		}

		public static void DrawArcY(GameObject obj, Vector3 position, float radius, float angle)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			UpdateArcY(CreateRenderer(obj), position, radius, angle, GetLineWidth(((Object)obj).name));
		}

		private static void UpdateArcZ(LineRenderer renderer, Vector3 position, float radius, float angle, float width)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] arcSegmentsZ = GetArcSegmentsZ(position, angle, radius - width / 2f);
			renderer.positionCount = arcSegmentsZ.Length;
			renderer.SetPositions(arcSegmentsZ);
		}

		public static void DrawArcZ(GameObject obj, Vector3 position, float radius, float angle)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			UpdateArcZ(CreateRenderer(obj), position, radius, angle, GetLineWidth(((Object)obj).name));
		}

		public static GameObject DrawArc(string tag, MonoBehaviour parent, Vector3 position, float radius, float angle)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateObject(((Component)parent).gameObject, tag);
			DrawArcY(CreateObject(obj, tag), position, radius, angle);
			DrawArcX(CreateObject(obj, tag), position, radius, angle);
			AddMeshCollider(obj);
			return obj;
		}

		public static void DrawConeX(GameObject obj, Vector3 position, float radius, float angle)
		{
			//IL_0013: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer val = CreateRenderer(obj);
			float lineWidth = GetLineWidth(((Object)obj).name);
			Vector3[] arcSegmentsX = GetArcSegmentsX(position, angle, radius - lineWidth / 2f);
			val.positionCount = arcSegmentsX.Length + 2;
			val.SetPosition(0, position);
			for (int i = 0; i < arcSegmentsX.Length; i++)
			{
				val.SetPosition(i + 1, arcSegmentsX[i]);
			}
			val.SetPosition(arcSegmentsX.Length + 1, position);
		}

		public static void DrawConeY(GameObject obj, Vector3 position, float radius, float angle)
		{
			//IL_0013: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer val = CreateRenderer(obj);
			float lineWidth = GetLineWidth(((Object)obj).name);
			Vector3[] arcSegmentsY = GetArcSegmentsY(position, angle, radius - lineWidth / 2f);
			val.positionCount = arcSegmentsY.Length + 2;
			val.SetPosition(0, position);
			for (int i = 0; i < arcSegmentsY.Length; i++)
			{
				val.SetPosition(i + 1, arcSegmentsY[i]);
			}
			val.SetPosition(arcSegmentsY.Length + 1, position);
		}

		public static void DrawConeZ(GameObject obj, Vector3 position, float radius, float angle)
		{
			//IL_0013: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer val = CreateRenderer(obj);
			float lineWidth = GetLineWidth(((Object)obj).name);
			Vector3[] arcSegmentsZ = GetArcSegmentsZ(position, angle, radius - lineWidth / 2f);
			val.positionCount = arcSegmentsZ.Length + 2;
			val.SetPosition(0, position);
			for (int i = 0; i < arcSegmentsZ.Length; i++)
			{
				val.SetPosition(i + 1, arcSegmentsZ[i]);
			}
			val.SetPosition(arcSegmentsZ.Length + 1, position);
		}

		public static GameObject DrawCone(string tag, MonoBehaviour parent, Vector3 position, float radius, float angle)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateObject(((Component)parent).gameObject, tag);
			DrawConeY(CreateObject(obj, tag), position, radius, angle);
			DrawConeX(CreateObject(obj, tag), position, radius, angle);
			AddMeshCollider(obj);
			return obj;
		}

		public static void SetShader(string name)
		{
			shaderName = name;
			lineShader = null;
			materials.Clear();
			Visualization[] visualizations = Utils.GetVisualizations();
			for (int i = 0; i < visualizations.Length; i++)
			{
				ChangeColor(((Component)visualizations[i]).gameObject);
			}
		}

		public static void Init()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Texture.SetPixel(0, 0, Color.gray);
		}

		private static GameObject CreateObject(GameObject parent, string tag, Quaternion? fixedRotation = null)
		{
			//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_0016: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject
			{
				layer = LayerMask.NameToLayer("character_trigger")
			};
			val.transform.parent = parent.transform;
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			if (tag != "")
			{
				((Object)val).name = tag;
				Visualization visualization = val.AddComponent<Visualization>();
				visualization.Tag = tag;
				if (fixedRotation.HasValue)
				{
					visualization.SetFixed(fixedRotation.Value);
				}
				val.SetActive(Visibility.IsTag(tag));
			}
			return val;
		}

		private static Material GetMaterial(Color color)
		{
			//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_0024: Expected O, but got Unknown
			//IL_002a: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			if (materials.ContainsKey(color))
			{
				return materials[color];
			}
			Material val = new Material(LineShader);
			val.SetColor("_Color", color);
			val.SetFloat("_BlendOp", 1f);
			val.SetTexture("_MainTex", (Texture)(object)Texture);
			materials[color] = val;
			return val;
		}

		private static LineRenderer CreateRenderer(GameObject obj)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer obj2 = obj.AddComponent<LineRenderer>();
			obj2.useWorldSpace = false;
			((Renderer)obj2).sharedMaterial = GetMaterial(GetColor(((Object)obj).name));
			((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)0;
			obj2.widthMultiplier = GetLineWidth(((Object)obj).name);
			return obj2;
		}

		private static void ChangeColor(GameObject obj)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer component = obj.GetComponent<LineRenderer>();
			if (Object.op_Implicit((Object)(object)component))
			{
				((Renderer)component).sharedMaterial = GetMaterial(GetColor(((Object)obj).name));
			}
		}

		private static void ChangeLineWidth(GameObject obj)
		{
			float lineWidth = GetLineWidth(((Object)obj).name);
			LineRenderer component = obj.GetComponent<LineRenderer>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.widthMultiplier = lineWidth;
			}
		}

		public static void AddMeshCollider(GameObject obj)
		{
			GameObject obj2 = obj;
			Array.ForEach(obj2.GetComponentsInChildren<LineRenderer>(), delegate(LineRenderer renderer)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				MeshCollider obj3 = obj2.AddComponent<MeshCollider>();
				obj3.convex = true;
				((Collider)obj3).isTrigger = true;
				Mesh val = new Mesh();
				renderer.BakeMesh(val, false);
				obj3.sharedMesh = val;
			});
		}

		public static void AddText(GameObject obj, string title, string text)
		{
			StaticText staticText = obj.AddComponent<StaticText>();
			staticText.text = text;
			staticText.title = title;
		}

		public static LineRenderer[] GetRenderers(MonoBehaviour obj, string tag)
		{
			return GetRenderers(obj, new string[1] { tag });
		}

		public static LineRenderer[] GetRenderers(MonoBehaviour obj, string[] tags)
		{
			HashSet<string> set = tags.ToHashSet();
			return ((Component)obj).GetComponentsInChildren<LineRenderer>(true).Where(delegate(LineRenderer renderer)
			{
				Visualization component = ((Component)renderer).GetComponent<Visualization>();
				return Object.op_Implicit((Object)(object)component) && set.Contains(component.Tag);
			}).ToArray();
		}

		public static bool HasVisual(MonoBehaviour obj, string tag)
		{
			string tag2 = tag;
			return ((Component)obj).GetComponentsInChildren<Visualization>(true).Any((Visualization visualization) => visualization.Tag == tag2);
		}

		public static Color GetColor(string tag)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (!colors.ContainsKey(tag))
			{
				return Color.white;
			}
			return colors[tag];
		}

		public static void SetColor(string tag, Color color)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			colors[tag] = color;
			Visualization[] visualizations = Utils.GetVisualizations();
			foreach (Visualization visualization in visualizations)
			{
				if (visualization.Tag == tag)
				{
					ChangeColor(((Component)visualization).gameObject);
				}
			}
		}

		public static float GetLineWidth(string tag)
		{
			return (float)Math.Max(1, lineWidths.ContainsKey(tag) ? lineWidths[tag] : 0) / 100f;
		}

		public static void SetLineWidth(string tag, int width)
		{
			lineWidths[tag] = width;
			Visualization[] visualizations = Utils.GetVisualizations();
			foreach (Visualization visualization in visualizations)
			{
				if (visualization.Tag == tag)
				{
					ChangeLineWidth(((Component)visualization).gameObject);
				}
			}
		}

		public static GameObject DrawCylinder(string tag, MonoBehaviour parent, float radius)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateObject(((Component)parent).gameObject, tag);
			DrawArcY(CreateObject(obj, tag), Vector3.zero, radius, 360f);
			float lineWidth = GetLineWidth(tag);
			AddSphereCollider(obj, radius - lineWidth / 2f);
			Vector3 start = default(Vector3);
			((Vector3)(ref start))..ctor(radius, -500f, 0f);
			Vector3 end = default(Vector3);
			((Vector3)(ref end))..ctor(radius, 500f, 0f);
			AddBoxCollider(DrawLineSub(CreateObject(obj, tag), start, end));
			((Vector3)(ref start))..ctor(0f - radius, -500f, 0f);
			((Vector3)(ref end))..ctor(0f - radius, 500f, 0f);
			AddBoxCollider(DrawLineSub(CreateObject(obj, tag), start, end));
			((Vector3)(ref start))..ctor(0f, -500f, radius);
			((Vector3)(ref end))..ctor(0f, 500f, radius);
			AddBoxCollider(DrawLineSub(CreateObject(obj, tag), start, end));
			((Vector3)(ref start))..ctor(0f, -500f, 0f - radius);
			((Vector3)(ref end))..ctor(0f, 500f, 0f - radius);
			AddBoxCollider(DrawLineSub(CreateObject(obj, tag), start, end));
			return obj;
		}

		private static void AddBoxCollider(GameObject obj)
		{
			GameObject obj2 = obj;
			Array.ForEach(obj2.GetComponentsInChildren<LineRenderer>(), delegate(LineRenderer renderer)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: 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_0031: Unknown result type (might be due to invalid IL or missing references)
				//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_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				Vector3 position = renderer.GetPosition(0);
				Vector3 position2 = renderer.GetPosition(renderer.positionCount - 1);
				float widthMultiplier = renderer.widthMultiplier;
				BoxCollider obj3 = obj2.AddComponent<BoxCollider>();
				((Collider)obj3).isTrigger = true;
				obj3.center = position + (position2 - position) / 2f;
				Vector3 val = position2 - position;
				val.x = Math.Abs(val.x);
				val.y = Math.Abs(val.y);
				val.z = Math.Abs(val.z);
				obj3.size = val + 2f * new Vector3(widthMultiplier, widthMultiplier, widthMultiplier);
			});
		}

		private static void AddBoxCollider(GameObject obj, Vector3 center, Vector3 size)
		{
			//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)
			BoxCollider obj2 = obj.AddComponent<BoxCollider>();
			((Collider)obj2).isTrigger = true;
			obj2.center = center;
			obj2.size = size;
		}

		private static GameObject DrawLineSub(GameObject obj, Vector3 start, Vector3 end)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer obj2 = CreateRenderer(obj);
			obj2.SetPosition(0, start);
			obj2.SetPosition(1, end);
			return obj;
		}

		public static GameObject DrawLine(string tag, MonoBehaviour parent, Vector3 start, Vector3 end)
		{
			//IL_0015: 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)
			GameObject obj = DrawLineSub(CreateObject(((Component)parent).gameObject, tag), start, end);
			AddBoxCollider(obj);
			return obj;
		}

		public static GameObject DrawLineWithFixedRotation(string tag, MonoBehaviour parent, Vector3 start, Vector3 end)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			Quaternion val = Quaternion.FromToRotation(Vector3.forward, end - start);
			GameObject obj = CreateObject(((Component)parent).gameObject, tag, val);
			Vector3 start2 = Quaternion.Inverse(val) * start;
			Vector3 end2 = Quaternion.Inverse(val) * end;
			GameObject obj2 = DrawLineSub(obj, start2, end2);
			AddBoxCollider(obj2);
			return obj2;
		}

		public static GameObject DrawMarkerLine(string tag, MonoBehaviour parent)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return DrawMarkerLine(tag, parent, Vector3.zero);
		}

		public static GameObject DrawMarkerLine(string tag, MonoBehaviour parent, Vector3 start)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 end = default(Vector3);
			((Vector3)(ref end))..ctor(start.x, 500f, start.z);
			GameObject obj = DrawLineSub(CreateObject(((Component)parent).gameObject, tag, Quaternion.identity), start, end);
			AddBoxCollider(obj);
			return obj;
		}

		public static GameObject DrawBox(string tag, MonoBehaviour parent, Vector3 size)
		{
			//IL_0000: 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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00fa: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_0176: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = size / 2f;
			float num = GetLineWidth(tag) / 2f;
			if (num > val.x)
			{
				num = val.x;
			}
			if (num > val.y)
			{
				num = val.y;
			}
			if (num > val.z)
			{
				num = val.z;
			}
			Vector3[] array = (Vector3[])(object)new Vector3[8]
			{
				new Vector3(0f - val.x + num, 0f - val.y + num, 0f - val.z + num),
				new Vector3(0f - val.x + num, 0f - val.y + num, val.z - num),
				new Vector3(0f - val.x + num, val.y - num, 0f - val.z + num),
				new Vector3(0f - val.x + num, val.y - num, val.z - num),
				new Vector3(val.x - num, 0f - val.y + num, 0f - val.z + num),
				new Vector3(val.x - num, 0f - val.y + num, val.z - num),
				new Vector3(val.x - num, val.y - num, 0f - val.z + num),
				new Vector3(val.x - num, val.y - num, val.z - num)
			};
			GameObject val2 = CreateObject(((Component)parent).gameObject, tag);
			for (int i = 0; i < array.Length; i++)
			{
				Vector3 val3 = array[i];
				for (int j = i + 1; j < array.Length; j++)
				{
					Vector3 val4 = array[j];
					int num2 = 0;
					if (val3.x == val4.x)
					{
						num2++;
					}
					if (val3.y == val4.y)
					{
						num2++;
					}
					if (val3.z == val4.z)
					{
						num2++;
					}
					if (num2 == 2)
					{
						DrawLineSub(CreateObject(val2, tag), array[i], array[j]);
					}
				}
			}
			return val2;
		}

		public static void AddSphereCollider(GameObject obj, float radius)
		{
			GameObject obj2 = obj;
			Array.ForEach(obj2.GetComponentsInChildren<LineRenderer>(), delegate
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				SphereCollider obj3 = obj2.AddComponent<SphereCollider>();
				((Collider)obj3).isTrigger = true;
				obj3.center = Vector3.zero;
				obj3.radius = radius;
			});
		}

		public static void UpdateSphereCollider(MonoBehaviour obj, float radius)
		{
			Array.ForEach(((Component)obj).GetComponentsInChildren<SphereCollider>(), delegate(SphereCollider collider)
			{
				collider.radius = radius;
			});
		}

		public static void UpdateSphere(MonoBehaviour parent, float radius)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			LineRenderer[] componentsInChildren = ((Component)parent).GetComponentsInChildren<LineRenderer>();
			if (componentsInChildren.Length == 3)
			{
				float widthMultiplier = componentsInChildren[0].widthMultiplier;
				UpdateArcX(componentsInChildren[0], Vector3.zero, radius, 360f, widthMultiplier);
				UpdateArcY(componentsInChildren[1], Vector3.zero, radius, 360f, widthMultiplier);
				UpdateArcZ(componentsInChildren[2], Vector3.zero, radius, 360f, widthMultiplier);
				UpdateSphereCollider(parent, radius - widthMultiplier / 2f);
			}
		}

		public static GameObject DrawSphere(string tag, MonoBehaviour parent, float radius)
		{
			return DrawSphere(tag, ((Component)parent).gameObject, radius);
		}

		public static GameObject DrawSphere(string tag, GameObject parent, float radius)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateObject(parent, tag);
			DrawArcX(CreateObject(obj, tag), Vector3.zero, radius, 360f);
			float lineWidth = GetLineWidth(tag);
			AddSphereCollider(obj, radius - lineWidth / 2f);
			DrawArcY(CreateObject(obj, tag), Vector3.zero, radius, 360f);
			DrawArcZ(CreateObject(obj, tag), Vector3.zero, radius, 360f);
			return obj;
		}

		public static GameObject DrawCapsule(string tag, MonoBehaviour parent, float radius, float height)
		{
			return DrawCapsule(tag, ((Component)parent).gameObject, radius, height);
		}

		public static GameObject DrawCapsule(string tag, GameObject parent, float radius, float height)
		{
			//IL_0011: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0057: 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_0091: 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_00cb: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0189: 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_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = CreateObject(parent, tag);
			Vector3 val = Vector3.up * (height - radius);
			Vector3 val2 = Vector3.up * radius;
			float num = GetLineWidth(tag) / 2f;
			float num2 = Mathf.Max(0f, radius - num);
			DrawArcX(CreateObject(obj, tag), val, radius, 360f);
			DrawArcY(CreateObject(obj, tag), val, radius, 360f);
			DrawArcZ(CreateObject(obj, tag), val, radius, 360f);
			DrawArcX(CreateObject(obj, tag), val2, radius, 360f);
			DrawArcY(CreateObject(obj, tag), val2, radius, 360f);
			DrawArcZ(CreateObject(obj, tag), val2, radius, 360f);
			DrawLineSub(CreateObject(obj, tag), val + Vector3.left * num2, val2 + Vector3.left * num2);
			DrawLineSub(CreateObject(obj, tag), val + Vector3.right * num2, val2 + Vector3.right * num2);
			DrawLineSub(CreateObject(obj, tag), val + Vector3.forward * num2, val2 + Vector3.forward * num2);
			DrawLineSub(CreateObject(obj, tag), val + Vector3.back * num2, val2 + Vector3.back * num2);
			return obj;
		}
	}
	public static class CircleAreaManager
	{
		private sealed class Area
		{
			public CircleRuler Owner;

			public Vector3 Center;

			public float Radius;

			public Area(CircleRuler owner, Vector3 center, float radius)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				Owner = owner;
				Center = center;
				Radius = radius;
				base..ctor();
			}
		}

		private static readonly Dictionary<CircleRuler, Area> Areas = new Dictionary<CircleRuler, Area>();

		public static void Register(CircleRuler owner, Vector3 center, float radius)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!Areas.ContainsKey(owner))
			{
				Areas[owner] = new Area(owner, center, radius);
			}
		}

		public static void UpdateRadius(CircleRuler owner, float radius, Vector3 centerIfMissing)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			if (!Areas.TryGetValue(owner, out Area value))
			{
				Register(owner, centerIfMissing, radius);
			}
			else
			{
				value.Radius = radius;
			}
		}

		public static void Unregister(CircleRuler owner)
		{
			Areas.Remove(owner);
		}

		public static void RefreshColors()
		{
			foreach (Area value in Areas.Values)
			{
				value.Owner.ApplyColor();
			}
		}

		public static bool IsInsideOtherCircle(CircleRuler owner, Vector3 position)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(position.x, position.z);
			Vector2 val2 = default(Vector2);
			foreach (Area value in Areas.Values)
			{
				if (!((Object)(object)value.Owner == (Object)(object)owner))
				{
					((Vector2)(ref val2))..ctor(value.Center.x, value.Center.z);
					Vector2 val3 = val - val2;
					if (((Vector2)(ref val3)).sqrMagnitude <= value.Radius * value.Radius)
					{
						return true;
					}
				}
			}
			return false;
		}
	}
	public abstract class BaseRuler : MonoBehaviour
	{
		private static LayerMask Mask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "terrain" }));

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

		private static GameObject? basePrefab;

		public static bool SnapToGround = true;

		public static bool Visible = true;

		protected List<GameObject> Segments = new List<GameObject>();

		private static GameObject BasePrefab => basePrefab ?? (basePrefab = GetBasePrefab());

		protected static Vector3 BaseScale => BasePrefab.transform.localScale;

		private static GameObject GetBasePrefab()
		{
			GameObject prefab = ZNetScene.instance.GetPrefab("piece_workbench");
			if (!Object.op_Implicit((Object)(object)prefab))
			{
				throw new InvalidOperationException("Error: Unable to find the workbench object.");
			}
			return prefab.GetComponentInChildren<CircleProjector>().m_prefab;
		}

		public void OnDestroy()
		{
			foreach (GameObject segment in Segments)
			{
				Object.Destroy((Object)(object)segment);
			}
			Segments.Clear();
		}

		public void Update()
		{
			if (!Visible)
			{
				CreateSegments(0);
				return;
			}
			CreateLines();
			if (SnapToGround)
			{
				Snap();
			}
		}

		protected void CreateSegments(int count)
		{
			if (Segments.Count == count)
			{
				return;
			}
			foreach (GameObject segment in Segments)
			{
				Object.Destroy((Object)(object)segment);
			}
			Segments.Clear();
			if (count != 0)
			{
				for (int i = 0; i < count; i++)
				{
					Segments.Add(Object.Instantiate<GameObject>(BasePrefab, ((Component)this).transform));
				}
				ApplyColor();
			}
		}

		internal void ApplyColor()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			Color color = Draw.GetColor("EffectAreaPlayerBase");
			foreach (GameObject segment in Segments)
			{
				ApplyColor(segment, color);
			}
		}

		private static void ApplyColor(GameObject obj, Color color)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Renderer component = obj.GetComponent<Renderer>();
			if (Object.op_Implicit((Object)(object)component))
			{
				Material[] materials = component.materials;
				for (int i = 0; i < materials.Length; i++)
				{
					materials[i].SetColor(ColorPropertyId, color);
				}
			}
		}

		protected abstract void CreateLines();

		private void Snap()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			foreach (GameObject segment in Segments)
			{
				segment.transform.position = Snap(segment.transform.position);
			}
		}

		private Vector3 Snap(Vector3 pos)
		{
			//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_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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(pos + Vector3.up * 500f, Vector3.down, ref val, 1000f, ((LayerMask)(ref Mask)).value))
			{
				pos.y = ((RaycastHit)(ref val)).point.y;
			}
			return pos;
		}

		protected Transform Get(int index)
		{
			return Segments[index].transform;
		}

		protected void Set(int index, Vector3 pos)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Get(index).localPosition = pos;
		}

		protected void SetRot(int index, Vector3 rot)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Get(index).localRotation = Quaternion.LookRotation(rot, Vector3.up);
		}
	}
	public class CircleRuler : BaseRuler
	{
		[SerializeField]
		private float radius = 20f;

		private readonly float Speed = 0.1f;

		public float Radius
		{
			get
			{
				return radius;
			}
			set
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				radius = value;
				CircleAreaManager.UpdateRadius(this, radius, ((Component)this).transform.position);
			}
		}

		public void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			CircleAreaManager.Register(this, ((Component)this).transform.position, radius);
		}

		public new void OnDestroy()
		{
			CircleAreaManager.Unregister(this);
			base.OnDestroy();
		}

		protected override void CreateLines()
		{
			int count = Math.Max(3, (int)(Radius * 4f));
			CreateSegments(count);
			UpdateLines();
		}

		private void UpdateLines()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: 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)
			int count = Segments.Count;
			float num = (float)Math.PI * 2f / (float)count;
			float num2 = Time.time * Speed;
			Vector3 pos = default(Vector3);
			for (int i = 0; i < count; i++)
			{
				float num3 = (float)i * num + num2;
				((Vector3)(ref pos))..ctor(Mathf.Sin(num3) * Radius, 0f, Mathf.Cos(num3) * Radius);
				Set(i, pos);
			}
			for (int j = 0; j < count; j++)
			{
				GameObject obj = ((j == 0) ? Segments[Segments.Count - 1] : Segments[j - 1]);
				GameObject val = ((j == Segments.Count - 1) ? Segments[0] : Segments[j + 1]);
				Vector3 val2 = obj.transform.localPosition - val.transform.localPosition;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				SetRot(j, normalized);
			}
			for (int k = 0; k < count; k++)
			{
				Segments[k].SetActive(!CircleAreaManager.IsInsideOtherCircle(this, Segments[k].transform.position));
			}
		}
	}
	public class Utils
	{
		public static Visualization[] GetVisualizations()
		{
			return Resources.FindObjectsOfTypeAll<Visualization>();
		}
	}
	[HarmonyPatch(typeof(Player), "UpdateHover")]
	public class Player_AddHoverForVisuals
	{
		private static void Postfix(ref GameObject ___m_hovering, ref GameObject ___m_hoveringCreature)
		{
			//IL_0037: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)___m_hovering) || Object.op_Implicit((Object)(object)___m_hoveringCreature))
			{
				return;
			}
			float num = 100f;
			int mask = LayerMask.GetMask(new string[1] { "character_trigger" });
			RaycastHit[] array = Physics.RaycastAll(((Component)GameCamera.instance).transform.position, ((Component)GameCamera.instance).transform.forward, num, mask);
			RaycastHit[] array2 = Physics.RaycastAll(((Component)GameCamera.instance).transform.position + ((Component)GameCamera.instance).transform.forward * num, -((Component)GameCamera.instance).transform.forward, num, mask);
			RaycastHit[] array3 = CollectionExtensions.AddRangeToArray<RaycastHit>(array, array2);
			Array.Sort(array3, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance));
			RaycastHit[] array4 = array3;
			for (int i = 0; i < array4.Length; i++)
			{
				RaycastHit val = array4[i];
				if ((Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponent<Visualization>() != (Object)null)
				{
					___m_hovering = ((Component)((RaycastHit)(ref val)).collider).gameObject;
					break;
				}
			}
		}
	}
	public class StaticText : MonoBehaviour, Hoverable
	{
		public string title = "";

		public string text = "";

		public string GetHoverText()
		{
			return Format.String(title) + "\n" + text;
		}

		public string GetHoverName()
		{
			return title;
		}
	}
	public class Visualization : MonoBehaviour
	{
		public string Tag = "";

		private static readonly List<Visualization> Visualizations = new List<Visualization>();

		private Quaternion? FixedRotation;

		public static void SharedUpdate()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			foreach (Visualization visualization in Visualizations)
			{
				((Component)visualization).transform.rotation = visualization.FixedRotation.Value;
			}
		}

		public void OnDestroy()
		{
			if (Visualizations.Contains(this))
			{
				Visualizations.Remove(this);
			}
		}

		public void SetFixed(Quaternion rotation)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			FixedRotation = rotation;
			Visualizations.Add(this);
		}
	}
	public class Visibility : Component
	{
		private static readonly Dictionary<string, string> combinedTags = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			["StructureCoverBlocked"] = "StructureCover",
			["PlayerCoverBlocked"] = "PlayerCover",
			["ZoneCornerAshlands"] = "ZoneCorner",
			["ZoneCornerBlackForest"] = "ZoneCorner",
			["ZoneCornerDeepNorth"] = "ZoneCorner",
			["ZoneCornerMeadows"] = "ZoneCorner",
			["ZoneCornerMistlands"] = "ZoneCorner",
			["ZoneCornerMountain"] = "ZoneCorner",
			["ZoneCornerOcean"] = "ZoneCorner",
			["ZoneCornerPlains"] = "ZoneCorner",
			["ZoneCornerSwamp"] = "ZoneCorner",
			["ZoneCornerUnknown"] = "ZoneCorner",
			["SpawnZoneAshlands"] = "SpawnZone",
			["SpawnZoneBlackForest"] = "SpawnZone",
			["SpawnZoneDeepNorth"] = "SpawnZone",
			["SpawnZoneMeadows"] = "SpawnZone",
			["SpawnZoneMistlands"] = "SpawnZone",
			["SpawnZoneMountain"] = "SpawnZone",
			["SpawnZoneOcean"] = "SpawnZone",
			["SpawnZonePlains"] = "SpawnZone",
			["SpawnZoneSwamp"] = "SpawnZone",
			["SpawnZoneUnknown"] = "SpawnZone"
		};

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

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

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

		private static readonly Dictionary<int, string> tags = new Dictionary<int, string>();

		private static readonly Dictionary<int, List<Action>> rebuilders = new Dictionary<int, List<Action>>();

		private static readonly Dictionary<string, int> tagHashCache = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);

		public static List<string> GetTags
		{
			get
			{
				Dictionary<int, string>.ValueCollection values = tags.Values;
				List<string> list = new List<string>(values.Count);
				list.AddRange(values);
				return list;
			}
		}

		public static int GetTagHash(string name)
		{
			if (tagHashCache.TryGetValue(name, out var value))
			{
				return value;
			}
			value = ((!combinedTags.TryGetValue(name, out string value2)) ? StringExtensionMethods.GetStableHashCode(name.ToLowerInvariant()) : StringExtensionMethods.GetStableHashCode(value2.ToLowerInvariant()));
			tagHashCache[name] = value;
			return value;
		}

		public static bool IsTag(string name)
		{
			int tagHash = GetTagHash(name);
			return PermissionManager.IsVisualFeatureEnabled(tagHash, enabledTags.Contains(tagHash));
		}

		public static void SetTag(string tag, bool visibility)
		{
			int tagHash = GetTagHash(tag);
			tagHashes.Add(tagHash);
			tags[tagHash] = tag;
			if (visibility)
			{
				enabledTags.Add(tagHash);
			}
			else
			{
				enabledTags.Remove(tagHash);
			}
			ApplyTagState(tagHash);
		}

		public static void RegisterRebuilder(string tag, Action rebuilder)
		{
			int tagHash = GetTagHash(tag);
			if (!rebuilders.TryGetValue(tagHash, out List<Action> value))
			{
				value = new List<Action>();
				rebuilders[tagHash] = value;
			}
			if (!value.Contains(rebuilder))
			{
				value.Add(rebuilder);
			}
		}

		private static void RebuildTag(string tag)
		{
			int tagHash = GetTagHash(tag);
			if (!rebuilders.TryGetValue(tagHash, out List<Action> value))
			{
				return;
			}
			foreach (Action item in value)
			{
				item();
			}
		}

		private static void DestroyTag(string name)
		{
			Visualization[] visualizations = Utils.GetVisualizations();
			foreach (Visualization visualization in visualizations)
			{
				if (!(visualization.Tag != name))
				{
					Object.Destroy((Object)(object)((Component)visualization).gameObject);
				}
			}
		}

		private static void UpdateTagVisibility(string name)
		{
			Visualization[] visualizations = Utils.GetVisualizations();
			foreach (Visualization visualization in visualizations)
			{
				if (!(visualization.Tag != name))
				{
					UpdateVisibility(visualization);
				}
			}
		}

		public static void Reload()
		{
			foreach (int tagHash in tagHashes)
			{
				ApplyTagState(tagHash);
			}
		}

		private static void ApplyTagState(int hash)
		{
			if (!tags.TryGetValue(hash, out string value))
			{
				return;
			}
			bool flag = previousTags.Contains(hash);
			bool flag2 = PermissionManager.IsVisualFeatureEnabled(hash, enabledTags.Contains(hash));
			if (flag2 != flag)
			{
				if (flag2)
				{
					previousTags.Add(hash);
				}
				else
				{
					previousTags.Remove(hash);
				}
				if (!flag2)
				{
					DestroyTag(value);
				}
				else if (!flag)
				{
					RebuildTag(value);
				}
				UpdateTagVisibility(value);
			}
		}

		private static void UpdateVisibility(Visualization obj)
		{
			GameObject gameObject = ((Component)obj).gameObject;
			bool flag = IsTag(obj.Tag);
			if (gameObject.activeSelf != flag)
			{
				gameObject.SetActive(flag);
			}
		}
	}
}
namespace Service
{
	public class Format
	{
		public const string FORMAT = "0.##";

		public static string GetValidColor(bool valid)
		{
			if (!valid)
			{
				return "#B2BEB5";
			}
			return "#FFFF00";
		}

		public static string String(string value, string color = "#FFFF00")
		{
			return "<color=" + color + ">" + value + "</color>";
		}

		public static string String(string value, bool valid)
		{
			return "<color=" + GetValidColor(valid) + ">" + value + "</color>";
		}

		public static string Float(double value, string format = "0.##", string color = "#FFFF00")
		{
			return String(value.ToString(format, CultureInfo.InvariantCulture), color);
		}

		public static string Multiplier(double value, string color = "#FFFF00")
		{
			return String(value.ToString("0.##", CultureInfo.InvariantCulture) + "x", color);
		}

		public static string Meters(double value, string color = "#FFFF00")
		{
			return String(value.ToString("0.##", CultureInfo.InvariantCulture) + " meters", color);
		}

		public static string Degrees(double value, string color = "#FFFF00")
		{
			return String(value.ToString("0.##", CultureInfo.InvariantCulture) + " degrees", color);
		}

		public static string Fixed(double value)
		{
			return String(value.ToString("N2", CultureInfo.InvariantCulture).PadLeft(5, '0'));
		}

		public static string Percent(double value, string color = "#FFFF00")
		{
			return String((100.0 * value).ToString("0.##", CultureInfo.InvariantCulture) + " %", color);
		}

		public static string PercentInt(double value, string color = "#FFFF00")
		{
			return String(value.ToString("P0", CultureInfo.InvariantCulture), color);
		}

		public static string Range(double min, double max, string color = "#FFFF00")
		{
			if (min == max)
			{
				return String(max.ToString("0.##", CultureInfo.InvariantCulture), color);
			}
			return String(min.ToString("0.##", CultureInfo.InvariantCulture), color) + "-" + String(max.ToString("0.##", CultureInfo.InvariantCulture), color);
		}

		public static string PercentRange(double min, double max)
		{
			if (min == max)
			{
				return max.ToString("P0", CultureInfo.InvariantCulture);
			}
			return min.ToString("P0", CultureInfo.InvariantCulture) + "-" + max.ToString("P0", CultureInfo.InvariantCulture);
		}

		public static string Progress(double value, double limit, bool percent = false)
		{
			return String(value.ToString("N0")) + "/" + String(limit.ToString("N0")) + (percent ? (" (" + PercentInt(value / limit) + ")") : "");
		}

		public static string Int(double value, string color = "#FFFF00")
		{
			return String(value.ToString("N0"), color);
		}

		public static string ProgressPercent(string header, double value, double limit)
		{
			return header + ": " + Progress(value, limit) + " seconds (" + Percent(value / limit) + ")";
		}

		public static string Coordinates(Vector3 coordinates, string format = "F0", string color = "#FFFF00")
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			string color2 = color;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(coordinates.x, coordinates.z, coordinates.y);
			return JoinRow(from value in ((Vector3)(ref val)).ToString(format).Replace("(", "").Replace(")", "")
					.Split(new char[1] { ',' })
				select String(value.Trim(), color2));
		}

		public static string JoinLines(IEnumerable<string> lines)
		{
			return string.Join("\n", lines.Where((string line) => line != ""));
		}

		public static string JoinRow(IEnumerable<string> lines)
		{
			return string.Join(", ", lines.Where((string line) => line != ""));
		}
	}
	public class Helper
	{
		private static T Get<T>(object obj, string field)
		{
			return Traverse.Create(obj).Field<T>(field).Value;
		}

		public static ZNetView Nview(MonoBehaviour obj)
		{
			return Get<ZNetView>(obj, "m_nview");
		}

		public static double GetElapsed(MonoBehaviour obj, string key, long defaultValue = 0L)
		{
			DateTime time = ZNet.instance.GetTime();
			DateTime dateTime = GetDateTime(obj, key, defaultValue);
			return (time - dateTime).TotalSeconds;
		}

		public static double GetElapsed(MonoBehaviour obj, int key, long defaultValue = 0L)
		{
			DateTime time = ZNet.instance.GetTime();
			DateTime dateTime = GetDateTime(obj, key, defaultValue);
			return (time - dateTime).TotalSeconds;
		}

		public static GameObject GetRoot(MonoBehaviour obj)
		{
			GameObject gameObject = ((Component)obj).gameObject;
			while ((Object)(object)gameObject.transform.parent != (Object)null)
			{
				gameObject = ((Component)gameObject.transform.parent).gameObject;
			}
			return gameObject;
		}

		public static DateTime GetDateTime(MonoBehaviour obj, string key, long defaultValue = 0L)
		{
			return new DateTime(GetLong(obj, key, defaultValue));
		}

		public static DateTime GetDateTime(MonoBehaviour obj, int key, long defaultValue = 0L)
		{
			return new DateTime(GetLong(obj, key, defaultValue));
		}

		public static float GetFloat(MonoBehaviour obj, string key, float defaultValue = 0f)
		{
			return Nview(obj).GetZDO().GetFloat(key, defaultValue);
		}

		public static long GetLong(MonoBehaviour obj, string key, long defaultValue = 0L)
		{
			return Nview(obj).GetZDO().GetLong(key, defaultValue);
		}

		public static long GetLong(MonoBehaviour obj, int key, long defaultValue = 0L)
		{
			return Nview(obj).GetZDO().GetLong(key, defaultValue);
		}

		public static int GetInt(MonoBehaviour obj, string key, int defaultValue = 0)
		{
			return Nview(obj).GetZDO().GetInt(key, defaultValue);
		}

		public static bool GetBool(MonoBehaviour obj, string key, bool defaultValue = false)
		{
			return Nview(obj).GetZDO().GetBool(key, defaultValue);
		}

		public static string GetString(MonoBehaviour obj, string key, string defaultValue = "")
		{
			return Nview(obj).GetZDO().GetString(key, defaultValue);
		}

		public static GameObject GetPrefab(MonoBehaviour obj)
		{
			return ZNetScene.instance.GetPrefab(Nview(obj).GetZDO().GetPrefab());
		}

		public static bool IsValid(MonoBehaviour obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return false;
			}
			ZNetView val = Nview(obj);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			return val.IsValid();
		}
	}
	public class Log
	{
		private static ManualLogSource Logger;

		public static void Init(ManualLogSource logger)
		{
			Logger = logger;
		}

		public static void Error(string message)
		{
			Logger.LogError((object)message);
		}

		public static void Warning(string message)
		{
			Logger.LogWarning((object)message);
		}

		public static void Info(string message)
		{
			Logger.LogInfo((object)message);
		}

		public static void Debug(string message)
		{
			Logger.LogDebug((object)message);
		}
	}
	[HarmonyPatch(typeof(Hud), "Awake")]
	public class HudAwake
	{
		private static void Postfix(Hud __instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = ((Component)__instance.m_hoverName).GetComponent<RectTransform>();
			component.sizeDelta += new Vector2(100f, 0f);
		}
	}
	[HarmonyPatch(typeof(MessageHud), "Update")]
	[HarmonyPriority(200)]
	public class MessageHud_UpdateMessage : MonoBehaviour
	{
		public static Func<List<string>> GetMessage = () => new List<string> { "Default message. Replace with your own function." };

		private static void Postfix(MessageHud __instance)
		{
			if ((Object)(object)Player.m_localPlayer == (Object)null || Hud.IsUserHidden())
			{
				return;
			}
			__instance.m_messageText.alignment = (TextAlignmentOptions)257;
			string text = __instance.m_messageText.text;
			List<string> list = GetMessage();
			if (list.Count != 0)
			{
				if (text != "")
				{
					list.Add(" ");
					list.Add(text);
				}
				__instance.m_messageText.text = Format.JoinLines(list);
				((Graphic)__instance.m_messageText).CrossFadeAlpha(1f, 0f, true);
				((Graphic)__instance.m_messageIcon).canvasRenderer.SetAlpha(0f);
				((Graphic)__instance.m_messageIcon).CrossFadeAlpha(0f, 0f, true);
			}
		}
	}
	[HarmonyPatch(typeof(MessageHud), "UpdateMessage")]
	public class MessageHud_GetBaseMessage : MonoBehaviour
	{
		private static string BaseMessage = "";

		private static void Prefix(out string __state)
		{
			__state = MessageHud.instance.m_messageText.text;
		}

		private static void Postfix(MessageHud __instance, float ___m_msgQueueTimer, string __state)
		{
			if (__instance.m_messageText.text != __state)
			{
				BaseMessage = __instance.m_messageText.text;
			}
			if (___m_msgQueueTimer >= 4f)
			{
				BaseMessage = "";
			}
			__instance.m_messageText.text = BaseMessage;
		}
	}
	public class Range<T>
	{
		public T Min;

		public T Max;

		public bool Uniform = true;

		public Range(T value)
		{
			Min = value;
			Max = value;
		}

		public Range(T min, T max)
		{
			Min = min;
			Max = max;
		}
	}
	public static class Parse
	{
		public static List<string> ToList(string str, bool removeEmpty = true)
		{
			string[] array = Split(str, removeEmpty);
			List<string> list = new List<string>(array.Length);
			list.AddRange(array);
			return list;
		}

		public static Vector2i Vector2Int(string arg)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			string[] array = SplitWithEmpty(arg);
			return new Vector2i(Int(array[0]), (array.Length > 1) ? Int(array[1]) : 0);
		}

		public static int Int(string arg, int defaultValue = 0)
		{
			if (!TryInt(arg, out var result))
			{
				return defaultValue;
			}
			return result;
		}

		public static uint UInt(string arg, uint defaultValue = 0u)
		{
			if (!TryUInt(arg, out var result))
			{
				return defaultValue;
			}
			return result;
		}

		public static long Long(string arg, long defaultValue = 0L)
		{
			if (!long.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return defaultValue;
			}
			return result;
		}

		public static bool TryLong(string arg, out long result)
		{
			return long.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
		}

		public static int Int(string[] args, int index, int defaultValue = 0)
		{
			if (args.Length <= index)
			{
				return defaultValue;
			}
			return Int(args[index], defaultValue);
		}

		public static bool TryUInt(string arg, out uint result)
		{
			return uint.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
		}

		public static bool TryInt(string arg, out int result)
		{
			return int.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
		}

		public static float Float(string arg, float defaultValue = 0f)
		{
			if (!TryFloat(arg, out var result))
			{
				return defaultValue;
			}
			return result;
		}

		public static float Float(string[] args, int index, float defaultValue = 0f)
		{
			if (args.Length <= index)
			{
				return defaultValue;
			}
			return Float(args[index], defaultValue);
		}

		public static bool TryFloat(string arg, out float result)
		{
			return float.TryParse(arg, NumberStyles.Float, CultureInfo.InvariantCulture, out result);
		}

		public static bool TryBoolean(string arg, out bool result)
		{
			result = false;
			if (arg.ToLowerInvariant() == "true")
			{
				result = true;
				return true;
			}
			if (arg.ToLowerInvariant() == "false")
			{
				return true;
			}
			return false;
		}

		public static Quaternion AngleYXZ(string arg)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return AngleYXZ(Split(arg), 0, Vector3.zero);
		}

		public static Quaternion AngleYXZ(string[] args, int index)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return AngleYXZ(args, index, Vector3.zero);
		}

		public static Quaternion AngleYXZ(string[] args, int index, Vector3 defaultValue)
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			zero.y = Float(args, index, defaultValue.y);
			zero.x = Float(args, index + 1, defaultValue.x);
			zero.z = Float(args, index + 2, defaultValue.z);
			return Quaternion.Euler(zero);
		}

		public static string[] Split(string arg, bool removeEmpty = true, char split = ',')
		{
			return (from s in arg.Split(new char[1] { split })
				select s.Trim() into s
				where !removeEmpty || s != ""
				select s).ToArray();
		}

		public static KeyValuePair<string, string> Kvp(string str, char separator = ',')
		{
			string[] array = str.Split(new char[1] { separator }, 2);
			if (array.Length < 2)
			{
				return new KeyValuePair<string, string>(array[0], "");
			}
			return new KeyValuePair<string, string>(array[0], array[1].Trim());
		}

		public static bool TryKvp(string str, out KeyValuePair<string, string> kvp, char separator = ',')
		{
			kvp = Kvp(str, separator);
			return kvp.Value != "";
		}

		public static string[] SplitWithEmpty(string arg, char split = ',')
		{
			return (from s in arg.Split(new char[1] { split })
				select s.Trim()).ToArray();
		}

		public static string[] SplitWithEscape(string arg, char separator = ',')
		{
			List<string> list = new List<string>();
			string[] array = arg.Split(new char[1] { separator });
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].TrimStart(Array.Empty<char>());
				if (text.StartsWith("\""))
				{
					array[i] = text.Substring(1);
					int j;
					for (j = i; j < array.Length; j++)
					{
						text = array[j].TrimEnd(Array.Empty<char>());
						if (text.EndsWith("\""))
						{
							array[j] = text.Substring(0, text.Length - 1);
							break;
						}
					}
					list.Add(string.Join(separator.ToString(), array.Skip(i).Take(j - i + 1)));
					i = j;
				}
				else
				{
					list.Add(array[i].Trim());
				}
			}
			return list.ToArray();
		}

		public static string Name(string arg)
		{
			return arg.Split(new char[1] { ':' })[0];
		}

		public static Vector3 VectorXZY(string arg)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return VectorXZY(arg, Vector3.zero);
		}

		public static Vector3 VectorXZY(string arg, Vector3 defaultValue)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			return VectorXZY(Split(arg), 0, defaultValue);
		}

		public static Vector3 VectorXZY(string[] args, int index)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return VectorXZY(args, index, Vector3.zero);
		}

		public static Vector3 VectorXZY(string[] args, int index, Vector3 defaultValue)
		{
			//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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			Vector3 zero = Vector3.zero;
			zero.x = Float(args, index, defaultValue.x);
			zero.z = Float(args, index + 1, defaultValue.z);
			zero.y = Float(args, index + 2, defaultValue.y);
			return zero;
		}

		public static Vector2 VectorXY(string arg)
		{
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			Vector2 zero = Vector2.zero;
			string[] args = Split(arg);
			zero.x = Float(args, 0);
			zero.y = Float(args, 1);
			return zero;
		}

		public static Vector3 Scale(string args)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return Scale(Split(args), 0);
		}

		public static Vector3 Scale(string[] args)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return Scale(args, 0);
		}

		public static Vector3 Scale(string[] args, int index)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return SanityCheck(VectorXZY(args, index));
		}

		private static Vector3 SanityCheck(Vector3 scale)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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 (scale.x == 0f)
			{
				scale.x = 1f;
			}
			if (scale.y == 0f)
			{
				scale.y = scale.x;
			}
			if (scale.z == 0f)
			{
				scale.z = scale.x;
			}
			return scale;
		}

		public static Range<string> StringRange(string arg)
		{
			List<string> list = arg.Split('-', ';').ToList();
			if (list.Count > 1 && list[0] == "")
			{
				list[0] = "-" + list[1];
				list.RemoveAt(1);
			}
			if (list.Count > 2 && list[1] == "")
			{
				list[1] = "-" + list[2];
				list.RemoveAt(2);
			}
			if (list.Count == 1)
			{
				return new Range<string>(list[0]);
			}
			return new Range<string>(list[0], list[1]);
		}

		public static Range<int> IntRange(string arg)
		{
			Range<string> range = StringRange(arg);
			return new Range<int>(Int(range.Min), Int(range.Max));
		}

		public static Range<float> FloatRange(string arg)
		{
			Range<string> range = StringRange(arg);
			return new Range<float>(Float(range.Min), Float(range.Max));
		}

		public static Range<long> LongRange(string arg)
		{
			Range<string> range = StringRange(arg);
			return new Range<long>(Long(range.Min, 0L), Long(range.Max, 0L));
		}

		public static int? IntNull(string arg)
		{
			if (int.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return result;
			}
			return null;
		}

		public static int? IntNull(string[] args, int index)
		{
			if (args.Length <= index)
			{
				return null;
			}
			return IntNull(args[index]);
		}

		public static float? FloatNull(string arg)
		{
			if (float.TryParse(arg, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return result;
			}
			return null;
		}

		public static float? FloatNull(string[] args, int index)
		{
			if (args.Length <= index)
			{
				return null;
			}
			return FloatNull(args[index]);
		}

		public static long? LongNull(string[] args, int index)
		{
			if (args.Length <= index)
			{
				return null;
			}
			return LongNull(args[index]);
		}

		public static long? LongNull(string arg)
		{
			if (long.TryParse(arg, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return result;
			}
			return null;
		}

		public static Vector3? VectorXZYNull(string? arg)
		{
			if (arg != null)
			{
				return VectorXZYNull(Split(arg));
			}
			return null;
		}

		public static Vector3? VectorXZYNull(string[] args)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			float? num = FloatNull(args, 0);
			float? num2 = FloatNull(args, 2);
			float? num3 = FloatNull(args, 1);
			if (!num.HasValue && !num2.HasValue && !num3.HasValue)
			{
				return null;
			}
			return new Vector3(num.GetValueOrDefault(), num2.GetValueOrDefault(), num3.GetValueOrDefault());
		}

		public static Quaternion? AngleYXZNull(string? arg)
		{
			if (arg != null)
			{
				return AngleYXZNull(Split(arg));
			}
			return null;
		}

		public static Quaternion? AngleYXZNull(string[] values)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			float? num = FloatNull(values, 0);
			float? num2 = FloatNull(values, 1);
			float? num3 = FloatNull(values, 2);
			if (!num.HasValue && !num2.HasValue && !num3.HasValue)
			{
				return null;
			}
			return Quaternion.Euler(new Vector3(num2.GetValueOrDefault(), num.GetValueOrDefault(), num3.GetValueOrDefault()));
		}

		public static string String(string[] args, int index)
		{
			if (args.Length <= index)
			{
				return "";
			}
			return args[index];
		}

		public static int Hash(string[] args, int index)
		{
			if (args.Length <= index)
			{
				return 0;
			}
			return StringExtensionMethods.GetStableHashCode(args[index]);
		}

		public static bool Boolean(string[] args, int index)
		{
			if (args.Length > index)
			{
				return Boolean(args[index]);
			}
			return false;
		}

		public static bool Boolean(string arg)
		{
			return arg.ToLowerInvariant() == "true";
		}

		public static bool BooleanTrue(string arg)
		{
			return arg.ToLowerInvariant() == "false";
		}

		public static ZDOID ZdoId(string arg)
		{
			//IL_0029: 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)
			string[] array = Split(arg, removeEmpty: true, ':');
			if (array.Length < 2)
			{
				return ZDOID.None;
			}
			return new ZDOID(Long(array[0], 0L), UInt(array[1]));
		}
	}
	public static class PermissionHash
	{
		public const string Section = "esp";

		public static readonly int Drops = StringExtensionMethods.GetStableHashCode("drops");

		public static readonly int Breeding = StringExtensionMethods.GetStableHashCode("breeding");

		public static readonly int Status = StringExtensionMethods.GetStableHashCode("status");

		public static readonly int Attacks = StringExtensionMethods.GetStableHashCode("attacks");

		public static readonly int Resistances = StringExtensionMethods.GetStableHashCode("resistances");

		public static readonly int ExtraInfo = StringExtensionMethods.GetStableHashCode("extrainfo");

		public static readonly int CustomOnly = StringExtensionMethods.GetStableHashCode("customonly");

		public static readonly int WeaponInfo = StringExtensionMethods.GetStableHashCode("weaponinfo");

		public static readonly int Progress = StringExtensionMethods.GetStableHashCode("progress");

		public static readonly int Support = StringExtensionMethods.GetStableHashCode("support");

		public static readonly int Structures = StringExtensionMethods.GetStableHashCode("structures");

		public static readonly int Creatures = StringExtensionMethods.GetStableHashCode("creatures");

		public static readonly int Destructibles = StringExtensionMethods.GetStableHashCode("destructibles");

		public static readonly int Pickables = StringExtensionMethods.GetStableHashCode("pickables");

		public static readonly int ItemDrops = StringExtensionMethods.GetStableHashCode("itemdrops");

		public static readonly int Ships = StringExtensionMethods.GetStableHashCode("ships");

		public static readonly int Locations = StringExtensionMethods.GetStableHashCode("locations");

		public static readonly int Vegetation = StringExtensionMethods.GetStableHashCode("vegetation");

		public static readonly int Hud = StringExtensionMethods.GetStableHashCode("hud");

		public static readonly int Ship = StringExtensionMethods.GetStableHashCode("ship");

		public static readonly int Time = StringExtensionMethods.GetStableHashCode("time");

		public static readonly int Position = StringExtensionMethods.GetStableHashCode("position");

		public static readonly int Altitude = StringExtensionMethods.GetStableHashCode("altitude");

		public static readonly int Forest = StringExtensionMethods.GetStableHashCode("forest");

		public static readonly int Blocked = StringExtensionMethods.GetStableHashCode("blocked");

		public static readonly int Stagger = StringExtensionMethods.GetStableHashCode("stagger");

		public static readonly int Heat = StringExtensionMethods.GetStableHashCode("heat");

		public static readonly int Speed = StringExtensionMethods.GetStableHashCode("speed");

		public static readonly int Stealth = StringExtensionMethods.GetStableHashCode("stealth");

		public static readonly int Weather = StringExtensionMethods.GetStableHashCode("weather");

		public static readonly int Wind = StringExtensionMethods.GetStableHashCode("wind");

		public static readonly int CreatureCollider = StringExtensionMethods.GetStableHashCode("creaturecollider");

		public static readonly int StructureCollider = StringExtensionMethods.GetStableHashCode("structurecollider");

		public static readonly int DestructibleCollider = StringExtensionMethods.GetStableHashCode("destructiblecollider");

		public static readonly int Attack = StringExtensionMethods.GetStableHashCode("attack");

		public static readonly int StructureCover = StringExtensionMethods.GetStableHashCode("structurecover");

		public static readonly int StructureCoverBlocked = StringExtensionMethods.GetStableHashCode("structurecoverblocked");

		public static readonly int StructureSupport = StringExtensionMethods.GetStableHashCode("structuresupport");

		public static readonly int CreatureNoise = StringExtensionMethods.GetStableHashCode("creaturenoise");

		public static readonly int CreatureHearRange = StringExtensionMethods.GetStableHashCode("creaturehearrange");

		public static readonly int CreatureViewRange = StringExtensionMethods.GetStableHashCode("creatureviewrange");

		public static readonly int CreatureAlertRange = StringExtensionMethods.GetStableHashCode("creaturealertrange");

		public static readonly int CreatureFireRange = StringExtensionMethods.GetStableHashCode("creaturefirerange");

		public static readonly int CreatureBreedingTotalRange = StringExtensionMethods.GetStableHashCode("creaturebreedingtotalrange");

		public static readonly int CreatureBreedingPartnerRange = StringExtensionMethods.GetStableHashCode("creaturebreedingpartnerrange");

		public static readonly int CreatureFoodSearchRange = StringExtensionMethods.GetStableHashCode("creaturefoodsearchrange");

		public static readonly int CreatureEatingRange = StringExtensionMethods.GetStableHashCode("creatureeatingrange");

		public static readonly int TrackedObject = StringExtensionMethods.GetStableHashCode("trackedobject");

		public static readonly int PickableOneTime = StringExtensionMethods.GetStableHashCode("pickableonetime");

		public static readonly int PickableRespawning = StringExtensionMethods.GetStableHashCode("pickablerespawning");

		public static readonly int EventZone = StringExtensionMethods.GetStableHashCode("eventzone");

		public static readonly int Location = StringExtensionMethods.GetStableHashCode("location");

		public static readonly int Chest = StringExtensionMethods.GetStableHashCode("chest");

		public static readonly int Tree = StringExtensionMethods.GetStableHashCode("tree");

		public static readonly int Ore = StringExtensionMethods.GetStableHashCode("ore");

		public static readonly int TrophySpeak = StringExtensionMethods.GetStableHashCode("trophyspeak");

		public static readonly int Destructible = StringExtensionMethods.GetStableHashCode("destructible");

		public static readonly int SpawnPointOneTime = StringExtensionMethods.GetStableHashCode("spawnpointonetime");

		public static readonly int SpawnPointRespawning = StringExtensionMethods.GetStableHashCode("spawnpointrespawning");

		public static readonly int SpawnerRay = StringExtensionMethods.GetStableHashCode("spawnerray");

		public static readonly int SpawnerTriggerRange = StringExtensionMethods.GetStableHashCode("spawnertriggerrange");

		public static readonly int SpawnerLimitRange = StringExtensionMethods.GetStableHashCode("spawnernearrange");

		public static readonly int SpawnerSpawnRange = StringExtensionMethods.GetStableHashCode("spawnerspawnrange");

		public static readonly int AltarRay = StringExtensionMethods.GetStableHashCode("altarray");

		public static readonly int AltarSpawnRadius = StringExtensionMethods.GetStableHashCode("altarspawnradius");

		public static readonly int AltarItemStandRange = StringExtensionMethods.GetStableHashCode("altaritemstandrange");

		public static readonly int ZoneCorner = StringExtensionMethods.GetStableHashCode("zonecorner");

		public static readonly int ZoneCornerAshlands = StringExtensionMethods.GetStableHashCode("zonecornerashlands");

		public static readonly int ZoneCornerBlackForest = StringExtensionMethods.GetStableHashCode("zonecornerblackforest");

		public static readonly int ZoneCornerDeepNorth = StringExtensionMethods.GetStableHashCode("zonecornerdeepnorth");

		public static readonly int ZoneCornerMeadows = StringExtensionMethods.GetStableHashCode("zonecornermeadows");

		public static readonly int ZoneCornerMistlands = StringExtensionMethods.GetStableHashCode("zonecornermistlands");

		public static readonly int ZoneCornerMountain = StringExtensionMethods.GetStableHashCode("zonecornermountain");

		public static readonly int ZoneCornerOcean = StringExtensionMethods.GetStableHashCode("zonecornerocean");

		public static readonly int ZoneCornerPlains = StringExtensionMethods.GetStableHashCode("zonecornerplains");

		public static readonly int ZoneCornerSwamp = StringExtensionMethods.GetStableHashCode("zonecornerswamp");

		public static readonly int ZoneCornerUnknown = StringExtensionMethods.GetStableHashCode("zonecornerunknown");

		public static readonly int SpawnZone = StringExtensionMethods.GetStableHashCode("spawnzone");

		public static readonly int SpawnZoneAshlands = StringExtensionMethods.GetStableHashCode("spawnzoneashlands");

		public static readonly int SpawnZoneBlackForest = StringExtensionMethods.GetStableHashCode("spawnzoneblackforest");

		public static readonly int SpawnZoneDeepNorth = StringExtensionMethods.GetStableHashCode("spawnzonedeepnorth");

		public static readonly int SpawnZoneMeadows = StringExtensionMethods.GetStableHashCode("spawnzonemeadows");

		public static readonly int SpawnZoneMistlands = StringExtensionMethods.GetStableHashCode("spawnzonemistlands");

		public static readonly int SpawnZoneMountain = StringExtensionMethods.GetStableHashCode("spawnzonemountain");

		public static readonly int SpawnZoneOcean = StringExtensionMethods.GetStableHashCode("spawnzoneocean");

		public static readonly int SpawnZonePlains = StringExtensionMethods.GetStableHashCode("spawnzoneplains");

		public static readonly int SpawnZoneSwamp = StringExtensionMethods.GetStableHashCode("spawnzoneswamp");

		public static readonly int SpawnZoneUnknown = StringExtensionMethods.GetStableHashCode("spawnzoneunknown");

		public static readonly int RandomEventSystem = StringExtensionMethods.GetStableHashCode("randomeventsystem");

		public static readonly int EffectAreaPrivateArea = StringExtensionMethods.GetStableHashCode("effectareaprivatearea");

		public static readonly int EffectAreaComfort = StringExtensionMethods.GetStableHashCode("effectareacomfort");

		public static readonly int EffectAreaBurning = StringExtensionMethods.GetStableHashCode("effectareaburning");

		public static readonly int EffectAreaHeat = StringExtensionMethods.GetStableHashCode("effectareaheat");

		public static readonly int EffectAreaFire = StringExtensionMethods.GetStableHashCode("effectareafire");

		public static readonly int EffectAreaNoMonsters = StringExtensionMethods.GetStableHashCode("effectareanomonsters");

		public static readonly int EffectAreaTeleport = StringExtensionMethods.GetStableHashCode("effectareateleport");

		public static readonly int EffectAreaPlayerBase = StringExtensionMethods.GetStableHashCode("effectareaplayerbase");

		public static readonly int EffectAreaOther = StringExtensionMethods.GetStableHashCode("effectareaother");

		public static readonly int EffectAreaCustomContainer = StringExtensionMethods.GetStableHashCode("effectareacustomcontainer");

		public static readonly int EffectAreaCustomCrafting = StringExtensionMethods.GetStableHashCode("effectareacustomcrafting");

		public static readonly int EffectAreaWarmCozy = StringExtensionMethods.GetStableHashCode("effectareawarmcozy");

		public static readonly int Smoke = StringExtensionMethods.GetStableHashCode("smoke");

		public static readonly int PlayerCover = StringExtensionMethods.GetStableHashCode("playercover");

		public static readonly int PlayerCoverBlocked = StringExtensionMethods.GetStableHashCode("playercoverblocked");

		public static readonly int Terrain = StringExtensionMethods.GetStableHashCode("terrain");
	}
	public static class SceneObjects
	{
		public static IEnumerable<T> FindLoaded<T>() where T : MonoBehaviour
		{
			HashSet<int> seen = new HashSet<int>();
			T val = default(T);
			foreach (ZNetView view in EnumerateViews())
			{
				if (!Object.op_Implicit((Object)(object)view))
				{
					continue;
				}
				Scene scene = ((Component)view).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					continue;
				}
				if (((Component)view).TryGetComponent<T>(ref val) && Object.op_Implicit((Object)(object)val) && seen.Add(((Object)(object)val).GetInstanceID()))
				{
					yield return val;
				}
				T[] componentsInChildren = ((Component)view).GetComponentsInChildren<T>(true);
				T[] array = componentsInChildren;
				foreach (T val2 in array)
				{
					if (Object.op_Implicit((Object)(object)val2))
					{
						scene = ((Component)(object)val2).gameObject.scene;
						if (((Scene)(ref scene)).IsValid() && seen.Add(((Object)(object)val2).GetInstanceID()))
						{
							yield return val2;
						}
					}
				}
			}
		}

		private static IEnumerable<ZNetView> EnumerateViews()
		{
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance))
			{
				yield break;
			}
			foreach (KeyValuePair<ZDO, ZNetView> instance in ZNetScene.instance.m_instances)
			{
				ZNetView value = instance.Value;
				if (Object.op_Implicit((Object)(object)value))
				{
					yield return value;
				}
			}
		}
	}
	public class Translate
	{
		public static string Name(string name, string color = "#FFFF00")
		{
			return Format.String(Localization.instance.Localize(name).Replace("(Clone)", ""), color);
		}

		public static string Name(Biome obj, string color = "#FFFF00")
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			return Name(Enum.GetName(typeof(Biome), obj), color);
		}

		private static string Name(Character obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return obj.m_name;
		}

		public static string Name(ItemData obj, string color = "#FFFF00")
		{
			if (!Object.op_Implicit((Object)(object)obj?.m_dropPrefab))
			{
				return Name(obj?.m_shared?.m_name ?? "");
			}
			return Name(Utils.GetPrefabName(obj?.m_dropPrefab), color);
		}

		private static string Name(Pickable obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			if (!string.IsNullOrEmpty(obj.m_overrideName))
			{
				return obj.m_overrideName;
			}
			GameObject itemPrefab = obj.m_itemPrefab;
			return ((itemPrefab != null) ? ((Object)itemPrefab).name : null) ?? "";
		}

		public static string Name(CreatureSpawner obj)
		{
			if (!Object.op_Implicit((Object)(object)obj) || !Object.op_Implicit((Object)(object)obj.m_creaturePrefab))
			{
				return "";
			}
			return Utils.GetPrefabName(obj.m_creaturePrefab);
		}

		public static string Name(IEnumerable<GameObject> objs, string color = "#FFFF00")
		{
			string color2 = color;
			return Format.JoinRow(objs.Select((GameObject prefab) => Id(prefab, color2)));
		}

		public static string Name(IEnumerable<ItemDrop> objs, string color = "#FFFF00")
		{
			string color2 = color;
			return Format.JoinRow(objs.Select((ItemDrop prefab) => Name((MonoBehaviour)(object)prefab, color2)));
		}

		private static string Name(Bed obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return obj.GetHoverName();
		}

		private static string Name(Piece obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return obj.m_name;
		}

		private static string Name(TreeLog obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return ((Object)obj).name;
		}

		private static string Name(Location obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return ((Object)obj).name;
		}

		private static string Name(MineRock obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return obj.m_name;
		}

		private static string Name(MineRock5 obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return obj.m_name;
		}

		private static string Name(TreeBase obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return ((Object)obj).name;
		}

		private static string Name(Destructible obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return ((Object)obj).name;
		}

		private static string Name(Smoke obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return "Smoke";
		}

		private static string Name(HoverText obj)
		{
			if (!Object.op_Implicit((Object)(object)obj))
			{
				return "";
			}
			return obj.m_text;
		}

		public static string Name(MonoBehaviour obj, string color = "yellow")
		{
			string text = "";
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<HoverText>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Smoke>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<CreatureSpawner>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Pickable>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Bed>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<TreeLog>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Location>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<MineRock>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<MineRock5>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<TreeBase>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Destructible>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Character>());
			}
			if (text == "")
			{
				text = Name(((Component)obj).GetComponentInParent<Piece>());
			}
			if (text == "")
			{
				text = Id(((Component)obj).gameObject, color);
			}
			return Name(text, color);
		}

		public static string Id(GameObject obj, string color = "yellow")
		{
			ZNetView componentInParent = obj.GetComponentInParent<ZNetView>();
			if (!Object.op_Implicit((Object)(object)componentInParent))
			{
				return Format.String(Utils.GetPrefabName(obj), color);
			}
			return Id(componentInParent, color);
		}

		public static string Id(ZNetView view, string color = "yellow")
		{
			ZDO zDO = view.GetZDO();
			int key = ((zDO != null) ? zDO.GetPrefab() : 0);
			if (ZNetScene.instance.m_namedPrefabs.TryGetValue(key, out var value))
			{
				return Format.String(((Object)value).name, color);
			}
			return "";
		}
	}
	public class Watcher
	{
		public static string BaseDirectory = Paths.ConfigPath;

		public static void SetupWatcher(ConfigFile config)
		{
			ConfigFile config2 = config;
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Path.GetDirectoryName(config2.ConfigFilePath), Path.GetFileName(config2.ConfigFilePath));
			fileSystemWatcher.Changed += delegate(object s, FileSystemEventArgs e)
			{
				ReadConfigValues(e.FullPath, config2);
			};
			fileSystemWatcher.Created += delegate(object s, FileSystemEventArgs e)
			{
				ReadConfigValues(e.FullPath, config2);
			};
			fileSystemWatcher.Renamed += delegate(object s, RenamedEventArgs e)
			{
				ReadConfigValues(e.FullPath, config2);
			};
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private static void ReadConfigValues(string path, ConfigFile config)
		{
			if (!File.Exists(path))
			{
				return;
			}
			try
			{
				config.Reload();
			}
			catch
			{
				Log.Error("There was an issue loading your " + config.ConfigFilePath);
				Log.Error("Please check your config entries for spelling and format!");
			}
		}

		public static void SetupWatcher(string pattern, Action<string> action)
		{
			SetupWatcher(Paths.ConfigPath, pattern, action);
		}

		public static void SetupWatcher(string folder, string pattern, Action<string> action)
		{
			Action<string> action2 = action;
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(folder, pattern);
			fileSystemWatcher.Created += delegate(object s, FileSystemEventArgs e)
			{
				action2(e.FullPath);
			};
			fileSystemWatcher.Changed += delegate(object s, FileSystemEventArgs e)
			{
				action2(e.FullPath);
			};
			fileSystemWatcher.Renamed += delegate(object s, RenamedEventArgs e)
			{
				action2(e.FullPath);
			};
			fileSystemWatcher.Deleted += delegate(object s, FileSystemEventArgs e)
			{
				action2(e.FullPath);
			};
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		public static void SetupWatcher(string folder, string pattern, Action action)
		{
			Action action2 = action;
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(folder, pattern);
			fileSystemWatcher.Created += d