Decompiled source of Admin menukz v1.0.0

Admin_menukz.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Admin_menukz
{
	[BepInPlugin("com.kz.Admin_menukz", "Admin_menukz", "1.0.0")]
	public class AdminMenuPlugin : BaseUnityPlugin
	{
		public enum ThirdPersonCameraMode
		{
			Standard,
			FreeLook
		}

		internal static ManualLogSource Log;

		private Harmony _harmony;

		private bool _showMenu;

		private Rect _menuRect = new Rect(50f, 50f, 400f, 560f);

		private Vector2 _scrollPos = Vector2.zero;

		private Vector2 _teleportScrollPos = Vector2.zero;

		private string _statusMessage = "";

		private float _statusClearTime;

		private int _currentTab;

		private readonly string[] _tabTitles = new string[4] { "\ud83c\udf00 Teleport", "\ud83d\udee0 Utilidades", "⚡ Cheats", "\ud83e\udd16 Bots" };

		internal static readonly List<SpawnedBot> SpawnedBots = new List<SpawnedBot>();

		private int _botCounter;

		private const int MAX_BOTS = 100;

		private GUIStyle _headerStyle;

		private GUIStyle _boxStyle;

		private GUIStyle _buttonStyle;

		private GUIStyle _smallButtonStyle;

		private GUIStyle _labelStyle;

		private GUIStyle _statusStyle;

		private GUIStyle _toggleStyle;

		private GUIStyle _tabButtonStyle;

		private bool _stylesInitialized;

		private Texture2D _bgTex;

		private Texture2D _btnTex;

		private Texture2D _btnHoverTex;

		private Texture2D _redBtnTex;

		private Texture2D _redBtnHoverTex;

		private Texture2D _toggleOnTex;

		private Texture2D _toggleOffTex;

		private Texture2D _tabActiveTex;

		private Texture2D _tabInactiveTex;

		public static bool IsMenuOpen { get; private set; } = false;

		public static bool IsSpawningBot { get; private set; } = false;

		public static string NextBotName { get; set; } = "Bot1";

		public static bool ThirdPersonEnabled { get; set; } = false;

		public static ThirdPersonCameraMode CameraMode { get; set; } = ThirdPersonCameraMode.Standard;

		public static float ThirdPersonDistance { get; set; } = 6f;

		public static float ThirdPersonHeight { get; set; } = 0.25f;

		public static float ThirdPersonSide { get; set; } = 0f;

		public static float ThirdPersonSmoothSpeed { get; set; } = 35f;

		public static KeyCode ThirdPersonToggleKey { get; set; } = (KeyCode)285;

		public static float OrbitYaw { get; set; } = 0f;

		public static float OrbitPitch { get; set; } = 15f;

		public static bool CheatFly { get; set; } = false;

		public static bool CheatSuperJump { get; set; } = false;

		public static bool CheatNoFallDamage { get; set; } = false;

		public static bool CheatInfiniteStamina { get; set; } = false;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("com.kz.Admin_menukz");
			_harmony.PatchAll(typeof(CharacterNamePatch));
			_harmony.PatchAll(typeof(AdminMenuInputPatches));
			_harmony.PatchAll(typeof(AdminCheatPatches));
			_harmony.PatchAll(typeof(NativeNameSystemPatches));
			_harmony.PatchAll(typeof(PlayerDetectionPatches));
			_harmony.PatchAll(typeof(ThirdPersonCameraPatches));
			_harmony.PatchAll(typeof(CampfireBotCompatibilityPatches));
			Log.LogInfo((object)"[Admin_menukz] Plugin loaded! Press F5 for Admin Menu, F4 for 3rd Person Camera.");
		}

		private void Update()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(ThirdPersonToggleKey))
			{
				ThirdPersonEnabled = !ThirdPersonEnabled;
				SetStatus(ThirdPersonEnabled ? "<color=#88FF88>Cámara 3ra Persona: ACTIVADA</color>" : "<color=#FF8888>Cámara 3ra Persona: DESACTIVADA</color>");
			}
			if (Input.GetKeyDown((KeyCode)286))
			{
				_showMenu = !_showMenu;
				IsMenuOpen = _showMenu;
				if (_showMenu)
				{
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
				}
			}
			if (_statusClearTime > 0f && Time.time >= _statusClearTime)
			{
				_statusMessage = "";
				_statusClearTime = 0f;
			}
			SpawnedBots.RemoveAll((SpawnedBot b) => (Object)(object)b.BotObject == (Object)null);
			HandleInfiniteStaminaCheat();
			HandleNoFallDamageCheat();
			HandleFlyCheat();
		}

		private void LateUpdate()
		{
			if (_showMenu)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		private void OnDestroy()
		{
			RemoveAllBots();
			try
			{
				Harmony harmony = _harmony;
				if (harmony != null)
				{
					harmony.UnpatchSelf();
				}
			}
			catch
			{
			}
			if ((Object)(object)_bgTex != (Object)null)
			{
				Object.Destroy((Object)(object)_bgTex);
			}
			if ((Object)(object)_btnTex != (Object)null)
			{
				Object.Destroy((Object)(object)_btnTex);
			}
			if ((Object)(object)_btnHoverTex != (Object)null)
			{
				Object.Destroy((Object)(object)_btnHoverTex);
			}
			if ((Object)(object)_redBtnTex != (Object)null)
			{
				Object.Destroy((Object)(object)_redBtnTex);
			}
			if ((Object)(object)_redBtnHoverTex != (Object)null)
			{
				Object.Destroy((Object)(object)_redBtnHoverTex);
			}
			if ((Object)(object)_toggleOnTex != (Object)null)
			{
				Object.Destroy((Object)(object)_toggleOnTex);
			}
			if ((Object)(object)_toggleOffTex != (Object)null)
			{
				Object.Destroy((Object)(object)_toggleOffTex);
			}
			if ((Object)(object)_tabActiveTex != (Object)null)
			{
				Object.Destroy((Object)(object)_tabActiveTex);
			}
			if ((Object)(object)_tabInactiveTex != (Object)null)
			{
				Object.Destroy((Object)(object)_tabInactiveTex);
			}
		}

		private void HandleInfiniteStaminaCheat()
		{
			if (CheatInfiniteStamina)
			{
				Character realLocalPlayer = GetRealLocalPlayer();
				if ((Object)(object)realLocalPlayer != (Object)null && (Object)(object)realLocalPlayer.data != (Object)null)
				{
					realLocalPlayer.infiniteStam = true;
					realLocalPlayer.data.currentStamina = 1f;
					realLocalPlayer.data.extraStamina = 1f;
				}
			}
		}

		private void HandleNoFallDamageCheat()
		{
			if (!CheatNoFallDamage)
			{
				return;
			}
			Character realLocalPlayer = GetRealLocalPlayer();
			if ((Object)(object)realLocalPlayer != (Object)null)
			{
				realLocalPlayer.data.fallSeconds = 0f;
				if (realLocalPlayer.refs != null && (Object)(object)realLocalPlayer.refs.afflictions != (Object)null)
				{
					realLocalPlayer.refs.afflictions.SetStatus((STATUSTYPE)0, 0f, false);
				}
			}
		}

		private void HandleFlyCheat()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_0148: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			if (!CheatFly)
			{
				return;
			}
			Character realLocalPlayer = GetRealLocalPlayer();
			if ((Object)(object)realLocalPlayer == (Object)null || realLocalPlayer.refs == null || (Object)(object)realLocalPlayer.refs.ragdoll == (Object)null)
			{
				return;
			}
			realLocalPlayer.data.fallSeconds = 0f;
			realLocalPlayer.data.sinceGrounded = 0f;
			Transform obj = (((Object)(object)MainCamera.instance != (Object)null) ? ((Component)MainCamera.instance).transform : (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform : ((Component)realLocalPlayer).transform));
			Vector3 forward = obj.forward;
			Vector3 right = obj.right;
			Vector3 val = Vector3.zero;
			if (!IsMenuOpen)
			{
				if (Input.GetKey((KeyCode)119))
				{
					val += forward;
				}
				if (Input.GetKey((KeyCode)115))
				{
					val -= forward;
				}
				if (Input.GetKey((KeyCode)100))
				{
					val += right;
				}
				if (Input.GetKey((KeyCode)97))
				{
					val -= right;
				}
				if (Input.GetKey((KeyCode)32))
				{
					val += Vector3.up;
				}
				if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)99))
				{
					val -= Vector3.up;
				}
			}
			float num = (Input.GetKey((KeyCode)304) ? 28f : 12f);
			Vector3 val2 = ((Vector3)(ref val)).normalized * (num * Time.deltaTime);
			realLocalPlayer.refs.ragdoll.MoveAllRigsInDirection(val2);
			realLocalPlayer.refs.ragdoll.HaltBodyVelocity(false);
		}

		private void OnGUI()
		{
			//IL_0016: 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_0037: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if (_showMenu)
			{
				InitStyles();
				_menuRect = GUI.Window(556677, _menuRect, new WindowFunction(DrawMenuWindow), "", _boxStyle);
			}
		}

		private void InitStyles()
		{
			//IL_0027: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: 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_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Expected O, but got Unknown
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Expected O, but got Unknown
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Expected O, but got Unknown
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Expected O, but got Unknown
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Expected O, but got Unknown
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			if (!_stylesInitialized)
			{
				_stylesInitialized = true;
				_bgTex = MakeTex(2, 2, new Color(0.08f, 0.08f, 0.12f, 0.96f));
				_btnTex = MakeTex(2, 2, new Color(0.18f, 0.45f, 0.85f, 1f));
				_btnHoverTex = MakeTex(2, 2, new Color(0.25f, 0.55f, 0.95f, 1f));
				_redBtnTex = MakeTex(2, 2, new Color(0.75f, 0.15f, 0.15f, 1f));
				_redBtnHoverTex = MakeTex(2, 2, new Color(0.9f, 0.2f, 0.2f, 1f));
				_toggleOnTex = MakeTex(2, 2, new Color(0.2f, 0.7f, 0.3f, 1f));
				_toggleOffTex = MakeTex(2, 2, new Color(0.25f, 0.25f, 0.35f, 1f));
				_tabActiveTex = MakeTex(2, 2, new Color(0.2f, 0.5f, 0.9f, 1f));
				_tabInactiveTex = MakeTex(2, 2, new Color(0.15f, 0.15f, 0.22f, 1f));
				_boxStyle = new GUIStyle(GUI.skin.window);
				_boxStyle.normal.background = _bgTex;
				_boxStyle.onNormal.background = _bgTex;
				_boxStyle.padding = new RectOffset(12, 12, 12, 12);
				_headerStyle = new GUIStyle(GUI.skin.label);
				_headerStyle.fontSize = 18;
				_headerStyle.fontStyle = (FontStyle)1;
				_headerStyle.normal.textColor = new Color(0.4f, 0.8f, 1f);
				_headerStyle.alignment = (TextAnchor)4;
				_buttonStyle = new GUIStyle(GUI.skin.button);
				_buttonStyle.fontSize = 14;
				_buttonStyle.fontStyle = (FontStyle)1;
				_buttonStyle.normal.background = _btnTex;
				_buttonStyle.normal.textColor = Color.white;
				_buttonStyle.hover.background = _btnHoverTex;
				_buttonStyle.hover.textColor = Color.white;
				_buttonStyle.active.background = _btnHoverTex;
				_buttonStyle.active.textColor = Color.yellow;
				_buttonStyle.border = new RectOffset(4, 4, 4, 4);
				_smallButtonStyle = new GUIStyle(_buttonStyle);
				_smallButtonStyle.fontSize = 11;
				_smallButtonStyle.normal.background = _redBtnTex;
				_smallButtonStyle.hover.background = _redBtnHoverTex;
				_labelStyle = new GUIStyle(GUI.skin.label);
				_labelStyle.fontSize = 13;
				_labelStyle.normal.textColor = new Color(0.85f, 0.85f, 0.9f);
				_labelStyle.richText = true;
				_statusStyle = new GUIStyle(GUI.skin.label);
				_statusStyle.fontSize = 12;
				_statusStyle.normal.textColor = new Color(0.3f, 1f, 0.4f);
				_statusStyle.alignment = (TextAnchor)4;
				_statusStyle.richText = true;
				_toggleStyle = new GUIStyle(GUI.skin.toggle);
				_toggleStyle.fontSize = 14;
				_toggleStyle.fontStyle = (FontStyle)1;
				_toggleStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f);
				_toggleStyle.onNormal.textColor = new Color(0.4f, 1f, 0.5f);
				_toggleStyle.margin = new RectOffset(4, 4, 6, 6);
				_tabButtonStyle = new GUIStyle(GUI.skin.button);
				_tabButtonStyle.fontSize = 12;
				_tabButtonStyle.fontStyle = (FontStyle)1;
				_tabButtonStyle.normal.background = _tabInactiveTex;
				_tabButtonStyle.normal.textColor = new Color(0.7f, 0.7f, 0.8f);
				_tabButtonStyle.onNormal.background = _tabActiveTex;
				_tabButtonStyle.onNormal.textColor = Color.white;
			}
		}

		private void DrawMenuWindow(int windowID)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Space(5f);
			GUILayout.Label("⚙ ADMIN MENU KZ ⚙", _headerStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < _tabTitles.Length; i++)
			{
				GUI.backgroundColor = ((_currentTab == i) ? new Color(0.3f, 0.65f, 1f) : new Color(0.2f, 0.2f, 0.3f));
				if (GUILayout.Button(_tabTitles[i], _tabButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
				{
					_currentTab = i;
				}
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.Space(6f);
			DrawSeparator();
			if (!string.IsNullOrEmpty(_statusMessage))
			{
				GUILayout.Label(_statusMessage, _statusStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Space(3f);
			}
			switch (_currentTab)
			{
			case 0:
				DrawTeleportTab();
				break;
			case 1:
				DrawUtilitiesTab();
				break;
			case 2:
				DrawCheatsTab();
				break;
			case 3:
				DrawBotsTab();
				break;
			}
			GUILayout.Space(10f);
			DrawSeparator();
			GUILayout.Label("<color=#666677><size=10>Presiona F5 para cerrar | Admin_menukz v1.0.0</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUI.DragWindow();
		}

		public static List<Character> GetAvailableTeleportTargets()
		{
			List<Character> list = new List<Character>();
			Character realLocalPlayer = GetRealLocalPlayer();
			if (Character.AllCharacters != null)
			{
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if ((Object)(object)allCharacter != (Object)null && (Object)(object)((Component)allCharacter).gameObject != (Object)null && (Object)(object)allCharacter != (Object)(object)realLocalPlayer && !list.Contains(allCharacter))
					{
						list.Add(allCharacter);
					}
				}
			}
			return list;
		}

		private void DrawTeleportTab()
		{
			//IL_0154: 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_0171: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<b>\ud83c\udf00 TELETRANSPORTE DE JUGADORES:</b>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			if (!PhotonNetwork.InRoom)
			{
				GUILayout.Label("<color=#FF6666><b>⚠ Debes estar en una partida para usar el teletransporte.</b></color>", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Space(10f);
				return;
			}
			Character realLocalPlayer = GetRealLocalPlayer();
			if ((Object)(object)realLocalPlayer == (Object)null)
			{
				GUILayout.Label("<color=#FFBB66>Esperando a que cargue tu personaje...</color>", _labelStyle, Array.Empty<GUILayoutOption>());
				return;
			}
			List<Character> availableTeleportTargets = GetAvailableTeleportTargets();
			GUI.enabled = availableTeleportTargets.Count > 0;
			if (GUILayout.Button("\ud83c\udf00  Traer a TODOS hacia mí", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) }))
			{
				TeleportAllToMe(realLocalPlayer, availableTeleportTargets);
			}
			GUI.enabled = true;
			GUILayout.Space(8f);
			DrawSeparator();
			GUILayout.Label($"<b>Jugadores y Bots disponibles ({availableTeleportTargets.Count}):</b>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			if (availableTeleportTargets.Count == 0)
			{
				GUILayout.Space(15f);
				GUILayout.Label("<color=#888899><size=12>No hay otros jugadores ni bots en la partida actualmente.</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Space(8f);
				if (GUILayout.Button("\ud83e\udd16 Ir a la pestaña de Bots para spawnear", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
				{
					_currentTab = 3;
				}
				return;
			}
			_teleportScrollPos = GUILayout.BeginScrollView(_teleportScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(220f) });
			foreach (Character item in availableTeleportTargets)
			{
				if ((Object)(object)item == (Object)null || (Object)(object)((Component)item).gameObject == (Object)null)
				{
					continue;
				}
				string characterName = item.characterName;
				int num;
				object obj;
				if (!item.isBot)
				{
					num = (((Object)(object)((Component)item).GetComponent<AdminBotMarker>() != (Object)null) ? 1 : 0);
					if (num == 0)
					{
						obj = "\ud83d\udc64";
						goto IL_01d5;
					}
				}
				else
				{
					num = 1;
				}
				obj = "\ud83e\udd16";
				goto IL_01d5;
				IL_01d5:
				string text = (string)obj;
				string text2 = ((num != 0) ? "Bot" : "Jugador");
				float num2 = Vector3.Distance(realLocalPlayer.Center, item.Center);
				GUILayout.BeginVertical(_boxStyle, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(text + " <b>" + characterName + "</b> <color=#888899>(" + text2 + ")</color>", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
				GUILayout.Label($"<color=#99BBFF>{num2:F0} m</color>", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) });
				GUILayout.EndHorizontal();
				GUILayout.Space(2f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				if (GUILayout.Button("\ud83d\ude80 Ir hacia él/ella", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					TeleportMeTo(realLocalPlayer, item);
				}
				if (GUILayout.Button("\ud83e\uddf2 Traer hacia mí", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					TeleportTargetToMe(realLocalPlayer, item);
				}
				GUILayout.EndHorizontal();
				GUILayout.EndVertical();
				GUILayout.Space(3f);
			}
			GUILayout.EndScrollView();
		}

		private void TeleportMeTo(Character localPlayer, Character target)
		{
			//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_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)target == (Object)null))
				{
					Vector3 val = target.Center + Vector3.up * 0.8f + ((Component)target).transform.forward * -0.6f;
					((MonoBehaviourPun)localPlayer).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
					SetStatus("<color=#88FF88>✓ Teletransportado hacia " + target.characterName + "</color>");
					Log.LogInfo((object)$"[Admin_menukz] Teleported local player to {target.characterName} at {val}");
				}
			}
			catch (Exception ex)
			{
				Log.LogError((object)$"[Admin_menukz] Error teleporting to target: {ex}");
				SetStatus("<color=#FF6666>Error al teletransportar: " + ex.Message + "</color>");
			}
		}

		private void TeleportTargetToMe(Character localPlayer, Character target)
		{
			//IL_0018: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Object)(object)localPlayer == (Object)null) && !((Object)(object)target == (Object)null))
				{
					Vector3 val = localPlayer.Center + ((Component)localPlayer).transform.forward * 1.5f + Vector3.up * 0.8f;
					((MonoBehaviourPun)target).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
					SetStatus("<color=#88FF88>✓ " + target.characterName + " traído hacia ti</color>");
					Log.LogInfo((object)$"[Admin_menukz] Teleported {target.characterName} to local player at {val}");
				}
			}
			catch (Exception ex)
			{
				Log.LogError((object)$"[Admin_menukz] Error teleporting target to me: {ex}");
				SetStatus("<color=#FF6666>Error al traer jugador: " + ex.Message + "</color>");
			}
		}

		private void TeleportAllToMe(Character localPlayer, List<Character> targets)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)localPlayer == (Object)null || targets == null || targets.Count == 0)
				{
					return;
				}
				int count = targets.Count;
				for (int i = 0; i < count; i++)
				{
					Character val = targets[i];
					if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null))
					{
						float num = (float)i * (360f / (float)Mathf.Max(1, count)) * ((float)Math.PI / 180f);
						Vector3 val2 = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * 2f + Vector3.up * 0.8f;
						Vector3 val3 = localPlayer.Center + val2;
						((MonoBehaviourPun)val).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val3, true });
					}
				}
				SetStatus($"<color=#88FF88>✓ {count} jugadores y bots traídos hacia ti</color>");
				Log.LogInfo((object)$"[Admin_menukz] Teleported all {count} targets to local player.");
			}
			catch (Exception ex)
			{
				Log.LogError((object)$"[Admin_menukz] Error teleporting all targets to me: {ex}");
				SetStatus("<color=#FF6666>Error al traer a todos: " + ex.Message + "</color>");
			}
		}

		private void DrawUtilitiesTab()
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("<b>UTILIDADES Y JUGABILIDAD:</b>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			bool thirdPersonEnabled = ThirdPersonEnabled;
			ThirdPersonEnabled = GUILayout.Toggle(ThirdPersonEnabled, "  \ud83c\udfa5  Cámara en 3ra Persona (F4)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (thirdPersonEnabled != ThirdPersonEnabled)
			{
				SetStatus(ThirdPersonEnabled ? "<color=#88FF88>3ra Persona activada (F4)</color>" : "<color=#FF8888>3ra Persona desactivada</color>");
				if (ThirdPersonEnabled)
				{
					Character realLocalPlayer = GetRealLocalPlayer();
					if ((Object)(object)realLocalPlayer != (Object)null)
					{
						OrbitYaw = realLocalPlayer.data.lookValues.x;
						OrbitPitch = 0f - realLocalPlayer.data.lookValues.y;
					}
				}
			}
			if (ThirdPersonEnabled)
			{
				GUILayout.Space(4f);
				GUILayout.BeginVertical(_boxStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Label("<b>Tipo de Cámara:</b>", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				bool num = CameraMode == ThirdPersonCameraMode.Standard;
				bool flag = CameraMode == ThirdPersonCameraMode.FreeLook;
				GUI.backgroundColor = (num ? new Color(0.25f, 0.65f, 1f) : new Color(0.2f, 0.2f, 0.25f));
				if (GUILayout.Button(num ? "● \ud83c\udfaf Estándar (Fija)" : "  \ud83c\udfaf Estándar (Fija)", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
				{
					CameraMode = ThirdPersonCameraMode.Standard;
					Character realLocalPlayer2 = GetRealLocalPlayer();
					if ((Object)(object)realLocalPlayer2 != (Object)null && (Object)(object)realLocalPlayer2.data != (Object)null)
					{
						realLocalPlayer2.data.lookValues.x = OrbitYaw;
						realLocalPlayer2.data.lookValues.y = 0f - OrbitPitch;
						ThirdPersonCameraPatches.RecalculateLook(realLocalPlayer2);
					}
				}
				GUI.backgroundColor = (flag ? new Color(0.25f, 0.65f, 1f) : new Color(0.2f, 0.2f, 0.25f));
				if (GUILayout.Button(flag ? "● \ud83c\udf10 Orbital Libre" : "  \ud83c\udf10 Orbital Libre", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
				{
					CameraMode = ThirdPersonCameraMode.FreeLook;
					Character realLocalPlayer3 = GetRealLocalPlayer();
					if ((Object)(object)realLocalPlayer3 != (Object)null && (Object)(object)realLocalPlayer3.data != (Object)null)
					{
						OrbitYaw = realLocalPlayer3.data.lookValues.x;
						OrbitPitch = 0f - realLocalPlayer3.data.lookValues.y;
					}
				}
				GUI.backgroundColor = Color.white;
				GUILayout.EndHorizontal();
				if (CameraMode == ThirdPersonCameraMode.FreeLook)
				{
					GUILayout.Label("<color=#99FFBB><size=11>\ud83c\udf10 Modo Orbital Libre: Gira 360° libremente alrededor del personaje. WASD se mueve relativo a la cámara.</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
				}
				else
				{
					GUILayout.Label("<color=#99BBFF><size=11>\ud83c\udfaf Modo Estándar: La cámara sigue directamente la dirección de apuntado y mirada del personaje.</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
				}
				GUILayout.Space(6f);
				DrawSeparator();
				GUILayout.Space(4f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label($"<b>Distancia:</b> {ThirdPersonDistance:F1} m", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
				ThirdPersonDistance = GUILayout.HorizontalSlider(ThirdPersonDistance, 1f, 15f, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label($"<b>Altura:</b> {ThirdPersonHeight:F2} m", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
				ThirdPersonHeight = GUILayout.HorizontalSlider(ThirdPersonHeight, -1.5f, 3f, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				string arg = ((ThirdPersonSide > 0.1f) ? "Derecha" : ((ThirdPersonSide < -0.1f) ? "Izquierda" : "Centro"));
				GUILayout.Label($"<b>Hombro ({arg}):</b> {ThirdPersonSide:F2} m", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
				ThirdPersonSide = GUILayout.HorizontalSlider(ThirdPersonSide, -2f, 2f, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				if (GUILayout.Button("⯇ Izquierda", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
				{
					ThirdPersonSide = -0.5f;
				}
				if (GUILayout.Button("⏺ Centro", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
				{
					ThirdPersonSide = 0f;
				}
				if (GUILayout.Button("⯈ Derecha", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }))
				{
					ThirdPersonSide = 0.5f;
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(4f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label($"<b>Suavidad:</b> {ThirdPersonSmoothSpeed:F0}", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
				ThirdPersonSmoothSpeed = GUILayout.HorizontalSlider(ThirdPersonSmoothSpeed, 5f, 60f, Array.Empty<GUILayoutOption>());
				GUILayout.EndHorizontal();
				GUILayout.Space(6f);
				if (GUILayout.Button("↺ Restablecer Valores por Defecto", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					ThirdPersonDistance = 6f;
					ThirdPersonHeight = 0.25f;
					ThirdPersonSide = 0f;
					ThirdPersonSmoothSpeed = 35f;
					CameraMode = ThirdPersonCameraMode.Standard;
					SetStatus("<color=#88FF88>Valores por defecto restablecidos (Distancia 6m, Altura 0.25m, Centro, Suavidad 35).</color>");
				}
				GUILayout.EndVertical();
				GUILayout.Space(4f);
				GUILayout.Label("<color=#99BBFF><size=11>✓ Escalada, recolección, combate y construcción optimizados para 3ra persona sin atravesar paredes ni texturas.</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			else
			{
				GUILayout.Space(4f);
				GUILayout.Label("<color=#888899><size=11>Activa la casilla o presiona [F4] en cualquier momento para alternar entre 1ra y 3ra persona cómodamente.</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
		}

		private void DrawCheatsTab()
		{
			GUILayout.Label("<b>PODERES DEL JUGADOR:</b>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			CheatFly = GUILayout.Toggle(CheatFly, "  \ud83e\udd85  Volar (Fly / Noclip)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (CheatFly)
			{
				GUILayout.Label("    <color=#99BBFF><size=11>WASD: Mover | Espacio: Subir | Ctrl: Bajar | Shift: Sprint</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(4f);
			CheatSuperJump = GUILayout.Toggle(CheatSuperJump, "  \ud83e\udd98  Súper Salto (Super Jump)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (CheatSuperJump)
			{
				GUILayout.Label("    <color=#99BBFF><size=11>Impulso y gravedad reducida al saltar</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(4f);
			CheatNoFallDamage = GUILayout.Toggle(CheatNoFallDamage, "  \ud83d\udee1  Sin Daño por Caída (No Fall Damage)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (CheatNoFallDamage)
			{
				GUILayout.Label("    <color=#99BBFF><size=11>Inmune a daño, lesiones y desmayos por caídas</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(4f);
			CheatInfiniteStamina = GUILayout.Toggle(CheatInfiniteStamina, "  ⚡  Estamina Infinita (Infinite Stamina)", _toggleStyle, Array.Empty<GUILayoutOption>());
			if (CheatInfiniteStamina)
			{
				GUILayout.Label("    <color=#99BBFF><size=11>Escala y corre sin agotar tu energía</size></color>", _labelStyle, Array.Empty<GUILayoutOption>());
			}
			GUILayout.Space(10f);
			if (GUILayout.Button("Desactivar Todos los Cheats", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) }))
			{
				CheatFly = false;
				CheatSuperJump = false;
				CheatNoFallDamage = false;
				CheatInfiniteStamina = false;
				Character realLocalPlayer = GetRealLocalPlayer();
				if ((Object)(object)realLocalPlayer != (Object)null)
				{
					realLocalPlayer.infiniteStam = false;
				}
				SetStatus("<color=#FF8888>Cheats desactivados.</color>");
			}
		}

		private void DrawBotsTab()
		{
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			int count = SpawnedBots.Count;
			GUILayout.Label($"<b>Bots activos:</b> {count} / {100}", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(5f);
			bool inRoom = PhotonNetwork.InRoom;
			if (!inRoom)
			{
				GUILayout.Label("<color=#FF6666><b>⚠ Debes estar en una partida para spawnear bots.</b></color>", _labelStyle, Array.Empty<GUILayoutOption>());
				GUILayout.Space(10f);
			}
			GUI.enabled = inRoom && count < 100;
			if (GUILayout.Button("➕  Spawnear Bot", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) }))
			{
				SpawnBot();
			}
			GUI.enabled = true;
			GUILayout.Space(5f);
			GUI.enabled = count > 0;
			if (GUILayout.Button("\ud83d\uddd1  Eliminar Todos los Bots", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
			{
				RemoveAllBots();
				SetStatus("<color=#FF8888>Todos los bots eliminados.</color>");
			}
			GUI.enabled = true;
			GUILayout.Space(8f);
			if (count <= 0)
			{
				return;
			}
			DrawSeparator();
			GUILayout.Label("<b>Lista de Bots:</b>", _labelStyle, Array.Empty<GUILayoutOption>());
			GUILayout.Space(3f);
			_scrollPos = GUILayout.BeginScrollView(_scrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(150f) });
			for (int num = SpawnedBots.Count - 1; num >= 0; num--)
			{
				SpawnedBot spawnedBot = SpawnedBots[num];
				if (!((Object)(object)spawnedBot.BotObject == (Object)null))
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					GUILayout.Label("  \ud83e\udd16 <b>" + spawnedBot.BotName + "</b>", _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
					if (GUILayout.Button("✕", _smallButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(30f),
						GUILayout.Height(22f)
					}))
					{
						RemoveBot(num);
					}
					GUILayout.EndHorizontal();
				}
			}
			GUILayout.EndScrollView();
		}

		private void DrawSeparator()
		{
			//IL_0023: 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)
			GUILayout.Space(2f);
			GUI.DrawTexture(GUILayoutUtility.GetRect(1f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }), (Texture)(object)MakeTex(1, 1, new Color(0.3f, 0.5f, 0.8f, 0.5f)));
			GUILayout.Space(2f);
		}

		private void SetStatus(string message, float duration = 4f)
		{
			_statusMessage = message;
			_statusClearTime = Time.time + duration;
		}

		public static Character GetRealLocalPlayer()
		{
			if (Character.AllCharacters != null)
			{
				foreach (Character allCharacter in Character.AllCharacters)
				{
					if ((Object)(object)allCharacter != (Object)null && allCharacter.IsLocal && (Object)(object)((Component)allCharacter).GetComponent<AdminBotMarker>() == (Object)null)
					{
						return allCharacter;
					}
				}
			}
			if ((Object)(object)Character.localCharacter != (Object)null)
			{
				_ = (Object)(object)((Component)Character.localCharacter).GetComponent<AdminBotMarker>() == (Object)null;
				return Character.localCharacter;
			}
			return Character.localCharacter;
		}

		private void SpawnBot()
		{
			//IL_00a4: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_008b: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_022b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!PhotonNetwork.InRoom)
				{
					SetStatus("<color=#FF6666>No estás en una partida.</color>");
					return;
				}
				if (SpawnedBots.Count >= 100)
				{
					SetStatus("<color=#FF6666>Límite de bots alcanzado (100).</color>");
					return;
				}
				Character realLocalPlayer = GetRealLocalPlayer();
				Vector3 val;
				Quaternion val2;
				if ((Object)(object)realLocalPlayer != (Object)null)
				{
					val = realLocalPlayer.Center + Vector3.up * 2.5f + new Vector3(Random.Range(-0.1f, 0.1f), 0f, Random.Range(-0.1f, 0.1f));
					val2 = ((Component)realLocalPlayer).transform.rotation;
				}
				else
				{
					val = Vector3.zero + Vector3.up * 5f;
					val2 = Quaternion.identity;
				}
				_botCounter++;
				string text = (NextBotName = "Bot" + _botCounter);
				IsSpawningBot = true;
				GameObject val3 = null;
				try
				{
					val3 = PhotonNetwork.Instantiate("Character", val, val2, (byte)0, (object[])null);
				}
				finally
				{
					IsSpawningBot = false;
				}
				if ((Object)(object)val3 == (Object)null)
				{
					Log.LogError((object)"[Admin_menukz] PhotonNetwork.Instantiate('Character') returned null!");
					SetStatus("<color=#FF6666>Error al spawnear bot.</color>");
					return;
				}
				if ((Object)(object)realLocalPlayer != (Object)null)
				{
					Character.localCharacter = realLocalPlayer;
				}
				Character component = val3.GetComponent<Character>();
				if ((Object)(object)component != (Object)null)
				{
					component.isBot = true;
					AdminBotMarker adminBotMarker = val3.GetComponent<AdminBotMarker>();
					if ((Object)(object)adminBotMarker == (Object)null)
					{
						adminBotMarker = val3.AddComponent<AdminBotMarker>();
					}
					adminBotMarker.BotName = text;
					if (Character.AllCharacters != null && !Character.AllCharacters.Contains(component))
					{
						Character.AllCharacters.Add(component);
					}
					if ((Object)(object)component.input != (Object)null)
					{
						((Behaviour)component.input).enabled = false;
					}
					CharacterInput component2 = val3.GetComponent<CharacterInput>();
					if ((Object)(object)component2 != (Object)null)
					{
						((Behaviour)component2).enabled = false;
					}
				}
				if ((Object)(object)realLocalPlayer != (Object)null)
				{
					Character.localCharacter = realLocalPlayer;
				}
				SpawnedBot item = new SpawnedBot
				{
					BotObject = val3,
					BotName = text,
					BotCharacter = component
				};
				SpawnedBots.Add(item);
				Log.LogInfo((object)$"[Admin_menukz] Spawned {text} at {val}");
				SetStatus("<color=#88FF88>✓ " + text + " spawneado!</color>");
			}
			catch (Exception ex)
			{
				Log.LogError((object)$"[Admin_menukz] SpawnBot error: {ex}");
				SetStatus("<color=#FF6666>Error: " + ex.Message + "</color>");
			}
		}

		private void RemoveBot(int index)
		{
			if (index < 0 || index >= SpawnedBots.Count)
			{
				return;
			}
			SpawnedBot spawnedBot = SpawnedBots[index];
			string botName = spawnedBot.BotName;
			if ((Object)(object)spawnedBot.BotObject != (Object)null)
			{
				Character component = spawnedBot.BotObject.GetComponent<Character>();
				if ((Object)(object)component != (Object)null && Character.AllCharacters != null)
				{
					Character.AllCharacters.Remove(component);
				}
				PhotonView component2 = spawnedBot.BotObject.GetComponent<PhotonView>();
				if ((Object)(object)component2 != (Object)null && component2.IsMine)
				{
					PhotonNetwork.Destroy(spawnedBot.BotObject);
				}
				else
				{
					Object.Destroy((Object)(object)spawnedBot.BotObject);
				}
			}
			SpawnedBots.RemoveAt(index);
			if (Character.AllCharacters != null)
			{
				Character.AllCharacters.RemoveAll((Character x) => (Object)(object)x == (Object)null || (Object)(object)((Component)x).gameObject == (Object)null);
			}
			Character realLocalPlayer = GetRealLocalPlayer();
			if ((Object)(object)realLocalPlayer != (Object)null)
			{
				Character.localCharacter = realLocalPlayer;
			}
			try
			{
				GUIManager instance = GUIManager.instance;
				if (instance != null)
				{
					instance.RefreshInteractablePrompt();
				}
			}
			catch
			{
			}
			SetStatus("<color=#FF8888>" + botName + " eliminado.</color>");
			Log.LogInfo((object)("[Admin_menukz] Removed " + botName));
		}

		private void RemoveAllBots()
		{
			for (int num = SpawnedBots.Count - 1; num >= 0; num--)
			{
				SpawnedBot spawnedBot = SpawnedBots[num];
				if ((Object)(object)spawnedBot.BotObject != (Object)null)
				{
					Character component = spawnedBot.BotObject.GetComponent<Character>();
					if ((Object)(object)component != (Object)null && Character.AllCharacters != null)
					{
						Character.AllCharacters.Remove(component);
					}
					PhotonView component2 = spawnedBot.BotObject.GetComponent<PhotonView>();
					if ((Object)(object)component2 != (Object)null && component2.IsMine)
					{
						PhotonNetwork.Destroy(spawnedBot.BotObject);
					}
					else
					{
						Object.Destroy((Object)(object)spawnedBot.BotObject);
					}
				}
			}
			SpawnedBots.Clear();
			if (Character.AllCharacters != null)
			{
				Character.AllCharacters.RemoveAll((Character x) => (Object)(object)x == (Object)null || (Object)(object)((Component)x).gameObject == (Object)null);
			}
			Character realLocalPlayer = GetRealLocalPlayer();
			if ((Object)(object)realLocalPlayer != (Object)null)
			{
				Character.localCharacter = realLocalPlayer;
			}
			try
			{
				GUIManager instance = GUIManager.instance;
				if (instance != null)
				{
					instance.RefreshInteractablePrompt();
				}
			}
			catch
			{
			}
			Log.LogInfo((object)"[Admin_menukz] All bots removed.");
		}

		private static Texture2D MakeTex(int width, int height, Color color)
		{
			//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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = color;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}
	}
	public class AdminBotMarker : MonoBehaviour
	{
		public string BotName;
	}
	internal class SpawnedBot
	{
		public GameObject BotObject;

		public string BotName;

		public Character BotCharacter;
	}
	[HarmonyPatch]
	internal static class CharacterNamePatch
	{
		[HarmonyPatch(typeof(Character), "get_characterName")]
		[HarmonyPrefix]
		private static bool Prefix(Character __instance, ref string __result)
		{
			if ((Object)(object)__instance == (Object)null)
			{
				return true;
			}
			AdminBotMarker component = ((Component)__instance).GetComponent<AdminBotMarker>();
			if ((Object)(object)component != (Object)null && !string.IsNullOrEmpty(component.BotName))
			{
				__result = component.BotName;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch]
	internal static class AdminMenuInputPatches
	{
		[HarmonyPatch(typeof(Character), "Awake")]
		[HarmonyPrefix]
		private static void Character_Awake_Prefix(Character __instance)
		{
			if (AdminMenuPlugin.IsSpawningBot)
			{
				__instance.isBot = true;
				((Component)__instance).gameObject.AddComponent<AdminBotMarker>().BotName = AdminMenuPlugin.NextBotName;
			}
		}

		[HarmonyPatch(typeof(Character), "Awake")]
		[HarmonyPostfix]
		private static void Character_Awake_Postfix(Character __instance)
		{
			if (!((Object)(object)((Component)__instance).GetComponent<AdminBotMarker>() != (Object)null) || !((Object)(object)Character.localCharacter == (Object)(object)__instance) || Character.AllCharacters == null)
			{
				return;
			}
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if ((Object)(object)allCharacter != (Object)null && allCharacter.IsLocal && (Object)(object)((Component)allCharacter).GetComponent<AdminBotMarker>() == (Object)null && (Object)(object)allCharacter != (Object)(object)__instance)
				{
					Character.localCharacter = allCharacter;
					break;
				}
			}
		}

		[HarmonyPatch(typeof(CursorHandler), "Update")]
		[HarmonyPostfix]
		private static void CursorHandler_Update_Postfix()
		{
			if (AdminMenuPlugin.IsMenuOpen)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		[HarmonyPatch(typeof(CharacterInput), "Sample")]
		[HarmonyPrefix]
		private static void CharacterInput_Sample_Prefix(ref bool playerMovementActive)
		{
			if (AdminMenuPlugin.IsMenuOpen)
			{
				playerMovementActive = false;
			}
		}

		[HarmonyPatch(typeof(CharacterInteractible), "IsInteractible")]
		[HarmonyPrefix]
		private static bool CharacterInteractible_IsInteractible_Prefix(CharacterInteractible __instance, Character interactor, ref bool __result)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.character != (Object)null && (Object)(object)((Component)__instance.character).GetComponent<AdminBotMarker>() != (Object)null)
			{
				__result = __instance.IsPrimaryInteractible(interactor) || __instance.IsSecondaryInteractible(interactor);
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(CharacterInteractible), "IsSecondaryInteractible")]
		[HarmonyPrefix]
		private static bool CharacterInteractible_IsSecondaryInteractible_Prefix(CharacterInteractible __instance, Character interactor, ref bool __result)
		{
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.character != (Object)null && (Object)(object)((Component)__instance.character).GetComponent<AdminBotMarker>() != (Object)null && !__instance.character.data.dead && (Object)(object)__instance.character != (Object)(object)Character.localCharacter && (Object)(object)Character.localCharacter != (Object)null && (Object)(object)Character.localCharacter.data.currentItem != (Object)null && Character.localCharacter.data.currentItem.canUseOnFriend)
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch]
	internal static class AdminCheatPatches
	{
		[HarmonyPatch(typeof(CharacterMovement), "CheckFallDamage")]
		[HarmonyPrefix]
		private static bool CharacterMovement_CheckFallDamage_Prefix(CharacterMovement __instance)
		{
			if (AdminMenuPlugin.CheatNoFallDamage)
			{
				Character component = ((Component)__instance).GetComponent<Character>();
				if ((Object)(object)component != (Object)null && component.IsLocal)
				{
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(CharacterClimbing), "CheckFallDamage")]
		[HarmonyPrefix]
		private static bool CharacterClimbing_CheckFallDamage_Prefix(CharacterClimbing __instance)
		{
			if (AdminMenuPlugin.CheatNoFallDamage)
			{
				Character component = ((Component)__instance).GetComponent<Character>();
				if ((Object)(object)component != (Object)null && component.IsLocal)
				{
					return false;
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(Character), "Fall")]
		[HarmonyPrefix]
		private static bool Character_Fall_Prefix(Character __instance)
		{
			if (__instance.IsLocal && AdminMenuPlugin.CheatNoFallDamage)
			{
				__instance.data.fallSeconds = 0f;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(Character), "RPCA_Fall")]
		[HarmonyPrefix]
		private static bool Character_RPCA_Fall_Prefix(Character __instance)
		{
			if (__instance.IsLocal && AdminMenuPlugin.CheatNoFallDamage)
			{
				__instance.data.fallSeconds = 0f;
				return false;
			}
			return true;
		}

		[HarmonyPatch(typeof(CharacterMovement), "JumpRpc")]
		[HarmonyPrefix]
		private static void CharacterMovement_JumpRpc_Prefix(CharacterMovement __instance, bool isPalJump)
		{
			if (AdminMenuPlugin.CheatSuperJump)
			{
				Character component = ((Component)__instance).GetComponent<Character>();
				if ((Object)(object)component != (Object)null && component.IsLocal)
				{
					__instance.DoSuperJump(34f, 0.35f, 3, 2.5f);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class NativeNameSystemPatches
	{
		[HarmonyPatch(typeof(UIPlayerNames), "Init")]
		[HarmonyPrefix]
		private static void UIPlayerNames_Init_Prefix(UIPlayerNames __instance)
		{
			try
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(UIPlayerNames), "indexCounter");
				if (fieldInfo == null)
				{
					return;
				}
				int num = (int)fieldInfo.GetValue(__instance);
				if (__instance.playerNameText != null && num < __instance.playerNameText.Length)
				{
					return;
				}
				int num2 = ((__instance.playerNameText != null) ? __instance.playerNameText.Length : 0);
				int num3 = Mathf.Max(num2 + 16, num + 16);
				PlayerName[] array = (PlayerName[])(object)new PlayerName[num3];
				if (num2 > 0)
				{
					Array.Copy(__instance.playerNameText, array, num2);
				}
				PlayerName val = ((num2 > 0) ? __instance.playerNameText[0] : null);
				if ((Object)(object)val != (Object)null)
				{
					for (int i = num2; i < num3; i++)
					{
						GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)val).transform.parent);
						((Object)val2).name = $"PlayerNameText_{i}";
						val2.SetActive(false);
						array[i] = val2.GetComponent<PlayerName>();
					}
				}
				__instance.playerNameText = array;
			}
			catch (Exception arg)
			{
				ManualLogSource log = AdminMenuPlugin.Log;
				if (log != null)
				{
					log.LogError((object)$"[Admin_menukz] Error expanding UIPlayerNames array: {arg}");
				}
			}
		}

		[HarmonyPatch(typeof(UIPlayerNames), "UpdateName")]
		[HarmonyPrefix]
		private static void UIPlayerNames_UpdateName_Prefix(UIPlayerNames __instance, int index)
		{
			if (!((Object)(object)__instance != (Object)null) || __instance.playerNameText == null || index < 0 || index >= __instance.playerNameText.Length)
			{
				return;
			}
			PlayerName val = __instance.playerNameText[index];
			if (!((Object)(object)val != (Object)null) || !((Object)(object)val.characterInteractable != (Object)null) || !((Object)(object)val.characterInteractable.character != (Object)null))
			{
				return;
			}
			AdminBotMarker component = ((Component)val.characterInteractable.character).GetComponent<AdminBotMarker>();
			if ((Object)(object)component != (Object)null && !string.IsNullOrEmpty(component.BotName))
			{
				if ((Object)(object)val.text != (Object)null && ((TMP_Text)val.text).text != component.BotName)
				{
					((TMP_Text)val.text).text = component.BotName;
				}
				if ((Object)(object)val.hostStar != (Object)null && val.hostStar.activeSelf)
				{
					val.hostStar.SetActive(false);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class PlayerDetectionPatches
	{
		[HarmonyPatch(typeof(PlayerHandler), "GetAllPlayerCharacters")]
		[HarmonyPostfix]
		private static void GetAllPlayerCharacters_Postfix(ref List<Character> __result)
		{
			if (__result == null)
			{
				__result = new List<Character>();
			}
			__result.RemoveAll((Character c) => (Object)(object)c == (Object)null || (Object)(object)((Component)c).gameObject == (Object)null);
			foreach (SpawnedBot spawnedBot in AdminMenuPlugin.SpawnedBots)
			{
				if (spawnedBot != null && (Object)(object)spawnedBot.BotObject != (Object)null && (Object)(object)spawnedBot.BotCharacter != (Object)null && !__result.Contains(spawnedBot.BotCharacter))
				{
					__result.Add(spawnedBot.BotCharacter);
				}
			}
		}
	}
	[HarmonyPatch]
	internal static class CampfireBotCompatibilityPatches
	{
		[HarmonyPatch(typeof(Campfire), "PlayerCharactersInRadius")]
		[HarmonyPrefix]
		private static bool PlayerCharactersInRadius_Prefix(Campfire __instance, float radius, ref List<Character> __result)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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)
			List<Character> list = Traverse.Create((object)__instance).Field("_charactersInRadius").GetValue<List<Character>>();
			if (list == null)
			{
				list = new List<Character>();
			}
			list.Clear();
			Vector3 position = ((Component)__instance).transform.position;
			if (PlayerHandler.Exists)
			{
				foreach (Character allPlayerCharacter in PlayerHandler.GetAllPlayerCharacters())
				{
					if ((Object)(object)allPlayerCharacter != (Object)null && (Object)(object)((Component)allPlayerCharacter).gameObject != (Object)null && !allPlayerCharacter.isBot && (Object)(object)((Component)allPlayerCharacter).GetComponent<AdminBotMarker>() == (Object)null && (Object)(object)allPlayerCharacter.data != (Object)null && !allPlayerCharacter.data.dead && Vector3.Distance(position, allPlayerCharacter.Center) <= radius)
					{
						list.Add(allPlayerCharacter);
					}
				}
			}
			__result = list;
			return false;
		}

		[HarmonyPatch(typeof(Campfire), "EveryoneInRange", new Type[] { typeof(float) })]
		[HarmonyPrefix]
		private static bool EveryoneInRange_Range_Prefix(Campfire __instance, float range, ref bool __result)
		{
			List<Character> list = __instance.PlayerCharactersInRadius(range);
			if (PlayerHandler.Exists)
			{
				foreach (Character allPlayerCharacter in PlayerHandler.GetAllPlayerCharacters())
				{
					if ((Object)(object)allPlayerCharacter != (Object)null && (Object)(object)((Component)allPlayerCharacter).gameObject != (Object)null && !allPlayerCharacter.isBot && (Object)(object)((Component)allPlayerCharacter).GetComponent<AdminBotMarker>() == (Object)null && (Object)(object)allPlayerCharacter.data != (Object)null && !allPlayerCharacter.data.dead && !list.Contains(allPlayerCharacter))
					{
						__result = false;
						return false;
					}
				}
			}
			__result = true;
			return false;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		private static bool EveryoneInRange_Printout_Prefix(Campfire __instance, out string printout, float range, ref bool __result)
		{
			//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_00a7: 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)
			bool flag = true;
			printout = "";
			List<Character> list = __instance.PlayerCharactersInRadius(range);
			Vector3 position = ((Component)__instance).transform.position;
			if (PlayerHandler.Exists)
			{
				foreach (Character allPlayerCharacter in PlayerHandler.GetAllPlayerCharacters())
				{
					if ((Object)(object)allPlayerCharacter != (Object)null && (Object)(object)((Component)allPlayerCharacter).gameObject != (Object)null && !allPlayerCharacter.isBot && (Object)(object)((Component)allPlayerCharacter).GetComponent<AdminBotMarker>() == (Object)null && (Object)(object)allPlayerCharacter.data != (Object)null && !allPlayerCharacter.data.dead && !list.Contains(allPlayerCharacter))
					{
						float num = Vector3.Distance(position, allPlayerCharacter.Center);
						flag = false;
						string arg = (((Object)(object)((MonoBehaviourPun)allPlayerCharacter).photonView != (Object)null && ((MonoBehaviourPun)allPlayerCharacter).photonView.Owner != null) ? ((MonoBehaviourPun)allPlayerCharacter).photonView.Owner.NickName : "Jugador");
						printout += $"\n{arg} {Mathf.RoundToInt(num * CharacterStats.unitsToMeters)}m";
					}
				}
			}
			if (!flag)
			{
				printout = LocalizedText.GetText("CANTLIGHT", true) + "\n" + printout;
			}
			__result = flag;
			return false;
		}
	}
	[HarmonyPatch]
	internal static class ThirdPersonCameraPatches
	{
		public static void RecalculateLook(Character character)
		{
			//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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)character == (Object)null) && !((Object)(object)character.data == (Object)null))
			{
				Vector3 val = Quaternion.Euler(0f - character.data.lookValues.y, character.data.lookValues.x, 0f) * Vector3.forward;
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				character.data.lookDirection = normalized;
				Vector3 val2 = normalized;
				val2.y = 0f;
				character.data.lookDirection_Flat = ((((Vector3)(ref val2)).sqrMagnitude > 0.001f) ? ((Vector3)(ref val2)).normalized : Vector3.forward);
				CharacterData data = character.data;
				val = Vector3.Cross(Vector3.up, character.data.lookDirection);
				data.lookDirection_Right = ((Vector3)(ref val)).normalized;
				CharacterData data2 = character.data;
				val = Vector3.Cross(character.data.lookDirection, character.data.lookDirection_Right);
				data2.lookDirection_Up = ((Vector3)(ref val)).normalized;
			}
		}

		[HarmonyPatch(typeof(CharacterMovement), "CameraLook")]
		[HarmonyPrefix]
		private static bool CharacterMovement_CameraLook_Prefix(CharacterMovement __instance)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
			if (!AdminMenuPlugin.ThirdPersonEnabled || AdminMenuPlugin.CameraMode != AdminMenuPlugin.ThirdPersonCameraMode.FreeLook)
			{
				return true;
			}
			if (AdminMenuPlugin.IsMenuOpen)
			{
				return false;
			}
			Character value = Traverse.Create((object)__instance).Field("character").GetValue<Character>();
			if ((Object)(object)value == (Object)null || !value.IsLocal)
			{
				return true;
			}
			float num = 1.5f;
			try
			{
				object value2 = Traverse.Create((object)__instance).Field("mouseSensSetting").GetValue();
				if (value2 != null)
				{
					num = Traverse.Create(value2).Property("Value", (object[])null).GetValue<float>();
				}
			}
			catch
			{
			}
			Vector2 lookInput = value.input.lookInput;
			AdminMenuPlugin.OrbitYaw += lookInput.x * num;
			AdminMenuPlugin.OrbitPitch -= lookInput.y * num;
			AdminMenuPlugin.OrbitPitch = Mathf.Clamp(AdminMenuPlugin.OrbitPitch, -75f, 85f);
			if (value.data.isClimbing || value.data.isRopeClimbing || value.data.isVineClimbing || value.input.useSecondaryIsPressed || value.input.interactIsPressed || value.input.usePrimaryIsPressed)
			{
				value.data.lookValues.x = AdminMenuPlugin.OrbitYaw;
				value.data.lookValues.y = 0f - AdminMenuPlugin.OrbitPitch;
				RecalculateLook(value);
			}
			else if (((Vector2)(ref value.input.movementInput)).sqrMagnitude > 0.01f)
			{
				Vector3 val = Quaternion.Euler(0f, AdminMenuPlugin.OrbitYaw, 0f) * Vector3.forward;
				Vector3 val2 = Quaternion.Euler(0f, AdminMenuPlugin.OrbitYaw, 0f) * Vector3.right;
				Vector3 val3 = val * value.input.movementInput.y + val2 * value.input.movementInput.x;
				Vector3 normalized = ((Vector3)(ref val3)).normalized;
				if (((Vector3)(ref normalized)).sqrMagnitude > 0.001f)
				{
					float num2 = Mathf.Atan2(normalized.x, normalized.z) * 57.29578f;
					value.data.lookValues.x = Mathf.MoveTowardsAngle(value.data.lookValues.x, num2, Time.deltaTime * 1200f);
					value.data.lookValues.y = Mathf.Lerp(value.data.lookValues.y, 0f, Time.deltaTime * 8f);
					RecalculateLook(value);
				}
			}
			return false;
		}

		private static Vector3 GroundDirection(Vector3 planeNormal, Vector3 sideDirection)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return -Vector3.Cross(sideDirection, planeNormal);
		}

		[HarmonyPatch(typeof(Character), "CalculateWorldMovementDir")]
		[HarmonyPrefix]
		private static bool Character_CalculateWorldMovementDir_Prefix(Character __instance)
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			if (!AdminMenuPlugin.ThirdPersonEnabled || AdminMenuPlugin.CameraMode != AdminMenuPlugin.ThirdPersonCameraMode.FreeLook)
			{
				return true;
			}
			if (!__instance.IsLocal)
			{
				return true;
			}
			Vector3 val = Quaternion.Euler(0f, AdminMenuPlugin.OrbitYaw, 0f) * Vector3.forward;
			Vector3 val2 = Quaternion.Euler(0f, AdminMenuPlugin.OrbitYaw, 0f) * Vector3.right;
			Vector3 val3 = val * __instance.input.movementInput.y + val2 * __instance.input.movementInput.x;
			val3.y = 0f;
			__instance.data.worldMovementInput = ((Vector3)(ref val3)).normalized;
			Vector3 planeNormal = ((__instance.data.sinceGrounded > 0.2f) ? Vector3.up : __instance.data.groundNormal);
			Vector3 val4 = GroundDirection(planeNormal, -val2);
			Vector3 val5 = GroundDirection(planeNormal, val);
			if (__instance.data.sinceGrounded < 0.2f)
			{
				__instance.data.groundedForward = val4;
				__instance.data.groundedRight = val5;
			}
			Vector3 val6 = val4 * __instance.input.movementInput.y + val5 * __instance.input.movementInput.x;
			val6 = Vector3.ClampMagnitude(val6, 1f);
			__instance.data.worldMovementInput_Grounded = val6;
			Vector3 val7 = (__instance.data.isGrounded ? __instance.data.worldMovementInput_Grounded : __instance.data.worldMovementInput);
			float num = Mathf.Lerp(__instance.refs.movement.movementTurnSpeed, __instance.refs.movement.airMovementTurnSpeed, __instance.data.sinceGrounded * 4f);
			__instance.data.worldMovementInput_Lerp = Vector3.MoveTowards(__instance.data.worldMovementInput_Lerp, val7, Time.deltaTime * num);
			return false;
		}

		[HarmonyPatch(typeof(MainCameraMovement), "CharacterCam")]
		[HarmonyPostfix]
		private static void MainCameraMovement_CharacterCam_Postfix(MainCameraMovement __instance)
		{
			//IL_00a4: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			if (!AdminMenuPlugin.ThirdPersonEnabled)
			{
				return;
			}
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || (Object)(object)MainCamera.instance == (Object)null || (Object)(object)Traverse.Create((object)MainCamera.instance).Field("camOverride").GetValue<CameraOverride>() != (Object)null)
			{
				return;
			}
			Transform transform = ((Component)__instance).transform;
			Transform val = ((localCharacter.refs != null && (Object)(object)localCharacter.refs.head != (Object)null) ? localCharacter.refs.head.transform : null);
			Vector3 val2 = (((Object)(object)val != (Object)null) ? (val.position + Vector3.up * 0.1f) : (localCharacter.Center + Vector3.up * 0.4f));
			Quaternion val3;
			if (AdminMenuPlugin.CameraMode == AdminMenuPlugin.ThirdPersonCameraMode.FreeLook)
			{
				val3 = (transform.rotation = Quaternion.Euler(AdminMenuPlugin.OrbitPitch, AdminMenuPlugin.OrbitYaw, 0f));
			}
			else
			{
				val3 = transform.rotation;
				AdminMenuPlugin.OrbitYaw = localCharacter.data.lookValues.x;
				AdminMenuPlugin.OrbitPitch = 0f - localCharacter.data.lookValues.y;
			}
			Vector3 val5 = val3 * Vector3.right * AdminMenuPlugin.ThirdPersonSide + Vector3.up * AdminMenuPlugin.ThirdPersonHeight - val3 * Vector3.forward * AdminMenuPlugin.ThirdPersonDistance;
			Vector3 val6 = val2 + val5;
			Vector3 val7 = val6 - val2;
			float magnitude = ((Vector3)(ref val7)).magnitude;
			if (magnitude > 0.01f)
			{
				val7 /= magnitude;
				int num = LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)1)) | LayerMask.GetMask(new string[2] { "Default", "Terrain" });
				RaycastHit[] array = Physics.SphereCastAll(val2, 0.22f, val7, magnitude, num, (QueryTriggerInteraction)1);
				float num2 = magnitude;
				List<Collider> list = null;
				if (localCharacter.refs != null && (Object)(object)localCharacter.refs.ragdoll != (Object)null)
				{
					list = Traverse.Create((object)localCharacter.refs.ragdoll).Field("colliderList").GetValue<List<Collider>>();
				}
				RaycastHit[] array2 = array;
				for (int i = 0; i < array2.Length; i++)
				{
					RaycastHit val8 = array2[i];
					if ((Object)(object)((RaycastHit)(ref val8)).collider != (Object)null && !((RaycastHit)(ref val8)).collider.isTrigger && (list == null || !list.Contains(((RaycastHit)(ref val8)).collider)) && ((RaycastHit)(ref val8)).distance < num2)
					{
						num2 = Mathf.Max(0.25f, ((RaycastHit)(ref val8)).distance - 0.15f);
					}
				}
				val6 = val2 + val7 * num2;
			}
			transform.position = Vector3.Lerp(transform.position, val6, Time.deltaTime * AdminMenuPlugin.ThirdPersonSmoothSpeed);
		}

		[HarmonyPatch(typeof(CharacterClimbing), "TryToStartWallClimb")]
		[HarmonyPrefix]
		private static bool CharacterClimbing_TryToStartWallClimb_Prefix(CharacterClimbing __instance, bool forceAttempt, Vector3 overide, bool botGrab, float raycastDistance)
		{
			//IL_00c4: 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_00ad: 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_00c9: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			if (!AdminMenuPlugin.ThirdPersonEnabled || botGrab || forceAttempt)
			{
				return true;
			}
			try
			{
				Character value = Traverse.Create((object)__instance).Field("character").GetValue<Character>();
				PhotonView value2 = Traverse.Create((object)__instance).Field("view").GetValue<PhotonView>();
				if ((Object)(object)value == (Object)null || !__instance.CanClimb() || value.isBot || ((Object)(object)value2 != (Object)null && !value2.IsMine))
				{
					return false;
				}
				Transform val = ((value.refs != null && (Object)(object)value.refs.head != (Object)null) ? value.refs.head.transform : null);
				Vector3 val2 = (((Object)(object)val != (Object)null) ? val.position : (value.Center + Vector3.up * 0.4f));
				Vector3 lookDirection = value.data.lookDirection;
				Vector3 val3 = val2 + lookDirection * 1.6f;
				RaycastHit val4 = HelperFunctions.LineCheck(val2, val3, (LayerType)1, 0f, (QueryTriggerInteraction)1);
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val4)).transform))
				{
					val4 = HelperFunctions.LineCheck(val2, val3, (LayerType)1, 0.08f, (QueryTriggerInteraction)1);
				}
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val4)).transform))
				{
					val4 = HelperFunctions.LineCheck(val2, val3, (LayerType)1, 0.15f, (QueryTriggerInteraction)1);
				}
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val4)).transform))
				{
					return false;
				}
				if (!Traverse.Create((object)__instance).Method("AcceptableGrabAngle", new object[2]
				{
					((RaycastHit)(ref val4)).normal,
					((RaycastHit)(ref val4)).collider
				}).GetValue<bool>())
				{
					return false;
				}
				float value3 = Traverse.Create((object)__instance).Field("sinceLastClimbStarted").GetValue<float>();
				bool value4 = Traverse.Create((object)value).Method("OutOfStamina", Array.Empty<object>()).GetValue<bool>();
				if (value3 <= 1f && value4)
				{
					return false;
				}
				value.data.sinceCanClimb = 0f;
				bool value5 = Traverse.Create((object)__instance).Property("validJumpToClimb", (object[])null).GetValue<bool>();
				if (value.data.sincePressClimb < 0.1f || value5)
				{
					if (value.refs != null && (Object)(object)value.refs.items != (Object)null)
					{
						value.refs.items.EquipSlotRpc(-1, -1);
					}
					Traverse.Create((object)__instance).Field("sinceLastClimbStarted").SetValue((object)0f);
					value2.RPC("StartClimbRpc", (RpcTarget)0, new object[2]
					{
						((RaycastHit)(ref val4)).point,
						((RaycastHit)(ref val4)).normal
					});
				}
				return false;
			}
			catch (Exception arg)
			{
				ManualLogSource log = AdminMenuPlugin.Log;
				if (log != null)
				{
					log.LogError((object)$"[Admin_menukz] Error in TryToStartWallClimb 3rd person prefix: {arg}");
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Interaction), "DoInteractableRaycasts")]
		[HarmonyPrefix]
		private static void Interaction_DoInteractableRaycasts_Prefix(ref float overrideDistance)
		{
			if (AdminMenuPlugin.ThirdPersonEnabled)
			{
				if (overrideDistance <= 0f)
				{
					overrideDistance = 2.2f + AdminMenuPlugin.ThirdPersonDistance + 1.2f;
				}
				else
				{
					overrideDistance += AdminMenuPlugin.ThirdPersonDistance + 1.2f;
				}
			}
		}

		[HarmonyPatch(typeof(CharacterItems), "RaycastClimbingSpikeStart")]
		[HarmonyPrefix]
		private static bool CharacterItems_RaycastClimbingSpikeStart_Prefix(CharacterItems __instance, ref bool __result)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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)
			if (!AdminMenuPlugin.ThirdPersonEnabled)
			{
				return true;
			}
			try
			{
				Character value = Traverse.Create((object)__instance).Field("character").GetValue<Character>();
				ClimbingSpikeComponent value2 = Traverse.Create((object)__instance).Field("currentClimbingSpikeComponent").GetValue<ClimbingSpikeComponent>();
				if ((Object)(object)value == (Object)null || (Object)(object)value2 == (Object)null || (Object)(object)MainCamera.instance == (Object)null)
				{
					return true;
				}
				float num = (value.data.isClimbingAnything ? value2.climbingSpikeStartDistance : value2.climbingSpikeStartDistanceGrounded);
				num += AdminMenuPlugin.ThirdPersonDistance + 1.2f;
				Transform transform = ((Component)MainCamera.instance).transform;
				RaycastHit val = default(RaycastHit);
				bool flag = Physics.Raycast(transform.position, transform.forward, ref val, num, LayerMask.op_Implicit(HelperFunctions.GetMask((LayerType)1)));
				Traverse.Create((object)__instance).Field("climbingSpikeHit").SetValue((object)val);
				__result = flag;
				return false;
			}
			catch
			{
				return true;
			}
		}

		[HarmonyPatch(typeof(Constructable), "TryUpdatePreview")]
		[HarmonyPrefix]
		private static void Constructable_TryUpdatePreview_Prefix(Constructable __instance)
		{
			if (AdminMenuPlugin.ThirdPersonEnabled && (Object)(object)__instance != (Object)null && __instance.maxConstructDistance < 12f)
			{
				__instance.maxConstructDistance += AdminMenuPlugin.ThirdPersonDistance;
			}
		}
	}
}