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 SpeedLimiter v1.0.1
SpeedLimiter.dll
Decompiled 19 hours 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 BepInEx.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using SpeedLimiter.Changes; 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("SpeedLimiter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SpeedLimiter")] [assembly: AssemblyTitle("SpeedLimiter")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 SpeedLimiter { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("com.Bloonjitsu7.SpeedLimiter", "SpeedLimiter", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MainPlugin : BaseUnityPlugin { public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); Main main = new Main(); Config.SetupConfig(((BaseUnityPlugin)this).Config); main.Initialize(); } } } namespace SpeedLimiter.Changes { public static class Config { public static ConfigEntry<bool> moveSpeedEnable { get; set; } public static ConfigEntry<float> moveSpeedLimit { get; set; } public static ConfigEntry<bool> atkSpeedEnable { get; set; } public static ConfigEntry<float> atkSpeedLimit { get; set; } public static void SetupConfig(ConfigFile cfg) { moveSpeedEnable = RegisterConfigBool(cfg, "Move Speed Limiter", "Enable Limiter", defaultValue: true, "Enables the limit to movement speed."); moveSpeedLimit = RegisterConfigFloat(cfg, "Move Speed Limiter", "Speed Limit", 2f, "Changes the limit to movement speed (1 = base move speed).", 1f, 10f); atkSpeedEnable = RegisterConfigBool(cfg, "Attack Speed Limiter", "Enable Limiter", defaultValue: true, "Enables the limit to attack speed."); atkSpeedLimit = RegisterConfigFloat(cfg, "Attack Speed Limiter", "Speed Limit", 2f, "Changes the limit to attack speed (1 = base attack speed).", 1f, 10f); } public static ConfigEntry<bool> RegisterConfigBool(ConfigFile cfg, string section, string key, bool defaultValue, string description, bool restart = false) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown ConfigEntry<bool> val = cfg.Bind<bool>(section, key, defaultValue, description); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val, new CheckBoxConfig { restartRequired = restart })); return val; } public static ConfigEntry<float> RegisterConfigFloat(ConfigFile cfg, string section, string key, float defaultValue, string description, float minValue, float maxValue, bool percent = false, bool restart = false) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown ConfigEntry<float> val = cfg.Bind<float>(section, key, defaultValue, description); ModSettingsManager.AddOption((BaseOption)new SliderOption(val, new SliderConfig { min = minValue, max = maxValue, restartRequired = restart, FormatString = (percent ? "{0:0}%" : "{0}") })); return val; } } public class Main { public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown CharacterBody.RecalculateStats += new hook_RecalculateStats(OnRecalcStats); CharacterBody.RecalculateStats += new Manipulator(IL_RecalcStats); } private void OnRecalcStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (Config.atkSpeedEnable.Value && self.attackSpeed > Config.atkSpeedLimit.Value) { self.attackSpeed = Config.atkSpeedLimit.Value; } } public void IL_RecalcStats(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); MoveType val2 = (MoveType)2; int loc1 = -1; int num = -1; if (val.TryGotoNext(val2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(CharacterBody), "baseMoveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(CharacterBody), "levelMoveSpeed") })) { int num2 = default(int); if (val.TryGotoNext(val2, new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref loc1), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchDiv(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val.Index -= 5; val.Emit(OpCodes.Ldloc, loc1); val.EmitDelegate<Func<float, float>>((Func<float, float>)((float multiplier) => (Config.moveSpeedEnable.Value && multiplier > Config.moveSpeedLimit.Value) ? Config.moveSpeedLimit.Value : multiplier)); val.Emit(OpCodes.Stloc, loc1); } else { Log.Error(((MemberReference)il.Method).Name + " Hook 1.2 failed!"); } } else { Log.Error(((MemberReference)il.Method).Name + " Hook 1.1 failed!"); } } public static void DumpComponents(GameObject gameObject) { Component[] componentsInChildren = gameObject.GetComponentsInChildren(typeof(Component)); foreach (Component data in componentsInChildren) { Log.Message(data); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }