The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of BadgeRemover v1.1.3
plugins/BadgeRemover.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using Microsoft.CodeAnalysis; using Steamworks; using UnityEngine; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BadgeRemover")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("BadgeRemover")] [assembly: AssemblyTitle("BadgeLocker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.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.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; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BadgeRemover { [BepInPlugin("BadgeRemover", "Badge Manager", "1.1.3")] public class BadgeRemoverPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static WindowFunction <>9__10_0; public static Func<BadgeData, bool> <>9__14_0; public static Func<BadgeData, bool> <>9__15_0; internal void <OnGUI>b__10_0(int id) { } internal bool <DrawLockTab>b__14_0(BadgeData badge) { return (Object)(object)badge != (Object)null && !badge.IsLocked; } internal bool <DrawUnlockTab>b__15_0(BadgeData badge) { return (Object)(object)badge != (Object)null && badge.IsLocked; } } private bool _showMenu = false; private Vector2 _scrollPosition; private int _currentTab = 0; private GUIStyle _windowStyle; private GUIStyle _buttonStyle; private GUIStyle _labelStyle; private GUIStyle _selectedButtonStyle; private GUIStyle _tooltipStyle; private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Badge Remover/Manager mod loaded!"); } private void Update() { if (Input.GetKeyDown((KeyCode)282)) { _showMenu = !_showMenu; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Menu toggled: " + (_showMenu ? "ON" : "OFF"))); } } private void OnGUI() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown if (!_showMenu) { return; } if (_windowStyle == null) { InitializeStyles(); } Rect val = default(Rect); ((Rect)(ref val))..ctor(20f, 20f, 420f, 500f); GUI.Window(0, val, new WindowFunction(DrawMenuWindow), "Badge Manager (Press F1 to close)", _windowStyle); if (!string.IsNullOrEmpty(GUI.tooltip)) { _tooltipStyle.richText = true; GUIContent val2 = new GUIContent(GUI.tooltip); Vector2 val3 = _tooltipStyle.CalcSize(val2); float num = 300f; float num2 = Mathf.Min(val3.x, num); float num3 = _tooltipStyle.CalcHeight(val2, num2); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(Event.current.mousePosition.x + 15f, Event.current.mousePosition.y + 15f, num2, num3); Rect val5 = val4; object obj = <>c.<>9__10_0; if (obj == null) { WindowFunction val6 = delegate { }; <>c.<>9__10_0 = val6; obj = (object)val6; } GUI.Window(999, val5, (WindowFunction)obj, val2, _tooltipStyle); GUI.BringWindowToFront(999); } if ((int)Event.current.type == 7) { GUI.tooltip = null; } } private void InitializeStyles() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00dc: 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) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Expected O, but got Unknown _windowStyle = new GUIStyle(GUI.skin.window); _windowStyle.normal.background = MakeTex(1, 1, new Color(0.1f, 0.1f, 0.1f, 0.95f)); _windowStyle.onNormal.background = _windowStyle.normal.background; _windowStyle.normal.textColor = Color.white; _windowStyle.fontStyle = (FontStyle)1; _windowStyle.padding = new RectOffset(10, 10, 25, 10); _buttonStyle = new GUIStyle(GUI.skin.button); _buttonStyle.normal.background = MakeTex(1, 1, new Color(0.3f, 0.3f, 0.3f, 1f)); _buttonStyle.hover.background = MakeTex(1, 1, new Color(0.4f, 0.4f, 0.4f, 1f)); _buttonStyle.active.background = MakeTex(1, 1, new Color(0.25f, 0.25f, 0.25f, 1f)); _buttonStyle.normal.textColor = Color.white; _buttonStyle.fontSize = 14; _buttonStyle.padding = new RectOffset(10, 10, 8, 8); _buttonStyle.margin = new RectOffset(4, 4, 4, 4); _selectedButtonStyle = new GUIStyle(_buttonStyle); _selectedButtonStyle.normal.background = MakeTex(1, 1, new Color(0.5f, 0.5f, 0.5f, 1f)); _labelStyle = new GUIStyle(GUI.skin.label); _labelStyle.normal.textColor = Color.white; _labelStyle.fontSize = 16; _labelStyle.alignment = (TextAnchor)3; _tooltipStyle = new GUIStyle(GUI.skin.box); _tooltipStyle.normal.background = MakeTex(1, 1, new Color(0.2f, 0.2f, 0.2f, 0.95f)); _tooltipStyle.normal.textColor = Color.white; _tooltipStyle.alignment = (TextAnchor)0; _tooltipStyle.padding = new RectOffset(5, 5, 5, 5); _tooltipStyle.wordWrap = true; } private void DrawMenuWindow(int windowID) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) GUI.DragWindow(new Rect(20f, 20f, 420f, 20f)); if ((Object)(object)GUIManager.instance == (Object)null || (Object)(object)GUIManager.instance.mainBadgeManager == (Object)null || (Object)(object)Singleton<Customization>.Instance == (Object)null || (Object)(object)SingletonAsset<AscentData>.Instance == (Object)null || (Object)(object)Singleton<AchievementManager>.Instance == (Object)null) { GUILayout.Label("Waiting for game to load...", _labelStyle, Array.Empty<GUILayoutOption>()); return; } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Lock Badges", (_currentTab == 0) ? _selectedButtonStyle : _buttonStyle, Array.Empty<GUILayoutOption>())) { _currentTab = 0; } if (GUILayout.Button("Unlock Badges", (_currentTab == 1) ? _selectedButtonStyle : _buttonStyle, Array.Empty<GUILayoutOption>())) { _currentTab = 1; } if (GUILayout.Button("Ascents", (_currentTab == 2) ? _selectedButtonStyle : _buttonStyle, Array.Empty<GUILayoutOption>())) { _currentTab = 2; } GUILayout.EndHorizontal(); GUILayout.Space(15f); if (_currentTab == 0) { DrawLockTab(); } else if (_currentTab == 1) { DrawUnlockTab(); } else { DrawAscentsTab(); } } private void DrawAscentsTab() { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Lock All Ascents", _buttonStyle, Array.Empty<GUILayoutOption>())) { Ascents.LockAll(); } if (GUILayout.Button("Unlock All Ascents", _buttonStyle, Array.Empty<GUILayoutOption>())) { Ascents.UnlockAll(); } GUILayout.EndHorizontal(); GUILayout.Space(10f); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty<GUILayoutOption>()); int num = default(int); Singleton<AchievementManager>.Instance.GetSteamStatInt((STEAMSTATTYPE)13, ref num); List<AscentInstanceData> ascents = SingletonAsset<AscentData>.Instance.ascents; for (int i = 0; i < ascents.Count; i++) { AscentInstanceData val = ascents[i]; bool flag = i < num; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string text = (flag ? "<color=green>(Unlocked)</color>" : "<color=red>(Locked)</color>"); _labelStyle.richText = true; GUILayout.Label(val.title + " " + text, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) }); _labelStyle.richText = false; if (flag) { if (GUILayout.Button("Lock", _buttonStyle, Array.Empty<GUILayoutOption>())) { SetAscentLevel(i); } } else if (GUILayout.Button("Unlock", _buttonStyle, Array.Empty<GUILayoutOption>())) { SetAscentLevel(i + 1); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } private void DrawLockTab() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("Click on a badge to re-lock it.", _labelStyle, Array.Empty<GUILayoutOption>()); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty<GUILayoutOption>()); BadgeData[] badgeData = GUIManager.instance.mainBadgeManager.badgeData; IEnumerable<BadgeData> enumerable = badgeData.Where((BadgeData badge) => (Object)(object)badge != (Object)null && !badge.IsLocked); CustomizationOption val = default(CustomizationOption); foreach (BadgeData item in enumerable) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (Singleton<Customization>.Instance.TryGetUnlockedCosmetic(item, ref val) && (Object)(object)val.texture != (Object)null) { GUIContent val2 = new GUIContent(val.texture, GetCosmeticRequirementText(val, item)); GUILayout.Label(val2, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(48f), GUILayout.Height(48f) }); } else { GUILayout.Space(52f); } if ((Object)(object)item.icon != (Object)null) { GUIContent val3 = new GUIContent(item.icon, "<b>" + item.displayName + "</b>\n\n" + item.description); GUILayout.Label(val3, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(48f), GUILayout.Height(48f) }); } if (GUILayout.Button(item.displayName, _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(260f), GUILayout.Height(48f) })) { LockAchievement(item.linkedAchievement); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } private void DrawUnlockTab() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("Click on a badge to unlock it.", _labelStyle, Array.Empty<GUILayoutOption>()); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty<GUILayoutOption>()); BadgeData[] badgeData = GUIManager.instance.mainBadgeManager.badgeData; IEnumerable<BadgeData> enumerable = badgeData.Where((BadgeData badge) => (Object)(object)badge != (Object)null && badge.IsLocked); CustomizationOption val = default(CustomizationOption); foreach (BadgeData item in enumerable) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (Singleton<Customization>.Instance.TryGetUnlockedCosmetic(item, ref val) && (Object)(object)val.texture != (Object)null) { GUIContent val2 = new GUIContent(val.texture, GetCosmeticRequirementText(val, item)); GUILayout.Label(val2, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(48f), GUILayout.Height(48f) }); } else { GUILayout.Space(52f); } if ((Object)(object)item.icon != (Object)null) { GUIContent val3 = new GUIContent(item.icon, "<b>" + item.displayName + "</b>\n\n" + item.description); GUILayout.Label(val3, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(48f), GUILayout.Height(48f) }); } if (GUILayout.Button(item.displayName, _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(260f), GUILayout.Height(48f) })) { UnlockAchievement(item.linkedAchievement); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } private Texture2D MakeTex(int width, int height, Color col) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } private string GetCosmeticRequirementText(CustomizationOption cosmetic, BadgeData badge) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 string text = "<b>Cosmetic: " + badge.displayName + "</b>\n\nRequired for unlock:\n"; if ((int)cosmetic.customRequirement == 1) { return text + "Complete the final Ascent."; } if ((int)cosmetic.customRequirement == 2) { return text + "Unlock all base-game badges."; } if ((int)cosmetic.requiredAchievement > 0) { return text + badge.description; } return "<b>Cosmetic: " + badge.displayName + "</b>\n\nNo special requirement."; } private void SetAscentLevel(int level) { if ((Object)(object)Singleton<AchievementManager>.Instance != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Setting Max Ascent to {level}"); Singleton<AchievementManager>.Instance.SetSteamStat((STEAMSTATTYPE)13, level); } else { ((BaseUnityPlugin)this).Logger.LogError((object)"AchievementManager not found!"); } } private void LockAchievement(ACHIEVEMENTTYPE achievementToLock) { string text = ((object)(ACHIEVEMENTTYPE)(ref achievementToLock)).ToString(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Attempting to lock achievement: " + text)); if (SteamManager.Initialized) { SteamUserStats.ClearAchievement(text); if (SteamUserStats.StoreStats()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Successfully locked '" + text + "'. Storing stats...")); ((MonoBehaviour)this).Invoke("RefreshGameUI", 0.2f); } else { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to store stats after attempting to lock '" + text + "'.")); } } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Steam is not initialized. Cannot lock achievement."); } } private void UnlockAchievement(ACHIEVEMENTTYPE achievementToUnlock) { string text = ((object)(ACHIEVEMENTTYPE)(ref achievementToUnlock)).ToString(); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Attempting to unlock achievement: " + text)); if (SteamManager.Initialized) { SteamUserStats.SetAchievement(text); if (SteamUserStats.StoreStats()) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Successfully unlocked '" + text + "'. Storing stats...")); ((MonoBehaviour)this).Invoke("RefreshGameUI", 0.2f); } else { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to store stats after attempting to unlock '" + text + "'.")); } } else { ((BaseUnityPlugin)this).Logger.LogError((object)"Steam is not initialized. Cannot unlock achievement."); } } private void RefreshGameUI() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Refreshing badge UI and player visuals..."); if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.mainBadgeManager != (Object)null) { ((MonoBehaviour)GUIManager.instance.mainBadgeManager).Invoke("InitBadges", 0f); } if ((Object)(object)Character.localCharacter != (Object)null) { BadgeUnlocker component = ((Component)Character.localCharacter).GetComponent<BadgeUnlocker>(); if ((Object)(object)component != (Object)null) { component.BadgeUnlockVisual(); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Badge Refresh complete."); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }