ESP.dll

Decompiled 6 days 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.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+88a70f2c2ad5d65edf85276dbae3a12a2dfaf250")]
[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 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 abstract class BaseRuler : MonoBehaviour
	{
		private static LayerMask Mask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "terrain" }));

		private static GameObject? basePrefab;

		public static bool SnapToGround = true;

		public static bool Visible = true;

		private GameObject? Center;

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

		public static float Offset = 0f;

		private readonly List<GameObject> OffsetSegments = 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);
			}
			foreach (GameObject offsetSegment in OffsetSegments)
			{
				Object.Destroy((Object)(object)offsetSegment);
			}
			Object.Destroy((Object)(object)Center);
			Center = null;
			Segments.Clear();
			OffsetSegments.Clear();
		}

		public void Update()
		{
			if (!Visible)
			{
				CreateSegments(0);
				CreateOffsetSegments(0);
				return;
			}
			CreateLines();
			if (SnapToGround)
			{
				Snap();
			}
			CreateOffsetSegments(Segments.Count);
			CreateOffsetLines();
		}

		protected void CreateSegments(int count)
		{
			//IL_007d: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (Segments.Count == count)
			{
				return;
			}
			foreach (GameObject segment in Segments)
			{
				Object.Destroy((Object)(object)segment);
			}
			Segments.Clear();
			Object.Destroy((Object)(object)Center);
			if (count != 0)
			{
				Center = Object.Instantiate<GameObject>(BasePrefab, ((Component)this).transform);
				Center.transform.localPosition = Vector3.zero;
				Center.transform.localRotation = Quaternion.identity;
				Center.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);
				for (int i = 0; i < count; i++)
				{
					Segments.Add(Object.Instantiate<GameObject>(BasePrefab, ((Component)this).transform));
				}
			}
		}

		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;
		}

		private void CreateOffsetSegments(int count)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (Mathf.Approximately(Offset, 0f))
			{
				count = 0;
			}
			if (OffsetSegments.Count == count)
			{
				return;
			}
			foreach (GameObject offsetSegment in OffsetSegments)
			{
				Object.Destroy((Object)(object)offsetSegment);
			}
			OffsetSegments.Clear();
			for (int i = 0; i < count; i++)
			{
				OffsetSegments.Add(Object.Instantiate<GameObject>(BasePrefab, Vector3.zero, Quaternion.identity, ((Component)this).transform));
			}
		}

		private void CreateOffsetLines()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0053: 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)
			for (int i = 0; i < OffsetSegments.Count; i++)
			{
				GameObject val = Segments[i];
				GameObject obj = OffsetSegments[i];
				obj.transform.localPosition = val.transform.localPosition + Vector3.up * Offset;
				obj.transform.localRotation = val.transform.localRotation;
				obj.transform.localScale = val.transform.localScale;
				obj.SetActive(val.activeSelf);
			}
		}

		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
	{
		public float Radius = 20f;

		private readonly float Speed = 0.1f;

		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_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);
			}
		}
	}
	public class RectangleRuler : BaseRuler
	{
		public float Width = 20f;

		public float Depth = 20f;

		private void EdgeFix(int index, float percent, float max, float start, float end, Vector3 direction)
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			float num = percent * max;
			Transform val = Get(index);
			Vector3 baseScale = BaseRuler.BaseScale;
			if (num - start < 0.5f)
			{
				baseScale.z *= num - start + 0.5f;
				val.localPosition += direction * (0.5f - baseScale.z / 2f);
			}
			if (end - num < 0.5f)
			{
				baseScale.z *= Mathf.Max(0f, end - num + 0.5f);
				val.localPosition -= direction * (0.5f - baseScale.z / 2f);
			}
			if (baseScale.z == 0f)
			{
				((Component)val).gameObject.SetActive(false);
			}
			else
			{
				((Component)val).gameObject.SetActive(true);
			}
			val.localScale = baseScale;
		}

		protected override void CreateLines()
		{
			float num = 2f * Width + 2f * Depth;
			int num2 = Math.Max(3, (int)num);
			int num3 = (int)Mathf.Max(2f, Mathf.Ceil((float)num2 * Depth / num));
			int num4 = (int)Mathf.Max(2f, Mathf.Ceil((float)num2 * Width / num));
			num2 = 2 * (num3 + num4);
			CreateSegments(num2);
			UpdateLines(num4, num3);
		}

		private void UpdateLines(int w, int d)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_0164: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			int count = Segments.Count;
			int num = 0;
			int num2 = 0;
			while (num2 < d)
			{
				SetRot(num, Vector3.forward);
				num2++;
				num++;
			}
			int num3 = 0;
			while (num3 < w)
			{
				SetRot(num, Vector3.right);
				num3++;
				num++;
			}
			int num4 = 0;
			while (num4 < d)
			{
				SetRot(num, Vector3.back);
				num4++;
				num++;
			}
			int num5 = 0;
			while (num5 < w)
			{
				SetRot(num, Vector3.left);
				num5++;
				num++;
			}
			num = 0;
			float num6 = Time.time * 0.025f * (float)(count - 4);
			float num7 = 0.5f;
			Vector3 val = Width * Vector3.left - (Depth + num7) * Vector3.forward;
			float num8 = 0.5f;
			float end = num8 + 2f * Depth;
			float num9 = 2f * Depth * (float)d / (float)(d - 1);
			float num10 = num6 / (float)d;
			int num11 = 0;
			while (num11 < d)
			{
				float num12 = ((float)num11 / (float)d + num10) % 1f;
				Vector3 pos = val + num12 * num9 * Vector3.forward;
				Set(num, pos);
				EdgeFix(num, num12, num9, num8, end, Vector3.forward);
				num11++;
				num++;
			}
			val = Depth * Vector3.forward - (Width + num7) * Vector3.right;
			end = num8 + 2f * Width;
			num9 = 2f * Width * (float)w / (float)(w - 1);
			num10 = num6 / (float)w;
			int num13 = 0;
			while (num13 < w)
			{
				float num14 = ((float)num13 / (float)w + num10) % 1f;
				Vector3 pos2 = val + num14 * num9 * Vector3.right;
				Set(num, pos2);
				EdgeFix(num, num14, num9, num8, end, Vector3.right);
				num13++;
				num++;
			}
			val = Width * Vector3.right - (Depth + num7) * Vector3.back;
			end = num8 + 2f * Depth;
			num9 = 2f * Depth * (float)d / (float)(d - 1);
			num10 = num6 / (float)d;
			int num15 = 0;
			while (num15 < d)
			{
				float num16 = ((float)num15 / (float)d + num10) % 1f;
				Vector3 pos3 = val + num16 * num9 * Vector3.back;
				Set(num, pos3);
				EdgeFix(num, num16, num9, num8, end, Vector3.back);
				num15++;
				num++;
			}
			val = Depth * Vector3.back - (Width + num7) * Vector3.left;
			end = num8 + 2f * Width;
			num9 = 2f * Width * (float)w / (float)(w - 1);
			num10 = num6 / (float)w;
			int num17 = 0;
			while (num17 < w)
			{
				float num18 = ((float)num17 / (float)w + num10) % 1f;
				Vector3 pos4 = val + num18 * num9 * Vector3.left;
				Set(num, pos4);
				EdgeFix(num, num18, num9, num8, end, Vector3.left);
				num17++;
				num++;
			}
		}
	}
	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 bool visible = false;

		private static readonly HashSet<string> visibleTags = new HashSet<string>();

		private static readonly HashSet<string> tags = new HashSet<string>();

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

		public static List<string> GetTags
		{
			get
			{
				HashSet<string> hashSet = tags;
				List<string> list = new List<string>(hashSet.Count);
				list.AddRange(hashSet);
				return list;
			}
		}

		public static bool IsTag(string name)
		{
			if (visible && visibleTags.Contains(name))
			{
				return !tagToGroup.ContainsKey(name);
			}
			return false;
		}

		public static void Set(bool visibility)
		{
			visible = visibility;
			UpdateVisibility();
		}

		public static void ToggleTag(string tag)
		{
			SetTag(tag, !visibleTags.Contains(tag));
		}

		public static void SetTag(string tag, bool visibility)
		{
			tags.Add(tag);
			if (visibility)
			{
				visibleTags.Add(tag);
			}
			else
			{
				visibleTags.Remove(tag);
			}
			UpdateTagVisibility(tag);
		}

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

		private static void UpdateVisibility()
		{
			Visualization[] visualizations = Utils.GetVisualizations();
			for (int i = 0; i < visualizations.Length; i++)
			{
				UpdateVisibility(visualizations[i]);
			}
		}

		private static void UpdateVisibility(Visualization obj)
		{
			GameObject gameObject = ((Component)obj).gameObject;
			bool flag = IsTag(obj.Tag);
			if (gameObject.activeSelf != flag)
			{
				gameObject.SetActive(flag);
			}
		}
	}
}
namespace Data
{
	public class Calculator
	{
		public static Vector3 EvaluateVector3(string expression)
		{
			//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_0061: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			string[] array = Parse.Split(expression);
			zero.x = EvaluateFloat(array[0]).GetValueOrDefault();
			if (array.Length > 1)
			{
				zero.z = EvaluateFloat(array[1]).GetValueOrDefault();
			}
			if (array.Length > 2)
			{
				zero.y = EvaluateFloat(array[2]).GetValueOrDefault();
			}
			return zero;
		}

