using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using PluginConfig.API;
using PluginConfig.API.Fields;
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
{
public static class Utils
{
public static bool CheatingFlag;
private static void CheatsHelper()
{
if (!CheatingFlag && !Plugin.FlagAsCheated.value)
{
if ((Object)(object)MonoSingleton<StatsManager>.Instance != (Object)null)
{
MonoSingleton<StatsManager>.Instance.majorUsed = true;
}
CheatingFlag = true;
}
}
public static void OverpumpHelper(int var, ref int pc, Component c, ref bool thirdPumpFlag)
{
if (var == 1 && pc >= 3)
{
if (thirdPumpFlag)
{
pc++;
CheatsHelper();
}
thirdPumpFlag = true;
AudioSource component = c.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
component.pitch = 1f + (float)(pc - 3) * 0.05f;
}
}
}
}
[BepInPlugin("com.sigtermd.ultrakill.infiniteoverpump", "Infinite Overpump", "1.3.0")]
public class Plugin : BaseUnityPlugin
{
private static readonly PluginConfigurator config = PluginConfigurator.Create("InfiniteOverpump", "infiniteoverpump");
public static FloatField ExplosionScale = null;
public static FloatField ShotMeterScale = null;
public static FloatField ShotSpinSpeed = null;
public static FloatField HammerMeterScale = null;
public static FloatField HammerSpinSpeed = null;
public static BoolField HammerSpin = null;
public static BoolField ShotSpin = null;
public static BoolField FlagAsCheated = null;
private void Awake()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Expected O, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Expected O, but got Unknown
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Expected O, but got Unknown
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Expected O, but got Unknown
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Expected O, but got Unknown
string iconWithURL = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "icon.png");
config.SetIconWithURL(iconWithURL);
BoolField val = new BoolField(config.rootPanel, "Enabled", "enabler", true);
ConfigDivision enabledDiv = new ConfigDivision(config.rootPanel, "enabledDiv");
ConfigDivision shotSpinDiv = new ConfigDivision((ConfigPanel)(object)enabledDiv, "shotSpinDiv");
ConfigDivision hammerSpinDiv = new ConfigDivision((ConfigPanel)(object)enabledDiv, "hammerSpinDiv");
ExplosionScale = new FloatField((ConfigPanel)(object)enabledDiv, "Over-Pump Explosion Scaling", "explosionScale", 0.75f);
ShotMeterScale = new FloatField((ConfigPanel)(object)enabledDiv, "Shotgun Meter Scaling", "shotMeterScale", 4f);
ShotSpinSpeed = new FloatField((ConfigPanel)(object)shotSpinDiv, "Shotgun Spin Speed", "shotSpinSpeed", 360f);
HammerMeterScale = new FloatField((ConfigPanel)(object)enabledDiv, "Hammer Meter Scaling", "hammerMeterScale", 1f);
HammerSpinSpeed = new FloatField((ConfigPanel)(object)hammerSpinDiv, "Hammer Spin Speed", "hammerSpinSpeed", 360f);
HammerSpin = new BoolField((ConfigPanel)(object)enabledDiv, "Hammer Meter Spin", "hammerMeterSpin", true);
ShotSpin = new BoolField((ConfigPanel)(object)enabledDiv, "Shotgun Spin", "shotSpin", false);
FlagAsCheated = new BoolField((ConfigPanel)(object)enabledDiv, "lil BITCH baby cheater mode >:P", "flagAsCheated", false);
Harmony harmony = new Harmony("com.sigtermd.ultrakill.infiniteoverpump");
if (val.value)
{
harmony.PatchAll();
}
val.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
((ConfigField)enabledDiv).interactable = e.value;
if (e.value)
{
harmony.UnpatchSelf();
harmony.PatchAll();
}
else
{
harmony.UnpatchSelf();
}
};
ShotSpin.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
((ConfigField)shotSpinDiv).interactable = e.value;
};
HammerSpin.onValueChange += (BoolValueChangeEventDelegate)delegate(BoolValueChangeEvent e)
{
((ConfigField)hammerSpinDiv).interactable = e.value;
};
((BaseUnityPlugin)this).Logger.LogInfo((object)"Infinite Overpump plugin loaded!");
}
}
[HarmonyPatch(typeof(Shotgun), "OnEnable")]
public class AwakePatch
{
[HarmonyPostfix]
[UsedImplicitly]
private static void Awake()
{
OverpumpPatch.ThirdPumpFlag = false;
}
}
[HarmonyPatch(typeof(ShotgunHammer), "OnEnable")]
public class AwakePatchHammer
{
[HarmonyPostfix]
[UsedImplicitly]
private static void Awake()
{
OverpumpPatchHammer.ThirdPumpFlag = false;
}
}
[HarmonyPatch(typeof(Shotgun), "Pump")]
public class OverpumpPatch
{
public static bool ThirdPumpFlag;
[HarmonyPostfix]
[UsedImplicitly]
private static void Pump(Shotgun __instance)
{
Utils.OverpumpHelper(__instance.variation, ref __instance.primaryCharge, (Component)(object)__instance, ref ThirdPumpFlag);
}
}
[HarmonyPatch(typeof(ShotgunHammer), "Pump")]
public class OverpumpPatchHammer
{
public static bool ThirdPumpFlag;
[HarmonyPostfix]
[UsedImplicitly]
private static void Pump(ShotgunHammer __instance)
{
Utils.OverpumpHelper(__instance.variation, ref __instance.primaryCharge, (Component)(object)__instance, ref ThirdPumpFlag);
}
}
[HarmonyPatch(typeof(Shotgun), "UpdateMeter")]
public class MeterPatch
{
private static float _currentSpinAngle = 180f;
private static Quaternion _defaultRotation = Quaternion.identity;
private static float _meterScaling = 40f;
private static float _defaultWidth = -1f;
private static float _defaultMaxValue = -1f;
[HarmonyPrefix]
[UsedImplicitly]
private static bool UpdateMeter(Shotgun __instance, ref float ___timeToBeep, ref Slider ___chargeSlider)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_0099: 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_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = ((Component)___chargeSlider).GetComponent<RectTransform>();
if (_defaultWidth < 0f)
{
_defaultWidth = component.sizeDelta.x;
_defaultMaxValue = ___chargeSlider.maxValue;
_defaultRotation = ((Transform)component).localRotation;
}
if (__instance.variation != 1 || __instance.primaryCharge <= 3)
{
component.sizeDelta = new Vector2(_defaultWidth, component.sizeDelta.y);
___chargeSlider.maxValue = _defaultMaxValue;
((Transform)component).localRotation = _defaultRotation;
_currentSpinAngle = ((Quaternion)(ref _defaultRotation)).eulerAngles.z;
return true;
}
_meterScaling = Plugin.ShotMeterScale.value * 10f;
___chargeSlider.maxValue = (float)__instance.primaryCharge * _meterScaling;
component.sizeDelta = new Vector2(_defaultWidth + (float)(__instance.primaryCharge - 3) * _meterScaling, component.sizeDelta.y);
if (Plugin.ShotSpin.value)
{
_currentSpinAngle = (_currentSpinAngle + Time.deltaTime * Plugin.ShotSpinSpeed.value) % 360f;
((Transform)component).localRotation = Quaternion.Euler(((Quaternion)(ref _defaultRotation)).eulerAngles.x, ((Quaternion)(ref _defaultRotation)).eulerAngles.y, _currentSpinAngle);
}
if (___timeToBeep != 0f)
{
___timeToBeep = Mathf.MoveTowards(___timeToBeep, 0f, Time.deltaTime * 5f);
}
___chargeSlider.value = ___chargeSlider.maxValue;
if (___timeToBeep == 0f)
{
___timeToBeep = 1f;
GameObject val = Object.Instantiate<GameObject>(__instance.warningBeep);
AudioSource component2 = val.GetComponent<AudioSource>();
if ((Object)(object)component2 != (Object)null)
{
component2.pitch = 1f + (float)(__instance.primaryCharge - 3) * 0.05f;
}
((Graphic)__instance.sliderFill).color = Color.red;
}
else if (___timeToBeep < 0.5f)
{
((Graphic)__instance.sliderFill).color = Color.black;
}
return false;
}
}
[HarmonyPatch(typeof(ShotgunHammer), "UpdateMeter")]
public class MeterPatchHammer
{
private static float _currentSpinAngle = 270f;
private static Vector3 _defaultScale = Vector3.zero;
private static Quaternion _defaultRotation = Quaternion.identity;
[HarmonyPostfix]
[UsedImplicitly]
private static void UpdateMeter(ShotgunHammer __instance, ref float ___timeToBeep, ref Image ___secondaryMeter)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
Image val = ___secondaryMeter;
if ((Object)(object)val == (Object)null)
{
return;
}
RectTransform rectTransform = ((Graphic)val).rectTransform;
if (_defaultScale == Vector3.zero)
{
_defaultScale = ((Transform)rectTransform).localScale;
_defaultRotation = ((Transform)rectTransform).localRotation;
}
if (__instance.variation != 1 || __instance.primaryCharge <= 3)
{
((Transform)rectTransform).localScale = _defaultScale;
((Transform)rectTransform).localRotation = _defaultRotation;
_currentSpinAngle = 270f;
return;
}
int primaryCharge = __instance.primaryCharge;
((Transform)rectTransform).localScale = new Vector3(1f, (float)primaryCharge * Plugin.HammerMeterScale.value, 1f);
if (Plugin.HammerSpin.value)
{
_currentSpinAngle = (_currentSpinAngle + Time.deltaTime * Plugin.HammerSpinSpeed.value) % 360f;
((Transform)rectTransform).localRotation = Quaternion.Euler(((Quaternion)(ref _defaultRotation)).eulerAngles.x, ((Quaternion)(ref _defaultRotation)).eulerAngles.y, _currentSpinAngle);
}
else
{
((Transform)rectTransform).localRotation = Quaternion.Euler(((Quaternion)(ref _defaultRotation)).eulerAngles.x, ((Quaternion)(ref _defaultRotation)).eulerAngles.y, ((Quaternion)(ref _defaultRotation)).eulerAngles.z);
}
if (___timeToBeep == 0f)
{
___timeToBeep = 1f;
GameObject val2 = Object.Instantiate<GameObject>(__instance.warningBeep);
AudioSource component = val2.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null)
{
component.pitch = 1f + (float)(__instance.primaryCharge - 3) * 0.05f;
}
((Graphic)val).color = Color.red;
}
else if (___timeToBeep < 0.5f)
{
((Graphic)val).color = Color.black;
}
}
}
[HarmonyPatch(typeof(Shotgun), "Shoot")]
public class ShootPatch
{
public static int SavedCharge;
[HarmonyPrefix]
[UsedImplicitly]
private static void Shoot(Shotgun __instance)
{
if (__instance.variation == 1 && __instance.primaryCharge >= 3)
{
SavedCharge = __instance.primaryCharge;
__instance.primaryCharge = 3;
OverpumpPatch.ThirdPumpFlag = false;
}
}
}
[HarmonyPatch(typeof(ShotgunHammer), "Impact")]
public class ShootPatchHammer
{
[HarmonyPrefix]
[UsedImplicitly]
private static void Impact(ShotgunHammer __instance)
{
if (__instance.variation == 1 && __instance.primaryCharge >= 3)
{
ShootPatch.SavedCharge = __instance.primaryCharge;
__instance.primaryCharge = 3;
OverpumpPatchHammer.ThirdPumpFlag = false;
}
}
}
[HarmonyPatch(typeof(Explosion), "Start")]
public class ExplosionPatch
{
[HarmonyPrefix]
[UsedImplicitly]
private static void Start(Explosion __instance)
{
if (ShootPatch.SavedCharge > 3)
{
int savedCharge = ShootPatch.SavedCharge;
ShootPatch.SavedCharge = 0;
float num = 1f + (float)(savedCharge - 3) * Plugin.ExplosionScale.value;
__instance.maxSize *= num;
__instance.speed *= num;
__instance.damage = Mathf.RoundToInt((float)__instance.damage * num);
__instance.playerDamageOverride = 50;
if (savedCharge >= 6)
{
__instance.unblockable = true;
}
}
}
}
[HarmonyPatch(typeof(StatsManager), "Awake")]
public class StatsManagerPatch
{
[HarmonyPostfix]
[UsedImplicitly]
private static void ResetOnLevelLoad()
{
OverpumpPatch.ThirdPumpFlag = false;
OverpumpPatchHammer.ThirdPumpFlag = false;
Utils.CheatingFlag = false;
}
}
}