Decompiled source of SpeelosToolbox v1.1.5

SpeelosToolbox.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SkToolbox.Configuration;
using SkToolbox.SkModules;
using SkToolbox.Utility;
using Splatform;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Speelo, Skrip, derekShaheen")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Speelo's Toolbox: clickable cheat menu and console/chat command extender for Valheim 1.0 (fork of Skrip's SkToolbox)")]
[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: AssemblyInformationalVersion("1.1.5+b9fb05a01c652978d0e5376b0a4d5d83ae77ed34")]
[assembly: AssemblyProduct("SpeelosToolbox")]
[assembly: AssemblyTitle("SpeelosToolbox")]
[assembly: AssemblyVersion("1.1.5.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SkToolbox
{
	[BepInPlugin("com.speelo.speelostoolbox", "SpeelosToolbox", "1.1.5")]
	public class SkBepInExLoader : BaseUnityPlugin
	{
		public const string MODNAME = "SpeelosToolbox";

		public const string DISPLAYNAME = "Speelo's Toolbox";

		public const string AUTHOR = "Speelo";

		public const string ORIGINAL_AUTHOR = "Skrip";

		public const string GUID = "com.speelo.speelostoolbox";

		public const string VERSION = "1.1.5";

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			if (Application.isBatchMode || (int)SystemInfo.graphicsDeviceType == 4)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Headless server detected - SpeelosToolbox is client-only, not loading.");
				return;
			}
			InitConfig();
			SkCommandPatcher.ApplyAchievementBypass();
			((Component)this).transform.parent = null;
			Object.DontDestroyOnLoad((Object)(object)this);
			SkLoader.InitBepThreading(this);
		}

		public void InitConfig()
		{
			try
			{
				SkConfigEntry.CDescriptor = ((BaseUnityPlugin)this).Config.Bind<bool>("- Index", "ThisIsJustAnIndex-NotASetting", true, "Config sections:\n0 - General\n1 - Auto Run\n2 - Customize Console Look\n3 - Command Aliasing\n4 - On-Screen Menu\n5 - Command Hotkeys [Currently Disabled due to Hearth and Home patch. Fix coming soon]\n");
				SkConfigEntry.CConsoleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "ConsoleEnabled", true, "Enables the console without launch option.");
				SkConfigEntry.CScrollable = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "ConsoleScrollable", true, "Enables the console to be scrollable.");
				SkConfigEntry.CScrollableLimit = ((BaseUnityPlugin)this).Config.Bind<int>("0 - General", "ConsoleScrollableLimit", 500, "Maximum number of lines to store in the console. Game default = 30 (lol)");
				SkConfigEntry.CConsoleAutoComplete = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "AutoComplete", true, "Press tab to auto-complete Speelo's Toolbox commands if you have partially typed a command.");
				SkConfigEntry.CAllowChatCommandInput = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "AllowChatCommandInput", true, "Toggle this if you want to allow or disable the entry of commands in the chat. If this is disabled, you can only input commands into the console.");
				SkConfigEntry.CAllowPublicChatOutput = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "AllowPublicResponse", true, "Toggle this to allow the mod to respond publicly with certain commands, when entered into chat.\nThe /portal command for example, if used in chat and this is true, others nearby will be able to see the response.\nNOTE: If you see a response from your name, it is shown publicly and everyone can see it. If it is a response from (Speelo's Toolbox), only you see it.");
				SkConfigEntry.CAllowChatOutput = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "AllowResponseInChat", true, "Toggle this to allow the mod to show output in the chat. If this is disabled, the mod will not output to the chat at all, publicly or not.");
				SkConfigEntry.CAllowExecuteOnClear = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "AllowExecuteOnClear", false, "Toggle this to enable the ability to execute commands by clearing the input (by hitting escape, or selecting all and removing).");
				SkConfigEntry.CKeepAchievements = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "KeepAchievements", true, "Keep Steam achievements working while cheats are used.\nValheim disables achievement progress as soon as anything counts as cheated, and simply loading BepInEx already counts (it sets Game.isModded).\nThis flips the game's own PlayerProfile.s_bypassCheatChecks switch, which every cheat check reads, so progress keeps counting.\nIt also stops cheat commands from permanently flagging the character, and clears that flag if it was already set.\nSet to false to let Valheim disable achievements normally.");
				SkConfigEntry.CPersistCheatsOnDeath = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "PersistCheatsOnDeath", true, "Put your cheats back on after you die.\nDying destroys your character object and the game builds a new one from the prefab, so every cheat that is stored on the character is silently lost: god mode, flying, no cost building, infinite stamina and far interact all switch themselves off on the respawn.\nWith this on, whatever you had switched on is switched back on once you respawn.\nSet to false to let each death clear them, which is what Valheim does on its own.");
				SkConfigEntry.CGodModeBlocksDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "GodModeBlocksDamage", true, "Make god mode block damage outright.\nValheim's own god mode does not stop damage: it subtracts health as normal and only rescues you at the moment the hit would kill you, clamping health to 1. So your health bar still drains.\nWith this on, any damage aimed at you while god mode is active is discarded before it lands, including fire, poison and smoke.\nSet to false for Valheim's unmodified behaviour.");
				SkConfigEntry.COpenConsoleWithSlash = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "OpenConsoleWithSlash", false, "Toggle this to enable the ability to open the console with the slash (/) button.\nThis option takes precedence over OpenChatWithSlash if both are true.");
				SkConfigEntry.COpenChatWithSlash = ((BaseUnityPlugin)this).Config.Bind<bool>("0 - General", "OpenChatWithSlash", false, "Toggle this to enable the ability to open chat with the slash (/) button.");
				SkConfigEntry.CAutoRun = ((BaseUnityPlugin)this).Config.Bind<bool>("1 - AutoRun", "AutoRunEnabled", false, "Toggle this to run commands automatically upon spawn into server.\nNote this will only occur once per game launch to prevent unintended command executions.");
				SkConfigEntry.CAutoRunCommand = ((BaseUnityPlugin)this).Config.Bind<string>("1 - AutoRun", "AutoRunCommand", "/nosup; /god", "Enter the commands to run upon spawn here. Seperate commands with a semicolon (;).");
				SkConfigEntry.OMenuToggleKey = ((BaseUnityPlugin)this).Config.Bind<string>("4 - OnScreenMenu", "MenuToggleKey", "F6", "Key that opens and closes the clickable menu. Valid key names: https://docs.unity3d.com/ScriptReference/KeyCode.html\nAlready taken: F11 and F12 take screenshots (Valheim and Steam), F5 opens the game console, F4 opens this mod's log console, F2 opens the connect panel, F9 cycles the controller layout, Ctrl+F1 toggles mouse capture, Ctrl+F3 hides the HUD.\nFree function keys: F6, F7, F8, F10.");
				SkConfigEntry.OMenuWalk = ((BaseUnityPlugin)this).Config.Bind<bool>("4 - OnScreenMenu", "WalkWithMenuOpen", true, "Let you walk around with the menu open, instead of freezing you in place.\nWASD moves as normal. Attacking, blocking, jumping and dodging stay switched off, which is the same state the game puts you in for a moment after closing its own menus.\nTyping in a search box moves nothing. Hold the look key below to turn the camera.\nThis is keyboard and mouse only: with a gamepad active the menu freezes you as before.");
				SkConfigEntry.OMenuLookKey = ((BaseUnityPlugin)this).Config.Bind<string>("4 - OnScreenMenu", "MenuLookKey", "Mouse1", "Hold this to turn the camera while the menu is open. Release it to get the cursor back.\nMouse1 is the right mouse button. It is safe to use even though it is normally block, because blocking is switched off while the menu is open.\nLeftAlt is a good alternative if you would rather leave the right button alone.\nValid key names: https://docs.unity3d.com/ScriptReference/KeyCode.html");
				SkConfigEntry.OBookmarks = ((BaseUnityPlugin)this).Config.Bind<string>("4 - OnScreenMenu", "Bookmarks", "", "Saved teleport spots, managed from the menu - there is no need to edit this by hand.\nEach entry is seed|name|x|y|z, and only the ones matching the world you are in are shown.");
				SkConfigEntry.OLoadouts = ((BaseUnityPlugin)this).Config.Bind<string>("4 - OnScreenMenu", "Loadouts", "", "Saved equipment sets, managed from the menu - there is no need to edit this by hand.\nEach entry is name|prefab:quality,prefab:quality.");
				SkConfigEntry.OMenuOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("4 - OnScreenMenu", "MenuOpacity", 0.96f, "How solid the menu background is. 1 = fully opaque, 0.5 = half see-through. Takes effect immediately.");
				SkConfigEntry.CAllowLookCustomizations = ((BaseUnityPlugin)this).Config.Bind<bool>("2 - CustomizeConsoleLook", "ConsoleAllowLookCustomizations", true, "Toggle this to enable or disable the customization settings below.");
				SkConfigEntry.CConsoleFont = ((BaseUnityPlugin)this).Config.Bind<string>("2 - CustomizeConsoleLook", "ConsoleFont", "Consola.ttl", "Set the font size of the text in the console. Game default = AveriaSansLibre-Bold");
				SkConfigEntry.CConsoleFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("2 - CustomizeConsoleLook", "ConsoleFontSize", 18, "Set the font size of the text in the console. Game default = 18");
				SkConfigEntry.CConsoleOutputTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("2 - CustomizeConsoleLook", "ConsoleOutputTextColor", "#E6F7FFFF", "Set the color of the output text shown in the console. Game default = #FFFFFFFF. Color format is #RRGGBBAA");
				SkConfigEntry.CConsoleInputTextColor = ((BaseUnityPlugin)this).Config.Bind<string>("2 - CustomizeConsoleLook", "ConsoleInputTextColor", "#E6F7FFFF", "Set the color of the input text shown in the console. Game default = #FFFFFFFF. Color format is #RRGGBBAA");
				SkConfigEntry.CConsoleSelectionColor = ((BaseUnityPlugin)this).Config.Bind<string>("2 - CustomizeConsoleLook", "ConsoleSelectionColor", "#A8CEFFC0", "Set the color of the selection highlight in the console. Game default = #A8CEFFC0. Color format is #RRGGBBAA");
				SkConfigEntry.CConsoleCaretColor = ((BaseUnityPlugin)this).Config.Bind<string>("2 - CustomizeConsoleLook", "ConsoleCaretColor", "#DCE6F5FF", "Set the color of the input text caret shown in the console. Game default = #FFFFFFFF. Color format is #RRGGBBAA");
				SkConfigEntry.CAlias1 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias1", "/creative: /god; /ghost; /imacheater; /nores; /nocost; /echo Creative mode toggled!", "Set this to create a command alias. Specify what the user will type, and what will be executed. Command chaining does work here, and these aliases can be used with the AutoRun functionality above. Note that aliases cannot reference other aliases. The slash (/) prefix is also not required - command aliases can be set to anything you want! Aliases do work from chat as well, if the execute from chat setting is enabled above. Alias commands also appear in the /? help menus.\nFormat: WhatToType: WhatToExecute\nExample: This will create a new command, '/Cmd1', and when entered it will execute /god and /fly\n/Cmd1: /god; /fly\n##################\nSet this to create command alias 1.");
				SkConfigEntry.CAlias2 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias2", "", "Set this to create command alias 2.");
				SkConfigEntry.CAlias3 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias3", "", "Set this to create command alias 3.");
				SkConfigEntry.CAlias4 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias4", "", "Set this to create command alias 4.");
				SkConfigEntry.CAlias5 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias5", "", "Set this to create command alias 5.");
				SkConfigEntry.CAlias6 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias6", "", "Set this to create command alias 6.");
				SkConfigEntry.CAlias7 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias7", "", "Set this to create command alias 7.");
				SkConfigEntry.CAlias8 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias8", "", "Set this to create command alias 8.");
				SkConfigEntry.CAlias9 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias9", "", "Set this to create command alias 9.");
				SkConfigEntry.CAlias10 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias10", "", "Set this to create command alias 10.");
				SkConfigEntry.CAlias11 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias11", "", "Set this to create command alias 11.");
				SkConfigEntry.CAlias12 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias12", "", "Set this to create command alias 12.");
				SkConfigEntry.CAlias13 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias13", "", "Set this to create command alias 13.");
				SkConfigEntry.CAlias14 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias14", "", "Set this to create command alias 14.");
				SkConfigEntry.CAlias15 = ((BaseUnityPlugin)this).Config.Bind<string>("3 - CommandAliasing", "Alias15", "", "Set this to create command alias 15.");
				SkConfigEntry.CHotkey1 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 1", "", "Set this to create a hotkey for a command or command chain.\nValid Format is WhatToPress: WhatToExecute\nExample 1 Press z to input /fly; /god        | z: /fly; /god\nExample 2 Press Shift+Z to input /creative   | Z: /creative\nExample 3 Press Tilde to open the console    | `: /console\nOnly 'Printable ASCII characters' are valid! (https://theasciicode.com.ar/). Capital letters make the hotkey require Shift before the hotkey press. Only one command or command chain can be assigned to each key (if hotkey 1 assigns to q, hotkey 2 cannot also assign to q).");
				SkConfigEntry.CHotkey2 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 2", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey3 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 3", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey4 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 4", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey5 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 5", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey6 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 6", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey7 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 7", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey8 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 8", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey9 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 9", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey10 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 10", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey11 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 11", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey12 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 12", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey13 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 13", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey14 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 14", "", "Set this to create a hotkey for a command or command chain.");
				SkConfigEntry.CHotkey15 = ((BaseUnityPlugin)this).Config.Bind<string>("5 - CommandHotkeys", "Hotkey 15", "", "Set this to create a hotkey for a command or command chain.");
			}
			catch (Exception ex)
			{
				SkUtilities.Logz(new string[1] { "ERR" }, new string[3] { "Could not load config. Please confirm there is a working version of BepInEx installed.", ex.Message, ex.Source }, (LogType)0);
			}
		}
	}
	internal static class SkCommandPatcher
	{
		[HarmonyPatch(typeof(Console), "IsConsoleEnabled")]
		public static class PatchIsConsoleEnabled
		{
			[HarmonyPriority(0)]
			private static void Postfix(ref bool __result)
			{
				if (SkConfigEntry.CConsoleEnabled != null && SkConfigEntry.CConsoleEnabled.Value)
				{
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(Terminal), "IsCheatsEnabled")]
		private static class PatchIsCheatsEnabled
		{
			private static void Postfix(ref bool __result)
			{
				if (BCheat)
				{
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(ConsoleCommand), "IsValid")]
		private static class PatchConsoleCommandIsValid
		{
			private static readonly MethodInfo s_isAllowedCommand = AccessTools.Method(typeof(Terminal), "isAllowedCommand", (Type[])null, (Type[])null);

			private static void Postfix(ConsoleCommand __instance, Terminal context, bool skipAllowedCheck, ref bool __result)
			{
				if (!__result && BCheat && !((Object)(object)context == (Object)null) && __instance.OnlyServer && !__instance.OnlyAdmin && (!__instance.RemoteCommand || string.Equals(__instance.Command, "confirmcheats", StringComparison.OrdinalIgnoreCase)) && (!__instance.IsNetwork || !((Object)(object)ZNet.instance == (Object)null)) && (skipAllowedCheck || !(s_isAllowedCommand != null) || (bool)s_isAllowedCommand.Invoke(context, new object[1] { __instance })))
				{
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(Chat), "InputText")]
		private static class PatchChatInputText
		{
			private static readonly FieldInfo commandsField = AccessTools.Field(typeof(Terminal), "commands");

			private static bool Prefix(Chat __instance)
			{
				if (SkConfigEntry.CAllowChatCommandInput != null && !SkConfigEntry.CAllowChatCommandInput.Value)
				{
					return true;
				}
				string text = ((TMP_InputField)((Terminal)__instance).m_input).text;
				if (!string.IsNullOrEmpty(text) && text.Length > 1 && text[0] == '/' && commandsField?.GetValue(null) is Dictionary<string, ConsoleCommand> dictionary && dictionary.ContainsKey(text.Split(new char[1] { ' ' })[0].ToLower()))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(WearNTear), "UpdateSupport")]
		private static class PatchUpdateSupport
		{
			private static bool Prefix(ref float ___m_support, ref ZNetView ___m_nview)
			{
				if (BFreeSupport)
				{
					if (___m_support != float.MaxValue)
					{
						___m_support = float.MaxValue;
						___m_nview.GetZDO().Set(ZDOVars.s_support, ___m_support);
					}
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Player), "UpdatePlacementGhost")]
		private static class PatchUpdatePlacementGhost
		{
			private static void Postfix(bool flashGuardStone)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Invalid comparison between Unknown and I4
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Invalid comparison between Unknown and I4
				if (!bBuildAnywhere)
				{
					return;
				}
				try
				{
					if (!((Object)(object)Player.m_localPlayer != (Object)null))
					{
						return;
					}
					PlacementStatus privateField = Player.m_localPlayer.GetPrivateField<PlacementStatus>("m_placementStatus");
					if ((int)privateField == 0 || (int)privateField == 4 || (int)privateField == 12)
					{
						return;
					}
					GameObject privateField2 = Player.m_localPlayer.GetPrivateField<GameObject>("m_placementGhost");
					if ((Object)(object)privateField2 != (Object)null && privateField2.activeSelf)
					{
						Player.m_localPlayer.SetPrivateField("m_placementStatus", (object)(PlacementStatus)0);
						Piece component = privateField2.GetComponent<Piece>();
						if (component != null)
						{
							component.SetInvalidPlacementHeightlight(false);
						}
					}
				}
				catch (Exception)
				{
				}
			}
		}

		[HarmonyPatch(typeof(Location), "IsInsideNoBuildLocation")]
		private static class PatchIsInsideNoBuildLocation
		{
			private static void Postfix(ref bool __result)
			{
				if (bBuildAnywhere)
				{
					__result = false;
				}
			}
		}

		[HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")]
		private static class PatchMenuMouseCapture
		{
			private static Vector2 savedPointer;

			private static bool cursorWasHeld;

			private static void Prefix(ref bool ___m_mouseCapture, out bool __state)
			{
				__state = ___m_mouseCapture;
				if (SkMenuController.IsOpen)
				{
					___m_mouseCapture = LookHeld;
				}
			}

			private static void Postfix(ref bool ___m_mouseCapture, bool __state)
			{
				//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)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				if (!SkMenuController.IsOpen)
				{
					return;
				}
				if (LookHeld)
				{
					if (!cursorWasHeld)
					{
						cursorWasHeld = true;
						savedPointer = Vector2.op_Implicit(ZInput.pointerPosition);
					}
					___m_mouseCapture = __state;
					return;
				}
				___m_mouseCapture = (___m_mouseCapture ? (!__state) : __state);
				ZCursor.LockState = (CursorLockMode)0;
				ZCursor.Show();
				if (cursorWasHeld)
				{
					cursorWasHeld = false;
					ZInput.SetMousePosition(savedPointer);
				}
			}
		}

		[HarmonyPatch(typeof(Player), "TakeInput")]
		private static class PatchMenuTakeInput
		{
			private static void Postfix(ref bool __result)
			{
				if (SkMenuController.IsOpen && !InDebugFlyMotion)
				{
					__result = false;
				}
			}
		}

		[HarmonyPatch(typeof(PlayerController), "TakeInput", new Type[] { typeof(bool) })]
		private static class PatchMenuPlayerControllerInput
		{
			private static void Postfix(bool look, ref bool __result)
			{
				if (SkMenuController.IsOpen && __result)
				{
					__result = (look ? LookHeld : WalkAllowed);
				}
			}
		}

		[HarmonyPatch(typeof(ZInput), "GetMouseScrollWheel")]
		private static class PatchMenuScrollWheel
		{
			private static void Postfix(ref float __result)
			{
				if (SkMenuController.IsOpen)
				{
					__result = 0f;
				}
			}
		}

		[HarmonyPatch(typeof(ZInput), "GetKeyDown", new Type[]
		{
			typeof(KeyCode),
			typeof(bool)
		})]
		private static class PatchMenuKeyDown
		{
			private static void Postfix(ref bool __result)
			{
				if (__result && SkMenuController.IsOpen && !BypassInputBlock)
				{
					__result = false;
				}
			}
		}

		[HarmonyPatch(typeof(ZInput), "GetButtonDown", new Type[] { typeof(string) })]
		private static class PatchMenuButtonDown
		{
			private static void Postfix(ref bool __result)
			{
				if (__result && SkMenuController.IsOpen && !BypassInputBlock)
				{
					__result = false;
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		private static class PatchBypassCheatChecks
		{
			private static void Postfix(ref bool __result)
			{
				if (KeepAchievementsEnabled)
				{
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "UseStamina")]
		private static class PatchInfiniteStamina
		{
			private static void Prefix(Player __instance, ref float v)
			{
				if (SkCommandProcessor.infStamina && !((Object)(object)__instance == (Object)null) && __instance == Player.m_localPlayer)
				{
					v = 0f;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "UseEitr")]
		private static class PatchInfiniteEitr
		{
			private static void Prefix(Player __instance, ref float v)
			{
				if (SkCommandProcessor.infEitr && !((Object)(object)__instance == (Object)null) && __instance == Player.m_localPlayer)
				{
					v = 0f;
				}
			}
		}

		[HarmonyPatch(typeof(Player), "SetControls")]
		private static class PatchMenuJumpCrouch
		{
			private static bool lastJump;

			private static bool lastCrouch;

			private static void Prefix(Player __instance, ref bool jump, ref bool crouch)
			{
				if ((Object)(object)__instance == (Object)null || __instance != Player.m_localPlayer)
				{
					return;
				}
				bool button = ZInput.GetButton("Jump");
				bool flag = ZInput.GetButton("Crouch") || ZInput.GetButton("JoyCrouch");
				bool flag2 = button && !lastJump;
				bool flag3 = flag && !lastCrouch;
				lastJump = button;
				lastCrouch = flag;
				if (SkMenuController.IsOpen && WalkAllowed && !((Character)__instance).IsDebugFlying())
				{
					if (flag2)
					{
						jump = true;
					}
					if (flag3)
					{
						crouch = true;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Character), "UpdateDebugFly")]
		private static class PatchMenuFlyUpDown
		{
			private static void Prefix(Character __instance)
			{
				InDebugFlyMotion = SkMenuController.IsOpen && WalkAllowed && (Object)(object)Player.m_localPlayer != (Object)null && (object)__instance == Player.m_localPlayer;
			}

			private static void Finalizer()
			{
				InDebugFlyMotion = false;
			}
		}

		[HarmonyPatch(typeof(Player), "OnSpawned")]
		private static class PatchReapplyToggles
		{
			private static void Postfix(Player __instance)
			{
				if ((Object)(object)__instance == (Object)null || __instance != Player.m_localPlayer)
				{
					return;
				}
				try
				{
					SkCommandProcessor.ReapplyOnSpawn(__instance);
				}
				catch (Exception ex)
				{
					SkUtilities.Logz(new string[2] { "RESPAWN", "ERROR" }, new string[1] { ex.Message }, (LogType)2);
				}
			}
		}

		[HarmonyPatch(typeof(Player), "OnDeath")]
		private static class PatchSnapshotOnDeath
		{
			private static void Prefix(Player __instance)
			{
				if ((Object)(object)__instance == (Object)null || __instance != Player.m_localPlayer)
				{
					return;
				}
				try
				{
					SkCommandProcessor.SnapshotOnDeath(__instance);
				}
				catch (Exception ex)
				{
					SkUtilities.Logz(new string[2] { "RESPAWN", "ERROR" }, new string[1] { ex.Message }, (LogType)2);
				}
			}
		}

		[HarmonyPatch(typeof(Character), "ApplyDamage")]
		private static class PatchGodModeBlocksDamage
		{
			private static bool Prefix(Character __instance, HitData hit)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected I4, but got Unknown
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null || (object)__instance != localPlayer)
				{
					return true;
				}
				if (hit != null && SkCommandProcessor.immuneTo.Contains((int)hit.m_hitType))
				{
					return false;
				}
				if (SkConfigEntry.CGodModeBlocksDamage != null && !SkConfigEntry.CGodModeBlocksDamage.Value)
				{
					return true;
				}
				if (((Character)localPlayer).InGodMode())
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Achievements), "CanGetAchievements", new Type[] { typeof(bool) })]
		private static class PatchCanGetAchievements
		{
			private static void Postfix(ref bool __result)
			{
				if (KeepAchievementsEnabled)
				{
					ApplyAchievementBypass();
					__result = true;
				}
			}
		}

		[HarmonyPatch(typeof(ConsoleCommand), "RunAction")]
		private static class PatchRunActionKeepAchievements
		{
			private static void Prefix(out bool __state)
			{
				__state = false;
				try
				{
					if ((Object)(object)Game.instance != (Object)null)
					{
						__state = Game.instance.GetPlayerProfile()?.m_usedCheats ?? false;
					}
				}
				catch (Exception)
				{
				}
			}

			private static void Postfix(bool __state)
			{
				if (!KeepAchievementsEnabled || __state)
				{
					return;
				}
				try
				{
					if ((Object)(object)Game.instance != (Object)null)
					{
						PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
						if (playerProfile != null)
						{
							playerProfile.m_usedCheats = false;
						}
					}
				}
				catch (Exception)
				{
				}
				ApplyAchievementBypass();
			}
		}

		private static Harmony harmony;

		private static bool initComplete;

		internal static bool BypassInputBlock;

		internal static bool LookHeld;

		internal static bool WalkAllowed;

		internal static bool InDebugFlyMotion;

		private static bool bCheat;

		private static bool bFreeSupport;

		public static bool bBuildAnywhere;

		private static bool clearedUsedCheats;

		public static Harmony Harmony
		{
			get
			{
				return harmony;
			}
			set
			{
				harmony = value;
			}
		}

		public static bool BCheat
		{
			get
			{
				return bCheat;
			}
			set
			{
				bCheat = value;
			}
		}

		public static bool BFreeSupport
		{
			get
			{
				return bFreeSupport;
			}
			set
			{
				bFreeSupport = value;
			}
		}

		public static bool InitComplete
		{
			get
			{
				return initComplete;
			}
			set
			{
				initComplete = value;
			}
		}

		internal static bool KeepAchievementsEnabled
		{
			get
			{
				if (SkConfigEntry.CKeepAchievements != null)
				{
					return SkConfigEntry.CKeepAchievements.Value;
				}
				return true;
			}
		}

		public static void InitPatch()
		{
			if (InitComplete)
			{
				return;
			}
			try
			{
				harmony = Harmony.CreateAndPatchAll(typeof(SkCommandPatcher).Assembly, (string)null);
			}
			catch (Exception ex)
			{
				SkCommandProcessor.PrintOut("Something failed, there is a strong possibility another mod blocked this operation.", SkCommandProcessor.LogTo.Console);
				SkUtilities.Logz(new string[2] { "SkCommandPatcher", "PATCH" }, new string[3] { "PATCH => FAILED. CHECK FOR OTHER MODS BLOCKING PATCHES.\n", ex.Message, ex.StackTrace }, (LogType)0);
			}
			finally
			{
				InitComplete = true;
			}
		}

		internal static void ApplyAchievementBypass()
		{
			if (!KeepAchievementsEnabled)
			{
				return;
			}
			try
			{
				if (clearedUsedCheats || !((Object)(object)Game.instance != (Object)null))
				{
					return;
				}
				PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
				if (playerProfile != null)
				{
					clearedUsedCheats = true;
					if (playerProfile.m_usedCheats)
					{
						playerProfile.m_usedCheats = false;
						SkUtilities.Logz(new string[1] { "ACHIEVEMENTS" }, new string[1] { "Cleared the permanent 'used cheats' flag on this character (KeepAchievements is on)." }, (LogType)3);
					}
				}
			}
			catch (Exception ex)
			{
				SkUtilities.Logz(new string[2] { "ACHIEVEMENTS", "ERROR" }, new string[1] { ex.Message }, (LogType)0);
			}
		}
	}
	internal static class SkCommandProcessor
	{
		[Flags]
		public enum LogTo
		{
			Console = 0,
			Chat = 1,
			DebugConsole = 2
		}

		internal static class TerrainModification
		{
			private static void CreateTerrain(GameObject prefab, Vector3 position, ZNetView component)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				float levelOffset = prefab.GetComponent<TerrainModifier>().m_levelOffset;
				GameObject val = Object.Instantiate<GameObject>(prefab, position - Vector3.up * levelOffset, Quaternion.identity);
			}

			public static void ModifyTerrain(Vector3 centerLocation, GameObject prefab, float radius)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: 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_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_0178: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: Unknown result type (might be due to invalid IL or missing references)
				//IL_0192: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0203: Unknown result type (might be due to invalid IL or missing references)
				//IL_020d: Unknown result type (might be due to invalid IL or missing references)
				//IL_021d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Unknown result type (might be due to invalid IL or missing references)
				//IL_0243: Unknown result type (might be due to invalid IL or missing references)
				//IL_024d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0253: Unknown result type (might be due to invalid IL or missing references)
				//IL_025d: Unknown result type (might be due to invalid IL or missing references)
				if (radius > 30f)
				{
					PrintOut("Radius clamped to 30 max!", LogTo.Console);
				}
				radius = Mathf.Clamp(radius, 0f, 30f);
				ZNetView component = ((Component)Player.m_localPlayer).gameObject.GetComponent<ZNetView>();
				int num = Mathf.CeilToInt(radius / 3f) * 3;
				Vector3 val = default(Vector3);
				for (int i = -num; i <= num; i += 3)
				{
					for (int j = -num; j <= num; j += 3)
					{
						((Vector3)(ref val))..ctor(centerLocation.x + (float)i, centerLocation.y, centerLocation.z + (float)j);
						if (Utils.DistanceXZ(centerLocation, val) <= radius)
						{
							CreateTerrain(prefab, val, component);
						}
					}
				}
				int num2 = int.MaxValue;
				int num3 = int.MaxValue;
				Vector3 val2 = default(Vector3);
				for (int k = -num; k <= 0; k++)
				{
					for (int l = -num; l <= -num / 2; l++)
					{
						((Vector3)(ref val2))..ctor(centerLocation.x + (float)k, centerLocation.y, centerLocation.z + (float)l);
						if (!(Utils.DistanceXZ(centerLocation, val2) <= radius))
						{
							continue;
						}
						if (k < l || (l >= num3 && k <= num2 + 2 && k != 0))
						{
							break;
						}
						num2 = k;
						num3 = l;
						if (k / 3 * 3 == k && l / 3 * 3 == l)
						{
							break;
						}
						CreateTerrain(prefab, new Vector3(centerLocation.x + (float)k, centerLocation.y, centerLocation.z + (float)l), component);
						CreateTerrain(prefab, new Vector3(centerLocation.x + (float)k, centerLocation.y, centerLocation.z - (float)l), component);
						if (k != 0)
						{
							CreateTerrain(prefab, new Vector3(centerLocation.x - (float)k, centerLocation.y, centerLocation.z + (float)l), component);
							CreateTerrain(prefab, new Vector3(centerLocation.x - (float)k, centerLocation.y, centerLocation.z - (float)l), component);
						}
						if (k != l)
						{
							CreateTerrain(prefab, new Vector3(centerLocation.x + (float)l, centerLocation.y, centerLocation.z + (float)k), component);
							CreateTerrain(prefab, new Vector3(centerLocation.x - (float)l, centerLocation.y, centerLocation.z + (float)k), component);
							if (k != 0)
							{
								CreateTerrain(prefab, new Vector3(centerLocation.x + (float)l, centerLocation.y, centerLocation.z - (float)k), component);
								CreateTerrain(prefab, new Vector3(centerLocation.x - (float)l, centerLocation.y, centerLocation.z - (float)k), component);
							}
						}
						break;
					}
				}
			}

			public static void ResetTerrain(Vector3 centerLocation, float radius)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				if (radius > 50f)
				{
					PrintOut("Radius clamped to 50 max!", LogTo.Console);
				}
				radius = Mathf.Clamp(radius, 2f, 50f);
				try
				{
					List<TerrainModifier> allInstances = TerrainModifier.GetAllInstances();
					foreach (TerrainModifier item in allInstances)
					{
						if ((Object)(object)item != (Object)null && Utils.DistanceXZ(((Component)Player.m_localPlayer).transform.position, ((Component)item).transform.position) < radius)
						{
							ZNetView component = ((Component)item).GetComponent<ZNetView>();
							if ((Object)(object)component != (Object)null && component.IsValid())
							{
								component.ClaimOwnership();
								component.Destroy();
							}
						}
					}
				}
				catch (Exception)
				{
				}
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<KeyValuePair<string, string>, string> <>9__50_0;

			public static Func<KeyValuePair<string, string>, string> <>9__50_1;

			public static Func<KeyValuePair<string, string>, string> <>9__50_2;

			public static ConsoleEvent <>9__53_0;

			public static ConsoleEvent <>9__53_1;

			public static ConsoleEvent <>9__53_2;

			public static ConsoleEvent <>9__53_3;

			public static ConsoleEvent <>9__53_4;

			public static ConsoleEvent <>9__53_5;

			public static ConsoleEvent <>9__53_6;

			public static ConsoleEvent <>9__53_7;

			public static ConsoleEvent <>9__53_8;

			public static ConsoleEvent <>9__53_9;

			public static ConsoleEvent <>9__53_10;

			public static ConsoleEvent <>9__53_11;

			public static Func<EnvSetup, string> <>9__53_49;

			public static Func<string, string> <>9__53_50;

			public static ConsoleEvent <>9__53_12;

			public static ConsoleEvent <>9__53_13;

			public static ConsoleEvent <>9__53_14;

			public static ConsoleEvent <>9__53_15;

			public static ConsoleEvent <>9__53_16;

			public static ConsoleEvent <>9__53_17;

			public static ConsoleEvent <>9__53_18;

			public static ConsoleEvent <>9__53_19;

			public static ConsoleEvent <>9__53_20;

			public static ConsoleEvent <>9__53_21;

			public static ConsoleEvent <>9__53_22;

			public static ConsoleEvent <>9__53_23;

			public static ConsoleEvent <>9__53_24;

			public static ConsoleEvent <>9__53_25;

			public static ConsoleEvent <>9__53_26;

			public static ConsoleEvent <>9__53_27;

			public static ConsoleEvent <>9__53_28;

			public static ConsoleEvent <>9__53_29;

			public static ConsoleEvent <>9__53_30;

			public static ConsoleEvent <>9__53_31;

			public static ConsoleEvent <>9__53_32;

			public static ConsoleEvent <>9__53_33;

			public static ConsoleEvent <>9__53_34;

			public static ConsoleEvent <>9__53_35;

			public static ConsoleEvent <>9__53_36;

			public static ConsoleEvent <>9__53_37;

			public static ConsoleEvent <>9__53_38;

			public static ConsoleEvent <>9__53_39;

			public static ConsoleEvent <>9__53_40;

			public static ConsoleEvent <>9__53_41;

			public static ConsoleEvent <>9__53_42;

			public static ConsoleEvent <>9__53_43;

			public static ConsoleEvent <>9__53_44;

			public static ConsoleEvent <>9__53_45;

			public static ConsoleEvent <>9__53_46;

			public static ConsoleEvent <>9__53_47;

			public static ConsoleEvent <>9__53_48;

			public static Predicate<ZDO> <>9__63_0;

			internal string <Announce>b__50_0(KeyValuePair<string, string> obj)
			{
				return obj.Key;
			}

			internal string <Announce>b__50_1(KeyValuePair<string, string> obj)
			{
				return obj.Key;
			}

			internal string <Announce>b__50_2(KeyValuePair<string, string> obj)
			{
				return obj.Value;
			}

			internal void <InitCommands>b__53_0(ConsoleEventArgs args)
			{
				if (args.Length > 1)
				{
					string text = string.Empty;
					for (int i = 0; i < args.Length; i++)
					{
						text = text + args[i] + " ";
					}
					PrintOut(text, LogTo.Console);
				}
			}

			internal void <InitCommands>b__53_1(ConsoleEventArgs args)
			{
				if (args.Length > 1)
				{
					if (args[1].Equals("1"))
					{
						((Component)((Terminal)Console.instance).m_chatWindow).gameObject.SetActive(true);
						SkConfigEntry.CConsoleEnabled.Value = true;
					}
					else
					{
						((Component)((Terminal)Console.instance).m_chatWindow).gameObject.SetActive(false);
					}
				}
				else
				{
					((Component)((Terminal)Console.instance).m_chatWindow).gameObject.SetActive(!((Component)((Terminal)Console.instance).m_chatWindow).gameObject.activeSelf);
					if (((Component)((Terminal)Console.instance).m_chatWindow).gameObject.activeInHierarchy)
					{
						SkConfigEntry.CConsoleEnabled.Value = true;
					}
				}
			}

			internal void <InitCommands>b__53_2(ConsoleEventArgs args)
			{
				PrintOut("Quitting game...", LogTo.DebugConsole);
				Application.Quit();
			}

			internal void <InitCommands>b__53_3(ConsoleEventArgs args)
			{
				((TMP_Text)((Terminal)Console.instance).m_output).text = string.Empty;
				try
				{
					Console.instance.SetPrivateField("m_chatBuffer", new List<string>());
					ConsoleOpt.consoleOutputHistory.Clear();
				}
				catch (Exception)
				{
				}
			}

			internal void <InitCommands>b__53_4(ConsoleEventArgs args)
			{
				List<ItemData> list = new List<ItemData>();
				((Humanoid)Player.m_localPlayer).GetInventory().GetWornItems(list);
				foreach (ItemData item in list)
				{
					try
					{
						item.m_durability = item.GetMaxDurability();
					}
					catch (Exception)
					{
					}
				}
				PrintOut("All items repaired!");
			}

			internal void <InitCommands>b__53_5(ConsoleEventArgs args)
			{
				PrintOut(ListPortals(), LogTo.Console);
			}

			internal void <InitCommands>b__53_6(ConsoleEventArgs args)
			{
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				GameObject prefab = ZNetScene.instance.GetPrefab("digg_v2");
				if ((Object)(object)prefab == (Object)null)
				{
					PrintOut("Terrain level failed. Report to mod author - terrain level error 1");
					return;
				}
				float radius = 5f;
				if (args.Length > 1)
				{
					try
					{
						radius = int.Parse(args[1]);
					}
					catch (Exception)
					{
					}
				}
				TerrainModification.ModifyTerrain(((Component)Player.m_localPlayer).transform.position, prefab, radius);
				PrintOut("Terrain levelled!");
			}

			internal void <InitCommands>b__53_7(ConsoleEventArgs args)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				float radius = 5f;
				if (args.Length > 1)
				{
					try
					{
						radius = int.Parse(args[1]);
					}
					catch (Exception)
					{
					}
				}
				TerrainModification.ResetTerrain(((Component)Player.m_localPlayer).transform.position, radius);
				PrintOut("Terrain reset!");
			}

			internal void <InitCommands>b__53_8(ConsoleEventArgs args)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				GameObject prefab = ZNetScene.instance.GetPrefab("raise");
				if ((Object)(object)prefab == (Object)null)
				{
					PrintOut("Terrain raise failed. Report to mod author - terrain raise error 1");
					return;
				}
				float radius = 5f;
				float num = 2f;
				if (args.Length > 1)
				{
					try
					{
						radius = int.Parse(args[1]);
					}
					catch (Exception)
					{
					}
				}
				if (args.Length > 2)
				{
					try
					{
						num = int.Parse(args[2]);
					}
					catch (Exception)
					{
					}
				}
				TerrainModification.ModifyTerrain(((Component)Player.m_localPlayer).transform.position + Vector3.up * num, prefab, radius);
				PrintOut("Terrain raised!");
			}

			internal void <InitCommands>b__53_9(ConsoleEventArgs args)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				GameObject prefab = ZNetScene.instance.GetPrefab("digg_v2");
				if ((Object)(object)prefab == (Object)null)
				{
					PrintOut("Terrain dig failed. Report to mod author - terrain dig error 1");
					return;
				}
				float radius = 5f;
				float num = 1f;
				if (args.Length > 1)
				{
					try
					{
						radius = int.Parse(args[1]);
					}
					catch (Exception)
					{
					}
				}
				if (args.Length > 2)
				{
					try
					{
						num = int.Parse(args[2]);
					}
					catch (Exception)
					{
					}
				}
				TerrainModification.ModifyTerrain(((Component)Player.m_localPlayer).transform.position - Vector3.up * num, prefab, radius);
				PrintOut("Terrain dug!");
			}

			internal void <InitCommands>b__53_10(ConsoleEventArgs args)
			{
				EnvMan.instance.ResetDebugWind();
				PrintOut("Wind unlocked and under game control.");
			}

			internal void <InitCommands>b__53_11(ConsoleEventArgs args)
			{
				if (args.Length == 3)
				{
					float num = float.Parse(args[1]);
					float num2 = float.Parse(args[2]);
					EnvMan.instance.SetDebugWind(num, num2);
				}
				else
				{
					PrintOut("Failed to set wind. Check parameters! Ex. /wind 240 5");
				}
			}

			internal void <InitCommands>b__53_12(ConsoleEventArgs args)
			{
				if (args.Length == 1)
				{
					if (!((Object)(object)EnvMan.instance == (Object)null))
					{
						PrintOut("Current environment: " + (EnvMan.instance.GetCurrentEnvironment()?.m_name ?? "(none)"));
						{
							foreach (string item in from e in EnvMan.instance.m_environments
								select e.m_name into q
								orderby q
								select q)
							{
								PrintOut(item);
							}
							return;
						}
					}
					PrintOut("Can't find environment manager.");
				}
				else if (args.Length >= 2)
				{
					if (args[1].Equals("-1"))
					{
						if ((Object)(object)EnvMan.instance != (Object)null)
						{
							EnvMan.instance.m_debugEnv = "";
							PrintOut("Weather unlocked and under game control.");
						}
						return;
					}
					<>c__DisplayClass53_0 CS$<>8__locals8 = new <>c__DisplayClass53_0
					{
						finalWeatherName = string.Empty
					};
					if (args.Length > 2)
					{
						string[] args2 = args.Args;
						foreach (string text in args2)
						{
							if (!text.Equals(args[0]))
							{
								CS$<>8__locals8.finalWeatherName = CS$<>8__locals8.finalWeatherName + " " + text;
							}
						}
						CS$<>8__locals8.finalWeatherName = CS$<>8__locals8.finalWeatherName.Trim();
					}
					else
					{
						CS$<>8__locals8.finalWeatherName = args[1];
					}
					EnvSetup val = (((Object)(object)EnvMan.instance != (Object)null) ? ((IEnumerable<EnvSetup>)EnvMan.instance.m_environments).FirstOrDefault((Func<EnvSetup, bool>)((EnvSetup e) => string.Equals(e.m_name, CS$<>8__locals8.finalWeatherName, StringComparison.OrdinalIgnoreCase))) : null);
					if (val != null)
					{
						EnvMan.instance.m_debugEnv = val.m_name;
						PrintOut("Weather set to: " + EnvMan.instance.m_debugEnv);
					}
					else if ((Object)(object)EnvMan.instance == (Object)null)
					{
						PrintOut("Failed to set weather to '" + CS$<>8__locals8.finalWeatherName + "'. Can't find environment manager.");
					}
					else
					{
						PrintOut("Failed to set weather to '" + CS$<>8__locals8.finalWeatherName + "'. Unknown environment. Use /env to list, /env -1 to unlock.");
					}
				}
				else
				{
					PrintOut("Failed to set weather. Check parameters! Ex. /env, /env -1, /env Misty");
				}
			}

			internal string <InitCommands>b__53_49(EnvSetup e)
			{
				return e.m_name;
			}

			internal string <InitCommands>b__53_50(string q)
			{
				return q;
			}

			internal void <InitCommands>b__53_13(ConsoleEventArgs args)
			{
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null || (Object)(object)((Component)localPlayer).GetComponent<ZNetView>() == (Object)null || !((Component)localPlayer).GetComponent<ZNetView>().IsValid())
				{
					PrintOut("Fly: no local player yet. Spawn into a world first.");
					return;
				}
				flyEnabled = localPlayer.ToggleDebugFly();
				Player.m_debugMode = flyEnabled || noCostEnabled || SkCommandPatcher.BCheat;
				PrintOut("Fly toggled! (" + flyEnabled + ")");
			}

			internal void <InitCommands>b__53_14(ConsoleEventArgs args)
			{
				if ((Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_items == null)
				{
					PrintOut("Item database is not loaded yet.");
					return;
				}
				string text = ((args.Length > 1) ? args[1].ToLower() : string.Empty);
				int num = 0;
				foreach (GameObject item in ObjectDB.instance.m_items)
				{
					if ((Object)(object)item == (Object)null)
					{
						continue;
					}
					ItemDrop component = item.GetComponent<ItemDrop>();
					if (!((Object)(object)component == (Object)null) && component.m_itemData != null && component.m_itemData.m_shared != null)
					{
						Sprite[] icons = component.m_itemData.m_shared.m_icons;
						if (icons != null && icons.Length != 0 && !((Object)(object)icons[0] == (Object)null) && (text.Length <= 0 || ((Object)item).name.ToLower().IndexOf(text) >= 0))
						{
							PrintOut(((Object)item).name);
							num++;
						}
					}
				}
				PrintOut(num + " item icon(s) listed.");
			}

			internal void <InitCommands>b__53_15(ConsoleEventArgs args)
			{
				//IL_0031: 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)
				SkMenuController skMenuController = (((Object)(object)SkLoader.Load != (Object)null) ? SkLoader.Load.GetComponent<SkMenuController>() : null);
				PrintOut("The menu is mouse-driven now. Press " + (((Object)(object)skMenuController != (Object)null) ? ((object)skMenuController.ToggleKey/*cast due to .constrained prefix*/).ToString() : "F6") + " to open it; the /alt keyboard controls were removed.");
			}

			internal void <InitCommands>b__53_16(ConsoleEventArgs args)
			{
				if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer())
				{
					PrintOut("Events can only be stopped by the host/server (the server re-syncs the active event every 2s).");
					return;
				}
				RandEventSystem.instance.ResetRandomEvent();
				PrintOut("Event stopped!");
			}

			internal void <InitCommands>b__53_17(ConsoleEventArgs args)
			{
				Minimap.instance.ExploreAll();
				PrintOut("Map revealed!");
			}

			internal void <InitCommands>b__53_18(ConsoleEventArgs args)
			{
				//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_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				string text = string.Empty;
				List<PlayerInfo> playerList = ZNet.instance.GetPlayerList();
				foreach (PlayerInfo item in playerList)
				{
					string[] obj = new string[6] { text, ", ", item.m_name, "(", null, null };
					ZDOID characterID = item.m_characterID;
					obj[4] = ((ZDOID)(ref characterID)).UserID.ToString();
					obj[5] = ")";
					text = string.Concat(obj);
				}
				if (text.Length > 2)
				{
					text = text.Remove(0, 2);
				}
				PrintOut("Active Players (" + playerList.Count + ") - " + text);
			}

			internal void <InitCommands>b__53_19(ConsoleEventArgs args)
			{
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0172: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a5: Expected O, but got Unknown
				string text = Player.m_localPlayer.GetPlayerName();
				string empty = string.Empty;
				int result = 1;
				int result2 = 1;
				if (args.Length < 2)
				{
					PrintOut("Failed. No item provided. /give [Item] [Qty=1] [Player] [Level=1]");
					return;
				}
				empty = args[1];
				if (args.Length >= 3 && !int.TryParse(args[2], out result))
				{
					result = 1;
				}
				if (args.Length >= 4)
				{
					text = args[3];
				}
				if (args.Length >= 5 && !int.TryParse(args[4], out result2))
				{
					result2 = 1;
				}
				Player val = null;
				foreach (Player allPlayer in Player.GetAllPlayers())
				{
					if ((Object)(object)allPlayer != (Object)null && allPlayer.GetPlayerName().ToLower().StartsWith(text.ToLower()))
					{
						val = allPlayer;
						break;
					}
				}
				if ((Object)(object)val == (Object)null)
				{
					PrintOut("Failed. Player does not exist. /give [Item] [Qty=1] [Player] [Level=1]");
					return;
				}
				GameObject prefab = ZNetScene.instance.GetPrefab(empty);
				if (Object.op_Implicit((Object)(object)prefab))
				{
					PrintOut("Spawning " + result + " of item " + empty + "(" + result2 + ") on " + text);
					try
					{
						GameObject val2 = Object.Instantiate<GameObject>(prefab, ((Component)val).transform.position + ((Component)val).transform.forward * 1.5f + Vector3.up, Quaternion.identity);
						ItemDrop val3 = (ItemDrop)val2.GetComponent(typeof(ItemDrop));
						if ((Object)(object)val3 != (Object)null && val3.m_itemData != null)
						{
							val3.SetQuality(result2);
							val3.m_itemData.m_stack = result;
							val3.m_itemData.m_durability = val3.m_itemData.GetMaxDurability();
						}
						return;
					}
					catch (Exception ex)
					{
						PrintOut("Something unexpected failed.");
						SkUtilities.Logz(new string[2] { "ERR", "/give" }, new string[2] { ex.Message, ex.Source }, (LogType)2);
						return;
					}
				}
				PrintOut("Failed. Check parameters. /give [Item] [Qty=1] [Player] [Level=1]");
			}

			internal void <InitCommands>b__53_20(ConsoleEventArgs args)
			{
				if ((Object)(object)Player.m_localPlayer == (Object)null)
				{
					PrintOut("No local player.");
					return;
				}
				godEnabled = !((Character)Player.m_localPlayer).InGodMode();
				Player.m_localPlayer.SetGodMode(godEnabled);
				PrintOut("Godmode " + (godEnabled ? "ON" : "OFF") + ((godEnabled && (SkConfigEntry.CGodModeBlocksDamage == null || SkConfigEntry.CGodModeBlocksDamage.Value)) ? " - damage is blocked outright." : "."));
			}

			internal void <InitCommands>b__53_21(ConsoleEventArgs args)
			{
				((Humanoid)Player.m_localPlayer).UnequipAllItems();
				((Humanoid)Player.m_localPlayer).GetInventory().RemoveAll();
				PrintOut("All items removed from inventory.");
			}

			internal void <InitCommands>b__53_22(ConsoleEventArgs args)
			{
				//IL_0031: 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_0049: Unknown result type (might be due to invalid IL or missing references)
				TombStone[] array = Object.FindObjectsByType<TombStone>((FindObjectsSortMode)0);
				if (array.Length != 0)
				{
					TombStone[] array2 = array;
					foreach (TombStone val in array2)
					{
						if ((Object)(object)val != (Object)null && ((Behaviour)val).enabled)
						{
							Minimap.instance.AddPin(((Component)val).transform.position, (PinType)12, "TS", true, true, 0L, default(PlatformUserID));
						}
					}
				}
				PrintOut("Tombstone sought out! Potentially " + array.Length + " found.");
			}

			internal void <InitCommands>b__53_23(ConsoleEventArgs args)
			{
				World privateField = WorldGenerator.instance.GetPrivateField<World>("m_world");
				PrintOut("Map seed: " + privateField.m_seedName);
			}

			internal void <InitCommands>b__53_24(ConsoleEventArgs args)
			{
				GameCamera.instance.ToggleFreeFly();
				PrintOut("Free cam toggled " + GameCamera.InFreeFly());
			}

			internal void <InitCommands>b__53_25(ConsoleEventArgs args)
			{
				if (args.Length > 1)
				{
					foreach (Player allPlayer in Player.GetAllPlayers())
					{
						if ((Object)(object)allPlayer != (Object)null && allPlayer.GetPlayerName().ToLower().Equals(args[1].ToLower()))
						{
							((Character)allPlayer).Heal(((Character)allPlayer).GetMaxHealth(), true);
							PrintOut("Player healed: " + allPlayer.GetPlayerName());
						}
					}
					return;
				}
				((Character)Player.m_localPlayer).Heal(((Character)Player.m_localPlayer).GetMaxHealth(), true);
				PrintOut("Self healed.");
			}

			internal void <InitCommands>b__53_26(ConsoleEventArgs args)
			{
				SkCommandPatcher.InitPatch();
				SkCommandPatcher.bBuildAnywhere = !SkCommandPatcher.bBuildAnywhere;
				PrintOut("No build restrictions toggled! (" + SkCommandPatcher.bBuildAnywhere + ")");
			}

			internal void <InitCommands>b__53_27(ConsoleEventArgs args)
			{
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null)
				{
					PrintOut("No local player.");
					return;
				}
				noCostEnabled = !localPlayer.NoCostCheat();
				localPlayer.SetNoPlacementCost(noCostEnabled);
				Player.m_debugMode = flyEnabled || noCostEnabled || SkCommandPatcher.BCheat;
				PrintOut("No build cost/requirements toggled! (" + noCostEnabled + ")");
			}

			internal void <InitCommands>b__53_28(ConsoleEventArgs args)
			{
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				if (args.Length != 2 || !args[1].Contains(","))
				{
					PrintOut("Syntax /tp X,Z");
					return;
				}
				try
				{
					string[] array = args[1].Split(new char[1] { ',' });
					float num = float.Parse(array[0]);
					float num2 = float.Parse(array[1]);
					float groundHeight = ZoneSystem.instance.GetGroundHeight(new Vector3(num, 750f, num2));
					bool flag = groundHeight < 749f;
					Player localPlayer = Player.m_localPlayer;
					if (Object.op_Implicit((Object)(object)localPlayer))
					{
						float num3;
						if (flag)
						{
							num3 = Mathf.Max(groundHeight + 0.5f, ZoneSystem.instance.m_waterLevel);
						}
						else
						{
							float num4 = (((Character)localPlayer).IsDebugFlying() ? 400f : 30f);
							num3 = Mathf.Clamp(((Component)localPlayer).transform.position.y, 30f, num4);
						}
						Vector3 val = default(Vector3);
						((Vector3)(ref val))..ctor(num, num3, num2);
						if (((Character)localPlayer).TeleportTo(val, ((Component)localPlayer).transform.rotation, true))
						{
							PrintOut("Teleporting...");
						}
						else
						{
							PrintOut("Teleport refused (already teleporting or <2s since last teleport). Try again in a moment.");
						}
					}
				}
				catch (Exception)
				{
					PrintOut("Syntax /tp X,Z");
				}
			}

			internal void <InitCommands>b__53_29(ConsoleEventArgs args)
			{
				bDetectEnemies = !bDetectEnemies;
				if (args.Length > 0)
				{
					try
					{
						bDetectRange = int.Parse(args[1]);
						bDetectRange = ((bDetectRange < 5) ? 5 : bDetectRange);
					}
					catch (Exception)
					{
						bDetectRange = 20;
					}
				}
				PrintOut("Detect enemies toggled! (" + bDetectEnemies + ", range: " + bDetectRange + ")");
			}

			internal void <InitCommands>b__53_30(ConsoleEventArgs args)
			{
				SkCommandPatcher.InitPatch();
				SkCommandPatcher.BCheat = !SkCommandPatcher.BCheat;
				try
				{
					Player.m_debugMode = SkCommandPatcher.BCheat;
					Terminal.m_cheat = SkCommandPatcher.BCheat;
					if (SkCommandPatcher.BCheat && (Object)(object)Game.instance != (Object)null)
					{
						PlayerProfile playerProfile = Game.instance.GetPlayerProfile();
						if (playerProfile != null && !playerProfile.m_usedCheats)
						{
							playerProfile.m_usedCheats = true;
							PrintOut(Localization.instance.Localize("$achievements_permanently_cheated_character"));
						}
					}
				}
				catch (Exception)
				{
				}
				if ((Object)(object)args.Context != (Object)null)
				{
					args.Context.InvokePrivateMethod("updateCommandList", null);
				}
				if ((Object)(object)Console.instance != (Object)null && (object)Console.instance != args.Context)
				{
					Console.instance.InvokePrivateMethod("updateCommandList", null);
				}
				PrintOut("Cheats toggled! (" + SkCommandPatcher.BCheat + ")");
				if (SkCommandPatcher.BCheat)
				{
					PrintOut("Vanilla cheat commands (god/fly/ghost/nocost/debugmode...) are now valid on this client, including on joined servers.");
				}
			}

			internal void <InitCommands>b__53_31(ConsoleEventArgs args)
			{
				SkCommandPatcher.InitPatch();
				SkCommandPatcher.BFreeSupport = !SkCommandPatcher.BFreeSupport;
				PrintOut("No build support requirements toggled! (" + SkCommandPatcher.BFreeSupport + ")");
			}

			internal void <InitCommands>b__53_32(ConsoleEventArgs args)
			{
				bCoords = !bCoords;
				PrintOut("Show coords toggled! (" + bCoords + ")");
			}

			internal void <InitCommands>b__53_33(ConsoleEventArgs args)
			{
				Minimap.instance.Reset();
			}

			internal void <InitCommands>b__53_34(ConsoleEventArgs args)
			{
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null)
				{
					PrintOut("Infinite stamina: no local player yet. Spawn into a world first.");
					return;
				}
				infStamina = !infStamina;
				ApplyInfStamina(localPlayer, applyOffValues: true);
				PrintOut("Infinite stamina toggled! (" + infStamina + ")");
			}

			internal void <InitCommands>b__53_35(ConsoleEventArgs args)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				Tameable.TameAllInArea(((Component)Player.m_localPlayer).transform.position, 20f);
				PrintOut("Creatures tamed!");
			}

			internal void <InitCommands>b__53_36(ConsoleEventArgs args)
			{
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null)
				{
					PrintOut("Far interactions: no local player yet. Spawn into a world first.");
					return;
				}
				farInteract = !farInteract;
				if (farInteract && args.Length > 1)
				{
					try
					{
						farInteractDistance = ((int.Parse(args[1]) < 20) ? 20 : int.Parse(args[1]));
					}
					catch (Exception)
					{
						PrintOut("Failed to set far interaction distance. Check params. /farinteract 50");
					}
				}
				ApplyFarInteract(localPlayer, applyOffValues: true);
				PrintOut(farInteract ? ("Far interactions toggled! (True Distance: " + farInteractDistance + ")") : "Far interactions toggled! (False)");
			}

			internal void <InitCommands>b__53_37(ConsoleEventArgs args)
			{
				Player localPlayer = Player.m_localPlayer;
				if ((Object)(object)localPlayer == (Object)null)
				{
					PrintOut("Ghost: no local player yet. Spawn into a world first.");
					return;
				}
				localPlayer.SetGhostMode(!((Character)localPlayer).InGhostMode());
				ghostEnabled = ((Character)localPlayer).InGhostMode();
				PrintOut("Ghost mode toggled! (" + ghostEnabled + ")");
			}

			internal void <InitCommands>b__53_38(ConsoleEventArgs args)
			{
				if (args.Length > 1)
				{
					if (float.TryParse(args[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
					{
						if (result < 0f)
						{
							EnvMan.instance.m_debugTimeOfDay = false;
							PrintOut("Time unlocked and under game control.");
						}
						else
						{
							EnvMan.instance.m_debugTimeOfDay = true;
							EnvMan.instance.m_debugTime = Mathf.Clamp01(result);
							PrintOut("Setting time of day:" + result);
						}
					}
				}
				else
				{
					PrintOut("Failed. Syntax /tod [0-1] Ex. /tod 0.5");
				}
			}

			internal void <InitCommands>b__53_39(ConsoleEventArgs args)
			{
				TerrainComp.UpgradeTerrain();
				Heightmap.UpdateTerrainAlpha();
			}

			internal void <InitCommands>b__53_40(ConsoleEventArgs args)
			{
				if (args.Length <= 1)
				{
					return;
				}
				if (args[1].Equals("cw"))
				{
					try
					{
						int num = int.Parse(args[2]);
						Player.m_localPlayer.m_maxCarryWeight = num;
						PrintOut("New carry weight set to: " + num);
						return;
					}
					catch (Exception)
					{
						PrintOut("Failed to set new carry weight. Check params.");
						return;
					}
				}
				if (args[1].Equals("skill"))
				{
					if (args.Length == 4 && !args[2].Contains("None") && !args[2].Contains("All") && !args[2].Contains("FireMagic") && !args[2].Contains("FrostMagic"))
					{
						try
						{
							string text = args[2];
							int num2 = int.Parse(args[3]);
							((Character)Player.m_localPlayer).GetSkills().CheatResetSkill(text.ToLower());
							((Character)Player.m_localPlayer).GetSkills().CheatRaiseSkill(text.ToLower(), (float)num2, true);
							return;
						}
						catch (Exception)
						{
							PrintOut("Failed to set skill. Check params / skill name. See /listskills. /set skill [skill] [level]");
							return;
						}
					}
					PrintOut("Failed to set skill. Check params / skill name. See /listskills.  /set skill [skill] [level]");
				}
				else if (args[1].Equals("pickup"))
				{
					if (args.Length >= 3)
					{
						try
						{
							int num3 = int.Parse(args[2]);
							Player.m_localPlayer.m_autoPickupRange = num3;
							PrintOut("New range set to: " + num3);
							return;
						}
						catch (Exception)
						{
							PrintOut("Failed to set pickup range. Check params. /set pickup 2");
							return;
						}
					}
					PrintOut("Failed to set pickup range. Check params.  /set pickup 2");
				}
				else if (args[1].Equals("jumpforce"))
				{
					if (args.Length >= 3)
					{
						try
						{
							int num4 = int.Parse(args[2]);
							((Character)Player.m_localPlayer).m_jumpForce = num4;
							PrintOut("New range set to: " + num4);
							return;
						}
						catch (Exception)
						{
							PrintOut("Failed to set jump force. Check params. /set jumpforce 10");
							return;
						}
					}
					PrintOut("Failed to set jump force. Check params.  /set jumpforce 10");
				}
				else if (args[1].Equals("exploreradius"))
				{
					if (args.Length >= 3)
					{
						try
						{
							int num5 = int.Parse(args[2]);
							Minimap.instance.m_exploreRadius = num5;
							PrintOut("New range set to: " + num5);
							return;
						}
						catch (Exception)
						{
							PrintOut("Failed to set explore radius. Check params. /set exploreradius 100");
							return;
						}
					}
					PrintOut("Failed to set explore radius. Check params.  /set exploreradius 100");
				}
				else if (args[1].Equals("speed"))
				{
					if (args.Length >= 4)
					{
						string text2 = args[2];
						string[] source = new string[3] { "crouch", "run", "swim" };
						if (source.Contains(text2))
						{
							float num6 = 0f;
							try
							{
								int num7 = int.Parse(args[3]);
								switch (text2)
								{
								case "crouch":
									num6 = ((Character)Player.m_localPlayer).m_crouchSpeed;
									((Character)Player.m_localPlayer).m_crouchSpeed = num7;
									break;
								case "run":
									num6 = ((Character)Player.m_localPlayer).m_runSpeed;
									((Character)Player.m_localPlayer).m_runSpeed = num7;
									break;
								case "swim":
									num6 = ((Character)Player.m_localPlayer).m_swimSpeed;
									((Character)Player.m_localPlayer).m_swimSpeed = num7;
									break;
								}
								PrintOut("New " + text2 + " speed set to: " + num7 + " (was: " + num6 + ")");
								return;
							}
							catch (Exception)
							{
								PrintOut("Failed to set speed. Check params name. Ex. /set speed crouch 2");
								return;
							}
						}
						PrintOut("Failed to set speed. Check params name. Ex.  /set speed crouch 2");
					}
					else
					{
						PrintOut("Failed to set speed. Check params name. Ex.  /set speed crouch 2");
					}
				}
				else
				{
					if (!args[1].Equals("difficulty"))
					{
						return;
					}
					if (args.Length >= 3)
					{
						try
						{
							int forcePlayerDifficulty = int.Parse(args[2]);
							Game.instance.SetForcePlayerDifficulty(forcePlayerDifficulty);
							PrintOut("Difficulty set to " + forcePlayerDifficulty);
							return;
						}
						catch (Exception)
						{
							PrintOut("Failed to set difficulty. Check params. /set difficulty 5");
							return;
						}
					}
					PrintOut("Failed to set difficulty. Check params.  /set difficulty 5");
				}
			}

			internal void <InitCommands>b__53_41(ConsoleEventArgs args)
			{
				ItemDrop[] array = Object.FindObjectsByType<ItemDrop>((FindObjectsSortMode)0);
				int num = 0;
				for (int i = 0; i < array.Length; i++)
				{
					Fish component = ((Component)array[i]).GetComponent<Fish>();
					if ((Object.op_Implicit((Object)(object)component) && !component.IsOutOfWater()) || array[i].IsPiece())
					{
						continue;
					}
					ZNetView component2 = ((Component)array[i]).GetComponent<ZNetView>();
					if (Object.op_Implicit((Object)(object)component2) && component2.IsValid())
					{
						if (!component2.IsOwner())
						{
							component2.ClaimOwnership();
						}
						component2.Destroy();
						num++;
					}
				}
				PrintOut("Items cleared (" + num + ").");
			}

			internal void <InitCommands>b__53_42(ConsoleEventArgs args)
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = SpawnPrefab(args);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				MonsterAI component = val.GetComponent<MonsterAI>();
				if ((Object)(object)component == (Object)null)
				{
					PrintOut("Spawned, but " + args[1] + " has no MonsterAI and cannot be tamed.");
					return;
				}
				component.MakeTame();
				Tameable component2 = val.GetComponent<Tameable>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.m_tamedEffect.Create(val.transform.position, val.transform.rotation, (Transform)null, 1f, -1, default(ZDOID));
				}
				PrintOut("Spawned tamed - " + args[1]);
			}

			internal void <InitCommands>b__53_43(ConsoleEventArgs args)
			{
				GameObject val = SpawnPrefab(args);
				if ((Object)(object)val != (Object)null)
				{
					PrintOut("Spawned - " + args[1]);
				}
			}

			internal void <InitCommands>b__53_44(ConsoleEventArgs args)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Expected O, but got Unknown
				List<Character> list = new List<Character>();
				Character.GetCharactersInRange(((Component)Player.m_localPlayer).transform.position, 50f, list);
				foreach (Character item in list)
				{
					if (!item.IsPlayer())
					{
						HitData val = new HitData();
						val.m_damage.m_damage = 1E+10f;
						item.Damage(val);
					}
				}
				PrintOut("Nearby creatures killed! (50m)");
			}

			internal void <InitCommands>b__53_45(ConsoleEventArgs args)
			{
				if (args.Length > 1)
				{
					foreach (GameObject item in ObjectDB.instance.m_items)
					{
						ItemDrop component = item.GetComponent<ItemDrop>();
						if (((Object)component).name.ToLower().Contains(args[1].ToLower()))
						{
							PrintOut("Item: '" + ((Object)component).name + "'", LogTo.DebugConsole);
						}
					}
					return;
				}
				foreach (GameObject item2 in ObjectDB.instance.m_items)
				{
					ItemDrop component2 = item2.GetComponent<ItemDrop>();
					PrintOut("Item: '" + ((Object)component2).name + "'", LogTo.DebugConsole);
				}
			}

			internal void <InitCommands>b__53_46(ConsoleEventArgs args)
			{
				ConsoleOpt.BuildPrefabs();
				if (args.Length > 1)
				{
					foreach (string prefab in ConsoleOpt.PrefabList)
					{
						if (prefab.ToLower().StartsWith(args[1].ToLower()))
						{
							PrintOut("Prefab: '" + prefab + "'", LogTo.DebugConsole);
						}
					}
					return;
				}
				foreach (string prefab2 in ConsoleOpt.PrefabList)
				{
					PrintOut("Prefab: '" + prefab2 + "'", LogTo.DebugConsole);
				}
			}

			internal void <InitCommands>b__53_47(ConsoleEventArgs args)
			{
				string text = "Skills found: ";
				foreach (object value in Enum.GetValues(typeof(SkillType)))
				{
					if (!value.ToString().Contains("None") && !value.ToString().Contains("All") && !value.ToString().Contains("FireMagic") && !value.ToString().Contains("FrostMagic"))
					{
						text = text + value.ToString() + ", ";
					}
				}
				text = text.Remove(text.Length - 2);
				PrintOut(text, LogTo.DebugConsole);
			}

			internal void <InitCommands>b__53_48(ConsoleEventArgs args)
			{
				((Terminal)Console.instance).TryRunCommand("help", false, false);
			}

			internal bool <ListPortals>b__63_0(ZDO z)
			{
				return !z.IsValid();
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass53_0
		{
			public string finalWeatherName;

			internal bool <InitCommands>b__51(EnvSetup e)
			{
				return string.Equals(e.m_name, finalWeatherName, StringComparison.OrdinalIgnoreCase);
			}
		}

		public static bool flyEnabled = false;

		public static bool godEnabled = false;

		public static bool farInteract = false;

		public static float farInteractDistance = 50f;

		public static bool infStamina = false;

		public static bool noCostEnabled = false;

		public static bool ghostEnabled = false;

		public static bool infEitr = false;

		public static bool noCarryLimit = false;

		public static readonly HashSet<int> immuneTo = new HashSet<int>();

		public static int carryWeight = 0;

		public static int pickupRange = 0;

		public static int jumpForce = 0;

		public static int runSpeed = 0;

		public static int swimSpeed = 0;

		public static int exploreRadius = 0;

		public static bool bTeleport = false;

		public static bool bDebugTime = false;

		public static bool bDetectEnemies = false;

		public static bool btDetectEnemiesSwitch = true;

		public static int bDetectRange = 20;

		public static bool altOnScreenControls = false;

		public static bool bCoords = false;

		public static int pageSize = 11;

		private static Vector3 chatPos = new Vector3(0f, -99f);

		private static ModConsole consoleOpt = null;

		private static bool eitrBaselineTaken = false;

		private static float baseEitrRegen;

		private static float baseEitrRegenDelay;

		private static bool tuningBaselineTaken = false;

		private static float baseCarry;

		private static float basePickup;

		private static float baseJump;

		private static float baseRun;

		private static float baseSwim;

		private static float baseExplore;

		public static Dictionary<string, string> commandList = new Dictionary<string, string>
		{
			{ "/alt", "- (Removed) The menu is mouse-driven now. Press the MenuToggleKey (default F6) to open it." },
			{ "/listicons", "[Filter] - List item prefabs that have an icon, for picking menu icons" },
			{ "/console", "[1/0] - Toggle the console. No parameter with toggle. 1 = Open, 0 = Closed. Intended for use with hotkeys and aliases." },
			{ "/coords", "- Show coords in corner of the screen" },
			{ "/clear", "- Clear the current output shown in the console" },
			{ "/clearinventory", "- Removes all items from your inventory. There is no confirmation, be careful." },
			{ "/detect", "[Range=20] - Toggle enemy detection" },
			{ "/farinteract", "[Distance=50] - Toggles far interactions (building as well). To change distance, toggle this off then back on with new distance" },
			{ "/echo", "[Text] - Echo the text back to the console. This is intended for use with aliases and the autorun features." },
			{ "/env", "[Weather] - Change the weather. No parameter provided will list all weather. -1 will allow the game to control the weather again." },
			{ "/findtomb", "- Pin nearby dead player tombstones on the map if any currently exist" },
			{ "/fly", "- Toggle flying" },
			{ "/freecam", "- Toggle freecam" },
			{ "/ghost", "- Toggle Ghostmode (enemy creatures cannot see you)" },
			{ "/give", "[Item] [Qty=1], OR /give [Item] [Qty=1] [Player] [Level=1] - Gives item to player. If player has a space in name, only provide name before the space. Capital letters matter in item / player name!" },
			{ "/god", "- Toggle Godmode" },
			{ "/heal", "[Player=local] - Heal Player" },
			{ "/imacheater", "- Use the toolbox to force enable standard cheats on any server" },
			{ "/infstam", "- Toggles infinite stamina" },
			{ "/killall", "- Kills all nearby creatures" },
			{ "/listitems", "[Name Contains] - List all items. Optionally include name starts with. Ex. /listitems Woo returns any item that contains the letters 'Woo'" },
			{ "/listprefabs", "[Name Contains] - Lists all prefabs - List all prefabs/creatures. Optionally include name starts with. Ex. /listprefabs Troll returns any prefab that starts with the letters 'Troll'" },
			{ "/listskills", "- Lists all skills" },
			{ "/nocost", "- Toggle no requirement building" },
			{ "/nores", "- Toggle no restrictions to where you can build (except ward zones)" },
			{ "/nosup", "- Toggle no supports required for buildings - WARNING! - IF YOU REJOIN AND THIS IS DISABLED, YOUR STRUCTURES MAY FALL APART - USE WITH CARE. Maybe use the AutoRun functionality?" },
			{ "/optterrain", "- Optimize old terrain modifications" },
			{ "/portals", "- List all portal tags" },
			{ "/removedrops", "- Removes items from the ground" },
			{ "/resetwind", "- If wind has been set, this will allow the game to take control of the wind again" },
			{ "/repair", "- Repair your inventory" },
			{ "/resetmap", "- Reset the map exploration" },
			{ "/revealmap", "- Reveals the entire minimap" },
			{ "/q", "- Quickly exit the game. Commands are sometimes just more convenient." },
			{ "/seed", "- Reveals the map seed" },
			{ "/set cw", "[Weight] - Set your weight limit (default 300)" },
			{ "/set difficulty", "[Player Count] - Set the difficulty (default is number of connected players)" },
			{ "/set exploreradius", "[Radius=100] - Set the explore radius" },
			{ "/set jumpforce", "[Force] - Set jump force (default 10). Careful if you fall too far!" },
			{ "/set pickup", "[Radius] - Set your auto pickup radius (default 2)" },
			{ "/set skill", "[Skill] [Level] - Set your skill level" },
			{ "/set speed", "[Speed Type] [Speed] - Speed Types: crouch (def: 2), run (def: 7), swim (def: 2)" },
			{ "/td", "[Radius=5] [Height=1] - Dig nearby terrain. Radius 30 max." },
			{ "/tl", "[Radius=5] - Level nearby terrain. Radius 30 max." },
			{ "/tr", "[Radius=5] [Height=1] - Raise nearby terrain. Radius 30 max." },
			{ "/tu", "[Radius=5] - Undo terrain modifications around you. Radius 50 max." },
			{ "/spawn", "[Creature Name] [Level=1] - Spawns a creature or prefab in front of you. Capitals in name matter! Ex. /spawn Boar 3 (use /give for items!)" },
			{ "/spawntamed", "[Creature Name] [Level=1] - Spawns a tamed creature in front of you. Capitals in name matter! Ex. /spawntamed Boar 3" },
			{ "/stopevent", "- Stops a current event" },
			{ "/tame", "- Tame all nearby creatures" },
			{ "/tod", "[0-1] - Set (and lock) time of day (-1 to unlock time) - Ex. /tod 0.5" },
			{ "/tp", "[X,Y] - Teleport you to the coords provided" },
			{ "/wind", "[Angle] [Intensity] - Set the wind direction and intensity" },
			{ "/whois", "- List all players" }
		};

		internal static bool MenuFeedbackActive = false;

		internal static bool MenuFeedbackShown = false;

		internal static ModConsole ConsoleOpt
		{
			get
			{
				return consoleOpt;
			}
			set
			{
				consoleOpt = value;
			}
		}

		internal static void ApplyInfStamina(Player lp, bool applyOffValues)
		{
			if (!((Object)(object)lp == (Object)null))
			{
				if (infStamina)
				{
					lp.m_staminaRegenDelay = 0.05f;
					lp.m_staminaRegen = 999f;
					lp.m_runStaminaDrain = 0f;
					lp.m_encumberedStaminaDrain = 0f;
					lp.m_swimStaminaDrainMinSkill = 0f;
					lp.m_swimStaminaDrainMaxSkill = 0f;
					lp.m_sneakStaminaDrain = 0f;
				}
				else if (applyOffValues)
				{
					lp.m_staminaRegenDelay = 1f;
					lp.m_staminaRegen = 5f;
					lp.m_runStaminaDrain = 10f;
					lp.m_encumberedStaminaDrain = 10f;
					lp.m_swimStaminaDrainMinSkill = 5f;
					lp.m_swimStaminaDrainMaxSkill = 2f;
					lp.m_sneakStaminaDrain = 5f;
				}
			}
		}

		internal static void ApplyInfEitr(Player lp, bool applyOffValues)
		{
			if (!((Object)(object)lp == (Object)null))
			{
				if (!eitrBaselineTaken)
				{
					eitrBaselineTaken = true;
					baseEitrRegen = lp.m_eiterRegen;
					baseEitrRegenDelay = lp.m_eitrRegenDelay;
				}
				if (infEitr)
				{
					lp.m_eiterRegen = 999f;
					lp.m_eitrRegenDelay = 0.05f;
				}
				else if (applyOffValues)
				{
					lp.m_eiterRegen = baseEitrRegen;
					lp.m_eitrRegenDelay = baseEitrRegenDelay;
				}
			}
		}

		internal static void CaptureTuningBaseline(Player lp)
		{
			if (!((Object)(object)lp == (Object)null) && !tuningBaselineTaken)
			{
				tuningBaselineTaken = true;
				baseCarry = lp.m_maxCarryWeight;
				basePickup = lp.m_autoPickupRange;
				baseJump = ((Character)lp).m_jumpForce;
				baseRun = ((Character)lp).m_runSpeed;
				baseSwim = ((Character)lp).m_swimSpeed;
				baseExplore = (((Object)(object)Minimap.instance != (Object)null) ? Minimap.instance.m_exploreRadius : 100f);
			}
		}

		internal static void ApplyTuning(Player lp)
		{
			if (!((Object)(object)lp == (Object)null))
			{
				CaptureTuningBaseline(lp);
				if (noCarryLimit)
				{
					lp.m_maxCarryWeight = 99999f;
				}
				else if (carryWeight > 0)
				{
					lp.m_maxCarryWeight = carryWeight;
				}
				if (pickupRange > 0)
				{
					lp.m_autoPickupRange = pickupRange;
				}
				if (jumpForce > 0)
				{
					((Character)lp).m_jumpForce = jumpForce;
				}
				if (runSpeed > 0)
				{
					((Character)lp).m_runSpeed = runSpeed;
				}
				if (swimSpeed > 0)
				{
					((Character)lp).m_swimSpeed = swimSpeed;
				}
				if (exploreRadius > 0 && (Object)(object)Minimap.instance != (Object)null)
				{
					Minimap.instance.m_exploreRadius = exploreRadius;
				}
			}
		}

		internal static void RestoreCarryBaseline(Player lp)
		{
			if (!((Object)(object)lp == (Object)null) && tuningBaselineTaken)
			{
				lp.m_maxCarryWeight = baseCarry;
			}
		}

		internal static void ResetTuning(Player lp)
		{
			noCarryLimit = false;
			carryWeight = 0;
			pickupRange = 0;
			jumpForce = 0;
			runSpeed = 0;
			swimSpeed = 0;
			exploreRadius = 0;
			if (!((Object)(object)lp == (Object)null) && tuningBaselineTaken)
			{
				lp.m_maxCarryWeight = baseCarry;
				lp.m_autoPickupRange = basePickup;
				((Character)lp).m_jumpForce = baseJump;
				((Character)lp).m_runSpeed = baseRun;
				((Character)lp).m_swimSpeed = baseSwim;
				if ((Object)(object)Minimap.instance != (Object)null)
				{
					Minimap.instance.m_exploreRadius = baseExplore;
				}
			}
		}

		internal static void ApplyFarInteract(Player lp, bool applyOffValues)
		{
			if (!((Object)(object)lp == (Object)null))
			{
				if (farInteract)
				{
					lp.m_maxInteractDistance = farInteractDistance;
					lp.m_maxPlaceDistance = farInteractDistance;
				}
				else if (applyOffValues)
				{
					lp.m_maxInteractDistance = 5f;
					lp.m_maxPlaceDistance = 5f;
				}
			}
		}

		internal static void SnapshotOnDeath(Player lp)
		{
			if (!((Object)(object)lp == (Object)null))
			{
				godEnabled = ((Character)lp).InGodMode();
				flyEnabled = ((Character)lp).IsDebugFlying();
				noCostEnabled = lp.NoCostCheat();
				ghostEnabled = ((Character)lp).InGhostMode();
			}
		}

		internal static void ReapplyOnSpawn(Player lp)
		{
			if ((Object)(object)lp == (Object)null)
			{
				return;
			}
			if (SkConfigEntry.CPersistCheatsOnDeath != null && !SkConfigEntry.CPersistCheatsOnDeath.Value)
			{
				infStamina = false;
				farInteract = false;
				godEnabled = false;
				flyEnabled = false;
				noCostEnabled = false;
				ghostEnabled = false;
				infEitr = false;
				immuneTo.Clear();
				return;
			}
			ApplyInfStamina(lp, applyOffValues: false);
			ApplyInfEitr(lp, applyOffValues: false);
			ApplyFarInteract(lp, applyOffValues: false);
			ApplyTuning(lp);
			if (ghostEnabled && !((Character)lp).InGhostMode())
			{
				lp.SetGhostMode(true);
			}
			if (godEnabled && !((Character)lp).InGodMode())
			{
				lp.SetGodMode(true);
			}
			if (noCostEnabled && !lp.NoCostCheat())
			{
				lp.SetNoPlacementCost(true);
			}
			if (flyEnabled && !((Character)lp).IsDebugFlying())
			{
				ZNetView component = ((Component)lp).GetComponent<ZNetView>();
				if ((Object)(object)component != (Object)null && component.IsValid())
				{
					lp.ToggleDebugFly();
				}
			}
			Player.m_debugMode = Player.m_debugMode || flyEnabled || noCostEnabled || SkCommandPatcher.BCheat;
		}

		public static void Announce()
		{
			if ((SkConfigEntry.CScrollable != null) & !SkConfigEntry.CScrollable.Value)
			{
				if (SkVersionChecker.VersionCurrent())
				{
					PrintOut("====  Toolbox (" + SkVersionChecker.currentVersion?.ToString() + ") by Skrip (DS) is enabled.\t\t====", LogTo.Console);
				}
				else
				{
					PrintOut("Toolbox by Skrip (DS) is enabled.", LogTo.Console);
					PrintOut("New Version Available on NexusMods!\t► Current: " + SkVersionChecker.currentVersion?.ToString() + " Latest: " + SkVersionChecker.latestVersion, LogTo.DebugConsole);
				}
				PrintOut("====  Press numpad 0 to open on-screen menu or type /? 1\t====", LogTo.Console);
			}
			try
			{
				commandList = commandList.OrderBy((KeyValuePair<string, string> obj) => obj.Key).ToDictionary((KeyValuePair<string, string> obj) => obj.Key, (KeyValuePair<string, string> obj) => obj.Value);
				SkCommandPatcher.InitPatch();
			}
			catch (Exception)
			{
			}
		}

		public static string DecomposeAlias(string inCommand)
		{
			string[] array = inCommand.Split(new char[1] { ';' });
			string text = inCommand;
			if ((Object)(object)ConsoleOpt != (Object)null && ConsoleOpt.AliasList != null && ConsoleOpt.AliasList.Count > 0)
			{
				for (int i = 0; i < array.Length; i++)
				{
					if (!string.IsNullOrEmpty(array[i]))
					{
						array[i] = array[i].Trim();
					}
					if (Enumerable.Contains(ConsoleOpt.AliasList.Keys, array[i]))
					{
						string value = string.Empty;
						ConsoleOpt.AliasList.TryGetValue(array[i], out value);
						value = value.Trim();
						if (value.EndsWith(";"))
						{
							value = value.Substring(0, value.Length - 1);
						}
						array[i] = value;
					}
				}
				text = string.Empty;
				string[] array2 = array;
				foreach (string text2 in array2)
				{
					text = ((array.Length <= 1) ? (text + text2) : (text + text2 + ";"));
				}
			}
			return text;
		}

		public static void ProcessCommands(string inCommand, LogTo source, GameObject go = null)
		{
			if (string.IsNullOrEmpty(inCommand))
			{
				return;
			}
			if ((Object)(object)Console.instance != (Object)null)
			{
				List<string> privateField = Console.instance.GetPrivateField<List<string>>("m_history");
				if (privateField != null)
				{
					if (privateField.Count == 0 || privateField[privateField.Count - 1] != inCommand)
					{
						privateField.Add(inCommand);
					}
					Console.instance.SetPrivateField("m_historyPosition", privateField.Count);
				}
			}
			inCommand = inCommand.Trim();
			inCommand = DecomposeAlias(inCommand);
			string[] array = inCommand.Split(new char[1] { ';' });
			string[] array2 = array;
			foreach (string text in array2)
			{
				string text2 = text.Trim();
				if (!string.IsNullOrEmpty(text2))
				{
					((Terminal)Console.instance).TryRunCommand(text2, false, false);
				}
			}
			((TMP_InputField)((Terminal)Console.instance).m_input).text = string.Empty;
		}

		public static void InitCommands()
		{
			//IL_0043: 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_0039: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00ee: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Expected O, but got Unknown
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Expected O, but got Unknown
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Expected O, but got Unknown
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Expected O, but got Unknown
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Expected O, but got Unknown
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Expected O, but got Unknown
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Expected O, but got Unknown
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Expected O, but got Unknown
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0402: Expected O, but got Unknown
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Expected O, but got Unknown
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Expected O, but got Unknown
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Expected O, but got Unknown
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Expected O, but got Unknown
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_054d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Expected O, but got Unknown
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Expected O, but got Unknown
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ca: Expected O, but got Unknown
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Expected O, but got Unknown
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Expected O, but got Unknown
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_066a: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Expected O, but got Unknown
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_