Decompiled source of EFT ALPHA CASE v1.0.0

EFT_ALPHA_CASE.dll

Decompiled 10 hours ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using Atlas;
using Atlas.MappingComponents.Sandbox;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using EFT_Frame;
using FistVR;
using H3MP;
using HarmonyLib;
using NGA;
using OtherLoader;
using Sodalite.Api;
using UnityEditor;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;
using Valve.VR;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace JerryComponent
{
	public class AlphaCase : MonoBehaviour
	{
		public GameObject box;

		public Collider colgrab;

		public FVRPhysicalObject mainobj;

		public GameObject lock1;

		public GameObject lock2;

		public GameObject savevalue;

		public GameObject WaX;

		public GameObject WaY;

		public GameObject WaZ;

		public WaggleJoint X;

		public WaggleJoint Y;

		public WaggleJoint Z;

		public PlayerCrouch PC;

		public GameObject rot;

		public GameObject phymain;

		public GameObject phylid;

		private void Awake()
		{
		}

		private void Update()
		{
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: 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_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
			{
				if ((Object)(object)((FVRInteractiveObject)mainobj).m_hand == (Object)null)
				{
					phymain.SetActive(false);
					phylid.SetActive(false);
					((Component)this).gameObject.transform.position = ((Component)GM.CurrentPlayerBody.Head).transform.position;
					((Component)this).gameObject.transform.eulerAngles = ((Component)GM.CurrentPlayerBody.Head).transform.eulerAngles;
					((Behaviour)X).enabled = true;
					((Behaviour)Y).enabled = true;
					((Behaviour)Z).enabled = true;
					((Behaviour)PC).enabled = true;
				}
				else if ((Object)(object)((FVRInteractiveObject)mainobj).m_hand != (Object)null)
				{
					phymain.SetActive(true);
					phylid.SetActive(true);
					((Behaviour)X).enabled = false;
					((Behaviour)Y).enabled = false;
					((Behaviour)Z).enabled = false;
					WaX.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
					WaY.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
					WaZ.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
					((Behaviour)PC).enabled = false;
					rot.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				}
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "MainMenu3" || GM.IsDead())
			{
				box.SetActive(false);
				colgrab.enabled = false;
			}
			else
			{
				Scene activeScene2 = SceneManager.GetActiveScene();
				if (((Scene)(ref activeScene2)).name != "MainMenu3" && !GM.IsDead())
				{
					box.SetActive(true);
					colgrab.enabled = true;
				}
			}
			if (lock1.transform.localEulerAngles.x > 15f && lock2.transform.localEulerAngles.x > 15f)
			{
				savevalue.SetActive(true);
			}
			else if (lock1.transform.localEulerAngles.x < 15f || lock2.transform.localEulerAngles.x < 15f)
			{
				savevalue.SetActive(false);
			}
		}
	}
}
namespace JerrySecureCase
{
	[BepInPlugin("Jerry.SecureCase", "Jerry.SecureCase", "1.0.0")]
	[BepInDependency("nrgill28.Sodalite", "1.3.2")]
	[BepInProcess("h3vr.exe")]
	public class AlphaCasePlugin : BaseUnityPlugin
	{
		private GameObject AlphaCase = null;

		private float timer = 0f;

		private float UpdateRate = 0.2f;

		private void Start()
		{
		}

		private void Update()
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			timer += Time.deltaTime;
			if (!(timer > UpdateRate))
			{
				return;
			}
			timer -= UpdateRate;
			if (!((Object)(object)AlphaCase == (Object)null))
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name != "MainMenu3"))
			{
				return;
			}
			if (IM.OD.ContainsKey("JerryAlphaCase"))
			{
				AnvilCallback<GameObject> gameObjectAsync = ((AnvilAsset)IM.OD["JerryAlphaCase"]).GetGameObjectAsync();
				if (Object.op_Implicit((Object)(object)gameObjectAsync.Result))
				{
					AlphaCase = Object.Instantiate<GameObject>(gameObjectAsync.Result);
					Console.Write("AlphaCase:Initialed new AlphaCase");
				}
				else
				{
					Scene activeScene2 = SceneManager.GetActiveScene();
					Console.Write("AlphaCase:Can't find AlphaCase,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene2)).name);
				}
			}
			else
			{
				Scene activeScene3 = SceneManager.GetActiveScene();
				Console.Write("AlphaCase:Can't find AlphaCase,please wait for the assets load or report a bug,current scene name : {0}", ((Scene)(ref activeScene3)).name);
			}
		}
	}
}
namespace JerryComponent
{
	public class PlayerCrouch : MonoBehaviour
	{
		public GameObject crouch;

		[SerializeField]
		private Transform body;

		public Ray ray;

		public float rayLength;

		[SerializeField]
		private LayerMask terrainLayer;

		public float rayStartYOffset = 0f;

		public float rayMul;

		public float dis;

		public RaycastHit rayhit;

		private void Start()
		{
		}