		public static Vector3 EvaluateVector3(string[] s, int index)
		{
			//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_0065: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			if (s.Length > index)
			{
				zero.x = EvaluateFloat(s[index]).GetValueOrDefault();
			}
			if (s.Length > index + 1)
			{
				zero.z = EvaluateFloat(s[index + 1]).GetValueOrDefault();
			}
			if (s.Length > index + 2)
			{
				zero.y = EvaluateFloat(s[index + 2]).GetValueOrDefault();
			}
			return zero;
		}

		public static Quaternion EvaluateQuaternion(string expression)
		{
			//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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			string[] array = Parse.Split(expression);
			zero.y = EvaluateFloat(array[0]).GetValueOrDefault();
			if (array.Length > 1)
			{
				zero.x = EvaluateFloat(array[1]).GetValueOrDefault();
			}
			if (array.Length > 2)
			{
				zero.z = EvaluateFloat(array[2]).GetValueOrDefault();
			}
			return Quaternion.Euler(zero);
		}

		public static Quaternion EvaluateQuaternion(string[] s, int index)
		{
			//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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			if (s.Length > index)
			{
				zero.y = EvaluateFloat(s[index]).GetValueOrDefault();
			}
			if (s.Length > index + 1)
			{
				zero.x = EvaluateFloat(s[index + 1]).GetValueOrDefault();
			}
			if (s.Length > index + 2)
			{
				zero.z = EvaluateFloat(s[index + 2]).GetValueOrDefault();
			}
			return Quaternion.Euler(zero);
		}

		public static int? EvaluateInt(string expression)
		{
			try
			{
				return (int?)EvaluateLong(expression);
			}
			catch
			{
				return null;
			}
		}

