Decompiled source of VargheimHUD v0.3.1

VargheimHUD.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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 VargheimHUD
{
	[BepInPlugin("digi.vargheim.hud", "VargheimHUD", "0.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "digi.vargheim.hud";

		public const string Version = "0.3.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<bool> NumbersInOrb;

		internal static ConfigEntry<bool> MoveKeyHints;

		internal static ConfigEntry<bool> MapPanel;

		internal static ConfigEntry<float> QuickGap;

		internal static ConfigEntry<float> QuickY;

		internal static ConfigEntry<float> OrbSize;

		internal static ConfigEntry<float> StripBottom;

		internal static ConfigEntry<float> HotbarSlot;

		internal static ConfigEntry<float> KeyHintsX;

		internal static ConfigEntry<float> KeyHintsY;

		internal static ConfigEntry<float> StatusScale;

		internal static ConfigEntry<float> FoodSpacing;

		internal static ConfigEntry<float> MessageX;

		internal static ConfigEntry<float> MessageY;

		internal static ConfigEntry<float> BottomScale;

		internal static ConfigEntry<float> MapOffsetY;

		internal static ConfigEntry<float> MapOffsetX;

		internal static Dictionary<string, Sprite> S = new Dictionary<string, Sprite>();

		internal static readonly Color Acc = new Color(0.69f, 0.77f, 0.84f);

		internal static readonly Color Acc2 = new Color(0.36f, 0.42f, 0.49f);

		internal static readonly Color Paper = new Color(0.89f, 0.91f, 0.93f);

		internal static readonly Color Mute = new Color(0.6f, 0.66f, 0.71f);

		internal static readonly Color Gold = new Color(0.8f, 0.67f, 0.39f);

		internal static readonly Color Yellow = new Color(1f, 0.85f, 0.27f);

		internal static readonly Color YellowDark = new Color(0.85f, 0.66f, 0.16f);

		internal static readonly Color HpTop = new Color(0.85f, 0.24f, 0.27f);

		internal static readonly Color HpBot = new Color(0.48f, 0.06f, 0.09f);

		internal static readonly Color EitrTop = new Color(0.35f, 0.71f, 0.9f);

		internal static readonly Color EitrBot = new Color(0.08f, 0.29f, 0.53f);

		internal static float Sc => Mathf.Clamp(BottomScale.Value, 0.5f, 1.5f);

		internal static float OrbPx()
		{
			return OrbSize.Value * Sc;
		}

		private void Awake()
		{
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "Enabled", true, "Vargheim HUD skin on. Off = vanilla HUD untouched (needs a relaunch to go back).");
			OrbSize = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "OrbSize", 60f, "Health / eitr orb diameter (canvas units; 1080p pixels at UI scale 1).");
			StripBottom = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "StripBottom", 40f, "Gap between the screen bottom and the hotbar.");
			HotbarSlot = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "HotbarSlot", 0f, "Hotbar slot spacing override (0 = the game's).");
			NumbersInOrb = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "NumbersInOrb", true, "Show the health / eitr number inside the orb.");
			MoveKeyHints = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "MoveKeyHints", true, "Move the key hints to one line above the right end of the strip.");
			KeyHintsX = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "KeyHintsX", -30f, "Key hints offset from the right edge.");
			KeyHintsY = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "KeyHintsY", 124f, "Key hints height above the screen bottom.");
			StatusScale = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "StatusScale", 0.5f, "Size of the status effect icons next to the minimap (1 = vanilla).");
			FoodSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "FoodSpacing", 40f, "Distance between the food slots in the strip.");
			MessageX = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "MessageX", 40f, "Pickup / info messages: distance from the left edge.");
			MessageY = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "MessageY", 60f, "Pickup / info messages: height above the screen centre (negative = below).");
			QuickGap = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "QuickGap", 28f, "Extra gap between the quick slots (Alt+Z/X/C) and the health orb.");
			QuickY = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "QuickY", 0f, "Nudge the quick slots (Alt+Z/X/C) up (+) or down (-) in pixels; 0 lines them up with the hotbar.");
			BottomScale = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "BottomScale", 0.8f, "Scale of the bottom strip: hotbar, orbs, stamina bar, food, quick slots, forsaken power (1 = vanilla size).");
			MapOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "MapOffsetY", 20f, "Raise (+) or lower (-) the minimap and its panel, in pixels.");
			MapOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Skin", "MapOffsetX", 20f, "Slide the minimap and its panel toward the right screen edge (+) or away from it (-), in pixels.");
			MapPanel = ((BaseUnityPlugin)this).Config.Bind<bool>("Skin", "MapPanel", true, "Glass panel behind the minimap with the status effects stacked under it.");
			Windows.Bind(((BaseUnityPlugin)this).Config);
			Slots.Bind(((BaseUnityPlugin)this).Config);
			Compass.Bind(((BaseUnityPlugin)this).Config);
			if (!Enabled.Value)
			{
				Log.LogInfo((object)"VargheimHUD off (Skin.Enabled = false).");
				return;
			}
			LoadSprites();
			if (S.Count == 0)
			{
				Log.LogWarning((object)"VargheimHUD: no sprites found; skin disabled for this session (vanilla HUD).");
				return;
			}
			Harmony val = new Harmony("digi.vargheim.hud");
			val.PatchAll(typeof(Patches));
			val.PatchAll(typeof(WindowPatches));
			val.PatchAll(typeof(SlotPatches));
			Log.LogInfo((object)("VargheimHUD 0.3.0 loaded (" + S.Count + " sprites)."));
		}

		private void LateUpdate()
		{
			if (Enabled.Value)
			{
				Skin.LateTick();
			}
		}

		private void LoadSprites()
		{
			//IL_004c: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Expected O, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string[] array = new string[2]
			{
				Path.Combine(directoryName, "assets"),
				directoryName
			};
			(string, Vector4, float)[] array2 = new(string, Vector4, float)[12]
			{
				("panel", new Vector4(24f, 24f, 24f, 24f), 2f),
				("panel_gold", new Vector4(24f, 24f, 24f, 24f), 2f),
				("window", new Vector4(24f, 24f, 24f, 24f), 2f),
				("chip", new Vector4(12f, 12f, 12f, 12f), 2f),
				("slot", new Vector4(10f, 10f, 10f, 10f), 2f),
				("bar_frame", new Vector4(8f, 8f, 8f, 8f), 2f),
				("bar_fill", new Vector4(2f, 2f, 2f, 2f), 2f),
				("cap", Vector4.zero, 2f),
				("orb_back", Vector4.zero, 2f),
				("orb_liquid", Vector4.zero, 2f),
				("orb_glass", Vector4.zero, 2f),
				("surface", Vector4.zero, 2f)
			};
			for (int i = 0; i < array2.Length; i++)
			{
				(string, Vector4, float) tuple = array2[i];
				string item = tuple.Item1;
				Vector4 item2 = tuple.Item2;
				float item3 = tuple.Item3;
				string text = null;
				string[] array3 = array;
				for (int j = 0; j < array3.Length; j++)
				{
					string text2 = Path.Combine(array3[j], item + ".png");
					if (File.Exists(text2))
					{
						text = text2;
						break;
					}
				}
				if (text == null)
				{
					Log.LogWarning((object)("missing sprite " + item + ".png (looked in " + string.Join(", ", array) + ")"));
				}
				else
				{
					Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false)
					{
						filterMode = (FilterMode)1,
						wrapMode = (TextureWrapMode)1
					};
					ImageConversion.LoadImage(val, File.ReadAllBytes(text));
					S[item] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f * item3, 0u, (SpriteMeshType)0, item2);
				}
			}
		}

		internal static RectTransform Rt(string name, Transform parent, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 size)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0048: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) })
			{
				layer = ((Component)parent).gameObject.layer
			}.GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			Vector2 anchorMin = (component.anchorMax = anchor);
			component.anchorMin = anchorMin;
			component.pivot = pivot;
			component.anchoredPosition = pos;
			component.sizeDelta = size;
			return component;
		}

		internal static Image Img(RectTransform rt, string sprite, Color c, Type type = (Type)1)
		{
			//IL_0023: 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)
			Image val = ((Component)rt).gameObject.AddComponent<Image>();
			if (S.TryGetValue(sprite, out var value))
			{
				val.sprite = value;
			}
			val.type = type;
			((Graphic)val).color = c;
			((Graphic)val).raycastTarget = false;
			return val;
		}

		internal static void Anchor(RectTransform rt, Vector2 anchor, Vector2 pivot, Vector2 pos)
		{
			//IL_0002: 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_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			Vector2 anchorMin = (rt.anchorMax = anchor);
			rt.anchorMin = anchorMin;
			rt.pivot = pivot;
			rt.anchoredPosition = pos;
		}

		internal static void Hide(Component c)
		{
			if (!((Object)(object)c == (Object)null))
			{
				CanvasGroup obj = c.gameObject.GetComponent<CanvasGroup>() ?? c.gameObject.AddComponent<CanvasGroup>();
				obj.alpha = 0f;
				obj.blocksRaycasts = false;
				obj.interactable = false;
			}
		}

		internal static TMP_Text Label(string name, Transform parent, TMP_Text template, float size, Color c, TextAlignmentOptions align, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 box)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: 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_0008: 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_004b: 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)
			TextMeshProUGUI val = ((Component)Rt(name, parent, anchor, pivot, pos, box)).gameObject.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)template != (Object)null)
			{
				((TMP_Text)val).font = template.font;
				((TMP_Text)val).fontSharedMaterial = template.fontSharedMaterial;
			}
			((TMP_Text)val).fontSize = size;
			((Graphic)val).color = c;
			((TMP_Text)val).alignment = align;
			((Graphic)val).raycastTarget = false;
			((TMP_Text)val).enableWordWrapping = false;
			((TMP_Text)val).overflowMode = (TextOverflowModes)0;
			((TMP_Text)val).outlineWidth = 0.25f;
			((TMP_Text)val).outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)220);
			return (TMP_Text)(object)val;
		}
	}
	internal class Orb
	{
		public RectTransform Root;

		public Image Liquid;

		public Image Surface;

		public TMP_Text Text;

		public Color Top;

		public Color Bottom;

		public static Orb Make(string name, Transform parent, Vector2 pos, float size, Color top, Color bottom, TMP_Text template)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: 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_022f: 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)
			Orb orb = new Orb
			{
				Top = top,
				Bottom = bottom
			};
			orb.Root = Plugin.Rt(name, parent, new Vector2(0.5f, 0f), new Vector2(0.5f, 0.5f), pos, new Vector2(size * 1.22f, size * 1.22f));
			Plugin.Img(Plugin.Rt("back", (Transform)(object)orb.Root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(size * 1.22f, size * 1.22f)), "orb_back", Color.white, (Type)0);
			orb.Liquid = Plugin.Img(Plugin.Rt("liquid", (Transform)(object)orb.Root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(size * 1.22f, size * 1.22f)), "orb_liquid", top, (Type)3);
			orb.Liquid.fillMethod = (FillMethod)1;
			orb.Liquid.fillOrigin = 0;
			orb.Liquid.fillAmount = 1f;
			orb.Surface = Plugin.Img(Plugin.Rt("surface", (Transform)(object)orb.Root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(size * 0.84f, 2f)), "surface", new Color(1f, 1f, 1f, 0.55f), (Type)0);
			Plugin.Img(Plugin.Rt("glass", (Transform)(object)orb.Root, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(size * 1.22f, size * 1.22f)), "orb_glass", Color.white, (Type)0);
			orb.Text = Plugin.Label("num", (Transform)(object)orb.Root, template, size * 0.28f, Plugin.Paper, (TextAlignmentOptions)514, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(size, size * 0.5f));
			return orb;
		}

		public void Set(float value, float max, float size)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			float num = ((max > 0f) ? Mathf.Clamp01(value / max) : 0f);
			Liquid.fillAmount = num;
			((Graphic)Liquid).color = Color.Lerp(Bottom, Top, 0.35f + 0.65f * num);
			float num2 = size * 0.42f;
			float num3 = 0f - num2 + 2f * num2 * num;
			float num4 = Mathf.Sqrt(Mathf.Max(0f, num2 * num2 - num3 * num3));
			((Graphic)Surface).rectTransform.anchoredPosition = new Vector2(0f, num3);
			((Graphic)Surface).rectTransform.sizeDelta = new Vector2(num4 * 2f, 2f);
			((Behaviour)Surface).enabled = num > 0.02f && num < 0.98f;
			if ((Object)(object)Text != (Object)null)
			{
				((Behaviour)Text).enabled = Plugin.NumbersInOrb.Value;
				Text.text = Mathf.CeilToInt(value).ToString();
			}
		}
	}
	internal class Bar
	{
		public RectTransform Root;

		public Image Fill;

		public TMP_Text LabelL;

		public TMP_Text LabelR;

		public Color Top;

		public Color Bottom;

		public static Bar Make(string name, Transform parent, Vector2 anchor, Vector2 pivot, Vector2 pos, float w, float h, Color top, Color bottom, Color acc, TMP_Text template, string label)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0021: 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_005c: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_0119: 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_0171: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: 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_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: 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)
			Bar bar = new Bar
			{
				Top = top,
				Bottom = bottom
			};
			bar.Root = Plugin.Rt(name, parent, anchor, pivot, pos, new Vector2(w, h));
			Plugin.Img(bar.Root, "bar_frame", Color.white, (Type)1);
			RectTransform rt = Plugin.Rt("fill", (Transform)(object)bar.Root, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(1f, 0f), new Vector2(w - 2f, h - 2f));
			bar.Fill = Plugin.Img(rt, "bar_fill", top, (Type)3);
			bar.Fill.fillMethod = (FillMethod)0;
			bar.Fill.fillOrigin = 0;
			float[] array = new float[3] { 0.25f, 0.5f, 0.75f };
			foreach (float num in array)
			{
				Image obj = ((Component)Plugin.Rt("q", (Transform)(object)bar.Root, new Vector2(num, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(1f, h - 2f))).gameObject.AddComponent<Image>();
				((Graphic)obj).color = new Color(0f, 0f, 0f, 0.7f);
				((Graphic)obj).raycastTarget = false;
			}
			Plugin.Img(Plugin.Rt("capL", (Transform)(object)bar.Root, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(h + 1f, h + 1f)), "cap", acc, (Type)0);
			Plugin.Img(Plugin.Rt("capR", (Transform)(object)bar.Root, new Vector2(1f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(h + 1f, h + 1f)), "cap", acc, (Type)0);
			if (label != null)
			{
				bar.LabelL = Plugin.Label("l", (Transform)(object)bar.Root, template, 11f, acc, (TextAlignmentOptions)1025, new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(6f, 2f), new Vector2(200f, 16f));
				bar.LabelL.text = label;
				bar.LabelL.characterSpacing = 8f;
				bar.LabelR = Plugin.Label("r", (Transform)(object)bar.Root, template, 11f, Plugin.Paper, (TextAlignmentOptions)1028, new Vector2(1f, 1f), new Vector2(1f, 0f), new Vector2(-6f, 2f), new Vector2(200f, 16f));
			}
			return bar;
		}

		public void Set(float value, float max)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			float num = ((max > 0f) ? Mathf.Clamp01(value / max) : 0f);
			Fill.fillAmount = num;
			((Graphic)Fill).color = Color.Lerp(Bottom, Top, 0.4f + 0.6f * num);
			if ((Object)(object)LabelR != (Object)null)
			{
				LabelR.text = Mathf.CeilToInt(value) + " / " + Mathf.CeilToInt(max);
			}
		}
	}
	internal static class Skin
	{
		private static bool s_built;

		private static bool s_mapBuilt;

		private static Orb s_hp;

		private static Orb s_eitr;

		private static Bar s_stam;

		private static RectTransform s_strip;

		private static RectTransform s_mapPanel;

		private static Bar s_zone;

		private static TMP_Text s_day;

		private static TMP_Text s_ringLine;

		private static float s_mapW;

		private static float s_mapH;

		private static FieldInfo s_zLevel;

		private static FieldInfo s_zKills;

		private static FieldInfo s_zPer;

		private static FieldInfo s_zStamp;

		private static bool s_zLooked;

		private static float s_hotW;

		private static float s_space;

		private static float s_bottom;

		private static HotkeyBar s_hb;

		private static bool s_aligned;

		private static RectTransform s_foodRow;

		private static bool s_foodPlaced;

		private static float s_rowLeft;

		private static float s_rowCy;

		private static HotkeyBar s_quick;

		private static bool s_quickLooked;

		internal static void Reset()
		{
			s_built = (s_mapBuilt = (s_aligned = (s_foodPlaced = (s_quickLooked = false))));
			s_hp = (s_eitr = null);
			s_stam = (s_zone = null);
			s_strip = (s_mapPanel = (s_foodRow = null));
			s_day = (s_ringLine = null);
			s_hb = (s_quick = null);
			Windows.Reset();
			Slots.Reset();
			Compass.Reset();
		}

		internal static void Build(Hud hud)
		{
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: 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_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: 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_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)hud == (Object)null || (Object)(object)hud.m_rootObject == (Object)null || (s_built && (Object)(object)s_strip != (Object)null && (Object)(object)((Component)s_strip).gameObject != (Object)null && (Object)(object)((Component)s_strip).transform.root == (Object)(object)((Component)hud).transform.root))
			{
				return;
			}
			Reset();
			s_built = true;
			try
			{
				Transform transform = hud.m_rootObject.transform;
				TMP_Text healthText = hud.m_healthText;
				HotkeyBar componentInChildren = hud.m_rootObject.GetComponentInChildren<HotkeyBar>(true);
				float sc = Plugin.Sc;
				float num = (((Object)(object)componentInChildren != (Object)null) ? HotbarSlotOr(componentInChildren.m_elementSpace) : 56f);
				s_hotW = num * 8f * sc;
				float value = Plugin.StripBottom.Value;
				s_space = num;
				s_bottom = value;
				s_hb = componentInChildren;
				if ((Object)(object)componentInChildren != (Object)null)
				{
					RectTransform component = ((Component)componentInChildren).GetComponent<RectTransform>();
					Plugin.Anchor(component, new Vector2(0.5f, 0f), new Vector2(0f, 0.5f), new Vector2((0f - s_hotW) / 2f + num * sc / 2f, value + num * sc / 2f));
					component.sizeDelta = new Vector2(num * 8f, num);
					((Transform)component).localScale = Vector3.one * sc;
				}
				s_strip = Plugin.Rt("VH_Strip", transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, value - 6f), new Vector2(s_hotW + 16f, num * sc + 12f));
				Plugin.Img(s_strip, "panel", Color.white, (Type)1);
				((Transform)s_strip).SetAsFirstSibling();
				s_stam = Bar.Make("VH_Stamina", transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, value + num * sc + 14f), s_hotW, 8f, Plugin.Yellow, Plugin.YellowDark, Plugin.Acc, healthText, "STAMINA");
				Plugin.Hide((Component)(object)hud.m_staminaBar2Root);
				float num2 = Plugin.OrbPx();
				float num3 = value + num * sc / 2f;
				s_hp = Orb.Make("VH_Health", transform, new Vector2((0f - s_hotW) / 2f - 14f - num2 * 0.61f, num3), num2, Plugin.HpTop, Plugin.HpBot, healthText);
				s_eitr = Orb.Make("VH_Eitr", transform, new Vector2(s_hotW / 2f + 14f + num2 * 0.61f, num3), num2, Plugin.EitrTop, Plugin.EitrBot, healthText);
				if ((Object)(object)hud.m_healthPanel != (Object)null)
				{
					Image[] components = ((Component)hud.m_healthPanel).GetComponents<Image>();
					for (int i = 0; i < components.Length; i++)
					{
						((Behaviour)components[i]).enabled = false;
					}
				}
				Plugin.Hide((Component)(object)hud.m_healthBarRoot);
				Plugin.Hide((Component)(object)hud.m_eitrBarRoot);
				float num4 = s_hotW / 2f + 14f + num2 * 1.22f + 12f;
				if ((Object)(object)hud.m_healthPanel != (Object)null)
				{
					Plugin.Anchor(hud.m_healthPanel, new Vector2(0.5f, 0f), new Vector2(0f, 0f), new Vector2(num4, value - 6f));
				}
				if ((Object)(object)hud.m_gpRoot != (Object)null)
				{
					((Transform)hud.m_gpRoot).SetParent(transform, false);
					((Transform)hud.m_gpRoot).localScale = Vector3.one * sc;
					Plugin.Anchor(hud.m_gpRoot, new Vector2(0.5f, 0f), new Vector2(0f, 0f), new Vector2(num4 + 150f, value - 6f));
				}
				if ((Object)(object)hud.m_buildHud != (Object)null)
				{
					RectTransform component2 = hud.m_buildHud.GetComponent<RectTransform>();
					if ((Object)(object)component2 != (Object)null)
					{
						Plugin.Anchor(component2, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, value + num + 44f));
					}
				}
				if (Plugin.MoveKeyHints.Value && (Object)(object)KeyHints.instance != (Object)null)
				{
					RectTransform component3 = ((Component)KeyHints.instance).GetComponent<RectTransform>();
					if ((Object)(object)component3 != (Object)null)
					{
						Plugin.Anchor(component3, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(Plugin.KeyHintsX.Value, Plugin.KeyHintsY.Value));
					}
				}
				Plugin.Log.LogInfo((object)("VargheimHUD strip built (hotbar " + s_hotW + ", orb " + num2 + ")."));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("VargheimHUD build failed: " + ex));
			}
		}

		private static float HotbarSlotOr(float game)
		{
			if (!(Plugin.HotbarSlot.Value > 0f))
			{
				return game;
			}
			return Plugin.HotbarSlot.Value;
		}

		internal static void BuildMap(Hud hud)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: 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_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: 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_0352: 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_038d: 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_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: 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_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0477: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			if (s_mapBuilt || !Plugin.MapPanel.Value)
			{
				return;
			}
			Minimap instance = Minimap.instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_smallRoot == (Object)null || (Object)(object)instance.m_mapImageSmall == (Object)null)
			{
				return;
			}
			s_mapBuilt = true;
			try
			{
				Transform parent = ((Transform)((Graphic)instance.m_mapImageSmall).rectTransform).parent;
				RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null);
				Rect rect = val.rect;
				float width = ((Rect)(ref rect)).width;
				rect = val.rect;
				float height = ((Rect)(ref rect)).height;
				if (val.anchorMin == val.anchorMax)
				{
					val.anchoredPosition += new Vector2(Plugin.MapOffsetX.Value, Plugin.MapOffsetY.Value);
					Vector2 pivot = val.pivot;
					s_mapPanel = Plugin.Rt("VH_MapPanel", ((Transform)val).parent, val.anchorMin, pivot, Vector2.zero, new Vector2(width + 16f, height + 82f));
					s_mapPanel.anchoredPosition = val.anchoredPosition + new Vector2((0f - (0.5f - pivot.x)) * 16f, -33f - (0.5f - pivot.y) * 82f);
					((Transform)s_mapPanel).SetSiblingIndex(Mathf.Max(0, ((Transform)val).GetSiblingIndex()));
				}
				else
				{
					s_mapPanel = Plugin.Rt("VH_MapPanel", (Transform)(object)val, Vector2.zero, new Vector2(0.5f, 0.5f), Vector2.zero, Vector2.zero);
					s_mapPanel.anchorMin = Vector2.zero;
					s_mapPanel.anchorMax = Vector2.one;
					s_mapPanel.offsetMin = new Vector2(-8f, -74f);
					s_mapPanel.offsetMax = new Vector2(8f, 8f);
					((Transform)s_mapPanel).SetAsFirstSibling();
				}
				Plugin.Img(s_mapPanel, "panel", Color.white, (Type)1);
				s_mapW = width;
				s_mapH = height;
				Image[] components = ((Component)val).GetComponents<Image>();
				for (int i = 0; i < components.Length; i++)
				{
					((Behaviour)components[i]).enabled = false;
				}
				components = ((Component)val).GetComponentsInChildren<Image>(true);
				foreach (Image val2 in components)
				{
					string text = ((Object)((Component)val2).gameObject).name.ToLowerInvariant();
					if (text.Contains("frame") || text.Contains("border"))
					{
						((Behaviour)val2).enabled = false;
					}
				}
				TMP_Text val3 = (((Object)(object)hud != (Object)null) ? hud.m_healthText : null);
				s_day = Plugin.Label("VH_Day", (Transform)(object)s_mapPanel, val3, 11f, Plugin.Mute, (TextAlignmentOptions)260, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(-8f, 56f), new Vector2(width, 14f));
				s_zone = Bar.Make("VH_Zone", (Transform)(object)s_mapPanel, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 24f), width - 8f, 6f, Plugin.Gold, new Color(0.59f, 0.44f, 0.19f), Plugin.Gold, val3, "ZONE");
				((Graphic)s_zone.LabelL).color = Plugin.Gold;
				s_ringLine = Plugin.Label("VH_Ring", (Transform)(object)s_mapPanel, val3, 9f, Plugin.Mute, (TextAlignmentOptions)514, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 8f), new Vector2(width, 12f));
				s_ringLine.characterSpacing = 6f;
				Plugin.Log.LogInfo((object)("VargheimHUD map: holder " + ((Object)val).name + " " + width + "x" + height + " anchors " + ((object)val.anchorMin/*cast due to .constrained prefix*/).ToString() + "/" + ((object)val.anchorMax/*cast due to .constrained prefix*/).ToString() + " pivot " + ((object)val.pivot/*cast due to .constrained prefix*/).ToString() + " pos " + ((object)val.anchoredPosition/*cast due to .constrained prefix*/).ToString() + " parent " + ((Object)((Transform)val).parent).name));
				if ((Object)(object)instance.m_biomeNameSmall != (Object)null)
				{
					instance.m_biomeNameSmall.fontSize = 12f;
					((Graphic)instance.m_biomeNameSmall).color = Plugin.Paper;
					instance.m_biomeNameSmall.characterSpacing = 6f;
					instance.m_biomeNameSmall.alignment = (TextAlignmentOptions)257;
					Plugin.Anchor(instance.m_biomeNameSmall.rectTransform, new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, -4f));
				}
				if ((Object)(object)hud != (Object)null && (Object)(object)hud.m_statusEffectListRoot != (Object)null)
				{
					RectTransform statusEffectListRoot = hud.m_statusEffectListRoot;
					Plugin.Anchor(statusEffectListRoot, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(0f - (width + 16f + 40f + 16f), -40f));
					((Transform)statusEffectListRoot).localScale = Vector3.one * Plugin.StatusScale.Value;
				}
				Compass.Build(((Object)(object)hud != (Object)null) ? hud.m_rootObject.transform : ((Transform)s_mapPanel).parent, val3);
				Plugin.Log.LogInfo((object)("VargheimHUD map panel built (" + width + "x" + height + ")."));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("VargheimHUD map panel failed: " + ex));
			}
		}

		private static void Align()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: 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_0244: 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_0262: 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_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: 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_032e: Unknown result type (might be due to invalid IL or missing references)
			s_aligned = true;
			try
			{
				RectTransform component = ((Component)s_hb).GetComponent<RectTransform>();
				Transform child = ((Component)s_hb).transform.GetChild(0);
				RectTransform val = (RectTransform)(object)((child is RectTransform) ? child : null);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				float sc = Plugin.Sc;
				float y = component.anchoredPosition.y;
				float y2 = ((Transform)val).localPosition.y;
				float num = 0.5f - val.pivot.y;
				Rect rect = val.rect;
				float num2 = y + (y2 + num * ((Rect)(ref rect)).height) * sc;
				float x = component.anchoredPosition.x;
				float x2 = ((Transform)val).localPosition.x;
				float num3 = 0.5f - val.pivot.x;
				rect = val.rect;
				float num4 = x + (x2 + num3 * ((Rect)(ref rect)).width) * sc;
				rect = val.rect;
				float num5 = ((Rect)(ref rect)).height * sc;
				rect = val.rect;
				float num6 = ((Rect)(ref rect)).width * sc;
				float num7 = num4 - num6 / 2f;
				float num8 = num7 + s_space * 7f * sc + num6;
				float num9 = (num7 + num8) / 2f;
				float num10 = num8 - num7;
				s_strip.anchoredPosition = new Vector2(num9, num2 - num5 / 2f - 6f);
				s_strip.sizeDelta = new Vector2(num10 + 16f, num5 + 12f);
				s_stam.Root.anchoredPosition = new Vector2(num9, num2 + num5 / 2f + 14f);
				s_stam.Root.sizeDelta = new Vector2(num10, 8f);
				float num11 = Plugin.OrbPx();
				s_hp.Root.anchoredPosition = new Vector2(num7 - 14f - num11 * 0.61f, num2);
				s_eitr.Root.anchoredPosition = new Vector2(num8 + 14f + num11 * 0.61f, num2);
				Hud instance = Hud.instance;
				if ((Object)(object)instance != (Object)null)
				{
					float value = Plugin.FoodSpacing.Value;
					int num12 = ((instance.m_foodIcons != null) ? instance.m_foodIcons.Length : 0);
					float num13 = ((num12 > 0) ? (value * (float)num12) : 0f);
					RectTransform val2 = Plugin.Rt("VH_FoodRow", ((Transform)s_strip).parent, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-32f, -400f), new Vector2(num13, num5 / sc));
					((Transform)val2).localScale = Vector3.one * sc;
					s_foodRow = val2;
					s_rowLeft = num7;
					s_rowCy = num2;
					for (int i = 0; i < num12; i++)
					{
						Image val3 = instance.m_foodIcons[i];
						if (!((Object)(object)val3 == (Object)null))
						{
							Transform parent = ((Component)val3).transform.parent;
							RectTransform val4 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
							if ((Object)(object)val4 == (Object)null || (Object)(object)val4 == (Object)(object)instance.m_healthPanel)
							{
								val4 = ((Graphic)val3).rectTransform;
							}
							((Transform)val4).SetParent((Transform)(object)val2, false);
							Plugin.Anchor(val4, new Vector2(0f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(value * ((float)i + 0.5f), 0f));
						}
					}
					float num14 = num8 + 14f + num11 * 1.22f + 12f;
					if ((Object)(object)instance.m_gpRoot != (Object)null)
					{
						instance.m_gpRoot.anchoredPosition = new Vector2(num14, num2 - num5 / 2f - 6f);
					}
					if ((Object)(object)instance.m_healthPanel != (Object)null)
					{
						Plugin.Hide((Component)(object)instance.m_healthPanel);
						instance.m_healthPanel.anchoredPosition = new Vector2(-4000f, 0f);
					}
					Plugin.Log.LogInfo((object)("VargheimHUD food row: " + num12 + " slots, parent of icon 0 = " + ((num12 > 0 && (Object)(object)instance.m_foodIcons[0] != (Object)null) ? ((Object)((Component)instance.m_foodIcons[0]).transform.parent).name : "-")));
				}
				Plugin.Log.LogInfo((object)("VargheimHUD aligned to slots: centre y " + num2 + ", slot " + num6 + "x" + num5 + ", row " + num7 + ".." + num8));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("VargheimHUD align: " + ex.Message));
			}
		}

		internal static void LateTick()
		{
			//IL_01f8: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			if (!s_aligned)
			{
				return;
			}
			if (!s_quickLooked)
			{
				Hud instance = Hud.instance;
				if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_rootObject == (Object)null)
				{
					return;
				}
				s_quickLooked = true;
				HotkeyBar[] componentsInChildren = instance.m_rootObject.GetComponentsInChildren<HotkeyBar>(true);
				foreach (HotkeyBar val in componentsInChildren)
				{
					if ((Object)(object)val != (Object)(object)s_hb)
					{
						s_quick = val;
						break;
					}
				}
				if ((Object)(object)s_quick == (Object)null)
				{
					componentsInChildren = Object.FindObjectsOfType<HotkeyBar>(true);
					foreach (HotkeyBar val2 in componentsInChildren)
					{
						if ((Object)(object)val2 != (Object)(object)s_hb)
						{
							s_quick = val2;
							break;
						}
					}
				}
				Plugin.Log.LogInfo((object)("VargheimHUD quick slots: " + (((Object)(object)s_quick != (Object)null) ? (((Object)((Component)s_quick).gameObject).name + " under " + ((Object)((Component)s_quick).transform.parent).name) : "not found")));
				if ((Object)(object)s_quick != (Object)null && (Object)(object)((Component)s_quick).transform.parent != (Object)(object)((Transform)s_strip).parent)
				{
					((Component)s_quick).transform.SetParent(((Transform)s_strip).parent, false);
				}
			}
			if (!((Object)(object)s_quick == (Object)null))
			{
				RectTransform component = ((Component)s_quick).GetComponent<RectTransform>();
				int num = Mathf.Max(1, ((Component)s_quick).transform.childCount);
				float sc = Plugin.Sc;
				float num2 = ((s_quick.m_elementSpace > 0f) ? s_quick.m_elementSpace : s_space) * sc;
				float num3 = Plugin.OrbPx();
				float num4 = s_rowLeft - 14f - num3 * 1.22f - 12f - Plugin.QuickGap.Value - (float)num * num2;
				Vector2 val3 = default(Vector2);
				((Vector2)(ref val3))..ctor(0.5f, 0f);
				component.anchorMax = val3;
				component.anchorMin = val3;
				component.pivot = new Vector2(0f, 0.5f);
				float num5 = 0f;
				RectTransform val4 = (RectTransform)((((Component)s_quick).transform.childCount > 0) ? /*isinst with value type is only supported in some contexts*/: null);
				if ((Object)(object)val4 != (Object)null)
				{
					float y = ((Transform)val4).localPosition.y;
					float num6 = 0.5f - val4.pivot.y;
					Rect rect = val4.rect;
					num5 = (y + num6 * ((Rect)(ref rect)).height) * sc;
				}
				component.anchoredPosition = new Vector2(num4 + num2 / 2f, s_rowCy - num5 + Plugin.QuickY.Value);
				((Transform)component).localScale = Vector3.one * sc;
			}
		}

		private static void TickMap()
		{
			if (!s_zLooked)
			{
				s_zLooked = true;
				Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
				foreach (Assembly assembly in assemblies)
				{
					if (!(assembly.GetName().Name != "VargheimZoneMeter"))
					{
						Type type = assembly.GetType("VargheimZoneMeter.Plugin");
						if (type == null)
						{
							break;
						}
						BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
						s_zLevel = type.GetField("s_level", bindingAttr);
						s_zKills = type.GetField("s_kills", bindingAttr);
						s_zPer = type.GetField("s_per", bindingAttr);
						s_zStamp = type.GetField("s_stamp", bindingAttr);
						FieldInfo field = type.GetField("Show", bindingAttr);
						ConfigEntry<bool> val = ((field != null) ? (field.GetValue(null) as ConfigEntry<bool>) : null);
						if (val != null)
						{
							val.Value = false;
						}
						Plugin.Log.LogInfo((object)("VargheimHUD: zone meter data hooked " + (s_zLevel != null)));
					}
				}
			}
			if ((Object)(object)EnvMan.instance != (Object)null && (Object)(object)s_day != (Object)null)
			{
				s_day.text = "DAY " + EnvMan.instance.GetDay() + (EnvMan.IsNight() ? "  ·  NIGHT" : "");
			}
			if (s_zone != null)
			{
				bool num = s_zLevel != null;
				int num2 = (num ? ((int)s_zLevel.GetValue(null)) : (-1));
				float num3 = ((num && s_zStamp != null) ? ((float)s_zStamp.GetValue(null)) : (-100f));
				bool flag = num && num2 >= 0 && Time.time - num3 < 30f;
				((Component)s_zone.Root).gameObject.SetActive(flag);
				if (flag)
				{
					int num4 = (int)s_zKills.GetValue(null);
					int num5 = Mathf.Max(1, (int)s_zPer.GetValue(null));
					int num6 = num4 % num5;
					s_zone.Set(num6, num5);
					s_zone.LabelL.text = "ZONE " + num2;
					s_ringLine.text = "RING " + RingOf(Player.m_localPlayer);
				}
				else
				{
					s_ringLine.text = "";
				}
			}
		}

		private static int RingOf(Player p)
		{
			//IL_0011: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)p == (Object)null)
			{
				return 0;
			}
			Vector2 val = new Vector2(((Component)p).transform.position.x, ((Component)p).transform.position.z);
			float magnitude = ((Vector2)(ref val)).magnitude;
			if (!(magnitude < 2000f))
			{
				return 1 + Mathf.FloorToInt((magnitude - 2000f) / 1000f);
			}
			return 0;
		}

		internal static void Tick(Hud hud)
		{
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null || s_hp == null || (Object)(object)s_hp.Root == (Object)null || (Object)(object)s_hp.Surface == (Object)null || s_stam == null || (Object)(object)s_stam.Root == (Object)null)
			{
				return;
			}
			float size = Plugin.OrbPx();
			s_hp.Set(((Character)localPlayer).GetHealth(), ((Character)localPlayer).GetMaxHealth(), size);
			s_stam.Set(localPlayer.GetStamina(), ((Character)localPlayer).GetMaxStamina());
			bool flag = !Hud.IsUserHidden() && !Minimap.IsOpen();
			bool flag2 = ((Character)localPlayer).GetMaxEitr() > 0f && flag;
			if (((Component)s_eitr.Root).gameObject.activeSelf != flag2)
			{
				((Component)s_eitr.Root).gameObject.SetActive(flag2);
			}
			if (flag2)
			{
				s_eitr.Set(localPlayer.GetEitr(), ((Character)localPlayer).GetMaxEitr(), size);
			}
			if ((Object)(object)s_mapPanel != (Object)null)
			{
				TickMap();
				Compass.Tick();
			}
			if (!s_aligned && (Object)(object)s_hb != (Object)null && ((Component)s_hb).transform.childCount > 0)
			{
				Align();
			}
			if (s_aligned && (Object)(object)s_foodRow != (Object)null && !s_foodPlaced && (Object)(object)s_mapPanel != (Object)null)
			{
				s_foodPlaced = true;
				s_foodRow.anchoredPosition = new Vector2(-48f + Plugin.MapOffsetX.Value, 0f - (40f + s_mapH + 74f + 12f) + Plugin.MapOffsetY.Value);
			}
			if (((Component)s_strip).gameObject.activeSelf != flag)
			{
				((Component)s_strip).gameObject.SetActive(flag);
				((Component)s_hp.Root).gameObject.SetActive(flag);
				((Component)s_stam.Root).gameObject.SetActive(flag);
				if ((Object)(object)s_mapPanel != (Object)null)
				{
					((Component)s_mapPanel).gameObject.SetActive(flag);
				}
				Compass.SetShown(flag);
				if ((Object)(object)s_foodRow != (Object)null)
				{
					((Component)s_foodRow).gameObject.SetActive(flag);
				}
			}
		}
	}
	internal static class Patches
	{
		[HarmonyPatch(typeof(Hud), "Awake")]
		[HarmonyPostfix]
		private static void Awake(Hud __instance)
		{
			Skin.Build(__instance);
		}

		[HarmonyPatch(typeof(MessageHud), "Awake")]
		[HarmonyPostfix]
		private static void MessageAwake(MessageHud __instance)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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)
			try
			{
				if (!((Object)(object)__instance.m_messageText == (Object)null))
				{
					RectTransform rectTransform = __instance.m_messageText.rectTransform;
					RectTransform val = (RectTransform)(((Object)(object)((Transform)rectTransform).parent != (Object)null && (Object)(object)__instance.m_messageIcon != (Object)null && (Object)(object)((Component)__instance.m_messageIcon).transform.parent == (Object)(object)((Transform)rectTransform).parent && (Object)(object)((Transform)rectTransform).parent != (Object)(object)((Component)__instance).transform) ? ((object)/*isinst with value type is only supported in some contexts*/) : ((object)rectTransform));
					Plugin.Anchor(val, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(Plugin.MessageX.Value, Plugin.MessageY.Value));
					float num = 0f;
					Vector2 anchorMin;
					if ((Object)(object)val != (Object)(object)rectTransform && (Object)(object)__instance.m_messageIcon != (Object)null)
					{
						RectTransform rectTransform2 = ((Graphic)__instance.m_messageIcon).rectTransform;
						anchorMin = (rectTransform2.anchorMax = new Vector2(0f, 0.5f));
						rectTransform2.anchorMin = anchorMin;
						rectTransform2.pivot = new Vector2(0f, 0.5f);
						rectTransform2.anchoredPosition = Vector2.zero;
						num = rectTransform2.sizeDelta.x + 8f;
					}
					anchorMin = (rectTransform.anchorMax = new Vector2(0f, 0.5f));
					rectTransform.anchorMin = anchorMin;
					rectTransform.pivot = new Vector2(0f, 0.5f);
					rectTransform.anchoredPosition = new Vector2(num, 0f);
					rectTransform.sizeDelta = new Vector2(640f, 60f);
					__instance.m_messageText.enableWordWrapping = true;
					__instance.m_messageText.overflowMode = (TextOverflowModes)0;
					__instance.m_messageText.alignment = (TextAlignmentOptions)513;
					__instance.m_messageText.fontSize = 20f;
					__instance.m_messageText.outlineWidth = 0.25f;
					__instance.m_messageText.outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)230);
					Plugin.Log.LogInfo((object)("VargheimHUD: message text moved (" + ((Object)val).name + ")."));
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("VargheimHUD message: " + ex.Message));
			}
		}

		[HarmonyPatch(typeof(Hud), "Update")]
		[HarmonyPostfix]
		private static void Update(Hud __instance)
		{
			Skin.BuildMap(__instance);
			Skin.Tick(__instance);
		}
	}
	internal static class Compass
	{
		private class Marker
		{
			public RectTransform Root;

			public Image Icon;

			public TMP_Text Dist;

			public float Seen;
		}

		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<bool> ShowPins;

		internal static ConfigEntry<bool> ShowPlayers;

		internal static ConfigEntry<bool> ShowDegrees;

		internal static ConfigEntry<float> Height;

		internal static ConfigEntry<float> Width;

		internal static ConfigEntry<float> TopOffset;

		internal static ConfigEntry<float> PinRange;

		internal static ConfigEntry<float> NearLabel;

		internal static ConfigEntry<float> TickEvery;

		internal static ConfigEntry<float> MarkerSize;

		internal static ConfigEntry<float> Spread;

		private static RectTransform s_strip;

		private static RectTransform s_inner;

		private static TMP_Text s_degrees;

		private static TMP_Text s_tpl;

		private static readonly List<RectTransform> s_cards = new List<RectTransform>();

		private static readonly List<float> s_cardAngle = new List<float>();

		private static readonly List<RectTransform> s_ticks = new List<RectTransform>();

		private static readonly List<float> s_tickAngle = new List<float>();

		private static readonly Dictionary<object, Marker> s_markers = new Dictionary<object, Marker>();

		private static readonly List<object> s_dead = new List<object>();

		private static float s_w;

		private static float s_h;

		private static MethodInfo s_playerColor;

		private static bool s_looked;

		private static FieldInfo s_pinsField;

		private static FieldInfo s_playerPinsField;

		internal static void Bind(ConfigFile cfg)
		{
			Enabled = cfg.Bind<bool>("Compass", "Enabled", true, "Compass strip at the top centre of the screen.");
			Width = cfg.Bind<float>("Compass", "Width", 560f, "Strip width.");
			TopOffset = cfg.Bind<float>("Compass", "TopOffset", 12f, "Gap between the top of the screen and the strip.");
			Height = cfg.Bind<float>("Compass", "Height", 30f, "Strip height (needs ~30 for the distance labels under markers).");
			Spread = cfg.Bind<float>("Compass", "Spread", 180f, "Degrees of heading shown across the strip (180 = ±90°).");
			TickEvery = cfg.Bind<float>("Compass", "TickEvery", 15f, "Minor tick spacing in degrees (0 = none).");
			ShowDegrees = cfg.Bind<bool>("Compass", "Degrees", false, "Show the heading in degrees under the centre mark.");
			ShowPins = cfg.Bind<bool>("Compass", "Pins", true, "Show your own map pins on the strip.");
			ShowPlayers = cfg.Bind<bool>("Compass", "Players", true, "Show other players on the strip, in their map colours.");
			PinRange = cfg.Bind<float>("Compass", "PinRange", 650f, "Pins further than this (m) are not shown; players always are.");
			NearLabel = cfg.Bind<float>("Compass", "NearLabel", 80f, "Markers closer than this (m) show their distance.");
			MarkerSize = cfg.Bind<float>("Compass", "MarkerSize", 14f, "Marker icon size.");
		}

		internal static void Reset()
		{
			s_strip = (s_inner = null);
			s_degrees = null;
			s_cards.Clear();
			s_cardAngle.Clear();
			s_ticks.Clear();
			s_tickAngle.Clear();
			s_markers.Clear();
		}

		internal static void Build(Transform root, TMP_Text tpl)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0099: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: 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_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled.Value || (Object)(object)root == (Object)null)
			{
				return;
			}
			try
			{
				s_tpl = tpl;
				s_w = Width.Value;
				s_h = Height.Value;
				float num = s_w;
				s_strip = Plugin.Rt("VH_Compass", root, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, 0f - TopOffset.Value), new Vector2(num, s_h));
				Plugin.Img(s_strip, "panel", Color.white, (Type)1);
				s_inner = Plugin.Rt("clip", (Transform)(object)s_strip, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(num - 8f, s_h - 4f));
				((Component)s_inner).gameObject.AddComponent<RectMask2D>();
				Plugin.Img(Plugin.Rt("centre", (Transform)(object)s_strip, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -1f), new Vector2(2f, 6f)), "cap", Plugin.Gold, (Type)0).sprite = null;
				string[] array = new string[8] { "N", "NE", "E", "SE", "S", "SW", "W", "NW" };
				for (int i = 0; i < 8; i++)
				{
					bool flag = i % 2 == 0;
					TMP_Text val = Plugin.Label("c" + array[i], (Transform)(object)s_inner, tpl, flag ? 11f : 8f, flag ? Plugin.Paper : Plugin.Mute, (TextAlignmentOptions)514, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(28f, s_h));
					val.text = array[i];
					val.characterSpacing = 2f;
					if (i == 0)
					{
						((Graphic)val).color = Plugin.Gold;
					}
					s_cards.Add(val.rectTransform);
					s_cardAngle.Add((float)i * 45f);
				}
				float value = TickEvery.Value;
				if (value >= 5f)
				{
					for (float num2 = 0f; num2 < 360f; num2 += value)
					{
						if (!(Mathf.Abs(Mathf.Repeat(num2, 45f)) < 0.01f))
						{
							RectTransform val2 = Plugin.Rt("t", (Transform)(object)s_inner, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 2f), new Vector2(1f, 4f));
							Image obj = ((Component)val2).gameObject.AddComponent<Image>();
							((Graphic)obj).color = new Color(0.6f, 0.66f, 0.71f, 0.5f);
							((Graphic)obj).raycastTarget = false;
							s_ticks.Add(val2);
							s_tickAngle.Add(num2);
						}
					}
				}
				if (ShowDegrees.Value)
				{
					s_degrees = Plugin.Label("deg", (Transform)(object)s_strip, tpl, 9f, Plugin.Mute, (TextAlignmentOptions)514, new Vector2(0.5f, 0f), new Vector2(0.5f, 1f), new Vector2(0f, -1f), new Vector2(40f, 12f));
				}
				Plugin.Log.LogInfo((object)("VargheimHUD compass built (" + num + "x" + s_h + ")."));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("VargheimHUD compass: " + ex));
				s_strip = null;
			}
		}

		private static float Heading()
		{
			//IL_0015: 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)
			GameCamera instance = GameCamera.instance;
			if ((Object)(object)instance != (Object)null)
			{
				return ((Component)instance).transform.eulerAngles.y;
			}
			Player localPlayer = Player.m_localPlayer;
			if (!((Object)(object)localPlayer != (Object)null))
			{
				return 0f;
			}
			return ((Component)localPlayer).transform.eulerAngles.y;
		}

		private static float Delta(float a, float b)
		{
			return Mathf.Repeat(a - b + 180f, 360f) - 180f;
		}

		internal static void SetShown(bool shown)
		{
			if ((Object)(object)s_strip != (Object)null && ((Component)s_strip).gameObject.activeSelf != shown)
			{
				((Component)s_strip).gameObject.SetActive(shown);
			}
		}

		internal static void Tick()
		{
			if ((Object)(object)s_strip == (Object)null || (Object)(object)s_inner == (Object)null || !((Component)s_strip).gameObject.activeSelf)
			{
				return;
			}
			try
			{
				float num = Heading();
				float num2 = Mathf.Max(30f, Spread.Value) / 2f;
				float ppd = (s_w - 8f) / (num2 * 2f);
				for (int i = 0; i < s_cards.Count; i++)
				{
					Place(s_cards[i], Delta(s_cardAngle[i], num), num2, ppd, 0f);
				}
				for (int j = 0; j < s_ticks.Count; j++)
				{
					Place(s_ticks[j], Delta(s_tickAngle[j], num), num2, ppd, 0f);
				}
				if ((Object)(object)s_degrees != (Object)null)
				{
					s_degrees.text = Mathf.RoundToInt(Mathf.Repeat(num, 360f)) + "°";
				}
				Markers(num, num2, ppd);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("VargheimHUD compass tick: " + ex.Message));
			}
		}

		private static void Place(RectTransform rt, float delta, float half, float ppd, float y)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Mathf.Abs(delta) <= half + 4f;
			if (((Component)rt).gameObject.activeSelf != flag)
			{
				((Component)rt).gameObject.SetActive(flag);
			}
			if (flag)
			{
				rt.anchoredPosition = new Vector2(delta * ppd, y);
			}
		}

		private static void Look()
		{
			if (!s_looked)
			{
				s_looked = true;
				s_pinsField = AccessTools.Field(typeof(Minimap), "m_pins");
				s_playerPinsField = AccessTools.Field(typeof(Minimap), "m_playerPins");
				Type type = AccessTools.TypeByName("VargheimPins.Players");
				if (type != null)
				{
					s_playerColor = AccessTools.Method(type, "Of", (Type[])null, (Type[])null);
				}
				Plugin.Log.LogInfo((object)("VargheimHUD compass: pins field " + (s_pinsField != null) + ", player colours " + (s_playerColor != null)));
			}
		}

		private static Color PlayerColor(string name)
		{
			//IL_002d: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (s_playerColor != null)
			{
				try
				{
					return (Color)s_playerColor.Invoke(null, new object[1] { name });
				}
				catch
				{
				}
			}
			return Plugin.Acc;
		}

		private static void Markers(float heading, float half, float ppd)
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Invalid comparison between Unknown and I4
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: 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_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_030f: 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_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: 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)
			Look();
			Minimap instance = Minimap.instance;
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)instance == (Object)null || (Object)(object)localPlayer == (Object)null || s_pinsField == null)
			{
				return;
			}
			float time = Time.time;
			Vector3 position = ((Component)localPlayer).transform.position;
			float value = MarkerSize.Value;
			float value2 = PinRange.Value;
			float value3 = NearLabel.Value;
			if (s_pinsField.GetValue(instance) is List<PinData> list)
			{
				for (int i = 0; i < list.Count; i++)
				{
					PinData val = list[i];
					if (val == null)
					{
						continue;
					}
					bool flag = (int)val.m_type == 10;
					bool flag2 = (int)val.m_type == 12 || (int)val.m_type == 7;
					bool flag3 = (int)val.m_type == 4;
					bool flag4 = val.m_ownerID == 0L && val.m_save && !flag && !flag2 && !flag3;
					if ((flag && !ShowPlayers.Value) || (flag4 && !ShowPins.Value) || !(flag || flag2 || flag3 || flag4))
					{
						continue;
					}
					Vector3 val2 = val.m_pos - position;
					Vector2 val3 = new Vector2(val2.x, val2.z);
					float magnitude = ((Vector2)(ref val3)).magnitude;
					if ((flag4 && magnitude > value2) || magnitude < 2f)
					{
						continue;
					}
					float num = Delta(Mathf.Atan2(val2.x, val2.z) * 57.29578f, heading);
					if (!(Mathf.Abs(num) > half + 2f))
					{
						if (!s_markers.TryGetValue(val, out var value4))
						{
							value4 = new Marker();
							value4.Root = Plugin.Rt("m", (Transform)(object)s_inner, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(value, value));
							value4.Icon = Plugin.Img(value4.Root, "cap", Color.white, (Type)0);
							value4.Icon.preserveAspect = true;
							value4.Dist = Plugin.Label("d", (Transform)(object)value4.Root, s_tpl, 7f, Plugin.Mute, (TextAlignmentOptions)514, new Vector2(0.5f, 0f), new Vector2(0.5f, 1f), new Vector2(0f, 1f), new Vector2(60f, 9f));
							s_markers[val] = value4;
						}
						value4.Seen = time;
						if ((Object)(object)val.m_icon != (Object)null && (Object)(object)value4.Icon.sprite != (Object)(object)val.m_icon)
						{
							value4.Icon.sprite = val.m_icon;
						}
						Color color = (flag ? PlayerColor(val.m_name) : (flag2 ? Plugin.Yellow : (flag3 ? Plugin.HpTop : Plugin.Paper)));
						((Graphic)value4.Icon).color = color;
						bool flag5 = magnitude <= value3 || flag;
						((Behaviour)value4.Dist).enabled = flag5;
						if (flag5)
						{
							value4.Dist.text = Mathf.RoundToInt(magnitude) + "m";
							((Graphic)value4.Dist).color = color;
						}
						Place(value4.Root, num, half, ppd, flag ? 7f : 5f);
					}
				}
			}
			s_dead.Clear();
			foreach (KeyValuePair<object, Marker> s_marker in s_markers)
			{
				if (time - s_marker.Value.Seen > 0.5f)
				{
					s_dead.Add(s_marker.Key);
				}
			}
			for (int j = 0; j < s_dead.Count; j++)
			{
				Marker marker = s_markers[s_dead[j]];
				if ((Object)(object)marker.Root != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)marker.Root).gameObject);
				}
				s_markers.Remove(s_dead[j]);
			}
		}
	}
	internal static class Slots
	{
		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<string> Sprites;

		internal static ConfigEntry<float> Alpha;

		private static readonly HashSet<int> s_done = new HashSet<int>();

		private static readonly Dictionary<int, int> s_counts = new Dictionary<int, int>();

		private static string[] s_pat;

		private static string s_patFor;

		internal static void Reset()
		{
			s_done.Clear();
			s_counts.Clear();
		}

		internal static void Bind(ConfigFile cfg)
		{
			Enabled = cfg.Bind<bool>("Slots", "Enabled", true, "Draw hotbar, quick-slot and inventory slot frames with the HUD's slot sprite instead of the vanilla one.");
			Sprites = cfg.Bind<string>("Slots", "Sprites", "item_background", "Vanilla sprite names that are slot backgrounds, separated by ','. A trailing * matches a prefix.");
			Alpha = cfg.Bind<float>("Slots", "Alpha", 1f, "Opacity of the slot frames.");
		}

		private static bool Match(string name)
		{
			string[] array;
			if ((object)Sprites.Value != s_patFor)
			{
				s_patFor = Sprites.Value;
				List<string> list = new List<string>();
				array = (s_patFor ?? "").Split(',');
				for (int i = 0; i < array.Length; i++)
				{
					string text = array[i].Trim();
					if (text.Length > 0)
					{
						list.Add(text);
					}
				}
				s_pat = list.ToArray();
			}
			array = s_pat;
			foreach (string text2 in array)
			{
				if (text2.EndsWith("*", StringComparison.Ordinal))
				{
					if (name.StartsWith(text2.Substring(0, text2.Length - 1), StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
				}
				else if (string.Equals(name, text2, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		internal static void Restyle(Component root)
		{
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled.Value || (Object)(object)root == (Object)null || !Plugin.S.ContainsKey("slot"))
			{
				return;
			}
			try
			{
				int instanceID = ((Object)root).GetInstanceID();
				int childCount = root.transform.childCount;
				if (s_counts.TryGetValue(instanceID, out var value) && value == childCount)
				{
					return;
				}
				s_counts[instanceID] = childCount;
				Image[] componentsInChildren = root.GetComponentsInChildren<Image>(true);
				foreach (Image val in componentsInChildren)
				{
					if (!((Object)(object)val == (Object)null) && !((Object)(object)val.sprite == (Object)null))
					{
						int instanceID2 = ((Object)val).GetInstanceID();
						if (!s_done.Contains(instanceID2) && Match(((Object)val.sprite).name))
						{
							val.sprite = Plugin.S["slot"];
							val.type = (Type)1;
							val.pixelsPerUnitMultiplier = 1f;
							((Graphic)val).color = new Color(1f, 1f, 1f, Mathf.Clamp01(Alpha.Value));
							s_done.Add(instanceID2);
						}
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("VargheimHUD slots: " + ex.Message));
			}
		}
	}
	[HarmonyPatch]
	internal static class SlotPatches
	{
		[HarmonyPatch(typeof(HotkeyBar), "UpdateIcons")]
		[HarmonyPostfix]
		private static void Hotkey(HotkeyBar __instance)
		{
			Slots.Restyle((Component)(object)__instance);
		}

		[HarmonyPatch(typeof(InventoryGrid), "UpdateGui")]
		[HarmonyPostfix]
		private static void Grid(InventoryGrid __instance)
		{
			Slots.Restyle((Component)(object)__instance);
		}
	}
	internal static class Windows
	{
		internal static ConfigEntry<bool> Enabled;

		internal static ConfigEntry<bool> Dump;

		internal static ConfigEntry<string> Patterns;

		internal static ConfigEntry<string> Skip;

		internal static ConfigEntry<float> Alpha;

		private static readonly HashSet<int> s_done = new HashSet<int>();

		private static readonly HashSet<int> s_dumped = new HashSet<int>();

		private static string[] s_pat;

		private static string[] s_skip;

		private static string s_patFor;

		private static string s_skipFor;

		internal static void Reset()
		{
			s_done.Clear();
			s_dumped.Clear();
		}

		internal static void Bind(ConfigFile cfg)
		{
			Enabled = cfg.Bind<bool>("Windows", "Enabled", true, "Swap the wood-panel backgrounds of inventory, chest, crafting, skills, compendium, trophies, trader, build menu and map windows for the glass panel.");
			Patterns = cfg.Bind<string>("Windows", "Sprites", "woodpanel*,panel_interior_bkg*", "Vanilla sprite names to replace, separated by ','. A trailing * matches a prefix. Use [Windows] DumpSprites to see what a window uses.");
			Skip = cfg.Bind<string>("Windows", "SkipSprites", "*_mask", "Sprite names never to touch (same syntax; a leading * matches a suffix). The vanilla *_mask sprites are the gamepad selection highlights.");
			Alpha = cfg.Bind<float>("Windows", "Alpha", 1f, "Opacity of the swapped backgrounds (1 = solid glass, lower to see the world through them).");
			Dump = cfg.Bind<bool>("Windows", "DumpSprites", false, "Write every sprite name used by each window to the log once (for tuning Sprites).");
		}

		private static string[] Parse(string v)
		{
			List<string> list = new List<string>();
			string[] array = (v ?? "").Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.Length > 0)
				{
					list.Add(text);
				}
			}
			return list.ToArray();
		}

		private static bool Match(string name, string[] pats)
		{
			foreach (string text in pats)
			{
				if (text.EndsWith("*", StringComparison.Ordinal))
				{
					if (name.StartsWith(text.Substring(0, text.Length - 1), StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
				}
				else if (text.StartsWith("*", StringComparison.Ordinal))
				{
					if (name.EndsWith(text.Substring(1), StringComparison.OrdinalIgnoreCase))
					{
						return true;
					}
				}
				else if (string.Equals(name, text, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		internal static void Restyle(Component root, string why, bool swap = true)
		{
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0165: 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)
			if (!Enabled.Value || (Object)(object)root == (Object)null || !Plugin.S.ContainsKey("window"))
			{
				return;
			}
			try
			{
				if ((object)Patterns.Value != s_patFor)
				{
					s_patFor = Patterns.Value;
					s_pat = Parse(s_patFor);
				}
				if ((object)Skip.Value != s_skipFor)
				{
					s_skipFor = Skip.Value;
					s_skip = Parse(s_skipFor);
				}
				Image[] componentsInChildren = root.GetComponentsInChildren<Image>(true);
				int num = 0;
				Dictionary<string, string> dictionary = ((Dump.Value && s_dumped.Add(((Object)root).GetInstanceID())) ? new Dictionary<string, string>() : null);
				Image[] array = componentsInChildren;
				foreach (Image val in array)
				{
					if ((Object)(object)val == (Object)null || (Object)(object)val.sprite == (Object)null)
					{
						continue;
					}
					string name = ((Object)val.sprite).name;
					if (dictionary != null && !dictionary.ContainsKey(name))
					{
						string[] obj = new string[5]
						{
							Path(((Component)val).transform, root.transform),
							" ",
							null,
							null,
							null
						};
						Rect rect = ((Graphic)val).rectTransform.rect;
						obj[2] = Mathf.RoundToInt(((Rect)(ref rect)).width).ToString();
						obj[3] = "x";
						rect = ((Graphic)val).rectTransform.rect;
						obj[4] = Mathf.RoundToInt(((Rect)(ref rect)).height).ToString();
						dictionary[name] = string.Concat(obj);
					}
					if (swap)
					{
						int instanceID = ((Object)val).GetInstanceID();
						if (!s_done.Contains(instanceID) && Match(name, s_pat) && (s_skip.Length == 0 || !Match(name, s_skip)))
						{
							val.sprite = Plugin.S["window"];
							val.type = (Type)1;
							val.pixelsPerUnitMultiplier = 1f;
							((Graphic)val).color = new Color(1f, 1f, 1f, Mathf.Clamp01(Alpha.Value));
							s_done.Add(instanceID);
							num++;
						}
					}
				}
				if (num > 0)
				{
					Plugin.Log.LogInfo((object)("VargheimHUD windows: " + num + " panels swapped (" + why + ")."));
				}
				if (dictionary == null)
				{
					return;
				}
				List<string> list = new List<string>();
				foreach (KeyValuePair<string, string> item in dictionary)
				{
					list.Add(item.Key + " @ " + item.Value);
				}
				list.Sort();
				Plugin.Log.LogInfo((object)("VargheimHUD sprites in " + why + " (" + list.Count + "):\n  " + string.Join("\n  ", list.ToArray())));
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("VargheimHUD windows (" + why + "): " + ex.Message));
			}
		}

		private static string Path(Transform t, Transform stop)
		{
			string text = ((Object)t).name;
			int num = 0;
			while ((Object)(object)t.parent != (Object)null && (Object)(object)t.parent != (Object)(object)stop && num++ < 12)
			{
				t = t.parent;
				text = ((Object)t).name + "/" + text;
			}
			return text;
		}
	}
	[HarmonyPatch]
	internal static class WindowPatches
	{
		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		[HarmonyPostfix]
		private static void InvAwake(InventoryGui __instance)
		{
			Windows.Restyle((Component)(object)__instance, "InventoryGui");
		}

		[HarmonyPatch(typeof(InventoryGui), "Show")]
		[HarmonyPostfix]
		private static void InvShow(InventoryGui __instance)
		{
			Windows.Restyle((Component)(object)__instance, "InventoryGui.Show");
		}

		[HarmonyPatch(typeof(StoreGui), "Awake")]
		[HarmonyPostfix]
		private static void StoreAwake(StoreGui __instance)
		{
			Windows.Restyle((Component)(object)__instance, "StoreGui");
		}

		[HarmonyPatch(typeof(Hud), "Awake")]
		[HarmonyPostfix]
		private static void HudAwake(Hud __instance)
		{
			if ((Object)(object)__instance.m_pieceSelectionWindow != (Object)null)
			{
				Windows.Restyle((Component)(object)__instance.m_pieceSelectionWindow.transform, "BuildMenu");
			}
			if ((Object)(object)__instance.m_rootObject != (Object)null)
			{
				Windows.Restyle((Component)(object)__instance.m_rootObject.transform, "Hud (dump only)", swap: false);
			}
		}

		[HarmonyPatch(typeof(Minimap), "Awake")]
		[HarmonyPostfix]
		private static void MapAwake(Minimap __instance)
		{
			if ((Object)(object)__instance.m_largeRoot != (Object)null)
			{
				Windows.Restyle((Component)(object)__instance.m_largeRoot.transform, "LargeMap");
			}
		}
	}
}