		private void Update()
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00db: 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_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_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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			ray = new Ray(body.position + Vector3.up * rayStartYOffset, Vector3.down);
			Physics.Raycast(ray, ref rayhit, rayLength, ((LayerMask)(ref terrainLayer)).value);
			if (((RaycastHit)(ref rayhit)).distance > 0.6f)
			{
				dis = 0.6f * rayMul;
				crouch.transform.localEulerAngles = new Vector3(dis, 0f, 0f);
			}
			else
			{
				dis = ((RaycastHit)(ref rayhit)).distance * rayMul;
				crouch.transform.localEulerAngles = new Vector3(dis, 0f, 0f);
			}
			if (crouch.transform.localEulerAngles.x > 60f)
			{
				crouch.transform.localEulerAngles = new Vector3(60f, 0f, 0f);
			}
			else if (crouch.transform.localEulerAngles.x < 0f)
			{
				crouch.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
			}
		}
	}
	public class VolumeSlot : MonoBehaviour
	{
		public Transform parent;

		private void OnTriggerStay(Collider other)
		{
			//IL_002d: 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_009b: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)other).gameObject;
			FVRPhysicalObject component = gameObject.GetComponent<FVRPhysicalObject>();
			if (!((Object)(object)component != (Object)null) || !((Object)(object)gameObject != (Object)(object)parent) || (int)component.QBSlotType != 0 || ((FVRInteractiveObject)component).m_isHeld || !((Object)(object)component.m_quickbeltSlot == (Object)null) || !((Object)(object)((Component)component).gameObject.GetComponent<FVRFireArm>() == (Object)null) || !((Object)(object)((Component)component).gameObject.GetComponent<FVRFireArmMagazine>() == (Object)null))
			{
				return;
			}
			float num = Vector3.Distance(((Component)component).transform.position, ((Component)GM.CurrentPlayerBody.LeftHand).transform.position);
			float num2 = Vector3.Distance(((Component)component).transform.position, ((Component)GM.CurrentPlayerBody.RightHand).transform.position);
			if (num < 0.25f || num2 < 0.25f)
			{
				Rigidbody component2 = gameObject.GetComponent<Rigidbody>();
				if ((Object)(object)component2 != (Object)null)
				{
					gameObject.transform.SetParent(((Component)parent).transform);
					component2.useGravity = false;
					component2.isKinematic = true;
				}
			}
		}

		private void OnTriggerExit(Collider other)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)other).gameObject;
			FVRPhysicalObject component = gameObject.GetComponent<FVRPhysicalObject>();
			if ((Object)(object)component != (Object)null && (Object)(object)gameObject != (Object)(object)parent && (int)component.QBSlotType == 0 && ((FVRInteractiveObject)component).m_isHeld && (Object)(object)component.m_quickbeltSlot == (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<FVRFireArm>() == (Object)null && (Object)(object)((Component)component).gameObject.GetComponent<FVRFireArmMagazine>() == (Object)null)
			{
				Rigidbody component2 = gameObject.GetComponent<Rigidbody>();
				if ((Object)(object)component2 != (Object)null)
				{
					Scene activeScene = SceneManager.GetActiveScene();
					gameObject.transform.SetParent((Transform)null);
					SceneManager.MoveGameObjectToScene(gameObject, activeScene);
					component2.useGravity = true;
					component2.isKinematic = false;
				}
			}
		}
	}
	public class Beacon : MonoBehaviour
	{
		private void Start()
		{
		}

		private void Update()
		{
		}
	}
	public class DeathActivate : MonoBehaviour
	{
		public float countdown = 3f;

		public bool isNGAInstalled;

		public bool loadouted = false;

		private void Start()
		{
			isNGAInstalled = Chainloader.PluginInfos.ContainsKey("NGA.SafehouseMP");
		}

		private void EnterWithLoadOut()
		{
			//IL_0048: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_009e: 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: Expected O, but got Unknown
			if (countdown >= 0f)
			{
				countdown -= Time.deltaTime;
			}
			if (!loadouted && countdown < 0f)
			{
				loadouted = true;
				Transform transform = new GameObject().transform;
				transform.position = ((Component)GM.CurrentPlayerBody).transform.position;
				VaultFile val = new VaultFile();
				if (!VaultSystem.LoadVaultFile(SafehouseMP.raid_extracted_loadout_filename, (VaultFileDisplayMode)1, ref val))
				{
					Debug.Log((object)"ERROR: Loading saved loadout failed.");
					return;
				}
				string text = default(string);
				if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)1, val, ref text, transform, Vector3.zero))
				{
					Debug.Log((object)"ERROR: Spawning saved loadout failed.");
					return;
				}
				VaultFile val2 = new VaultFile();
				VaultSystem.SaveVaultFile(SafehouseMP.raid_extracted_loadout_filename, (VaultFileDisplayMode)1, val2);
			}
		}

		private void Update()
		{
			//IL_0013: 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)
			if (isNGAInstalled && Vector3.Distance(((Component)this).transform.position, GM.CurrentMovementManager.Head.position) < 0.5f)
			{
				EnterWithLoadOut();
			}
		}
	}
	public class DeathBody : MonoBehaviour
	{
		public GameObject deathswitch;

		public GameObject body;

		public Transform spawnpoint;

		public GameObject player;

		public bool dead = false;

		private DropItems deadbody;

		public FVRQuickBeltSlot headslotalive;

		public FVRQuickBeltSlot bodyslotalive;

		public FVRQuickBeltSlot maskslotalive;

		public FVRQuickBeltSlot armorslotalive;

		public FVRQuickBeltSlot beltslotalive;

		private FVRPhysicalObject helmet;

		private FVRPhysicalObject vest;

		private FVRPhysicalObject mask;

		private FVRPhysicalObject armor;

		private FVRPhysicalObject belt;

		public MeshRenderer armband;

		private void Start()
		{
		}

		private void Update()
		{
			//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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0610: Unknown result type (might be due to invalid IL or missing references)
			//IL_0620: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			if (deathswitch.transform.localEulerAngles.x < 45f)
			{
			}
			if (!(deathswitch.transform.localEulerAngles.x > 45f))
			{
				return;
			}
			if ((Object)(object)deadbody == (Object)null || !dead || (Object)(object)helmet == (Object)null || (Object)(object)vest == (Object)null || (Object)(object)mask == (Object)null || (Object)(object)armor == (Object)null || (Object)(object)belt == (Object)null)
			{
			}
			if ((Object)(object)deadbody != (Object)null && dead)
			{
				deadbody.dc.isdead = true;
				if ((Object)(object)helmet != (Object)null)
				{
					((Component)helmet).gameObject.transform.position = deadbody.headslot.position;
					((Component)helmet).gameObject.transform.eulerAngles = deadbody.headslot.eulerAngles;
				}
				if ((Object)(object)vest != (Object)null)
				{
					((Component)vest).gameObject.transform.position = deadbody.bodyslot.position;
					((Component)vest).gameObject.transform.eulerAngles = deadbody.bodyslot.eulerAngles;
				}
				if ((Object)(object)mask != (Object)null)
				{
					((Component)mask).gameObject.transform.position = deadbody.maskslot.position;
					((Component)mask).gameObject.transform.eulerAngles = deadbody.maskslot.eulerAngles;
				}
				if ((Object)(object)armor != (Object)null)
				{
					((Component)armor).gameObject.transform.position = deadbody.armorslot.position;
					((Component)armor).gameObject.transform.eulerAngles = deadbody.armorslot.eulerAngles;
				}
				if ((Object)(object)belt != (Object)null)
				{
					((Component)belt).gameObject.transform.position = deadbody.beltslot.position;
					((Component)belt).gameObject.transform.eulerAngles = deadbody.beltslot.eulerAngles;
				}
				if ((Object)(object)headslotalive.CurObject != (Object)null)
				{
					helmet = headslotalive.CurObject;
					headslotalive.CurObject.ClearQuickbeltState();
				}
				if ((Object)(object)maskslotalive.CurObject != (Object)null)
				{
					mask = maskslotalive.CurObject;
					maskslotalive.CurObject.ClearQuickbeltState();
				}
				if ((Object)(object)bodyslotalive.CurObject != (Object)null)
				{
					vest = bodyslotalive.CurObject;
					bodyslotalive.CurObject.ClearQuickbeltState();
				}
				if ((Object)(object)armorslotalive.CurObject != (Object)null)
				{
					armor = armorslotalive.CurObject;
					armorslotalive.CurObject.ClearQuickbeltState();
				}
				if ((Object)(object)beltslotalive.CurObject != (Object)null)
				{
					belt = beltslotalive.CurObject;
					beltslotalive.CurObject.ClearQuickbeltState();
				}
			}
			if (GM.IsDead())
			{
				for (int num = GM.CurrentPlayerBody.QuickbeltSlots.Count - 1; num >= 0; num--)
				{
					if ((Object)(object)GM.CurrentPlayerBody.QuickbeltSlots[num] != (Object)null && (Object)(object)GM.CurrentPlayerBody.QuickbeltSlots[num].CurObject != (Object)null)
					{
						FVRPhysicalObject curObject = GM.CurrentPlayerBody.QuickbeltSlots[num].CurObject;
						curObject.ClearQuickbeltState();
						curObject.DeRegisterQuickbeltSlots();
						curObject.SetIsKinematicLocked(false);
						curObject.SetQuickBeltSlot((FVRQuickBeltSlot)null);
						curObject.SetParentage((Transform)null);
						((FVRInteractiveObject)curObject).SetAllCollidersToLayer(false, "Default");
						((FVRInteractiveObject)curObject).BeginInteraction(GM.CurrentMovementManager.Hands[0]);
						((FVRInteractiveObject)curObject).EndInteraction(GM.CurrentMovementManager.Hands[0]);
						GM.CurrentPlayerBody.QuickbeltSlots[num].CurObject = null;
					}
				}
				if ((Object)(object)GM.CurrentMovementManager.Hands[0].CurrentInteractable != (Object)null)
				{
					GM.CurrentMovementManager.Hands[0].CurrentInteractable.IsHeld = false;
					GM.CurrentMovementManager.Hands[0].CurrentInteractable.EndInteraction(GM.CurrentMovementManager.Hands[0]);
					GM.CurrentMovementManager.Hands[0].EndInteractionIfHeld(GM.CurrentMovementManager.Hands[0].CurrentInteractable);
				}
				if ((Object)(object)GM.CurrentMovementManager.Hands[1].CurrentInteractable != (Object)null)
				{
					GM.CurrentMovementManager.Hands[1].CurrentInteractable.IsHeld = false;
					GM.CurrentMovementManager.Hands[1].CurrentInteractable.EndInteraction(GM.CurrentMovementManager.Hands[1]);
					GM.CurrentMovementManager.Hands[1].EndInteractionIfHeld(GM.CurrentMovementManager.Hands[1].CurrentInteractable);
				}
				DropQuickbeltContents();
				((Renderer)armband).enabled = false;
				player.SetActive(false);
				if (!dead)
				{
					int quickbeltPreset = GM.Options.QuickbeltOptions.QuickbeltPreset;
					GM.CurrentPlayerBody.ConfigureQuickbelt(quickbeltPreset + 1);
					deadbody = Object.Instantiate<GameObject>(body, ((Component)spawnpoint).transform.position, ((Component)spawnpoint).transform.rotation).GetComponent<DropItems>();
					dead = true;
				}
			}
			if (!GM.IsDead())
			{
				if ((Object)(object)deadbody != (Object)null)
				{
					deadbody.dc.cam.SetActive(false);
					deadbody.dc.isdead = false;
				}
				if (dead)
				{
					int quickbeltPreset2 = GM.Options.QuickbeltOptions.QuickbeltPreset;
					GM.CurrentPlayerBody.ConfigureQuickbelt(quickbeltPreset2);
				}
				if ((Object)(object)helmet != (Object)null)
				{
					((Component)helmet).transform.SetParent((Transform)null);
				}
				if ((Object)(object)vest != (Object)null)
				{
					((Component)vest).transform.SetParent((Transform)null);
				}
				if ((Object)(object)mask != (Object)null)
				{
					((Component)mask).transform.SetParent((Transform)null);
				}
				if ((Object)(object)armor != (Object)null)
				{
					((Component)armor).transform.SetParent((Transform)null);
				}
				if ((Object)(object)belt != (Object)null)
				{
					((Component)belt).transform.SetParent((Transform)null);
				}
				helmet = null;
				vest = null;
				mask = null;
				armor = null;
				belt = null;
				((Renderer)armband).enabled = true;
				player.SetActive(true);
				dead = false;
			}
		}

		public void DropQuickbeltContents()
		{
		}
	}
	public class DeathCamera : MonoBehaviour
	{
		public bool spawned = true;

		public bool isdead = true;

		public GameObject cam;

		public GameObject cam2;

		public GameObject camholderpos;

		public GameObject camholderrot;

		private void Start()
		{
			cam.SetActive(false);
			spawned = true;
		}

		private void Update()
		{
			//IL_002e: 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_005c: 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_00d6: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			if (isdead)
			{
				cam.SetActive(true);
				((Component)GM.CurrentMovementManager).transform.eulerAngles = cam2.transform.eulerAngles;
				camholderpos.transform.localPosition = -((Component)GM.CurrentPlayerBody.Head).gameObject.transform.localPosition;
				spawned = false;
			}
			if (!isdead)
			{
				cam.SetActive(false);
				if (!spawned)
				{
					((Component)GM.CurrentMovementManager).transform.position = GM.CurrentSceneSettings.DeathResetPoint.position;
					spawned = true;
				}
				((Component)GM.CurrentMovementManager).transform.eulerAngles = new Vector3(0f, ((Component)GM.CurrentMovementManager).transform.eulerAngles.y, 0f);
			}
		}

		private void OnDestroy()
		{
			cam.SetActive(false);
		}
	}
	public class DestroyOnAudioStop : MonoBehaviour
	{
		public GameObject thisobj;

		public AudioSource thisaudio;

		private void Start()
		{
			Object.DontDestroyOnLoad((Object)(object)thisobj);
		}

		private void Update()
		{
			if (!thisaudio.isPlaying)
			{
				Object.Destroy((Object)(object)thisobj);
			}
		}
	}
	public class DropItems : MonoBehaviour
	{
		public DeathCamera dc;

		public Rigidbody head;

		public Rigidbody pelvis;

		public Rigidbody spine;

		public Rigidbody thighL;

		public Rigidbody thighR;

		public Rigidbody calfL;

		public Rigidbody calfR;

		public Rigidbody upperarmL;

		public Rigidbody upperarmR;

		public Rigidbody forearmL;

		public Rigidbody forearmR;

		public Transform headslot;

		public Transform bodyslot;

		public Transform maskslot;

		public Transform armorslot;

		public Transform beltslot;

		private void Start()
		{
		}

		private void Update()
		{
			head.isKinematic = false;
			pelvis.isKinematic = false;
			spine.isKinematic = false;
			thighL.isKinematic = false;
			thighR.isKinematic = false;
			calfL.isKinematic = false;
			calfR.isKinematic = false;
			upperarmL.isKinematic = false;
			upperarmR.isKinematic = false;
			forearmL.isKinematic = false;
			forearmR.isKinematic = false;
		}
	}
	public class EFTMode : MonoBehaviour
	{
		public TextMesh countdowntext;

		public GameObject countdownboard;

		public float countdownstart = 3f;

		public bool startcount = false;

		public bool tele = true;

		public GameObject playerdetectpoint;

		public bool m_isLoading = false;

		public GameObject death;

		public GameObject escape;

		public float deathcountdownnum = 15f;

		public bool addcomp = false;

		private void Start()
		{
			escape.SetActive(false);
			death.SetActive(false);
		}

		private void Update()
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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)
			if (startcount)
			{
				countdownboard.SetActive(true);
				countdownstart -= Time.deltaTime;
				countdowntext.text = "SpawnLoadout" + countdownstart.ToString("f1");
			}
			if (countdownstart < 0f)
			{
				countdownboard.SetActive(false);
				startcount = false;
			}
			if (!addcomp && (Object)(object)GM.CurrentPlayerBody != (Object)null && (Object)(object)Object.FindObjectOfType<DeathActivate>() == (Object)null)
			{
				playerdetectpoint.AddComponent<DeathActivate>();
				startcount = true;
				addcomp = true;
			}
			if ((Object)(object)GM.CurrentMovementManager != (Object)null)
			{
				playerdetectpoint.transform.position = GM.CurrentMovementManager.Head.position;
				playerdetectpoint.transform.eulerAngles = GM.CurrentMovementManager.Head.eulerAngles;
			}
			if (!GM.IsDead())
			{
				return;
			}
			deathcountdownnum -= 1f * Time.deltaTime;
			if (deathcountdownnum < 10f)
			{
				death.SetActive(true);
				if (tele)
				{
					GM.CurrentMovementManager.TeleportToPoint(new Vector3(0f, 0f, 0f), true, new Vector3(0f, 0f, 0f));
					tele = false;
				}
			}
			if (!m_isLoading && deathcountdownnum < 0f)
			{
				m_isLoading = true;
			}
		}
	}
	public class Extractpoint : MonoBehaviour
	{
		public bool isNGAInstalled;

		public float telecountdown = 1f;

		public bool telecount = false;

		public bool telecount2 = false;

		public GameObject motherboard;

		public bool startcountdown = false;

		public EFTMode modemain;

		public float countdownnum = 12f;

		public bool sceneswitched = false;

		public GameObject countdownboard;

		public Transform hidepoint;

		public TextMesh countdowntext;

		private void OnTriggerStay(Collider other)
		{
			if ((Object)(object)((Component)other).gameObject == (Object)(object)modemain.playerdetectpoint)
			{
				startcountdown = true;
			}
		}

		private void OnTriggerExit(Collider other)
		{
			if ((Object)(object)((Component)other).gameObject == (Object)(object)modemain.playerdetectpoint)
			{
				startcountdown = false;
			}
		}

		private void Start()
		{
			isNGAInstalled = Chainloader.PluginInfos.ContainsKey("NGA.SafehouseMP");
			motherboard.SetActive(true);
		}

		private void Update()
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_0164: 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)
			if (!isNGAInstalled)
			{
				((Component)this).gameObject.SetActive(false);
			}
			else if (isNGAInstalled)
			{
				if (telecount)
				{
					telecountdown -= Time.deltaTime;
				}
				if (telecountdown < 0f && !telecount2)
				{
					telecount = false;
					telecount2 = true;
					modemain.escape.SetActive(true);
					GM.CurrentMovementManager.TeleportToPoint(((Component)hidepoint).transform.position, true, ((Component)hidepoint).transform.localEulerAngles);
				}
				if (countdownnum < 2f)
				{
					motherboard.SetActive(false);
					SteamVR_Fade.Start(new Color(0f, 0f, 0f, 1f), 0.25f, false);
					telecount = true;
				}
				if (countdownnum < 0f && !sceneswitched)
				{
					Save();
					Escape();
					startcountdown = false;
					sceneswitched = true;
				}
				if (startcountdown)
				{
					countdownboard.SetActive(true);
					countdownboard.transform.position = ((Component)GM.CurrentMovementManager.Head).transform.position;
					countdownboard.transform.eulerAngles = ((Component)GM.CurrentMovementManager.Head).transform.eulerAngles;
					countdowntext.text = "Extract" + (countdownnum - 2f).ToString("f1");
					countdownnum -= 1f * Time.deltaTime;
				}
				if (!startcountdown)
				{
					countdownboard.SetActive(false);
					countdowntext.text = "Extract10";
					countdownnum = 12f;
				}
			}
		}

		private void Save()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			VaultFile val = new VaultFile();
			if (VaultSystem.FindAndScanObjectsInQuickbelt(val))
			{
				if (!VaultSystem.SaveVaultFile(SafehouseMP.raid_extracted_loadout_filename, (VaultFileDisplayMode)1, val))
				{
					Debug.Log((object)"ERROR: Saving loadout failed.");
				}
				else if (SafehouseMP.config_delete_loadout_on_save.Value)
				{
					VaultFile val2 = new VaultFile();
					FVRPlayerBody val3 = Object.FindObjectOfType<FVRPlayerBody>();
					Transform transform = new GameObject().transform;
					transform.position = ((Component)val3).transform.position;
					string text = default(string);
					if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)1, val2, ref text, transform, Vector3.zero))
					{
						Debug.Log((object)("ERROR: Couldn't spawn empty loadout w status: " + text));
					}
				}
			}
			else
			{
				Debug.Log((object)"ERROR: Quickbelt scan failed.");
			}
		}

		private void Escape()
		{
			for (int i = 0; i < GM.CurrentSceneSettings.QuitReceivers.Count; i++)
			{
				GM.CurrentSceneSettings.QuitReceivers[i].BroadcastMessage("QUIT", (SendMessageOptions)1);
			}
			if (((AnvilCallbackBase)GM.LoadingCallback).IsCompleted)
			{
				CustomSceneInfo customScene = AtlasPlugin.GetCustomScene("EFTHideOut_SafeHouse");
				if (customScene != null)
				{
					AtlasPlugin.LoadCustomScene("EFTHideOut_SafeHouse");
				}
				else
				{
					SteamVR_LoadLevel.Begin("EFTHideOut_SafeHouse", false, 0f, 0f, 0f, 0f, 1f);
				}
			}
		}
	}
	public class Humansig : MonoBehaviour
	{
		public GameObject handL;

		public GameObject handR;

		public Sosig sosig;

		public GameObject body;

		private void Start()
		{
			sosig = ((Component)this).GetComponentInParent<Sosig>();
		}

		private void Update()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)sosig == (Object)null)
			{
			}
			if ((Object)(object)sosig != (Object)null)
			{
				if ((int)sosig.BodyState != 0)
				{
					Object.Instantiate<GameObject>(body, ((Component)sosig).gameObject.transform.position, ((Component)sosig).gameObject.transform.rotation);
					Object.Destroy((Object)(object)((Component)sosig).gameObject);
					Object.Destroy((Object)(object)this);
				}
				sosig.Renderers[0].enabled = false;
				sosig.Renderers[1].enabled = false;
				sosig.Renderers[2].enabled = false;
				sosig.Renderers[3].enabled = false;
				if (sosig.Hand_Primary != null)
				{
					handR.transform.position = ((Component)sosig.Hand_Primary.Root).transform.position;
					handR.transform.eulerAngles = ((Component)sosig.Hand_Primary.Root).transform.eulerAngles;
				}
				if (sosig.Hand_Secondary != null)
				{
					handL.transform.position = ((Component)sosig.Hand_Secondary.Root).transform.position;
					handL.transform.eulerAngles = ((Component)sosig.Hand_Secondary.Root).transform.eulerAngles;
				}
			}
		}
	}
	public class Humansigconv : MonoBehaviour
	{
		public float countdown = 2f;

		public bool conved = false;

		public FVRObject body;

		public FVRObject bodySCAVBoss;

		private void Start()
		{
		}

		private void Update()
		{
			//IL_0165: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			if (!conved)
			{
				countdown -= Time.deltaTime;
			}
			if (!(countdown < 0f) || conved)
			{
				return;
			}
			conved = true;
			Sosig[] array = Object.FindObjectsOfType<Sosig>();
			if (array == null)
			{
				return;
			}
			Sosig[] array2 = array;
			foreach (Sosig val in array2)
			{
				Debug.Log((object)"sosig found");
				if (((Object)((Component)val).gameObject).name == "Zosig_Rot(Clone)" && val.Renderers[0].enabled && (Object)(object)val.Links[0] != (Object)null)
				{
					GameObject val2 = Object.Instantiate<GameObject>(((AnvilAsset)bodySCAVBoss).GetGameObject(), ((Component)val.Links[0]).transform);
					val.CanBeKnockedOut = false;
					val.DoesDropWeaponsOnBallistic = false;
					val.DamMult_Blunt = 0.25f;
					val.DamMult_Chilling = 0.25f;
					val.DamMult_Cutting = 0.25f;
					val.DamMult_EMP = 0.15f;
					val.DamMult_Explosive = 0.55f;
					val.DamMult_Melee = 0.35f;
					val.DamMult_Piercing = 0.1f;
					val.DamMult_Projectile = 0.1f;
					val.DamMult_Thermal = 0.1f;
					if ((Object)(object)val2 != (Object)null)
					{
						val2.transform.localPosition = new Vector3(0f, 0f, 0f);
						val2.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
						Humansig component = val2.GetComponent<Humansig>();
						if ((Object)(object)component != (Object)null)
						{
							component.sosig = val;
						}
					}
					Debug.Log((object)"SCAVboss spawned on sosig");
				}
				if (!(((Object)((Component)val).gameObject).name != "Zosig_Rot(Clone)") || !val.Renderers[0].enabled || !((Object)(object)val.Links[0] != (Object)null))
				{
					continue;
				}
				GameObject val3 = Object.Instantiate<GameObject>(((AnvilAsset)body).GetGameObject(), ((Component)val.Links[0]).transform);
				val.DamMult_Blunt = 0.75f;
				val.DamMult_Chilling = 1f;
				val.DamMult_Cutting = 0.75f;
				val.DamMult_EMP = 0.5f;
				val.DamMult_Explosive = 1f;
				val.DamMult_Melee = 1.5f;
				val.DamMult_Piercing = 0.5f;
				val.DamMult_Projectile = 0.5f;
				val.DamMult_Thermal = 0.5f;
				if ((Object)(object)val3 != (Object)null)
				{
					val3.transform.localPosition = new Vector3(0f, 0f, 0f);
					val3.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
					Humansig component2 = val3.GetComponent<Humansig>();
					if ((Object)(object)component2 != (Object)null)
					{
						component2.sosig = val;
					}
				}
				Debug.Log((object)"USEC spawned on sosig");
			}
		}
	}
	public class AmITheFirst : MonoBehaviour
	{
		public string objname;

		public GameObject objtoenable;

		public FVRObject theobjname;

		private void Start()
		{
			if ((Object)(object)GameObject.Find(objname) == (Object)null)
			{
				objtoenable.SetActive(true);
				Object.Instantiate<GameObject>(((AnvilAsset)theobjname).GetGameObject(), ((Component)this).transform);
				Debug.Log((object)"first");
			}
			if ((Object)(object)GameObject.Find(objname) != (Object)null)
			{
				objtoenable.SetActive(false);
				Debug.Log((object)"not first");
			}
		}

		private void Update()
		{
		}
	}
	public class SpawnFVROBJ : MonoBehaviour
	{
		public bool spawnpicked = false;

		public Random Rand;

		public ObjectSpawnPoint[] IDs;

		public ObjectSpawnPoint ID;

		public int length;

		private void Start()
		{
			IDs = ((Component)this).GetComponents<ObjectSpawnPoint>();
			RandomPick();
		}

		private void Update()
		{
			if ((Object)(object)ID == (Object)null)
			{
				Debug.Log((object)"Null");
			}
		}

		private void RandomPick()
		{
			if (!spawnpicked)
			{
				int num = Random.Range(0, IDs.Length);
				ID = IDs[num];
				if ((Object)(object)ID != (Object)null)
				{
					((Behaviour)ID).enabled = true;
					Debug.Log((object)"Loot spawned");
				}
				spawnpicked = true;
			}
		}
	}
	public class DrawDecal : MonoBehaviour
	{
		private void OnTriggerEnter(Collider other)
		{
			if (((Object)((Component)other).gameObject).name == "MarkeTail")
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void Start()
		{
		}

		private void Update()
		{
		}
	}
	public class DrawingTool : MonoBehaviour
	{
		public GameObject penref;

		public GameObject decal;

		private void OnTriggerStay(Collider other)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)other).gameObject).name == "MarkerTip")
			{
				penref.transform.position = ((Component)other).gameObject.transform.position;
				Object.Instantiate<GameObject>(decal, penref.transform.position, ((Component)this).transform.rotation);
			}
		}

		private void Start()
		{
		}

		private void FixedUpdate()
		{
		}
	}
}
namespace JerryAr.EFT_ALPHA_CASE
{
	[BepInPlugin("JerryAr.EFT_ALPHA_CASE", "EFT_ALPHA_CASE", "1.0.0")]
	[BepInProcess("h3vr.exe")]
	[Description("Built with MeatKit")]
	[BepInDependency("h3vr.otherloader", "1.3.0")]
	public class EFT_ALPHA_CASEPlugin : BaseUnityPlugin
	{
		private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		internal static ManualLogSource Logger;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAssets();
		}

