Decompiled source of MiscFixes v1.2.6

MiscFixes.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.BrotherMonster;
using EntityStates.LunarExploderMonster;
using EntityStates.MinorConstruct;
using EntityStates.Scrapper;
using EntityStates.VagrantNovaItem;
using EntityStates.VoidCamp;
using Facepunch.Steamworks;
using HG;
using HarmonyLib;
using IL.EntityStates.BrotherMonster;
using IL.EntityStates.ChildMonster;
using IL.EntityStates.Duplicator;
using IL.EntityStates.Huntress.Weapon;
using IL.EntityStates.Merc;
using IL.EntityStates.MinorConstruct;
using IL.EntityStates.Scrapper;
using IL.RoR2;
using IL.RoR2.UI;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.EntityStates.VagrantNovaItem;
using On.RoR2;
using On.RoR2.PostProcessing;
using R2API.Utils;
using Rewired;
using RoR2;
using RoR2.Items;
using RoR2.Navigation;
using RoR2.Orbs;
using RoR2.PostProcessing;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using TanksMod.Modules;
using TanksMod.Modules.Components;
using TanksMod.Modules.Components.BasicTank;
using TanksMod.Modules.Components.UI;
using TanksMod.Modules.Survivors;
using TanksMod.States;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MiscFixes
{
	[HarmonyPatch]
	public class FixVanilla
	{
		[HarmonyPatch(typeof(CharacterBody), "GetNotMoving")]
		[HarmonyPrefix]
		public static void FindFucker(CharacterBody __instance)
		{
			if (!NetworkServer.active)
			{
				Debug.LogError((object)new StackTrace());
			}
		}

		[HarmonyPatch(typeof(CharacterBody), "TriggerEnemyDebuffs")]
		[HarmonyILManipulator]
		public static void WhatTheFuck(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DotController>(x, "GetDotDef"),
				(Instruction x) => ILPatternMatchingExt.MatchPop(x)
			}))
			{
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Br, (object)val2);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchPop(x)
				});
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CharacterBody.TriggerEnemyDebuffs");
			}
		}

		[HarmonyPatch(typeof(CharacterBody), "TryGiveFreeUnlockWhenLevelUp")]
		[HarmonyILManipulator]
		public static void FreeFortniteCard(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel retLabel = null;
			ILCursor[] array = default(ILCursor[]);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(CharacterBody), "inventory"))
			}) && val.TryFindNext(ref array, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref retLabel)
			}))
			{
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val2);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Br, (object)retLabel);
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CharacterBody.TryGiveFreeUnlockWhenLevelUp");
			}
		}

		[HarmonyPatch(typeof(VineOrb), "OnArrival")]
		[HarmonyILManipulator]
		public static void VineOrbArrival(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int bodyLoc = 0;
			ILCursor[] array = default(ILCursor[]);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref bodyLoc)
			}) && val.TryFindNext(ref array, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Play_item_proc_triggerEnemyDebuffs")
			}))
			{
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Ldloc, bodyLoc);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)val2);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Play_item_proc_triggerEnemyDebuffs")
				});
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for VineOrb.OnArrival");
			}
		}

		[HarmonyPatch(typeof(BossGroup), "OnDefeatedServer")]
		[HarmonyILManipulator]
		public static void BossGroupEvent(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(Run), "instance")),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "OnServerBossDefeated")
			}))
			{
				ILLabel val2 = val.DefineLabel();
				ILLabel val3 = val.DefineLabel();
				int index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)val3);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val3);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "OnServerBossDefeated")
				});
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for BossGroup.OnDefeatedServer");
			}
		}

		[HarmonyPatch(typeof(ProjectileController), "Start")]
		[HarmonyILManipulator]
		public static void ProjectileStart(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel label = null;
			int num = default(int);
			ILLabel val2 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertySetter(typeof(ProjectileController), "shouldPlaySounds")),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => x.MatchOpImplicit(),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
			}) && val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(ProjectileController), "isPrediction")),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Call, (MethodBase)AccessTools.PropertyGetter(typeof(ProjectileController), "ghost"));
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)label);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for ProjectileController.Start");
			}
		}

		[HarmonyPatch(typeof(TemporaryOverlayInstance), "SetupMaterial")]
		[HarmonyPrefix]
		public static void SetupMaterial(TemporaryOverlayInstance __instance)
		{
			if (!Object.op_Implicit((Object)(object)__instance.originalMaterial) && __instance.ValidateOverlay())
			{
				__instance.componentReference.CopyDataFromPrefabToInstance();
			}
		}

		[HarmonyPatch(typeof(StatManager), "ProcessGoldEvents")]
		[HarmonyILManipulator]
		public static void ProcessGold(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			ILLabel val3 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<GoldEvent>(x, "characterMaster"),
				(Instruction x) => ILPatternMatchingExt.MatchDup(x),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val3)
			}))
			{
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchDup(x)
				});
				val.EmitOpImplicit();
			}
			else
			{
				Debug.LogError((object)"IL hook failed for StatManager.ProcessGoldEvents 1");
			}
			ILLabel val2 = default(ILLabel);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Component>(x, "GetComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchDup(x),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref val2)
			}))
			{
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchDup(x)
				});
				val.EmitOpImplicit();
			}
			else
			{
				Debug.LogError((object)"IL hook failed for StatManager.ProcessGoldEvents 2");
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyILManipulator]
		private static void DevotionTele(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLoopLabel = null;
			FieldReference bodyField = null;
			int num = default(int);
			ILLabel val3 = default(ILLabel);
			FieldReference val2 = default(FieldReference);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(List<NodeIndex>), "Count")),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val3),
				(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref nextLoopLabel)
			}) && val.TryGotoPrev(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref bodyField),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(Component), "transform")),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(Transform), "position"))
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.Emit(OpCodes.Ldfld, bodyField);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)nextLoopLabel);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for DevotedLemurianController.TryTeleport");
			}
		}

		[HarmonyPatch(typeof(MinionLeashBodyBehavior), "OnDisable")]
		[HarmonyILManipulator]
		private static void MinionLeash(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (new ILCursor(il).TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(SceneInfo), "instance")),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(SceneInfo), "sceneDef")),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(SceneDef), "cachedName"))
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				ILLabel val2 = val.DefineLabel();
				ILLabel val3 = val.DefineLabel();
				ILLabel val4 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val3);
				val.Emit(OpCodes.Pop);
				val.Emit<string>(OpCodes.Ldsfld, "Empty");
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val3);
				index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val4);
				val.Emit(OpCodes.Pop);
				val.Emit<string>(OpCodes.Ldsfld, "Empty");
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val4);
				index = val.Index;
				val.Index = index + 1;
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for MinionLeashBodyBehavior.OnDisable");
			}
		}

		[HarmonyPatch(typeof(ElusiveAntlersPickup), "Start")]
		[HarmonyILManipulator]
		private static void FixAntlerStart(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel retLabel = null;
			if (new ILCursor(il).TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref retLabel)
			}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ElusiveAntlersPickup>(x, "ownerBody")
			}))
			{
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val2);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Br, (object)retLabel);
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for ElusiveAntlersPickup.Start");
			}
		}

		[HarmonyPatch(typeof(CharacterBody), "OnShardDestroyed")]
		[HarmonyILManipulator]
		private static void FixRpcShardDestroy(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0083: 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)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "CallRpcOnShardDestroyedClient")
			}))
			{
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Ldarg_0);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)val2);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "CallRpcOnShardDestroyedClient")
				});
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CharacterBody.OnShardDestroyed");
			}
		}

		[HarmonyILManipulator]
		[HarmonyPatch(typeof(ElusiveAntlersPickup), "FixedUpdate")]
		private static void ElusiveAntlersPickup_FixedUpdate(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num2 = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ElusiveAntlersPickup>(x, "ownerBody"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(Component), "gameObject")),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(GameObject), "transform")),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(Transform), "position")),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num2)
			}))
			{
				int index = val.Index;
				val.Index = index + 1;
				ILLabel val2 = val.DefineLabel();
				ILLabel val3 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val3);
				val.Emit(OpCodes.Pop);
				val.Emit<Vector3>(OpCodes.Ldsfld, "zeroVector");
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val3);
				int num = default(int);
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
				});
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for ElusiveAntlersPickup.FixedUpdate");
			}
		}

		[HarmonyPatch(typeof(FogDamageController), "EvaluateTeam")]
		[HarmonyILManipulator]
		public static void FixFog(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int locTC = 0;
			int locBody = 0;
			ILLabel label = null;
			ILCursor[] array = default(ILCursor[]);
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locTC),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(TeamComponent), "body")),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locBody)
			}) && val.TryFindPrev(ref array, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref label)
			}))
			{
				val.Emit(OpCodes.Ldloc, locTC);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)label);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, locBody)
				});
				val.Emit(OpCodes.Ldloc, locBody);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)label);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for FogDamageController.EvaluateTeam");
			}
		}

		[HarmonyPatch(typeof(TetherVfxOrigin), "AddTether")]
		[HarmonyILManipulator]
		public static void FixTether(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: 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)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<TetherVfxOrigin>(x, "onTetherAdded"),
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<TetherAddDelegate>(x, "Invoke")
			}))
			{
				ILLabel val2 = val.MarkLabel();
				val.GotoPrev((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<TetherVfxOrigin>(x, "onTetherAdded")
				});
				ILLabel val3 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.Emit(OpCodes.Brtrue, (object)val3);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val3);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for TetherVfxOrigin.AddTether");
			}
		}

		[HarmonyPatch(typeof(CharacterMaster), "TrueKill", new Type[]
		{
			typeof(GameObject),
			typeof(GameObject),
			typeof(DamageTypeCombo)
		})]
		[HarmonyILManipulator]
		public static void FixKill(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel label = null;
			ILLabel label2 = null;
			FieldReference val4 = default(FieldReference);
			ILCursor[] array = default(ILCursor[]);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, ref val4),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "HasBuff")
			}) && val.TryFindNext(ref array, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
			}))
			{
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody")
				});
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val2);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Br, (object)label);
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CharacterMaster.TrueKill 1");
			}
			if (val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(CharacterBody), "equipmentSlot"))
			}) && val.TryFindNext(ref array, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label2)
			}))
			{
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "GetBody")
				});
				ILLabel val3 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brtrue, (object)val3);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Br, (object)label2);
				val.MarkLabel(val3);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CharacterMaster.TrueKill 2");
			}
		}

		[HarmonyPatch(typeof(DeathState), "FixedUpdate")]
		[HarmonyILManipulator]
		public static void FixExplode(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILCursor[] array = Array.Empty<ILCursor>();
			if (val.TryFindNext(ref array, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<DeathState>(x, "FireExplosion"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GameObject>(x, "SetActive")
			}))
			{
				ILCursor obj = array[0];
				ILCursor val2 = array[1];
				int index = obj.Index;
				obj.Index = index + 1;
				obj.MoveAfterLabels();
				index = val2.Index;
				val2.Index = index + 1;
				obj.Emit(OpCodes.Br, (object)val2.MarkLabel());
				val2.Emit(OpCodes.Ldarg_0);
				val2.EmitDelegate<Action<DeathState>>((Action<DeathState>)delegate(DeathState self)
				{
					if (Object.op_Implicit((Object)(object)((EntityState)self).modelLocator) && Object.op_Implicit((Object)(object)((EntityState)self).modelLocator.modelTransform))
					{
						((Component)((EntityState)self).modelLocator.modelTransform).gameObject.SetActive(false);
					}
				});
			}
			else
			{
				Debug.LogError((object)"IL hook failed for DeathState.FixedUpdate");
			}
		}

		[HarmonyPatch(typeof(MPEventSystem), "Update")]
		[HarmonyILManipulator]
		public static void FixThisFuckingBullshitGearbox(ILContext il)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			ILCursor[] array = null;
			if (new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)AccessTools.PropertyGetter(typeof(EventSystem), "current")),
				(Instruction x) => ILPatternMatchingExt.MatchCall(x, (MethodBase)AccessTools.PropertySetter(typeof(EventSystem), "current"))
			}))
			{
				array[0].Remove();
				array[1].Remove();
			}
			else
			{
				Debug.LogError((object)"IL hook failed for MPEventSystem.Update");
			}
		}

		[HarmonyPatch(typeof(Idle), "OnEnter")]
		[HarmonyILManipulator]
		public static void Spinny(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(RouletteChestControllerBaseState), "rouletteChestController")),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<RouletteChestController>(x, "purchaseInteraction"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertySetter(typeof(PurchaseInteraction), "Networkavailable"))
			}))
			{
				ILLabel val2 = val.DefineLabel();
				val.Emit(OpCodes.Br, (object)val2);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertySetter(typeof(PurchaseInteraction), "Networkavailable"))
				});
				val.MarkLabel(val2);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Action<RouletteChestControllerBaseState>>((Action<RouletteChestControllerBaseState>)delegate(RouletteChestControllerBaseState ctrl)
				{
					if (Object.op_Implicit((Object)(object)ctrl.rouletteChestController) && Object.op_Implicit((Object)(object)ctrl.rouletteChestController.purchaseInteraction))
					{
						ctrl.rouletteChestController.purchaseInteraction.Networkavailable = true;
					}
				});
			}
			else
			{
				Debug.LogError((object)"IL hook failed for MPEventSystem.Update");
			}
		}

		[HarmonyPatch(typeof(BaseSteamworks), "RunUpdateCallbacks")]
		[HarmonyFinalizer]
		public static Exception FixFacepunch(Exception __exception)
		{
			return null;
		}

		[HarmonyPatch(typeof(Idle), "FixedUpdate")]
		[HarmonyPatch(typeof(VoidCampObjectiveTracker), "GenerateString")]
		[HarmonyILManipulator]
		public static void FixVoidSeed(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(ReadOnlyCollection<TeamComponent>), "Count"))
			}))
			{
				val.Remove();
				val.Emit(OpCodes.Call, (MethodBase)AccessTools.DeclaredMethod(typeof(FixVanilla), "GetRealCount", (Type[])null, (Type[])null));
			}
			else
			{
				Debug.LogError((object)"IL hook failed for EntityStates.VoidCamp.Idle");
			}
		}

		[HarmonyPatch(typeof(Interactor), "FindBestInteractableObject")]
		[HarmonyILManipulator]
		public static void FixInteraction(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int loc = 0;
			ILLabel label = null;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref loc),
				(Instruction x) => ILPatternMatchingExt.MatchCall<EntityLocator>(x, "HasEntityLocator"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
			}))
			{
				val.Emit(OpCodes.Ldloc, loc);
				val.Emit<EntityLocator>(OpCodes.Ldfld, "entity");
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)label);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for Interactor.FindBestInteractableObject");
			}
			int loc2 = 0;
			ILLabel label2 = null;
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref loc2),
				(Instruction x) => ILPatternMatchingExt.MatchCall<EntityLocator>(x, "HasEntityLocator"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label2)
			}))
			{
				val.Emit(OpCodes.Ldloc, loc2);
				val.Emit<EntityLocator>(OpCodes.Ldfld, "entity");
				val.EmitOpImplicit();
				val.Emit(OpCodes.Brfalse, (object)label2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for Interactor.FindBestInteractableObject2");
			}
		}

		public static int GetRealCount(ReadOnlyCollection<TeamComponent> teamMembers)
		{
			int num = 0;
			foreach (TeamComponent teamMember in teamMembers)
			{
				CharacterBody val = (Object.op_Implicit((Object)(object)teamMember) ? teamMember.body : null);
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.master) && Object.op_Implicit((Object)(object)val.healthComponent) && val.healthComponent.alive)
				{
					num++;
				}
			}
			return num;
		}
	}
	[HarmonyPatch]
	public class FixTank
	{
		[HarmonyPatch(typeof(BasicTank), "InitializeSkills")]
		[HarmonyPostfix]
		public static void InitializeSkills()
		{
			foreach (SkillDef skillDef in ContentPacks.skillDefs)
			{
				skillDef.skillName = skillDef.skillName.Trim().Replace(" ", "_");
				skillDef.skillNameToken = skillDef.skillNameToken.Trim().Replace(" ", "_");
				((Object)skillDef).name = skillDef.skillName;
			}
		}

		[HarmonyPatch(typeof(StaticModels), "CreateBodyModelFamily")]
		[HarmonyPostfix]
		public static void CreateBodyModelFamily(GenericSkill __result)
		{
			__result.skillName = "BodyModel";
			((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "BodyModelFamily";
			Content.AddSkillFamily(__result._skillFamily);
		}

		[HarmonyPatch(typeof(StaticModels), "CreateTurretModelFamily")]
		[HarmonyPostfix]
		public static void CreateTurretModelFamily(GenericSkill __result)
		{
			__result.skillName = "TurretModel";
			((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "TurretModelFamily";
			Content.AddSkillFamily(__result._skillFamily);
		}

		[HarmonyPatch(typeof(StaticColors), "CreateGlowColorFamily")]
		[HarmonyPostfix]
		public static void CreateGlowColorFamily(GenericSkill __result)
		{
			__result.skillName = "GlowColor";
			((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "GlowColorFamily";
			Content.AddSkillFamily(__result._skillFamily);
		}

		[HarmonyPatch(typeof(StaticColors), "CreateBodyColorFamily")]
		[HarmonyPostfix]
		public static void CreateBodyColorFamily(GenericSkill __result)
		{
			__result.skillName = "BodyColor";
			((Object)__result._skillFamily).name = ((Object)((Component)__result).gameObject).name + "BodyColorFamily";
			Content.AddSkillFamily(__result._skillFamily);
		}

		[HarmonyPatch(typeof(TankCrosshair), "Start")]
		[HarmonyPrefix]
		public static void IHateUI(TankCrosshair __instance)
		{
			TankController component = ((Component)__instance).GetComponentInParent<HUD>().targetBodyObject.GetComponent<TankController>();
			if ((Object)(object)component.crosshair != (Object)null && (Object)(object)component.crosshair != (Object)(object)__instance)
			{
				Object.Destroy((Object)(object)((Component)component.crosshair).gameObject);
			}
		}

		public static void BaseVagrantNovaItemState_OnEnter(orig_OnEnter orig, BaseVagrantNovaItemState self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)self.chargeSparks) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((Object)((EntityState)self).characterBody).name == "BasicTankBody(Clone)")
			{
				self.chargeSparks.startSize = 0.02f;
			}
		}

		public static BurnEffectControllerHelper BurnEffectController_AddFireParticles(orig_AddFireParticles orig, BurnEffectController self, Renderer modelRenderer, Transform targetParentTransform)
		{
			//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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			BurnEffectControllerHelper val = orig.Invoke(self, modelRenderer, targetParentTransform);
			if (Object.op_Implicit((Object)(object)targetParentTransform) && Object.op_Implicit((Object)(object)targetParentTransform.parent) && ((Object)targetParentTransform.parent).name == "mdlBasicTank")
			{
				NormalizeParticleScale val2 = default(NormalizeParticleScale);
				if (((Component)val).TryGetComponent<NormalizeParticleScale>(ref val2))
				{
					Object.DestroyImmediate((Object)(object)val2);
				}
				Vector3 localScale = ((Component)modelRenderer).transform.localScale;
				float num = Mathf.Max(1f, Vector3Utils.ComponentMax(ref localScale));
				ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren<ParticleSystem>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					MainModule main = componentsInChildren[i].main;
					MinMaxCurve startSize = ((MainModule)(ref main)).startSize;
					((MinMaxCurve)(ref startSize)).constantMin = ((MinMaxCurve)(ref startSize)).constantMin / num;
					((MinMaxCurve)(ref startSize)).constantMax = ((MinMaxCurve)(ref startSize)).constantMax / num;
					((MainModule)(ref main)).startSize = startSize;
				}
			}
			return val;
		}

		[HarmonyPatch(typeof(VisualRuntime), "Start")]
		[HarmonyPostfix]
		public static void UpdateInfos(VisualRuntime __instance)
		{
			ColorRuntime component = ((Component)__instance).GetComponent<ColorRuntime>();
			CharacterModel component2 = ((Component)((Component)__instance).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>();
			for (int i = 0; i < component2.baseRendererInfos.Length; i++)
			{
				ref RendererInfo reference = ref component2.baseRendererInfos[i];
				bool ignoreOverlays = !((Component)reference.renderer).gameObject.activeSelf || !((Component)reference.renderer).gameObject.activeInHierarchy || !component.bodyOnlyRenderers.Contains(reference.renderer);
				reference.ignoreOverlays = ignoreOverlays;
			}
		}

		[HarmonyPatch(typeof(GenericTankMain), "ApplyFuelBaseAmount")]
		[HarmonyILManipulator]
		public static void FixFuel(ILContext il)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			ILCursor[] array = null;
			string[] s = new string[3];
			if (new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref s[0]),
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref s[1]),
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref s[2])
			}))
			{
				for (int i = 0; i < array.Length; i++)
				{
					array[i].Next.Operand = s[i].Trim().Replace(" ", "_");
				}
			}
			else
			{
				Debug.LogError((object)"IL hook failed for GenericTankMain.ApplyFuelBaseAmount");
			}
		}

		[HarmonyPatch(typeof(CheesePlayerHandler), "ExecuteInGameplay")]
		[HarmonyILManipulator]
		public static void BetterGameplay(ILContext il)
		{
			//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_001a: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il)
			{
				Index = il.Instrs.Count - 1
			};
			if (val.TryGotoPrev((MoveType)1, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CheesePlayerHandler>(x, "myUser")
			}))
			{
				val.Emit(OpCodes.Ret);
			}
		}

		[HarmonyPatch(typeof(CheesePlayerHandler), "ExecuteInMenu")]
		[HarmonyILManipulator]
		public static void FuckUICode2(ILContext il)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			ILCursor[] array = null;
			if (new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "bodyRowId")),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "turretRowId")),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "glowRowId")),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, AccessTools.DeclaredField(typeof(StaticLoadouts), "paintRowId"))
			}))
			{
				ILCursor[] array2 = default(ILCursor[]);
				int num = default(int);
				for (int i = 0; i < array.Length; i++)
				{
					ILCursor val = array[i];
					int loc = 0;
					ILLabel label = null;
					val.GotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref loc)
					});
					val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, loc)
					});
					val.FindNext(ref array2, new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
					});
					val.EmitDelegate<Func<List<Row>, int, bool>>((Func<List<Row>, int, bool>)((List<Row> rows, int idx) => idx < rows.Count));
					val.Emit(OpCodes.Brfalse, (object)label);
					val.Emit(OpCodes.Ldarg_0);
					val.Emit<CheesePlayerHandler>(OpCodes.Ldfld, "panel");
					val.Emit<LoadoutPanelController>(OpCodes.Ldfld, "rows");
					val.Emit(OpCodes.Ldloc, loc);
					if (i == 0)
					{
						val.GotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 3)
						});
						val.Remove();
						val.Emit(OpCodes.Ldloc, loc);
					}
					if (i == 1)
					{
						val.GotoNext(new Func<Instruction, bool>[1]
						{
							(Instruction x) => ILPatternMatchingExt.MatchStfld<CheesePlayerHandler>(x, "turretTips")
						});
						val.GotoPrev(new Func<Instruction, bool>[2]
						{
							(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num),
							(Instruction x) => ILPatternMatchingExt.MatchCgt(x)
						});
						val.Remove();
						val.Emit(OpCodes.Ldloc, loc);
					}
				}
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CheesePlayerHandler.ExecuteInMenu");
			}
		}

		[HarmonyPatch(typeof(CheesePlayerHandler), "Update")]
		[HarmonyILManipulator]
		public static void FuckUICode(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdelemRef(x)
			}))
			{
				ILLabel val2 = val.DefineLabel();
				ILLabel val3 = val.DefineLabel();
				ILLabel val4 = val.DefineLabel();
				val.Emit(OpCodes.Dup);
				val.Emit<Object>(OpCodes.Call, "op_Implicit");
				val.Emit(OpCodes.Brtrue, (object)val3);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldnull);
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val3);
				int index = val.Index;
				val.Index = index + 1;
				val.Emit(OpCodes.Dup);
				val.Emit<Object>(OpCodes.Call, "op_Implicit");
				val.Emit(OpCodes.Brtrue, (object)val4);
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldnull);
				val.Emit(OpCodes.Br, (object)val2);
				val.MarkLabel(val4);
				index = val.Index;
				val.Index = index + 1;
				val.MarkLabel(val2);
			}
			else
			{
				Debug.LogError((object)"IL hook failed for CheesePlayerHandler.Update");
			}
		}
	}
	internal static class GameFixes
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__FixMercEvisAllyTargetting;

			public static Manipulator <1>__FixPrinterDropEffect;

			public static Manipulator <2>__FixParticleDetachOnDestroy;

			public static Manipulator <3>__FixPositionIndicatorWithHiddenHud;

			public static Manipulator <4>__FixIndicatorSetVisibleNRE;

			public static Manipulator <5>__FixCrosshairOverrideOnDestroy;

			public static Manipulator <6>__FixLobbyQuitEventSystem;

			public static hook_RefreshJoystickAssignment <7>__FixNoRewiredInputOnQuit;

			public static Func<HealthComponent, TeamIndex, bool> <8>__ShouldDirectHitProceed;

			public static Manipulator <9>__EnterSkyLeap_OnEnter;

			public static Manipulator <10>__ExitSkyLeap_OnEnter;

			public static Manipulator <11>__HoldSkyLeap_OnEnter;

			public static Manipulator <12>__HoldSkyLeap_OnExit;

			public static Manipulator <13>__SpellChannelState_OnEnter;

			public static Manipulator <14>__SpellChannelState_OnExit;

			public static Manipulator <15>__Duplicating_DropDroplet;

			public static Manipulator <16>__FireArrowSnipe_FireBullet;

			public static Manipulator <17>__Hidden_OnEnter;

			public static Manipulator <18>__Hidden_OnExit;

			public static Manipulator <19>__ScrapperBaseState_OnEnter;

			public static Manipulator <20>__BuffPassengerWhileSeated_OnDisable;

			public static Manipulator <21>__BuffPassengerWhileSeated_OnEnable;

			public static Manipulator <22>__DelusionChestController_ResetChestForDelusion;

			public static Manipulator <23>__DelusionChestController_Start;

			public static Manipulator <24>__DevotionInventoryController_Awake;

			public static Manipulator <25>__MasterDropDroplet_DropItems;

			public static Manipulator <26>__MinionGroup_AddMinion;

			public static Manipulator <27>__MinionGroup_RemoveMinion;

			public static Manipulator <28>__FixKinBodyIndexNotReseting;

			public static Manipulator <29>__FixKinNotUpdatingPanel;

			public static Manipulator <30>__FixFrolicTeleportWithoutAvailableNodes;

			public static Manipulator <31>__FixBurnControllerDestroyDoT;

			public static hook_Awake <32>__FixMeridianTestStateSpam;

			public static hook_Awake <33>__FixMainMenuCameraDamageIndicator;
		}

		internal static void EmitOpImplicit(this ILCursor c)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			c.Emit<Object>(OpCodes.Call, "op_Implicit");
		}

		internal static bool MatchOpImplicit(this Instruction instr)
		{
			return ILPatternMatchingExt.MatchCallOrCallvirt<Object>(instr, "op_Implicit");
		}

		internal static bool MatchOpInequality(this Instruction instr)
		{
			return ILPatternMatchingExt.MatchCallOrCallvirt<Object>(instr, "op_Inequality");
		}

		internal static bool MatchAny(this Instruction instr, out Instruction instruction)
		{
			instruction = instr;
			return true;
		}

		private static void ApplyManualILHook(Type type, string methodName, Manipulator manipulator)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			BindingFlags bindingAttr = (BindingFlags)(-1);
			new ILHook((MethodBase)type.GetMethods(bindingAttr).FirstOrDefault((MethodInfo t) => t.Name.Contains(methodName)), manipulator);
		}

		private static void LogError(string method)
		{
			Debug.LogError((object)("Failed to patch " + method));
		}

		private static void LogError(ILContext il)
		{
			LogError(((MemberReference)il.Method).Name);
		}

		internal static void Init()
		{
			//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: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0090: 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_009b: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			object obj = <>O.<0>__FixMercEvisAllyTargetting;
			if (obj == null)
			{
				Manipulator val = FixMercEvisAllyTargetting;
				<>O.<0>__FixMercEvisAllyTargetting = val;
				obj = (object)val;
			}
			EvisDash.FixedUpdate += (Manipulator)obj;
			object obj2 = <>O.<1>__FixPrinterDropEffect;
			if (obj2 == null)
			{
				Manipulator val2 = FixPrinterDropEffect;
				<>O.<1>__FixPrinterDropEffect = val2;
				obj2 = (object)val2;
			}
			Duplicating.DropDroplet += (Manipulator)obj2;
			object obj3 = <>O.<2>__FixParticleDetachOnDestroy;
			if (obj3 == null)
			{
				Manipulator val3 = FixParticleDetachOnDestroy;
				<>O.<2>__FixParticleDetachOnDestroy = val3;
				obj3 = (object)val3;
			}
			DetachParticleOnDestroyAndEndEmission.OnDisable += (Manipulator)obj3;
			object obj4 = <>O.<3>__FixPositionIndicatorWithHiddenHud;
			if (obj4 == null)
			{
				Manipulator val4 = FixPositionIndicatorWithHiddenHud;
				<>O.<3>__FixPositionIndicatorWithHiddenHud = val4;
				obj4 = (object)val4;
			}
			PositionIndicator.UpdatePositions += (Manipulator)obj4;
			object obj5 = <>O.<4>__FixIndicatorSetVisibleNRE;
			if (obj5 == null)
			{
				Manipulator val5 = FixIndicatorSetVisibleNRE;
				<>O.<4>__FixIndicatorSetVisibleNRE = val5;
				obj5 = (object)val5;
			}
			Indicator.SetVisibleInternal += (Manipulator)obj5;
			object obj6 = <>O.<5>__FixCrosshairOverrideOnDestroy;
			if (obj6 == null)
			{
				Manipulator val6 = FixCrosshairOverrideOnDestroy;
				<>O.<5>__FixCrosshairOverrideOnDestroy = val6;
				obj6 = (object)val6;
			}
			CrosshairOverrideBehavior.OnDestroy += (Manipulator)obj6;
			object obj7 = <>O.<6>__FixLobbyQuitEventSystem;
			if (obj7 == null)
			{
				Manipulator val7 = FixLobbyQuitEventSystem;
				<>O.<6>__FixLobbyQuitEventSystem = val7;
				obj7 = (object)val7;
			}
			RuleChoiceController.FindNetworkUser += (Manipulator)obj7;
			object obj8 = <>O.<7>__FixNoRewiredInputOnQuit;
			if (obj8 == null)
			{
				hook_RefreshJoystickAssignment val8 = FixNoRewiredInputOnQuit;
				<>O.<7>__FixNoRewiredInputOnQuit = val8;
				obj8 = (object)val8;
			}
			RewiredIntegrationManager.RefreshJoystickAssignment += (hook_RefreshJoystickAssignment)obj8;
			FixServerMethodsCalledOnClient();
			SotsFixes();
		}

		private static void FixMercEvisAllyTargetting(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int varIndex = 0;
			ILLabel label = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Component>(x, "GetComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref varIndex)
			}) || !val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, varIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)AccessTools.PropertyGetter(typeof(EntityState), "healthComponent")),
				(Instruction x) => x.MatchOpInequality(),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit(OpCodes.Ldloc, varIndex);
			val.Emit<HurtBox>(OpCodes.Ldfld, "healthComponent");
			val.Emit(OpCodes.Ldarg_0);
			val.Emit(OpCodes.Call, (MethodBase)AccessTools.PropertyGetter(typeof(EntityState), "characterBody"));
			val.Emit(OpCodes.Callvirt, (MethodBase)AccessTools.PropertyGetter(typeof(CharacterBody), "teamComponent"));
			val.Emit(OpCodes.Callvirt, (MethodBase)AccessTools.PropertyGetter(typeof(TeamComponent), "teamIndex"));
			val.EmitDelegate<Func<HealthComponent, TeamIndex, bool>>((Func<HealthComponent, TeamIndex, bool>)FriendlyFireManager.ShouldDirectHitProceed);
			val.Emit(OpCodes.Brfalse_S, (object)label);
		}

		private static void FixPrinterDropEffect(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(EffectManager), "SimpleMuzzleFlash")
			}))
			{
				LogError(il);
				return;
			}
			val.Remove();
			val.EmitDelegate<Action<GameObject, GameObject, string, bool>>((Action<GameObject, GameObject, string, bool>)delegate(GameObject effectPrefab, GameObject obj, string muzzleName, bool _)
			{
				//IL_004d: 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)
				ModelLocator val2 = default(ModelLocator);
				if (Object.op_Implicit((Object)(object)obj) && obj.TryGetComponent<ModelLocator>(ref val2) && Object.op_Implicit((Object)(object)val2.modelTransform))
				{
					ChildLocator component = ((Component)val2.modelTransform).GetComponent<ChildLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						int num = component.FindChildIndex(muzzleName);
						Transform val3 = component.FindChild(num);
						if (Object.op_Implicit((Object)(object)val3))
						{
							Object.Instantiate<GameObject>(effectPrefab, val3.position, Quaternion.identity, val3);
						}
					}
				}
			});
		}

		private static void FixParticleDetachOnDestroy(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel returnLabel = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<DetachParticleOnDestroyAndEndEmission>(x, "particleSystem"),
				(Instruction x) => x.MatchOpImplicit(),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref returnLabel)
			}) || !val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ParticleSystem>(x, "Stop")
			}))
			{
				LogError(il);
				return;
			}
			val.Emit(OpCodes.Ldarg_0);
			val.Emit<DetachParticleOnDestroyAndEndEmission>(OpCodes.Ldfld, "particleSystem");
			val.Emit(OpCodes.Callvirt, (MethodBase)AccessTools.PropertyGetter(typeof(Component), "gameObject"));
			val.Emit(OpCodes.Callvirt, (MethodBase)AccessTools.PropertyGetter(typeof(GameObject), "activeInHierarchy"));
			val.Emit(OpCodes.Brfalse, (object)returnLabel);
		}

		private static void FixPositionIndicatorWithHiddenHud(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int locVarIndex = 0;
			ILLabel nextLabel = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locVarIndex),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<PositionIndicator>(x, "alwaysVisibleObject"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GameObject>(x, "SetActive"),
				(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Index += 2;
			val.Emit<Object>(OpCodes.Call, "op_Implicit");
			val.Emit(OpCodes.Brfalse, nextLabel.Target);
			val.Emit(OpCodes.Ldloc, locVarIndex);
			val.Emit<PositionIndicator>(OpCodes.Ldfld, "alwaysVisibleObject");
		}

		private static void FixIndicatorSetVisibleNRE(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction val2 = null;
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Renderer>(x, "set_enabled"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val2 = val.Next;
			val.Emit(OpCodes.Dup);
			val.Emit<Object>(OpCodes.Call, "op_Implicit");
			val.Emit(OpCodes.Brtrue_S, val2);
			val.Emit(OpCodes.Pop);
			val.Emit(OpCodes.Br_S, nextInstr);
		}

		private static void FixCrosshairOverrideOnDestroy(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CrosshairOverrideBehavior>(x, "requestList")
			}))
			{
				LogError(il);
				return;
			}
			val.EmitDelegate<Func<List<OverrideRequest>, List<OverrideRequest>>>((Func<List<OverrideRequest>, List<OverrideRequest>>)((List<OverrideRequest> requestList) => requestList.ToList()));
		}

		private static void FixNoRewiredInputOnQuit(orig_RefreshJoystickAssignment orig)
		{
			if (ReInput.initialized && ReInput.controllers != null)
			{
				orig.Invoke();
			}
		}

		private static void FixLobbyQuitEventSystem(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchPop(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdnull(x),
				(Instruction x) => ILPatternMatchingExt.MatchRet(x)
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #1");
				return;
			}
			Instruction next = val.Next;
			if (!val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EventSystem>(x, "get_current")
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #2");
				return;
			}
			val.Remove();
			val.Emit(OpCodes.Isinst, typeof(MPEventSystem));
			val.Emit(OpCodes.Dup);
			val.Emit<Object>(OpCodes.Call, "op_Implicit");
			val.Emit(OpCodes.Brfalse, next);
		}

		internal static void FixServerMethodsCalledOnClient()
		{
			//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: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0090: 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_009b: Expected O, but got Unknown
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Expected O, but got Unknown
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Expected O, but got Unknown
			object obj = <>O.<9>__EnterSkyLeap_OnEnter;
			if (obj == null)
			{
				Manipulator val = EnterSkyLeap_OnEnter;
				<>O.<9>__EnterSkyLeap_OnEnter = val;
				obj = (object)val;
			}
			EnterSkyLeap.OnEnter += (Manipulator)obj;
			object obj2 = <>O.<10>__ExitSkyLeap_OnEnter;
			if (obj2 == null)
			{
				Manipulator val2 = ExitSkyLeap_OnEnter;
				<>O.<10>__ExitSkyLeap_OnEnter = val2;
				obj2 = (object)val2;
			}
			ExitSkyLeap.OnEnter += (Manipulator)obj2;
			object obj3 = <>O.<11>__HoldSkyLeap_OnEnter;
			if (obj3 == null)
			{
				Manipulator val3 = HoldSkyLeap_OnEnter;
				<>O.<11>__HoldSkyLeap_OnEnter = val3;
				obj3 = (object)val3;
			}
			HoldSkyLeap.OnEnter += (Manipulator)obj3;
			object obj4 = <>O.<12>__HoldSkyLeap_OnExit;
			if (obj4 == null)
			{
				Manipulator val4 = HoldSkyLeap_OnExit;
				<>O.<12>__HoldSkyLeap_OnExit = val4;
				obj4 = (object)val4;
			}
			HoldSkyLeap.OnExit += (Manipulator)obj4;
			object obj5 = <>O.<13>__SpellChannelState_OnEnter;
			if (obj5 == null)
			{
				Manipulator val5 = SpellChannelState_OnEnter;
				<>O.<13>__SpellChannelState_OnEnter = val5;
				obj5 = (object)val5;
			}
			SpellChannelState.OnEnter += (Manipulator)obj5;
			object obj6 = <>O.<14>__SpellChannelState_OnExit;
			if (obj6 == null)
			{
				Manipulator val6 = SpellChannelState_OnExit;
				<>O.<14>__SpellChannelState_OnExit = val6;
				obj6 = (object)val6;
			}
			SpellChannelState.OnExit += (Manipulator)obj6;
			object obj7 = <>O.<15>__Duplicating_DropDroplet;
			if (obj7 == null)
			{
				Manipulator val7 = Duplicating_DropDroplet;
				<>O.<15>__Duplicating_DropDroplet = val7;
				obj7 = (object)val7;
			}
			Duplicating.DropDroplet += (Manipulator)obj7;
			object obj8 = <>O.<16>__FireArrowSnipe_FireBullet;
			if (obj8 == null)
			{
				Manipulator val8 = FireArrowSnipe_FireBullet;
				<>O.<16>__FireArrowSnipe_FireBullet = val8;
				obj8 = (object)val8;
			}
			FireArrowSnipe.FireBullet += (Manipulator)obj8;
			object obj9 = <>O.<17>__Hidden_OnEnter;
			if (obj9 == null)
			{
				Manipulator val9 = Hidden_OnEnter;
				<>O.<17>__Hidden_OnEnter = val9;
				obj9 = (object)val9;
			}
			Hidden.OnEnter += (Manipulator)obj9;
			object obj10 = <>O.<18>__Hidden_OnExit;
			if (obj10 == null)
			{
				Manipulator val10 = Hidden_OnExit;
				<>O.<18>__Hidden_OnExit = val10;
				obj10 = (object)val10;
			}
			Hidden.OnExit += (Manipulator)obj10;
			object obj11 = <>O.<19>__ScrapperBaseState_OnEnter;
			if (obj11 == null)
			{
				Manipulator val11 = ScrapperBaseState_OnEnter;
				<>O.<19>__ScrapperBaseState_OnEnter = val11;
				obj11 = (object)val11;
			}
			ScrapperBaseState.OnEnter += (Manipulator)obj11;
			object obj12 = <>O.<20>__BuffPassengerWhileSeated_OnDisable;
			if (obj12 == null)
			{
				Manipulator val12 = BuffPassengerWhileSeated_OnDisable;
				<>O.<20>__BuffPassengerWhileSeated_OnDisable = val12;
				obj12 = (object)val12;
			}
			BuffPassengerWhileSeated.OnDisable += (Manipulator)obj12;
			object obj13 = <>O.<21>__BuffPassengerWhileSeated_OnEnable;
			if (obj13 == null)
			{
				Manipulator val13 = BuffPassengerWhileSeated_OnEnable;
				<>O.<21>__BuffPassengerWhileSeated_OnEnable = val13;
				obj13 = (object)val13;
			}
			BuffPassengerWhileSeated.OnEnable += (Manipulator)obj13;
			object obj14 = <>O.<22>__DelusionChestController_ResetChestForDelusion;
			if (obj14 == null)
			{
				Manipulator val14 = DelusionChestController_ResetChestForDelusion;
				<>O.<22>__DelusionChestController_ResetChestForDelusion = val14;
				obj14 = (object)val14;
			}
			DelusionChestController.ResetChestForDelusion += (Manipulator)obj14;
			object obj15 = <>O.<23>__DelusionChestController_Start;
			if (obj15 == null)
			{
				Manipulator val15 = DelusionChestController_Start;
				<>O.<23>__DelusionChestController_Start = val15;
				obj15 = (object)val15;
			}
			DelusionChestController.Start += (Manipulator)obj15;
			object obj16 = <>O.<24>__DevotionInventoryController_Awake;
			if (obj16 == null)
			{
				Manipulator val16 = DevotionInventoryController_Awake;
				<>O.<24>__DevotionInventoryController_Awake = val16;
				obj16 = (object)val16;
			}
			DevotionInventoryController.Awake += (Manipulator)obj16;
			object obj17 = <>O.<25>__MasterDropDroplet_DropItems;
			if (obj17 == null)
			{
				Manipulator val17 = MasterDropDroplet_DropItems;
				<>O.<25>__MasterDropDroplet_DropItems = val17;
				obj17 = (object)val17;
			}
			MasterDropDroplet.DropItems += (Manipulator)obj17;
			object obj18 = <>O.<26>__MinionGroup_AddMinion;
			if (obj18 == null)
			{
				Manipulator val18 = MinionGroup_AddMinion;
				<>O.<26>__MinionGroup_AddMinion = val18;
				obj18 = (object)val18;
			}
			MinionGroup.AddMinion += (Manipulator)obj18;
			object obj19 = <>O.<27>__MinionGroup_RemoveMinion;
			if (obj19 == null)
			{
				Manipulator val19 = MinionGroup_RemoveMinion;
				<>O.<27>__MinionGroup_RemoveMinion = val19;
				obj19 = (object)val19;
			}
			MinionGroup.RemoveMinion += (Manipulator)obj19;
		}

		private static void EnterSkyLeap_OnEnter(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ArmorBoost"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<EnterSkyLeap>(x, "baseDuration"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "AddTimedBuff"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void ExitSkyLeap_OnEnter(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ArmorBoost"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld<ExitSkyLeap>(x, "baseDuration"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "AddTimedBuff"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void HoldSkyLeap_OnEnter(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "HiddenInvincibility"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "AddBuff"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #1");
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			Instruction prev = val.Prev;
			val.Emit(OpCodes.Brfalse_S, nextInstr);
			if (!val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HoldSkyLeap>(x, "hurtboxGroup"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit")
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #2");
				return;
			}
			val.Remove();
			val.Emit(OpCodes.Brfalse_S, prev);
		}

		private static void HoldSkyLeap_OnExit(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "HiddenInvincibility"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "RemoveBuff"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #1");
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			Instruction prev = val.Prev;
			val.Emit(OpCodes.Brfalse_S, nextInstr);
			if (!val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<HoldSkyLeap>(x, "hurtboxGroup"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit")
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #2");
				return;
			}
			val.Remove();
			val.Emit(OpCodes.Brfalse_S, prev);
		}

		private static void SpellChannelState_OnEnter(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Immune"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "AddBuff"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #1");
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			Instruction prev = val.Prev;
			val.Emit(OpCodes.Brfalse_S, nextInstr);
			if (!val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<SpellChannelState>(x, "spellChannelChildTransform"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit")
			}))
			{
				LogError(((MemberReference)il.Method).Name + " #2");
				return;
			}
			val.Remove();
			val.Emit(OpCodes.Brfalse_S, prev);
		}

		private static void SpellChannelState_OnExit(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "Immune"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "RemoveBuff"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void Duplicating_DropDroplet(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "GetComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ShopTerminalBehavior>(x, "DropPickup"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void FireArrowSnipe_FireBullet(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			float num = default(float);
			if (!val.TryGotoNext(new Func<Instruction, bool>[10]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_healthComponent"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarga(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Ray>(x, "get_direction"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Vector3>(x, "op_Multiply"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<HealthComponent>(x, "TakeDamageForce"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void Hidden_OnEnter(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<Hidden>(x, "buffDef"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, (object)nextLabel);
		}

		private static void Hidden_OnExit(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<Hidden>(x, "buffDef"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, (object)nextLabel);
		}

		private static void ScrapperBaseState_OnEnter(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<ScrapperBaseState>(x, "pickupPickerController"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ScrapperBaseState>(x, "get_enableInteraction"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupPickerController>(x, "SetAvailable"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void BuffPassengerWhileSeated_OnDisable(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<BuffPassengerWhileSeated>(x, "vehicleSeat"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, (object)nextLabel);
		}

		private static void BuffPassengerWhileSeated_OnEnable(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<BuffPassengerWhileSeated>(x, "vehicleSeat"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, (object)nextLabel);
		}

		private static void DelusionChestController_ResetChestForDelusion(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			int num = default(int);
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<DelusionChestController>(x, "_pickupPickerController"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupPickerController>(x, "SetAvailable"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void DelusionChestController_Start(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			int num = default(int);
			if (!val.TryGotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<DelusionChestController>(x, "_pickupPickerController"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupPickerController>(x, "SetAvailable"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void DevotionInventoryController_Awake(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction nextInstr = null;
			int num = default(int);
			if (!val.TryGotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<DevotionInventoryController>(x, "_devotionMinionInventory"),
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "LemurianHarness"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GiveItem"),
				(Instruction x) => x.MatchAny(out nextInstr)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, nextInstr);
		}

		private static void MasterDropDroplet_DropItems(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			Instruction val2 = val.Instrs[val.Instrs.Count - 1];
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, val2);
		}

		private static void MinionGroup_AddMinion(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, (object)nextLabel);
		}

		private static void MinionGroup_RemoveMinion(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel nextLabel = null;
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Object>(x, "op_Implicit"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.Emit<NetworkServer>(OpCodes.Call, "get_active");
			val.Emit(OpCodes.Brfalse_S, (object)nextLabel);
		}

		private static void FixKinPanelPersisting()
		{
			//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: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			object obj = <>O.<28>__FixKinBodyIndexNotReseting;
			if (obj == null)
			{
				Manipulator val = FixKinBodyIndexNotReseting;
				<>O.<28>__FixKinBodyIndexNotReseting = val;
				obj = (object)val;
			}
			ClassicStageInfo.RebuildCards += (Manipulator)obj;
			Type typeFromHandle = typeof(Stage);
			object obj2 = <>O.<29>__FixKinNotUpdatingPanel;
			if (obj2 == null)
			{
				Manipulator val2 = FixKinNotUpdatingPanel;
				<>O.<29>__FixKinNotUpdatingPanel = val2;
				obj2 = (object)val2;
			}
			ApplyManualILHook(typeFromHandle, "set_singleMonsterTypeBodyIndex", (Manipulator)obj2);
		}

		private static void FixKinBodyIndexNotReseting(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int varIndex = 0;
			ILLabel nextLabel = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(Artifacts), "get_singleMonsterTypeArtifactDef"),
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<RunArtifactManager>(x, "IsArtifactEnabled"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref varIndex)
			}) || !val.TryGotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, varIndex),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref nextLabel)
			}))
			{
				LogError(il);
				return;
			}
			val.GotoLabel(nextLabel, (MoveType)0, false);
			val.Emit(OpCodes.Br, nextLabel.Target);
			val.Emit<Stage>(OpCodes.Call, "get_instance");
			Instruction prev = val.Prev;
			val.Emit<Object>(OpCodes.Call, "op_Implicit");
			val.Emit(OpCodes.Brfalse, nextLabel.Target);
			val.Emit<Stage>(OpCodes.Call, "get_instance");
			val.Emit(OpCodes.Ldc_I4_M1);
			val.Emit<Stage>(OpCodes.Callvirt, "set_singleMonsterTypeBodyIndex");
			val.GotoPrev((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, varIndex)
			});
			val.Remove();
			val.Emit(OpCodes.Brfalse, prev);
		}

		private static void FixKinNotUpdatingPanel(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Stage>(x, "set_Network_singleMonsterTypeBodyIndex")
			}))
			{
				LogError(il);
			}
			else
			{
				val.Emit<EnemyInfoPanel>(OpCodes.Call, "RefreshAll");
			}
		}

		internal static void SotsFixes()
		{
			//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: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			object obj = <>O.<30>__FixFrolicTeleportWithoutAvailableNodes;
			if (obj == null)
			{
				Manipulator val = FixFrolicTeleportWithoutAvailableNodes;
				<>O.<30>__FixFrolicTeleportWithoutAvailableNodes = val;
				obj = (object)val;
			}
			Frolic.TeleportAroundPlayer += (Manipulator)obj;
			object obj2 = <>O.<31>__FixBurnControllerDestroyDoT;
			if (obj2 == null)
			{
				Manipulator val2 = FixBurnControllerDestroyDoT;
				<>O.<31>__FixBurnControllerDestroyDoT = val2;
				obj2 = (object)val2;
			}
			BurnEffectController.HandleDestroy += (