Decompiled source of SulfurTaskTracker v1.0.0

BepInEx\plugins\SulfurTaskTracker.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using PerfectRandom.Sulfur.Core;
using PerfectRandom.Sulfur.Core.Items;
using PerfectRandom.Sulfur.Core.UI.Inventory;
using PerfectRandom.Sulfur.Core.Units;
using PerfectRandom.Sulfur.Gameplay;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SulfurTaskTracker")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6d511da4396bcac57a1a551ba30f49f714266021")]
[assembly: AssemblyProduct("SulfurTaskTracker")]
[assembly: AssemblyTitle("SulfurTaskTracker")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[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 SulfurTaskTracker
{
	[BepInPlugin("local.sulfur.tasktracker", "Sulfur Task Tracker", "0.1.7")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "local.sulfur.tasktracker";

		public const string PluginName = "Sulfur Task Tracker";

		public const string PluginVersion = "0.1.7";

		private QuestTrackerOverlay? overlay;

		private void Awake()
		{
			overlay = ((Component)this).gameObject.AddComponent<QuestTrackerOverlay>();
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}
	}
	public sealed class QuestTrackerOverlay : MonoBehaviour
	{
		private sealed class QuestCell
		{
			private readonly GameObject root;

			private readonly Image icon;

			private readonly TextMeshProUGUI traderText;

			private readonly TextMeshProUGUI itemText;

			private readonly Image rewardIcon;

			private readonly TextMeshProUGUI rewardText;

			private readonly CornerLineFrame cellFrame;

			private static Sprite? stampSprite;

			public QuestCell(Transform parent, TextMeshProUGUI? styleSource)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a2: Expected O, but got Unknown
				//IL_00ca: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Expected O, but got Unknown
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01be: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_0218: Expected O, but got Unknown
				//IL_0240: Unknown result type (might be due to invalid IL or missing references)
				//IL_0255: Unknown result type (might be due to invalid IL or missing references)
				//IL_026a: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_031c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0351: Unknown result type (might be due to invalid IL or missing references)
				//IL_0358: Expected O, but got Unknown
				//IL_0382: Unknown result type (might be due to invalid IL or missing references)
				//IL_0397: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0429: Unknown result type (might be due to invalid IL or missing references)
				//IL_0430: Expected O, but got Unknown
				//IL_0456: Unknown result type (might be due to invalid IL or missing references)
				//IL_046b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0480: 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_04a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_04f8: Expected O, but got Unknown
				//IL_051e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0533: Unknown result type (might be due to invalid IL or missing references)
				//IL_0548: Unknown result type (might be due to invalid IL or missing references)
				//IL_055d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0571: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ca: Unknown result type (might be due to invalid IL or missing references)
				root = new GameObject("QuestCell", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				root.transform.SetParent(parent, false);
				RectTransform component = root.GetComponent<RectTransform>();
				((Graphic)root.GetComponent<Image>()).color = CellBackgroundColor;
				cellFrame = CornerLineFrame.Add(component, "QuestFrame", 10f, 2f);
				GameObject val = new GameObject("IconSlot", new Type[1] { typeof(RectTransform) });
				val.transform.SetParent(root.transform, false);
				RectTransform component2 = val.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0f, 0.5f);
				component2.anchorMax = new Vector2(0f, 0.5f);
				component2.pivot = new Vector2(0f, 0.5f);
				component2.anchoredPosition = new Vector2(12f, 0f);
				component2.sizeDelta = new Vector2(72f, 72f);
				GameObject val2 = new GameObject("Icon", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val2.transform.SetParent(val.transform, false);
				RectTransform component3 = val2.GetComponent<RectTransform>();
				component3.anchorMin = new Vector2(0.5f, 0.5f);
				component3.anchorMax = new Vector2(0.5f, 0.5f);
				component3.pivot = new Vector2(0.5f, 0.5f);
				component3.anchoredPosition = Vector2.zero;
				component3.sizeDelta = new Vector2(58f, 58f);
				icon = val2.GetComponent<Image>();
				icon.preserveAspect = true;
				GameObject val3 = new GameObject("Texts", new Type[3]
				{
					typeof(RectTransform),
					typeof(VerticalLayoutGroup),
					typeof(LayoutElement)
				});
				val3.transform.SetParent(root.transform, false);
				RectTransform component4 = val3.GetComponent<RectTransform>();
				component4.anchorMin = new Vector2(0f, 0f);
				component4.anchorMax = new Vector2(1f, 1f);
				component4.offsetMin = new Vector2(96f, 10f);
				component4.offsetMax = new Vector2(-94f, -10f);
				VerticalLayoutGroup component5 = val3.GetComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)component5).spacing = 2f;
				((HorizontalOrVerticalLayoutGroup)component5).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)component5).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)component5).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)component5).childForceExpandHeight = false;
				val3.GetComponent<LayoutElement>().flexibleWidth = 1f;
				traderText = CreateCellText("Trader", val3.transform, styleSource, 13, (FontStyles)1, new Color(0.98f, 0.86f, 0.48f, 1f));
				itemText = CreateCellText("Item", val3.transform, styleSource, 14, (FontStyles)0, new Color(0.94f, 0.92f, 0.86f, 1f), wrap: true);
				GameObject val4 = new GameObject("RewardBox", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val4.transform.SetParent(root.transform, false);
				RectTransform component6 = val4.GetComponent<RectTransform>();
				component6.anchorMin = new Vector2(1f, 0.5f);
				component6.anchorMax = new Vector2(1f, 0.5f);
				component6.pivot = new Vector2(1f, 0.5f);
				component6.anchoredPosition = new Vector2(-12f, 0f);
				component6.sizeDelta = new Vector2(70f, 78f);
				((Graphic)val4.GetComponent<Image>()).color = new Color(0.075f, 0.065f, 0.05f, 0.92f);
				GameObject val5 = new GameObject("StampIcon", new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				});
				val5.transform.SetParent(val4.transform, false);
				RectTransform component7 = val5.GetComponent<RectTransform>();
				component7.anchorMin = new Vector2(0.5f, 1f);
				component7.anchorMax = new Vector2(0.5f, 1f);
				component7.pivot = new Vector2(0.5f, 1f);
				component7.anchoredPosition = new Vector2(0f, -10f);
				component7.sizeDelta = new Vector2(34f, 34f);
				rewardIcon = val5.GetComponent<Image>();
				rewardIcon.preserveAspect = true;
				GameObject val6 = new GameObject("RewardAmount", new Type[2]
				{
					typeof(RectTransform),
					typeof(TextMeshProUGUI)
				});
				val6.transform.SetParent(val4.transform, false);
				RectTransform component8 = val6.GetComponent<RectTransform>();
				component8.anchorMin = new Vector2(0f, 0f);
				component8.anchorMax = new Vector2(1f, 0f);
				component8.pivot = new Vector2(0.5f, 0f);
				component8.offsetMin = new Vector2(4f, 8f);
				component8.offsetMax = new Vector2(-4f, 30f);
				rewardText = val6.GetComponent<TextMeshProUGUI>();
				CopyTextStyle(rewardText, styleSource);
				((TMP_Text)rewardText).fontSize = 13f;
				((TMP_Text)rewardText).fontStyle = (FontStyles)1;
				((Graphic)rewardText).color = new Color(1f, 0.68f, 0.15f, 1f);
				((TMP_Text)rewardText).alignment = (TextAlignmentOptions)514;
				((TMP_Text)rewardText).textWrappingMode = (TextWrappingModes)0;
				((TMP_Text)rewardText).overflowMode = (TextOverflowModes)1;
			}

			public void ApplyFrame(Color borderColor)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				cellFrame.Apply(borderColor);
			}

			public void Set(QuestRow row)
			{
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: 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_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: 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_00a2: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				root.SetActive(true);
				icon.sprite = row.Icon;
				((Behaviour)icon).enabled = (Object)(object)row.Icon != (Object)null;
				RectTransform rectTransform = ((Graphic)icon).rectTransform;
				float num = 58f;
				if ((Object)(object)row.Icon == (Object)null)
				{
					rectTransform.sizeDelta = new Vector2(num, num);
				}
				else
				{
					((Graphic)icon).SetNativeSize();
					Vector2 sizeDelta = rectTransform.sizeDelta;
					if (sizeDelta.x <= 0f || sizeDelta.y <= 0f)
					{
						rectTransform.sizeDelta = new Vector2(num, num);
					}
					else
					{
						float num2 = Mathf.Min(num / sizeDelta.x, num / sizeDelta.y);
						rectTransform.sizeDelta = sizeDelta * num2;
					}
				}
				((TMP_Text)traderText).text = row.TraderName;
				((TMP_Text)itemText).text = "x" + row.Quantity + " " + row.ItemName;
				rewardIcon.sprite = GetStampSprite();
				((Behaviour)rewardIcon).enabled = (Object)(object)rewardIcon.sprite != (Object)null;
				((TMP_Text)rewardText).text = "x" + row.Reward;
			}

			public void SetVisible(bool visible)
			{
				root.SetActive(visible);
			}

			private static TextMeshProUGUI CreateCellText(string name, Transform parent, TextMeshProUGUI? styleSource, int size, FontStyles style, Color color, bool wrap = false)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Expected O, but got Unknown
				//IL_0057: 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)
				GameObject val = new GameObject(name, new Type[3]
				{
					typeof(RectTransform),
					typeof(TextMeshProUGUI),
					typeof(LayoutElement)
				});
				val.transform.SetParent(parent, false);
				TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
				CopyTextStyle(component, styleSource);
				((TMP_Text)component).fontSize = size;
				((TMP_Text)component).fontStyle = style;
				((Graphic)component).color = color;
				((TMP_Text)component).textWrappingMode = (TextWrappingModes)(wrap ? 1 : 0);
				((TMP_Text)component).overflowMode = (TextOverflowModes)1;
				val.GetComponent<LayoutElement>().preferredHeight = (wrap ? 44f : ((float)size + 7f));
				return component;
			}

			private static Sprite? GetStampSprite()
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)stampSprite != (Object)null)
				{
					return stampSprite;
				}
				try
				{
					ItemDefinition asset = AssetAccess.GetAsset(ItemIds.Stamp);
					if ((Object)(object)asset != (Object)null)
					{
						stampSprite = asset.artwork;
					}
				}
				catch (Exception ex)
				{
					Debug.LogWarning((object)("[SulfurTaskTracker] Failed to load stamp artwork: " + ex));
				}
				return stampSprite;
			}
		}

		private sealed class CornerLineFrame
		{
			private readonly RoundedBorderGraphic border;

			private CornerLineFrame(RoundedBorderGraphic border)
			{
				this.border = border;
			}

			public static CornerLineFrame Add(RectTransform target, string name, float radius, float thickness)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: 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_0047: 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_0067: 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)
				//IL_007c: 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)
				GameObject val = new GameObject(name, new Type[3]
				{
					typeof(RectTransform),
					typeof(RoundedBorderGraphic),
					typeof(LayoutElement)
				});
				val.transform.SetParent((Transform)(object)target, false);
				RectTransform component = val.GetComponent<RectTransform>();
				component.anchorMin = Vector2.zero;
				component.anchorMax = Vector2.one;
				component.pivot = new Vector2(0.5f, 0.5f);
				component.anchoredPosition = Vector2.zero;
				component.sizeDelta = Vector2.zero;
				val.GetComponent<LayoutElement>().ignoreLayout = true;
				RoundedBorderGraphic component2 = val.GetComponent<RoundedBorderGraphic>();
				((Graphic)component2).raycastTarget = false;
				component2.Radius = radius;
				component2.Thickness = thickness;
				return new CornerLineFrame(component2);
			}

			public void Apply(Color color)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				((Graphic)border).color = color;
				((Graphic)border).SetVerticesDirty();
			}
		}

		private sealed class RoundedBorderGraphic : MaskableGraphic
		{
			private const int CornerSegments = 8;

			public float Radius { get; set; } = 10f;

			public float Thickness { get; set; } = 2f;

			protected override void OnPopulateMesh(VertexHelper vh)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: 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_0105: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_018e: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_021f: 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_0253: 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_0265: Unknown result type (might be due to invalid IL or missing references)
				//IL_026e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0273: Unknown result type (might be due to invalid IL or missing references)
				vh.Clear();
				Rect rect = ((Graphic)this).rectTransform.rect;
				if (!(((Rect)(ref rect)).width <= 0f) && !(((Rect)(ref rect)).height <= 0f))
				{
					float num = Mathf.Clamp(Thickness, 1f, Mathf.Min(((Rect)(ref rect)).width, ((Rect)(ref rect)).height) * 0.5f);
					float num2 = Mathf.Clamp(Radius, num, Mathf.Min(((Rect)(ref rect)).width, ((Rect)(ref rect)).height) * 0.5f);
					float num3 = Mathf.Max(0f, num2 - num);
					List<Vector2> list = new List<Vector2>(36);
					List<Vector2> list2 = new List<Vector2>(36);
					AddArc(list, new Vector2(((Rect)(ref rect)).xMax - num2, ((Rect)(ref rect)).yMax - num2), num2, 90f, 0f);
					AddArc(list, new Vector2(((Rect)(ref rect)).xMax - num2, ((Rect)(ref rect)).yMin + num2), num2, 0f, -90f);
					AddArc(list, new Vector2(((Rect)(ref rect)).xMin + num2, ((Rect)(ref rect)).yMin + num2), num2, -90f, -180f);
					AddArc(list, new Vector2(((Rect)(ref rect)).xMin + num2, ((Rect)(ref rect)).yMax - num2), num2, 180f, 90f);
					Rect val = default(Rect);
					((Rect)(ref val))..ctor(((Rect)(ref rect)).xMin + num, ((Rect)(ref rect)).yMin + num, ((Rect)(ref rect)).width - num * 2f, ((Rect)(ref rect)).height - num * 2f);
					AddArc(list2, new Vector2(((Rect)(ref val)).xMax - num3, ((Rect)(ref val)).yMax - num3), num3, 90f, 0f);
					AddArc(list2, new Vector2(((Rect)(ref val)).xMax - num3, ((Rect)(ref val)).yMin + num3), num3, 0f, -90f);
					AddArc(list2, new Vector2(((Rect)(ref val)).xMin + num3, ((Rect)(ref val)).yMin + num3), num3, -90f, -180f);
					AddArc(list2, new Vector2(((Rect)(ref val)).xMin + num3, ((Rect)(ref val)).yMax - num3), num3, 180f, 90f);
					Color32 color = Color32.op_Implicit(((Graphic)this).color);
					int num4 = Mathf.Min(list.Count, list2.Count);
					for (int i = 0; i < num4; i++)
					{
						int index = (i + 1) % num4;
						AddQuad(vh, list[i], list[index], list2[index], list2[i], color);
					}
				}
			}

			private static void AddArc(List<Vector2> points, Vector2 center, float radius, float startDegrees, float endDegrees)
			{
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				for (int i = 0; i <= 8; i++)
				{
					float num = (float)i / 8f;
					float num2 = Mathf.Lerp(startDegrees, endDegrees, num) * (MathF.PI / 180f);
					points.Add(center + new Vector2(Mathf.Cos(num2), Mathf.Sin(num2)) * radius);
				}
			}

			private static void AddQuad(VertexHelper vh, Vector2 a, Vector2 b, Vector2 c, Vector2 d, Color32 color)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: 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_0045: 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_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_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)
				int currentVertCount = vh.currentVertCount;
				vh.AddVert(Vector2.op_Implicit(a), color, Vector4.op_Implicit(Vector2.zero));
				vh.AddVert(Vector2.op_Implicit(b), color, Vector4.op_Implicit(Vector2.zero));
				vh.AddVert(Vector2.op_Implicit(c), color, Vector4.op_Implicit(Vector2.zero));
				vh.AddVert(Vector2.op_Implicit(d), color, Vector4.op_Implicit(Vector2.zero));
				vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2);
				vh.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount);
			}
		}

		private readonly struct QuestRow
		{
			public UnitSO Trader { get; }

			public string TraderName { get; }

			public string ItemName { get; }

			public Sprite? Icon { get; }

			public int Quantity { get; }

			public int Reward { get; }

			public QuestRow(UnitSO trader, string traderName, string itemName, Sprite? icon, int quantity, int reward)
			{
				Trader = trader;
				TraderName = traderName;
				ItemName = itemName;
				Icon = icon;
				Quantity = quantity;
				Reward = reward;
			}
		}

		private const float RefreshInterval = 0.5f;

		private const int CellPoolSize = 16;

		private const float ActiveQuestCacheSyncInterval = 5f;

		private const string KnownTradersSaveKey = "SulfurTaskTrackerKnownQuestTraders";

		private static readonly Color BorderColor = new Color(0.93f, 0.56f, 0.07f, 0.95f);

		private static readonly Color PanelBackgroundColor = new Color(0.035f, 0.03f, 0.025f, 0.9f);

		private static readonly Color CellBackgroundColor = new Color(0.105f, 0.09f, 0.07f, 0.94f);

		private static readonly FieldInfo? QuestGiverCurrentQuestField = typeof(QuestGiver).GetField("currentQuest", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly FieldInfo? QuestGiverOwnerField = typeof(QuestGiver).GetField("Owner", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly FieldInfo? GridSlotBorderColorField = typeof(GridSlotVisual).GetField("borderColor", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly HashSet<ushort> KnownTraderIds = new HashSet<ushort>();

		private InventoryUI? inventoryUi;

		private RectTransform? panelParent;

		private RectTransform? panel;

		private RectTransform? content;

		private GridLayoutGroup? gridLayout;

		private LayoutElement? viewportLayout;

		private TextMeshProUGUI? titleText;

		private TextMeshProUGUI? emptyText;

		private TextMeshProUGUI? styleSource;

		private Color nativeBorderColor = BorderColor;

		private CornerLineFrame? panelFrame;

		private readonly List<QuestCell> cells = new List<QuestCell>();

		private float nextRefreshTime;

		private static float nextActiveQuestCacheSyncTime;

		private static bool knownTradersLoaded;

		private void Update()
		{
			if (!(Time.unscaledTime < nextRefreshTime))
			{
				nextRefreshTime = Time.unscaledTime + 0.5f;
				Tick();
			}
		}

		private void Tick()
		{
			if ((Object)(object)inventoryUi == (Object)null)
			{
				inventoryUi = FindInventoryUi();
				if ((Object)(object)inventoryUi != (Object)null)
				{
					BuildPanel(inventoryUi);
				}
			}
			if (!((Object)(object)inventoryUi == (Object)null) && !((Object)(object)panel == (Object)null))
			{
				LearnOpenQuestGivers();
				bool flag = ShouldShowInMainInventory(inventoryUi);
				((Component)panel).gameObject.SetActive(flag);
				if (flag)
				{
					UpdatePanelLayout(inventoryUi);
					Refresh();
				}
			}
		}

		private static bool ShouldShowInMainInventory(InventoryUI ui)
		{
			if (!ui.IsOpened)
			{
				return false;
			}
			if ((Object)(object)ui.CurrentServiceStation != (Object)null || (Object)(object)ui.CurrentShopKeeper != (Object)null)
			{
				return false;
			}
			if (!ui.InShopUI)
			{
				return !ui.InStashUI;
			}
			return false;
		}

		private static InventoryUI? FindInventoryUi()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			InventoryUI[] array = Resources.FindObjectsOfTypeAll<InventoryUI>();
			foreach (InventoryUI val in array)
			{
				if (!((Object)(object)val != (Object)null))
				{
					continue;
				}
				Scene scene = ((Component)val).gameObject.scene;
				if (((Scene)(ref scene)).IsValid())
				{
					scene = ((Component)val).gameObject.scene;
					if (((Scene)(ref scene)).isLoaded)
					{
						return val;
					}
				}
			}
			return null;
		}

		private void BuildPanel(InventoryUI ui)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_00b2: Expected O, but got Unknown
			//IL_00e0: 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_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Expected O, but got Unknown
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			panelParent = (RectTransform?)(((Object)(object)ui.InventoryPanelRight != (Object)null) ? ((object)ui.InventoryPanelRight) : ((object)/*isinst with value type is only supported in some contexts*/));
			if (!((Object)(object)panelParent == (Object)null))
			{
				styleSource = ((Component)panelParent).GetComponentInChildren<TextMeshProUGUI>(true);
				nativeBorderColor = (Color)(((??)TryReadNativeBorderColor(ui)) ?? BorderColor);
				GameObject val = new GameObject("SulfurTaskTrackerPanel", new Type[4]
				{
					typeof(RectTransform),
					typeof(CanvasGroup),
					typeof(Image),
					typeof(VerticalLayoutGroup)
				});
				val.transform.SetParent((Transform)(object)panelParent, false);
				panel = val.GetComponent<RectTransform>();
				panel.anchorMin = new Vector2(0f, 1f);
				panel.anchorMax = new Vector2(0f, 1f);
				panel.pivot = new Vector2(0f, 1f);
				panel.anchoredPosition = new Vector2(18f, 0f);
				panel.sizeDelta = new Vector2(380f, 580f);
				((Graphic)val.GetComponent<Image>()).color = PanelBackgroundColor;
				panelFrame = CornerLineFrame.Add(panel, "MainFrame", 12f, 2f);
				panelFrame.Apply(nativeBorderColor);
				VerticalLayoutGroup component = val.GetComponent<VerticalLayoutGroup>();
				((LayoutGroup)component).padding = new RectOffset(12, 12, 12, 12);
				((HorizontalOrVerticalLayoutGroup)component).spacing = 8f;
				((HorizontalOrVerticalLayoutGroup)component).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)component).childControlHeight = false;
				((HorizontalOrVerticalLayoutGroup)component).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)component).childForceExpandHeight = false;
				titleText = CreateText("Current Trader Quests", val.transform, 17, (FontStyles)1);
				((TMP_Text)titleText).alignment = (TextAlignmentOptions)513;
				((TMP_Text)titleText).rectTransform.sizeDelta = new Vector2(0f, 28f);
				GameObject val2 = new GameObject("Viewport", new Type[4]
				{
					typeof(RectTransform),
					typeof(Image),
					typeof(RectMask2D),
					typeof(ScrollRect)
				});
				val2.transform.SetParent(val.transform, false);
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.sizeDelta = new Vector2(0f, 448f);
				viewportLayout = val2.AddComponent<LayoutElement>();
				viewportLayout.flexibleHeight = 1f;
				viewportLayout.minHeight = 180f;
				((Graphic)val2.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.12f);
				GameObject val3 = new GameObject("Grid", new Type[3]
				{
					typeof(RectTransform),
					typeof(GridLayoutGroup),
					typeof(ContentSizeFitter)
				});
				val3.transform.SetParent(val2.transform, false);
				content = val3.GetComponent<RectTransform>();
				content.anchorMin = new Vector2(0f, 1f);
				content.anchorMax = new Vector2(1f, 1f);
				content.pivot = new Vector2(0.5f, 1f);
				content.anchoredPosition = Vector2.zero;
				content.sizeDelta = new Vector2(0f, 0f);
				gridLayout = val3.GetComponent<GridLayoutGroup>();
				gridLayout.cellSize = new Vector2(356f, 112f);
				gridLayout.spacing = new Vector2(0f, 9f);
				gridLayout.constraint = (Constraint)1;
				gridLayout.constraintCount = 1;
				((LayoutGroup)gridLayout).childAlignment = (TextAnchor)0;
				val3.GetComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
				ScrollRect component3 = val2.GetComponent<ScrollRect>();
				component3.viewport = component2;
				component3.content = content;
				component3.horizontal = false;
				component3.vertical = true;
				component3.movementType = (MovementType)2;
				emptyText = CreateText("No active trader quests", val2.transform, 16, (FontStyles)0);
				((TMP_Text)emptyText).alignment = (TextAlignmentOptions)514;
				((TMP_Text)emptyText).rectTransform.anchorMin = Vector2.zero;
				((TMP_Text)emptyText).rectTransform.anchorMax = Vector2.one;
				((TMP_Text)emptyText).rectTransform.offsetMin = Vector2.zero;
				((TMP_Text)emptyText).rectTransform.offsetMax = Vector2.zero;
				for (int i = 0; i < 16; i++)
				{
					QuestCell questCell = new QuestCell(val3.transform, styleSource);
					questCell.ApplyFrame(nativeBorderColor);
					cells.Add(questCell);
				}
				UpdatePanelLayout(ui);
			}
		}

		private void UpdatePanelLayout(InventoryUI ui)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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)
			if ((Object)(object)panel == (Object)null)
			{
				return;
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(380f, 580f);
			ItemGrid playerBackpackGrid = ui.PlayerBackpackGrid;
			RectTransform val2 = (((Object)(object)playerBackpackGrid != (Object)null) ? playerBackpackGrid.RectTransform : null);
			if ((Object)(object)val2 != (Object)null)
			{
				Rect rect = val2.rect;
				if (((Rect)(ref rect)).width > 0f && ((Rect)(ref rect)).height > 0f)
				{
					((Vector2)(ref val))..ctor(Mathf.Clamp(((Rect)(ref rect)).width * 0.78f, 350f, 430f), ((Rect)(ref rect)).height);
				}
			}
			panel.sizeDelta = val;
			AlignPanelTopToBackpack(ui);
			EnsureNativeBorderColor(ui);
			float num = Mathf.Max(260f, val.x - 28f);
			if ((Object)(object)gridLayout != (Object)null)
			{
				gridLayout.cellSize = new Vector2(num, 112f);
			}
			if ((Object)(object)viewportLayout != (Object)null)
			{
				viewportLayout.minHeight = Mathf.Max(180f, val.y - 52f);
			}
		}

		private void EnsureNativeBorderColor(InventoryUI ui)
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			Color? val = TryReadNativeBorderColor(ui);
			if (val.HasValue)
			{
				nativeBorderColor = val.Value;
				panelFrame?.Apply(nativeBorderColor);
				for (int i = 0; i < cells.Count; i++)
				{
					cells[i].ApplyFrame(nativeBorderColor);
				}
			}
		}

		private void AlignPanelTopToBackpack(InventoryUI ui)
		{
			//IL_0071: 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_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)
			//IL_00a2: 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)
			if (!((Object)(object)panel == (Object)null) && !((Object)(object)panelParent == (Object)null))
			{
				ItemGrid playerBackpackGrid = ui.PlayerBackpackGrid;
				RectTransform val = (((Object)(object)playerBackpackGrid != (Object)null) ? playerBackpackGrid.RectTransform : null);
				if ((Object)(object)val == (Object)null)
				{
					panel.anchoredPosition = new Vector2(18f, 0f);
					return;
				}
				Vector3[] array = (Vector3[])(object)new Vector3[4];
				val.GetWorldCorners(array);
				float y = ((Transform)panelParent).InverseTransformPoint(array[2]).y;
				Rect rect = panelParent.rect;
				float num = y - ((Rect)(ref rect)).yMax;
				panel.anchoredPosition = new Vector2(18f, num);
			}
		}

		private void Refresh()
		{
			List<QuestRow> list = CollectRows();
			if ((Object)(object)titleText != (Object)null)
			{
				((TMP_Text)titleText).text = ((list.Count == 1) ? "Current Trader Quest" : "Current Trader Quests");
			}
			if ((Object)(object)emptyText != (Object)null)
			{
				((Component)emptyText).gameObject.SetActive(list.Count == 0);
			}
			for (int i = 0; i < cells.Count; i++)
			{
				if (i < list.Count)
				{
					cells[i].Set(list[i]);
				}
				else
				{
					cells[i].SetVisible(visible: false);
				}
			}
		}

		private static List<QuestRow> CollectRows()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			List<QuestRow> list = new List<QuestRow>();
			try
			{
				GameManager instance = StaticInstance<GameManager>.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return list;
				}
				if (instance.ActiveQuests == null || Time.unscaledTime >= nextActiveQuestCacheSyncTime)
				{
					instance.UpdateActiveQuests(default(UnitId), (List<QuestRequirement>)null);
					nextActiveQuestCacheSyncTime = Time.unscaledTime + 5f;
				}
				IDictionary activeQuests = instance.ActiveQuests;
				if (activeQuests != null)
				{
					foreach (DictionaryEntry item in activeQuests)
					{
						object key = item.Key;
						UnitSO val = (UnitSO)((key is UnitSO) ? key : null);
						IEnumerable enumerable = item.Value as IEnumerable;
						if (!((Object)(object)val == (Object)null) && enumerable != null && IsKnownTrader(val))
						{
							AddRequirementRows(list, val, enumerable);
						}
					}
				}
				AddLiveQuestGiverRows(list);
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[SulfurTaskTracker] Failed to refresh quest list: " + ex));
			}
			return list;
		}

		private static void LearnOpenQuestGivers()
		{
			//IL_0031: 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)
			//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)
			if (QuestGiverCurrentQuestField == null)
			{
				return;
			}
			QuestGiver[] array = Resources.FindObjectsOfTypeAll<QuestGiver>();
			foreach (QuestGiver val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Scene scene = ((Component)val).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					continue;
				}
				scene = ((Component)val).gameObject.scene;
				if (!((Scene)(ref scene)).isLoaded)
				{
					continue;
				}
				object? value = QuestGiverCurrentQuestField.GetValue(val);
				Quest val2 = (Quest)((value is Quest) ? value : null);
				if (val2 != null && val2.requirements != null)
				{
					object? obj = QuestGiverOwnerField?.GetValue(val);
					Npc val3 = (Npc)((obj is Npc) ? obj : null);
					if ((Object)(object)val3 == (Object)null)
					{
						val3 = ((Component)val).GetComponent<Npc>();
					}
					if ((Object)(object)val3 != (Object)null && (Object)(object)((Unit)val3).unitSO != (Object)null)
					{
						RememberTrader(((Unit)val3).unitSO);
					}
				}
			}
		}

		private static void AddLiveQuestGiverRows(List<QuestRow> rows)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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)
			if (QuestGiverCurrentQuestField == null)
			{
				return;
			}
			QuestGiver[] array = Resources.FindObjectsOfTypeAll<QuestGiver>();
			foreach (QuestGiver val in array)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Scene scene = ((Component)val).gameObject.scene;
				if (!((Scene)(ref scene)).IsValid())
				{
					continue;
				}
				scene = ((Component)val).gameObject.scene;
				if (!((Scene)(ref scene)).isLoaded)
				{
					continue;
				}
				object? value = QuestGiverCurrentQuestField.GetValue(val);
				Quest val2 = (Quest)((value is Quest) ? value : null);
				if (val2 == null || val2.requirements == null)
				{
					continue;
				}
				object? obj = QuestGiverOwnerField?.GetValue(val);
				Npc val3 = (Npc)((obj is Npc) ? obj : null);
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = ((Component)val).GetComponent<Npc>();
				}
				if ((Object)(object)val3 == (Object)null || (Object)(object)((Unit)val3).unitSO == (Object)null)
				{
					continue;
				}
				UnitSO trader = ((Unit)val3).unitSO;
				if (IsKnownTrader(trader))
				{
					rows.RemoveAll((QuestRow row) => (Object)(object)row.Trader == (Object)(object)trader);
					AddRequirementRows(rows, trader, val2.requirements);
				}
			}
		}

		private static bool IsKnownTrader(UnitSO trader)
		{
			LoadKnownTraders();
			if (((UnitId)(ref trader.id)).IsValid)
			{
				return KnownTraderIds.Contains(trader.id.value);
			}
			return false;
		}

		private static void RememberTrader(UnitSO trader)
		{
			if (((UnitId)(ref trader.id)).IsValid)
			{
				LoadKnownTraders();
				if (KnownTraderIds.Add(trader.id.value))
				{
					SaveKnownTraders();
				}
			}
		}

		private static void LoadKnownTraders()
		{
			if (knownTradersLoaded)
			{
				return;
			}
			try
			{
				if (SulfurSave.Imp == null || !SulfurSave.Imp.initialized)
				{
					return;
				}
				knownTradersLoaded = true;
				List<ushort> list = SulfurSave.Imp.Load<List<ushort>>("SulfurTaskTrackerKnownQuestTraders", new List<ushort>());
				KnownTraderIds.Clear();
				for (int i = 0; i < list.Count; i++)
				{
					if (list[i] != 0)
					{
						KnownTraderIds.Add(list[i]);
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[SulfurTaskTracker] Failed to load known quest traders: " + ex));
			}
		}

		private static void SaveKnownTraders()
		{
			try
			{
				if (SulfurSave.Imp != null && SulfurSave.Imp.initialized)
				{
					SulfurSave.Imp.SaveToDisk<List<ushort>>("SulfurTaskTrackerKnownQuestTraders", new List<ushort>(KnownTraderIds));
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[SulfurTaskTracker] Failed to save known quest traders: " + ex));
			}
		}

		private static void AddRequirementRows(List<QuestRow> rows, UnitSO trader, IEnumerable requirements)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			foreach (object requirement in requirements)
			{
				QuestRequirement val = (QuestRequirement)((requirement is QuestRequirement) ? requirement : null);
				if (val != null && ((ItemId)(ref val.ItemId)).IsValid)
				{
					ItemDefinition asset = AssetAccess.GetAsset(val.ItemId);
					if (!((Object)(object)asset == (Object)null))
					{
						rows.Add(new QuestRow(trader, trader.LocalizedIdentifier(), asset.LocalizedDisplayName, asset.artwork, val.quantity, Mathf.Max(1, Mathf.RoundToInt(val.stampRewardPerItem * (float)val.quantity))));
					}
				}
			}
		}

		private TextMeshProUGUI CreateText(string text, Transform parent, int size, FontStyles style)
		{
			//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_0058: 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)
			GameObject val = new GameObject("Text", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParent(parent, false);
			TextMeshProUGUI component = val.GetComponent<TextMeshProUGUI>();
			CopyTextStyle(component, styleSource);
			((TMP_Text)component).text = text;
			((TMP_Text)component).fontSize = size;
			((TMP_Text)component).fontStyle = style;
			((Graphic)component).color = new Color(0.92f, 0.86f, 0.74f, 1f);
			((TMP_Text)component).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)component).overflowMode = (TextOverflowModes)1;
			return component;
		}

		private static void CopyTextStyle(TextMeshProUGUI target, TextMeshProUGUI? source)
		{
			if (!((Object)(object)source == (Object)null))
			{
				((TMP_Text)target).font = ((TMP_Text)source).font;
				((TMP_Text)target).fontSharedMaterial = ((TMP_Text)source).fontSharedMaterial;
				((TMP_Text)target).spriteAsset = ((TMP_Text)source).spriteAsset;
			}
		}

		private static Color? TryReadNativeBorderColor(InventoryUI ui)
		{
			//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_0065: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ItemGrid playerBackpackGrid = ui.PlayerBackpackGrid;
				GridSlot val = (((Object)(object)playerBackpackGrid != (Object)null) ? playerBackpackGrid.GetSlotAt(0, 0) : null);
				GridSlotVisual val2 = ((val != null) ? val.visual : null);
				if ((Object)(object)val2 == (Object)null)
				{
					return null;
				}
				if (GridSlotBorderColorField?.GetValue(val2) is Color value)
				{
					return value;
				}
			}
			catch (Exception ex)
			{
				Debug.LogWarning((object)("[SulfurTaskTracker] Failed to read inventory border color: " + ex));
			}
			return null;
		}
	}
}