		public static float? EvaluateFloat(string expression)
		{
			try
			{
				return (float)EvaluateDouble(expression);
			}
			catch
			{
				return null;
			}
		}

		private static double EvaluateDouble(string expression)
		{
			string[] array = expression.Split(new char[1] { '+' });
			if (array.Length > 1)
			{
				double num = 0.0;
				string[] array2 = array;
				foreach (string expression2 in array2)
				{
					num += EvaluateDouble(expression2);
				}
				return num;
			}
			string[] array3 = expression.Split(new char[1] { '-' });
			if (array3.Where((string s) => s != "").Count() > 1)
			{
				double? num2 = null;
				for (int j = 0; j < array3.Length; j++)
				{
					if (!(array3[j] == "") || j + 1 >= array3.Length)
					{
						num2 = (num2.HasValue ? (num2 - EvaluateDouble(array3[j])) : new double?(EvaluateDouble(array3[j])));
					}
					else
					{
						array3[j + 1] = "-" + array3[j + 1];
					}
				}
				return num2.GetValueOrDefault();
			}
			string[] array4 = expression.Split(new char[1] { '*' });
			if (array4.Length > 1)
			{
				double num3 = 1.0;
				string[] array2 = array4;
				foreach (string expression3 in array2)
				{
					num3 *= EvaluateDouble(expression3);
				}
				return num3;
			}
			string[] array5 = expression.Split(new char[1] { '/' });
			if (array5.Length > 1)
			{
				double num4 = EvaluateDouble(array5[0]);
				for (int k = 1; k < array5.Length; k++)
				{
					num4 /= EvaluateDouble(array5[k]);
				}
				return num4;
			}
			try
			{
				return double.Parse(expression.Trim(), NumberFormatInfo.InvariantInfo);
			}
			catch
			{
				throw new InvalidOperationException("Failed to parse expression: " + expression);
			}
		}

		public static long? EvaluateLong(string expression)
		{
			try
			{
				return EvalLong(expression);
			}
			catch
			{
				return null;
			}
		}

		private static long EvalLong(string expression)
		{
			string[] array = expression.Split(new char[1] { '+' });
			if (array.Length > 1)
			{
				long num = 0L;
				string[] array2 = array;
				foreach (string expression2 in array2)
				{
					num += EvalLong(expression2);
				}
				return num;
			}
			string[] array3 = expression.Split(new char[1] { '-' });
			if (array3.Where((string s) => s != "").Count() > 1)
			{
				long? num2 = null;
				for (int j = 0; j < array3.Length; j++)
				{
					if (!(array3[j] == "") || j + 1 >= array3.Length)
					{
						num2 = (num2.HasValue ? (num2 - EvalLong(array3[j])) : new long?(EvalLong(array3[j])));
					}
					else
					{
						array3[j + 1] = "-" + array3[j + 1];
					}
				}
				return num2.GetValueOrDefault();
			}
			string[] array4 = expression.Split(new char[1] { '*' });
			if (array4.Length > 1)
			{
				long num3 = 1L;
				string[] array2 = array4;
				foreach (string expression3 in array2)
				{
					num3 *= EvalLong(expression3);
				}
				return num3;
			}
			string[] array5 = expression.Split(new char[1] { '/' });
			if (array5.Length > 1)
			{
				long num4 = EvalLong(array5[0]);
				for (int k = 1; k < array5.Length; k++)
				{
					num4 /= EvalLong(array5[k]);
				}
				return num4;
			}
			try
			{
				return long.Parse(expression.Trim());
			}
			catch
			{
				throw new InvalidOperationException("Failed to parse expression: " + expression);
			}
		}
	}
	public class Parameters
	{
		[CompilerGenerated]
		private string <prefab>P;

		[CompilerGenerated]
		private string <arg>P;

		[CompilerGenerated]
		private Vector3 <pos>P;

		public static Func<string, string?> ExecuteCode = (string key) => null;

		public static Func<string, string, string?> ExecuteCodeWithValue = (string key, string value) => null;

		protected string[]? args;

		private readonly double time;

		public Parameters(string prefab, string arg, Vector3 pos)
		{
			//IL_000f: 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)
			<prefab>P = prefab;
			<arg>P = arg;
			<pos>P = pos;
			time = ZNet.instance.GetTimeSeconds();
			base..ctor();
		}

