Decompiled source of SeneaLHudLayout v1.5.54

SeneaLHudLayout.dll

Decompiled 16 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.5.54")]
[assembly: AssemblyInformationalVersion("1.5.54+3c37e103a6cdbc394a311ff9dde62b1d15ab5ebe")]
[assembly: AssemblyVersion("1.5.54.0")]
[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;
		}
	}
}
namespace SeneaLHudLayout
{
	internal static class ActionSlotXpBar
	{
		private const string RootName = "SeneaLHudLayout_SlotXp";

		private const float BaseLevelFont = 12f;

		private const float BaseBarWidth = 100f;

		private const float BaseBarHeight = 6f;

		private const float BaseSmallFont = 10f;

		private const float BaseInnerGap = 8f;

		private const float BaseBarGap = 6f;

		private const float PlatePadX = 7f;

		private const float PlatePadY = 4f;

		private const float BaseNumbersPad = 6f;

		private const float PlateMinHeight = 18f;

		private const float SlotGap = 12f;

		private static readonly Color PlateFill = new Color(0.05f, 0.04f, 0.03f, 0.5f);

		private static readonly Color GoldLine = new Color(0.93f, 0.82f, 0.52f, 1f);

		private static readonly Color TextColor = new Color(0.93f, 0.82f, 0.52f, 1f);

		private static readonly Color BorderGold = new Color(0.93f, 0.82f, 0.52f, 0.15f);

		private static readonly Color FillGold = GoldLine;

		private static Transform _root;

		private static Image _plateTop;

		private static Image _plateAmount;

		private const float BaseBorderThickness = 0.5f;

		private static Image _borderTop;

		private static Image _borderBottom;

		private static Image _borderLeft;

		private static Image _borderRight;

		private static bool? _placedBorder;

		private static float _placedBorderWidth = float.NaN;

		private static float? _placedBorderAlpha;

		private static float _cardW;

		private static float _cardTop;

		private static float _cardBottom;

		private static float _cardCenterY;

		private static float _cardH;

		private static Image _back;

		private static Image _fill;

		private static TextMeshProUGUI _level;

		private static TextMeshProUGUI _amount;

		private static TextMeshProUGUI _percent;

		private static FieldInfo _hotbarField;

		private static FieldInfo _frameActions;

		private static FieldInfo _frameQuiver;

		private static bool _lookup;

		private static float _scale = 1f;

		private static float _placedRight = float.NaN;

		private static float _placedCenter = float.NaN;

		private static float _placedLevelWidth = float.NaN;

		private static float _placedAmountWidth = float.NaN;

		private static float _placedPercentWidth = float.NaN;

		private static float _placedScale = float.NaN;

		private static string _placedText = "";

		private static float _placedFill = float.NaN;

		private static bool _fontApplied;

		private static float _nextFont;

		private const float DataInterval = 0.1f;

		private static float _nextData;

		private static int _dataLevel = -1;

		private static float _dataFraction = -1f;

		private static float _dataCurrent;

		private static float _dataRequired;

		private const float DefaultTrackOpacity = 0.25f;

		private static float _placedTrack = float.NaN;

		private const float DefaultPlateOpacity = 0.75f;

		private static float _placedPlate = float.NaN;

		private static Canvas _cardCanvas;

		private static Canvas _cardParentCanvas;

		private static Graphic _cover;

		private static Graphic _coverTop;

		private static readonly HashSet<string> CoverLogged = new HashSet<string>();

		private static float _nextScan;

		private const float ScanInterval = 1.5f;

		private static Sprite _plate;

		private static Sprite _barFrame;

		private static float BorderThickness => BorderWidthPx();

		private static float LevelFont => 12f * _scale;

		private static float SmallFont => 10f * _scale;

		private static float BarWidth => 100f * _scale;

		private static float BarHeight => Mathf.Max(4f, 6f * _scale);

		private static float InnerGap => 8f * _scale;

		private static float BarGap => 6f * _scale;

		private static float PadX => 7f * _scale;

		private static float PadY => 4f * _scale;

		private static float NumbersPad => 6f * _scale;

		private static float TrackOpacity()
		{
			return Mathf.Clamp01(SeneaLHudLayoutPlugin.ShowSlotXpBarTrackOpacity?.Value ?? 0.25f);
		}

		private static float PlateAlpha()
		{
			return Mathf.Clamp01(SeneaLHudLayoutPlugin.ShowSlotXpBarOpacity?.Value ?? 0.75f);
		}

		private static bool BorderOn()
		{
			return SeneaLHudLayoutPlugin.ShowSlotXpBarBorder?.Value ?? true;
		}

		private static float BorderWidthPx()
		{
			return Mathf.Clamp(SeneaLHudLayoutPlugin.ShowSlotXpBarBorderWidth?.Value ?? 0.5f, 0.1f, 4f) * _scale;
		}

		private static Color BorderColor()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<float> showSlotXpBarBorderOpacity = SeneaLHudLayoutPlugin.ShowSlotXpBarBorderOpacity;
			float a = ((showSlotXpBarBorderOpacity != null) ? Mathf.Clamp01(showSlotXpBarBorderOpacity.Value) : 0.15f);
			Color borderGold = BorderGold;
			borderGold.a = a;
			return borderGold;
		}

		private static bool DigitsWhite()
		{
			return SeneaLHudLayoutPlugin.ShowSlotXpBarWhiteNumbers?.Value ?? true;
		}

		private static string Digits(string number, bool white)
		{
			if (!white)
			{
				return number;
			}
			return "<color=#FFFFFFFF>" + number + "</color>";
		}

		private static void PlaceBorder()
		{
			//IL_0047: 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)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_borderTop == (Object)null) && !(_cardW <= 0f))
			{
				float borderThickness = BorderThickness;
				((Transform)((Graphic)_borderTop).rectTransform).localPosition = new Vector3(_cardW * 0.5f, _cardTop - borderThickness * 0.5f, 0f);
				((Graphic)_borderTop).rectTransform.sizeDelta = new Vector2(_cardW, borderThickness);
				((Transform)((Graphic)_borderBottom).rectTransform).localPosition = new Vector3(_cardW * 0.5f, _cardBottom + borderThickness * 0.5f, 0f);
				((Graphic)_borderBottom).rectTransform.sizeDelta = new Vector2(_cardW, borderThickness);
				((Transform)((Graphic)_borderLeft).rectTransform).localPosition = new Vector3(borderThickness * 0.5f, _cardCenterY, 0f);
				((Graphic)_borderLeft).rectTransform.sizeDelta = new Vector2(borderThickness, _cardH - 2f * borderThickness);
				((Transform)((Graphic)_borderRight).rectTransform).localPosition = new Vector3(_cardW - borderThickness * 0.5f, _cardCenterY, 0f);
				((Graphic)_borderRight).rectTransform.sizeDelta = new Vector2(borderThickness, _cardH - 2f * borderThickness);
				_placedBorderWidth = borderThickness;
			}
		}

