Decompiled source of PeakConsole v1.3.0

plugins\com.github.wwshare.advancedconsole.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
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: AssemblyCompany("com.github.wwshare.advancedconsole")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0")]
[assembly: AssemblyProduct("com.github.wwshare.advancedconsole")]
[assembly: AssemblyTitle("PeakConsole")]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (e.g., Code Suggestions, Refactoring, Documentation Generation).")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "GitHub Copilot (Microsoft)")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.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]
	[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]
	[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;
		}
	}
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
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: 成就 '{achievementType}' 已授予成功!");
				Plugin.Log.LogInfo((object)$"已授予成就: {achievementType}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)$"grantachievement: 授予成就 '{achievementType}' 失败 - {ex.Message}");
				Plugin.Log.LogError((object)("授予成就失败: " + 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: 成就 '{result}' 已授予成功!");
					Plugin.Log.LogInfo((object)$"已按名称授予成就: {result}");
				}
				else
				{
					Debug.LogWarning((object)("grantachievementbyname: 未找到成就 '" + achievementName + "'! 请使用 ListAchievements 查看可用成就。"));
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("grantachievementbyname: 授予成就 '" + achievementName + "' - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ClearAllAchievements()
		{
			try
			{
				AchievementManager.ClearAchievements();
				Debug.Log((object)"clearallachievements: 所有成就已成功清除!");
				Plugin.Log.LogInfo((object)"已清除所有成就");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("clearallachievements: 清除成就失败 - " + ex.Message));
				Plugin.Log.LogError((object)("清除成就失败: " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ListAchievements()
		{
			//IL_0051: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Debug.Log((object)"=== 可用成就 ===");
				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)instance != (Object)null)
						{
							flag = instance.IsAchievementUnlocked(val);
						}
					}
					catch
					{
					}
					string arg = (flag ? "[UNLOCKED]" : "[LOCKED]");
					Debug.Log((object)$"  {val} {arg}");
				}
				Debug.Log((object)$"成就总数: {array.Length}");
				Debug.Log((object)"使用 GrantAchievement 或 GrantAchievementByName 解锁成就");
				Plugin.Log.LogInfo((object)$"已列出 {array.Length} 项成就");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("listachievements: 列出成就失败 - " + 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Debug.Log((object)$"=== 成就信息: {achievementType} ===");
				string achievementDescription = GetAchievementDescription(achievementType);
				Debug.Log((object)("描述: " + achievementDescription));
				try
				{
					AchievementManager instance = Singleton<AchievementManager>.Instance;
					if ((Object)instance != (Object)null)
					{
						bool flag = instance.IsAchievementUnlocked(achievementType);
						Debug.Log((object)("状态: " + (flag ? "UNLOCKED" : "LOCKED")));
						if (instance.runBasedValueData.achievementsEarnedThisRun.Contains(achievementType))
						{
							Debug.Log((object)"本次旅程获得: 是");
						}
					}
				}
				catch
				{
					Debug.Log((object)"状态: 无法检查");
				}
				Plugin.Log.LogInfo((object)$"已显示成就信息: {achievementType}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("achievementinfo: 获取成就信息失败 - " + 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: 没有可用成就!");
					return;
				}
				ACHIEVEMENTTYPE val = array[Random.Range(0, array.Length)];
				AchievementManager.Grant(val);
				Debug.Log((object)$"grantrandomachievement: 已授予随机成就 '{val}'!");
				Plugin.Log.LogInfo((object)$"已授予随机成就: {val}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("grantrandomachievement: 授予随机成就失败 - " + 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: 授予 {val} 失败 - {ex.Message}");
					}
				}
				Debug.Log((object)$"grantallachievements: 已授予 {num}/{array.Length} 项成就!");
				Plugin.Log.LogInfo((object)$"已授予所有成就: {num}/{array.Length}");
			}
			catch (Exception ex2)
			{
				Debug.LogError((object)("grantallachievements: 授予所有成就失败 - " + ex2.Message));
			}
		}

		[ConsoleCommand]
		public static void AchievementStats()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			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)instance != (Object)null)
				{
					ACHIEVEMENTTYPE[] array2 = array;
					foreach (ACHIEVEMENTTYPE val in array2)
					{
						try
						{
							if (instance.IsAchievementUnlocked(val))
							{
								num++;
							}
							if (instance.runBasedValueData.achievementsEarnedThisRun.Contains(val))
							{
								num2++;
							}
						}
						catch
						{
						}
					}
				}
				Debug.Log((object)"=== 成就统计 ===");
				Debug.Log((object)$"成就总数: {array.Length}");
				Debug.Log((object)$"已解锁: {num}/{array.Length} ({(float)num / (float)array.Length * 100f:F1}%)");
				Debug.Log((object)$"本次旅程获得: {num2}");
				Debug.Log((object)$"剩余: {array.Length - num}");
				Plugin.Log.LogInfo((object)$"成就统计: 已解锁 {num}/{array.Length}, 本次 {num2}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("achievementstats: 获取成就统计失败 - " + 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_0004: 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)
		{
			return (from name in Enum.GetNames(typeof(ACHIEVEMENTTYPE))
				where name != "NONE"
				where name.StartsWith(textSoFar, StringComparison.OrdinalIgnoreCase)
				select name).Select((Func<string, ParameterAutocomplete>)((string name) => new ParameterAutocomplete(name))).ToList();
		}
	}
	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 HashSet<string> _favorites = new HashSet<string>();

		private VisualElement _commandsContainer;

		private DropdownField _groupFilter;

		private TextField _searchField;

		private Button _refreshButton;

		public AdvancedConsolePage()
		{
			((VisualElement)this).name = "AdvancedConsole";
			LoadFavorites();
			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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00ac: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_00f4: 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_0109: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_0188: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_029b: 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_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Expected O, but got Unknown
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Expected O, but got Unknown
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: 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_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Expected O, but got Unknown
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Expected O, but got Unknown
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Expected O, but got Unknown
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Expected O, but got Unknown
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_0492: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Expected O, but got Unknown
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Expected O, but got Unknown
			Label val = new Label("高级控制台命令");
			((VisualElement)val).style.fontSize = new StyleLength(20f);
			((VisualElement)val).style.unityFontStyleAndWeight = new StyleEnum<FontStyle>((FontStyle)1);
			((VisualElement)val).style.color = new StyleColor(new Color(0.2f, 0.9f, 0.2f));
			((VisualElement)val).style.marginBottom = new StyleLength(8f);
			((VisualElement)val).style.marginTop = new StyleLength(3f);
			Label val2 = val;
			((VisualElement)this).Add((VisualElement)val2);
			VisualElement val3 = new VisualElement();
			val3.style.flexDirection = new StyleEnum<FlexDirection>((FlexDirection)2);
			val3.style.marginBottom = new StyleLength(8f);
			val3.style.backgroundColor = new StyleColor(new Color(0.15f, 0.15f, 0.15f, 0.8f));
			val3.style.paddingTop = new StyleLength(4f);
			val3.style.paddingBottom = new StyleLength(4f);
			val3.style.paddingLeft = new StyleLength(6f);
			val3.style.paddingRight = new StyleLength(6f);
			val3.style.borderTopLeftRadius = new StyleLength(4f);
			val3.style.borderTopRightRadius = new StyleLength(4f);
			val3.style.borderBottomLeftRadius = new StyleLength(4f);
			val3.style.borderBottomRightRadius = new StyleLength(4f);
			VisualElement val4 = val3;
			TextField val5 = new TextField("搜索:");
			((VisualElement)val5).style.flexGrow = new StyleFloat(1f);
			((VisualElement)val5).style.marginRight = new StyleLength(8f);
			((VisualElement)val5).style.color = new StyleColor(new Color(0.95f, 0.95f, 0.95f));
			((VisualElement)val5).style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
			_searchField = val5;
			((CallbackEventHandler)_searchField).RegisterCallback<AttachToPanelEvent>((EventCallback<AttachToPanelEvent>)delegate
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				VisualElement val12 = UQueryExtensions.Q<VisualElement>((VisualElement)_searchField, (string)null, "unity-text-field__input");
				if (val12 != null)
				{
					val12.style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
					val12.style.color = new StyleColor(new Color(0.95f, 0.95f, 0.95f));
				}
			}, (TrickleDown)0);
			INotifyValueChangedExtensions.RegisterValueChangedCallback<string>((INotifyValueChanged<string>)(object)_searchField, (EventCallback<ChangeEvent<string>>)OnSearchChanged);
			val4.Add((VisualElement)_searchField);
			List<string> list = new List<string> { "所有分组", "★ 收藏" };
			list.AddRange(_commandGroups.Keys);
			DropdownField val6 = new DropdownField("分类:", list, 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val6).style.width = new StyleLength(350f);
			((VisualElement)val6).style.marginRight = new StyleLength(8f);
			((VisualElement)val6).style.color = new StyleColor(new Color(0.95f, 0.95f, 0.95f));
			((VisualElement)val6).style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
			_groupFilter = val6;
			INotifyValueChangedExtensions.RegisterValueChangedCallback<string>((INotifyValueChanged<string>)(object)_groupFilter, (EventCallback<ChangeEvent<string>>)OnGroupFilterChanged);
			val4.Add((VisualElement)_groupFilter);
			Button val7 = new Button((Action)RefreshCommands)
			{
				text = "刷新"
			};
			((VisualElement)val7).style.width = new StyleLength(90f);
			((VisualElement)val7).style.backgroundColor = new StyleColor(new Color(0.2f, 0.5f, 0.8f));
			((VisualElement)val7).style.color = new StyleColor(Color.white);
			_refreshButton = val7;
			val4.Add((VisualElement)_refreshButton);
			((VisualElement)this).Add(val4);
			ScrollView val8 = new ScrollView();
			((VisualElement)val8).style.flexGrow = new StyleFloat(1f);
			ScrollView val9 = val8;
			_commandsContainer = new VisualElement();
			((VisualElement)val9).Add(_commandsContainer);
			((VisualElement)this).Add((VisualElement)val9);
			Label val10 = new Label($"共找到 {_commandGroups.Sum((KeyValuePair<string, List<ConsoleCommandInfo>> g) => g.Value.Count)} 个命令,分布在 {_commandGroups.Count} 个分组中");
			((VisualElement)val10).style.fontSize = new StyleLength(11f);
			((VisualElement)val10).style.color = new StyleColor(new Color(0.8f, 0.8f, 0.8f));
			((VisualElement)val10).style.marginTop = new StyleLength(4f);
			Label val11 = val10;
			((VisualElement)this).Add((VisualElement)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();
					foreach (Type type in types)
					{
						MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public);
						foreach (MethodInfo methodInfo in methods)
						{
							if (((MemberInfo)methodInfo).GetCustomAttribute<ConsoleCommandAttribute>() != null)
							{
								AddCommandToGroups(methodInfo, type);
							}
						}
					}
				}
				catch (Exception ex)
				{
					Plugin.Log.LogDebug((object)("扫描程序集出错 " + 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)
				{
					foreach (FieldInfo item in (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())
					{
						try
						{
							object value = item.GetValue(null);
							if (value != null)
							{
								ScanRegisteredCommands(value);
							}
						}
						catch (Exception ex2)
						{
							Plugin.Log.LogDebug((object)("访问命令字段出错 " + item.Name + ":" + ex2.Message));
						}
					}
				}
			}
			catch (Exception ex3)
			{
				Plugin.Log.LogDebug((object)("扫描已注册命令出错:" + ex3.Message));
			}
			Plugin.Log.LogInfo((object)$"高级控制台:共找到 {_commandGroups.Sum((KeyValuePair<string, List<ConsoleCommandInfo>> g) => g.Value.Count)} 个命令,分布在 {_commandGroups.Count} 个分组中");
		}

		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 obj = type.GetGenericArguments()[0];
				_ = type.GetGenericArguments()[1];
				if (!(obj == typeof(string)) || !(type.GetProperty("Keys")?.GetValue(commandDict) 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>();
						}
						if (_commandGroups[groupName].FirstOrDefault((ConsoleCommandInfo c) => c.FullName == commandName) == null)
						{
							_commandGroups[groupName].Add(item);
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("扫描已注册命令出错:" + 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 "传送";
			}
			if (typeName.Contains("Fun"))
			{
				return "趣味命令";
			}
			if (typeName.Contains("Environment"))
			{
				return "环境";
			}
			if (typeName.Contains("Spawn"))
			{
				return "生成与物品";
			}
			if (typeName.Contains("RPC"))
			{
				return "RPC 命令";
			}
			if (typeName.Contains("Status"))
			{
				return "状态效果";
			}
			if (typeName.Contains("Map"))
			{
				return "地图与分段";
			}
			if (typeName.Contains("Info"))
			{
				return "信息";
			}
			if (typeName.Contains("Log"))
			{
				return "控制台与日志";
			}
			if (typeName.Contains("Sync"))
			{
				return "同步命令";
			}
			if (typeName.Contains("Weather"))
			{
				return "天气";
			}
			if (typeName.Contains("Character"))
			{
				return "角色";
			}
			if (typeName.Contains("Item"))
			{
				return "物品";
			}
			if (typeName.Contains("Console"))
			{
				return "控制台与日志";
			}
			if (typeName.Contains("Application"))
			{
				return "系统";
			}
			if (typeName.Contains("Achievement"))
			{
				return "成就";
			}
			if (typeName.Contains("Passport"))
			{
				return "自定义";
			}
			if (typeName.Contains("Ascent"))
			{
				return "登顶";
			}
			if (typeName.Contains("Backpack"))
			{
				return "背包";
			}
			return "其他命令";
		}

		private string GetCommandDescription(MethodInfo method)
		{
			string text = Regex.Replace(method.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> { "所有分组", "★ 收藏" };
			list.AddRange(_commandGroups.Keys);
			((BasePopupField<string, string>)(object)_groupFilter).choices = list;
			RefreshCommandsDisplay();
		}

		private void RefreshCommandsDisplay()
		{
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: 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_0128: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: 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_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_023e: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: 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 != "所有分组" && value != "★ 收藏" && commandGroup.Key != value)
				{
					continue;
				}
				List<ConsoleCommandInfo> list = commandGroup.Value.Where((ConsoleCommandInfo cmd) => (value != "★ 收藏" || IsFavorite(cmd.FullName)) && (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 = new StyleLength(16f);
				((VisualElement)val).style.unityFontStyleAndWeight = new StyleEnum<FontStyle>((FontStyle)1);
				((VisualElement)val).style.color = new StyleColor(new Color(0.2f, 0.8f, 1f));
				((VisualElement)val).style.marginTop = new StyleLength(8f);
				((VisualElement)val).style.marginBottom = new StyleLength(4f);
				((VisualElement)val).style.backgroundColor = new StyleColor(new Color(0.05f, 0.05f, 0.05f, 0.7f));
				((VisualElement)val).style.paddingLeft = new StyleLength(6f);
				((VisualElement)val).style.paddingTop = new StyleLength(2f);
				((VisualElement)val).style.paddingBottom = new StyleLength(2f);
				((VisualElement)val).style.borderTopLeftRadius = new StyleLength(3f);
				((VisualElement)val).style.borderTopRightRadius = new StyleLength(3f);
				((VisualElement)val).style.borderBottomLeftRadius = new StyleLength(3f);
				((VisualElement)val).style.borderBottomRightRadius = new StyleLength(3f);
				Label val2 = val;
				_commandsContainer.Add((VisualElement)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_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Expected O, but got Unknown
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Expected O, but got Unknown
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Expected O, but got Unknown
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: 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_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bc: Expected O, but got Unknown
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Expected O, but got Unknown
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Expected O, but got Unknown
			//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0405: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: 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_0414: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: 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_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_0688: 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_045f: 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_0474: 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_0489: 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_049e: 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_04b3: 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_04c8: 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_04dd: 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_04f2: 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_0507: Unknown result type (might be due to invalid IL or missing references)
			//IL_0512: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Expected O, but got Unknown
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Expected O, but got Unknown
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_071d: Expected O, but got Unknown
			//IL_0735: Unknown result type (might be due to invalid IL or missing references)
			//IL_074b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0761: Unknown result type (might be due to invalid IL or missing references)
			//IL_0781: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07df: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Unknown result type (might be due to invalid IL or missing references)
			//IL_0811: Unknown result type (might be due to invalid IL or missing references)
			//IL_081d: Expected O, but got Unknown
			//IL_0aac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aeb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b36: Expected O, but got Unknown
			//IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b44: Expected O, but got Unknown
			//IL_0b60: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6a: Expected O, but got Unknown
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0882: Unknown result type (might be due to invalid IL or missing references)
			//IL_088c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0893: Expected O, but got Unknown
			//IL_08c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e7: Expected O, but got Unknown
			//IL_093d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0942: Unknown result type (might be due to invalid IL or missing references)
			//IL_094d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0957: Unknown result type (might be due to invalid IL or missing references)
			//IL_0962: Unknown result type (might be due to invalid IL or missing references)
			//IL_096c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_0981: Unknown result type (might be due to invalid IL or missing references)
			//IL_0996: Unknown result type (might be due to invalid IL or missing references)
			//IL_099b: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cb: Expected O, but got Unknown
			//IL_09cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09dd: Expected O, but got Unknown
			//IL_0912: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Unknown result type (might be due to invalid IL or missing references)
			//IL_0931: Unknown result type (might be due to invalid IL or missing references)
			//IL_0938: Expected O, but got Unknown
			//IL_09f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a79: Expected O, but got Unknown
			VisualElement val = new VisualElement();
			val.style.backgroundColor = new StyleColor(new Color(0.08f, 0.08f, 0.08f, 0.6f));
			val.style.marginBottom = new StyleLength(2f);
			val.style.paddingTop = new StyleLength(3f);
			val.style.paddingBottom = new StyleLength(3f);
			val.style.paddingLeft = new StyleLength(6f);
			val.style.paddingRight = new StyleLength(6f);
			val.style.borderTopLeftRadius = new StyleLength(3f);
			val.style.borderTopRightRadius = new StyleLength(3f);
			val.style.borderBottomLeftRadius = new StyleLength(3f);
			val.style.borderBottomRightRadius = new StyleLength(3f);
			val.style.borderLeftWidth = new StyleFloat(2f);
			val.style.borderLeftColor = new StyleColor(new Color(0.2f, 0.6f, 0.9f, 0.8f));
			VisualElement val2 = val;
			VisualElement val3 = new VisualElement();
			val3.style.flexDirection = new StyleEnum<FlexDirection>((FlexDirection)2);
			val3.style.alignItems = new StyleEnum<Align>((Align)2);
			VisualElement val4 = val3;
			VisualElement val5 = new VisualElement();
			val5.style.flexDirection = new StyleEnum<FlexDirection>((FlexDirection)2);
			val5.style.alignItems = new StyleEnum<Align>((Align)2);
			val5.style.flexGrow = new StyleFloat(1f);
			val5.style.minWidth = new StyleLength(200f);
			VisualElement val6 = val5;
			Label val7 = new Label(command.FullName);
			((VisualElement)val7).style.fontSize = new StyleLength(12f);
			((VisualElement)val7).style.unityFontStyleAndWeight = new StyleEnum<FontStyle>((FontStyle)1);
			((VisualElement)val7).style.color = new StyleColor(new Color(0.9f, 0.9f, 0.9f));
			((VisualElement)val7).style.marginRight = new StyleLength(6f);
			((VisualElement)val7).style.flexShrink = new StyleFloat(0f);
			((VisualElement)val7).style.whiteSpace = new StyleEnum<WhiteSpace>((WhiteSpace)1);
			Label val8 = val7;
			val6.Add((VisualElement)val8);
			if (command.IsRPCCommand)
			{
				Label val9 = new Label("RPC");
				((VisualElement)val9).style.fontSize = new StyleLength(8f);
				((VisualElement)val9).style.color = new StyleColor(new Color(1f, 0.9f, 0.3f));
				((VisualElement)val9).style.backgroundColor = new StyleColor(new Color(0.4f, 0.3f, 0.1f, 0.8f));
				((VisualElement)val9).style.paddingLeft = new StyleLength(3f);
				((VisualElement)val9).style.paddingRight = new StyleLength(3f);
				((VisualElement)val9).style.paddingTop = new StyleLength(1f);
				((VisualElement)val9).style.paddingBottom = new StyleLength(1f);
				((VisualElement)val9).style.marginRight = new StyleLength(3f);
				((VisualElement)val9).style.borderTopLeftRadius = new StyleLength(2f);
				((VisualElement)val9).style.borderTopRightRadius = new StyleLength(2f);
				((VisualElement)val9).style.borderBottomLeftRadius = new StyleLength(2f);
				((VisualElement)val9).style.borderBottomRightRadius = new StyleLength(2f);
				Label val10 = val9;
				val6.Add((VisualElement)val10);
			}
			if (command.RequiresMasterClient)
			{
				Label val11 = new Label("房主");
				((VisualElement)val11).style.fontSize = new StyleLength(8f);
				((VisualElement)val11).style.color = new StyleColor(PhotonNetwork.IsMasterClient ? new Color(0.7f, 1f, 0.7f) : new Color(1f, 0.7f, 0.7f));
				((VisualElement)val11).style.backgroundColor = new StyleColor(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 = new StyleLength(3f);
				((VisualElement)val11).style.paddingRight = new StyleLength(3f);
				((VisualElement)val11).style.paddingTop = new StyleLength(1f);
				((VisualElement)val11).style.paddingBottom = new StyleLength(1f);
				((VisualElement)val11).style.marginRight = new StyleLength(3f);
				((VisualElement)val11).style.borderTopLeftRadius = new StyleLength(2f);
				((VisualElement)val11).style.borderTopRightRadius = new StyleLength(2f);
				((VisualElement)val11).style.borderBottomLeftRadius = new StyleLength(2f);
				((VisualElement)val11).style.borderBottomRightRadius = new StyleLength(2f);
				Label val12 = val11;
				val6.Add((VisualElement)val12);
			}
			val4.Add(val6);
			Label val13 = new Label(command.Description);
			((VisualElement)val13).style.fontSize = new StyleLength(10f);
			((VisualElement)val13).style.color = new StyleColor(new Color(0.75f, 0.75f, 0.75f));
			((VisualElement)val13).style.width = new StyleLength(200f);
			((VisualElement)val13).style.minWidth = new StyleLength(200f);
			((VisualElement)val13).style.marginRight = new StyleLength(8f);
			Label val14 = val13;
			val4.Add((VisualElement)val14);
			Button val15 = new Button((Action)delegate
			{
				ToggleFavorite(command.FullName);
			});
			((TextElement)val15).text = (IsFavorite(command.FullName) ? "★" : "☆");
			((VisualElement)val15).style.width = new StyleLength(26f);
			((VisualElement)val15).style.height = new StyleLength(20f);
			((VisualElement)val15).style.fontSize = new StyleLength(13f);
			((VisualElement)val15).style.backgroundColor = new StyleColor(IsFavorite(command.FullName) ? new Color(0.5f, 0.4f, 0.08f) : new Color(0.16f, 0.16f, 0.16f));
			((VisualElement)val15).style.color = new StyleColor(IsFavorite(command.FullName) ? new Color(1f, 0.9f, 0.3f) : new Color(0.8f, 0.8f, 0.8f));
			((VisualElement)val15).style.marginRight = new StyleLength(4f);
			((VisualElement)val15).tooltip = "点击收藏/取消收藏该命令";
			val4.Add((VisualElement)(object)val15);
			Button val16 = new Button((Action)delegate
			{
				CopyToClipboard(command.FullName);
			});
			((TextElement)val16).text = "复制";
			((VisualElement)val16).style.width = new StyleLength(34f);
			((VisualElement)val16).style.height = new StyleLength(20f);
			((VisualElement)val16).style.fontSize = new StyleLength(9f);
			((VisualElement)val16).style.backgroundColor = new StyleColor(new Color(0.16f, 0.16f, 0.22f));
			((VisualElement)val16).style.color = new StyleColor(new Color(0.85f, 0.85f, 0.95f));
			((VisualElement)val16).style.marginRight = new StyleLength(4f);
			((VisualElement)val16).tooltip = "复制命令到剪贴板";
			val4.Add((VisualElement)(object)val16);
			VisualElement val17 = new VisualElement();
			val17.style.flexDirection = new StyleEnum<FlexDirection>((FlexDirection)2);
			val17.style.alignItems = new StyleEnum<Align>((Align)2);
			val17.style.flexGrow = new StyleFloat(1f);
			VisualElement val18 = val17;
			List<VisualElement> inputFields = new List<VisualElement>();
			ParameterInfo[] parameters = command.Parameters;
			foreach (ParameterInfo parameterInfo in parameters)
			{
				VisualElement val19;
				if (parameterInfo.ParameterType == typeof(Player))
				{
					DropdownField obj = CreatePlayerDropdown();
					((VisualElement)obj).style.width = new StyleLength(150f);
					((VisualElement)obj).style.marginRight = new StyleLength(4f);
					val19 = (VisualElement)obj;
				}
				else if (parameterInfo.ParameterType == typeof(ConsoleItem))
				{
					DropdownField obj2 = CreateItemDropdown();
					((VisualElement)obj2).style.width = new StyleLength(150f);
					((VisualElement)obj2).style.marginRight = new StyleLength(4f);
					val19 = (VisualElement)obj2;
				}
				else if (parameterInfo.ParameterType.IsEnum)
				{
					DropdownField obj3 = CreateEnumDropdown(parameterInfo.ParameterType);
					((VisualElement)obj3).style.width = new StyleLength(100f);
					((VisualElement)obj3).style.marginRight = new StyleLength(4f);
					val19 = (VisualElement)obj3;
				}
				else
				{
					TextField val20 = new TextField();
					((VisualElement)val20).style.fontSize = new StyleLength(9f);
					((VisualElement)val20).style.width = new StyleLength(80f);
					((VisualElement)val20).style.marginRight = new StyleLength(4f);
					((VisualElement)val20).style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
					((VisualElement)val20).style.color = new StyleColor(new Color(0.95f, 0.95f, 0.95f));
					TextField val21 = val20;
					VisualElement val22 = UQueryExtensions.Q<VisualElement>((VisualElement)val21, (string)null, "unity-text-field__input");
					if (val22 != null)
					{
						val22.style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
						val22.style.color = new StyleColor(new Color(0.95f, 0.95f, 0.95f));
					}
					((BaseField<string>)(object)val21).SetValueWithoutNotify(GetDefaultParameterValue(parameterInfo));
					if (string.IsNullOrEmpty(((BaseField<string>)(object)val21).value))
					{
						((BaseField<string>)(object)val21).value = parameterInfo.Name ?? "";
					}
					val19 = (VisualElement)val21;
				}
				inputFields.Add(val19);
				val18.Add(val19);
			}
			Button val23 = new Button((Action)delegate
			{
				ExecuteCommand(command, inputFields);
			})
			{
				text = "▶ 执行"
			};
			((VisualElement)val23).style.width = new StyleLength(85f);
			((VisualElement)val23).style.backgroundColor = new StyleColor(new Color(0.15f, 0.7f, 0.15f));
			((VisualElement)val23).style.color = new StyleColor(Color.white);
			((VisualElement)val23).style.fontSize = new StyleLength(10f);
			((VisualElement)val23).style.marginLeft = new StyleLength(4f);
			Button val24 = val23;
			val18.Add((VisualElement)val24);
			val4.Add(val18);
			val2.Add(val4);
			VisualElementExtensions.AddManipulator(val2, (IManipulator)new ContextualMenuManipulator((Action<ContextualMenuPopulateEvent>)delegate(ContextualMenuPopulateEvent evt)
			{
				evt.menu.AppendAction("复制命令", (Action<DropdownMenuAction>)delegate
				{
					CopyToClipboard(command.FullName);
				}, (Status)1);
				evt.menu.AppendAction("复制为执行命令", (Action<DropdownMenuAction>)delegate
				{
					CopyToClipboard(command.FullName + " ");
				}, (Status)1);
			}));
			_commandsContainer.Add(val2);
		}

		private static void CopyToClipboard(string text)
		{
			try
			{
				GUIUtility.systemCopyBuffer = text;
				Debug.Log((object)("已复制到剪贴板: " + text));
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("复制到剪贴板失败: " + ex.Message));
			}
		}

		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> { "无玩家" };
			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 = new StyleLength(9f);
			((VisualElement)val).style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
			((VisualElement)val).style.color = new StyleColor(new Color(0.95f, 0.95f, 0.95f));
			return val;
		}

		private DropdownField CreateEnumDropdown(Type enumType)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_0071: Expected O, but got Unknown
			DropdownField val = new DropdownField(Enum.GetNames(enumType).ToList(), 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val).style.fontSize = new StyleLength(9f);
			((VisualElement)val).style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
			((VisualElement)val).style.color = new StyleColor(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("没有可用物品");
			}
			DropdownField val = new DropdownField(list, 0, (Func<string, string>)null, (Func<string, string>)null);
			((VisualElement)val).style.fontSize = new StyleLength(9f);
			((VisualElement)val).style.backgroundColor = new StyleColor(new Color(0.1f, 0.1f, 0.1f));
			((VisualElement)val).style.color = new StyleColor(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)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			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)((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)((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)("高级控制台界面:已执行命令 " + command.FullName));
				Debug.Log((object)("高级控制台界面:已执行 " + command.FullName));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("高级控制台界面:执行命令失败 " + command.FullName + ":" + ex.Message));
				Debug.LogError((object)("高级控制台界面:执行命令失败 " + command.FullName + ":" + ex.Message));
			}
		}

		private void ExecuteCommandViaConsoleHandler(ConsoleCommandInfo command, List<VisualElement> inputFields)
		{
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			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)((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)((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)("在 ConsoleHandler 中找不到命令的执行方法 " + command.FullName));
					}
				}
				else
				{
					Plugin.Log.LogWarning((object)("找不到命令的 ConsoleHandler 类型 " + command.FullName));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("通过 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;
			}
			string s = NormalizeNumericInput(input);
			if (targetType == typeof(int))
			{
				if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
				{
					return result;
				}
				return 0;
			}
			if (targetType == typeof(float))
			{
				if (float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
				{
					return result2;
				}
				return 0f;
			}
			if (targetType == typeof(double))
			{
				if (double.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result3))
				{
					return result3;
				}
				return 0.0;
			}
			if (targetType == typeof(byte))
			{
				if (byte.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result4))
				{
					return result4;
				}
				return (byte)0;
			}
			if (targetType == typeof(short))
			{
				if (short.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result5))
				{
					return result5;
				}
				return (short)0;
			}
			if (targetType == typeof(long))
			{
				if (long.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result6))
				{
					return result6;
				}
				return 0L;
			}
			if (targetType == typeof(uint))
			{
				if (uint.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result7))
				{
					return result7;
				}
				return 0u;
			}
			if (targetType == typeof(ulong))
			{
				if (ulong.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result8))
				{
					return result8;
				}
				return 0uL;
			}
			if (targetType == typeof(ushort))
			{
				if (ushort.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result9))
				{
					return result9;
				}
				return (ushort)0;
			}
			if (targetType == typeof(decimal))
			{
				if (decimal.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result10))
				{
					return result10;
				}
				return 0m;
			}
			if (targetType == typeof(bool))
			{
				switch (input.Trim().ToLowerInvariant())
				{
				case "true":
				case "1":
				case "yes":
				case "是":
				case "开启":
					return true;
				case "false":
				case "0":
				case "no":
				case "否":
				case "关闭":
					return false;
				default:
				{
					bool result11;
					return bool.TryParse(input, out result11) && result11;
				}
				}
			}
			if (targetType.IsEnum)
			{
				try
				{
					return Enum.Parse(targetType, input, ignoreCase: true);
				}
				catch
				{
					try
					{
						if (int.TryParse(s, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result12))
						{
							return Enum.ToObject(targetType, result12);
						}
					}
					catch
					{
					}
					return Activator.CreateInstance(targetType);
				}
			}
			try
			{
				return Convert.ChangeType(input, targetType);
			}
			catch
			{
				if (targetType.IsValueType)
				{
					return Activator.CreateInstance(targetType);
				}
				return null;
			}
		}

		private static string NormalizeNumericInput(string input)
		{
			if (string.IsNullOrEmpty(input))
			{
				return "";
			}
			char[] array = input.Trim().ToCharArray();
			for (int i = 0; i < array.Length; i++)
			{
				char c = array[i];
				if (c >= '0' && c <= '9')
				{
					array[i] = (char)(c - 65248);
					continue;
				}
				switch (c)
				{
				case '.':
					array[i] = '.';
					break;
				case ',':
				case '。':
				case ',':
					array[i] = '.';
					break;
				case '−':
				case '-':
					array[i] = '-';
					break;
				}
			}
			return new string(array);
		}

		private void LoadFavorites()
		{
			_favorites.Clear();
			try
			{
				string text = PlayerPrefs.GetString("AdvancedConsole.Favorites", "");
				if (string.IsNullOrEmpty(text))
				{
					return;
				}
				string[] array = text.Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries);
				foreach (string text2 in array)
				{
					if (!string.IsNullOrWhiteSpace(text2))
					{
						_favorites.Add(text2.Trim());
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("加载收藏失败:" + ex.Message));
			}
		}

		private void SaveFavorites()
		{
			try
			{
				PlayerPrefs.SetString("AdvancedConsole.Favorites", string.Join("|", _favorites));
				PlayerPrefs.Save();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("保存收藏失败:" + ex.Message));
			}
		}

		private bool IsFavorite(string fullName)
		{
			return _favorites.Contains(fullName);
		}

		private void ToggleFavorite(string fullName)
		{
			if (_favorites.Contains(fullName))
			{
				_favorites.Remove(fullName);
			}
			else
			{
				_favorites.Add(fullName);
			}
			SaveFavorites();
			RefreshCommandsDisplay();
		}
	}
	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, true);
		}

		[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, true, true, false);
		}

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

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

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

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

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

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

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

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

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

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

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

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

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

		[PunRPC]
		public void RPC_AddHot(float amt)
		{
			CA.AddStatus((STATUSTYPE)8, amt, false, true, true, 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, true);
			}
		}
	}
	[HarmonyPatch]
	public static class CharacterItemsPatch
	{
		[HarmonyPatch(typeof(CharacterItems), "UpdateBalloonCount")]
		[HarmonyPrefix]
		public static bool UpdateBalloonCount_Prefix(CharacterItems __instance, ItemSlot[] slots)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			try
			{
				if ((Object)(__instance?.character?.refs?.items) == (Object)null || (Object)__instance.character.refs.balloons == (Object)null)
				{
					return false;
				}
				if (__instance.character.refs.items.currentSelectedSlot.IsSome)
				{
					if ((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)itemSlot.prefab != (Object)null && __instance.character.refs.items.currentSelectedSlot.IsSome && (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)(__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 配置 ===");
			Debug.Log((object)PluginConfig.GetConfigInfo());
			Debug.Log((object)"=== 当前按键绑定 ===");
			Debug.Log((object)$"控制台开关: {PluginConfig.ConsoleToggleKey} (按下以显示/隐藏控制台)");
			Debug.Log((object)$"控制台 DPI 重置: {PluginConfig.ConsoleDPIResetKey} (按下以重置控制台缩放)");
			Debug.Log((object)"=== 配置帮助 ===");
			Debug.Log((object)"使用 'ConfigCommands.ShowKeyCodes' 查看可用按键");
			Debug.Log((object)"使用 'ConfigCommands.OpenConfigFolder' 打开配置文件所在位置");
			Plugin.Log.LogInfo((object)"已在控制台显示配置");
		}

		[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: 将控制台开关按键更改为 {key}:");
				Debug.Log((object)"1. 关闭游戏");
				Debug.Log((object)"2. 打开配置文件: BepInEx/config/wwshare.AdvancedConsole.cfg");
				Debug.Log((object)$"3. 找到 [Keybinds] 部分并将 ConsoleToggleKey 更改为 {(int)key}");
				Debug.Log((object)"4. 保存文件并重启游戏");
				Debug.Log((object)$"当前按键: {PluginConfig.ConsoleToggleKey} (代码: {(int)PluginConfig.ConsoleToggleKey})");
				Debug.Log((object)$"目标按键: {key} (代码: {(int)key})");
				Plugin.Log.LogInfo((object)$"已请求更改控制台开关按键: {PluginConfig.ConsoleToggleKey} -> {key}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("setconsoletogglekey: 错误 - " + 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: 将控制台 DPI 重置按键更改为 {key}:");
				Debug.Log((object)"1. 关闭游戏");
				Debug.Log((object)"2. 打开配置文件: BepInEx/config/wwshare.AdvancedConsole.cfg");
				Debug.Log((object)$"3. 找到 [Keybinds] 部分并将 ConsoleDPIResetKey 更改为 {(int)key}");
				Debug.Log((object)"4. 保存文件并重启游戏");
				Debug.Log((object)$"当前按键: {PluginConfig.ConsoleDPIResetKey} (代码: {(int)PluginConfig.ConsoleDPIResetKey})");
				Debug.Log((object)$"目标按键: {key} (代码: {(int)key})");
				Plugin.Log.LogInfo((object)$"已请求更改控制台 DPI 重置按键: {PluginConfig.ConsoleDPIResetKey} -> {key}");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("setconsoledpiresetkey: 错误 - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ReloadConfig()
		{
			try
			{
				PluginConfig.Reload();
				Debug.Log((object)"reloadconfig: 已从磁盘重新加载配置");
				Debug.Log((object)"注意: 按键绑定需要重启游戏才能生效");
				ShowConfig();
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("reloadconfig: 错误 - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void SaveConfig()
		{
			try
			{
				PluginConfig.Save();
				Debug.Log((object)"saveconfig: 配置已保存到磁盘");
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("saveconfig: 错误 - " + ex.Message));
			}
		}

		[ConsoleCommand]
		public static void ShowKeyCodes()
		{
			Debug.Log((object)"=== 常用绑定按键代码 ===");
			Debug.Log((object)"功能键:");
			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)"特殊按键:");
			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)"修饰键:");
			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)"用法: ConfigCommands.SetConsoleToggleKey <KeyCode>");
			Debug.Log((object)"示例: 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, "wwshare.AdvancedConsole.cfg");
				string text2 = Path.GetDirectoryName(text) ?? Paths.ConfigPath;
				Debug.Log((object)"openconfigfolder: 配置文件位置:");
				Debug.Log((object)("  " + text));
				Debug.Log((object)("  目录: " + text2));
				if ((int)Application.platform == 2 || (int)Application.platform == 7)
				{
					try
					{
						Process.Start("explorer.exe", text2);
						Debug.Log((object)"openconfigfolder: 已在 Windows 资源管理器中打开配置文件夹");
					}
					catch
					{
						Debug.Log((object)"openconfigfolder: 无法自动打开文件夹。请手动导航到上述路径。");
					}
				}
				else
				{
					Debug.Log((object)"openconfigfolder: 仅在 Windows 上支持自动打开文件夹。请手动导航到上述路径。");
				}
				Plugin.Log.LogInfo((object)("已请求访问配置文件夹: " + text2));
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("openconfigfolder: 错误 - " + 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 wwshare.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: 已创建示例配置文件:");
				Debug.Log((object)("  " + text));
				Debug.Log((object)"使用此文件作为配置选项的参考");
				Plugin.Log.LogInfo((object)("已创建示例配置: " + text));
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("createexampleconfig: 错误 - " + ex.Message));
			}
		}
	}
	[HarmonyPatch]
	public static class ConsoleCommandPatches
	{
		private static readonly Type _consoleHandlerType = typeof(ConsoleHandler);

		public static void Initialize(Harmony harmony)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Expected O, but got Unknown
			try
			{
				MethodInfo method = _consoleHandlerType.GetMethod("ProcessCommand", BindingFlags.Static | BindingFlags.Public);
				MethodInfo method2 = typeof(ConsoleCommandPatches).GetMethod("ProcessCommandPrefix", BindingFlags.Static | BindingFlags.NonPublic);
				if (method != null && method2 != null)
				{
					harmony.Patch((MethodBase)method, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.Log.LogInfo((object)"ConsoleCommandPatches: 命令解析增强已启用");
				}
				else
				{
					Plugin.Log.LogWarning((object)"ConsoleCommandPatches: 未找到 ProcessCommand 方法");
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("ConsoleCommandPatches 初始化失败: " + ex.Message));
			}
		}

		private static bool ProcessCommandPrefix(string command, ref Task<bool> __result)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: 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_0133: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (string.IsNullOrEmpty(command))
				{
					return true;
				}
				string firstToken;
				string text = (firstToken = command.Trim());
				string text2 = "";
				int num = text.IndexOf(' ');
				if (num > 0)
				{
					firstToken = text.Substring(0, num);
					text2 = text.Substring(num + 1).Trim();
				}
				List<ConsoleCommand> consoleCommands = ConsoleHandler.ConsoleCommands;
				if (consoleCommands == null)
				{
					return true;
				}
				string text3 = null;
				if (firstToken.Contains('.'))
				{
					int num2 = firstToken.IndexOf('.');
					string domain = firstToken.Substring(0, num2);
					string cmd = firstToken.Substring(num2 + 1);
					List<ConsoleCommand> list = consoleCommands.Where((ConsoleCommand c) => string.Equals(c.DomainName, domain, StringComparison.OrdinalIgnoreCase) && string.Equals(c.Command, cmd, StringComparison.OrdinalIgnoreCase)).ToList();
					if (list.Count == 1 && (list[0].DomainName != domain || list[0].Command != cmd))
					{
						text3 = list[0].DomainName + "." + list[0].Command;
					}
				}
				else
				{
					List<ConsoleCommand> list2 = consoleCommands.Where((ConsoleCommand c) => string.Equals(c.Command, firstToken, StringComparison.OrdinalIgnoreCase)).ToList();
					if (list2.Count == 0)
					{
						list2 = consoleCommands.Where((ConsoleCommand c) => c.Command.StartsWith(firstToken, StringComparison.OrdinalIgnoreCase)).ToList();
					}
					if (list2.Count == 1)
					{
						text3 = list2[0].DomainName + "." + list2[0].Command;
					}
					else if (list2.Count > 1)
					{
						ConsoleCommand val = PickPreferredCommand(list2);
						text3 = val.DomainName + "." + val.Command;
						Plugin.Log.LogDebug((object)$"命令 '{firstToken}' 存在 {list2.Count} 个匹配, 优先执行 {text3}");
					}
				}
				if (text3 != null)
				{
					string text4 = text3 + ((text2.Length > 0) ? (" " + text2) : "");
					__result = ConsoleHandler.ProcessCommand(text4);
					return false;
				}
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogDebug((object)("ProcessCommandPrefix 错误: " + ex.Message));
				return true;
			}
		}

		private static ConsoleCommand PickPreferredCommand(List<ConsoleCommand> matches)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			string name = typeof(Plugin).Assembly.GetName().Name;
			foreach (ConsoleCommand match in matches)
			{
				if (match.MethodInfo != null && match.MethodInfo.DeclaringType != null && match.MethodInfo.DeclaringType.Assembly.GetName().Name == name)
				{
					return match;
				}
			}
			return matches[0];
		}
	}
	[HarmonyPatch]
	public static class ConsoleEnhancements
	{
		private static readonly HashSet<ConsoleLogElement> _