		public string Replace(string str)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < str.Length; i++)
			{
				if (str[i] == '<')
				{
					if (num == 0)
					{
						stringBuilder.Append(str.Substring(num2, i - num2));
						num2 = i;
					}
					num++;
				}
				if (str[i] == '>')
				{
					if (num == 1)
					{
						string str2 = str.Substring(num2, i - num2 + 1);
						stringBuilder.Append(ResolveParameters(str2));
						num2 = i + 1;
					}
					if (num > 0)
					{
						num--;
					}
				}
			}
			if (num2 < str.Length)
			{
				stringBuilder.Append(str.Substring(num2));
			}
			return stringBuilder.ToString();
		}

		private string ResolveParameters(string str)
		{
			int num;
			for (num = 0; num < str.Length; num++)
			{
				int num2 = str.IndexOf(">", num);
				if (num2 == -1)
				{
					break;
				}
				num = num2;
				int num3 = str.LastIndexOf("<", num2);
				if (num3 != -1)
				{
					int num4 = num2 - num3 + 1;
					if (TryReplaceParameter(str.Substring(num3, num4), out string resolved))
					{
						str = str.Remove(num3, num4);
						str = str.Insert(num3, resolved);
						num = num3 - 1;
					}
					else
					{
						num = num2;
					}
				}
			}
			return str;
		}

		private bool TryReplaceParameter(string key, out string resolved)
		{
			resolved = GetParameter(key) ?? key;
			return resolved != key;
		}

		protected virtual string? GetParameter(string key)
		{
			string text = ExecuteCode(key.Substring(1, key.Length - 2));
			if (text != null)
			{
				return text;
			}
			text = GetGeneralParameter(key);
			if (text != null)
			{
				return text;
			}
			KeyValuePair<string, string> keyValuePair = Parse.Kvp(key, '_');
			if (keyValuePair.Value == "")
			{
				return null;
			}
			key = keyValuePair.Key.Substring(1);
			string str = keyValuePair.Value.Substring(0, keyValuePair.Value.Length - 1);
			KeyValuePair<string, string> keyValuePair2 = Parse.Kvp(str, '=');
			str = keyValuePair2.Key;
			string value = keyValuePair2.Value;
			text = ExecuteCodeWithValue(key, str);
			if (text != null)
			{
				return text;
			}
			return GetValueParameter(key, str, value);
		}

		private string? GetGeneralParameter(string key)
		{
			return key switch
			{
				"<prefab>" => <prefab>P, 
				"<par>" => <arg>P, 
				"<par0>" => GetArg(0), 
				"<par1>" => GetArg(1), 
				"<par2>" => GetArg(2), 
				"<par3>" => GetArg(3), 
				"<par4>" => GetArg(4), 
				"<par5>" => GetArg(5), 
				"<par6>" => GetArg(6), 
				"<par7>" => GetArg(7), 
				"<par8>" => GetArg(8), 
				"<par9>" => GetArg(9), 
				"<time>" => Format(time), 
				"<day>" => EnvMan.instance.GetDay(time).ToString(), 
				"<ticks>" => ((long)(time * 10000000.0)).ToString(), 
				"<x>" => Format(<pos>P.x), 
				"<y>" => Format(<pos>P.y), 
				"<z>" => Format(<pos>P.z), 
				"<snap>" => Format(WorldGenerator.instance.GetHeight(<pos>P.x, <pos>P.z)), 
				_ => null, 
			};
		}

		protected virtual string? GetValueParameter(string key, string value, string defaultValue)
		{
			float result;
			float result2;
			float result3;
			float result4;
			float result5;
			float result6;
			float result7;
			float result8;
			float result9;
			float result10;
			KeyValuePair<string, string> kvp;
			float result11;
			float result12;
			float result13;
			KeyValuePair<string, string> kvp2;
			float result14;
			float result15;
			KeyValuePair<string, string> kvp3;
			float result16;
			float result17;
			KeyValuePair<string, string> kvp4;
			float result18;
			float result19;
			KeyValuePair<string, string> kvp5;
			float result20;
			float result21;
			KeyValuePair<string, string> kvp6;
			float result22;
			float result23;
			KeyValuePair<string, string> kvp7;
			float result24;
			float result25;
			KeyValuePair<string, string> kvp8;
			float result26;
			float result27;
			KeyValuePair<string, string> kvp9;
			float result28;
			float result29;
			KeyValuePair<string, string> kvp10;
			int result30;
			int result31;
			int result32;
			int result33;
			return key switch
			{
				"sqrt" => Parse.TryFloat(value, out result) ? Mathf.Sqrt(result).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"round" => Parse.TryFloat(value, out result2) ? Mathf.Round(result2).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"ceil" => Parse.TryFloat(value, out result3) ? Mathf.Ceil(result3).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"floor" => Parse.TryFloat(value, out result4) ? Mathf.Floor(result4).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"abs" => Parse.TryFloat(value, out result5) ? Mathf.Abs(result5).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"sin" => Parse.TryFloat(value, out result6) ? Mathf.Sin(result6).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"cos" => Parse.TryFloat(value, out result7) ? Mathf.Cos(result7).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"tan" => Parse.TryFloat(value, out result8) ? Mathf.Tan(result8).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"asin" => Parse.TryFloat(value, out result9) ? Mathf.Asin(result9).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"acos" => Parse.TryFloat(value, out result10) ? Mathf.Acos(result10).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"atan" => Atan(value, defaultValue), 
				"pow" => (Parse.TryKvp(value, out kvp, '_') && Parse.TryFloat(kvp.Key, out result11) && Parse.TryFloat(kvp.Value, out result12)) ? Mathf.Pow(result11, result12).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"log" => Log(value, defaultValue), 
				"exp" => Parse.TryFloat(value, out result13) ? Mathf.Exp(result13).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"min" => (Parse.TryKvp(value, out kvp2, '_') && Parse.TryFloat(kvp2.Key, out result14) && Parse.TryFloat(kvp2.Value, out result15)) ? Mathf.Min(result14, result15).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"max" => (Parse.TryKvp(value, out kvp3, '_') && Parse.TryFloat(kvp3.Key, out result16) && Parse.TryFloat(kvp3.Value, out result17)) ? Mathf.Max(result16, result17).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"add" => (Parse.TryKvp(value, out kvp4, '_') && Parse.TryFloat(kvp4.Key, out result18) && Parse.TryFloat(kvp4.Value, out result19)) ? (result18 + result19).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"sub" => (Parse.TryKvp(value, out kvp5, '_') && Parse.TryFloat(kvp5.Key, out result20) && Parse.TryFloat(kvp5.Value, out result21)) ? (result20 - result21).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"mul" => (Parse.TryKvp(value, out kvp6, '_') && Parse.TryFloat(kvp6.Key, out result22) && Parse.TryFloat(kvp6.Value, out result23)) ? (result22 * result23).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"div" => (Parse.TryKvp(value, out kvp7, '_') && Parse.TryFloat(kvp7.Key, out result24) && Parse.TryFloat(kvp7.Value, out result25)) ? (result24 / result25).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"mod" => (Parse.TryKvp(value, out kvp8, '_') && Parse.TryFloat(kvp8.Key, out result26) && Parse.TryFloat(kvp8.Value, out result27)) ? (result26 % result27).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"randf" => (Parse.TryKvp(value, out kvp9, '_') && Parse.TryFloat(kvp9.Key, out result28) && Parse.TryFloat(kvp9.Value, out result29)) ? Random.Range(result28, result29).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"randi" => (Parse.TryKvp(value, out kvp10, '_') && Parse.TryInt(kvp10.Key, out result30) && Parse.TryInt(kvp10.Value, out result31)) ? Random.Range(result30, result31).ToString(CultureInfo.InvariantCulture) : defaultValue, 
				"hash" => Hash(value).ToString(), 
				"len" => value.Length.ToString(CultureInfo.InvariantCulture), 
				"lower" => value.ToLowerInvariant(), 
				"upper" => value.ToUpperInvariant(), 
				"trim" => value.Trim(), 
				"calcf" => Calculator.EvaluateFloat(value)?.ToString(CultureInfo.InvariantCulture) ?? defaultValue, 
				"calci" => Calculator.EvaluateInt(value)?.ToString(CultureInfo.InvariantCulture) ?? defaultValue, 
				"par" => Parse.TryInt(value, out result32) ? GetArg(result32, defaultValue) : defaultValue, 
				"rest" => Parse.TryInt(value, out result33) ? GetRest(result33, defaultValue) : defaultValue, 
				_ => null, 
			};
		}

		private string GetRest(int index, string defaultValue = "")
		{
			if (args == null)
			{
				args = <arg>P.Split(new char[1] { ' ' });
			}
			if (index < 0 || index >= args.Length)
			{
				return defaultValue;
			}
			return string.Join(" ", args, index, args.Length - index);
		}

		private string Atan(string value, string defaultValue)
		{
			KeyValuePair<string, string> keyValuePair = Parse.Kvp(value, '_');
			if (!Parse.TryFloat(keyValuePair.Key, out var result))
			{
				return defaultValue;
			}
			if (keyValuePair.Value == "")
			{
				return Mathf.Atan(result).ToString(CultureInfo.InvariantCulture);
			}
			if (!Parse.TryFloat(keyValuePair.Value, out var result2))
			{
				return defaultValue;
			}
			return Mathf.Atan2(result, result2).ToString(CultureInfo.InvariantCulture);
		}

		private string Log(string value, string defaultValue)
		{
			KeyValuePair<string, string> keyValuePair = Parse.Kvp(value, '_');
			if (!Parse.TryFloat(keyValuePair.Key, out var result))
			{
				return defaultValue;
			}
			if (keyValuePair.Value == "")
			{
				return Mathf.Log(result).ToString(CultureInfo.InvariantCulture);
			}
			if (!Parse.TryFloat(keyValuePair.Value, out var result2))
			{
				return defaultValue;
			}
			return Mathf.Log(result, result2).ToString(CultureInfo.InvariantCulture);
		}

		private string GetArg(int index, string defaultValue = "")
		{
			if (args == null)
			{
				args = <arg>P.Split(new char[1] { ' ' });
			}
			if (args.Length > index)
			{
				return args[index];
			}
			return defaultValue;
		}

		protected static string Format(float value)
		{
			return value.ToString("0.#####", NumberFormatInfo.InvariantInfo);
		}

		protected static string Format(double value)
		{
			return value.ToString("0.#####", NumberFormatInfo.InvariantInfo);
		}

		public static string PrintVectorXZY(Vector3 vector)
		{
			return vector.x.ToString("0.##", CultureInfo.InvariantCulture) + " " + vector.z.ToString("0.##", CultureInfo.InvariantCulture) + " " + vector.y.ToString("0.##", CultureInfo.InvariantCulture);
		}

		public static string PrintAngleYXZ(Quaternion quaternion)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return PrintVectorYXZ(((Quaternion)(ref quaternion)).eulerAngles);
		}

		private static string PrintVectorYXZ(Vector3 vector)
		{
			return vector.y.ToString("0.##", CultureInfo.InvariantCulture) + " " + vector.x.ToString("0.##", CultureInfo.InvariantCulture) + " " + vector.z.ToString("0.##", CultureInfo.InvariantCulture);
		}

		public static int Hash(string key)
		{
			if (Parse.TryInt(key, out var result))
			{
				return result;
			}
			if (key.StartsWith("$", StringComparison.InvariantCultureIgnoreCase))
			{
				int hash = ZSyncAnimation.GetHash(key.Substring(1));
				if (key == "$anim_speed")
				{
					return hash;
				}
				return 438569 + hash;
			}
			return StringExtensionMethods.GetStableHashCode(key);
		}

		public static string GetGlobalKey(string key)
		{
			string lower = key.ToLowerInvariant();
			return ZoneSystem.instance.m_globalKeysValues.FirstOrDefault((KeyValuePair<string, string> kvp) => kvp.Key.ToLowerInvariant() == lower).Value ?? "0";
		}
	}
	public class ObjectParameters : Parameters
	{
		[CompilerGenerated]
		private ZDO <zdo>P;

		private Inventory? inventory;

		public ObjectParameters(string prefab, string arg, ZDO zdo)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			<zdo>P = zdo;
			base..ctor(prefab, arg, <zdo>P.m_position);
		}

		protected override string? GetParameter(string key)
		{
			string parameter = base.GetParameter(key);
			if (parameter != null)
			{
				return parameter;
			}
			parameter = GetGeneralParameter(key);
			if (parameter != null)
			{
				return parameter;
			}
			KeyValuePair<string, string> keyValuePair = Parse.Kvp(key, '_');
			if (keyValuePair.Value == "")
			{
				return null;
			}
			key = keyValuePair.Key.Substring(1);
			string str = keyValuePair.Value.Substring(0, keyValuePair.Value.Length - 1);
			KeyValuePair<string, string> keyValuePair2 = Parse.Kvp(str, '=');
			str = keyValuePair2.Key;
			string value = keyValuePair2.Value;
			parameter = Parameters.ExecuteCodeWithValue(key, str);
			if (parameter != null)
			{
				return parameter;
			}
			parameter = base.GetValueParameter(key, str, value);
			if (parameter != null)
			{
				return parameter;
			}
			return GetValueParameter(key, str, value);
		}

		private string? GetGeneralParameter(string key)
		{
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			return key switch
			{
				"<zdo>" => ((object)(ZDOID)(ref <zdo>P.m_uid)).ToString(), 
				"<pos>" => Parameters.Format(<zdo>P.m_position.x) + "," + Parameters.Format(<zdo>P.m_position.z) + "," + Parameters.Format(<zdo>P.m_position.y), 
				"<i>" => ZoneSystem.GetZone(<zdo>P.m_position).x.ToString(), 
				"<j>" => ZoneSystem.GetZone(<zdo>P.m_position).y.ToString(), 
				"<a>" => Parameters.Format(<zdo>P.m_rotation.y), 
				"<rot>" => Parameters.Format(<zdo>P.m_rotation.y) + "," + Parameters.Format(<zdo>P.m_rotation.x) + "," + Parameters.Format(<zdo>P.m_rotation.z), 
				"<pid>" => GetPid(<zdo>P), 
				"<pname>" => GetPname(<zdo>P), 
				"<pchar>" => GetPchar(<zdo>P), 
				"<owner>" => <zdo>P.GetOwner().ToString(), 
				_ => null, 
			};
		}

		private static string GetPid(ZDO zdo)
		{
			ZNetPeer peer = GetPeer(zdo);
			if (peer != null)
			{
				return peer.m_rpc.GetSocket().GetHostName();
			}
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return "Server";
			}
			return "";
		}

		private static string GetPname(ZDO zdo)
		{
			ZNetPeer peer = GetPeer(zdo);
			if (peer != null)
			{
				return peer.m_playerName;
			}
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return Player.m_localPlayer.GetPlayerName();
			}
			return "";
		}

		private static string GetPchar(ZDO zdo)
		{
			ZNetPeer peer = GetPeer(zdo);
			if (peer != null)
			{
				return ((object)(ZDOID)(ref peer.m_characterID)).ToString();
			}
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return Player.m_localPlayer.GetPlayerID().ToString();
			}
			return "";
		}

		private static ZNetPeer? GetPeer(ZDO zdo)
		{
			if (zdo.GetOwner() == 0L)
			{
				return null;
			}
			return ZNet.instance.GetPeer(zdo.GetOwner());
		}

		protected override string? GetValueParameter(string key, string value, string defaultValue)
		{
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			switch (key)
			{
			case "key":
				return Parameters.GetGlobalKey(value);
			case "string":
				return GetString(value, defaultValue);
			case "float":
				return GetFloat(value, defaultValue).ToString(CultureInfo.InvariantCulture);
			case "int":
				return GetInt(value, defaultValue).ToString(CultureInfo.InvariantCulture);
			case "long":
				return GetLong(value, defaultValue).ToString(CultureInfo.InvariantCulture);
			case "bool":
				return GetBool(value, defaultValue) ? "true" : "false";
			case "hash":
			{
				GameObject prefab = ZNetScene.instance.GetPrefab(<zdo>P.GetInt(value, 0));
				return ((prefab != null) ? ((Object)prefab).name : null) ?? "";
			}
			case "vec":
				return Parameters.PrintVectorXZY(GetVec3(value, defaultValue));
			case "quat":
				return Parameters.PrintAngleYXZ(GetQuaternion(value, defaultValue));
			case "byte":
				return Convert.ToBase64String(<zdo>P.GetByteArray(value, (byte[])null));
			case "zdo":
			{
				ZDOID zDOID = <zdo>P.GetZDOID(value);
				return ((object)(ZDOID)(ref zDOID)).ToString();
			}
			case "item":
				return GetAmountOfItems(value).ToString();
			case "pos":
				return Parameters.PrintVectorXZY(GetPos(value));
			case "pdata":
				return GetPlayerData(<zdo>P, value);
			default:
				return null;
			}
		}

		private string GetString(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			string result = default(string);
			if (!ZDOExtraData.s_strings.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref result))
			{
				return GetStringField(value, defaultValue);
			}
			return result;
		}

		private float GetFloat(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			float result = default(float);
			if (!ZDOExtraData.s_floats.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref result))
			{
				return GetFloatField(value, defaultValue);
			}
			return result;
		}

		private int GetInt(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			int result = default(int);
			if (!ZDOExtraData.s_ints.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref result))
			{
				return GetIntField(value, defaultValue);
			}
			return result;
		}

		private long GetLong(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			long result = default(long);
			if (!ZDOExtraData.s_longs.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref result))
			{
				return GetLongField(value, defaultValue);
			}
			return result;
		}

		private bool GetBool(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			int num = default(int);
			if (!ZDOExtraData.s_ints.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref num))
			{
				return GetBoolField(value, defaultValue);
			}
			return num > 0;
		}

		private Vector3 GetVec3(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			Vector3 result = default(Vector3);
			if (!ZDOExtraData.s_vec3.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref result))
			{
				return GetVecField(value, defaultValue);
			}
			return result;
		}

		private Quaternion GetQuaternion(string value, string defaultValue)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			Quaternion result = default(Quaternion);
			if (!ZDOExtraData.s_quats.TryGetValue(<zdo>P.m_uid, out var value2) || !value2.TryGetValue(Parameters.Hash(value), ref result))
			{
				return GetQuatField(value, defaultValue);
			}
			return result;
		}

		private string GetStringField(string value, string defaultValue)
		{
			if (!(GetField(value) is string result))
			{
				return defaultValue;
			}
			return result;
		}

		private float GetFloatField(string value, string defaultValue)
		{
			object field = GetField(value);
			if (field is float)
			{
				return (float)field;
			}
			return Parse.Float(defaultValue);
		}

		private int GetIntField(string value, string defaultValue)
		{
			object field = GetField(value);
			if (field is int)
			{
				return (int)field;
			}
			return Parse.Int(defaultValue);
		}

		private bool GetBoolField(string value, string defaultValue)
		{
			object field = GetField(value);
			if (field is bool)
			{
				return (bool)field;
			}
			return Parse.Boolean(defaultValue);
		}

		private long GetLongField(string value, string defaultValue)
		{
			object field = GetField(value);
			if (field is long)
			{
				return (long)field;
			}
			return Parse.Long(defaultValue, 0L);
		}

		private Vector3 GetVecField(string value, string defaultValue)
		{
			//IL_001a: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			object field = GetField(value);
			if (field is Vector3)
			{
				return (Vector3)field;
			}
			return Parse.VectorXZY(defaultValue);
		}

		private Quaternion GetQuatField(string value, string defaultValue)
		{
			//IL_001a: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			object field = GetField(value);
			if (field is Quaternion)
			{
				return (Quaternion)field;
			}
			return Parse.AngleYXZ(defaultValue);
		}

		private object? GetField(string value)
		{
			KeyValuePair<string, string> keyValuePair = Parse.Kvp(value, '.');
			if (keyValuePair.Value == "")
			{
				return null;
			}
			GameObject prefab = ZNetScene.instance.GetPrefab(<zdo>P.m_prefab);
			if ((Object)(object)prefab == (Object)null)
			{
				return null;
			}
			Component component = prefab.GetComponent(keyValuePair.Key);
			if ((Object)(object)component == (Object)null)
			{
				return null;
			}
			string[] array = keyValuePair.Value.Split(new char[1] { '.' });
			object obj = component;
			string[] array2 = array;
			foreach (string name in array2)
			{
				FieldInfo field = obj.GetType().GetField(name);
				if (field == null)
				{
					return null;
				}
				obj = field.GetValue(obj);
				if (obj == null)
				{
					return null;
				}
			}
			return obj;
		}

		private int GetAmountOfItems(string prefab)
		{
			LoadInventory();
			if (inventory == null)
			{
				return 0;
			}
			int num = 0;
			foreach (ItemData item in inventory.m_inventory)
			{
				GameObject dropPrefab = item.m_dropPrefab;
				if ((((dropPrefab != null) ? ((Object)dropPrefab).name : null) ?? item.m_shared.m_name) == prefab)
				{
					num += item.m_stack;
				}
			}
			return num;
		}

		private void LoadInventory()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (inventory == null)
			{
				string @string = <zdo>P.GetString(ZDOVars.s_items, "");
				if (!(@string == ""))
				{
					inventory = new Inventory("", (Sprite)null, 4, 2);
					inventory.Load(new ZPackage(@string));
				}
			}
		}

		private Vector3 GetPos(string value)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Parse.VectorXZY(value);
			return <zdo>P.GetPosition() + <zdo>P.GetRotation() * val;
		}

		public static string GetPlayerData(ZDO zdo, string key)
		{
			ZNetPeer peer = GetPeer(zdo);
			if (peer != null)
			{
				if (!peer.m_serverSyncedPlayerData.TryGetValue(key, out var value))
				{
					return "";
				}
				return value;
			}
			if (Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				if (!ZNet.instance.m_serverSyncedPlayerData.TryGetValue(key, out var value2))
				{
					return "";
				}
				return value2;
			}
			return "";
		}
	}
	public class PrefabHelper
	{
		private static readonly Dictionary<string, List<int>> ResultCache = new Dictionary<string, List<int>>();

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

		private static readonly int WearNTearHash = StringExtensionMethods.GetStableHashCode("wearntear");

		private static readonly int HumanoidHash = StringExtensionMethods.GetStableHashCode("humanoid");

		private static readonly int CreatureHash = StringExtensionMethods.GetStableHashCode("creature");

		private static readonly int StructureHash = StringExtensionMethods.GetStableHashCode("structure");

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

		public static int? GetPrefab(string value)
		{
			List<int> prefabs = GetPrefabs(value);
			if (prefabs.Count == 0)
			{
				return null;
			}
			if (prefabs.Count == 1)
			{
				return prefabs[0];
			}
			return prefabs[Random.Range(0, prefabs.Count)];
		}

		public static void ClearCache()
		{
			ResultCache.Clear();
			PrefabCache.Clear();
			LoadGroups();
		}

		private static void LoadGroups()
		{
			if (Groups.Count > 0)
			{
				return;
			}
			foreach (KeyValuePair<int, GameObject> namedPrefab in ZNetScene.instance.m_namedPrefabs)
			{
				if (!Object.op_Implicit((Object)(object)namedPrefab.Value))
				{
					continue;
				}
				namedPrefab.Value.GetComponentsInChildren<MonoBehaviour>(ZNetView.m_tempComponents);
				foreach (MonoBehaviour tempComponent in ZNetView.m_tempComponents)
				{
					int stableHashCode = StringExtensionMethods.GetStableHashCode(((object)tempComponent).GetType().Name.ToLowerInvariant());
					if (!Groups.ContainsKey(stableHashCode))
					{
						Groups[stableHashCode] = new List<int>();
					}
					Groups[stableHashCode].Add(namedPrefab.Key);
				}
			}
			Groups[CreatureHash] = Groups[HumanoidHash];
			Groups[StructureHash] = Groups[WearNTearHash];
		}

		public static List<int> GetPrefabs(string value)
		{
			if (ResultCache.ContainsKey(value))
			{
				return ResultCache[value];
			}
			List<int> prefabs = GetPrefabs(Parse.ToList(value));
			if (prefabs == null)
			{
				return new List<int>();
			}
			ResultCache[value] = prefabs;
			return prefabs;
		}

		public static List<int>? GetPrefabs(List<string> values)
		{
			if (values.Count == 0)
			{
				return null;
			}
			if (values.Count == 1)
			{
				return ParsePrefabs(values[0]);
			}
			List<List<int>> list = (from s in values.Select(ParsePrefabs)
				where s != null
				select s).ToList();
			HashSet<int> hashSet = new HashSet<int>();
			foreach (List<int> item in list)
			{
				if (item == null)
				{
					continue;
				}
				foreach (int item2 in item)
				{
					hashSet.Add(item2);
				}
			}
			if (hashSet.Count != 0)
			{
				HashSet<int> hashSet2 = hashSet;
				List<int> list2 = new List<int>(hashSet2.Count);
				list2.AddRange(hashSet2);
				return list2;
			}
			return null;
		}

		private static List<int>? ParsePrefabs(string prefab)
		{
			string p = prefab.ToLowerInvariant();
			if (PrefabCache.Count == 0)
			{
				PrefabCache = ZNetScene.instance.m_namedPrefabs.ToDictionary((KeyValuePair<int, GameObject> pair) => ((Object)pair.Value).name, (KeyValuePair<int, GameObject> pair) => pair.Key);
			}
			if (p == "*")
			{
				Dictionary<string, int>.ValueCollection values = PrefabCache.Values;
				List<int> list = new List<int>(values.Count);
				list.AddRange(values);
				return list;
			}
			if (p[0] == '*' && p[p.Length - 1] == '*')
			{
				p = p.Substring(1, p.Length - 2);
				return (from pair in PrefabCache
					where pair.Key.ToLowerInvariant().Contains(p)
					select pair.Value).ToList();
			}
			if (p[0] == '*')
			{
				p = p.Substring(1);
				return (from pair in PrefabCache
					where pair.Key.EndsWith(p, StringComparison.OrdinalIgnoreCase)
					select pair.Value).ToList();
			}
			if (p[p.Length - 1] == '*')
			{
				p = p.Substring(0, p.Length - 1);
				return (from pair in PrefabCache
					where pair.Key.StartsWith(p, StringComparison.OrdinalIgnoreCase)
					select pair.Value).ToList();
			}
			if (PrefabCache.ContainsKey(prefab))
			{
				return new List<int>(1) { PrefabCache[prefab] };
			}
			int stableHashCode = StringExtensionMethods.GetStableHashCode(p);
			if (Groups.ContainsKey(stableHashCode))
			{
				return Groups[stableHashCode];
			}
			Log.Warning("Failed to resolve prefab: " + prefab);
			return null;
		}
	}
}
namespace Service
{
	public static class Admin
	{
		public static IAdmin Instance = new DefaultAdmin();