		public static void Tick()
		{
			//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_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: 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_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0598: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			if (SeneaLHudLayoutPlugin.ShowSlotXpBar == null || !SeneaLHudLayoutPlugin.ShowSlotXpBar.Value || !((Object)(object)Player.m_localPlayer != (Object)null))
			{
				Hide();
				return;
			}
			RectTransform val = Anchor();
			RectTransform hotbarShift = HudLayout.HotbarShift;
			if ((Object)(object)val == (Object)null || (Object)(object)hotbarShift == (Object)null || !((Component)val).gameObject.activeInHierarchy)
			{
				Hide();
			}
			else
			{
				if (!Ensure(hotbarShift))
				{
					return;
				}
				if (!_fontApplied && Time.unscaledTime >= _nextFont)
				{
					_nextFont = Time.unscaledTime + 1f;
					CharacterExtras.CopyFoodBarFont(_level);
					CharacterExtras.CopyFoodBarFont(_percent);
					CharacterExtras.CopyFoodBarFont(_amount);
					KillLabelGlow();
					_fontApplied = HasFoodFont(_level);
				}
				if (Time.unscaledTime >= _nextData)
				{
					_nextData = Time.unscaledTime + 0.1f;
					SyncOrder();
					GuardCover();
					_dataLevel = CharacterExtras.Level(Player.m_localPlayer);
					_dataFraction = ((_dataLevel < 0) ? (-1f) : Mathf.Clamp01(CharacterExtras.Fraction(Player.m_localPlayer)));
					if (_dataLevel >= 0)
					{
						CharacterExtras.Xp(Player.m_localPlayer, out _dataCurrent, out _dataRequired);
					}
				}
				if (_dataLevel < 0)
				{
					Hide();
					return;
				}
				float num = ((SeneaLHudLayoutPlugin.ShowSlotXpBarScale == null) ? 1f : Mathf.Clamp(SeneaLHudLayoutPlugin.ShowSlotXpBarScale.Value, 0.5f, 3f));
				if (!Mathf.Approximately(num, _scale))
				{
					_scale = num;
					_placedFill = float.NaN;
				}
				float num2 = ((_dataFraction < 0f) ? 0f : _dataFraction);
				bool white = DigitsWhite();
				string text = "Level " + Digits(_dataLevel.ToString(), white);
				string text2 = Digits(CharacterExtras.XpText(_dataCurrent), white) + " / " + Digits(CharacterExtras.XpText(_dataRequired), white);
				string text3 = Digits(Mathf.RoundToInt(num2 * 100f).ToString(), white) + "%";
				string text4 = text + "|" + text2 + "|" + text3 + "|" + _scale;
				bool num3 = text4 != _placedText;
				if (num3)
				{
					((TMP_Text)_level).text = text;
					((TMP_Text)_amount).text = text2;
					((TMP_Text)_percent).text = text3;
					((TMP_Text)_level).ForceMeshUpdate(false, false);
					((TMP_Text)_amount).ForceMeshUpdate(false, false);
					((TMP_Text)_percent).ForceMeshUpdate(false, false);
				}
				float num4 = Mathf.Ceil(((TMP_Text)_level).preferredWidth);
				float num5 = Mathf.Ceil(((TMP_Text)_amount).preferredWidth);
				float num6 = Mathf.Ceil(((TMP_Text)_percent).preferredWidth);
				Vector2 val2 = AttachPoint(val, hotbarShift);
				if (num3 || !Mathf.Approximately(val2.x, _placedRight) || !Mathf.Approximately(val2.y, _placedCenter) || !Mathf.Approximately(num4, _placedLevelWidth) || !Mathf.Approximately(num5, _placedAmountWidth) || !Mathf.Approximately(num6, _placedPercentWidth) || !Mathf.Approximately(_scale, _placedScale))
				{
					_root.localPosition = new Vector3(val2.x, val2.y, 0f);
					Place(num4, num5, num6);
					_placedRight = val2.x;
					_placedCenter = val2.y;
					_placedLevelWidth = num4;
					_placedAmountWidth = num5;
					_placedPercentWidth = num6;
					_placedScale = _scale;
					_placedText = text4;
				}
				float num7 = Mathf.Max(0f, BarWidth - 2f) * num2;
				if (float.IsNaN(_placedFill) || Mathf.Abs(num7 - _placedFill) > 0.1f)
				{
					((Graphic)_fill).rectTransform.sizeDelta = new Vector2(num7, Mathf.Max(0f, BarHeight - 2f));
					((Graphic)_fill).rectTransform.anchoredPosition = new Vector2(1f, 0f);
					_placedFill = num7;
				}
				float num8 = TrackOpacity();
				if (float.IsNaN(_placedTrack) || Mathf.Abs(num8 - _placedTrack) > 0.01f)
				{
					((Graphic)_back).color = new Color(1f, 1f, 1f, num8);
					_placedTrack = num8;
				}
				float num9 = PlateAlpha();
				if (float.IsNaN(_placedPlate) || Mathf.Abs(num9 - _placedPlate) > 0.01f)
				{
					Color plateFill = PlateFill;
					plateFill.a = num9;
					((Graphic)_plateTop).color = plateFill;
					((Graphic)_plateAmount).color = plateFill;
					_placedPlate = num9;
				}
				bool flag = BorderOn();
				if (!_placedBorder.HasValue || _placedBorder.Value != flag)
				{
					((Behaviour)_borderTop).enabled = flag;
					((Behaviour)_borderBottom).enabled = flag;
					((Behaviour)_borderLeft).enabled = flag;
					((Behaviour)_borderRight).enabled = flag;
					_placedBorder = flag;
				}
				Color val3 = BorderColor();
				if (!_placedBorderAlpha.HasValue || Mathf.Abs(val3.a - _placedBorderAlpha.Value) > 0.01f)
				{
					((Graphic)_borderTop).color = val3;
					((Graphic)_borderBottom).color = val3;
					((Graphic)_borderLeft).color = val3;
					((Graphic)_borderRight).color = val3;
					_placedBorderAlpha = val3.a;
				}
				float borderThickness = BorderThickness;
				if (float.IsNaN(_placedBorderWidth) || Mathf.Abs(borderThickness - _placedBorderWidth) > 0.01f)
				{
					PlaceBorder();
				}
				if (!((Component)_root).gameObject.activeSelf)
				{
					((Component)_root).gameObject.SetActive(true);
				}
			}
		}

