Decompiled source of CiarencesUnbelievableModifications H3VR v1.3.2

CiarencesUnbelievableModifications_H3VR/CiarenceW.CiarencesUnbelievableModifications_H3VR.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CiarencesUnbelievableModifications.Libraries;
using CiarencesUnbelievableModifications.MonoBehaviours;
using CiarencesUnbelievableModifications.Patches;
using FistVR;
using HarmonyLib;
using HarmonyLib.Public.Patching;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("CiarenceW")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Small tweaks and QoL things for H3VR")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyInformationalVersion("1.3.1")]
[assembly: AssemblyProduct("CiarenceW.CiarencesUnbelievableModifications_H3VR")]
[assembly: AssemblyTitle("CiarencesUnbelievableModifications")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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;
		}
	}
}
public class MethodSignature
{
	private static readonly Dictionary<string, Type> primitive_types_lookup = new Dictionary<string, Type>
	{
		{
			"void",
			typeof(void)
		},
		{
			"bool",
			typeof(bool)
		},
		{
			"byte",
			typeof(byte)
		},
		{
			"sbyte",
			typeof(sbyte)
		},
		{
			"char",
			typeof(char)
		},
		{
			"decimal",
			typeof(decimal)
		},
		{
			"double",
			typeof(double)
		},
		{
			"float",
			typeof(float)
		},
		{
			"int",
			typeof(int)
		},
		{
			"uint",
			typeof(uint)
		},
		{
			"nint",
			typeof(IntPtr)
		},
		{
			"nuint",
			typeof(UIntPtr)
		},
		{
			"long",
			typeof(long)
		},
		{
			"ulong",
			typeof(ulong)
		},
		{
			"short",
			typeof(short)
		},
		{
			"ushort",
			typeof(ushort)
		},
		{
			"object",
			typeof(object)
		},
		{
			"string",
			typeof(string)
		}
	};

	public BindingFlags binding_flags { get; }

	public Type? return_type { get; }

	public Type enclosing_type { get; }

	public string method_name { get; }

	public string[] method_arguments { get; }

	private MethodSignature(BindingFlags flags, Type return_type, Type enclosing_type, string name, string[] arguments)
	{
		binding_flags = flags;
		this.return_type = return_type;
		this.enclosing_type = enclosing_type;
		method_name = name;
		method_arguments = arguments;
	}

	private static Type? GetTypeFromAppDomain(string typename_at_assembly)
	{
		string[] array = typename_at_assembly.Split(new char[1] { '@' });
		return GetTypeFromAppDomain(array[0], (array.Length > 1) ? array[1] : "");
	}

	private static Type? GetTypeFromAppDomain(string typename, string assembly_name)
	{
		assembly_name = assembly_name.Trim();
		if (assembly_name.StartsWith("@"))
		{
			assembly_name = assembly_name.Substring(1);
		}
		Assembly assembly = null;
		Type type = null;
		try
		{
			if (!string.IsNullOrEmpty(assembly_name))
			{
				assembly = Assembly.Load(assembly_name);
			}
			if ((object)assembly != null)
			{
				type = assembly.GetType(typename);
			}
			else
			{
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				for (int i = 0; i < assemblies.Length; i++)
				{
					type = assemblies[i].GetType(typename);
					if ((object)type != null)
					{
						break;
					}
				}
			}
		}
		catch
		{
		}
		return type;
	}

	private static string UnmangleGenericName(string generic_name)
	{
		int num = generic_name.IndexOf('`');
		if (num <= 0)
		{
			return generic_name;
		}
		string text = generic_name.Substring(0, num);
		_ = generic_name[num + 1];
		string generic_name2 = generic_name.Substring(generic_name.IndexOf('[') + 1, generic_name.LastIndexOf(']') - generic_name.IndexOf('[') - 1);
		return text + "<" + UnmangleGenericName(generic_name2) + ">";
	}

	private static string ExpandTypenames(string parameter_string)
	{
		bool flag = false;
		Match match = Regex.Match(parameter_string, "^(ref|out)\\s+");
		if (match.Success)
		{
			flag = true;
			parameter_string = parameter_string.Remove(0, match.Length);
		}
		int num = 0;
		Match match2 = Regex.Match(parameter_string, "[<>,]");
		if (!match2.Success)
		{
			string text = parameter_string.Split(new char[1] { ' ' })[0];
			if (primitive_types_lookup.ContainsKey(text))
			{
				return primitive_types_lookup[text].ToString() + (flag ? "&" : "");
			}
			return text;
		}
		StringBuilder stringBuilder = new StringBuilder();
		do
		{
			string text2 = parameter_string.Substring(num, match2.Index - num);
			if (primitive_types_lookup.ContainsKey(text2))
			{
				stringBuilder.Append(primitive_types_lookup[text2]);
			}
			else
			{
				stringBuilder.Append(text2);
			}
			stringBuilder.Append(parameter_string[match2.Index]);
			num = match2.Index + 1;
			match2 = match2.NextMatch();
		}
		while (match2.Success);
		return stringBuilder.ToString();
	}

	private static string[] GetArgumentTypes(string argument_string)
	{
		List<string> list = new List<string> { "" };
		int num = 0;
		int num2 = 0;
		for (int i = 0; i < argument_string.Length; i++)
		{
			char c = argument_string[i];
			if (c == ',' && num == 0)
			{
				list.Add("");
				num2++;
				continue;
			}
			switch (c)
			{
			case '<':
				num++;
				break;
			case '>':
				num--;
				break;
			default:
				if (num > 0 && char.IsWhiteSpace(c))
				{
					continue;
				}
				break;
			}
			list[num2] += c;
		}
		return (from arg in list
			select ExpandTypenames(arg.Trim()) into arg
			where !string.IsNullOrEmpty(arg)
			select arg).ToArray();
	}

	public static MethodSignature Parse(string string_signature)
	{
		string[] array = string_signature.Trim().Split('(', ')');
		string[] array2 = array[0].Split(new char[1] { ' ' });
		BindingFlags bindingFlags = BindingFlags.Default;
		bindingFlags = (array2.Contains("public") ? (bindingFlags | BindingFlags.Public) : ((!array2.Contains("private") && !array2.Contains("protected")) ? (bindingFlags | (BindingFlags.Public | BindingFlags.NonPublic)) : (bindingFlags | BindingFlags.NonPublic)));
		bindingFlags = ((!array2.Contains("static")) ? (bindingFlags | BindingFlags.Instance) : (bindingFlags | BindingFlags.Static));
		Type type = null;
		if (array2.Length > 1)
		{
			string text = array2[^2];
			if (primitive_types_lookup.ContainsKey(text))
			{
				type = primitive_types_lookup[text];
			}
			else
			{
				Type typeFromAppDomain = GetTypeFromAppDomain(text);
				if ((object)typeFromAppDomain != null)
				{
					type = typeFromAppDomain;
				}
			}
		}
		string text2 = array2.Last();
		Type typeFromAppDomain2 = GetTypeFromAppDomain(text2.Substring(0, text2.LastIndexOf('.')), array.Last());
		return new MethodSignature(bindingFlags, type, typeFromAppDomain2, text2.Substring(text2.LastIndexOf('.') + 1), GetArgumentTypes(array[1]));
	}

	public static MethodInfo? FindMethod(string method_signature)
	{
		return Parse(method_signature).FindMethod();
	}

	public static MethodInfo? FindMethod(Type targetClass, string targetMethod, string args = "", BindingFlags flags = BindingFlags.Default, Type returnType = null)
	{
		if ((object)returnType == null)
		{
			returnType = typeof(void);
		}
		return new MethodSignature(flags, returnType, targetClass, targetMethod, GetArgumentTypes(args.Trim('(', ')'))).FindMethod();
	}

	public MethodInfo? FindMethod()
	{
		List<MethodInfo> list = new List<MethodInfo>();
		MethodInfo[] methods = enclosing_type.GetMethods(binding_flags);
		foreach (MethodInfo methodInfo in methods)
		{
			if (methodInfo.Name == method_name)
			{
				list.Add(methodInfo);
			}
		}
		if (list.Count > 0)
		{
			if (list.Count == 1)
			{
				return list[0];
			}
			foreach (MethodInfo item in list)
			{
				string[] array = (from param in item.GetParameters()
					select UnmangleGenericName(param.ParameterType.ToString())).ToArray();
				if (array.Length != method_arguments.Length)
				{
					continue;
				}
				bool flag = true;
				for (int j = 0; j < method_arguments.Length; j++)
				{
					if (array[j] != method_arguments[j])
					{
						flag = false;
						break;
					}
				}
				if (flag)
				{
					return item;
				}
			}
		}
		return null;
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace CiarencesUnbelievableModifications
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("h3vr.exe")]
	[BepInPlugin("CiarenceW.CiarencesUnbelievableModifications_H3VR", "CiarencesUnbelievableModifications", "1.3.1")]
	public class CiarencesUnbelievableModifications : BaseUnityPlugin
	{
		public static PluginInfo safehouseProgressionPlugin;