		public static bool Enabled
		{
			get
			{
				return Instance.Enabled;
			}
			set
			{
				Instance.Enabled = value;
			}
		}

		public static bool Checking
		{
			get
			{
				return Instance.Checking;
			}
			set
			{
				Instance.Checking = value;
			}
		}

		public static void Check()
		{
			Instance.Check();
		}

		public static void Verify(string text)
		{
			Instance.Verify(text);
		}
	}
	public interface IAdmin
	{
		bool Enabled { get; set; }

		bool Checking { get; set; }

		void Check();

		void Verify(string text);
	}
	public class DefaultAdmin : IAdmin
	{
		public virtual bool Enabled { get; set; }

		public virtual bool Checking { get; set; }

		public void Check()
		{
			if (Object.op_Implicit((Object)(object)ZNet.instance))
			{
				Checking = true;
				if (ZNet.instance.IsServer())
				{
					OnSuccess();
				}
				else
				{
					ZNet.instance.Unban("admintest");
				}
			}
		}

		public void Verify(string text)
		{
			if (text == "Unbanning user admintest")
			{
				OnSuccess();
			}
			else
			{
				OnFail();
			}
		}

		protected virtual void OnSuccess()
		{
			Checking = false;
			Enabled = true;
		}

		protected virtual void OnFail()
		{
			Checking = false;
			Enabled = false;
		}
	}
	[HarmonyPatch(typeof(ZNet), "RPC_RemotePrint")]
	public class ZNet_RPC_RemotePrint
	{
		private static bool Prefix(string text)
		{
			if (!Admin.Checking)
			{
				return true;
			}
			Admin.Verify(text);
			return false;
		}
	}
	[HarmonyPatch(typeof(Game), "UpdateRespawn")]
	public class CheckAdmin
	{
		private static void Prefix(bool ___m_firstSpawn, ref bool __state)
		{
			if (___m_firstSpawn)
			{
				Admin.Enabled = false;
			}
			__sta