using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PluginConfig.API; using PluginConfig.API.Fields; 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.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("PiercerWallbang")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PiercerWallbang")] [assembly: AssemblyTitle("PiercerWallbang")] [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 PiercerWallbang { [BepInPlugin("DestinedSnow.CoinPiercerwallbangConfig", "CoinPiercer Wallbang", "1.0.0")] [BepInProcess("ULTRAKILL.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static BoolValueChangeEventDelegate <>9__10_0; public static BoolValueChangeEventDelegate <>9__10_1; internal void b__10_0(BoolValueChangeEvent data) { CoinWallbang.Value = data.value; } internal void b__10_1(BoolValueChangeEvent data) { DirectWallbang.Value = data.value; } } public const string ModGuid = "DestinedSnow.CoinPiercerwallbangConfig"; public const string ModName = "CoinPiercer Wallbang"; public const string ModVersion = "1.0.0"; internal static ManualLogSource Log; public static PluginConfigurator PluginConfigInstance; public static BoolField CoinWallbangField; public static BoolField DirectWallbangField; internal static ConfigEntry CoinWallbang; internal static ConfigEntry DirectWallbang; private Harmony harmony; private void Awake() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; CoinWallbang = ((BaseUnityPlugin)this).Config.Bind("General", "CoinWallbang", true, (ConfigDescription)null); DirectWallbang = ((BaseUnityPlugin)this).Config.Bind("General", "DirectWallbang", true, (ConfigDescription)null); harmony = new Harmony("DestinedSnow.CoinPiercerwallbangConfig"); harmony.PatchAll(); PluginConfigInstance = PluginConfigurator.Create("Coin Piercer Wallbang", "Coin Piercer Wallbang Config"); string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string iconWithURL = "file:///" + Path.Combine(directoryName, "icon.png").Replace("\\", "/"); PluginConfigInstance.SetIconWithURL(iconWithURL); CoinWallbangField = new BoolField(PluginConfigInstance.rootPanel, "Coin Wallbang", "coin_wallbang", CoinWallbang.Value); BoolField coinWallbangField = CoinWallbangField; object obj = <>c.<>9__10_0; if (obj == null) { BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent data) { CoinWallbang.Value = data.value; }; <>c.<>9__10_0 = val; obj = (object)val; } coinWallbangField.onValueChange += (BoolValueChangeEventDelegate)obj; DirectWallbangField = new BoolField(PluginConfigInstance.rootPanel, "Direct Piercer Wallbang", "direct_wallbang", DirectWallbang.Value); BoolField directWallbangField = DirectWallbangField; object obj2 = <>c.<>9__10_1; if (obj2 == null) { BoolValueChangeEventDelegate val2 = delegate(BoolValueChangeEvent data) { DirectWallbang.Value = data.value; }; <>c.<>9__10_1 = val2; obj2 = (object)val2; } directWallbangField.onValueChange += (BoolValueChangeEventDelegate)obj2; Log.LogInfo((object)"CoinPiercer Wallbang 1.0.0 loaded."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } internal static bool IsChargedPiercer(RevolverBeam beam) { if ((Object)(object)beam == (Object)null) { return false; } if (beam.gunVariation != 0) { return false; } int num = (beam.strongAlt ? 6 : 3); return beam.hitAmount >= num; } } [HarmonyPatch(typeof(Coin), "CheckEnemyObstruction")] internal static class CoinCheckEnemyObstructionPatch { private static bool Prefix(Coin __instance, ref bool __result) { if (!Plugin.CoinWallbang.Value) { return true; } try { GameObject value = Traverse.Create((object)__instance).Field("altBeam").GetValue(); if ((Object)(object)value == (Object)null) { return true; } RevolverBeam component = value.GetComponent(); if ((Object)(object)component == (Object)null) { return true; } if (!Plugin.IsChargedPiercer(component)) { return true; } __result = true; return false; } catch (Exception arg) { Plugin.Log.LogWarning((object)$"CoinCheckEnemyObstructionPatch error: {arg}"); return true; } } } [HarmonyPatch(typeof(RevolverBeam), "Shoot")] internal static class BeamDistancePatch { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable instructions; public IEnumerable <>3__instructions; private FieldInfo 5__1; private MethodInfo 5__2; private IEnumerator <>s__3; private CodeInstruction 5__4; CodeInstruction IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 2u) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>s__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = AccessTools.Field(typeof(PhysicsCastResult), "distance"); 5__2 = AccessTools.Method(typeof(BeamDistancePatch), "ModifyDistance", (Type[])null, (Type[])null); <>s__3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; if (5__4.opcode == OpCodes.Ldfld && object.Equals(5__4.operand, 5__1)) { <>2__current = new CodeInstruction(OpCodes.Ldarg_0, (object)null); <>1__state = 2; return true; } goto IL_014b; case 2: <>1__state = -3; <>2__current = new CodeInstruction(OpCodes.Call, (object)5__2); <>1__state = 3; return true; case 3: { <>1__state = -3; goto IL_014b; } IL_014b: 5__4 = null; break; } if (<>s__3.MoveNext()) { 5__4 = <>s__3.Current; <>2__current = 5__4; <>1__state = 1; return true; } <>m__Finally1(); <>s__3 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__3 != null) { <>s__3.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1(0); } d__.instructions = <>3__instructions; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } private static float ModifyDistance(float distance, RevolverBeam beam) { if (!Plugin.DirectWallbang.Value) { return distance; } if (Plugin.IsChargedPiercer(beam)) { return 1000f; } return distance; } [IteratorStateMachine(typeof(d__1))] private static IEnumerable Transpiler(IEnumerable instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>3__instructions = instructions }; } } }