Please disclose if your mod was created primarily 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 AttackStaminaOverride v1.0.0
AttackStaminaOverride.dll
Decompiled 5 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AttackStaminaOverride")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AttackStaminaOverride")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("dca406e3-4408-4a32-ad08-c357d25f0dde")] [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")] namespace AttackStaminaOverride; [BepInPlugin("IDRdh7.attackstaminaoverride", "Attack Stamina Override", "1.0.0")] public class AttackStaminaOverride : BaseUnityPlugin { private static ConfigEntry<float> staminaMultiplier; private void Awake() { staminaMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MeleeStaminaMultiplier", 1f, "Multiplier for stamina used by melee attacks (1.0 = default)."); Harmony.CreateAndPatchAll(typeof(AttackStaminaOverride), (string)null); } [HarmonyPatch(typeof(Player), "UseStamina")] [HarmonyPrefix] private static void Prefix(Player __instance, ref float v) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 FieldInfo field = typeof(Humanoid).GetField("m_currentAttack", BindingFlags.Instance | BindingFlags.NonPublic); if (!(field == null)) { object? value = field.GetValue(__instance); Attack val = (Attack)((value is Attack) ? value : null); if (val != null && ((int)val.m_attackType == 0 || (int)val.m_attackType == 1 || (int)val.m_attackType == 4)) { v *= staminaMultiplier.Value; } } } }