Decompiled source of WeaponVariantBinds v1.1.3

WeaponVariantBinds.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WeaponVariantBinds")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WeaponVariantBinds")]
[assembly: AssemblyTitle("WeaponVariantBinds")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WeaponVariantBinds
{
	[BepInPlugin("WeaponVariantBinds", "WeaponVariantBinds", "0.01")]
	public class Plugin : BaseUnityPlugin
	{
		public static bool modEnabled = true;

		public static GameObject weapon = null;

		public static bool scrollEnabled = false;

		public static bool scrollVariation = false;

		public static bool scrollReversed = false;

		public static bool scrollWeapons = false;

		private WeaponCycle[] wcArray = new WeaponCycle[2];

		private int newSlot = -1;

		private int newVariation = -1;

		public static int tickCount = 0;

		public static int tickCountUpdateVanillaWeaponCycles = 0;

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			PluginConfig.InitVanillaWeaponCycles();
			PluginConfig.WeaponVariantBindsConfig();
			wcArray[0] = PluginConfig.vanillaWeaponCycles[1];
			wcArray[1] = PluginConfig.vanillaWeaponCycles[0];
			Harmony val = new Harmony("WeaponVariantBinds");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin WeaponVariantBinds is loaded!");
		}

		public static bool IsGameplayScene()
		{
			string[] source = new string[6] { "Intro", "Bootstrap", "Main Menu", "Level 2-S", "Intermission1", "Intermission2" };
			if (SceneHelper.CurrentScene == null)
			{
				return false;
			}
			return !source.Contains(SceneHelper.CurrentScene);
		}

		public static bool IsMenu()
		{
			if ((Object)(object)MonoSingleton<OptionsManager>.Instance != (Object)null && !MonoSingleton<OptionsManager>.Instance.paused && !MonoSingleton<FistControl>.Instance.shopping && (Object)(object)GameStateManager.Instance != (Object)null && !GameStateManager.Instance.PlayerInputLocked)
			{
				return false;
			}
			return true;
		}

		public void SwitchToNextCustomSlot()
		{
			WeaponCycle weaponCycle = wcArray[1];
			int num = 0;
			if (weaponCycle == PluginConfig.vanillaWeaponCycles[0])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[1];
			}
			else if (weaponCycle == PluginConfig.vanillaWeaponCycles[1])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[2];
			}
			else if (weaponCycle == PluginConfig.vanillaWeaponCycles[2])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[3];
			}
			else if (weaponCycle == PluginConfig.vanillaWeaponCycles[3])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[4];
			}
			else
			{
				int num2 = 0;
				while (true)
				{
					if (num2 < PluginConfig.numWeaponCyclesActive)
					{
						if (weaponCycle == PluginConfig.weaponCycles[num2])
						{
							num = num2 + 1;
							if (num >= PluginConfig.numWeaponCyclesActive - 1)
							{
								wcArray[0] = wcArray[1];
								wcArray[1] = PluginConfig.vanillaWeaponCycles[0];
								break;
							}
						}
						num2++;
						continue;
					}
					for (int i = 0; i < PluginConfig.numWeaponCyclesActive; i++)
					{
						bool flag = true;
						for (int j = 0; j < PluginConfig.weaponCycles[num].weaponEnums.Length; j++)
						{
							if (PluginConfig.weaponCycles[num].weaponEnums[j] != 0)
							{
								flag = false;
							}
						}
						if (flag)
						{
							num++;
							if (num >= PluginConfig.numWeaponCyclesActive)
							{
								num = 0;
							}
							continue;
						}
						break;
					}
					wcArray[0] = wcArray[1];
					wcArray[1] = PluginConfig.weaponCycles[num];
					break;
				}
			}
			WeaponCycle weaponCycle2 = wcArray[1];
			if (!weaponCycle2.rememberVariation)
			{
				weaponCycle2.currentIndex = 0;
			}
			for (int k = 0; k < weaponCycle2.weaponEnums.Length; k++)
			{
				if (weaponCycle2.weaponEnums[weaponCycle2.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle2.ignoreInCycle[weaponCycle2.currentIndex])
				{
					weaponCycle2.currentIndex++;
				}
				if (weaponCycle2.currentIndex >= weaponCycle2.weaponEnums.Length)
				{
					weaponCycle2.currentIndex = 0;
				}
			}
			int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]);
			newSlot = array[0];
			newVariation = array[1];
		}

		public void SwitchToPrevCustomSlot()
		{
			WeaponCycle weaponCycle = wcArray[1];
			int num = PluginConfig.numWeaponCyclesActive - 1;
			if (weaponCycle == PluginConfig.vanillaWeaponCycles[4])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[3];
			}
			else if (weaponCycle == PluginConfig.vanillaWeaponCycles[3])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[2];
			}
			else if (weaponCycle == PluginConfig.vanillaWeaponCycles[2])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[1];
			}
			else if (weaponCycle == PluginConfig.vanillaWeaponCycles[1])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = PluginConfig.vanillaWeaponCycles[0];
			}
			else
			{
				int num2 = PluginConfig.weaponCycles.Length - 1;
				while (true)
				{
					if (num2 >= 0)
					{
						if (weaponCycle == PluginConfig.weaponCycles[num2])
						{
							num = num2 - 1;
							if (num < 0)
							{
								wcArray[0] = wcArray[1];
								wcArray[1] = PluginConfig.vanillaWeaponCycles[4];
								break;
							}
						}
						num2 += -1;
						continue;
					}
					for (int i = PluginConfig.weaponCycles.Length - 1; i >= 0; i += -1)
					{
						bool flag = true;
						for (int j = 0; j < PluginConfig.weaponCycles[num].weaponEnums.Length; j++)
						{
							if (PluginConfig.weaponCycles[num].weaponEnums[j] != 0)
							{
								flag = false;
							}
						}
						if (flag)
						{
							num += -1;
							if (num < 0)
							{
								num = PluginConfig.numWeaponCyclesActive - 1;
							}
							continue;
						}
						break;
					}
					wcArray[0] = wcArray[1];
					wcArray[1] = PluginConfig.weaponCycles[num];
					break;
				}
			}
			WeaponCycle weaponCycle2 = wcArray[1];
			if (!weaponCycle2.rememberVariation)
			{
				weaponCycle2.currentIndex = 0;
			}
			for (int k = 0; k < weaponCycle2.weaponEnums.Length; k++)
			{
				if (weaponCycle2.weaponEnums[weaponCycle2.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle2.ignoreInCycle[weaponCycle2.currentIndex])
				{
					weaponCycle2.currentIndex++;
				}
				if (weaponCycle2.currentIndex >= weaponCycle2.weaponEnums.Length)
				{
					weaponCycle2.currentIndex = 0;
				}
			}
			int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]);
			newSlot = array[0];
			newVariation = array[1];
		}

		public void VariationBindLogic()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			WeaponCycle weaponCycle = wcArray[1];
			if (weaponCycle == null)
			{
				return;
			}
			WeaponActions val = MonoSingleton<InputManager>.Instance.InputSource.Actions.Weapon;
			if (((WeaponActions)(ref val)).VariationSlot1.WasPressedThisFrame())
			{
				weaponCycle.currentIndex = 0;
				for (int i = 0; i < weaponCycle.weaponEnums.Length; i++)
				{
					if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None)
					{
						weaponCycle.currentIndex++;
					}
					if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length)
					{
						weaponCycle.currentIndex = 0;
					}
				}
				int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
				newSlot = array[0];
				newVariation = array[1];
			}
			val = MonoSingleton<InputManager>.Instance.InputSource.Actions.Weapon;
			if (((WeaponActions)(ref val)).VariationSlot2.WasPressedThisFrame())
			{
				weaponCycle.currentIndex = 1;
				for (int j = 0; j < weaponCycle.weaponEnums.Length; j++)
				{
					if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None)
					{
						weaponCycle.currentIndex++;
					}
					if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length)
					{
						weaponCycle.currentIndex = 0;
					}
				}
				int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
				newSlot = array2[0];
				newVariation = array2[1];
			}
			val = MonoSingleton<InputManager>.Instance.InputSource.Actions.Weapon;
			if (((WeaponActions)(ref val)).VariationSlot3.WasPressedThisFrame())
			{
				weaponCycle.currentIndex = 2;
				for (int k = 0; k < weaponCycle.weaponEnums.Length; k++)
				{
					if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None)
					{
						weaponCycle.currentIndex++;
					}
					if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length)
					{
						weaponCycle.currentIndex = 0;
					}
				}
				int[] array3 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
				newSlot = array3[0];
				newVariation = array3[1];
			}
			for (int l = 3; l < 100; l++)
			{
				if (!Input.GetKeyDown(PluginConfig.variationBinds[l]))
				{
					continue;
				}
				weaponCycle.currentIndex = l;
				for (int m = 0; m < weaponCycle.weaponEnums.Length; m++)
				{
					if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None)
					{
						weaponCycle.currentIndex++;
					}
					if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length)
					{
						weaponCycle.currentIndex = 0;
					}
				}
				int[] array4 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
				newSlot = array4[0];
				newVariation = array4[1];
			}
		}

		public void ScrollLogic()
		{
			WeaponCycle weaponCycle = wcArray[1];
			if (wcArray[1] == null)
			{
				return;
			}
			if (MonoSingleton<PrefsManager>.Instance.prefMap.ContainsKey("scrollEnabled"))
			{
				scrollEnabled = (bool)MonoSingleton<PrefsManager>.Instance.prefMap["scrollEnabled"];
			}
			if (MonoSingleton<PrefsManager>.Instance.prefMap.ContainsKey("scrollVariations"))
			{
				scrollVariation = (bool)MonoSingleton<PrefsManager>.Instance.prefMap["scrollVariations"];
			}
			if (MonoSingleton<PrefsManager>.Instance.prefMap.ContainsKey("scrollReversed"))
			{
				scrollReversed = (bool)MonoSingleton<PrefsManager>.Instance.prefMap["scrollReversed"];
			}
			if (MonoSingleton<PrefsManager>.Instance.prefMap.ContainsKey("scrollWeapons"))
			{
				scrollWeapons = (bool)MonoSingleton<PrefsManager>.Instance.prefMap["scrollWeapons"];
			}
			float num = 1f;
			if (scrollReversed)
			{
				num = -1f;
			}
			float num2 = Input.GetAxis("Mouse ScrollWheel") * num;
			if (scrollEnabled && scrollVariation)
			{
				if (num2 >= 0.1f)
				{
					weaponCycle.currentIndex++;
					for (int i = 0; i < weaponCycle.weaponEnums.Length; i++)
					{
						if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length)
						{
							weaponCycle.currentIndex = 0;
							if (scrollWeapons)
							{
								SwitchToNextCustomSlot();
								break;
							}
						}
						if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex])
						{
							weaponCycle.currentIndex++;
						}
					}
					int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
					newSlot = array[0];
					newVariation = array[1];
				}
				if (num2 <= -0.1f)
				{
					weaponCycle.currentIndex += -1;
					for (int j = 0; j < weaponCycle.weaponEnums.Length; j++)
					{
						if (weaponCycle.currentIndex < 0)
						{
							weaponCycle.currentIndex = weaponCycle.weaponEnums.Length - 1;
							if (scrollWeapons)
							{
								SwitchToPrevCustomSlot();
								break;
							}
						}
						if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex])
						{
							weaponCycle.currentIndex += -1;
						}
					}
					int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
					newSlot = array2[0];
					newVariation = array2[1];
				}
			}
			if (scrollEnabled && !scrollVariation && scrollWeapons)
			{
				if (num2 >= 0.1f)
				{
					SwitchToNextCustomSlot();
				}
				if (num2 <= -0.1f)
				{
					SwitchToPrevCustomSlot();
				}
			}
		}

		public void AlterVariationLogic()
		{
			WeaponCycle weaponCycle = wcArray[1];
			if (MonoSingleton<InputManager>.Instance.InputSource.NextVariation.WasPerformedThisFrame)
			{
				weaponCycle.currentIndex++;
				for (int i = 0; i < weaponCycle.weaponEnums.Length; i++)
				{
					if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex])
					{
						weaponCycle.currentIndex++;
					}
					if (weaponCycle.currentIndex >= weaponCycle.weaponEnums.Length)
					{
						weaponCycle.currentIndex = 0;
					}
				}
				int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
				newSlot = array[0];
				newVariation = array[1];
			}
			if (!MonoSingleton<InputManager>.Instance.InputSource.PreviousVariation.WasCanceledThisFrame)
			{
				return;
			}
			weaponCycle.currentIndex += -1;
			for (int j = 0; j < weaponCycle.weaponEnums.Length; j++)
			{
				if (weaponCycle.currentIndex < 0)
				{
					weaponCycle.currentIndex = weaponCycle.weaponEnums.Length - 1;
				}
				if (weaponCycle.weaponEnums[weaponCycle.currentIndex] == PluginConfig.WeaponEnum.None || weaponCycle.ignoreInCycle[weaponCycle.currentIndex])
				{
					weaponCycle.currentIndex += -1;
				}
				if (weaponCycle.currentIndex < 0)
				{
					weaponCycle.currentIndex = weaponCycle.weaponEnums.Length - 1;
				}
			}
			int[] array2 = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle.weaponEnums[weaponCycle.currentIndex]);
			newSlot = array2[0];
			newVariation = array2[1];
		}

		public void AlterWeaponLogic()
		{
			if (MonoSingleton<InputManager>.Instance.InputSource.NextWeapon.WasCanceledThisFrame)
			{
				SwitchToNextCustomSlot();
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.PrevWeapon.WasCanceledThisFrame)
			{
				SwitchToPrevCustomSlot();
			}
		}

		public void LastWeaponLogic()
		{
			if (wcArray[0] != null && MonoSingleton<InputManager>.Instance.InputSource.LastWeapon.WasCanceledThisFrame)
			{
				WeaponCycle weaponCycle = wcArray[1];
				wcArray[1] = wcArray[0];
				wcArray[0] = weaponCycle;
				WeaponCycle weaponCycle2 = wcArray[1];
				int[] array = PluginConfig.convertWeaponEnumToSlotVariation(weaponCycle2.weaponEnums[weaponCycle2.currentIndex]);
				newSlot = array[0];
				newVariation = array[1];
			}
		}

		public void SwitchToWeapon(WeaponCycle wc)
		{
			bool flag = true;
			bool flag2 = false;
			if (wc != wcArray[1] && wc.rememberVariation)
			{
				flag2 = true;
			}
			if (wc.rememberVariation || wc == wcArray[1])
			{
				flag = false;
			}
			if (wc != wcArray[1])
			{
				wcArray[0] = wcArray[1];
				wcArray[1] = wc;
			}
			if (wc.swapBehavior == SwapBehaviorEnum.NextVariation && !flag2)
			{
				wc.currentIndex++;
				if (flag)
				{
					wc.currentIndex = 0;
				}
			}
			else if (wc.swapBehavior == SwapBehaviorEnum.SameVariation && !flag2)
			{
				wc.currentIndex = wc.currentIndex;
				if (flag)
				{
					wc.currentIndex = 0;
				}
			}
			else if (wc.swapBehavior == SwapBehaviorEnum.FirstVariation && !flag2)
			{
				wc.currentIndex = 0;
			}
			for (int i = 0; i < wc.weaponEnums.Length; i++)
			{
				if (wc.weaponEnums[wc.currentIndex] == PluginConfig.WeaponEnum.None || wc.ignoreInCycle[wc.currentIndex])
				{
					wc.currentIndex++;
				}
				if (wc.currentIndex >= wc.weaponEnums.Length)
				{
					wc.currentIndex = 0;
				}
			}
			int[] array = PluginConfig.convertWeaponEnumToSlotVariation(wc.weaponEnums[wc.currentIndex]);
			newSlot = array[0];
			newVariation = array[1];
		}

		public void SwitchWeaponLogic()
		{
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if (MonoSingleton<InputManager>.Instance.InputSource.Slot1.WasPerformedThisFrame)
			{
				WeaponCycle wc = PluginConfig.vanillaWeaponCycles[0];
				SwitchToWeapon(wc);
				return;
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.Slot2.WasPerformedThisFrame)
			{
				WeaponCycle wc2 = PluginConfig.vanillaWeaponCycles[1];
				SwitchToWeapon(wc2);
				return;
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.Slot3.WasPerformedThisFrame)
			{
				WeaponCycle wc3 = PluginConfig.vanillaWeaponCycles[2];
				SwitchToWeapon(wc3);
				return;
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.Slot4.WasPerformedThisFrame)
			{
				WeaponCycle wc4 = PluginConfig.vanillaWeaponCycles[3];
				SwitchToWeapon(wc4);
				return;
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.Slot5.WasPerformedThisFrame)
			{
				WeaponCycle wc5 = PluginConfig.vanillaWeaponCycles[4];
				SwitchToWeapon(wc5);
				return;
			}
			for (int i = 0; i < PluginConfig.weaponCycles.Length; i++)
			{
				WeaponCycle weaponCycle = PluginConfig.weaponCycles[i];
				if (weaponCycle != null && Input.GetKeyDown(weaponCycle.useCode))
				{
					SwitchToWeapon(weaponCycle);
					break;
				}
			}
		}

		public void InputLogic()
		{
			newSlot = -1;
			newVariation = -1;
			VariationBindLogic();
			ScrollLogic();
			AlterVariationLogic();
			AlterWeaponLogic();
			LastWeaponLogic();
			SwitchWeaponLogic();
			if (newVariation > 100 || newSlot > 100)
			{
				Debug.Log((object)"WeaponVariantBinds - Tried to switch to an empty weapon.");
			}
			else if (newVariation != -1 && newSlot != -1)
			{
				if (newSlot == 0)
				{
					MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot1[newVariation], true);
				}
				else if (newSlot == 1)
				{
					MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot2[newVariation], true);
				}
				else if (newSlot == 2)
				{
					MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot3[newVariation], true);
				}
				else if (newSlot == 3)
				{
					MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot4[newVariation], true);
				}
				else if (newSlot == 4)
				{
					MonoSingleton<GunControl>.Instance.ForceWeapon(MonoSingleton<GunControl>.Instance.slot5[newVariation], true);
				}
				weapon = MonoSingleton<GunControl>.Instance.currentWeapon;
				return;
			}
			if ((Object)(object)weapon != (Object)(object)MonoSingleton<GunControl>.Instance.currentWeapon)
			{
				Debug.Log((object)"WeaponVariantBinds - Unaccounted weapon change detected.");
				weapon = MonoSingleton<GunControl>.Instance.currentWeapon;
			}
		}

		public void Update()
		{
			tickCount++;
			if (tickCount == PluginConfig.tickUpdateSettings + 2)
			{
				PluginConfig.UpdateSettings();
			}
			if (tickCount > tickCountUpdateVanillaWeaponCycles + 100)
			{
				PluginConfig.DetermineVanillaWeaponCycles();
				tickCountUpdateVanillaWeaponCycles = tickCount;
			}
			if (IsGameplayScene() && modEnabled && !IsMenu())
			{
				InputLogic();
			}
		}
	}
	public enum SwapBehaviorEnum
	{
		NextVariation,
		SameVariation,
		FirstVariation
	}
	public class WeaponCycle
	{
		public PluginConfig.WeaponEnum[] weaponEnums = new PluginConfig.WeaponEnum[100];

		public bool[] ignoreInCycle = new bool[100];

		public int currentIndex = 0;

		public KeyCode useCode = (KeyCode)0;

		public bool rememberVariation = false;

		public SwapBehaviorEnum swapBehavior = SwapBehaviorEnum.NextVariation;
	}
	public class PluginConfig
	{
		public enum WeaponEnum
		{
			None,
			Piercer_Revolver,
			Marksman_Revolver,
			Sharpshooter_Revolver,
			Core_Eject_Shotgun,
			Pump_Charge_Shotgun,
			Sawed_On_Shotgun,
			Attractor_Nailgun,
			Overheat_Nailgun,
			Jumpstart_Nailgun,
			Electric_Railcannon,
			Screwdriver,
			Malicious_Railcannon,
			Freezeframe_Rocket_Launcher,
			SRS_Rocket_Launcher,
			Firestarter_Rocket_Launcher
		}

		public enum KeyEnum
		{
			None,
			Backspace,
			Tab,
			Escape,
			Space,
			UpArrow,
			DownArrow,
			RightArrow,
			LeftArrow,
			A,
			B,
			C,
			D,
			E,
			F,
			G,
			H,
			I,
			J,
			K,
			L,
			M,
			N,
			O,
			P,
			Q,
			R,
			S,
			T,
			U,
			V,
			W,
			X,
			Y,
			Z,
			Alpha1,
			Alpha2,
			Alpha3,
			Alpha4,
			Alpha5,
			Alpha6,
			Alpha7,
			Alpha8,
			Alpha9,
			Alpha0,
			CapsLock,
			RightShift,
			LeftShift,
			RightControl,
			LeftControl,
			RightAlt,
			LeftAlt,
			Mouse1,
			Mouse2,
			Mouse3,
			Mouse4,
			Mouse5,
			Mouse6,
			Mouse7,
			BackQuote,
			EqualsSign,
			Minus,
			LeftBracket,
			RightBracket,
			Semicolon,
			Quote,
			Comma,
			Period,
			Slash,
			Backslash,
			Numlock,
			KeypadDivide,
			KeypadMultiply,
			KeypadMinus,
			KeypadPlus,
			KeypadEnter,
			KeypadPeriod,
			Keypad0,
			Keypad1,
			Keypad2,
			Keypad3,
			Keypad4,
			Keypad5,
			Keypad6,
			Keypad7,
			Keypad8,
			Keypad9,
			Home,
			End,
			PageUp,
			PageDown,
			Enter,
			F1,
			F2,
			F3,
			F4,
			F5,
			F6,
			F7,
			F8,
			F9,
			F10,
			F11,
			F12,
			F13,
			F14,
			F15,
			WheelUp,
			WheelDown
		}

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

			public static EnumValueChangeEventDelegate<KeyEnum> <>9__25_0;

			public static BoolValueChangeEventDelegate <>9__25_1;

			public static EnumValueChangeEventDelegate<SwapBehaviorEnum> <>9__25_2;

			public static EnumValueChangeEventDelegate<WeaponEnum> <>9__27_0;

			public static BoolValueChangeEventDelegate <>9__27_1;

			public static EnumValueChangeEventDelegate<KeyEnum> <>9__40_1;

			public static BoolValueChangeEventDelegate <>9__40_0;

			public static BoolValueChangeEventDelegate <>9__40_2;

			public static EnumValueChangeEventDelegate<SwapBehaviorEnum> <>9__40_3;

			public static BoolValueChangeEventDelegate <>9__40_4;

			internal void <CreateWeaponCyclePanel>b__25_0(EnumValueChangeEvent<KeyEnum> e)
			{
				StartSettingsUpdate();
			}

			internal void <CreateWeaponCyclePanel>b__25_1(BoolValueChangeEvent e)
			{
				StartSettingsUpdate();
			}

			internal void <CreateWeaponCyclePanel>b__25_2(EnumValueChangeEvent<SwapBehaviorEnum> e)
			{
				StartSettingsUpdate();
			}

			internal void <CreateWeaponField>b__27_0(EnumValueChangeEvent<WeaponEnum> e)
			{
				StartSettingsUpdate();
			}

			internal void <CreateWeaponField>b__27_1(BoolValueChangeEvent e)
			{
				StartSettingsUpdate();
			}

			internal void <WeaponVariantBindsConfig>b__40_1(EnumValueChangeEvent<KeyEnum> e)
			{
				StartSettingsUpdate();
			}

			internal void <WeaponVariantBindsConfig>b__40_0(BoolValueChangeEvent e)
			{
				Plugin.modEnabled = e.value;
				((ConfigField)division).interactable = e.value;
			}

			internal void <WeaponVariantBindsConfig>b__40_2(BoolValueChangeEvent e)
			{
				StartSettingsUpdate();
			}

			internal void <WeaponVariantBindsConfig>b__40_3(EnumValueChangeEvent<SwapBehaviorEnum> e)
			{
				StartSettingsUpdate();
			}

			internal void <WeaponVariantBindsConfig>b__40_4(BoolValueChangeEvent e)
			{
				StartSettingsUpdate();
			}
		}

		public static KeyCode[] variationBinds = (KeyCode[])(object)new KeyCode[100];

		public static string DefaultParentFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "";

		public static WeaponCycle[] weaponCycles = new WeaponCycle[100];

		public static WeaponCycle[] vanillaWeaponCycles = new WeaponCycle[5];

		public static EnumField<WeaponEnum>[,] allWeaponFields = new EnumField<WeaponEnum>[100, 100];

		public static BoolField[,] weaponSkipCycleFields = new BoolField[100, 100];

		public static EnumField<SwapBehaviorEnum>[] swapBehaviorFields = new EnumField<SwapBehaviorEnum>[100];

		public static ConfigPanel[] configPanels = (ConfigPanel[])(object)new ConfigPanel[100];

		public static ConfigPanel[] advancedWeaponOptionsFields = (ConfigPanel[])(object)new ConfigPanel[100];

		public static int tickUpdateSettings = 0;

		public static int numWeaponCyclesActive = 0;

		public static EnumField<KeyEnum>[] useKeyFields = new EnumField<KeyEnum>[100];

		public static ConfigDivision division = null;

		public static EnumField<WeaponEnum>[,] vanillaWeaponFields = new EnumField<WeaponEnum>[5, 3];

		public static BoolField[,] vanillaWeaponSkipCycleFields = new BoolField[5, 3];

		public static EnumField<KeyEnum>[] weaponVariantBindFields = new EnumField<KeyEnum>[100];

		public static EnumField<SwapBehaviorEnum>[] vanillaSwapBehaviorFields = new EnumField<SwapBehaviorEnum>[5];

		public static BoolField[] rememberVariationFields = (BoolField[])(object)new BoolField[100];

		public static BoolField[] rememberVanillaVariationFields = (BoolField[])(object)new BoolField[5];

		public static void setWeaponEnumDisplayNames(EnumField<WeaponEnum> field)
		{
			field.SetEnumDisplayName(WeaponEnum.Piercer_Revolver, "Piercer Revolver");
			field.SetEnumDisplayName(WeaponEnum.Marksman_Revolver, "Marksman Revolver");
			field.SetEnumDisplayName(WeaponEnum.Sharpshooter_Revolver, "Sharpshooter Revolver");
			field.SetEnumDisplayName(WeaponEnum.Core_Eject_Shotgun, "Core Eject Shotgun");
			field.SetEnumDisplayName(WeaponEnum.Pump_Charge_Shotgun, "Pump Charge Shotgun");
			field.SetEnumDisplayName(WeaponEnum.Sawed_On_Shotgun, "Sawed-On Shotgun");
			field.SetEnumDisplayName(WeaponEnum.Attractor_Nailgun, "Attractor Nailgun");
			field.SetEnumDisplayName(WeaponEnum.Overheat_Nailgun, "Overheat Nailgun");
			field.SetEnumDisplayName(WeaponEnum.Jumpstart_Nailgun, "Jumpstart Nailgun");
			field.SetEnumDisplayName(WeaponEnum.Electric_Railcannon, "Electric Railcannon");
			field.SetEnumDisplayName(WeaponEnum.Screwdriver, "Screwdriver");
			field.SetEnumDisplayName(WeaponEnum.Malicious_Railcannon, "Malicious Railcannon");
			field.SetEnumDisplayName(WeaponEnum.Freezeframe_Rocket_Launcher, "Freezeframe Rocket Launcher");
			field.SetEnumDisplayName(WeaponEnum.SRS_Rocket_Launcher, "S.R.S. Rocket Launcher");
			field.SetEnumDisplayName(WeaponEnum.Firestarter_Rocket_Launcher, "Firestarter Rocket Launcher");
		}

		public static WeaponEnum convertWeaponToWeaponEnum(GameObject weapon)
		{
			WeaponEnum result = WeaponEnum.None;
			if ((Object)(object)weapon.GetComponent<Revolver>() != (Object)null)
			{
				if (weapon.GetComponent<Revolver>().gunVariation == 0)
				{
					result = WeaponEnum.Piercer_Revolver;
				}
				if (weapon.GetComponent<Revolver>().gunVariation == 1)
				{
					result = WeaponEnum.Marksman_Revolver;
				}
				if (weapon.GetComponent<Revolver>().gunVariation == 2)
				{
					result = WeaponEnum.Sharpshooter_Revolver;
				}
			}
			if ((Object)(object)weapon.GetComponent<Shotgun>() != (Object)null)
			{
				if (weapon.GetComponent<Shotgun>().variation == 0)
				{
					result = WeaponEnum.Core_Eject_Shotgun;
				}
				if (weapon.GetComponent<Shotgun>().variation == 1)
				{
					result = WeaponEnum.Pump_Charge_Shotgun;
				}
				if (weapon.GetComponent<Shotgun>().variation == 2)
				{
					result = WeaponEnum.Sawed_On_Shotgun;
				}
			}
			if ((Object)(object)weapon.GetComponent<ShotgunHammer>() != (Object)null)
			{
				if (weapon.GetComponent<ShotgunHammer>().variation == 0)
				{
					result = WeaponEnum.Core_Eject_Shotgun;
				}
				if (weapon.GetComponent<ShotgunHammer>().variation == 1)
				{
					result = WeaponEnum.Pump_Charge_Shotgun;
				}
				if (weapon.GetComponent<ShotgunHammer>().variation == 2)
				{
					result = WeaponEnum.Sawed_On_Shotgun;
				}
			}
			if ((Object)(object)weapon.GetComponent<Nailgun>() != (Object)null)
			{
				if (weapon.GetComponent<Nailgun>().variation == 1)
				{
					result = WeaponEnum.Attractor_Nailgun;
				}
				if (weapon.GetComponent<Nailgun>().variation == 0)
				{
					result = WeaponEnum.Overheat_Nailgun;
				}
				if (weapon.GetComponent<Nailgun>().variation == 2)
				{
					result = WeaponEnum.Jumpstart_Nailgun;
				}
			}
			if ((Object)(object)weapon.GetComponent<Railcannon>() != (Object)null)
			{
				if (weapon.GetComponent<Railcannon>().variation == 0)
				{
					result = WeaponEnum.Electric_Railcannon;
				}
				if (weapon.GetComponent<Railcannon>().variation == 1)
				{
					result = WeaponEnum.Screwdriver;
				}
				if (weapon.GetComponent<Railcannon>().variation == 2)
				{
					result = WeaponEnum.Malicious_Railcannon;
				}
			}
			if ((Object)(object)weapon.GetComponent<RocketLauncher>() != (Object)null)
			{
				if (weapon.GetComponent<RocketLauncher>().variation == 0)
				{
					result = WeaponEnum.Freezeframe_Rocket_Launcher;
				}
				if (weapon.GetComponent<RocketLauncher>().variation == 1)
				{
					result = WeaponEnum.SRS_Rocket_Launcher;
				}
				if (weapon.GetComponent<RocketLauncher>().variation == 2)
				{
					result = WeaponEnum.Firestarter_Rocket_Launcher;
				}
			}
			return result;
		}

		public static WeaponEnum convertWeaponToWeaponEnum(int slot, int variation)
		{
			WeaponEnum result = WeaponEnum.None;
			switch (slot)
			{
			case 1:
				switch (variation)
				{
				case 0:
					result = WeaponEnum.Piercer_Revolver;
					break;
				case 1:
					result = WeaponEnum.Marksman_Revolver;
					break;
				case 2:
					result = WeaponEnum.Sharpshooter_Revolver;
					break;
				}
				break;
			case 2:
				switch (variation)
				{
				case 0:
					result = WeaponEnum.Core_Eject_Shotgun;
					break;
				case 1:
					result = WeaponEnum.Pump_Charge_Shotgun;
					break;
				case 2:
					result = WeaponEnum.Sawed_On_Shotgun;
					break;
				}
				break;
			case 3:
				switch (variation)
				{
				case 0:
					result = WeaponEnum.Overheat_Nailgun;
					break;
				case 1:
					result = WeaponEnum.Attractor_Nailgun;
					break;
				case 2:
					result = WeaponEnum.Jumpstart_Nailgun;
					break;
				}
				break;
			case 4:
				switch (variation)
				{
				case 0:
					result = WeaponEnum.Electric_Railcannon;
					break;
				case 1:
					result = WeaponEnum.Malicious_Railcannon;
					break;
				case 2:
					result = WeaponEnum.Screwdriver;
					break;
				}
				break;
			case 5:
				switch (variation)
				{
				case 0:
					result = WeaponEnum.Freezeframe_Rocket_Launcher;
					break;
				case 1:
					result = WeaponEnum.SRS_Rocket_Launcher;
					break;
				case 2:
					result = WeaponEnum.Firestarter_Rocket_Launcher;
					break;
				}
				break;
			}
			return result;
		}

		public static int[] convertWeaponEnumToSlotVariation(WeaponEnum code)
		{
			int[] array = new int[2] { 500, 500 };
			array[0] = (int)(code - 1) / 3;
			array[1] = -1;
			for (int i = 0; i < 3; i++)
			{
				if (i < MonoSingleton<GunControl>.Instance.slot1.Count)
				{
					if (MonoSingleton<GunControl>.Instance.slot1[i].GetComponent<Revolver>().gunVariation == 0 && code == WeaponEnum.Piercer_Revolver)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot1[i].GetComponent<Revolver>().gunVariation == 1 && code == WeaponEnum.Marksman_Revolver)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot1[i].GetComponent<Revolver>().gunVariation == 2 && code == WeaponEnum.Sharpshooter_Revolver)
					{
						array[1] = i;
					}
				}
				if (i < MonoSingleton<GunControl>.Instance.slot2.Count)
				{
					if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>() != (Object)null)
					{
						if (MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>().variation == 0 && code == WeaponEnum.Core_Eject_Shotgun)
						{
							array[1] = i;
						}
					}
					else if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>() != (Object)null && MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>().variation == 0 && code == WeaponEnum.Core_Eject_Shotgun)
					{
						array[1] = i;
					}
					if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>() != (Object)null)
					{
						if (MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>().variation == 1 && code == WeaponEnum.Pump_Charge_Shotgun)
						{
							array[1] = i;
						}
					}
					else if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>() != (Object)null && MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>().variation == 1 && code == WeaponEnum.Pump_Charge_Shotgun)
					{
						array[1] = i;
					}
					if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>() != (Object)null)
					{
						if (MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<Shotgun>().variation == 2 && code == WeaponEnum.Sawed_On_Shotgun)
						{
							array[1] = i;
						}
					}
					else if ((Object)(object)MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>() != (Object)null && MonoSingleton<GunControl>.Instance.slot2[i].GetComponent<ShotgunHammer>().variation == 2 && code == WeaponEnum.Sawed_On_Shotgun)
					{
						array[1] = i;
					}
				}
				if (i < MonoSingleton<GunControl>.Instance.slot3.Count)
				{
					if (MonoSingleton<GunControl>.Instance.slot3[i].GetComponent<Nailgun>().variation == 1 && code == WeaponEnum.Attractor_Nailgun)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot3[i].GetComponent<Nailgun>().variation == 0 && code == WeaponEnum.Overheat_Nailgun)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot3[i].GetComponent<Nailgun>().variation == 2 && code == WeaponEnum.Jumpstart_Nailgun)
					{
						array[1] = i;
					}
				}
				if (i < MonoSingleton<GunControl>.Instance.slot4.Count)
				{
					if (MonoSingleton<GunControl>.Instance.slot4[i].GetComponent<Railcannon>().variation == 0 && code == WeaponEnum.Electric_Railcannon)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot4[i].GetComponent<Railcannon>().variation == 1 && code == WeaponEnum.Screwdriver)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot4[i].GetComponent<Railcannon>().variation == 2 && code == WeaponEnum.Malicious_Railcannon)
					{
						array[1] = i;
					}
				}
				if (i < MonoSingleton<GunControl>.Instance.slot5.Count)
				{
					if (MonoSingleton<GunControl>.Instance.slot5[i].GetComponent<RocketLauncher>().variation == 0 && code == WeaponEnum.Freezeframe_Rocket_Launcher)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot5[i].GetComponent<RocketLauncher>().variation == 1 && code == WeaponEnum.SRS_Rocket_Launcher)
					{
						array[1] = i;
					}
					if (MonoSingleton<GunControl>.Instance.slot5[i].GetComponent<RocketLauncher>().variation == 2 && code == WeaponEnum.Firestarter_Rocket_Launcher)
					{
						array[1] = i;
					}
				}
			}
			return array;
		}

		public static KeyCode convertKeyEnumToKeyCode(KeyEnum value)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f73: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: 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)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_0629: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Unknown result type (might be due to invalid IL or missing references)
			//IL_0677: Unknown result type (might be due to invalid IL or missing references)
			//IL_069e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0713: Unknown result type (might be due to invalid IL or missing references)
			//IL_073a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0761: Unknown result type (might be due to invalid IL or missing references)
			//IL_0788: Unknown result type (might be due to invalid IL or missing references)
			//IL_07af: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0824: Unknown result type (might be due to invalid IL or missing references)
			//IL_084b: Unknown result type (might be due to invalid IL or missing references)
			//IL_086f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0893: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08db: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0923: Unknown result type (might be due to invalid IL or missing references)
			//IL_0947: Unknown result type (might be due to invalid IL or missing references)
			//IL_096b: Unknown result type (might be due to invalid IL or missing references)
			//IL_098f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b36: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ce3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0df1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e66: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eb4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0edb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6e: Unknown result type (might be due to invalid IL or missing references)
			KeyCode result = (KeyCode)0;
			if (value.Equals(KeyEnum.Backspace))
			{
				result = (KeyCode)8;
			}
			else if (value.Equals(KeyEnum.Tab))
			{
				result = (KeyCode)9;
			}
			else if (value.Equals(KeyEnum.Escape))
			{
				result = (KeyCode)27;
			}
			else if (value.Equals(KeyEnum.Space))
			{
				result = (KeyCode)32;
			}
			else if (value.Equals(KeyEnum.UpArrow))
			{
				result = (KeyCode)273;
			}
			else if (value.Equals(KeyEnum.DownArrow))
			{
				result = (KeyCode)274;
			}
			else if (value.Equals(KeyEnum.RightArrow))
			{
				result = (KeyCode)275;
			}
			else if (value.Equals(KeyEnum.LeftArrow))
			{
				result = (KeyCode)276;
			}
			else if (value.Equals(KeyEnum.A))
			{
				result = (KeyCode)97;
			}
			else if (value.Equals(KeyEnum.B))
			{
				result = (KeyCode)98;
			}
			else if (value.Equals(KeyEnum.C))
			{
				result = (KeyCode)99;
			}
			else if (value.Equals(KeyEnum.D))
			{
				result = (KeyCode)100;
			}
			else if (value.Equals(KeyEnum.E))
			{
				result = (KeyCode)101;
			}
			else if (value.Equals(KeyEnum.F))
			{
				result = (KeyCode)102;
			}
			else if (value.Equals(KeyEnum.G))
			{
				result = (KeyCode)103;
			}
			else if (value.Equals(KeyEnum.H))
			{
				result = (KeyCode)104;
			}
			else if (value.Equals(KeyEnum.I))
			{
				result = (KeyCode)105;
			}
			else if (value.Equals(KeyEnum.J))
			{
				result = (KeyCode)106;
			}
			else if (value.Equals(KeyEnum.K))
			{
				result = (KeyCode)107;
			}
			else if (value.Equals(KeyEnum.L))
			{
				result = (KeyCode)108;
			}
			else if (value.Equals(KeyEnum.M))
			{
				result = (KeyCode)109;
			}
			else if (value.Equals(KeyEnum.N))
			{
				result = (KeyCode)110;
			}
			else if (value.Equals(KeyEnum.O))
			{
				result = (KeyCode)111;
			}
			else if (value.Equals(KeyEnum.P))
			{
				result = (KeyCode)112;
			}
			else if (value.Equals(KeyEnum.Q))
			{
				result = (KeyCode)113;
			}
			else if (value.Equals(KeyEnum.R))
			{
				result = (KeyCode)114;
			}
			else if (value.Equals(KeyEnum.S))
			{
				result = (KeyCode)115;
			}
			else if (value.Equals(KeyEnum.T))
			{
				result = (KeyCode)116;
			}
			else if (value.Equals(KeyEnum.U))
			{
				result = (KeyCode)117;
			}
			else if (value.Equals(KeyEnum.V))
			{
				result = (KeyCode)118;
			}
			else if (value.Equals(KeyEnum.W))
			{
				result = (KeyCode)119;
			}
			else if (value.Equals(KeyEnum.X))
			{
				result = (KeyCode)120;
			}
			else if (value.Equals(KeyEnum.Y))
			{
				result = (KeyCode)121;
			}
			else if (value.Equals(KeyEnum.Z))
			{
				result = (KeyCode)122;
			}
			else if (value.Equals(KeyEnum.Alpha1))
			{
				result = (KeyCode)49;
			}
			else if (value.Equals(KeyEnum.Alpha2))
			{
				result = (KeyCode)50;
			}
			else if (value.Equals(KeyEnum.Alpha3))
			{
				result = (KeyCode)51;
			}
			else if (value.Equals(KeyEnum.Alpha4))
			{
				result = (KeyCode)52;
			}
			else if (value.Equals(KeyEnum.Alpha5))
			{
				result = (KeyCode)53;
			}
			else if (value.Equals(KeyEnum.Alpha6))
			{
				result = (KeyCode)54;
			}
			else if (value.Equals(KeyEnum.Alpha7))
			{
				result = (KeyCode)55;
			}
			else if (value.Equals(KeyEnum.Alpha8))
			{
				result = (KeyCode)56;
			}
			else if (value.Equals(KeyEnum.Alpha9))
			{
				result = (KeyCode)57;
			}
			else if (value.Equals(KeyEnum.Alpha0))
			{
				result = (KeyCode)48;
			}
			else if (value.Equals(KeyEnum.CapsLock))
			{
				result = (KeyCode)301;
			}
			else if (value.Equals(KeyEnum.RightShift))
			{
				result = (KeyCode)303;
			}
			else if (value.Equals(KeyEnum.LeftShift))
			{
				result = (KeyCode)304;
			}
			else if (value.Equals(KeyEnum.RightControl))
			{
				result = (KeyCode)305;
			}
			else if (value.Equals(KeyEnum.LeftControl))
			{
				result = (KeyCode)306;
			}
			else if (value.Equals(KeyEnum.RightAlt))
			{
				result = (KeyCode)307;
			}
			else if (value.Equals(KeyEnum.LeftAlt))
			{
				result = (KeyCode)308;
			}
			else if (value.Equals(KeyEnum.Mouse1))
			{
				result = (KeyCode)323;
			}
			else if (value.Equals(KeyEnum.Mouse2))
			{
				result = (KeyCode)324;
			}
			else if (value.Equals(KeyEnum.Mouse3))
			{
				result = (KeyCode)325;
			}
			else if (value.Equals(KeyEnum.Mouse4))
			{
				result = (KeyCode)326;
			}
			else if (value.Equals(KeyEnum.Mouse5))
			{
				result = (KeyCode)327;
			}
			else if (value.Equals(KeyEnum.Mouse6))
			{
				result = (KeyCode)328;
			}
			else if (value.Equals(KeyEnum.Mouse7))
			{
				result = (KeyCode)329;
			}
			else
			{
				if (value.Equals(KeyEnum.BackQuote))
				{
					return (KeyCode)96;
				}
				if (value.Equals(KeyEnum.EqualsSign))
				{
					return (KeyCode)61;
				}
				if (value.Equals(KeyEnum.Minus))
				{
					return (KeyCode)45;
				}
				if (value.Equals(KeyEnum.LeftBracket))
				{
					return (KeyCode)91;
				}
				if (value.Equals(KeyEnum.RightBracket))
				{
					return (KeyCode)93;
				}
				if (value.Equals(KeyEnum.Semicolon))
				{
					return (KeyCode)59;
				}
				if (value.Equals(KeyEnum.Quote))
				{
					return (KeyCode)39;
				}
				if (value.Equals(KeyEnum.Comma))
				{
					return (KeyCode)44;
				}
				if (value.Equals(KeyEnum.Period))
				{
					return (KeyCode)46;
				}
				if (value.Equals(KeyEnum.Slash))
				{
					return (KeyCode)47;
				}
				if (value.Equals(KeyEnum.Backslash))
				{
					return (KeyCode)92;
				}
				if (value.Equals(KeyEnum.Numlock))
				{
					return (KeyCode)300;
				}
				if (value.Equals(KeyEnum.KeypadDivide))
				{
					return (KeyCode)267;
				}
				if (value.Equals(KeyEnum.KeypadMultiply))
				{
					return (KeyCode)268;
				}
				if (value.Equals(KeyEnum.KeypadMinus))
				{
					return (KeyCode)269;
				}
				if (value.Equals(KeyEnum.KeypadPlus))
				{
					return (KeyCode)270;
				}
				if (value.Equals(KeyEnum.KeypadEnter))
				{
					return (KeyCode)271;
				}
				if (value.Equals(KeyEnum.KeypadPeriod))
				{
					return (KeyCode)266;
				}
				if (value.Equals(KeyEnum.Keypad0))
				{
					return (KeyCode)256;
				}
				if (value.Equals(KeyEnum.Keypad1))
				{
					return (KeyCode)257;
				}
				if (value.Equals(KeyEnum.Keypad2))
				{
					return (KeyCode)258;
				}
				if (value.Equals(KeyEnum.Keypad3))
				{
					return (KeyCode)259;
				}
				if (value.Equals(KeyEnum.Keypad4))
				{
					return (KeyCode)260;
				}
				if (value.Equals(KeyEnum.Keypad5))
				{
					return (KeyCode)261;
				}
				if (value.Equals(KeyEnum.Keypad6))
				{
					return (KeyCode)262;
				}
				if (value.Equals(KeyEnum.Keypad7))
				{
					return (KeyCode)263;
				}
				if (value.Equals(KeyEnum.Keypad8))
				{
					return (KeyCode)264;
				}
				if (value.Equals(KeyEnum.Keypad9))
				{
					return (KeyCode)265;
				}
				if (value.Equals(KeyEnum.Home))
				{
					return (KeyCode)278;
				}
				if (value.Equals(KeyEnum.End))
				{
					return (KeyCode)279;
				}
				if (value.Equals(KeyEnum.PageUp))
				{
					return (KeyCode)280;
				}
				if (value.Equals(KeyEnum.PageDown))
				{
					return (KeyCode)281;
				}
				if (value.Equals(KeyEnum.Enter))
				{
					return (KeyCode)13;
				}
				if (value.Equals(KeyEnum.F1))
				{
					return (KeyCode)282;
				}
				if (value.Equals(KeyEnum.F2))
				{
					return (KeyCode)283;
				}
				if (value.Equals(KeyEnum.F3))
				{
					return (KeyCode)284;
				}
				if (value.Equals(KeyEnum.F4))
				{
					return (KeyCode)285;
				}
				if (value.Equals(KeyEnum.F5))
				{
					return (KeyCode)286;
				}
				if (value.Equals(KeyEnum.F6))
				{
					return (KeyCode)287;
				}
				if (value.Equals(KeyEnum.F7))
				{
					return (KeyCode)288;
				}
				if (value.Equals(KeyEnum.F8))
				{
					return (KeyCode)289;
				}
				if (value.Equals(KeyEnum.F9))
				{
					return (KeyCode)290;
				}
				if (value.Equals(KeyEnum.F10))
				{
					return (KeyCode)291;
				}
				if (value.Equals(KeyEnum.F11))
				{
					return (KeyCode)292;
				}
				if (value.Equals(KeyEnum.F12))
				{
					return (KeyCode)293;
				}
				if (value.Equals(KeyEnum.F13))
				{
					return (KeyCode)294;
				}
				if (value.Equals(KeyEnum.F14))
				{
					return (KeyCode)295;
				}
				if (value.Equals(KeyEnum.F15))
				{
					return (KeyCode)296;
				}
			}
			return result;
		}

		private static void SetDisplayNames(EnumField<KeyEnum> field)
		{
			field.SetEnumDisplayName(KeyEnum.Minus, "-");
			field.SetEnumDisplayName(KeyEnum.EqualsSign, "=");
			field.SetEnumDisplayName(KeyEnum.LeftBracket, "[");
			field.SetEnumDisplayName(KeyEnum.RightBracket, "]");
			field.SetEnumDisplayName(KeyEnum.CapsLock, "Caps Lock");
			field.SetEnumDisplayName(KeyEnum.LeftShift, "Left Shift");
			field.SetEnumDisplayName(KeyEnum.RightShift, "Right Shift");
			field.SetEnumDisplayName(KeyEnum.LeftControl, "Left Control");
			field.SetEnumDisplayName(KeyEnum.RightControl, "Right Control");
			field.SetEnumDisplayName(KeyEnum.LeftAlt, "Left Alt");
			field.SetEnumDisplayName(KeyEnum.RightAlt, "Right Alt");
			field.SetEnumDisplayName(KeyEnum.BackQuote, "`");
			field.SetEnumDisplayName(KeyEnum.Quote, "'");
			field.SetEnumDisplayName(KeyEnum.Semicolon, ";");
			field.SetEnumDisplayName(KeyEnum.Slash, "/");
			field.SetEnumDisplayName(KeyEnum.Backslash, "\\");
			field.SetEnumDisplayName(KeyEnum.Keypad0, "Keypad 0");
			field.SetEnumDisplayName(KeyEnum.Keypad1, "Keypad 1");
			field.SetEnumDisplayName(KeyEnum.Keypad2, "Keypad 2");
			field.SetEnumDisplayName(KeyEnum.Keypad3, "Keypad 3");
			field.SetEnumDisplayName(KeyEnum.Keypad4, "Keypad 4");
			field.SetEnumDisplayName(KeyEnum.Keypad5, "Keypad 5");
			field.SetEnumDisplayName(KeyEnum.Keypad6, "Keypad 6");
			field.SetEnumDisplayName(KeyEnum.Keypad7, "Keypad 7");
			field.SetEnumDisplayName(KeyEnum.Keypad8, "Keypad 8");
			field.SetEnumDisplayName(KeyEnum.Keypad9, "Keypad 9");
			field.SetEnumDisplayName(KeyEnum.KeypadDivide, "Keypad /");
			field.SetEnumDisplayName(KeyEnum.KeypadMultiply, "Keypad *");
			field.SetEnumDisplayName(KeyEnum.KeypadPlus, "Keypad Plus");
			field.SetEnumDisplayName(KeyEnum.KeypadMinus, "Keypad Minus");
			field.SetEnumDisplayName(KeyEnum.KeypadEnter, "Keypad Enter");
			field.SetEnumDisplayName(KeyEnum.KeypadPeriod, "Keypad .");
			field.SetEnumDisplayName(KeyEnum.Period, ".");
			field.SetEnumDisplayName(KeyEnum.Comma, ",");
			field.SetEnumDisplayName(KeyEnum.PageUp, "Page Up");
			field.SetEnumDisplayName(KeyEnum.PageDown, "Page Down");
			field.SetEnumDisplayName(KeyEnum.UpArrow, "Up Arrow");
			field.SetEnumDisplayName(KeyEnum.DownArrow, "Down Arrow");
			field.SetEnumDisplayName(KeyEnum.LeftArrow, "Left Arrow");
			field.SetEnumDisplayName(KeyEnum.RightArrow, "Right Arrow");
			field.SetEnumDisplayName(KeyEnum.Alpha0, "0");
			field.SetEnumDisplayName(KeyEnum.Alpha1, "1");
			field.SetEnumDisplayName(KeyEnum.Alpha2, "2");
			field.SetEnumDisplayName(KeyEnum.Alpha3, "3");
			field.SetEnumDisplayName(KeyEnum.Alpha4, "4");
			field.SetEnumDisplayName(KeyEnum.Alpha5, "5");
			field.SetEnumDisplayName(KeyEnum.Alpha6, "6");
			field.SetEnumDisplayName(KeyEnum.Alpha7, "7");
			field.SetEnumDisplayName(KeyEnum.Alpha8, "8");
			field.SetEnumDisplayName(KeyEnum.Alpha9, "9");
			field.SetEnumDisplayName(KeyEnum.Mouse1, "Mouse 1");
			field.SetEnumDisplayName(KeyEnum.Mouse2, "Mouse 2");
			field.SetEnumDisplayName(KeyEnum.Mouse3, "Mouse 3");
			field.SetEnumDisplayName(KeyEnum.Mouse4, "Mouse 4");
			field.SetEnumDisplayName(KeyEnum.Mouse5, "Mouse 5");
			field.SetEnumDisplayName(KeyEnum.Mouse6, "Mouse 6");
			field.SetEnumDisplayName(KeyEnum.Mouse7, "Mouse 7");
		}

		public static void InitVanillaWeaponCycles()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 5; i++)
			{
				WeaponCycle weaponCycle = new WeaponCycle();
				weaponCycle.weaponEnums = new WeaponEnum[100];
				for (int j = 0; j < 100; j++)
				{
					weaponCycle.weaponEnums[i] = WeaponEnum.None;
				}
				weaponCycle.currentIndex = 0;
				weaponCycle.useCode = (KeyCode)0;
				weaponCycle.rememberVariation = false;
				weaponCycle.swapBehavior = SwapBehaviorEnum.NextVariation;
				vanillaWeaponCycles[i] = weaponCycle;
			}
		}

		public static void DetermineVanillaWeaponCycles()
		{
			if ((Object)(object)MonoSingleton<GunControl>.Instance != (Object)null)
			{
				if (MonoSingleton<GunControl>.Instance.slot1.Count > 0)
				{
					vanillaWeaponCycles[0].weaponEnums[0] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot1[0]);
				}
				if (MonoSingleton<GunControl>.Instance.slot1.Count > 1)
				{
					vanillaWeaponCycles[0].weaponEnums[1] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot1[1]);
				}
				if (MonoSingleton<GunControl>.Instance.slot1.Count > 2)
				{
					vanillaWeaponCycles[0].weaponEnums[2] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot1[2]);
				}
				if (MonoSingleton<GunControl>.Instance.slot2.Count > 0)
				{
					vanillaWeaponCycles[1].weaponEnums[0] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot2[0]);
				}
				if (MonoSingleton<GunControl>.Instance.slot2.Count > 1)
				{
					vanillaWeaponCycles[1].weaponEnums[1] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot2[1]);
				}
				if (MonoSingleton<GunControl>.Instance.slot2.Count > 2)
				{
					vanillaWeaponCycles[1].weaponEnums[2] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot2[2]);
				}
				if (MonoSingleton<GunControl>.Instance.slot3.Count > 0)
				{
					vanillaWeaponCycles[2].weaponEnums[0] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot3[0]);
				}
				if (MonoSingleton<GunControl>.Instance.slot3.Count > 1)
				{
					vanillaWeaponCycles[2].weaponEnums[1] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot3[1]);
				}
				if (MonoSingleton<GunControl>.Instance.slot3.Count > 2)
				{
					vanillaWeaponCycles[2].weaponEnums[2] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot3[2]);
				}
				if (MonoSingleton<GunControl>.Instance.slot4.Count > 0)
				{
					vanillaWeaponCycles[3].weaponEnums[0] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot4[0]);
				}
				if (MonoSingleton<GunControl>.Instance.slot4.Count > 1)
				{
					vanillaWeaponCycles[3].weaponEnums[1] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot4[1]);
				}
				if (MonoSingleton<GunControl>.Instance.slot4.Count > 2)
				{
					vanillaWeaponCycles[3].weaponEnums[2] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot4[2]);
				}
				if (MonoSingleton<GunControl>.Instance.slot5.Count > 0)
				{
					vanillaWeaponCycles[4].weaponEnums[0] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot5[0]);
				}
				if (MonoSingleton<GunControl>.Instance.slot5.Count > 1)
				{
					vanillaWeaponCycles[4].weaponEnums[1] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot5[1]);
				}
				if (MonoSingleton<GunControl>.Instance.slot5.Count > 2)
				{
					vanillaWeaponCycles[4].weaponEnums[2] = convertWeaponToWeaponEnum(MonoSingleton<GunControl>.Instance.slot5[2]);
				}
			}
			for (int i = 0; i < 5; i++)
			{
				for (int j = 0; j < 3; j++)
				{
					vanillaWeaponFields[i, j].value = vanillaWeaponCycles[i].weaponEnums[j];
				}
			}
		}

		public static void UpdateSettings()
		{
			updateVariantBinds();
			updateRememberVariation();
			updateSkipCycles();
			UpdateUseKeySettings();
			updateSwapBehavior();
			for (int i = 1; i < 100; i++)
			{
				((ConfigField)configPanels[i]).interactable = true;
				if (allWeaponFields[i, 1] == null || allWeaponFields[i, 1].value == WeaponEnum.None)
				{
					break;
				}
				bool flag = false;
				int num = 1;
				while (num < 100)
				{
					if (allWeaponFields[i, num] != null)
					{
						weaponCycles[i - 1].weaponEnums[num - 1] = allWeaponFields[i, num].value;
						((ConfigField)allWeaponFields[i, num]).interactable = true;
						((ConfigField)weaponSkipCycleFields[i, num]).interactable = true;
						if (allWeaponFields[i, num].value == WeaponEnum.None)
						{
							flag = true;
						}
						num++;
						continue;
					}
					goto IL_00f7;
				}
				continue;
				IL_00f7:
				WeaponCycle weaponCycle = weaponCycles[i - 1];
				if (num < 99 && !flag && allWeaponFields[i, num] == null && allWeaponFields[i, num + 1] == null)
				{
					CreateWeaponField(configPanels[i], weaponCycle, i, num);
					break;
				}
			}
			for (int j = 1; j < 100 && allWeaponFields[j, 1] != null; j++)
			{
				int num2 = 0;
				for (int k = 1; k < 100 && allWeaponFields[j, k] != null; k++)
				{
					bool flag2 = false;
					if (allWeaponFields[j, k].value == WeaponEnum.None)
					{
						num2++;
					}
					else if (num2 > 0)
					{
						flag2 = true;
						num2++;
					}
					if (flag2)
					{
						allWeaponFields[j, k].value = WeaponEnum.None;
					}
					if (num2 > 1)
					{
						((ConfigField)weaponSkipCycleFields[j, k]).interactable = false;
						((ConfigField)allWeaponFields[j, k]).interactable = false;
					}
				}
			}
			bool flag3 = true;
			for (int l = 1; l < 100; l++)
			{
				if (allWeaponFields[numWeaponCyclesActive, l] != null && allWeaponFields[numWeaponCyclesActive, l].value != 0)
				{
					flag3 = false;
					break;
				}
			}
			if (!flag3)
			{
				CreateWeaponCyclePanel(numWeaponCyclesActive + 1);
			}
			int num3 = 0;
			for (int m = 1; m < 100 && allWeaponFields[m, 1] != null; m++)
			{
				bool flag4 = false;
				for (int n = 1; n < 100; n++)
				{
					if (allWeaponFields[m, n] != null)
					{
						flag4 = true;
						if (allWeaponFields[m, n].value != 0)
						{
							flag4 = false;
							break;
						}
					}
				}
				if (flag4)
				{
					num3++;
				}
				if (num3 > 0 && m < numWeaponCyclesActive)
				{
					HideWeaponCyclePanel(m + 1);
				}
			}
		}

		public static void StartSettingsUpdate()
		{
			tickUpdateSettings = Plugin.tickCount;
		}

		public static void UpdateUseKeySettings()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 1; i < 100 && useKeyFields[i] != null; i++)
			{
				WeaponCycle weaponCycle = weaponCycles[i - 1];
				weaponCycle.useCode = convertKeyEnumToKeyCode(useKeyFields[i].value);
			}
		}

		public static ConfigPanel CreateWeaponCyclePanel(int i)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Expected O, but got Unknown
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Expected O, but got Unknown
			weaponCycles[i - 1] = new WeaponCycle();
			WeaponCycle weaponCycle = weaponCycles[i - 1];
			weaponCycle.ignoreInCycle = new bool[100];
			numWeaponCyclesActive++;
			for (int j = 0; j < weaponCycle.weaponEnums.Length; j++)
			{
				weaponCycle.weaponEnums[j] = WeaponEnum.None;
			}
			ConfigPanel val = new ConfigPanel((ConfigPanel)(object)division, "Weapon Cycle " + i, "customWeaponCyclePanel" + i);
			configPanels[i] = val;
			if (i % 2 == 1)
			{
				val.fieldColor = new Color(0.06f, 0.06f, 0.06f);
			}
			ConfigHeader val2 = new ConfigHeader(val, "Only the first weapon with this bind in the panel will be switched to. Default weapon binds will also be used before this.", 24);
			val2.textSize = 12;
			EnumField<KeyEnum> val3 = new EnumField<KeyEnum>(val, "Weapon Cycle Key", "customWeaponCycleKey" + i, KeyEnum.None);
			val3.onValueChange += delegate
			{
				StartSettingsUpdate();
			};
			weaponCycle.useCode = convertKeyEnumToKeyCode(val3.value);
			SetDisplayNames(val3);
			useKeyFields[i] = val3;
			BoolField val4 = new BoolField(val, "Remember Cycle Variation", "rememberCycleVariation" + i, false);
			object obj = <>c.<>9__25_1;
			if (obj == null)
			{
				BoolValueChangeEventDelegate val5 = delegate
				{
					StartSettingsUpdate();
				};
				<>c.<>9__25_1 = val5;
				obj = (object)val5;
			}
			val4.onValueChange += (BoolValueChangeEventDelegate)obj;
			weaponCycle.rememberVariation = val4.value;
			rememberVariationFields[i] = val4;
			EnumField<SwapBehaviorEnum> val6 = new EnumField<SwapBehaviorEnum>(val, "On Swap to Already Drawn Weapon", "swapBehavior" + i, SwapBehaviorEnum.NextVariation);
			val6.onValueChange += delegate
			{
				StartSettingsUpdate();
			};
			weaponCycle.swapBehavior = val6.value;
			val6.SetEnumDisplayName(SwapBehaviorEnum.FirstVariation, "First Variation");
			val6.SetEnumDisplayName(SwapBehaviorEnum.NextVariation, "Next Variation");
			val6.SetEnumDisplayName(SwapBehaviorEnum.SameVariation, "Same Variation");
			swapBehaviorFields[i] = val6;
			ConfigPanel val7 = new ConfigPanel(val, "Advanced Options", "advancedVanillaWeaponOptionsField" + i);
			ConfigHeader val8 = new ConfigHeader(val7, "Ignored weapons in cycle can only be switched to using specific variant binds.", 24);
			val8.textSize = 12;
			advancedWeaponOptionsFields[i] = val7;
			ConfigHeader val9 = new ConfigHeader(val, "Weapons", 24);
			for (int k = 1; k < 100 && CreateWeaponField(val, weaponCycle, i, k).value != 0; k++)
			{
			}
			return val;
		}

		public static void HideWeaponCyclePanel(int i)
		{
			((ConfigField)configPanels[i]).interactable = false;
			for (int j = 1; j < 100 && allWeaponFields[i, j] != null; j++)
			{
				allWeaponFields[i, j].value = WeaponEnum.None;
			}
		}

		public static EnumField<WeaponEnum> CreateWeaponField(ConfigPanel newWeaponCyclePanel, WeaponCycle weaponCycle, int i, int j)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Expected O, but got Unknown
			EnumField<WeaponEnum> val = new EnumField<WeaponEnum>(newWeaponCyclePanel, "Weapon " + j, "customWeaponCycle" + i + "weapon" + j, WeaponEnum.None);
			allWeaponFields[i, j] = val;
			val.onValueChange += delegate
			{
				StartSettingsUpdate();
			};
			weaponCycle.weaponEnums[j - 1] = val.value;
			setWeaponEnumDisplayNames(val);
			if (j % 2 == 0)
			{
				val.fieldColor = new Color(0.06f, 0.06f, 0.06f);
			}
			ConfigPanel val2 = advancedWeaponOptionsFields[i];
			BoolField val3 = new BoolField(val2, "Ignore Weapon " + j + " in cycle", "ignoreWeaponInCycle" + i + "_" + j, false);
			object obj = <>c.<>9__27_1;
			if (obj == null)
			{
				BoolValueChangeEventDelegate val4 = delegate
				{
					StartSettingsUpdate();
				};
				<>c.<>9__27_1 = val4;
				obj = (object)val4;
			}
			val3.onValueChange += (BoolValueChangeEventDelegate)obj;
			weaponCycles[i - 1].ignoreInCycle[j] = val3.value;
			weaponSkipCycleFields[i, j] = val3;
			return val;
		}

		public static void HideWeaponField(int i, int j)
		{
			((ConfigField)allWeaponFields[i, j]).interactable = false;
			((ConfigField)weaponSkipCycleFields[i, j]).interactable = false;
		}

		public static void updateVariantBinds()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			for (int i = 3; i < 100; i++)
			{
				variationBinds[i] = (KeyCode)(int)convertKeyEnumToKeyCode(weaponVariantBindFields[i].value);
			}
		}

		public static void updateSkipCycles()
		{
			for (int i = 0; i < 5; i++)
			{
				for (int j = 0; j < 3; j++)
				{
					vanillaWeaponCycles[i].ignoreInCycle[j] = vanillaWeaponSkipCycleFields[i, j].value;
				}
			}
			for (int k = 1; k < 100 && weaponSkipCycleFields[k, 1] != null; k++)
			{
				for (int l = 1; l < 100 && weaponSkipCycleFields[k, l] != null; l++)
				{
					weaponCycles[k - 1].ignoreInCycle[l] = weaponSkipCycleFields[k, l].value;
				}
			}
		}

		public static void updateSwapBehavior()
		{
			for (int i = 0; i < 5; i++)
			{
				vanillaWeaponCycles[i].swapBehavior = vanillaSwapBehaviorFields[i].value;
			}
			for (int j = 1; j < 100 && swapBehaviorFields[j] != null; j++)
			{
				weaponCycles[j - 1].swapBehavior = swapBehaviorFields[j].value;
			}
		}

		public static void updateRememberVariation()
		{
			for (int i = 0; i < 5; i++)
			{
				vanillaWeaponCycles[i].rememberVariation = rememberVanillaVariationFields[i].value;
			}
			for (int j = 1; j < 100 && rememberVariationFields[j] != null; j++)
			{
				weaponCycles[j - 1].rememberVariation = rememberVariationFields[j].value;
			}
		}

		public static void WeaponVariantBindsConfig()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected I4, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: 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_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Expected O, but got Unknown
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_0569: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f6: Expected O, but got Unknown
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Expected O, but got Unknown
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Expected O, but got Unknown
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Expected O, but got Unknown
			//IL_0473: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Expected O, but got Unknown
			PluginConfigurator val = PluginConfigurator.Create("WeaponVariantBinds", "WeaponVariantBinds");
			val.SetIconWithURL(Path.Combine(DefaultParentFolder, "icon.png") ?? "");
			ConfigHeader val2 = new ConfigHeader(val.rootPanel, "This mod overrides vanilla weapon switching, incompatibilies with other mods may arise.", 24);
			val2.textSize = 14;
			val2.textColor = Color.red;
			BoolField val3 = new BoolField(val.rootPanel, "Mod Enabled", "modEnabled", true);
			ConfigPanel val4 = new ConfigPanel(val.rootPanel, "Advanced Options", "advancedOptionsPanel");
			ConfigHeader val5 = new ConfigHeader(val4, "Variant Binds 1-3 are in Ultrakill's main controls settings.", 24);
			val5.textSize = 12;
			for (int i = 3; i < 100; i++)
			{
				EnumField<KeyEnum> val6 = new EnumField<KeyEnum>(val4, "Weapon Variant Bind " + (i + 1), "variantBind" + i, KeyEnum.None);
				val6.onValueChange += delegate
				{
					StartSettingsUpdate();
				};
				variationBinds[i] = (KeyCode)(int)convertKeyEnumToKeyCode(val6.value);
				weaponVariantBindFields[i] = val6;
				SetDisplayNames(val6);
			}
			division = new ConfigDivision(val.rootPanel, "division");
			object obj = <>c.<>9__40_0;
			if (obj == null)
			{
				BoolValueChangeEventDelegate val7 = delegate(BoolValueChangeEvent e)
				{
					Plugin.modEnabled = e.value;
					((ConfigField)division).interactable = e.value;
				};
				<>c.<>9__40_0 = val7;
				obj = (object)val7;
			}
			val3.onValueChange += (BoolValueChangeEventDelegate)obj;
			Plugin.modEnabled = val3.value;
			((ConfigField)division).interactable = val3.value;
			string[] array = new string[5] { "Revolver", "Shotgun", "Nailgun", "Railcannon", "Rocket Launcher" };
			Color[] array2 = (Color[])(object)new Color[5]
			{
				new Color(0f, 0f, 0.2f),
				new Color(0.2f, 0f, 0f),
				new Color(0f, 0.2f, 0f),
				new Color(0.1f, 0f, 0.1f),
				new Color(0.1f, 0.1f, 0f)
			};
			for (int j = 0; j < 5; j++)
			{
				string text = array[j];
				WeaponCycle weaponCycle = vanillaWeaponCycles[j];
				ConfigPanel val8 = new ConfigPanel((ConfigPanel)(object)division, text + " Weapon Cycle", "customWeaponCyclePanel" + text);
				val8.fieldColor = array2[j];
				ConfigHeader val9 = new ConfigHeader(val8, "The use key for this weapon is whatever it is set to in Ultrakill main settings.", 24);
				val9.textSize = 12;
				BoolField val10 = new BoolField(val8, "Remember Cycle Variation", "rememberCycleVariation" + text, false);
				object obj2 = <>c.<>9__40_2;
				if (obj2 == null)
				{
					BoolValueChangeEventDelegate val11 = delegate
					{
						StartSettingsUpdate();
					};
					<>c.<>9__40_2 = val11;
					obj2 = (object)val11;
				}
				val10.onValueChange += (BoolValueChangeEventDelegate)obj2;
				weaponCycle.rememberVariation = val10.value;
				rememberVanillaVariationFields[j] = val10;
				EnumField<SwapBehaviorEnum> val12 = new EnumField<SwapBehaviorEnum>(val8, "On Swap to Already Drawn Weapon", "swapBehavior" + text, SwapBehaviorEnum.NextVariation);
				val12.onValueChange += delegate
				{
					StartSettingsUpdate();
				};
				weaponCycle.swapBehavior = val12.value;
				val12.SetEnumDisplayName(SwapBehaviorEnum.FirstVariation, "First Variation");
				val12.SetEnumDisplayName(SwapBehaviorEnum.NextVariation, "Next Variation");
				val12.SetEnumDisplayName(SwapBehaviorEnum.SameVariation, "Same Variation");
				vanillaSwapBehaviorFields[j] = val12;
				ConfigPanel val13 = new ConfigPanel(val8, "Advanced Options", "advancedWeaponOptionsField" + j);
				ConfigHeader val14 = new ConfigHeader(val13, "Ignored weapons in cycle can only be switched to using specific variant binds.", 24);
				val14.textSize = 12;
				ConfigHeader val15 = new ConfigHeader(val8, "Weapons", 24);
				for (int k = 0; k < 3; k++)
				{
					EnumField<WeaponEnum> val16 = new EnumField<WeaponEnum>(val8, "Weapon " + (k + 1), "vanillaWeaponCycle" + (j + 1) + "weapon" + (k + 1), vanillaWeaponCycles[j].weaponEnums[k]);
					((ConfigField)val16).interactable = false;
					setWeaponEnumDisplayNames(val16);
					if (k % 2 == 1)
					{
						val16.fieldColor = new Color(0.06f, 0.06f, 0.06f);
					}
					vanillaWeaponFields[j, k] = val16;
					BoolField val17 = new BoolField(val13, "Ignore Weapon " + (k + 1) + " in cycle", "ignoreVanillaWeaponInCycle" + (j + 1) + "_" + (k + 1), false);
					object obj3 = <>c.<>9__40_4;
					if (obj3 == null)
					{
						BoolValueChangeEventDelegate val18 = delegate
						{
							StartSettingsUpdate();
						};
						<>c.<>9__40_4 = val18;
						obj3 = (object)val18;
					}
					val17.onValueChange += (BoolValueChangeEventDelegate)obj3;
					vanillaWeaponCycles[j].ignoreInCycle[k] = val17.value;
					vanillaWeaponSkipCycleFields[j, k] = val17;
				}
			}
			ConfigHeader val19 = new ConfigHeader((ConfigPanel)(object)division, "Specific weapon variant binds can be made down here with a weapon cycle. Consult the readme on the mod page if you need help.", 24);
			val19.textSize = 14;
			for (int l = 1; l <= weaponCycles.Length; l++)
			{
				CreateWeaponCyclePanel(l);
				if (allWeaponFields[l, 1] == null || allWeaponFields[l, 1].value == WeaponEnum.None)
				{
					break;
				}
			}
		}
	}
	public class PluginOld
	{
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "WeaponVariantBinds";

		public const string PLUGIN_NAME = "WeaponVariantBinds";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}