		private void LoadAssets()
		{
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "JerryAr.EFT_ALPHA_CASE");
			OtherLoader.RegisterDirectLoad(BasePath, "JerryAr.EFT_ALPHA_CASE", "", "", "jerryalphacase", "");
		}
	}
}
public class NavMeshCleaner : MonoBehaviour
{
	private class Tri
	{
		public int i1;

		public int i2;

		public int i3;

		public int min;

		public int max;

		public Tri(int i1, int i2, int i3)
		{
			this.i1 = i1;
			this.i2 = i2;
			this.i3 = i3;
			min = Mathf.Min(new int[3] { i1, i2, i3 });
			max = Mathf.Max(new int[3] { i1, i2, i3 });
		}
	}

	private class Edge
	{
		public int i1;

		public int i2;

		public Edge(int i1, int i2)
		{
			this.i1 = i1;
			this.i2 = i2;
		}
	}

	[CustomEditor(typeof(NavMeshCleaner))]
	public class NavMeshCleanerEditor : Editor
	{
		private static class Styles
		{
			private static Dictionary<string, GUIStyle> texture = new Dictionary<string, GUIStyle>();

			public static GUIStyle Get(string id)
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Expected O, but got Unknown
				if (!texture.TryGetValue(id, out var value))
				{
					value = new GUIStyle(GUIStyle.op_Implicit(id));
					texture.Add(id, value);
				}
				return value;
			}
		}

