Decompiled source of BadgeRemover v1.1.5

plugins/BadgeRemover.dll

Decompiled an hour ago
using 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.5")]
	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__15_0;

			public static Func<BadgeData, bool> <>9__16_0;

			internal void <OnGUI>b__10_0(int id)
			{
			}

			internal bool <DrawLockTab>b__15_0(BadgeData badge)
			{
				return (Object)(object)badge != (Object)null && !badge.IsLocked;
			}

			internal bool <DrawUnlockTab>b__16_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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: 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_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Expected O, but got Unknown
			Color col = default(Color);
			((Color)(ref col))..ctor(0.12f, 0.13f, 0.15f, 0.98f);
			Color val = default(Color);
			((Color)(ref val))..ctor(0.18f, 0.2f, 0.22f);
			Color borderColor = default(Color);
			((Color)(ref borderColor))..ctor(0.23f, 0.29f, 0.36f);
			Color col2 = default(Color);
			((Color)(ref col2))..ctor(0.08f, 0.45f, 0.82f);
			Color col3 = default(Color);
			((Color)(ref col3))..ctor(0.1f, 0.55f, 0.95f);
			Color white = Color.white;
			_windowStyle = new GUIStyle(GUI.skin.window);
			_windowStyle.normal.background = MakeTex(1, 1, col);
			_windowStyle.onNormal.background = _windowStyle.normal.background;
			_windowStyle.normal.textColor = 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, val);
			_buttonStyle.hover.background = MakeTex(1, 1, col2);
			_buttonStyle.active.background = MakeTex(1, 1, col3);
			_buttonStyle.normal.textColor = white;
			_buttonStyle.hover.textColor = white;
			_buttonStyle.active.textColor = white;
			_buttonStyle.fontSize = 14;
			_buttonStyle.fontStyle = (FontStyle)1;
			_buttonStyle.padding = new RectOffset(10, 10, 8, 8);
			_buttonStyle.margin = new RectOffset(4, 4, 4, 4);
			_buttonStyle.border = new RectOffset(2, 2, 2, 2);
			_selectedButtonStyle = new GUIStyle(_buttonStyle);
			_selectedButtonStyle.normal.background = MakeTex(1, 1, col2);
			_selectedButtonStyle.hover.background = MakeTex(1, 1, col3);
			_labelStyle = new GUIStyle(GUI.skin.label);
			_labelStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f, 1f);
			_labelStyle.fontSize = 16;
			_labelStyle.alignment = (TextAnchor)3;
			_tooltipStyle = new GUIStyle(GUI.skin.box);
			_tooltipStyle.normal.background = MakeTexWithBorder(8, 8, val, borderColor, 1);
			_tooltipStyle.border = new RectOffset(3, 3, 3, 3);
			_tooltipStyle.normal.textColor = white;
			_tooltipStyle.alignment = (TextAnchor)0;
			_tooltipStyle.padding = new RectOffset(8, 8, 8, 8);
			_tooltipStyle.wordWrap = true;
		}

		private Texture2D MakeTexWithBorder(int width, int height, Color backgroundColor, Color borderColor, int borderThickness)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			//IL_0048: 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)
			Texture2D val = new Texture2D(width, height);
			for (int i = 0; i < height; i++)
			{
				for (int j = 0; j < width; j++)
				{
					if (j < borderThickness || j >= width - borderThickness || i < borderThickness || i >= height - borderThickness)
					{
						val.SetPixel(j, i, borderColor);
					}
					else
					{
						val.SetPixel(j, i, backgroundColor);
					}
				}
			}
			val.Apply();
			return val;
		}

		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, 10f));
			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)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			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>());
				if ((Object)(object)val.sashSprite != (Object)null && (Object)(object)val.sashSprite.texture != (Object)null)
				{
					GUIContent val2 = new GUIContent((Texture)(object)val.sashSprite.texture, "<b>Reward:</b> " + val.localizedReward);
					GUILayout.Label(val2, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(48f),
						GUILayout.Height(48f)
					});
				}
				else
				{
					GUILayout.Space(56f);
				}
				string text = (flag ? " <color=green>(Unlocked)</color>" : " <color=red>(Locked)</color>");
				_labelStyle.richText = true;
				GUILayout.Label(val.localizedTitle + " " + text, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(210f),
					GUILayout.Height(48f)
				});
				_labelStyle.richText = false;
				if (flag)
				{
					if (GUILayout.Button("Lock", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Width(100f),
						GUILayout.Height(48f)
					}))
					{
						int ascentLevel = Math.Max(0, i - 1);
						SetAscentLevel(ascentLevel);
					}
				}
				else if (GUILayout.Button("Unlock", _buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(100f),
					GUILayout.Height(48f)
				}))
				{
					SetAscentLevel(i);
				}
				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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Click on a badge to remove/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);
			foreach (BadgeData item in enumerable)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				List<CustomizationOption> source = Singleton<Customization>.Instance.TryGetUnlockedCosmetics(item);
				CustomizationOption val = source.FirstOrDefault();
				if ((Object)(object)val != (Object)null && (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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_01a7: 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);
			foreach (BadgeData item in enumerable)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				List<CustomizationOption> source = Singleton<Customization>.Instance.TryGetUnlockedCosmetics(item);
				CustomizationOption val = source.FirstOrDefault();
				if ((Object)(object)val != (Object)null && (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 status and UI...");
			if ((Object)(object)Character.localCharacter != (Object)null && (Object)(object)Character.localCharacter.data != (Object)null)
			{
				Character.localCharacter.data.SetBadgeStatus();
			}
			if ((Object)(object)GUIManager.instance != (Object)null && (Object)(object)GUIManager.instance.mainBadgeManager != (Object)null)
			{
				((MonoBehaviour)GUIManager.instance.mainBadgeManager).Invoke("InitBadges", 0f);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Badge status and UI refresh complete.");
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}