Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of StackLimitPlus v1.2.0
SCH1_StackLimitPlusMONO.dll
Decompiled 5 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using HarmonyLib; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using ScheduleOne.ItemFramework; using UnityEngine; using UniversalStackLimit; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Stack Limit Plus MONO", "1.1.0", "BlessingMds", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SCH1_StackLimitPlusMONO")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SCH1_StackLimitPlusMONO")] [assembly: AssemblyTitle("SCH1_StackLimitPlusMONO")] [assembly: NeutralResourcesLanguage("en-US")] [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 UniversalStackLimit { public class Core : MelonMod { [HarmonyPatch(typeof(ItemDefinition))] public class ItemDefinitionConstructorPatch { public static List<ItemDefinition> AllItems = new List<ItemDefinition>(); [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static void OnItemDefinitionCreated(ItemDefinition __instance) { if (!((Object)(object)__instance == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(ItemDefinition), "StackLimit"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, _globalStackLimit); } if (!AllItems.Contains(__instance)) { AllItems.Add(__instance); } } } } [CompilerGenerated] private static class <>O { public static WindowFunction <0>__DrawMenuWindow; } private static int _globalStackLimit = 40; private static bool _menuVisible = false; private static Rect _menuRect = new Rect(20f, 20f, 310f, 170f); private static bool _sceneLoaded = false; private static bool _hasInitialized = false; private static int _frameCounter = 0; private const int CHECK_INTERVAL = 60; private static readonly string ConfigFilePath = Path.Combine(MelonEnvironment.UserDataDirectory, "StackLimitPlus.txt"); private static readonly Color _greenColor = new Color(0.2f, 0.8f, 0.3f, 1f); private static readonly Color _yellowColor = new Color(1f, 0.9f, 0.2f, 1f); private static Texture2D _whiteTexture; private static Harmony _harmony; public override void OnInitializeMelon() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) _harmony = new Harmony("com.blessingmds.universalstacklimit"); _harmony.PatchAll(); _whiteTexture = new Texture2D(1, 1); _whiteTexture.SetPixel(0, 0, Color.white); _whiteTexture.Apply(); LoadStackLimit(); ((MelonBase)this).LoggerInstance.Msg("Stack Limit Plus MONO loaded! Press F6 for menu."); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Main") { ((MelonBase)this).LoggerInstance.Msg("Main scene loaded. Reloading user preference and resetting item update..."); _sceneLoaded = true; _hasInitialized = false; LoadStackLimit(); ItemDefinitionConstructorPatch.AllItems.Clear(); } } public override void OnUpdate() { if (Input.GetKeyDown((KeyCode)287)) { _menuVisible = !_menuVisible; } if (!_sceneLoaded || _hasInitialized) { return; } _frameCounter++; if (_frameCounter >= 60) { _frameCounter = 0; if (IsPlayerLoaded()) { FindAndUpdateAllItems(); _hasInitialized = true; ((MelonBase)this).LoggerInstance.Msg("Local player detected. Items updated with user preference: " + _globalStackLimit); } } } private bool IsPlayerLoaded() { try { GameObject val = GameObject.Find("Player_Local"); if ((Object)(object)val != (Object)null && val.activeInHierarchy) { return true; } return false; } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Error checking if player is loaded: " + ex.Message); return false; } } private static void FindAndUpdateAllItems() { ItemDefinition[] array = Resources.FindObjectsOfTypeAll<ItemDefinition>(); MelonLogger.Msg($"Found {array.Length} items"); int num = 0; ItemDefinition[] array2 = array; foreach (ItemDefinition val in array2) { if (!((Object)(object)val == (Object)null) && !ItemDefinitionConstructorPatch.AllItems.Contains(val)) { ItemDefinitionConstructorPatch.AllItems.Add(val); num++; UpdateStackLimit(val); } } UpdateAllDefinitions(); } public override void OnGUI() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (_menuVisible) { GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.9f); Rect menuRect = _menuRect; object obj = <>O.<0>__DrawMenuWindow; if (obj == null) { WindowFunction val = DrawMenuWindow; <>O.<0>__DrawMenuWindow = val; obj = (object)val; } _menuRect = GUI.Window(0, menuRect, (WindowFunction)obj, ""); } } private static void DrawMenuWindow(int windowId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Expected O, but got Unknown //IL_04a3: Unknown result type (might be due to invalid IL or missing references) GUI.color = _greenColor; GUI.Label(new Rect(10f, 10f, 230f, 25f), "StackLimit", new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }); GUI.color = _yellowColor; GUI.Label(new Rect(110f, 10f, 50f, 25f), "Plus", new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }); GUI.color = Color.white; DrawLine(new Rect(10f, 35f, ((Rect)(ref _menuRect)).width - 20f, 1f), Color.gray); GUI.Label(new Rect(10f, 45f, 150f, 20f), "Current Stack Limit:"); GUI.Label(new Rect(150f, 45f, 100f, 20f), _globalStackLimit.ToString(), new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, alignment = (TextAnchor)2 }); _globalStackLimit = (int)GUI.HorizontalSlider(new Rect(10f, 70f, ((Rect)(ref _menuRect)).width - 20f, 20f), (float)_globalStackLimit, 1f, 9999f); string s = GUI.TextField(new Rect(10f, 95f, 70f, 20f), _globalStackLimit.ToString()); if (int.TryParse(s, out var result) && result > 0) { _globalStackLimit = result; } GUI.Label(new Rect(85f, 95f, 70f, 20f), "Presets:"); if (GUI.Button(new Rect(135f, 95f, 35f, 20f), "10")) { UpdateStackLimit(10); } if (GUI.Button(new Rect(175f, 95f, 35f, 20f), "40")) { UpdateStackLimit(40); } if (GUI.Button(new Rect(215f, 95f, 35f, 20f), "99")) { UpdateStackLimit(99); } if (GUI.Button(new Rect(255f, 95f, 45f, 20f), "999")) { UpdateStackLimit(999); } if (GUI.Button(new Rect(10f, 125f, 30f, 30f), "-") && _globalStackLimit > 1) { UpdateStackLimit(_globalStackLimit - 1); } if (GUI.Button(new Rect(45f, 125f, 30f, 30f), "+") && _globalStackLimit < 9999) { UpdateStackLimit(_globalStackLimit + 1); } GUI.backgroundColor = new Color(0.2f, 0.6f, 0.2f, 1f); if (GUI.Button(new Rect(95f, 125f, 100f, 30f), "Update")) { UpdateAllDefinitions(); SaveStackLimit(); MelonLogger.Msg($"Stack limit updated to {_globalStackLimit}"); } GUI.backgroundColor = new Color(0.6f, 0.2f, 0.2f, 1f); if (GUI.Button(new Rect(205f, 125f, 85f, 30f), "Close")) { _menuVisible = false; } GUI.backgroundColor = Color.white; GUI.color = new Color(0.7f, 0.7f, 0.7f, 0.7f); GUI.Label(new Rect(0f, ((Rect)(ref _menuRect)).height - 22f, ((Rect)(ref _menuRect)).width, 20f), $"F6 to toggle • {ItemDefinitionConstructorPatch.AllItems.Count} items", new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 10 }); GUI.color = Color.white; GUI.DragWindow(); } private static void DrawLine(Rect rect, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_whiteTexture); GUI.color = color2; } private static void UpdateStackLimit(int newLimit) { _globalStackLimit = newLimit; SaveStackLimit(); } private static void UpdateStackLimit(ItemDefinition item) { if ((Object)(object)item == (Object)null) { return; } try { FieldInfo fieldInfo = AccessTools.Field(((object)item).GetType(), "StackLimit"); if (fieldInfo != null) { fieldInfo.SetValue(item, _globalStackLimit); } } catch (Exception ex) { MelonLogger.Error("Update failed: " + ex.Message); } } private static void SaveStackLimit() { try { File.WriteAllText(ConfigFilePath, _globalStackLimit.ToString()); MelonLogger.Msg("Stack limit saved to " + ConfigFilePath); } catch (Exception ex) { MelonLogger.Error("Failed to save stack limit: " + ex.Message); } } private static void LoadStackLimit() { try { if (File.Exists(ConfigFilePath)) { string s = File.ReadAllText(ConfigFilePath); if (int.TryParse(s, out var result)) { _globalStackLimit = Mathf.Clamp(result, 1, 9999); MelonLogger.Msg($"Loaded stack limit from preference file: {_globalStackLimit}"); } } else { SaveStackLimit(); } } catch (Exception ex) { MelonLogger.Error("Failed to load stack limit: " + ex.Message); } } public static void UpdateAllDefinitions() { int num = 0; foreach (ItemDefinition allItem in ItemDefinitionConstructorPatch.AllItems) { if ((Object)(object)allItem == (Object)null) { continue; } try { FieldInfo fieldInfo = AccessTools.Field(((object)allItem).GetType(), "StackLimit"); if (fieldInfo != null) { fieldInfo.SetValue(allItem, _globalStackLimit); num++; } } catch (Exception ex) { MelonLogger.Error("Update failed: " + ex.Message); } } MelonLogger.Msg($"Updated {num} items"); } } }
SCH1_StackLimitPlus.dll
Decompiled 5 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.PlayerScripts; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using SCH1_StackLimitPlus; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Core), "Stack Limit Plus", "1.0.0", "BlessingMds", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("SCH1_StackLimitPlus")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+23cfed4c00b8f25ed261a9886956fbd7e3636e32")] [assembly: AssemblyProduct("SCH1_StackLimitPlus")] [assembly: AssemblyTitle("SCH1_StackLimitPlus")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace SCH1_StackLimitPlus { public class Core : MelonMod { [HarmonyPatch(typeof(ItemDefinition))] public class ItemDefinitionConstructorPatch { public static HashSet<ItemDefinition> AllItems = new HashSet<ItemDefinition>(); [HarmonyPostfix] [HarmonyPatch(/*Could not decode attribute arguments.*/)] private static void OnItemDefinitionCreated(ItemDefinition __instance) { if ((Object)(object)__instance == (Object)null || !AllItems.Add(__instance)) { return; } try { __instance.StackLimit = _globalStackLimit; } catch (Exception ex) { MelonLogger.Error("Init failed: " + ex.Message); } } } private static int _globalStackLimit = 40; private static bool _menuVisible = false; private static Rect _menuRect = new Rect(20f, 20f, 310f, 170f); private static bool _sceneLoaded = false; private static bool _hasInitialized = false; private static int _frameCounter = 0; private const int CHECK_INTERVAL = 60; private static readonly string ConfigFilePath = Path.Combine(MelonEnvironment.UserDataDirectory, "StackLimitPlus.txt"); private static readonly Color _greenColor = new Color(0.2f, 0.8f, 0.3f, 1f); private static readonly Color _yellowColor = new Color(1f, 0.9f, 0.2f, 1f); private static Texture2D? _whiteTexture; public override void OnInitializeMelon() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown ((MelonBase)this).OnInitializeMelon(); MelonLogger.Msg("StackLimitPlus Loaded"); _whiteTexture = new Texture2D(1, 1); _whiteTexture.SetPixel(0, 0, Color.white); _whiteTexture.Apply(); Harmony val = new Harmony("com.sch1.stacklimitplus"); val.PatchAll(); } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { if (sceneName == "Main") { MelonLogger.Msg("Main scene loaded. Reloading user preference and resetting item update..."); _sceneLoaded = true; _hasInitialized = false; LoadStackLimit(); ItemDefinitionConstructorPatch.AllItems.Clear(); } } public override void OnUpdate() { if (Input.GetKeyDown((KeyCode)287)) { _menuVisible = !_menuVisible; } if (!_sceneLoaded || _hasInitialized) { return; } _frameCounter++; if (_frameCounter >= 60) { _frameCounter = 0; if (IsPlayerLoaded()) { FindAndUpdateAllItems(); _hasInitialized = true; MelonLogger.Msg("Local player detected. Items updated with user preference: " + _globalStackLimit); } } } private bool IsPlayerLoaded() { try { Il2CppReferenceArray<Object> val = Object.FindObjectsOfType(Il2CppType.Of<Player>()); if (val != null && ((Il2CppArrayBase<Object>)(object)val).Length > 0) { return true; } GameObject val2 = GameObject.Find("Player_Local"); if ((Object)(object)val2 != (Object)null && val2.activeInHierarchy) { return true; } return false; } catch (Exception ex) { MelonLogger.Error("Error checking if player is loaded: " + ex.Message); return false; } } public override void OnGUI() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (_menuVisible) { GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 0.9f); _menuRect = GUI.Window(0, _menuRect, WindowFunction.op_Implicit((Action<int>)DrawMenuWindow), ""); } } private static void DrawMenuWindow(int windowId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Expected O, but got Unknown //IL_048e: Unknown result type (might be due to invalid IL or missing references) GUI.color = _greenColor; GUI.Label(new Rect(10f, 10f, 230f, 25f), "StackLimit", new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }); GUI.color = _yellowColor; GUI.Label(new Rect(110f, 10f, 50f, 25f), "Plus", new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, alignment = (TextAnchor)0 }); GUI.color = Color.white; DrawLine(new Rect(10f, 35f, ((Rect)(ref _menuRect)).width - 20f, 1f), Color.gray); GUI.Label(new Rect(10f, 45f, 150f, 20f), "Current Stack Limit:"); GUI.Label(new Rect(150f, 45f, 100f, 20f), _globalStackLimit.ToString(), new GUIStyle(GUI.skin.label) { fontStyle = (FontStyle)1, alignment = (TextAnchor)2 }); _globalStackLimit = (int)GUI.HorizontalSlider(new Rect(10f, 70f, ((Rect)(ref _menuRect)).width - 20f, 20f), (float)_globalStackLimit, 1f, 9999f); GUI.Label(new Rect(10f, 95f, 70f, 20f), "Presets:"); if (GUI.Button(new Rect(70f, 95f, 35f, 20f), "10")) { UpdateStackLimit(10); } if (GUI.Button(new Rect(110f, 95f, 35f, 20f), "40")) { UpdateStackLimit(40); } if (GUI.Button(new Rect(150f, 95f, 35f, 20f), "99")) { UpdateStackLimit(99); } if (GUI.Button(new Rect(190f, 95f, 45f, 20f), "999")) { UpdateStackLimit(999); } if (GUI.Button(new Rect(10f, 125f, 30f, 30f), "-") && _globalStackLimit > 1) { UpdateStackLimit(_globalStackLimit - 1); } if (GUI.Button(new Rect(45f, 125f, 30f, 30f), "+") && _globalStackLimit < 9999) { UpdateStackLimit(_globalStackLimit + 1); } GUI.backgroundColor = new Color(0.2f, 0.6f, 0.2f, 1f); if (GUI.Button(new Rect(95f, 125f, 100f, 30f), "Update")) { FindAndUpdateAllItems(); MelonLogger.Msg($"Stack limit updated to {_globalStackLimit}"); } GUI.backgroundColor = new Color(0.6f, 0.2f, 0.2f, 1f); if (GUI.Button(new Rect(205f, 125f, 85f, 30f), "Close")) { _menuVisible = false; } GUI.backgroundColor = Color.white; GUI.color = new Color(0.7f, 0.7f, 0.7f, 0.7f); GUI.Label(new Rect(0f, ((Rect)(ref _menuRect)).height - 22f, ((Rect)(ref _menuRect)).width, 20f), $"F6 to toggle • {ItemDefinitionConstructorPatch.AllItems.Count} items", new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 10 }); GUI.color = Color.white; GUI.DragWindow(); } private static void DrawLine(Rect rect, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_whiteTexture); GUI.color = color2; } private static void FindAndUpdateAllItems() { Il2CppArrayBase<ItemDefinition> val = Resources.FindObjectsOfTypeAll<ItemDefinition>(); MelonLogger.Msg($"Found {val.Length} items"); int num = 0; foreach (ItemDefinition item in val) { if (!((Object)(object)item == (Object)null) && !ItemDefinitionConstructorPatch.AllItems.Contains(item)) { ItemDefinitionConstructorPatch.AllItems.Add(item); num++; UpdateStackLimit(item); } } UpdateAllDefinitions(); } public static void UpdateAllDefinitions() { int num = 0; foreach (ItemDefinition allItem in ItemDefinitionConstructorPatch.AllItems) { if (!((Object)(object)allItem == (Object)null)) { try { UpdateStackLimit(allItem); num++; } catch (Exception ex) { MelonLogger.Error("Update failed: " + ex.Message); } } } MelonLogger.Msg($"Updated {num} items"); } private static void UpdateStackLimit(int newLimit) { _globalStackLimit = newLimit; SaveStackLimit(); } private static void UpdateStackLimit(ItemDefinition item) { if ((Object)(object)item == (Object)null) { return; } try { item.StackLimit = _globalStackLimit; } catch (Exception ex) { MelonLogger.Error("Update failed: " + ex.Message); } } private static void SaveStackLimit() { try { File.WriteAllText(ConfigFilePath, _globalStackLimit.ToString()); MelonLogger.Msg("Stack limit saved to " + ConfigFilePath); } catch (Exception ex) { MelonLogger.Error("Failed to save stack limit: " + ex.Message); } } private static void LoadStackLimit() { try { if (File.Exists(ConfigFilePath)) { string s = File.ReadAllText(ConfigFilePath); if (int.TryParse(s, out var result)) { _globalStackLimit = Mathf.Clamp(result, 1, 9999); MelonLogger.Msg($"Loaded stack limit from preference file: {_globalStackLimit}"); } } else { SaveStackLimit(); } } catch (Exception ex) { MelonLogger.Error("Failed to load stack limit: " + ex.Message); } } } }