		private NavMeshCleaner m_Target;

		private int m_OverPoint = -1;

		private static float kEpsilon = 1E-06f;

		private void OnEnable()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			m_Target = (NavMeshCleaner)(object)((Editor)this).target;
			Undo.undoRedoPerformed = (UndoRedoCallback)Delegate.Combine((Delegate?)(object)Undo.undoRedoPerformed, (Delegate?)new UndoRedoCallback(OnUndoOrRedo));
		}

		private void OnDisable()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Undo.undoRedoPerformed = (UndoRedoCallback)Delegate.Remove((Delegate?)(object)Undo.undoRedoPerformed, (Delegate?)new UndoRedoCallback(OnUndoOrRedo));
		}

		private void OnUndoOrRedo()
		{
			((Editor)this).Repaint();
		}

		public override void OnInspectorGUI()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_00f9: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			EditorGUILayout.HelpBox((m_OverPoint == -1) ? "Press Control and click to add a walkable point." : "Press Control and click to remove the point.", (MessageType)((m_Target.m_WalkablePoint.Count != 0) ? 1 : 2));
			((Editor)this).OnInspectorGUI();
			NavMeshCleaner navMeshCleaner = (NavMeshCleaner)(object)((Editor)this).target;
			if (navMeshCleaner.m_Child.Count > 0)
			{
				EditorGUI.BeginChangeCheck();
				bool flag = EditorGUILayout.Toggle("Hide Temp Mesh Object In Hierarchy", ((((Object)navMeshCleaner.m_Child[0].gameObject).hideFlags & 1) != 0) ? true : false, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				if (EditorGUI.EndChangeCheck())
				{
					for (int i = 0; i < navMeshCleaner.m_Child.Count; i++)
					{
						((Object)navMeshCleaner.m_Child[i].gameObject).hideFlags = (HideFlags)((!flag) ? (((Object)navMeshCleaner.m_Child[i].gameObject).hideFlags & -2) : (((Object)navMeshCleaner.m_Child[i].gameObject).hideFlags | 1));
					}
					try
					{
						EditorApplication.RepaintHierarchyWindow();
						EditorApplication.DirtyHierarchyWindowSorting();
					}
					catch
					{
					}
				}
			}
			if (GUILayout.Button((!navMeshCleaner.HasMesh()) ? "Calculate" : "Recalculate", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				navMeshCleaner.Build();
				navMeshCleaner.SetMeshVisible(visible: true);
				SceneView.RepaintAll();
			}
			if (navMeshCleaner.HasMesh() && GUILayout.Button((!navMeshCleaner.MeshVisible()) ? "Show Mesh" : "Hide Mesh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				bool meshVisible = !navMeshCleaner.MeshVisible();
				navMeshCleaner.SetMeshVisible(meshVisible);
				SceneView.RepaintAll();
			}
			if (navMeshCleaner.HasMesh() && GUILayout.Button("Reset Mesh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				navMeshCleaner.Reset();
				SceneView.RepaintAll();
			}
			if (navMeshCleaner.HasMesh() && GUILayout.Button("Reset WalkablePoints", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				Undo.RecordObject(((Editor)this).target, "reset");
				m_Target.m_WalkablePoint.Clear();
				SceneView.RepaintAll();
			}
		}

		private void DrawDisc(Vector3 p, Vector3 n, float radius)
		{
			//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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[20];
			Matrix4x4 val = Matrix4x4.TRS(p, Quaternion.LookRotation(n), Vector3.one * radius);
			for (int i = 0; i < 20; i++)
			{
				ref Vector3 reference = ref array[i];
				reference = ((Matrix4x4)(ref val)).MultiplyPoint3x4(new Vector3(Mathf.Cos((float)Math.PI * 2f * (float)i / 19f), Mathf.Sin((float)Math.PI * 2f * (float)i / 19f), 0f));
			}
			Handles.DrawAAPolyLine(array);
		}

		private void OnSceneGUI()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Invalid comparison between Unknown and I4
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004f: 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_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)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Invalid comparison between Unknown and I4
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Invalid comparison between Unknown and I4
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Invalid comparison between Unknown and I4
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Invalid comparison between Unknown and I4
			SceneView currentDrawingSceneView = SceneView.currentDrawingSceneView;
			Event current = Event.current;
			if ((int)current.type == 7)
			{
				for (int i = 0; i < m_Target.m_WalkablePoint.Count; i++)
				{
					Vector3 val = ((Component)m_Target).transform.TransformPoint(m_Target.m_WalkablePoint[i]);
					float num = WorldSize(1f, currentDrawingSceneView.camera, val);
					Handles.color = Color.black;
					DrawDisc(val, Vector3.up, num * 15f);
					Handles.color = ((i != m_OverPoint) ? Color.green : Color.red);
					Handles.DrawSolidDisc(val, Vector3.up, num * 10f);
					Handles.DrawLine(val, val + Vector3.up * (num * 200f));
				}
			}
			if ((int)current.type == 8 && current.control)
			{
				HandleUtility.AddDefaultControl(GUIUtility.GetControlID((FocusType)2));
			}
			if (current.control)
			{
				EditorGUIUtility.AddCursorRect(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (MouseCursor)((m_OverPoint != -1) ? 12 : 11));
			}
			if (((int)current.type == 0 || (int)current.type == 3 || (int)current.type == 2 || (int)current.type == 1) && current.button == 0)
			{
				MouseEvent(current.type, current.mousePosition, (int)current.modifiers == 2);
			}
		}

		private void MouseEvent(EventType type, Vector2 mouseposition, bool controldown)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_00aa: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0137: 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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			SceneView currentDrawingSceneView = SceneView.currentDrawingSceneView;
			Ray val = HandleUtility.GUIPointToWorldRay(mouseposition);
			if ((int)type == 2)
			{
				int num = -1;
				for (int i = 0; i < m_Target.m_WalkablePoint.Count; i++)
				{
					Vector3 val2 = ((Component)m_Target).transform.TransformPoint(m_Target.m_WalkablePoint[i]);
					float num2 = WorldSize(10f, currentDrawingSceneView.camera, val2) * 1.5f;
					if (DistanceRayVsPoint(val, val2) < num2)
					{
						num = i;
						break;
					}
				}
				if (num != m_OverPoint)
				{
					m_OverPoint = num;
					HandleUtility.Repaint();
				}
			}
			if ((int)type != 0 || !controldown)
			{
				return;
			}
			if (m_OverPoint != -1)
			{
				Undo.RecordObject((Object)(object)m_Target, "Remove Point");
				m_Target.m_WalkablePoint.RemoveAt(m_OverPoint);
				m_OverPoint = -1;
			}
			else
			{
				float num3 = 1000f;
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(val, ref val3, num3))
				{
					Undo.RecordObject((Object)(object)m_Target, "Add Point");
					m_Target.m_WalkablePoint.Add(((Component)m_Target).transform.InverseTransformPoint(((RaycastHit)(ref val3)).point));
				}
				else
				{
					NavMeshTriangulation val4 = NavMesh.CalculateTriangulation();
					Vector3[] vertices = val4.vertices;
					int[] indices = val4.indices;
					Vector3 outNormal = Vector3.up;
					for (int j = 0; j < indices.Length; j += 3)
					{
						num3 = IntersectTest(val, vertices[indices[j]], vertices[indices[j + 1]], vertices[indices[j + 2]], num3, ref outNormal);
					}
					if (num3 < 1000f)
					{
						Undo.RecordObject((Object)(object)m_Target, "Add Point");
						Vector3 val5 = ((Ray)(ref val)).origin + ((Ray)(ref val)).direction * num3;
						m_Target.m_WalkablePoint.Add(((Component)m_Target).transform.InverseTransformPoint(val5));
					}
				}
			}
			HandleUtility.Repaint();
		}

		private static float IntersectTest(Ray ray, Vector3 v0, Vector3 v1, Vector3 v2, float mint, ref Vector3 outNormal)
		{
			//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_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_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: 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_0063: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: 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_00d0: 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_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_0101: 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_010b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = v1 - v0;
			Vector3 val2 = v2 - v0;
			Vector3 val3 = Vector3.Cross(((Ray)(ref ray)).direction, val2);
			float num = Vector3.Dot(val, val3);
			if (num > 0f - kEpsilon && num < kEpsilon)
			{
				return mint;
			}
			float num2 = 1f / num;
			Vector3 val4 = ((Ray)(ref ray)).origin - v0;
			float num3 = num2 * Vector3.Dot(val4, val3);
			if (num3 < 0f || num3 > 1f)
			{
				return mint;
			}
			Vector3 val5 = Vector3.Cross(val4, val);
			float num4 = num2 * Vector3.Dot(((Ray)(ref ray)).direction, val5);
			if (num4 < 0f || num3 + num4 > 1f)
			{
				return mint;
			}
			float num5 = num2 * Vector3.Dot(val2, val5);
			if (num5 > kEpsilon && num5 < mint)
			{
				outNormal = Vector3.Normalize(Vector3.Cross(((Vector3)(ref val)).normalized, ((Vector3)(ref val2)).normalized));
				return num5;
			}
			return mint;
		}

		private static float WorldSize(float screensize, Camera camera, Vector3 p)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			if (!camera.orthographic)
			{
				Vector3 val = ((Component)camera).transform.InverseTransformPoint(p);
				float num = Mathf.Tan(camera.fieldOfView * ((float)Math.PI / 180f) * 0.5f) * val.z;
				return num * screensize / (float)camera.pixelHeight;
			}
			return camera.orthographicSize * screensize / (float)camera.pixelHeight;
		}

		private static float DistanceRayVsPoint(Ray mouseRay, Vector3 pos)
		{
			//IL_0001: 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)
			//IL_0009: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			Vector3 val = pos - ((Ray)(ref mouseRay)).origin;
			return Mathf.Sqrt(Vector3.Dot(val, val) - Vector3.Dot(((Ray)(ref mouseRay)).direction, val) * Vector3.Dot(((Ray)(ref mouseRay)).direction, val));
		}

		private static Vector3 IntersectPlane(Vector3 inNormal, Vector3 inPoint, Ray mouseRay)
		{
			//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)
			//IL_000e: 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_0022: 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_0036: 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_004b: 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)
			Plane val = default(Plane);
			((Plane)(ref val))..ctor(inNormal, inPoint);
			float distanceToPoint = ((Plane)(ref val)).GetDistanceToPoint(((Ray)(ref mouseRay)).origin);
			return ((Ray)(ref mouseRay)).origin + ((Ray)(ref mouseRay)).direction * (distanceToPoint / Vector3.Dot(-((Plane)(ref val)).normal, ((Ray)(ref mouseRay)).direction));
		}
	}

	public List<Vector3> m_WalkablePoint = new List<Vector3>();

	public float m_Height = 1f;

	public float m_Offset = 0f;

	public int m_MidLayerCount = 3;

	private List<GameObject> m_Child = new List<GameObject>();

	private void Awake()
	{
		SetMeshVisible(visible: false);
	}

	private void Reset()
	{
		Undo.RecordObject((Object)(object)this, "Reset");
		for (int i = 0; i < m_Child.Count; i++)
		{
			Undo.DestroyObjectImmediate((Object)(object)m_Child[i]);
		}
		m_Child.Clear();
	}

	private void SetMeshVisible(bool visible)
	{
		for (int i = 0; i < m_Child.Count; i++)
		{
			m_Child[i].SetActive(visible);
		}
	}

	public bool HasMesh()
	{
		return (m_Child.Count != 0) ? true : false;
	}

	public bool MeshVisible()
	{
		if (m_Child.Count > 0)
		{
			return m_Child[0].activeSelf;
		}
		return false;
	}

	private void Build()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		//IL_0083: 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_00a3: 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_00ba: 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->IL011c: Incompatible stack types: O vs I4
		//IL_0106->IL011c: Incompatible stack types: I4 vs O
		//IL_0106->IL011c: Incompatible stack types: O vs I4
		Mesh[] array = CreateMesh();
		Undo.RegisterCreatedObjectUndo((Object)(object)this, "build");
		for (int i = 0; i < array.Length || i == 0; i++)
		{
			GameObject val;
			if (i >= m_Child.Count)
			{
				val = new GameObject();
				((Object)val).name = ((Object)((Component)this).gameObject).name + "_Mesh(DontSave)";
				val.AddComponent<MeshFilter>();
				MeshRenderer val2 = val.AddComponent<MeshRenderer>();
				((Renderer)val2).sharedMaterial = AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat");
				val.transform.parent = ((Component)this).transform;
				val.transform.localScale = Vector3.one;
				val.transform.localPosition = Vector3.zero;
				val.transform.localRotation = Quaternion.identity;
				GameObjectUtility.SetStaticEditorFlags(val, (StaticEditorFlags)(GameObjectUtility.GetStaticEditorFlags(((Component)this).gameObject) | 8));
				GameObjectUtility.SetNavMeshArea(val, 1);
				m_Child.Add(val);
				Undo.RegisterCreatedObjectUndo((Object)(object)val, "");
			}
			else
			{
				val = m_Child[i].gameObject;
			}
			object obj = val;
			int num;
			if (i == 0)
			{
				num = 53;
				obj = num;
				num = (int)obj;
			}
			else
			{
				obj = ((Object)m_Child[0].gameObject).hideFlags;
				num = (int)obj;
			}
			((Object)num).hideFlags = (HideFlags)obj;
			MeshFilter component = m_Child[i].GetComponent<MeshFilter>();
			Undo.RecordObject((Object)(object)component, "MeshUpdate");
			component.sharedMesh = ((array.Length != 0) ? array[i] : null);
		}
		while (m_Child.Count > array.Length)
		{
			Undo.DestroyObjectImmediate((Object)(object)m_Child[m_Child.Count - 1]);
			m_Child.RemoveAt(m_Child.Count - 1);
		}
	}

	private static int Find(Vector3[] vtx, int left, int right, Vector3 v, float key)
	{
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		int num = (left + right) / 2;
		if (num == left)
		{
			for (int i = left; i < vtx.Length && vtx[i].x <= key + 0.002f; i++)
			{
				if (Vector3.Magnitude(vtx[i] - v) <= 0.01f)
				{
					return i;
				}
			}
			return -1;
		}
		if (key <= vtx[num].x)
		{
			return Find(vtx, left, num, v, key);
		}
		return Find(vtx, num, right, v, key);
	}

	private static bool Find(Edge[] edge, int left, int right, int i1, int i2)
	{
		int num = (left + right) / 2;
		if (num == left)
		{
			for (int j = left; j < edge.Length && edge[j].i1 <= i1; j++)
			{
				if (edge[j].i1 == i1 && edge[j].i2 == i2)
				{
					return true;
				}
			}
			return false;
		}
		if (i1 <= edge[num].i1)
		{
			return Find(edge, left, num, i1, i2);
		}
		return Find(edge, num, right, i1, i2);
	}

	private Mesh[] CreateMesh()
	{
		//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_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0716: Unknown result type (might be due to invalid IL or missing references)
		//IL_0721: Unknown result type (might be due to invalid IL or missing references)
		//IL_0726: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0618: Unknown result type (might be due to invalid IL or missing references)
		//IL_061d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0628: Unknown result type (might be due to invalid IL or missing references)
		//IL_062d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0632: Unknown result type (might be due to invalid IL or missing references)
		//IL_0757: Unknown result type (might be due to invalid IL or missing references)
		//IL_075c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0767: Unknown result type (might be due to invalid IL or missing references)
		//IL_076c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a42: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a73: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7f: Unknown result type (might be due to invalid IL or missing references)
		NavMeshTriangulation val = NavMesh.CalculateTriangulation();
		Vector3[] vertices = val.vertices;
		List<Vector3> list = new List<Vector3>();
		list.AddRange(vertices);
		list.Sort((Vector3 v1, Vector3 v2) => (v1.x == v2.x) ? ((v1.z != v2.z) ? ((!(v1.z < v2.z)) ? 1 : (-1)) : 0) : ((!(v1.x < v2.x)) ? 1 : (-1)));
		Vector3[] vtx = list.ToArray();
		int[] array = new int[val.vertices.Length];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = Find(vtx, 0, list.Count, vertices[i], vertices[i].x - 0.001f);
			if (i % 100 == 0)
			{
				EditorUtility.DisplayProgressBar($"Export Nav-Mesh (Phase #1/3) {i}/{array.Length}", "Weld Vertex", Mathf.InverseLerp(0f, (float)array.Length, (float)i));
			}
		}
		int[] indices = val.indices;
		List<Tri> list2 = new List<Tri>();
		for (int j = 0; j < indices.Length; j += 3)
		{
			list2.Add(new Tri(array[indices[j]], array[indices[j + 1]], array[indices[j + 2]]));
		}
		list2.Sort((Tri t1, Tri t2) => (t1.min != t2.min) ? ((t1.min >= t2.min) ? 1 : (-1)) : 0);
		int[] array2 = new int[(list2.Count + 127) / 128];
		int[] array3 = new int[array2.Length];
		int num = 0;
		int num2 = 0;
		while (num < list2.Count)
		{
			int num3 = list2[num].min;
			int num4 = list2[num].max;
			for (int k = 1; k < 128 && num + k < list2.Count; k++)
			{
				num3 = Mathf.Min(list2[num + k].min, num3);
				num4 = Mathf.Max(list2[num + k].max, num4);
			}
			array2[num2] = num3;
			array3[num2] = num4;
			num += 128;
			num2++;
		}
		int[] array4 = new int[indices.Length];
		for (int l = 0; l < array4.Length; l += 3)
		{
			array4[l] = list2[l / 3].i1;
			array4[l + 1] = list2[l / 3].i2;
			array4[l + 2] = list2[l / 3].i3;
		}
		List<int> list3 = new List<int>();
		List<int> list4 = new List<int>();
		int[] array5 = new int[array4.Length / 3];
		for (int m = 0; m < array4.Length; m += 3)
		{
			int num5 = -1;
			int num6 = Mathf.Max(new int[3]
			{
				array4[m],
				array4[m + 1],
				array4[m + 2]
			});
			int num7 = Mathf.Min(new int[3]
			{
				array4[m],
				array4[m + 1],
				array4[m + 2]
			});
			int num8 = 0;
			int num9 = 0;
			while (num8 < m)
			{
				if (array2[num9] <= num6 && array3[num9] >= num7)
				{
					for (int n = num8; n < m && n < num8 + 384 && list2[n / 3].min <= num6; n += 3)
					{
						if (list2[n / 3].max < num7 || list3[array5[n / 3]] == num5)
						{
							continue;
						}
						for (int num10 = 0; num10 < 3; num10++)
						{
							int num11 = array4[n + num10];
							if (array4[m] != num11 && array4[m + 1] != num11 && array4[m + 2] != num11)
							{
								continue;
							}
							if (num5 == -1)
							{
								num5 = list3[array5[n / 3]];
								array5[m / 3] = num5;
								break;
							}
							int num12 = list3[array5[n / 3]];
							for (int num13 = 0; num13 < list3.Count; num13++)
							{
								if (list3[num13] == num12)
								{
									list3[num13] = num5;
								}
							}
							break;
						}
					}
				}
				num8 += 384;
				num9++;
			}
			if (num5 == -1)
			{
				num5 = list3.Count;
				array5[m / 3] = num5;
				list3.Add(num5);
				list4.Add(0);
			}
			if (m / 3 % 100 == 0)
			{
				EditorUtility.DisplayProgressBar("Collect (Phase #2/3)", "Classification Group", Mathf.InverseLerp(0f, (float)array4.Length, (float)m));
			}
		}
		for (int num14 = 0; num14 < array4.Length; num14 += 3)
		{
			array5[num14 / 3] = list3[array5[num14 / 3]];
			list4[array5[num14 / 3]]++;
		}
		List<Mesh> list5 = new List<Mesh>();
		List<Vector3> list6 = new List<Vector3>();
		List<int> list7 = new List<int>();
		int[] array6 = new int[list.Count];
		for (int num15 = 0; num15 < array6.Length; num15++)
		{
			array6[num15] = -1;
		}
		Vector3[] points = m_WalkablePoint.ToArray();
		for (int num16 = 0; num16 < list4.Count; num16++)
		{
			if (list4[num16] == 0)
			{
				continue;
			}
			List<Vector3> list8 = new List<Vector3>();
			List<int> list9 = new List<int>();
			for (int num17 = 0; num17 < array4.Length; num17 += 3)
			{
				if (array5[num17 / 3] != num16)
				{
					continue;
				}
				for (int num18 = 0; num18 < 3; num18++)
				{
					int num19 = array4[num17 + num18];
					if (array6[num19] == -1)
					{
						array6[num19] = list8.Count;
						list8.Add(((Component)this).transform.InverseTransformPoint(list[num19] + Vector3.up * m_Offset));
					}
				}
				list9.Add(array6[array4[num17]]);
				list9.Add(array6[array4[num17 + 1]]);
				list9.Add(array6[array4[num17 + 2]]);
			}
			if (Contains(list8.ToArray(), list9.ToArray(), points))
			{
				continue;
			}
			int num20 = 32768;
			if (list6.Count > num20 || list6.Count + list8.Count * (2 + m_MidLayerCount) >= 65536)
			{
				list5.Add(CreateMesh(list6.ToArray(), list7.ToArray()));
				list6.Clear();
				list7.Clear();
			}
			Vector3 val2 = ((Component)this).transform.InverseTransformVector(Vector3.up * m_Height);
			int count = list6.Count;
			int num21 = 2 + m_MidLayerCount;
			for (int num22 = 0; num22 < list8.Count; num22++)
			{
				for (int num23 = 0; num23 < num21; num23++)
				{
					list6.Add(list8[num22] + val2 * ((float)num23 / (float)(num21 - 1)));
				}
			}
			for (int num24 = 0; num24 < list9.Count; num24 += 3)
			{
				for (int num25 = 0; num25 < num21; num25++)
				{
					if (num25 == 0)
					{
						list7.AddRange(new int[3]
						{
							count + list9[num24] * num21 + num25,
							count + list9[num24 + 2] * num21 + num25,
							count + list9[num24 + 1] * num21 + num25
						});
					}
					else
					{
						list7.AddRange(new int[3]
						{
							count + list9[num24] * num21 + num25,
							count + list9[num24 + 1] * num21 + num25,
							count + list9[num24 + 2] * num21 + num25
						});
					}
				}
			}
			if (m_Height > 0f)
			{
				List<Edge> list10 = new List<Edge>();
				for (int num26 = 0; num26 < list9.Count; num26 += 3)
				{
					list10.Add(new Edge(list9[num26], list9[num26 + 1]));
					list10.Add(new Edge(list9[num26 + 1], list9[num26 + 2]));
					list10.Add(new Edge(list9[num26 + 2], list9[num26]));
				}
				list10.Sort((Edge e1, Edge e2) => (e1.i1 != e2.i1) ? ((e1.i1 >= e2.i1) ? 1 : (-1)) : 0);
				Edge[] edge = list10.ToArray();
				for (int num27 = 0; num27 < list9.Count; num27 += 3)
				{
					int num28 = 2;
					int num29 = 0;
					while (num29 < 3)
					{
						int num30 = list9[num27 + num28];
						int num31 = list9[num27 + num29];
						if (!Find(edge, 0, list10.Count, num31, num30))
						{
							if (list6.Count + 4 >= 65536)
							{
								list5.Add(CreateMesh(list6.ToArray(), list7.ToArray()));
								list6.Clear();
								list7.Clear();
							}
							list7.AddRange(new int[6]
							{
								list6.Count,
								list6.Count + 1,
								list6.Count + 3,
								list6.Count,
								list6.Count + 3,
								list6.Count + 2
							});
							list6.AddRange((IEnumerable<Vector3>)(object)new Vector3[4]
							{
								list8[num30],
								list8[num31],
								list8[num30] + val2,
								list8[num31] + val2
							});
						}
						num28 = num29++;
					}
					if (num27 % 600 == 0)
					{
						EditorUtility.DisplayProgressBar("Collect (Phase #3/3)", "Create Mesh", Mathf.InverseLerp(0f, (float)(list4.Count * 100), (float)(num16 * 100 + num27 * 100 / (num27 - list9.Count))));
					}
				}
			}
			EditorUtility.DisplayProgressBar("Collect (Phase #3/3)", "Create Mesh", Mathf.InverseLerp(0f, (float)list4.Count, (float)num16));
		}
		if (list6.Count > 0)
		{
			list5.Add(CreateMesh(list6.ToArray(), list7.ToArray()));
		}
		EditorUtility.ClearProgressBar();
		return list5.ToArray();
	}

	private static Mesh CreateMesh(Vector3[] vtx, int[] indices)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		Mesh val = new Mesh();
		((Object)val).hideFlags = (HideFlags)52;
		val.vertices = vtx;
		val.SetIndices(indices, (MeshTopology)0, 0);
		val.RecalculateNormals();
		val.RecalculateBounds();
		return val;
	}

	private static bool Contains(Vector3[] vtx, int[] indices, Vector3[] points)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		foreach (Vector3 p in points)
		{
			for (int j = 0; j < indices.Length; j += 3)
			{
				if (indices[j] != indices[j + 1] && indices[j] != indices[j + 2] && indices[j + 1] != indices[j + 2] && PointInTriangle(vtx[indices[j]], vtx[indices[j + 2]], vtx[indices[j + 1]], p))
				{
					return true;
				}
			}
		}
		return false;
	}

	private static bool PointInTriangle(Vector3 v1, Vector3 v2, Vector3 v3, Vector3 p)
	{
		//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_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_000f: 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_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: 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_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_004b: 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_005d: 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)
		//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_006e: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = Vector3.Cross(v3 - v1, v2 - v1);
		if (Vector3.Dot(Vector3.Cross(p - v1, v2 - v1), val) > 0f && Vector3.Dot(Vector3.Cross(p - v2, v3 - v2), val) > 0f && Vector3.Dot(Vector3.Cross(p - v3, v1 - v3), val) > 0f)
		{
			return true;
		}
		return false;
	}
}
public class CuttableMesh
{
	private MeshRenderer inputMeshRenderer;

