Decompiled source of Shortcuts v1.6.0

Shortcuts.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ComfyLib;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Shortcuts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Shortcuts")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("149d97c3-4482-49c6-ab51-74f0164d425a")]
[assembly: AssemblyFileVersion("1.6.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.6.0.0")]
[module: UnverifiableCode]
namespace ComfyLib
{
	public static class ConfigFileExtensions
	{
		internal sealed class ConfigurationManagerAttributes
		{
			public Action<ConfigEntryBase> CustomDrawer;

			public bool? Browsable;

			public bool? HideDefaultButton;

			public int? Order;
		}

		private static readonly Dictionary<string, int> _sectionToSettingOrder = new Dictionary<string, int>();

		private static int GetSettingOrder(string section)
		{
			if (!_sectionToSettingOrder.TryGetValue(section, out var value))
			{
				value = 0;
			}
			_sectionToSettingOrder[section] = value - 1;
			return value;
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = GetSettingOrder(section)
				}
			}));
		}

		public static ConfigEntry<T> BindInOrder<T>(this ConfigFile config, string section, string key, T defaultValue, string description, Action<ConfigEntryBase> customDrawer = null, bool browsable = true, bool hideDefaultButton = false, bool hideSettingName = false)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			return config.Bind<T>(section, key, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Browsable = browsable,
					CustomDrawer = customDrawer,
					HideDefaultButton = hideDefaultButton,
					Order = GetSettingOrder(section)
				}
			}));
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action settingChangedHandler)
		{
			configEntry.SettingChanged += delegate
			{
				settingChangedHandler();
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<T> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((T)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}

		public static void OnSettingChanged<T>(this ConfigEntry<T> configEntry, Action<ConfigEntry<T>> settingChangedHandler)
		{
			configEntry.SettingChanged += delegate(object _, EventArgs eventArgs)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				settingChangedHandler((ConfigEntry<T>)((SettingChangedEventArgs)eventArgs).ChangedSetting.BoxedValue);
			};
		}
	}
}
namespace Shortcuts
{
	public sealed class ShortcutConfigEntry
	{
		public readonly ConfigEntry<KeyboardShortcut> BaseConfigEntry;

		private KeyboardShortcut _shortcut = KeyboardShortcut.Empty;

		private KeyCode _mainKey;

		private KeyCode[] _modifierKeys = (KeyCode[])(object)new KeyCode[0];

		private int _modifierKeyCount;

		public ShortcutConfigEntry(ConfigEntry<KeyboardShortcut> configEntry)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			BaseConfigEntry = configEntry;
			BaseConfigEntry.SettingChanged += OnSettingChanged;
			SetShortcut(BaseConfigEntry.Value);
		}

