Decompiled source of DebugToolkit v3.22.0

DebugToolkit.dll

Decompiled 6 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DebugToolkit.Code;
using DebugToolkit.Commands;
using DebugToolkit.Permissions;
using EntityStates;
using EntityStates.TeleporterHealNovaController;
using HG;
using HG.Reflection;
using IL.RoR2;
using IL.RoR2.Networking;
using IL.RoR2.UI;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.RoR2;
using On.RoR2.Networking;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.Artifacts;
using RoR2.CharacterAI;
using RoR2.ConVar;
using RoR2.ExpansionManagement;
using RoR2.Navigation;
using RoR2.Networking;
using RoR2.UI;
using ShareSuite;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DebugToolkit Contributors")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyProduct("DebugToolkit")]
[assembly: AssemblyTitle("DebugToolkit")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/harbingerofme/DebugToolkit")]
[assembly: AssemblyInformationalVersion("3.22.0+d1e2f0aa4b8ac4747547db0fcd87344953432f06")]
[assembly: AssemblyCopyright("2026 DebugToolkit Contributors")]
[assembly: AssemblyDescription("DebugToolkit is an expansive list of console commands for Risk of Rain 2, intended to make forcing specific situation easier. This is supposed to help with testing of interactions, mods, and what else.")]
[assembly: AssemblyFileVersion("3.22.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.22.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DebugToolkit
{
	public static class ArgumentParser
	{
		public static bool AssertInARun(ConCommandArgs args)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Run.instance))
			{
				Log.MessageNetworked("This command only works when in a Run!", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool AssertInSimulacrumARun(ConCommandArgs args)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Run.instance) || !(Run.instance is InfiniteTowerRun))
			{
				Log.MessageNetworked("Must be in a Simulacrum Run!", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool AssertRequiredArguments(ConCommandArgs args, string defaultArgs, int required, int? requiredFromServer = null)
		{
			//IL_001f: 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)
			if (((ConCommandArgs)(ref args)).Count < required)
			{
				Log.MessageNetworked("Insufficient number of arguments. " + defaultArgs, args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			if ((Object)(object)args.sender == (Object)null && requiredFromServer.HasValue && (((ConCommandArgs)(ref args)).Count < requiredFromServer.Value || ((ConCommandArgs)(ref args))[requiredFromServer.Value - 1] == ""))
			{
				Log.Message("Insufficient number of arguments. " + defaultArgs);
				return false;
			}
			return true;
		}

		public static bool AssertNotServer(ConCommandArgs args)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)args.sender == (Object)null)
			{
				Log.Message("This command has not yet been implemented to be run from a dedicated server.");
				return false;
			}
			return true;
		}

		public static bool AssertExpansionAvailable(ConCommandArgs args, ExpansionDef expansionDef, string typeName)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)expansionDef) && Object.op_Implicit((Object)(object)Run.instance) && !Run.instance.IsExpansionEnabled(expansionDef))
			{
				Log.MessageNetworked($"An expansion is required for this {typeName}: {Util.GetExpansion(expansionDef)}", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool AssertLivingBody(ConCommandArgs args)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((ConCommandArgs)(ref args)).senderBody == (Object)null)
			{
				Log.MessageNetworked("Can't use this command while dead. Use 'respawn' to skip the wait.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseArtifact(ConCommandArgs args, int index, out ArtifactDef artifactDef)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			artifactDef = null;
			ArtifactIndex artifactFromPartial = StringFinder.Instance.GetArtifactFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)artifactFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "artifact", ((ConCommandArgs)(ref args))[index], "list_artifact"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			artifactDef = ArtifactCatalog.GetArtifactDef(artifactFromPartial);
			return AssertExpansionAvailable(args, artifactDef.requiredExpansion, "artifact");
		}

		public static bool TryParseBuff(ConCommandArgs args, int index, out BuffDef buffDef)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			buffDef = null;
			BuffIndex buffFromPartial = StringFinder.Instance.GetBuffFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)buffFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "buff", ((ConCommandArgs)(ref args))[index], "list_buff"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			buffDef = BuffCatalog.GetBuffDef(buffFromPartial);
			return true;
		}

		public static bool TryParseDot(ConCommandArgs args, int index, out DotIndex dotIndex)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected I4, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			dotIndex = (DotIndex)(int)StringFinder.Instance.GetDotFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)dotIndex == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "dot", ((ConCommandArgs)(ref args))[index], "list_dot"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseItem(ConCommandArgs args, int index, out ItemDef itemDef)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			itemDef = null;
			ItemIndex itemFromPartial = StringFinder.Instance.GetItemFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)itemFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "item", ((ConCommandArgs)(ref args))[index], "list_item"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			itemDef = ItemCatalog.GetItemDef(itemFromPartial);
			return AssertExpansionAvailable(args, itemDef.requiredExpansion, "item");
		}

		public static bool TryParseEquipmentOrRandom(ConCommandArgs args, int index, out EquipmentDef equipmentDef)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Invalid comparison between Unknown and I4
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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)
			equipmentDef = null;
			if (string.Equals(((ConCommandArgs)(ref args))[index], "RANDOM", StringComparison.InvariantCultureIgnoreCase))
			{
				PickupIndex val = RoR2Application.rng.NextElementUniform<PickupIndex>(Run.instance.availableEquipmentDropList);
				equipmentDef = EquipmentCatalog.GetEquipmentDef(PickupCatalog.GetPickupDef(val).equipmentIndex);
				return true;
			}
			EquipmentIndex equipFromPartial = StringFinder.Instance.GetEquipFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)equipFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "equip", ((ConCommandArgs)(ref args))[index], "list_equip"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			equipmentDef = EquipmentCatalog.GetEquipmentDef(equipFromPartial);
			return AssertExpansionAvailable(args, equipmentDef.requiredExpansion, "equipment");
		}

		public static bool TryParseBody(ConCommandArgs args, int index, out GameObject bodyPrefab)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			bodyPrefab = null;
			BodyIndex bodyFromPartial = StringFinder.Instance.GetBodyFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)bodyFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "body", ((ConCommandArgs)(ref args))[index], "list_body"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			bodyPrefab = BodyCatalog.GetBodyPrefab(bodyFromPartial);
			return true;
		}

		public static bool TryParseDrone(ConCommandArgs args, int index, out DroneDef droneDef)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			droneDef = null;
			DroneIndex droneFromPartial = StringFinder.Instance.GetDroneFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)droneFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "drone", ((ConCommandArgs)(ref args))[index], "list_drone"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			droneDef = DroneCatalog.GetDroneDef(droneFromPartial);
			return true;
		}

		public static bool TryParseMaster(ConCommandArgs args, int index, out GameObject masterObject)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			masterObject = null;
			MasterIndex aiFromPartial = StringFinder.Instance.GetAiFromPartial(((ConCommandArgs)(ref args))[index]);
			if (aiFromPartial == MasterIndex.none)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "ai", ((ConCommandArgs)(ref args))[index], "list_ai"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			masterObject = MasterCatalog.GetMasterPrefab(aiFromPartial);
			return true;
		}

		public static bool TryParseEliteOrDefault(ConCommandArgs args, int index, EliteDef defaultValue, out EliteDef eliteDef)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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)
			eliteDef = defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "")
			{
				EliteIndex eliteFromPartial = StringFinder.Instance.GetEliteFromPartial(((ConCommandArgs)(ref args))[index]);
				if (eliteFromPartial == StringFinder.EliteIndex_NotFound)
				{
					Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "elite", ((ConCommandArgs)(ref args))[index], "list_elite"), args, Log.LogLevel.MessageClientOnly);
					return false;
				}
				eliteDef = EliteCatalog.GetEliteDef(eliteFromPartial);
			}
			return AssertExpansionAvailable(args, eliteDef?.eliteEquipmentDef?.requiredExpansion, "elite equipment");
		}

		public static bool TryParseTeam(ConCommandArgs args, int index, out TeamIndex teamIndex)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected I4, but got Unknown
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between I4 and Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			teamIndex = (TeamIndex)(int)StringFinder.Instance.GetTeamFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)teamIndex == (int)StringFinder.TeamIndex_NotFound)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "team", ((ConCommandArgs)(ref args))[index], "list_team"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseTeamOrDefault(ConCommandArgs args, int index, TeamIndex defaultValue, out TeamIndex teamIndex)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Expected I4, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			teamIndex = (TeamIndex)(int)defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "")
			{
				return TryParseTeam(args, index, out teamIndex);
			}
			return true;
		}

		public static bool TryParseDifficulty(ConCommandArgs args, int index, out DifficultyIndex difficultyIndex)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected I4, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			difficultyIndex = (DifficultyIndex)(int)StringFinder.Instance.GetDifficultyFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((int)difficultyIndex == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "difficulty", ((ConCommandArgs)(ref args))[index], "list_difficulty"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseScene(ConCommandArgs args, int index, bool includeOffline, out SceneDef sceneDef)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0042: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			sceneDef = null;
			SceneIndex sceneFromPartial = StringFinder.Instance.GetSceneFromPartial(((ConCommandArgs)(ref args))[index], includeOffline);
			if ((int)sceneFromPartial == -1)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "scene", ((ConCommandArgs)(ref args))[index], "list_scene"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			sceneDef = SceneCatalog.GetSceneDef(sceneFromPartial);
			return AssertExpansionAvailable(args, sceneDef.requiredExpansion, "scene");
		}

		public static bool TryParseInteractableCard(ConCommandArgs args, int index, out InteractableSpawnCard isc)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			isc = StringFinder.Instance.GetInteractableSpawnCardFromPartial(((ConCommandArgs)(ref args))[index]);
			if ((Object)(object)isc == (Object)null)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "isc", ((ConCommandArgs)(ref args))[index], "list_interactables"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseDirectorCard(ConCommandArgs args, int index, out DirectorCard directorCard)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			directorCard = StringFinder.Instance.GetDirectorCardFromPartial(((ConCommandArgs)(ref args))[index]);
			if (directorCard == null)
			{
				Log.MessageNetworked(string.Format("No {0} with the name \"{1}\" could be found. Please use {2} for options.", "director_card", ((ConCommandArgs)(ref args))[index], "list_directorcards"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseOptionalBool(ConCommandArgs args, int index, string variableName, bool defaultValue, out bool value)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			value = defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "" && !Util.TryParseBool(((ConCommandArgs)(ref args))[index], out value))
			{
				Log.MessageNetworked(string.Format("Unable to parse {0} to {1}.", variableName, "bool"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseOptionalInt(ConCommandArgs args, int index, string variableName, int defaultValue, out int value, int? min = null, int? max = null)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			value = defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "" && !TextSerialization.TryParseInvariant(((ConCommandArgs)(ref args))[index], ref value))
			{
				Log.MessageNetworked(string.Format("Unable to parse {0} to {1}.", variableName, "int"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			if (min.HasValue && value < min.Value)
			{
				Log.MessageNetworked($"'{variableName}' can't be less than {min.Value}.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			if (max.HasValue && value > max.Value)
			{
				Log.MessageNetworked($"'{variableName}' can't be greater than {max.Value}.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseOptionalUInt(ConCommandArgs args, int index, string variableName, uint defaultValue, out uint value)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			value = defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "" && !TextSerialization.TryParseInvariant(((ConCommandArgs)(ref args))[index], ref value))
			{
				Log.MessageNetworked(string.Format("Unable to parse {0} to {1}.", variableName, "uint"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseOptionalULong(ConCommandArgs args, int index, string variableName, ulong defaultValue, out ulong value)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			value = defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "" && !TextSerialization.TryParseInvariant(((ConCommandArgs)(ref args))[index], ref value))
			{
				Log.MessageNetworked(string.Format("Unable to parse {0} to {1}.", variableName, "ulong"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParseOptionalFloat(ConCommandArgs args, int index, string variableName, float defaultValue, out float value, float? min = null, float? max = null)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			value = defaultValue;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "" && !TextSerialization.TryParseInvariant(((ConCommandArgs)(ref args))[index], ref value))
			{
				Log.MessageNetworked(string.Format("Unable to parse {0} to {1}.", variableName, "float"), args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			if (min.HasValue && value < min.Value)
			{
				Log.MessageNetworked($"'{variableName}' can't be less than {min.Value}.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			if (max.HasValue && value > max.Value)
			{
				Log.MessageNetworked($"'{variableName}' can't be greater than {max.Value}.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParsePlayerOrDefault(ConCommandArgs args, int index, out CharacterMaster master, bool requireLiving = false)
		{
			//IL_0000: 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_0071: 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)
			NetworkUser sender = args.sender;
			master = ((ConCommandArgs)(ref args)).senderMaster;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "")
			{
				sender = Util.GetNetUserFromString(args.userArgs, index);
				if ((Object)(object)sender == (Object)null)
				{
					Log.MessageNetworked("Specified player not found or isn't alive. Please use list_player for options.", args, Log.LogLevel.MessageClientOnly);
					return false;
				}
				master = sender.master;
			}
			if (requireLiving && !Object.op_Implicit((Object)(object)master.bodyInstanceObject))
			{
				Log.MessageNetworked("The target player is required alive for this command.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			return true;
		}

		public static bool TryParsePlayerOrPingedTarget(ConCommandArgs args, int index, out Util.CommandTarget target)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			target = default(Util.CommandTarget);
			CharacterMaster val = ((ConCommandArgs)(ref args)).senderMaster;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "")
			{
				val = Util.GetTargetFromArgs(args, index);
				if ((Object)(object)val == (Object)null && (Object)(object)args.sender != (Object)null && ((ConCommandArgs)(ref args))[index].ToUpperInvariant() == "PINGED")
				{
					val = Hooks.GetPingedTarget(((ConCommandArgs)(ref args)).senderMaster).master;
					if ((Object)(object)val == (Object)null)
					{
						Log.MessageNetworked("Pinged target not found. Either the last ping was not a character, or it has been destroyed since.", args, Log.LogLevel.MessageClientOnly);
						return false;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Log.MessageNetworked("Specified player not found or isn't alive. Please use list_player for options.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			target.inventory = val.inventory;
			PlayerCharacterMasterController playerCharacterMasterController = val.playerCharacterMasterController;
			target.name = ((playerCharacterMasterController != null) ? playerCharacterMasterController.GetDisplayName() : null) ?? ((Object)((Component)val).gameObject).name;
			return true;
		}

		public static bool TryParsePlayerOrPingedBodyTarget(ConCommandArgs args, int index, out Util.CommandTarget target)
		{
			//IL_000f: 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_003a: 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)
			target = default(Util.CommandTarget);
			CharacterBody val = ((ConCommandArgs)(ref args)).senderBody;
			bool flag = (Object)(object)args.sender == (Object)null;
			if (((ConCommandArgs)(ref args)).Count > index && ((ConCommandArgs)(ref args))[index] != "")
			{
				CharacterMaster targetFromArgs = Util.GetTargetFromArgs(args, index);
				if ((Object)(object)targetFromArgs == (Object)null && !flag && ((ConCommandArgs)(ref args))[index].ToUpperInvariant() == "PINGED")
				{
					val = Hooks.GetPingedTarget(((ConCommandArgs)(ref args)).senderMaster).body;
					if ((Object)(object)val == (Object)null)
					{
						Log.MessageNetworked("Pinged target not found. Either the last ping was not a character, or it has been destroyed since.", args, Log.LogLevel.MessageClientOnly);
						return false;
					}
				}
				else
				{
					val = ((targetFromArgs != null) ? targetFromArgs.GetBody() : null);
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Log.MessageNetworked("Specified player not found or isn't alive. Please use list_player for options.", args, Log.LogLevel.MessageClientOnly);
				return false;
			}
			CharacterMaster master = val.master;
			PlayerCharacterMasterController val2 = ((master != null) ? master.playerCharacterMasterController : null);
			target.body = val;
			target.name = ((val2 != null) ? val2.GetDisplayName() : null) ?? ((Object)((Component)val).gameObject).name;
			return true;
		}
	}
	[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
	public sealed class AutoCompleteAttribute : Attribute
	{
		internal class Result
		{
			internal AutoCompleteParser parser;

			internal string signature;

			internal List<string>[] parameters;

			internal Result(AutoCompleteParser parser, string signature, List<string>[] parameters)
			{
				this.parser = parser;
				this.signature = signature;
				this.parameters = parameters;
			}
		}

		public string args;

		public AutoCompleteAttribute(string args)
		{
			this.args = args;
		}

		internal Result Parse(AutoCompleteParser parser)
		{
			MatchCollection matchCollection = Regex.Matches(args, "\\{(.*?)\\}|\\[(.*?)\\]|<(.*?)>");
			List<string>[] array = new List<string>[matchCollection.Count];
			for (int i = 0; i < matchCollection.Count; i++)
			{
				GroupCollection groups = matchCollection[i].Groups;
				string text = ((!string.IsNullOrEmpty(groups[1].Value)) ? groups[1] : ((!string.IsNullOrEmpty(groups[2].Value)) ? groups[2] : groups[3])).Value.Split(':')[0];
				Match match = Regex.Match(text, "\\((.*)\\)");
				array[i] = new List<string>();
				AutoCompleteParser.StaticCatalog catalog;
				AutoCompleteParser.DynamicCatalog catalog2;
				if (match.Success)
				{
					foreach (string item in from s in match.Groups[1].Value.Split('|')
						select s.Trim())
					{
						string text2 = item.Trim();
						if (text2.StartsWith("'") && text2.EndsWith("'"))
						{
							array[i].Add(text2);
						}
						else if (parser.TryGetStaticVariable(text2, out catalog) || parser.TryGetDynamicVariable(text2, out catalog2))
						{
							array[i].Add(text2);
						}
					}
				}
				else
				{
					text = text.Trim();
					if (parser.TryGetStaticVariable(text, out catalog) || parser.TryGetDynamicVariable(text, out catalog2))
					{
						array[i].Add(text);
					}
				}
			}
			return new Result(parser, string.Join(" ", from Match m in matchCollection
				select m.Groups[0].Value), array);
		}
	}
	internal static class AutoCompleteManager
	{
		private static readonly Dictionary<string, AutoCompleteAttribute.Result> commands = new Dictionary<string, AutoCompleteAttribute.Result>();

		internal static string CurrentCommand { get; private set; }

		internal static List<AutoCompleteParser.AutoCompleteOption>[] CurrentParameters { get; private set; }

		internal static string CurrentSignature { get; private set; }

		internal static void PrepareCommandOptions(string commandName)
		{
			commandName = commandName.ToLower();
			if (CurrentCommand == commandName)
			{
				return;
			}
			CurrentCommand = commandName;
			if (!commands.TryGetValue(commandName, out var value))
			{
				CurrentParameters = new List<AutoCompleteParser.AutoCompleteOption>[0];
				CurrentSignature = null;
				return;
			}
			AutoCompleteParser parser = value.parser;
			List<AutoCompleteParser.AutoCompleteOption>[] array = new List<AutoCompleteParser.AutoCompleteOption>[value.parameters.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new List<AutoCompleteParser.AutoCompleteOption>();
				foreach (string item in value.parameters[i])
				{
					AutoCompleteParser.StaticCatalog catalog;
					AutoCompleteParser.DynamicCatalog catalog2;
					if (item.StartsWith("'") && item.EndsWith("'"))
					{
						array[i].Add(new AutoCompleteParser.AutoCompleteOption(item.Trim('\'')));
					}
					else if (parser.TryGetStaticVariable(item, out catalog))
					{
						array[i].AddRange(catalog.options);
					}
					else if (parser.TryGetDynamicVariable(item, out catalog2))
					{
						array[i].AddRange(catalog2.Rebuild());
					}
				}
			}
			CurrentParameters = array;
			CurrentSignature = value.signature;
		}

		internal static void ClearCommandOptions()
		{
			CurrentCommand = null;
			CurrentParameters = null;
			CurrentSignature = null;
		}

		internal static void RegisterCommand(string commandName, AutoCompleteAttribute.Result parameters)
		{
			commands[commandName.ToLower()] = parameters;
		}

		internal static void RegisterAutoCompleteCommands()
		{
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: 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)
			AutoCompleteParser autoCompleteParser = new AutoCompleteParser();
			autoCompleteParser.RegisterStaticVariable("0", "0");
			autoCompleteParser.RegisterStaticVariable("1", "1");
			autoCompleteParser.RegisterStaticVariable("ai", MasterCatalog.allAiMasters.Select((CharacterMaster i) => $"{(int)i.masterIndex}|{((Object)i).name}|{StringFinder.GetLangInvar(StringFinder.GetMasterName(i))}"), 1);
			autoCompleteParser.RegisterStaticVariable("artifact", ArtifactCatalog.artifactDefs.Select((ArtifactDef i) => $"{(int)i.artifactIndex}|{i.cachedName}|{StringFinder.GetLangInvar(i.nameToken)}"), 1);
			autoCompleteParser.RegisterStaticVariable("body", BodyCatalog.allBodyPrefabBodyBodyComponents.Select((CharacterBody i) => $"{(int)i.bodyIndex}|{((Object)i).name}|{StringFinder.GetLangInvar(i.baseNameToken)}"), 1);
			autoCompleteParser.RegisterStaticVariable("buff", BuffCatalog.buffDefs.Select((BuffDef i) => $"{(int)i.buffIndex}|{StringFinder.GetLangInvar(((Object)i).name)}"), 1);
			autoCompleteParser.RegisterStaticVariable("difficulty", from kv in StringFinder.difficultyDefs
				orderby kv.Key
				select $"{(int)kv.Key}|{StringFinder.GetLangInvar(kv.Value.nameToken)}", 1);
			autoCompleteParser.RegisterStaticVariable("drone", DroneCatalog.allDroneDefs.Select((DroneDef i) => $"{(int)i.droneIndex}|{((Object)i).name}|{StringFinder.GetLangInvar(i.nameToken)}"), 1);
			autoCompleteParser.RegisterStaticVariable("droptable", from i in (IEnumerable<ItemTierDef>)(object)ItemTierCatalog.allItemTierDefs
				orderby i.tier
				select $"{(int)i.tier}|{((Object)i).name}", 1);
			autoCompleteParser.RegisterStaticVariable("dot", DotController.dotDefs.Select((DotDef d, int i) => $"{i}|{(object)(DotIndex)i}"), 1);
			autoCompleteParser.RegisterStaticVariable("elite", new string[1] { "-1|None" }.Concat(EliteCatalog.eliteDefs.Select((EliteDef i) => $"{(int)i.eliteIndex}|{((Object)i).name}|{StringFinder.GetLangInvar(i.modifierToken)}")), 1);
			autoCompleteParser.RegisterStaticVariable("equip", EquipmentCatalog.equipmentDefs.Select((EquipmentDef i) => $"{(int)i.equipmentIndex}|{((Object)i).name}|{StringFinder.GetLangInvar(i.nameToken)}"), 1);
			autoCompleteParser.RegisterStaticVariable("item", ((IEnumerable<ItemDef>)(object)ItemCatalog.allItemDefs).Select((ItemDef i) => $"{(int)i.itemIndex}|{((Object)i).name}|{StringFinder.GetLangInvar(i.nameToken)}"), 1);
			autoCompleteParser.RegisterStaticVariable("specific_stage", from i in (IEnumerable<SceneDef>)(object)SceneCatalog.allSceneDefs
				where !i.isOfflineScene
				select $"{(int)i.sceneDefIndex}|{i.cachedName}|{StringFinder.GetLangInvar(i.nameToken)}", 1);
			autoCompleteParser.RegisterStaticVariable("team", new string[1] { "-1|None" }.Concat(TeamCatalog.teamDefs.Select((TeamDef t, int i) => $"{i}|{(object)(TeamIndex)(sbyte)i}")), 1);
			autoCompleteParser.RegisterStaticVariable("item_type", CollectEnumNames(typeof(Items.ItemType), typeof(int)).SkipLast(1), 1);
			autoCompleteParser.RegisterStaticVariable("permission_level", CollectEnumNames(typeof(Level), typeof(int)), 1);
			autoCompleteParser.RegisterDynamicVariable("director_card", StringFinder.Instance.DirectorCards, "spawnCard", isToken: false, showIndex: true, 1);
			autoCompleteParser.RegisterDynamicVariable("interactable", StringFinder.Instance.InteractableSpawnCards, "", isToken: false, showIndex: true, 1);
			autoCompleteParser.RegisterDynamicVariable("player", NetworkUser.instancesList, "userName");
			autoCompleteParser.Scan(Assembly.GetExecutingAssembly());
		}

		private static IEnumerable<string> CollectEnumNames(Type enumType, Type castTo)
		{
			if (enumType == null)
			{
				Log.Message("Input type is null", Log.LogLevel.Warning, Log.Target.Bepinex);
				yield break;
			}
			if (!enumType.IsEnum)
			{
				Log.Message("Input type is not enum: " + enumType.Name, Log.LogLevel.Warning, Log.Target.Bepinex);
				yield break;
			}
			string[] enumNames = Enum.GetNames(enumType);
			Array enumValues = Enum.GetValues(enumType);
			for (int i = 0; i < enumValues.Length; i++)
			{
				if (enumNames[i] != "Count")
				{
					yield return $"{Convert.ChangeType(enumValues.GetValue(i), castTo)}|{enumNames[i]}";
				}
			}
		}
	}
	public sealed class AutoCompleteParser
	{
		internal class AutoCompleteOption
		{
			internal string name;

			internal int index;

			internal AutoCompleteOption(string name, int index = 0)
			{
				this.name = name;
				this.index = index;
			}
		}

		internal class StaticCatalog
		{
			internal readonly AutoCompleteOption[] options;

			internal StaticCatalog(IEnumerable<string> catalog, int autocompleteIndex = 0)
			{
				options = catalog.Select((string s) => new AutoCompleteOption(s, autocompleteIndex)).ToArray();
			}
		}

		internal class DynamicCatalog
		{
			private readonly IEnumerable<object> catalog;

			private readonly string nestedField;

			private readonly bool isToken;

			private readonly bool showIndex;

			private readonly int autocompleteIndex;

			internal DynamicCatalog(IEnumerable<object> catalog, string nestedField, bool isToken, bool showIndex, int autocompleteIndex)
			{
				this.catalog = catalog;
				this.nestedField = nestedField;
				this.isToken = isToken;
				this.showIndex = showIndex;
				this.autocompleteIndex = autocompleteIndex;
			}

			internal IEnumerable<AutoCompleteOption> Rebuild()
			{
				string[] block = ((!string.IsNullOrEmpty(nestedField)) ? nestedField.Split('/') : new string[0]);
				int index = 0;
				foreach (object item in catalog)
				{
					string text;
					if (block.Length != 0)
					{
						object fieldValue = Reflection.GetFieldValue<object>(item, block[0]);
						for (int i = 1; i < block.Length; i++)
						{
							fieldValue = Reflection.GetFieldValue<object>(fieldValue, block[i]);
						}
						text = fieldValue.ToString();
					}
					else
					{
						text = item.ToString();
					}
					if (text.Contains("(RoR"))
					{
						text = text.Substring(0, text.IndexOf('('));
					}
					text = (isToken ? StringFinder.GetLangInvar(text) : StringFinder.RemoveSpacesAndAlike(text));
					text = (showIndex ? $"{index}|{text}" : text);
					yield return new AutoCompleteOption(text, autocompleteIndex);
					index++;
				}
			}
		}

		private readonly Dictionary<string, StaticCatalog> staticVariables = new Dictionary<string, StaticCatalog>();

		private readonly Dictionary<string, DynamicCatalog> dynamicVariables = new Dictionary<string, DynamicCatalog>();

		public void RegisterStaticVariable(string name, string value)
		{
			RegisterStaticVariable(name, new string[1] { value });
		}

		public void RegisterStaticVariable(string name, IEnumerable<string> values, int autocompleteIndex = 0)
		{
			staticVariables[name] = new StaticCatalog(values, autocompleteIndex);
		}

		public void RegisterDynamicVariable(string name, IEnumerable<object> catalog, string nestedField = "", bool isToken = false, bool showIndex = true, int autocompleteIndex = 0)
		{
			dynamicVariables[name] = new DynamicCatalog(catalog, nestedField, isToken, showIndex, autocompleteIndex);
		}

		internal bool TryGetStaticVariable(string name, out StaticCatalog catalog)
		{
			return staticVariables.TryGetValue(name, out catalog);
		}

		internal bool TryGetDynamicVariable(string name, out DynamicCatalog catalog)
		{
			return dynamicVariables.TryGetValue(name, out catalog);
		}

		public void Scan(Assembly assembly)
		{
			if (assembly == null)
			{
				Log.Message("Null assembly encountered for autocompletion scanning", Log.LogLevel.Warning, Log.Target.Bepinex);
				return;
			}
			Type[] source;
			try
			{
				source = assembly.GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				source = ex.Types.Where((Type x) => x != null).ToArray();
				Exception[] loaderExceptions = ex.LoaderExceptions;
				for (int num = 0; num < loaderExceptions.Length; num++)
				{
					_ = loaderExceptions[num];
					Log.Message(ex.Message, Log.LogLevel.Error, Log.Target.Bepinex);
				}
			}
			foreach (MethodInfo item in source.SelectMany((Type x) => x.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)))
			{
				object[] customAttributes;
				try
				{
					customAttributes = item.GetCustomAttributes(inherit: false);
				}
				catch (TypeLoadException ex2)
				{
					Log.Message(ex2.Message, Log.LogLevel.Error, Log.Target.Bepinex);
					continue;
				}
				catch (InvalidOperationException ex3)
				{
					Log.Message(ex3.Message, Log.LogLevel.Error, Log.Target.Bepinex);
					continue;
				}
				if (customAttributes == null)
				{
					continue;
				}
				AutoCompleteAttribute autoCompleteAttribute = customAttributes.OfType<AutoCompleteAttribute>().DefaultIfEmpty(null).FirstOrDefault();
				if (autoCompleteAttribute == null)
				{
					continue;
				}
				ConCommandAttribute[] array = customAttributes.OfType<ConCommandAttribute>().ToArray();
				if (array.Length != 0)
				{
					AutoCompleteAttribute.Result parameters = autoCompleteAttribute.Parse(this);
					ConCommandAttribute[] array2 = array;
					for (int num = 0; num < array2.Length; num++)
					{
						AutoCompleteManager.RegisterCommand(array2[num].commandName, parameters);
					}
				}
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("iHarbHD.DebugToolkit", "DebugToolkit", "3.22.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DebugToolkit : BaseUnityPlugin
	{
		public const string modname = "DebugToolkit";

		public const string modver = "3.22.0";

		public const string GUID = "iHarbHD.DebugToolkit";

		internal static ConfigFile Configuration;

		internal static DebugToolkit Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Configuration = ((BaseUnityPlugin)this).Config;
			new Log(((BaseUnityPlugin)this).Logger);
			Log.Message("Created by Harb, iDeathHD and . Based on RoR2Cheats by Morris1927.", Log.LogLevel.Info, Log.Target.Bepinex);
			MacroSystem.Init();
			PermissionSystem.Init();
			Hooks.InitializeHooks();
			NetworkManager.Init();
			((BaseConVar)ConsoleWindow.cvConsoleEnabled).defaultValue = "1";
			ConsoleWindow.cvConsoleEnabled.SetBool(true);
		}

		private void LogBuildInfo()
		{
		}

		private void Start()
		{
			_ = StringFinder.Instance;
		}

		private void Update()
		{
			MacroSystem.Update();
			if (Object.op_Implicit((Object)(object)Run.instance) && Command_Noclip.IsActivated)
			{
				Command_Noclip.Update();
			}
		}

		public static void InvokeCMD(NetworkUser user, string commandName, params string[] arguments)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = arguments.ToList();
			CmdSender val = default(CmdSender);
			((CmdSender)(ref val))..ctor(user);
			if (Object.op_Implicit((Object)(object)Console.instance))
			{
				Console.instance.RunCmd(val, commandName, list);
			}
			else
			{
				Log.Message("InvokeCMD called whilst no console instance exists.", Log.LogLevel.Error, Log.Target.Bepinex);
			}
		}

		public static string GetModVer()
		{
			return "3.22.0";
		}
	}
	public sealed class Hooks
	{
		internal struct PingCache
		{
			internal CharacterBody body;

			internal CharacterMaster master;
		}

		internal struct MatchInfo
		{
			public int similarity;

			public string str;

			public int index;
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__UnlockConsole;

			public static hook_AwakeCoroutine <1>__InitCommandsAndFreeConvars;

			public static Manipulator <2>__WarnUserOfServerCommandOffline;

			public static Manipulator <3>__ToggleConsoleWindowWithCustomKey;

			public static hook_SetSearchString <4>__BetterAutoCompletion;

			public static Action <5>__InitDroptableData;

			public static Action <6>__InitPortals;

			public static Action <7>__RegisterAutoCompleteCommands;

			public static Action<Run> <8>__CollectItemTiers;

			public static hook_Start <9>__AddConCommandSignatureHint;

			public static hook_OnInputFieldValueChanged <10>__UpdateCommandSignature;

			public static Manipulator <11>__ApplyTextWithoutColorTags;

			public static Manipulator <12>__SmoothDropDownSuggestionNavigation;

			public static Manipulator <13>__AllowTabAutocompleteConCommands;

			public static Manipulator <14>__EnableCheatsInCCSetScene;

			public static hook_CCSceneList <15>__OverrideVanillaSceneList;

			public static hook_Save <16>__PreventSave;

			public static hook_RebuildPing <17>__InterceptPing;

			public static Manipulator <18>__InfiniteTowerRun_BeginNextWave;

			public static hook_SetNextSpawnAsBoss <19>__SetNextBossForDirector;

			public static hook_Initialize <20>__SetNextBossForSimulacrumDirector;

			public static hook_AttemptSpawnOnTarget <21>__OverrideBossCombatDirectorSpawnResult;

			public static hook_RebuildCards <22>__ForceFamilyEvent;

			public static hook_GenerateWeightedCategorySelection <23>__ForceFamilyEventForDccsPoolStages;

			public static hook_IsAvailable <24>__ForceFamilyDirectorCardCategorySelectionToBeAvailable;

			public static Action<SceneDirector> <25>__DenyInteractableSpawns;

			public static hook_SpendAllCreditsOnMapSpawns_Transform_WeightedSelection1 <26>__DenyMapSpawns;

			public static hook_AwardExperience <27>__DenyExperience;

			public static hook_Start <28>__CreateNetworkObject;

			public static hook_OnDestroy <29>__DestroyNetworkObject;

			public static hook_OnStopClient <30>__DisableOnStopClient;

			public static hook_TeleportBody <31>__DisableOOBCheck;

			public static Action<Run> <32>__DisableOnRunDestroy;

			public static hook_TakeDamage <33>__NonLethalDamage;

			public static hook_Awake <34>__SetGodMode;

			public static Manipulator <35>__FixCommandHelpText;

			public static Manipulator <36>__FixCCFind;
		}

		private const ConVarFlags AllFlagsNoCheat = (ConVarFlags)23;

		private const string GRAY = "<color=#808080>";

		private const string COMMAND_SIGNATURE = "<color=#ffa000>{0} {1}</color>";

		private static int[] autoCompleteIndices;

		private static orig_RunCmd _origRunCmd;

		internal static bool buddha;

		internal static bool god;

		private static GameObject commandSignatureText;

		private static CombatDirector bossDirector;

		private static bool skipSpawnIfTooCheapBackup;

		private static readonly Dictionary<CharacterMaster, PingCache> pingedTargets = new Dictionary<CharacterMaster, PingCache>();

		private const float changeSelectedItemTimer = 0.1f;

		private static float _lastSelectedItemChange;

		public static void InitializeHooks()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_009c: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Expected O, but got Unknown
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Expected O, but got Unknown
			//IL_0286: 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_0291: Expected O, but got Unknown
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Expected O, but got Unknown
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Expected O, but got Unknown
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Expected O, but got Unknown
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Expected O, but got Unknown
			//IL_0366: 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_0371: Expected O, but got Unknown
			//IL_0386: 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_0391: Expected O, but got Unknown
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Expected O, but got Unknown
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d1: Expected O, but got Unknown
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Expected O, but got Unknown
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Expected O, but got Unknown
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Expected O, but got Unknown
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Expected O, but got Unknown
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Expected O, but got Unknown
			//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d5: Expected O, but got Unknown
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Expected O, but got Unknown
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: Expected O, but got Unknown
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Expected O, but got Unknown
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Expected O, but got Unknown
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Expected O, but got Unknown
			BindingFlags bindingAttr = (BindingFlags)(-1);
			MethodInfo? methodInfo = typeof(Console).GetNestedTypes(bindingAttr).FirstOrDefault((Type t) => t.Name.Contains("AwakeCoroutine")).GetMethods(bindingAttr)
				.FirstOrDefault((MethodInfo m) => m.Name.Contains("MoveNext"));
			object obj = <>O.<0>__UnlockConsole;
			if (obj == null)
			{
				Manipulator val = UnlockConsole;
				<>O.<0>__UnlockConsole = val;
				obj = (object)val;
			}
			new ILHook((MethodBase)methodInfo, (Manipulator)obj);
			object obj2 = <>O.<1>__InitCommandsAndFreeConvars;
			if (obj2 == null)
			{
				hook_AwakeCoroutine val2 = InitCommandsAndFreeConvars;
				<>O.<1>__InitCommandsAndFreeConvars = val2;
				obj2 = (object)val2;
			}
			Console.AwakeCoroutine += (hook_AwakeCoroutine)obj2;
			_origRunCmd = new Hook((MethodBase)Reflection.GetMethodCached(typeof(Console), "RunCmd"), Reflection.GetMethodCached(typeof(Hooks), "LogNetworkCommandsAndCheckPermissions"), new HookConfig
			{
				Priority = 1
			}).GenerateTrampoline<orig_RunCmd>();
			object obj3 = <>O.<2>__WarnUserOfServerCommandOffline;
			if (obj3 == null)
			{
				Manipulator val3 = WarnUserOfServerCommandOffline;
				<>O.<2>__WarnUserOfServerCommandOffline = val3;
				obj3 = (object)val3;
			}
			Console.RunCmd += (Manipulator)obj3;
			object obj4 = <>O.<3>__ToggleConsoleWindowWithCustomKey;
			if (obj4 == null)
			{
				Manipulator val4 = ToggleConsoleWindowWithCustomKey;
				<>O.<3>__ToggleConsoleWindowWithCustomKey = val4;
				obj4 = (object)val4;
			}
			ConsoleWindow.CheckConsoleKey += (Manipulator)obj4;
			object obj5 = <>O.<4>__BetterAutoCompletion;
			if (obj5 == null)
			{
				hook_SetSearchString val5 = BetterAutoCompletion;
				<>O.<4>__BetterAutoCompletion = val5;
				obj5 = (object)val5;
			}
			AutoComplete.SetSearchString += (hook_SetSearchString)obj5;
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Items.InitDroptableData));
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(Spawners.InitPortals));
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AutoCompleteManager.RegisterAutoCompleteCommands));
			Run.onRunStartGlobal += Items.CollectItemTiers;
			object obj6 = <>O.<9>__AddConCommandSignatureHint;
			if (obj6 == null)
			{
				hook_Start val6 = AddConCommandSignatureHint;
				<>O.<9>__AddConCommandSignatureHint = val6;
				obj6 = (object)val6;
			}
			ConsoleWindow.Start += (hook_Start)obj6;
			object obj7 = <>O.<10>__UpdateCommandSignature;
			if (obj7 == null)
			{
				hook_OnInputFieldValueChanged val7 = UpdateCommandSignature;
				<>O.<10>__UpdateCommandSignature = val7;
				obj7 = (object)val7;
			}
			ConsoleWindow.OnInputFieldValueChanged += (hook_OnInputFieldValueChanged)obj7;
			object obj8 = <>O.<11>__ApplyTextWithoutColorTags;
			if (obj8 == null)
			{
				Manipulator val8 = ApplyTextWithoutColorTags;
				<>O.<11>__ApplyTextWithoutColorTags = val8;
				obj8 = (object)val8;
			}
			ConsoleWindow.ApplyAutoComplete += (Manipulator)obj8;
			object obj9 = <>O.<12>__SmoothDropDownSuggestionNavigation;
			if (obj9 == null)
			{
				Manipulator val9 = SmoothDropDownSuggestionNavigation;
				<>O.<12>__SmoothDropDownSuggestionNavigation = val9;
				obj9 = (object)val9;
			}
			ConsoleWindow.Update += (Manipulator)obj9;
			object obj10 = <>O.<13>__AllowTabAutocompleteConCommands;
			if (obj10 == null)
			{
				Manipulator val10 = AllowTabAutocompleteConCommands;
				<>O.<13>__AllowTabAutocompleteConCommands = val10;
				obj10 = (object)val10;
			}
			HUD.Update += (Manipulator)obj10;
			object obj11 = <>O.<14>__EnableCheatsInCCSetScene;
			if (obj11 == null)
			{
				Manipulator val11 = EnableCheatsInCCSetScene;
				<>O.<14>__EnableCheatsInCCSetScene = val11;
				obj11 = (object)val11;
			}
			NetworkManagerSystem.CCSetScene += (Manipulator)obj11;
			object obj12 = <>O.<15>__OverrideVanillaSceneList;
			if (obj12 == null)
			{
				hook_CCSceneList val12 = OverrideVanillaSceneList;
				<>O.<15>__OverrideVanillaSceneList = val12;
				obj12 = (object)val12;
			}
			NetworkManagerSystem.CCSceneList += (hook_CCSceneList)obj12;
			object obj13 = <>O.<16>__PreventSave;
			if (obj13 == null)
			{
				hook_Save val13 = Profile.PreventSave;
				<>O.<16>__PreventSave = val13;
				obj13 = (object)val13;
			}
			SaveSystem.Save += (hook_Save)obj13;
			object obj14 = <>O.<17>__InterceptPing;
			if (obj14 == null)
			{
				hook_RebuildPing val14 = InterceptPing;
				<>O.<17>__InterceptPing = val14;
				obj14 = (object)val14;
			}
			PingerController.RebuildPing += (hook_RebuildPing)obj14;
			object obj15 = <>O.<18>__InfiniteTowerRun_BeginNextWave;
			if (obj15 == null)
			{
				Manipulator val15 = InfiniteTowerRun_BeginNextWave;
				<>O.<18>__InfiniteTowerRun_BeginNextWave = val15;
				obj15 = (object)val15;
			}
			InfiniteTowerRun.BeginNextWave += (Manipulator)obj15;
			object obj16 = <>O.<19>__SetNextBossForDirector;
			if (obj16 == null)
			{
				hook_SetNextSpawnAsBoss val16 = SetNextBossForDirector;
				<>O.<19>__SetNextBossForDirector = val16;
				obj16 = (object)val16;
			}
			CombatDirector.SetNextSpawnAsBoss += (hook_SetNextSpawnAsBoss)obj16;
			object obj17 = <>O.<20>__SetNextBossForSimulacrumDirector;
			if (obj17 == null)
			{
				hook_Initialize val17 = SetNextBossForSimulacrumDirector;
				<>O.<20>__SetNextBossForSimulacrumDirector = val17;
				obj17 = (object)val17;
			}
			InfiniteTowerExplicitSpawnWaveController.Initialize += (hook_Initialize)obj17;
			object obj18 = <>O.<21>__OverrideBossCombatDirectorSpawnResult;
			if (obj18 == null)
			{
				hook_AttemptSpawnOnTarget val18 = OverrideBossCombatDirectorSpawnResult;
				<>O.<21>__OverrideBossCombatDirectorSpawnResult = val18;
				obj18 = (object)val18;
			}
			CombatDirector.AttemptSpawnOnTarget += (hook_AttemptSpawnOnTarget)obj18;
			object obj19 = <>O.<22>__ForceFamilyEvent;
			if (obj19 == null)
			{
				hook_RebuildCards val19 = ForceFamilyEvent;
				<>O.<22>__ForceFamilyEvent = val19;
				obj19 = (object)val19;
			}
			ClassicStageInfo.RebuildCards += (hook_RebuildCards)obj19;
			object obj20 = <>O.<23>__ForceFamilyEventForDccsPoolStages;
			if (obj20 == null)
			{
				hook_GenerateWeightedCategorySelection val20 = ForceFamilyEventForDccsPoolStages;
				<>O.<23>__ForceFamilyEventForDccsPoolStages = val20;
				obj20 = (object)val20;
			}
			DccsPool.GenerateWeightedCategorySelection += (hook_GenerateWeightedCategorySelection)obj20;
			object obj21 = <>O.<24>__ForceFamilyDirectorCardCategorySelectionToBeAvailable;
			if (obj21 == null)
			{
				hook_IsAvailable val21 = ForceFamilyDirectorCardCategorySelectionToBeAvailable;
				<>O.<24>__ForceFamilyDirectorCardCategorySelectionToBeAvailable = val21;
				obj21 = (object)val21;
			}
			FamilyDirectorCardCategorySelection.IsAvailable += (hook_IsAvailable)obj21;
			Run.onRunDestroyGlobal += delegate
			{
				CurrentRun.ResetNextBoss();
				CurrentRun.forceFamilyEvent = false;
			};
			SceneDirector.onPrePopulateSceneServer += DenyInteractableSpawns;
			object obj22 = <>O.<26>__DenyMapSpawns;
			if (obj22 == null)
			{
				hook_SpendAllCreditsOnMapSpawns_Transform_WeightedSelection1 val22 = DenyMapSpawns;
				<>O.<26>__DenyMapSpawns = val22;
				obj22 = (object)val22;
			}
			CombatDirector.SpendAllCreditsOnMapSpawns_Transform_WeightedSelection1 += (hook_SpendAllCreditsOnMapSpawns_Transform_WeightedSelection1)obj22;
			object obj23 = <>O.<27>__DenyExperience;
			if (obj23 == null)
			{
				hook_AwardExperience val23 = DenyExperience;
				<>O.<27>__DenyExperience = val23;
				obj23 = (object)val23;
			}
			ExperienceManager.AwardExperience += (hook_AwardExperience)obj23;
			object obj24 = <>O.<28>__CreateNetworkObject;
			if (obj24 == null)
			{
				hook_Start val24 = NetworkManager.CreateNetworkObject;
				<>O.<28>__CreateNetworkObject = val24;
				obj24 = (object)val24;
			}
			NetworkSession.Start += (hook_Start)obj24;
			object obj25 = <>O.<29>__DestroyNetworkObject;
			if (obj25 == null)
			{
				hook_OnDestroy val25 = NetworkManager.DestroyNetworkObject;
				<>O.<29>__DestroyNetworkObject = val25;
				obj25 = (object)val25;
			}
			NetworkSession.OnDestroy += (hook_OnDestroy)obj25;
			object obj26 = <>O.<30>__DisableOnStopClient;
			if (obj26 == null)
			{
				hook_OnStopClient val26 = Command_Noclip.DisableOnStopClient;
				<>O.<30>__DisableOnStopClient = val26;
				obj26 = (object)val26;
			}
			NetworkManagerSystem.OnStopClient += (hook_OnStopClient)obj26;
			object obj27 = <>O.<31>__DisableOOBCheck;
			if (obj27 == null)
			{
				hook_TeleportBody val27 = Command_Noclip.DisableOOBCheck;
				<>O.<31>__DisableOOBCheck = val27;
				obj27 = (object)val27;
			}
			MapZone.TeleportBody += (hook_TeleportBody)obj27;
			Run.onRunDestroyGlobal += Command_Noclip.DisableOnRunDestroy;
			object obj28 = <>O.<33>__NonLethalDamage;
			if (obj28 == null)
			{
				hook_TakeDamage val28 = NonLethalDamage;
				<>O.<33>__NonLethalDamage = val28;
				obj28 = (object)val28;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj28;
			object obj29 = <>O.<34>__SetGodMode;
			if (obj29 == null)
			{
				hook_Awake val29 = SetGodMode;
				<>O.<34>__SetGodMode = val29;
				obj29 = (object)val29;
			}
			CharacterMaster.Awake += (hook_Awake)obj29;
			object obj30 = <>O.<35>__FixCommandHelpText;
			if (obj30 == null)
			{
				Manipulator val30 = FixCommandHelpText;
				<>O.<35>__FixCommandHelpText = val30;
				obj30 = (object)val30;
			}
			Console.ShowHelpText += (Manipulator)obj30;
			object obj31 = <>O.<36>__FixCCFind;
			if (obj31 == null)
			{
				Manipulator val31 = FixCCFind;
				<>O.<36>__FixCCFind = val31;
				obj31 = (object)val31;
			}
			Console.CCFind += (Manipulator)obj31;
		}

		private static void ToggleConsoleWindowWithCustomKey(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Input>(x, "GetKeyDown")
			}))
			{
				Log.Message("Failed to patch " + ((MemberReference)il.Method).Name);
				return;
			}
			val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)delegate(bool isKeyPressed)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				if (isKeyPressed)
				{
					return true;
				}
				KeyCode value = MacroSystem.ConsoleKey.Value;
				return (int)value != 0 && Input.GetKeyDown(value);
			});
		}

		private static void FixCommandHelpText(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0024: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.Instrs.Count > 1)
			{
				Log.Message("Skipped patching the command help text method. Maybe fixed already?", Log.LogLevel.Warning, Log.Target.Bepinex);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit<Console>(OpCodes.Call, "GetHelpText");
			val.Emit<Debug>(OpCodes.Call, "Log");
		}

		private static void FixCCFind(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Console>(x, "Find"),
				(Instruction x) => ILPatternMatchingExt.MatchPop(x)
			}))
			{
				Log.Message("Could not patch \"find\" command. Maybe fixed already?", Log.LogLevel.Warning, Log.Target.Bepinex);
				return;
			}
			val.Index += 1;
			val.Emit<Debug>(OpCodes.Call, "Log");
			val.Remove();
		}

		private static void SetGodMode(orig_Awake orig, CharacterMaster self)
		{
			orig.Invoke(self);
			if (NetworkServer.active)
			{
				self.godMode |= Object.op_Implicit((Object)(object)self.playerCharacterMasterController) && god;
			}
		}

		private static void NonLethalDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (buddha && self.body.isPlayerControlled)
			{
				damageInfo.damageType |= DamageTypeCombo.op_Implicit((DamageType)1);
			}
			orig.Invoke(self, damageInfo);
		}

		private static void InfiniteTowerRun_BeginNextWave(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0)
			}))
			{
				Log.Message("Failed to patch RoR2.InfiniteTowerRun.BeginNextWave", Log.LogLevel.Warning, Log.Target.Bepinex);
				return;
			}
			val.Index += 1;
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<GameObject, InfiniteTowerRun, GameObject>>((Func<GameObject, InfiniteTowerRun, GameObject>)delegate(GameObject wavePrefab, InfiniteTowerRun run)
			{
				wavePrefab = CurrentRun.selectedWavePrefab ?? wavePrefab;
				CurrentRun.selectedWavePrefab = null;
				return wavePrefab;
			});
		}

		private static void InterceptPing(orig_RebuildPing orig, PingerController self, PingInfo pingInfo)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, pingInfo);
			CharacterMaster component = ((Component)self).GetComponent<CharacterMaster>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (Object.op_Implicit((Object)(object)self.pingIndicator) && Object.op_Implicit((Object)(object)self.pingIndicator.pingTarget))
			{
				CharacterBody component2 = self.pingIndicator.pingTarget.GetComponent<CharacterBody>();
				if ((Object)(object)component2 != (Object)null)
				{
					pingedTargets[component] = new PingCache
					{
						body = component2,
						master = component2.master
					};
				}
				else
				{
					pingedTargets[component] = default(PingCache);
				}
			}
			else
			{
				pingedTargets[component] = default(PingCache);
			}
		}

		private static void OverrideVanillaSceneList(orig_CCSceneList orig, ConCommandArgs args)
		{
			//IL_0006: 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)
			StringBuilder stringBuilder = new StringBuilder();
			foreach (SceneDef item in ((IEnumerable<SceneDef>)(object)SceneCatalog.allSceneDefs).Where((SceneDef def) => !Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)def.requiredExpansion) || Run.instance.IsExpansionEnabled(def.requiredExpansion)))
			{
				stringBuilder.AppendLine($"[{item.sceneDefIndex}] - {item.cachedName} ");
			}
			Log.Message(stringBuilder, Log.LogLevel.MessageClientOnly);
		}

		private static void EnableCheatsInCCSetScene(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			MethodInfo method = Reflection.GetMethodCached(typeof(SceneCatalog), "GetSceneDefFromSceneName");
			MethodInfo methodCached = Reflection.GetMethodCached(typeof(Hooks), "FilterExpansionLockedScenes");
			val.GotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)method)
			});
			val.Remove();
			val.Emit(OpCodes.Call, (MethodBase)methodCached);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CheatsConVar>(x, "get_boolValue")
			});
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Ldc_I4_1);
		}

		public static SceneDef FilterExpansionLockedScenes(string sceneName)
		{
			SceneDef sceneDefFromSceneName = SceneCatalog.GetSceneDefFromSceneName(sceneName);
			if (!Object.op_Implicit((Object)(object)sceneDefFromSceneName))
			{
				return null;
			}
			if (!Object.op_Implicit((Object)(object)Run.instance) || !Object.op_Implicit((Object)(object)sceneDefFromSceneName.requiredExpansion) || Run.instance.IsExpansionEnabled(sceneDefFromSceneName.requiredExpansion))
			{
				return sceneDefFromSceneName;
			}
			Debug.Log((object)string.Format("An expansion is required for this {0}: {1}", "scene", Util.GetExpansion(sceneDefFromSceneName.requiredExpansion)));
			return null;
		}

		private static void UnlockConsole(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCastclass(x, typeof(ConCommandAttribute))
			});
			val.EmitDelegate<Func<ConCommandAttribute, ConCommandAttribute>>((Func<ConCommandAttribute, ConCommandAttribute>)delegate(ConCommandAttribute conAttr)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				conAttr.flags = (ConVarFlags)(conAttr.flags & 0x17);
				if (conAttr.commandName == "run_set_stages_cleared")
				{
					conAttr.helpText = "Sets the amount of stages cleared. This does not change the current stage.";
				}
				return conAttr;
			});
		}

		private static IEnumerator InitCommandsAndFreeConvars(orig_AwakeCoroutine orig, Console self)
		{
			IEnumerator iterator = orig.Invoke(self);
			while (iterator.MoveNext())
			{
				yield return iterator.Current;
			}
			RemoveCheatFlag(self.FindConVar("sv_time_transmit_interval"));
			RemoveCheatFlag(self.FindConVar("run_scene_override"));
			RemoveCheatFlag(self.FindConVar("stage1_pod"));
			RemoveCheatFlag(self.FindConVar("spite_bomb_coefficient"));
			RemoveCheatFlag(self.FindConVar("bag_disable_breakout"));
			RemoveCheatFlag(self.FindConVar("bounce_velocity"));
			RemoveCheatFlag(self.FindConVar("junk_unlimited"));
			ExpandHelpText(self.FindConVar("timescale"), " Use time_scale instead!");
			ExpandHelpText(self.FindConVar("director_combat_disable"), " Use no_enemies instead!");
			ExpandHelpText(self.FindConVar("timestep"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("cmotor_safe_collision_step_threshold"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("ai_update_interval"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("contact_damage_update_interval"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("log_async_assets"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("preload_scenes"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("hitbox_show"), " Let the DebugToolkit team know if you need this convar.");
			ExpandHelpText(self.FindConVar("cheats"), " But you already have the DebugToolkit mod installed...");
			static void ExpandHelpText(BaseConVar cv, string text)
			{
				if (cv != null)
				{
					cv.helpText += text;
				}
			}
			static void RemoveCheatFlag(BaseConVar cv)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (cv != null)
				{
					cv.flags = (ConVarFlags)(cv.flags & 0x17);
				}
			}
		}

		private static void LogNetworkCommandsAndCheckPermissions(Console self, CmdSender sender, string concommandName, List<string> userArgs)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			StringBuilder sb = new StringBuilder();
			userArgs.ForEach(delegate(string str)
			{
				sb.AppendLine(str);
			});
			if ((Object)(object)sender.networkUser != (Object)null && sender.localUser == null)
			{
				Log.Message($"{sender.networkUser.userName}({sender.networkUser.id.value}) issued: {concommandName} {sb}");
			}
			else if (Application.isBatchMode)
			{
				Log.Message(string.Format("{0}({1}) issued: {2} {3}", "Server", 0, concommandName, sb));
			}
			bool flag = true;
			if ((Object)(object)sender.networkUser != (Object)null && sender.localUser == null && PermissionSystem.IsEnabled.Value)
			{
				flag = PermissionSystem.CanUserExecute(sender.networkUser, concommandName, userArgs);
			}
			if (flag)
			{
				_origRunCmd.Invoke(self, sender, concommandName, userArgs);
				ScrollConsoleDown();
			}
		}

		private static void WarnUserOfServerCommandOffline(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_004e: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Console>(x, "ForwardCmdToServer")
			}))
			{
				Log.Message("Failed to patch RoR2.Console.RunCmd", Log.LogLevel.Error, Log.Target.Bepinex);
				return;
			}
			Instruction next = val.Next;
			val.Emit<NetworkSession>(OpCodes.Call, "get_instance");
			val.Emit(OpCodes.Brtrue_S, next);
			val.Emit(OpCodes.Ldstr, "This command requires a network or game session.");
			val.Emit<Debug>(OpCodes.Call, "Log");
		}

		private static void AddConCommandSignatureHint(orig_Start orig, ConsoleWindow self)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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)
			orig.Invoke(self);
			Transform child = ((Component)self).gameObject.transform.GetChild(0).GetChild(1);
			commandSignatureText = new GameObject("CommandHint", new Type[1] { typeof(RectTransform) });
			commandSignatureText.transform.SetParent(child);
			Transform transform = commandSignatureText.transform;
			Transform obj = ((transform is RectTransform) ? transform : null);
			((RectTransform)obj).anchorMin = new Vector2(0f, 0f);
			((RectTransform)obj).anchorMax = new Vector2(1f, 1f);
			((RectTransform)obj).pivot = new Vector2(0f, 0.5f);
			((RectTransform)obj).offsetMin = new Vector2(14f, 29f);
			((RectTransform)obj).offsetMax = new Vector2(-26f, 19f);
			obj.localScale = ((Component)child).transform.GetChild(0).localScale;
			HGTextMeshProUGUI obj2 = commandSignatureText.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)obj2).fontSize = 14f;
			((TMP_Text)obj2).overflowMode = (TextOverflowModes)1;
			((TMP_Text)obj2).enableWordWrapping = false;
		}

		private static void UpdateCommandSignature(orig_OnInputFieldValueChanged orig, ConsoleWindow self, string text)
		{
			orig.Invoke(self, text);
			HGTextMeshProUGUI val = default(HGTextMeshProUGUI);
			if (Object.op_Implicit((Object)(object)commandSignatureText) && commandSignatureText.TryGetComponent<HGTextMeshProUGUI>(ref val))
			{
				if (text == "")
				{
					AutoCompleteManager.ClearCommandOptions();
				}
				string currentCommand = AutoCompleteManager.CurrentCommand;
				string currentSignature = AutoCompleteManager.CurrentSignature;
				if (currentCommand == null || currentSignature == null)
				{
					((TMP_Text)val).text = "";
				}
				else
				{
					((TMP_Text)val).text = $"<color=#ffa000>{currentCommand} {currentSignature}</color>";
				}
			}
		}

		internal static void ScrollConsoleDown()
		{
			if (Object.op_Implicit((Object)(object)ConsoleWindow.instance) && Object.op_Implicit((Object)(object)ConsoleWindow.instance.outputField.verticalScrollbar))
			{
				ConsoleWindow.instance.outputField.verticalScrollbar.value = 1f;
			}
		}

		private static bool BetterAutoCompletion(orig_SetSearchString orig, AutoComplete self, string newSearchString)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (self.searchString == newSearchString)
			{
				return false;
			}
			self.searchString = newSearchString;
			List<string> list = new Lexer(newSearchString).GetTokens().ToList();
			list.RemoveAt(list.Count - 1);
			if (list.Count == 0)
			{
				return false;
			}
			int num = list.LastIndexOf(";") + 1;
			List<MatchInfo> list2 = new List<MatchInfo>();
			if (list[list.Count - 1] == ";" || newSearchString.EndsWith(list[num]))
			{
				AutoCompleteManager.ClearCommandOptions();
				List<string> list3 = Console.instance.allConVars.Keys.ToList();
				list3.AddRange(Console.instance.concommandCatalog.Keys);
				list3.Sort();
				string text = ((list[list.Count - 1] == ";") ? "" : list[num].ToLowerInvariant());
				foreach (string item in list3)
				{
					int num2 = item.IndexOf(text);
					if (num2 == 0)
					{
						list2.Add(new MatchInfo
						{
							similarity = 1000 + text.Length - item.Length,
							str = item.Substring(0, text.Length) + GrayOutText(item, text.Length)
						});
					}
					else if (num2 > 0)
					{
						list2.Add(new MatchInfo
						{
							similarity = text.Length - item.Length,
							str = GrayOutText(item, 0, num2) + item.Substring(num2, text.Length) + GrayOutText(item, num2 + text.Length)
						});
					}
				}
			}
			else
			{
				int num3 = list.Count - 1;
				if (!newSearchString.EndsWith(list[list.Count - 1]))
				{
					num3++;
					TMP_Dropdown autoCompleteDropdown = ConsoleWindow.instance.autoCompleteDropdown;
					if ((Object)(object)autoCompleteDropdown != (Object)null)
					{
						autoCompleteDropdown.SetValue(0, false);
						autoCompleteDropdown.Hide();
						((Selectable)ConsoleWindow.instance.inputField).Select();
					}
				}
				string text2 = list[num].ToLowerInvariant();
				if (text2 != AutoCompleteManager.CurrentCommand)
				{
					AutoCompleteManager.PrepareCommandOptions(text2);
				}
				List<AutoCompleteParser.AutoCompleteOption>[] currentParameters = AutoCompleteManager.CurrentParameters;
				int num4 = num3 - num - 1;
				if (num4 < currentParameters.Length && currentParameters[num4].Count > 0)
				{
					List<AutoCompleteParser.AutoCompleteOption> list4 = currentParameters[num4];
					string text3 = ((num3 < list.Count) ? list[num3] : "");
					if (text3 == "")
					{
						foreach (AutoCompleteParser.AutoCompleteOption item2 in list4)
						{
							list2.Add(new MatchInfo
							{
								similarity = int.MinValue,
								str = GrayOutText(item2.name, 0),
								index = item2.index
							});
						}
					}
					else
					{
						int num5 = default(int);
						if (TextSerialization.TryParseInvariant(text3, ref num5))
						{
							text3 = num5.ToString();
						}
						foreach (AutoCompleteParser.AutoCompleteOption item3 in list4)
						{
							if (item3.name.IndexOf(text3, StringComparison.InvariantCultureIgnoreCase) < 0)
							{
								continue;
							}
							List<string> list5 = new List<string>();
							int num6 = int.MinValue;
							string[] array = item3.name.Split('|');
							foreach (string text4 in array)
							{
								int num7 = text4.IndexOf(text3, StringComparison.InvariantCultureIgnoreCase);
								if (num7 == 0)
								{
									num6 = Math.Max(1000 + text3.Length - text4.Length, num6);
									list5.Add(text4.Substring(0, text3.Length) + GrayOutText(text4, text3.Length));
								}
								else if (num7 > 0)
								{
									num6 = Math.Max(text3.Length - text4.Length, num6);
									list5.Add(GrayOutText(text4, 0, num7) + text4.Substring(num7, text3.Length) + GrayOutText(text4, num7 + text3.Length));
								}
								else
								{
									list5.Add(GrayOutText(text4, 0));
								}
							}
							list2.Add(new MatchInfo
							{
								similarity = num6,
								str = string.Join("|", list5),
								index = item3.index
							});
						}
					}
				}
			}
			list2 = list2.OrderByDescending((MatchInfo m) => m.similarity).ToList();
			self.resultsList = list2.Select((MatchInfo m) => m.str).ToList();
			autoCompleteIndices = list2.Select((MatchInfo m) => m.index).ToArray();
			return true;
			static string GrayOutText(string text5, int startIndex, int length = -1)
			{
				text5 = ((length < 0) ? text5.Substring(startIndex) : text5.Substring(startIndex, length));
				return "<color=#808080>" + text5 + "</color>";
			}
		}

		private static void ApplyTextWithoutColorTags(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0047: 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)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(OptionData), "get_text")
			}))
			{
				Log.Message("Failed to patch ConsoleWindow", Log.LogLevel.Error, Log.Target.Bepinex);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Ldarg_1);
			val.EmitDelegate<Func<string, ConsoleWindow, int, string>>((Func<string, ConsoleWindow, int, string>)delegate(string text, ConsoleWindow consoleWindow, int optionIndex)
			{
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				string[] array = text.Split('|');
				int num = autoCompleteIndices[optionIndex];
				if (num >= array.Length)
				{
					num = 0;
				}
				text = array[num].Replace("<color=#808080>", "").Replace("</color>", "");
				string text2 = consoleWindow.inputField.text;
				List<string> list = new Lexer(text2).GetTokens().ToList();
				list.RemoveAt(list.Count - 1);
				if (list.Count == 0)
				{
					return text;
				}
				string text3 = list[list.Count - 1];
				return (!text2.EndsWith(text3)) ? (text2 + text) : (text2.Substring(0, text2.Length - text3.Length) + text);
			});
		}

		private static void SmoothDropDownSuggestionNavigation(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			MethodReference operand = il.Import((MethodBase)Reflection.GetMethodCached(typeof(Input), "GetKey", new Type[1] { typeof(KeyCode) }));
			int inputKey = 273;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, inputKey),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Input>(x, "GetKeyDown")
			});
			val.Prev.Operand = operand;
			val.Emit(OpCodes.Ldc_I4, inputKey);
			val.EmitDelegate<Func<bool, int, bool>>((Func<bool, int, bool>)LimitChangeItemFrequency);
			inputKey = 274;
			val.GotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, inputKey),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Input>(x, "GetKeyDown")
			});
			val.Prev.Operand = operand;
			val.Emit(OpCodes.Ldc_I4, inputKey);
			val.EmitDelegate<Func<bool, int, bool>>((Func<bool, int, bool>)LimitChangeItemFrequency);
			ILLabel val2 = default(ILLabel);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
			});
			val.Index += 1;
			val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)ScrollAutocompleteNextWithTab);
			for (int num = 0; num < 3; num++)
			{
				if (num != 1)
				{
					val.GotoNext(new Func<Instruction, bool>[2]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 3),
						(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
					});
					val.Index += 1;
					val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)ScrollAutocompleteNextWithTab);
				}
			}
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
			});
			val.Index += 1;
			val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool previousKeyPressed) => previousKeyPressed || (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)9))));
			static bool LimitChangeItemFrequency(bool canChangeItem, int key)
			{
				if (canChangeItem && Time.timeScale > 0f)
				{
					float time = Time.time;
					if (time > 0.1f * Time.timeScale + _lastSelectedItemChange)
					{
						_lastSelectedItemChange = time;
						return true;
					}
					return false;
				}
				if (Time.timeScale <= 0f)
				{
					return Input.GetKeyDown((KeyCode)key);
				}
				return canChangeItem;
			}
			static bool ScrollAutocompleteNextWithTab(bool isNextKeyPressed)
			{
				if (!isNextKeyPressed)
				{
					if (!Input.GetKey((KeyCode)306))
					{
						return Input.GetKeyDown((KeyCode)9);
					}
					return false;
				}
				return true;
			}
		}

		private static void AllowTabAutocompleteConCommands(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00d7: 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)
			ILCursor val = new ILCursor(il);
			ILLabel jumpLabel = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "info"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Player>(x, "GetButtonDown")
			}) || !val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<HUD>(x, "get_targetBodyObject"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref jumpLabel)
			}))
			{
				Log.Message("Failed to patch RoR2.UI.HUD.Update", Log.LogLevel.Error, Log.Target.Bepinex);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<HUD, bool>>((Func<HUD, bool>)delegate(HUD self)
			{
				MPEventSystemProvider eventSystemProvider = self.eventSystemProvider;
				object obj;
				if (eventSystemProvider == null)
				{
					obj = null;
				}
				else
				{
					MPEventSystem eventSystem = eventSystemProvider.eventSystem;
					obj = ((eventSystem != null) ? ((EventSystem)eventSystem).currentSelectedGameObject : null);
				}
				GameObject val2 = (GameObject)obj;
				if (Object.op_Implicit((Object)(object)val2))
				{
					ConsoleWindow instance = ConsoleWindow.instance;
					object obj2;
					if (instance == null)
					{
						obj2 = null;
					}
					else
					{
						TMP_InputField inputField = instance.inputField;
						obj2 = ((inputField != null) ? ((Component)inputField).gameObject : null);
					}
					return !((Object)(object)val2 == (Object)obj2);
				}
				return true;
			});
			val.Emit(OpCodes.Brfalse_S, jumpLabel.Target);
		}

		private static WeightedSelection<Category> ForceFamilyEventForDccsPoolStages(orig_GenerateWeightedCategorySelection orig, DccsPool self)
		{
			WeightedSelection<Category> result = orig.Invoke(self);
			if (CurrentRun.forceFamilyEvent)
			{
				WeightedSelection<Category> val = new WeightedSelection<Category>(8);
				Category[] poolCategories = self.poolCategories;
				foreach (Category val2 in poolCategories)
				{
					if (ClassicStageInfo.instance.IsCategorySelectionAFamily(val2))
					{
						val.AddChoice(val2, val2.categoryWeight);
					}
				}
				if (val.Count > 0)
				{
					return val;
				}
			}
			return result;
		}

		private static bool ForceFamilyDirectorCardCategorySelectionToBeAvailable(orig_IsAvailable orig, FamilyDirectorCardCategorySelection self)
		{
			if (!orig.Invoke(self))
			{
				return CurrentRun.forceFamilyEvent;
			}
			return true;
		}

		internal static void ForceFamilyEvent(orig_RebuildCards orig, ClassicStageInfo self, DirectorCardCategorySelection forcedMonsterCategory, DirectorCardCategorySelection forcedInteractableCategory)
		{
			orig.Invoke(self, forcedMonsterCategory, forcedInteractableCategory);
			CurrentRun.forceFamilyEvent = false;
		}

		internal static void SetNextBossForDirector(orig_SetNextSpawnAsBoss orig, CombatDirector self)
		{
			orig.Invoke(self);
			if (CurrentRun.nextBoss != null && !((Object)((Component)self).gameObject).name.Contains("DeepVoidPortalBattery"))
			{
				bossDirector = self;
				DirectorCard nextBoss = CurrentRun.nextBoss;
				self.OverrideCurrentMonsterCard(nextBoss);
				EliteDef val = (self.currentActiveEliteDef = CurrentRun.nextBossElite);
				self.currentActiveEliteTier = Spawners.GetTierDef(val);
				string text = (((Object)(object)val == (Object)null) ? "non-elite" : ((Object)val).name);
				int nextBossCount = CurrentRun.nextBossCount;
				self.monsterCredit = (float)(nextBoss.cost * nextBossCount) * self.currentActiveEliteTier.costMultiplier;
				skipSpawnIfTooCheapBackup = self.skipSpawnIfTooCheap;
				self.skipSpawnIfTooCheap = false;
				Log.Message($"The director credits have been set to {self.monsterCredit} to spawn {nextBossCount} {text} {((Object)nextBoss.spawnCard).name}", Log.LogLevel.Info, Log.Target.Ror2);
			}
		}

		private static bool OverrideBossCombatDirectorSpawnResult(orig_AttemptSpawnOnTarget orig, CombatDirector self, Transform spawnTarget, PlacementMode placementMode)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			bool flag = orig.Invoke(self, spawnTarget, placementMode);
			if ((Object)(object)self != (Object)(object)bossDirector)
			{
				return flag;
			}
			if (bossDirector.spawnCountInCurrentWave >= CurrentRun.nextBossCount || !flag)
			{
				self.skipSpawnIfTooCheap = skipSpawnIfTooCheapBackup;
				bossDirector = null;
				CurrentRun.ResetNextBoss();
				return false;
			}
			return flag;
		}

		internal static void SetNextBossForSimulacrumDirector(orig_Initialize orig, InfiniteTowerExplicitSpawnWaveController self, int waveIndex, Inventory enemyInventory, GameObject spawnTargetObject)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			if (CurrentRun.nextBoss != null)
			{
				self.spawnList = (SpawnInfo[])(object)new SpawnInfo[1]
				{
					new SpawnInfo
					{
						spawnCard = (CharacterSpawnCard)CurrentRun.nextBoss.spawnCard,
						eliteDef = CurrentRun.nextBossElite,
						count = CurrentRun.nextBossCount
					}
				};
			}
			orig.Invoke(self, waveIndex, enemyInventory, spawnTargetObject);
			CurrentRun.ResetNextBoss();
		}

		internal static void SeedHook(orig_Awake orig, PreGameController self)
		{
			orig.Invoke(self);
			if (CurrentRun.seed != 0L)
			{
				self.runSeed = CurrentRun.seed;
			}
		}

		internal static void DenyMapSpawns(orig_SpendAllCreditsOnMapSpawns_Transform_WeightedSelection1 orig, CombatDirector self, Transform mapSpawnTarget, WeightedSelection<DirectorCard> list)
		{
			if (CurrentRun.noEnemies)
			{
				self.monsterCredit = 0f;
			}
			orig.Invoke(self, mapSpawnTarget, list);
		}

		internal static void DenyInteractableSpawns(SceneDirector sceneDirector)
		{
			if (CurrentRun.noInteractables)
			{
				sceneDirector.onPopulateCreditMultiplier = 0f;
			}
		}

		internal static void DenyExperience(orig_AwardExperience orig, ExperienceManager self, Vector3 origin, CharacterBody body, ulong amount)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if (!CurrentRun.lockExp)
			{
				orig.Invoke(self, origin, body, amount);
			}
		}

		internal static PingCache GetPingedTarget(CharacterMaster player)
		{
			if (pingedTargets.TryGetValue(player, out var value))
			{
				return value;
			}
			return default(PingCache);
		}
	}
	public static class Lang
	{
		public const string DROPTABLE_DEFAULT = "Tier1:100,Tier2:60,Tier3:4";

		public const string ADDPORTAL_ARGS = "Requires 1 argument: {portal ('blue'|'celestial'|'gold'|'green'|'void'|'all')}";

		public const string BAN_ARGS = "Requires 1 argument: {player}";

		public const string BIND_ARGS = "Requires 2 arguments: {key} [console_commands]";

		public const string BIND_DELETE_ARGS = "Requires 1 argument: {key}";

		public const string CHANGETEAM_ARGS = "Requires 1 (2 if from server) argument: {team} [player:<self>]";

		public const string CHARGEZONE_ARGS = "Requires 0 argument: [charge]";

		public const string CREATEPICKUP_ARGS = "Requires 1 (3 if from server) argument: {object (item|equip|'lunarcoin'|'voidcoin')} [item_type:Permanent] [search ('item'|'equip'|'both'):'both'] [player:<self>]";

		public const string CREATEPOTENTIAL_ARGS = "Requires 0 (3 if from server) arguments: [droptable (droptable|'all'):'Tier1:100,Tier2:60,Tier3:4'] [count:3] [player:<self>]";

		public const string DUMPSTATE_ARGS = "Requires 0 (1 if from server) argument: [target (player|'pinged'):<self>]";

		public const string DUMPSTATS_ARGS = "Requires 1 argument: {body}";

		public const string ENABLE_ARGS = "Requires 0 or 1 arguments: [enable (0|1)]";

		public const string FIXEDTIME_ARGS = "Requires 0 or 1 argument: [time]";

		public const string FORCEWAVE_ARGS = "Requires 0 or 1 argument [wave_prefab]";

		public const string GIVEBUFF_ARGS = "Requires 1 (4 if from server) arguments: {buff} [count:1] [duration:0] [target (player|'pinged'):<self>]";

		public const string GIVEDOT_ARGS = "Requires 1 (4 if from server) argument: {dot} [count:1] [target (player|'pinged'):<self>] [attacker (player|'pinged'):<self>]";

		public const string GIVEEQUIP_ARGS = "Requires 1 (2 if from server) argument: {equip (equip|'random')} [target (player|'pinged'|'evolution'|'simulacrum'|'voidfields'|'devotion'):<self>]";

		public const string GIVEEQUIPEXTRA_ARGS = "Requires 3 (4 if from server) argument: {equip (equip|'random')} {slot} {set} [target (player|'pinged'|'evolution'|'simulacrum'|'voidfields'|'devotion'):<self>]";

		public const string GIVEITEM_ARGS = "Requires 1 (4 if from server) argument: {item} [count:1] [item_type:Permanent] [target (player|'pinged'|'evolution'|'simulacrum'|'voidfields'|'devotion'):<self>]";

		public const string GIVELUNAR_ARGS = "Requires 0 arguments: [amount:1]";

		public const string GIVEMONEY_ARGS = "Requires 1 argument: {amount} [target (player|'all')]";

		public const string HEAL_ARGS = "Requires 1 (2 if from server) argument: {amount} [target (player|'pinged'):<self>]";

		public const string HURT_ARGS = "Requires 1 (2 if from server) argument: {amount} [target (player|'pinged'):<self>]";

		publ