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 UnlimitedPhysicalStrength v0.1.2
UnlimitedPhysicalStrength.dll
Decompiled 5 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("UnlimitedPhysicalStrength")] [assembly: AssemblyDescription("无限体力模组 for REPO")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("hyy")] [assembly: AssemblyProduct("UnlimitedPhysicalStrength")] [assembly: AssemblyCopyright("Copyright © hyy 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("45e9cac9-6b1f-46f0-b1f3-f37575e133fd")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("0.1.1.0")] namespace UnlimitedPhysicalStrength { [BepInPlugin("hyy.REPO.UnlimitedPhysicalStrength", "Unlimited Physical Strength", "0.1.1")] [BepInProcess("REPO.exe")] [BepInDependency("nickklmao.menulib", "2.5.0")] public class UnlimitedPhysicalStrength : BaseUnityPlugin { private ConfigEntry<bool> configEnableMod; private ConfigEntry<bool> configInfiniteStamina; private ConfigEntry<bool> configBlockOtherMods; private ConfigEntry<bool> configEnableAutoRegen; private ConfigEntry<bool> configNoStaminaDrain; private ConfigEntry<bool> configInstantStaminaRecovery; private ConfigEntry<float> configStaminaMultiplier; private ConfigEntry<float> configCustomMaxStamina; private ConfigEntry<bool> configModifyMaxStamina; private ConfigEntry<KeyboardShortcut> configToggleHotkey; private ConfigEntry<bool> configDebugMode; private bool isModEnabled = true; private bool lastModState = true; private float lastStaminaValue = 0f; private float checkInterval = 0.5f; private float checkTimer = 0f; private Harmony harmony; private static object currentPlayerController; private static float originalMaxStamina = 100f; private static bool isOriginalMaxStaminaSaved = false; internal static ManualLogSource Logger { get; private set; } public static UnlimitedPhysicalStrength Instance { get; private set; } public static bool IsModEnabled => Instance?.isModEnabled ?? false; public static bool InfiniteStaminaEnabled => Instance?.configInfiniteStamina.Value ?? true; public static bool BlockOtherModsEnabled => Instance?.configBlockOtherMods.Value ?? true; public static bool AutoRegenEnabled => Instance?.configEnableAutoRegen.Value ?? true; public static bool NoStaminaDrainEnabled => Instance?.configNoStaminaDrain.Value ?? true; public static bool InstantStaminaRecoveryEnabled => Instance?.configInstantStaminaRecovery.Value ?? true; public static float StaminaMultiplier => Instance?.configStaminaMultiplier.Value ?? 1f; public static float CustomMaxStamina => Instance?.configCustomMaxStamina.Value ?? 100f; public static bool ModifyMaxStamina => Instance?.configModifyMaxStamina.Value ?? false; public static bool DebugMode => Instance?.configDebugMode.Value ?? false; private void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; harmony = new Harmony("hyy.REPO.UnlimitedPhysicalStrength"); LoadConfig(); ApplyPatches(); Logger.LogInfo((object)"=========================================================================="); Logger.LogInfo((object)"Unlimited Physical Strength v0.1.1 by hyy"); Logger.LogInfo((object)"GUID: hyy.REPO.UnlimitedPhysicalStrength"); Logger.LogInfo((object)"=========================================================================="); Logger.LogInfo((object)("Mod Status: " + (isModEnabled ? "ENABLED" : "DISABLED"))); Logger.LogInfo((object)$"Infinite Stamina: {configInfiniteStamina.Value}"); Logger.LogInfo((object)$"Custom Max Stamina: {configCustomMaxStamina.Value} (Enabled: {configModifyMaxStamina.Value})"); Logger.LogInfo((object)$"Block Other Mods: {configBlockOtherMods.Value}"); Logger.LogInfo((object)$"Toggle Hotkey: {configToggleHotkey.Value}"); Logger.LogInfo((object)"=========================================================================="); } private void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = configToggleHotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { ToggleModEnabled(); } checkTimer += Time.deltaTime; if (checkTimer >= checkInterval && DebugMode) { checkTimer = 0f; CheckStaminaStatus(); } } private void OnDestroy() { if (harmony != null) { harmony.UnpatchSelf(); Logger.LogInfo((object)"Harmony patches unloaded"); } } private void LoadConfig() { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) configEnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableMod", true, "启用/禁用整个模组"); configInfiniteStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina", "InfiniteStamina", true, "启用无限体力"); configBlockOtherMods = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina", "BlockOtherMods", true, "阻止其他模组修改体力"); configEnableAutoRegen = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina", "EnableAutoRegen", true, "启用自动体力回复"); configNoStaminaDrain = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina", "NoStaminaDrain", true, "完全阻止体力消耗"); configInstantStaminaRecovery = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina", "InstantStaminaRecovery", true, "即时体力恢复"); configStaminaMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "StaminaMultiplier", 1f, new ConfigDescription("体力倍率(仅在无限体力关闭时生效)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); configCustomMaxStamina = ((BaseUnityPlugin)this).Config.Bind<float>("Stamina", "CustomMaxStamina", 100f, new ConfigDescription("自定义最大体力值 (1-1000)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>())); configModifyMaxStamina = ((BaseUnityPlugin)this).Config.Bind<bool>("Stamina", "ModifyMaxStamina", false, "启用自定义最大体力(修改后需要重启游戏或重新加载场景)"); configToggleHotkey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Hotkeys", "ToggleMod", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "切换模组启用/禁用的热键"); configDebugMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DebugMode", false, "启用调试模式(会在日志中显示更多信息)"); isModEnabled = configEnableMod.Value; lastModState = isModEnabled; } private void ApplyPatches() { try { List<Type> list = new List<Type>(); Assembly executingAssembly = Assembly.GetExecutingAssembly(); Type[] types = executingAssembly.GetTypes(); foreach (Type type in types) { if (type.Namespace == "UnlimitedPhysicalStrength.Patches" && type.GetCustomAttributes(typeof(HarmonyPatch), inherit: false).Length != 0) { list.Add(type); } } foreach (Type item in list) { harmony.PatchAll(item); Logger.LogDebug((object)("Applied patch: " + item.Name)); } Logger.LogInfo((object)$"成功应用 {list.Count} 个Harmony补丁"); if (BlockOtherModsEnabled) { ApplyUniversalProtection(); } } catch (Exception ex) { Logger.LogError((object)("应用补丁时出错: " + ex.Message)); Logger.LogError((object)ex.StackTrace); } } private void ApplyUniversalProtection() { try { Logger.LogInfo((object)"全局体力保护已启用"); } catch (Exception ex) { Logger.LogError((object)("应用全局保护时出错: " + ex.Message)); } } private void ToggleModEnabled() { isModEnabled = !isModEnabled; configEnableMod.Value = isModEnabled; if (isModEnabled) { Logger.LogInfo((object)"模组已启用"); if (!lastModState) { ApplyPatches(); } } else { Logger.LogInfo((object)"模组已禁用"); } lastModState = isModEnabled; ShowNotification("无限体力: " + (isModEnabled ? "启用" : "禁用")); } private void CheckStaminaStatus() { try { if (currentPlayerController == null) { return; } FieldInfo field = currentPlayerController.GetType().GetField("EnergyCurrent"); if (field != null) { float num = (float)field.GetValue(currentPlayerController); if (Mathf.Abs(num - lastStaminaValue) > 0.01f) { Logger.LogDebug((object)$"体力变化: {lastStaminaValue} -> {num}"); lastStaminaValue = num; } } } catch { } } private void ShowNotification(string message) { try { Logger.LogInfo((object)("通知: " + message)); } catch { Logger.LogInfo((object)message); } } public static void SetPlayerController(object playerController) { currentPlayerController = playerController; } public static object GetPlayerController() { return currentPlayerController; } public static void SaveOriginalMaxStamina(float value) { if (!isOriginalMaxStaminaSaved) { originalMaxStamina = value; isOriginalMaxStaminaSaved = true; Logger.LogInfo((object)$"原始最大体力已保存: {originalMaxStamina}"); } } public static float GetOriginalMaxStamina() { return originalMaxStamina; } public static bool IsOriginalMaxStaminaSaved() { return isOriginalMaxStaminaSaved; } public static void ForceSetStamina(float value) { try { if (currentPlayerController != null) { FieldInfo field = currentPlayerController.GetType().GetField("EnergyCurrent"); if (field != null) { field.SetValue(currentPlayerController, value); Logger.LogDebug((object)$"强制设置体力: {value}"); } } } catch (Exception ex) { Logger.LogError((object)("强制设置体力时出错: " + ex.Message)); } } public static float GetEffectiveMaxStamina() { if (ModifyMaxStamina) { return CustomMaxStamina; } return GetOriginalMaxStamina(); } } } namespace UnlimitedPhysicalStrength.Config { public static class ModConfig { public static ConfigEntry<bool> EnableMod { get; private set; } public static ConfigEntry<bool> InfiniteStamina { get; private set; } public static ConfigEntry<bool> BlockOtherMods { get; private set; } public static ConfigEntry<bool> EnableAutoRegen { get; private set; } public static ConfigEntry<bool> NoStaminaDrain { get; private set; } public static ConfigEntry<bool> InstantStaminaRecovery { get; private set; } public static ConfigEntry<float> StaminaMultiplier { get; private set; } public static ConfigEntry<float> CustomMaxStamina { get; private set; } public static ConfigEntry<bool> ModifyMaxStamina { get; private set; } public static ConfigEntry<KeyboardShortcut> ToggleHotkey { get; private set; } public static ConfigEntry<bool> DebugMode { get; private set; } public static void Initialize(ConfigFile config) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) EnableMod = config.Bind<bool>("General", "EnableMod", true, "启用/禁用整个模组"); InfiniteStamina = config.Bind<bool>("Stamina", "InfiniteStamina", true, "启用无限体力"); BlockOtherMods = config.Bind<bool>("Stamina", "BlockOtherMods", true, "阻止其他模组修改体力"); EnableAutoRegen = config.Bind<bool>("Stamina", "EnableAutoRegen", true, "启用自动体力回复"); NoStaminaDrain = config.Bind<bool>("Stamina", "NoStaminaDrain", true, "完全阻止体力消耗"); InstantStaminaRecovery = config.Bind<bool>("Stamina", "InstantStaminaRecovery", true, "即时体力恢复"); StaminaMultiplier = config.Bind<float>("Stamina", "StaminaMultiplier", 1f, "体力倍率(仅在无限体力关闭时生效)"); CustomMaxStamina = config.Bind<float>("Stamina", "CustomMaxStamina", 100f, new ConfigDescription("自定义最大体力值 (1-1000)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 1000f), Array.Empty<object>())); ModifyMaxStamina = config.Bind<bool>("Stamina", "ModifyMaxStamina", false, "启用自定义最大体力(修改后需要重启游戏或重新加载场景)"); ToggleHotkey = config.Bind<KeyboardShortcut>("Hotkeys", "ToggleMod", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "切换模组启用/禁用的热键"); DebugMode = config.Bind<bool>("Debug", "DebugMode", false, "启用调试模式"); } } } namespace UnlimitedPhysicalStrength.Patches { [HarmonyPatch] public static class PlayerStaminaController { private static float lastDetectedStamina; private static float lastMaxStamina; internal static Type playerControllerType; private static bool customMaxStaminaApplied; static PlayerStaminaController() { lastDetectedStamina = 0f; lastMaxStamina = 0f; playerControllerType = null; customMaxStaminaApplied = false; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { playerControllerType = assembly.GetType("PlayerController"); if (playerControllerType != null) { UnlimitedPhysicalStrength.Logger.LogInfo((object)("Found PlayerController type: " + playerControllerType.FullName)); break; } } catch { } } if (playerControllerType == null) { UnlimitedPhysicalStrength.Logger.LogWarning((object)"PlayerController type not found, using dynamic lookup"); } } catch (Exception ex) { UnlimitedPhysicalStrength.Logger.LogError((object)("Error finding PlayerController type: " + ex.Message)); } } [HarmonyTargetMethods] private static IEnumerable<MethodBase> TargetMethods() { List<MethodBase> list = new List<MethodBase>(); if (playerControllerType != null) { MethodInfo[] methods = playerControllerType.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method = playerControllerType.GetMethod("Update", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { list.Add(method); } MethodInfo method2 = playerControllerType.GetMethod("FixedUpdate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method2 != null) { list.Add(method2); } MethodInfo method3 = playerControllerType.GetMethod("LateUpdate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method3 != null) { list.Add(method3); } MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { string text = methodInfo.Name.ToLower(); if ((text.Contains("stamina") || text.Contains("energy") || text.Contains("update") || text.Contains("regenerate") || text.Contains("start") || text.Contains("awake")) && !list.Contains(methodInfo)) { list.Add(methodInfo); } } } UnlimitedPhysicalStrength.Logger.LogInfo((object)$"Found {list.Count} methods to patch"); return list; } [HarmonyPostfix] private static void Postfix(ref object __instance) { if (!UnlimitedPhysicalStrength.IsModEnabled) { return; } try { SaveOriginalMaxStamina(__instance); ApplyCustomMaxStamina(__instance); if (UnlimitedPhysicalStrength.InfiniteStaminaEnabled) { ApplyInfiniteStamina(__instance); } } catch (Exception ex) { if (UnlimitedPhysicalStrength.DebugMode) { UnlimitedPhysicalStrength.Logger.LogError((object)("Error in stamina patch: " + ex.Message)); } } } private static void SaveOriginalMaxStamina(object playerInstance) { if (playerInstance == null || UnlimitedPhysicalStrength.IsOriginalMaxStaminaSaved()) { return; } Type type = playerInstance.GetType(); string[] array = new string[6] { "EnergyStart", "energyStart", "maxStamina", "MaxStamina", "maxEnergy", "MaxEnergy" }; string[] array2 = array; foreach (string name in array2) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { try { float value = (float)field.GetValue(playerInstance); UnlimitedPhysicalStrength.SaveOriginalMaxStamina(value); break; } catch { } } } } private static void ApplyCustomMaxStamina(object playerInstance) { if (playerInstance == null || !UnlimitedPhysicalStrength.ModifyMaxStamina || customMaxStaminaApplied) { return; } Type type = playerInstance.GetType(); string[] array = new string[6] { "EnergyStart", "energyStart", "maxStamina", "MaxStamina", "maxEnergy", "MaxEnergy" }; string[] array2 = array; foreach (string name in array2) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null)) { continue; } try { float customMaxStamina = UnlimitedPhysicalStrength.CustomMaxStamina; field.SetValue(playerInstance, customMaxStamina); if (!customMaxStaminaApplied) { UnlimitedPhysicalStrength.Logger.LogInfo((object)$"应用自定义最大体力: {customMaxStamina}"); customMaxStaminaApplied = true; } break; } catch (Exception ex) { UnlimitedPhysicalStrength.Logger.LogError((object)("设置自定义最大体力时出错: " + ex.Message)); } } } internal static void ApplyInfiniteStamina(object playerInstance) { if (playerInstance == null) { return; } UnlimitedPhysicalStrength.SetPlayerController(playerInstance); Type type = playerInstance.GetType(); FieldInfo fieldInfo = null; FieldInfo fieldInfo2 = null; string[] array = new string[6] { "EnergyCurrent", "energyCurrent", "stamina", "Stamina", "currentEnergy", "CurrentEnergy" }; string[] array2 = new string[6] { "EnergyStart", "energyStart", "maxStamina", "MaxStamina", "maxEnergy", "MaxEnergy" }; string[] array3 = array; foreach (string name in array3) { fieldInfo = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo != null) { break; } } string[] array4 = array2; foreach (string name2 in array4) { fieldInfo2 = type.GetField(name2, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo2 != null) { break; } } if (fieldInfo == null || fieldInfo2 == null) { PropertyInfo propertyInfo = null; PropertyInfo propertyInfo2 = null; string[] array5 = array; foreach (string name3 in array5) { propertyInfo = type.GetProperty(name3, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (propertyInfo != null) { break; } } string[] array6 = array2; foreach (string name4 in array6) { propertyInfo2 = type.GetProperty(name4, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (propertyInfo2 != null) { break; } } if (propertyInfo != null && propertyInfo2 != null) { float num = (float)propertyInfo2.GetValue(playerInstance); propertyInfo.SetValue(playerInstance, num); if (UnlimitedPhysicalStrength.DebugMode && Time.frameCount % 60 == 0) { UnlimitedPhysicalStrength.Logger.LogDebug((object)$"Set stamina to max via property: {num}"); } } return; } float num2 = (float)fieldInfo2.GetValue(playerInstance); fieldInfo.SetValue(playerInstance, num2); float num3 = (float)fieldInfo.GetValue(playerInstance); if (Mathf.Abs(num3 - lastDetectedStamina) > 0.1f || Mathf.Abs(num2 - lastMaxStamina) > 0.1f) { if (UnlimitedPhysicalStrength.DebugMode) { UnlimitedPhysicalStrength.Logger.LogDebug((object)$"Stamina: {num3}/{num2}"); } lastDetectedStamina = num3; lastMaxStamina = num2; } if (UnlimitedPhysicalStrength.NoStaminaDrainEnabled) { ResetStaminaDrainVariables(playerInstance, type); } if (UnlimitedPhysicalStrength.AutoRegenEnabled) { ForceStaminaRegeneration(playerInstance, type); } } private static void ResetStaminaDrainVariables(object instance, Type type) { try { FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { string text = fieldInfo.Name.ToLower(); if (text.Contains("drain") || text.Contains("cost") || text.Contains("consume") || text.Contains("消耗")) { if (fieldInfo.FieldType == typeof(float)) { fieldInfo.SetValue(instance, 0f); } else if (fieldInfo.FieldType == typeof(int)) { fieldInfo.SetValue(instance, 0); } } } } catch { } } private static void ForceStaminaRegeneration(object instance, Type type) { try { if (UnlimitedPhysicalStrength.InstantStaminaRecoveryEnabled) { return; } FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { string text = fieldInfo.Name.ToLower(); if ((text.Contains("regen") || text.Contains("recovery") || text.Contains("recover") || text.Contains("回复")) && fieldInfo.FieldType == typeof(float)) { float num = (float)fieldInfo.GetValue(instance); if (num < 100f) { fieldInfo.SetValue(instance, 100f); } } } } catch { } } } [HarmonyPatch] public static class StaminaSetterInterceptor { [HarmonyTargetMethods] private static IEnumerable<MethodBase> TargetSetterMethods() { List<MethodBase> list = new List<MethodBase>(); if (PlayerStaminaController.playerControllerType != null) { MethodInfo[] methods = PlayerStaminaController.playerControllerType.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { string text = methodInfo.Name.ToLower(); if (text.StartsWith("set_") && (text.Contains("energy") || text.Contains("stamina"))) { list.Add(methodInfo); } else if (text.Contains("setenergy") || text.Contains("setstamina") || text.Contains("changeenergy") || text.Contains("changestamina") || text.Contains("modify") || text.Contains("adjust")) { list.Add(methodInfo); } } } UnlimitedPhysicalStrength.Logger.LogInfo((object)$"Found {list.Count} stamina setter methods to intercept"); return list; } [HarmonyPrefix] private static bool Prefix(ref object __instance, ref object __0) { if (!UnlimitedPhysicalStrength.IsModEnabled || !UnlimitedPhysicalStrength.BlockOtherModsEnabled) { return true; } try { object obj = __0; if (obj is float) { float num = (float)obj; if (true && UnlimitedPhysicalStrength.InfiniteStaminaEnabled) { float effectiveMaxStamina = UnlimitedPhysicalStrength.GetEffectiveMaxStamina(); if (num < effectiveMaxStamina - 0.1f) { __0 = effectiveMaxStamina; if (UnlimitedPhysicalStrength.DebugMode) { UnlimitedPhysicalStrength.Logger.LogDebug((object)$"Intercepted stamina reduction: {num} -> {effectiveMaxStamina}"); } } } } } catch (Exception ex) { if (UnlimitedPhysicalStrength.DebugMode) { UnlimitedPhysicalStrength.Logger.LogError((object)("Error intercepting stamina setter: " + ex.Message)); } } return true; } [HarmonyPostfix] private static void Postfix(ref object __instance) { if (!UnlimitedPhysicalStrength.IsModEnabled || !UnlimitedPhysicalStrength.InfiniteStaminaEnabled) { return; } try { PlayerStaminaController.ApplyInfiniteStamina(__instance); } catch (Exception ex) { if (UnlimitedPhysicalStrength.DebugMode) { UnlimitedPhysicalStrength.Logger.LogError((object)("Error in stamina setter postfix: " + ex.Message)); } } } } }