Decompiled source of BetterCards v1.2.2

plugins/BetterCards.dll

Decompiled a day 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 System.Text;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppSystem.Reflection;
using Nosebleed.Pancake.GameConfig;
using Nosebleed.Pancake.Modal;
using Nosebleed.Pancake.Models;
using Nosebleed.Pancake.View;
using TMPro;
using UnityEngine;
using UnityEngine.Localization;
using UnityEngine.Localization.Settings;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BetterCards")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+54237db3af257956b72ee3ee66255ca88cb082ba")]
[assembly: AssemblyProduct("BetterCards")]
[assembly: AssemblyTitle("BetterCards")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BetterCards;

[BepInPlugin("com.tovak.vc.bettercards", "BetterCards", "1.2.2")]
public class Plugin : BasePlugin
{
	internal static ManualLogSource Log;

	internal static string CurrentLangCode = "";

	internal static bool LocaleRebuildPending = false;

	public override void Load()
	{
		//IL_0015: 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)
		//IL_0020: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Expected O, but got Unknown
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BasePlugin)this).Log;
		ClassInjector.RegisterTypeInIl2Cpp<ComboObserver>();
		GameObject val = new GameObject("BetterCards");
		Object.DontDestroyOnLoad((Object)val);
		val.AddComponent<ComboObserver>();
		try
		{
			Locale selectedLocale = LocalizationSettings.SelectedLocale;
			if ((Object)(object)selectedLocale != (Object)null)
			{
				CurrentLangCode = (selectedLocale.Identifier.Code ?? "").ToLowerInvariant();
			}
		}
		catch
		{
		}
		try
		{
			new Harmony("com.tovak.vc.bettercards").PatchAll(typeof(LocalePatch));
		}
		catch (Exception ex)
		{
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[BetterCards] harmony error: ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
			}
			log.LogWarning(val2);
		}
		Log.LogInfo((object)"BetterCards chargé !");
	}
}
[HarmonyPatch(typeof(LocalizationSettings), "SetSelectedLocale")]
public static class LocalePatch
{
	public static void Postfix(Locale locale)
	{
		try
		{
			string text = "";
			if ((Object)(object)locale != (Object)null)
			{
				text = (locale.Identifier.Code ?? "").ToLowerInvariant();
			}
			if (text != Plugin.CurrentLangCode)
			{
				Plugin.CurrentLangCode = text;
				Plugin.LocaleRebuildPending = true;
			}
		}
		catch
		{
		}
	}
}
public class ComboObserver : MonoBehaviour
{
	internal class AnimBadge
	{
		public Transform ring;

		public Transform shine;
	}

	private bool _wasOpen;

	private string _lastCardSignature = "";

	private ChooseCardModal _cachedModal;

	private int _searchCooldown;

	private DeckBoxModal _cachedDeckModal;

	private int _deckSearchCooldown;

	private int _deckAliveCheck;

	private bool _wasDeckOpen;

	private PlayerModel _cachedPlayerModel;

	private GameObject _deckOverlay;

	private GameObject _chooseCardOverlay;

	private bool _deckOverlayPending;

	private Dictionary<int, int> _pendingCostGroups;

	private Transform _cachedScrollView;

	private RectTransform _cachedScrollRT;

	private RectTransform _cachedDeckViewRT;

	private Il2CppStructArray<Vector3> _cornersBuf;

	private int _overlayStabilizeFrames;

	private bool _deckOverlayFixed;

	private int _levelupReopenDelay;

	private int _lastOverlayTotal;

	private bool _pendingLevelupClose;

	private int _overlayCardCount;

	private int _cardCountCheckTimer;

	private static readonly Dictionary<int, Sprite> _manaOrbSprites = new Dictionary<int, Sprite>();

	private static readonly Dictionary<int, Color> _manaOrbColors = new Dictionary<int, Color>();

	private static Sprite _arcSprite = null;

	private static Sprite _modalFrameSprite = null;

	private const int WILD_KEY = -99;

	private const int XMANA_KEY = -98;

	private const string BadgeName = "VCComboBadge";

	private static Sprite _ringSpriteRainbow;

	private static Sprite _ringSpriteSilver;

	private static Sprite _evoTextSprite;

	private static Sprite _shineSprite;

	private static Sprite _checkmarkSprite;

	private const string CountBadgeName = "VCCountBadge";

	private static Sprite _newBadgeSprite;

	private static readonly Sprite[] _countBadgeCache = (Sprite[])(object)new Sprite[10];

	private static readonly byte[][][] GlyphsNEW = new byte[3][][]
	{
		new byte[7][]
		{
			new byte[5] { 1, 0, 0, 0, 1 },
			new byte[5] { 1, 1, 0, 0, 1 },
			new byte[5] { 1, 1, 0, 0, 1 },
			new byte[5] { 1, 0, 1, 0, 1 },
			new byte[5] { 1, 0, 0, 1, 1 },
			new byte[5] { 1, 0, 0, 1, 1 },
			new byte[5] { 1, 0, 0, 0, 1 }
		},
		new byte[7][]
		{
			new byte[5] { 1, 1, 1, 1, 1 },
			new byte[5] { 1, 0, 0, 0, 0 },
			new byte[5] { 1, 0, 0, 0, 0 },
			new byte[5] { 1, 1, 1, 1, 0 },
			new byte[5] { 1, 0, 0, 0, 0 },
			new byte[5] { 1, 0, 0, 0, 0 },
			new byte[5] { 1, 1, 1, 1, 1 }
		},
		new byte[7][]
		{
			new byte[5] { 1, 0, 0, 0, 1 },
			new byte[5] { 1, 0, 0, 0, 1 },
			new byte[5] { 1, 0, 0, 0, 1 },
			new byte[5] { 1, 0, 1, 0, 1 },
			new byte[5] { 1, 0, 1, 0, 1 },
			new byte[5] { 0, 1, 0, 1, 0 },
			new byte[5] { 0, 1, 0, 1, 0 }
		}
	};

	private static readonly byte[][] GlyphTimes = new byte[3][]
	{
		new byte[3] { 1, 0, 1 },
		new byte[3] { 0, 1, 0 },
		new byte[3] { 1, 0, 1 }
	};

