Decompiled source of RuneheimUI v0.116.7

plugins/RuneheimUI.Pov.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using PassiveTree;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
using Valheiman.Api;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("RuneheimUI.Pov")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b3ca239ca6980966d4bfce95fdf95ba25fe450df")]
[assembly: AssemblyProduct("RuneheimUI.Pov")]
[assembly: AssemblyTitle("RuneheimUI.Pov")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal static class RhSafe
{
	private static class Holder<F>
	{
		public static F Value;
	}

	private static ManualLogSource _log;

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

	private const int MaxReports = 300;

	private static ManualLogSource Log
	{
		get
		{
			if (_log == null)
			{
				_log = Logger.CreateLogSource(typeof(RhSafe).Assembly.GetName().Name + " (checks)");
			}
			return _log;
		}
	}

	private static void Warn(string key, string text)
	{
		try
		{
			lock (_said)
			{
				if (_said.Count >= 300 || !_said.Add(key))
				{
					return;
				}
			}
			Log.LogWarning((object)text);
		}
		catch
		{
		}
	}

	private static string Where(string file, int line)
	{
		return Path.GetFileName(file) + ":" + line;
	}

	public static void Swallowed(Exception e, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0, [CallerMemberName] string member = "")
	{
		string text = Where(file, line);
		object obj;
		if (e == null)
		{
			obj = null;
		}
		else
		{
			string? stackTrace = e.StackTrace;
			obj = ((stackTrace == null) ? null : stackTrace.Split(new char[1] { '\n' })[0]?.Trim());
		}
		if (obj == null)
		{
			obj = "";
		}
		string text2 = (string)obj;
		Warn("catch " + text, "Handled error in " + member + " (" + text + "): " + e?.GetType().Name + ": " + e?.Message + " " + text2);
	}

	private static ref F Dummy<T, F>(T instance)
	{
		return ref Holder<F>.Value;
	}

	private static ref F DummyStatic<F>()
	{
		return ref Holder<F>.Value;
	}

	public static FieldRef<T, F> FieldRef<T, F>(string name, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
	{
		try
		{
			return AccessTools.FieldRefAccess<T, F>(name);
		}
		catch (Exception ex)
		{
			Warn("field " + typeof(T).FullName + "." + name, typeof(T).Name + "." + name + " (as " + typeof(F).Name + ") can't be read (" + Where(file, line) + "): " + ex.GetBaseException().Message + ". What uses it is switched off.");
			return Dummy<T, F>;
		}
	}

	public static FieldRef<T, F> FieldRef<T, F>(FieldInfo field, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
	{
		try
		{
			if (field != null)
			{
				return AccessTools.FieldRefAccess<T, F>(field);
			}
		}
		catch (Exception ex)
		{
			Warn("field " + field?.DeclaringType?.FullName + "." + field?.Name, field?.DeclaringType?.Name + "." + field?.Name + " can't be read (" + Where(file, line) + "): " + ex.GetBaseException().Message + ". What uses it is switched off.");
			return Dummy<T, F>;
		}
		Warn("field null " + Where(file, line), "A field looked up at " + Where(file, line) + " wasn't found. What uses it is switched off.");
		return Dummy<T, F>;
	}

	public static FieldRef<F> StaticFieldRef<F>(Type type, string name, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
	{
		try
		{
			FieldInfo fieldInfo = ((type != null) ? AccessTools.Field(type, name) : null);
			if (fieldInfo != null)
			{
				return AccessTools.StaticFieldRefAccess<F>(fieldInfo);
			}
			Warn("static " + type?.FullName + "." + name, type?.Name + "." + name + " wasn't found (" + Where(file, line) + "). What uses it is switched off.");
		}
		catch (Exception ex)
		{
			Warn("static " + type?.FullName + "." + name, type?.Name + "." + name + " (as " + typeof(F).Name + ") can't be read (" + Where(file, line) + "): " + ex.GetBaseException().Message + ". What uses it is switched off.");
		}
		return DummyStatic<F>;
	}

	public static D MethodDelegate<D>(MethodInfo method, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) where D : Delegate
	{
		try
		{
			if (method != null)
			{
				return AccessTools.MethodDelegate<D>(method, (object)null, true);
			}
			Warn("method null " + Where(file, line), "A method looked up at " + Where(file, line) + " wasn't found. What uses it is switched off.");
		}
		catch (Exception ex)
		{
			Warn("method " + method?.DeclaringType?.FullName + "." + method?.Name, method?.DeclaringType?.Name + "." + method?.Name + " can't be called (" + Where(file, line) + "): " + ex.GetBaseException().Message + ". What uses it is switched off.");
		}
		return null;
	}
}
namespace RuneheimUI
{
	public class PovLootWindow : StripPageWindow
	{
		private const float ViewTop = 84f;

		private const float CellS = 40f;

		private const float CellG = 6f;

		private const float PickS = 44f;

		private const float HeadH = 62f;

		private const float BarH = 30f;

		private const float BarRoom = 40f;

		private RectTransform topRow;

		private RectTransform groupsView;

		private RectTransform groups;

		private RectTransform pickerPage;

		private RectTransform pickerGrid;

		private TMP_Text status;

		private SlideToggle filterOn;

		private readonly Dictionary<string, Group> pending = new Dictionary<string, Group>();

		private static ConfigEntry<string> RemovedItems;

		private TMP_InputField search;

		private TMP_Text pickerTitle;

		private Group pickFor;

		private bool searchBlocks;

		private bool needRefill = true;

		private readonly List<(SlideToggle sw, Func<bool> get)> switches = new List<(SlideToggle, Func<bool>)>();

		private readonly List<PovLootCell> pickCells = new List<PovLootCell>();

		private readonly List<TMP_Text> pickHeads = new List<TMP_Text>();

		private readonly List<Image> pickRules = new List<Image>();

		private readonly List<(string prefab, string name, Sprite icon, int order, string section)> catalog = new List<(string, string, Sprite, int, string)>();

		private static readonly string[] SectionOrder = new string[8] { "Weapons", "Armor", "Tools", "Ammo", "Food", "Utility", "Materials", "Trophies" };

		public override string Title => "Loot filter";

		public override StripPage Kind => (StripPage)5;

		protected override bool Extra
		{
			get
			{
				if (!PovLook.On)
				{
					if (PovPage.Loot)
					{
						return PovBridge.Active;
					}
					return false;
				}
				return StripPages.Is((StripPage)5);
			}
		}

		private float ContentW => StripPageWindow.W - 48f - 8f;

		protected override void HideVanilla(bool on)
		{
			((StripPageWindow)this).HideVanilla(on);
			if (!on && searchBlocks)
			{
				searchBlocks = false;
				GUIManager.BlockInput(false);
			}
			if (!on && pending.Count > 0)
			{
				pending.Clear();
				needRefill = true;
			}
		}

		private Group Effective(string prefab)
		{
			//IL_0017: 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)
			if (!pending.TryGetValue(prefab, out var value))
			{
				return LootFilter.OfPrefab(prefab);
			}
			return value;
		}

		private void Stage(string prefab, Group g)
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			if (LootFilter.OfPrefab(prefab) == g)
			{
				pending.Remove(prefab);
			}
			else
			{
				pending[prefab] = g;
			}
			Redraw();
		}

		private void Redraw()
		{
			if (((Component)pickerPage).gameObject.activeSelf)
			{
				FillPicker();
			}
			else
			{
				needRefill = true;
			}
		}

		private void ConfirmChanges()
		{
			//IL_0023: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Invalid comparison between Unknown and I4
			//IL_005e: 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)
			Dictionary<string, Group> dictionary = ReadRemoved();
			foreach (KeyValuePair<string, Group> item in pending)
			{
				Group val = LootFilter.OfPrefab(item.Key);
				if ((int)item.Value != 2)
				{
					dictionary.Remove(item.Key);
				}
				else if ((int)val != 2)
				{
					dictionary[item.Key] = val;
				}
				LootFilter.Set(item.Key, item.Value);
			}
			RemovedItems.Value = string.Join(";", dictionary.Select((KeyValuePair<string, Group> kv) => kv.Key + ":" + (int)kv.Value));
			pending.Clear();
			Redraw();
		}

		private void DiscardChanges()
		{
			pending.Clear();
			Redraw();
		}

		private static Dictionary<string, Group> ReadRemoved()
		{
			Dictionary<string, Group> dictionary = new Dictionary<string, Group>();
			string[] array = RemovedItems.Value.Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < array.Length; i++)
			{
				string[] array2 = array[i].Split(new char[1] { ':' });
				if (array2.Length == 2 && int.TryParse(array2[1], out var result))
				{
					dictionary[array2[0]] = (Group)result;
				}
			}
			return dictionary;
		}

		protected override void Build()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0065: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Expected O, but got Unknown
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Expected O, but got Unknown
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Expected O, but got Unknown
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			((CleanWindow)this).MakeFrame(new Vector2(StripPageWindow.W, StripPageWindow.H));
			HeaderLine obj = HeaderLine.Create(((CleanWindow)this).Frame, StripPageWindow.W - 48f, 12f, StripPageWindow.W - 48f - 180f, 30f);
			RectTransform val = (RectTransform)((Component)obj).transform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 1f);
			val.pivot = val2;
			Vector2 anchorMin = (val.anchorMax = val2);
			val.anchorMin = anchorMin;
			val.anchoredPosition = new Vector2(0f, -16f);
			obj.Set(new string[1] { "Loot filter" });
			CleanWindow.Place((RectTransform)((Component)PlateButton.Create(((CleanWindow)this).Frame, "Close", new Vector2(70f, 26f), (Action)delegate
			{
				if (PovLook.On)
				{
					StripPages.Close();
				}
				else
				{
					PovPage.ToggleLoot();
				}
			}, 12f, (Sprite)null, default(Vector2), 0f)).transform, StripPageWindow.W - 24f - 70f, 12f, 70f, 26f);
			RemovedItems = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<string>("Loot filter", "Removed items", "", new ConfigDescription("Items taken out of a loot filter group, for the Removed section of the add page.", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
			{
				Browsable = false
			} }));
			topRow = UiUtil.NewRect("Top row", (Transform)(object)((CleanWindow)this).Frame);
			CleanWindow.Place(topRow, 0f, 0f, StripPageWindow.W, 84f);
			Label(topRow, "Filter volume", 24f, 50f, 110f, 14, UiStyle.Rest);
			PovSlider.Create(topRow, 140f, 50f, 200f, () => LootFilter.Master, delegate(float v)
			{
				LootFilter.Master = v;
			});
			Label(topRow, "Filter on", StripPageWindow.W - 24f - 44f - 76f, 50f, 70f, 14, UiStyle.Rest);
			filterOn = Switch(topRow, StripPageWindow.W - 24f - 44f, 49f, () => LootFilter.On, delegate(bool v)
			{
				LootFilter.On = v;
			});
			HoverTip.On(((Component)filterOn).gameObject, (Func<string>)(() => "Filter on"), (Func<string>)(() => "Turns the whole loot filter on or off. Off: ignored items are picked up and drop again, and nothing is marked. Your groups stay as they are."));
			float num = StripPageWindow.H - 24f - 30f;
			status = Label(((CleanWindow)this).Frame, "", 24f, num + 5f, StripPageWindow.W - 48f - 240f, 14, UiStyle.Muted);
			PlateButton obj2 = PlateButton.Create(((CleanWindow)this).Frame, "Confirm", new Vector2(120f, 30f), (Action)ConfirmChanges, 13f, (Sprite)null, default(Vector2), 0f);
			CleanWindow.Place((RectTransform)((Component)obj2).transform, StripPageWindow.W - 24f - 120f, num, 120f, 30f);
			PlateButton val4 = PlateButton.Create(((CleanWindow)this).Frame, "Discard", new Vector2(100f, 30f), (Action)DiscardChanges, 13f, (Sprite)null, default(Vector2), 0f);
			CleanWindow.Place((RectTransform)((Component)val4).transform, StripPageWindow.W - 24f - 120f - 8f - 100f, num, 100f, 30f);
			obj2.Interactable = (val4.Interactable = () => pending.Count > 0);
			obj2.Tip = "Confirm";
			obj2.TipBody = "Save the changes you have clicked.";
			val4.Tip = "Discard";
			val4.TipBody = "Forget the changes you have clicked. Closing this page does the same.";
			groupsView = UiUtil.NewRect("Groups view", (Transform)(object)((CleanWindow)this).Frame);
			CleanWindow.Place(groupsView, 24f, 84f, StripPageWindow.W - 48f, StripPageWindow.H - 84f - 24f - 40f);
			groups = ScrollArea(groupsView);
			pickerPage = UiUtil.NewRect("Picker", (Transform)(object)((CleanWindow)this).Frame);
			CleanWindow.Place(pickerPage, 24f, 50f, StripPageWindow.W - 48f, StripPageWindow.H - 84f + 34f - 24f - 40f);
			CleanWindow.Place((RectTransform)((Component)PlateButton.Create(pickerPage, "Back", new Vector2(70f, 26f), (Action)ClosePicker, 12f, (Sprite)null, default(Vector2), 0f)).transform, 0f, 0f, 70f, 26f);
			pickerTitle = Label(pickerPage, "", 80f, 0f, 300f, 14, UiStyle.Hover);
			search = CraftPanel.SearchBox(pickerPage, StripPageWindow.W - 48f - 210f, 0f, 210f, 26f);
			((UnityEvent<string>)(object)search.onValueChanged).AddListener((UnityAction<string>)delegate
			{
				FillPicker();
			});
			RectTransform val5 = UiUtil.NewRect("Grid view", (Transform)(object)pickerPage);
			CleanWindow.Place(val5, 0f, 36f, StripPageWindow.W - 48f, StripPageWindow.H - 84f + 34f - 24f - 40f - 36f);
			pickerGrid = ScrollArea(val5);
			((Component)pickerPage).gameObject.SetActive(false);
		}

		private static RectTransform ScrollArea(RectTransform view)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Image obj = ((Component)view).gameObject.AddComponent<Image>();
			((Graphic)obj).color = Color.clear;
			((Graphic)obj).raycastTarget = true;
			((Component)view).gameObject.AddComponent<RectMask2D>();
			ScrollRect obj2 = ((Component)view).gameObject.AddComponent<ScrollRect>();
			RectTransform val = UiUtil.NewRect("Content", (Transform)(object)view);
			val.anchorMin = new Vector2(0f, 1f);
			val.anchorMax = new Vector2(1f, 1f);
			val.pivot = new Vector2(0.5f, 1f);
			Vector2 offsetMin = (val.offsetMax = Vector2.zero);
			val.offsetMin = offsetMin;
			obj2.content = val;
			obj2.viewport = view;
			obj2.horizontal = false;
			obj2.movementType = (MovementType)2;
			obj2.scrollSensitivity = 30f;
			SmoothScroll.On(obj2);
			return val;
		}

		private static TMP_Text Label(RectTransform parent, string text, float x, float y, float w, int size, Color c, bool heading = false)
		{
			//IL_0008: 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)
			TMP_Text obj = UiUtil.NewText("Label", (Transform)(object)parent, size, c, (TextAnchor)3, Vector2.zero, heading);
			obj.alignment = (TextAlignmentOptions)4097;
			obj.textWrappingMode = (TextWrappingModes)0;
			obj.overflowMode = (TextOverflowModes)1;
			((Graphic)obj).raycastTarget = false;
			obj.text = text;
			CleanWindow.Place(obj.rectTransform, x, y, w, 20f);
			return obj;
		}

		private SlideToggle Switch(RectTransform parent, float x, float y, Func<bool> get, Action<bool> set)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			SlideToggle val = SlideToggle.Create((Transform)(object)parent, true);
			CleanWindow.Place((RectTransform)((Component)val).transform, x, y, 44f, 22f);
			((Component)val).gameObject.AddComponent<PovClick>().OnClick = delegate
			{
				set(!get());
			};
			switches.Add((val, get));
			return val;
		}

		protected override void Tick()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			bool flag = (Object)(object)search != (Object)null && search.isFocused;
			if (flag != searchBlocks)
			{
				searchBlocks = flag;
				GUIManager.BlockInput(flag);
			}
			foreach (var (val, func) in switches)
			{
				if ((Object)(object)val != (Object)null)
				{
					val.Set(func(), UiUtil.Hovered((RectTransform)((Component)val).transform), true);
				}
			}
			string text = ((pending.Count == 0) ? "No changes waiting" : (pending.Count + ((pending.Count == 1) ? " change" : " changes") + " waiting for Confirm"));
			if (status.text != text)
			{
				status.text = text;
			}
			if (needRefill && !((Component)pickerPage).gameObject.activeSelf)
			{
				needRefill = false;
				Refill();
			}
		}

		private unsafe static string TitleOf(Group g)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			if ((int)g != 4)
			{
				return ((object)(*(Group*)(&g))/*cast due to .constrained prefix*/).ToString();
			}
			return "Very rare";
		}

		private static string NoteOf(Group g)
		{
			//IL_0000: 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_001c: Expected I4, but got Unknown
			return (g - 1) switch
			{
				0 => "Not marked, and never picked up automatically.", 
				1 => "Not marked, picked up as usual. Every item not in another group.", 
				2 => "Marked on the map, plays a sound when it drops.", 
				3 => "Its own map mark and its own drop sound.", 
				4 => "Every unique item. Set by rarity, cannot be edited.", 
				_ => "Every legendary item. Set by rarity, cannot be edited.", 
			};
		}

		private void Refill()
		{
			//IL_00aa: 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_0512: 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_00cb: Invalid comparison between Unknown and I4
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Invalid comparison between Unknown and I4
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: 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_02ad: 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_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Expected O, but got Unknown
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			switches.RemoveAll(((SlideToggle sw, Func<bool> get) s) => (Object)(object)s.sw == (Object)null || ((Component)s.sw).transform.IsChildOf((Transform)(object)groups));
			for (int num = ((Transform)groups).childCount - 1; num >= 0; num--)
			{
				if (((Object)((Transform)groups).GetChild(num)).name != "rhui_scrollcatch")
				{
					Object.Destroy((Object)(object)((Component)((Transform)groups).GetChild(num)).gameObject);
				}
			}
			float contentW = ContentW;
			float num2 = 0f;
			int num3 = Mathf.Max(1, Mathf.FloorToInt((contentW - 28f + 6f) / 46f));
			for (int num4 = 1; num4 <= 6; num4++)
			{
				Group g = (Group)num4;
				bool flag = LootFilter.Editable(g);
				List<string> items = ((flag && (int)g != 2) ? LootFilter.In(g) : new List<string>());
				if (flag && (int)g != 2)
				{
					items.AddRange((from p in pending
						where p.Value == g && !items.Contains(p.Key)
						select p.Key).OrderBy<string, string>((string p) => p, StringComparer.Ordinal).ToList());
				}
				int num5 = (flag ? (items.Count + 1) : 0);
				int num6 = (num5 + num3 - 1) / num3;
				float num7 = 62f + ((num6 > 0) ? ((float)num6 * 40f + (float)(num6 - 1) * 6f) : (-6f)) + 12f;
				RectTransform val = UiUtil.NewRect("Group " + ((object)Unsafe.As<Group, Group>(ref g)/*cast due to .constrained prefix*/).ToString(), (Transform)(object)groups);
				CleanWindow.Place(val, 0f, num2, contentW, num7);
				Image obj = ((Component)val).gameObject.AddComponent<Image>();
				((Graphic)obj).raycastTarget = false;
				obj.sprite = ShapeArt.RoundRect(contentW, num7, 8f, new Color(0.024f, 0.024f, 0.028f, 0.55f), new Color(0.024f, 0.024f, 0.028f, 0.55f));
				Image obj2 = UiUtil.NewImage("Inset", (Transform)(object)val, Color.white);
				obj2.sprite = ShapeArt.InsetShadow(contentW, num7, 8f, 10f);
				UiUtil.Stretch(((Graphic)obj2).rectTransform, 0f);
				((Graphic)obj2).raycastTarget = false;
				float num8 = Controls(val, g, contentW);
				Label(val, num4 + "  ·  " + TitleOf(g).ToUpperInvariant(), 14f, 10f, contentW - num8 - 28f, 13, UiStyle.Hover, heading: true).characterSpacing = 4f;
				Label(val, NoteOf(g), 14f, 32f, contentW - num8 - 28f, 13, UiStyle.Muted);
				for (int num9 = 0; num9 < num5; num9++)
				{
					float num10 = 14f + (float)(num9 % num3) * 46f;
					float num11 = 62f + (float)(num9 / num3) * 46f;
					PovLootCell povLootCell = PovLootCell.Create(val, 40f);
					CleanWindow.Place((RectTransform)((Component)povLootCell).transform, num10, num11, 40f, 40f);
					if (num9 < items.Count)
					{
						string prefab = items[num9];
						(string name, Sprite icon) tuple = Describe(prefab);
						string item = tuple.name;
						Sprite item2 = tuple.icon;
						Group value;
						bool waiting = pending.TryGetValue(prefab, out value);
						bool flag2 = waiting && value != g;
						string body = (flag2 ? "Leaves this group when you Confirm. Click to keep it." : (waiting ? "Joins this group when you Confirm. Click to cancel." : "Click to remove it from this group. Nothing changes until you Confirm."));
						povLootCell.Set(item2, null, 0, waiting, item, body, delegate
						{
							//IL_0037: Unknown result type (might be due to invalid IL or missing references)
							if (!waiting)
							{
								Stage(prefab, (Group)2);
							}
							else
							{
								Stage(prefab, LootFilter.OfPrefab(prefab));
							}
						});
						if (waiting)
						{
							povLootCell.Staged(!flag2, flag2 ? 0.35f : 1f);
						}
					}
					else
					{
						Group target = g;
						povLootCell.Set(null, "+", 0, isPicked: false, "Add items", "Add items to " + TitleOf(g) + ".", delegate
						{
							//IL_000c: Unknown result type (might be due to invalid IL or missing references)
							OpenPicker(target);
						});
					}
				}
				num2 += num7 + 10f;
			}
			groups.sizeDelta = new Vector2(0f, num2);
		}

		private float Controls(RectTransform row, Group g, float cw)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: 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)
			float num = cw - 14f;
			if ((int)g == 1)
			{
				HoverTip.On(((Component)Switch(row, num - 44f, 16f, () => LootFilter.NoDrop, delegate(bool v)
				{
					LootFilter.NoDrop = v;
				})).gameObject, (Func<string>)(() => "Disable drop"), (Func<string>)(() => "Items in this group don't drop at all from your kills, chopping, mining and gathering. Other players still get them."));
				Label(row, "Disable drop", num - 44f - 96f, 17f, 90f, 13, UiStyle.Rest);
				return 150f;
			}
			if (LootFilter.SoundOf(g) == null)
			{
				return 0f;
			}
			Group target = g;
			PlateButton obj = PlateButton.Create(row, (string)null, new Vector2(34f, 34f), (Action)delegate
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				LootMarks.Preview(target);
			}, 0f, ShapeArt.Arrow(14f), new Vector2(13f, 13f), -90f);
			obj.Tip = "Play";
			obj.TipBody = "Hear this group's drop sound.";
			CleanWindow.Place((RectTransform)((Component)obj).transform, num - 34f, 10f, 34f, 34f);
			num -= 40f;
			Sprite val = LootFilter.MapIcon(g);
			if ((Object)(object)val != (Object)null)
			{
				Image obj2 = UiUtil.NewImage("Mark", (Transform)(object)row, Color.white);
				obj2.sprite = val;
				obj2.preserveAspect = true;
				((Graphic)obj2).raycastTarget = true;
				CleanWindow.Place(((Graphic)obj2).rectTransform, num - 28f, 13f, 28f, 28f);
				HoverTip.On(((Component)obj2).gameObject, (Func<string>)(() => "Map mark"), (Func<string>)(() => "How this group shows on the map."));
				num -= 38f;
			}
			PovSlider.Create(row, num - 160f, 17f, 110f, () => LootFilter.VolumeOf(target), delegate(float v)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				LootFilter.SetVolume(target, v);
			});
			return cw - 14f - (num - 160f);
		}

		private static (string name, Sprite icon) Describe(string prefab)
		{
			object obj;
			if ((Object)(object)ObjectDB.instance != (Object)null)
			{
				GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefab);
				if (itemPrefab != null)
				{
					obj = itemPrefab.GetComponent<ItemDrop>();
					goto IL_0025;
				}
			}
			obj = null;
			goto IL_0025;
			IL_0025:
			ItemDrop val = (ItemDrop)obj;
			if (!((Object)(object)val == (Object)null))
			{
				return (name: Localization.instance.Localize(val.m_itemData.m_shared.m_name), icon: val.m_itemData.GetIcon());
			}
			return (name: prefab, icon: null);
		}

		private void OpenPicker(Group g)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			pickFor = g;
			pickerTitle.text = "Add items to " + TitleOf(g);
			if (catalog.Count == 0)
			{
				BuildCatalog();
			}
			search.SetTextWithoutNotify("");
			((Component)topRow).gameObject.SetActive(false);
			((Component)groupsView).gameObject.SetActive(false);
			((Component)pickerPage).gameObject.SetActive(true);
			FillPicker();
			search.ActivateInputField();
		}

		private void ClosePicker()
		{
			((Component)pickerPage).gameObject.SetActive(false);
			((Component)topRow).gameObject.SetActive(true);
			((Component)groupsView).gameObject.SetActive(true);
			needRefill = true;
		}

		private void BuildCatalog()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Invalid comparison between Unknown and I4
			HashSet<string> hashSet = new HashSet<string>();
			foreach (GameObject item in ObjectDB.instance.m_items)
			{
				ItemDrop val = (((Object)(object)item != (Object)null) ? item.GetComponent<ItemDrop>() : null);
				SharedData val2 = ((!((Object)(object)val != (Object)null)) ? null : val.m_itemData?.m_shared);
				if (val2 != null && val2.m_icons != null && val2.m_icons.Length != 0)
				{
					string text = Localization.instance.Localize(val2.m_name);
					if (!string.IsNullOrEmpty(text) && !text.StartsWith("$") && hashSet.Add(text))
					{
						string text2 = (((int)val2.m_itemType == 13) ? "Trophies" : CraftPanel.Group(val.m_itemData));
						catalog.Add((((Object)item).name, text, val.m_itemData.GetIcon(), Array.IndexOf(SectionOrder, text2), text2));
					}
				}
			}
			catalog.Sort(((string prefab, string name, Sprite icon, int order, string section) a, (string prefab, string name, Sprite icon, int order, string section) b) => (a.order == b.order) ? string.Compare(a.name, b.name, StringComparison.CurrentCultureIgnoreCase) : a.order.CompareTo(b.order));
		}

		private void FillPicker()
		{
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Invalid comparison between Unknown and I4
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Invalid comparison between Unknown and I4
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Invalid comparison between Unknown and I4
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Invalid comparison between Unknown and I4
			string q = (search.text ?? "").Trim();
			float contentW = ContentW;
			float num = 0f;
			int num2 = Mathf.Max(1, Mathf.FloorToInt((contentW + 6f) / 50f));
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			string text = null;
			List<(string, Group, (string, Sprite))> list = (from keyValuePair in ReadRemoved()
				where (int)Effective(keyValuePair.Key) == 2
				select (prefab: keyValuePair.Key, @from: keyValuePair.Value, look: Describe(keyValuePair.Key)) into tuple
				where q.Length == 0 || tuple.look.name.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) >= 0
				select tuple).OrderBy<(string, Group, (string, Sprite)), string>(((string prefab, Group from, (string name, Sprite icon) look) tuple) => tuple.look.name, StringComparer.CurrentCultureIgnoreCase).ToList();
			if (list.Count > 0)
			{
				Head(num4++, "Removed", num, contentW);
				num += 30f;
				for (int num6 = 0; num6 < list.Count; num6++)
				{
					(string prefab, Group from, (string name, Sprite icon) look) r = list[num6];
					PovLootCell povLootCell = PickCell(num3++);
					CleanWindow.Place((RectTransform)((Component)povLootCell).transform, (float)(num6 % num2) * 50f, num + (float)(num6 / num2) * 50f, 44f, 44f);
					povLootCell.Set(r.look.icon, null, 0, isPicked: false, r.look.name, "Removed from " + TitleOf(r.from) + ". Click to add it to " + TitleOf(pickFor) + ".", delegate
					{
						//IL_0021: Unknown result type (might be due to invalid IL or missing references)
						Stage(r.prefab, pickFor);
					});
				}
				num += (float)((list.Count + num2 - 1) / num2) * 50f + 6f;
			}
			foreach (var item2 in catalog)
			{
				if (q.Length > 0 && item2.name.IndexOf(q, StringComparison.CurrentCultureIgnoreCase) < 0)
				{
					continue;
				}
				if (item2.section != text)
				{
					if (text != null && num5 > 0)
					{
						num += (float)((num5 + num2 - 1) / num2) * 50f + 6f;
					}
					text = item2.section;
					num5 = 0;
					Head(num4++, item2.section, num, contentW);
					num += 30f;
				}
				PovLootCell povLootCell2 = PickCell(num3++);
				CleanWindow.Place((RectTransform)((Component)povLootCell2).transform, (float)(num5 % num2) * 50f, num + (float)(num5 / num2) * 50f, 44f, 44f);
				string prefab = item2.prefab;
				string item = item2.name;
				Group val = Effective(prefab);
				povLootCell2.Set(body: (((int)val != 2) ? ("Now in: " + TitleOf(val)) : "") + (pending.ContainsKey(prefab) ? ((((int)val != 2) ? "\n" : "") + "Waiting for Confirm.") : ""), sprite: item2.icon, glyph: null, group: ((int)val != 2) ? ((int)val) : 0, isPicked: val == pickFor && (int)pickFor != 2, title: item, onClick: delegate
				{
					//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_002e: 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_0069: 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_0051: Unknown result type (might be due to invalid IL or missing references)
					//IL_005b: Unknown result type (might be due to invalid IL or missing references)
					Group val2 = LootFilter.OfPrefab(prefab);
					Stage(prefab, (Group)((Effective(prefab) == pickFor) ? ((val2 == pickFor) ? 2 : ((int)val2)) : ((int)pickFor)));
				});
				num5++;
			}
			if (num5 > 0)
			{
				num += (float)((num5 + num2 - 1) / num2) * 50f;
			}
			for (int num7 = num3; num7 < pickCells.Count; num7++)
			{
				if (((Component)pickCells[num7]).gameObject.activeSelf)
				{
					((Component)pickCells[num7]).gameObject.SetActive(false);
				}
			}
			for (int num8 = num4; num8 < pickHeads.Count; num8++)
			{
				((Component)pickHeads[num8]).gameObject.SetActive(false);
				((Component)pickRules[num8]).gameObject.SetActive(false);
			}
			pickerGrid.sizeDelta = new Vector2(0f, num);
		}

		private PovLootCell PickCell(int i)
		{
			while (pickCells.Count <= i)
			{
				pickCells.Add(PovLootCell.Create(pickerGrid, 44f));
			}
			if (!((Component)pickCells[i]).gameObject.activeSelf)
			{
				((Component)pickCells[i]).gameObject.SetActive(true);
			}
			return pickCells[i];
		}

		private void Head(int i, string text, float y, float cw)
		{
			//IL_0024: 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)
			while (pickHeads.Count <= i)
			{
				pickHeads.Add(Label(pickerGrid, "", 2f, 0f, cw, 12, ShapeArt.GoldBottom, heading: true));
				pickHeads[pickHeads.Count - 1].characterSpacing = 10f;
				Image val = UiUtil.NewImage("Rule", (Transform)(object)pickerGrid, Color.white);
				((Graphic)val).raycastTarget = false;
				val.sprite = ShapeArt.HRule(cw, 1f);
				pickRules.Add(val);
			}
			((Component)pickHeads[i]).gameObject.SetActive(true);
			((Component)pickRules[i]).gameObject.SetActive(true);
			pickHeads[i].text = text.ToUpperInvariant();
			CleanWindow.Place(pickHeads[i].rectTransform, 2f, y, cw, 20f);
			CleanWindow.Place(((Graphic)pickRules[i]).rectTransform, 0f, y + 23f, cw, 1f);
		}
	}
	public class PovClick : MonoBehaviour, IPointerClickHandler, IEventSystemHandler
	{
		public Action OnClick;

		public void OnPointerClick(PointerEventData e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)e.button == 0)
			{
				OnClick?.Invoke();
			}
		}
	}
	public class PovLootCell : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IPointerEnterHandler, IPointerExitHandler
	{
		private Image icon;

		private Image edge;

		private TMP_Text plus;

		private TMP_Text badge;

		private Action click;

		private string tipTitle;

		private string tipBody;

		private bool hover;

		private bool picked;

		private static readonly Color Rest = new Color(UiStyle.Rest.r, UiStyle.Rest.g, UiStyle.Rest.b, 0.18f);

		private Image stage;

		private Image stageH;

		private Image stageV;

		private static readonly Color AddColor = Theme.Hex("#5fa64e");

		private static readonly Color RemoveColor = Theme.Hex("#c8443a");

		public static PovLootCell Create(RectTransform parent, float size)
		{
			//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_0053: 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_00b1: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = UiUtil.NewRect("Cell", (Transform)(object)parent);
			PovLootCell povLootCell = ((Component)val).gameObject.AddComponent<PovLootCell>();
			Image obj = ((Component)val).gameObject.AddComponent<Image>();
			obj.sprite = ShapeArt.RoundRect(size, size, 6f, Color.white, Color.white);
			((Graphic)obj).color = new Color(0.024f, 0.024f, 0.028f, 0.8f);
			((Graphic)obj).raycastTarget = true;
			povLootCell.edge = UiUtil.NewImage("Edge", (Transform)(object)val, Rest);
			povLootCell.edge.sprite = ShapeArt.RoundRectLine(size, size, 6f, 1f);
			UiUtil.Stretch(((Graphic)povLootCell.edge).rectTransform, 0f);
			povLootCell.icon = UiUtil.NewImage("Icon", (Transform)(object)val, Color.white);
			UiUtil.Stretch(((Graphic)povLootCell.icon).rectTransform, 4f);
			povLootCell.icon.preserveAspect = true;
			((Behaviour)povLootCell.icon).enabled = false;
			povLootCell.plus = UiUtil.NewText("Plus", (Transform)(object)val, 20, UiStyle.Rest, (TextAnchor)4, Vector2.zero, true);
			UiUtil.Stretch(povLootCell.plus.rectTransform, 0f);
			povLootCell.plus.alignment = (TextAlignmentOptions)514;
			((Graphic)povLootCell.plus).raycastTarget = false;
			povLootCell.badge = UiUtil.NewText("Group", (Transform)(object)val, 11, UiStyle.Hover, (TextAnchor)2, Vector2.zero, true);
			UiUtil.Stretch(povLootCell.badge.rectTransform, 0f);
			povLootCell.badge.rectTransform.offsetMax = new Vector2(-4f, -2f);
			povLootCell.badge.alignment = (TextAlignmentOptions)260;
			((Graphic)povLootCell.badge).raycastTarget = false;
			povLootCell.stage = UiUtil.NewImage("Waiting", (Transform)(object)val, Color.white);
			povLootCell.stage.sprite = ShapeArt.Disc(13f);
			((Graphic)povLootCell.stage).raycastTarget = false;
			((Behaviour)povLootCell.stage).enabled = false;
			RectTransform rectTransform = ((Graphic)povLootCell.stage).rectTransform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(1f, 1f);
			rectTransform.pivot = val2;
			Vector2 anchorMin = (rectTransform.anchorMax = val2);
			rectTransform.anchorMin = anchorMin;
			rectTransform.sizeDelta = new Vector2(13f, 13f);
			rectTransform.anchoredPosition = new Vector2(-2f, -2f);
			povLootCell.stageH = Bar(rectTransform, 7f, 2f);
			povLootCell.stageV = Bar(rectTransform, 2f, 7f);
			return povLootCell;
		}

		private static Image Bar(RectTransform parent, float w, float h)
		{
			//IL_0006: 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_003e: 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_0040: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			Image obj = UiUtil.NewImage("Bar", (Transform)(object)parent, Color.white);
			((Graphic)obj).raycastTarget = false;
			((Behaviour)obj).enabled = false;
			RectTransform rectTransform = ((Graphic)obj).rectTransform;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0.5f, 0.5f);
			rectTransform.pivot = val;
			Vector2 anchorMin = (rectTransform.anchorMax = val);
			rectTransform.anchorMin = anchorMin;
			rectTransform.sizeDelta = new Vector2(w, h);
			rectTransform.anchoredPosition = Vector2.zero;
			return obj;
		}

		public void Set(Sprite sprite, string glyph, int group, bool isPicked, string title, string body, Action onClick)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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)
			icon.sprite = sprite;
			((Behaviour)icon).enabled = (Object)(object)sprite != (Object)null;
			((Graphic)icon).color = Color.white;
			Image obj = stage;
			Image obj2 = stageH;
			bool flag = (((Behaviour)stageV).enabled = false);
			bool enabled = (((Behaviour)obj2).enabled = flag);
			((Behaviour)obj).enabled = enabled;
			plus.text = glyph ?? "";
			badge.text = ((group > 0) ? group.ToString() : "");
			picked = isPicked;
			tipTitle = title;
			tipBody = body;
			click = onClick;
			((Graphic)edge).color = (picked ? UiStyle.Selected : Rest);
		}

		public void Staged(bool adding, float alpha)
		{
			//IL_0036: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			Image obj = stage;
			bool enabled = (((Behaviour)stageH).enabled = true);
			((Behaviour)obj).enabled = enabled;
			((Behaviour)stageV).enabled = adding;
			((Graphic)stage).color = (adding ? AddColor : RemoveColor);
			((Graphic)icon).color = new Color(1f, 1f, 1f, alpha);
		}

		private void LateUpdate()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			if (hover)
			{
				((Graphic)edge).color = UiStyle.Hover;
				UiTooltip.Show(tipTitle, tipBody);
			}
		}

		public void OnPointerEnter(PointerEventData e)
		{
			hover = true;
		}

		public void OnPointerExit(PointerEventData e)
		{
			//IL_001c: 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)
			hover = false;
			((Graphic)edge).color = (picked ? UiStyle.Selected : Rest);
		}

		private void OnDisable()
		{
			hover = false;
		}

		public void OnPointerClick(PointerEventData e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)e.button == 0)
			{
				click?.Invoke();
			}
		}
	}
	public class PovSlider : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler
	{
		private const float Max = 3f;

		private const float BarH = 6f;

		private RectTransform root;

		private RectTransform mask;

		private RectTransform knob;

		private TMP_Text value;

		private Func<float> get;

		private Action<float> set;

		private float width;

		public static PovSlider Create(RectTransform parent, float x, float y, float w, Func<float> get, Action<float> set)
		{
			//IL_0020: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00ab: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: 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_024a: 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_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: 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_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: 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_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = UiUtil.NewRect("Volume", (Transform)(object)parent);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0f, 1f);
			val.pivot = val2;
			Vector2 val3 = (val.anchorMin = (val.anchorMax = val2));
			val.sizeDelta = new Vector2(w, 20f);
			val.anchoredPosition = new Vector2(x, 0f - y);
			PovSlider povSlider = ((Component)val).gameObject.AddComponent<PovSlider>();
			povSlider.root = val;
			povSlider.width = w;
			povSlider.get = get;
			povSlider.set = set;
			Image obj = ((Component)val).gameObject.AddComponent<Image>();
			((Graphic)obj).color = Color.clear;
			((Graphic)obj).raycastTarget = true;
			Image obj2 = UiUtil.NewImage("Track", (Transform)(object)val, new Color(UiStyle.Rest.r, UiStyle.Rest.g, UiStyle.Rest.b, 0.18f));
			obj2.sprite = ShapeArt.Pill(w, 6f);
			Middle(((Graphic)obj2).rectTransform, w);
			povSlider.mask = UiUtil.NewRect("Fill", (Transform)(object)val);
			((Component)povSlider.mask).gameObject.AddComponent<RectMask2D>();
			RectTransform obj3 = povSlider.mask;
			RectTransform obj4 = povSlider.mask;
			RectTransform obj5 = povSlider.mask;
			((Vector2)(ref val2))..ctor(0f, 0.5f);
			obj5.pivot = val2;
			val3 = (obj3.anchorMin = (obj4.anchorMax = val2));
			povSlider.mask.sizeDelta = new Vector2(0f, 6f);
			Image obj6 = UiUtil.NewImage("Bar", (Transform)(object)povSlider.mask, Color.white);
			obj6.sprite = ShapeArt.GradientPill(w, 6f, ShapeArt.GoldBottom, UiStyle.Selected, UiStyle.Hover);
			RectTransform rectTransform = ((Graphic)obj6).rectTransform;
			((Vector2)(ref val2))..ctor(0f, 0.5f);
			rectTransform.pivot = val2;
			val3 = (rectTransform.anchorMin = (rectTransform.anchorMax = val2));
			rectTransform.sizeDelta = new Vector2(w, 6f);
			Image val10 = UiUtil.NewImage("Knob", (Transform)(object)val, UiStyle.Hover);
			((Graphic)val10).raycastTarget = false;
			povSlider.knob = ((Graphic)val10).rectTransform;
			RectTransform obj7 = povSlider.knob;
			RectTransform obj8 = povSlider.knob;
			((Vector2)(ref val3))..ctor(0f, 0.5f);
			obj8.anchorMax = val3;
			obj7.anchorMin = val3;
			povSlider.knob.pivot = new Vector2(0.5f, 0.5f);
			povSlider.knob.sizeDelta = new Vector2(9f, 9f);
			((Transform)povSlider.knob).localRotation = Quaternion.Euler(0f, 0f, 45f);
			povSlider.value = UiUtil.NewText("Value", (Transform)(object)parent, 13, UiStyle.Rest, (TextAnchor)3, Vector2.zero, false);
			((Graphic)povSlider.value).raycastTarget = false;
			povSlider.value.alignment = (TextAlignmentOptions)4097;
			RectTransform rectTransform2 = povSlider.value.rectTransform;
			((Vector2)(ref val2))..ctor(0f, 1f);
			rectTransform2.pivot = val2;
			val3 = (rectTransform2.anchorMin = (rectTransform2.anchorMax = val2));
			rectTransform2.sizeDelta = new Vector2(44f, 20f);
			rectTransform2.anchoredPosition = new Vector2(x + w + 8f, 0f - y);
			povSlider.Paint();
			return povSlider;
		}

		private static void Middle(RectTransform r, float w)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0022: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, 0.5f);
			r.pivot = val;
			Vector2 anchorMin = (r.anchorMax = val);
			r.anchorMin = anchorMin;
			r.sizeDelta = new Vector2(w, 6f);
			r.anchoredPosition = Vector2.zero;
		}

		private void Paint()
		{
			//IL_002c: 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)
			float num = get();
			float num2 = Mathf.Clamp01(num / 3f);
			mask.sizeDelta = new Vector2(width * num2, 6f);
			knob.anchoredPosition = new Vector2(width * num2, 0f);
			value.text = Mathf.RoundToInt(num * 100f) + "%";
		}

		public void OnPointerDown(PointerEventData e)
		{
			Drag(e);
		}

		public void OnDrag(PointerEventData e)
		{
			Drag(e);
		}

		private void Drag(PointerEventData e)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if ((int)e.button == 0)
			{
				float x = UiUtil.ScreenToLocal(root, e.position).x;
				Rect rect = root.rect;
				float num = x - ((Rect)(ref rect)).xMin;
				set(Mathf.Round(Mathf.Clamp01(num / width) * 3f * 20f) / 20f);
				Paint();
			}
		}
	}
	public sealed class PovStorageProvider : IStorageProvider
	{
		public string Id => "daytreee.runeheimui";

		public int Contract => 1;

		public ItemData ItemIn(Player p, string cell)
		{
			return PovLink.Find(((Humanoid)p).GetInventory(), cell);
		}

		public bool Put(Player p, string cell, ItemData item)
		{
			return PovLink.PutIn(((Humanoid)p).GetInventory(), cell, item);
		}

		public bool TakeOut(Player p, string cell)
		{
			//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_001c: 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)
			Inventory inventory = ((Humanoid)p).GetInventory();
			ItemData val = PovLink.Find(inventory, cell);
			if (val == null)
			{
				return true;
			}
			Vector2i val2 = InventorySlots.FreeMainCell(inventory, false);
			if (val2.x >= 0)
			{
				return InventorySlots.MoveWithin(inventory, val, val2);
			}
			return false;
		}
	}
}