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 CosmeticsCounter v1.1.0
CosmeticsCounter.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CosmeticsCounter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CosmeticsCounter")] [assembly: AssemblyTitle("CosmeticsCounter")] [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 CosmeticsCounter { [BepInPlugin("com.kwaidix.cosmeticscounter", "Cosmetics Counter", "1.1.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"CosmeticsCounter loaded!"); new Harmony("com.kwaidix.cosmeticscounter").PatchAll(); Logger.LogInfo((object)"Harmony patches applied!"); } } [HarmonyPatch(typeof(MenuPageCosmetics), "Start")] public class MenuPageCosmetics_Start_Patch { private static void Postfix(MenuPageCosmetics __instance) { Plugin.Logger.LogInfo((object)"MenuPageCosmetics.Start() fired!"); CounterManager.InjectCounter(__instance); } } public static class CounterManager { private static GameObject? _counterObject; private static TextMeshProUGUI? _counterText; public static void InjectCounter(MenuPageCosmetics page) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_counterObject != (Object)null) { Object.Destroy((Object)(object)_counterObject); } _counterObject = new GameObject("CosmeticsCounterLabel"); _counterObject.transform.SetParent(((Component)page).transform, false); _counterText = _counterObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)_counterText).fontSize = 10f; ((TMP_Text)_counterText).fontStyle = (FontStyles)1; ((Graphic)_counterText).color = new Color(1f, 1f, 1f, 0.85f); ((TMP_Text)_counterText).alignment = (TextAlignmentOptions)260; RectTransform component = _counterObject.GetComponent<RectTransform>(); component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(1f, 1f); component.anchoredPosition = new Vector2(-24f, -18f); component.sizeDelta = new Vector2(220f, 40f); _counterObject.transform.SetAsLastSibling(); RefreshText(); Plugin.Logger.LogInfo((object)"Cosmetics counter created!"); } public static void RefreshText() { if (!((Object)(object)_counterText == (Object)null) && !((Object)(object)MetaManager.instance == (Object)null)) { int count = MetaManager.instance.cosmeticAssets.Count; int unlockedCount = GetUnlockedCount(); ((TMP_Text)_counterText).text = $"{unlockedCount} / {count} unlocked"; Plugin.Logger.LogInfo((object)$"Counter: {unlockedCount} / {count}"); } } private static int GetUnlockedCount() { try { FieldInfo field = typeof(MetaManager).GetField("cosmeticUnlocks", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field == null) { Plugin.Logger.LogWarning((object)"Field cosmeticUnlocks not found via reflection!"); return 0; } return (field.GetValue(MetaManager.instance) is List<int> list) ? list.Count : 0; } catch (Exception ex) { Plugin.Logger.LogError((object)("Reflection error: " + ex.Message)); return 0; } } } internal static class MyPluginInfo { public const string PLUGIN_GUID = "com.kwaidix.cosmeticscounter"; public const string PLUGIN_NAME = "Cosmetics Counter"; public const string PLUGIN_VERSION = "1.1.0"; } }