Decompiled source of STRAFTH v2.1.0

BepInEx/plugins/STRAFTH/STRAFTH.dll

Decompiled an hour ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ComputerysModdingUtilities;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using FishNet;
using FishNet.Component.Animating;
using FishNet.Component.Transforming;
using FishNet.Connection;
using FishNet.Managing.Client;
using FishNet.Managing.Object;
using FishNet.Managing.Scened;
using FishNet.Managing.Timing;
using FishNet.Object;
using FishNet.Object.Synchronizing;
using FishNet.Transporting;
using FishySteamworks;
using HarmonyLib;
using HeathenEngineering.DEMO;
using ModMenu.Api;
using Newtonsoft.Json.Linq;
using Steamworks;
using Strafth.AimTrainer;
using Strafth.Duels;
using Strafth.Routes;
using Strafth.Social;
using TMPro;
using UnityEngine;
using UnityEngine.Animations.Rigging;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.LowLevel;
using UnityEngine.Networking;
using UnityEngine.Playables;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.TextCore;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("STRAFTH")]
[assembly: AssemblyDescription("STRAFTH for STRAFTAT. Dorsth was here.")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: StraftatMod(true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.0.0")]
[module: UnverifiableCode]
namespace Strafth
{
	internal sealed class Arena
	{
		public sealed class MovingPart
		{
			public Transform T;

			public Collider C;

			public Vector3 Home;

			public Func<double, Vector3> At;
		}

		public GameObject Root;

		public readonly Vector3 Origin;

		public Material Floor;

		public Material Wall;

		private readonly List<MeshRenderer> renderers = new List<MeshRenderer>();

		private readonly HashSet<MeshRenderer> shaded = new HashSet<MeshRenderer>();

		private const float Shade = 0.6f;

		private Material shadedWall;

		private readonly List<Mesh> meshes = new List<Mesh>();

		private readonly int layer;

		private readonly string tag;

		private static readonly List<Arena> live = new List<Arena>();

		private static float lookDirtyAt = -1f;

		public bool UsesSky = true;

		public bool Roofed;

		public Bounds Extent;

		private bool hasExtent;

		private readonly List<Material> signMats = new List<Material>();

		public readonly List<MovingPart> Movers = new List<MovingPart>();

		public bool HasExtent => hasExtent;

		public Arena(Vector3 origin, int useLayer, string useTag)
		{
			//IL_0045: 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)
			Origin = origin;
			layer = useLayer;
			tag = useTag;
			live.Add(this);
		}

		public static void LookChanged()
		{
			if (live.Count > 0)
			{
				lookDirtyAt = Time.unscaledTime + 0.2f;
			}
		}

		public static void SkyChanged()
		{
			foreach (Arena item in live)
			{
				if (item.UsesSky)
				{
					Skies.Apply(Cfg.Sky.Value);
					break;
				}
			}
		}

		public static void Tick()
		{
			if (lookDirtyAt < 0f || Time.unscaledTime < lookDirtyAt)
			{
				return;
			}
			lookDirtyAt = -1f;
			foreach (Arena item in live)
			{
				item.ApplyLook();
			}
		}

		public static Vector3 FindSpace(Vector3 half)
		{
			//IL_0000: 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)
			return FindSpace(half, new Vector3(0f, 2000f, 0f));
		}

		public static Vector3 FindSpace(Vector3 half, Vector3 start)
		{
			//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_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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0049: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = start;
			for (int i = 0; i < 8; i++)
			{
				if (!Physics.CheckBox(val + Vector3.up * half.y, half, Quaternion.identity, -1, (QueryTriggerInteraction)1))
				{
					break;
				}
				val += Vector3.up * 500f;
			}
			return val;
		}

		public static void GroundStyle(FirstPersonController p, out int layer, out string tag)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			layer = 0;
			tag = "Untagged";
			float num = float.MaxValue;
			RaycastHit[] array = Physics.RaycastAll(((Component)p).transform.position + Vector3.up * 0.5f, Vector3.down, 30f, -1, (QueryTriggerInteraction)1);
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit val = array[i];
				if (!((Object)(object)((Component)((RaycastHit)(ref val)).collider).transform.root == (Object)(object)((Component)p).transform.root) && !(((RaycastHit)(ref val)).distance >= num))
				{
					num = ((RaycastHit)(ref val)).distance;
					layer = ((Component)((RaycastHit)(ref val)).collider).gameObject.layer;
					tag = ((Component)((RaycastHit)(ref val)).collider).tag;
				}
			}
			if (layer == 11 || layer == 7 || layer == 8)
			{
				layer = 0;
				tag = "Untagged";
			}
		}

		public void Begin()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			Clear();
			Root = new GameObject("ST_Arena");
			Root.transform.position = Origin;
			Movers.Clear();
			Roofed = false;
			hasExtent = false;
			Extent = default(Bounds);
		}

		public void Room(float halfW, float back, float front, float wallH)
		{
			//IL_001f: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			Box(new Vector3(0f - halfW - 1f, -1f, 0f - back - 1f), new Vector3(halfW + 1f, 0f, front + 1f));
			Box(new Vector3(0f - halfW - 1f, 0f, front), new Vector3(halfW + 1f, wallH, front + 1f));
			Box(new Vector3(0f - halfW - 1f, 0f, 0f - back - 1f), new Vector3(halfW + 1f, wallH, 0f - back));
			Box(new Vector3(halfW, 0f, 0f - back), new Vector3(halfW + 1f, wallH, front));
			Box(new Vector3(0f - halfW - 1f, 0f, 0f - back), new Vector3(0f - halfW, wallH, front));
		}

		public void Box(Vector3 min, Vector3 max)
		{
			//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_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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Vector3 size = max - min;
			Vector3 val = (min + max) * 0.5f;
			Piece(val, Quaternion.identity, size, val);
		}

		public void Sign(Vector3 center, Vector2 size, Texture2D tex)
		{
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0079: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			if (!((Object)(object)tex == (Object)null) && !((Object)(object)Root == (Object)null))
			{
				GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
				Collider component = val.GetComponent<Collider>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
				((Object)val).name = "ST_Sign";
				val.transform.SetParent(Root.transform, false);
				val.transform.localPosition = center;
				val.transform.localRotation = Quaternion.identity;
				val.transform.localScale = new Vector3(size.x, size.y, 1f);
				val.layer = layer;
				try
				{
					val.tag = tag;
				}
				catch
				{
				}
				Shader val2 = Looks.Plain();
				Material val3 = (((Object)(object)val2 != (Object)null) ? new Material(val2) : new Material(Shader.Find("Sprites/Default")));
				((Object)val3).name = "ST_Sign";
				val3.mainTexture = (Texture)(object)tex;
				if (val3.HasProperty("_Glossiness"))
				{
					val3.SetFloat("_Glossiness", 0.08f);
				}
				if (val3.HasProperty("_Metallic"))
				{
					val3.SetFloat("_Metallic", 0f);
				}
				signMats.Add(val3);
				MeshRenderer component2 = val.GetComponent<MeshRenderer>();
				((Renderer)component2).sharedMaterial = val3;
				((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
			}
		}

		public void DarkColumn(Vector3 center, float r, float y0, float y1, int sides = 64)
		{
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00a7: 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_00ca: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Expected O, but got Unknown
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: 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_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Root == (Object)null)
			{
				return;
			}
			List<Vector3> list = new List<Vector3>();
			List<Vector3> list2 = new List<Vector3>();
			List<Vector2> list3 = new List<Vector2>();
			List<int> list4 = new List<int>();
			List<int> list5 = new List<int>();
			float num = (float)Math.PI * 2f * r;
			Vector3 item = default(Vector3);
			for (int i = 0; i <= sides; i++)
			{
				float num2 = (float)i / (float)sides * (float)Math.PI * 2f;
				float num3 = Mathf.Cos(num2);
				float num4 = Mathf.Sin(num2);
				((Vector3)(ref item))..ctor(num3, 0f, num4);
				list.Add(new Vector3(center.x + num3 * r, y0, center.z + num4 * r));
				list2.Add(item);
				list3.Add(new Vector2(num * (float)i / (float)sides, y0));
				list.Add(new Vector3(center.x + num3 * r, y1, center.z + num4 * r));
				list2.Add(item);
				list3.Add(new Vector2(num * (float)i / (float)sides, y1));
			}
			for (int j = 0; j < sides; j++)
			{
				int num5 = j * 2;
				int item2 = num5 + 1;
				int item3 = num5 + 2;
				int item4 = num5 + 3;
				list5.Add(num5);
				list5.Add(item2);
				list5.Add(item4);
				list5.Add(num5);
				list5.Add(item4);
				list5.Add(item3);
			}
			bool[] array = new bool[2] { true, false };
			foreach (bool flag in array)
			{
				float num6 = (flag ? y1 : y0);
				int count = list.Count;
				list.Add(new Vector3(center.x, num6, center.z));
				list2.Add(flag ? Vector3.up : Vector3.down);
				list3.Add(new Vector2(center.x, center.z));
				for (int l = 0; l < sides; l++)
				{
					float num7 = (float)l / (float)sides * (float)Math.PI * 2f;
					list.Add(new Vector3(center.x + Mathf.Cos(num7) * r, num6, center.z + Mathf.Sin(num7) * r));
					list2.Add(flag ? Vector3.up : Vector3.down);
					list3.Add(new Vector2(center.x + Mathf.Cos(num7) * r, center.z + Mathf.Sin(num7) * r));
				}
				for (int m = 0; m < sides; m++)
				{
					int item5 = count + 1 + m;
					int item6 = count + 1 + (m + 1) % sides;
					if (flag)
					{
						list4.Add(count);
						list4.Add(item6);
						list4.Add(item5);
					}
					else
					{
						list4.Add(count);
						list4.Add(item5);
						list4.Add(item6);
					}
				}
			}
			Mesh val = new Mesh
			{
				name = "ST_RoundColumn",
				subMeshCount = 2
			};
			val.SetVertices(list);
			val.SetNormals(list2);
			val.SetUVs(0, list3);
			val.SetTriangles(list4, 0);
			val.SetTriangles(list5, 1);
			val.RecalculateBounds();
			meshes.Add(val);
			GameObject val2 = new GameObject("ST_Column");
			val2.transform.SetParent(Root.transform, false);
			val2.layer = layer;
			try
			{
				val2.tag = tag;
			}
			catch
			{
			}
			val2.AddComponent<MeshFilter>().sharedMesh = val;
			MeshCollider obj2 = val2.AddComponent<MeshCollider>();
			obj2.sharedMesh = val;
			obj2.convex = true;
			Bounds bounds = val.bounds;
			Vector3 center2 = ((Bounds)(ref bounds)).center;
			Quaternion identity = Quaternion.identity;
			bounds = val.bounds;
			Grow(center2, identity, ((Bounds)(ref bounds)).size);
			MeshRenderer item7 = val2.AddComponent<MeshRenderer>();
			renderers.Add(item7);
			shaded.Add(item7);
		}

		public void DarkBox(Vector3 min, Vector3 max)
		{
			//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_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_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Vector3 size = max - min;
			Vector3 val = (min + max) * 0.5f;
			MeshRenderer component = Piece(val, Quaternion.identity, size, val).GetComponent<MeshRenderer>();
			if ((Object)(object)component != (Object)null)
			{
				shaded.Add(component);
			}
		}

		public void Ramp(Vector3 from, Vector3 to, float width, float thick = 0.6f)
		{
			//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_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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = to - from;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (!(magnitude < 0.01f))
			{
				Quaternion val2 = Quaternion.LookRotation(val / magnitude, Vector3.up);
				Vector3 center = (from + to) * 0.5f - val2 * Vector3.up * (thick * 0.5f);
				Piece(center, val2, new Vector3(width, thick, magnitude), Vector3.zero);
			}
		}

		public void Hill(Vector3 center, float rx, float rz, float h)
		{
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_0196: Expected O, but got Unknown
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[841];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			Vector3 val = default(Vector3);
			for (int i = 0; i <= 28; i++)
			{
				for (int j = 0; j <= 28; j++)
				{
					float num = (float)j / 28f * 2f - 1f;
					float num2 = (float)i / 28f * 2f - 1f;
					float num3 = Mathf.Min(1f, Mathf.Sqrt(num * num + num2 * num2));
					float num4 = h * 0.5f * (1f + Mathf.Cos(num3 * (float)Math.PI)) - 0.04f;
					((Vector3)(ref val))..ctor(num * rx, num4, num2 * rz);
					array[i * 29 + j] = val;
					array2[i * 29 + j] = new Vector2(center.x + val.x, center.z + val.z);
				}
			}
			int[] array3 = new int[4704];
			int num5 = 0;
			for (int k = 0; k < 28; k++)
			{
				for (int l = 0; l < 28; l++)
				{
					int num6 = k * 29 + l;
					int num7 = num6 + 1;
					int num8 = num6 + 28 + 1;
					int num9 = num8 + 1;
					array3[num5++] = num6;
					array3[num5++] = num8;
					array3[num5++] = num7;
					array3[num5++] = num7;
					array3[num5++] = num8;
					array3[num5++] = num9;
				}
			}
			Mesh val2 = new Mesh
			{
				name = "ST_Hill"
			};
			val2.vertices = array;
			val2.uv = array2;
			val2.subMeshCount = 2;
			val2.SetTriangles(array3, 0);
			val2.SetTriangles(new int[0], 1);
			val2.RecalculateNormals();
			val2.RecalculateBounds();
			val2.RecalculateTangents();
			meshes.Add(val2);
			GameObject val3 = new GameObject("ST_Hill");
			val3.transform.SetParent(Root.transform, false);
			val3.transform.localPosition = center;
			val3.layer = layer;
			try
			{
				val3.tag = tag;
			}
			catch
			{
			}
			val3.AddComponent<MeshFilter>().sharedMesh = val2;
			renderers.Add(val3.AddComponent<MeshRenderer>());
			val3.AddComponent<MeshCollider>().sharedMesh = val2;
			Grow(center + new Vector3(0f, h * 0.5f, 0f), Quaternion.identity, new Vector3(rx * 2f, h, rz * 2f));
		}

		public void Terrain(float x0, float x1, float z0, float z1, float step, Func<float, float, float> height)
		{
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Max(1, Mathf.CeilToInt((x1 - x0) / step));
			int num2 = Mathf.Max(1, Mathf.CeilToInt((z1 - z0) / step));
			Vector3[] array = (Vector3[])(object)new Vector3[(num + 1) * (num2 + 1)];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			float num3 = 0f;
			for (int i = 0; i <= num2; i++)
			{
				for (int j = 0; j <= num; j++)
				{
					float num4 = Mathf.Lerp(x0, x1, (float)j / (float)num);
					float num5 = Mathf.Lerp(z0, z1, (float)i / (float)num2);
					float num6 = height(num4, num5);
					if (num6 > num3)
					{
						num3 = num6;
					}
					array[i * (num + 1) + j] = new Vector3(num4, num6, num5);
					array2[i * (num + 1) + j] = new Vector2(num4, num5);
				}
			}
			int[] array3 = new int[num * num2 * 6];
			int num7 = 0;
			for (int k = 0; k < num2; k++)
			{
				for (int l = 0; l < num; l++)
				{
					int num8 = k * (num + 1) + l;
					int num9 = num8 + 1;
					int num10 = num8 + num + 1;
					int num11 = num10 + 1;
					array3[num7++] = num8;
					array3[num7++] = num10;
					array3[num7++] = num9;
					array3[num7++] = num9;
					array3[num7++] = num10;
					array3[num7++] = num11;
				}
			}
			Mesh val = new Mesh
			{
				name = "ST_Terrain"
			};
			val.vertices = array;
			val.uv = array2;
			val.subMeshCount = 2;
			val.SetTriangles(array3, 0);
			val.SetTriangles(new int[0], 1);
			val.RecalculateNormals();
			val.RecalculateBounds();
			val.RecalculateTangents();
			meshes.Add(val);
			GameObject val2 = new GameObject("ST_Terrain");
			val2.transform.SetParent(Root.transform, false);
			val2.layer = layer;
			try
			{
				val2.tag = tag;
			}
			catch
			{
			}
			val2.AddComponent<MeshFilter>().sharedMesh = val;
			renderers.Add(val2.AddComponent<MeshRenderer>());
			val2.AddComponent<MeshCollider>().sharedMesh = val;
			Grow(new Vector3((x0 + x1) * 0.5f, num3 * 0.5f, (z0 + z1) * 0.5f), Quaternion.identity, new Vector3(x1 - x0, num3, z1 - z0));
		}

		private GameObject Piece(Vector3 center, Quaternion rot, Vector3 size, Vector3 uvOffset)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0028: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ST_Box");
			val.transform.SetParent(Root.transform, false);
			val.transform.localPosition = center;
			val.transform.localRotation = rot;
			val.layer = layer;
			try
			{
				val.tag = tag;
			}
			catch
			{
			}
			Mesh val2 = BoxMesh(size, uvOffset);
			meshes.Add(val2);
			val.AddComponent<MeshFilter>().sharedMesh = val2;
			MeshRenderer item = val.AddComponent<MeshRenderer>();
			renderers.Add(item);
			val.AddComponent<BoxCollider>().size = size;
			Grow(center, rot, size);
			return val;
		}

		public GameObject Panel(Vector3 min, Vector3 max)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return Loose(min, max, null);
		}

		private void Grow(Vector3 center, Quaternion rot, 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0036: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = size * 0.5f;
			for (int i = 0; i < 8; i++)
			{
				Vector3 val2 = center + rot * new Vector3(((i & 1) == 0) ? (0f - val.x) : val.x, ((i & 2) == 0) ? (0f - val.y) : val.y, ((i & 4) == 0) ? (0f - val.z) : val.z);
				if (!hasExtent)
				{
					Extent = new Bounds(val2, Vector3.zero);
					hasExtent = true;
				}
				else
				{
					((Bounds)(ref Extent)).Encapsulate(val2);
				}
			}
		}

		public void Invisible(Vector3 min, Vector3 max)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ST_Ghost");
			val.transform.SetParent(Root.transform, false);
			val.transform.localPosition = (min + max) * 0.5f;
			val.layer = layer;
			try
			{
				val.tag = tag;
			}
			catch
			{
			}
			val.AddComponent<BoxCollider>().size = max - min;
		}

		public void End(bool light = true)
		{
			//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_0045: 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_008b: Unknown result type (might be due to invalid IL or missing references)
			if (!light)
			{
				if ((Object)(object)Floor != (Object)null)
				{
					SetMaterials(Floor, Wall);
				}
				return;
			}
			GameObject val = new GameObject("ST_Light");
			val.transform.SetParent(Root.transform, false);
			val.transform.rotation = Quaternion.Euler(58f, 35f, 0f);
			Light obj = val.AddComponent<Light>();
			obj.type = (LightType)1;
			obj.intensity = 0.75f;
			obj.color = new Color(1f, 0.98f, 0.94f);
			obj.shadows = (LightShadows)0;
			foreach (MeshRenderer renderer in renderers)
			{
				if (!((Object)(object)renderer == (Object)null))
				{
					((Renderer)renderer).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)renderer).receiveShadows = false;
					((Renderer)renderer).lightProbeUsage = (LightProbeUsage)0;
					((Renderer)renderer).reflectionProbeUsage = (ReflectionProbeUsage)0;
				}
			}
			Indoors.Set(this, roofed: true);
			if ((Object)(object)Floor != (Object)null)
			{
				SetMaterials(Floor, Wall);
			}
		}

		private static Mesh BoxMesh(Vector3 size, Vector3 uvOffset)
		{
			//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_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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: 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_033d: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00a9: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_013e: 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_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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: 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_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_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			List<Vector3> list2 = new List<Vector3>();
			List<Vector2> list3 = new List<Vector2>();
			List<int> list4 = new List<int>();
			List<int> list5 = new List<int>();
			Vector3 val = size * 0.5f;
			Vector3[] array = (Vector3[])(object)new Vector3[6]
			{
				Vector3.up,
				Vector3.down,
				Vector3.right,
				Vector3.left,
				Vector3.forward,
				Vector3.back
			};
			foreach (Vector3 val2 in array)
			{
				Vector3 val3;
				Vector3 val4;
				if (Mathf.Abs(val2.y) > 0.5f)
				{
					val3 = Vector3.right;
					val4 = Vector3.forward;
				}
				else if (Mathf.Abs(val2.x) > 0.5f)
				{
					val3 = Vector3.forward;
					val4 = Vector3.up;
				}
				else
				{
					val3 = Vector3.right;
					val4 = Vector3.up;
				}
				Vector3 val5 = Vector3.Scale(val2, val);
				Vector3 val6 = Vector3.Scale(val3, val);
				Vector3 val7 = Vector3.Scale(val4, val);
				Vector3[] array2 = (Vector3[])(object)new Vector3[4]
				{
					val5 - val6 - val7,
					val5 - val6 + val7,
					val5 + val6 + val7,
					val5 + val6 - val7
				};
				int count = list.Count;
				Vector3[] array3 = array2;
				foreach (Vector3 val8 in array3)
				{
					list.Add(val8);
					list2.Add(val2);
					Vector3 val9 = val8 + uvOffset;
					if (Mathf.Abs(val2.y) > 0.5f)
					{
						list3.Add(new Vector2(val9.x, val9.z));
					}
					else if (Mathf.Abs(val2.x) > 0.5f)
					{
						list3.Add(new Vector2(val9.z, val9.y));
					}
					else
					{
						list3.Add(new Vector2(val9.x, val9.y));
					}
				}
				List<int> list6 = ((val2.y > 0.5f) ? list4 : list5);
				if (Vector3.Dot(Vector3.Cross(array2[1] - array2[0], array2[2] - array2[0]), val2) > 0f)
				{
					list6.AddRange(new int[6]
					{
						count,
						count + 1,
						count + 2,
						count,
						count + 2,
						count + 3
					});
				}
				else
				{
					list6.AddRange(new int[6]
					{
						count,
						count + 2,
						count + 1,
						count,
						count + 3,
						count + 2
					});
				}
			}
			Mesh val10 = new Mesh
			{
				name = "AT_Box"
			};
			val10.SetVertices(list);
			val10.SetNormals(list2);
			val10.SetUVs(0, list3);
			val10.subMeshCount = 2;
			val10.SetTriangles(list4, 0);
			val10.SetTriangles(list5, 1);
			val10.RecalculateBounds();
			val10.RecalculateTangents();
			return val10;
		}

		public void SetMaterials(Material floor, Material wall)
		{
			//IL_00a9: 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_00c9: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Floor != (Object)null && (Object)(object)Floor != (Object)(object)floor)
			{
				Looks.Free(Floor);
			}
			if ((Object)(object)Wall != (Object)null && (Object)(object)Wall != (Object)(object)wall)
			{
				Looks.Free(Wall);
			}
			Floor = floor;
			Wall = wall;
			Material[] array = (Material[])(object)new Material[2] { floor, wall };
			if ((Object)(object)shadedWall != (Object)null)
			{
				Object.Destroy((Object)(object)shadedWall);
				shadedWall = null;
			}
			Material[] array2 = null;
			if (shaded.Count > 0 && (Object)(object)wall != (Object)null)
			{
				shadedWall = new Material(wall)
				{
					name = ((Object)wall).name + " (shaded)"
				};
				if (shadedWall.HasProperty("_Color"))
				{
					shadedWall.color *= new Color(0.6f, 0.6f, 0.6f, 1f);
				}
				array2 = (Material[])(object)new Material[2] { floor, shadedWall };
			}
			foreach (MeshRenderer renderer in renderers)
			{
				if ((Object)(object)renderer != (Object)null)
				{
					((Renderer)renderer).sharedMaterials = ((array2 != null && shaded.Contains(renderer)) ? array2 : array);
				}
			}
		}

		public void ApplyLook()
		{
			try
			{
				SetMaterials(Looks.Make(Cfg.Floor), Looks.Make(Cfg.Wall));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Arena look failed: " + ex.Message));
			}
		}

		public bool Owns(Collider c)
		{
			if ((Object)(object)c != (Object)null && (Object)(object)Root != (Object)null)
			{
				return ((Component)c).transform.IsChildOf(Root.transform);
			}
			return false;
		}

		public Vector3 World(Vector3 local)
		{
			//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_0007: Unknown result type (might be due to invalid IL or missing references)
			return Origin + local;
		}

		public Vector3 Local(Vector3 world)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return world - Origin;
		}

		public Vector3 Ground(float lx, float lz)
		{
			//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)
			//IL_0020: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = World(new Vector3(lx, 30f, lz));
			float num = float.MaxValue;
			Vector3 result = World(new Vector3(lx, 0f, lz));
			RaycastHit[] array = Physics.RaycastAll(val, Vector3.down, 60f, -1, (QueryTriggerInteraction)1);
			for (int i = 0; i < array.Length; i++)
			{
				RaycastHit val2 = array[i];
				if (Owns(((RaycastHit)(ref val2)).collider) && ((RaycastHit)(ref val2)).distance < num)
				{
					num = ((RaycastHit)(ref val2)).distance;
					result = ((RaycastHit)(ref val2)).point;
				}
			}
			return result;
		}

		private void Clear()
		{
			Indoors.Set(this, roofed: false);
			Movers.Clear();
			renderers.Clear();
			shaded.Clear();
			if ((Object)(object)shadedWall != (Object)null)
			{
				Object.Destroy((Object)(object)shadedWall);
				shadedWall = null;
			}
			foreach (Material signMat in signMats)
			{
				if ((Object)(object)signMat != (Object)null)
				{
					Object.Destroy((Object)(object)signMat);
				}
			}
			signMats.Clear();
			foreach (Mesh mesh in meshes)
			{
				if ((Object)(object)mesh != (Object)null)
				{
					Object.Destroy((Object)(object)mesh);
				}
			}
			meshes.Clear();
			if ((Object)(object)Root != (Object)null)
			{
				Object.Destroy((Object)(object)Root);
			}
			Root = null;
		}

		public void Destroy()
		{
			live.Remove(this);
			Clear();
			Looks.Free(Floor);
			Looks.Free(Wall);
			Floor = (Wall = null);
		}

		private GameObject Loose(Vector3 min, Vector3 max, string name)
		{
			//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)
			//IL_000e: 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)
			//IL_0010: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			bool flag = hasExtent;
			Bounds extent = Extent;
			Vector3 val = (min + max) * 0.5f;
			GameObject val2 = Piece(val, Quaternion.identity, max - min, val);
			Extent = extent;
			hasExtent = flag;
			if (name != null)
			{
				((Object)val2).name = name;
			}
			return val2;
		}

		public void Mover(Vector3 min, Vector3 max, Func<double, Vector3> at)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//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)
			GameObject val = Loose(min, max, "ST_Mover");
			Movers.Add(new MovingPart
			{
				T = val.transform,
				C = val.GetComponent<Collider>(),
				Home = (min + max) * 0.5f,
				At = at
			});
		}

		public MeshRenderer Plate(Vector3 min, Vector3 max)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = Loose(min, max, "ST_Plate").GetComponent<MeshRenderer>();
			renderers.Remove(component);
			return component;
		}

		public MeshRenderer Part(Vector3 center, Quaternion rot, Vector3 size)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = Piece(center, rot, size, center).GetComponent<MeshRenderer>();
			renderers.Remove(component);
			return component;
		}

		public MeshRenderer Prism(Vector3 a, Vector3 b, Vector3 c, Vector3 depth)
		{
			//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_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0036: 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_0041: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0087: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_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_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_0140: 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_0152: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			Vector3 val = a + depth;
			Vector3 val2 = b + depth;
			Vector3 val3 = c + depth;
			Vector3 mid = (a + b + c + val + val2 + val3) / 6f;
			List<Vector3> v = new List<Vector3>();
			List<Vector2> uv = new List<Vector2>();
			List<int> tris = new List<int>();
			Face((Vector3[])(object)new Vector3[3] { a, b, c });
			Face((Vector3[])(object)new Vector3[3] { val, val2, val3 });
			Face((Vector3[])(object)new Vector3[4] { a, b, val2, val });
			Face((Vector3[])(object)new Vector3[4] { b, c, val3, val2 });
			Face((Vector3[])(object)new Vector3[4] { c, a, val, val3 });
			Mesh val4 = new Mesh
			{
				name = "AT_Prism"
			};
			val4.SetVertices(v);
			val4.SetUVs(0, uv);
			val4.SetTriangles(tris, 0);
			val4.RecalculateNormals();
			val4.RecalculateBounds();
			meshes.Add(val4);
			GameObject val5 = new GameObject("ST_Prism");
			val5.transform.SetParent(Root.transform, false);
			val5.layer = layer;
			try
			{
				val5.tag = tag;
			}
			catch
			{
			}
			val5.AddComponent<MeshFilter>().sharedMesh = val4;
			MeshCollider obj2 = val5.AddComponent<MeshCollider>();
			obj2.sharedMesh = val4;
			obj2.convex = true;
			return val5.AddComponent<MeshRenderer>();
			void Face(Vector3[] q)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: 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_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_0046: 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_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: 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_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
				int count = v.Count;
				v.AddRange(q);
				Vector3 val6 = Vector3.Cross(q[1] - q[0], q[2] - q[0]);
				Vector3 val7 = default(Vector3);
				((Vector3)(ref val7))..ctor(Mathf.Abs(val6.x), Mathf.Abs(val6.y), Mathf.Abs(val6.z));
				foreach (Vector3 val8 in q)
				{
					if (val7.y >= val7.x && val7.y >= val7.z)
					{
						uv.Add(new Vector2(val8.x, val8.z));
					}
					else if (val7.x >= val7.z)
					{
						uv.Add(new Vector2(val8.z, val8.y));
					}
					else
					{
						uv.Add(new Vector2(val8.x, val8.y));
					}
				}
				bool flag = Vector3.Dot(val6, q[0] - mid) > 0f;
				for (int j = 1; j + 1 < q.Length; j++)
				{
					if (flag)
					{
						tris.AddRange(new int[3]
						{
							count,
							count + j,
							count + j + 1
						});
					}
					else
					{
						tris.AddRange(new int[3]
						{
							count,
							count + j + 1,
							count + j
						});
					}
				}
			}
		}

		public void Own(Mesh m)
		{
			if ((Object)(object)m != (Object)null)
			{
				meshes.Add(m);
			}
		}

		public void HiddenRamp(Vector3 from, Vector3 to, float width, float thick = 0.3f)
		{
			//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_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_001b: 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_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)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0055: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = to - from;
			float magnitude = ((Vector3)(ref val)).magnitude;
			if (!(magnitude < 0.01f))
			{
				Quaternion val2 = Quaternion.LookRotation(val / magnitude, Vector3.up);
				GameObject val3 = new GameObject("ST_Slope");
				val3.transform.SetParent(Root.transform, false);
				val3.transform.localPosition = (from + to) * 0.5f - val2 * Vector3.up * (thick * 0.5f);
				val3.transform.localRotation = val2;
				val3.layer = layer;
				try
				{
					val3.tag = tag;
				}
				catch
				{
				}
				val3.AddComponent<BoxCollider>().size = new Vector3(width, thick, magnitude);
			}
		}

		public MeshRenderer Column(Vector2[] ring, float y0, float y1)
		{
			//IL_0026: 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_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: 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_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: 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_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_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_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Expected O, but got Unknown
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			List<Vector3> v = new List<Vector3>();
			List<Vector2> uv = new List<Vector2>();
			List<int> list = new List<int>();
			List<int> list2 = new List<int>();
			Vector3 mid = Vector3.zero;
			foreach (Vector2 val in ring)
			{
				mid += new Vector3(val.x, (y0 + y1) * 0.5f, val.y);
			}
			mid /= (float)ring.Length;
			int num = ring.Length;
			Vector3[] array = (Vector3[])(object)new Vector3[num];
			Vector3[] array2 = (Vector3[])(object)new Vector3[num];
			for (int j = 0; j < num; j++)
			{
				array[j] = new Vector3(ring[j].x, y1, ring[j].y);
				array2[j] = new Vector3(ring[j].x, y0, ring[j].y);
			}
			Face(list, array);
			Face(list, array2);
			for (int k = 0; k < num; k++)
			{
				int num2 = (k + 1) % num;
				Face(list2, (Vector3[])(object)new Vector3[4]
				{
					array2[k],
					array2[num2],
					array[num2],
					array[k]
				});
			}
			Mesh val2 = new Mesh
			{
				name = "AT_Column",
				subMeshCount = 2
			};
			val2.SetVertices(v);
			val2.SetUVs(0, uv);
			val2.SetTriangles(list, 0);
			val2.SetTriangles(list2, 1);
			val2.RecalculateNormals();
			val2.RecalculateBounds();
			meshes.Add(val2);
			GameObject val3 = new GameObject("ST_Column");
			val3.transform.SetParent(Root.transform, false);
			val3.layer = layer;
			try
			{
				val3.tag = tag;
			}
			catch
			{
			}
			val3.AddComponent<MeshFilter>().sharedMesh = val2;
			MeshCollider obj2 = val3.AddComponent<MeshCollider>();
			obj2.sharedMesh = val2;
			obj2.convex = true;
			Bounds bounds = val2.bounds;
			Grow(((Bounds)(ref bounds)).center, Quaternion.identity, ((Bounds)(ref bounds)).size);
			return val3.AddComponent<MeshRenderer>();
			void Face(List<int> tris, Vector3[] q)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: 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_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_0046: 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_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: 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_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
				int count = v.Count;
				v.AddRange(q);
				Vector3 val4 = Vector3.Cross(q[1] - q[0], q[2] - q[0]);
				Vector3 val5 = default(Vector3);
				((Vector3)(ref val5))..ctor(Mathf.Abs(val4.x), Mathf.Abs(val4.y), Mathf.Abs(val4.z));
				foreach (Vector3 val6 in q)
				{
					if (val5.y >= val5.x && val5.y >= val5.z)
					{
						uv.Add(new Vector2(val6.x, val6.z));
					}
					else if (val5.x >= val5.z)
					{
						uv.Add(new Vector2(val6.z, val6.y));
					}
					else
					{
						uv.Add(new Vector2(val6.x, val6.y));
					}
				}
				bool flag = Vector3.Dot(val4, q[0] - mid) > 0f;
				for (int m = 1; m + 1 < q.Length; m++)
				{
					if (flag)
					{
						tris.AddRange(new int[3]
						{
							count,
							count + m,
							count + m + 1
						});
					}
					else
					{
						tris.AddRange(new int[3]
						{
							count,
							count + m + 1,
							count + m
						});
					}
				}
			}
		}
	}
	internal static class Cfg
	{
		public static ConfigEntry<KeyboardShortcut> RestartKey;

		public static ConfigEntry<ScenarioId> Scenario;

		public static ConfigEntry<bool> InstagibBounce;

		public static ConfigEntry<bool> Outlines;

		public static ConfigEntry<bool> Viewmodel;

		public static ConfigEntry<bool> Trails;

		public static ConfigEntry<bool> Hitmarker;

		public static ConfigEntry<bool> BloodSparks;

		public static ConfigEntry<bool> StatsHud;

		public static ConfigEntry<bool> PbBar;

		public static ConfigEntry<int> Countdown;

		public static ConfigEntry<bool> CountdownHundredths;

		public static ConfigEntry<float> Volume;

		public static ConfigEntry<float> GunVolume;

		public static ConfigEntry<string> BotSuit;

		public static ConfigEntry<string> BotHat;

		public static ConfigEntry<string> Sky;

		public static ConfigEntry<string> HitSound;

		public static ConfigEntry<string> HeadSound;

		public static ConfigEntry<string> KillSound;

		public static ConfigEntry<string> Event;

		public static ConfigEntry<string> InstagibMap;

		public static ConfigEntry<string> SmashMap;

		public static ConfigEntry<KeyboardShortcut>[] SmashKeys;

		public static ConfigEntry<int> InstagibMinutes;

		public static ConfigEntry<int> InstagibFrags;

		public static ConfigEntry<int> DuelRounds;

		public static ConfigEntry<bool> SmashTeams;

		public static ConfigEntry<bool> ShareScores;

		public static ConfigEntry<string> MenuColor;

		public static ConfigEntry<string> MenuBackground;

		public static ConfigEntry<string> HudColor;

		public static ConfigEntry<string> HudBackground;

		public static ConfigEntry<string> PbOnPace;

		public static ConfigEntry<string> PbBehind;

		public static Surface Floor;

		public static Surface Wall;

		public static ConfigEntry<float> AnnouncerVolume;

		public static ConfigEntry<bool> WelcomeVoice;

		public static ConfigEntry<string> FirstOn;

		public static ConfigEntry<string> PadColor;

		public static ConfigEntry<int> LgRounds;

		public static ConfigEntry<bool> HitNumbers;

		public static ConfigEntry<bool> SmashDetailed;

		public static ConfigEntry<KeyboardShortcut>[] GunGameKeys;

		public static ConfigEntry<bool> GunGameDemotion;

		public static ConfigEntry<string> GunGameGuns;

		public static ConfigEntry<string> GunGameMap;

		public static int CountdownSeconds => Mathf.Clamp(Countdown.Value, 0, 3);

		public static void Bind(ConfigFile c)
		{
			//IL_0015: 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_00a1: Expected O, but got Unknown
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Expected O, but got Unknown
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Expected O, but got Unknown
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Expected O, but got Unknown
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_0673: Expected O, but got Unknown
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a2: Expected O, but got Unknown
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0777: Unknown result type (might be due to invalid IL or missing references)
			RestartKey = c.Bind<KeyboardShortcut>("Keys", "Restart", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Starts the selected scenario again.");
			Outlines = c.Bind<bool>("Settings", "Outlines", true, "Red outline on targets.");
			Viewmodel = c.Bind<bool>("Settings", "Viewmodel", true, "Show your gun in the arena. The Smith and M2000 always show.");
			Trails = c.Bind<bool>("Settings", "Bullet trails", true, "Show your bullet trails in the arena, faded. Other players' trails always show.");
			Countdown = c.Bind<int>("Settings", "Countdown", 3, new ConfigDescription("Seconds of countdown before a run starts, 1 to 3, or 0 to start right away.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			CountdownHundredths = c.Bind<bool>("Settings", "Detailed countdown", false, "Show the countdown with hundredths (\"2.47\") instead of whole seconds, in the aim trainer and the route trainer.");
			ConfigEntry<bool> val = c.Bind<bool>("Settings", "Skip countdown", false, "Replaced by Countdown, leave it.");
			if (val.Value)
			{
				Countdown.Value = 0;
				val.Value = false;
			}
			StatsHud = c.Bind<bool>("Settings", "Stats hud", true, "Time, score and accuracy at the top while you play.");
			PbBar = c.Bind<bool>("Settings", "Pb bar", true, "A bar under the stats that fills up to your best score on the scenario while you play.");
			Hitmarker = c.Bind<bool>("Settings", "Hitmarker", true, "Show the hitmarker when you hit.");
			BloodSparks = c.Bind<bool>("Settings", "Blood sparks", true, "Small sparks on body and head hits. Off means no blood at all.");
			Volume = c.Bind<float>("Audio", "Hit volume", 1f, new ConfigDescription("Volume of the hit and kill sounds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			AnnouncerVolume = c.Bind<float>("Audio", "Announcer level", 1f, new ConfigDescription("Volume of the announcer, the voice that calls out the big moments in multiplayer. 0 turns it off.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			WelcomeVoice = c.Bind<bool>("Audio", "Welcome voice", true, "Says welcome to STRAFTH the first time you open the menu after starting the game. Plays at the announcer volume.");
			FirstOn = c.Bind<string>("Leaderboard", "First place on", "", "Scenarios you hold first place on, kept by STRAFTH so \"new record!\" only plays when you take it. Leave it.");
			GunVolume = c.Bind<float>("Audio", "Gun volume", 1f, new ConfigDescription("Volume of the guns in the arena, yours and the other players'.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			PadColor = c.Bind<string>("Settings", "Jump pad color", "B5F7B7", "Hex color of the jump pads in the multiplayer arenas.");
			ShareScores = c.Bind<bool>("Settings", "Share scores", true, "Post your finished aim trainer runs to the leaderboard on strafth.com, under your Steam name.");
			MenuColor = c.Bind<string>("Settings", "Menu color", "B5F7B7", "The text color of the STRAFTH menu, as hex. Easier to pick in the menu.");
			MenuBackground = c.Bind<string>("Settings", "Menu background", "151610", "The background color of the STRAFTH menu, as hex. Easier to pick in the menu.");
			HudColor = c.Bind<string>("Settings", "Hud color", "", "The text color of the STRAFTH hud, as hex. Empty: the same as the menu. Easier to pick in the menu.");
			HudBackground = c.Bind<string>("Settings", "Hud background", "", "The background color of the STRAFTH hud, as hex. Empty: the same as the menu. Easier to pick in the menu.");
			PbOnPace = c.Bind<string>("Settings", "Pb bar on pace", "33F233", "The pb bar's color while you're on pace for your best score, as hex. Easier to pick in the menu.");
			PbBehind = c.Bind<string>("Settings", "Pb bar behind", "F24040", "The pb bar's color while you're behind your best score, as hex. Easier to pick in the menu.");
			Theme.Apply();
			Scenario = c.Bind<ScenarioId>("Settings", "Last scenario", ScenarioId.GroundClicking, "The scenario the restart key runs.");
			Floor = new Surface(c, "Floor", "Grid Dark");
			Wall = new Surface(c, "Wall", "Grid Light");
			BotSuit = c.Bind<string>("Bots", "Outfit", "default", "default, random or an outfit name. Easier to pick in the menu.");
			BotHat = c.Bind<string>("Bots", "Hat", "default", "default, random or a hat name. Easier to pick in the menu.");
			Sky = c.Bind<string>("Arena", "Sky", "clear day", "Pick it in the menu.");
			if (Sky.Value == "map default" || Sky.Value == "void")
			{
				Sky.Value = ((Sky.Value == "void") ? "blackout" : "clear day");
			}
			HitSound = c.Bind<string>("Audio", "Hit sound", "default", "default (the game's own), wood knock, soft tap, rim, thud, click, pop, tink, thock or keycap.");
			HeadSound = c.Bind<string>("Audio", "Head hit sound", "default", "default (the game's own), hollow block, bamboo, tom, rimshot, low bell, ding, chime, crack or marble.");
			KillSound = c.Bind<string>("Audio", "Kill sound", "default", "default (the game's own), soft tom, deep kick, double clack, bass drop, brush, rise, punch, bell or vice.");
			ConfigEntry<bool> val2 = c.Bind<bool>("Audio", "Game sounds by default", false, "Set once by STRAFTH, leave it.");
			if (!val2.Value)
			{
				if (HitSound.Value == "wood knock")
				{
					HitSound.Value = "default";
				}
				if (HeadSound.Value == "hollow block")
				{
					HeadSound.Value = "default";
				}
				if (KillSound.Value == "soft tom")
				{
					KillSound.Value = "default";
				}
				val2.Value = true;
			}
			Event = c.Bind<string>("Multiplayer", "Vamp 1v1 events", "random", "random, or one event for the whole match. Easier to pick in the menu.");
			InstagibMap = c.Bind<string>("Multiplayer", "Instagib map", "crossfire", "crossfire, citadel, quarry, atrium, bastion or canyon. Easier to pick in the menu.");
			SmashMap = c.Bind<string>("Multiplayer", "Smash map", "apex", "apex, foundry, spire, skyline, strata, orbit, cascade, scaffold, bastion, drift, clockwork or galleon. Easier to pick in the menu.");
			InstagibBounce = c.Bind<bool>("Multiplayer", "Instagib bounce", false, "Instagib's mode: off is normal, on is bounce (right click fires a rocket that only launches you).");
			InstagibMinutes = c.Bind<int>("Multiplayer", "Instagib time limit", 10, new ConfigDescription("Minutes, 5 to 30, or 0 for no time limit.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 30), Array.Empty<object>()));
			HitNumbers = c.Bind<bool>("Smash", "Knockback numbers", true, "Show how hard your hits launch, as numbers coming off the players you hit.");
			SmashDetailed = c.Bind<bool>("Smash", "Detailed scoreboard", false, "The smash scoreboard with hits, accuracy, percent dealt and knockouts per gun. Off: the simple one, lives, percent, knockouts and damage.");
			SmashTeams = c.Bind<bool>("Multiplayer", "Smash teams", false, "Smash in teams (the host picks them in the menu) instead of free for all.");
			DuelRounds = c.Bind<int>("Multiplayer", "Vamp 1v1 first to", 10, new ConfigDescription("Rounds to win, 10 to 30.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 30), Array.Empty<object>()));
			LgRounds = c.Bind<int>("Multiplayer", "Vamp LG 1v1 rounds to win", 5, new ConfigDescription("Rounds to win, 5 to 20.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(5, 20), Array.Empty<object>()));
			InstagibFrags = c.Bind<int>("Multiplayer", "Instagib frag limit", 30, new ConfigDescription("Kills to win, 20 to 50.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 50), Array.Empty<object>()));
			string[] array = new string[4] { "kusma", "smith", "shotgun", "rocket launcher" };
			SmashKeys = new ConfigEntry<KeyboardShortcut>[array.Length];
			for (int i = 0; i < array.Length; i++)
			{
				SmashKeys[i] = c.Bind<KeyboardShortcut>("Smash keys", "Slot " + (i + 1) + " " + array[i], new KeyboardShortcut((KeyCode)(49 + i), Array.Empty<KeyCode>()), "Takes out the " + array[i] + " in smash.");
			}
			GunGameKeys = new ConfigEntry<KeyboardShortcut>[2]
			{
				c.Bind<KeyboardShortcut>("Gun game keys", "Main weapon", new KeyboardShortcut((KeyCode)49, Array.Empty<KeyCode>()), "Takes out your gun in gun game (with melee demotion on)."),
				c.Bind<KeyboardShortcut>("Gun game keys", "Melee", new KeyboardShortcut((KeyCode)50, Array.Empty<KeyCode>()), "Takes out your stylus in gun game (with melee demotion on).")
			};
			GunGameDemotion = c.Bind<bool>("Multiplayer", "Gun game melee demotion", false, "Gun game: everyone also carries a stylus, and a kill with it sends the one you killed back a gun.");
			GunGameGuns = c.Bind<string>("Multiplayer", "Gun game guns", "classic", "The weapon set: classic, sharpshooter, spray and pray, heavy or comp. Easier to pick in the menu.");
			GunGameMap = c.Bind<string>("Multiplayer", "Gun game map", "nuketown", "Easier to pick in the menu.");
		}
	}
	internal sealed class Surface
	{
		public readonly string Fallback;

		public readonly ConfigEntry<string> Texture;

		public readonly ConfigEntry<string> Color;

		public readonly ConfigEntry<float> Scale;

		public readonly ConfigEntry<float> Brightness;

		public readonly ConfigEntry<float> Saturation;

		public Color Tint
		{
			get
			{
				//IL_0024: 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)
				Color result = default(Color);
				if (!ColorUtility.TryParseHtmlString("#" + Color.Value, ref result))
				{
					return Color.white;
				}
				return result;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Color.Value = ColorUtility.ToHtmlStringRGB(value);
			}
		}

		public Surface(ConfigFile c, string name, string fallback)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			Fallback = fallback;
			string text = "Arena " + name.ToLowerInvariant();
			Texture = c.Bind<string>(text, "Texture", fallback, "Pick it in the menu.");
			Color = c.Bind<string>(text, "Color", "FFFFFF", "Hex color the texture is multiplied by.");
			Scale = c.Bind<float>(text, "Scale", 4f, new ConfigDescription("Meters per texture repeat.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 16f), Array.Empty<object>()));
			Brightness = c.Bind<float>(text, "Brightness", 1f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 1.6f), Array.Empty<object>()));
			Saturation = c.Bind<float>(text, "Saturation", 1f, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
		}

		public void Reset()
		{
			Texture.Value = Fallback;
			Color.Value = "FFFFFF";
			Scale.Value = 4f;
			Brightness.Value = 1f;
			Saturation.Value = 1f;
		}
	}
	internal static class ArenaPatches
	{
		private static readonly Type T = typeof(ArenaPatches);

		private static readonly FieldInfo ExploreText = AccessTools.Field(typeof(SceneMotor), "explorationText");

		private static readonly List<Graphic> exploreHidden = new List<Graphic>();

		private static bool boxHud;

		private static bool exploreDone;

		private static GameObject exploreGo;

		private static GameObject tabStandIn;

		private static GameObject tabReal;

		private static GameObject tabSaved;

		private static bool capNoted;

		private static float arenaSince = -1f;

		private static int arenaFrames;

		private static bool fpsReported;

		private static float nextRocketNote;

		private static bool InArena
		{
			get
			{
				if (!Trainer.Active)
				{
					return DuelSession.Active;
				}
				return true;
			}
		}

		public static void Apply()
		{
			foreach (MethodInfo item in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name == "ShootServer" && Patcher.Takes(m, typeof(float), typeof(Vector3), typeof(Vector3))))
			{
				Patcher.Patch(item, T, "ShootPrefix", null);
			}
			foreach (MethodInfo item2 in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name.StartsWith("RpcLogic___ShootObserversEffect", StringComparison.Ordinal)))
			{
				Patcher.Patch(item2, T, "ShotEffectPrefix", null);
			}
			foreach (MethodInfo item3 in Patcher.Find((Type t, MethodInfo m) => m.Name == "KillServer" && Patcher.Takes(m, typeof(PlayerHealth))))
			{
				Patcher.Patch(item3, T, "KillPrefix", null);
			}
			foreach (MethodInfo item4 in Patcher.Find((Type t, MethodInfo m) => m.Name.StartsWith("RpcLogic___KillServer", StringComparison.Ordinal) && Patcher.Takes(m, typeof(PlayerHealth))))
			{
				Patcher.Patch(item4, T, "KillLogicPrefix", null);
			}
			foreach (MethodInfo item5 in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name.StartsWith("RpcLogic___GiveDamage", StringComparison.Ordinal) && Patcher.Takes(m, typeof(float), typeof(PlayerHealth))))
			{
				Patcher.Patch(item5, T, "DamagePrefix", null);
			}
			foreach (MethodInfo item6 in Patcher.Find((Type t, MethodInfo m) => t == typeof(PlayerHealth) && m.Name.StartsWith("RpcLogic___RemoveHealth", StringComparison.Ordinal) && Patcher.Takes(m, typeof(float))))
			{
				Patcher.Patch(item6, T, "RemoveHealthPrefix", null);
			}
			foreach (MethodInfo item7 in Patcher.Find((Type t, MethodInfo m) => t == typeof(PlayerHealth) && m.Name.StartsWith("RpcLogic___SetKiller", StringComparison.Ordinal) && Patcher.Takes(m, typeof(Transform))))
			{
				Patcher.Patch(item7, T, "SetKillerPrefix", null);
			}
			Patcher.Pre(typeof(PlayerHealth), "Explode", T, "ExplodePrefix");
			RealNames.Patch();
			Patcher.Pre(typeof(PlayerHealth), "DisablePlayerObjectWhenKilled", T, "DisablePrefix");
			Patcher.Pre(typeof(Weapon), "FriendlyFireCheck", T, "FriendlyFirePrefix");
			foreach (MethodInfo item8 in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name == "RemoveAmmo" && m.GetParameters().Length == 0))
			{
				Patcher.Patch(item8, T, "SkipForArenaGun", null);
			}
			string[] array = new string[3] { "CameraAnimation", "CameraRevolverAnimation", "AltCameraRevolverAnimation" };
			foreach (string method in array)
			{
				Patcher.Pre(typeof(Weapon), method, T, "SkipForTunedGun");
			}
			Patcher.Pre(typeof(ItemBehaviour), "Start", T, "ItemStartPrefix", "ItemStartPostfix");
			array = new string[5] { "IncreaseHeadshotsAmount", "IncreaseBodyshotsAmount", "IncreaseKillsAmount", "RecordAchievementKill", "RecordAchievementHat" };
			foreach (string method2 in array)
			{
				Patcher.Pre(typeof(Settings), method2, T, "SkipInArena");
			}
			Patcher.Pre(typeof(PlayerPickup), "HandleDrop", T, "SkipInArena");
			Patcher.Pre(typeof(PlayerPickup), "HandleInteraction", T, "SkipInArena");
			Patcher.Pre(typeof(PlayerHealth), "Update", T, "HealthUpdatePrefix");
			foreach (MethodInfo item9 in Patcher.Find((Type t, MethodInfo m) => typeof(Shotgun).IsAssignableFrom(t) && m.Name == "ShootServer" && Patcher.Takes(m, typeof(float), typeof(Vector3), typeof(Vector3))))
			{
				Patcher.Patch(item9, T, "PelletPrefix", null, 800);
			}
			foreach (MethodInfo item10 in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name == "GiveDamage" && Patcher.Takes(m, typeof(float), typeof(PlayerHealth), typeof(string))))
			{
				Patcher.Patch(item10, T, "GiveDamagePrefix", null, 800);
			}
			Patcher.Pre(typeof(PredictedProjectile), "HandleCollision", T, "ProjectilePrefix");
			Patcher.Post(typeof(PredictedProjectile), "Initialize", T, "ProjectileMadePostfix");
			Patcher.Pre(typeof(DualLauncher), "ServerFire", T, "LauncherFirePrefix");
			Patcher.Pre(typeof(DualLauncher), "Fire", T, "LauncherShotPrefix");
			foreach (MethodInfo item11 in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name.StartsWith("RpcLogic___SpawnBulletTrail_", StringComparison.Ordinal)))
			{
				Patcher.Patch(item11, typeof(Gear), "TrailPrefix", "TrailPostfix");
			}
			foreach (MethodInfo item12 in Patcher.Find((Type t, MethodInfo m) => IsWeapon(t) && m.Name.StartsWith("RpcLogic___SpawnVFX", StringComparison.Ordinal)))
			{
				Patcher.Patch(item12, T, "ImpactPrefix", null);
			}
			Patcher.Pre(typeof(BulletSound), "Start", T, "BulletSoundPrefix");
			Patcher.Pre(typeof(Suppression), "SuppressionTrigger", T, "WhizPrefix");
			Patcher.Pre(typeof(FirstPersonController), "HandleTaunt", T, "SkipTaunt");
			Patcher.Pre(typeof(FirstPersonController), "SetZoom", typeof(DuelSession), "ZoomPrefix");
			Patcher.Pre(typeof(FirstPersonController), "SetZoomToggle", typeof(DuelSession), "ZoomPrefix");
			Patcher.Pre(typeof(FirstPersonController), "AboubiPlayServer", T, "SkipTaunt");
			foreach (MethodInfo item13 in Patcher.Find((Type t, MethodInfo m) => t == typeof(FirstPersonController) && m.Name.StartsWith("RpcLogic___AboubiPlay", StringComparison.Ordinal)))
			{
				Patcher.Patch(item13, T, "SkipTaunt", null);
			}
			Patcher.Pre(typeof(EjectedCaseScript), "OnParticleCollision", T, "SkipInArena");
			Patcher.Post(typeof(EjectedCaseScript), "Awake", T, "CasingPostfix");
			Patcher.Post(typeof(SceneMotor), "Update", T, "SceneMotorPostfix");
			Patcher.Pre(typeof(PauseManager), "Update", T, "PausePrefix", "PausePostfix");
			Patcher.Pre(typeof(PauseManager), "WriteLog", T, "KillLogPrefix");
			ModeLocks.Apply();
			Patcher.Pre(typeof(PauseManager), "ChangeAmmoText", T, "AmmoTextPrefix");
			Patcher.Pre(typeof(ItemBehaviour), "OnFocus", T, "GrabPromptPrefix");
			static bool IsWeapon(Type t)
			{
				return typeof(Weapon).IsAssignableFrom(t);
			}
		}

		private static bool GrabPromptPrefix()
		{
			if (!DuelSession.Active)
			{
				return true;
			}
			PauseManager instance = PauseManager.Instance;
			if ((Object)(object)instance != (Object)null && (Object)(object)instance.grabPopup != (Object)null && ((Component)instance.grabPopup).gameObject.activeSelf)
			{
				((Component)instance.grabPopup).gameObject.SetActive(false);
			}
			return false;
		}

		private static void AmmoTextPrefix(ref string text, ref string reloadText)
		{
			if (DuelSession.Active)
			{
				text = "";
				reloadText = "";
			}
		}

		private static bool KillLogPrefix(string text)
		{
			if (!DuelSession.Active || DuelSession.OwnFeedLine || string.IsNullOrEmpty(text))
			{
				return true;
			}
			return (!text.Contains(" with a") || !text.Contains(" by ")) && !text.Contains("fell into the void") && !text.Contains("commited suicide") && !text.EndsWith(" died", StringComparison.Ordinal);
		}

		private static void ShootPrefix(Weapon __instance, Vector3 __1, Vector3 __2)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Trainer.I != (Object)null)
			{
				Trainer.I.OnShot(__instance, __1, __2);
			}
			if ((Object)(object)DuelSession.I != (Object)null)
			{
				DuelSession.I.OnShot(__instance, __1, __2);
			}
		}

		private static bool ShotEffectPrefix(Weapon __instance)
		{
			if ((Object)(object)DuelSession.I != (Object)null)
			{
				DuelSession.I.MuteIfEnemy(__instance);
			}
			if (!Gear.ShotEffect(__instance))
			{
				return false;
			}
			if (DuelSession.SmashActive && ((NetworkBehaviour)__instance).IsOwner && __instance is DualLauncher && GunTags.KindOf(__instance) == GunKind.Rocket)
			{
				if ((Object)(object)__instance.fireClip != (Object)null && (Object)(object)__instance.audio != (Object)null)
				{
					__instance.audio.PlayOneShot(__instance.fireClip);
				}
				return false;
			}
			return true;
		}

		private static void PelletPrefix(Shotgun __instance, ref Vector3 __2)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (GunTags.Pattern((Weapon)(object)__instance, out var tight))
			{
				__2 = GunTags.PelletDirection(__instance, __2, tight);
			}
		}

		private static void ImpactPrefix(Weapon __instance)
		{
			if ((Object)(object)DuelSession.I != (Object)null)
			{
				DuelSession.I.NoteImpact(__instance);
			}
		}

		private static bool BulletSoundPrefix()
		{
			if ((Object)(object)DuelSession.I != (Object)null)
			{
				return !DuelSession.I.MuteImpactNow;
			}
			return true;
		}

		private static bool WhizPrefix()
		{
			if (DuelSession.Active)
			{
				return !(DuelSession.I.Mode.Vamp > 0f);
			}
			return true;
		}

		private static void LauncherFirePrefix(DualLauncher __instance, Vector3 __0, Vector3 __1)
		{
			//IL_0013: 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)
			if ((Object)(object)DuelSession.I != (Object)null)
			{
				DuelSession.I.SmashRocketFired(__instance, __0, __1);
			}
		}

		private static void ProjectileMadePostfix(PredictedProjectile __instance, GameObject __4)
		{
			if ((Object)(object)DuelSession.I != (Object)null