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 OverchargeScalesToStrength v1.0.0
ScaleOverchargeToUpgrades.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; [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("ScaleOverchargeToUpgrades")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+62ef3fe1b6269d77e304d35d3fc566da88e1c904")] [assembly: AssemblyProduct("ScaleOverchargeToUpgrades")] [assembly: AssemblyTitle("ScaleOverchargeToUpgrades")] [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.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; } } [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 Necrofancy.Repo.ScaleOverchargeToUpgrades { [BepInPlugin("Necrofancy.OverchargeScalesToStrength", "Overcharge Scales To Strength", "1.0.0")] public class Plugin : BaseUnityPlugin { private const string Id = "Necrofancy.OverchargeScalesToStrength"; private const string Name = "Overcharge Scales To Strength"; private const string Version = "1.0.0"; private readonly Harmony _harmony = new Harmony("Necrofancy.OverchargeScalesToStrength"); private static ConfigEntry<float>? _constantConfig; private static ConfigEntry<float>? _scalingConfig; public static float ConstantFactor => _constantConfig?.Value ?? 0.05f; public static float ScalingFactor => _scalingConfig?.Value ?? 0.15f; public void Awake() { _harmony.PatchAll(Assembly.GetExecutingAssembly()); _constantConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Balancing", "ConstantFactor", 0.05f, "Defines starting percentage for overcharge"); _scalingConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Balancing", "ScalingFactor", 0.15f, "Defines the growth per Strength upgrade applied"); } } [HarmonyPatch(typeof(PhysGrabber), "PhysGrabOverCharge")] public static class ScaleOverchargeGain { private static void Prefix(PhysGrabber __instance, ref float _amount, ref float _multiplier) { string key = SemiFunc.PlayerGetSteamID(__instance.playerAvatar); Dictionary<string, int> playerUpgradeStrength = StatsManager.instance.playerUpgradeStrength; if (playerUpgradeStrength.TryGetValue(key, out var value)) { _amount *= Math.Max(Plugin.ConstantFactor + Plugin.ScalingFactor * (float)value, 0f); } } } }