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 EnhancedStaminaUpgrade v1.0.0
EnhancedStaminaUpgrade.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; 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(".NETFramework,Version=v4.6", FrameworkDisplayName = "")] [assembly: AssemblyCompany("EnhancedStaminaUpgrade")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("My first plugin")] [assembly: AssemblyTitle("EnhancedStaminaUpgrade")] [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 EnhancedStaminaUpgrade { [BepInPlugin("traktool.enhancedstaminaupgrade", "Enhanced Stamina Upgrade", "1.0.0")] public class EnhancedStaminaUpgrade : BaseUnityPlugin { public const string PluginGUID = "traktool.enhancedstaminaupgrade"; public const string PluginName = "Enhanced Stamina Upgrade"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Logger; private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin traktool.enhancedstaminaupgrade is loaded!"); Harmony val = new Harmony("traktool.enhancedstaminaupgrade"); val.PatchAll(); LogAllPatches(); } private void LogAllPatches() { List<MethodBase> list = Harmony.GetAllPatchedMethods().ToList(); if (!list.Any()) { Logger.LogDebug((object)"No patch found."); return; } foreach (MethodBase item in list) { Patches patchInfo = Harmony.GetPatchInfo(item); if (patchInfo == null) { continue; } List<Patch> list2 = patchInfo.Prefixes.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList(); List<Patch> list3 = patchInfo.Postfixes.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList(); List<Patch> list4 = patchInfo.Transpilers.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList(); List<Patch> list5 = patchInfo.Finalizers.Where((Patch p) => p.owner == "traktool.enhancedstaminaupgrade").ToList(); if (list2.Count == 0 && list3.Count == 0 && list4.Count == 0 && list5.Count == 0) { continue; } string text = item.DeclaringType?.FullName + ":" + item.Name; Logger.LogDebug((object)("Patched method traktool.enhancedstaminaupgrade : " + text)); foreach (Patch item2 in list2) { Logger.LogDebug((object)(" -> [Prefix] (patched method : " + item2.PatchMethod.Name + ")")); } foreach (Patch item3 in list3) { Logger.LogDebug((object)(" -> [Postfix] (patched method : " + item3.PatchMethod.Name + ")")); } foreach (Patch item4 in list4) { Logger.LogDebug((object)(" -> [Transpiler](patched method : " + item4.PatchMethod.Name + ")")); } foreach (Patch item5 in list5) { Logger.LogDebug((object)(" -> [Finalizer] (patched method : " + item5.PatchMethod.Name + ")")); } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "EnhancedStaminaUpgrade"; public const string PLUGIN_NAME = "My first plugin"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace EnhancedStaminaUpgrade.Patches { [HarmonyPatch(typeof(PlayerController))] internal class PlayerControllerPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void Update_Prefix(ref float ___sprintRechargeAmount, PlayerController __instance) { if (!LevelGenerator.Instance.Generated || SemiFunc.MenuLevel()) { return; } string key = SemiFunc.PlayerGetSteamID(__instance.playerAvatarScript); if (StatsManager.instance.playerUpgradeStamina.ContainsKey(key)) { float num = float.Parse(StatsManager.instance.playerUpgradeStamina[key].ToString()); if (___sprintRechargeAmount != 2f + 0.5f * num) { EnhancedStaminaUpgrade.Logger.LogDebug((object)$"Old Sprint Recharge Amount: {___sprintRechargeAmount}"); ___sprintRechargeAmount = 2f + 0.5f * num; EnhancedStaminaUpgrade.Logger.LogDebug((object)$"New Sprint Recharge Amount: {___sprintRechargeAmount}"); } } } } }