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 NoStageDifficultyScaling v1.0.1
NoStageDifficultyScaling.dll
Decompiled 5 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using RoR2; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoStageDifficultyScaling")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4afbb965565481ac57ad9465736fdb6500150f95")] [assembly: AssemblyProduct("NoStageDifficultyScaling")] [assembly: AssemblyTitle("NoStageDifficultyScaling")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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 ScalingExperiment { [BepInPlugin("com.Moffein.NoStageDifficultyScaling", "No Stage Difficulty Scaling", "1.0.1")] public class NoStageDifficultyScaling : BaseUnityPlugin { public static ConfigEntry<float> stageDurationBaseline; internal void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0030: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown stageDurationBaseline = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Settings", "Stage Clear Time"), 420f, new ConfigDescription("Expected time in seconds to clear a stage.", (AcceptableValueBase)null, Array.Empty<object>())); if (stageDurationBaseline.Value <= 0f) { Debug.LogError((object)"NoStageDifficultyScaling: Baseline stage clear timer must be greater than 0."); } else { Run.RecalculateDifficultyCoefficentInternal += new Manipulator(Run_RecalculateDifficultyCoefficentInternal); } } private static void Run_RecalculateDifficultyCoefficentInternal(ILContext il) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown bool flag = true; ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<Run>(x, "stageClearCount"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)GetTimeScaledStages); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<Run>(x, "stageClearCount"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)GetTimeScaledStages); flag = false; } } if (flag) { Debug.LogError((object)"ScalingExperiment: Run_RecalculateDifficultyCoefficentInternal IL hook failed."); } } public static float GetTimeScaledStages(float stages) { if (Object.op_Implicit((Object)(object)Run.instance)) { return Run.instance.GetRunStopwatch() / stageDurationBaseline.Value; } return stages; } } }