		public static PluginInfo betterHandsPlugin;

		public static bool isBetterHandsPalmingEnabled;

		public static PluginInfo stovepipePlugin;

		public const string HarmonyInstanceOwnerId = "CiarencesHarmonyInstanceIWILLKillYouInH3VRIfYouTouchIt";

		private static FieldInfo logColours;

		internal static Dictionary<ConsoleColor, Color> m_C2Cdict = new Dictionary<ConsoleColor, Color>
		{
			[ConsoleColor.Black] = GetColorFromHTMLString("#000000"),
			[ConsoleColor.DarkBlue] = GetColorFromHTMLString("#00008B"),
			[ConsoleColor.DarkGreen] = GetColorFromHTMLString("#006400"),
			[ConsoleColor.DarkCyan] = GetColorFromHTMLString("#008B8B"),
			[ConsoleColor.DarkRed] = GetColorFromHTMLString("#8B0000"),
			[ConsoleColor.DarkMagenta] = GetColorFromHTMLString("#8B008B"),
			[ConsoleColor.DarkYellow] = GetColorFromHTMLString("#8B8803"),
			[ConsoleColor.Gray] = GetColorFromHTMLString("#808080"),
			[ConsoleColor.DarkGray] = GetColorFromHTMLString("#A9A9A9"),
			[ConsoleColor.Blue] = GetColorFromHTMLString("#0000FF"),
			[ConsoleColor.Green] = GetColorFromHTMLString("#008000"),
			[ConsoleColor.Cyan] = GetColorFromHTMLString("#00FFFF"),
			[ConsoleColor.Red] = GetColorFromHTMLString("#FF0000"),
			[ConsoleColor.Magenta] = GetColorFromHTMLString("#FF00FF"),
			[ConsoleColor.Yellow] = GetColorFromHTMLString("#FFFF00"),
			[ConsoleColor.White] = GetColorFromHTMLString("#FFFFFF")
		};

		public const string Id = "CiarenceW.CiarencesUnbelievableModifications_H3VR";

		internal static Harmony HarmonyInstance { get; } = new Harmony("CiarencesHarmonyInstanceIWILLKillYouInH3VRIfYouTouchIt");


		public static CiarencesUnbelievableModifications Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		public static string Name => "CiarencesUnbelievableModifications";

		public static string Version => "1.3.1";

		private void Awake()
		{
			Instance = this;
			Type[] types = typeof(BepInPlugin).Assembly.GetTypes();
			foreach (Type type in types)
			{
				if (type.FullName == "BepInEx.ConsoleUtil.Kon")
				{
					ConsoleColourer.konType = type;
					break;
				}
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			SettingsManager.InitializeAndBindSettings(((BaseUnityPlugin)this).Config);
			CheckForIncompatibilites();
			PatchAll();
			if (Random.Range(0, 10000) > 9999)
			{
				SaySomething();
			}
			ConsoleColourer.BackgroundColor = ConsoleColor.Red;
			Logger.LogMessageWithColor("CiarenceW.CiarencesUnbelievableModifications_H3VR version " + Version + " prepped and ready", ConsoleColor.Green);
			ConsoleColourer.BackgroundColor = ConsoleColor.Black;
		}

		private void SaySomething()
		{
			ConsoleColourer.BackgroundColor = ConsoleColor.DarkMagenta;
			Logger.LogWithCustomLevelNameAndColor("FUCK YOU", "Evil Ciarence", ConsoleColor.Yellow);
			ConsoleColourer.BackgroundColor = ConsoleColor.Black;
		}

		private void PatchAll()
		{
			HarmonyInstance.PatchAll(typeof(MagRetentionTweaks.MagRetentionTweaksTranspilers));
			HarmonyInstance.PatchAll(typeof(MagRetentionTweaks.MagRetentionTweaksHarmonyFixes));
			HarmonyInstance.PatchAll(typeof(CylinderBulletCollector));
			HarmonyInstance.PatchAll(typeof(CylinderBulletCollector.CylinderBulletCollectorTranspiler));
			HarmonyInstance.PatchAll(typeof(BoltHandleLockSoundTweaks));
			HarmonyInstance.PatchAll(typeof(BoltHandleLockSoundTweaks.Transpilers));
			HarmonyInstance.PatchAll(typeof(ReverseMagHoldPos));
			HarmonyInstance.PatchAll(typeof(MagRetentionTweaks.MagPalmKeepOffsetPatch.MagPalmKeepOffsetHarmonyPatches));
			HarmonyInstance.PatchAll(typeof(MagRetentionTweaks.MagPalmKeepOffsetPatch.MagPalmKeepOffsetTranspilers));
			HarmonyInstance.PatchAll(typeof(FireArmTweaks.SpawnStockTweaks));
			HarmonyInstance.PatchAll(typeof(FireArmTweaks.BitchDontTouchMyGun));
			HarmonyInstance.PatchAll(typeof(InstitutionPreviewReenabler));
			HarmonyInstance.PatchAll(typeof(CompetitiveShellGrabbing.Patches));
			HarmonyInstance.PatchAll(typeof(CompetitiveShellGrabbing.Transpilers));
			HarmonyInstance.PatchAll(typeof(FireArmTweaks.KnockAKDrumOut));
			HarmonyInstance.PatchAll(typeof(OptionGunCategoryBlacklister.Transpilers));
			HarmonyInstance.PatchAll(typeof(FireArmTweaks.AddChamberLoadingForMoreFireArms));
			HarmonyInstance.PatchAll(typeof(BepInExFunnyThing));
		}

		internal void CheckForIncompatibilites()
		{
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Expected O, but got Unknown
			Logger.LogMessageWithColor("Suicide protocol engaged.", ConsoleColor.DarkRed);
			if (!Chainloader.PluginInfos.TryGetValue("NGA.SafehouseProgression", out safehouseProgressionPlugin))
			{
				Chainloader.PluginInfos.TryGetValue("NGA.SafehouseMP", out safehouseProgressionPlugin);
			}
			ConfigEntry<bool> val = default(ConfigEntry<bool>);
			if (Chainloader.PluginInfos.TryGetValue("maiq.BetterHand", out betterHandsPlugin) && betterHandsPlugin.Instance.Config.TryGetEntry<bool>("MagPalm Options", "aEnable", ref val))
			{
				isBetterHandsPalmingEnabled = val.Value;
				val.SettingChanged += delegate(object sender, EventArgs args)
				{
					isBetterHandsPalmingEnabled = (sender as ConfigEntry<bool>).Value;
				};
			}
			if (Chainloader.PluginInfos.TryGetValue("nrgill28.Sodalite", out var value) && SettingsManager.configEnableSodaliteConsoleColorPatch.Value)
			{
				object? value2 = AccessTools.Field(((object)value.Instance).GetType(), "_modPanelPrefab").GetValue(value.Instance);
				MonoBehaviour[] components = ((GameObject)((value2 is GameObject) ? value2 : null)).GetComponents<MonoBehaviour>();
				object obj = null;
				for (int i = 0; i < components.Length; i++)
				{
					if ((object)AccessTools.Field(((object)components[i]).GetType(), "LogPage") != null)
					{
						obj = AccessTools.Field(((object)components[i]).GetType(), "LogPage").GetValue(components[i]);
					}
				}
				if (obj != null)
				{
					logColours = AccessTools.Field(obj.GetType(), "LogColors");
					(logColours.GetValue(obj) as Dictionary<LogLevel, string>).Add((LogLevel)696969, "pink");
					HarmonyMethod val2 = new HarmonyMethod(AccessTools.Method(typeof(CiarencesUnbelievableModifications), "TranspileSodaliteConsoleUpdateText", (Type[])null, (Type[])null));
					HarmonyInstance.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("Sodalite.ModPanel.Pages.UniversalModPanelLogPage"), "UpdateText", new Type[1] { typeof(bool) }, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			Logger.LogMessageWithColor("Suicide postponed.", ConsoleColor.Green);
			Chainloader.PluginInfos.TryGetValue("dll.smidgeon.failuretoeject", out stovepipePlugin);
		}

		internal static Color GetColorFromHTMLString(string piss)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(piss, ref result))
			{
				return result;
			}
			return Color.white;
		}

		public static Color GetColorFromConsoleColor(ConsoleColor consoleColor)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (m_C2Cdict.TryGetValue(consoleColor, out var value))
			{
				return value;
			}
			return Color.white;
		}

