Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NoDefenceValues v1.0.3
NoDefenceValues.dll
Decompiled 4 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NoDefenceValues")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NoDefenceValues")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("44b0fc72-ce55-41c8-9ad5-1c1ea82b8074")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.EylonShachmon.NoDefenceValues", "NoDefenceValues", "1.0.3")] public class NoDefenceValues : BaseUnityPlugin { [CompilerGenerated] private sealed class <TranspilerDoubleJump>d__3 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator { private int <>1__state; private CodeInstruction <>2__current; private int <>l__initialThreadId; private IEnumerable<CodeInstruction> instructions; public IEnumerable<CodeInstruction> <>3__instructions; private bool <injectedAlready>5__1; private bool <worked>5__2; private IEnumerator<CodeInstruction> <>s__3; private CodeInstruction <instr>5__4; private MethodInfo <mi>5__5; CodeInstruction IEnumerator<CodeInstruction>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TranspilerDoubleJump>d__3(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) <= 3u) { try { } finally { <>m__Finally1(); } } <>s__3 = null; <instr>5__4 = null; <mi>5__5 = 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_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <injectedAlready>5__1 = false; <worked>5__2 = true; <>s__3 = instructions.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; <>2__current = new CodeInstruction(OpCodes.Pop, (object)null); <>1__state = 2; return true; case 2: <>1__state = -3; <>2__current = new CodeInstruction(OpCodes.Ldc_R4, (object)1f); <>1__state = 3; return true; case 3: <>1__state = -3; <injectedAlready>5__1 = true; break; case 4: <>1__state = -3; <mi>5__5 = null; <instr>5__4 = null; break; } if (<>s__3.MoveNext()) { <instr>5__4 = <>s__3.Current; if (<instr>5__4.opcode == OpCodes.Callvirt) { object operand = <instr>5__4.operand; <mi>5__5 = operand as MethodInfo; if ((object)<mi>5__5 != null && <mi>5__5 == GetMultFromLevelMethod) { if (!<injectedAlready>5__1) { <>2__current = new CodeInstruction(OpCodes.Pop, (object)null); <>1__state = 1; return true; } <worked>5__2 = false; Debug.LogError((object)"No-Defence-Values buildtime error: Trying to turn off damage scaling call in 2 places"); } } <>2__current = <instr>5__4; <>1__state = 4; return true; } <>m__Finally1(); <>s__3 = null; if (!<injectedAlready>5__1) { Debug.LogError((object)"No-Defence-Values buildtime error: Call for getting damage scaling has not been found"); } else if (<worked>5__2) { Debug.Log((object)"No-Defence-Values: Damage scaling has been successfully removed"); } 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<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator() { <TranspilerDoubleJump>d__3 <TranspilerDoubleJump>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <TranspilerDoubleJump>d__ = this; } else { <TranspilerDoubleJump>d__ = new <TranspilerDoubleJump>d__3(0); } <TranspilerDoubleJump>d__.instructions = <>3__instructions; return <TranspilerDoubleJump>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<CodeInstruction>)this).GetEnumerator(); } } private static readonly Type nestedType = typeof(HealthManager).GetNestedType("DamageScalingConfig", BindingFlags.NonPublic); private static readonly MethodInfo GetMultFromLevelMethod = AccessTools.Method(nestedType, "GetMultFromLevel", (Type[])null, (Type[])null); private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin loaded and initialized"); Harmony.CreateAndPatchAll(typeof(NoDefenceValues), (string)null); } [IteratorStateMachine(typeof(<TranspilerDoubleJump>d__3))] [HarmonyTranspiler] [HarmonyPatch(typeof(HealthManager), "ApplyDamageScaling")] private static IEnumerable<CodeInstruction> TranspilerDoubleJump(IEnumerable<CodeInstruction> instructions) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TranspilerDoubleJump>d__3(-2) { <>3__instructions = instructions }; } }