		private void OnSettingChanged(object sender, EventArgs eventArgs)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			SetShortcut(((ConfigEntry<KeyboardShortcut>)(object)((SettingChangedEventArgs)eventArgs).ChangedSetting).Value);
		}

		public void SetShortcut(KeyboardShortcut shortcut)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			_shortcut = shortcut;
			_mainKey = ((KeyboardShortcut)(ref _shortcut)).MainKey;
			_modifierKeys = ((KeyboardShortcut)(ref _shortcut)).Modifiers.ToArray();
			_modifierKeyCount = _modifierKeys.Length;
		}

		public bool IsKeyDown()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			if (!ZInput.m_instance.Input_GetKeyDown(_mainKey, false))
			{
				return false;
			}
			if (_modifierKeyCount > 0)
			{
				for (int i = 0; i < _modifierKeyCount; i++)
				{
					if (!ZInput.m_instance.Input_GetKey(_modifierKeys[i], true))
					{
						return false;
					}
				}
			}
			return true;
		}
	}
	public static class CodeMatcherExtensions
	{
		public static readonly CodeMatch ZInputGetButtonDown = new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(ZInput), "GetButtonDown", new Type[1] { typeof(string) }, (Type[])null), (string)null);

		public static readonly CodeMatch ZInputGetKeyDownMatch = new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(ZInput), "GetKeyDown", new Type[2]
		{
			typeof(KeyCode),
			typeof(bool)
		}, (Type[])null), (string)null);

		public static readonly CodeMatch ZInputGetKeyMatch = new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(ZInput), "GetKey", new Type[2]
		{
			typeof(KeyCode),
			typeof(bool)
		}, (Type[])null), (string)null);

		public static CodeMatcher MatchGetButtonDown(this CodeMatcher matcher, string keyName)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			return matcher.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldstr, (object)keyName, (string)null),
				ZInputGetButtonDown
			}).ThrowIfInvalid("Could not patch ZInput.GetButtonDown() for Key: " + keyName).Advance(1);
		}

		public static CodeMatcher MatchGetKeyDown(this CodeMatcher matcher, int key)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			return matcher.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				(key > 127) ? new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)key, (string)null) : new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)Convert.ToSByte(key), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
				ZInputGetKeyDownMatch
			}).ThrowIfInvalid($"Could not patch ZInput.GetKeyDown() for Key: {key}!").Advance(2);
		}

		public static CodeMatcher MatchGetKey(this CodeMatcher matcher, int key)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			return matcher.MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
			{
				(key > 127) ? new CodeMatch((OpCode?)OpCodes.Ldc_I4, (object)key, (string)null) : new CodeMatch((OpCode?)OpCodes.Ldc_I4_S, (object)Convert.ToSByte(key), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
				ZInputGetKeyMatch
			}).ThrowIfInvalid($"Could not patch ZInput.GetKey() for Key: {key}!").Advance(2);
		}
	}
	[HarmonyPatch(typeof(ConnectPanel))]
	internal static class ConnectPanelPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("Update")]
		private static IEnumerable<CodeInstruction> UpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetKeyDown(new CodeMatcher(instructions, (ILGenerator)null), 283).SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)ToggleConnectPanelDelegate)).InstructionEnumeration();
		}

		private static bool ToggleConnectPanelDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.ToggleConnectPanelShortcut.IsKeyDown();
		}
	}
	[HarmonyPatch(typeof(Console))]
	internal static class ConsolePatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("Update")]
		private static IEnumerable<CodeInstruction> UpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetButtonDown(new CodeMatcher(instructions, (ILGenerator)null), "Console").SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)ToggleConsoleDelgate)).InstructionEnumeration();
		}

		private static bool ToggleConsoleDelgate(string name)
		{
			return PluginConfig.ToggleConsoleShortcut.IsKeyDown();
		}
	}
	[HarmonyPatch(typeof(FejdStartup))]
	internal static class FejdStartupPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("LateUpdate")]
		private static IEnumerable<CodeInstruction> LateUpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetKeyDown(new CodeMatcher(instructions, (ILGenerator)null), 292).SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)TakeScreenshotDelegate)).InstructionEnumeration();
		}

		private static bool TakeScreenshotDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.TakeScreenshotShortcut.IsKeyDown();
		}
	}
	[HarmonyPatch(typeof(GameCamera))]
	internal static class GameCameraPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("LateUpdate")]
		private static IEnumerable<CodeInstruction> LateUpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetKeyDown(new CodeMatcher(instructions, (ILGenerator)null), 292).SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)TakeScreenshotDelegate)).InstructionEnumeration();
		}

		private static bool TakeScreenshotDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.TakeScreenshotShortcut.IsKeyDown();
		}

		[HarmonyTranspiler]
		[HarmonyPatch("UpdateMouseCapture")]
		private static IEnumerable<CodeInstruction> UpdateMouseCaptureTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetKey(new CodeMatcher(instructions, (ILGenerator)null), 306).SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)IgnoreKeyDelegate)).MatchGetKeyDown(282)
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)ToggleMouseCaptureDelegate))
				.InstructionEnumeration();
		}

		private static bool ToggleMouseCaptureDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.ToggleMouseCaptureShortcut.IsKeyDown();
		}

		private static bool IgnoreKeyDelegate(KeyCode key, bool logWarning)
		{
			return true;
		}
	}
	[HarmonyPatch(typeof(Hud))]
	internal static class HudPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("Update")]
		private static IEnumerable<CodeInstruction> UpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetKeyDown(new CodeMatcher(instructions, (ILGenerator)null), 284).SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)ToggleHudDelegate)).MatchGetKey(306)
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)IgnoreKeyDelegate))
				.InstructionEnumeration();
		}

		private static bool ToggleHudDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.ToggleHudShortcut.IsKeyDown();
		}

		private static bool IgnoreKeyDelegate(KeyCode key, bool logWarning)
		{
			return true;
		}
	}
	[HarmonyPatch(typeof(Player))]
	internal static class PlayerPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("Update")]
		private static IEnumerable<CodeInstruction> UpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			return CodeMatcherExtensions.MatchGetKeyDown(new CodeMatcher(instructions, (ILGenerator)null), 122).SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)ToggleDebugFlyDelegate)).MatchGetKeyDown(98)
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)ToggleDebugNoCostDelegate))
				.MatchGetKeyDown(107)
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)DebugKillAllDelegate))
				.MatchGetKeyDown(108)
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<KeyCode, bool, bool>>((Func<KeyCode, bool, bool>)DebugRemoveDropsDelegate))
				.MatchGetButtonDown("Hotbar1")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem1Delegate))
				.MatchGetButtonDown("Hotbar2")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem2Delegate))
				.MatchGetButtonDown("Hotbar3")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem3Delegate))
				.MatchGetButtonDown("Hotbar4")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem4Delegate))
				.MatchGetButtonDown("Hotbar5")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem5Delegate))
				.MatchGetButtonDown("Hotbar6")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem6Delegate))
				.MatchGetButtonDown("Hotbar7")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem7Delegate))
				.MatchGetButtonDown("Hotbar8")
				.SetInstructionAndAdvance(Transpilers.EmitDelegate<Func<string, bool>>((Func<string, bool>)HotbarItem8Delegate))
				.InstructionEnumeration();
		}

		private static bool ToggleDebugFlyDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.ToggleDebugFlyShortcut.IsKeyDown();
		}

		private static bool ToggleDebugNoCostDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.ToggleDebugNoCostShortcut.IsKeyDown();
		}

		private static bool DebugKillAllDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.DebugKillAllShortcut.IsKeyDown();
		}

		private static bool DebugRemoveDropsDelegate(KeyCode key, bool logWarning)
		{
			return PluginConfig.DebugRemoveDropsShortcut.IsKeyDown();
		}

		private static bool HotbarItem1Delegate(string name)
		{
			return PluginConfig.HotbarItem1Shortcut.IsKeyDown();
		}

		private static bool HotbarItem2Delegate(string name)
		{
			return PluginConfig.HotbarItem2Shortcut.IsKeyDown();
		}

		private static bool HotbarItem3Delegate(string name)
		{
			return PluginConfig.HotbarItem3Shortcut.IsKeyDown();
		}

		private static bool HotbarItem4Delegate(string name)
		{
			return PluginConfig.HotbarItem4Shortcut.IsKeyDown();
		}

		private static bool HotbarItem5Delegate(string name)
		{
			return PluginConfig.HotbarItem5Shortcut.IsKeyDown();
		}

		private static bool HotbarItem6Delegate(string name)
		{
			return PluginConfig.HotbarItem6Shortcut.IsKeyDown();
		}

		private static bool HotbarItem7Delegate(string name)
		{
			return PluginConfig.HotbarItem7Shortcut.IsKeyDown();
		}

		private static bool HotbarItem8Delegate(string name)
		{
			return PluginConfig.HotbarItem8Shortcut.IsKeyDown();
		}
	}
	public static class PluginConfig
	{
		public static ConfigEntry<bool> IsModEnabled { get; private set; }

		public static ShortcutConfigEntry ToggleConsoleShortcut { get; private set; }

		public static ShortcutConfigEntry ToggleHudShortcut { get; private set; }

		public static ShortcutConfigEntry ToggleConnectPanelShortcut { get; private set; }

		public static ShortcutConfigEntry TakeScreenshotShortcut { get; private set; }

		public static ShortcutConfigEntry ToggleMouseCaptureShortcut { get; private set; }

		public static ShortcutConfigEntry ToggleDebugFlyShortcut { get; private set; }

		public static ShortcutConfigEntry ToggleDebugNoCostShortcut { get; private set; }

		public static ShortcutConfigEntry DebugKillAllShortcut { get; private set; }

		public static ShortcutConfigEntry DebugRemoveDropsShortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem1Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem2Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem3Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem4Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem5Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem6Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem7Shortcut { get; private set; }

		public static ShortcutConfigEntry HotbarItem8Shortcut { get; private set; }

		public static void BindConfig(ConfigFile config)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod (restart required).");
			ToggleConsoleShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Console", "toggleConsoleShortcut", new KeyboardShortcut((KeyCode)286, Array.Empty<KeyCode>()), "Shortcut to toggle the Console on/off."));
			ToggleHudShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hud", "toggleHudShortcut", new KeyboardShortcut((KeyCode)284, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "Shortcut to toggle the Hud on/off."));
			ToggleConnectPanelShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("ConnectPanel", "toggleConnectPanelShortcut", new KeyboardShortcut((KeyCode)283, Array.Empty<KeyCode>()), "Shortcut to toggle the ConnectPanel on/off."));
			TakeScreenshotShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("GameCamera", "takeScreenshotShortcut", new KeyboardShortcut((KeyCode)292, Array.Empty<KeyCode>()), "Shortcut to take a screenshot."));
			ToggleMouseCaptureShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("GameCamera", "toggleMouseCaptureShortcut", new KeyboardShortcut((KeyCode)282, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "Shortcut to toggle mouse capture from the GameCamera."));
			ToggleDebugFlyShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Debugmode", "toggleDebugFlyShortcut", new KeyboardShortcut((KeyCode)122, Array.Empty<KeyCode>()), "Shortcut to toggle flying when in debugmode."));
			ToggleDebugNoCostShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Debugmode", "toggleDebugNoCostShortcut", new KeyboardShortcut((KeyCode)98, Array.Empty<KeyCode>()), "Shortcut to toggle no-cost building when in debugmode."));
			DebugKillAllShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Debugmode", "debugKillAllShortcut", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Shortcut to kill/damage all mobs around player. Unbound by default."));
			DebugRemoveDropsShortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Debugmode", "debugRemoveDropsShortcut", new KeyboardShortcut((KeyCode)0, Array.Empty<KeyCode>()), "Shortcut to 'removedrops' command. Unbound by default."));
			HotbarItem1Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem1Shortcut", new KeyboardShortcut((KeyCode)49, Array.Empty<KeyCode>()), "Shortcut for the first slot in the Hotbar."));
			HotbarItem2Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem2Shortcut", new KeyboardShortcut((KeyCode)50, Array.Empty<KeyCode>()), "Shortcut for the second slot in the Hotbar."));
			HotbarItem3Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem3Shortcut", new KeyboardShortcut((KeyCode)51, Array.Empty<KeyCode>()), "Shortcut for the third slot in the Hotbar."));
			HotbarItem4Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem4Shortcut", new KeyboardShortcut((KeyCode)52, Array.Empty<KeyCode>()), "Shortcut for the fourth slot in the Hotbar."));
			HotbarItem5Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem5Shortcut", new KeyboardShortcut((KeyCode)53, Array.Empty<KeyCode>()), "Shortcut for the fifth slot in the Hotbar."));
			HotbarItem6Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem6Shortcut", new KeyboardShortcut((KeyCode)54, Array.Empty<KeyCode>()), "Shortcut for the sixth slot in the Hotbar."));
			HotbarItem7Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem7Shortcut", new KeyboardShortcut((KeyCode)55, Array.Empty<KeyCode>()), "Shortcut for the seventh slot in the Hotbar."));
			HotbarItem8Shortcut = new ShortcutConfigEntry(config.BindInOrder<KeyboardShortcut>("Hotbar", "hotbarItem8Shortcut", new KeyboardShortcut((KeyCode)56, Array.Empty<KeyCode>()), "Shortcut for the eight slot in the Hotbar."));
		}
	}
	[BepInPlugin("redseiko.valheim.shortcuts", "Shortcuts", "1.6.0")]
	public sealed class Shortcuts : BaseUnityPlugin
	{
		public const string PluginGUID = "redseiko.valheim.shortcuts";

		public const string PluginName = "Shortcuts";

		public const string PluginVersion = "1.6.0";

		private Harmony _harmony;

		private void Awake()
		{
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
			if (PluginConfig.IsModEnabled.Value)
			{
				_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.shortcuts");
			}
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}