Decompiled source of PowerupMinimap v1.1.3

PowerupMinimap.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Reflection;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PowerupMinimap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.3.0")]
[assembly: AssemblyInformationalVersion("2.0.3+587a0b13fc3b9a715a8dd4959ab4a993fe4c716d")]
[assembly: AssemblyProduct("PowerupMinimap")]
[assembly: AssemblyTitle("PowerupMinimap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte b)
		{
			NullableFlags = new byte[1] { b };
		}

		public NullableAttribute(byte[] flags)
		{
			NullableFlags = flags;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PowerupMinimap
{
	public static class CollectiblePatches
	{
		public static void TryRegister(CollectibleItemBase item)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			try
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)((Component)item).gameObject == (Object)null) && !item.collected && !item.IsCollected)
				{
					PickupCategory pickupCategory = ClassifyCollectible(item);
					if (IsVisible(pickupCategory))
					{
						MinimapBlipOverlay.Register(((Object)((Component)item).gameObject).GetInstanceID(), ((Component)item).transform, pickupCategory);
					}
				}
			}
			catch (Exception ex)
			{
				ManualLogSource log = PowerupMinimapPlugin.Log;
				if (log != null)
				{
					bool flag = default(bool);
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(34, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PowerupMinimap] Register failed: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
					}
					log.LogError(val);
				}
			}
		}

		public static void TryUnregister(CollectibleItemBase item)
		{
			try
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)((Component)item).gameObject == (Object)null))
				{
					MinimapBlipOverlay.Unregister(((Object)((Component)item).gameObject).GetInstanceID());
				}
			}
			catch
			{
			}
		}

		public static PickupCategory ClassifyCollectible(CollectibleItemBase item)
		{
			if ((Object)(object)item == (Object)null)
			{
				return PickupCategory.Generic;
			}
			if ((Object)(object)((Il2CppObjectBase)item).TryCast<CollectableItemHP>() != (Object)null)
			{
				return PickupCategory.HP;
			}
			if ((Object)(object)((Il2CppObjectBase)item).TryCast<CollectableItemBomb>() != (Object)null)
			{
				return PickupCategory.Bomb;
			}
			if ((Object)(object)((Il2CppObjectBase)item).TryCast<CollectableItemMagnet>() != (Object)null)
			{
				return PickupCategory.Magnet;
			}
			if ((Object)(object)((Il2CppObjectBase)item).TryCast<CollectableItemBuilderUpgrade>() != (Object)null)
			{
				return PickupCategory.Buff;
			}
			CollectableItemBuff val = ((Il2CppObjectBase)item).TryCast<CollectableItemBuff>();
			if ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)val.buffDefinition != (Object)null)
				{
					string source = val.buffDefinition.buffId ?? "";
					string source2 = val.buffDefinition.displayName ?? "";
					if (ContainsAny(source, "Speed") || ContainsAny(source2, "Speed"))
					{
						return PickupCategory.Speed;
					}
					if (ContainsAny(source, "Exp", "XP") || ContainsAny(source2, "Exp", "XP"))
					{
						return PickupCategory.ExpBoost;
					}
				}
				return PickupCategory.Buff;
			}
			Type il2CppType = ((Object)item).GetIl2CppType();
			string source3 = ((il2CppType != null) ? ((MemberInfo)il2CppType).Name : null) ?? "";
			string source4 = (((Object)(object)((Component)item).gameObject != (Object)null) ? ((Object)((Component)item).gameObject).name : "");
			if (ContainsAny(source3, "HP", "Heal", "Health", "Potion", "DropHP") || ContainsAny(source4, "HP", "Heal", "Health", "Potion"))
			{
				return PickupCategory.HP;
			}
			if (ContainsAny(source3, "Magnet") || ContainsAny(source4, "Magnet"))
			{
				return PickupCategory.Magnet;
			}
			if (ContainsAny(source3, "Bomb", "Explosive") || ContainsAny(source4, "Bomb", "Explosive"))
			{
				return PickupCategory.Bomb;
			}
			if (ContainsAny(source3, "Exp", "XP", "Experience") || ContainsAny(source4, "Exp", "XP", "Experience"))
			{
				return PickupCategory.ExpBoost;
			}
			if (ContainsAny(source3, "Speed") || ContainsAny(source4, "Speed"))
			{
				return PickupCategory.Speed;
			}
			if (ContainsAny(source3, "Buff", "Builder", "Attack", "Upgrade") || ContainsAny(source4, "Buff", "Builder", "Attack", "Upgrade"))
			{
				return PickupCategory.Buff;
			}
			if (!ContainsAny(source3, "Coin", "Currency", "Gold"))
			{
				ContainsAny(source4, "Coin", "Currency", "Gold");
			}
			return PickupCategory.Generic;
		}

		private static bool ContainsAny(string source, params string[] tokens)
		{
			foreach (string value in tokens)
			{
				if (source.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0)
				{
					return true;
				}
			}
			return false;
		}

		public static bool IsVisible(PickupCategory cat)
		{
			return cat switch
			{
				PickupCategory.HP => PowerupMinimapPlugin.ShowHP.Value, 
				PickupCategory.Buff => PowerupMinimapPlugin.ShowBuff.Value, 
				PickupCategory.Bomb => PowerupMinimapPlugin.ShowBomb.Value, 
				PickupCategory.Magnet => PowerupMinimapPlugin.ShowMagnet.Value, 
				PickupCategory.ExpBoost => PowerupMinimapPlugin.ShowExpBoost.Value, 
				PickupCategory.Speed => PowerupMinimapPlugin.ShowSpeed.Value, 
				PickupCategory.Chest => PowerupMinimapPlugin.ShowChest.Value, 
				_ => PowerupMinimapPlugin.ShowGeneric.Value, 
			};
		}
	}
	public enum PickupCategory
	{
		HP,
		Buff,
		Bomb,
		Magnet,
		ExpBoost,
		Speed,
		Chest,
		Generic
	}
	public sealed class PickupEntry
	{
		public Transform? Transform;

		public PickupCategory Category;
	}
	public sealed class MinimapBlipOverlay : MonoBehaviour
	{
		private static readonly Dictionary<int, PickupEntry> _pickups = new Dictionary<int, PickupEntry>();

		private static readonly object _lock = new object();

		private MinimapController? _minimapController;

		private RectTransform? _mapImageRT;

		private RectTransform? _maskRT;

		private Canvas? _canvas;

		private Camera? _canvasCam;

		private float _worldMinX;

		private float _worldMinZ;

		private float _worldMaxX;

		private float _worldMaxZ;

		private bool _boundsValid;

		private bool _loggedBounds;

		private bool _isCircular;

		private float _boundsRefreshTimer;

		private const float BoundsRefreshInterval = 1f;

		private float _scanTimer;

		private const float ScanInterval = 0.2f;

		private readonly List<(Vector3 world, PickupCategory cat)> _drawList = new List<(Vector3, PickupCategory)>(64);

		private Texture2D? _blipTex;

		private float _pulsePhase;

		private GUIStyle? _labelStyle;

		private float _pruneTimer;

		private const float PruneInterval = 0.5f;

		private readonly List<int> _removeBuffer = new List<int>(8);

		private static readonly Il2CppStructArray<Vector3> _cornersBuffer = new Il2CppStructArray<Vector3>(4L);

		public static MinimapBlipOverlay? Instance { get; private set; }

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

		public static void Register(int id, Transform transform, PickupCategory category)
		{
			lock (_lock)
			{
				_pickups[id] = new PickupEntry
				{
					Transform = transform,
					Category = category
				};
			}
		}

		public static void Unregister(int id)
		{
			lock (_lock)
			{
				_pickups.Remove(id);
			}
		}

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			_blipTex = MakeCircleTexture(64);
			SceneManager.sceneLoaded += UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoaded);
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= UnityAction<Scene, LoadSceneMode>.op_Implicit((Action<Scene, LoadSceneMode>)OnSceneLoaded);
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
			if ((Object)(object)_blipTex != (Object)null)
			{
				Object.Destroy((Object)(object)_blipTex);
			}
		}

		private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			ManualLogSource log = PowerupMinimapPlugin.Log;
			if (log != null)
			{
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PowerupMinimap] Scene loaded: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Scene)(ref scene)).name);
				}
				log.LogInfo(val);
			}
			_minimapController = null;
			_mapImageRT = null;
			_maskRT = null;
			_canvas = null;
			_canvasCam = null;
			_boundsValid = false;
			_loggedBounds = false;
			_boundsRefreshTimer = 1f;
			lock (_lock)
			{
				_pickups.Clear();
			}
		}

		private void Update()
		{
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Expected O, but got Unknown
			if (!PowerupMinimapPlugin.Enabled.Value)
			{
				return;
			}
			float deltaTime = Time.deltaTime;
			float value = PowerupMinimapPlugin.PulseSpeed.Value;
			if (value > 0f)
			{
				_pulsePhase = (_pulsePhase + deltaTime * value * (float)Math.PI * 2f) % ((float)Math.PI * 2f);
			}
			RefreshMinimapRef();
			_scanTimer += deltaTime;
			if (_scanTimer >= 0.2f)
			{
				_scanTimer = 0f;
				ScanExistingCollectibles();
			}
			_pruneTimer += deltaTime;
			if (_pruneTimer >= 0.5f)
			{
				_pruneTimer = 0f;
				lock (_lock)
				{
					_removeBuffer.Clear();
					foreach (KeyValuePair<int, PickupEntry> pickup in _pickups)
					{
						if ((Object)(object)pickup.Value.Transform == (Object)null || !((Component)pickup.Value.Transform).gameObject.activeInHierarchy)
						{
							_removeBuffer.Add(pickup.Key);
						}
					}
					foreach (int item in _removeBuffer)
					{
						_pickups.Remove(item);
					}
				}
			}
			_boundsRefreshTimer += deltaTime;
			if (!(_boundsRefreshTimer >= 1f))
			{
				return;
			}
			_boundsRefreshTimer = 0f;
			_boundsValid = TryGetWorldBounds(out _worldMinX, out _worldMinZ, out _worldMaxX, out _worldMaxZ);
			if (_boundsValid && !_loggedBounds)
			{
				_loggedBounds = true;
				ManualLogSource log = PowerupMinimapPlugin.Log;
				if (log != null)
				{
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(56, 4, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PowerupMinimap] Map bounds confirmed: min=(");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_worldMinX, "F1");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_worldMinZ, "F1");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") max=(");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_worldMaxX, "F1");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_worldMaxZ, "F1");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
					}
					log.LogInfo(val);
				}
			}
			if ((Object)(object)_minimapController != (Object)null)
			{
				_isCircular = _minimapController.circularMask;
			}
		}

		private void ScanExistingCollectibles()
		{
			try
			{
				Il2CppArrayBase<CollectibleItemBase> val = Object.FindObjectsByType<CollectibleItemBase>((FindObjectsInactive)0, (FindObjectsSortMode)0);
				if (val == null || val.Length <= 0)
				{
					return;
				}
				for (int i = 0; i < val.Length; i++)
				{
					CollectibleItemBase val2 = val[i];
					if ((Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null && !val2.collected && !val2.IsCollected)
					{
						CollectiblePatches.TryRegister(val2);
					}
				}
			}
			catch
			{
			}
		}

		private void OnGUI()
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Invalid comparison between Unknown and I4
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: 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_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: 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_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			if (!PowerupMinimapPlugin.Enabled.Value || (Object)(object)_mapImageRT == (Object)null || (Object)(object)_blipTex == (Object)null || !_boundsValid)
			{
				return;
			}
			float num = _worldMaxX - _worldMinX;
			float num2 = _worldMaxZ - _worldMinZ;
			if (num < 0.001f || num2 < 0.001f)
			{
				return;
			}
			RectTransform val = _maskRT;
			bool flag = _isCircular;
			if ((Object)(object)_minimapController != (Object)null && (int)_minimapController._viewState == 1)
			{
				GameObject frameUnfolded = _minimapController.frameUnfolded;
				if ((Object)(object)frameUnfolded != (Object)null && frameUnfolded.activeInHierarchy)
				{
					RectTransform component = frameUnfolded.GetComponent<RectTransform>();
					if ((Object)(object)component != (Object)null)
					{
						val = component;
						flag = false;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Rect val2 = GUIRectOf(val);
			if (((Rect)(ref val2)).width < 1f || ((Rect)(ref val2)).height < 1f)
			{
				return;
			}
			float num3 = 1f + Mathf.Sin(_pulsePhase) * PowerupMinimapPlugin.PulseScale.Value;
			float size = PowerupMinimapPlugin.BlipSize.Value * num3;
			if (_labelStyle == null)
			{
				BuildLabelStyle();
			}
			_drawList.Clear();
			lock (_lock)
			{
				foreach (KeyValuePair<int, PickupEntry> pickup in _pickups)
				{
					if (!((Object)(object)pickup.Value.Transform == (Object)null) && ((Component)pickup.Value.Transform).gameObject.activeInHierarchy)
					{
						_drawList.Add((pickup.Value.Transform.position, pickup.Value.Category));
					}
				}
			}
			if (_drawList.Count == 0)
			{
				return;
			}
			float num4 = ((Rect)(ref val2)).width * 0.5f;
			float num5 = ((Rect)(ref val2)).height * 0.5f;
			float num6 = (flag ? (num4 * num4) : 0f);
			GUI.BeginClip(val2);
			foreach (var (val3, cat) in _drawList)
			{
				if (!IsVisible(cat))
				{
					continue;
				}
				float num7 = (val3.x - _worldMinX) / num;
				float num8 = (val3.z - _worldMinZ) / num2;
				float num9 = num7 - _mapImageRT.pivot.x;
				Rect rect = _mapImageRT.rect;
				float num10 = num9 * ((Rect)(ref rect)).width;
				float num11 = num8 - _mapImageRT.pivot.y;
				rect = _mapImageRT.rect;
				float num12 = num11 * ((Rect)(ref rect)).height;
				Vector3 val4 = ((Transform)_mapImageRT).TransformPoint(new Vector3(num10, num12, 0f));
				Vector2 val5 = RectTransformUtility.WorldToScreenPoint(_canvasCam, val4);
				float num13 = val5.x - ((Rect)(ref val2)).xMin;
				float num14 = (float)Screen.height - val5.y - ((Rect)(ref val2)).yMin;
				if (flag)
				{
					float num15 = num13 - num4;
					float num16 = num14 - num5;
					if (num15 * num15 + num16 * num16 > num6)
					{
						continue;
					}
				}
				else if (num13 < 0f || num13 > ((Rect)(ref val2)).width || num14 < 0f || num14 > ((Rect)(ref val2)).height)
				{
					continue;
				}
				DrawBlip(num13, num14, size, GetColor(cat), cat);
			}
			GUI.EndClip();
		}

		private void RefreshMinimapRef()
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			if ((Object)(object)_minimapController == (Object)null)
			{
				_minimapController = Object.FindAnyObjectByType<MinimapController>((FindObjectsInactive)1);
				if ((Object)(object)_minimapController == (Object)null)
				{
					return;
				}
				ManualLogSource log = PowerupMinimapPlugin.Log;
				if (log != null)
				{
					log.LogInfo((object)"[PowerupMinimap] Found MinimapController in scene!");
				}
				_mapImageRT = null;
				_maskRT = null;
				_canvas = null;
				_canvasCam = null;
				_boundsRefreshTimer = 1f;
			}
			if ((Object)(object)_mapImageRT == (Object)null || (Object)(object)_maskRT == (Object)null)
			{
				_mapImageRT = _minimapController.mapImageRect;
				_maskRT = _minimapController.maskRect;
				if ((Object)(object)_mapImageRT == (Object)null)
				{
					_mapImageRT = FindMinimapRect(_minimapController);
				}
				if ((Object)(object)_maskRT == (Object)null)
				{
					_maskRT = ((Component)_minimapController).GetComponent<RectTransform>();
				}
				if ((Object)(object)_mapImageRT != (Object)null && (Object)(object)_maskRT != (Object)null)
				{
					ManualLogSource log2 = PowerupMinimapPlugin.Log;
					if (log2 != null)
					{
						bool flag = default(bool);
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(57, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[PowerupMinimap] Acquired mapImageRect (");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)_mapImageRT).name);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") and maskRect (");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)_maskRT).name);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
						}
						log2.LogInfo(val);
					}
				}
			}
			if ((Object)(object)_canvas == (Object)null && (Object)(object)_mapImageRT != (Object)null)
			{
				_canvas = ((Component)_mapImageRT).GetComponentInParent<Canvas>();
				_canvasCam = (((Object)(object)_canvas != (Object)null) ? _canvas.worldCamera : null);
			}
		}

		private static RectTransform? FindMinimapRect(MinimapController ctrl)
		{
			string[] array = new string[5] { "MinimapImage", "MapImage", "Minimap", "Map", "MinimapPanel" };
			foreach (string text in array)
			{
				Transform val = ((Component)ctrl).transform.Find(text);
				if ((Object)(object)val != (Object)null)
				{
					RectTransform component = ((Component)val).GetComponent<RectTransform>();
					if ((Object)(object)component != (Object)null)
					{
						return component;
					}
				}
			}
			RectTransform component2 = ((Component)ctrl).GetComponent<RectTransform>();
			if ((Object)(object)component2 != (Object)null)
			{
				return component2;
			}
			if (((Component)ctrl).transform.childCount > 0)
			{
				RectTransform component3 = ((Component)((Component)ctrl).transform.GetChild(0)).GetComponent<RectTransform>();
				if ((Object)(object)component3 != (Object)null)
				{
					return component3;
				}
			}
			return null;
		}

		private bool TryGetWorldBounds(out float minX, out float minZ, out float maxX, out float maxZ)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			minX = (minZ = (maxX = (maxZ = 0f)));
			if ((Object)(object)_minimapController != (Object)null)
			{
				Vector2 minWorld = _minimapController._minWorld;
				Vector2 maxWorld = _minimapController._maxWorld;
				if (Mathf.Abs(maxWorld.x - minWorld.x) > 1f && Mathf.Abs(maxWorld.y - minWorld.y) > 1f)
				{
					minX = minWorld.x;
					minZ = minWorld.y;
					maxX = maxWorld.x;
					maxZ = maxWorld.y;
					return true;
				}
			}
			Terrain activeTerrain = Terrain.activeTerrain;
			if ((Object)(object)activeTerrain != (Object)null && (Object)(object)activeTerrain.terrainData != (Object)null)
			{
				Vector3 position = ((Component)activeTerrain).transform.position;
				Vector3 size = activeTerrain.terrainData.size;
				minX = position.x;
				minZ = position.z;
				maxX = position.x + size.x;
				maxZ = position.z + size.z;
				return true;
			}
			lock (_lock)
			{
				if (_pickups.Count == 0)
				{
					return false;
				}
				minX = float.MaxValue;
				minZ = float.MaxValue;
				maxX = float.MinValue;
				maxZ = float.MinValue;
				foreach (KeyValuePair<int, PickupEntry> pickup in _pickups)
				{
					if (!((Object)(object)pickup.Value.Transform == (Object)null))
					{
						Vector3 position2 = pickup.Value.Transform.position;
						minX = Mathf.Min(minX, position2.x);
						minZ = Mathf.Min(minZ, position2.z);
						maxX = Mathf.Max(maxX, position2.x);
						maxZ = Mathf.Max(maxZ, position2.z);
					}
				}
				float num = 50f;
				minX -= num;
				minZ -= num;
				maxX += num;
				maxZ += num;
				return maxX > minX && maxZ > minZ;
			}
		}

		private void DrawBlip(float cx, float cy, float size, Color col, PickupCategory cat)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			float num = size * 0.5f;
			Color color = col;
			color.a *= 0.35f;
			GUI.color = color;
			GUI.DrawTexture(new Rect(cx - num * 1.8f, cy - num * 1.8f, size * 1.8f, size * 1.8f), (Texture)(object)_blipTex);
			GUI.color = col;
			GUI.DrawTexture(new Rect(cx - num, cy - num, size, size), (Texture)(object)_blipTex);
			if (_labelStyle != null && size >= 6f)
			{
				GUI.color = Color.white;
				_labelStyle.fontSize = Mathf.RoundToInt(size * 0.7f);
				GUI.Label(new Rect(cx - num, cy - num, size, size), CategoryLetter(cat), _labelStyle);
			}
			GUI.color = Color.white;
		}

		private static string CategoryLetter(PickupCategory cat)
		{
			return cat switch
			{
				PickupCategory.HP => "+", 
				PickupCategory.Buff => "B", 
				PickupCategory.Bomb => "\ud83d\udca3", 
				PickupCategory.Magnet => "M", 
				PickupCategory.ExpBoost => "E", 
				PickupCategory.Speed => "S", 
				PickupCategory.Chest => "C", 
				_ => "?", 
			};
		}

		private static Color GetColor(PickupCategory cat)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(cat switch
			{
				PickupCategory.HP => PowerupMinimapPlugin.ParsedColorHP, 
				PickupCategory.Buff => PowerupMinimapPlugin.ParsedColorBuff, 
				PickupCategory.Bomb => PowerupMinimapPlugin.ParsedColorBomb, 
				PickupCategory.Magnet => PowerupMinimapPlugin.ParsedColorMagnet, 
				PickupCategory.ExpBoost => PowerupMinimapPlugin.ParsedColorExpBoost, 
				PickupCategory.Speed => PowerupMinimapPlugin.ParsedColorSpeed, 
				PickupCategory.Chest => PowerupMinimapPlugin.ParsedColorChest, 
				_ => PowerupMinimapPlugin.ParsedColorGeneric, 
			});
		}

		private static bool IsVisible(PickupCategory cat)
		{
			return cat switch
			{
				PickupCategory.HP => PowerupMinimapPlugin.ShowHP.Value, 
				PickupCategory.Buff => PowerupMinimapPlugin.ShowBuff.Value, 
				PickupCategory.Bomb => PowerupMinimapPlugin.ShowBomb.Value, 
				PickupCategory.Magnet => PowerupMinimapPlugin.ShowMagnet.Value, 
				PickupCategory.ExpBoost => PowerupMinimapPlugin.ShowExpBoost.Value, 
				PickupCategory.Speed => PowerupMinimapPlugin.ShowSpeed.Value, 
				PickupCategory.Chest => PowerupMinimapPlugin.ShowChest.Value, 
				_ => PowerupMinimapPlugin.ShowGeneric.Value, 
			};
		}

		private static Rect GUIRectOf(RectTransform rt)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			Canvas componentInParent = ((Component)rt).GetComponentInParent<Canvas>();
			Camera obj = (((Object)(object)componentInParent != (Object)null) ? componentInParent.worldCamera : null);
			rt.GetWorldCorners(_cornersBuffer);
			Vector2 val = RectTransformUtility.WorldToScreenPoint(obj, ((Il2CppArrayBase<Vector3>)(object)_cornersBuffer)[0]);
			Vector2 val2 = RectTransformUtility.WorldToScreenPoint(obj, ((Il2CppArrayBase<Vector3>)(object)_cornersBuffer)[2]);
			return new Rect(val.x, (float)Screen.height - val2.y, val2.x - val.x, val2.y - val.y);
		}

		private static Texture2D MakeCircleTexture(int size)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Object)val).hideFlags = (HideFlags)61;
			float num = (float)size * 0.5f;
			float num2 = num - 1f;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					float num3 = (float)j - num + 0.5f;
					float num4 = (float)i - num + 0.5f;
					val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01((num2 - Mathf.Sqrt(num3 * num3 + num4 * num4)) / 1.5f)));
				}
			}
			val.Apply();
			return val;
		}

		private void BuildLabelStyle()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			_labelStyle = new GUIStyle
			{
				alignment = (TextAnchor)4,
				fontStyle = (FontStyle)1,
				fontSize = 8
			};
			_labelStyle.normal.textColor = Color.white;
		}
	}
	internal static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.sineusarena.powerupminimap";

		public const string PLUGIN_NAME = "Powerup Minimap";

		public const string PLUGIN_VERSION = "2.0.3";
	}
	[BepInPlugin("com.sineusarena.powerupminimap", "Powerup Minimap", "2.0.3")]
	public class PowerupMinimapPlugin : BasePlugin
	{
		public static PowerupMinimapPlugin Instance { get; private set; }

		public static ManualLogSource Log { get; private set; }

		public static ConfigEntry<bool> Enabled { get; private set; }

		public static ConfigEntry<float> BlipSize { get; private set; }

		public static ConfigEntry<float> PulseSpeed { get; private set; }

		public static ConfigEntry<float> PulseScale { get; private set; }

		public static ConfigEntry<string> ColorHP { get; private set; }

		public static ConfigEntry<string> ColorBuff { get; private set; }

		public static ConfigEntry<string> ColorBomb { get; private set; }

		public static ConfigEntry<string> ColorMagnet { get; private set; }

		public static ConfigEntry<string> ColorExpBoost { get; private set; }

		public static ConfigEntry<string> ColorSpeed { get; private set; }

		public static ConfigEntry<string> ColorChest { get; private set; }

		public static ConfigEntry<string> ColorGeneric { get; private set; }

		public static Color ParsedColorHP { get; private set; }

		public static Color ParsedColorBuff { get; private set; }

		public static Color ParsedColorBomb { get; private set; }

		public static Color ParsedColorMagnet { get; private set; }

		public static Color ParsedColorExpBoost { get; private set; }

		public static Color ParsedColorSpeed { get; private set; }

		public static Color ParsedColorChest { get; private set; }

		public static Color ParsedColorGeneric { get; private set; }

		public static ConfigEntry<bool> ShowHP { get; private set; }

		public static ConfigEntry<bool> ShowBuff { get; private set; }

		public static ConfigEntry<bool> ShowBomb { get; private set; }

		public static ConfigEntry<bool> ShowMagnet { get; private set; }

		public static ConfigEntry<bool> ShowExpBoost { get; private set; }

		public static ConfigEntry<bool> ShowSpeed { get; private set; }

		public static ConfigEntry<bool> ShowChest { get; private set; }

		public static ConfigEntry<bool> ShowGeneric { get; private set; }

		public override void Load()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			Instance = this;
			Log = ((BasePlugin)this).Log;
			BindConfig();
			try
			{
				ClassInjector.RegisterTypeInIl2Cpp<MinimapBlipOverlay>();
				GameObject val = new GameObject("PowerupMinimapOverlay");
				Object.DontDestroyOnLoad((Object)val);
				val.AddComponent<MinimapBlipOverlay>();
				Log.LogInfo((object)"Powerup Minimap (IL2CPP) loaded successfully!");
			}
			catch (Exception ex)
			{
				Log.LogError((object)("Failed to initialize Powerup Minimap: " + ex));
			}
		}

		public override bool Unload()
		{
			return ((BasePlugin)this).Unload();
		}

		private void BindConfig()
		{
			Enabled = ((BasePlugin)this).Config.Bind<bool>("1 - General", "Enabled", true, "Enable or disable the entire mod.");
			BlipSize = ((BasePlugin)this).Config.Bind<float>("2 - Appearance", "BlipSize", 8f, "Radius in minimap pixels of each powerup blip.");
			PulseSpeed = ((BasePlugin)this).Config.Bind<float>("2 - Appearance", "PulseSpeed", 2.5f, "How fast the blips pulse (cycles per second). Set to 0 to disable pulsing.");
			PulseScale = ((BasePlugin)this).Config.Bind<float>("2 - Appearance", "PulseScale", 0.35f, "Fractional size change during pulsing (0 = no pulse, 0.5 = ±50% size).");
			ColorHP = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorHP", "#33E64D", "Hex colour for healing / HP pickups (e.g. #RRGGBB).");
			ColorBuff = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorBuff", "#E69919", "Hex colour for buff pickups.");
			ColorBomb = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorBomb", "#F24019", "Hex colour for bomb pickups.");
			ColorMagnet = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorMagnet", "#8C4DF2", "Hex colour for magnet pickups.");
			ColorExpBoost = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorExpBoost", "#19B3F2", "Hex colour for experience boost pickups.");
			ColorSpeed = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorSpeed", "#F2F219", "Hex colour for speed buff pickups.");
			ColorChest = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorChest", "#FFCC1A", "Hex colour for buff chest items.");
			ColorGeneric = ((BasePlugin)this).Config.Bind<string>("3 - Colors", "ColorGeneric", "#CCCCCC", "Hex colour for any other pickup types.");
			UpdateParsedColors();
			ColorHP.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorBuff.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorBomb.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorMagnet.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorExpBoost.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorSpeed.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorChest.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ColorGeneric.SettingChanged += delegate
			{
				UpdateParsedColors();
			};
			ShowHP = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowHP", true, "Show HP / healing pickups on the minimap.");
			ShowBuff = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowBuff", true, "Show buff pickups on the minimap.");
			ShowBomb = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowBomb", true, "Show bomb pickups on the minimap.");
			ShowMagnet = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowMagnet", true, "Show magnet pickups on the minimap.");
			ShowExpBoost = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowExpBoost", true, "Show experience boost pickups on the minimap.");
			ShowSpeed = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowSpeed", true, "Show speed buff pickups on the minimap.");
			ShowChest = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowChest", false, "Show buff chests on the minimap (default false as game has native icon).");
			ShowGeneric = ((BasePlugin)this).Config.Bind<bool>("4 - Filters", "ShowGeneric", true, "Show all other pickup types on the minimap.");
		}

		private static void UpdateParsedColors()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_0131: 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_015e: Unknown result type (might be due to invalid IL or missing references)
			ParsedColorHP = ParseColor(ColorHP.Value, new Color(0.2f, 0.9f, 0.3f, 1f));
			ParsedColorBuff = ParseColor(ColorBuff.Value, new Color(0.9f, 0.6f, 0.1f, 1f));
			ParsedColorBomb = ParseColor(ColorBomb.Value, new Color(0.95f, 0.25f, 0.1f, 1f));
			ParsedColorMagnet = ParseColor(ColorMagnet.Value, new Color(0.55f, 0.3f, 0.95f, 1f));
			ParsedColorExpBoost = ParseColor(ColorExpBoost.Value, new Color(0.1f, 0.7f, 0.95f, 1f));
			ParsedColorSpeed = ParseColor(ColorSpeed.Value, new Color(0.95f, 0.95f, 0.1f, 1f));
			ParsedColorChest = ParseColor(ColorChest.Value, new Color(1f, 0.8f, 0.1f, 1f));
			ParsedColorGeneric = ParseColor(ColorGeneric.Value, new Color(0.8f, 0.8f, 0.8f, 1f));
		}

		private static Color ParseColor(string hex, Color fallback)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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)
			if (string.IsNullOrWhiteSpace(hex))
			{
				return fallback;
			}
			hex = hex.Trim().TrimStart('#');
			try
			{
				if (hex.Length == 6)
				{
					byte num = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
					byte b = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
					byte b2 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
					return new Color((float)(int)num / 255f, (float)(int)b / 255f, (float)(int)b2 / 255f, 1f);
				}
				if (hex.Length == 8)
				{
					byte num2 = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber);
					byte b3 = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber);
					byte b4 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber);
					byte b5 = byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber);
					return new Color((float)(int)num2 / 255f, (float)(int)b3 / 255f, (float)(int)b4 / 255f, (float)(int)b5 / 255f);
				}
				if (hex.Length == 3)
				{
					byte num3 = byte.Parse(new string(hex[0], 2), NumberStyles.HexNumber);
					byte b6 = byte.Parse(new string(hex[1], 2), NumberStyles.HexNumber);
					byte b7 = byte.Parse(new string(hex[2], 2), NumberStyles.HexNumber);
					return new Color((float)(int)num3 / 255f, (float)(int)b6 / 255f, (float)(int)b7 / 255f, 1f);
				}
			}
			catch
			{
			}
			return fallback;
		}
	}
}