Decompiled source of AdvancedConsole v1.1.9

BepInEx/plugins/com.keklick1337.peak.advancedconsole.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UIElements;
using Zorro.Core;
using Zorro.Core.CLI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.keklick1337.peak.advancedconsole")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.9.0")]
[assembly: AssemblyInformationalVersion("1.1.9+45f0d3a6b1bf4ffa4f5cb25aa004fbf122e3c76e")]
[assembly: AssemblyProduct("com.keklick1337.peak.advancedconsole")]
[assembly: AssemblyTitle("Advanced Peak Console")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.9.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace AdvancedConsole
{
	public static class AchievementCommands
	{
		[ConsoleCommand]
		public static void GrantAchievement(ACHIEVEMENTTYPE achievementType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			try
			{
				AchievementManager.Grant(achievementType);
				Debug.Log((object)$"grantachievement: Achievement '{achievementType}' granted successfully!");
				Plugin.Log.LogInfo((object)$"Achievement granted: {achievementType}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)$"grantachievement: Failed to grant achievement '{achievementType}' - {ex.Message}");
				Plugin.Log.LogError((object)("Failed to grant achievement: " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void GrantAchievementByName(string achievementName)
		{
			//IL_000b: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (Enum.TryParse<ACHIEVEMENTTYPE>(achievementName, ignoreCase: true, out ACHIEVEMENTTYPE result))
				{
					AchievementManager.Grant(result);
					Debug.Log((object)$"grantachievementbyname: Achievement '{result}' granted successfully!");
					Plugin.Log.LogInfo((object)$"Achievement granted by name: {result}");
				}
				else
				{
					Debug.LogWarning((object)("grantachievementbyname: Achievement '" + achievementName + "' not found! Use ListAchievements to see available achievements."));
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("grantachievementbyname: Failed to grant achievement '" + achievementName + "' - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ClearAllAchievements()
		{
			try
			{
				AchievementManager.ClearAchievements();
				Debug.Log((object)"clearallachievements: All achievements cleared successfully!");
				Plugin.Log.LogInfo((object)"All achievements cleared");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("clearallachievements: Failed to clear achievements - " + ex.Message));
				Plugin.Log.LogError((object)("Failed to clear achievements: " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ListAchievements()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Debug.Log((object)"=== Available Achievements ===");
				ACHIEVEMENTTYPE[] array = (from ACHIEVEMENTTYPE a in Enum.GetValues(typeof(ACHIEVEMENTTYPE))
					where (int)a > 0
					select a).ToArray();
				ACHIEVEMENTTYPE[] array2 = array;
				foreach (ACHIEVEMENTTYPE val in array2)
				{
					bool flag = false;
					try
					{
						AchievementManager instance = Singleton<AchievementManager>.Instance;
						if ((Object)(object)instance != (Object)null)
						{
							flag = instance.IsAchievementUnlocked(val);
						}
					}
					catch
					{
					}
					string arg = (flag ? "[UNLOCKED]" : "[LOCKED]");
					Debug.Log((object)$"  {val} {arg}");
				}
				Debug.Log((object)$"Total achievements: {array.Length}");
				Debug.Log((object)"Use GrantAchievement or GrantAchievementByName to unlock achievements");
				Plugin.Log.LogInfo((object)$"Listed {array.Length} achievements");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("listachievements: Failed to list achievements - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void AchievementInfo(ACHIEVEMENTTYPE achievementType)
		{
			//IL_0005: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Debug.Log((object)$"=== Achievement Info: {achievementType} ===");
				string achievementDescription = GetAchievementDescription(achievementType);
				Debug.Log((object)("Description: " + achievementDescription));
				try
				{
					AchievementManager instance = Singleton<AchievementManager>.Instance;
					if ((Object)(object)instance != (Object)null)
					{
						bool flag = instance.IsAchievementUnlocked(achievementType);
						Debug.Log((object)("Status: " + (flag ? "UNLOCKED" : "LOCKED")));
						if (instance.achievementsEarnedThisRun.Contains(achievementType))
						{
							Debug.Log((object)"Earned this run: YES");
						}
					}
				}
				catch
				{
					Debug.Log((object)"Status: Unable to check");
				}
				Plugin.Log.LogInfo((object)$"Achievement info displayed: {achievementType}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("achievementinfo: Failed to get achievement info - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void GrantRandomAchievement()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ACHIEVEMENTTYPE[] array = (from ACHIEVEMENTTYPE a in Enum.GetValues(typeof(ACHIEVEMENTTYPE))
					where (int)a > 0
					select a).ToArray();
				if (array.Length == 0)
				{
					Debug.LogWarning((object)"grantrandomachievement: No achievements available!");
					return;
				}
				ACHIEVEMENTTYPE val = array[Random.Range(0, array.Length)];
				AchievementManager.Grant(val);
				Debug.Log((object)$"grantrandomachievement: Random achievement '{val}' granted!");
				Plugin.Log.LogInfo((object)$"Random achievement granted: {val}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("grantrandomachievement: Failed to grant random achievement - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void GrantAllAchievements()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ACHIEVEMENTTYPE[] array = (from ACHIEVEMENTTYPE a in Enum.GetValues(typeof(ACHIEVEMENTTYPE))
					where (int)a > 0
					select a).ToArray();
				int num = 0;
				ACHIEVEMENTTYPE[] array2 = array;
				foreach (ACHIEVEMENTTYPE val in array2)
				{
					try
					{
						AchievementManager.Grant(val);
						num++;
					}
					catch (Exception ex)
					{
						Debug.LogWarning((object)$"grantallachievements: Failed to grant {val} - {ex.Message}");
					}
				}
				Debug.Log((object)$"grantallachievements: Granted {num}/{array.Length} achievements!");
				Plugin.Log.LogInfo((object)$"Granted all achievements: {num}/{array.Length}");
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)("grantallachievements: Failed to grant all achievements - " + ex2.Message));
			}
		}

		[ConsoleCommand]
		public static void AchievementStats()
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ACHIEVEMENTTYPE[] array = (from ACHIEVEMENTTYPE a in Enum.GetValues(typeof(ACHIEVEMENTTYPE))
					where (int)a > 0
					select a).ToArray();
				int num = 0;
				int num2 = 0;
				AchievementManager instance = Singleton<AchievementManager>.Instance;
				if ((Object)(object)instance != (Object)null)
				{
					ACHIEVEMENTTYPE[] array2 = array;
					foreach (ACHIEVEMENTTYPE val in array2)
					{
						try
						{
							if (instance.IsAchievementUnlocked(val))
							{
								num++;
							}
							if (instance.achievementsEarnedThisRun.Contains(val))
							{
								num2++;
							}
						}
						catch
						{
						}
					}
				}
				Debug.Log((object)"=== Achievement Statistics ===");
				Debug.Log((object)$"Total achievements: {array.Length}");
				Debug.Log((object)$"Unlocked: {num}/{array.Length} ({(float)num / (float)array.Length * 100f:F1}%)");
				Debug.Log((object)$"Earned this run: {num2}");
				Debug.Log((object)$"Remaining: {array.Length - num}");
				Plugin.Log.LogInfo((object)$"Achievement stats: {num}/{array.Length} unlocked, {num2} this run");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("achievementstats: Failed to get achievement stats - " + ex.Message));
			}
		}

		private static string GetAchievementDescription(ACHIEVEMENTTYPE achievementType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected I4, but got Unknown
			return (achievementType - 1) switch
			{
				0 => "Tried Your Best - Keep trying!", 
				1 => "Beachcomber - Master of the Beach biome", 
				2 => "Trailblazer - Explorer of trails", 
				3 => "Alpinist - Mountain climbing expert", 
				4 => "Volcanology - Volcano and lava expert", 
				5 => "Cooking - Master chef of the wilderness", 
				6 => "Happy Camper - Camping enthusiast", 
				7 => "Bouldering - Rock climbing specialist", 
				8 => "Toxicology - Poison and antidote expert", 
				9 => "Foraging - Master of finding resources", 
				10 => "Esoterica - Hidden knowledge seeker", 
				11 => "Peak - Summit conquerer", 
				12 => "Lone Wolf - Solo adventurer", 
				13 => "Clutch - Rescue specialist", 
				14 => "Balloon - High altitude specialist", 
				15 => "Leave No Trace - Environmental protector", 
				16 => "Speed Climber - Fast ascent specialist", 
				17 => "Bing Bong - Mystery achievement", 
				18 => "Naturalist - Nature observer", 
				19 => "Gourmand - Fine food connoisseur", 
				20 => "Mycology - Mushroom expert", 
				21 => "First Aid - Medical specialist", 
				22 => "Survivalist - Ultimate survival expert", 
				23 => "Animal Serenading - Animal whisperer", 
				24 => "Arborist - Tree expert", 
				25 => "Mentorship - Teacher and guide", 
				26 => "Knot Tying - Rope work specialist", 
				27 => "Emergency Preparedness - Always ready", 
				28 => "Ascender - Climbing equipment master", 
				29 => "Plunderer - Loot collector", 
				30 => "Bookworm - Knowledge seeker", 
				31 => "Endurance - Stamina specialist", 
				_ => "Unknown achievement", 
			};
		}
	}
	public class AchievementTypeCLIParser : CLITypeParser
	{
		public override object? Parse(string raw)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			if (Enum.TryParse<ACHIEVEMENTTYPE>(raw, ignoreCase: true, out ACHIEVEMENTTYPE result))
			{
				return result;
			}
			return null;
		}

		public override List<ParameterAutocomplete> FindAutocomplete(string textSoFar)
		{
			string textSoFar2 = textSoFar;
			return (from name in Enum.GetNames(typeof(ACHIEVEMENTTYPE))
				where name != "NONE"
				where name.StartsWith(textSoFar2, StringComparison.OrdinalIgnoreCase)
				select name).Select((Func<string, ParameterAutocomplete>)((string name) => new ParameterAutocomplete(name))).ToList();
		}
	}
	public class CharacterAfflictionsRPC : MonoBehaviourPunCallbacks
	{
		private CharacterAfflictions CA => ((Component)this).GetComponent<CharacterAfflictions>();

		[PunRPC]
		public void RPC_ClearStatus(int statusType)
		{
			//IL_0001: 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)
			STATUSTYPE val = (STATUSTYPE)statusType;
			CA.SetStatus(val, 0f);
		}

		[PunRPC]
		public void RPC_AddStatus(int statusType, float amount)
		{
			//IL_0001: 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)
			STATUSTYPE val = (STATUSTYPE)statusType;
			CA.AddStatus(val, amount, false);
		}

		[PunRPC]
		public void RPC_ClearCold()
		{
			CA.SetStatus((STATUSTYPE)2, 0f);
		}

		[PunRPC]
		public void RPC_AddCold(float amt)
		{
			CA.AddStatus((STATUSTYPE)2, amt, false);
		}

		[PunRPC]
		public void RPC_ClearHunger()
		{
			CA.SetStatus((STATUSTYPE)1, 0f);
		}

		[PunRPC]
		public void RPC_AddHunger(float amt)
		{
			CA.AddStatus((STATUSTYPE)1, amt, false);
		}

		[PunRPC]
		public void RPC_ClearPoison()
		{
			CA.SetStatus((STATUSTYPE)3, 0f);
		}

		[PunRPC]
		public void RPC_AddPoison(float amt)
		{
			CA.AddStatus((STATUSTYPE)3, amt, false);
		}

		[PunRPC]
		public void RPC_ClearCurse()
		{
			CA.SetStatus((STATUSTYPE)5, 0f);
		}

		[PunRPC]
		public void RPC_AddCurse(float amt)
		{
			CA.AddStatus((STATUSTYPE)5, amt, false);
		}

		[PunRPC]
		public void RPC_ClearDrowsy()
		{
			CA.SetStatus((STATUSTYPE)6, 0f);
		}

		[PunRPC]
		public void RPC_AddDrowsy(float amt)
		{
			CA.AddStatus((STATUSTYPE)6, amt, false);
		}

		[PunRPC]
		public void RPC_ClearInjury()
		{
			CA.SetStatus((STATUSTYPE)0, 0f);
		}

		[PunRPC]
		public void RPC_AddInjury(float amt)
		{
			CA.AddStatus((STATUSTYPE)0, amt, false);
		}

		[PunRPC]
		public void RPC_ClearHot()
		{
			CA.SetStatus((STATUSTYPE)8, 0f);
		}

		[PunRPC]
		public void RPC_AddHot(float amt)
		{
			CA.AddStatus((STATUSTYPE)8, amt, false);
		}

		[PunRPC]
		public void RPC_ClearAllStatuses()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			foreach (STATUSTYPE value in Enum.GetValues(typeof(STATUSTYPE)))
			{
				CA.SetStatus(value, 0f);
			}
		}
	}
	[HarmonyPatch]
	public static class CharacterItemsPatch
	{
		[HarmonyPatch(typeof(CharacterItems), "UpdateBalloonCount")]
		[HarmonyPrefix]
		public static bool UpdateBalloonCount_Prefix(CharacterItems __instance, ItemSlot[] slots)
		{
			try
			{
				if ((Object)(object)__instance?.character?.refs?.items == (Object)null || (Object)(object)__instance.character.refs.balloons == (Object)null)
				{
					return false;
				}
				if (__instance.character.refs.items.currentSelectedSlot.IsSome)
				{
					if ((Object)(object)__instance.character.player == (Object)null)
					{
						__instance.character.refs.balloons.heldBalloonCount = 0;
						return false;
					}
					ItemSlot itemSlot = __instance.character.player.GetItemSlot(__instance.character.refs.items.currentSelectedSlot.Value);
					if (itemSlot != null && !itemSlot.IsEmpty() && (Object)(object)itemSlot.prefab != (Object)null && __instance.character.refs.items.currentSelectedSlot.IsSome && (Object)(object)((Component)itemSlot.prefab).GetComponent<Balloon>() != (Object)null)
					{
						__instance.character.refs.balloons.heldBalloonCount = 1;
					}
					else
					{
						__instance.character.refs.balloons.heldBalloonCount = 0;
					}
				}
				else
				{
					__instance.character.refs.balloons.heldBalloonCount = 0;
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Error in UpdateBalloonCount patch: " + ex.Message));
				if ((Object)(object)__instance?.character?.refs?.balloons != (Object)null)
				{
					__instance.character.refs.balloons.heldBalloonCount = 0;
				}
				return false;
			}
		}
	}
	public static class ConfigCommands
	{
		[ConsoleCommand]
		public static void ShowConfig()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"=== Advanced Console Configuration ===");
			Debug.Log((object)PluginConfig.GetConfigInfo());
			Debug.Log((object)"=== Current Key Bindings ===");
			Debug.Log((object)$"Console Toggle: {PluginConfig.ConsoleToggleKey} (press to show/hide console)");
			Debug.Log((object)$"Console DPI Reset: {PluginConfig.ConsoleDPIResetKey} (press to reset console scaling)");
			Debug.Log((object)"=== Configuration Help ===");
			Debug.Log((object)"Use 'ConfigCommands.ShowKeyCodes' to see available keys");
			Debug.Log((object)"Use 'ConfigCommands.OpenConfigFolder' to open config file location");
			Plugin.Log.LogInfo((object)"Configuration displayed in console");
		}

		[ConsoleCommand]
		public static void SetConsoleToggleKey(KeyCode key)
		{
			//IL_0005: 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_0034: Expected I4, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected I4, but got Unknown
			//IL_0070: 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_007c: Expected I4, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Debug.Log((object)$"setconsoletogglekey: To change console toggle key to {key}:");
				Debug.Log((object)"1. Close the game");
				Debug.Log((object)"2. Open config file: BepInEx/config/keklick1337.AdvancedConsole.cfg");
				Debug.Log((object)$"3. Find [Keybinds] section and change ConsoleToggleKey = {(int)key}");
				Debug.Log((object)"4. Save the file and restart the game");
				Debug.Log((object)$"Current key: {PluginConfig.ConsoleToggleKey} (code: {(int)PluginConfig.ConsoleToggleKey})");
				Debug.Log((object)$"Desired key: {key} (code: {(int)key})");
				Plugin.Log.LogInfo((object)$"Console toggle key change requested: {PluginConfig.ConsoleToggleKey} -> {key}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("setconsoletogglekey: Error - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void SetConsoleDPIResetKey(KeyCode key)
		{
			//IL_0005: 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_0034: Expected I4, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected I4, but got Unknown
			//IL_0070: 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_007c: Expected I4, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Debug.Log((object)$"setconsoledpiresetkey: To change console DPI reset key to {key}:");
				Debug.Log((object)"1. Close the game");
				Debug.Log((object)"2. Open config file: BepInEx/config/keklick1337.AdvancedConsole.cfg");
				Debug.Log((object)$"3. Find [Keybinds] section and change ConsoleDPIResetKey = {(int)key}");
				Debug.Log((object)"4. Save the file and restart the game");
				Debug.Log((object)$"Current key: {PluginConfig.ConsoleDPIResetKey} (code: {(int)PluginConfig.ConsoleDPIResetKey})");
				Debug.Log((object)$"Desired key: {key} (code: {(int)key})");
				Plugin.Log.LogInfo((object)$"Console DPI reset key change requested: {PluginConfig.ConsoleDPIResetKey} -> {key}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("setconsoledpiresetkey: Error - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ReloadConfig()
		{
			try
			{
				PluginConfig.Reload();
				Debug.Log((object)"reloadconfig: Configuration reloaded from disk");
				Debug.Log((object)"Note: Key bindings require game restart to take effect");
				ShowConfig();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("reloadconfig: Error - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void SaveConfig()
		{
			try
			{
				PluginConfig.Save();
				Debug.Log((object)"saveconfig: Configuration saved to disk");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("saveconfig: Error - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ShowKeyCodes()
		{
			Debug.Log((object)"=== Popular KeyCodes for binding ===");
			Debug.Log((object)"Function Keys:");
			Debug.Log((object)$"  F1 = {282}, F2 = {283}, F3 = {284}, F4 = {285}");
			Debug.Log((object)$"  F5 = {286}, F6 = {287}, F7 = {288}, F8 = {289}");
			Debug.Log((object)$"  F9 = {290}, F10 = {291}, F11 = {292}, F12 = {293}");
			Debug.Log((object)"Special Keys:");
			Debug.Log((object)$"  Tilde (~) = {96}, Tab = {9}");
			Debug.Log((object)$"  Insert = {277}, Delete = {127}");
			Debug.Log((object)$"  Home = {278}, End = {279}");
			Debug.Log((object)$"  Page Up = {280}, Page Down = {281}");
			Debug.Log((object)"Modifier Keys:");
			Debug.Log((object)$"  Left Ctrl = {306}, Right Ctrl = {305}");
			Debug.Log((object)$"  Left Alt = {308}, Right Alt = {307}");
			Debug.Log((object)$"  Left Shift = {304}, Right Shift = {303}");
			Debug.Log((object)"Usage: ConfigCommands.SetConsoleToggleKey <KeyCode>");
			Debug.Log((object)"Example: ConfigCommands.SetConsoleToggleKey BackQuote");
		}

		[ConsoleCommand]
		public static void OpenConfigFolder()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			try
			{
				string text = Path.Combine(Paths.ConfigPath, "keklick1337.AdvancedConsole.cfg");
				string text2 = Path.GetDirectoryName(text) ?? Paths.ConfigPath;
				Debug.Log((object)"openconfigfolder: Config file location:");
				Debug.Log((object)("  " + text));
				Debug.Log((object)("  Directory: " + text2));
				if ((int)Application.platform == 2 || (int)Application.platform == 7)
				{
					try
					{
						Process.Start("explorer.exe", text2);
						Debug.Log((object)"openconfigfolder: Opened config folder in Windows Explorer");
					}
					catch
					{
						Debug.Log((object)"openconfigfolder: Could not open folder automatically. Please navigate manually to the path above.");
					}
				}
				else
				{
					Debug.Log((object)"openconfigfolder: Automatic folder opening only supported on Windows. Please navigate manually to the path above.");
				}
				Plugin.Log.LogInfo((object)("Config folder access requested: " + text2));
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("openconfigfolder: Error - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void CreateExampleConfig()
		{
			try
			{
				string text = Path.Combine(Paths.ConfigPath, "AdvancedConsole_Example.cfg");
				string contents = "# Advanced Console Configuration Example\r\n# This file shows all available settings with descriptions\r\n# Copy values to keklick1337.AdvancedConsole.cfg to apply changes\r\n\r\n[Keybinds]\r\n\r\n# Key to toggle console visibility\r\n# Popular choices: F1=282, F2=283, F3=284, F4=285, F5=286\r\n# BackQuote=96 (tilde ~), Tab=9, Insert=277, Delete=127\r\nConsoleToggleKey = 282\r\n\r\n# Key to reset console DPI to default\r\n# Useful if console becomes too small/large due to scaling issues\r\nConsoleDPIResetKey = 283\r\n\r\n[General]\r\n\r\n# Enable extended debug logging for troubleshooting\r\nEnableDebugLogs = true\r\n\r\n# Enable mod detection system to identify other players' mods\r\nEnableModDetection = true\r\n\r\n[ServerInfo]\r\n\r\n# Automatically refresh Server Info page\r\nAutoRefresh = true\r\n\r\n# How often to refresh Server Info in seconds (1-60)\r\nRefreshInterval = 5.0\r\n\r\n[Distance]\r\n\r\n# Maximum raycast distance for teleport and spawn commands (100-10000 meters)\r\n# Used when teleporting to camera target or spawning items at camera position\r\nMaxRaycastDistance = 5000.0\r\n\r\n# Fallback distance when raycast doesn't hit anything (5-100 meters)\r\n# Used when camera raycast goes into empty space\r\nFallbackDistance = 25.0\r\n\r\n# Key Code Reference:\r\n# A-Z = 97-122, 0-9 = 48-57\r\n# F1-F12 = 282-293\r\n# Arrow Keys: Up=273, Down=274, Right=275, Left=276\r\n# Space=32, Enter=13, Escape=27\r\n# For complete list, use: ConfigCommands.ShowKeyCodes\r\n";
				File.WriteAllText(text, contents);
				Debug.Log((object)"createexampleconfig: Created example config file:");
				Debug.Log((object)("  " + text));
				Debug.Log((object)"Use this file as reference for configuration options");
				Plugin.Log.LogInfo((object)("Example config created: " + text));
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("createexampleconfig: Error - " + ex.Message));
			}
		}
	}
	[HarmonyPatch]
	public static class ConsoleLogPatch
	{
		private class LogGroupEntry
		{
			public string OriginalMessage { get; set; } = "";


			public LogType LogType { get; set; }

			public DateTime FirstOccurrence { get; set; }

			public DateTime LastOccurrence { get; set; }

			public int Count { get; set; } = 1;


			public List<DateTime> AllOccurrences { get; set; } = new List<DateTime>();


			public string Stacktrace { get; set; } = "";

		}

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

		private static readonly TimeSpan _groupingTimeWindow = TimeSpan.FromMinutes(5.0);

		public static void Initialize()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			try
			{
				Harmony val = new Harmony("com.keklick1337.peak.advancedconsole.logpatch");
				Type typeFromHandle = typeof(DebugUIHandler);
				MethodInfo method = typeFromHandle.GetMethod("AddEntry", BindingFlags.Instance | BindingFlags.Public);
				if (method != null)
				{
					MethodInfo method2 = typeof(ConsoleLogPatch).GetMethod("AddEntryPrefix", BindingFlags.Static | BindingFlags.NonPublic);
					val.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.Log.LogInfo((object)"Successfully patched DebugUIHandler.AddEntry");
				}
				else
				{
					Plugin.Log.LogError((object)"Could not find DebugUIHandler.AddEntry method");
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Failed to initialize ConsoleLogPatch: {arg}");
			}
		}

		private static bool AddEntryPrefix(DebugUIHandler __instance, ref ConsoleLogEntry entry)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (string.IsNullOrWhiteSpace(entry.Log))
				{
					return true;
				}
				string key = $"{entry.LogType}:{entry.Log.Trim()}:{entry.Stacktrace}";
				DateTime now = DateTime.Now;
				if (_logGroups.TryGetValue(key, out LogGroupEntry value))
				{
					if (now - value.LastOccurrence <= _groupingTimeWindow)
					{
						value.Count++;
						value.LastOccurrence = now;
						value.AllOccurrences.Add(now);
						ConsoleLogEntry val = default(ConsoleLogEntry);
						val.Log = $"[{value.Count}] {value.OriginalMessage}";
						val.LogType = value.LogType;
						val.LogTime = value.FirstOccurrence;
						val.Frame = entry.Frame;
						val.Stacktrace = value.Stacktrace;
						ConsoleLogEntry item = val;
						List<ConsoleLogEntry> logEntries = GetLogEntries(__instance);
						if (logEntries != null)
						{
							for (int num = logEntries.Count - 1; num >= 0; num--)
							{
								ConsoleLogEntry val2 = logEntries[num];
								if (IsSameGroup(val2.Log, val2.LogType, val2.Stacktrace, value))
								{
									logEntries.RemoveAt(num);
									break;
								}
							}
							logEntries.Add(item);
						}
						return false;
					}
					_logGroups.Remove(key);
				}
				LogGroupEntry logGroupEntry = new LogGroupEntry
				{
					OriginalMessage = entry.Log,
					LogType = entry.LogType,
					FirstOccurrence = now,
					LastOccurrence = now,
					Count = 1,
					Stacktrace = entry.Stacktrace
				};
				logGroupEntry.AllOccurrences.Add(now);
				_logGroups[key] = logGroupEntry;
				return true;
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Error in AddEntryPrefix: {arg}");
				return true;
			}
		}

		private static bool IsSameGroup(string entryLog, LogType entryLogType, string entryStacktrace, LogGroupEntry group)
		{
			//IL_004e: 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)
			string text = entryLog;
			if (text.StartsWith("[") && text.Contains("] "))
			{
				int num = text.IndexOf("] ");
				if (num > 0)
				{
					text = text.Substring(num + 2);
				}
			}
			if (text.Trim() == group.OriginalMessage.Trim() && entryLogType == group.LogType)
			{
				return entryStacktrace == group.Stacktrace;
			}
			return false;
		}

		private static List<ConsoleLogEntry>? GetLogEntries(DebugUIHandler handler)
		{
			try
			{
				return typeof(DebugUIHandler).GetField("m_logEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(handler) as List<ConsoleLogEntry>;
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Error getting log entries: {arg}");
				return null;
			}
		}

		public static void CleanupOldEntries()
		{
			try
			{
				DateTime cutoffTime = DateTime.Now - _groupingTimeWindow;
				List<string> list = (from kvp in _logGroups
					where kvp.Value.LastOccurrence < cutoffTime
					select kvp.Key).ToList();
				foreach (string item in list)
				{
					_logGroups.Remove(item);
				}
				if (list.Count > 0)
				{
					Plugin.Log.LogInfo((object)$"Cleaned up {list.Count} old log groups");
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Error cleaning up old entries: {arg}");
			}
		}

		public static void GetLogGroupStats()
		{
			try
			{
				Plugin.Log.LogInfo((object)$"Active log groups: {_logGroups.Count}");
				IEnumerable<LogGroupEntry> enumerable = _logGroups.Values.OrderByDescending((LogGroupEntry g) => g.Count).Take(10);
				foreach (LogGroupEntry item in enumerable)
				{
					Plugin.Log.LogInfo((object)$"[{item.Count}] {item.OriginalMessage.Substring(0, Math.Min(50, item.OriginalMessage.Length))}...");
				}
			}
			catch (Exception arg)
			{
				Plugin.Log.LogError((object)$"Error getting log group stats: {arg}");
			}
		}
	}
	public class AdvancedConsolePage : DebugPage
	{
		public class ConsoleCommandInfo
		{
			public string MethodName { get; set; } = "";


			public string FullName { get; set; } = "";


			public string Description { get; set; } = "";


			public ParameterInfo[] Parameters { get; set; } = Array.Empty<ParameterInfo>();


			public MethodInfo Method { get; set; }

			public Type DeclaringType { get; set; }

			public bool RequiresMasterClient { get; set; }

			public bool IsRPCCommand { get; set; }
		}

		private Dictionary<string, List<ConsoleCommandInfo>> _commandGroups = new Dictionary<string, List<ConsoleCommandInfo>>();

		private VisualElement _commandsContainer;

		private DropdownField _groupFilter;

		private TextField _searchField;

		private Button _refreshButton;

		public AdvancedConsolePage()
		{
			((VisualElement)this).name = "AdvancedConsole";
			ScanForCommands();
			SetupPage();
		}

		private void SetupPage()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_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_005f: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: 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_01f1: 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_0205: Expected O, but got Unknown
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Expected O, but got Unknown
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Expected O, but got Unknown
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Expected O, but got Unknown
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Expected O, but got Unknown
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Expected O, but got Unknown
			Label val = new Label("Advanced Console Commands");
			((VisualElement)val).style.fontSize = StyleLength.op_Implicit(20f);
			((VisualElement)val).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			((VisualElement)val).style.color = StyleColor.op_Implicit(new Color(0.2f, 0.9f, 0.2f));
			((VisualElement)val).style.marginBottom = StyleLength.op_Implicit(8f);
			((VisualElement)val).style.marginTop = StyleLength.op_Implicit(3f);
			Label val2 = val;
			((VisualElement)this).Add((VisualElement)(object)val2);
			VisualElement val3 = new VisualElement();
			val3.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
			val3.style.marginBottom = StyleLength.op_Implicit(8f);
			val3.style.backgroundColor = StyleColor.op_Implicit(new Color(0.15f, 0.15f, 0.15f, 0.8f));
			val3.style.paddingTop = StyleLength.op_Implicit(4f);
			val3.style.paddingBottom = StyleLength.op_Implicit(4f);
			val3.style.paddingLeft = StyleLength.op_Implicit(6f);
			val3.style.paddingRight = StyleLength.op_Implicit(6f);
			val3.style.borderTopLeftRadius = StyleLength.op_Implicit(4f);
			val3.style.borderTopRightRadius = StyleLength.op_Implicit(4f);
			val3.style.borderBottomLeftRadius = StyleLength.op_Implicit(4f);
			val3.style.borderBottomRightRadius = StyleLength.op_Implicit(4f);
			VisualElement val4 = val3;
			TextField val5 = new TextField("Search:");
			((VisualElement)val5).style.flexGrow = StyleFloat.op_Implicit(1f);
			((VisualElement)val5).style.marginRight = StyleLength.op_Implicit(8f);
			((VisualElement)val5).style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
			((VisualElement)val5).style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
			_searchField = val5;
			((CallbackEventHandler)_searchField).RegisterCallback<AttachToPanelEvent>((EventCallback<AttachToPanelEvent>)delegate
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				VisualElement val12 = UQueryExtensions.Q<VisualElement>((VisualElement)(object)_searchField, (string)null, "unity-text-field__input");
				if (val12 != null)
				{
					val12.style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
					val12.style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
				}
			}, (TrickleDown)0);
			INotifyValueChangedExtensions.RegisterValueChangedCallback<string>((INotifyValueChanged<string>)(object)_searchField, (EventCallback<ChangeEvent<string>>)OnSearchChanged);
			val4.Add((VisualElement)(object)_searchField);
			List<string> list = new List<string> { "All Groups" };
			list.AddRange(_commandGroups.Keys);
			DropdownField val6 = new DropdownField("Category:", list, 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val6).style.width = StyleLength.op_Implicit(350f);
			((VisualElement)val6).style.marginRight = StyleLength.op_Implicit(8f);
			((VisualElement)val6).style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
			((VisualElement)val6).style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
			_groupFilter = val6;
			INotifyValueChangedExtensions.RegisterValueChangedCallback<string>((INotifyValueChanged<string>)(object)_groupFilter, (EventCallback<ChangeEvent<string>>)OnGroupFilterChanged);
			val4.Add((VisualElement)(object)_groupFilter);
			Button val7 = new Button((Action)RefreshCommands)
			{
				text = "Refresh"
			};
			((VisualElement)val7).style.width = StyleLength.op_Implicit(90f);
			((VisualElement)val7).style.backgroundColor = StyleColor.op_Implicit(new Color(0.2f, 0.5f, 0.8f));
			((VisualElement)val7).style.color = StyleColor.op_Implicit(Color.white);
			_refreshButton = val7;
			val4.Add((VisualElement)(object)_refreshButton);
			((VisualElement)this).Add(val4);
			ScrollView val8 = new ScrollView();
			((VisualElement)val8).style.flexGrow = StyleFloat.op_Implicit(1f);
			ScrollView val9 = val8;
			_commandsContainer = new VisualElement();
			((VisualElement)val9).Add(_commandsContainer);
			((VisualElement)this).Add((VisualElement)(object)val9);
			Label val10 = new Label($"Found {_commandGroups.Sum<KeyValuePair<string, List<ConsoleCommandInfo>>>((KeyValuePair<string, List<ConsoleCommandInfo>> g) => g.Value.Count)} commands in {_commandGroups.Count} groups");
			((VisualElement)val10).style.fontSize = StyleLength.op_Implicit(11f);
			((VisualElement)val10).style.color = StyleColor.op_Implicit(new Color(0.8f, 0.8f, 0.8f));
			((VisualElement)val10).style.marginTop = StyleLength.op_Implicit(4f);
			Label val11 = val10;
			((VisualElement)this).Add((VisualElement)(object)val11);
			RefreshCommandsDisplay();
		}

		private void ScanForCommands()
		{
			_commandGroups.Clear();
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			Assembly[] array = assemblies;
			foreach (Assembly assembly in array)
			{
				try
				{
					Type[] types = assembly.GetTypes();
					Type[] array2 = types;
					foreach (Type type in array2)
					{
						MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
						MethodInfo[] array3 = methods;
						foreach (MethodInfo methodInfo in array3)
						{
							ConsoleCommandAttribute customAttribute = ((MemberInfo)methodInfo).GetCustomAttribute<ConsoleCommandAttribute>();
							if (customAttribute != null)
							{
								AddCommandToGroups(methodInfo, type);
							}
						}
					}
				}
				catch (Exception ex)
				{
					Plugin.Log.LogDebug((object)("Error scanning assembly " + assembly.FullName + ": " + ex.Message));
				}
			}
			try
			{
				Type type2 = assemblies.SelectMany(delegate(Assembly a)
				{
					try
					{
						return a.GetTypes();
					}
					catch
					{
						return Array.Empty<Type>();
					}
				}).FirstOrDefault((Type t) => t.Name == "ConsoleHandler");
				if (type2 != null)
				{
					List<FieldInfo> list = (from f in type2.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
						where f.FieldType.IsGenericType && (f.FieldType.GetGenericTypeDefinition() == typeof(Dictionary<, >) || f.Name.ToLower().Contains("command"))
						select f).ToList();
					foreach (FieldInfo item in list)
					{
						try
						{
							object value = item.GetValue(null);
							if (value != null)
							{
								ScanRegisteredCommands(value);
							}
						}
						catch (Exception ex2)
						{
							Plugin.Log.LogDebug((object)("Error accessing command field " + item.Name + ": " + ex2.Message));
						}
					}
				}
			}
			catch (Exception ex3)
			{
				Plugin.Log.LogDebug((object)("Error scanning registered commands: " + ex3.Message));
			}
			Plugin.Log.LogInfo((object)$"Advanced Console: Found {_commandGroups.Sum<KeyValuePair<string, List<ConsoleCommandInfo>>>((KeyValuePair<string, List<ConsoleCommandInfo>> g) => g.Value.Count)} commands in {_commandGroups.Count} groups");
		}

		private void AddCommandToGroups(MethodInfo method, Type type)
		{
			ConsoleCommandInfo item = new ConsoleCommandInfo
			{
				MethodName = method.Name,
				FullName = type.Name + "." + method.Name,
				Description = GetCommandDescription(method),
				Parameters = method.GetParameters(),
				Method = method,
				DeclaringType = type,
				RequiresMasterClient = DoesRequireMasterClient(method),
				IsRPCCommand = IsRPCCommand(method)
			};
			string groupName = GetGroupName(type.Name);
			if (!_commandGroups.ContainsKey(groupName))
			{
				_commandGroups[groupName] = new List<ConsoleCommandInfo>();
			}
			_commandGroups[groupName].Add(item);
		}

		private void ScanRegisteredCommands(object commandDict)
		{
			try
			{
				Type type = commandDict.GetType();
				if (!type.IsGenericType || !(type.GetGenericTypeDefinition() == typeof(Dictionary<, >)))
				{
					return;
				}
				Type type2 = type.GetGenericArguments()[0];
				Type type3 = type.GetGenericArguments()[1];
				if (!(type2 == typeof(string)))
				{
					return;
				}
				object obj = type.GetProperty("Keys")?.GetValue(commandDict);
				if (!(obj is IEnumerable<string> enumerable))
				{
					return;
				}
				foreach (string commandName in enumerable)
				{
					if (!commandName.Contains("."))
					{
						continue;
					}
					string[] array = commandName.Split('.');
					if (array.Length >= 2)
					{
						string typeName = array[0];
						string methodName = array[1];
						ConsoleCommandInfo item = new ConsoleCommandInfo
						{
							MethodName = methodName,
							FullName = commandName,
							Description = GetCommandDescription(methodName),
							Parameters = Array.Empty<ParameterInfo>(),
							Method = null,
							DeclaringType = null,
							RequiresMasterClient = false,
							IsRPCCommand = false
						};
						string groupName = GetGroupName(typeName);
						if (!_commandGroups.ContainsKey(groupName))
						{
							_commandGroups[groupName] = new List<ConsoleCommandInfo>();
						}
						ConsoleCommandInfo consoleCommandInfo = _commandGroups[groupName].FirstOrDefault((ConsoleCommandInfo c) => c.FullName == commandName);
						if (consoleCommandInfo == null)
						{
							_commandGroups[groupName].Add(item);
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("Error scanning registered commands: " + ex.Message));
			}
		}

		private string GetCommandDescription(string methodName)
		{
			string text = Regex.Replace(methodName, "([a-z])([A-Z])", "$1 $2").ToLower();
			return char.ToUpper(text[0]) + text.Substring(1);
		}

		private string GetGroupName(string typeName)
		{
			if (typeName.Contains("Teleport"))
			{
				return "Teleportation";
			}
			if (typeName.Contains("Fun"))
			{
				return "Fun Commands";
			}
			if (typeName.Contains("Environment"))
			{
				return "Environment";
			}
			if (typeName.Contains("Spawn"))
			{
				return "Spawn & Items";
			}
			if (typeName.Contains("RPC"))
			{
				return "RPC Commands";
			}
			if (typeName.Contains("Status"))
			{
				return "Status Effects";
			}
			if (typeName.Contains("Map"))
			{
				return "Map & Segments";
			}
			if (typeName.Contains("Info"))
			{
				return "Information";
			}
			if (typeName.Contains("Log"))
			{
				return "Console & Logs";
			}
			if (typeName.Contains("Sync"))
			{
				return "Sync Commands";
			}
			if (typeName.Contains("Weather"))
			{
				return "Weather";
			}
			if (typeName.Contains("Character"))
			{
				return "Character";
			}
			if (typeName.Contains("Item"))
			{
				return "Items";
			}
			if (typeName.Contains("Console"))
			{
				return "Console & Logs";
			}
			if (typeName.Contains("Application"))
			{
				return "System";
			}
			if (typeName.Contains("Achievement"))
			{
				return "Achievements";
			}
			if (typeName.Contains("Passport"))
			{
				return "Customization";
			}
			if (typeName.Contains("Ascent"))
			{
				return "Ascents";
			}
			if (typeName.Contains("Backpack"))
			{
				return "Backpack";
			}
			return "Other Commands";
		}

		private string GetCommandDescription(MethodInfo method)
		{
			string name = method.Name;
			string text = Regex.Replace(name, "([a-z])([A-Z])", "$1 $2").ToLower();
			return char.ToUpper(text[0]) + text.Substring(1);
		}

		private bool DoesRequireMasterClient(MethodInfo method)
		{
			return method.GetCustomAttribute<MasterClientOnlyAttribute>() != null;
		}

		private bool IsRPCCommand(MethodInfo method)
		{
			Type? declaringType = method.DeclaringType;
			if (((object)declaringType == null || !declaringType.Name.Contains("RPC")) && !method.Name.Contains("RPC"))
			{
				return DoesRequireMasterClient(method);
			}
			return true;
		}

		private void OnSearchChanged(ChangeEvent<string> evt)
		{
			RefreshCommandsDisplay();
		}

		private void OnGroupFilterChanged(ChangeEvent<string> evt)
		{
			RefreshCommandsDisplay();
		}

		private void RefreshCommands()
		{
			ScanForCommands();
			List<string> list = new List<string> { "All Groups" };
			list.AddRange(_commandGroups.Keys);
			((BasePopupField<string, string>)(object)_groupFilter).choices = list;
			RefreshCommandsDisplay();
		}

		private void RefreshCommandsDisplay()
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			_commandsContainer.Clear();
			string searchText = ((BaseField<string>)(object)_searchField).value?.ToLower() ?? "";
			string value = ((BaseField<string>)(object)_groupFilter).value;
			foreach (KeyValuePair<string, List<ConsoleCommandInfo>> commandGroup in _commandGroups)
			{
				if (value != "All Groups" && commandGroup.Key != value)
				{
					continue;
				}
				List<ConsoleCommandInfo> list = commandGroup.Value.Where((ConsoleCommandInfo cmd) => string.IsNullOrEmpty(searchText) || cmd.FullName.ToLower().Contains(searchText) || cmd.Description.ToLower().Contains(searchText)).ToList();
				if (list.Count == 0)
				{
					continue;
				}
				Label val = new Label($"{commandGroup.Key} ({list.Count})");
				((VisualElement)val).style.fontSize = StyleLength.op_Implicit(16f);
				((VisualElement)val).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
				((VisualElement)val).style.color = StyleColor.op_Implicit(new Color(0.2f, 0.8f, 1f));
				((VisualElement)val).style.marginTop = StyleLength.op_Implicit(8f);
				((VisualElement)val).style.marginBottom = StyleLength.op_Implicit(4f);
				((VisualElement)val).style.backgroundColor = StyleColor.op_Implicit(new Color(0.05f, 0.05f, 0.05f, 0.7f));
				((VisualElement)val).style.paddingLeft = StyleLength.op_Implicit(6f);
				((VisualElement)val).style.paddingTop = StyleLength.op_Implicit(2f);
				((VisualElement)val).style.paddingBottom = StyleLength.op_Implicit(2f);
				((VisualElement)val).style.borderTopLeftRadius = StyleLength.op_Implicit(3f);
				((VisualElement)val).style.borderTopRightRadius = StyleLength.op_Implicit(3f);
				((VisualElement)val).style.borderBottomLeftRadius = StyleLength.op_Implicit(3f);
				((VisualElement)val).style.borderBottomRightRadius = StyleLength.op_Implicit(3f);
				Label val2 = val;
				_commandsContainer.Add((VisualElement)(object)val2);
				foreach (ConsoleCommandInfo item in list.OrderBy((ConsoleCommandInfo c) => c.MethodName))
				{
					CreateCommandElement(item);
				}
			}
		}

		private void CreateCommandElement(ConsoleCommandInfo command)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Expected O, but got Unknown
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: 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_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: 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_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Expected O, but got Unknown
			//IL_052e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_056c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ad: Expected O, but got Unknown
			//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Expected O, but got Unknown
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_087c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0887: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08df: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f6: Expected O, but got Unknown
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_040a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_065c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_042b: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_044b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Expected O, but got Unknown
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_073b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0745: Unknown result type (might be due to invalid IL or missing references)
			//IL_0750: Unknown result type (might be due to invalid IL or missing references)
			//IL_075a: Unknown result type (might be due to invalid IL or missing references)
			//IL_076f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0774: Unknown result type (might be due to invalid IL or missing references)
			//IL_077e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Unknown result type (might be due to invalid IL or missing references)
			//IL_0798: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Expected O, but got Unknown
			//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0703: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
			ConsoleCommandInfo command2 = command;
			VisualElement val = new VisualElement();
			val.style.backgroundColor = StyleColor.op_Implicit(new Color(0.08f, 0.08f, 0.08f, 0.6f));
			val.style.marginBottom = StyleLength.op_Implicit(2f);
			val.style.paddingTop = StyleLength.op_Implicit(3f);
			val.style.paddingBottom = StyleLength.op_Implicit(3f);
			val.style.paddingLeft = StyleLength.op_Implicit(6f);
			val.style.paddingRight = StyleLength.op_Implicit(6f);
			val.style.borderTopLeftRadius = StyleLength.op_Implicit(3f);
			val.style.borderTopRightRadius = StyleLength.op_Implicit(3f);
			val.style.borderBottomLeftRadius = StyleLength.op_Implicit(3f);
			val.style.borderBottomRightRadius = StyleLength.op_Implicit(3f);
			val.style.borderLeftWidth = StyleFloat.op_Implicit(2f);
			val.style.borderLeftColor = StyleColor.op_Implicit(new Color(0.2f, 0.6f, 0.9f, 0.8f));
			VisualElement val2 = val;
			VisualElement val3 = new VisualElement();
			val3.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
			val3.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
			VisualElement val4 = val3;
			VisualElement val5 = new VisualElement();
			val5.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
			val5.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
			val5.style.flexGrow = StyleFloat.op_Implicit(1f);
			val5.style.minWidth = StyleLength.op_Implicit(200f);
			VisualElement val6 = val5;
			Label val7 = new Label(command2.FullName);
			((VisualElement)val7).style.fontSize = StyleLength.op_Implicit(12f);
			((VisualElement)val7).style.unityFontStyleAndWeight = StyleEnum<FontStyle>.op_Implicit((FontStyle)1);
			((VisualElement)val7).style.color = StyleColor.op_Implicit(new Color(0.9f, 0.9f, 0.9f));
			((VisualElement)val7).style.marginRight = StyleLength.op_Implicit(6f);
			((VisualElement)val7).style.flexShrink = StyleFloat.op_Implicit(0f);
			((VisualElement)val7).style.whiteSpace = StyleEnum<WhiteSpace>.op_Implicit((WhiteSpace)1);
			Label val8 = val7;
			val6.Add((VisualElement)(object)val8);
			if (command2.IsRPCCommand)
			{
				Label val9 = new Label("RPC");
				((VisualElement)val9).style.fontSize = StyleLength.op_Implicit(8f);
				((VisualElement)val9).style.color = StyleColor.op_Implicit(new Color(1f, 0.9f, 0.3f));
				((VisualElement)val9).style.backgroundColor = StyleColor.op_Implicit(new Color(0.4f, 0.3f, 0.1f, 0.8f));
				((VisualElement)val9).style.paddingLeft = StyleLength.op_Implicit(3f);
				((VisualElement)val9).style.paddingRight = StyleLength.op_Implicit(3f);
				((VisualElement)val9).style.paddingTop = StyleLength.op_Implicit(1f);
				((VisualElement)val9).style.paddingBottom = StyleLength.op_Implicit(1f);
				((VisualElement)val9).style.marginRight = StyleLength.op_Implicit(3f);
				((VisualElement)val9).style.borderTopLeftRadius = StyleLength.op_Implicit(2f);
				((VisualElement)val9).style.borderTopRightRadius = StyleLength.op_Implicit(2f);
				((VisualElement)val9).style.borderBottomLeftRadius = StyleLength.op_Implicit(2f);
				((VisualElement)val9).style.borderBottomRightRadius = StyleLength.op_Implicit(2f);
				Label val10 = val9;
				val6.Add((VisualElement)(object)val10);
			}
			if (command2.RequiresMasterClient)
			{
				Label val11 = new Label("MC");
				((VisualElement)val11).style.fontSize = StyleLength.op_Implicit(8f);
				((VisualElement)val11).style.color = StyleColor.op_Implicit(PhotonNetwork.IsMasterClient ? new Color(0.7f, 1f, 0.7f) : new Color(1f, 0.7f, 0.7f));
				((VisualElement)val11).style.backgroundColor = StyleColor.op_Implicit(PhotonNetwork.IsMasterClient ? new Color(0.1f, 0.4f, 0.1f, 0.8f) : new Color(0.4f, 0.1f, 0.1f, 0.8f));
				((VisualElement)val11).style.paddingLeft = StyleLength.op_Implicit(3f);
				((VisualElement)val11).style.paddingRight = StyleLength.op_Implicit(3f);
				((VisualElement)val11).style.paddingTop = StyleLength.op_Implicit(1f);
				((VisualElement)val11).style.paddingBottom = StyleLength.op_Implicit(1f);
				((VisualElement)val11).style.marginRight = StyleLength.op_Implicit(3f);
				((VisualElement)val11).style.borderTopLeftRadius = StyleLength.op_Implicit(2f);
				((VisualElement)val11).style.borderTopRightRadius = StyleLength.op_Implicit(2f);
				((VisualElement)val11).style.borderBottomLeftRadius = StyleLength.op_Implicit(2f);
				((VisualElement)val11).style.borderBottomRightRadius = StyleLength.op_Implicit(2f);
				Label val12 = val11;
				val6.Add((VisualElement)(object)val12);
			}
			val4.Add(val6);
			Label val13 = new Label(command2.Description);
			((VisualElement)val13).style.fontSize = StyleLength.op_Implicit(10f);
			((VisualElement)val13).style.color = StyleColor.op_Implicit(new Color(0.75f, 0.75f, 0.75f));
			((VisualElement)val13).style.width = StyleLength.op_Implicit(200f);
			((VisualElement)val13).style.minWidth = StyleLength.op_Implicit(200f);
			((VisualElement)val13).style.marginRight = StyleLength.op_Implicit(8f);
			Label val14 = val13;
			val4.Add((VisualElement)(object)val14);
			VisualElement val15 = new VisualElement();
			val15.style.flexDirection = StyleEnum<FlexDirection>.op_Implicit((FlexDirection)2);
			val15.style.alignItems = StyleEnum<Align>.op_Implicit((Align)2);
			val15.style.flexGrow = StyleFloat.op_Implicit(1f);
			VisualElement val16 = val15;
			List<VisualElement> inputFields = new List<VisualElement>();
			ParameterInfo[] parameters = command2.Parameters;
			foreach (ParameterInfo parameterInfo in parameters)
			{
				VisualElement val18;
				if (parameterInfo.ParameterType == typeof(Player))
				{
					DropdownField val17 = CreatePlayerDropdown();
					((VisualElement)val17).style.width = StyleLength.op_Implicit(150f);
					((VisualElement)val17).style.marginRight = StyleLength.op_Implicit(4f);
					val18 = (VisualElement)(object)val17;
				}
				else if (parameterInfo.ParameterType == typeof(ConsoleItem))
				{
					DropdownField val19 = CreateItemDropdown();
					((VisualElement)val19).style.width = StyleLength.op_Implicit(150f);
					((VisualElement)val19).style.marginRight = StyleLength.op_Implicit(4f);
					val18 = (VisualElement)(object)val19;
				}
				else if (parameterInfo.ParameterType.IsEnum)
				{
					DropdownField val20 = CreateEnumDropdown(parameterInfo.ParameterType);
					((VisualElement)val20).style.width = StyleLength.op_Implicit(100f);
					((VisualElement)val20).style.marginRight = StyleLength.op_Implicit(4f);
					val18 = (VisualElement)(object)val20;
				}
				else
				{
					TextField val21 = new TextField();
					((VisualElement)val21).style.fontSize = StyleLength.op_Implicit(9f);
					((VisualElement)val21).style.width = StyleLength.op_Implicit(80f);
					((VisualElement)val21).style.marginRight = StyleLength.op_Implicit(4f);
					((VisualElement)val21).style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
					((VisualElement)val21).style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
					TextField val22 = val21;
					VisualElement val23 = UQueryExtensions.Q<VisualElement>((VisualElement)(object)val22, (string)null, "unity-text-field__input");
					if (val23 != null)
					{
						val23.style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
						val23.style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
					}
					((BaseField<string>)(object)val22).SetValueWithoutNotify(GetDefaultParameterValue(parameterInfo));
					if (string.IsNullOrEmpty(((BaseField<string>)(object)val22).value))
					{
						((BaseField<string>)(object)val22).value = parameterInfo.Name ?? "";
					}
					val18 = (VisualElement)(object)val22;
				}
				inputFields.Add(val18);
				val16.Add(val18);
			}
			Button val24 = new Button((Action)delegate
			{
				ExecuteCommand(command2, inputFields);
			})
			{
				text = "▶ Execute"
			};
			((VisualElement)val24).style.width = StyleLength.op_Implicit(85f);
			((VisualElement)val24).style.backgroundColor = StyleColor.op_Implicit(new Color(0.15f, 0.7f, 0.15f));
			((VisualElement)val24).style.color = StyleColor.op_Implicit(Color.white);
			((VisualElement)val24).style.fontSize = StyleLength.op_Implicit(10f);
			((VisualElement)val24).style.marginLeft = StyleLength.op_Implicit(4f);
			Button val25 = val24;
			val16.Add((VisualElement)(object)val25);
			val4.Add(val16);
			val2.Add(val4);
			_commandsContainer.Add(val2);
		}

		private DropdownField CreatePlayerDropdown()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00b6: Expected O, but got Unknown
			List<string> list = new List<string> { "No players" };
			if (PhotonNetwork.IsConnected && PhotonNetwork.PlayerList.Length != 0)
			{
				list = PhotonNetwork.PlayerList.Select((Player p) => p.NickName).ToList();
			}
			DropdownField val = new DropdownField(list, 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val).style.fontSize = StyleLength.op_Implicit(9f);
			((VisualElement)val).style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
			((VisualElement)val).style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
			return val;
		}

		private DropdownField CreateEnumDropdown(Type enumType)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			List<string> list = Enum.GetNames(enumType).ToList();
			DropdownField val = new DropdownField(list, 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val).style.fontSize = StyleLength.op_Implicit(9f);
			((VisualElement)val).style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
			((VisualElement)val).style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
			return val;
		}

		private DropdownField CreateItemDropdown()
		{
			//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_0061: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			List<ConsoleItem> allItems = ConsoleItem.GetAllItems();
			List<string> list = new List<string>();
			if (allItems.Count > 0)
			{
				list = allItems.Select((ConsoleItem item) => item.Name).ToList();
			}
			else
			{
				list.Add("No items available");
			}
			DropdownField val = new DropdownField(list, 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val).style.fontSize = StyleLength.op_Implicit(9f);
			((VisualElement)val).style.backgroundColor = StyleColor.op_Implicit(new Color(0.1f, 0.1f, 0.1f));
			((VisualElement)val).style.color = StyleColor.op_Implicit(new Color(0.95f, 0.95f, 0.95f));
			return val;
		}

		private string GetDefaultParameterValue(ParameterInfo param)
		{
			if (param.HasDefaultValue && param.DefaultValue != null)
			{
				return param.DefaultValue.ToString() ?? "";
			}
			return param.ParameterType.Name switch
			{
				"Single" => "1.0", 
				"Double" => "1.0", 
				"Int32" => "1", 
				"String" => "", 
				"Boolean" => "true", 
				"UInt16" => "1", 
				_ => "", 
			};
		}

		private void ExecuteCommand(ConsoleCommandInfo command, List<VisualElement> inputFields)
		{
			try
			{
				if (command.Method != null)
				{
					object[] array = new object[command.Parameters.Length];
					for (int i = 0; i < command.Parameters.Length; i++)
					{
						ParameterInfo parameterInfo = command.Parameters[i];
						VisualElement val = inputFields[i];
						DropdownField val2 = (DropdownField)(object)((val is DropdownField) ? val : null);
						if (val2 != null)
						{
							if (parameterInfo.ParameterType == typeof(Player))
							{
								string selectedPlayerName = ((BaseField<string>)(object)val2).value;
								Player val3 = ((IEnumerable<Player>)PhotonNetwork.PlayerList).FirstOrDefault((Func<Player, bool>)((Player p) => p.NickName == selectedPlayerName));
								array[i] = val3;
							}
							else if (parameterInfo.ParameterType == typeof(ConsoleItem))
							{
								string selectedItemName = ((BaseField<string>)(object)val2).value;
								List<ConsoleItem> allItems = ConsoleItem.GetAllItems();
								ConsoleItem consoleItem = allItems.FirstOrDefault((ConsoleItem item) => item.Name == selectedItemName);
								array[i] = consoleItem ?? allItems.FirstOrDefault();
							}
							else if (parameterInfo.ParameterType.IsEnum)
							{
								string value = ((BaseField<string>)(object)val2).value;
								array[i] = Enum.Parse(parameterInfo.ParameterType, value);
							}
							continue;
						}
						TextField val4 = (TextField)(object)((val is TextField) ? val : null);
						if (val4 != null)
						{
							string value2 = ((BaseField<string>)(object)val4).value;
							if (string.IsNullOrEmpty(value2) && parameterInfo.HasDefaultValue)
							{
								array[i] = parameterInfo.DefaultValue;
							}
							else
							{
								array[i] = ConvertParameter(value2, parameterInfo.ParameterType) ?? parameterInfo.DefaultValue;
							}
						}
					}
					command.Method.Invoke(null, array);
				}
				else
				{
					ExecuteCommandViaConsoleHandler(command, inputFields);
				}
				Plugin.Log.LogInfo((object)("Advanced Console UI: Executed command " + command.FullName));
				Debug.Log((object)("Advanced Console UI: Executed " + command.FullName));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Advanced Console UI: Failed to execute " + command.FullName + ": " + ex.Message));
				Debug.LogError((object)("Advanced Console UI: Failed to execute " + command.FullName + ": " + ex.Message));
			}
		}

		private void ExecuteCommandViaConsoleHandler(ConsoleCommandInfo command, List<VisualElement> inputFields)
		{
			try
			{
				Type type = AppDomain.CurrentDomain.GetAssemblies().SelectMany(delegate(Assembly a)
				{
					try
					{
						return a.GetTypes();
					}
					catch
					{
						return Array.Empty<Type>();
					}
				}).FirstOrDefault((Type t) => t.Name == "ConsoleHandler");
				if (type != null)
				{
					MethodInfo methodInfo = type.GetMethods(BindingFlags.Static | BindingFlags.Public).FirstOrDefault((MethodInfo m) => m.Name.Contains("Execute") && m.GetParameters().Length != 0);
					if (methodInfo != null)
					{
						string text = command.FullName;
						if (inputFields.Count > 0)
						{
							List<string> list = new List<string>();
							foreach (VisualElement inputField in inputFields)
							{
								TextField val = (TextField)(object)((inputField is TextField) ? inputField : null);
								if (val != null && !string.IsNullOrEmpty(((BaseField<string>)(object)val).value))
								{
									list.Add(((BaseField<string>)(object)val).value);
									continue;
								}
								DropdownField val2 = (DropdownField)(object)((inputField is DropdownField) ? inputField : null);
								if (val2 != null && !string.IsNullOrEmpty(((BaseField<string>)(object)val2).value))
								{
									list.Add(((BaseField<string>)(object)val2).value);
								}
							}
							if (list.Count > 0)
							{
								text = text + " " + string.Join(" ", list);
							}
						}
						methodInfo.Invoke(null, new object[1] { text });
					}
					else
					{
						Plugin.Log.LogWarning((object)("Could not find execute method in ConsoleHandler for command " + command.FullName));
					}
				}
				else
				{
					Plugin.Log.LogWarning((object)("Could not find ConsoleHandler type for command " + command.FullName));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Failed to execute command via ConsoleHandler: " + ex.Message));
			}
		}

		private object? ConvertParameter(string input, Type targetType)
		{
			if (string.IsNullOrEmpty(input))
			{
				if (!targetType.IsValueType)
				{
					return null;
				}
				return Activator.CreateInstance(targetType);
			}
			if (targetType == typeof(string))
			{
				return input;
			}
			if (targetType == typeof(int))
			{
				return int.Parse(input);
			}
			if (targetType == typeof(float))
			{
				return float.Parse(input);
			}
			if (targetType == typeof(double))
			{
				return double.Parse(input);
			}
			if (targetType == typeof(bool))
			{
				return bool.Parse(input);
			}
			if (targetType == typeof(ushort))
			{
				return ushort.Parse(input);
			}
			return Convert.ChangeType(input, targetType);
		}
	}
	public static class ConsoleIntegration
	{
		public static void RegisterAdvancedConsolePage()
		{
			try
			{
				DebugUIHandler val = Object.FindFirstObjectByType<DebugUIHandler>();
				if ((Object)(object)val != (Object)null)
				{
					val.RegisterPage("Advanced Console", (Func<DebugPage>)(() => (DebugPage)(object)new AdvancedConsolePage()));
					val.RegisterPage("Server Info", (Func<DebugPage>)(() => (DebugPage)(object)new ServerInfoPage()));
					val.RegisterPage("Map Selection", (Func<DebugPage>)(() => (DebugPage)(object)new MapSelectionPage()));
					Plugin.Log.LogInfo((object)"Advanced Console, Server Info, and Map Selection pages registered successfully");
				}
				else
				{
					Plugin.Log.LogWarning((object)"DebugUIHandler not found - cannot register Advanced Console pages");
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Failed to register Advanced Console pages: " + ex.Message));
			}
		}
	}
	public static class EnvironmentCommands
	{
		[ConsoleCommand]
		[MasterClientOnly(null)]
		public static void SetTime(float time)
		{
			try
			{
				MonoBehaviour obj = Object.FindFirstObjectByType<MonoBehaviour>();
				MonoBehaviour val = ((obj != null) ? ((Component)obj).GetComponent<MonoBehaviour>() : null);
				Debug.Log((object)$"settime: attempting to set time to {time}");
				Plugin.Log.LogInfo((object)$"Attempted to set time to: {time}");
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("settime: failed to set time - " + ex.Message));
			}
		}

		[ConsoleCommand]
		[MasterClientOnly(null)]
		public static void SetGravity(float gravity = -9.81f)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Physics.gravity = new Vector3(0f, gravity, 0f);
			try
			{
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter != (Object)null)
				{
					((MonoBehaviourPun)localCharacter).photonView.RPC("SyncGravityRPC", (RpcTarget)1, new object[1] { gravity });
				}
			}
			catch (Exception)
			{
			}
			Debug.Log((object)$"setgravity: gravity set to {gravity}");
			Plugin.Log.LogInfo((object)$"Gravity set to: {gravity}");
		}

		[ConsoleCommand]
		public static void GetGravity()
		{
			//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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 gravity = Physics.gravity;
			float num = Mathf.Abs(gravity.y);
			Debug.Log((object)$"getgravity: Current gravity Y: {gravity.y:F2} (magnitude: {num:F2})");
			Plugin.Log.LogInfo((object)$"Current gravity: {gravity}");
		}

		[ConsoleCommand]
		public static void ToggleFog()
		{
			RenderSettings.fog = !RenderSettings.fog;
			Debug.Log((object)("togglefog: fog is now " + (RenderSettings.fog ? "ON" : "OFF")));
			Plugin.Log.LogInfo((object)("Fog toggled: " + (RenderSettings.fog ? "ON" : "OFF")));
		}

		[ConsoleCommand]
		public static void SetFogDensity(float density = 0.01f)
		{
			RenderSettings.fogDensity = density;
			Debug.Log((object)$"setfogdensity: fog density set to {density}");
			Plugin.Log.LogInfo((object)$"Fog density set to: {density}");
		}

		[ConsoleCommand]
		public static void SetFogColor(float r = 0.5f, float g = 0.5f, float b = 0.5f)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			RenderSettings.fogColor = new Color(r, g, b, 1f);
			Debug.Log((object)$"setfogcolor: fog color set to R:{r} G:{g} B:{b}");
			Plugin.Log.LogInfo((object)$"Fog color set to R:{r} G:{g} B:{b}");
		}

		[ConsoleCommand]
		public static void GodModeEnvironment()
		{
			try
			{
				IEnumerable<MonoBehaviour> enumerable = from c in Object.FindObjectsByType<MonoBehaviour>((FindObjectsSortMode)0)
					where ((object)c).GetType().Name.Contains("Damage") || ((object)c).GetType().Name.Contains("Harm") || ((object)c).GetType().Name.Contains("Kill")
					select c;
				int num = 0;
				foreach (MonoBehaviour item in enumerable)
				{
					((Behaviour)item).enabled = false;
					num++;
				}
				Debug.Log((object)$"godmodeenv: disabled {num} damage components");
				Plugin.Log.LogInfo((object)$"Disabled {num} environmental damage components");
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("godmodeenv: failed - " + ex.Message));
			}
		}

		[ConsoleCommand]
		[MasterClientOnly(null)]
		public static void ExplodeAt(Player target, float force = 1000f)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Player target2 = target;
			if (target2 == null)
			{
				Debug.LogWarning((object)"explode: player not found!");
				return;
			}
			Character val = ((IEnumerable<Character>)Character.AllCharacters).FirstOrDefault((Func<Character, bool>)((Character c) => ((object)((MonoBehaviourPun)c).photonView.Owner)?.Equals((object?)target2) ?? false));
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogWarning((object)("explode: no Character for '" + target2.NickName + "'"));
				return;
			}
			Vector3 center = val.Center;
			try
			{
				Character localCharacter = Character.localCharacter;
				if ((Object)(object)localCharacter != (Object)null)
				{
					((MonoBehaviourPun)localCharacter).photonView.RPC("RPCA_Explosion", (RpcTarget)0, new object[4] { center.x, center.y, center.z, force });
				}
			}
			catch
			{
				CreateExplosionEffect(center, force);
			}
			Debug.Log((object)$"explode: created explosion at '{target2.NickName}' position with force {force}");
			Plugin.Log.LogInfo((object)$"Created explosion at {target2.NickName} position with force {force}");
		}

		private static void CreateExplosionEffect(Vector3 explosionPos, float force)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody val = default(Rigidbody);
			foreach (Character allCharacter in Character.AllCharacters)
			{
				float num = Vector3.Distance(allCharacter.Center, explosionPos);
				if (num < 10f && ((Component)allCharacter).TryGetComponent<Rigidbody>(ref val))
				{
					Vector3 val2 = allCharacter.Center - explosionPos;
					Vector3 normalized = ((Vector3)(ref val2)).normalized;
					float num2 = force / (num + 1f);
					val.AddForce(normalized * num2, (ForceMode)1);
				}
			}
		}

		[ConsoleCommand]
		[MasterClientOnly(null)]
		public static void Lightning()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Character localCharacter = Character.localCha