	private bool hasUvs;

	private bool hasUv1s;

	private bool hasColours;

	private List<CuttableSubMesh> subMeshes;

	public CuttableMesh(Mesh inputMesh)
	{
		Init(inputMesh, ((Object)inputMesh).name);
	}

	public CuttableMesh(MeshRenderer input)
	{
		inputMeshRenderer = input;
		MeshFilter component = ((Component)input).GetComponent<MeshFilter>();
		Mesh sharedMesh = component.sharedMesh;
		Init(sharedMesh, ((Object)input).name);
	}

	public CuttableMesh(CuttableMesh inputMesh, List<CuttableSubMesh> newSubMeshes)
	{
		inputMeshRenderer = inputMesh.inputMeshRenderer;
		hasUvs = inputMesh.hasUvs;
		hasUv1s = inputMesh.hasUv1s;
		hasColours = inputMesh.hasColours;
		subMeshes = new List<CuttableSubMesh>();
		subMeshes.AddRange(newSubMeshes);
	}

	private void Init(Mesh inputMesh, string debugName)
	{
		subMeshes = new List<CuttableSubMesh>();
		if (inputMesh.isReadable)
		{
			Vector3[] vertices = inputMesh.vertices;
			Vector3[] normals = inputMesh.normals;
			Vector2[] uv = inputMesh.uv;
			Vector2[] uv2 = inputMesh.uv2;
			Color32[] colors = inputMesh.colors32;
			hasUvs = uv != null && uv.Length > 0;
			hasUv1s = uv2 != null && uv2.Length > 0;
			hasColours = colors != null && colors.Length > 0;
			for (int i = 0; i < inputMesh.subMeshCount; i++)
			{
				int[] indices = inputMesh.GetIndices(i);
				CuttableSubMesh item = new CuttableSubMesh(indices, vertices, normals, colors, uv, uv2);
				subMeshes.Add(item);
			}
		}
		else
		{
			Debug.LogError((object)("CuttableMesh's input mesh is not readable: " + debugName), (Object)(object)inputMesh);
		}
	}

