Decompiled source of InfiniteOverpump v1.0.0

InfiniteOverPump.dll

Decompiled 3 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[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: AssemblyCompany("InfiniteOverPump")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InfiniteOverPump")]
[assembly: AssemblyTitle("InfiniteOverPump")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
}
namespace InfiniteOverPump
{
	[BepInPlugin("com.sigtermd.ultrakill.infiniteoverpump", "Infinite Overpump", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.sigtermd.ultrakill.infiniteoverpump");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Infinite Overpump plugin loaded!");
		}
	}
	[HarmonyPatch(typeof(Shotgun), "Pump")]
	public class OverpumpPatch
	{
		public static bool Flag;

		[HarmonyPostfix]
		private static void Pump(Shotgun __instance)
		{
			if (__instance.variation == 1 && __instance.primaryCharge >= 3)
			{
				if (Flag)
				{
					__instance.primaryCharge++;
				}
				Flag = true;
				AudioSource component = ((Component)__instance).GetComponent<AudioSource>();
				if ((Object)(object)component != (Object)null)
				{
					component.pitch = 1f + (float)(__instance.primaryCharge - 3) * 0.05f;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Shotgun), "UpdateMeter")]
	public class MeterPatch
	{
		private static float DefaultWidth = -1f;

		private static float DefaultMaxValue = -1f;

		private static readonly FieldInfo SliderField = AccessTools.Field(typeof(Shotgun), "chargeSlider");

		private static readonly FieldInfo TimeToBeepField = AccessTools.Field(typeof(Shotgun), "timeToBeep");

		[HarmonyPrefix]
		private static bool UpdateMeter(Shotgun __instance)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_002b: 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_00d4: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			Slider val = (Slider)SliderField.GetValue(__instance);
			RectTransform component = ((Component)val).GetComponent<RectTransform>();
			if (DefaultWidth < 0f)
			{
				DefaultWidth = component.sizeDelta.x;
				DefaultMaxValue = val.maxValue;
			}
			if (__instance.variation != 1 || __instance.primaryCharge < 3)
			{
				component.sizeDelta = new Vector2(DefaultWidth, component.sizeDelta.y);
				val.maxValue = DefaultMaxValue;
				return true;
			}
			__instance.sliderFill.type = (Type)2;
			val.maxValue = (float)__instance.primaryCharge * 40f;
			component.sizeDelta = new Vector2(DefaultWidth + (float)(__instance.primaryCharge - 3) * 40f, component.sizeDelta.y);
			float num = (float)TimeToBeepField.GetValue(__instance);
			if (num != 0f)
			{
				num = Mathf.MoveTowards(num, 0f, Time.deltaTime * 5f);
			}
			val.value = val.maxValue;
			if (num == 0f)
			{
				num = 1f;
				Object.Instantiate<GameObject>(__instance.warningBeep);
				((Graphic)__instance.sliderFill).color = Color.red;
			}
			else
			{
				if (num >= 0.5f)
				{
					TimeToBeepField.SetValue(__instance, num);
					return false;
				}
				((Graphic)__instance.sliderFill).color = Color.black;
			}
			TimeToBeepField.SetValue(__instance, num);
			return false;
		}
	}
	[HarmonyPatch(typeof(Shotgun), "Shoot")]
	public class ShootPatch
	{
		public static int SavedCharge;

		[HarmonyPrefix]
		private static void Shoot(Shotgun __instance)
		{
			if (__instance.variation == 1 && __instance.primaryCharge >= 3)
			{
				SavedCharge = __instance.primaryCharge;
				__instance.primaryCharge = 3;
				OverpumpPatch.Flag = false;
			}
		}
	}
	[HarmonyPatch(typeof(Explosion), "Start")]
	public class ExplosionPatch
	{
		[HarmonyPrefix]
		private static void Start(Explosion __instance)
		{
			if (ShootPatch.SavedCharge >= 3)
			{
				int savedCharge = ShootPatch.SavedCharge;
				ShootPatch.SavedCharge = 0;
				float num = 1f + (float)(savedCharge - 3) * 0.75f;
				__instance.maxSize *= num;
				__instance.speed *= num;
				__instance.damage = Mathf.RoundToInt((float)__instance.damage * num);
				__instance.playerDamageOverride = 50;
			}
		}
	}
}