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 CarlosMMOCarryWeight v2.5.4
plugins/CarlosMMOCarryWeight.dll
Decompiled a month agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; 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("CarlosMMOCarryWeight")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CarlosMMOCarryWeight")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d82aa18f-8b5f-4b47-9c48-2372b582784e")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace CarlosMMO; [BepInPlugin("carlosmmo.carryweight", "Carlos MMO CarryWeight", "2.5.2")] public sealed class CarlosMMOCarryWeight : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "GetMaxCarryWeight")] private static class Player_GetMaxCarryWeight_Patch { private static void Postfix(ref float __result) { __result = CarryWeightResolver.Resolve(__result); } } public const string ModGuid = "carlosmmo.carryweight"; public const string ModName = "Carlos MMO CarryWeight"; public const string ModVersion = "2.5.2"; private static Harmony _harmony; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown try { _harmony = new Harmony("carlosmmo.carryweight"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Carlos MMO CarryWeight 2.5.2 carregado."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Falha ao aplicar patches do Carlos MMO CarryWeight: " + ex)); } } private void OnDestroy() { try { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } catch { } } } internal static class CarryWeightResolver { private const float AbsoluteMinimumCarryWeight = 500f; private const float CarryPerLevel = 5f; private static bool _reflectionInitialized; private static Type _coreMainType; private static FieldInfo _currentLevelField; public static float Resolve(float originalValue) { try { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return originalValue; } if (!((Character)localPlayer).IsPlayer()) { return originalValue; } int effectiveLevel = GetEffectiveLevel(); float num = 500f + (float)Mathf.Max(0, effectiveLevel) * 5f; float num2 = originalValue; if (num > num2) { num2 = num; } if (num2 < 500f) { num2 = 500f; } return num2; } catch { return (originalValue < 500f) ? 500f : originalValue; } } private static int GetEffectiveLevel() { if (TryGetLevelFromCoreField(out var level)) { return level; } return GetLevelFromPlayerPrefs(); } private static bool TryGetLevelFromCoreField(out int level) { level = 1; try { EnsureReflection(); if (_coreMainType == null || _currentLevelField == null) { return false; } object value = _currentLevelField.GetValue(null); if (value == null) { return false; } level = ConvertToInt(value); if (level < 1) { level = 1; } return true; } catch { return false; } } private static int GetLevelFromPlayerPrefs() { try { int @int = PlayerPrefs.GetInt("MMO_Level", 1); return (@int < 1) ? 1 : @int; } catch { return 1; } } private static void EnsureReflection() { if (_reflectionInitialized) { return; } _reflectionInitialized = true; _coreMainType = null; _currentLevelField = null; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly == null) { continue; } Type type = null; try { type = assembly.GetType("CarlosMMOCore.Main", throwOnError: false); } catch { type = null; } if (!(type == null)) { FieldInfo field = type.GetField("CurrentLevel", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (!(field == null)) { _coreMainType = type; _currentLevelField = field; break; } } } } catch { _coreMainType = null; _currentLevelField = null; } } private static int ConvertToInt(object value) { if (!(value is int result)) { if (value is float) { return (int)Math.Round((float)value); } if (value is double) { return (int)Math.Round((double)value); } if (value is long) { return (int)(long)value; } if (!(value is int result2)) { if (!(value is int result3)) { if (int.TryParse(value.ToString(), out var result4)) { return result4; } return 1; } return result3; } return result2; } return result; } }