		[HarmonyWrapSafe]
		internal static IEnumerable<CodeInstruction> TranspileSodaliteConsoleUpdateText(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator);
			Debug.Log((object)"penis");
			if (val.TryMatchForward(false, __originalMethod, new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)logColours, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(LogEventArgs), "Level"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)null, (string)null)))
			{
				val.RemoveInstructions(4).Insert((CodeInstruction[])(object)new CodeInstruction[7]
				{
					new CodeInstruction(OpCodes.Ldstr, (object)"#"),
					new CodeInstruction(OpCodes.Ldloc_S, (object)5),
					new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(LogEventArgs), "Level")),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(LogLevelExtensions), "GetConsoleColor", (Type[])null, (Type[])null)),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CiarencesUnbelievableModifications), "GetColorFromConsoleColor", (Type[])null, (Type[])null)),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ColorUtility), "ToHtmlStringRGB", (Type[])null, (Type[])null)),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(string), "Concat", new Type[2]
					{
						typeof(string),
						typeof(string)
					}, (Type[])null))
				});
			}
			val.Print();
			return val.InstructionEnumeration();
		}
	}
	internal static class SettingsManager
	{
		private const string debugCatName = "Debug";

		private const string magRetentionCatName = "Magazine Retention";

		private const string cylinderBulletCollectorCatName = "Cylinder Bullet Collector";

		private const string reverseMagHoldPosCatName = "Reverse Magazine Hold";

		private const string reverseMagHoldOffset = "Reverse Magazine Hold | Custom Offsets";

		private const string boltHandleSoundTweaksCatName = "Bolt Handle Sounds";

		private const string bitchDontGrabMyGunCatName = "Bitch Dont Grab My Gun";

		private const string foldStockOnSpawn = "Fold Stock On Spawn";

		private const string competitiveShellGrabbing = "Competitive Shell Grabbing";

		private const string timedObjectDestructionCatName = "Timed Object Destruction";

		private const string knockAKDrumOutCatName = "Knock AK Drums out";

		private const string easyMagLoadingCategoryBlacklistCatName = "Easy Mag Loading Category Blacklist";

		private const string virtualStockCategoryBlacklistCatName = "Virtual Stock Category Blacklist";

		private const string experimentalCatName = "Experimental stuff, might not work ^^ (probably requires restart)";

		internal static ConfigEntry<bool> configVerbose;

		internal static ConfigEntry<float> configMagRetentionMinimumDistanceThreshold;

		internal static ConfigEntry<float> configMagRetentionMinimumDotThreshold;

		internal static ConfigEntry<bool> configEnableMagPalmKeepOffset;

		internal static ConfigEntry<bool> configEnableQuickRetainedMagRelease;

		internal static ConfigEntry<bool> configEnableQuickRetainedMagReleaseMaximumHoldTime;

		internal static ConfigEntry<float> configQuickRetainedMagReleaseMaximumHoldTime;

		internal static ConfigEntry<bool> configEnableCylinderBulletCollector;

		internal static ConfigEntry<bool> configEnableReverseMagHold;

		internal static ConfigEntry<float> configReverseMagGrabMinDotProduct;

		internal static ConfigEntry<float> configReverseMagHoldPositionDistance;

		internal static ConfigEntry<bool> configReverseMagHoldHandgunOnly;

		internal static ConfigEntry<bool> configEnableFuckYouBitchDontGrabMyGun;

		internal static ConfigEntry<bool> configOnlyHandguns;

		internal static ConfigEntry<bool> configEnableStockFoldOnSpawn;

		internal static ConfigEntry<bool> configForceSilenceHitLock;

		internal static ConfigEntry<bool> configEnableCompetitiveShellGrabbing;

		internal static ConfigEntry<bool> configOnlyGrabXFromQB;

		internal static ConfigEntry<bool> configOnlyGrabPairAmountOfShells;

		internal static ConfigEntry<bool> configRevertToNormalGrabbingWhenAboveX;

		internal static ConfigEntry<int> configMaxShellsInHand;

		internal static ConfigEntry<bool> configNoLeverAction;

		internal static ConfigEntry<bool> configForceUnconditionalCompetitiveShellGrabbing;

		internal static ConfigEntry<Vector3> configCompetitiveShellPoseOverridePosition;

		internal static ConfigEntry<Vector3> configCompetitiveShellPoseOverrideRotation;

		internal static ConfigEntry<bool> configIncreaseRoundInsertTriggerZone;

		internal static ConfigEntry<float> configTriggerZoneMultiplier;

		internal static ConfigEntry<bool> configPezOnGrabOneShell;

		internal static ConfigEntry<bool> configGrabOneShellOnTrigger;

		internal static ConfigEntry<bool> configReverseGrabAndTrigger;

		internal static ConfigEntry<bool> configOnlyGrabOneWhenChamberOpen;

		internal static ConfigEntry<bool> configGrabOneWhenSmartPalmingOff;

		internal static ConfigEntry<bool> configEnableKnockAKDrumOut;

		internal static ConfigEntry<bool> configForAllNonEjectableGuns;

		internal static SectionConfigList<OTagFirearmAction> sectionConfigListVirtualStockBlacklist;

		internal static SectionConfigList<OTagFirearmSize> sectionConfigListEasyMagLoadingBlacklist;

		internal static ConfigEntry<string> configVirtualStockWeaponBlacklist;

		internal static ConfigEntry<string> configVirtualStockWeaponWhitelist;

		internal static ConfigEntry<string> configEasyMagLoadingWeaponBlacklist;

		internal static ConfigEntry<string> configEasyMagLoadingWeaponWhitelist;

		internal static ConfigEntry<bool> configEnableSodaliteConsoleColorPatch;

		internal static ConfigFile configFile;

		internal static ConfigEntry<bool> configEnableTimedObjectDestruction;

		internal static ConfigEntry<float> configTODTimeToDestroy;

		internal static ConfigEntry<bool> configTODEnableFirearms;

		internal static ConfigEntry<bool> configTODEnableMagazines;

		internal static ConfigEntry<bool> configTODEmptyMagazinesOnly;

		internal static ConfigEntry<bool> configTODEnableRounds;

		internal static ConfigEntry<bool> configTODEnableAll;

		internal static bool Verbose => configVerbose.Value;

		internal static void InitializeAndBindSettings(ConfigFile config)
		{
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			configFile = config;
			configVerbose = config.Bind<bool>("Debug", "EnableVerbose", false, "Adds logging information for debugging purposes");
			configEnableQuickRetainedMagRelease = config.Bind<bool>("Magazine Retention", "EnableQuickRetainedMagRelease", true, "Allows you to drop a retained magazine simply by releasing the touchpad/thumbstick, nice for people who don't like the Quest 2's thumbsticks");
			configEnableQuickRetainedMagReleaseMaximumHoldTime = config.Bind<bool>("Magazine Retention", "EnableQuickRetainedMagReleaseMaxHeldTime", true, "Allows you to keep a retained magazine without having to hold by pressing and releasing quickly the touchpad");
			configQuickRetainedMagReleaseMaximumHoldTime = config.Bind<float>("Magazine Retention", "QuickRetainedMagReleaseMaximumHoldTime", 0.1f, "Maximum amount of time that the touchpad must be held down before the retained magazine can be released by letting go of the touchpad");
			configEnableMagPalmKeepOffset = config.Bind<bool>("Magazine Retention", "EnableMagPalmKeepOffset", true, "Keeps the offset of the palmed magazine");
			configMagRetentionMinimumDistanceThreshold = config.Bind<float>("Magazine Retention", "MagRetentionMinimumDistanceThreshold", 0.2f, "The minimum distance between the gun's magazine and the magazine in the other hand needed for the gun's mag to be retained");
			configMagRetentionMinimumDotThreshold = config.Bind<float>("Magazine Retention", "MagRetentionMinimumDotThreshold", 0.8f, "The closer the value is to 1, the closer the angles of the two magazines must match for the gun's mag to be retained (0 is perpendicular, 1 is exact, -1 to disable)");
			configEnableCylinderBulletCollector = config.Bind<bool>("Cylinder Bullet Collector", "EnableCylinderBulletCollector", true, "Allows you to eject the cylinder of a revolver and keep its unspent rounds by grabbing it and pressing the trigger");
			configEnableReverseMagHold = config.Bind<bool>("Reverse Magazine Hold", "EnableReverseMagHold", false, "Allows you to grab a magazine upside-down (Disabled automatically when BetterHands' mag palming is on)");
			configReverseMagGrabMinDotProduct = config.Bind<float>("Reverse Magazine Hold", "ReverseMagHoldMinDotProduct", 0.4f, "The minimum difference between the hand and the magazine for the magazine to be grabbed upside-down (a value of 1 means disabled)");
			configReverseMagHoldPositionDistance = config.Bind<float>("Reverse Magazine Hold", "ReverseMagHoldPositionDistance", 0.15f, "The offset between the center of your hand and the magazine's reversed position");
			configReverseMagHoldHandgunOnly = config.Bind<bool>("Reverse Magazine Hold", "ReverseMagHoldHandgunOnly", false, "Only allow handgun magazines to be held upside down");
			configReverseMagHoldPositionDistance.SettingChanged += delegate
			{
				FVRMagazinePoseExtender[] array = Object.FindObjectsOfType<FVRMagazinePoseExtender>();
				for (int i = 0; i < array.Length; i++)
				{
					array[i].OffsetReverseHoldingPose();
				}
			};
			configForceSilenceHitLock = config.Bind<bool>("Bolt Handle Sounds", "ForceSilenceHitLock", false, "Mutes the Handle Forward sound when the rotation charging handle is locked");
			configEnableFuckYouBitchDontGrabMyGun = config.Bind<bool>("Bitch Dont Grab My Gun", "EnableBitchDontGrabMyGun", false, "Prevents your other hand from instantly grabbing the gun you're currently holding");
			configOnlyHandguns = config.Bind<bool>("Bitch Dont Grab My Gun", "OnlyHandguns", true, "Only enables the gun snatching prevention for handguns");
			configEnableStockFoldOnSpawn = config.Bind<bool>("Fold Stock On Spawn", "EnableStockFoldOnSpawn", CiarencesUnbelievableModifications.safehouseProgressionPlugin == null, "Makes the foldable stocks of guns be folded when spawned");
			configEnableCompetitiveShellGrabbing = config.Bind<bool>("Competitive Shell Grabbing", "EnableCompetitiveShellGrabbing", false, "Enables grabbing shotgun shells competitive-shooting style");
			configOnlyGrabXFromQB = config.Bind<bool>("Competitive Shell Grabbing", "OnlyGrabXFromQB", true, "Only grab X amount (MaxShellsInPalm) of shells from a non-spawnlocked quickbelt slot");
			configRevertToNormalGrabbingWhenAboveX = config.Bind<bool>("Competitive Shell Grabbing", "RevertToNormalProxyPositionWhenAboveX", false, "If amount of shells palmed in hand is above X (MaxShellsInPalm), revert to \"pez dispenser\" holding style");
			configMaxShellsInHand = config.Bind<int>("Competitive Shell Grabbing", "MaxShellsInPalm", 4, "The max amount of shells that can be palmed in a competitive-shooting style");
			configOnlyGrabPairAmountOfShells = config.Bind<bool>("Competitive Shell Grabbing", "OnlyGrabPairAmountOfShells", false, "Forces the amount of grabbed shells in limited ammo mode to be pair");
			configNoLeverAction = config.Bind<bool>("Competitive Shell Grabbing", "NoLeverAction", true, "Prevents competitively grabbing shells while holding a lever-action");
			configForceUnconditionalCompetitiveShellGrabbing = config.Bind<bool>("Competitive Shell Grabbing", "ForceUnconditionalCompetitiveShellGrabbing", false, "If true, will always grab shotgun shells in a competitive-shooting style");
			configCompetitiveShellPoseOverridePosition = config.Bind<Vector3>("Competitive Shell Grabbing", "CompetitiveShellPoseOverridePosition", new Vector3(0f, -0.025f, -0.1f), "The position offset from the normal way shotgun shells are held, change if shells are jittery when colliding");
			configCompetitiveShellPoseOverrideRotation = config.Bind<Vector3>("Competitive Shell Grabbing", "configCompetitiveShellPoseOverrideRotation", new Vector3(0f, 180f, 90f), "The rotation offset from the normal way shotgun shells are held");
			configIncreaseRoundInsertTriggerZone = config.Bind<bool>("Competitive Shell Grabbing", "configIncreaseRoundInsertTriggerZone", false, "Increases the size of the trigger zone where rounds will be loaded, makes reloading easier");
			configTriggerZoneMultiplier = config.Bind<float>("Competitive Shell Grabbing", "configTriggerZoneMultiplier", 2f, "The value by which the trigger zone's bounds will be mutliplied by");
			configPezOnGrabOneShell = config.Bind<bool>("Competitive Shell Grabbing", "configPezOnGrabOneShell", true, "If only one shell is grabbed (for example using Trigger), shell will be in pez form");
			configGrabOneShellOnTrigger = config.Bind<bool>("Competitive Shell Grabbing", "configGrabOneShellOnTrigger", true, "If trigger is pressed on a Quickbelt slot, grab a single shell");
			configReverseGrabAndTrigger = config.Bind<bool>("Competitive Shell Grabbing", "configReverseGrabAndTrigger", false, "Press trigger to grab a whole stack of shells, press grab to grab a single one");
			configOnlyGrabOneWhenChamberOpen = config.Bind<bool>("Competitive Shell Grabbing", "OnlyGrabOneWhenChamberOpen", false, "Only grabs one shell when the chamber is opened and accessible");
			configGrabOneWhenSmartPalmingOff = config.Bind<bool>("Competitive Shell Grabbing", "GrabOneWhenSmartPalmingOff", false, "Only grab one shell when Smart Palming is off");
			configEnableKnockAKDrumOut = config.Bind<bool>("Knock AK Drums out", "KnockAKDrumOut", true, "Enables you to knock a drum magazine from a gun with a physical magazine latch by knocking it with another mag, while pressing touchpad down on the controller with the gun");
			configForAllNonEjectableGuns = config.Bind<bool>("Knock AK Drums out", "EnableForAllNonEjectableGuns", false, "Enables knocking out drum mags for guns that don't have an eject button");
			SectionConfigList<OTagFirearmSize> sectionConfigList = default(SectionConfigList<OTagFirearmSize>);
			sectionConfigList.section = "Easy Mag Loading Category Blacklist";
			sectionConfigList.configEntries = SettingsManager.BindAllTypesOfFireArms<OTagFirearmSize>(config, "Easy Mag Loading Category Blacklist");
			sectionConfigListEasyMagLoadingBlacklist = sectionConfigList;
			configEasyMagLoadingWeaponBlacklist = config.Bind<string>("Easy Mag Loading Category Blacklist", "EasyMagLoadingWeaponSpecificBlacklist", string.Empty, "Specific weapons that should be banned from Easy Mag Loading. Needs to be the name that displays on the Wrist Menu. Format goes as follows: GunName|GunName ");
			configEasyMagLoadingWeaponWhitelist = config.Bind<string>("Easy Mag Loading Category Blacklist", "EasyMagLoadingWeaponSpecificWhitelist", string.Empty, "Specific weapons that should always have Easy Mag Loading on, takes priority over any blacklist. Needs to be the name that displays on the Wrist Menu. Format goes as follows: GunName|GunName ");
			SectionConfigList<OTagFirearmAction> sectionConfigList2 = default(SectionConfigList<OTagFirearmAction>);
			sectionConfigList2.section = "Virtual Stock Category Blacklist";
			sectionConfigList2.configEntries = SettingsManager.BindAllTypesOfFireArms<OTagFirearmAction>(config, "Virtual Stock Category Blacklist");
			sectionConfigListVirtualStockBlacklist = sectionConfigList2;
			configVirtualStockWeaponBlacklist = config.Bind<string>("Virtual Stock Category Blacklist", "VirtualStockWeaponSpecificBlacklist", string.Empty, "Specific weapons that should be banned from Virtual Stock. Needs to be the name that displays on the Wrist Menu. Format goes as follows: GunName|GunName ");
			configVirtualStockWeaponWhitelist = config.Bind<string>("Virtual Stock Category Blacklist", "VirtualStockWeaponSpecificWhitelist", string.Empty, "Specific weapons that should always have Virtual Stock on, takes priority over any blacklist. Needs to be the name that displays on the Wrist Menu. Format goes as follows: GunName|GunName ");
			configEnableTimedObjectDestruction = config.Bind<bool>("Timed Object Destruction", "EnabledTimedObjectDestruction", false, "Enable time object destruction");
			configTODTimeToDestroy = config.Bind<float>("Timed Object Destruction", "TimedObjectDestructionTimeBeforeDestroy", 50f, "How long will an object stay before being destroyed");
			configTODEnableFirearms = config.Bind<bool>("Timed Object Destruction", "EnableFirearmsTimedObjectDestruction", false, "Starts destruction countdown timer for firearms");
			configTODEnableMagazines = config.Bind<bool>("Timed Object Destruction", "EnableMagazinesTimedObjectDestruction", true, "Starts destruction countdown timer for magazines");
			configTODEmptyMagazinesOnly = config.Bind<bool>("Timed Object Destruction", "TODEmptyMagazinesOnly", true, "Destruction countdown timer will only start for empty magazines");
			configTODEnableRounds = config.Bind<bool>("Timed Object Destruction", "EnableRoundsTimedObjectDestruction", true, "Starts destruction countdown timer for unspent rounds (vanilla H3VR already has one for spent shells)");
			configTODEnableAll = config.Bind<bool>("Timed Object Destruction", "EnableAllTimedObjectDestruction", false, "Starts destruction countdown timer for everything that gets deleted by the \"All Spawnables\" option in the hand menu");
			configEnableSodaliteConsoleColorPatch = config.Bind<bool>("Experimental stuff, might not work ^^ (probably requires restart)", "EnableSodaliteConsoleColorPatch", false, "Transpiles the Sodalite console so that CUM's custom console colour feature works, currently just recolours the entire console if one of CUM's extensions is used, oops");
		}

		internal static Dictionary<T, ConfigEntry<bool>> BindAllTypesOfFireArms<T>(ConfigFile config, string section) where T : Enum
		{
			Dictionary<T, ConfigEntry<bool>> dictionary = new Dictionary<T, ConfigEntry<bool>>();
			foreach (T @enum in ExtensionsToMakeMyLifeLessShit.GetEnumList<T>())
			{
				dictionary.Add(@enum, config.Bind<bool>(section, @enum.ToString(), false, "Should guns from the " + @enum.ToString() + " category be excluded from " + section + "?"));
			}
			return dictionary;
		}

		internal static void LogVerboseLevelNameAndColor(object data, string levelName, ConsoleColor color, bool forceLog = false)
		{
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.LogWithCustomLevelNameAndColor(data, levelName, color);
			}
		}

		internal static void LogVerboseInfo(object data, bool forceLog = false)
		{
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.LogInfo(data);
			}
		}

		internal static void LogVerboseWarning(object data, bool forceLog = false)
		{
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.LogWarning(data);
			}
		}

		internal static void LogVerboseError(object data, bool forceLog = false)
		{
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.LogError(data);
			}
		}

		internal static void LogVerboseMessage(object data, bool forceLog = false)
		{
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.LogMessage(data);
			}
		}

		internal static void LogVerboseFatal(object data, bool forceLog = false)
		{
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.LogFatal(data);
			}
		}

		internal static void LogVerbose(LogLevel logLevel, object data, bool forceLog = false)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			if (Verbose || forceLog)
			{
				CiarencesUnbelievableModifications.Logger.Log(logLevel, data);
			}
		}

		internal static ConfigEntry<float> BindMagazineOffset(FVRFireArmMagazine magazine)
		{
			return configFile.Bind<float>("Reverse Magazine Hold | Custom Offsets", ((FVRPhysicalObject)magazine).ObjectWrapper.ItemID, 0f, (ConfigDescription)null);
		}
	}
}
namespace CiarencesUnbelievableModifications.Patches
{
	public static class BoltHandleLockSoundTweaks
	{
		internal static class Transpilers
		{
			[HarmonyPatch(typeof(ClosedBoltHandle), "Event_HitLockPosition")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> TranspileHitLockPositionSoundEvent(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Expected O, but got Unknown
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Expected O, but got Unknown
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Expected O, but got Unknown
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Expected O, but got Unknown
				//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Expected O, but got Unknown
				//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Expected O, but got Unknown
				CodeMatch[] codeMatches = (CodeMatch[])(object)new CodeMatch[3]
				{
					new CodeMatch(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (string)null),
					new CodeMatch(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ClosedBoltHandle), "Weapon")), (string)null),
					new CodeMatch(new CodeInstruction(OpCodes.Ldc_I4_S, (object)null), (string)null)
				};
				if (TranspilerHelper.TryMatchForward(useEnd: true, instructions, generator, out CodeMatcher codeMatcher, __originalMethod, (Action<string>)CiarencesUnbelievableModifications.Logger.LogError, codeMatches))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "BHLS-Transpilers", ConsoleColor.Cyan);
					codeMatcher.SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldarg_0, (object)null)).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ClosedBoltHandle), "Weapon"))
					}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(BoltHandleLockSoundTweaks), "GetHandleLockSound", (Type[])null, (Type[])null))
					});
				}
				return codeMatcher.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(ClosedBoltHandle), "UpdateHandle")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> AddHandleDownSoundEvent(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Expected O, but got Unknown
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Expected O, but got Unknown
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Expected O, but got Unknown
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Expected O, but got Unknown
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Expected O, but got Unknown
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Expected O, but got Unknown
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Expected O, but got Unknown
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Expected O, but got Unknown
				//IL_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Expected O, but got Unknown
				CodeMatch[] codeMatches = (CodeMatch[])(object)new CodeMatch[4]
				{
					new CodeMatch(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ClosedBoltHandle), "Weapon"), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ClosedBoltWeapon), "Bolt"), (string)null),
					new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(ClosedBolt), "ReleaseBolt", (Type[])null, (Type[])null), (string)null)
				};
				if (TranspilerHelper.TryMatchForward(useEnd: false, instructions, generator, out CodeMatcher codeMatcher, __originalMethod, (Action<string>)CiarencesUnbelievableModifications.Logger.LogError, codeMatches))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "BHLS-Transpilers", ConsoleColor.Cyan);
					codeMatcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null)
					}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(ClosedBoltHandle), "Weapon"))
					}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ldc_I4, (object)13)
					})
						.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
						{
							new CodeInstruction(OpCodes.Ldc_R4, (object)1f)
						})
						.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
						{
							new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(FVRFireArm), "PlayAudioEvent", (Type[])null, (Type[])null))
						});
				}
				return codeMatcher.InstructionEnumeration();
			}
		}

		public static FirearmAudioEventType GetHandleLockSound(ClosedBoltWeapon weapon)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			FirearmAudioEventType val = (FirearmAudioEventType)11;
			if (((FVRFireArm)weapon).AudioClipSet.HandleUp.Clips.Count > 0 || SettingsManager.configForceSilenceHitLock.Value)
			{
				val = (FirearmAudioEventType)12;
			}
			SettingsManager.LogVerboseInfo(val);
			return val;
		}
	}
	public static class CompetitiveShellGrabbing
	{
		internal static class Patches
		{
			private static FieldInfo m_hoverOverReloadTriggerFieldInfo;

			[HarmonyPatch(typeof(FVRFireArmRound), "BeginInteraction")]
			[HarmonyPrefix]
			private static bool GrabSingularIfSmartPalmingOff(ref FVRFireArmRound __instance, FVRViveHand hand)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Invalid comparison between Unknown and I4
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				if (!((FVRPhysicalObject)__instance).m_isSpawnLock && (Object)(object)((FVRPhysicalObject)__instance).QuickbeltSlot != (Object)null && (int)GM.Options.ControlOptions.SmartAmmoPalming == 1 && (Object)(object)((FVRPhysicalObject)__instance).ObjectWrapper != (Object)null && (SettingsManager.configGrabOneWhenSmartPalmingOff.Value || IsSingleShellGrabAction(hand)) && __instance.ProxyRounds.Count > 0)
				{
					FVRQuickBeltSlot quickbeltSlot = ((FVRPhysicalObject)__instance).QuickbeltSlot;
					FVRFireArmRound component = Object.Instantiate<GameObject>(((AnvilAsset)((FVRPhysicalObject)__instance).ObjectWrapper).GetGameObject(), ((Component)__instance).transform.position, ((Component)__instance).transform.rotation).GetComponent<FVRFireArmRound>();
					if (__instance.m_canAnimate)
					{
						component.BeginAnimationFrom(((Component)__instance).transform.position, ((Component)__instance).transform.rotation);
					}
					FVRFireArmRound component2 = Object.Instantiate<GameObject>(((AnvilAsset)__instance.ProxyRounds[0].ObjectWrapper).GetGameObject(), ((Component)__instance).transform.position, ((Component)__instance).transform.rotation).GetComponent<FVRFireArmRound>();
					for (int i = 1; i < __instance.ProxyRounds.Count; i++)
					{
						component2.AddProxy(__instance.ProxyRounds[i].Class, __instance.ProxyRounds[i].ObjectWrapper);
					}
					((FVRPhysicalObject)__instance).ClearQuickbeltState();
					((FVRPhysicalObject)component2).SetQuickBeltSlot(quickbeltSlot);
					__instance.DestroyAllProxies();
					((FVRInteractiveObject)component).BeginInteraction(hand);
					hand.ForceSetInteractable((FVRInteractiveObject)(object)component);
					component2.UpdateProxyDisplay();
					Object.Destroy((Object)(object)((Component)__instance).gameObject);
					return false;
				}
				return true;
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "UpdateProxyPositions")]
			[HarmonyPostfix]
			private static void ResetProxyPoseMode(FVRFireArmRound __instance)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				__instance.ProxyPose = (ProxyPositionMode)0;
			}

			[HarmonyPatch(typeof(TubeFedShotgun), "Awake")]
			[HarmonyPostfix]
			private static void IncreaseShotgunRoundInsertTriggerZone(TubeFedShotgun __instance)
			{
				//IL_0064: 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_0082: Unknown result type (might be due to invalid IL or missing references)
				if (!SettingsManager.configIncreaseRoundInsertTriggerZone.Value)
				{
					return;
				}
				FVRFireArmMagazineReloadTrigger[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<FVRFireArmMagazineReloadTrigger>();
				if (componentsInChildren == null || componentsInChildren.Length == 0)
				{
					return;
				}
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Collider component = ((Component)componentsInChildren[i]).GetComponent<Collider>();
					SphereCollider val = (SphereCollider)(object)((component is SphereCollider) ? component : null);
					if (val != null)
					{
						val.radius *= SettingsManager.configTriggerZoneMultiplier.Value;
					}
					else
					{
						BoxCollider val2 = (BoxCollider)(object)((component is BoxCollider) ? component : null);
						if (val2 != null)
						{
							Vector3 size = val2.size;
							size.z *= SettingsManager.configTriggerZoneMultiplier.Value;
							val2.size = size;
						}
						else
						{
							CapsuleCollider val3 = (CapsuleCollider)(object)((component is CapsuleCollider) ? component : null);
							if (val3 != null)
							{
								val3.height *= SettingsManager.configTriggerZoneMultiplier.Value;
							}
						}
					}
					Debug.Log((object)"increased trigger size");
				}
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "Awake")]
			[HarmonyPostfix]
			private static void AddPoseExtender(FVRFireArmRound __instance)
			{
				//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_000c: Invalid comparison between Unknown and I4
				if ((int)AM.GetRoundPower(__instance.RoundType) == 3)
				{
					((Component)__instance).gameObject.AddComponent<FVRShotgunRoundPoseExtender>();
				}
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "BeginInteraction")]
			[HarmonyPostfix]
			private static void TryAddPoseExtenderPoses(FVRFireArmRound __instance)
			{
				if (((Component)(object)__instance).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender result))
				{
					result.SetOverrideTransforms();
				}
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "GetNumRoundsPulled")]
			[HarmonyPostfix]
			private static void PatchForceNumRoundsPulled(FVRFireArmRound __instance, ref int __result, FVRViveHand hand)
			{
				ForceNumRoundsPulled(__instance, ref __result, hand);
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "UpdateProxyPositions")]
			[HarmonyPostfix]
			private static void CheckIfShouldSwitchPos(FVRFireArmRound __instance)
			{
				if (((Component)(object)__instance).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender result) && (Object)(object)((FVRInteractiveObject)__instance).m_hand != (Object)null && !ShouldBeInline(((Component)__instance).transform))
				{
					result.SwitchTransform(forceOff: true);
				}
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "DuplicateFromSpawnLock")]
			[HarmonyPostfix]
			private static void DestroyDuplicatesIfSingleGrab(FVRFireArmRound __instance, ref GameObject __result, FVRViveHand hand)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Invalid comparison between Unknown and I4
				if ((int)GM.Options.ControlOptions.SmartAmmoPalming != 1 || !((Component)(object)__instance).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender _))
				{
					return;
				}
				bool flag = false;
				if (IsSingleShellGrabAction(hand))
				{
					flag = true;
				}
				if (flag)
				{
					FVRFireArmRound component = __result.GetComponent<FVRFireArmRound>();
					for (int num = component.ProxyRounds.Count - 1; num >= 0; num--)
					{
						Object.Destroy((Object)(object)component.ProxyRounds[num].GO);
						component.ProxyRounds[num].GO = null;
						component.ProxyRounds[num].Filter = null;
						component.ProxyRounds[num].Renderer = null;
						component.ProxyRounds[num].ObjectWrapper = null;
					}
					component.ProxyRounds.Clear();
				}
			}
		}

		internal static class Transpilers
		{
			[HarmonyPatch(typeof(FVRFireArmRound), "DuplicateFromSpawnLock")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> AddForceNumRoundsPulled(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Expected O, but got Unknown
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Expected O, but got Unknown
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Expected O, but got Unknown
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Expected O, but got Unknown
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b6: Expected O, but got Unknown
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Expected O, but got Unknown
				//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fd: Expected O, but got Unknown
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Expected O, but got Unknown
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0133: Expected O, but got Unknown
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Expected O, but got Unknown
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0164: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				if (val.TryMatchForward(true, __originalMethod, new CodeMatch(new CodeInstruction(OpCodes.Ldloc_S, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldloc_3, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(FVRFireArm), "GetChambers", (Type[])null, (Type[])null)), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<>).MakeGenericType(typeof(FVRFireArmChamber)), "get_Count", (Type[])null, (Type[])null)), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Blt, (object)null), (string)null)))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "CSG-Transpilers", ConsoleColor.Cyan);
					val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Ldloca_S, (object)2),
						new CodeInstruction(OpCodes.Ldarg_1, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "ForceNumRoundsPulledTrans", (Type[])null, (Type[])null))
					});
				}
				return val.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(FVRViveHand), "Update")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> ResetShouldPez(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Expected O, but got Unknown
				//IL_006f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Expected O, but got Unknown
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Expected O, but got Unknown
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Expected O, but got Unknown
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f7: Expected O, but got Unknown
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Expected O, but got Unknown
				//IL_0133: Unknown result type (might be due to invalid IL or missing references)
				//IL_0139: Expected O, but got Unknown
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				if (val.TryMatchForward(true, __originalMethod, new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldflda, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Brfalse, (object)null, (string)null)))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "CSG-Transpilers", ConsoleColor.Cyan);
					val.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(FVRViveHand), "CurrentInteractable")),
						new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(Component), "gameObject")),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "ResetShouldPez", (Type[])null, (Type[])null))
					});
				}
				return val.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(FVRViveHand), "Update")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> TryGetSingleShell(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Expected O, but got Unknown
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Expected O, but got Unknown
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b0: Expected O, but got Unknown
				//IL_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Expected O, but got Unknown
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Expected O, but got Unknown
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0149: Expected O, but got Unknown
				//IL_017c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: Expected O, but got Unknown
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Expected O, but got Unknown
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a3: Expected O, but got Unknown
				//IL_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c4: Expected O, but got Unknown
				//IL_01df: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e5: Expected O, but got Unknown
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Expected O, but got Unknown
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Expected O, but got Unknown
				//IL_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Expected O, but got Unknown
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				//IL_0237: Expected O, but got Unknown
				//IL_0255: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Expected O, but got Unknown
				//IL_0269: Unknown result type (might be due to invalid IL or missing references)
				//IL_026f: Expected O, but got Unknown
				//IL_0278: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Expected O, but got Unknown
				//IL_029a: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a0: Expected O, but got Unknown
				//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b8: Expected O, but got Unknown
				//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c7: Expected O, but got Unknown
				//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02eb: Expected O, but got Unknown
				//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ff: Expected O, but got Unknown
				//IL_0308: Unknown result type (might be due to invalid IL or missing references)
				//IL_030e: Expected O, but got Unknown
				//IL_0317: Unknown result type (might be due to invalid IL or missing references)
				//IL_031d: Expected O, but got Unknown
				//IL_0339: Unknown result type (might be due to invalid IL or missing references)
				//IL_033f: Expected O, but got Unknown
				//IL_035b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0361: Expected O, but got Unknown
				//IL_036a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0370: Expected O, but got Unknown
				//IL_0379: Unknown result type (might be due to invalid IL or missing references)
				//IL_037f: Expected O, but got Unknown
				//IL_039b: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a1: Expected O, but got Unknown
				//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b0: Expected O, but got Unknown
				//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d2: Expected O, but got Unknown
				//IL_03db: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e1: Expected O, but got Unknown
				//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0405: Expected O, but got Unknown
				//IL_040e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0414: Expected O, but got Unknown
				//IL_041d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0423: Expected O, but got Unknown
				//IL_043f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0445: Expected O, but got Unknown
				//IL_0461: Unknown result type (might be due to invalid IL or missing references)
				//IL_0467: Expected O, but got Unknown
				//IL_0485: Unknown result type (might be due to invalid IL or missing references)
				//IL_048b: Expected O, but got Unknown
				//IL_0494: Unknown result type (might be due to invalid IL or missing references)
				//IL_049a: Expected O, but got Unknown
				//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04af: Expected O, but got Unknown
				//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c1: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				if (val.TryMatchForward(true, __originalMethod, new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)null, (object)AccessTools.PropertyGetter(typeof(FVRViveHand), "ClosestPossibleInteractable"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(FVRInteractiveObject), "SimpleInteraction", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null)))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "CSG-Transpilers", ConsoleColor.Cyan);
					Label label = default(Label);
					val.SetAndAdvance(OpCodes.Ldloc_S, (object)13).CreateLabelAt(val.Pos, ref label).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[37]
					{
						new CodeInstruction(OpCodes.Brtrue, (object)label),
						new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(SettingsManager), "configGrabOneShellOnTrigger")),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(ConfigEntry<>).MakeGenericType(typeof(bool)), "Value")),
						new CodeInstruction(OpCodes.Brfalse, (object)label),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldflda, (object)AccessTools.Field(typeof(FVRViveHand), "Input")),
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(HandInput), "TriggerDown")),
						new CodeInstruction(OpCodes.Brfalse, (object)label),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(FVRViveHand), "ClosestPossibleInteractable")),
						new CodeInstruction(OpCodes.Ldnull, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Object), "op_Inequality", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Brfalse_S, (object)label),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(FVRViveHand), "ClosestPossibleInteractable")),
						new CodeInstruction(OpCodes.Isinst, (object)typeof(FVRFireArmRound)),
						new CodeInstruction(OpCodes.Ldnull, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Object), "op_Inequality", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Brfalse_S, (object)label),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(FVRViveHand), "ClosestPossibleInteractable")),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertySetter(typeof(FVRViveHand), "CurrentInteractable")),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
						new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(FVRViveHand), "m_state")),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(FVRViveHand), "CurrentInteractable")),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(FVRInteractiveObject), "BeginInteraction", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRViveHand), "Buzzer")),
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRHaptics), "Buzz_BeginInteraction")),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(FVRViveHand), "Buzz", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
						new CodeInstruction(OpCodes.Stloc_S, (object)14)
					});
					CodeInstruction val2 = new CodeInstruction(val.Instruction);
					CodeInstructionExtensions.ExtractLabels(val2);
					val.SetAndAdvance(OpCodes.Ldc_I4_0, (object)null).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { val2 });
				}
				return val.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "FVRFixedUpdate")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> ChangeCheckForSpeedierRoundLoad(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Expected O, but got Unknown
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Expected O, but got Unknown
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Expected O, but got Unknown
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Expected O, but got Unknown
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Expected O, but got Unknown
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Expected O, but got Unknown
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				if (val.TryMatchForward(false, __originalMethod, new CodeMatch(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRFireArmRound), "ProxyRounds")), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<>).MakeGenericType(typeof(ProxyRound)), "get_Count", (Type[])null, (Type[])null)), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Bge, (object)null), (string)null)))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "CSG-Transpilers", ConsoleColor.Cyan);
					val.RemoveInstructions(4).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "ShouldSpeedInsert", (Type[])null, (Type[])null))
					}).SetOpcodeAndAdvance(OpCodes.Brfalse);
				}
				return val.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "UpdateProxyPositions")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> MakeAlternativeShellHoldingPose(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Expected O, but got Unknown
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Expected O, but got Unknown
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Expected O, but got Unknown
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Expected O, but got Unknown
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Expected O, but got Unknown
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fb: Expected O, but got Unknown
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011e: Expected O, but got Unknown
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Expected O, but got Unknown
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Expected O, but got Unknown
				//IL_018f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Expected O, but got Unknown
				//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01be: Expected O, but got Unknown
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Expected O, but got Unknown
				//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Expected O, but got Unknown
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0214: Expected O, but got Unknown
				//IL_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Expected O, but got Unknown
				//IL_0249: Unknown result type (might be due to invalid IL or missing references)
				//IL_024f: Expected O, but got Unknown
				//IL_0275: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Expected O, but got Unknown
				//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b4: Expected O, but got Unknown
				//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c7: Expected O, but got Unknown
				//IL_02de: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e9: Expected O, but got Unknown
				//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ea: Expected O, but got Unknown
				//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fd: Expected O, but got Unknown
				//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fe: Expected O, but got Unknown
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_0311: Expected O, but got Unknown
				//IL_030c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0312: Expected O, but got Unknown
				//IL_032b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0331: Expected O, but got Unknown
				//IL_034e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0354: Expected O, but got Unknown
				//IL_0388: Unknown result type (might be due to invalid IL or missing references)
				//IL_038e: Expected O, but got Unknown
				//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e6: Expected O, but got Unknown
				//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fa: Expected O, but got Unknown
				//IL_0408: Unknown result type (might be due to invalid IL or missing references)
				//IL_040e: Expected O, but got Unknown
				//IL_041c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0422: Expected O, but got Unknown
				//IL_0430: Unknown result type (might be due to invalid IL or missing references)
				//IL_0436: Expected O, but got Unknown
				//IL_0444: Unknown result type (might be due to invalid IL or missing references)
				//IL_044a: Expected O, but got Unknown
				//IL_046b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0471: Expected O, but got Unknown
				//IL_047f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0485: Expected O, but got Unknown
				//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c6: Expected O, but got Unknown
				//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ee: Expected O, but got Unknown
				//IL_0512: Unknown result type (might be due to invalid IL or missing references)
				//IL_0518: Expected O, but got Unknown
				//IL_0527: Unknown result type (might be due to invalid IL or missing references)
				//IL_052d: Expected O, but got Unknown
				//IL_053c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0542: Expected O, but got Unknown
				//IL_0551: Unknown result type (might be due to invalid IL or missing references)
				//IL_0557: Expected O, but got Unknown
				//IL_056d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0573: Expected O, but got Unknown
				//IL_0590: Unknown result type (might be due to invalid IL or missing references)
				//IL_0596: Expected O, but got Unknown
				//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
				//IL_05d0: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				if (val.TryMatchForward(false, __originalMethod, new CodeMatch(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRFireArmRound), "ProxyRounds")), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<>).MakeGenericType(typeof(ProxyRound)), "get_Count", (Type[])null, (Type[])null)), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldc_I4_1, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Bne_Un, (object)null), (string)null)))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "CSG-Transpilers", ConsoleColor.Cyan);
					val.RemoveInstructions(4).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "ShouldBeInline", (Type[])null, (Type[])null))
					}).SetOpcodeAndAdvance(OpCodes.Brfalse);
					if (val.TryMatchForward(true, __originalMethod, new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRFireArmRound), "RoundType"), (string)null), new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(AM), "GetRoundPower", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_3, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Bne_Un, (object)null, (string)null)))
					{
						val.Advance(1).CreateBranchAtMatch(false, out var label, new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(FVRFireArmRound), "ProxyPose"), (string)null)).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
						{
							new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(SettingsManager), "configForceUnconditionalCompetitiveShellGrabbing")),
							new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(ConfigEntry<>).MakeGenericType(typeof(bool)), "Value")),
							new CodeInstruction(OpCodes.Brtrue, (object)label)
						});
						if (val.TryMatchForward(true, __originalMethod, new CodeMatch(new CodeInstruction(OpCodes.Ldloc_0, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldloc_2, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldloc_3, (object)null), (string)null)))
						{
							val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
							{
								new CodeInstruction(OpCodes.Ldarg_0, (object)null),
								new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null))
							}).Advance(1).RemoveInstructions(5)
								.Insert((CodeInstruction[])(object)new CodeInstruction[1]
								{
									new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "CalculateShellPositions", (Type[])null, (Type[])null))
								});
							if (val.TryMatchForward(true, __originalMethod, new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Vector3), "op_Multiply", new Type[2]
							{
								typeof(Vector3),
								typeof(float)
							}, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Stloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRFireArmRound), "ProxyRounds"), (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<>).MakeGenericType(typeof(ProxyRound)), "get_Item", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(ProxyRound), "GO"), (string)null), new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(GameObject), "get_transform", (Type[])null, (Type[])null), (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null), new CodeMatch((OpCode?)OpCodes.Ldloc_S, (object)null, (string)null)))
							{
								val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
								{
									new CodeInstruction(OpCodes.Ldarg_0, (object)null),
									new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(Component), "get_transform", (Type[])null, (Type[])null))
								}).Advance(1).RemoveInstructions(5)
									.Insert((CodeInstruction[])(object)new CodeInstruction[1]
									{
										new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "CalculateQBShellPositions", (Type[])null, (Type[])null))
									});
							}
						}
					}
				}
				return val.InstructionEnumeration();
			}

			[HarmonyPatch(typeof(FVRFireArmRound), "CycleToProxy")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> AddPropertyTransferPoint(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Expected O, but got Unknown
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Expected O, but got Unknown
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Expected O, but got Unknown
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Expected O, but got Unknown
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Expected O, but got Unknown
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Expected O, but got Unknown
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Expected O, but got Unknown
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Expected O, but got Unknown
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Expected O, but got Unknown
				//IL_0141: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				if (val.TryMatchForward(true, __originalMethod, new CodeMatch(new CodeInstruction(OpCodes.Ldarg_2, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Brtrue, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(FVRFireArmRound), "ProxyRounds")), (string)null), new CodeMatch(new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(List<>).MakeGenericType(typeof(ProxyRound)), "Clear", (Type[])null, (Type[])null)), (string)null)))
				{
					SettingsManager.LogVerboseLevelNameAndColor("Patching " + MethodBase.GetCurrentMethod().Name, "CSG-Transpilers", ConsoleColor.Cyan);
					val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[4]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.PropertyGetter(typeof(Component), "gameObject")),
						new CodeInstruction(OpCodes.Ldloc_2, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CompetitiveShellGrabbing), "TransferShotgunPoseExtenderProperties", (Type[])null, (Type[])null))
					});
				}
				return val.InstructionEnumeration();
			}
		}

		public static Vector3 CalculateShellPositions(Vector3 basePos, Vector3 baseRadius, Transform transform, int j)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			if (!SettingsManager.configEnableCompetitiveShellGrabbing.Value)
			{
				return basePos + baseRadius * (float)(j + 1);
			}
			float radius = ((Component)transform).GetComponent<CapsuleCollider>().radius;
			Vector3 val = -transform.up * (radius * 1.75f);
			return basePos + baseRadius * (float)((j + 1) % 2) + val * (float)((j + 1) / 2);
		}

		public static Vector3 CalculateQBShellPositions(Vector3 basePos, Vector3 baseUp, Transform transform, int k)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (!SettingsManager.configEnableCompetitiveShellGrabbing.Value || (int)AM.GetRoundPower(((Component)transform).GetComponent<FVRFireArmRound>().RoundType) != 3)
			{
				return basePos + baseUp * (float)(k + 2);
			}
			Vector3 val = -transform.forward * (((Component)transform).GetComponent<CapsuleCollider>().height * 1.02f);
			return basePos + baseUp * (float)((k + 1) / 2) + val * (float)((k + 1) % 2);
		}

		public static bool IsSingleShellGrabAction(FVRViveHand hand)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (!SettingsManager.configGrabOneShellOnTrigger.Value || (int)GM.Options.ControlOptions.GripButtonToHoldOverride == 2 || (int)hand.CMode == 0)
			{
				return false;
			}
			if (SettingsManager.configReverseGrabAndTrigger.Value)
			{
				if (hand.Input.IsGrabDown)
				{
					return true;
				}
			}
			else if (hand.Input.TriggerDown)
			{
				return true;
			}
			return false;
		}

		public static bool ShouldBeInline(Transform transform)
		{
			FVRFireArmRound component = ((Component)transform).GetComponent<FVRFireArmRound>();
			if (!((Component)(object)transform).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender result))
			{
				return component.ProxyRounds.Count == 1;
			}
			bool flag = component.ProxyRounds.Count == 1 && (!SettingsManager.configEnableCompetitiveShellGrabbing.Value || result.shouldPez);
			SettingsManager.LogVerboseInfo("Vanilla check: " + flag);
			bool flag2 = (Object)(object)((FVRInteractiveObject)component).m_hand.OtherHand.CurrentInteractable != (Object)null && ((FVRInteractiveObject)component).m_hand.OtherHand.CurrentInteractable is LeverActionFirearm;
			SettingsManager.LogVerboseInfo("has LeverAction: " + flag2);
			bool flag3 = component.ProxyRounds.Count + 1 <= SettingsManager.configMaxShellsInHand.Value;
			SettingsManager.LogVerboseInfo("HasRightAmount: " + flag3);
			bool flag4 = component.ProxyRounds.Count + 1 > SettingsManager.configMaxShellsInHand.Value && !SettingsManager.configRevertToNormalGrabbingWhenAboveX.Value;
			SettingsManager.LogVerboseInfo("NoOneCarres About fuck you: " + flag4);
			bool flag5 = (flag3 || flag4) && SettingsManager.configEnableCompetitiveShellGrabbing.Value && (!flag2 || (flag2 && !SettingsManager.configNoLeverAction.Value));
			SettingsManager.LogVerboseInfo("shouldBeInline: " + flag5);
			bool result2 = flag || (flag5 && !result.shouldPez) || SettingsManager.configForceUnconditionalCompetitiveShellGrabbing.Value;
			SettingsManager.LogVerboseInfo("Result: " + result2);
			return result2;
		}

		public static bool ShouldSpeedInsert(Transform transform)
		{
			FVRFireArmRound component = ((Component)transform).GetComponent<FVRFireArmRound>();
			if (!((Component)(object)transform).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender result))
			{
				return component.ProxyRounds.Count < 1;
			}
			bool num = component.ProxyRounds.Count < 1 && (!SettingsManager.configEnableCompetitiveShellGrabbing.Value || result.shouldPez);
			bool flag = (Object)(object)((FVRInteractiveObject)component).m_hand.OtherHand.CurrentInteractable != (Object)null && ((FVRInteractiveObject)component).m_hand.OtherHand.CurrentInteractable is LeverActionFirearm;
			bool flag2 = component.ProxyRounds.Count % 2 == 0 && component.ProxyRounds.Count + 1 <= SettingsManager.configMaxShellsInHand.Value && SettingsManager.configEnableCompetitiveShellGrabbing.Value && (!flag || (flag && !SettingsManager.configNoLeverAction.Value));
			if (!num)
			{
				if (flag2)
				{
					if (result.shouldPez)
					{
						return SettingsManager.configForceUnconditionalCompetitiveShellGrabbing.Value;
					}
					return true;
				}
				return false;
			}
			return true;
		}

		public static void ForceNumRoundsPulled(FVRFireArmRound __instance, ref int roundNum, FVRViveHand hand)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (SettingsManager.configEnableCompetitiveShellGrabbing.Value)
			{
				if ((int)AM.GetRoundPower(__instance.RoundType) == 3 && SettingsManager.configOnlyGrabXFromQB.Value && roundNum > SettingsManager.configMaxShellsInHand.Value && (Object)(object)hand.OtherHand.CurrentInteractable != (Object)null)
				{
					FVRInteractiveObject currentInteractable = hand.OtherHand.CurrentInteractable;
					FVRFireArm val = (FVRFireArm)(object)((currentInteractable is FVRFireArm) ? currentInteractable : null);
					if (val != null && (Object)(object)val.Magazine != (Object)null && val.RoundType == __instance.RoundType)
					{
						roundNum = Mathf.Min(SettingsManager.configMaxShellsInHand.Value, val.Magazine.m_capacity - val.Magazine.m_numRounds);
					}
				}
				if (SettingsManager.configOnlyGrabPairAmountOfShells.Value && roundNum % 2 != 0)
				{
					if (roundNum - 1 == 0)
					{
						roundNum = 2;
					}
					else
					{
						roundNum++;
					}
				}
			}
			FVRInteractiveObject currentInteractable2 = hand.OtherHand.CurrentInteractable;
			TubeFedShotgun val2 = (TubeFedShotgun)(object)((currentInteractable2 is TubeFedShotgun) ? currentInteractable2 : null);
			if (val2 != null && ((FVRFireArm)val2).RoundType == __instance.RoundType && ((FVRFireArm)val2).GetChambers().Count == 1 && SettingsManager.configOnlyGrabOneWhenChamberOpen.Value)
			{
				FVRFireArmChamber val3 = ((FVRFireArm)val2).GetChambers()[0];
				if (val3.IsManuallyChamberable && !val3.IsFull && val3.IsAccessible)
				{
					roundNum = 1;
				}
			}
			if (IsSingleShellGrabAction(hand))
			{
				roundNum = 1;
			}
		}

		public static void ForceNumRoundsPulledTrans(Transform bitch, ref int roundNum, FVRViveHand hand)
		{
			ForceNumRoundsPulled(((Component)bitch).GetComponent<FVRFireArmRound>(), ref roundNum, hand);
		}

		public static void TransferShotgunPoseExtenderProperties(GameObject oldGo, GameObject newGo)
		{
			if (((Component)(object)oldGo.transform).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender result) && ((Component)(object)newGo.transform).TryGetComponent<FVRShotgunRoundPoseExtender>(out FVRShotgunRoundPoseExtender result2))
			{
				SettingsManager.LogVerboseInfo