Decompiled source of FraudTweaks v1.1.0

FraudTweaks.dll

Decompiled 14 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Enemy;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("FraudTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6f2602dc647d2f72156061e069aab45bd0518fda")]
[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 float RocketDelay = 0f;

		public static Dictionary<RevolverBeam, Vision> HitPointVisions = new Dictionary<RevolverBeam, Vision>();

		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!");
		}

		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.Patches
{
	[HarmonyPatch(typeof(Grenade))]
	public class Rocket
	{
		[HarmonyPatch("PlayerRideStart")]
		[HarmonyPostfix]
		private static void RideOn(Grenade __instance, ref GameObject ___interruptSphere)
		{
			if ((Object)(object)___interruptSphere != (Object)null)
			{
				___interruptSphere.SetActive(true);
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunHammer))]
	public class JackhammerRocket
	{
		[HarmonyPatch("ImpactRoutine")]
		[HarmonyPrefix]
		private static void RocketPuncher(ShotgunHammer __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			Vector3 defaultPos = MonoSingleton<CameraController>.Instance.GetDefaultPos();
			Collider[] array = Physics.OverlapSphere(defaultPos, 0.01f);
			if (array.Length == 0)
			{
				return;
			}
			ParryHelper val2 = default(ParryHelper);
			for (int i = 0; i < array.Length; i++)
			{
				Transform val = ((Component)array[i]).transform;
				if (((Component)val).TryGetComponent<ParryHelper>(ref val2))
				{
					val = val2.target;
				}
				if (MonoSingleton<ObjectTracker>.Instance.grenadeList.Count <= 0 || ((Component)val).gameObject.layer != 10)
				{
					continue;
				}
				Grenade componentInParent = ((Component)val).GetComponentInParent<Grenade>();
				if (!(Object.op_Implicit((Object)(object)componentInParent) & componentInParent.rocket))
				{
					continue;
				}
				if (FraudTweaks.RocketDelay > 4f)
				{
					object? value = AccessTools.Field(typeof(Grenade), "interruptSphere").GetValue(componentInParent);
					GameObject val3 = (GameObject)((value is GameObject) ? value : null);
					val3.SetActive(false);
					continue;
				}
				object? value2 = AccessTools.Field(typeof(Grenade), "interruptSphere").GetValue(componentInParent);
				GameObject val4 = (GameObject)((value2 is GameObject) ? value2 : null);
				val4.SetActive(true);
				FraudTweaks.RocketDelay += 1f;
				if (componentInParent.levelledUp)
				{
					FraudTweaks.RocketDelay += 0.5f;
				}
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void DelayFallOff(ShotgunHammer __instance)
		{
			FraudTweaks.RocketDelay = Mathf.Clamp(FraudTweaks.RocketDelay - Time.deltaTime, 0f, 5f);
		}
	}
	[HarmonyPatch(typeof(RevolverBeam))]
	public class Revolver
	{
		[HarmonyPatch("PiercingShotOrder")]
		[HarmonyPrefix]
		private static void RevolverPierce(RevolverBeam __instance, ref PhysicsCastResult rayHit, ref bool ___splitcoinable, ref LayerMask ___enemyLayerMask)
		{
			//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_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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: 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)
			bool flag = false;
			if (!__instance.strongAlt & ((Object)__instance).name.Contains("Revolver Beam Super"))
			{
				___splitcoinable = false;
				flag = true;
			}
			if (!(flag | ___splitcoinable))
			{
				return;
			}
			Vector3 position = ((Component)((Component)__instance).transform).transform.position;
			Vector3 forward = ((Component)((Component)__instance).transform).transform.forward;
			float num = 1000f;
			PhysicsCastResult val = default(PhysicsCastResult);
			PortalTraversalV2[] array = default(PortalTraversalV2[]);
			Vector3 val2 = default(Vector3);
			Coin val3 = default(Coin);
			if (PortalPhysicsV2.Raycast(position, forward, num, LayerMask.op_Implicit(___enemyLayerMask), ref val, ref array, ref val2, (QueryTriggerInteraction)0) && ((Component)val.transform).gameObject.TryGetComponent<Coin>(ref val3))
			{
				object? value = AccessTools.Field(typeof(Coin), "vision").GetValue(val3);
				Vision val4 = (Vision)((value is Vision) ? value : null);
				object? value2 = AccessTools.Field(typeof(Coin), "enemyQuery").GetValue(val3);
				VisionQuery val5 = (VisionQuery)((value2 is VisionQuery) ? value2 : null);
				object? value3 = AccessTools.Field(typeof(Coin), "coinQuery").GetValue(val3);
				VisionQuery val6 = (VisionQuery)((value3 is VisionQuery) ? value3 : null);
				val4.UpdateSourcePos(((Component)val3).transform.position);
				TargetDataRef val7 = default(TargetDataRef);
				bool flag2 = val4.TrySee(val5, ref val7);
				TargetDataRef val8 = default(TargetDataRef);
				bool flag3 = val4.TrySee(val6, ref val8);
				Coin val9 = default(Coin);
				if (flag3 && val8.target.GameObject.TryGetComponent<Coin>(ref val9) && (Object)(object)val9.ccc != (Object)null && val9.ccc.beenHit.Contains(((Component)val9).gameObject))
				{
					___splitcoinable = true;
				}
				if (flag2 && !flag3)
				{
					___splitcoinable = true;
				}
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}