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("MoreRicoshots")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreRicoshots")]
[assembly: AssemblyTitle("MoreRicoshots")]
[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 MoreRicoshots
{
[BepInPlugin("MoreRicoshots.adry.ultrakill", "MoreRicoshots", "1.0.4")]
public class MoreRicoshots : BaseUnityPlugin
{
[HarmonyPatch(typeof(Coin), "DelayedReflectRevolver")]
public class DelayedReflectRevolverPatch
{
[HarmonyPrefix]
private static void Prefix(Coin __instance)
{
if (((ConfigValueElement<bool>)(object)modEnabled).GetValue() && !isProcessing)
{
__instance.hitTimes = ((ConfigValueElement<int>)(object)ricochetAmount).GetValue();
if (((ConfigValueElement<bool>)(object)instantRicochet).GetValue())
{
isProcessing = true;
((MonoBehaviour)__instance).CancelInvoke("ReflectRevolver");
__instance.ReflectRevolver();
isProcessing = false;
}
}
}
}
[HarmonyPatch(typeof(Coin), "ReflectRevolver")]
public class ReflectRevolverPatch
{
[HarmonyPatch(typeof(MonoBehaviour), "Invoke")]
public class InvokePatch
{
[HarmonyPrefix]
private static bool Prefix(MonoBehaviour __instance, string methodName, float time)
{
if (!((ConfigValueElement<bool>)(object)modEnabled).GetValue() || !((ConfigValueElement<bool>)(object)instantRicochet).GetValue() || isProcessing)
{
return true;
}
if (__instance is Coin && methodName == "ReflectRevolver")
{
isProcessing = true;
((Component)__instance).SendMessage(methodName);
isProcessing = false;
return false;
}
return true;
}
}
[HarmonyPrefix]
private static void Prefix(Coin __instance)
{
if (((ConfigValueElement<bool>)(object)modEnabled).GetValue() && ((ConfigValueElement<bool>)(object)singleTargetMode).GetValue())
{
__instance.ccc = null;
}
}
}
private ConfigBuilder config;
private static bool isProcessing = false;
[Configgable("General", "Enable Mod", 0, "Enables or disables the MoreRicoshots mod.")]
private static ConfigToggle modEnabled = new ConfigToggle(true);
[Configgable("Ricoshot", "Ricochet Amount", 1, "Number of ricochets (1-100, default: 3)")]
private static ConfigSlider<int> ricochetAmount = (ConfigSlider<int>)new IntegerSlider(3, 1, 100);
[Configgable("Ricoshot", "Single Target Mode", 2, "Allows multiple ricochets to hit the same enemy")]
private static ConfigToggle singleTargetMode = new ConfigToggle(false);
[Configgable("Ricoshot", "Instant Ricochet", 3, "Makes ricochets happen almost instantly")]
private static ConfigToggle instantRicochet = new ConfigToggle(false);
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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
config = new ConfigBuilder("MoreRicoshots.adry.ultrakill", "MoreRicoshots");
config.BuildAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreRicoshots is loaded!");
Harmony val = new Harmony("MoreRicoshots.adry.ultrakill");
val.PatchAll();
}
}
}