Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of HyperbolicSpeedScaling v1.2.0
HyperbolicSpeedScaling.dll
Decompiled 11 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; [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("HyperbolicSpeedScaling")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HyperbolicSpeedScaling")] [assembly: AssemblyTitle("HyperbolicSpeedScaling")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 HyperbolicSpeedScaling { [BepInPlugin("HIFU.HyperbolicSpeedScaling", "HyperbolicSpeedScaling", "1.0.0")] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.HyperbolicSpeedScaling"; public const string PluginAuthor = "HIFU"; public const string PluginName = "HyperbolicSpeedScaling"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<float> maxValue { get; set; } public void Awake() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown maxValue = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Speed Scaling", 40f, "This is the value that all speed increases will approach, but never reach. It is not the percentage value, but a total value in meters per second. Most survivors walk at 7m/s and sprint at 10.15m/s."); CharacterBody.RecalculateStats += new Manipulator(CharacterBody_RecalculateStats); } private void CharacterBody_RecalculateStats(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); int num = default(int); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "set_moveSpeed") })) { int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<float, float>>((Func<float, float>)delegate(float orig) { orig = Math.Min(orig, GetHyperbolic(orig, maxValue.Value, orig)); return orig; }); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to apply Hyperbolic Speed Increase hook"); } } private float GetHyperbolic(float firstStack, float cap, float chance) { if (firstStack >= cap) { return cap * (chance / firstStack); } float num = chance / firstStack; float num2 = 100f * firstStack / (cap - firstStack); return cap * (1f - 100f / (num * num2 + 100f)); } } }