	public void Add(CuttableMesh other)
	{
		if (subMeshes.Count != other.subMeshes.Count)
		{
			throw new Exception("Mismatched submesh count");
		}
		for (int i = 0; i < subMeshes.Count; i++)
		{
			subMeshes[i].Add(other.subMeshes[i]);
		}
	}

	public int NumSubMeshes()
	{
		return subMeshes.Count;
	}

	public bool HasUvs()
	{
		return hasUvs;
	}

	public bool HasColours()
	{
		return hasColours;
	}

	public List<CuttableSubMesh> GetSubMeshes()
	{
		return subMeshes;
	}

	public CuttableSubMesh GetSubMesh(int index)
	{
		return subMeshes[index];
	}

	public Transform GetTransform()
	{
		if ((Object)(object)inputMeshRenderer != (Object)null)
		{
			return ((Component)inputMeshRenderer).transform;
		}
		return null;
	}

	public MeshRenderer ConvertToRenderer(string newObjectName)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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)
		Mesh val = CreateMesh();
		if (val.vertexCount == 0)
		{
			return null;
		}
		GameObject val2 = new GameObject(newObjectName);
		val2.transform.SetParent(((Component)inputMeshRenderer).transform);
		val2.transform.localPosition = Vector3.zero;
		val2.transform.localRotation = Quaternion.identity;
		val2.transform.localScale = Vector3.one;
		MeshFilter val3 = val2.AddComponent<MeshFilter>();
		val3.mesh = val;
		MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
		((Renderer)val4).shadowCastingMode = ((Renderer)inputMeshRenderer).shadowCastingMode;
		((Renderer)val4).reflectionProbeUsage = ((Renderer)inputMeshRenderer).reflectionProbeUsage;
		((Renderer)val4).lightProbeUsage = ((Renderer)inputMeshRenderer).lightProbeUsage;
		((Renderer)val4).sharedMaterials = ((Renderer)inputMeshRenderer).sharedMaterials;
		return val4;
	}

	public Mesh CreateMesh()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		Mesh val = new Mesh();
		int num = 0;
		for (int i = 0; i < subMeshes.Count; i++)
		{
			num += subMeshes[i].NumIndices();
		}
		List<Vector3> list = new List<Vector3>();
		List<Vector3> list2 = new List<Vector3>();
		List<Color32> list3 = ((!hasColours) ? null : new List<Color32>());
		List<Vector2> list4 = ((!hasUvs) ? null : new List<Vector2>());
		List<Vector2> list5 = ((!hasUv1s) ? null : new List<Vector2>());
		List<int> list6 = new List<int>();
		foreach (CuttableSubMesh subMesh in subMeshes)
		{
			list6.Add(list.Count);
			subMesh.AddTo(list, list2, list3, list4, list5);
		}
		val.vertices = list.ToArray();
		val.normals = list2.ToArray();
		val.colors32 = ((!hasColours) ? null : list3.ToArray());
		val.uv = ((!hasUvs) ? null : list4.ToArray());
		val.uv2 = ((!hasUv1s) ? null : list5.ToArray());
		val.subMeshCount = subMeshes.Count;
		for (int j = 0; j < subMeshes.Count; j++)
		{
			CuttableSubMesh cuttableSubMesh = subMeshes[j];
			int num2 = list6[j];
			int[] array = cuttableSubMesh.GenIndices();
			for (int k = 0; k < array.Length; k++)
			{
				array[k] += num2;
			}
			val.SetTriangles(array, j, true);
		}
		return val;
	}
}
public class CuttableSubMesh
{
	private List<Vector3> vertices;

