Decompiled source of AdminMod LobbyExpansion v1.0.3

BepInEx/plugins/AdminMod/AdminMod.dll

Decompiled 2 hours ago
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LastPirates.AdminMod;

public class AdminESP : MonoBehaviour
{
	public bool EnableESP;

	public bool ShowPlayers = true;

	public bool ShowMonsters = true;

	public bool ShowChests = true;

	public float MaxDistance = 300f;

	private GUIStyle playerStyle;

	private GUIStyle monsterStyle;

	private GUIStyle chestStyle;

	private Texture2D boxTexture;

	public static AdminESP Instance { get; private set; }

	private void Awake()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		if (AdminModPlugin.Instance != null)
		{
			EnableESP = AdminModPlugin.Instance.EnableESP.Value;
		}
		boxTexture = new Texture2D(1, 1);
		boxTexture.SetPixel(0, 0, Color.white);
		boxTexture.Apply();
	}

	private void InitStyles()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Expected O, but got Unknown
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Expected O, but got Unknown
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		if (playerStyle == null)
		{
			playerStyle = new GUIStyle(GUI.skin.label);
			playerStyle.normal.textColor = Color.green;
			playerStyle.fontSize = 12;
			playerStyle.fontStyle = (FontStyle)1;
			playerStyle.alignment = (TextAnchor)1;
			monsterStyle = new GUIStyle(GUI.skin.label);
			monsterStyle.normal.textColor = Color.red;
			monsterStyle.fontSize = 12;
			monsterStyle.fontStyle = (FontStyle)1;
			monsterStyle.alignment = (TextAnchor)1;
			chestStyle = new GUIStyle(GUI.skin.label);
			chestStyle.normal.textColor = Color.yellow;
			chestStyle.fontSize = 12;
			chestStyle.fontStyle = (FontStyle)1;
			chestStyle.alignment = (TextAnchor)1;
		}
	}

	private void OnGUI()
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: 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_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		if (!EnableESP)
		{
			return;
		}
		Camera main = Camera.main;
		if (main == null)
		{
			return;
		}
		InitStyles();
		if (ShowPlayers && PlayerAdmin.Instance != null)
		{
			List<GameObject> allPlayers = PlayerAdmin.Instance.GetAllPlayers();
			GameObject localPlayer = PlayerAdmin.Instance.GetLocalPlayer();
			foreach (GameObject item in allPlayers)
			{
				if (item == null || item == localPlayer)
				{
					continue;
				}
				float num = Vector3.Distance(((Component)main).transform.position, item.transform.position);
				if (!(num > MaxDistance))
				{
					Vector3 val = main.WorldToScreenPoint(item.transform.position + Vector3.up * 1f);
					if (val.z > 0f)
					{
						float num2 = (float)Screen.height - val.y;
						string text = $"[PIRATA] {((Object)item).name}\n{num:F1}m";
						GUI.Label(new Rect(val.x - 100f, num2 - 30f, 200f, 40f), text, playerStyle);
						DrawESPBox(val.x, num2, 30f, 60f, Color.green);
					}
				}
			}
		}
		if (ShowMonsters && WorldAdmin.Instance != null)
		{
			List<GameObject> monsters = WorldAdmin.Instance.GetMonsters();
			foreach (GameObject item2 in monsters)
			{
				if (item2 == null || !item2.activeInHierarchy)
				{
					continue;
				}
				float num3 = Vector3.Distance(((Component)main).transform.position, item2.transform.position);
				if (!(num3 > MaxDistance))
				{
					Vector3 val2 = main.WorldToScreenPoint(item2.transform.position + Vector3.up * 0.8f);
					if (val2.z > 0f)
					{
						float num4 = (float)Screen.height - val2.y;
						string text2 = $"[MONSTRO] {((Object)item2).name}\n{num3:F1}m";
						GUI.Label(new Rect(val2.x - 100f, num4 - 30f, 200f, 40f), text2, monsterStyle);
						DrawESPBox(val2.x, num4, 25f, 45f, Color.red);
					}
				}
			}
		}
		if (!ShowChests || WorldAdmin.Instance == null)
		{
			return;
		}
		List<GameObject> chests = WorldAdmin.Instance.GetChests();
		foreach (GameObject item3 in chests)
		{
			if (item3 == null || !item3.activeInHierarchy)
			{
				continue;
			}
			float num5 = Vector3.Distance(((Component)main).transform.position, item3.transform.position);
			if (!(num5 > MaxDistance))
			{
				Vector3 val3 = main.WorldToScreenPoint(item3.transform.position);
				if (val3.z > 0f)
				{
					float num6 = (float)Screen.height - val3.y;
					string text3 = $"[BAÚ/OURO] {((Object)item3).name}\n{num5:F1}m";
					GUI.Label(new Rect(val3.x - 100f, num6 - 25f, 200f, 40f), text3, chestStyle);
					DrawESPBox(val3.x, num6, 20f, 20f, Color.yellow);
				}
			}
		}
	}

	private void DrawESPBox(float centerX, float centerY, float width, float height, Color color)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: 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_0064: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		Color color2 = GUI.color;
		GUI.color = color;
		float num = centerX - width / 2f;
		float num2 = centerY - height / 2f;
		GUI.DrawTexture(new Rect(num, num2, width, 2f), boxTexture);
		GUI.DrawTexture(new Rect(num, num2 + height - 2f, width, 2f), boxTexture);
		GUI.DrawTexture(new Rect(num, num2, 2f, height), boxTexture);
		GUI.DrawTexture(new Rect(num + width - 2f, num2, 2f, height), boxTexture);
		GUI.color = color2;
	}
}
[BepInPlugin("com.admin.lastpirates", "Last Pirates Admin & Lobby Expansion", "1.0.3")]
public class AdminModPlugin : BaseUnityPlugin
{
	public const string PLUGIN_GUID = "com.admin.lastpirates";

	public const string PLUGIN_NAME = "Last Pirates Admin & Lobby Expansion";

	public const string PLUGIN_VERSION = "1.0.3";

	private Harmony harmony;

	public static AdminModPlugin Instance { get; private set; }

	public static ManualLogSource Log
	{
		get
		{
			if (Instance == null)
			{
				return null;
			}
			return ((BaseUnityPlugin)Instance).Logger;
		}
	}

	public ConfigEntry<KeyCode> MenuToggleKey { get; private set; }

	public ConfigEntry<int> MaxLobbyPlayers { get; private set; }

	public ConfigEntry<bool> EnableLateJoin { get; private set; }

	public ConfigEntry<bool> EnableESP { get; private set; }

	public ConfigEntry<bool> GodModeDefault { get; private set; }

	public ConfigEntry<float> FlySpeedMultiplier { get; private set; }

	public ConfigEntry<float> SpeedMultiplier { get; private set; }

	public ConfigEntry<float> ElasticReachMultiplier { get; private set; }

	private void Awake()
	{
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Expected O, but got Unknown
		Instance = this;
		Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		MenuToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Atalhos", "MenuToggleKey", (KeyCode)0, "Tecla para abrir/fechar o Menu de Admin (ex: F1, Insert, F4)");
		MaxLobbyPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("Lobby", "MaxLobbyPlayers", 16, "Capacidade máxima de jogadores na sala criada pelo Host (4 a 32)");
		EnableLateJoin = ((BaseUnityPlugin)this).Config.Bind<bool>("Lobby", "EnableLateJoin", true, "Permite que novos jogadores entrem mesmo durante a partida em andamento");
		EnableESP = ((BaseUnityPlugin)this).Config.Bind<bool>("Visual", "EnableESP", false, "Ativa/Desativa o ESP de jogadores, monstros e baús");
		GodModeDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Admin", "GodModeDefault", false, "Inicia com God Mode ativado");
		FlySpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Admin", "FlySpeedMultiplier", 15f, "Velocidade do modo de voo (Noclip)");
		SpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Admin", "SpeedMultiplier", 2f, "Multiplicador de velocidade de corrida");
		ElasticReachMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Admin", "ElasticReachMultiplier", 3f, "Multiplicador de alcance dos braços elásticos");
		((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("[AdminMod] Inicializando {0} v{1}...", "Last Pirates Admin & Lobby Expansion", "1.0.3"));
		try
		{
			harmony = new Harmony("com.admin.lastpirates");
			LobbyExpansion.ApplyPatches(harmony);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[AdminMod] Patches de Lobby e Rede aplicados com sucesso!");
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)$"[AdminMod] Erro ao aplicar patches Harmony: {arg}");
		}
		((Component)this).gameObject.AddComponent<AdminUI>();
		((Component)this).gameObject.AddComponent<PlayerAdmin>();
		((Component)this).gameObject.AddComponent<WorldAdmin>();
		((Component)this).gameObject.AddComponent<ItemSpawner>();
		((Component)this).gameObject.AddComponent<AdminESP>();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[AdminMod] Mod carregado com sucesso! Pressione F1, Insert, F4 ou clique no botão [☠\ufe0f ADMIN] no canto da tela!");
	}

	private void OnDestroy()
	{
		try
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
		catch
		{
		}
	}
}
public class AdminUI : MonoBehaviour
{
	public bool IsMenuOpen;

	public bool IsMinimized;

	private Rect windowRect;

	private int currentTab;

	private readonly string[] tabNames = new string[6] { "⚓ LOBBY", "\ud83d\udc65 PLAYERS", "⚡ PODERES", "\ud83c\udf81 SPAWN", "\ud83c\udfdd\ufe0f MUNDO", "\ud83d\udc41\ufe0f ESP" };

	private Vector2 scrollPosition = Vector2.zero;

