Decompiled source of Quads Party HUD v1.10.2

plugins/PartyHud.dll

Decompiled 13 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.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 DHack.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Splatform;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyMetadata("AI_Assisted_Creation", "This assembly was partially or fully created with the assistance of Generative AI (Claude Code).")]
[assembly: AssemblyMetadata("AI_Model_Vendor", "Anthropic")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.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 PartyHud
{
	internal static class GameUi
	{
		internal sealed class Edge
		{
			internal Image[] Sides;

			private Color _color;

			internal void SetColor(Color color, bool force = false)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: 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_0030: Unknown result type (might be due to invalid IL or missing references)
				if (force || !(color == _color))
				{
					_color = color;
					Image[] sides = Sides;
					foreach (Image val in sides)
					{
						((Graphic)val).color = color;
						((Behaviour)val).enabled = color.a > 0.01f;
					}
				}
			}
		}

		internal sealed class Meter
		{
			internal RectTransform Groove;

			internal Image Fill;

			internal Image Trail;

			internal TMP_Text Text;

			internal TMP_Text Shadow;

			private float _fill = -1f;

			private float _trail = -1f;

			internal void Set(float fraction, float trail = -1f, bool force = false)
			{
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				fraction = Mathf.Clamp01(fraction);
				if (force || Mathf.Abs(fraction - _fill) > 0.0005f)
				{
					_fill = fraction;
					((Graphic)Fill).rectTransform.anchorMax = new Vector2(fraction, 1f);
					((Behaviour)Fill).enabled = fraction > 0.002f;
				}
				if (!((Object)(object)Trail == (Object)null))
				{
					trail = Mathf.Clamp01(Mathf.Max(trail, _fill));
					if (force || Mathf.Abs(trail - _trail) > 0.0005f)
					{
						_trail = trail;
						((Graphic)Trail).rectTransform.anchorMax = new Vector2(trail, 1f);
					}
					((Behaviour)Trail).enabled = _trail > _fill + 0.002f;
				}
			}

			internal void SetColor(Color color)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: 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)
				if (((Graphic)Fill).color != color)
				{
					((Graphic)Fill).color = color;
				}
			}

			internal void SetText(string text)
			{
				GameUi.SetText(Text, text ?? "");
				GameUi.SetText(Shadow, text ?? "");
			}

			internal void SetActive(bool on)
			{
				if (((Component)Groove).gameObject.activeSelf != on)
				{
					((Component)Groove).gameObject.SetActive(on);
				}
			}
		}

		private const string CanvasName = "PartyHudCanvas";

		internal static Func<bool> IsOpen = () => false;

		internal static TMP_FontAsset Norse;

		internal static TMP_FontAsset Serif;

		internal static TMP_FontAsset Sans;

		private static Image _panel;

		private static Image _sunken;

		private static Image _braid;

		private static Button _button;

		private static Button _tab;

		private static GameObject _cell;

		private static float _cellSpace = 70f;

		internal static readonly Color Warm = new Color(1f, 0.86f, 0.55f);

		internal static readonly Color Text = new Color(0.94f, 0.9f, 0.82f);

		internal static readonly Color Dim = new Color(0.75f, 0.72f, 0.66f);

		internal static readonly Color Gold = new Color(1f, 0.78f, 0.3f);

		internal static readonly Color Warn = new Color(1f, 0.55f, 0.35f);

		internal static readonly Color Good = new Color(0.6f, 0.9f, 0.55f);

		private static Canvas _canvas;

		internal static Transform Canvas
		{
			get
			{
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				if ((Object)(object)_canvas != (Object)null)
				{
					Match();
					return ((Component)_canvas).transform;
				}
				InventoryGui instance = InventoryGui.instance;
				if ((Object)(object)instance == (Object)null)
				{
					return null;
				}
				foreach (Transform item in (from Transform t in (IEnumerable)((Component)instance).transform.parent
					where ((Object)t).name == "PartyHudCanvas"
					select t).ToList())
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
				Canvas val = ((Component)instance).GetComponentInChildren<Canvas>(true) ?? ((Component)instance).GetComponentInParent<Canvas>();
				GameObject val2 = new GameObject("PartyHudCanvas", new Type[1] { typeof(RectTransform) });
				val2.transform.SetParent(((Component)instance).transform.parent, false);
				_canvas = val2.AddComponent<Canvas>();
				_canvas.renderMode = (RenderMode)0;
				_canvas.sortingOrder = (((Object)(object)val != (Object)null) ? val.sortingOrder : 0) + 5;
				val2.AddComponent<CanvasScaler>();
				val2.AddComponent<GraphicRaycaster>();
				Match();
				return ((Component)_canvas).transform;
			}
		}

		internal static float CellSpace => _cellSpace;

		internal static Transform HudRoot
		{
			get
			{
				if (!((Object)(object)Hud.instance != (Object)null) || !((Object)(object)Hud.instance.m_rootObject != (Object)null))
				{
					return null;
				}
				return Hud.instance.m_rootObject.transform;
			}
		}

		private static void Match()
		{
			//IL_0054: 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)
			InventoryGui instance = InventoryGui.instance;
			CanvasScaler val = (((Object)(object)_canvas != (Object)null) ? ((Component)_canvas).GetComponent<CanvasScaler>() : null);
			CanvasScaler val2 = (((Object)(object)instance != (Object)null) ? (((Component)instance).GetComponentInChildren<CanvasScaler>(true) ?? ((Component)instance).GetComponentInParent<CanvasScaler>()) : null);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
			{
				val.uiScaleMode = val2.uiScaleMode;
				val.referenceResolution = val2.referenceResolution;
				val.screenMatchMode = val2.screenMatchMode;
				val.matchWidthOrHeight = val2.matchWidthOrHeight;
				val.scaleFactor = val2.scaleFactor;
				val.referencePixelsPerUnit = val2.referencePixelsPerUnit;
			}
		}

		internal static void Destroy()
		{
			if ((Object)(object)_canvas != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_canvas).gameObject);
			}
			_canvas = null;
			_panel = null;
			_button = null;
			_cell = null;
			IsOpen = () => false;
		}

		internal static bool Ready()
		{
			if ((Object)(object)_button != (Object)null && (Object)(object)_panel != (Object)null && (Object)(object)_cell != (Object)null)
			{
				return true;
			}
			InventoryGui instance = InventoryGui.instance;
			if ((Object)(object)instance == (Object)null)
			{
				return false;
			}
			Transform root = ((Component)instance).transform;
			_panel = Find<Image>("root/Crafting/Bkg") ?? Find<Image>("root/Player/Bkg");
			_sunken = Find<Image>("root/Player/sunken");
			_braid = Find<Image>("root/Crafting/BraidLineHorisontalMedium");
			_button = Find<Button>("root/Player/Container/TakeAll");
			_tab = Find<Button>("root/Crafting/TabsButtons/Craft");
			TMP_Text obj = Find<TMP_Text>("root/Crafting/topic");
			Norse = ((obj != null) ? obj.font : null);
			TMP_Text obj2 = Find<TMP_Text>("root/Crafting/TabsButtons/Craft/Text");
			Serif = ((obj2 != null) ? obj2.font : null);
			TMP_Text obj3 = Find<TMP_Text>("root/Crafting/Decription/Description");
			Sans = ((obj3 != null) ? obj3.font : null) ?? Serif;
			InventoryGrid playerGrid = instance.m_playerGrid;
			if ((Object)(object)playerGrid != (Object)null)
			{
				_cell = playerGrid.m_elementPrefab;
				_cellSpace = ((playerGrid.m_elementSpace > 1f) ? playerGrid.m_elementSpace : 70f);
			}
			if ((Object)(object)_button == (Object)null || (Object)(object)_panel == (Object)null || (Object)(object)_cell == (Object)null)
			{
				Debug.LogWarning((object)"PartyHudCanvas: the game's interface was not found where expected (a game update moved it?)");
			}
			if ((Object)(object)_button != (Object)null && (Object)(object)_panel != (Object)null)
			{
				return (Object)(object)_cell != (Object)null;
			}
			return false;
			T Find<T>(string path) where T : Component
			{
				Transform val = root.Find(path);
				if (!((Object)(object)val != (Object)null))
				{
					return default(T);
				}
				return ((Component)val).GetComponent<T>();
			}
		}

		internal static RectTransform Rect(Transform parent, string name, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 size)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0030: 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_0032: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent(parent, false);
			Vector2 anchorMin = (val2.anchorMax = anchor);
			val2.anchorMin = anchorMin;
			val2.pivot = pivot;
			val2.anchoredPosition = pos;
			val2.sizeDelta = size;
			return val2;
		}

		internal static RectTransform Window(string name, Vector2 size)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Rect(Canvas, name, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, size);
			Copy(_panel, ((Component)val).gameObject.AddComponent<Image>());
			return val;
		}

		internal static RectTransform Box(Transform parent, Vector2 pos, Vector2 size)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Rect(parent, "Box", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size);
			Image val2 = ((Component)val).gameObject.AddComponent<Image>();
			if ((Object)(object)_sunken != (Object)null)
			{
				Copy(_sunken, val2);
			}
			else
			{
				((Graphic)val2).color = new Color(0f, 0f, 0f, 0.35f);
			}
			return val;
		}

		internal static void Braid(Transform parent, Vector2 pos, float width)
		{
			//IL_001e: 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_0032: 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_0043: 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_0068: 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)_braid == (Object)null))
			{
				Vector2 anchor = new Vector2(0.5f, 1f);
				Vector2 pivot = new Vector2(0.5f, 0.5f);
				Rect rect = ((Graphic)_braid).rectTransform.rect;
				float num;
				if (!(((Rect)(ref rect)).height > 1f))
				{
					num = 16f;
				}
				else
				{
					rect = ((Graphic)_braid).rectTransform.rect;
					num = ((Rect)(ref rect)).height;
				}
				RectTransform val = Rect(parent, "Braid", anchor, pivot, pos, new Vector2(width, num));
				Copy(_braid, ((Component)val).gameObject.AddComponent<Image>());
			}
		}

		private static void Copy(Image from, Image to)
		{
			//IL_0018: 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)
			if (!((Object)(object)from == (Object)null))
			{
				to.sprite = from.sprite;
				to.type = from.type;
				((Graphic)to).material = ((Graphic)from).material;
				((Graphic)to).color = ((Graphic)from).color;
				to.pixelsPerUnitMultiplier = from.pixelsPerUnitMultiplier;
				to.fillCenter = from.fillCenter;
			}
		}

		internal static TMP_Text Label(Transform parent, string text, Vector2 pos, Vector2 size, float fontSize, Color color, TMP_FontAsset font = null, TextAlignmentOptions align = (TextAlignmentOptions)257, Vector2? anchor = null)
		{
			//IL_0020: 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_0025: 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_002d: 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_002f: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = (Vector2)(((??)anchor) ?? new Vector2(0f, 1f));
			RectTransform val2 = Rect(parent, "Text", val, val, pos, size);
			bool activeSelf = ((Component)val2).gameObject.activeSelf;
			((Component)val2).gameObject.SetActive(false);
			TextMeshProUGUI val3 = ((Component)val2).gameObject.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val3).font = font ?? Sans;
			((Component)val2).gameObject.SetActive(activeSelf);
			((TMP_Text)val3).fontSize = fontSize;
			((Graphic)val3).color = color;
			((TMP_Text)val3).alignment = align;
			((TMP_Text)val3).richText = true;
			((TMP_Text)val3).enableWordWrapping = true;
			((TMP_Text)val3).overflowMode = (TextOverflowModes)0;
			((TMP_Text)val3).text = text;
			((Graphic)val3).raycastTarget = false;
			return (TMP_Text)(object)val3;
		}

		internal static Button Button(Transform parent, string text, Vector2 pos, Vector2 size, Action click, bool enabled = true, float fontSize = 18f)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0031: 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_0059: Expected O, but got Unknown
			Button val = Clone(_button, parent, text, pos, size, fontSize);
			((Selectable)val).interactable = enabled;
			((Graphic)Label(val)).color = (enabled ? Text : Dim);
			((UnityEvent)val.onClick).AddListener((UnityAction)delegate
			{
				click();
			});
			return val;
		}

		internal static Button Tab(Transform parent, string text, Vector2 pos, Vector2 size, bool chosen, Action click, float fontSize = 18f)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			Button val = Clone(_tab ?? _button, parent, text, pos, size, fontSize);
			Transform val2 = ((Component)val).transform.Find("Selected");
			if ((Object)(object)val2 != (Object)null)
			{
				((Component)val2).gameObject.SetActive(false);
			}
			((Selectable)val).interactable = !chosen;
			((Graphic)Label(val)).color = (chosen ? Gold : Text);
			((UnityEvent)val.onClick).AddListener((UnityAction)delegate
			{
				click();
			});
			return val;
		}

		internal static TMP_Text Label(Button b)
		{
			return ((IEnumerable<TMP_Text>)((Component)b).GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => ((Component)t).gameObject.activeSelf));
		}

		private static Button Clone(Button template, Transform parent, string text, Vector2 pos, Vector2 size, float fontSize)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Expected O, but got Unknown
			//IL_00ed: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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_0131: Expected O, but got Unknown
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Expected O, but got Unknown
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: 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_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(((Component)template).gameObject, parent, false);
			((Object)val).name = "Button";
			val.SetActive(true);
			foreach (Transform item in ((IEnumerable)val.transform).Cast<Transform>().ToList())
			{
				if (((Object)item).name.StartsWith("gamepad_hint"))
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}
			UIGamePad[] componentsInChildren = val.GetComponentsInChildren<UIGamePad>(true);
			foreach (UIGamePad val2 in componentsInChildren)
			{
				Object.Destroy((Object)(object)val2);
			}
			ButtonTextColor[] componentsInChildren2 = val.GetComponentsInChildren<ButtonTextColor>(true);
			foreach (ButtonTextColor val3 in componentsInChildren2)
			{
				Object.Destroy((Object)(object)val3);
			}
			RectTransform val4 = (RectTransform)val.transform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0f, 1f);
			val4.anchorMax = val5;
			val4.anchorMin = val5;
			val4.pivot = new Vector2(0f, 1f);
			val4.anchoredPosition = pos;
			val4.sizeDelta = size;
			Button component = val.GetComponent<Button>();
			component.onClick = new ButtonClickedEvent();
			TMP_Text val6 = ((IEnumerable<TMP_Text>)val.GetComponentsInChildren<TMP_Text>(true)).FirstOrDefault((Func<TMP_Text, bool>)((TMP_Text t) => ((Object)t).name == "Text"));
			if ((Object)(object)val6 == (Object)null)
			{
				val6 = Label(val.transform, text, Vector2.zero, size, fontSize, Text, Serif, (TextAlignmentOptions)514, (Vector2?)new Vector2(0.5f, 0.5f));
				((RectTransform)val6.transform).pivot = new Vector2(0.5f, 0.5f);
			}
			val6.text = text;
			val6.fontSize = fontSize;
			val6.enableAutoSizing = false;
			val6.enableWordWrapping = false;
			val6.overflowMode = (TextOverflowModes)1;
			RectTransform val7 = (RectTransform)val6.transform;
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = new Vector2(4f, 0f);
			val7.offsetMax = new Vector2(-4f, 0f);
			val6.alignment = (TextAlignmentOptions)514;
			TMP_Text[] componentsInChildren3 = val.GetComponentsInChildren<TMP_Text>(true);
			foreach (TMP_Text val8 in componentsInChildren3)
			{
				if ((Object)(object)val8 != (Object)(object)val6)
				{
					((Component)val8).gameObject.SetActive(false);
				}
			}
			return component;
		}

		internal static Image Icon(Transform parent, Vector2 pos, Vector2 size, Sprite sprite)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			Image val = ((Component)Rect(parent, "Icon", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size)).gameObject.AddComponent<Image>();
			val.sprite = sprite;
			val.preserveAspect = true;
			((Graphic)val).raycastTarget = false;
			((Behaviour)val).enabled = (Object)(object)sprite != (Object)null;
			return val;
		}

		internal static float Chip(Transform parent, Vector2 pos, ItemData item, string amount, float size = 28f, float fontSize = 17f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_0107: 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_007f: 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)
			Image val = Icon(parent, pos, new Vector2(size, size), item.GetIcon());
			((Graphic)val).raycastTarget = true;
			UITooltip val2 = ((!((Object)(object)_cell != (Object)null)) ? null : _cell.GetComponent<InventoryElement>()?.m_tooltip);
			if ((Object)(object)val2 != (Object)null)
			{
				UITooltip val3 = ((Component)val).gameObject.AddComponent<UITooltip>();
				val3.m_tooltipPrefab = val2.m_tooltipPrefab;
				val3.Set(item.m_shared.m_name, item.GetTooltip(-1), (RectTransform)null, default(Vector2));
			}
			TMP_Text val4 = Label(parent, amount, new Vector2(pos.x + size + 3f, pos.y - (size - fontSize * 1.3f) / 2f), new Vector2(80f, size), fontSize, Text, null, (TextAlignmentOptions)257);
			val4.enableWordWrapping = false;
			float x = val4.GetPreferredValues(amount, 200f, 0f).x;
			((RectTransform)val4.transform).sizeDelta = new Vector2(x + 2f, size);
			return size + 3f + x + 12f;
		}

		internal static RectTransform Bar(Transform parent, Vector2 pos, Vector2 size, float fraction, Color fill, string text, float fontSize = 15f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_006c: 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_009c: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_0123: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Box(parent, pos, size);
			RectTransform val2 = Rect((Transform)(object)val, "Fill", new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(2f, 2f), new Vector2(0f, 0f));
			val2.anchorMax = new Vector2(0f, 1f);
			val2.offsetMax = new Vector2(2f + (size.x - 4f) * Mathf.Clamp01(fraction), -2f);
			Image val3 = ((Component)val2).gameObject.AddComponent<Image>();
			((Graphic)val3).color = new Color(fill.r * 0.8f, fill.g * 0.8f, fill.b * 0.8f, 0.9f);
			((Graphic)val3).raycastTarget = false;
			if (!string.IsNullOrEmpty(text))
			{
				bool[] array = new bool[2] { true, false };
				foreach (bool flag in array)
				{
					TMP_Text val4 = Label((Transform)(object)val, text, new Vector2(flag ? 1f : 0f, flag ? (-1f) : 0f), size, fontSize, (Color)(flag ? new Color(0f, 0f, 0f, 0.85f) : Color.white), Sans, (TextAlignmentOptions)514);
					val4.enableWordWrapping = false;
				}
			}
			return val;
		}

		internal static InventoryElement Cell(Transform parent, Vector2 pos, ItemData item, string amount, bool selected, Action click)
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00a0: 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_00b9: 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_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(_cell, parent, false);
			((Object)val).name = "Cell";
			val.SetActive(true);
			UIDragHandler[] componentsInChildren = val.GetComponentsInChildren<UIDragHandler>(true);
			foreach (UIDragHandler val2 in componentsInChildren)
			{
				Object.Destroy((Object)(object)val2);
			}
			UIGamePad[] componentsInChildren2 = val.GetComponentsInChildren<UIGamePad>(true);
			foreach (UIGamePad val3 in componentsInChildren2)
			{
				Object.Destroy((Object)(object)val3);
			}
			RectTransform val4 = (RectTransform)val.transform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0f, 1f);
			val4.anchorMax = val5;
			val4.anchorMin = val5;
			val4.pivot = new Vector2(0f, 1f);
			val4.anchoredPosition = pos;
			InventoryElement component = val.GetComponent<InventoryElement>();
			component.Initialize(0, 0);
			Transform val6 = val.transform.Find("binding");
			if ((Object)(object)val6 != (Object)null)
			{
				TMP_Text component2 = ((Component)val6).GetComponent<TMP_Text>();
				if (component2 != null)
				{
					((Behaviour)component2).enabled = false;
				}
			}
			((Behaviour)component.m_icon).enabled = true;
			component.m_icon.sprite = item.GetIcon();
			((Graphic)component.m_icon).color = Color.white;
			bool flag = item.m_shared.m_useDurability && item.m_durability < item.GetMaxDurability();
			((Component)component.m_durability).gameObject.SetActive(flag);
			if (flag)
			{
				component.m_durability.SetValue(item.GetDurabilityPercentage());
			}
			((Behaviour)component.m_equiped).enabled = item.m_equipped;
			((Behaviour)component.m_queued).enabled = false;
			((Behaviour)component.m_noteleport).enabled = false;
			((Behaviour)component.m_food).enabled = false;
			((Behaviour)component.m_quality).enabled = amount == null && item.m_shared.m_maxQuality > 1;
			if (((Behaviour)component.m_quality).enabled)
			{
				component.m_quality.text = item.m_quality.ToString();
			}
			((Behaviour)component.m_amount).enabled = amount != null || item.m_shared.m_maxStackSize > 1;
			component.m_amount.text = amount ?? $"{item.m_stack}/{item.m_shared.m_maxStackSize}";
			if ((Object)(object)component.m_selected != (Object)null)
			{
				component.m_selected.SetActive(selected);
			}
			UITooltip tooltip = component.m_tooltip;
			string name = item.m_shared.m_name;
			string tooltip2 = item.GetTooltip(-1);
			val5 = default(Vector2);
			tooltip.Set(name, tooltip2, (RectTransform)null, val5);
			UIInputHandler componentInChildren = val.GetComponentInChildren<UIInputHandler>(true);
			if ((Object)(object)componentInChildren != (Object)null && click != null)
			{
				componentInChildren.m_onLeftClick = delegate
				{
					click();
				};
			}
			return component;
		}

		internal static RectTransform Scroll(RectTransform box, float inset)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_0116: 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_0140: 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_014c: 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_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Expected O, but got Unknown
			//IL_023d: 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)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Expected O, but got Unknown
			InventoryGui gui = InventoryGui.instance;
			ScrollRect val = (((Object)(object)gui != (Object)null) ? ((IEnumerable<ScrollRect>)((Component)gui).GetComponentsInChildren<ScrollRect>(true)).FirstOrDefault((Func<ScrollRect, bool>)((ScrollRect s) => (Object)(object)s.content == (Object)(object)gui.m_recipeListRoot)) : null);
			Scrollbar val2 = (((Object)(object)gui != (Object)null) ? gui.m_recipeListScroll : null);
			float num;
			if (!((Object)(object)val2 != (Object)null))
			{
				num = 0f;
			}
			else
			{
				Rect rect = ((RectTransform)((Component)val2).transform).rect;
				num = Mathf.Max(8f, ((Rect)(ref rect)).width);
			}
			float num2 = num;
			RectTransform val3 = Rect((Transform)(object)box, "View", new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(inset, 0f - inset), box.sizeDelta - new Vector2(inset * 2f + ((num2 > 0f) ? (num2 + 4f) : 0f), inset * 2f));
			((Component)val3).gameObject.AddComponent<RectMask2D>();
			Image val4 = ((Component)val3).gameObject.AddComponent<Image>();
			((Graphic)val4).color = Color.clear;
			RectTransform val5 = Rect((Transform)(object)val3, "Content", new Vector2(0f, 1f), new Vector2(0f, 1f), Vector2.zero, new Vector2(val3.sizeDelta.x, 0f));
			ScrollRect val6 = ((Component)val3).gameObject.AddComponent<ScrollRect>();
			val6.content = val5;
			val6.viewport = val3;
			val6.horizontal = false;
			val6.movementType = (MovementType)2;
			val6.scrollSensitivity = (((Object)(object)val != (Object)null && val.scrollSensitivity > 0f) ? val.scrollSensitivity : 300f);
			val6.inertia = false;
			if ((Object)(object)val2 != (Object)null)
			{
				GameObject val7 = Object.Instantiate<GameObject>(((Component)val2).gameObject, (Transform)(object)box, false);
				((Object)val7).name = "Scrollbar";
				val7.SetActive(true);
				UIGamePad[] componentsInChildren = val7.GetComponentsInChildren<UIGamePad>(true);
				foreach (UIGamePad val8 in componentsInChildren)
				{
					Object.Destroy((Object)(object)val8);
				}
				RectTransform val9 = (RectTransform)val7.transform;
				val9.anchorMin = new Vector2(1f, 0f);
				val9.anchorMax = new Vector2(1f, 1f);
				val9.pivot = new Vector2(1f, 0.5f);
				val9.sizeDelta = new Vector2(num2, (0f - inset) * 2f);
				val9.anchoredPosition = new Vector2((0f - inset) * 0.5f, 0f);
				Scrollbar component = val7.GetComponent<Scrollbar>();
				component.onValueChanged = new ScrollEvent();
				val6.verticalScrollbar = component;
				val6.verticalScrollbarVisibility = (ScrollbarVisibility)1;
			}
			return val5;
		}

		internal static RectTransform At(Transform parent, string name, float x, float y, float w, float h)
		{
			//IL_000c: 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_0023: 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)
			return Rect(parent, name, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, 0f - y), new Vector2(w, h));
		}

		internal static RectTransform Stretch(Transform parent, string name, float left = 0f, float bottom = 0f, float right = 0f, float top = 0f)
		{
			//IL_0002: 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_0016: 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_0027: 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_0041: 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)
			RectTransform val = Rect(parent, name, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.offsetMin = new Vector2(0f - left, 0f - bottom);
			val.offsetMax = new Vector2(right, top);
			return val;
		}

		internal static Image Plain(RectTransform r, Color color)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Image val = ((Component)r).gameObject.AddComponent<Image>();
			((Graphic)val).color = color;
			((Graphic)val).raycastTarget = false;
			return val;
		}

		internal static RawImage Picture(Transform parent, Vector2 pos, Vector2 size)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			RawImage val = ((Component)Rect(parent, "Picture", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size)).gameObject.AddComponent<RawImage>();
			((Graphic)val).raycastTarget = false;
			((Behaviour)val).enabled = false;
			return val;
		}

		internal static void Show(RawImage img, Texture texture, Color tint)
		{
			//IL_000b: 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_0019: 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_0069: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)img == (Object)null)
			{
				return;
			}
			if (((Graphic)img).color != tint)
			{
				((Graphic)img).color = tint;
			}
			if (!((Object)(object)img.texture == (Object)(object)texture))
			{
				img.texture = texture;
				((Behaviour)img).enabled = (Object)(object)texture != (Object)null;
				if (!((Object)(object)texture == (Object)null) && texture.width > 0 && texture.height > 0)
				{
					Rect rect = ((Graphic)img).rectTransform.rect;
					Vector2 size = ((Rect)(ref rect)).size;
					float num = (float)texture.width / (float)texture.height;
					float num2 = ((size.y > 0f) ? (size.x / size.y) : 1f);
					img.uvRect = ((num > num2) ? new Rect(0.5f - num2 / num / 2f, 0f, num2 / num, 1f) : new Rect(0f, 0.5f - num / num2 / 2f, 1f, num / num2));
				}
			}
		}

		internal static void SetText(TMP_Text label, string text)
		{
			if ((Object)(object)label != (Object)null && label.text != text)
			{
				label.text = text;
			}
		}

		internal static Sprite ArrowSprite()
		{
			Minimap instance = Minimap.instance;
			Image val = (((Object)(object)instance != (Object)null && (Object)(object)instance.m_smallMarker != (Object)null) ? ((Component)instance.m_smallMarker).GetComponentInChildren<Image>(true) : null);
			if (!((Object)(object)val != (Object)null))
			{
				return null;
			}
			return val.sprite;
		}

		internal static Edge Frame(Transform parent, float width, float outset, Color color)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0072: 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_0087: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			Edge edge = new Edge();
			edge.Sides = (Image[])(object)new Image[4]
			{
				Plain(Side("EdgeTop", new Vector2(0f, 1f), Vector2.one, new Vector2(0f - outset, outset - width), new Vector2(outset, outset)), color),
				Plain(Side("EdgeBottom", Vector2.zero, new Vector2(1f, 0f), new Vector2(0f - outset, 0f - outset), new Vector2(outset, width - outset)), color),
				Plain(Side("EdgeLeft", Vector2.zero, new Vector2(0f, 1f), new Vector2(0f - outset, width - outset), new Vector2(width - outset, outset - width)), color),
				Plain(Side("EdgeRight", new Vector2(1f, 0f), Vector2.one, new Vector2(outset - width, width - outset), new Vector2(outset, outset - width)), color)
			};
			edge.SetColor(color, force: true);
			return edge;
			RectTransform Side(string name, Vector2 min, Vector2 max, Vector2 offMin, Vector2 offMax)
			{
				//IL_0008: 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_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_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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)
				RectTransform val = Rect(parent, name, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
				val.anchorMin = min;
				val.anchorMax = max;
				val.offsetMin = offMin;
				val.offsetMax = offMax;
				return val;
			}
		}

		internal static Meter LiveBar(Transform parent, Vector2 pos, Vector2 size, Color fill, bool trail = false, float fontSize = 0f)
		{
			//IL_0006: 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_0066: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_009f: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: 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_017a: 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_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			Meter meter = new Meter();
			bool flag = size.y >= 10f && (Object)(object)_sunken != (Object)null;
			if (flag)
			{
				meter.Groove = Box(parent, pos, size);
				((Graphic)((Component)meter.Groove).GetComponent<Image>()).raycastTarget = false;
			}
			else
			{
				meter.Groove = Rect(parent, "Groove", new Vector2(0f, 1f), new Vector2(0f, 1f), pos, size);
				Plain(meter.Groove, new Color(0f, 0f, 0f, 0.6f));
			}
			float num = (flag ? 2f : ((size.y >= 4f) ? 1f : 0f));
			RectTransform inner = Stretch((Transform)(object)meter.Groove, "Inner", 0f - num, 0f - num, 0f - num, 0f - num);
			if (trail)
			{
				meter.Trail = Fill("Trail", new Color(1f, 0.92f, 0.85f, 0.55f));
			}
			meter.Fill = Fill("Fill", fill);
			if (fontSize > 0f)
			{
				bool[] array = new bool[2] { true, false };
				foreach (bool flag2 in array)
				{
					TMP_Text val = Label((Transform)(object)meter.Groove, "", Vector2.zero, size, fontSize, (Color)(flag2 ? new Color(0f, 0f, 0f, 0.85f) : Color.white), Sans, (TextAlignmentOptions)514);
					RectTransform val2 = (RectTransform)val.transform;
					val2.anchorMin = Vector2.zero;
					val2.anchorMax = Vector2.one;
					val2.offsetMin = (Vector2)(flag2 ? new Vector2(1f, -1f) : Vector2.zero);
					val2.offsetMax = (Vector2)(flag2 ? new Vector2(1f, -1f) : Vector2.zero);
					val.textWrappingMode = (TextWrappingModes)0;
					val.overflowMode = (TextOverflowModes)0;
					if (flag2)
					{
						meter.Shadow = val;
					}
					else
					{
						meter.Text = val;
					}
				}
			}
			meter.Set(0f, 0f, force: true);
			return meter;
			Image Fill(string name, Color color)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//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_0016: 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_0037: 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_0049: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				RectTransform val3 = Rect((Transform)(object)inner, name, Vector2.zero, Vector2.zero, Vector2.zero, Vector2.zero);
				val3.anchorMin = Vector2.zero;
				val3.anchorMax = new Vector2(0f, 1f);
				Vector2 offsetMin = (val3.offsetMax = Vector2.zero);
				val3.offsetMin = offsetMin;
				return Plain(val3, color);
			}
		}
	}
	[BepInPlugin("com.quad.partyhud", "PartyHud", "1.10.2")]
	public class Plugin : BaseUnityPlugin
	{
		private class Effect
		{
			public Sprite Icon;

			public float Fraction;
		}

		private class FoodSlot
		{
			public Sprite Icon;

			public float Fraction;
		}

		private class Member
		{
			public long Id;

			public ulong SteamId;

			public string Name;

			public bool Self;

			public bool HasData;

			public float Hp;

			public float MaxHp;

			public float St;

			public float MaxSt;

			public float Eitr;

			public float MaxEitr;

			public float Distance = -1f;

			public Vector3 Pos;

			public bool HasPos;

			public List<Effect> Effects = new List<Effect>();

			public List<FoodSlot> Foods = new List<FoodSlot>();

			public bool FoodKnown;

			public bool Companion;

			public string Status;
		}

		private class Anim
		{
			public float Health;

			public float Trail;

			public float Stamina;

			public float Eitr;

			public float Alpha;

			public float LastTime;
		}

		private class Slot
		{
			public Image Back;

			public Image Icon;

			public GameUi.Meter Time;
		}

		private class Row
		{
			public bool Companion;

			public bool Compact;

			public RectTransform Rect;

			public CanvasGroup Group;

			public float Height;

			public GameUi.Edge Edge;

			public GameUi.Edge Ring;

			public Image PictureBack;

			public RawImage Picture;

			public TMP_Text Initial;

			public TMP_Text Name;

			public TMP_Text Distance;

			public TMP_Text Status;

			public RectTransform Arrow;

			public Graphic ArrowImage;

			public GameUi.Meter Health;

			public GameUi.Meter Stamina;

			public GameUi.Meter Eitr;

			public readonly List<Slot> Foods = new List<Slot>();

			public readonly List<Slot> Effects = new List<Slot>();
		}

		private class Remote
		{
			public string Name;

			public float Hp;

			public float MaxHp;

			public float St;

			public float MaxSt;

			public float Eitr;

			public float MaxEitr;

			public float Seen = -999f;

			public List<KeyValuePair<int, float>> Effects = new List<KeyValuePair<int, float>>();

			public float EffectsAt;

			public bool FoodsKnown;

			public List<RawFood> Foods = new List<RawFood>();
		}

		private struct RawFood
		{
			public string Prefab;

			public float Time;

			public float Burn;
		}

		public const string Guid = "com.quad.partyhud";

		public const string OldGuid = "com.dhack.partyhud";

		public const string Name = "PartyHud";

		public const string Version = "1.10.2";

		internal static ServerSettings Synced;

		private ConfigEntry<bool> _shareMine;

		private ConfigEntry<bool> _allowSharing;

		private ConfigEntry<bool> _enabled;

		private ConfigEntry<bool> _showSelf;

		private ConfigEntry<bool> _showPortraits;

		private ConfigEntry<bool> _showDistance;

		private ConfigEntry<bool> _hideInMenus;

		private ConfigEntry<bool> _avoidShipHud;

		private ConfigEntry<bool> _compact;

		private ConfigEntry<bool> _onLeft;

		private ConfigEntry<bool> _showArrow;

		private ConfigEntry<bool> _showEffects;

		private ConfigEntry<bool> _showFood;

		private ConfigEntry<bool> _showCompanions;

		private ConfigEntry<float> _offsetX;

		private ConfigEntry<float> _offsetY;

		private ConfigEntry<float> _scale;

		private ConfigEntry<float> _opacity;

		private ConfigEntry<int> _maxRows;

		private ConfigEntry<KeyboardShortcut> _toggleKey;

		private bool _visible = true;

		private List<Member> _members = new List<Member>();

		private float _nextMembers;

		private int _awakeFrame;

		private const string PanelName = "PartyHudPanel";

		private const float PanelWidth = 252f;

		private static readonly Color HealthColor = new Color(0.84f, 0.22f, 0.22f);

		private static readonly Color StaminaColor = new Color(0.96f, 0.8f, 0.26f);

		private static readonly Color EitrColor = new Color(0.66f, 0.46f, 0.96f);

		private static readonly Color CompanionColor = new Color(0.36f, 0.62f, 0.56f);

		private static readonly Color Grey = new Color(0.3f, 0.3f, 0.3f);

		private static readonly Color Clear = new Color(0f, 0f, 0f, 0f);

		private readonly Dictionary<long, Anim> _anim = new Dictionary<long, Anim>();

		private RectTransform _panel;

		private TMP_Text _header;

		private readonly List<Row> _rows = new List<Row>();

		private string _built = "";

		private bool _membersChanged;

		private float _nextShipCheck;

		private float _retryAt;

		private bool _loggedFailure;

		private const string RpcStats = "DHack_PartyStats";

		private readonly Dictionary<long, Remote> _remote = new Dictionary<long, Remote>();

		private ZRoutedRpc _registeredOn;

		private float _nextSend;

		private string _lastGist;

		private float _lastSentAt;

		private const float SendCheck = 1f;

		private const float SendKeepalive = 2f;

		private const float RemoteFresh = 6f;

		private static long MyId => ZDOMan.GetSessionID();

		private void Awake()
		{
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			Migration.FromOldGuid((BaseUnityPlugin)(object)this, "com.dhack.partyhud");
			Translations.Load((BaseUnityPlugin)(object)this);
			_enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Show the party panel.");
			_showSelf = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowSelf", true, "Include yourself in the panel.");
			_showPortraits = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowPortraits", true, "Show each player's Steam profile picture. Off (or no picture available) = a coloured initial.");
			_showDistance = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowDistance", true, "Show how far away each player is.");
			_hideInMenus = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "HideInMenus", true, "Hide the panel while the inventory, crafting window, build menu, trader or big map is open, so it doesn't overlap them.");
			_maxRows = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayers", 8, "Most players to show (you first, then the rest alphabetically).");
			_toggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "ToggleKey", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Press to hide or show the panel (handy for screenshots).");
			_offsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "OffsetX", 10f, "Gap from the right edge of the screen (UI pixels).");
			_offsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "OffsetY", 300f, "Gap from the top of the screen (UI pixels). Raise it if it overlaps your minimap.");
			_scale = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Scale", 1f, "Size of the panel (1 = normal, 1.25 = bigger).");
			_avoidShipHud = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "AvoidShipHud", true, "While you are steering a ship, move the panel down so it does not cover the wind indicator and the rest of the ship display.");
			_compact = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "Compact", false, "A smaller, tighter panel: a small picture and thinner bars, for when you want it out of the way.");
			_onLeft = ((BaseUnityPlugin)this).Config.Bind<bool>("Layout", "OnLeft", false, "Put the panel on the left edge of the screen instead of the right.");
			_showArrow = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowDirectionArrow", true, "Next to each player's distance, an arrow pointing the way they are, relative to where you are looking.");
			_showFood = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowFood", true, "Show three food slots under each player's picture: what they are eating and how long it has left. Only for players who also have this mod.");
			_showEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowStatusEffects", true, "Show each player's buffs and debuffs (food, rested, wet, poison...) as small icons under their bars. Only for players who also have this mod.");
			_showCompanions = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowCompanions", true, "With the AICompanion mod: show each player's companion under them (health, distance, what it is doing).");
			_opacity = ((BaseUnityPlugin)this).Config.Bind<float>("Layout", "Opacity", 0.85f, "How solid the panel background is (0.2 to 1).");
			Synced = new ServerSettings("com.quad.partyhud", ((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
			_shareMine = ((BaseUnityPlugin)this).Config.Bind<bool>("Sharing", "ShareMyStats", true, "Send your health, stamina, Eitr, food and buffs to the other players who have this mod (a few times a second, at any distance). Off: they only see what the game itself shows of you when you are near.");
			_allowSharing = Synced.Add<bool>(((BaseUnityPlugin)this).Config.Bind<bool>("Sharing", "AllowSharing", true, "Players with this mod share their exact health, stamina, Eitr, food and buffs with each other at any distance. A PvP server may want this off (each player then sees only what the game shows of players near them). In multiplayer the server's value applies."));
			_awakeFrame = Time.frameCount;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"PartyHud 1.10.2 loaded");
			if ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)Chat.instance != (Object)null)
			{
				((Terminal)Chat.instance).AddString("[Mod]", "PartyHud v1.10.2 reloaded", (Type)1, false);
			}
		}

		private void OnDestroy()
		{
			UnregisterRpc();
			_remote.Clear();
			Synced?.Dispose();
			DestroyDrawResources();
			SteamAvatars.Clear();
			Translations.Unload();
		}

		private void Update()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0041: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			Synced?.Update();
			if (!_enabled.Value)
			{
				return;
			}
			KeyboardShortcut value = _toggleKey.Value;
			if ((int)((KeyboardShortcut)(ref value)).MainKey != 0)
			{
				value = _toggleKey.Value;
				if (Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey))
				{
					value = _toggleKey.Value;
					if (((KeyboardShortcut)(ref value)).Modifiers.All((Func<KeyCode, bool>)Input.GetKey))
					{
						_visible = !_visible;
					}
				}
			}
			UpdateNetwork();
			if (!((Object)(object)Player.m_localPlayer == (Object)null) && !((Object)(object)ZNet.instance == (Object)null) && Time.time >= _nextMembers)
			{
				_nextMembers = Time.time + 0.2f;
				BuildMembers();
				_membersChanged = true;
			}
		}

		private void LateUpdate()
		{
			UpdatePanel();
		}

		private unsafe static ulong SteamIdOf(PlayerInfo info)
		{
			//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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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_0016: 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)
			try
			{
				PlatformUserID id = info.m_userInfo.m_id;
				if (((PlatformUserID)(ref id)).IsValid)
				{
					Platform platform = id.m_platform;
					ulong result = default(ulong);
					if (string.Equals(((object)(*(Platform*)(&platform))/*cast due to .constrained prefix*/).ToString(), "Steam", StringComparison.OrdinalIgnoreCase) && ((PlatformUserID)(ref id)).TryParseAsUInt64(ref result))
					{
						return result;
					}
				}
			}
			catch (Exception)
			{
			}
			return 0uL;
		}

		private void BuildMembers()
		{
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: 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_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			List<Member> list = new List<Member>();
			if (_showSelf.Value)
			{
				list.Add(new Member
				{
					Id = MyId,
					Name = localPlayer.GetPlayerName(),
					Self = true,
					HasData = true,
					SteamId = SteamAvatars.Own(),
					Hp = ((Character)localPlayer).GetHealth(),
					MaxHp = ((Character)localPlayer).GetMaxHealth(),
					St = localPlayer.GetStamina(),
					MaxSt = ((Character)localPlayer).GetMaxStamina(),
					Eitr = localPlayer.GetEitr(),
					MaxEitr = ((Character)localPlayer).GetMaxEitr(),
					Effects = ToEffects(ParseEffects(EffectsText(localPlayer)), 0f),
					Foods = ToFoods(ParseFoods(FoodsText(localPlayer)), 0f),
					FoodKnown = true
				});
			}
			List<Player> allPlayers = Player.GetAllPlayers();
			List<Member> others = new List<Member>();
			foreach (PlayerInfo player in ZNet.instance.GetPlayerList())
			{
				ZDOID characterID = player.m_characterID;
				long id = ((ZDOID)(ref characterID)).UserID;
				if (id == 0L || id == MyId)
				{
					continue;
				}
				Member member = new Member
				{
					Id = id,
					Name = player.m_name,
					SteamId = SteamIdOf(player)
				};
				if (player.m_publicPosition)
				{
					member.Distance = Vector3.Distance(((Component)localPlayer).transform.position, player.m_position);
					member.Pos = player.m_position;
					member.HasPos = true;
				}
				if (_allowSharing.Value && _remote.TryGetValue(id, out var value) && Time.time - value.Seen < 6f)
				{
					member.HasData = true;
					member.Hp = value.Hp;
					member.MaxHp = value.MaxHp;
					member.St = value.St;
					member.MaxSt = value.MaxSt;
					member.Eitr = value.Eitr;
					member.MaxEitr = value.MaxEitr;
					member.Effects = ToEffects(value.Effects, Time.time - value.EffectsAt);
					member.Foods = ToFoods(value.Foods, Time.time - value.EffectsAt);
					member.FoodKnown = value.FoodsKnown;
				}
				else
				{
					Player val = ((IEnumerable<Player>)allPlayers).FirstOrDefault((Func<Player, bool>)delegate(Player p)
					{
						//IL_000a: Unknown result type (might be due to invalid IL or missing references)
						//IL_000f: Unknown result type (might be due to invalid IL or missing references)
						if ((Object)(object)p != (Object)null)
						{
							ZDOID zDOID = ((Character)p).GetZDOID();
							return ((ZDOID)(ref zDOID)).UserID == id;
						}
						return false;
					});
					ZDO val2 = (((Object)(object)val != (Object)null && ZDOMan.instance != null) ? ZDOMan.instance.GetZDO(((Character)val).GetZDOID()) : null);
					if ((Object)(object)val != (Object)null && val2 != null)
					{
						member.HasData = true;
						member.Hp = ((Character)val).GetHealth();
						member.MaxHp = ((Character)val).GetMaxHealth();
						member.St = val2.GetFloat(ZDOVars.s_stamina, 0f);
						member.MaxSt = Mathf.Max(member.St, 100f);
						member.Distance = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)val).transform.position);
						member.Pos = ((Component)val).transform.position;
						member.HasPos = true;
					}
				}
				others.Add(member);
			}
			list.AddRange(others.OrderBy<Member, string>((Member o) => o.Name, StringComparer.OrdinalIgnoreCase));
			_members = list.Take(Mathf.Max(1, _maxRows.Value)).ToList();
			if (_showCompanions.Value)
			{
				AddCompanions(localPlayer);
			}
			foreach (long item in (from kv in _remote
				where Time.time - kv.Value.Seen > 60f && others.All((Member o) => o.Id != kv.Key)
				select kv.Key).ToList())
			{
				_remote.Remove(item);
			}
		}

		private void AddCompanions(Player me)
		{
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			if (!(AppDomain.CurrentDomain.GetData("DHack.Companions") is Func<string> func))
			{
				return;
			}
			string text;
			try
			{
				text = func();
			}
			catch (Exception)
			{
				return;
			}
			if (string.IsNullOrEmpty(text))
			{
				return;
			}
			string[] array = text.Split(new char[1] { '\n' });
			Vector3 val = default(Vector3);
			foreach (string text2 in array)
			{
				string[] f = text2.Split(new char[1] { '|' });
				if (f.Length < 9 || !long.TryParse(f[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
				{
					continue;
				}
				int num = _members.FindIndex((Member x) => !x.Companion && x.Name == f[2]);
				if (num >= 0)
				{
					int num2;
					for (num2 = num + 1; num2 < _members.Count && _members[num2].Companion; num2++)
					{
					}
					((Vector3)(ref val))..ctor(ParseFloat(f[5]), ParseFloat(f[6]), ParseFloat(f[7]));
					_members.Insert(num2, new Member
					{
						Id = result,
						Name = f[1],
						Companion = true,
						HasData = true,
						Status = f[8],
						Hp = ParseFloat(f[3]),
						MaxHp = ParseFloat(f[4]),
						St = ((f.Length > 10) ? ParseFloat(f[9]) : 0f),
						MaxSt = ((f.Length > 10) ? ParseFloat(f[10]) : 0f),
						Effects = ((f.Length > 11) ? ToEffects(ParseEffects(f[11]), 0f) : new List<Effect>()),
						FoodKnown = (f.Length > 12 && f[12] != "-"),
						Foods = ((f.Length > 12 && f[12] != "-") ? ToFoods(ParseFoods(f[12]), 0f) : new List<FoodSlot>()),
						Pos = val,
						HasPos = true,
						Distance = Vector3.Distance(((Component)me).transform.position, val)
					});
				}
			}
		}

		private static float ParseFloat(string s)
		{
			if (!float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
			{
				return 0f;
			}
			return result;
		}

		private void UpdatePanel()
		{
			if (Time.unscaledTime < _retryAt)
			{
				return;
			}
			try
			{
				Tick();
			}
			catch (Exception ex)
			{
				if (!_loggedFailure)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)("The party panel failed and is hidden for now: " + ex));
				}
				_loggedFailure = true;
				_retryAt = Time.unscaledTime + 5f;
				DestroyPanel();
			}
		}

		private void Tick()
		{
			if (!_enabled.Value || !_visible || !((Object)(object)Player.m_localPlayer != (Object)null) || _members.Count <= 0 || !((Object)(object)GameUi.HudRoot != (Object)null) || Menu.IsVisible() || (_hideInMenus.Value && ScreenCoversPanel()))
			{
				if ((Object)(object)_panel != (Object)null && ((Component)_panel).gameObject.activeSelf)
				{
					((Component)_panel).gameObject.SetActive(false);
				}
				return;
			}
			if ((Object)(object)_panel == (Object)null || _membersChanged || _rows.Count != _members.Count)
			{
				if (!GameUi.Ready())
				{
					return;
				}
				string text = Signature();
				if ((Object)(object)_panel == (Object)null || text != _built || _rows.Count != _members.Count)
				{
					Build(text);
				}
				_membersChanged = false;
				Refresh();
			}
			if (!((Component)_panel).gameObject.activeSelf)
			{
				((Component)_panel).gameObject.SetActive(true);
			}
			if (Time.unscaledTime >= _nextShipCheck)
			{
				_nextShipCheck = Time.unscaledTime + 0.25f;
				Place();
			}
			for (int i = 0; i < _rows.Count; i++)
			{
				Animate(_rows[i], _members[i]);
			}
		}

		private string Signature()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append(_compact.Value).Append(_showDistance.Value).Append(_showArrow.Value)
				.Append(_showEffects.Value)
				.Append(_showFood.Value)
				.Append(_onLeft.Value)
				.Append(',')
				.Append(_scale.Value)
				.Append(',')
				.Append(_opacity.Value)
				.Append(',')
				.Append(_offsetX.Value)
				.Append(',')
				.Append(_offsetY.Value);
			foreach (Member member in _members)
			{
				stringBuilder.Append('|').Append(member.Id).Append(member.Companion ? 'c' : 'p')
					.Append(member.Self ? 's' : '-')
					.Append(member.HasData ? 'd' : '-');
				if (member.Companion)
				{
					stringBuilder.Append(CompanionEffects(member)).Append(CompanionFood(member) ? 'f' : '-').Append((member.MaxSt > 0f) ? 'm' : '-');
				}
				else
				{
					stringBuilder.Append(PlayerEffects(member)).Append(PlayerFood(member) ? 'f' : '-').Append(ShowsEitr(member) ? 'e' : '-');
				}
			}
			return stringBuilder.ToString();
		}

		private bool ShowsEitr(Member m)
		{
			if (m.HasData)
			{
				return m.MaxEitr > 1f;
			}
			return false;
		}

		private bool PlayerFood(Member m)
		{
			if (_showFood.Value && m.HasData)
			{
				return m.FoodKnown;
			}
			return false;
		}

		private int PlayerEffects(Member m)
		{
			if (!_showEffects.Value)
			{
				return 0;
			}
			return Mathf.Min(m.Effects.Count, 12);
		}

		private bool CompanionFood(Member m)
		{
			if (_showFood.Value && m.FoodKnown)
			{
				return !_compact.Value;
			}
			return false;
		}

		private int CompanionEffects(Member m)
		{
			if (!_showEffects.Value)
			{
				return 0;
			}
			return Mathf.Min(m.Effects.Count, 6);
		}

		private void DestroyPanel()
		{
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)_panel).gameObject);
			}
			_panel = null;
			_header = null;
			_rows.Clear();
			_built = "";
		}

		private void DestroyDrawResources()
		{
			DestroyPanel();
			Transform hudRoot = GameUi.HudRoot;
			if ((Object)(object)hudRoot != (Object)null)
			{
				foreach (Transform item in (from Transform t in (IEnumerable)hudRoot
					where ((Object)t).name == "PartyHudPanel"
					select t).ToList())
				{
					Object.Destroy((Object)(object)((Component)item).gameObject);
				}
			}
			GameUi.Destroy();
			_anim.Clear();
		}

		private void Build(string signature)
		{
			//IL_009e: 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_00a0: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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_016f: 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)
			DestroyPanel();
			Transform hudRoot = GameUi.HudRoot;
			foreach (Transform item in (from Transform t in (IEnumerable)hudRoot
				where ((Object)t).name == "PartyHudPanel"
				select t).ToList())
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(_onLeft.Value ? 0f : 1f, 1f);
			_panel = GameUi.Rect(hudRoot, "PartyHudPanel", val, val, Vector2.zero, new Vector2(252f, 0f));
			((Transform)_panel).localScale = Vector3.one * Mathf.Clamp(_scale.Value, 0.5f, 2f);
			((Component)_panel).gameObject.AddComponent<Canvas>();
			CanvasGroup val2 = ((Component)_panel).gameObject.AddComponent<CanvasGroup>();
			val2.blocksRaycasts = false;
			val2.interactable = false;
			_header = GameUi.Label((Transform)(object)_panel, "", new Vector2(2f, 0f), new Vector2(252f, 16f), 12f, new Color(GameUi.Warm.r, GameUi.Warm.g, GameUi.Warm.b, 0.8f), null, (TextAlignmentOptions)513);
			_header.textWrappingMode = (TextWrappingModes)0;
			float num = 18f;
			foreach (Member member in _members)
			{
				Row row = (member.Companion ? BuildCompanion(member, num) : BuildPlayer(member, num));
				_rows.Add(row);
				num += row.Height + (member.Companion ? 5f : 7f);
			}
			_panel.sizeDelta = new Vector2(252f, num);
			_built = signature;
			foreach (long item2 in _anim.Keys.Where((long id) => _members.All((Member m) => m.Id != id)).ToList())
			{
				_anim.Remove(item2);
			}
			_nextShipCheck = 0f;
			Place();
		}

		private Row NewRow(string name, float y, float indent, float height, bool companion)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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)
			Row row = new Row
			{
				Companion = companion,
				Compact = _compact.Value,
				Height = height
			};
			row.Rect = GameUi.At((Transform)(object)_panel, name, 0f, y, 252f, height);
			row.Group = ((Component)row.Rect).gameObject.AddComponent<CanvasGroup>();
			row.Group.alpha = 0f;
			RectTransform r = GameUi.At((Transform)(object)row.Rect, "Backing", indent + 2f, 2f, 252f - indent - 4f, height - 4f);
			Color val = (companion ? new Color(0.05f, 0.06f, 0.055f) : new Color(0.06f, 0.05f, 0.045f));
			GameUi.Plain(r, new Color(val.r, val.g, val.b, Mathf.Clamp(_opacity.Value, 0.2f, 1f)));
			RectTransform val2 = GameUi.Box((Transform)(object)row.Rect, new Vector2(indent, 0f), new Vector2(252f - indent, height));
			((Graphic)((Component)val2).GetComponent<Image>()).raycastTarget = false;
			row.Edge = GameUi.Frame((Transform)(object)val2, 1.5f, 0f, Clear);
			return row;
		}

		private void BuildPicture(Row row, Member m, float x, float y, float size, float initialSize, bool ring)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = GameUi.At((Transform)(object)row.Rect, "Portrait", x, y, size, size);
			row.PictureBack = GameUi.Plain(val, Grey);
			row.Initial = GameUi.Label((Transform)(object)val, string.IsNullOrEmpty(m.Name) ? "?" : m.Name.Substring(0, 1).ToUpperInvariant(), Vector2.zero, new Vector2(size, size), initialSize, Color.white, null, (TextAlignmentOptions)514);
			row.Initial.textWrappingMode = (TextWrappingModes)0;
			row.Picture = GameUi.Picture((Transform)(object)val, Vector2.zero, new Vector2(size, size));
			if (ring)
			{
				row.Ring = GameUi.Frame((Transform)(object)val, 2f, 1.5f, Clear);
			}
		}

		private TMP_Text NameLabel(Row row, float x, float y, float w, float h, float size, Color color, TextAlignmentOptions align)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0035: 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_005d: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Max(h, size * 1.8f);
			TextAlignmentOptions align2 = (TextAlignmentOptions)(((int)align == 516) ? 260 : (((int)align == 514) ? 258 : 257));
			TMP_Text val = GameUi.Label((Transform)(object)row.Rect, "", new Vector2(x, 0f - y + (num - h) * 0.5f - 1f), new Vector2(w, num), size, color, null, align2);
			val.textWrappingMode = (TextWrappingModes)0;
			val.overflowMode = (TextOverflowModes)1;
			return val;
		}

		private void BuildArrow(Row row, float x, float y, float w, float h, Color color)
		{
			//IL_001c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			Sprite val = GameUi.ArrowSprite();
			row.Arrow = GameUi.Rect((Transform)(object)row.Rect, "Arrow", new Vector2(0f, 1f), new Vector2(0.5f, 0.5f), new Vector2(x + w / 2f, 0f - y - h / 2f), new Vector2(w, h));
			if ((Object)(object)val != (Object)null)
			{
				Image val2 = ((Component)row.Arrow).gameObject.AddComponent<Image>();
				val2.sprite = val;
				val2.preserveAspect = true;
				row.ArrowImage = (Graphic)(object)val2;
			}
			else
			{
				TMP_Text val3 = GameUi.Label((Transform)(object)row.Arrow, "^", Vector2.zero, new Vector2(w, h), h * 1.2f, color, null, (TextAlignmentOptions)514);
				val3.textWrappingMode = (TextWrappingModes)0;
				row.ArrowImage = (Graphic)(object)val3;
			}
			row.ArrowImage.color = color;
			row.ArrowImage.raycastTarget = false;
			((Behaviour)row.ArrowImage).enabled = false;
		}

		private Slot BuildSlot(Row row, float x, float y, float size, bool back, float lineHeight)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			Slot slot = new Slot();
			RectTransform val = GameUi.At((Transform)(object)row.Rect, "Slot", x, y, size, size);
			if (back)
			{
				slot.Back = GameUi.Plain(val, new Color(0f, 0f, 0f, 0.55f));
			}
			RectTransform val2 = (back ? GameUi.Stretch((Transform)(object)val, "Icon", -0.5f, -0.5f, -0.5f, -0.5f) : GameUi.Stretch((Transform)(object)val, "Icon"));
			slot.Icon = ((Component)val2).gameObject.AddComponent<Image>();
			slot.Icon.preserveAspect = true;
			((Graphic)slot.Icon).raycastTarget = false;
			((Behaviour)slot.Icon).enabled = false;
			slot.Time = GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(x, 0f - (y + size + 1f)), new Vector2(size, lineHeight), GameUi.Good);
			slot.Time.SetActive(on: false);
			return slot;
		}

		private Row BuildPlayer(Member m, float y)
		{
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: 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_02cb: 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_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: 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)
			bool value = _compact.Value;
			bool flag = ShowsEitr(m);
			bool flag2 = PlayerFood(m);
			int num = PlayerEffects(m);
			float num2 = ((!(num > 0 || flag2)) ? 0f : ((!value) ? 21f : ((num > 0) ? 15f : 12f)));
			float num3 = ((num <= 0) ? 0f : (value ? 15f : num2));
			float num4 = (value ? (38f + (flag ? 5f : 0f)) : (62f + (flag ? 12f : 0f))) + num2;
			Row row = NewRow("Player", y, 0f, num4, companion: false);
			float num5 = (value ? 28f : 48f);
			float num6 = (value ? 5f : 7f);
			BuildPicture(row, m, num6, num6, num5, value ? 15f : 26f, ring: true);
			float num7 = (value ? 40f : 63f);
			float num8 = 252f - num7 - 9f;
			float y2 = (value ? 2f : 3f);
			float h = (value ? 15f : 18f);
			row.Name = NameLabel(row, num7, y2, num8 - 62f, h, value ? 13f : 16f, m.Self ? GameUi.Gold : GameUi.Text, (TextAlignmentOptions)513);
			if (_showDistance.Value && !m.Self)
			{
				row.Distance = NameLabel(row, num7, y2, num8, h, value ? 11f : 13f, GameUi.Dim, (TextAlignmentOptions)516);
				if (_showArrow.Value)
				{
					BuildArrow(row, num7 + num8 - 54f, value ? 3f : 4f, 14f, value ? 13f : 16f, new Color(0.95f, 0.85f, 0.55f));
				}
			}
			row.Health = (value ? GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num7, -18f), new Vector2(num8, 12f), HealthColor, trail: true, 10f) : GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num7, -24f), new Vector2(num8, 18f), HealthColor, trail: true, 13f));
			row.Stamina = (value ? GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num7, -32f), new Vector2(num8, 5f), StaminaColor) : GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num7, -45f), new Vector2(num8, 12f), StaminaColor));
			if (flag)
			{
				row.Eitr = (value ? GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num7, -39f), new Vector2(num8, 4f), EitrColor) : GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num7, -60f), new Vector2(num8, 8f), EitrColor));
			}
			if (flag2)
			{
				float num9 = (value ? 9f : 14f);
				float num10 = (value ? 1.5f : 3f);
				float y3 = num6 + num5 + (value ? 3f : 4f);
				for (int i = 0; i < 3; i++)
				{
					row.Foods.Add(BuildSlot(row, num6 + (float)i * (num9 + num10), y3, num9, back: true, 2f));
				}
			}
			if (num > 0)
			{
				float num11 = (value ? 12f : 17f);
				float y4 = num4 - num3 + (value ? 0f : 1f);
				for (int j = 0; j < num; j++)
				{
					float num12 = ((value && !flag2) ? 7f : num7) + (float)j * (num11 + 3f);
					if (num12 + num11 > 248f)
					{
						break;
					}
					row.Effects.Add(BuildSlot(row, num12, y4, num11, back: false, 2f));
				}
			}
			return row;
		}

		private Row BuildCompanion(Member m, float y)
		{
			//IL_00ab: 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_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_029c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: 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_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			bool value = _compact.Value;
			bool flag = CompanionFood(m);
			float num = (value ? 14f : 20f);
			float num2 = 252f - num;
			float num3 = (value ? 30f : (flag ? 58f : 48f));
			float num4 = num;
			Row row = NewRow("Companion", y, num, num3, companion: true);
			Color color = default(Color);
			((Color)(ref color))..ctor(0.55f, 0.45f, 0.25f, 0.7f);
			float num5 = num * 0.45f;
			GameUi.Plain(GameUi.At((Transform)(object)row.Rect, "Line", num5, -6f, 2f, num3 / 2f + 7f), color);
			GameUi.Plain(GameUi.At((Transform)(object)row.Rect, "Line", num5, num3 / 2f - 1f, num4 - num5, 2f), color);
			float num6 = (value ? 20f : 36f);
			float num7 = (flag ? 4f : ((num3 - num6) / 2f));
			BuildPicture(row, m, num4 + 5f, num7, num6, value ? 12f : 18f, ring: false);
			if (flag)
			{
				for (int i = 0; i < 3; i++)
				{
					row.Foods.Add(BuildSlot(row, num4 + 5f + (float)i * 13f, num7 + num6 + 4f, 10f, back: true, 1.5f));
				}
			}
			float num8 = num4 + 5f + num6 + 6f;
			float num9 = num4 + num2 - 7f - num8;
			float h = (value ? 13f : 15f);
			row.Name = NameLabel(row, num8, 2f, num9 - 58f, h, value ? 12f : 14f, new Color(0.8f, 0.95f, 0.9f), (TextAlignmentOptions)513);
			if (_showDistance.Value)
			{
				row.Distance = NameLabel(row, num8, 2f, num9, h, value ? 11f : 12f, GameUi.Dim, (TextAlignmentOptions)516);
				if (_showArrow.Value)
				{
					BuildArrow(row, num8 + num9 - 50f, 2f, 14f, h, new Color(0.75f, 0.95f, 0.85f));
				}
			}
			row.Health = (value ? GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num8, -16f), new Vector2(num9, 7f), HealthColor, trail: true) : GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num8, -18f), new Vector2(num9, 11f), HealthColor, trail: true, 10f));
			if (m.MaxSt > 0f)
			{
				row.Stamina = (value ? GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num8, -24f), new Vector2(num9, 4f), StaminaColor) : GameUi.LiveBar((Transform)(object)row.Rect, new Vector2(num8, -31f), new Vector2(num9, 5f), StaminaColor));
			}
			int num10 = CompanionEffects(m);
			float num11 = (value ? 10f : 12f);
			for (int j = 0; j < num10; j++)
			{
				row.Effects.Add(BuildSlot(row, num4 + num2 - 6f - (float)(j + 1) * (num11 + 2f), value ? 2f : 36f, num11, back: false, 1f));
			}
			if (!value)
			{
				row.Status = NameLabel(row, num8, 35f, num9 - (float)num10 * (num11 + 2f), 12f, 10f, GameUi.Dim, (TextAlignmentOptions)513);
				row.Status.fontStyle = (FontStyles)2;
			}
			return row;
		}

		private void Refresh()
		{
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			GameUi.SetText(_header, Translations.T("partyhud_header", _members.Count((Member m) => !m.Companion)));
			for (int num = 0; num < _rows.Count; num++)
			{
				Row row = _rows[num];
				Member member = _members[num];
				bool flag = IsDead(member);
				GameUi.SetText(row.Name, member.Name ?? "?");
				GameUi.SetText(row.Distance, (_showDistance.Value && member.Distance >= 0f) ? Translations.T("partyhud_distance", member.Distance.ToString("0")) : "");
				if (row.Companion)
				{
					if ((Object)(object)row.Name != (Object)null)
					{
						((Graphic)row.Name).color = (Color)(flag ? GameUi.Dim : new Color(0.8f, 0.95f, 0.9f));
					}
					row.Health.SetText(flag ? Translations.T("partyhud_fallen") : $"{Mathf.CeilToInt(member.Hp)} / {Mathf.CeilToInt(member.MaxHp)}");
					GameUi.SetText(row.Status, string.IsNullOrEmpty(member.Status) ? "" : (flag ? Translations.T("partyhud_fallen_status") : member.Status));
					Texture texture = null;
					if (AppDomain.CurrentDomain.GetData("DHack.CompanionPortrait") is Func<long, Texture> func)
					{
						try
						{
							texture = func(member.Id);
						}
						catch (Exception)
						{
						}
					}
					((Graphic)row.PictureBack).color = (Color)(flag ? new Color(0.25f, 0.25f, 0.25f) : (CompanionColor * 0.8f));
					GameUi.Show(row.Picture, texture, (Color)(flag ? new Color(0.45f, 0.45f, 0.45f, 1f) : Color.white));
				}
				else
				{
					row.Health.SetText((!member.HasData) ? Translations.T("partyhud_no_data") : (flag ? Translations.T("partyhud_dead") : $"{Mathf.CeilToInt(member.Hp)} / {Mathf.CeilToInt(member.MaxHp)}"));
					if (!member.HasData)
					{
						((Graphic)row.Health.Text).color = GameUi.Dim;
					}
					else
					{
						((Graphic)row.Health.Text).color = Color.white;
					}
					Texture2D texture2 = (_showPortraits.Value ? SteamAvatars.Get(member.SteamId) : null);
					int num2 = (member.Name ?? "?").Aggregate(17, (int h, char c) => h * 31 + c);
					((Graphic)row.PictureBack).color = Color.HSVToRGB((float)Mathf.Abs(num2 % 360) / 360f, 0.45f, flag ? 0.3f : 0.55f);
					GameUi.Show(row.Picture, (Texture)(object)texture2, (Color)(flag ? new Color(0.45f, 0.45f, 0.45f, 1f) : Color.white));
				}
				((Behaviour)row.Initial).enabled = (Object)(object)row.Picture.texture == (Object)null;
				for (int num3 = 0; num3 < row.Foods.Count; num3++)
				{
					Slot slot = row.Foods[num3];
					FoodSlot foodSlot = ((num3 < member.Foods.Count) ? member.Foods[num3] : null);
					bool flag2 = foodSlot != null && (Object)(object)foodSlot.Icon != (Object)null;
					((Behaviour)slot.Icon).enabled = flag2;
					if (flag2 && (Object)(object)slot.Icon.sprite != (Object)(object)foodSlot.Icon)
					{
						slot.Icon.sprite = foodSlot.Icon;
					}
					((Graphic)slot.Back).color = (flag2 ? new Color(0f, 0f, 0f, 0.55f) : new Color(0.45f, 0.4f, 0.3f, 0.25f));
					slot.Time.SetActive(flag2);
					if (flag2)
					{
						slot.Time.Set(foodSlot.Fraction);
						slot.Time.SetColor((foodSlot.Fraction < 0.2f) ? new Color(1f, 0.45f, 0.35f, 0.95f) : new Color(0.55f, 0.9f, 0.45f, 0.95f));
					}
				}
				for (int num4 = 0; num4 < row.Effects.Count; num4++)
				{
					Slot slot2 = row.Effects[num4];
					Effect effect = ((num4 < member.Effects.Count && !(row.Companion && flag)) ? member.Effects[num4] : null);
					bool flag3 = effect != null && (Object)(object)effect.Icon != (Object)null;
					((Behaviour)slot2.Icon).enabled = flag3;
					if (flag3 && (Object)(object)slot2.Icon.sprite != (Object)(object)effect.Icon)
					{
						slot2.Icon.sprite = effect.Icon;
					}
					bool flag4 = flag3 && !row.Companion && effect.Fraction < 0.999f;
					slot2.Time.SetActive(flag4);
					if (flag4)
					{
						slot2.Time.Set(effect.Fraction);
						slot2.Time.SetColor(new Color(0.95f, 0.8f, 0.4f, 0.95f));
					}
				}
			}
		}

		private static bool IsDead(Member m)
		{
			if (!m.Companion)
			{
				if (m.HasData && m.MaxHp > 0f)
				{
					return m.Hp <= 0.5f;
				}
				return false;
			}
			if (!(m.MaxHp <= 0f))
			{
				return m.Hp <= 0.5f;
			}
			return true;
		}

		private void Animate(Row row, Member m)
		{
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: 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_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			//IL_043e: Unknown result type (might be due to invalid IL or missing references)
			bool flag = IsDead(m);
			float num = ((m.HasData && m.MaxHp > 0f) ? Mathf.Clamp01(m.Hp / m.MaxHp) : 0f);
			float stamina = ((m.HasData && m.MaxSt > 0f) ? Mathf.Clamp01(m.St / m.MaxSt) : 0f);
			float eitr = ((m.HasData && m.MaxEitr > 0f) ? Mathf.Clamp01(m.Eitr / m.MaxEitr) : 0f);
			Anim anim = Animate(m.Id, num, stamina, eitr);
			float num2 = anim.Alpha * (m.HasData ? 1f : 0.6f);
			if (Mathf.Abs(row.Group.alpha - num2) > 0.004f)
			{
				row.Group.alpha = num2;
			}
			bool flag2 = m.HasData && !flag && num < 0.25f;
			float num3 = 0.5f + 0.5f * Mathf.Sin(Time.unscaledTime * 6f);
			Color val = (Color)((!row.Companion) ? (m.Self ? new Color(GameUi.Gold.r, GameUi.Gold.g, GameUi.Gold.b, 0.85f) : Clear) : (flag ? new Color(0.4f, 0.4f, 0.4f, 0.8f) : new Color(CompanionColor.r, CompanionColor.g, CompanionColor.b, 0.85f)));
			if (flag2)
			{
				val = Color.Lerp((Color)((val.a > 0f) ? val : new Color(1f, 0.25f, 0.2f, 0f)), new Color(1f, 0.25f, 0.2f, 1f), 0.5f + 0.5f * num3);
			}
			row.Edge.SetColor(val);
			row.Ring?.SetColor((Color)((!m.HasData) ? Clear : (flag ? new Color(0.4f, 0.4f, 0.4f, 0.9f) : Color.Lerp(new Color(0.9f, 0.2f, 0.18f, 0.95f), new Color(0.35f, 0.85f, 0.4f, 0.95f), Mathf.Clamp01(anim.Health * 1.15f)))));
			Color color = (Color)((!flag) ? HealthColor : (row.Companion ? Grey : new Color(0.35f, 0.35f, 0.35f)));
			if (flag2)
			{
				color = Color.Lerp(HealthColor, new Color(1f, 0.55f, 0.45f), num3);
			}
			row.Health.SetColor(color);
			row.Health.Set(m.HasData ? anim.Health : 0f, m.HasData ? anim.Trail : 0f);
			if (row.Stamina != null)
			{
				row.Stamina.SetColor(flag ? Grey : StaminaColor);
				row.Stamina.Set(m.HasData ? anim.Stamina : 0f);
			}
			row.Eitr?.Set(anim.Eitr);
			if (!((Object)(object)row.ArrowImage != (Object)null))
			{
				return;
			}
			float? num4 = ((m.Self || m.Distance < 0f) ? ((float?)null) : BearingTo(m));
			if (((Behaviour)row.ArrowImage).enabled != num4.HasValue)
			{
				((Behaviour)row.ArrowImage).enabled = num4.HasValue;
			}
			if (num4.HasValue)
			{
				Quaternion val2 = Quaternion.Euler(0f, 0f, 0f - num4.Value);
				if (Quaternion.Angle(((Transform)row.Arrow).localRotation, val2) > 0.5f)
				{
					((Transform)row.Arrow).localRot