	private List<Vector3> normals;

	private List<Color32> colours;

	private List<Vector2> uvs;

	private List<Vector2> uv1s;

	public CuttableSubMesh(bool hasNormals, bool hasColours, bool hasUvs, bool hasUv1)
	{
		vertices = new List<Vector3>();
		if (hasNormals)
		{
			normals = new List<Vector3>();
		}
		if (hasColours)
		{
			colours = new List<Color32>();
		}
		if (hasUvs)
		{
			uvs = new List<Vector2>();
		}
		if (hasUv1)
		{
			uv1s = new List<Vector2>();
		}
	}

	public CuttableSubMesh(int[] indices, Vector3[] inputVertices, Vector3[] inputNormals, Color32[] inputColours, Vector2[] inputUvs, Vector2[] inputUv1)
	{
		//IL_0099: 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)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		vertices = new List<Vector3>();
		if (inputNormals != null && inputNormals.Length > 0)
		{
			normals = new List<Vector3>();
		}
		if (inputColours != null && inputColours.Length > 0)
		{
			colours = new List<Color32>();
		}
		if (inputUvs != null && inputUvs.Length > 0)
		{
			uvs = new List<Vector2>();
		}
		if (inputUv1 != null && inputUv1.Length > 0)
		{
			uv1s = new List<Vector2>();
		}
		foreach (int num in indices)
		{
			vertices.Add(inputVertices[num]);
			if (normals != null)
			{
				normals.Add(inputNormals[num]);
			}
			if (colours != null)
			{
				colours.Add(inputColours[num]);
			}
			if (uvs != null)
			{
				uvs.Add(inputUvs[num]);
			}
			if (uv1s != null)
			{
				uv1s.Add(inputUv1[num]);
			}
		}
	}