	private Vector2 spawnerScrollPos = Vector2.zero;

	private Vector2 playersScrollPos = Vector2.zero;

	private GUIStyle windowStyle;

	private GUIStyle headerStyle;

	private GUIStyle miniTitleStyle;

	private GUIStyle tabButtonStyle;

	private GUIStyle actionButtonStyle;

	private GUIStyle dangerButtonStyle;

	private GUIStyle successButtonStyle;

	private GUIStyle subHeaderStyle;

	private GUIStyle cardStyle;

	private GUIStyle itemCardStyle;

	private GUIStyle searchFieldStyle;

	private GUIStyle floatingButtonStyle;

	private Texture2D windowBgTexture;

	private Texture2D cardBgTexture;

	private Texture2D itemCardBgTexture;

	private Texture2D accentBarTexture;

	private Texture2D floatBtnTexture;

	public static AdminUI Instance { get; private set; }

	private void Awake()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		float num = 430f;
		float num2 = 440f;
		float num3 = Mathf.Max(20f, (float)Screen.width - num - 20f);
		float num4 = 35f;
		windowRect = new Rect(num3, num4, num, num2);
		CreateTextures();
	}

	private void CreateTextures()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
		windowBgTexture = MakeSolidTexture(1, 1, new Color(0.08f, 0.1f, 0.13f, 0.92f));
		cardBgTexture = MakeSolidTexture(1, 1, new Color(0.13f, 0.16f, 0.2f, 0.88f));
		itemCardBgTexture = MakeSolidTexture(1, 1, new Color(0.16f, 0.2f, 0.25f, 0.9f));
		accentBarTexture = MakeSolidTexture(1, 1, new Color(1f, 0.78f, 0.28f, 1f));
		floatBtnTexture = MakeSolidTexture(1, 1, new Color(0.12f, 0.15f, 0.2f, 0.9f));
	}

	private Texture2D MakeSolidTexture(int width, int height, Color col)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		Color[] array = (Color[])(object)new Color[width * height];
		for (int i = 0; i < array.Length; i++)
		{
			array[i] = col;
		}
		Texture2D val = new Texture2D(width, height);
		val.SetPixels(array);
		val.Apply();
		return val;
	}

	private void Update()
	{
		if (CheckToggleKeyPressed())
		{
			ToggleMenu();
		}
	}

	public void ToggleMenu()
	{
		IsMenuOpen = !IsMenuOpen;
		if (IsMenuOpen)
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}
	}

	private bool CheckToggleKeyPressed()
	{
		try
		{
			if (Input.GetKeyDown((KeyCode)0) || Input.GetKeyDown((KeyCode)2) || Input.GetKeyDown((KeyCode)1))
			{
				return true;
			}
		}
		catch
		{
		}
		try
		{
			Type type = Type.GetType("UnityEngine.InputSystem.Keyboard, Unity.InputSystem") ?? Type.GetType("UnityEngine.InputSystem.Keyboard, UnityEngine.InputSystem");
			if (type != null)
			{
				PropertyInfo property = type.GetProperty("current", BindingFlags.Static | BindingFlags.Public);
				if (property != null)
				{
					object value = property.GetValue(null, null);
					if (value != null && (IsNewInputKeyPressed(value, "f1Key") || IsNewInputKeyPressed(value, "insertKey") || IsNewInputKeyPressed(value, "f4Key")))
					{
						return true;
					}
				}
			}
		}
		catch
		{
		}
		return false;
	}

	private bool IsNewInputKeyPressed(object keyboard, string keyPropName)
	{
		try
		{
			PropertyInfo property = keyboard.GetType().GetProperty(keyPropName, BindingFlags.Instance | BindingFlags.Public);
			if (property != null)
			{
				object value = property.GetValue(keyboard, null);
				if (value != null)
				{
					PropertyInfo property2 = value.GetType().GetProperty("wasPressedThisFrame", BindingFlags.Instance | BindingFlags.Public);
					if (property2 != null)
					{
						return (bool)property2.GetValue(value, null);
					}
				}
			}
		}
		catch
		{
		}
		return false;
	}

	private void InitStyles()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Expected O, but got Unknown
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_00c0: 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_00eb: Expected O, but got Unknown
		//IL_011e: 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_0149: Expected O, but got Unknown
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Expected O, but got Unknown
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Expected O, but got Unknown
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ec: Expected O, but got Unknown
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Expected O, but got Unknown
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Expected O, but got Unknown
		//IL_0248: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Expected O, but got Unknown
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_0263: Expected O, but got Unknown
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Expected O, but got Unknown
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d1: Expected O, but got Unknown
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Expected O, but got Unknown
		//IL_0305: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Expected O, but got Unknown
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Expected O, but got Unknown
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Expected O, but got Unknown
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Expected O, but got Unknown
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0377: Expected O, but got Unknown
		//IL_039f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: Expected O, but got Unknown
		//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
		if (windowStyle == null)
		{
			windowStyle = new GUIStyle(GUI.skin.window);
			windowStyle.normal.background = windowBgTexture;
			windowStyle.onNormal.background = windowBgTexture;
			windowStyle.padding = new RectOffset(10, 10, 10, 10);
			windowStyle.border = new RectOffset(2, 2, 2, 2);
			headerStyle = new GUIStyle(GUI.skin.label);
			headerStyle.fontSize = 13;
			headerStyle.fontStyle = (FontStyle)1;
			headerStyle.normal.textColor = new Color(1f, 0.82f, 0.32f);
			headerStyle.alignment = (TextAnchor)2;
			miniTitleStyle = new GUIStyle(GUI.skin.label);
			miniTitleStyle.fontSize = 11;
			miniTitleStyle.fontStyle = (FontStyle)1;
			miniTitleStyle.normal.textColor = new Color(0.9f, 0.9f, 0.95f);
			miniTitleStyle.alignment = (TextAnchor)1;
			subHeaderStyle = new GUIStyle(GUI.skin.label);
			subHeaderStyle.fontSize = 11;
			subHeaderStyle.fontStyle = (FontStyle)1;
			subHeaderStyle.normal.textColor = new Color(0.45f, 0.82f, 1f);
			tabButtonStyle = new GUIStyle(GUI.skin.button);
			tabButtonStyle.fontSize = 10;
			tabButtonStyle.fontStyle = (FontStyle)1;
			tabButtonStyle.fixedHeight = 24f;
			tabButtonStyle.margin = new RectOffset(1, 1, 1, 1);
			tabButtonStyle.padding = new RectOffset(4, 4, 2, 2);
			actionButtonStyle = new GUIStyle(GUI.skin.button);
			actionButtonStyle.fontSize = 10;
			actionButtonStyle.fontStyle = (FontStyle)1;
			actionButtonStyle.fixedHeight = 22f;
			actionButtonStyle.margin = new RectOffset(1, 1, 1, 1);
			actionButtonStyle.padding = new RectOffset(3, 3, 1, 1);
			dangerButtonStyle = new GUIStyle(actionButtonStyle);
			dangerButtonStyle.normal.textColor = new Color(1f, 0.4f, 0.4f);
			successButtonStyle = new GUIStyle(actionButtonStyle);
			successButtonStyle.normal.textColor = new Color(0.4f, 1f, 0.5f);
			cardStyle = new GUIStyle(GUI.skin.box);
			cardStyle.normal.background = cardBgTexture;
			cardStyle.padding = new RectOffset(6, 6, 6, 6);
			cardStyle.margin = new RectOffset(0, 0, 3, 3);
			itemCardStyle = new GUIStyle(GUI.skin.box);
			itemCardStyle.normal.background = itemCardBgTexture;
			itemCardStyle.padding = new RectOffset(5, 5, 4, 4);
			itemCardStyle.margin = new RectOffset(0, 0, 2, 2);
			searchFieldStyle = new GUIStyle(GUI.skin.textField);
			searchFieldStyle.fontSize = 11;
			searchFieldStyle.fixedHeight = 22f;
			floatingButtonStyle = new GUIStyle(GUI.skin.button);
			floatingButtonStyle.normal.background = floatBtnTexture;
			floatingButtonStyle.normal.textColor = new Color(1f, 0.82f, 0.32f);
			floatingButtonStyle.fontSize = 11;
			floatingButtonStyle.fontStyle = (FontStyle)1;
			floatingButtonStyle.alignment = (TextAnchor)1;
		}
	}

	private void OnGUI()
	{
		//IL_004a: 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_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Expected O, but got Unknown
		//IL_016f: 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_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Expected O, but got Unknown
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		InitStyles();
		if (!IsMenuOpen)
		{
			float num = 115f;
			float num2 = 26f;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor((float)Screen.width - num - 15f, 10f, num, num2);
			GUI.backgroundColor = new Color(1f, 0.8f, 0.3f, 0.95f);
			if (GUI.Button(val, "☠\ufe0f ADMIN [F1]", floatingButtonStyle))
			{
				ToggleMenu();
			}
			GUI.backgroundColor = Color.white;
			return;
		}
		((Rect)(ref windowRect)).x = Mathf.Clamp(((Rect)(ref windowRect)).x, 0f, (float)Screen.width - ((Rect)(ref windowRect)).width);
		((Rect)(ref windowRect)).y = Mathf.Clamp(((Rect)(ref windowRect)).y, 0f, (float)Screen.height - ((Rect)(ref windowRect)).height);
		if (IsMinimized)
		{
			((Rect)(ref windowRect)).height = 36f;
			((Rect)(ref windowRect)).width = 280f;
			GUI.Window(9999, windowRect, new WindowFunction(DrawMiniBar), "", windowStyle);
		}
		else
		{
			((Rect)(ref windowRect)).height = 430f;
			((Rect)(ref windowRect)).width = 430f;
			GUI.Window(9999, windowRect, new WindowFunction(DrawAdminWindow), "", windowStyle);
		}
	}

	private void DrawMiniBar(int windowID)
	{
		//IL_0080: 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_00db: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("☠\ufe0f <b>ADMIN</b> | F1", headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
		string text = ((PlayerAdmin.Instance != null && PlayerAdmin.Instance.GodMode) ? "<color=#ffd700>GOD</color>" : "<color=#44ff44>ATIVO</color>");
		GUILayout.Label(text, miniTitleStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
		GUI.backgroundColor = new Color(0.3f, 0.7f, 1f);
		if (GUILayout.Button("\ud83d\uddd6 Expandir", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }))
		{
			IsMinimized = false;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 36f));
	}

	private void DrawAdminWindow(int windowID)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: 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_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUI.DrawTexture(new Rect(10f, 14f, 3f, 14f), accentBarTexture);
		GUILayout.Space(8f);
		GUILayout.Label("☠\ufe0f LAST PIRATES | ADMIN HOST", headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUI.backgroundColor = new Color(0.4f, 0.4f, 0.45f);
		if (GUILayout.Button("—", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) }))
		{
			IsMinimized = true;
		}
		GUI.backgroundColor = new Color(0.8f, 0.25f, 0.25f);
		if (GUILayout.Button("✕", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(24f) }))
		{
			IsMenuOpen = false;
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUILayout.Space(4f);
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		for (int i = 0; i < 3; i++)
		{
			GUI.backgroundColor = ((currentTab == i) ? new Color(1f, 0.78f, 0.28f) : new Color(0.2f, 0.24f, 0.3f));
			if (GUILayout.Button(tabNames[i], tabButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				currentTab = i;
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		for (int j = 3; j < tabNames.Length; j++)
		{
			GUI.backgroundColor = ((currentTab == j) ? new Color(1f, 0.78f, 0.28f) : new Color(0.2f, 0.24f, 0.3f));
			if (GUILayout.Button(tabNames[j], tabButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				currentTab = j;
			}
		}
		GUILayout.EndHorizontal();
		GUI.backgroundColor = Color.white;
		GUILayout.Space(6f);
		scrollPosition = GUILayout.BeginScrollView(scrollPosition, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(330f) });
		switch (currentTab)
		{
		case 0:
			DrawLobbyTab();
			break;
		case 1:
			DrawPlayersTab();
			break;
		case 2:
			DrawCheatsTab();
			break;
		case 3:
			DrawSpawnerTab();
			break;
		case 4:
			DrawWorldTab();
			break;
		case 5:
			DrawESPTab();
			break;
		}
		GUILayout.EndScrollView();
		GUILayout.EndVertical();
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f));
	}

	private void DrawLobbyTab()
	{
		GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("⚓ Expansão de Jogadores na Sala", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label($"Capacidade Máxima: <b>{LobbyExpansion.TargetMaxPlayers} Jogadores</b> (Padrão: 4)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		LobbyExpansion.TargetMaxPlayers = (int)GUILayout.HorizontalSlider((float)LobbyExpansion.TargetMaxPlayers, 4f, 32f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Space(6f);
		LobbyExpansion.AllowMidGameJoin = GUILayout.Toggle(LobbyExpansion.AllowMidGameJoin, " \ud83d\udeaa Permitir Entrada no Meio da Partida (Late-Join)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("<size=9><i>Novos jogadores entram mesmo após o início do round.</i></size>", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.EndVertical();
		GUILayout.Space(4f);
		GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("Status da Partida:", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		int num = ((PlayerAdmin.Instance != null) ? PlayerAdmin.Instance.GetPlayersData().Count : 0);
		GUILayout.Label($"• Modo: <b>Host-Only (Ativo)</b> | Jogadores: <b>{num}</b>", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (GUILayout.Button("\ud83d\udd04 Atualizar Conexões & Cena", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
		{
			if (PlayerAdmin.Instance != null)
			{
				PlayerAdmin.Instance.RefreshPlayerList();
			}
			if (WorldAdmin.Instance != null)
			{
				WorldAdmin.Instance.RefreshWorldObjects();
			}
		}
		GUILayout.EndVertical();
	}

	private void DrawPlayersTab()
	{
		//IL_001a: 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_009f: 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_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0428: Unknown result type (might be due to invalid IL or missing references)
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUI.backgroundColor = new Color(0.2f, 0.8f, 0.4f);
		if (GUILayout.Button("✨ Reviver Todos", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]) && PlayerAdmin.Instance != null)
		{
			PlayerAdmin.Instance.ReviveAll();
		}
		GUI.backgroundColor = new Color(0.9f, 0.3f, 0.3f);
		if (GUILayout.Button("☠\ufe0f Matar Todos", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]) && PlayerAdmin.Instance != null)
		{
			PlayerAdmin.Instance.KillAllPlayers(includeHost: false);
		}
		GUI.backgroundColor = new Color(0.3f, 0.6f, 0.9f);
		if (GUILayout.Button("\ud83d\udccd Puxar Todos", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]) && PlayerAdmin.Instance != null)
		{
			PlayerAdmin.Instance.BringAllToMe();
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUILayout.Space(4f);
		if (PlayerAdmin.Instance == null)
		{
			return;
		}
		List<PlayerAdmin.PlayerData> playersData = PlayerAdmin.Instance.GetPlayersData();
		GameObject localPlayer = PlayerAdmin.Instance.GetLocalPlayer();
		if (playersData.Count == 0)
		{
			GUILayout.Label("<size=10>Nenhum pirata detectado no momento.</size>", (GUILayoutOption[])(object)new GUILayoutOption[0]);
		}
		playersScrollPos = GUILayout.BeginScrollView(playersScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(280f) });
		for (int i = 0; i < playersData.Count; i++)
		{
			PlayerAdmin.PlayerData playerData = playersData[i];
			if (playerData == null || playerData.GameObject == null)
			{
				continue;
			}
			bool flag = playerData.IsLocal || playerData.GameObject == localPlayer;
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
			string arg = (flag ? "\ud83d\udc51 [HOST]" : "\ud83c\udff4\u200d☠\ufe0f");
			string text = (playerData.IsDead ? "<color=#ff4444>[MORTO]</color>" : $"<color=#44ff44>[{playerData.Health:F0} HP]</color>");
			if (playerData.IsFrozen)
			{
				text += " <color=#44ffff>[GELO]</color>";
			}
			if (playerData.HasGodMode)
			{
				text += " <color=#ffd700>[GOD]</color>";
			}
			GUILayout.Label($"<b>{arg} {playerData.Name}</b> {text}", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (!flag)
			{
				if (GUILayout.Button("\ud83d\ude80 Ir", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) }))
				{
					PlayerAdmin.Instance.TeleportTo(playerData.GameObject);
				}
				if (GUILayout.Button("\ud83e\uddf2 Puxar", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(50f) }))
				{
					PlayerAdmin.Instance.BringToMe(playerData.GameObject);
				}
				if (GUILayout.Button("\ud83d\udd90\ufe0f Slap", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }))
				{
					PlayerAdmin.Instance.SlapPlayer(playerData.GameObject, 25f);
				}
			}
			GUI.backgroundColor = new Color(0.2f, 0.8f, 0.4f);
			if (GUILayout.Button("❤\ufe0f Reviver", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }))
			{
				PlayerAdmin.Instance.RevivePlayer(playerData.GameObject);
			}
			if (!flag)
			{
				GUI.backgroundColor = new Color(0.9f, 0.3f, 0.3f);
				if (GUILayout.Button("☠\ufe0f Kill", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }))
				{
					PlayerAdmin.Instance.KillPlayer(playerData.GameObject);
				}
				GUI.backgroundColor = (playerData.IsFrozen ? new Color(0.4f, 0.8f, 1f) : new Color(0.3f, 0.5f, 0.7f));
				if (GUILayout.Button(playerData.IsFrozen ? "\ud83d\udd25" : "❄\ufe0f", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(28f) }))
				{
					PlayerAdmin.Instance.ToggleFreezePlayer(playerData);
				}
				GUI.backgroundColor = new Color(1f, 0.5f, 0.2f);
				if (GUILayout.Button("\ud83d\udeaa Kick", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(45f) }))
				{
					PlayerAdmin.Instance.KickPlayer(playerData.GameObject);
				}
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
			GUILayout.EndVertical();
		}
		GUILayout.EndScrollView();
	}

	private void DrawCheatsTab()
	{
		if (PlayerAdmin.Instance != null)
		{
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Label("Poderes Pessoais do Host:", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			PlayerAdmin.Instance.GodMode = GUILayout.Toggle(PlayerAdmin.Instance.GodMode, " \ud83d\udee1\ufe0f God Mode (Imortalidade)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			PlayerAdmin.Instance.InfiniteStamina = GUILayout.Toggle(PlayerAdmin.Instance.InfiniteStamina, " ⚡ Estamina Infinita", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			PlayerAdmin.Instance.InfiniteElasticReach = GUILayout.Toggle(PlayerAdmin.Instance.InfiniteElasticReach, $" \ud83e\uddbe Braço Elástico Longo ({PlayerAdmin.Instance.ElasticMultiplier:F1}x)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (PlayerAdmin.Instance.InfiniteElasticReach)
			{
				PlayerAdmin.Instance.ElasticMultiplier = GUILayout.HorizontalSlider(PlayerAdmin.Instance.ElasticMultiplier, 1f, 8f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			}
			GUILayout.EndVertical();
			GUILayout.Space(4f);
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Label("Movimentação & Voo:", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			PlayerAdmin.Instance.NoclipMode = GUILayout.Toggle(PlayerAdmin.Instance.NoclipMode, $" \ud83d\udd4a\ufe0f Modo Voo / Noclip (Vel: {PlayerAdmin.Instance.FlySpeed:F0})", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (PlayerAdmin.Instance.NoclipMode)
			{
				PlayerAdmin.Instance.FlySpeed = GUILayout.HorizontalSlider(PlayerAdmin.Instance.FlySpeed, 5f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
				GUILayout.Label("<size=9><i>Use WASD + Espaço (subir) / Ctrl (descer).</i></size>", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			}
			PlayerAdmin.Instance.SuperSpeed = GUILayout.Toggle(PlayerAdmin.Instance.SuperSpeed, $" \ud83c\udfc3 Super Velocidade ({PlayerAdmin.Instance.SpeedMultiplier:F1}x)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			if (PlayerAdmin.Instance.SuperSpeed)
			{
				PlayerAdmin.Instance.SpeedMultiplier = GUILayout.HorizontalSlider(PlayerAdmin.Instance.SpeedMultiplier, 1.5f, 5f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			}
			GUILayout.EndVertical();
		}
	}

	private void DrawSpawnerTab()
	{
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_035f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0414: Unknown result type (might be due to invalid IL or missing references)
		if (ItemSpawner.Instance == null)
		{
			return;
		}
		GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label("\ud83d\udd0d", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) });
		string search = ItemSpawner.Instance.GetSearch();
		string text = GUILayout.TextField(search, searchFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
		if (text != search)
		{
			ItemSpawner.Instance.SetSearch(text);
		}
		if (GUILayout.Button("✕", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(25f) }))
		{
			ItemSpawner.Instance.SetSearch("");
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		for (int i = 0; i < 3; i++)
		{
			string text2 = ItemSpawner.Instance.Categories[i];
			GUI.backgroundColor = ((ItemSpawner.Instance.GetCategory() == text2) ? new Color(1f, 0.78f, 0.28f) : new Color(0.2f, 0.25f, 0.3f));
			if (GUILayout.Button(text2, actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				ItemSpawner.Instance.SetCategory(text2);
			}
		}
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		for (int j = 3; j < ItemSpawner.Instance.Categories.Length; j++)
		{
			string text3 = ItemSpawner.Instance.Categories[j];
			GUI.backgroundColor = ((ItemSpawner.Instance.GetCategory() == text3) ? new Color(1f, 0.78f, 0.28f) : new Color(0.2f, 0.25f, 0.3f));
			if (GUILayout.Button(text3, actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				ItemSpawner.Instance.SetCategory(text3);
			}
		}
		GUI.backgroundColor = Color.white;
		GUILayout.EndHorizontal();
		GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]);
		GUILayout.Label($"Qtd: <b>{ItemSpawner.Instance.GetQuantity()}x</b>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) });
		if (GUILayout.Button("1x", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) }))
		{
			ItemSpawner.Instance.SetQuantity(1);
		}
		if (GUILayout.Button("5x", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) }))
		{
			ItemSpawner.Instance.SetQuantity(5);
		}
		if (GUILayout.Button("10x", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
		{
			ItemSpawner.Instance.SetQuantity(10);
		}
		if (GUILayout.Button("25x", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(40f) }))
		{
			ItemSpawner.Instance.SetQuantity(25);
		}
		if (GUILayout.Button("\ud83d\udd04 Scan", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
		{
			ItemSpawner.Instance.ScanAllItemsInGame();
		}
		GUILayout.EndHorizontal();
		GUILayout.EndVertical();
		List<ItemSpawner.SpawnableItem> filteredItems = ItemSpawner.Instance.GetFilteredItems();
		spawnerScrollPos = GUILayout.BeginScrollView(spawnerScrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(170f) });
		for (int k = 0; k < filteredItems.Count; k++)
		{
			ItemSpawner.SpawnableItem spawnableItem = filteredItems[k];
			GUILayout.BeginHorizontal(itemCardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Label($"<size=10>{spawnableItem.Name}</size>", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(270f) });
			GUI.backgroundColor = new Color(0.2f, 0.8f, 0.4f);
			if (GUILayout.Button("\ud83c\udf81 Spawn", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(75f) }))
			{
				ItemSpawner.Instance.SpawnItem(spawnableItem, ItemSpawner.Instance.GetQuantity());
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndHorizontal();
		}
		GUILayout.EndScrollView();
	}

	private void DrawWorldTab()
	{
		//IL_0062: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		if (WorldAdmin.Instance != null)
		{
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Label("Monstros & Inimigos:", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			WorldAdmin.Instance.FreezeMonsters = GUILayout.Toggle(WorldAdmin.Instance.FreezeMonsters, " ❄\ufe0f Congelar Todos os Monstros (Freeze AI)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUI.backgroundColor = new Color(0.9f, 0.3f, 0.3f);
			if (GUILayout.Button("\ud83d\udca5 Eliminar Todos os Monstros", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				WorldAdmin.Instance.KillAllMonsters();
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndVertical();
			GUILayout.Space(4f);
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Label("Tesouros & Extração:", subHeaderStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUI.backgroundColor = new Color(1f, 0.78f, 0.28f);
			if (GUILayout.Button("\ud83c\udf81 Spawnar Baú de Ouro Aqui", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				WorldAdmin.Instance.SpawnGoldChestAtPlayer();
			}
			GUI.backgroundColor = new Color(0.3f, 0.6f, 0.9f);
			if (GUILayout.Button("\ud83d\udea2 Extração (Teleportar Todos para o Barco)", actionButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]))
			{
				WorldAdmin.Instance.ForceCompleteIsland();
			}
			GUI.backgroundColor = Color.white;
			GUILayout.EndVertical();
		}
	}

	private void DrawESPTab()
	{
		if (AdminESP.Instance != null)
		{
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			AdminESP.Instance.EnableESP = GUILayout.Toggle(AdminESP.Instance.EnableESP, " \ud83d\udfe2 Ativar ESP (Wallhack)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Space(3f);
			AdminESP.Instance.ShowPlayers = GUILayout.Toggle(AdminESP.Instance.ShowPlayers, " \ud83d\udc65 ESP Piratas (Verde)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			AdminESP.Instance.ShowMonsters = GUILayout.Toggle(AdminESP.Instance.ShowMonsters, " \ud83d\udc79 ESP Monstros (Vermelho)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			AdminESP.Instance.ShowChests = GUILayout.Toggle(AdminESP.Instance.ShowChests, " \ud83d\udcb0 ESP Baús & Ouro (Amarelo)", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Space(4f);
			GUILayout.Label($"Alcance do ESP: <b>{AdminESP.Instance.MaxDistance:F0}m</b>", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			AdminESP.Instance.MaxDistance = GUILayout.HorizontalSlider(AdminESP.Instance.MaxDistance, 50f, 600f, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.EndVertical();
			GUILayout.Space(4f);
			GUILayout.BeginVertical(cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.Label("<size=9>\ud83d\udca1 <i>Dica: Você pode arrastar este menu pelo topo para qualquer canto da tela ou clicar em <b>—</b> para deixá-lo minimizado.</i></size>", (GUILayoutOption[])(object)new GUILayoutOption[0]);
			GUILayout.EndVertical();
		}
	}
}
public class ItemSpawner : MonoBehaviour
{
	public class SpawnableItem
	{
		public string Name;

		public string Category;

		public GameObject Prefab;

		public Object OriginalObject;
	}

	private List<SpawnableItem> allItems = new List<SpawnableItem>();

	private string searchFilter = "";

	private string selectedCategory = "TODOS";

	private int spawnQuantity = 1;

	private float lastScanTime;

	public readonly string[] Categories = new string[6] { "TODOS", "\ud83d\udcb0 TESOUROS", "⚔\ufe0f ARMAS/EQUIP", "\ud83e\uddea CONSUMÍVEIS", "\ud83d\udddd\ufe0f UTILITÁRIOS", "\ud83d\udce6 BAÚS" };

	public static ItemSpawner Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
	}

	private void Start()
	{
		ScanAllItemsInGame();
	}

	private void Update()
	{
		if (allItems.Count == 0 && Time.time - lastScanTime > 3f)
		{
			lastScanTime = Time.time;
			ScanAllItemsInGame();
		}
	}

	public List<SpawnableItem> GetFilteredItems()
	{
		List<SpawnableItem> list = new List<SpawnableItem>();
		for (int i = 0; i < allItems.Count; i++)
		{
			SpawnableItem spawnableItem = allItems[i];
			if ((selectedCategory == "TODOS" || (selectedCategory == "\ud83d\udcb0 TESOUROS" && (spawnableItem.Category == "TESOUROS" || spawnableItem.Name.ToLowerInvariant().Contains("gold") || spawnableItem.Name.ToLowerInvariant().Contains("treasure") || spawnableItem.Name.ToLowerInvariant().Contains("relic") || spawnableItem.Name.ToLowerInvariant().Contains("coin"))) || (selectedCategory == "⚔\ufe0f ARMAS/EQUIP" && (spawnableItem.Category == "ARMAS" || spawnableItem.Name.ToLowerInvariant().Contains("sword") || spawnableItem.Name.ToLowerInvariant().Contains("gun") || spawnableItem.Name.ToLowerInvariant().Contains("weapon") || spawnableItem.Name.ToLowerInvariant().Contains("shield") || spawnableItem.Name.ToLowerInvariant().Contains("cutlass"))) || (selectedCategory == "\ud83e\uddea CONSUMÍVEIS" && (spawnableItem.Category == "CONSUMÍVEIS" || spawnableItem.Name.ToLowerInvariant().Contains("potion") || spawnableItem.Name.ToLowerInvariant().Contains("heal") || spawnableItem.Name.ToLowerInvariant().Contains("food") || spawnableItem.Name.ToLowerInvariant().Contains("rum") || spawnableItem.Name.ToLowerInvariant().Contains("drink"))) || (selectedCategory == "\ud83d\udddd\ufe0f UTILITÁRIOS" && (spawnableItem.Category == "UTILITÁRIOS" || spawnableItem.Name.ToLowerInvariant().Contains("key") || spawnableItem.Name.ToLowerInvariant().Contains("torch") || spawnableItem.Name.ToLowerInvariant().Contains("light") || spawnableItem.Name.ToLowerInvariant().Contains("map") || spawnableItem.Name.ToLowerInvariant().Contains("compass"))) || (selectedCategory == "\ud83d\udce6 BAÚS" && (spawnableItem.Category == "BAÚS" || spawnableItem.Name.ToLowerInvariant().Contains("chest") || spawnableItem.Name.ToLowerInvariant().Contains("crate") || spawnableItem.Name.ToLowerInvariant().Contains("box")))) && (string.IsNullOrEmpty(searchFilter) || spawnableItem.Name.ToLowerInvariant().Contains(searchFilter.ToLowerInvariant())))
			{
				list.Add(spawnableItem);
			}
		}
		return list;
	}

	public void SetSearch(string filter)
	{
		searchFilter = filter;
	}

	public string GetSearch()
	{
		return searchFilter;
	}

	public void SetCategory(string cat)
	{
		selectedCategory = cat;
	}

	public string GetCategory()
	{
		return selectedCategory;
	}

	public void SetQuantity(int qty)
	{
		spawnQuantity = Mathf.Clamp(qty, 1, 50);
	}

	public int GetQuantity()
	{
		return spawnQuantity;
	}

	public void ScanAllItemsInGame()
	{
		allItems.Clear();
		HashSet<string> hashSet = new HashSet<string>();
		try
		{
			Object[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject));
			if (array != null)
			{
				Object[] array2 = array;
				foreach (Object val in array2)
				{
					if (val != null)
					{
						string text = val.name.ToLowerInvariant();
						if ((text.Contains("item") || text.Contains("chest") || text.Contains("treasure") || text.Contains("relic") || text.Contains("gold") || text.Contains("coin") || text.Contains("potion") || text.Contains("key") || text.Contains("weapon") || text.Contains("sword") || text.Contains("gun") || text.Contains("tool")) && !hashSet.Contains(val.name))
						{
							hashSet.Add(val.name);
							SpawnableItem spawnableItem = new SpawnableItem();
							spawnableItem.Name = CleanItemName(val.name);
							spawnableItem.Category = CategorizeItem(val.name);
							spawnableItem.Prefab = (GameObject)(object)((val is GameObject) ? val : null);
							spawnableItem.OriginalObject = val;
							allItems.Add(spawnableItem);
						}
					}
				}
			}
		}
		catch
		{
		}
		try
		{
			if (Object.FindObjectsOfType(typeof(Transform)) is Component[] array3)
			{
				Component[] array4 = array3;
				foreach (Component val2 in array4)
				{
					if (val2 == null)
					{
						continue;
					}
					GameObject gameObject = val2.gameObject;
					if (gameObject != null)
					{
						string text2 = ((Object)gameObject).name.ToLowerInvariant();
						string text3 = ((gameObject.tag != null) ? gameObject.tag.ToLowerInvariant() : "");
						if ((text3.Contains("item") || text3.Contains("loot") || text3.Contains("chest") || text2.Contains("chest") || text2.Contains("treasure") || text2.Contains("gold") || text2.Contains("relic") || text2.Contains("potion")) && !hashSet.Contains(((Object)gameObject).name))
						{
							hashSet.Add(((Object)gameObject).name);
							SpawnableItem spawnableItem2 = new SpawnableItem();
							spawnableItem2.Name = CleanItemName(((Object)gameObject).name);
							spawnableItem2.Category = CategorizeItem(((Object)gameObject).name);
							spawnableItem2.Prefab = gameObject;
							spawnableItem2.OriginalObject = (Object)(object)gameObject;
							allItems.Add(spawnableItem2);
						}
					}
				}
			}
		}
		catch
		{
		}
		if (allItems.Count == 0)
		{
			AddDefaultFallbackItems();
		}
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[ItemSpawner] {allItems.Count} itens disponíveis catalogados para spawn!");
		}
	}

	private void AddDefaultFallbackItems()
	{
		string[] array = new string[15]
		{
			"Baú de Ouro do Capitão", "Tesouro Amaldiçoado", "Relíquia Antiga do Pirata", "Saco de Moedas de Ouro", "Cálice de Rubi", "Coroa de Diamante", "Espada Sabre Pirata", "Pistola de Pederneira", "Tridente das Profundezas", "Poção de Cura Rápida",
			"Garrafa de Rum Restauradora", "Elixir de Imortalidade", "Chave Mestra de Esqueleto", "Lanterna Mágica", "Bússola Dourada de Navegação"
		};
		string[] array2 = array;
		foreach (string name in array2)
		{
			SpawnableItem spawnableItem = new SpawnableItem();
			spawnableItem.Name = name;
			spawnableItem.Category = CategorizeItem(name);
			spawnableItem.Prefab = null;
			spawnableItem.OriginalObject = null;
			allItems.Add(spawnableItem);
		}
	}

	private string CategorizeItem(string name)
	{
		string text = name.ToLowerInvariant();
		if (text.Contains("chest") || text.Contains("crate") || text.Contains("baú") || text.Contains("box"))
		{
			return "BAÚS";
		}
		if (text.Contains("sword") || text.Contains("gun") || text.Contains("sabre") || text.Contains("pistol") || text.Contains("weapon") || text.Contains("trident"))
		{
			return "ARMAS";
		}
		if (text.Contains("potion") || text.Contains("rum") || text.Contains("heal") || text.Contains("food") || text.Contains("elixir") || text.Contains("drink"))
		{
			return "CONSUMÍVEIS";
		}
		if (text.Contains("key") || text.Contains("torch") || text.Contains("light") || text.Contains("lanterna") || text.Contains("compass") || text.Contains("chave"))
		{
			return "UTILITÁRIOS";
		}
		return "TESOUROS";
	}

	private string CleanItemName(string raw)
	{
		return raw.Replace("(Clone)", "").Replace("Prefab", "").Replace("_", " ")
			.Trim();
	}

	public void SpawnItem(SpawnableItem item, int quantity)
	{
		//IL_0025: 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_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: 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_0018: 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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = ((PlayerAdmin.Instance != null) ? PlayerAdmin.Instance.GetLocalPlayer() : null);
		Vector3 val2 = ((val != null) ? (val.transform.position + val.transform.forward * 2f + Vector3.up * 0.5f) : Vector3.zero);
		for (int i = 0; i < quantity; i++)
		{
			Vector3 val3 = ((quantity > 1) ? (Random.insideUnitSphere * 0.8f) : Vector3.zero);
			val3.y = Mathf.Abs(val3.y);
			Vector3 val4 = val2 + val3;
			if (item.Prefab != null)
			{
				try
				{
					GameObject val5 = Object.Instantiate<GameObject>(item.Prefab, val4, (val != null) ? val.transform.rotation : Quaternion.identity);
					val5.SetActive(true);
					Rigidbody component = val5.GetComponent<Rigidbody>();
					if (component != null)
					{
						component.isKinematic = false;
						component.useGravity = true;
					}
				}
				catch (Exception ex)
				{
					if (AdminModPlugin.Log != null)
					{
						AdminModPlugin.Log.LogError((object)$"[ItemSpawner] Erro ao instanciar prefab {item.Name}: {ex.Message}");
					}
				}
			}
			else if (WorldAdmin.Instance != null && (item.Name.Contains("Ouro") || item.Name.Contains("Baú") || item.Name.Contains("Tesouro")))
			{
				WorldAdmin.Instance.SpawnGoldChestAtPlayer();
			}
			else if (PlayerAdmin.Instance != null && val != null)
			{
				PlayerAdmin.Instance.GiveGold(val, 500);
			}
		}
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[ItemSpawner] Spawnado com sucesso: {quantity}x {item.Name}");
		}
	}
}
public static class LobbyExpansion
{
	public static int TargetMaxPlayers = 16;

	public static bool AllowMidGameJoin = true;

	public static void ApplyPatches(Harmony harmony)
	{
		if (AdminModPlugin.Instance != null)
		{
			TargetMaxPlayers = AdminModPlugin.Instance.MaxLobbyPlayers.Value;
			AllowMidGameJoin = AdminModPlugin.Instance.EnableLateJoin.Value;
		}
		PatchSteamworks(harmony);
		PatchGameLobbyManagers(harmony);
	}

	private static void PatchSteamworks(Harmony harmony)
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Expected O, but got Unknown
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Expected O, but got Unknown
		try
		{
			Type type = AccessTools.TypeByName("Steamworks.SteamMatchmaking");
			if (!(type != null))
			{
				return;
			}
			MethodInfo methodInfo = AccessTools.Method(type, "CreateLobby", (Type[])null, (Type[])null);
			if (methodInfo != null)
			{
				MethodInfo method = typeof(LobbyExpansion).GetMethod("Prefix_CreateLobby", BindingFlags.Static | BindingFlags.NonPublic);
				harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				if (AdminModPlugin.Log != null)
				{
					AdminModPlugin.Log.LogInfo((object)"[LobbyExpansion] Patch aplicado em SteamMatchmaking.CreateLobby!");
				}
			}
			MethodInfo methodInfo2 = AccessTools.Method(type, "SetLobbyMemberLimit", (Type[])null, (Type[])null);
			if (methodInfo2 != null)
			{
				MethodInfo method2 = typeof(LobbyExpansion).GetMethod("Prefix_SetLobbyMemberLimit", BindingFlags.Static | BindingFlags.NonPublic);
				harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				if (AdminModPlugin.Log != null)
				{
					AdminModPlugin.Log.LogInfo((object)"[LobbyExpansion] Patch aplicado em SteamMatchmaking.SetLobbyMemberLimit!");
				}
			}
			MethodInfo methodInfo3 = AccessTools.Method(type, "SetLobbyJoinable", (Type[])null, (Type[])null);
			if (methodInfo3 != null)
			{
				MethodInfo method3 = typeof(LobbyExpansion).GetMethod("Prefix_SetLobbyJoinable", BindingFlags.Static | BindingFlags.NonPublic);
				harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(method3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				if (AdminModPlugin.Log != null)
				{
					AdminModPlugin.Log.LogInfo((object)"[LobbyExpansion] Patch aplicado em SteamMatchmaking.SetLobbyJoinable!");
				}
			}
		}
		catch (Exception ex)
		{
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogWarning((object)$"[LobbyExpansion] Aviso ao patchear Steamworks: {ex.Message}");
			}
		}
	}

	private static void PatchGameLobbyManagers(Harmony harmony)
	{
		Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
		foreach (Assembly assembly in assemblies)
		{
			try
			{
				string name = assembly.GetName().Name;
				if (!name.StartsWith("Assembly-CSharp") && !name.Contains("Game") && !name.Contains("Network"))
				{
					continue;
				}
				Type[] types = assembly.GetTypes();
				foreach (Type type in types)
				{
					string text = type.Name.ToLowerInvariant();
					if (text.Contains("lobby") || text.Contains("room") || text.Contains("session") || text.Contains("match"))
					{
						PatchLobbyMethodsInType(harmony, type);
					}
				}
			}
			catch
			{
			}
		}
	}

	private static void PatchLobbyMethodsInType(Harmony harmony, Type type)
	{
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Expected O, but got Unknown
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Expected O, but got Unknown
		try
		{
			MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo methodInfo in methods)
			{
				string text = methodInfo.Name.ToLowerInvariant();
				if (text.Contains("createlobby") || text.Contains("hostgame") || text.Contains("createroom") || text.Contains("startserver"))
				{
					ParameterInfo[] parameters = methodInfo.GetParameters();
					for (int j = 0; j < parameters.Length; j++)
					{
						string text2 = parameters[j].Name.ToLowerInvariant();
						if ((text2.Contains("max") || text2.Contains("players") || text2.Contains("limit") || text2.Contains("capacity")) && parameters[j].ParameterType == typeof(int))
						{
							MethodInfo method = typeof(LobbyExpansion).GetMethod("Prefix_GeneralMaxPlayersInt", BindingFlags.Static | BindingFlags.NonPublic);
							harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
							if (AdminModPlugin.Log != null)
							{
								AdminModPlugin.Log.LogInfo((object)$"[LobbyExpansion] Interceptado limite de players no método: {type.Name}.{methodInfo.Name}");
							}
							break;
						}
					}
				}
				if (text.Contains("locklobby") || text.Contains("closeonstart") || text.Contains("setjoinable") || text.Contains("disablenewconnections"))
				{
					MethodInfo method2 = typeof(LobbyExpansion).GetMethod("Prefix_PreventLobbyLock", BindingFlags.Static | BindingFlags.NonPublic);
					harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					if (AdminModPlugin.Log != null)
					{
						AdminModPlugin.Log.LogInfo((object)$"[LobbyExpansion] Interceptado bloqueio de entrada no método: {type.Name}.{methodInfo.Name}");
					}
				}
			}
		}
		catch
		{
		}
	}

	private static void Prefix_CreateLobby(ref int cMaxMembers)
	{
		cMaxMembers = TargetMaxPlayers;
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[LobbyExpansion] Criando Steam Lobby com capacidade expandida: {TargetMaxPlayers} jogadores");
		}
	}

	private static void Prefix_SetLobbyMemberLimit(ref int cMaxMembers)
	{
		cMaxMembers = TargetMaxPlayers;
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[LobbyExpansion] Atualizando limite do lobby para: {TargetMaxPlayers}");
		}
	}

	private static void Prefix_SetLobbyJoinable(ref bool bLobbyJoinable)
	{
		if (AllowMidGameJoin)
		{
			bLobbyJoinable = true;
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)"[LobbyExpansion] Mantendo lobby joinable (Entrada durante o jogo permitida)!");
			}
		}
	}

	private static void Prefix_GeneralMaxPlayersInt(ref int __0)
	{
		__0 = TargetMaxPlayers;
	}

	private static bool Prefix_PreventLobbyLock()
	{
		if (AllowMidGameJoin)
		{
			return false;
		}
		return true;
	}
}
public class PlayerAdmin : MonoBehaviour
{
	public class PlayerData
	{
		public GameObject GameObject;

		public string Name;

		public string SteamID = "N/A";

		public float Health = 100f;

		public float MaxHealth = 100f;

		public bool IsDead;

		public bool IsLocal;

		public bool IsFrozen;

		public bool HasGodMode;

		public Vector3 Position
		{
			get
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				if (GameObject == null)
				{
					return Vector3.zero;
				}
				return GameObject.transform.position;
			}
		}
	}

	public bool GodMode;

	public bool InfiniteStamina;

	public bool InfiniteElasticReach;

	public bool NoclipMode;

	public bool SuperSpeed;

	public bool SuperJump;

	public bool InvisibleToMonsters;

	public float SpeedMultiplier = 2.5f;

	public float ElasticMultiplier = 4f;

	public float FlySpeed = 15f;

	private GameObject localPlayerObject;

	private List<PlayerData> playersDataList = new List<PlayerData>();

	private HashSet<string> bannedPlayers = new HashSet<string>();

	private float scanTimer;

	private Camera spectateCamera;

	private GameObject spectatingTarget;

	public static PlayerAdmin Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
		if (AdminModPlugin.Instance != null)
		{
			GodMode = AdminModPlugin.Instance.GodModeDefault.Value;
			FlySpeed = AdminModPlugin.Instance.FlySpeedMultiplier.Value;
			SpeedMultiplier = AdminModPlugin.Instance.SpeedMultiplier.Value;
			ElasticMultiplier = AdminModPlugin.Instance.ElasticReachMultiplier.Value;
		}
	}

	private void Update()
	{
		scanTimer += Time.deltaTime;
		if (scanTimer >= 0.8f)
		{
			scanTimer = 0f;
			RefreshPlayerList();
		}
		ApplyLocalPlayerCheats();
		ApplyIndividualPlayerStates();
		UpdateSpectateCamera();
	}

	public List<PlayerData> GetPlayersData()
	{
		return playersDataList;
	}

	public List<GameObject> GetAllPlayers()
	{
		List<GameObject> list = new List<GameObject>();
		foreach (PlayerData playersData in playersDataList)
		{
			if (playersData.GameObject != null)
			{
				list.Add(playersData.GameObject);
			}
		}
		return list;
	}

	public GameObject GetLocalPlayer()
	{
		if (localPlayerObject != null && localPlayerObject.activeInHierarchy)
		{
			return localPlayerObject;
		}
		RefreshPlayerList();
		return localPlayerObject;
	}

	public void RefreshPlayerList()
	{
		playersDataList.Clear();
		localPlayerObject = null;
		if (!(Object.FindObjectsOfType(typeof(Transform)) is Component[] array))
		{
			return;
		}
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		for (int i = 0; i < array.Length; i++)
		{
			if (array[i] == null)
			{
				continue;
			}
			GameObject gameObject = array[i].gameObject;
			if (gameObject == null || hashSet.Contains(gameObject))
			{
				continue;
			}
			hashSet.Add(gameObject);
			string text = ((Object)gameObject).name.ToLowerInvariant();
			string text2 = ((gameObject.tag != null) ? gameObject.tag.ToLowerInvariant() : "");
			if ((text2.Contains("player") || text.Contains("player") || text.Contains("pirate") || text.Contains("character")) && (gameObject.GetComponent<CharacterController>() != null || gameObject.GetComponent<Rigidbody>() != null))
			{
				bool flag = gameObject.GetComponentInChildren<Camera>() != null || gameObject.GetComponent<AudioListener>() != null;
				if (flag)
				{
					localPlayerObject = gameObject;
				}
				float health = GetHealth(gameObject);
				bool isDead = health <= 0.01f || CheckIfDead(gameObject);
				PlayerData playerData = new PlayerData();
				playerData.GameObject = gameObject;
				playerData.Name = CleanPlayerName(((Object)gameObject).name);
				playerData.IsLocal = flag;
				playerData.Health = health;
				playerData.IsDead = isDead;
				if (bannedPlayers.Contains(playerData.Name))
				{
					KickPlayer(gameObject);
				}
				else
				{
					playersDataList.Add(playerData);
				}
			}
		}
		if (localPlayerObject == null && playersDataList.Count > 0)
		{
			localPlayerObject = playersDataList[0].GameObject;
			playersDataList[0].IsLocal = true;
		}
	}

	private string CleanPlayerName(string raw)
	{
		return raw.Replace("(Clone)", "").Trim();
	}

	public void KillPlayer(GameObject target)
	{
		if (target == null)
		{
			return;
		}
		SetHealth(target, 0f);
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			MethodInfo methodInfo = type.GetMethod("TakeDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("ApplyDamage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Damage", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (methodInfo != null)
			{
				try
				{
					ParameterInfo[] parameters = methodInfo.GetParameters();
					if (parameters.Length == 1 && parameters[0].ParameterType == typeof(float))
					{
						methodInfo.Invoke(val, new object[1] { 999999f });
					}
					else if (parameters.Length == 1 && parameters[0].ParameterType == typeof(int))
					{
						methodInfo.Invoke(val, new object[1] { 999999 });
					}
					else if (parameters.Length == 0)
					{
						methodInfo.Invoke(val, null);
					}
				}
				catch
				{
				}
			}
			MethodInfo methodInfo2 = type.GetMethod("Die", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Kill", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("OnDeath", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (methodInfo2 != null && methodInfo2.GetParameters().Length == 0)
			{
				try
				{
					methodInfo2.Invoke(val, null);
				}
				catch
				{
				}
			}
		}
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Jogador eliminado: {((Object)target).name}");
		}
		RefreshPlayerList();
	}

	public void KillAllPlayers(bool includeHost)
	{
		GameObject localPlayer = GetLocalPlayer();
		foreach (PlayerData playersData in playersDataList)
		{
			if (playersData.GameObject != null && (includeHost || playersData.GameObject != localPlayer))
			{
				KillPlayer(playersData.GameObject);
			}
		}
	}

	public void RevivePlayer(GameObject target)
	{
		if (target == null)
		{
			return;
		}
		SetHealth(target, 100f);
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			MethodInfo methodInfo = type.GetMethod("Revive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Respawn", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("ResetPlayer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (methodInfo != null && methodInfo.GetParameters().Length == 0)
			{
				try
				{
					methodInfo.Invoke(val, null);
				}
				catch
				{
				}
			}
			FieldInfo fieldInfo = type.GetField("isDead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("dead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (fieldInfo != null && fieldInfo.FieldType == typeof(bool))
			{
				try
				{
					fieldInfo.SetValue(val, false);
				}
				catch
				{
				}
			}
		}
		CharacterController component = target.GetComponent<CharacterController>();
		if (component != null)
		{
			((Behaviour)component).enabled = true;
		}
		Rigidbody component2 = target.GetComponent<Rigidbody>();
		if (component2 != null)
		{
			component2.isKinematic = false;
			component2.useGravity = true;
		}
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Jogador revivido: {((Object)target).name}");
		}
		RefreshPlayerList();
	}

	public void ReviveAll()
	{
		foreach (PlayerData playersData in playersDataList)
		{
			if (playersData.GameObject != null)
			{
				RevivePlayer(playersData.GameObject);
			}
		}
	}

	public void KickPlayer(GameObject target)
	{
		if (target == null || target == GetLocalPlayer())
		{
			return;
		}
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Expulsando jogador da sala: {((Object)target).name}");
		}
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			MethodInfo methodInfo = type.GetMethod("Disconnect", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("Kick", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetMethod("LeaveRoom", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (methodInfo != null)
			{
				try
				{
					methodInfo.Invoke(val, null);
				}
				catch
				{
				}
			}
		}
		target.SetActive(false);
		Object.Destroy((Object)(object)target);
		RefreshPlayerList();
	}

	public void BanPlayer(GameObject target)
	{
		if (target != null && target != GetLocalPlayer())
		{
			string text = CleanPlayerName(((Object)target).name);
			bannedPlayers.Add(text);
			KickPlayer(target);
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Jogador BANIDO da sessão: {text}");
			}
		}
	}

	public void ToggleFreezePlayer(PlayerData player)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		if (player == null || player.GameObject == null)
		{
			return;
		}
		player.IsFrozen = !player.IsFrozen;
		CharacterController component = player.GameObject.GetComponent<CharacterController>();
		Rigidbody component2 = player.GameObject.GetComponent<Rigidbody>();
		if (player.IsFrozen)
		{
			if (component != null)
			{
				((Behaviour)component).enabled = false;
			}
			if (component2 != null)
			{
				component2.linearVelocity = Vector3.zero;
				component2.isKinematic = true;
			}
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Jogador congelado: {player.Name}");
			}
		}
		else
		{
			if (component != null)
			{
				((Behaviour)component).enabled = true;
			}
			if (component2 != null)
			{
				component2.isKinematic = false;
			}
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Jogador descongelado: {player.Name}");
			}
		}
	}

	public void SlapPlayer(GameObject target, float force)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		if (target != null)
		{
			Rigidbody component = target.GetComponent<Rigidbody>();
			if (component != null)
			{
				component.isKinematic = false;
				component.AddForce(Vector3.up * force + Random.insideUnitSphere * (force * 0.5f), (ForceMode)2);
			}
			else
			{
				Transform transform = target.transform;
				transform.position += Vector3.up * 10f;
			}
		}
	}

	public void TeleportToOcean(GameObject target)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		if (target != null)
		{
			target.transform.position = new Vector3(0f, -20f, 0f);
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)$"[PlayerAdmin] Jogador teleportado para o fundo do mar: {((Object)target).name}");
			}
		}
	}

	public void ToggleSpectate(GameObject target)
	{
		if (spectatingTarget == target)
		{
			spectatingTarget = null;
			if (spectateCamera != null)
			{
				((Behaviour)spectateCamera).enabled = false;
			}
		}
		else
		{
			spectatingTarget = target;
		}
	}

	private void UpdateSpectateCamera()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		if (spectatingTarget != null)
		{
			Camera main = Camera.main;
			if (main != null)
			{
				((Component)main).transform.position = spectatingTarget.transform.position - spectatingTarget.transform.forward * 3.5f + Vector3.up * 2f;
				((Component)main).transform.LookAt(spectatingTarget.transform.position + Vector3.up * 1.2f);
			}
		}
	}

	public void TeleportTo(GameObject target)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: 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)
		GameObject localPlayer = GetLocalPlayer();
		if (localPlayer != null && target != null)
		{
			localPlayer.transform.position = target.transform.position + Vector3.up * 1f;
		}
	}

	public void BringToMe(GameObject target)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		GameObject localPlayer = GetLocalPlayer();
		if (localPlayer != null && target != null)
		{
			target.transform.position = localPlayer.transform.position + localPlayer.transform.forward * 2f;
		}
	}

	public void BringAllToMe()
	{
		//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_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		GameObject localPlayer = GetLocalPlayer();
		if (localPlayer == null)
		{
			return;
		}
		foreach (PlayerData playersData in playersDataList)
		{
			if (playersData.GameObject != localPlayer && playersData.GameObject != null)
			{
				playersData.GameObject.transform.position = localPlayer.transform.position + Random.insideUnitSphere * 2f;
			}
		}
	}

	public void GiveGold(GameObject target, int amount)
	{
		if (target == null)
		{
			return;
		}
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			FieldInfo fieldInfo = type.GetField("gold", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("money", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("coins", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(fieldInfo != null))
			{
				continue;
			}
			try
			{
				if (fieldInfo.FieldType == typeof(int))
				{
					int num = (int)fieldInfo.GetValue(val);
					fieldInfo.SetValue(val, Mathf.Max(0f, (float)(num + amount)));
				}
				else if (fieldInfo.FieldType == typeof(float))
				{
					float num2 = (float)fieldInfo.GetValue(val);
					fieldInfo.SetValue(val, Mathf.Max(0f, num2 + (float)amount));
				}
			}
			catch
			{
			}
		}
	}

	private void ApplyIndividualPlayerStates()
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		foreach (PlayerData playersData in playersDataList)
		{
			if (playersData.GameObject == null)
			{
				continue;
			}
			if (playersData.IsFrozen)
			{
				Rigidbody component = playersData.GameObject.GetComponent<Rigidbody>();
				if (component != null)
				{
					component.linearVelocity = Vector3.zero;
				}
			}
			if (playersData.HasGodMode)
			{
				SetHealth(playersData.GameObject, 9999f);
			}
		}
	}

	private void ApplyLocalPlayerCheats()
	{
		//IL_01c9: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: 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_00a5: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		//IL_0123: 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_014e: 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_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		GameObject localPlayer = GetLocalPlayer();
		if (localPlayer == null)
		{
			return;
		}
		if (GodMode)
		{
			SetHealth(localPlayer, 9999f);
		}
		if (InfiniteStamina)
		{
			SetStamina(localPlayer, 100f);
		}
		if (InfiniteElasticReach)
		{
			ApplyElasticReach(localPlayer, ElasticMultiplier);
		}
		if (NoclipMode)
		{
			CharacterController component = localPlayer.GetComponent<CharacterController>();
			if (component != null)
			{
				((Behaviour)component).enabled = false;
			}
			Rigidbody component2 = localPlayer.GetComponent<Rigidbody>();
			if (component2 != null)
			{
				component2.isKinematic = true;
				component2.useGravity = false;
			}
			Transform val = ((Camera.main != null) ? ((Component)Camera.main).transform : localPlayer.transform);
			Vector3 val2 = Vector3.zero;
			if (Input.GetKey((KeyCode)3))
			{
				val2 += val.forward;
			}
			if (Input.GetKey((KeyCode)5))
			{
				val2 -= val.forward;
			}
			if (Input.GetKey((KeyCode)6))
			{
				val2 += val.right;
			}
			if (Input.GetKey((KeyCode)4))
			{
				val2 -= val.right;
			}
			if (Input.GetKey((KeyCode)7))
			{
				val2 += Vector3.up;
			}
			if (Input.GetKey((KeyCode)8))
			{
				val2 -= Vector3.up;
			}
			float num = FlySpeed;
			if (Input.GetKey((KeyCode)9))
			{
				num *= 2.5f;
			}
			Transform transform = localPlayer.transform;
			transform.position += ((Vector3)(ref val2)).normalized * num * Time.deltaTime;
		}
		else
		{
			CharacterController component3 = localPlayer.GetComponent<CharacterController>();
			if (component3 != null && !((Behaviour)component3).enabled)
			{
				((Behaviour)component3).enabled = true;
			}
			Rigidbody component4 = localPlayer.GetComponent<Rigidbody>();
			if (component4 != null && component4.isKinematic)
			{
				component4.isKinematic = false;
				component4.useGravity = true;
			}
		}
		if (SuperSpeed && !NoclipMode)
		{
			Transform transform2 = localPlayer.transform;
			transform2.position += localPlayer.transform.forward * (Input.GetAxis("Vertical") * SpeedMultiplier * 5f * Time.deltaTime);
		}
	}

	private float GetHealth(GameObject target)
	{
		if (target == null)
		{
			return 0f;
		}
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			FieldInfo fieldInfo = type.GetField("health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("currentHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("hp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(fieldInfo != null))
			{
				continue;
			}
			try
			{
				if (fieldInfo.FieldType == typeof(float))
				{
					return (float)fieldInfo.GetValue(val);
				}
				if (fieldInfo.FieldType == typeof(int))
				{
					return (int)fieldInfo.GetValue(val);
				}
			}
			catch
			{
			}
		}
		return 100f;
	}

	private bool CheckIfDead(GameObject target)
	{
		if (target == null)
		{
			return true;
		}
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			FieldInfo fieldInfo = ((object)val).GetType().GetField("isDead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? ((object)val).GetType().GetField("dead", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (fieldInfo != null && fieldInfo.FieldType == typeof(bool))
			{
				try
				{
					return (bool)fieldInfo.GetValue(val);
				}
				catch
				{
				}
			}
		}
		return false;
	}

	private void SetHealth(GameObject target, float value)
	{
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			FieldInfo fieldInfo = type.GetField("health", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("currentHealth", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("hp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(fieldInfo != null))
			{
				continue;
			}
			try
			{
				if (fieldInfo.FieldType == typeof(float))
				{
					fieldInfo.SetValue(val, value);
				}
				else if (fieldInfo.FieldType == typeof(int))
				{
					fieldInfo.SetValue(val, (int)value);
				}
			}
			catch
			{
			}
		}
	}

	private void SetStamina(GameObject target, float value)
	{
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			FieldInfo fieldInfo = type.GetField("stamina", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("currentStamina", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("energy", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(fieldInfo != null))
			{
				continue;
			}
			try
			{
				if (fieldInfo.FieldType == typeof(float))
				{
					fieldInfo.SetValue(val, value);
				}
				else if (fieldInfo.FieldType == typeof(int))
				{
					fieldInfo.SetValue(val, (int)value);
				}
			}
			catch
			{
			}
		}
	}

	private void ApplyElasticReach(GameObject target, float multiplier)
	{
		Component[] componentsInChildren = target.GetComponentsInChildren<Component>();
		Component[] array = componentsInChildren;
		foreach (Component val in array)
		{
			if (val == null)
			{
				continue;
			}
			Type type = ((object)val).GetType();
			FieldInfo fieldInfo = type.GetField("maxReach", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("elasticLength", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("armLength", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? type.GetField("grabDistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (fieldInfo != null && fieldInfo.FieldType == typeof(float))
			{
				try
				{
					fieldInfo.SetValue(val, 50f * multiplier);
				}
				catch
				{
				}
			}
		}
	}
}
public class WorldAdmin : MonoBehaviour
{
	public bool FreezeMonsters;

	public bool DisableTraps;

	public float LootMultiplier = 2f;

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

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

	private float scanTimer;

	public static WorldAdmin Instance { get; private set; }

	private void Awake()
	{
		Instance = this;
	}

	private void Update()
	{
		scanTimer += Time.deltaTime;
		if (scanTimer >= 2f)
		{
			scanTimer = 0f;
			RefreshWorldObjects();
		}
		if (FreezeMonsters)
		{
			ApplyFreezeMonsters();
		}
	}

	public List<GameObject> GetMonsters()
	{
		return cachedMonsters;
	}

	public List<GameObject> GetChests()
	{
		return cachedChests;
	}

	public void RefreshWorldObjects()
	{
		cachedMonsters.Clear();
		cachedChests.Clear();
		if (!(Object.FindObjectsOfType(typeof(Transform)) is Component[] array))
		{
			return;
		}
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		for (int i = 0; i < array.Length; i++)
		{
			if (array[i] == null)
			{
				continue;
			}
			GameObject gameObject = array[i].gameObject;
			if (gameObject != null && !hashSet.Contains(gameObject))
			{
				hashSet.Add(gameObject);
				string text = ((Object)gameObject).name.ToLowerInvariant();
				string text2 = ((gameObject.tag != null) ? gameObject.tag.ToLowerInvariant() : "");
				if ((text2.Contains("enemy") || text2.Contains("monster") || text2.Contains("ai") || text.Contains("monster") || text.Contains("enemy") || text.Contains("creature") || text.Contains("ghost") || text.Contains("skeleton")) && !cachedMonsters.Contains(gameObject))
				{
					cachedMonsters.Add(gameObject);
				}
				if ((text2.Contains("loot") || text2.Contains("chest") || text2.Contains("item") || text.Contains("chest") || text.Contains("treasure") || text.Contains("loot") || text.Contains("gold") || text.Contains("relic")) && !cachedChests.Contains(gameObject))
				{
					cachedChests.Add(gameObject);
				}
			}
		}
	}

	public void KillAllMonsters()
	{
		RefreshWorldObjects();
		int num = 0;
		foreach (GameObject cachedMonster in cachedMonsters)
		{
			if (cachedMonster != null)
			{
				cachedMonster.SetActive(false);
				Object.Destroy((Object)(object)cachedMonster);
				num++;
			}
		}
		cachedMonsters.Clear();
		if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogInfo((object)$"[WorldAdmin] {num} monstros eliminados do mapa!");
		}
	}

	private void ApplyFreezeMonsters()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		foreach (GameObject cachedMonster in cachedMonsters)
		{
			if (cachedMonster == null)
			{
				continue;
			}
			Rigidbody component = cachedMonster.GetComponent<Rigidbody>();
			if (component != null)
			{
				component.linearVelocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
				component.isKinematic = true;
			}
			Component[] componentsInChildren = cachedMonster.GetComponentsInChildren<Component>();
			Component[] array = componentsInChildren;
			foreach (Component val in array)
			{
				if (val == null)
				{
					continue;
				}
				string text = ((object)val).GetType().Name.ToLowerInvariant();
				if (!text.Contains("navmeshagent") && !text.Contains("ai") && !text.Contains("patrol") && !text.Contains("chase"))
				{
					continue;
				}
				PropertyInfo property = ((object)val).GetType().GetProperty("enabled");
				if (property != null)
				{
					try
					{
						property.SetValue(val, false, null);
					}
					catch
					{
					}
				}
			}
		}
	}

	public void ForceCompleteIsland()
	{
		//IL_00c6: 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_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)
		if (!(Object.FindObjectsOfType(typeof(Transform)) is Component[] array))
		{
			return;
		}
		for (int i = 0; i < array.Length; i++)
		{
			if (array[i] == null)
			{
				continue;
			}
			GameObject gameObject = array[i].gameObject;
			if (gameObject == null)
			{
				continue;
			}
			string text = ((Object)gameObject).name.ToLowerInvariant();
			if (!text.Contains("ship") && !text.Contains("boat") && !text.Contains("extraction") && !text.Contains("portal") && !text.Contains("escape"))
			{
				continue;
			}
			List<GameObject> list = ((PlayerAdmin.Instance != null) ? PlayerAdmin.Instance.GetAllPlayers() : null);
			if (list != null)
			{
				foreach (GameObject item in list)
				{
					if (item != null)
					{
						item.transform.position = gameObject.transform.position + Vector3.up * 2f;
					}
				}
			}
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)"[WorldAdmin] Extração forçada: Todos os jogadores teleportados para o Navio de Fuga!");
			}
			break;
		}
	}

	public void SpawnGoldChestAtPlayer()
	{
		//IL_003b: 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_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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = ((PlayerAdmin.Instance != null) ? PlayerAdmin.Instance.GetLocalPlayer() : null);
		if (val == null)
		{
			return;
		}
		if (cachedChests.Count > 0 && cachedChests[0] != null)
		{
			Vector3 val2 = val.transform.position + val.transform.forward * 2f + Vector3.up * 0.5f;
			GameObject val3 = Object.Instantiate<GameObject>(cachedChests[0], val2, Quaternion.identity);
			val3.SetActive(true);
			if (AdminModPlugin.Log != null)
			{
				AdminModPlugin.Log.LogInfo((object)"[WorldAdmin] Baú de tesouro gerado em frente ao jogador!");
			}
		}
		else if (AdminModPlugin.Log != null)
		{
			AdminModPlugin.Log.LogWarning((object)"[WorldAdmin] Nenhum modelo de baú encontrado em cache para clonar nesta área.");
		}
	}
}