Decompiled source of FraudTweaks v1.6.0

FraudTweaks.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ULTRAKILL.Portal;
using ULTRAKILL.Portal.Geometry;
using UnityEngine;
using UnityEngine.SceneManagement;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FraudTweaks
{
	[BepInPlugin("FraudTweaks", "FraudTweaks", "1.0.0")]
	public class FraudTweaks : BaseUnityPlugin
	{
		public static Dictionary<ItemPlaceZone, ItemIdentifier> LastItem = new Dictionary<ItemPlaceZone, ItemIdentifier>();

		public static int SavedLevel = 0;

		public static List<Bounds> OutofboundsList = new List<Bounds>();

		public static List<Transform> OutofboundsParents = new List<Transform>();

		public static Dictionary<GameObject, bool> OutofboundsActive = new Dictionary<GameObject, bool>();

		public static FraudTweaks Instance { get; private set; } = null;


		internal static ManualLogSource Logger { get; private set; } = null;


		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"FraudTweaks v1.0.0 has loaded!");
			SceneManager.sceneLoaded += delegate
			{
				OutofboundsList.Clear();
				OutofboundsParents.Clear();
				OutofboundsActive.Clear();
				OutofboundsList.Capacity = 0;
				OutofboundsParents.Capacity = 0;
			};
		}

		internal static void Patch()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("FraudTweaks");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "FraudTweaks";

		public const string PLUGIN_NAME = "FraudTweaks";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FraudTweaks.LevelSpecifics
{
	[HarmonyPatch(typeof(StatsManager))]
	public class LevelFinder
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void Started(StatsManager __instance)
		{
			//IL_0079: 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)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] source = Resources.FindObjectsOfTypeAll<GameObject>();
			List<GameObject> list = source.Where((GameObject obj) => ((Object)obj).name.Contains("OopsBlocker")).ToList();
			if (list.Count == 0)
			{
				return;
			}
			foreach (GameObject item2 in list)
			{
				FraudTweaks.OutofboundsActive.Add(item2, item2.activeSelf);
				ActiveCheck activeCheck = item2.AddComponent<ActiveCheck>();
				Bounds item = default(Bounds);
				BoxCollider[] componentsInChildren = item2.GetComponentsInChildren<BoxCollider>();
				foreach (BoxCollider val in componentsInChildren)
				{
					((Bounds)(ref item)).Encapsulate(((Collider)val).bounds);
				}
				((Bounds)(ref item)).Expand(-0.05f);
				FraudTweaks.OutofboundsList.Add(item);
				FraudTweaks.OutofboundsParents.Add(item2.transform);
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void BoundsRunner(StatsManager __instance)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			if (FraudTweaks.OutofboundsList.Count == 0)
			{
				return;
			}
			for (int i = 0; i < FraudTweaks.OutofboundsList.Count; i++)
			{
				Bounds bounds = ((Collider)MonoSingleton<NewMovement>.Instance.playerCollider).bounds;
				bool flag = false;
				BoxCollider[] componentsInChildren = ((Component)FraudTweaks.OutofboundsParents[i]).GetComponentsInChildren<BoxCollider>();
				Bounds val2;
				foreach (BoxCollider val in componentsInChildren)
				{
					val2 = ((Collider)val).bounds;
					if (((Bounds)(ref val2)).Contains(((Bounds)(ref bounds)).min))
					{
						val2 = ((Collider)val).bounds;
						if (((Bounds)(ref val2)).Contains(((Bounds)(ref bounds)).max))
						{
							flag = true;
							break;
						}
					}
				}
				KeyValuePair<GameObject, bool> keyValuePair = FraudTweaks.OutofboundsActive.ElementAtOrDefault(i);
				if (!((Object)(object)keyValuePair.Key != (Object)null))
				{
					continue;
				}
				bool num = !flag;
				val2 = FraudTweaks.OutofboundsList[i];
				int num2;
				if (((Bounds)(ref val2)).Contains(((Bounds)(ref bounds)).min))
				{
					val2 = FraudTweaks.OutofboundsList[i];
					num2 = (((Bounds)(ref val2)).Contains(((Bounds)(ref bounds)).max) ? 1 : 0);
				}
				else
				{
					num2 = 0;
				}
				if (((num ? 1u : 0u) & (uint)num2) != 0)
				{
					if (keyValuePair.Value)
					{
						bool value = FraudTweaks.OutofboundsActive.ElementAt(i).Value;
						((Component)FraudTweaks.OutofboundsParents[i]).gameObject.SetActive(true);
						FraudTweaks.OutofboundsActive[FraudTweaks.OutofboundsActive.ElementAt(i).Key] = value;
					}
				}
				else
				{
					bool value2 = FraudTweaks.OutofboundsActive.ElementAt(i).Value;
					((Component)FraudTweaks.OutofboundsParents[i]).gameObject.SetActive(false);
					FraudTweaks.OutofboundsActive[FraudTweaks.OutofboundsActive.ElementAt(i).Key] = value2;
				}
			}
		}
	}
	public class ActiveCheck : MonoBehaviour
	{
		public ActiveCheck instance;

		public void OnEnable()
		{
			instance = this;
			if (FraudTweaks.OutofboundsActive.ContainsKey(((Component)instance).gameObject))
			{
				FraudTweaks.OutofboundsActive[((Component)instance).gameObject] = true;
			}
		}

		public void OnDisable()
		{
			instance = this;
			if (FraudTweaks.OutofboundsActive.ContainsKey(((Component)instance).gameObject))
			{
				FraudTweaks.OutofboundsActive[((Component)instance).gameObject] = false;
			}
		}
	}
}
namespace FraudTweaks.Patches
{
	public class CoroutineRunner : MonoBehaviour
	{
		private static CoroutineRunner _instance;