	public void Add(CuttableSubMesh other)
	{
		for (int i = 0; i < other.vertices.Count; i++)
		{
			CopyVertex(i, other);
		}
	}

	public int NumVertices()
	{
		return vertices.Count;
	}

	public Vector3 GetVertex(int index)
	{
		//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_0013: Unknown result type (might be due to invalid IL or missing references)
		return vertices[index];
	}

	public bool HasNormals()
	{
		return normals != null;
	}

	public bool HasColours()
	{
		return colours != null;
	}

	public bool HasUvs()
	{
		return uvs != null;
	}

	public bool HasUv1()
	{
		return uv1s != null;
	}

	public void CopyVertex(int srcIndex, CuttableSubMesh srcMesh)
	{
		//IL_000e: 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_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		vertices.Add(srcMesh.vertices[srcIndex]);
		if (normals != null)
		{
			normals.Add(srcMesh.normals[srcIndex]);
		}
		if (colours != null)
		{
			colours.Add(srcMesh.colours[srcIndex]);
		}
		if (uvs != null)
		{
			uvs.Add(srcMesh.uvs[srcIndex]);
		}
		if (uv1s != null)
		{
			uv1s.Add(srcMesh.uv1s[srcIndex]);
		}
	}

	public void AddInterpolatedVertex(int i0, int i1, float weight, CuttableSubMesh srcMesh)
	{
		//IL_0004: 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_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: 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_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: 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_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: 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_00c6: 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_00f6: 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)
		Vector3 vertex = srcMesh.GetVertex(i0);
		Vector3 vertex2 = srcMesh.GetVertex(i1);
		vertices.Add(Vector3.Lerp(vertex, vertex2, weight));
		if (normals != null)
		{
			List<Vector3> list = normals;
			Vector3 val = Vector3.Lerp(srcMesh.normals[i0], srcMesh.normals[i1], weight);
			list.Add(((Vector3)(ref val)).normalized);
		}
		if (colours != null)
		{
			colours.Add(Color32.Lerp(srcMesh.colours[i0], srcMesh.colours[i1], weight));
		}
		if (uvs != null)
		{
			uvs.Add(Vector2.Lerp(srcMesh.uvs[i0], srcMesh.uvs[i1], weight));
		}
		if (uv1s != null)
		{
			uv1s.Add(Vector2.Lerp(srcMesh.uv1s[i0], srcMesh.uv1s[i1], weight));
		}
	}

	public void AddTo(List<Vector3> destVertices, List<Vector3> destNormals, List<Color32> destColours, List<Vector2> destUvs, List<Vector2> destUv1s)
	{
		destVertices.AddRange(vertices);
		if (normals != null)
		{
			destNormals.AddRange(normals);
		}
		if (colours != null)
		{
			destColours.AddRange(colours);
		}
		if (uvs != null)
		{
			destUvs.AddRange(uvs);
		}
		if (uv1s != null)
		{
			destUv1s.AddRange(uv1s);
		}
	}

	public int NumIndices()
	{
		return vertices.Count;
	}

	public int[] GenIndices()
	{
		int[] array = new int[vertices.Count];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = i;
		}
		return array;
	}
}
public enum VertexClassification
{
	Front = 1,
	Back = 2,
	OnPlane = 4
}
public class MeshCutter
{
	private CuttableMesh inputMesh;

	private List<CuttableSubMesh> outputFrontSubMeshes;

	private List<CuttableSubMesh> outputBackSubMeshes;

	public void Cut(CuttableMesh input, Plane worldCutPlane)
	{
		//IL_0067: 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_0038: 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_0048: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		inputMesh = input;
		outputFrontSubMeshes = new List<CuttableSubMesh>();
		outputBackSubMeshes = new List<CuttableSubMesh>();
		Transform transform = inputMesh.GetTransform();
		Plane cutPlane = default(Plane);
		if ((Object)(object)transform != (Object)null)
		{
			Vector3 val = transform.InverseTransformPoint(ClosestPointOnPlane(worldCutPlane, Vector3.zero));
			Vector3 val2 = transform.InverseTransformDirection(((Plane)(ref worldCutPlane)).normal);
			((Plane)(ref cutPlane))..ctor(val2, val);
		}
		else
		{
			cutPlane = worldCutPlane;
		}
		foreach (CuttableSubMesh subMesh in input.GetSubMeshes())
		{
			Cut(subMesh, cutPlane);
		}
	}

	private static Vector3 ClosestPointOnPlane(Plane plane, Vector3 point)
	{
		//IL_0003: 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_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: 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_002b: 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)
		float distanceToPoint = ((Plane)(ref plane)).GetDistanceToPoint(point);
		if (((Plane)(ref plane)).GetSide(point))
		{
			return point - ((Plane)(ref plane)).normal * distanceToPoint;
		}
		return point + ((Plane)(ref plane)).normal * distanceToPoint;
	}

	public CuttableMesh GetFrontOutput()
	{
		return new CuttableMesh(inputMesh, outputFrontSubMeshes);
	}

	public CuttableMesh GetBackOutput()
	{
		return new CuttableMesh(inputMesh, outputBackSubMeshes);
	}

	private void Cut(CuttableSubMesh inputSubMesh, Plane cutPlane)
	{
		//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_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_006b: 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_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: 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_0248: Unknown result type (might be due to invalid IL or missing references)
		bool hasNormals = inputSubMesh.HasNormals();
		bool hasColours = inputSubMesh.HasColours();
		bool hasUvs = inputSubMesh.HasUvs();
		bool hasUv = inputSubMesh.HasUv1();
		CuttableSubMesh cuttableSubMesh = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv);
		CuttableSubMesh cuttableSubMesh2 = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv);
		for (int i = 0; i < inputSubMesh.NumVertices(); i += 3)
		{
			int num = i;
			int num2 = i + 1;
			int num3 = i + 2;
			Vector3 vertex = inputSubMesh.GetVertex(num);
			Vector3 vertex2 = inputSubMesh.GetVertex(num2);
			Vector3 vertex3 = inputSubMesh.GetVertex(num3);
			VertexClassification vertexClassification = Classify(vertex, cutPlane);
			VertexClassification vertexClassification2 = Classify(vertex2, cutPlane);
			VertexClassification vertexClassification3 = Classify(vertex3, cutPlane);
			int numFront = 0;
			int numBehind = 0;
			CountSides(vertexClassification, ref numFront, ref numBehind);
			CountSides(vertexClassification2, ref numFront, ref numBehind);
			CountSides(vertexClassification3, ref numFront, ref numBehind);
			if (numFront > 0 && numBehind == 0)
			{
				KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh);
			}
			else if (numFront == 0 && numBehind > 0)
			{
				KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2);
			}
			else if (numFront == 2 && numBehind == 1)
			{
				if (vertexClassification == VertexClassification.Back)
				{
					SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
				}
				else if (vertexClassification2 == VertexClassification.Back)
				{
					SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
				}
				else
				{
					SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh);
				}
			}
			else if (numFront == 1 && numBehind == 2)
			{
				if (vertexClassification == VertexClassification.Front)
				{
					SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
				}
				else if (vertexClassification2 == VertexClassification.Front)
				{
					SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
				}
				else
				{
					SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
				}
			}
			else if (numFront == 1 && numBehind == 1)
			{
				if (vertexClassification == VertexClassification.OnPlane)
				{
					if (vertexClassification3 == VertexClassification.Front)
					{
						SplitB(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
					}
					else
					{
						SplitBFlipped(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2);
					}
					continu