Decompiled source of QuickPunches v1.0.0

QuickPunches.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Configgy;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("QuickPunches")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuickPunches")]
[assembly: AssemblyTitle("QuickPunches")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace QuickPunches
{
	[BepInPlugin("QuickPunches.mod.ultrakill", "Quick Punches", "1.0.0")]
	public class QuickPunches : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("Start")]
		public class PunchStartPatch
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Invalid comparison between Unknown and I4
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue() && (int)__instance.type == 0)
				{
					__instance.anim.speed = 1f + (float)((ConfigValueElement<int>)(object)punchSpeedMultiplier).GetValue() * 0.1f;
				}
			}
		}

		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("ActiveFrame")]
		public class PunchActiveFramePatch
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Invalid comparison between Unknown and I4
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue() && (int)__instance.type == 0)
				{
					__instance.anim.speed = 1f + (float)((ConfigValueElement<int>)(object)punchSpeedMultiplier).GetValue() * 0.1f;
				}
			}
		}

		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("PunchStart")]
		public class PunchStartSpeed
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Invalid comparison between Unknown and I4
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue() && (int)__instance.type == 0)
				{
					__instance.anim.speed = 1f + (float)((ConfigValueElement<int>)(object)punchSpeedMultiplier).GetValue() * 0.1f;
				}
			}
		}

		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("Parry")]
		public class ParrySpeed
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue())
				{
					__instance.anim.speed = 1f + (float)((ConfigValueElement<int>)(object)punchSpeedMultiplier).GetValue() * 0.1f;
				}
			}
		}

		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("PunchSuccess")]
		public class PunchSuccessSpeed
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue())
				{
					__instance.anim.speed = 1f + (float)((ConfigValueElement<int>)(object)punchSpeedMultiplier).GetValue() * 0.1f;
				}
			}
		}

		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("ActiveEnd")]
		public class PunchActiveEnd
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Invalid comparison between Unknown and I4
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue() && (int)__instance.type == 0)
				{
					__instance.anim.speed = 1f;
				}
			}
		}

		[HarmonyPatch(typeof(Punch))]
		[HarmonyPatch("OnDisable")]
		public class PunchOnDisable
		{
			[HarmonyPostfix]
			public static void Postfix(Punch __instance)
			{
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue())
				{
					__instance.anim.speed = 1f;
				}
			}
		}

		[HarmonyPatch(typeof(FistControl))]
		[HarmonyPatch("Update")]
		public class FistControlUpdatePatch
		{
			[HarmonyPostfix]
			public static void Postfix(FistControl __instance)
			{
				if (((ConfigValueElement<bool>)(object)modEnabled).GetValue())
				{
					float num = 1f - (float)((ConfigValueElement<int>)(object)cooldownReduction).GetValue() * 0.1f;
					__instance.fistCooldown *= num;
				}
			}
		}

		private ConfigBuilder config;

		[Configgable("General", "Enable Mod", 0, "Enables or disables the Quick Punches mod.")]
		private static ConfigToggle modEnabled = new ConfigToggle(false);

		[Configgable("Punch Speed", "Punch Speed Multiplier", 1, "Adjusts the punch speed. 0 is default, 10 is maximum speed (100% faster).")]
		private static ConfigSlider<int> punchSpeedMultiplier = (ConfigSlider<int>)new IntegerSlider(0, 0, 10);

		[Configgable("Cooldown", "Cooldown Reduction", 2, "Reduces the cooldown between punches. 0 is default, 10 is maximum reduction (100% faster).")]
		private static ConfigSlider<int> cooldownReduction = (ConfigSlider<int>)new IntegerSlider(0, 0, 10);

		private void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			config = new ConfigBuilder("QuickPunches.mod.ultrakill", "Quick Punches");
			config.BuildAll();
			Harmony val = new Harmony("QuickPunches.mod.ultrakill");
			val.PatchAll();
			Debug.Log((object)"QuickPunches mod loaded");
		}
	}
}