		public static CoroutineRunner Instance
		{
			get
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject();
					_instance = val.AddComponent<CoroutineRunner>();
					Object.DontDestroyOnLoad((Object)(object)val);
				}
				return _instance;
			}
		}

		public Coroutine RunCoroutine(IEnumerator coroutine)
		{
			return ((MonoBehaviour)this).StartCoroutine(coroutine);
		}
	}
	[HarmonyPatch(typeof(SpawnMenu))]
	public class CubeMaker
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void CubePrefix(SpawnMenu __instance, ref SpawnableObjectsDatabase ___objects)
		{
			SpawnableObject[] sandboxTools = ___objects.sandboxTools;
			for (int i = 0; i < sandboxTools.Length; i++)
			{
				FraudTweaks.Logger.LogInfo((object)sandboxTools[i].objectName);
				if (sandboxTools[i].objectName == "Block Creator")
				{
					sandboxTools[i].sandboxOnly = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(SandboxUtils))]
	public class CubeInfo
	{
		[HarmonyPatch("CreateFinalBlock")]
		[HarmonyPostfix]
		public static void LogCube(SpawnMenu __instance, ref GameObject __result)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			BoxCollider component = __result.GetComponent<BoxCollider>();
			ManualLogSource logger = FraudTweaks.Logger;
			string[] obj = new string[5] { "Scale = ", null, null, null, null };
			Vector3 val = component.size;
			obj[1] = ((object)(Vector3)(ref val)).ToString();
			obj[2] = Environment.NewLine;
			obj[3] = "Center = ";
			val = component.center + __result.transform.position;
			obj[4] = ((object)(Vector3)(ref val)).ToString();
			logger.LogWarning((object)string.Concat(obj));
		}
	}
	[HarmonyPatch(typeof(StatsManager))]
	public class LevelFinder
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void Started(StatsManager __instance)
		{
			//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)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.levelNumber == 30)
			{
				Transform val = ((Component)((Component)GameObject.Find("Inside").transform.Find("9 - Archangel Hall")).transform.Find("9 Nonstuff")).transform.Find("TrapRoomTrigger");
				val.localScale += Vector3.right * 15f;
				ObjectActivator[] components = ((Component)val).GetComponents<ObjectActivator>();
				components[0].delay = 0.55f;
				components[1].delay = 0.55f;
				GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)0);
				val2.transform.localScale = Vector3.one * 3f;
				((Object)val2).name = "Sphere";
				Object.Instantiate<GameObject>(val2);
			}
		}
	}
	[HarmonyPatch(typeof(ItemPlaceZone))]
	public class PedestalFix
	{
		[HarmonyPatch("CheckItem")]
		[HarmonyPrefix]
		private static void RemoveItem(ItemPlaceZone __instance, ref AudioSource ___soundOnDeactivated)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0086: 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)
			ItemIdentifier componentInChildren = ((Component)__instance).GetComponentInChildren<ItemIdentifier>();
			if (!((Object)(object)componentInChildren == (Object)null) && ((Object)((Component)componentInChildren).transform).name.Contains("VendingMachine"))
			{
				AddForce component = ((Component)componentInChildren).GetComponent<AddForce>();
				Vector3 val = ((Component)__instance).transform.up * 2f;
				Vector3 val2 = new Vector3((float)Random.Range(-3, 3), 0f, (float)Random.Range(-3, 3));
				component.force = val + ((Vector3)(ref val2)).normalized * 1f;
				component.oneTime = false;
				component.relative = false;
				component.onEnable = true;
				((Behaviour)component).enabled = false;
				((Component)componentInChildren).transform.SetParent((Transform)null, true);
				((Component)componentInChildren).GetComponent<Rigidbody>().isKinematic = false;
				((Behaviour)component).enabled = true;
				((Component)componentInChildren).GetComponent<Rigidbody>().angularVelocity = component.force;
				Object.Instantiate<GameObject>(MonoSingleton<HookArm>.Instance.errorSound);
				MonoSingleton<CameraController>.Instance.CameraShake(0.5f);
				switch (new Random().Next(1, 6))
				{
				case 1:
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>That doesnt belong there!</color>", "", "", 0, true, false, true);
					break;
				case 2:
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Stop that!</color>", "", "", 0, true, false, true);
					break;
				case 3:
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>This is for your safety!</color>", "", "", 0, true, false, true);
					break;
				case 4:
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>You'll get softlocked!</color>", "", "", 0, true, false, true);
					break;
				case 5:
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>Quit doing that!</color>", "", "", 0, true, false, true);
					break;
				case 6:
					MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>That doesnt fit there!</color>", "", "", 0, true, false, true);
					break;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Drone))]
	public class ProvidenceFix
	{
		[HarmonyPatch("Explode")]
		[HarmonyPrefix]
		public static void GhostCheck(Drone __instance, ref EnemyIdentifier ___eid, ref GameObject ___ghost)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			if ((int)___eid.enemyType == 38)
			{
				___ghost = null;
			}
		}
	}
	[HarmonyPatch(typeof(EnemyIdentifier))]
	public class DeathcatcherKillFix
	{
		[HarmonyPatch("ProcessDeath")]
		[HarmonyPostfix]
		public static void FixDeath(EnemyIdentifier __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			Enemy val = default(Enemy);
			if (((int)__instance.enemyType == 39 || (int)__instance.enemyType == 21) && !((Component)__instance).TryGetComponent<Enemy>(ref val))
			{
				AccessTools.Method(typeof(EnemyIdentifier), "GetGoreZone", (Type[])null, (Type[])null).Invoke(__instance, null);
				if (Object.op_Implicit((Object)(object)__instance.gz.checkpoint))
				{
					__instance.gz.checkpoint.restartKills = __instance.gz.checkpoint.restartKills - 1;
				}
			}
		}
	}
	[HarmonyPatch(typeof(GunControl))]
	public class YesWeaponFix
	{
		[HarmonyPatch("YesWeapon")]
		[HarmonyPostfix]
		private static void YesWeaponUpdate(GunControl __instance)
		{
			if (!((Object)(object)__instance.currentWeapon == (Object)null))
			{
				__instance.ForceWeapon(__instance.currentWeapon, true);
			}
		}

		[HarmonyPatch("NoWeapon")]
		[HarmonyPostfix]
		private static void NoWeaponUpdate(GunControl __instance, ref Action<GameObject> ___OnWeaponChange)
		{
			___OnWeaponChange(__instance.currentWeapon);
		}
	}
	[HarmonyPatch(typeof(Explosion))]
	public class ExplosionFix
	{
		private static readonly LayerMask mask = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("Portal"));

		private static Collider[] LastBuffer = (Collider[])(object)new Collider[32];

		[HarmonyPatch("CheckPortalOverlaps")]
		[HarmonyPrefix]
		private static bool PortalChecker(Explosion __instance, ref float radius, ref PortalScene scene, ref Collider[] ___PortalOverlapBuffer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_008a: 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)
			//IL_0092: 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)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_010e: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0191: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)__instance).transform.position;
			Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(mask));
			if (array.Any() & (___PortalOverlapBuffer != LastBuffer))
			{
				LastBuffer = ___PortalOverlapBuffer;
				Collider[] array2 = array;
				PortalHandleSequence val2 = default(PortalHandleSequence);
				foreach (Collider val in array2)
				{
					PortalHandle handle = ((Component)val).GetComponent<PortalIdentifier>().Handle;
					PortalTransform transform = scene.GetPortalObject(handle).GetTransform(PortalSideExtensions.Reverse(handle.side));
					if (!PortalUtils.IsPointInFront(transform, position) || Vector3.Dot(transform.back, position - transform.center) >= radius)
					{
						continue;
					}
					((PortalHandleSequence)(ref val2))..ctor((PortalHandle[])(object)new PortalHandle[1] { handle });
					Matrix4x4 travelMatrix = scene.GetTravelMatrix(ref val2);
					Vector3 val3 = ((Matrix4x4)(ref travelMatrix)).MultiplyPoint3x4(position);
					int num = Physics.OverlapSphereNonAlloc(val3, radius, ___PortalOverlapBuffer, LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)4)));
					for (int j = 0; j < num; j++)
					{
						Collider val4 = ___PortalOverlapBuffer[j];
						Vector3 val5 = val4.ClosestPoint(val3);
						MethodInfo methodInfo = AccessTools.Method(typeof(Explosion), "PrecisePortalCheck", (Type[])null, (Type[])null);
						if ((bool)methodInfo.Invoke(__instance, new object[4] { scene, handle, position, val5 }))
						{
							MethodInfo methodInfo2 = AccessTools.Method(typeof(Explosion), "Collide", (Type[])null, (Type[])null);
							methodInfo2.Invoke(__instance, new object[2] { val4, val3 });
						}
					}
				}
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(MaliciousFace))]
	public class MaliciousFix
	{
		[HarmonyPatch("TriggerHit")]
		[HarmonyPrefix]
		private static bool FallCheck(MaliciousFace __instance, ref Collider other, ref bool ___spiderFalling)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			EnemyIdentifier component = ((Component)other).GetComponent<EnemyIdentifier>();
			if ((Object)(object)component != (Object)null && (___spiderFalling & ((int)component.enemyType == 39 || (int)component.enemyType == 21)))
			{
				Vector3 val = other.ClosestPoint(((Component)__instance).transform.position);
				RaycastHit[] array = Physics.RaycastAll(((Component)__instance).transform.position, val, Vector3.Distance(((Component)__instance).transform.position, val), LayerMask.op_Implicit(LayerMaskDefaults.Get((LMD)1)), (QueryTriggerInteraction)1);
				if (array.Length != 0)
				{
					return true;
				}
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(Shotgun))]
	public class SawFix
	{
		[CompilerGenerated]
		private sealed class <ShotgunRunner>d__0 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public object __instance;

			public float delay;

			private Type <shot>5__1;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ShotgunRunner>d__0(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<shot>5__1 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForSeconds(delay);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<shot>5__1 = __instance.GetType();
					AccessTools.Method(<shot>5__1, "ShootSaw", (Type[])null, (Type[])null).Invoke(__instance, new object[1] { false });
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[IteratorStateMachine(typeof(<ShotgunRunner>d__0))]
		public static IEnumerator ShotgunRunner(object __instance, float delay)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ShotgunRunner>d__0(0)
			{
				__instance = __instance,
				delay = delay
			};
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void SawCheckNormal(Shotgun __instance, ref bool ___gunReady, ref GunControl ___gc, ref bool ___charging, ref WeaponIdentifier ___wid)
		{
			if ((((((MonoSingleton<InputManager>.Instance.InputSource.Fire2.WasCanceledThisFrame || (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && !GameStateManager.Instance.PlayerInputLocked && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame)) && __instance.variation == 2) & ___gunReady) && ___gc.activated) & ___charging) && ___wid.delay != 0f)
			{
				CoroutineRunner.Instance.RunCoroutine(ShotgunRunner(__instance, ___wid.delay));
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunHammer))]
	public class SawFixHammer
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void SawCheckHammer(ShotgunHammer __instance, ref bool ___gunReady, ref GunControl ___gc, ref bool ___charging, ref WeaponIdentifier ___wid)
		{
			if ((((((MonoSingleton<InputManager>.Instance.InputSource.Fire2.WasCanceledThisFrame || (!MonoSingleton<InputManager>.Instance.PerformingCheatMenuCombo() && !GameStateManager.Instance.PlayerInputLocked && MonoSingleton<InputManager>.Instance.InputSource.Fire1.WasPerformedThisFrame)) && __instance.variation == 2) & ___gunReady) && ___gc.activated) & ___charging) && ___wid.delay != 0f)
			{
				CoroutineRunner.Instance.RunCoroutine(SawFix.ShotgunRunner(__instance, ___wid.delay));
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}