	private static readonly byte[][][] GlyphsDigits = new byte[10][][]
	{
		new byte[5][]
		{
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 0, 1, 0 }
		},
		new byte[5][]
		{
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 1, 0 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 1, 1 }
		},
		new byte[5][]
		{
			new byte[3] { 1, 1, 0 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 0, 0 },
			new byte[3] { 1, 1, 1 }
		},
		new byte[5][]
		{
			new byte[3] { 1, 1, 0 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 1, 1, 0 }
		},
		new byte[5][]
		{
			new byte[3] { 1, 0, 1 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 1, 1, 1 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 0, 0, 1 }
		},
		new byte[5][]
		{
			new byte[3] { 1, 1, 1 },
			new byte[3] { 1, 0, 0 },
			new byte[3] { 1, 1, 0 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 1, 1, 0 }
		},
		new byte[5][]
		{
			new byte[3] { 0, 1, 1 },
			new byte[3] { 1, 0, 0 },
			new byte[3] { 1, 1, 0 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 0, 1, 0 }
		},
		new byte[5][]
		{
			new byte[3] { 1, 1, 1 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 0, 1, 0 }
		},
		new byte[5][]
		{
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 0, 1, 0 }
		},
		new byte[5][]
		{
			new byte[3] { 0, 1, 0 },
			new byte[3] { 1, 0, 1 },
			new byte[3] { 0, 1, 1 },
			new byte[3] { 0, 0, 1 },
			new byte[3] { 0, 1, 0 }
		}
	};

	internal static readonly List<AnimBadge> _animBadges = new List<AnimBadge>();

	public ComboObserver(IntPtr ptr)
		: base(ptr)
	{
	}

	public void Awake()
	{
	}

	private static string GetCardSignature(ChooseCardModal modal)
	{
		List<CardChoiceView> cardChoiceViews = modal._cardChoiceViews;
		if (cardChoiceViews == null)
		{
			return "";
		}
		StringBuilder stringBuilder = new StringBuilder();
		Enumerator<CardChoiceView> enumerator = cardChoiceViews.GetEnumerator();
		while (enumerator.MoveNext())
		{
			CardChoiceView current = enumerator.Current;
			object obj;
			if (current == null)
			{
				obj = null;
			}
			else
			{
				CardConfig cardConfig = current.CardConfig;
				obj = ((cardConfig != null) ? ((Object)cardConfig).name : null);
			}
			if (obj == null)
			{
				obj = "null";
			}
			stringBuilder.Append((string?)obj).Append("|");
		}
		return stringBuilder.ToString();
	}

	public void Update()
	{
		//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ad: Expected O, but got Unknown
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0703: Unknown result type (might be due to invalid IL or missing references)
		//IL_070d: Unknown result type (might be due to invalid IL or missing references)
		//IL_071b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_044c: Unknown result type (might be due to invalid IL or missing references)
		//IL_045d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0771: Unknown result type (might be due to invalid IL or missing references)
		//IL_0476: Unknown result type (might be due to invalid IL or missing references)
		//IL_0784: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_080a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0819: Unknown result type (might be due to invalid IL or missing references)
		//IL_0826: Unknown result type (might be due to invalid IL or missing references)
		//IL_0839: Unknown result type (might be due to invalid IL or missing references)
		//IL_083e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0840: Unknown result type (might be due to invalid IL or missing references)
		//IL_0845: Unknown result type (might be due to invalid IL or missing references)
		//IL_084d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0860: Unknown result type (might be due to invalid IL or missing references)
		//IL_086c: Unknown result type (might be due to invalid IL or missing references)
		//IL_087a: Unknown result type (might be due to invalid IL or missing references)
		//IL_088f: Unknown result type (might be due to invalid IL or missing references)
		if (_animBadges.Count > 0)
		{
			float unscaledTime = Time.unscaledTime;
			float num = unscaledTime * 35f % 360f;
			float num2 = unscaledTime * -120f % 360f;
			for (int num3 = _animBadges.Count - 1; num3 >= 0; num3--)
			{
				AnimBadge animBadge = _animBadges[num3];
				if (animBadge == null || (Object)(object)animBadge.ring == (Object)null)
				{
					_animBadges.RemoveAt(num3);
				}
				else
				{
					try
					{
						animBadge.ring.localEulerAngles = new Vector3(0f, 0f, num);
						if ((Object)(object)animBadge.shine != (Object)null)
						{
							animBadge.shine.localEulerAngles = new Vector3(0f, 0f, num2);
						}
					}
					catch
					{
						_animBadges.RemoveAt(num3);
					}
				}
			}
		}
		if ((Object)(object)_cachedModal == (Object)null)
		{
			if (--_searchCooldown > 0)
			{
				return;
			}
			_searchCooldown = 20;
			_cachedModal = Object.FindObjectOfType<ChooseCardModal>();
		}
		ChooseCardModal cachedModal = _cachedModal;
		bool flag = (Object)(object)cachedModal != (Object)null && ((Modal)cachedModal).IsOpen;
		if (flag)
		{
			string cardSignature = GetCardSignature(cachedModal);
			if (!_wasOpen || cardSignature != _lastCardSignature)
			{
				_lastCardSignature = cardSignature;
				OnModalOpened(cachedModal);
			}
		}
		else
		{
			_lastCardSignature = "";
			if (_wasOpen)
			{
				if ((Object)(object)_chooseCardOverlay != (Object)null)
				{
					Object.Destroy((Object)(object)_chooseCardOverlay);
					_chooseCardOverlay = null;
				}
				_cachedModal = null;
				_pendingLevelupClose = true;
				if ((Object)(object)_cachedDeckModal != (Object)null)
				{
					_levelupReopenDelay = 60;
				}
			}
		}
		_wasOpen = flag;
		if ((Object)(object)_cachedDeckModal == (Object)null && --_deckSearchCooldown <= 0)
		{
			_deckSearchCooldown = 20;
			_cachedDeckModal = Object.FindObjectOfType<DeckBoxModal>();
			if ((Object)(object)_cachedDeckModal != (Object)null)
			{
				_cachedScrollView = null;
				_cachedScrollRT = null;
				_cachedDeckViewRT = null;
				_deckAliveCheck = 0;
				_wasDeckOpen = false;
				if (_pendingLevelupClose && _levelupReopenDelay == 0)
				{
					_levelupReopenDelay = 60;
					_pendingLevelupClose = false;
				}
			}
		}
		if ((Object)(object)_cachedDeckModal != (Object)null)
		{
			if (_overlayStabilizeFrames > 0)
			{
				_overlayStabilizeFrames--;
			}
			if (Plugin.LocaleRebuildPending)
			{
				Plugin.LocaleRebuildPending = false;
				if ((Object)(object)_deckOverlay != (Object)null)
				{
					Object.Destroy((Object)(object)_deckOverlay);
					_deckOverlay = null;
				}
				_deckOverlayFixed = false;
				_deckOverlayPending = false;
				_pendingCostGroups = null;
				_overlayStabilizeFrames = 0;
				if (((Modal)_cachedDeckModal).IsOpen && !flag)
				{
					OnDeckBoxOpened(_cachedDeckModal, "locale-change");
				}
			}
			if (_levelupReopenDelay > 0 && !flag && --_levelupReopenDelay == 0)
			{
				OnDeckBoxOpened(_cachedDeckModal, "levelup-close");
			}
			bool isOpen = ((Modal)_cachedDeckModal).IsOpen;
			if (isOpen && !_wasDeckOpen && !_deckOverlayPending && !flag)
			{
				OnDeckBoxOpened(_cachedDeckModal, "open-transition");
			}
			_wasDeckOpen = isOpen;
			if ((Object)(object)_cachedScrollView == (Object)null)
			{
				Transform val = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "AdjustableScrollView", 10);
				if ((Object)(object)val != (Object)null)
				{
					_cachedScrollView = val;
					_cachedScrollRT = ((Component)val).GetComponent<RectTransform>();
				}
			}
			if ((Object)(object)_cachedDeckViewRT == (Object)null)
			{
				Transform val2 = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "DeckView");
				if ((Object)(object)val2 != (Object)null)
				{
					_cachedDeckViewRT = ((Component)val2).GetComponent<RectTransform>();
				}
			}
			if ((Object)(object)_deckOverlay != (Object)null && (Object)(object)_cachedScrollRT != (Object)null && (Object)(object)_cachedDeckViewRT != (Object)null && !_deckOverlayFixed)
			{
				if (_cornersBuf == null)
				{
					_cornersBuf = new Il2CppStructArray<Vector3>(4L);
				}
				_cachedScrollRT.GetWorldCorners(_cornersBuf);
				Vector2 zero = Vector2.zero;
				if (RectTransformUtility.ScreenPointToLocalPointInRectangle(_cachedDeckViewRT, new Vector2(((Il2CppArrayBase<Vector3>)(object)_cornersBuf)[0].x, ((Il2CppArrayBase<Vector3>)(object)_cornersBuf)[0].y), (Camera)null, ref zero))
				{
					float num4 = zero.y - 5f - 75f;
					RectTransform component = _deckOverlay.GetComponent<RectTransform>();
					if ((Object)(object)component != (Object)null && Mathf.Abs(component.anchoredPosition.y - num4) > 0.5f)
					{
						component.anchoredPosition = new Vector2(0f, num4);
					}
				}
			}
			if (flag && (Object)(object)_deckOverlay != (Object)null)
			{
				Object.Destroy((Object)(object)_deckOverlay);
				_deckOverlay = null;
			}
			if ((Object)(object)_deckOverlay != (Object)null && isOpen && _levelupReopenDelay == 0 && ++_cardCountCheckTimer >= 30)
			{
				_cardCountCheckTimer = 0;
				Transform val3 = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "CardContainer", 10);
				if ((Object)(object)val3 != (Object)null && val3.childCount != _overlayCardCount)
				{
					_levelupReopenDelay = 90;
				}
			}
			if (++_deckAliveCheck >= 30)
			{
				_deckAliveCheck = 0;
				if ((Object)(object)Object.FindObjectOfType<DeckBoxModal>() == (Object)null)
				{
					if ((Object)(object)_deckOverlay != (Object)null)
					{
						Object.Destroy((Object)(object)_deckOverlay);
						_deckOverlay = null;
					}
					_cachedDeckModal = null;
					_cachedScrollView = null;
					_cachedScrollRT = null;
					_cachedDeckViewRT = null;
					_deckOverlayFixed = false;
					_deckOverlayPending = false;
					_pendingCostGroups = null;
					_wasDeckOpen = false;
					_levelupReopenDelay = 0;
					_lastOverlayTotal = 0;
					_overlayCardCount = 0;
					_cardCountCheckTimer = 0;
				}
			}
		}
		if (!_deckOverlayPending || !((Object)(object)_cachedDeckModal != (Object)null) || _pendingCostGroups == null)
		{
			return;
		}
		_deckOverlayPending = false;
		if (!flag)
		{
			float yOffset = -340f;
			float xOffset = 0f;
			bool flag2 = false;
			try
			{
				Transform val4 = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "DeckView");
				Transform val5 = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "AdjustableScrollView", 10);
				if ((Object)(object)val5 != (Object)null && (Object)(object)val4 != (Object)null)
				{
					Canvas.ForceUpdateCanvases();
					RectTransform component2 = ((Component)val5).GetComponent<RectTransform>();
					RectTransform component3 = ((Component)val4).GetComponent<RectTransform>();
					if ((Object)(object)component2 != (Object)null && (Object)(object)component3 != (Object)null)
					{
						Il2CppStructArray<Vector3> val6 = new Il2CppStructArray<Vector3>(4L);
						component2.GetWorldCorners(val6);
						Vector2 zero2 = Vector2.zero;
						RectTransformUtility.ScreenPointToLocalPointInRectangle(component3, new Vector2(((Il2CppArrayBase<Vector3>)(object)val6)[0].x, ((Il2CppArrayBase<Vector3>)(object)val6)[0].y), (Camera)null, ref zero2);
						float num5 = zero2.y - 5f - 75f;
						float num6 = num5 - 75f;
						float num7 = 540f;
						Transform obj2 = FindCanvasTransform(((Component)_cachedDeckModal).gameObject.transform);
						RectTransform val7 = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null);
						if ((Object)(object)val7 != (Object)null && val7.sizeDelta.y > 0f)
						{
							num7 = val7.sizeDelta.y / 2f;
						}
						int num8 = 0;
						Transform val8 = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "CardContainer", 10);
						if ((Object)(object)val8 != (Object)null)
						{
							num8 = val8.childCount;
						}
						flag2 = num8 > 10 || num6 < 0f - (num7 + 10f);
						if (!flag2)
						{
							float num9 = 0f - (num7 - 75f - 4f);
							yOffset = Mathf.Max(num5, num9);
						}
						else
						{
							float x = ((Il2CppArrayBase<Vector3>)(object)val6)[2].x;
							float num10 = (((Il2CppArrayBase<Vector3>)(object)val6)[0].y + ((Il2CppArrayBase<Vector3>)(object)val6)[1].y) / 2f;
							Vector2 zero3 = Vector2.zero;
							Vector2 zero4 = Vector2.zero;
							RectTransformUtility.ScreenPointToLocalPointInRectangle(component3, new Vector2(x, num10), (Camera)null, ref zero3);
							RectTransformUtility.ScreenPointToLocalPointInRectangle(component3, new Vector2(((Il2CppArrayBase<Vector3>)(object)val6)[0].x, num10), (Camera)null, ref zero4);
							xOffset = zero3.x + 20f + 120f;
							yOffset = zero4.y;
						}
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = Plugin.Log;
				bool flag3 = default(bool);
				BepInExWarningLogInterpolatedStringHandler val9 = new BepInExWarningLogInterpolatedStringHandler(21, 1, ref flag3);
				if (flag3)
				{
					((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("[DeckBox] pos error: ");
					((BepInExLogInterpolatedStringHandler)val9).AppendFormatted<string>(ex.Message);
				}
				log.LogWarning(val9);
			}
			if ((Object)(object)_deckOverlay != (Object)null)
			{
				Object.Destroy((Object)(object)_deckOverlay);
				_deckOverlay = null;
			}
			_deckOverlay = CreateManaPanel(((Component)_cachedDeckModal).gameObject, _pendingCostGroups, yOffset, xOffset, flag2);
			_deckOverlayFixed = flag2;
			_overlayStabilizeFrames = 30;
			Transform val10 = FindNamedChild(((Component)_cachedDeckModal).gameObject.transform, "CardContainer", 10);
			_overlayCardCount = (((Object)(object)val10 != (Object)null) ? val10.childCount : 0);
			_cardCountCheckTimer = 0;
		}
		_pendingCostGroups = null;
	}

	private static void TryCacheManaIcons(List<CardChoiceView> views)
	{
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Invalid comparison between Unknown and I4
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		Enumerator<CardChoiceView> enumerator = views.GetEnumerator();
		while (enumerator.MoveNext())
		{
			CardChoiceView current = enumerator.Current;
			CardConfig val = ((current != null) ? current.CardConfig : null);
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			int manaCost = val.manaCost;
			if (!_manaOrbSprites.ContainsKey(manaCost))
			{
				Transform obj = FindNamedChild(((Component)current).gameObject.transform, "_manaComboElementOrb", 15);
				Image val2 = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null);
				if ((Object)(object)((val2 != null) ? val2.sprite : null) != (Object)null)
				{
					_manaOrbSprites[manaCost] = val2.sprite;
					_manaOrbColors[manaCost] = ((Graphic)val2).color;
				}
			}
			if ((Object)(object)_arcSprite == (Object)null)
			{
				Transform obj2 = FindNamedChild(((Component)current).gameObject.transform, "_manaComboElement", 15);
				Image val3 = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null);
				if ((Object)(object)((val3 != null) ? val3.sprite : null) != (Object)null)
				{
					_arcSprite = val3.sprite;
				}
			}
			if ((Object)(object)_modalFrameSprite == (Object)null && ((Component)current).gameObject.transform.childCount > 0)
			{
				Image component = ((Component)((Component)current).gameObject.transform.GetChild(0)).GetComponent<Image>();
				if ((Object)(object)component != (Object)null && (int)component.type == 1 && (Object)(object)component.sprite != (Object)null)
				{
					_modalFrameSprite = component.sprite;
				}
			}
		}
	}

	private void OnDeckBoxOpened(DeckBoxModal modal, string reason = "")
	{
		//IL_0631: Unknown result type (might be due to invalid IL or missing references)
		//IL_0638: Expected O, but got Unknown
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: Invalid comparison between Unknown and I4
		//IL_0367: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (_overlayStabilizeFrames > 0 && reason == "open-transition")
			{
				return;
			}
			if ((Object)(object)_deckOverlay != (Object)null)
			{
				Object.Destroy((Object)(object)_deckOverlay);
				_deckOverlay = null;
			}
			if ((Object)(object)_cachedModal != (Object)null && ((Modal)_cachedModal).IsOpen)
			{
				return;
			}
			Transform val = FindNamedChild(((Component)modal).gameObject.transform, "CardContainer", 10);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log.LogWarning((object)"[DeckBox] CardContainer null");
				return;
			}
			if ((Object)(object)_modalFrameSprite != (Object)null)
			{
				string name = ((Object)_modalFrameSprite).name;
				if (name != null && name.StartsWith("frame", StringComparison.OrdinalIgnoreCase))
				{
					goto IL_00e3;
				}
			}
			Sprite val2 = FindFrameSpriteRecursive(((Component)modal).gameObject.transform, 15);
			if ((Object)(object)val2 != (Object)null)
			{
				_modalFrameSprite = val2;
			}
			goto IL_00e3;
			IL_00e3:
			Dictionary<int, int> dictionary = new Dictionary<int, int>();
			for (int i = 0; i < val.childCount; i++)
			{
				Transform child = val.GetChild(i);
				CardSelectionCardView component = ((Component)child).GetComponent<CardSelectionCardView>();
				CardConfig val3 = null;
				CardModel val4 = null;
				CardView val5 = null;
				if ((Object)(object)component != (Object)null)
				{
					try
					{
						MethodInfo method = ((Object)component).GetIl2CppType().GetMethod("get_CardModel");
						Object val6 = ((method != null) ? ((MethodBase)method).Invoke((Object)(object)component, (Il2CppReferenceArray<Object>)null) : null);
						if (val6 != null)
						{
							val4 = ((Il2CppObjectBase)val6).TryCast<CardModel>();
							if ((Object)(object)val4 != (Object)null)
							{
								val3 = val4.CardConfig;
								try
								{
									val5 = val4.CardView;
								}
								catch
								{
								}
							}
						}
					}
					catch
					{
					}
				}
				if ((Object)(object)val5 != (Object)null)
				{
					try
					{
						CardConfig appliedCardConfig = val5._appliedCardConfig;
						if ((Object)(object)appliedCardConfig != (Object)null)
						{
							val3 = appliedCardConfig;
						}
					}
					catch
					{
					}
				}
				string text = ((val3 != null) ? ((Object)val3).name : null) ?? FindCardConfigName(child);
				if (text == null)
				{
					continue;
				}
				int num = text.IndexOf("(Clone)", StringComparison.Ordinal);
				if (num > 0)
				{
					text = text.Substring(0, num).TrimEnd();
				}
				string[] array = text.Split('_');
				if (array.Length >= 2 && array[1].ToUpperInvariant() == "C")
				{
					continue;
				}
				bool num2 = array.Length == 3 || (array.Length >= 2 && array[1].ToUpperInvariant() == "E");
				int cost = -999;
				if (num2)
				{
					cost = -99;
				}
				else
				{
					if ((Object)(object)val5 != (Object)null)
					{
						try
						{
							TMP_Text costText = val5._costText;
							if ((Object)(object)costText != (Object)null)
							{
								TryParseCostText(costText.text, out cost);
							}
						}
						catch
						{
						}
					}
					if (cost == -999 && (Object)(object)val4 != (Object)null)
					{
						try
						{
							cost = val4.GetCardCostTypeManaCost(false);
						}
						catch
						{
							cost = -999;
						}
					}
					if (cost == -999 && (Object)(object)val3 != (Object)null)
					{
						cost = val3.manaCost;
					}
					if (cost == -999)
					{
						continue;
					}
					if (cost == -99 && (Object)(object)val4 != (Object)null)
					{
						TryCacheWildSpriteFromModel(val4);
					}
				}
				if (!_manaOrbSprites.ContainsKey(cost))
				{
					Transform val7 = ((cost != -99) ? FindNamedChild(child, "_manaComboElementOrb", 15) : (FindNamedChild(child, "_W_cardCostBackgroundElement", 15) ?? FindNamedChild(child, "_manaComboElementOrb", 15)));
					Image val8 = ((val7 != null) ? ((Component)val7).GetComponent<Image>() : null);
					if ((Object)(object)((val8 != null) ? val8.sprite : null) != (Object)null)
					{
						_manaOrbSprites[cost] = val8.sprite;
						_manaOrbColors[cost] = ((Graphic)val8).color;
					}
				}
				if ((Object)(object)_modalFrameSprite == (Object)null && child.childCount > 0)
				{
					Image component2 = ((Component)child.GetChild(0)).GetComponent<Image>();
					if ((Object)(object)component2 != (Object)null && (int)component2.type == 1 && (Object)(object)component2.sprite != (Object)null)
					{
						_modalFrameSprite = component2.sprite;
					}
				}
				dictionary[cost] = ((!dictionary.TryGetValue(cost, out var value)) ? 1 : (value + 1));
			}
			if ((Object)(object)_cachedPlayerModel == (Object)null)
			{
				_cachedPlayerModel = Object.FindObjectOfType<PlayerModel>();
			}
			Dictionary<int, int> dictionary2 = new Dictionary<int, int>();
			PlayerModel cachedPlayerModel = _cachedPlayerModel;
			List<CardModel> val9 = ((cachedPlayerModel != null) ? cachedPlayerModel._allCards : null);
			if (val9 != null)
			{
				Enumerator<CardModel> enumerator = val9.GetEnumerator();
				while (enumerator.MoveNext())
				{
					CardModel current = enumerator.Current;
					CardConfig val10 = ((current != null) ? current.CardConfig : null);
					if ((Object)(object)val10 == (Object)null || ((Object)val10).name == null || !((Object)val10).name.StartsWith("Card_"))
					{
						continue;
					}
					try
					{
						CardView cardView = current.CardView;
						CardConfig val11 = ((cardView != null) ? cardView._appliedCardConfig : null);
						if ((Object)(object)val11 != (Object)null)
						{
							val10 = val11;
						}
					}
					catch
					{
					}
					string[] array2 = ((Object)val10).name.Split('_');
					if (array2.Length >= 2 && array2[1].ToUpperInvariant() == "C")
					{
						continue;
					}
					bool num3 = array2.Length == 3 || (array2.Length >= 2 && array2[1].ToUpperInvariant() == "E");
					int cost2 = -999;
					if (num3)
					{
						cost2 = -99;
						TryCacheWildSpriteFromModel(current);
					}
					else
					{
						try
						{
							CardView cardView2 = current.CardView;
							TMP_Text val12 = ((cardView2 != null) ? cardView2._costText : null);
							if ((Object)(object)val12 != (Object)null)
							{
								TryParseCostText(val12.text, out cost2);
							}
						}
						catch
						{
						}
						if (cost2 == -999)
						{
							try
							{
								cost2 = current.GetCardCostTypeManaCost(false);
							}
							catch
							{
								cost2 = -999;
							}
						}
						if (cost2 == -999)
						{
							cost2 = val10.manaCost;
						}
						switch (cost2)
						{
						case -99:
							TryCacheWildSpriteFromModel(current);
							break;
						default:
							TryCacheOrbSpriteFromModel(current, cost2);
							break;
						case -98:
							break;
						}
					}
					dictionary2[cost2] = ((!dictionary2.TryGetValue(cost2, out var value2)) ? 1 : (value2 + 1));
				}
			}
			if (dictionary2.Count == 0)
			{
				dictionary2 = dictionary;
			}
			if (dictionary2.Count == 0)
			{
				Plugin.Log.LogWarning((object)"[DeckBox] costGroups vide");
				return;
			}
			int num4 = dictionary2.Values.Sum();
			if (!(reason == "levelup-close") || num4 >= _lastOverlayTotal)
			{
				_lastOverlayTotal = num4;
				_pendingCostGroups = dictionary2;
				_deckOverlayPending = true;
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log = Plugin.Log;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val13 = new BepInExErrorLogInterpolatedStringHandler(10, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val13).AppendLiteral("[DeckBox] ");
				((BepInExLogInterpolatedStringHandler)val13).AppendFormatted<Exception>(ex);
			}
			log.LogError(val13);
		}
	}

	private static void TryCacheWildSpriteFromModel(CardModel cm)
	{
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)cm == (Object)null || _manaOrbSprites.ContainsKey(-99))
		{
			return;
		}
		try
		{
			CardView cardView = cm.CardView;
			if ((Object)(object)cardView == (Object)null)
			{
				return;
			}
			GameObject gameObject = ((Component)cardView).gameObject;
			Transform val = ((gameObject != null) ? gameObject.transform : null);
			if (!((Object)(object)val == (Object)null))
			{
				Transform obj = FindNamedChild(val, "_W_cardCostBackgroundElement", 15) ?? FindNamedChild(val, "_manaComboElementOrb", 15);
				Image val2 = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null);
				if ((Object)(object)((val2 != null) ? val2.sprite : null) != (Object)null)
				{
					_manaOrbSprites[-99] = val2.sprite;
					_manaOrbColors[-99] = ((Graphic)val2).color;
				}
			}
		}
		catch
		{
		}
	}

	private static void TryCacheOrbSpriteFromModel(CardModel cm, int cost)
	{
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)cm == (Object)null || _manaOrbSprites.ContainsKey(cost))
		{
			return;
		}
		try
		{
			CardView cardView = cm.CardView;
			if ((Object)(object)cardView == (Object)null)
			{
				return;
			}
			GameObject gameObject = ((Component)cardView).gameObject;
			Transform val = ((gameObject != null) ? gameObject.transform : null);
			if (!((Object)(object)val == (Object)null))
			{
				Transform obj = FindNamedChild(val, "_manaComboElementOrb", 15);
				Image val2 = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null);
				if ((Object)(object)((val2 != null) ? val2.sprite : null) != (Object)null)
				{
					_manaOrbSprites[cost] = val2.sprite;
					_manaOrbColors[cost] = ((Graphic)val2).color;
				}
			}
		}
		catch
		{
		}
	}

	private static bool TryParseCostText(string txt, out int cost)
	{
		cost = -999;
		if (string.IsNullOrEmpty(txt))
		{
			return false;
		}
		txt = txt.Trim();
		if (int.TryParse(txt, out var result))
		{
			cost = result;
			return true;
		}
		if (txt.Equals("W", StringComparison.OrdinalIgnoreCase) || txt.Equals("U", StringComparison.OrdinalIgnoreCase))
		{
			cost = -99;
			return true;
		}
		if (txt.Equals("X", StringComparison.OrdinalIgnoreCase))
		{
			cost = -98;
			return true;
		}
		return false;
	}

	private static Sprite FindFrameSpriteRecursive(Transform t, int maxDepth)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Invalid comparison between Unknown and I4
		if (maxDepth <= 0)
		{
			return null;
		}
		Image component = ((Component)t).GetComponent<Image>();
		if ((Object)(object)component != (Object)null && (int)component.type == 1 && (Object)(object)component.sprite != (Object)null && (((Object)component.sprite).name ?? "").StartsWith("frame", StringComparison.OrdinalIgnoreCase))
		{
			return component.sprite;
		}
		for (int i = 0; i < t.childCount; i++)
		{
			Sprite val = FindFrameSpriteRecursive(t.GetChild(i), maxDepth - 1);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private static Transform FindNamedChild(Transform t, string name, int maxDepth = 5)
	{
		if (maxDepth <= 0)
		{
			return null;
		}
		for (int i = 0; i < t.childCount; i++)
		{
			Transform child = t.GetChild(i);
			if (((Object)child).name == name)
			{
				return child;
			}
			Transform val = FindNamedChild(child, name, maxDepth - 1);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private static string FindCardConfigName(Transform root, int maxDepth = 4)
	{
		if (maxDepth <= 0)
		{
			return null;
		}
		if (((Object)root).name.StartsWith("Card_"))
		{
			return ((Object)root).name;
		}
		for (int i = 0; i < root.childCount; i++)
		{
			string text = FindCardConfigName(root.GetChild(i), maxDepth - 1);
			if (text != null)
			{
				return text;
			}
		}
		return null;
	}

	private static (string main, string sub) GetCompositionLabel()
	{
		string text = Plugin.CurrentLangCode ?? "";
		if (text.StartsWith("zh"))
		{
			if (!text.Contains("hant"))
			{
				return ("牌组构成", "(不含同伴卡)");
			}
			return ("牌組構成", "(不含同伴卡)");
		}
		return ((text.Length > 0) ? text.Split('-')[0] : "") switch
		{
			"fr" => ("COMPOSITION", "(hors cartes compagnons)"), 
			"de" => ("ZUSAMMENSETZUNG", "(ohne Begleiterkarten)"), 
			"it" => ("COMPOSIZIONE", "(escl. carte compagno)"), 
			"es" => ("COMPOSICIÓN", "(excl. cartas de compañero)"), 
			"ru" => ("СОСТАВ", "(без карт спутника)"), 
			"pl" => ("SKŁAD TALII", "(bez kart towarzyszy)"), 
			"pt" => ("COMPOSIÇÃO", "(excl. cartas de companheiro)"), 
			"ja" => ("デッキ構成", "(仲間カードを除く)"), 
			"ko" => ("덱 구성", "(동료 카드 제외)"), 
			_ => ("COMPOSITION", "(excl. companion cards)"), 
		};
	}

	private static Transform FindCanvasTransform(Transform t, int maxDepth = 5)
	{
		if (maxDepth <= 0)
		{
			return null;
		}
		if ((Object)(object)((Component)t).GetComponent<Canvas>() != (Object)null && (Object)(object)((Component)t).GetComponent<RectTransform>() != (Object)null)
		{
			return t;
		}
		for (int i = 0; i < t.childCount; i++)
		{
			Transform val = FindCanvasTransform(t.GetChild(i), maxDepth - 1);
			if ((Object)(object)val != (Object)null)
			{
				return val;
			}
		}
		return null;
	}

	private static GameObject CreateManaPanel(GameObject modalGo, Dictionary<int, int> costGroups, float yOffset, float xOffset = 0f, bool vertical = false)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_125b: Unknown result type (might be due to invalid IL or missing references)
		//IL_126a: Unknown result type (might be due to invalid IL or missing references)
		//IL_126f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1281: Unknown result type (might be due to invalid IL or missing references)
		//IL_1288: Unknown result type (might be due to invalid IL or missing references)
		//IL_1293: Unknown result type (might be due to invalid IL or missing references)
		//IL_129e: Unknown result type (might be due to invalid IL or missing references)
		//IL_12a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_12a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_12ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_12cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_12da: Unknown result type (might be due to invalid IL or missing references)
		//IL_12df: Unknown result type (might be due to invalid IL or missing references)
		//IL_12f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_12f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_1303: Unknown result type (might be due to invalid IL or missing references)
		//IL_1318: Unknown result type (might be due to invalid IL or missing references)
		//IL_132c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0990: Unknown result type (might be due to invalid IL or missing references)
		//IL_099f: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_09b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_09c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_09e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a00: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: 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_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: 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_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0433: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_045c: 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_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_139b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a93: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a98: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0abb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ad0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ae5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0afa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b0e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b57: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b73: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b8a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b9b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bb0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bc5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c30: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c4c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c63: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c74: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c9e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cb3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cc7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a1c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a21: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a33: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a3a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a45: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a50: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a55: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a56: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fc: Expected O, but got Unknown
		//IL_0522: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Unknown result type (might be due to invalid IL or missing references)
		//IL_0528: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0541: Unknown result type (might be due to invalid IL or missing references)
		//IL_0550: Unknown result type (might be due to invalid IL or missing references)
		//IL_0564: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d28: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d2f: Expected O, but got Unknown
		//IL_0d55: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d5a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d5b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d62: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d74: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d83: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
		//IL_0597: Unknown result type (might be due to invalid IL or missing references)
		//IL_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05af: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0609: Unknown result type (might be due to invalid IL or missing references)
		//IL_0633: Unknown result type (might be due to invalid IL or missing references)
		//IL_0638: Unknown result type (might be due to invalid IL or missing references)
		//IL_064b: Unknown result type (might be due to invalid IL or missing references)
		//IL_065d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0662: Unknown result type (might be due to invalid IL or missing references)
		//IL_0663: Unknown result type (might be due to invalid IL or missing references)
		//IL_066a: Unknown result type (might be due to invalid IL or missing references)
		//IL_067c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0687: Unknown result type (might be due to invalid IL or missing references)
		//IL_069b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dc5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dca: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ddd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0def: Unknown result type (might be due to invalid IL or missing references)
		//IL_0df4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0df5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dfc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e0e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e19: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e2d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e67: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e76: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e8e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ea6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ead: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ebf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ed4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ee8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f12: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f17: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f2a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f3c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f41: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f42: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f49: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f5b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f66: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f7a: Unknown result type (might be due to invalid IL or missing references)
		//IL_079e: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_073b: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_107d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1082: Unknown result type (might be due to invalid IL or missing references)
		//IL_1095: Unknown result type (might be due to invalid IL or missing references)
		//IL_109c: Unknown result type (might be due to invalid IL or missing references)
		//IL_10a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_10b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_10b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_10b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_10bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_101a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fd0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fc9: Unknown result type (might be due to invalid IL or missing references)
		//IL_078f: Unknown result type (might be due to invalid IL or missing references)
		//IL_077a: Unknown result type (might be due to invalid IL or missing references)
		//IL_106e: Unknown result type (might be due to invalid IL or missing references)
		//IL_1059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0844: Unknown result type (might be due to invalid IL or missing references)
		//IL_085c: Unknown result type (might be due to invalid IL or missing references)
		//IL_086b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0870: Unknown result type (might be due to invalid IL or missing references)
		//IL_0882: Unknown result type (might be due to invalid IL or missing references)
		//IL_0894: Unknown result type (might be due to invalid IL or missing references)
		//IL_0899: Unknown result type (might be due to invalid IL or missing references)
		//IL_089a: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0932: Unknown result type (might be due to invalid IL or missing references)
		//IL_1123: Unknown result type (might be due to invalid IL or missing references)
		//IL_113b: Unknown result type (might be due to invalid IL or missing references)
		//IL_114a: Unknown result type (might be due to invalid IL or missing references)
		//IL_114f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1161: Unknown result type (might be due to invalid IL or missing references)
		//IL_1173: Unknown result type (might be due to invalid IL or missing references)
		//IL_1178: Unknown result type (might be due to invalid IL or missing references)
		//IL_1179: Unknown result type (might be due to invalid IL or missing references)
		//IL_1180: Unknown result type (might be due to invalid IL or missing references)
		//IL_1192: Unknown result type (might be due to invalid IL or missing references)
		//IL_11ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_11c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_121d: Unknown result type (might be due to invalid IL or missing references)
		object obj = FindNamedChild(modalGo.transform, "ChooseACard");
		Transform val = FindCanvasTransform(modalGo.transform);
		if (obj == null)
		{
			obj = val ?? modalGo.transform;
		}
		Transform val2 = (Transform)obj;
		GameObject val3 = new GameObject("VCManaOverlay");
		val3.layer = ((Component)val2).gameObject.layer;
		val3.transform.SetParent(val2, false);
		val3.transform.SetAsLastSibling();
		RectTransform val4 = val3.AddComponent<RectTransform>();
		val4.anchorMin = new Vector2(0.5f, 0.5f);
		val4.anchorMax = new Vector2(0.5f, 0.5f);
		val4.pivot = new Vector2(0.5f, 0.5f);
		val4.anchoredPosition = new Vector2(xOffset, yOffset);
		List<KeyValuePair<int, int>> list = costGroups.OrderBy((KeyValuePair<int, int> kv) => (kv.Key != -99) ? ((kv.Key != -98) ? kv.Key : (-2147483647)) : int.MinValue).ToList();
		bool flag = list.Count > 0;
		if (flag && vertical)
		{
			float num = 242f;
			float num2 = 70f + (float)list.Count * 96f - 8f + 14f;
			val4.sizeDelta = new Vector2(num, num2);
			GameObject val5 = new GameObject("BgFill");
			val5.transform.SetParent(val3.transform, false);
			RectTransform obj2 = val5.AddComponent<RectTransform>();
			obj2.anchorMin = Vector2.zero;
			obj2.anchorMax = Vector2.one;
			Vector2 offsetMin = (obj2.offsetMax = Vector2.zero);
			obj2.offsetMin = offsetMin;
			((Graphic)val5.AddComponent<Image>()).color = new Color(0.294f, 0.31f, 0.455f, 0.97f);
			if ((Object)(object)_modalFrameSprite != (Object)null)
			{
				GameObject val6 = new GameObject("BgFrame");
				val6.transform.SetParent(val3.transform, false);
				RectTransform obj3 = val6.AddComponent<RectTransform>();
				obj3.anchorMin = Vector2.zero;
				obj3.anchorMax = Vector2.one;
				offsetMin = (obj3.offsetMax = Vector2.zero);
				obj3.offsetMin = offsetMin;
				Image obj4 = val6.AddComponent<Image>();
				obj4.sprite = _modalFrameSprite;
				obj4.type = (Type)1;
			}
			(string main, string sub) compositionLabel = GetCompositionLabel();
			string item = compositionLabel.main;
			string item2 = compositionLabel.sub;
			GameObject val7 = new GameObject("Title");
			val7.transform.SetParent(val3.transform, false);
			RectTransform obj5 = val7.AddComponent<RectTransform>();
			obj5.anchorMin = new Vector2(0f, 1f);
			obj5.anchorMax = new Vector2(1f, 1f);
			obj5.pivot = new Vector2(0.5f, 1f);
			obj5.anchoredPosition = new Vector2(0f, -6f);
			obj5.sizeDelta = new Vector2(-8f, 26f);
			TextMeshProUGUI obj6 = val7.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj6).text = item;
			((TMP_Text)obj6).fontSize = 22f;
			((TMP_Text)obj6).fontStyle = (FontStyles)1;
			((TMP_Text)obj6).alignment = (TextAlignmentOptions)514;
			((Graphic)obj6).color = new Color(1f, 0.92f, 0.55f, 1f);
			((TMP_Text)obj6).enableWordWrapping = false;
			((TMP_Text)obj6).overflowMode = (TextOverflowModes)0;
			GameObject val8 = new GameObject("Sub");
			val8.transform.SetParent(val3.transform, false);
			RectTransform obj7 = val8.AddComponent<RectTransform>();
			obj7.anchorMin = new Vector2(0f, 1f);
			obj7.anchorMax = new Vector2(1f, 1f);
			obj7.pivot = new Vector2(0.5f, 1f);
			obj7.anchoredPosition = new Vector2(0f, -32f);
			obj7.sizeDelta = new Vector2(-8f, 18f);
			TextMeshProUGUI obj8 = val8.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj8).text = item2;
			((TMP_Text)obj8).fontSize = 14f;
			((TMP_Text)obj8).alignment = (TextAlignmentOptions)514;
			((Graphic)obj8).color = new Color(0.78f, 0.78f, 0.85f, 0.9f);
			((TMP_Text)obj8).enableWordWrapping = false;
			((TMP_Text)obj8).overflowMode = (TextOverflowModes)0;
			GameObject val9 = new GameObject("Sep");
			val9.transform.SetParent(val3.transform, false);
			RectTransform obj9 = val9.AddComponent<RectTransform>();
			obj9.anchorMin = new Vector2(0.03f, 1f);
			obj9.anchorMax = new Vector2(0.97f, 1f);
			obj9.pivot = new Vector2(0.5f, 1f);
			obj9.anchoredPosition = new Vector2(0f, -60f);
			obj9.sizeDelta = new Vector2(0f, 1f);
			((Graphic)val9.AddComponent<Image>()).color = new Color(1f, 0.92f, 0.55f, 0.35f);
			float num3 = (0f - num) / 2f + 18f + 42f;
			float num4 = (0f - num) / 2f + 18f + 84f + 12f;
			float num5 = num2 / 2f - 60f - 10f - 44f;
			foreach (KeyValuePair<int, int> item5 in list)
			{
				GameObject val10 = new GameObject("Badge");
				val10.transform.SetParent(val3.transform, false);
				RectTransform obj10 = val10.AddComponent<RectTransform>();
				offsetMin = (obj10.anchorMax = new Vector2(0.5f, 0.5f));
				obj10.anchorMin = offsetMin;
				obj10.pivot = new Vector2(0.5f, 0.5f);
				obj10.anchoredPosition = new Vector2(num3, num5);
				obj10.sizeDelta = new Vector2(84f, 84f);
				if (item5.Key == -99 && _manaOrbSprites.ContainsKey(item5.Key))
				{
					GameObject val12 = new GameObject("WBg");
					val12.transform.SetParent(val10.transform, false);
					RectTransform obj11 = val12.AddComponent<RectTransform>();
					offsetMin = (obj11.anchorMax = new Vector2(0.5f, 0.5f));
					obj11.anchorMin = offsetMin;
					obj11.pivot = new Vector2(0.5f, 0.5f);
					obj11.anchoredPosition = new Vector2(-1f, 1f);
					obj11.sizeDelta = new Vector2(84f, 84f);
					val12.AddComponent<Image>().sprite = _manaOrbSprites[item5.Key];
					GameObject val14 = new GameObject("WFg");
					val14.transform.SetParent(val10.transform, false);
					RectTransform obj12 = val14.AddComponent<RectTransform>();
					offsetMin = (obj12.anchorMax = new Vector2(0.5f, 0.5f));
					obj12.anchorMin = offsetMin;
					obj12.pivot = new Vector2(0.5f, 0.5f);
					obj12.anchoredPosition = Vector2.zero;
					obj12.sizeDelta = new Vector2(84f, 84f);
					Image obj13 = val14.AddComponent<Image>();
					obj13.sprite = _manaOrbSprites[item5.Key];
					((Graphic)obj13).color = (Color)(_manaOrbColors.TryGetValue(item5.Key, out var value) ? value : new Color(0f, 0.23f, 0.58f, 1f));
				}
				else
				{
					Image val16 = val10.AddComponent<Image>();
					if (_manaOrbSprites.TryGetValue(item5.Key, out var value2))
					{
						val16.sprite = value2;
						if (_manaOrbColors.TryGetValue(item5.Key, out var value3))
						{
							((Graphic)val16).color = value3;
						}
					}
					else if (_manaOrbSprites.Count > 0)
					{
						val16.sprite = _manaOrbSprites.First().Value;
						((Graphic)val16).color = ((_manaOrbColors.Count > 0) ? _manaOrbColors.First().Value : Color.white);
					}
					GameObject val17 = new GameObject("Num");
					val17.transform.SetParent(val10.transform, false);
					RectTransform obj14 = val17.AddComponent<RectTransform>();
					obj14.anchorMin = Vector2.zero;
					obj14.anchorMax = Vector2.one;
					offsetMin = (obj14.offsetMax = Vector2.zero);
					obj14.offsetMin = offsetMin;
					TextMeshProUGUI obj15 = val17.AddComponent<TextMeshProUGUI>();
					((TMP_Text)obj15).text = ((item5.Key == -99) ? "W" : ((item5.Key == -98) ? "X" : item5.Key.ToString()));
					((TMP_Text)obj15).fontSize = 60f;
					((TMP_Text)obj15).fontStyle = (FontStyles)1;
					((TMP_Text)obj15).alignment = (TextAlignmentOptions)514;
					((Graphic)obj15).color = Color.white;
					((TMP_Text)obj15).enableWordWrapping = false;
					((TMP_Text)obj15).overflowMode = (TextOverflowModes)0;
					((TMP_Text)obj15).margin = Vector4.zero;
				}
				GameObject val18 = new GameObject("Cnt");
				val18.transform.SetParent(val3.transform, false);
				RectTransform obj16 = val18.AddComponent<RectTransform>();
				offsetMin = (obj16.anchorMax = new Vector2(0.5f, 0.5f));
				obj16.anchorMin = offsetMin;
				obj16.pivot = new Vector2(0f, 0.5f);
				obj16.anchoredPosition = new Vector2(num4, num5);
				obj16.sizeDelta = new Vector2(110f, 88f);
				TextMeshProUGUI obj17 = val18.AddComponent<TextMeshProUGUI>();
				((TMP_Text)obj17).text = $"x{item5.Value}";
				((TMP_Text)obj17).fontSize = 36f;
				((TMP_Text)obj17).fontStyle = (FontStyles)1;
				((TMP_Text)obj17).alignment = (TextAlignmentOptions)4097;
				((Graphic)obj17).color = Color.white;
				num5 -= 96f;
			}
		}
		else if (flag)
		{
			float num6 = (float)list.Count * 164f - 20f + 44f;
			val4.sizeDelta = new Vector2(num6, 150f);
			GameObject val20 = new GameObject("BgFill");
			val20.transform.SetParent(val3.transform, false);
			RectTransform obj18 = val20.AddComponent<RectTransform>();
			obj18.anchorMin = Vector2.zero;
			obj18.anchorMax = Vector2.one;
			Vector2 offsetMin = (obj18.offsetMax = Vector2.zero);
			obj18.offsetMin = offsetMin;
			((Graphic)val20.AddComponent<Image>()).color = new Color(0.294f, 0.31f, 0.455f, 0.97f);
			if ((Object)(object)_modalFrameSprite != (Object)null)
			{
				GameObject val21 = new GameObject("BgFrame");
				val21.transform.SetParent(val3.transform, false);
				RectTransform obj19 = val21.AddComponent<RectTransform>();
				obj19.anchorMin = Vector2.zero;
				obj19.anchorMax = Vector2.one;
				offsetMin = (obj19.offsetMax = Vector2.zero);
				obj19.offsetMin = offsetMin;
				Image obj20 = val21.AddComponent<Image>();
				obj20.sprite = _modalFrameSprite;
				obj20.type = (Type)1;
			}
			(string main, string sub) compositionLabel2 = GetCompositionLabel();
			string item3 = compositionLabel2.main;
			string item4 = compositionLabel2.sub;
			GameObject val22 = new GameObject("Title");
			val22.transform.SetParent(val3.transform, false);
			RectTransform obj21 = val22.AddComponent<RectTransform>();
			obj21.anchorMin = new Vector2(0f, 1f);
			obj21.anchorMax = new Vector2(1f, 1f);
			obj21.pivot = new Vector2(0.5f, 1f);
			obj21.anchoredPosition = new Vector2(0f, -4f);
			obj21.sizeDelta = new Vector2(-8f, 24f);
			TextMeshProUGUI obj22 = val22.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj22).text = item3;
			((TMP_Text)obj22).fontSize = 22f;
			((TMP_Text)obj22).fontStyle = (FontStyles)1;
			((TMP_Text)obj22).alignment = (TextAlignmentOptions)514;
			((Graphic)obj22).color = new Color(1f, 0.92f, 0.55f, 1f);
			((TMP_Text)obj22).enableWordWrapping = false;
			((TMP_Text)obj22).overflowMode = (TextOverflowModes)0;
			GameObject val23 = new GameObject("Subtitle");
			val23.transform.SetParent(val3.transform, false);
			RectTransform obj23 = val23.AddComponent<RectTransform>();
			obj23.anchorMin = new Vector2(0f, 1f);
			obj23.anchorMax = new Vector2(1f, 1f);
			obj23.pivot = new Vector2(0.5f, 1f);
			obj23.anchoredPosition = new Vector2(0f, -27f);
			obj23.sizeDelta = new Vector2(-8f, 18f);
			TextMeshProUGUI obj24 = val23.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj24).text = item4;
			((TMP_Text)obj24).fontSize = 14f;
			((TMP_Text)obj24).alignment = (TextAlignmentOptions)514;
			((Graphic)obj24).color = new Color(0.78f, 0.78f, 0.85f, 0.9f);
			((TMP_Text)obj24).enableWordWrapping = false;
			((TMP_Text)obj24).overflowMode = (TextOverflowModes)0;
			GameObject val24 = new GameObject("Sep");
			val24.transform.SetParent(val3.transform, false);
			RectTransform obj25 = val24.AddComponent<RectTransform>();
			obj25.anchorMin = new Vector2(0.03f, 1f);
			obj25.anchorMax = new Vector2(0.97f, 1f);
			obj25.pivot = new Vector2(0.5f, 1f);
			obj25.anchoredPosition = new Vector2(0f, -46f);
			obj25.sizeDelta = new Vector2(0f, 1f);
			((Graphic)val24.AddComponent<Image>()).color = new Color(1f, 0.92f, 0.55f, 0.35f);
			float num7 = -23f;
			float num8 = (0f - num6) / 2f + 22f;
			foreach (KeyValuePair<int, int> item6 in list)
			{
				GameObject val25 = new GameObject("Badge");
				val25.transform.SetParent(val3.transform, false);
				RectTransform obj26 = val25.AddComponent<RectTransform>();
				offsetMin = (obj26.anchorMax = new Vector2(0.5f, 0.5f));
				obj26.anchorMin = offsetMin;
				obj26.pivot = new Vector2(0f, 0.5f);
				obj26.anchoredPosition = new Vector2(num8, num7);
				obj26.sizeDelta = new Vector2(80f, 80f);
				if (item6.Key == -99 && _manaOrbSprites.ContainsKey(-99))
				{
					GameObject val27 = new GameObject("WildShadow");
					val27.transform.SetParent(val25.transform, false);
					RectTransform obj27 = val27.AddComponent<RectTransform>();
					offsetMin = (obj27.anchorMax = new Vector2(0.5f, 0.5f));
					obj27.anchorMin = offsetMin;
					obj27.pivot = new Vector2(0.5f, 0.5f);
					obj27.anchoredPosition = Vector2.zero;
					obj27.sizeDelta = new Vector2(92f, 92f);
					Image obj28 = val27.AddComponent<Image>();
					obj28.sprite = _manaOrbSprites[item6.Key];
					((Graphic)obj28).color = new Color(0.1f, 0.1f, 0.15f, 0.95f);
					GameObject val29 = new GameObject("WildBg");
					val29.transform.SetParent(val25.transform, false);
					RectTransform obj29 = val29.AddComponent<RectTransform>();
					offsetMin = (obj29.anchorMax = new Vector2(0.5f, 0.5f));
					obj29.anchorMin = offsetMin;
					obj29.pivot = new Vector2(0.5f, 0.5f);
					obj29.anchoredPosition = new Vector2(-2f, 2f);
					obj29.sizeDelta = new Vector2(80f, 80f);
					val29.AddComponent<Image>().sprite = _manaOrbSprites[item6.Key];
					GameObject val31 = new GameObject("WildFg");
					val31.transform.SetParent(val25.transform, false);
					RectTransform obj30 = val31.AddComponent<RectTransform>();
					offsetMin = (obj30.anchorMax = new Vector2(0.5f, 0.5f));
					obj30.anchorMin = offsetMin;
					obj30.pivot = new Vector2(0.5f, 0.5f);
					obj30.anchoredPosition = Vector2.zero;
					obj30.sizeDelta = new Vector2(80f, 80f);
					Image obj31 = val31.AddComponent<Image>();
					obj31.sprite = _manaOrbSprites[item6.Key];
					((Graphic)obj31).color = (Color)(_manaOrbColors.TryGetValue(item6.Key, out var value4) ? value4 : new Color(0f, 0.23f, 0.58f, 1f));
				}
				else
				{
					Image val33 = val25.AddComponent<Image>();
					if (_manaOrbSprites.TryGetValue(item6.Key, out var value5))
					{
						val33.sprite = value5;
						if (_manaOrbColors.TryGetValue(item6.Key, out var value6))
						{
							((Graphic)val33).color = value6;
						}
					}
					else
					{
						if (_manaOrbSprites.Count > 0)
						{
							val33.sprite = _manaOrbSprites.First().Value;
						}
						((Graphic)val33).color = ((_manaOrbColors.Count > 0) ? _manaOrbColors.First().Value : Color.white);
					}
					GameObject val34 = new GameObject("Num");
					val34.transform.SetParent(val25.transform, false);
					RectTransform obj32 = val34.AddComponent<RectTransform>();
					obj32.anchorMin = Vector2.zero;
					obj32.anchorMax = Vector2.one;
					offsetMin = (obj32.offsetMax = Vector2.zero);
					obj32.offsetMin = offsetMin;
					TextMeshProUGUI obj33 = val34.AddComponent<TextMeshProUGUI>();
					((TMP_Text)obj33).text = ((item6.Key == -99) ? "W" : ((item6.Key == -98) ? "X" : item6.Key.ToString()));
					((TMP_Text)obj33).fontSize = 56f;
					((TMP_Text)obj33).fontStyle = (FontStyles)1;
					((TMP_Text)obj33).alignment = (TextAlignmentOptions)514;
					((Graphic)obj33).color = Color.white;
					((TMP_Text)obj33).enableWordWrapping = false;
					((TMP_Text)obj33).overflowMode = (TextOverflowModes)0;
					((TMP_Text)obj33).margin = Vector4.zero;
				}
				GameObject val35 = new GameObject("Cnt");
				val35.transform.SetParent(val3.transform, false);
				RectTransform obj34 = val35.AddComponent<RectTransform>();
				offsetMin = (obj34.anchorMax = new Vector2(0.5f, 0.5f));
				obj34.anchorMin = offsetMin;
				obj34.pivot = new Vector2(0f, 0.5f);
				obj34.anchoredPosition = new Vector2(num8 + 80f + 4f, num7);
				obj34.sizeDelta = new Vector2(64f, 56f);
				TextMeshProUGUI obj35 = val35.AddComponent<TextMeshProUGUI>();
				((TMP_Text)obj35).text = $"x{item6.Value}";
				((TMP_Text)obj35).fontSize = 30f;
				((TMP_Text)obj35).fontStyle = (FontStyles)1;
				((TMP_Text)obj35).alignment = (TextAlignmentOptions)4097;
				((Graphic)obj35).color = Color.white;
				num8 += 164f;
			}
		}
		else
		{
			val4.sizeDelta = new Vector2(300f, 40f);
			GameObject val37 = new GameObject("BgFill");
			val37.transform.SetParent(val3.transform, false);
			RectTransform obj36 = val37.AddComponent<RectTransform>();
			obj36.anchorMin = Vector2.zero;
			obj36.anchorMax = Vector2.one;
			Vector2 offsetMin = (obj36.offsetMax = Vector2.zero);
			obj36.offsetMin = offsetMin;
			((Graphic)val37.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.72f);
			GameObject val38 = new GameObject("Label");
			val38.transform.SetParent(val3.transform, false);
			RectTransform obj37 = val38.AddComponent<RectTransform>();
			obj37.anchorMin = Vector2.zero;
			obj37.anchorMax = Vector2.one;
			obj37.offsetMin = new Vector2(6f, 0f);
			obj37.offsetMax = new Vector2(-6f, 0f);
			TextMeshProUGUI obj38 = val38.AddComponent<TextMeshProUGUI>();
			((TMP_Text)obj38).text = string.Join("   ", list.Select((KeyValuePair<int, int> kv) => $"{kv.Key}: {kv.Value}"));
			((TMP_Text)obj38).fontSize = 14f;
			((TMP_Text)obj38).alignment = (TextAlignmentOptions)514;
			((Graphic)obj38).color = new Color(1f, 0.92f, 0.55f, 1f);
		}
		return val3;
	}

	private void OnModalOpened(ChooseCardModal modal)
	{
		//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Expected O, but got Unknown
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			PlayerModel playerModel = modal._playerModel;
			if ((Object)(object)playerModel == (Object)null)
			{
				return;
			}
			_cachedPlayerModel = playerModel;
			List<CardChoiceView> cardChoiceViews = modal._cardChoiceViews;
			if (cardChoiceViews == null)
			{
				return;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			List<CardConfig> list = new List<CardConfig>();
			List<CardModel> allCards = playerModel._allCards;
			Enumerator<CardModel> enumerator;
			if (allCards != null)
			{
				enumerator = allCards.GetEnumerator();
				while (enumerator.MoveNext())
				{
					CardModel current = enumerator.Current;
					CardConfig val = ((current != null) ? current.CardConfig : null);
					if (!((Object)(object)val == (Object)null))
					{
						if (((Object)val).name != null)
						{
							string baseKey = GetBaseKey(((Object)val).name);
							dictionary[baseKey] = ((!dictionary.TryGetValue(baseKey, out var value)) ? 1 : (value + 1));
						}
						list.Add(val);
					}
				}
			}
			TryCacheManaIcons(cardChoiceViews);
			Enumerator<CardChoiceView> enumerator2 = cardChoiceViews.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				CardChoiceView current2 = enumerator2.Current;
				if (!((Object)(object)current2 == (Object)null))
				{
					Transform tweenContainer = GetTweenContainer(((Component)current2).gameObject);
					Transform val2 = tweenContainer.Find("VCComboBadge");
					if ((Object)(object)val2 != (Object)null)
					{
						Object.DestroyImmediate((Object)(object)((Component)val2).gameObject);
					}
					Transform val3 = tweenContainer.Find("VCCountBadge");
					if ((Object)(object)val3 != (Object)null)
					{
						Object.DestroyImmediate((Object)(object)((Component)val3).gameObject);
					}
				}
			}
			enumerator2 = cardChoiceViews.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				CardChoiceView current3 = enumerator2.Current;
				if ((Object)(object)current3 == (Object)null)
				{
					continue;
				}
				CardConfig cardConfig = current3.CardConfig;
				if ((Object)(object)cardConfig == (Object)null)
				{
					continue;
				}
				string text = ((((Object)cardConfig).name != null) ? GetBaseKey(((Object)cardConfig).name) : "");
				int value2;
				int count = ((text.Length > 0 && dictionary.TryGetValue(text, out value2)) ? value2 : 0);
				AddCountBadge(((Component)current3).gameObject, count);
				if (((Object)cardConfig).name != null)
				{
					var (flag, evoName, isRedundant) = CheckCombo(cardConfig, list);
					if (flag)
					{
						AddBadge(((Component)current3).gameObject, evoName, isRedundant);
					}
				}
			}
			if ((Object)(object)_chooseCardOverlay != (Object)null)
			{
				Object.Destroy((Object)(object)_chooseCardOverlay);
				_chooseCardOverlay = null;
			}
			if (allCards == null)
			{
				return;
			}
			Dictionary<int, int> dictionary2 = new Dictionary<int, int>();
			enumerator = allCards.GetEnumerator();
			while (enumerator.MoveNext())
			{
				CardModel current4 = enumerator.Current;
				CardConfig val4 = ((current4 != null) ? current4.CardConfig : null);
				if ((Object)(object)val4 == (Object)null || ((Object)val4).name == null || !((Object)val4).name.StartsWith("Card_"))
				{
					continue;
				}
				string[] array = ((Object)val4).name.Split('_');
				bool num = array.Length == 3 || (array.Length >= 2 && array[1].ToUpperInvariant() == "E");
				int cost = -999;
				if (num)
				{
					cost = -99;
				}
				else
				{
					try
					{
						CardView cardView = current4.CardView;
						TMP_Text val5 = ((cardView != null) ? cardView._costText : null);
						if ((Object)(object)val5 != (Object)null)
						{
							TryParseCostText(val5.text, out cost);
						}
					}
					catch
					{
					}
					if (cost == -999)
					{
						int num2 = 0;
						try
						{
							CardGemsModel cardGems = current4.CardGems;
							Dictionary<GemConfig, GemManaModifierInfo> val6 = ((cardGems != null) ? cardGems._gemManaModifiers : null);
							if (val6 != null)
							{
								Enumerator<GemConfig, GemManaModifierInfo> enumerator3 = val6.GetEnumerator();
								while (enumerator3.MoveNext())
								{
									KeyValuePair<GemConfig, GemManaModifierInfo> current5 = enumerator3.Current;
									num2 += current5.Value.Count * current5.Value.Amount;
								}
							}
						}
						catch
						{
						}
						cost = val4.manaCost + num2;
					}
				}
				switch (cost)
				{
				case -99:
					TryCacheWildSpriteFromModel(current4);
					break;
				default:
					TryCacheOrbSpriteFromModel(current4, cost);
					break;
				case -98:
					break;
				}
				dictionary2[cost] = ((!dictionary2.TryGetValue(cost, out var value3)) ? 1 : (value3 + 1));
			}
			if (dictionary2.Count > 0)
			{
				_chooseCardOverlay = CreateManaPanel(((Component)modal).gameObject, dictionary2, -440f);
			}
		}
		catch (Exception ex)
		{
			ManualLogSource log = Plugin.Log;
			bool flag2 = default(bool);
			BepInExErrorLogInterpolatedStringHandler val7 = new BepInExErrorLogInterpolatedStringHandler(17, 1, ref flag2);
			if (flag2)
			{
				((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[ComboIndicator] ");
				((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<Exception>(ex);
			}
			log.LogError(val7);
		}
	}

	private static string[] ParseComponents(string desc)
	{
		if (string.IsNullOrEmpty(desc))
		{
			return Array.Empty<string>();
		}
		int num = desc.IndexOf(':');
		if (num < 0)
		{
			return Array.Empty<string>();
		}
		return (from s in desc.Substring(num + 1).Replace(".", "").Split(',')
			select s.Trim() into s
			where s.Length > 0
			select s).ToArray();
	}

	private static string Norm(string s)
	{
		return new string(s.ToLowerInvariant().Where(char.IsLetter).ToArray());
	}

	private static string GetBaseName(string assetName)
	{
		if (string.IsNullOrEmpty(assetName))
		{
			return "";
		}
		string[] array = assetName.Split('_');
		if (array.Length < 4)
		{
			return Norm(assetName);
		}
		return Norm(string.Join("", array.Skip(3)));
	}

	private static string GetBaseKey(string assetName)
	{
		if (string.IsNullOrEmpty(assetName))
		{
			return "";
		}
		string[] array = assetName.Split('_');
		if (array.Length >= 4)
		{
			return array[1].ToLowerInvariant() + "_" + array[2] + "_" + Norm(string.Join("", array.Skip(3)));
		}
		return Norm(assetName);
	}

	private static bool CardMatchesComp(CardConfig card, string compNorm)
	{
		if (compNorm.Length == 0)
		{
			return false;
		}
		if (((Object)card).name != null && GetBaseName(((Object)card).name) == compNorm)
		{
			return true;
		}
		if (card.Name != null && Norm(card.Name) == compNorm)
		{
			return true;
		}
		return false;
	}

	private static bool OwnsComp(string compName, List<CardConfig> owned)
	{
		string text = Norm(compName);
		if (text.Length == 0)
		{
			return false;
		}
		foreach (CardConfig item in owned)
		{
			if ((Object)(object)item != (Object)null && CardMatchesComp(item, text))
			{
				return true;
			}
		}
		return false;
	}

	private static (bool hasCombo, string evoName, bool isRedundant) CheckCombo(CardConfig offered, List<CardConfig> ownedConfigs)
	{
		if (offered.HasEvolution)
		{
			string[] array = ParseComponents(offered.GetEvolveRequirementDescription());
			if (array.Length != 0)
			{
				bool flag = array.All((string c) => CardMatchesComp(offered, Norm(c)) || OwnsComp(c, ownedConfigs));
				bool flag2 = array.Any((string c) => !CardMatchesComp(offered, Norm(c)) && OwnsComp(c, ownedConfigs));
				if (flag && flag2)
				{
					bool item = array.All((string c) => OwnsComp(c, ownedConfigs));
					CardConfig evolvedCardConfig = offered.EvolvedCardConfig;
					return (true, ((evolvedCardConfig != null) ? evolvedCardConfig.Name : null) ?? "?", item);
				}
			}
		}
		foreach (CardConfig ownedConfig in ownedConfigs)
		{
			if ((Object)(object)ownedConfig == (Object)null || !ownedConfig.HasEvolution)
			{
				continue;
			}
			string[] array2 = ParseComponents(ownedConfig.GetEvolveRequirementDescription());
			if (array2.Length != 0 && array2.Any(delegate(string c)
			{
				string text2 = Norm(c);
				return text2.Length > 0 && CardMatchesComp(offered, text2);
			}) && array2.All(delegate(string c)
			{
				string text = Norm(c);
				if (text.Length == 0)
				{
					return true;
				}
				return CardMatchesComp(offered, text) || OwnsComp(c, ownedConfigs);
			}))
			{
				bool item2 = array2.All((string c) => OwnsComp(c, ownedConfigs));
				CardConfig evolvedCardConfig2 = ownedConfig.EvolvedCardConfig;
				return (true, ((evolvedCardConfig2 != null) ? evolvedCardConfig2.Name : null) ?? "?", item2);
			}
		}
		return (false, "", false);
	}

	private static Sprite GetBadgeRingSprite(bool silver = false)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: 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_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0316: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: 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_02e0: Unknown result type (might be due to invalid IL or missing references)
		if (silver && (Object)(object)_ringSpriteSilver != (Object)null)
		{
			return _ringSpriteSilver;
		}
		if (!silver && (Object)(object)_ringSpriteRainbow != (Object)null)
		{
			return _ringSpriteRainbow;
		}
		Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		float num = 32f;
		float num2 = 32f;
		Color[] array = (Color[])(object)new Color[4096];
		for (int i = 0; i < 64; i++)
		{
			for (int j = 0; j < 64; j++)
			{
				float num3 = (float)j + 0.5f - num;
				float num4 = (float)i + 0.5f - num2;
				float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
				Color val2 = Color.clear;
				if (num5 < 32f)
				{
					float num6 = Mathf.Atan2(num4, num3);
					float num7 = (Mathf.Cos(num6 + 0.9424779f) + 1f) * 0.5f;
					if (num5 >= 29f)
					{
						float num8 = 1f - (num5 - 29f) / 3f;
						val2 = (silver ? new Color(0.4f, 0.45f, 0.55f, num8 * num8 * 0.55f) : new Color(0.55f, 0.3f, 0.7f, num8 * num8 * 0.55f));
					}
					else if (num5 >= 19.5f)
					{
						float num9 = (num5 - 19.5f) / 9.5f;
						float num10 = (Mathf.Sin(num9 * (float)Math.PI * 3.5f - 0.3f) + 1f) * 0.5f;
						float num11 = Mathf.Pow(Mathf.Abs(num9 * 2f - 1f), 1.5f);
						float num12 = num10 * 0.32f + num7 * 0.33f + num11 * 0.28f + 0.07f;
						num12 = Mathf.Clamp01(num12);
						if (silver)
						{
							((Color)(ref val2))..ctor(Mathf.Lerp(0.42f, 0.96f, num12), Mathf.Lerp(0.46f, 0.98f, num12), Mathf.Lerp(0.55f, 1f, num12), 1f);
						}
						else
						{
							Color val3 = Color.HSVToRGB((num6 + (float)Math.PI) / ((float)Math.PI * 2f) % 1f, 0.92f, 1f);
							((Color)(ref val2))..ctor(Mathf.Lerp(val3.r * 0.3f, val3.r, num12), Mathf.Lerp(val3.g * 0.3f, val3.g, num12), Mathf.Lerp(val3.b * 0.3f, val3.b, num12), 1f);
						}
					}
					else if (num5 >= 17.5f)
					{
						float num13 = (num5 - 17.5f) / 2f;
						val2 = (silver ? new Color(0.06f, 0.06f, 0.1f, num13 * 0.9f) : new Color(0.07f, 0.03f, 0.1f, num13 * 0.9f));
					}
					else
					{
						val2 = (silver ? new Color(0.05f, 0.05f, 0.08f, 0.97f) : new Color(0.05f, 0.03f, 0.08f, 0.97f));
					}
				}
				array[i * 64 + j] = val2;
			}
		}
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		Sprite val4 = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f);
		if (silver)
		{
			_ringSpriteSilver = val4;
		}
		else
		{
			_ringSpriteRainbow = val4;
		}
		return val4;
	}

	private static Sprite GetEvoTextSprite()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: 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)
		if ((Object)(object)_evoTextSprite != (Object)null)
		{
			return _evoTextSprite;
		}
		Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color[] array = (Color[])(object)new Color[4096];
		byte[][][] array2 = new byte[3][][]
		{
			new byte[7][]
			{
				new byte[5] { 1, 1, 1, 1, 1 },
				new byte[5] { 1, 0, 0, 0, 0 },
				new byte[5] { 1, 0, 0, 0, 0 },
				new byte[5] { 1, 1, 1, 1, 0 },
				new byte[5] { 1, 0, 0, 0, 0 },
				new byte[5] { 1, 0, 0, 0, 0 },
				new byte[5] { 1, 1, 1, 1, 1 }
			},
			new byte[7][]
			{
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 0, 1, 0, 1, 0 },
				new byte[5] { 0, 1, 0, 1, 0 },
				new byte[5] { 0, 0, 1, 0, 0 }
			},
			new byte[7][]
			{
				new byte[5] { 0, 1, 1, 1, 0 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 1, 0, 0, 0, 1 },
				new byte[5] { 0, 1, 1, 1, 0 }
			}
		};
		int num = 15;
		int num2 = 21;
		int num3 = 3;
		int num4 = 3 * num + 2 * num3;
		int num5 = (64 - num4) / 2;
		int num6 = (64 - num2) / 2;
		for (int i = 0; i < 3; i++)
		{
			int num7 = num5 + i * (num + num3);
			for (int j = 0; j < 7; j++)
			{
				for (int k = 0; k < 5; k++)
				{
					if (array2[i][j][k] == 0)
					{
						continue;
					}
					for (int l = 0; l < 3; l++)
					{
						for (int m = 0; m < 3; m++)
						{
							int num8 = num7 + k * 3 + m + 1;
							int num9 = num6 + (6 - j) * 3 + l - 1;
							if (num8 >= 0 && num8 < 64 && num9 >= 0 && num9 < 64)
							{
								array[num9 * 64 + num8] = new Color(0f, 0f, 0f, 0.92f);
							}
						}
					}
				}
			}
		}
		for (int n = 0; n < 3; n++)
		{
			int num10 = num5 + n * (num + num3);
			for (int num11 = 0; num11 < 7; num11++)
			{
				for (int num12 = 0; num12 < 5; num12++)
				{
					if (array2[n][num11][num12] == 0)
					{
						continue;
					}
					for (int num13 = 0; num13 < 3; num13++)
					{
						for (int num14 = 0; num14 < 3; num14++)
						{
							int num15 = num10 + num12 * 3 + num14;
							int num16 = num6 + (6 - num11) * 3 + num13;
							if (num15 >= 0 && num15 < 64 && num16 >= 0 && num16 < 64)
							{
								array[num16 * 64 + num15] = new Color(1f, 1f, 1f, 1f);
							}
						}
					}
				}
			}
		}
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		_evoTextSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f);
		return _evoTextSprite;
	}

	private static Sprite GetShineSprite()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: 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_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: 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)
		if ((Object)(object)_shineSprite != (Object)null)
		{
			return _shineSprite;
		}
		Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		float num = 32f;
		float num2 = 32f;
		Color[] array = (Color[])(object)new Color[4096];
		for (int i = 0; i < 64; i++)
		{
			for (int j = 0; j < 64; j++)
			{
				float num3 = (float)j + 0.5f - num;
				float num4 = (float)i + 0.5f - num2;
				float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4);
				Color clear = Color.clear;
				if (num5 >= 18.5f && num5 <= 30.5f)
				{
					float num6;
					for (num6 = Mathf.Atan2(num4, num3) - (float)Math.PI / 2f; num6 > (float)Math.PI; num6 -= (float)Math.PI * 2f)
					{
					}
					for (; num6 < -(float)Math.PI; num6 += (float)Math.PI * 2f)
					{
					}
					float num7 = Mathf.Pow(Mathf.Clamp01(Mathf.Cos(num6 * 1.2f)), 5f);
					float num8 = (num5 - 18.5f) / 12f;
					float num9 = 1f - Mathf.Abs(num8 * 2f - 1f);
					num9 = Mathf.Pow(Mathf.Clamp01(num9), 1.4f);
					float num10 = num7 * num9;
					((Color)(ref clear))..ctor(1f, 1f, 1f, num10 * 0.85f);
				}
				array[i * 64 + j] = clear;
			}
		}
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		_shineSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f);
		return _shineSprite;
	}

	private static Sprite GetCheckmarkSprite()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: 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_0133: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02af: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_checkmarkSprite != (Object)null)
		{
			return _checkmarkSprite;
		}
		Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color[] array = (Color[])(object)new Color[1024];
		float num = 16f;
		float num2 = 16f;
		float num3 = 14f;
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.32f, 0.85f, 0.36f, 1f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0.1f, 0.5f, 0.18f, 1f);
		for (int i = 0; i < 32; i++)
		{
			for (int j = 0; j < 32; j++)
			{
				float num4 = (float)j + 0.5f - num;
				float num5 = (float)i + 0.5f - num2;
				float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5);
				if (num6 <= num3 + 0.5f)
				{
					float num7 = Mathf.Clamp01((Mathf.Cos(Mathf.Atan2(num5, num4) + 0.9424779f) + 1f) * 0.5f * 0.55f + (1f - num6 / num3) * 0.45f);
					Color val4 = Color.Lerp(val3, val2, num7);
					float num8 = Mathf.Clamp01(num3 - num6 + 0.5f);
					array[i * 32 + j] = new Color(val4.r, val4.g, val4.b, num8);
				}
			}
		}
		byte[][] array2 = new byte[7][]
		{
			new byte[10] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 },
			new byte[10] { 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 },
			new byte[10] { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 },
			new byte[10] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0 },
			new byte[10] { 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 },
			new byte[10] { 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
			new byte[10] { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 }
		};
		int num9 = 6;
		int num10 = 9;
		for (int k = 0; k < 2; k++)
		{
			for (int l = 0; l < 7; l++)
			{
				for (int m = 0; m < 10; m++)
				{
					if (array2[l][m] == 0)
					{
						continue;
					}
					for (int n = 0; n < 2; n++)
					{
						for (int num11 = 0; num11 < 2; num11++)
						{
							int num12 = num9 + m * 2 + num11 + ((k == 0) ? 1 : 0);
							int num13 = num10 + (6 - l) * 2 + n - ((k == 0) ? 1 : 0);
							if (num12 >= 0 && num12 < 32 && num13 >= 0 && num13 < 32)
							{
								array[num13 * 32 + num12] = ((k == 0) ? new Color(0f, 0f, 0f, 0.55f) : new Color(1f, 1f, 1f, 1f));
							}
						}
					}
				}
			}
		}
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		_checkmarkSprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f);
		return _checkmarkSprite;
	}

	private static float PillDist(float x, float y, float cx, float cy, float halfLen, float r)
	{
		float num = Mathf.Max(0f, Mathf.Abs(x - cx) - halfLen);
		float num2 = y - cy;
		return Mathf.Sqrt(num * num + num2 * num2) / r;
	}

	private static Sprite GetNewBadgeSprite()
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_newBadgeSprite != (Object)null)
		{
			return _newBadgeSprite;
		}
		Texture2D val = new Texture2D(56, 20, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color[] array = (Color[])(object)new Color[1120];
		float cx = 28f;
		float cy = 10f;
		float r = 9f;
		float halfLen = 18f;
		for (int i = 0; i < 20; i++)
		{
			for (int j = 0; j < 56; j++)
			{
				float num = PillDist((float)j + 0.5f, (float)i + 0.5f, cx, cy, halfLen, r);
				if (num <= 1f)
				{
					Color val2 = Color.HSVToRGB((float)j / 56f, 0.88f, 0.9f);
					float num2 = Mathf.Clamp01((1f - num) / 0.15f);
					array[i * 56 + j] = new Color(val2.r, val2.g, val2.b, num2 * 0.96f);
				}
			}
		}
		int num3 = 10;
		int num4 = 14;
		int num5 = (56 - (3 * num3 + 4)) / 2;
		int num6 = (20 - num4) / 2;
		for (int k = 0; k < 2; k++)
		{
			for (int l = 0; l < 3; l++)
			{
				int num7 = num5 + l * (num3 + 2);
				for (int m = 0; m < 7; m++)
				{
					for (int n = 0; n < 5; n++)
					{
						if (GlyphsNEW[l][m][n] == 0)
						{
							continue;
						}
						for (int num8 = 0; num8 < 2; num8++)
						{
							for (int num9 = 0; num9 < 2; num9++)
							{
								int num10 = num7 + n * 2 + num9 + ((k == 0) ? 1 : 0);
								int num11 = num6 + (6 - m) * 2 + num8 - ((k == 0) ? 1 : 0);
								if (num10 >= 0 && num10 < 56 && num11 >= 0 && num11 < 20)
								{
									array[num11 * 56 + num10] = (Color)((k == 0) ? new Color(0f, 0f, 0f, 0.65f) : Color.white);
								}
							}
						}
					}
				}
			}
		}
		val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
		val.Apply();
		_newBadgeSprite = Sprite.Create(val, new Rect(0f, 0f, 56f, 20f), new Vector2(0.5f, 0.5f), 100f);
		return _newBadgeSprite;
	}

	private static Sprite GetCountBadgeSprite(int n)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: 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_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		int num = Mathf.Min(n, 9);
		if ((Object)(object)_countBadgeCache[num] != (Object)null)
		{
			return _countBadgeCache[num];
		}
		Texture2D val = new Texture2D(30, 16, (TextureFormat)4, false);
		((Texture)val).filterMode = (FilterMode)1;
		Color[] array = (Color[])(object)new Color[480];
		float cx = 15f;
		float cy = 8f;
		float r = 7f;
		float halfLen = 7f;
		for (int i = 0; i < 16; i++)
		{
			for (int j = 0; j < 30; j++)
			{
				float num2 = PillDist((float)j + 0.5f, (float)i + 0.5f, cx, cy, halfLen, r);
				if (num2 <= 1f)
				{
					float num3 = Mathf.Clamp01((1f - num2) / 0.15f);
					array[i * 30 + j] = new Color(0.05f, 0.03f, 0f, num3 * 0.88f);
				}
			}
		}
		int num4 = 14;
		int num5 = (30 - num4) / 2;
		int num6 = 5;
		int num7 = 3;
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(1f, 0.88f, 0.2f, 1f);
		for (int k = 0; k < 3; k++)
		{
			for (int l = 0; l < 3; l++)
			{
				if (GlyphTimes[k][l] == 0)
				{
					continue;
				}
				for (int m = 0; m < 2; m++)
				{
					for (int num8 = 0; num8 < 2; num8++)
					{
						int num9 = num5 + l * 2 + num8;
						int num10 = num6 + (2 - k) * 2 + m;
						if (num9 >= 0 && num9 < 30 && num10 >= 0 && num10 < 16)
						{
							array[num10 * 30 + num9] = val2;
						}
					}
				}
			}
		}
		byte[][] array2 = GlyphsDigits[num];
		int num11 = num5 + 6 + 2;
		for (int num12 = 0; num12 < 5; num12++)
		{
			for (int num13 = 0; num13 < 3; num13++)
			{
				if (array2[num12][num13] == 0)
				{
					continue;
				}
				for (int num14 = 0; num14 < 2; num14++)
				{
					for (int num15 = 0; num15 < 2; num15++)
					{
						int num16 = num11 + num13 * 2 + num15;
						int num17 = num7 + (4 - num12) * 2 + num14;
						if (num16 >= 0 && num16 < 30 && num17 >= 0 && num17 < 16)
						{
							arra