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 CleanStacks v1.0.12
CleanStacks.dll
Decompiled a week agousing System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; 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("CleanStacks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CleanStacks")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.12")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.12.0")] namespace CleanStacks; [BepInPlugin("com.jotunn.CleanStacks", "CleanStacks", "1.0.12")] internal class CleanStacks : BaseUnityPlugin { public const string PluginGUID = "com.jotunn.CleanStacks"; public const string PluginName = "CleanStacks"; public const string PluginVersion = "1.0.12"; private Harmony harmony; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"CleanStacks has landed"); harmony = new Harmony("com.jotunn.CleanStacks"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"CleanStacks: stack display patches loaded."); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } internal static class StackCountText { internal static void HideMaximum(object component) { if (component == null) { return; } PropertyInfo property = component.GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null || !property.CanRead || !property.CanWrite || property.PropertyType != typeof(string)) { return; } string text = property.GetValue(component) as string; if (!string.IsNullOrEmpty(text)) { int num = text.IndexOf('/'); if (num > 0) { property.SetValue(component, text.Substring(0, num)); } } } } [HarmonyPatch(typeof(InventoryGrid), "UpdateGui")] internal static class InventoryGrid_UpdateGui_Patch { private static void Postfix(InventoryGrid __instance) { if ((Object)(object)__instance == (Object)null || !(AccessTools.Field(typeof(InventoryGrid), "m_elements")?.GetValue(__instance) is IList list)) { return; } foreach (object item in list) { if (item != null) { object component = AccessTools.Field(item.GetType(), "m_amount")?.GetValue(item); StackCountText.HideMaximum(component); } } } } [HarmonyPatch(typeof(Hud), "Update")] internal static class Hud_Update_Patch { private static void Postfix(Hud __instance) { if ((Object)(object)__instance == (Object)null) { return; } Transform[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((Object)val).name) && ((Object)val).name.ToLowerInvariant().Contains("hotkey")) { Component[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<Component>(true); foreach (Component component in componentsInChildren2) { StackCountText.HideMaximum(component); } } } } }