		private static RectTransform Anchor()
		{
			EnsureLookup();
			RectTransform val = Frame(_frameActions);
			RectTransform val2 = Frame(_frameQuiver);
			if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy)
			{
				return val;
			}
			if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy)
			{
				return val2;
			}
			if (!((Object)(object)val != (Object)null))
			{
				return val2;
			}
			return val;
		}

		private static RectTransform Frame(FieldInfo field)
		{
			if (field == null || _hotbarField == null)
			{
				return null;
			}
			object value = _hotbarField.GetValue(null);
			if (value != null)
			{
				object? value2 = field.GetValue(value);
				return (RectTransform)((value2 is RectTransform) ? value2 : null);
			}
			return null;
		}

		private static float RightWorld(RectTransform rt)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = rt.rect;
			return ((Transform)rt).TransformPoint(new Vector3(((Rect)(ref rect)).xMax, 0f, 0f)).x;
		}

		private static Vector2 AttachPoint(RectTransform anchor, RectTransform shift)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0042: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_005b: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			float num = ContentRight(anchor);
			Vector3 val = ((Transform)anchor).TransformPoint(new Vector3(num, 0f, 0f));
			Rect rect = anchor.rect;
			Vector3 val2 = ((Transform)anchor).TransformPoint(new Vector3(0f, ((Rect)(ref rect)).center.y, 0f));
			Vector2 val3 = Vector2.op_Implicit(((Transform)shift).InverseTransformPoint(val));
			Vector2 val4 = Vector2.op_Implicit(((Transform)shift).InverseTransformPoint(val2));
			return new Vector2(val3.x + 12f, val4.y);
		}

		private static float ContentRight(RectTransform frame)
		{
			//IL_0073: 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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_002e: 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)
			float num = float.NegativeInfinity;
			Rect rect;
			for (int i = 0; i < ((Transform)frame).childCount; i++)
			{
				Transform child = ((Transform)frame).GetChild(i);
				RectTransform val = (RectTransform)(object)((child is RectTransform) ? child : null);
				if (val != null && ((Component)val).gameObject.activeInHierarchy)
				{
					float num2 = num;
					rect = val.rect;
					num = Mathf.Max(num2, ((Rect)(ref rect)).xMax + val.anchoredPosition.x);
				}
			}
			if (!float.IsNegativeInfinity(num))
			{
				float num3 = num;
				rect = frame.rect;
				return Mathf.Min(num3, ((Rect)(ref rect)).xMax);
			}
			rect = frame.rect;
			return ((Rect)(ref rect)).xMax;
		}

		private static void Place(float levelWidth, float amountWidth, float percentWidth)
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: 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_0253: 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)
			float num = Mathf.Max(14f * _scale, LevelFont + 6f * _scale);
			float num2 = SmallFont + 2f * _scale;
			float num3 = num2 + NumbersPad;
			float num4 = PadX + levelWidth + InnerGap;
			float num5 = num4 + BarWidth + BarGap + percentWidth + PadX;
			float num6 = num * 0.25f + num2 * 0.5f;
			float num7 = num6 - num * 0.5f - num3 * 0.5f;
			float num8 = (0f - (num - BarHeight)) * 0.5f + 1f * _scale;
			float num9 = num6 + num * 0.5f;
			float num10 = num7 - num3 * 0.5f;
			float cardCenterY = (num9 + num10) * 0.5f;
			float cardH = num9 - num10;
			((Transform)((Graphic)_plateTop).rectTransform).localPosition = new Vector3(num5 * 0.5f, num6, 0f);
			((Graphic)_plateTop).rectTransform.sizeDelta = new Vector2(num5, num);
			((Transform)((TMP_Text)_level).rectTransform).localPosition = new Vector3((0f - num5) * 0.5f + PadX + levelWidth * 0.5f, num8, 0f);
			((TMP_Text)_level).rectTransform.sizeDelta = new Vector2(levelWidth, num);
			((Transform)((Graphic)_back).rectTransform).localPosition = new Vector3((0f - num5) * 0.5f + num4 + BarWidth * 0.5f, num8, 0f);
			((Graphic)_back).rectTransform.sizeDelta = new Vector2(BarWidth, BarHeight);
			((Transform)((TMP_Text)_percent).rectTransform).localPosition = new Vector3((0f - num5) * 0.5f + num4 + BarWidth + BarGap + percentWidth * 0.5f, num8, 0f);
			((TMP_Text)_percent).rectTransform.sizeDelta = new Vector2(percentWidth, num);
			((Transform)((Graphic)_plateAmount).rectTransform).localPosition = new Vector3(num5 * 0.5f, num7, 0f);
			((Graphic)_plateAmount).rectTransform.sizeDelta = new Vector2(num5, num3);
			((Transform)((TMP_Text)_amount).rectTransform).localPosition = new Vector3((0f - num5) * 0.5f + num4 + amountWidth * 0.5f, NumbersPad * 0.5f, 0f);
			((TMP_Text)_amount).rectTransform.sizeDelta = new Vector2(amountWidth, num2);
			_cardW = num5;
			_cardTop = num9;
			_cardBottom = num10;
			_cardCenterY = cardCenterY;
			_cardH = cardH;
			PlaceBorder();
		}

		private static bool Ensure(RectTransform shift)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_root != (Object)null && (Object)(object)_root.parent == (Object)(object)shift)
			{
				return true;
			}
			Transform val = ((Transform)shift).Find("SeneaLHudLayout_SlotXp");
			if ((Object)(object)val != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			GameObject val2 = new GameObject("SeneaLHudLayout_SlotXp", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent((Transform)(object)shift, false);
			val2.layer = ((Component)shift).gameObject.layer;
			_root = val2.transform;
			Canvas componentInParent = ((Component)shift).GetComponentInParent<Canvas>();
			Canvas obj = val2.AddComponent<Canvas>();
			obj.overrideSorting = true;
			obj.sortingOrder = (((Object)(object)componentInParent != (Object)null) ? componentInParent.sortingOrder : 0) + 1;
			_cardCanvas = obj;
			_cardParentCanvas = componentInParent;
			RectTransform val3 = (RectTransform)_root;
			val3.anchorMin = Vector2.zero;
			val3.anchorMax = Vector2.zero;
			val3.pivot = new Vector2(0f, 0.5f);
			val3.sizeDelta = Vector2.zero;
			((Transform)val3).localScale = Vector3.one;
			Debug.Log((object)"[SeneaL HUD Layout] XP bar built, v1.5.54");
			_plateTop = MakePlate("plateTop", _root);
			_plateAmount = MakePlate("plateAmount", _root);
			_borderTop = MakeLine("borderTop", _root);
			_borderBottom = MakeLine("borderBottom", _root);
			_borderLeft = MakeLine("borderLeft", _root);
			_borderRight = MakeLine("borderRight", _root);
			_placedBorder = null;
			_placedBorderWidth = float.NaN;
			_placedBorderAlpha = null;
			_back = MakeImage("bar", ((Component)_plateTop).transform);
			((Graphic)_back).color = Color.white;
			_back.sprite = BarFrame();
			_back.type = (Type)1;
			_fill = MakeImage("fill", ((Component)_back).transform);
			((Graphic)_fill).color = FillGold;
			_level = MakeLabel("level", ((Component)_plateTop).transform, (TextAlignmentOptions)4097, LevelFont);
			_percent = MakeLabel("percent", ((Component)_plateTop).transform, (TextAlignmentOptions)4097, SmallFont);
			_amount = MakeLabel("amount", ((Component)_plateAmount).transform, (TextAlignmentOptions)4098, SmallFont);
			CenterAll();
			RectTransform rectTransform = ((Graphic)_fill).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 0.5f);
			rectTransform.anchorMax = new Vector2(0f, 0.5f);
			rectTransform.pivot = new Vector2(0f, 0.5f);
			rectTransform.anchoredPosition = new Vector2(1f, 0f);
			rectTransform.sizeDelta = Vector2.zero;
			_placedRight = float.NaN;
			_placedLevelWidth = float.NaN;
			_placedAmountWidth = float.NaN;
			_placedPercentWidth = float.NaN;
			_placedScale = float.NaN;
			_placedText = "";
			_placedFill = float.NaN;
			_placedTrack = float.NaN;
			_placedPlate = float.NaN;
			_placedBorder = null;
			return true;
		}

		private static void SyncOrder()
		{
			if ((Object)(object)_cardCanvas == (Object)null)
			{
				return;
			}
			if ((Object)(object)_cardParentCanvas == (Object)null || (Object)(object)_cardParentCanvas == (Object)(object)_cardCanvas.rootCanvas)
			{
				_cardParentCanvas = (((Object)(object)((Component)_cardCanvas).transform.parent != (Object)null) ? ((Component)((Component)_cardCanvas).transform.parent).GetComponentInParent<Canvas>() : null);
				if ((Object)(object)_cardParentCanvas == (Object)null || (Object)(object)_cardParentCanvas == (Object)(object)_cardCanvas)
				{
					return;
				}
			}
			int num = _cardParentCanvas.sortingOrder + 1;
			if (_cardCanvas.sortingOrder != num)
			{
				_cardCanvas.sortingOrder = num;
			}
		}

		private static string ColorText(Color c)
		{
			return "(" + c.r.ToString("F2") + "," + c.g.ToString("F2") + "," + c.b.ToString("F2") + "," + c.a.ToString("F2") + ")";
		}

		private static void GuardCover()
		{
			//IL_0020: 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)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: 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_0246: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_back == (Object)null)
			{
				return;
			}
			if ((Object)(object)_cover != (Object)null && !Blackened(_cover.color))
			{
				PaintCover(_cover);
			}
			if ((Object)(object)_coverTop != (Object)null && ((Component)_coverTop).gameObject.activeSelf)
			{
				((Component)_coverTop).gameObject.SetActive(false);
			}
			if (Time.unscaledTime < _nextScan)
			{
				return;
			}
			_nextScan = Time.unscaledTime + 1.5f;
			Canvas componentInParent = ((Component)_root).GetComponentInParent<Canvas>();
			Canvas val = (((Object)(object)componentInParent != (Object)null) ? componentInParent.rootCanvas : null);
			Camera cam = (((Object)(object)val != (Object)null && (int)val.renderMode != 0) ? val.worldCamera : null);
			int num = (((Object)(object)val != (Object)null) ? val.sortingOrder : int.MinValue);
			Rect bar = ScreenRect(((Graphic)_plateTop).rectTransform, cam);
			if (((Rect)(ref bar)).width * ((Rect)(ref bar)).height < 64f)
			{
				return;
			}
			RectTransform hotbarShift = HudLayout.HotbarShift;
			if ((Object)(object)hotbarShift == (Object)null)
			{
				return;
			}
			Graphic[] array = Object.FindObjectsOfType<Graphic>();
			foreach (Graphic val2 in array)
			{
				if ((Object)(object)val2 == (Object)null || (Object)(object)val2 == (Object)(object)_cover || (Object)(object)val2 == (Object)(object)_coverTop || !((Behaviour)val2).isActiveAndEnabled)
				{
					continue;
				}
				Transform transform = ((Component)val2).transform;
				Canvas val3 = (((Object)(object)val2.canvas != (Object)null) ? val2.canvas.rootCanvas : null);
				if ((!Under(transform, (Transform)(object)hotbarShift) && (!((Object)(object)val != (Object)null) || !((Object)(object)val3 == (Object)(object)val))) || Under(transform, _root) || (Object)(object)transform == (Object)(object)hotbarShift)
				{
					continue;
				}
				Color color = val2.color;
				if (!(color.a <= 0.02f) && !(CoverFraction(ScreenRect(val2.rectTransform, cam), bar) < 0.75f))
				{
					string text = Path(((Component)val2).transform);
					if ((Object)(object)val3 == (Object)null || val3.sortingOrder >= num)
					{
						_coverTop = val2;
						((Component)val2).gameObject.SetActive(false);
						LogCover(text + " (draws over the card) col " + ColorText(color));
					}
					else
					{
						_cover = val2;
						PaintCover(val2);
						LogCover(text + " (behind the card) was col " + ColorText(color));
					}
					break;
				}
			}
		}

		private static void LogCover(string message)
		{
			if (CoverLogged.Add(message))
			{
				Debug.Log((object)("[SeneaL HUD Layout] XP cover: fixed " + message));
			}
		}

		private static void PaintCover(Graphic graphic)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Min(graphic.color.a, 0.45f);
			graphic.color = new Color(PlateFill.r, PlateFill.g, PlateFill.b, num);
		}

		private static bool Blackened(Color color)
		{
			//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			if (color.r <= 0.2f && color.g <= 0.2f)
			{
				return color.b <= 0.2f;
			}
			return false;
		}

		private static bool Warm(Color color)
		{
			//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (color.r >= 0.45f && color.g >= 0.3f)
			{
				return color.b <= 0.85f * color.g;
			}
			return false;
		}

		private static bool Under(Transform t, Transform ancestor)
		{
			int num = 0;
			while ((Object)(object)t != (Object)null && num < 16)
			{
				if ((Object)(object)t == (Object)(object)ancestor)
				{
					return true;
				}
				num++;
				t = t.parent;
			}
			return false;
		}

		private static float CoverFraction(Rect rect, Rect bar)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref bar)).width * ((Rect)(ref bar)).height;
			if (num <= 0f || ((Rect)(ref rect)).width < 1f || ((Rect)(ref rect)).height < 1f)
			{
				return 0f;
			}
			Rect val = Rect.MinMaxRect(Mathf.Max(((Rect)(ref rect)).xMin, ((Rect)(ref bar)).xMin), Mathf.Max(((Rect)(ref rect)).yMin, ((Rect)(ref bar)).yMin), Mathf.Min(((Rect)(ref rect)).xMax, ((Rect)(ref bar)).xMax), Mathf.Min(((Rect)(ref rect)).yMax, ((Rect)(ref bar)).yMax));
			if (((Rect)(ref val)).width <= 0f || ((Rect)(ref val)).height <= 0f)
			{
				return 0f;
			}
			return ((Rect)(ref val)).width * ((Rect)(ref val)).height / num;
		}

		private static Rect ScreenRect(RectTransform rt, Camera cam)
		{
			//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_003a: 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_004b: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			rt.GetWorldCorners(array);
			float num = float.MaxValue;
			float num2 = float.MinValue;
			float num3 = float.MaxValue;
			float num4 = float.MinValue;
			for (int i = 0; i < 4; i++)
			{
				Vector2 val = RectTransformUtility.WorldToScreenPoint(cam, array[i]);
				num = Mathf.Min(num, val.x);
				num2 = Mathf.Max(num2, val.x);
				num3 = Mathf.Min(num3, val.y);
				num4 = Mathf.Max(num4, val.y);
			}
			return new Rect(num, num3, num2 - num, num4 - num3);
		}

		private static string Path(Transform t)
		{
			StringBuilder stringBuilder = new StringBuilder(64);
			List<string> list = new List<string>(8);
			int num = 0;
			while ((Object)(object)t != (Object)null && num < 8)
			{
				list.Add(((Object)t).name);
				num++;
				t = t.parent;
			}
			for (int num2 = list.Count - 1; num2 >= 0; num2--)
			{
				stringBuilder.Append(list[num2]);
				if (num2 > 0)
				{
					stringBuilder.Append('/');
				}
			}
			return stringBuilder.ToString();
		}

		private static void KillLabelGlow()
		{
			Strip(_level);
			Strip(_percent);
			Strip(_amount);
		}

		private static void Strip(TextMeshProUGUI label)
		{
			//IL_0057: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Invalid comparison between Unknown and I4
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			Material val = (((Object)(object)label != (Object)null) ? ((TMP_Text)label).fontSharedMaterial : null);
			if ((Object)(object)val == (Object)null || (Object)(object)val.shader == (Object)null)
			{
				return;
			}
			Shader shader = val.shader;
			int propertyCount = shader.GetPropertyCount();
			for (int i = 0; i < propertyCount; i++)
			{
				string propertyName = shader.GetPropertyName(i);
				if (!IsExtraEffect(propertyName))
				{
					continue;
				}
				ShaderPropertyType propertyType = shader.GetPropertyType(i);
				if ((int)propertyType == 2 || (int)propertyType == 3)
				{
					if (val.HasFloat(propertyName) && !Mathf.Approximately(val.GetFloat(propertyName), 0f))
					{
						val.SetFloat(propertyName, 0f);
					}
				}
				else if ((int)propertyType == 0 && val.HasColor(propertyName))
				{
					Color color = val.GetColor(propertyName);
					if (!Mathf.Approximately(color.a, 0f))
					{
						color.a = 0f;
						val.SetColor(propertyName, color);
					}
				}
			}
		}

		private static bool IsExtraEffect(string property)
		{
			string text = property.ToLowerInvariant();
			if (!text.Contains("glow") && !text.Contains("underlay") && !text.Contains("outline") && !text.Contains("shiny") && !text.Contains("reflect") && !text.Contains("dilate") && !text.Contains("bevel"))
			{
				return text.Contains("bump");
			}
			return true;
		}

		private static void CenterAll()
		{
			Center(((Graphic)_plateTop).rectTransform);
			Center(((Graphic)_plateAmount).rectTransform);
			Center(((Graphic)_borderTop).rectTransform);
			Center(((Graphic)_borderBottom).rectTransform);
			Center(((Graphic)_borderLeft).rectTransform);
			Center(((Graphic)_borderRight).rectTransform);
			Center(((Graphic)_back).rectTransform);
			Center(((TMP_Text)_level).rectTransform);
			Center(((TMP_Text)_percent).rectTransform);
			Center(((TMP_Text)_amount).rectTransform);
		}

		private static void Center(RectTransform rt)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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)
			rt.anchorMin = new Vector2(0.5f, 0.5f);
			rt.anchorMax = new Vector2(0.5f, 0.5f);
			rt.pivot = new Vector2(0.5f, 0.5f);
		}

		private static Image MakePlate(string name, Transform parent)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Image obj = MakeImage(name, parent);
			obj.sprite = PlateSprite();
			((Graphic)obj).color = PlateFill;
			return obj;
		}

		private static Sprite PlateSprite()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_plate != (Object)null)
			{
				return _plate;
			}
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			((Object)val).name = "SeneaLHudLayout_XpPlate";
			val.SetPixels32((Color32[])(object)new Color32[1]
			{
				new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)
			});
			val.Apply();
			((Texture)val).filterMode = (FilterMode)0;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 1f);
			((Object)obj).name = ((Object)val).name;
			_plate = obj;
			return _plate;
		}

		private static Image MakeLine(string name, Transform parent)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			Image obj = MakeImage(name, parent);
			((Graphic)obj).color = BorderGold;
			return obj;
		}

		private static Image MakeImage(string name, Transform parent)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			val.layer = ((Component)parent).gameObject.layer;
			Image obj = val.AddComponent<Image>();
			obj.sprite = CharacterExtras.PixelSprite();
			((Graphic)obj).raycastTarget = false;
			return obj;
		}

		private static Sprite BarFrame()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_003e: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_barFrame != (Object)null)
			{
				return _barFrame;
			}
			Texture2D val = new Texture2D(12, 12, (TextureFormat)4, false);
			((Object)val).name = "SeneaLHudLayout_XpBarFrame";
			Color32 val2 = Color32.op_Implicit(new Color(0f, 0f, 0f, 1f));
			Color32 val3 = Color32.op_Implicit(new Color(0.08f, 0.08f, 0.09f, 1f));
			Color32[] array = (Color32[])(object)new Color32[144];
			for (int i = 0; i < 12; i++)
			{
				for (int j = 0; j < 12; j++)
				{
					bool flag = j < 1 || i < 1 || j >= 11 || i >= 11;
					array[i * 12 + j] = (flag ? val3 : val2);
				}
			}
			val.SetPixels32(array);
			val.Apply();
			((Texture)val).filterMode = (FilterMode)0;
			Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 12f, 12f), new Vector2(0.5f, 0.5f), 1f, 0u, (SpriteMeshType)0, new Vector4(1f, 1f, 1f, 1f));
			((Object)obj).name = ((Object)val).name;
			_barFrame = obj;
			return _barFrame;
		}

		private static TextMeshProUGUI MakeLabel(string name, Transform parent, TextAlignmentOptions align, float size)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0044: 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)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			val.layer = ((Component)parent).gameObject.layer;
			TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
			((Graphic)obj).raycastTarget = false;
			((TMP_Text)obj).alignment = align;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)0;
			((TMP_Text)obj).fontSize = size;
			((TMP_Text)obj).fontStyle = (FontStyles)1;
			((Graphic)obj).color = TextColor;
			CharacterExtras.CopyFoodBarFont(obj);
			_fontApplied = HasFoodFont(obj);
			return obj;
		}

		private static bool HasFoodFont(TextMeshProUGUI label)
		{
			if ((Object)(object)label != (Object)null && (Object)(object)((TMP_Text)label).font != (Object)null)
			{
				return ((TMP_Text)label).font != TMP_Settings.defaultFontAsset;
			}
			return false;
		}

		private static void EnsureLookup()
		{
			if (_lookup)
			{
				return;
			}
			_lookup = true;
			Type type = AccessTools.TypeByName("SeneaLUI.Hud.HudRoot");
			if (!(type == null))
			{
				_hotbarField = AccessTools.Field(type, "_hotbar");
				if (!(_hotbarField == null))
				{
					Type fieldType = _hotbarField.FieldType;
					_frameActions = AccessTools.Field(fieldType, "FrameActions");
					_frameQuiver = AccessTools.Field(fieldType, "FrameQuiver");
				}
			}
		}

		private static void Hide()
		{
			if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf)
			{
				((Component)_root).gameObject.SetActive(false);
			}
		}
	}
	internal static class AdventureJournal
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__Toggle;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__44_0;

			internal void <AddClose>b__44_0()
			{
				_window.SetActive(false);
			}
		}

		private const string ButtonName = "SeneaLHudLayout_Quests";

		private const string WindowName = "SeneaLHudLayout_Adventure";

		private static Transform _tabs;

		private static Button _button;

		private static GameObject _window;

		private static Image _panel;

		private static Image _viewportFill;

		private static RectTransform _view;

		private static RectTransform _list;

		private static ScrollRect _scroll;

		private static TextMeshProUGUI _bountyTab;

		private static TextMeshProUGUI _counts;

		private static TextMeshProUGUI _treasureTab;

		private static bool _bounties = true;

		private static bool _lookedUp;

		private static MethodInfo _saveData;

		private static MethodInfo _inProgress;

		private static MethodInfo _claimable;

		private static MethodInfo _unfound;

		private static MethodInfo _bountyName;

		private static MethodInfo _monsterName;

		private static MethodInfo _config;

		private static FieldInfo _treasureConfig;

		private static FieldInfo _biomeInfo;

		private static bool _returnToJournal;

		private static bool _reopen;

		private static bool _allowMap;

		private static MethodInfo _adventureEnabled;

		private static bool _adventureChecked;

		public static void Apply(Harmony harmony)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			MethodInfo methodInfo = AccessTools.Method(typeof(Minimap), "ShowPointOnMap", new Type[1] { typeof(Vector3) }, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Minimap), "SetMapMode", (Type[])null, (Type[])null);
			harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(AdventureJournal), "SkipMerchantMap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(AdventureJournal), "AfterMapMode", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
		}

		private static bool SkipMerchantMap()
		{
			if (_allowMap)
			{
				_allowMap = false;
				_returnToJournal = true;
				return true;
			}
			if (SeneaLHudLayoutPlugin.KeepMapClosedOnAccept != null && SeneaLHudLayoutPlugin.KeepMapClosedOnAccept.Value && (FromMerchant() || TraderOpen()))
			{
				return false;
			}
			return true;
		}

		private static bool FromMerchant()
		{
			StackTrace stackTrace = new StackTrace();
			for (int i = 0; i < stackTrace.FrameCount; i++)
			{
				Type type = stackTrace.GetFrame(i).GetMethod()?.DeclaringType;
				while (type != null)
				{
					string text = type.FullName ?? type.Name;
					if (text.Contains("BountiesAdventureFeature") || text.Contains("TreasureMapsAdventureFeature"))
					{
						return true;
					}
					type = type.DeclaringType;
				}
			}
			return false;
		}

		private static bool TraderOpen()
		{
			StoreGui instance = StoreGui.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return false;
			}
			object? obj = AccessTools.Field(typeof(StoreGui), "m_root")?.GetValue(instance);
			GameObject val = (GameObject)((obj is GameObject) ? obj : null);
			if ((Object)(object)val != (Object)null)
			{
				return val.activeInHierarchy;
			}
			return false;
		}

		private static void AfterMapMode(MapMode mode)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			if (_returnToJournal && (int)mode != 2)
			{
				_returnToJournal = false;
				_reopen = true;
			}
		}

		public static void Tick()
		{
			if (_reopen && (Object)(object)InventoryGui.instance != (Object)null)
			{
				_reopen = false;
				InventoryGui.instance.Show((Container)null, 1);
				EnsureWindow();
				_window.SetActive(true);
				_window.transform.SetAsLastSibling();
			}
			if (EnsureButton())
			{
				PlaceButton();
				bool flag = (Object)(object)InventoryGui.instance != (Object)null && InventoryGui.IsVisible();
				bool flag2 = flag && ((Component)_tabs).gameObject.activeInHierarchy && AdventureOn();
				if (((Component)_button).gameObject.activeSelf != flag2)
				{
					((Component)_button).gameObject.SetActive(flag2);
				}
				if ((Object)(object)_window != (Object)null && _window.activeSelf && !flag && !_returnToJournal)
				{
					_window.SetActive(false);
				}
				Wheel();
			}
		}

		private static void Wheel()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_scroll == (Object)null || (Object)(object)_view == (Object)null || (Object)(object)_window == (Object)null || !_window.activeSelf)
			{
				return;
			}
			float y = Input.mouseScrollDelta.y;
			if (!(Mathf.Abs(y) < 0.01f) && RectTransformUtility.RectangleContainsScreenPoint(_view, Vector2.op_Implicit(Input.mousePosition)))
			{
				Rect rect = _list.rect;
				float height = ((Rect)(ref rect)).height;
				rect = _view.rect;
				float num = height - ((Rect)(ref rect)).height;
				if (!(num < 1f))
				{
					_scroll.verticalNormalizedPosition = Mathf.Clamp01(_scroll.verticalNormalizedPosition + y * 72f / num);
				}
			}
		}

		private static bool AdventureOn()
		{
			if (!_adventureChecked)
			{
				_adventureChecked = true;
				_adventureEnabled = AccessTools.Method(AccessTools.TypeByName("EpicLoot.EpicLoot"), "IsAdventureModeEnabled", (Type[])null, (Type[])null);
			}
			if (_adventureEnabled == null)
			{
				return false;
			}
			try
			{
				return (bool)_adventureEnabled.Invoke(null, null);
			}
			catch (Exception)
			{
				return false;
			}
		}

		private static bool EnsureButton()
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: 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_025c: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Expected O, but got Unknown
			if ((Object)(object)_button != (Object)null)
			{
				return true;
			}
			if ((Object)(object)_tabs == (Object)null)
			{
				InventoryGui instance = InventoryGui.instance;
				if ((Object)(object)instance == (Object)null)
				{
					return false;
				}
				Transform[] componentsInChildren = ((Component)instance).GetComponentsInChildren<Transform>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					if (((Object)componentsInChildren[i]).name == "tabs" && (Object)(object)componentsInChildren[i].Find("tab0") != (Object)null)
					{
						_tabs = componentsInChildren[i];
						break;
					}
				}
			}
			if (!((Object)(object)_tabs == (Object)null))
			{
				Transform obj = _tabs.Find("gear");
				RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null);
				if (val != null)
				{
					Transform val2 = _tabs.Find("SeneaLHudLayout_Quests");
					if ((Object)(object)val2 != (Object)null)
					{
						_button = ((Component)val2).GetComponent<Button>();
						return (Object)(object)_button != (Object)null;
					}
					GameObject val3 = new GameObject("SeneaLHudLayout_Quests", new Type[3]
					{
						typeof(RectTransform),
						typeof(Image),
						typeof(Button)
					});
					val3.transform.SetParent(_tabs, false);
					RectTransform val4 = (RectTransform)val3.transform;
					val4.anchorMin = new Vector2(1f, 1f);
					val4.anchorMax = new Vector2(1f, 1f);
					val4.pivot = new Vector2(1f, 1f);
					float num = 88f;
					float num2 = ((val.sizeDelta.y > 8f) ? val.sizeDelta.y : 28f);
					val4.sizeDelta = new Vector2(num, num2);
					Image component = val3.GetComponent<Image>();
					component.sprite = CharacterExtras.Plate();
					((Graphic)component).raycastTarget = true;
					CharacterExtras.Frame(component);
					_button = val3.GetComponent<Button>();
					((Selectable)_button).targetGraphic = (Graphic)(object)component;
					ButtonClickedEvent onClick = _button.onClick;
					object obj2 = <>O.<0>__Toggle;
					if (obj2 == null)
					{
						UnityAction val5 = Toggle;
						<>O.<0>__Toggle = val5;
						obj2 = (object)val5;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj2);
					GameObject val6 = new GameObject("t", new Type[1] { typeof(RectTransform) });
					val6.transform.SetParent(val3.transform, false);
					RectTransform val7 = (RectTransform)val6.transform;
					val7.anchorMin = Vector2.zero;
					val7.anchorMax = Vector2.one;
					val7.offsetMin = Vector2.zero;
					val7.offsetMax = Vector2.zero;
					TextMeshProUGUI val8 = val6.AddComponent<TextMeshProUGUI>();
					((TMP_Text)val8).text = "Quests";
					((TMP_Text)val8).fontSize = 12f;
					((TMP_Text)val8).fontStyle = (FontStyles)0;
					((TMP_Text)val8).alignment = (TextAlignmentOptions)514;
					((Graphic)val8).color = new Color(0.93f, 0.82f, 0.52f, 1f);
					((Graphic)val8).raycastTarget = false;
					CopyFont(val, val8);
					PlaceButton();
					return true;
				}
			}
			return false;
		}

		private static void PlaceButton()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_button == (Object)null)
			{
				return;
			}
			Transform obj = _tabs.Find("gear");
			RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null);
			if (val != null)
			{
				Transform obj2 = _tabs.Find("SeneaLHudLayout_Talents");
				RectTransform val2 = (RectTransform)(object)((obj2 is RectTransform) ? obj2 : null);
				if ((Object)(object)val2 == (Object)null || !((Component)val2).gameObject.activeInHierarchy)
				{
					val2 = val;
				}
				((RectTransform)((Component)_button).transform).anchoredPosition = new Vector2(val2.anchoredPosition.x - val2.sizeDelta.x - 8f, val2.anchoredPosition.y);
			}
		}

		private static void Toggle()
		{
			if ((Object)(object)_window != (Object)null && _window.activeSelf)
			{
				_window.SetActive(false);
				return;
			}
			EnsureWindow();
			_bounties = true;
			_window.SetActive(true);
			_window.transform.SetAsLastSibling();
			Rebuild();
		}

		public static void PaintBackground()
		{
			//IL_0027: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			Color val = (Color)((SeneaLHudLayoutPlugin.QuestBackground != null) ? SeneaLHudLayoutPlugin.QuestBackground.Value : new Color(0.08f, 0.07f, 0.05f, 1f));
			float num = ((SeneaLHudLayoutPlugin.QuestBackgroundAlpha != null) ? Mathf.Clamp01(SeneaLHudLayoutPlugin.QuestBackgroundAlpha.Value) : 1f);
			Color color = default(Color);
			((Color)(ref color))..ctor(val.r, val.g, val.b, num);
			if ((Object)(object)_panel != (Object)null)
			{
				_panel.sprite = CharacterExtras.Plate();
				((Graphic)_panel).color = color;
			}
			if ((Object)(object)_viewportFill != (Object)null)
			{
				_viewportFill.sprite = CharacterExtras.Plate();
				((Graphic)_viewportFill).color = color;
			}
		}

		private static void EnsureWindow()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_0068: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: 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)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: 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_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Expected O, but got Unknown
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: 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_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Expected O, but got Unknown
			//IL_0400: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Expected O, but got Unknown
			if (!((Object)(object)_window != (Object)null))
			{
				Transform transform = ((Component)InventoryGui.instance).transform;
				GameObject val = new GameObject("SeneaLHudLayout_Adventure", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val.transform.SetParent(transform, false);
				RectTransform val2 = (RectTransform)val.transform;
				val2.anchorMin = new Vector2(0.5f, 0.5f);
				val2.anchorMax = new Vector2(0.5f, 0.5f);
				val2.pivot = new Vector2(0.5f, 0.5f);
				val2.sizeDelta = new Vector2(560f, 460f);
				Image component = val.GetComponent<Image>();
				component.sprite = CharacterExtras.Plate();
				((Graphic)component).color = new Color(0.62f, 0.48f, 0.28f, 1f);
				((Graphic)component).raycastTarget = true;
				_window = val;
				GameObject val3 = new GameObject("fill", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val3.transform.SetParent((Transform)(object)val2, false);
				val3.transform.SetAsFirstSibling();
				RectTransform val4 = (RectTransform)val3.transform;
				val4.anchorMin = Vector2.zero;
				val4.anchorMax = Vector2.one;
				val4.offsetMin = new Vector2(1f, 1f);
				val4.offsetMax = new Vector2(-1f, -1f);
				_panel = val3.GetComponent<Image>();
				_panel.sprite = CharacterExtras.Plate();
				((Graphic)_panel).raycastTarget = true;
				PaintBackground();
				AddLabel(val2, "Bounties and treasure maps", 18f, new Vector2(0f, -16f), 20f, (FontStyles)1);
				AddTab(val2, "Bounties", new Vector2(16f, -48f), bounties: true);
				AddTab(val2, "Treasure", new Vector2(150f, -48f), bounties: false);
				_counts = AddLabel(val2, "", 0f, new Vector2(-16f, -48f), 15f, (FontStyles)0);
				((TMP_Text)_counts).alignment = (TextAlignmentOptions)4100;
				((TMP_Text)_counts).rectTransform.anchorMin = new Vector2(1f, 1f);
				((TMP_Text)_counts).rectTransform.anchorMax = new Vector2(1f, 1f);
				((TMP_Text)_counts).rectTransform.pivot = new Vector2(1f, 1f);
				((TMP_Text)_counts).rectTransform.sizeDelta = new Vector2(260f, 28f);
				AddClose(val2);
				GameObject val5 = new GameObject("view", new Type[3]
				{
					typeof(RectTransform),
					typeof(Image),
					typeof(Mask)
				});
				val5.transform.SetParent((Transform)(object)val2, false);
				RectTransform val6 = (RectTransform)val5.transform;
				val6.anchorMin = new Vector2(0f, 0f);
				val6.anchorMax = new Vector2(1f, 1f);
				val6.offsetMin = new Vector2(12f, 12f);
				val6.offsetMax = new Vector2(-28f, -88f);
				_viewportFill = val5.GetComponent<Image>();
				_viewportFill.sprite = CharacterExtras.Plate();
				((Graphic)_viewportFill).raycastTarget = true;
				PaintBackground();
				val5.GetComponent<Mask>().showMaskGraphic = true;
				_view = val6;
				GameObject val7 = new GameObject("list", new Type[3]
				{
					typeof(RectTransform),
					typeof(VerticalLayoutGroup),
					typeof(ContentSizeFitter)
				});
				val7.transform.SetParent((Transform)(object)val6, false);
				_list = (RectTransform)val7.transform;
				_list.anchorMin = new Vector2(0f, 1f);
				_list.anchorMax = new Vector2(1f, 1f);
				_list.pivot = new Vector2(0.5f, 1f);
				_list.anchoredPosition = Vector2.zero;
				_list.sizeDelta = new Vector2(0f, 0f);
				VerticalLayoutGroup component2 = val7.GetComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)component2).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)component2).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)component2).spacing = 8f;
				((LayoutGroup)component2).padding = new RectOffset(8, 8, 8, 8);
				val7.GetComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
				ScrollRect obj = val5.AddComponent<ScrollRect>();
				obj.viewport = val6;
				obj.content = _list;
				obj.horizontal = false;
				obj.movementType = (MovementType)2;
				obj.scrollSensitivity = 40f;
				obj.verticalScrollbar = AddScrollbar(val2);
				obj.verticalScrollbarVisibility = (ScrollbarVisibility)0;
				_scroll = obj;
				val.SetActive(false);
			}
		}

		private static Scrollbar AddScrollbar(RectTransform window)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: 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_00e9: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("scroll", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent((Transform)(object)window, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = new Vector2(1f, 0f);
			val2.anchorMax = new Vector2(1f, 1f);
			val2.pivot = new Vector2(1f, 1f);
			val2.offsetMin = new Vector2(-22f, 12f);
			val2.offsetMax = new Vector2(-8f, -88f);
			((Graphic)val.GetComponent<Image>()).color = new Color(0.07f, 0.05f, 0.03f, 0.9f);
			GameObject val3 = new GameObject("area", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent((Transform)(object)val2, false);
			RectTransform val4 = (RectTransform)val3.transform;
			val4.anchorMin = Vector2.zero;
			val4.anchorMax = Vector2.one;
			val4.offsetMin = new Vector2(2f, 2f);
			val4.offsetMax = new Vector2(-2f, -2f);
			GameObject val5 = new GameObject("handle", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val5.transform.SetParent((Transform)(object)val4, false);
			RectTransform val6 = (RectTransform)val5.transform;
			val6.anchorMin = Vector2.zero;
			val6.anchorMax = Vector2.one;
			val6.sizeDelta = Vector2.zero;
			((Graphic)val5.GetComponent<Image>()).color = new Color(0.62f, 0.48f, 0.28f, 0.95f);
			Scrollbar obj = val.AddComponent<Scrollbar>();
			obj.handleRect = val6;
			((Selectable)obj).targetGraphic = (Graphic)(object)val5.GetComponent<Image>();
			obj.direction = (Direction)2;
			return obj;
		}

		private static void AddTab(RectTransform window, string text, Vector2 pos, bool bounties)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			GameObject val = new GameObject(text, new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent((Transform)(object)window, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = new Vector2(0f, 1f);
			val2.anchorMax = new Vector2(0f, 1f);
			val2.pivot = new Vector2(0f, 1f);
			val2.anchoredPosition = pos;
			val2.sizeDelta = new Vector2(124f, 28f);
			((Graphic)val.GetComponent<Image>()).color = new Color(0.22f, 0.17f, 0.1f, 1f);
			TextMeshProUGUI val3 = AddLabel(val2, text, 0f, Vector2.zero, 15f, (FontStyles)0);
			((TMP_Text)val3).rectTransform.anchorMin = Vector2.zero;
			((TMP_Text)val3).rectTransform.anchorMax = Vector2.one;
			((TMP_Text)val3).rectTransform.offsetMin = Vector2.zero;
			((TMP_Text)val3).rectTransform.offsetMax = Vector2.zero;
			if (bounties)
			{
				_bountyTab = val3;
			}
			else
			{
				_treasureTab = val3;
			}
			((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				_bounties = bounties;
				Rebuild();
			});
		}

		private static void AddClose(RectTransform window)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			GameObject val = new GameObject("close", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent((Transform)(object)window, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = new Vector2(1f, 1f);
			val2.anchorMax = new Vector2(1f, 1f);
			val2.pivot = new Vector2(1f, 1f);
			val2.anchoredPosition = new Vector2(-12f, -12f);
			val2.sizeDelta = new Vector2(28f, 28f);
			((Graphic)val.GetComponent<Image>()).color = new Color(0.28f, 0.14f, 0.1f, 1f);
			((TMP_Text)AddLabel(val2, "X", 0f, Vector2.zero, 16f, (FontStyles)1)).rectTransform.anchorMin = Vector2.zero;
			TextMeshProUGUI componentInChildren = val.GetComponentInChildren<TextMeshProUGUI>();
			((TMP_Text)componentInChildren).rectTransform.anchorMax = Vector2.one;
			((TMP_Text)componentInChildren).rectTransform.offsetMin = Vector2.zero;
			((TMP_Text)componentInChildren).rectTransform.offsetMax = Vector2.zero;
			ButtonClickedEvent onClick = val.GetComponent<Button>().onClick;
			object obj = <>c.<>9__44_0;
			if (obj == null)
			{
				UnityAction val3 = delegate
				{
					_window.SetActive(false);
				};
				<>c.<>9__44_0 = val3;
				obj = (object)val3;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
		}

		private static void Rebuild()
		{
			PaintTabs();
			if ((Object)(object)_scroll != (Object)null)
			{
				_scroll.verticalNormalizedPosition = 1f;
			}
			for (int num = ((Transform)_list).childCount - 1; num >= 0; num--)
			{
				Object.Destroy((Object)(object)((Component)((Transform)_list).GetChild(num)).gameObject);
			}
			if (!Lookup())
			{
				Row("EpicLoot is not loaded.", "", null);
				return;
			}
			object obj = _saveData.Invoke(null, new object[1] { Player.m_localPlayer });
			if (obj == null)
			{
				Row("No adventure data on this character.", "", null);
				return;
			}
			IList list = Join(AsList(Invoke(_inProgress, obj)), AsList(Invoke(_claimable, obj)));
			IList list2 = AsList(Invoke(_unfound, obj));
			if ((Object)(object)_counts != (Object)null)
			{
				((TMP_Text)_counts).text = "Bounties: " + Count(list) + "/" + BountyCap() + "    Treasure: " + Count(list2);
			}
			IList list3 = (_bounties ? list : list2);
			if (list3 == null || list3.Count == 0)
			{
				Row(_bounties ? "No active bounties." : "No active treasure maps.", "", null);
				return;
			}
			for (int i = 0; i < list3.Count; i++)
			{
				object item = list3[i];
				if (_bounties)
				{
					Row(BountyText(item), "Map", delegate
					{
						//IL_0010: Unknown result type (might be due to invalid IL or missing references)
						ShowMap(ReadVector(Field(item, "Position")));
					});
				}
				else
				{
					Row(TreasureText(item), "Map", delegate
					{
						//IL_0010: Unknown result type (might be due to invalid IL or missing references)
						ShowMap(ReadVector(Field(item, "Position")));
					});
				}
			}
			Canvas.ForceUpdateCanvases();
			LayoutRebuilder.ForceRebuildLayoutImmediate(_list);
		}

		private static object Invoke(MethodInfo method, object target)
		{
			try
			{
				return (method == null) ? null : method.Invoke(target, null);
			}
			catch (Exception)
			{
				return null;
			}
		}

		private static IList AsList(object value)
		{
			if (value is IList result)
			{
				return result;
			}
			if (value is IEnumerable enumerable)
			{
				ArrayList arrayList = new ArrayList();
				{
					foreach (object item in enumerable)
					{
						arrayList.Add(item);
					}
					return arrayList;
				}
			}
			return null;
		}

		private static int Count(IList items)
		{
			return items?.Count ?? 0;
		}

		private static int BountyCap()
		{
			if (!Chainloader.PluginInfos.TryGetValue("randyknapp.mods.epicloot", out var value) || (Object)(object)value.Instance == (Object)null)
			{
				return 0;
			}
			ConfigFile config = value.Instance.Config;
			string[] array = new string[3] { "5 - Adventure", "Bounty Management", "Adventure" };
			ConfigEntry<int> val = default(ConfigEntry<int>);
			for (int i = 0; i < array.Length; i++)
			{
				if (config.TryGetEntry<int>(array[i], "Max Bounties Per Player", ref val))
				{
					return val.Value;
				}
			}
			return 0;
		}

		private static void PaintTabs()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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)
			if ((Object)(object)_bountyTab != (Object)null)
			{
				((Graphic)_bountyTab).color = (_bounties ? new Color(1f, 0.86f, 0.45f) : new Color(0.75f, 0.7f, 0.6f));
			}
			if ((Object)(object)_treasureTab != (Object)null)
			{
				((Graphic)_treasureTab).color = (_bounties ? new Color(0.75f, 0.7f, 0.6f) : new Color(1f, 0.86f, 0.45f));
			}
		}

		private static string BountyText(object bounty)
		{
			string text = ((_bountyName != null) ? (_bountyName.Invoke(null, new object[1] { bounty }) as string) : null);
			if (string.IsNullOrEmpty(text))
			{
				text = Field(bounty, "TargetName") as string;
			}
			object obj = Field(bounty, "Target");
			int value = ((obj != null) ? Convert.ToInt32(Field(obj, "Level") ?? ((object)0)) : 0);
			string text2 = ((obj == null) ? "" : (Field(obj, "MonsterID") as string));
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(Localize(text));
			if (!string.IsNullOrEmpty(text2))
			{
				stringBuilder.Append("  (").Append(Monster(text2)).Append(')');
			}
			stringBuilder.Append("\nZone: ").Append(Zone(Field(bounty, "Biome")));
			stringBuilder.Append("\nStars: ").Append(value);
			stringBuilder.Append("\nLoot: ").Append(Rewards(bounty));
			if (Field(bounty, "Adds") is IList { Count: >0 } list)
			{
				stringBuilder.Append("\nAdds: ");
				for (int i = 0; i < list.Count; i++)
				{
					if (i > 0)
					{
						stringBuilder.Append(", ");
					}
					object source = list[i];
					stringBuilder.Append(Monster(Field(source, "MonsterID") as string));
					stringBuilder.Append(" x").Append(Convert.ToInt32(Field(source, "Count") ?? ((object)1)));
					stringBuilder.Append(" (").Append(Convert.ToInt32(Field(source, "Level") ?? ((object)0))).Append(" stars)");
				}
			}
			return stringBuilder.ToString();
		}

		private static string TreasureText(object map)
		{
			object biome = Field(map, "Biome");
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("Treasure map");
			stringBuilder.Append("\nZone: ").Append(Zone(biome));
			stringBuilder.Append("\nLoot: ").Append(TreasureLoot(biome));
			return stringBuilder.ToString();
		}

		private static string Rewards(object bounty)
		{
			List<string> list = new List<string>();
			AddCount(list, "Iron token", Field(bounty, "RewardIron"));
			AddCount(list, "Gold token", Field(bounty, "RewardGold"));
			AddCount(list, "Coins", Field(bounty, "RewardCoins"));
			if (list.Count != 0)
			{
				return string.Join(", ", list);
			}
			return "none listed";
		}

		private static string TreasureLoot(object biome)
		{
			if (_config == null || _treasureConfig == null || _biomeInfo == null)
			{
				return "see the merchant";
			}
			object obj = _config.Invoke(null, null);
			object obj2 = ((obj == null) ? null : _treasureConfig.GetValue(obj));
			if (!(((obj2 == null) ? null : _biomeInfo.GetValue(obj2)) is IList list))
			{
				return "see the merchant";
			}
			string b = ((biome == null) ? "" : biome.ToString());
			for (int i = 0; i < list.Count; i++)
			{
				object source = list[i];
				if (string.Equals(Field(source, "Biome") as string, b, StringComparison.OrdinalIgnoreCase))
				{
					List<string> list2 = new List<string>();
					AddCount(list2, "Forest token", Field(source, "ForestTokens"));
					AddCount(list2, "Iron token", Field(source, "IronTokens"));
					AddCount(list2, "Gold token", Field(source, "GoldTokens"));
					AddCount(list2, "Coins", Field(source, "Coins"));
					if (list2.Count != 0)
					{
						return string.Join(", ", list2);
					}
					return "none listed";
				}
			}
			return "see the merchant";
		}

		private static void AddCount(List<string> parts, string label, object value)
		{
			int num = Convert.ToInt32(value ?? ((object)0));
			if (num > 0)
			{
				parts.Add(label + " x" + num);
			}
		}

		private static string Monster(string id)
		{
			if (string.IsNullOrEmpty(id))
			{
				return "unknown";
			}
			if (_monsterName != null)
			{
				string text = _monsterName.Invoke(null, new object[1] { id }) as string;
				if (!string.IsNullOrEmpty(text))
				{
					return Localize(text);
				}
			}
			return Localize("$enemy_" + id.ToLowerInvariant());
		}

		private static string Zone(object biome)
		{
			if (biome == null)
			{
				return "unknown";
			}
			string text = biome.ToString();
			string text2 = Localize("$biome_" + text.ToLowerInvariant());
			if (!text2.StartsWith("$"))
			{
				return text2;
			}
			return text;
		}

		private static string Localize(string text)
		{
			if (string.IsNullOrEmpty(text) || Localization.instance == null)
			{
				return text ?? "";
			}
			return Localization.instance.Localize(text);
		}

		private static void ShowMap(Vector3 position)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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)
			if (!(position == Vector3.zero) && !((Object)(object)Minimap.instance == (Object)null))
			{
				_window.SetActive(false);
				_allowMap = true;
				_returnToJournal = true;
				if ((Object)(object)InventoryGui.instance != (Object)null && InventoryGui.IsVisible())
				{
					InventoryGui.instance.Hide();
				}
				Minimap.instance.SetMapMode((MapMode)2);
				Minimap.instance.ShowPointOnMap(position);
			}
		}

		private static Vector3 ReadVector(object value)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			if (value == null)
			{
				return Vector3.zero;
			}
			if (value is Vector3)
			{
				return (Vector3)value;
			}
			MethodInfo methodInfo = AccessTools.Method(value.GetType(), "ToVector3", (Type[])null, (Type[])null);
			if (methodInfo != null && methodInfo.ReturnType == typeof(Vector3))
			{
				return (Vector3)methodInfo.Invoke(value, null);
			}
			float num = Convert.ToSingle(Field(value, "x") ?? Field(value, "X") ?? ((object)0f));
			float num2 = Convert.ToSingle(Field(value, "y") ?? Field(value, "Y") ?? ((object)0f));
			float num3 = Convert.ToSingle(Field(value, "z") ?? Field(value, "Z") ?? ((object)0f));
			return new Vector3(num, num2, num3);
		}

		private static IList Join(IList first, IList second)
		{
			ArrayList arrayList = new ArrayList();
			if (first != null)
			{
				foreach (object item in first)
				{
					arrayList.Add(item);
				}
			}
			if (second != null)
			{
				foreach (object item2 in second)
				{
					if (!arrayList.Contains(item2))
					{
						arrayList.Add(item2);
					}
				}
			}
			return arrayList;
		}

		private static bool Lookup()
		{
			if (_lookedUp)
			{
				return _saveData != null;
			}
			_lookedUp = true;
			Type type = AccessTools.TypeByName("EpicLoot.Adventure.PlayerExtensions_Adventure");
			Type type2 = AccessTools.TypeByName("EpicLoot.Adventure.AdventureSaveData");
			Type type3 = AccessTools.TypeByName("EpicLoot.Adventure.AdventureDataManager");
			Type type4 = AccessTools.TypeByName("EpicLoot.Adventure.AdventureDataConfig");
			Type type5 = AccessTools.TypeByName("EpicLoot.Adventure.TreasureMapConfig");
			_saveData = AccessTools.Method(type, "GetAdventureSaveData", new Type[1] { typeof(Player) }, (Type[])null);
			_inProgress = AccessTools.Method(type2, "GetInProgressBounties", (Type[])null, (Type[])null);
			_claimable = AccessTools.Method(type2, "GetClaimableBounties", (Type[])null, (Type[])null);
			_unfound = AccessTools.Method(type2, "GetUnfoundTreasureChests", (Type[])null, (Type[])null);
			_bountyName = AccessTools.Method(type3, "GetBountyName", (Type[])null, (Type[])null);
			_monsterName = AccessTools.Method(type3, "GetMonsterName", (Type[])null, (Type[])null);
			_config = AccessTools.Method(type3, "GetCFG", (Type[])null, (Type[])null);
			_treasureConfig = AccessTools.Field(type4, "TreasureMap");
			_biomeInfo = AccessTools.Field(type5, "BiomeInfo");
			if (_saveData != null && _inProgress != null)
			{
				return _unfound != null;
			}
			return false;
		}

		private static object Field(object source, string name)
		{
			if (source == null)
			{
				return null;
			}
			FieldInfo fieldInfo = AccessTools.Field(source.GetType(), name);
			if (!(fieldInfo == null))
			{
				return fieldInfo.GetValue(source);
			}
			return null;
		}

		private static void Row(string body, string button, Action click)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_007d: 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_009c: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_01c9: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0245: 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_0260: Expected O, but got Unknown
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("row", new Type[4]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(HorizontalLayoutGroup),
				typeof(LayoutElement)
			});
			val.transform.SetParent((Transform)(object)_list, false);
			((Graphic)val.GetComponent<Image>()).color = new Color(0.14f, 0.12f, 0.09f, 0.9f);
			HorizontalLayoutGroup component = val.GetComponent<HorizontalLayoutGroup>();
			((LayoutGroup)component).padding = new RectOffset(8, 8, 6, 6);
			((HorizontalOrVerticalLayoutGroup)component).spacing = 8f;
			((LayoutGroup)component).childAlignment = (TextAnchor)3;
			((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
			val.GetComponent<LayoutElement>().minHeight = 72f;
			GameObject val2 = new GameObject("body", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(val.transform, false);
			TextMeshProUGUI val3 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = body;
			((TMP_Text)val3).fontSize = 15f;
			((Graphic)val3).color = new Color(0.93f, 0.88f, 0.76f);
			((TMP_Text)val3).alignment = (TextAlignmentOptions)257;
			((TMP_Text)val3).textWrappingMode = (TextWrappingModes)1;
			LayoutElement obj = val2.AddComponent<LayoutElement>();
			obj.flexibleWidth = 1f;
			obj.minHeight = 60f;
			Transform obj2 = _tabs.Find("gear");
			CopyFont((RectTransform)(object)((obj2 is RectTransform) ? obj2 : null), val3);
			if (click != null)
			{
				GameObject val4 = new GameObject("map", new Type[4]
				{
					typeof(RectTransform),
					typeof(Image),
					typeof(Button),
					typeof(LayoutElement)
				});
				val4.transform.SetParent(val.transform, false);
				val4.GetComponent<LayoutElement>().preferredWidth = 72f;
				val4.GetComponent<LayoutElement>().preferredHeight = 28f;
				((Graphic)val4.GetComponent<Image>()).color = new Color(0.28f, 0.22f, 0.12f, 1f);
				((UnityEvent)val4.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					click();
				});
				TextMeshProUGUI obj3 = AddLabel((RectTransform)val4.transform, button, 0f, Vector2.zero, 14f, (FontStyles)0);
				((TMP_Text)obj3).rectTransform.anchorMin = Vector2.zero;
				((TMP_Text)obj3).rectTransform.anchorMax = Vector2.one;
				((TMP_Text)obj3).rectTransform.offsetMin = Vector2.zero;
				((TMP_Text)obj3).rectTransform.offsetMax = Vector2.zero;
			}
		}

		private static TextMeshProUGUI AddLabel(RectTransform parent, string text, float y, Vector2 pos, float size, FontStyles style)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_008a: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("label", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent((Transform)(object)parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = new Vector2(0f, 1f);
			val2.anchorMax = new Vector2(1f, 1f);
			val2.pivot = new Vector2(0.5f, 1f);
			val2.anchoredPosition = (Vector2)((pos == Vector2.zero && y != 0f) ? new Vector2(0f, 0f - y) : pos);
			val2.sizeDelta = new Vector2(-24f, size + 8f);
			TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).text = text;
			((TMP_Text)val3).fontSize = size;
			((TMP_Text)val3).fontStyle = style;
			((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
			((Graphic)val3).color = new Color(0.93f, 0.84f, 0.62f);
			((Graphic)val3).raycastTarget = false;
			CopyFont((RectTransform)(((Object)(object)_tabs != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null), val3);
			return val3;
		}

		private static void CopyFont(RectTransform source, TextMeshProUGUI label)
		{
			TMP_Text val = (((Object)(object)source != (Object)null) ? ((Component)source).GetComponentInChildren<TMP_Text>(true) : null);
			if ((Object)(object)val != (Object)null && (Object)(object)val.font != (Object)null)
			{
				((TMP_Text)label).font = val.font;
				if ((Object)(object)val.fontSharedMaterial != (Object)null)
				{
					((TMP_Text)label).fontSharedMaterial = val.fontSharedMaterial;
				}
			}
			else if ((Object)(object)TMP_Settings.defaultFontAsset != (Object)null)
			{
				((TMP_Text)label).font = TMP_Settings.defaultFontAsset;
			}
		}
	}
	internal static class BossStars
	{
		private static Transform _bosses;

		private static float _nextScan;

		public static void Tick()
		{
			if (SeneaLHudLayoutPlugin.HideBossStars == null || !SeneaLHudLayoutPlugin.HideBossStars.Value)
			{
				return;
			}
			if ((Object)(object)_bosses == (Object)null)
			{
				if (Time.unscaledTime < _nextScan)
				{
					return;
				}
				_nextScan = Time.unscaledTime + 2f;
				Hud instance = Hud.instance;
				_bosses = FindNamed(((Object)(object)instance != (Object)null && (Object)(object)instance.m_rootObject != (Object)null) ? instance.m_rootObject.transform.Find("SeneaLUI_Hud") : null, "bosses");
				if ((Object)(object)_bosses == (Object)null)
				{
					return;
				}
			}
			for (int i = 0; i < _bosses.childCount; i++)
			{
				HideOn(_bosses.GetChild(i));
			}
		}

		private static Transform FindNamed(Transform root, string name)
		{
			if ((Object)(object)root == (Object)null)
			{
				return null;
			}
			if (((Object)root).name == name)
			{
				return root;
			}
			for (int i = 0; i < root.childCount; i++)
			{
				Transform val = FindNamed(root.GetChild(i), name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}

		private static void HideOn(Transform card)
		{
			for (int i = 0; i < card.childCount; i++)
			{
				Transform child = card.GetChild(i);
				HideOn(child);
				string name = ((Object)child).name;
				if ((name == "starchip" || name == "starnum" || (name.Length > 4 && name.StartsWith("star") && char.IsDigit(name[4]))) && ((Component)child).gameObject.activeSelf)
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
		}
	}
	internal static class BuildSearchMemory
	{
		private const string HammerName = "$item_hammer";

		private static FieldInfo _search;

		private static FieldInfo _term;

		private static FieldInfo _shown;

		private static FieldInfo _pieceSig;

		private static PropertyInfo _text;

		private static MethodInfo _setText;

		private static MethodInfo _clear;

		private static string _keep;

		private static bool _lastHammer = true;

		public static void Apply(Harmony harmony)
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_012d: Expected O, but got Unknown
			Type type = AccessTools.TypeByName("SeneaLUI.Hud.BuildMenuView");
			MethodInfo methodInfo = ((type != null) ? AccessTools.Method(type, "Tick", (Type[])null, (Type[])null) : null);
			if (!(methodInfo == null))
			{
				_search = AccessTools.Field(type, "_search");
				_term = AccessTools.Field(type, "_term");
				_shown = AccessTools.Field(type, "_shown");
				_pieceSig = AccessTools.Field(type, "_pieceSig");
				Type type2 = AccessTools.TypeByName("SeneaLUI.Components.SearchBox");
				_text = ((type2 != null) ? AccessTools.Property(type2, "Text") : null);
				_setText = ((type2 != null) ? AccessTools.Method(type2, "SetText", (Type[])null, (Type[])null) : null);
				_clear = ((type2 != null) ? AccessTools.Method(type2, "Clear", (Type[])nul