Decompiled source of ImprovedUI v1.2.1

ImprovedUI.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using HG;
using HG.Reflection;
using On.RoR2;
using On.RoR2.Networking;
using On.RoR2.UI;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Networking;
using RoR2.Skills;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using SimpleJSON;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ImprovedUI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ImprovedUI")]
[assembly: AssemblyTitle("ImprovedUI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ImprovedUI;

internal class BuffTimer : NetworkBehaviour
{
	private BuffDisplay display;

	private BuffIcon buffIcon;

	public HGTextMeshProUGUI countdown;

	public Image fill;

	private TimedBuff timedBuff;

	private float duration;

	private void Awake()
	{
		buffIcon = ((Component)this).GetComponent<BuffIcon>();
	}

	private void Start()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		display = ((Component)this).GetComponentInParent<BuffDisplay>();
		if (!Object.op_Implicit((Object)(object)display.source))
		{
			return;
		}
		fill.sprite = buffIcon.iconImage.sprite;
		((Component)fill).transform.localPosition = Vector3.zero;
		((TMP_Text)countdown).transform.localPosition = new Vector3(25f, 65f, 0f);
		foreach (TimedBuff timedBuff in display.source.timedBuffs)
		{
			if (timedBuff.buffIndex == buffIcon.buffDef.buffIndex)
			{
				this.timedBuff = timedBuff;
				duration = this.timedBuff.timer;
				break;
			}
		}
	}

	private void Update()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		if (timedBuff != null && timedBuff.timer > 0f)
		{
			if (Object.op_Implicit((Object)(object)fill))
			{
				((Component)fill).transform.localPosition = Vector3.zero;
				fill.fillAmount = Mathf.Clamp01((duration - timedBuff.timer) / duration);
			}
			if (Object.op_Implicit((Object)(object)countdown))
			{
				double num = Math.Round(timedBuff.timer, 2);
				((TMP_Text)countdown).text = ((num > 0.0) ? (num + "s") : "");
			}
		}
		else
		{
			if (!Object.op_Implicit((Object)(object)display) || !Object.op_Implicit((Object)(object)display.source))
			{
				return;
			}
			float num2 = 0f;
			foreach (TimedBuff timedBuff in display.source.timedBuffs)
			{
				if (timedBuff.buffIndex == buffIcon.buffDef.buffIndex && timedBuff.timer > 0f && num2 < timedBuff.timer)
				{
					num2 = timedBuff.timer;
					this.timedBuff = timedBuff;
				}
			}
			duration = num2;
		}
	}
}
internal class Command : MonoBehaviour
{
}
internal class CustomHUDBehaviour : MonoBehaviour
{
	public List<GameObject> objectsToEnable = new List<GameObject>();

	public List<GameObject> draggableElements = new List<GameObject>();

	public HUD HUD;

	public GameObject hudScale;

	private GameObject InfoBar;

	private GameObject ClassicRunInfoHudPanel;

	public GameObject lineX;

	public bool draggingX;

	public GameObject lineY;

	public bool draggingY;

	public GameObject gridRoot;

	public bool axisLock;

	public bool snapping;

	public float snapScale = 1f;

	public TMP_Dropdown dropdown;

	public TMP_InputField presetName;

	public HGButton add;

	public HGButton cancel;

	public HGButton delete;

	public HGButton save;

	private bool delayedLoad;

	private float delayedLoadTimer;

	public float delayedLoadDelay = 1f;

	private void Start()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Expected O, but got Unknown
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		((UnityEvent)((Button)((Component)add).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(NewPreset));
		((UnityEvent)((Button)((Component)cancel).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(LoadPreset));
		((UnityEvent)((Button)((Component)delete).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(DeletePreset));
		((UnityEvent)((Button)((Component)save).GetComponent<HGButton>()).onClick).AddListener(new UnityAction(SaveHUDData));
		((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)ChangePreset);
		((UnityEvent<string>)(object)presetName.onValueChanged).AddListener((UnityAction<string>)RenamePreset);
		UpdateInputBox(Configs.hudData.defaultPreset, sendCallBack: false);
	}

	private void OnDestroy()
	{
		((UnityEventBase)((Button)((Component)add).GetComponent<HGButton>()).onClick).RemoveAllListeners();
		((UnityEventBase)((Button)((Component)cancel).GetComponent<HGButton>()).onClick).RemoveAllListeners();
		((UnityEventBase)((Button)((Component)delete).GetComponent<HGButton>()).onClick).RemoveAllListeners();
		((UnityEventBase)((Button)((Component)save).GetComponent<HGButton>()).onClick).RemoveAllListeners();
		((UnityEventBase)dropdown.onValueChanged).RemoveAllListeners();
		((UnityEventBase)presetName.onValueChanged).RemoveAllListeners();
	}

	private void Update()
	{
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: 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_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_05db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Expected O, but got Unknown
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: 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_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0344: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0404: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0483: Unknown result type (might be due to invalid IL or missing references)
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_04be: Unknown result type (might be due to invalid IL or missing references)
		//IL_054a: Unknown result type (might be due to invalid IL or missing references)
		//IL_054f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0520: Unknown result type (might be due to invalid IL or missing references)
		//IL_0525: Unknown result type (might be due to invalid IL or missing references)
		//IL_0536: Unknown result type (might be due to invalid IL or missing references)
		if (delayedLoad)
		{
			delayedLoadTimer += Time.deltaTime;
			if (delayedLoadTimer >= delayedLoadDelay)
			{
				delayedLoadTimer = 0f;
				delayedLoad = false;
				Debug.LogWarning((object)"delay load");
				if (!Configs.ResetHUDData)
				{
				}
				if (MainPlugin.debug && Configs.ResetHUDData)
				{
					Configs.hudData.presets.Clear();
					string name = "Default";
					HUDData.PresetData presetData = new HUDData.PresetData(name);
					foreach (GameObject draggableElement in draggableElements)
					{
						DraggableUI component = draggableElement.GetComponent<DraggableUI>();
						Vector3 position = ((Component)component.target).transform.position;
						Quaternion rotation = ((Component)component.target).transform.rotation;
						Vector3 localScale = ((Component)component.target).transform.localScale;
						presetData.AddTransformData(new HUDData.TransformData(((Object)draggableElement).name, new Vector3(position.x, position.y, position.z), new Vector3(rotation.x, rotation.y, rotation.z), localScale.x));
					}
					Configs.hudData.presets.Add(presetData);
					Configs.hudData.defaultPreset = presetData.name;
					SaveHUDData();
				}
			}
		}
		if (Input.GetKeyDown(Configs.GridToggleKey.Value))
		{
			gridRoot.SetActive(!gridRoot.activeInHierarchy);
		}
		if (Input.GetKeyDown(Configs.AxisLockKey.Value))
		{
			axisLock = axisLock;
		}
		if (Input.GetKeyDown(Configs.SnappingToggleKey.Value))
		{
			snapping = snapping;
		}
		if (Input.GetKeyDown(Configs.IncreaseSnap.Value) || Input.GetAxis("Mouse ScrollWheel") > 0f)
		{
		}
		if (Input.GetKeyDown(Configs.DecreaseSnap.Value) || Input.GetAxis("Mouse ScrollWheel") > 0f)
		{
		}
		lineX.SetActive(draggingX);
		lineY.SetActive(draggingY);
		if (!Object.op_Implicit((Object)(object)InfoBar) && Object.op_Implicit((Object)(object)HUD) && Object.op_Implicit((Object)(object)HUD.gameModeUiInstance))
		{
			Transform val = HUD.gameModeUiInstance.GetComponent<ChildLocator>().FindChild("RightInfoBar");
			val.SetParent(HUD.gameModeUiInstance.transform.parent);
			RectTransform val2 = (RectTransform)((Component)val).transform;
			Vector3 localPosition = ((Component)val2).transform.localPosition;
			((Component)val2).transform.localPosition = new Vector3(localPosition.x, -116f, localPosition.z);
			val2.sizeDelta = new Vector2(34f, val2.sizeDelta.y);
			InfoBar = Prefabs.NewDraggableElement("RightInfoBar", ((Component)this).transform, HUD.canvas, val, new Vector2(165f, 355f));
			draggableElements.Add(InfoBar);
			ClassicRunInfoHudPanel = Prefabs.NewDraggableElement("ClassicRunInfoHudPanel", ((Component)this).transform, HUD.canvas, HUD.gameModeUiInstance.transform, new Vector2(260f, 115f));
			draggableElements.Add(ClassicRunInfoHudPanel);
			((RectTransform)ClassicRunInfoHudPanel.transform).pivot = Vector2.one * 0.75f;
			objectsToEnable.AddRange(draggableElements);
			foreach (GameObject draggableElement2 in draggableElements)
			{
				draggableElement2.GetComponent<DraggableUI>().Start();
			}
			int num = 0;
			Resolution currentResolution;
			while (true)
			{
				int num2 = num;
				currentResolution = Screen.currentResolution;
				if (num2 >= ((Resolution)(ref currentResolution)).width / 5)
				{
					break;
				}
				Transform transform = Prefabs.NewGuideline(gridRoot.transform, Color.black * 0.5f, 0.005f, (SnapAxis)2, setActive: true).transform;
				Vector3 right = Vector3.right;
				currentResolution = Screen.currentResolution;
				transform.localPosition = right * (float)(-((Resolution)(ref currentResolution)).width + num * 10);
				num++;
			}
			int num3 = 0;
			while (true)
			{
				int num4 = num3;
				currentResolution = Screen.currentResolution;
				if (num4 >= ((Resolution)(ref currentResolution)).height / 5)
				{
					break;
				}
				Transform transform2 = Prefabs.NewGuideline(gridRoot.transform, Color.black * 0.5f, 0.005f, (SnapAxis)1, setActive: true).transform;
				Vector3 up = Vector3.up;
				currentResolution = Screen.currentResolution;
				transform2.localPosition = up * (float)(-((Resolution)(ref currentResolution)).height + num3 * 10);
				num3++;
			}
			UpdateDropdown(resetIndex: false, Configs.hudData.presets.IndexOf(Configs.hudData.presets.Find((HUDData.PresetData x) => x.name == Configs.hudData.defaultPreset)));
			if (!Configs.ResetHUDData)
			{
				LoadPreset();
			}
			else if (MainPlugin.debug)
			{
				delayedLoad = true;
			}
		}
		if (!Input.GetKeyDown(Configs.HUDToggleKey.Value))
		{
			return;
		}
		foreach (GameObject item in objectsToEnable)
		{
			item.SetActive(!item.activeInHierarchy);
		}
	}

	private void UpdateDropdown(bool resetIndex = false, int setIndex = 0, bool callBack = false)
	{
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"UpdateDropdown");
		}
		dropdown.ClearOptions();
		List<string> list = new List<string>();
		foreach (HUDData.PresetData preset in Configs.hudData.presets)
		{
			list.Add(preset.name);
		}
		dropdown.AddOptions(list);
		if (setIndex != 0)
		{
			dropdown.SetValue(setIndex, callBack);
		}
		UpdateInputBox(Configs.hudData.defaultPreset);
		if (resetIndex)
		{
			dropdown.SetValue(0, false);
		}
	}

	private void UpdateInputBox(string s, bool sendCallBack = true)
	{
		presetName.SetText(s, sendCallBack);
	}

	public void ChangePreset(int index)
	{
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"ChangePreset");
		}
		Configs.hudData.defaultPreset = Configs.hudData.presets.ElementAt(index).name;
		LoadPreset();
		UpdateInputBox(Configs.hudData.defaultPreset);
	}

	public void SetDefaultPreset()
	{
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"SetDefaultPreset");
		}
		HUDData.PresetData presetDataByName = Configs.hudData.GetPresetDataByName(Configs.hudData.defaultPreset);
		Configs.hudData.defaultPreset = presetDataByName.name;
		UpdateDropdown();
	}

	public void DeletePreset()
	{
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"DeletePreset");
		}
		if (!(Configs.hudData.defaultPreset == "Default"))
		{
			HUDData.PresetData presetDataByName = Configs.hudData.GetPresetDataByName(Configs.hudData.defaultPreset);
			Configs.hudData.presets.Remove(presetDataByName);
			Configs.hudData.defaultPreset = "Default";
			LoadPreset();
			UpdateDropdown(resetIndex: true);
		}
	}

	public void RenamePreset(string s)
	{
		if (!(Configs.hudData.defaultPreset == "Default"))
		{
			if (MainPlugin.debug)
			{
				Debug.LogWarning((object)"RenamePreset");
			}
			int value = dropdown.value;
			HUDData.PresetData presetDataByName = Configs.hudData.GetPresetDataByName(Configs.hudData.defaultPreset);
			presetDataByName.name = s;
			Configs.hudData.defaultPreset = s;
			dropdown.options[value].text = s;
			Configs.hudData.GetPresetDataByName(Configs.hudData.defaultPreset).name = s;
		}
	}

	public void LoadPreset()
	{
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: 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)
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"LoadPreset");
		}
		HUDData.PresetData presetDataByName = Configs.hudData.GetPresetDataByName(Configs.hudData.defaultPreset);
		foreach (GameObject draggableElement in draggableElements)
		{
			DraggableUI component = draggableElement.GetComponent<DraggableUI>();
			HUDData.TransformData transformDataByName = presetDataByName.GetTransformDataByName(((Object)draggableElement).name);
			if (transformDataByName != null && Object.op_Implicit((Object)(object)component))
			{
				draggableElement.transform.position = transformDataByName.position;
				draggableElement.transform.rotation = Quaternion.Euler(transformDataByName.rotation);
				draggableElement.transform.localScale = Vector3.one * transformDataByName.scale;
				((Component)component.target).transform.position = draggableElement.transform.position;
				((Component)component.target).transform.rotation = draggableElement.transform.rotation;
				((Component)component.target).transform.localScale = draggableElement.transform.localScale;
			}
		}
	}

	public void NewPreset()
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"NewPreset");
		}
		string text = "NewPreset" + Configs.hudData.presets.Count;
		HUDData.PresetData presetData = new HUDData.PresetData(text);
		foreach (GameObject draggableElement in draggableElements)
		{
			Vector3 position = draggableElement.transform.position;
			Quaternion rotation = draggableElement.transform.rotation;
			Vector3 localScale = draggableElement.transform.localScale;
			presetData.AddTransformData(new HUDData.TransformData(((Object)draggableElement).name, new Vector3(position.x, position.y, position.z), new Vector3(rotation.x, rotation.y, rotation.z), localScale.x));
		}
		Configs.hudData.presets.Add(presetData);
		Configs.hudData.defaultPreset = presetData.name;
		dropdown.AddOptions(new List<string> { presetData.name });
		dropdown.SetValue(dropdown.value + 1, false);
		UpdateInputBox(text, sendCallBack: false);
		SaveHUDData();
	}

	public void SaveHUDData()
	{
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)"SaveHUDData");
		}
		Configs.hudData.SaveHUDData();
	}
}
internal class DPSBehaviour : MonoBehaviour
{
	public RectTransform stupidShit;

	public HGTextMeshProUGUI text;

	public HUD hud;

	private float dps;

	private float damageCache;

	private long time;

	private long oldTime;

	private long lastCachedTime;

	private long lastResetTime;

	private void OnEnable()
	{
		GlobalEventManager.onClientDamageNotified += GlobalEventManager_onClientDamageNotified;
	}

	private void GlobalEventManager_onClientDamageNotified(DamageDealtMessage message)
	{
		CharacterBody val = (Object.op_Implicit((Object)(object)message.attacker) ? message.attacker.GetComponent<CharacterBody>() : null);
		CharacterMaster val2 = (Object.op_Implicit((Object)(object)val) ? val.master : null);
		if ((Object)(object)message.attacker == (Object)(object)hud.targetBodyObject || (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.minionOwnership) && Object.op_Implicit((Object)(object)val2.minionOwnership.ownerMaster) && val2.minionOwnership.ownerMaster.hasBody && (Object)(object)((Component)val2.minionOwnership.ownerMaster.GetBody()).gameObject == (Object)(object)hud.targetBodyObject))
		{
			damageCache += message.damage;
			lastCachedTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
		}
	}

	private void Update()
	{
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: 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)
		if ((Object)(object)Run.instance == (Object)null || Time.timeScale == 0f)
		{
			return;
		}
		time = DateTimeOffset.Now.ToUnixTimeMilliseconds();
		if ((float)(time - oldTime) > Configs.DPSRefreshTimer.Value)
		{
			if ((float)(time - lastCachedTime) > Configs.DPSResetTimer.Value)
			{
				damageCache = 0f;
				lastResetTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
			}
			dps = damageCache / ((float)(time - lastResetTime) * Time.timeScale / 1000f);
			oldTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
			double num = Math.Round(dps);
			((TMP_Text)text).text = (float.IsNaN((float)num) ? "0" : num.ToString());
		}
		if (Util.HasEffectiveAuthority(((Component)this).gameObject) && Input.GetKeyDown(Configs.DPSRefreshKey.Value))
		{
			damageCache = 0f;
			lastResetTime = DateTimeOffset.Now.ToUnixTimeMilliseconds();
		}
		if (Object.op_Implicit((Object)(object)stupidShit) && !(stupidShit.sizeDelta != new Vector2(201f, 127f)))
		{
		}
	}

	private void OnDisable()
	{
		GlobalEventManager.onClientDamageNotified -= GlobalEventManager_onClientDamageNotified;
	}
}
internal class DraggUI : MonoBehaviour, IDragHandler, IEventSystemHandler
{
	public RectTransform canvasRectTransform;

	public Transform target;

	private Vector2 pointerOffset;

	private RectTransform panelRectTransform;

	private HUDScaleController scale;

	private bool clampedToLeft;

	private bool clampedToRight;

	private bool clampedToTop;

	private bool clampedToBottom;

	private void Start()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_0040: 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)
		((Component)this).transform.position = target.position;
		scale = ((Component)target).GetComponent<HUDScaleController>();
		panelRectTransform = (RectTransform)((Component)this).transform;
		((Transform)panelRectTransform).localScale = Vector3.one;
		((Transform)panelRectTransform).localRotation = ((Component)target).transform.localRotation;
	}

	public void OnBeginDrag(PointerEventData eventData)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		((Transform)panelRectTransform).SetAsLastSibling();
		RectTransformUtility.ScreenPointToLocalPointInRectangle(panelRectTransform, eventData.position, eventData.pressEventCamera, ref pointerOffset);
	}

	public void OnDrag(PointerEventData eventData)
	{
		//IL_002b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_0232: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		Vector2 val = default(Vector2);
		if (Object.op_Implicit((Object)(object)canvasRectTransform) && Object.op_Implicit((Object)(object)panelRectTransform) && RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRectTransform, eventData.position, eventData.pressEventCamera, ref val))
		{
			((Transform)panelRectTransform).localPosition = new Vector3(val.x, val.y, ((Component)this).transform.localPosition.z) - new Vector3(pointerOffset.x, pointerOffset.y);
			ClampToWindow();
			Vector2 val2 = Vector2.op_Implicit(((Transform)panelRectTransform).localPosition);
			Rect rect;
			if (clampedToRight)
			{
				rect = canvasRectTransform.rect;
				float num = ((Rect)(ref rect)).width * 0.5f;
				rect = panelRectTransform.rect;
				val2.x = num - ((Rect)(ref rect)).width * (1f - panelRectTransform.pivot.x);
			}
			else if (clampedToLeft)
			{
				rect = canvasRectTransform.rect;
				float num2 = (0f - ((Rect)(ref rect)).width) * 0.5f;
				rect = panelRectTransform.rect;
				val2.x = num2 + ((Rect)(ref rect)).width * panelRectTransform.pivot.x;
			}
			if (clampedToTop)
			{
				rect = canvasRectTransform.rect;
				float num3 = ((Rect)(ref rect)).height * 0.5f;
				rect = panelRectTransform.rect;
				val2.y = num3 - ((Rect)(ref rect)).height * (1f - panelRectTransform.pivot.y);
			}
			else if (clampedToBottom)
			{
				rect = canvasRectTransform.rect;
				float num4 = (0f - ((Rect)(ref rect)).height) * 0.5f;
				rect = panelRectTransform.rect;
				val2.y = num4 + ((Rect)(ref rect)).height * panelRectTransform.pivot.y;
			}
			((Transform)panelRectTransform).localPosition = new Vector3(val2.x, val2.y, ((Transform)panelRectTransform).localPosition.z);
		}
	}

	private void ClampToWindow()
	{
		Vector3[] array = (Vector3[])(object)new Vector3[4];
		Vector3[] array2 = (Vector3[])(object)new Vector3[4];
		canvasRectTransform.GetWorldCorners(array);
		panelRectTransform.GetWorldCorners(array2);
		if (array2[2].x > array[2].x)
		{
			if (!clampedToRight)
			{
				clampedToRight = true;
			}
		}
		else if (clampedToRight)
		{
			clampedToRight = false;
		}
		else if (array2[0].x < array[0].x)
		{
			if (!clampedToLeft)
			{
				clampedToLeft = true;
			}
		}
		else if (clampedToLeft)
		{
			clampedToLeft = false;
		}
		if (array2[2].y > array[2].y)
		{
			if (!clampedToTop)
			{
				clampedToTop = true;
			}
		}
		else if (clampedToTop)
		{
			clampedToTop = false;
		}
		else if (array2[0].y < array[0].y)
		{
			if (!clampedToBottom)
			{
				clampedToBottom = true;
			}
		}
		else if (clampedToBottom)
		{
			clampedToBottom = false;
		}
	}
}
internal class DraggableUI : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler
{
	public TMP_InputField[] inputs;

	public RectTransform canvasRectTransform;

	public Transform target;

	public RectTransform targetRect;

	private Vector2 pointerOffset;

	private RectTransform panelRectTransform;

	public CustomHUDBehaviour behaviour;

	public Vector3 presetPosition = Vector3.zero;

	public float presetScale = 1f;

	public Vector3 presetRotation = Vector3.zero;

	private Vector2 startingPointerPosition;

	private Vector3 startingPosition;

	private Vector3 pointerStartingPosition;

	private bool lockedY;

	private bool lockedX;

	private bool axisLock;

	private Vector3[] panelRectCorners = (Vector3[])(object)new Vector3[4];

	public float scaleCornerRadius = 12f;

	private Vector3 startSize;

	private Vector2 previousPointerPosition;

	private bool scale;

	public float sizePerDistance = 0.002f;

	public GameObject windowTransforms;

	private void OnEnable()
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < inputs.Length; i++)
		{
			Vector3 val;
			switch (i)
			{
			case 0:
			{
				TMP_InputField obj4 = inputs[i];
				val = ((Component)this).transform.position;
				obj4.text = val.x.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)1);
				});
				break;
			}
			case 1:
			{
				TMP_InputField obj3 = inputs[i];
				val = ((Component)this).transform.position;
				obj3.text = val.y.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)2);
				});
				break;
			}
			case 2:
			{
				TMP_InputField obj2 = inputs[i];
				val = ((Component)this).transform.position;
				obj2.text = val.z.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)4);
				});
				break;
			}
			case 3:
				inputs[i].text = ((Component)this).transform.rotation.x.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)1, position: false);
				});
				break;
			case 4:
				inputs[i].text = ((Component)this).transform.rotation.y.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)2, position: false);
				});
				break;
			case 5:
				inputs[i].text = ((Component)this).transform.rotation.z.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)4, position: false);
				});
				break;
			case 6:
			{
				TMP_InputField obj = inputs[i];
				val = ((Component)this).transform.localScale;
				obj.text = ((Vector3)(ref val)).magnitude.ToString();
				((UnityEvent<string>)(object)inputs[i].onValueChanged).AddListener((UnityAction<string>)delegate(string s)
				{
					UpdateTransforms(s, (SnapAxis)0);
				});
				break;
			}
			}
		}
	}

	private void OnDisable()
	{
		for (int i = 0; i < inputs.Length; i++)
		{
			((UnityEventBase)inputs[i].onValueChanged).RemoveAllListeners();
		}
	}

	public void Start()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0061: Expected O, but got Unknown
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		((Component)this).transform.position = target.position;
		((Component)this).transform.rotation = ((Component)target).transform.rotation;
		((Component)this).transform.localScale = ((Component)target).transform.localScale;
		targetRect = (RectTransform)target;
		panelRectTransform = (RectTransform)((Component)this).transform;
	}

	public void UpdateTransforms(string s, SnapAxis axis, bool position = true)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected I4, but got Unknown
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: 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)
		if (MainPlugin.debug)
		{
			Debug.LogWarning((object)s);
			Debug.LogWarning((object)("axis: " + ((object)(SnapAxis)(ref axis)).ToString()));
		}
		if (Utility.IsNullOrWhiteSpace(s))
		{
			return;
		}
		float num = 1f;
		TextSerialization.TryParseInvariant(s, ref num);
		Vector3 position2 = ((Component)this).transform.position;
		Quaternion rotation = ((Component)this).transform.rotation;
		SnapAxis val = axis;
		SnapAxis val2 = val;
		switch ((int)val2)
		{
		case 1:
			if (position)
			{
				((Component)this).transform.position = new Vector3(num, position2.y, position2.z);
			}
			else
			{
				((Component)this).transform.rotation = Quaternion.Euler(new Vector3(num, rotation.y, rotation.z));
			}
			break;
		case 2:
			if (position)
			{
				((Component)this).transform.position = new Vector3(position2.x, num, position2.z);
			}
			else
			{
				((Component)this).transform.rotation = Quaternion.Euler(new Vector3(rotation.x, num, rotation.z));
			}
			break;
		case 4:
			if (position)
			{
				((Component)this).transform.position = new Vector3(position2.x, position2.y, num);
			}
			else
			{
				((Component)this).transform.rotation = Quaternion.Euler(new Vector3(rotation.x, rotation.y, num));
			}
			break;
		case 0:
			((Component)this).transform.localScale = Vector3.one * num;
			break;
		case 3:
			break;
		}
	}

	public void OnBeginDrag(PointerEventData eventData)
	{
		//IL_0003: 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_002e: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: 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_00b8: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: 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_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		startingPointerPosition = eventData.position;
		lockedY = false;
		lockedX = false;
		((Transform)panelRectTransform).SetAsLastSibling();
		RectTransformUtility.ScreenPointToLocalPointInRectangle(panelRectTransform, eventData.position, eventData.pressEventCamera, ref pointerOffset);
		previousPointerPosition = eventData.position;
		panelRectTransform.GetLocalCorners(panelRectCorners);
		for (int i = 0; i < panelRectCorners.Length; i++)
		{
			if (Vector2.Distance(Vector2.op_Implicit(panelRectCorners[i]), pointerOffset) <= scaleCornerRadius)
			{
				scale = true;
				break;
			}
		}
		startSize = ((Component)this).transform.localScale;
		startingPosition = ((Transform)panelRectTransform).localPosition;
		behaviour.lineX.transform.position = new Vector3(0f, ((Transform)panelRectTransform).position.y, ((Transform)panelRectTransform).position.z);
		behaviour.lineY.transform.position = new Vector3(((Transform)panelRectTransform).position.x, 0f, ((Transform)panelRectTransform).position.z);
		pointerStartingPosition = Vector2.op_Implicit(eventData.position);
	}

	public void OnEndDrag(PointerEventData eventData)
	{
		lockedY = false;
		lockedX = false;
		behaviour.draggingX = false;
		behaviour.draggingY = false;
		scale = false;
		UpdateTexts();
		UpdatePreset();
	}

	public void OnDrag(PointerEventData eventData)
	{
		//IL_0018: 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_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: 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_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: 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_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: 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_01dd: 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)
		if (Input.GetKeyDown((KeyCode)324))
		{
		}
		Vector2 val = default(Vector2);
		bool flag = RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRectTransform, eventData.position, eventData.pressEventCamera, ref val);
		if (scale)
		{
			float num = eventData.position.x - previousPointerPosition.x;
			float num2 = num * sizePerDistance;
			((Component)this).transform.localScale = startSize * (1f + num2);
		}
		else
		{
			if (axisLock)
			{
				float num3 = Mathf.Abs(pointerStartingPosition.x - eventData.position.x);
				float num4 = Mathf.Abs(pointerStartingPosition.y - eventData.position.y);
				lockedX = num3 > num4;
				lockedY = num3 < num4;
				behaviour.draggingX = lockedX;
				behaviour.draggingY = lockedY;
			}
			else
			{
				lockedY = false;
				lockedX = false;
				behaviour.draggingX = false;
				behaviour.draggingY = false;
			}
			if (Object.op_Implicit((Object)(object)canvasRectTransform) && Object.op_Implicit((Object)(object)panelRectTransform))
			{
				if (flag)
				{
					Vector3 val2 = Vector2.op_Implicit(val - pointerOffset);
					if (lockedX)
					{
						((Vector3)(ref val2))..ctor(val2.x, startingPosition.y, startingPosition.z);
					}
					else if (lockedY)
					{
						((Vector3)(ref val2))..ctor(startingPosition.x, val2.y, startingPosition.z);
					}
					((Transform)panelRectTransform).localPosition = val2;
				}
				if (behaviour.axisLock)
				{
					Vector3 position = ((Component)this).transform.position;
					((Component)this).transform.position = new Vector3(Mathf.Round(position.x * behaviour.snapScale), Mathf.Round(position.y * behaviour.snapScale), position.z);
				}
			}
		}
		UpdateTexts();
	}

	private void UpdateTexts(bool callBack = false)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		for (int i = 0; i < inputs.Length; i++)
		{
			switch (i)
			{
			case 0:
				inputs[i].SetText(((Component)this).transform.position.x.ToString(), callBack);
				break;
			case 1:
				inputs[i].SetText(((Component)this).transform.position.y.ToString(), callBack);
				break;
			case 2:
				inputs[i].SetText(((Component)this).transform.position.z.ToString(), callBack);
				break;
			case 3:
				inputs[i].SetText(((Component)this).transform.rotation.x.ToString(), callBack);
				break;
			case 4:
				inputs[i].SetText(((Component)this).transform.rotation.y.ToString(), callBack);
				break;
			case 5:
				inputs[i].SetText(((Component)this).transform.rotation.z.ToString(), callBack);
				break;
			case 6:
				inputs[i].SetText(((Component)this).transform.localScale.x.ToString(), callBack);
				break;
			}
		}
	}

	private void UpdatePreset()
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		if (!(Configs.hudData.defaultPreset == "Default"))
		{
			HUDData.PresetData presetDataByName = Configs.hudData.GetPresetDataByName(Configs.hudData.defaultPreset);
			HUDData.TransformData transformDataByName = presetDataByName.GetTransformDataByName(((Object)this).name);
			if (transformDataByName != null)
			{
				transformDataByName.position = ((Component)this).transform.position;
				Quaternion rotation = ((Component)this).transform.rotation;
				transformDataByName.rotation = ((Quaternion)(ref rotation)).eulerAngles;
				transformDataByName.scale = ((Component)this).transform.localScale.x;
			}
		}
	}

	private void Update()
	{
		//IL_0007: 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_0069: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		axisLock = Input.GetKey(Configs.AxisLockKey.Value);
		if (Input.GetKeyDown(Configs.ShowTransforms.Value))
		{
			windowTransforms.SetActive(!windowTransforms.activeInHierarchy);
			UpdateTexts();
		}
		if (Object.op_Implicit((Object)(object)target))
		{
			target.position = ((Component)this).transform.position;
			target.rotation = ((Component)this).transform.rotation;
			target.localScale = ((Component)this).transform.localScale;
		}
	}
}
internal class Dropdown : TMP_Dropdown
{
	public override GameObject CreateBlocker(Canvas rootCanvas)
	{
		return null;
	}
}
[Serializable]
internal class TransformInputValidator : TMP_InputValidator
{
	public override char Validate(ref string text, ref int pos, char ch)
	{
		if (char.IsNumber(ch) || ch == '-' || ch == '.')
		{
			text += ch;
			pos++;
			return ch;
		}
		return '\0';
	}

	private long ConvertToInt(string inputText)
	{
		StringBuilder stringBuilder = new StringBuilder();
		foreach (char c in inputText)
		{
			if (char.IsDigit(c))
			{
				stringBuilder.Append(c);
			}
		}
		return long.Parse(stringBuilder.ToString());
	}

	public static TransformInputValidator NewValidator()
	{
		return ScriptableObject.CreateInstance<TransformInputValidator>();
	}
}
internal class ItemCountBehaviour : MonoBehaviour
{
	private HGTextMeshProUGUI text;

	public ScoreboardStrip scoreboard;

	private Inventory inventory;

	public readonly string count = "<color=#FFFFFF>{0}</color> <color=#77FF17>{1}</color> <color=#E7543A>{2}</color> <color=#FFEB04>{3}</color> <color=#307FFF>{4}</color> <color=#ED7FCD>{5}</color> <color=#FF8000>{6}</color>";

	private void OnEnable()
	{
		if (!Object.op_Implicit((Object)(object)text))
		{
			text = ((Component)this).GetComponent<HGTextMeshProUGUI>();
		}
		if (!Object.op_Implicit((Object)(object)inventory) && Object.op_Implicit((Object)(object)scoreboard) && Object.op_Implicit((Object)(object)scoreboard.itemInventoryDisplay))
		{
			inventory = scoreboard.itemInventoryDisplay.inventory;
		}
		UpdateCounters();
		Inventory.onInventoryChangedGlobal += Inventory_onInventoryChangedGlobal;
	}

	private void OnDisable()
	{
		Inventory.onInventoryChangedGlobal -= Inventory_onInventoryChangedGlobal;
	}

	private string ToString(int i)
	{
		string text = i.ToString();
		return (i <= 0) ? text : ((i < 10) ? ("0" + text) : text);
	}

	private void UpdateCounters()
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected I4, but got Unknown
		if (!Object.op_Implicit((Object)(object)inventory) || !Object.op_Implicit((Object)(object)text))
		{
			return;
		}
		int num = 0;
		int num2 = 0;
		int num3 = 0;
		int num4 = 0;
		int num5 = 0;
		int num6 = 0;
		int num7 = 0;
		Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				ItemDef current = enumerator.Current;
				int itemCount = inventory.GetItemCount(current.itemIndex);
				ItemTier tier = current.tier;
				ItemTier val = tier;
				switch ((int)val)
				{
				case 0:
					num += itemCount;
					break;
				case 1:
					num2 += itemCount;
					break;
				case 2:
					num3 += itemCount;
					break;
				case 4:
					num4 += itemCount;
					break;
				case 3:
					num5 += itemCount;
					break;
				case 6:
				case 7:
				case 8:
				case 9:
					num6 += itemCount;
					break;
				case 10:
					num7 += itemCount;
					break;
				}
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		string[] array = new string[7]
		{
			ToString(num),
			ToString(num2),
			ToString(num3),
			ToString(num4),
			ToString(num5),
			ToString(num6),
			ToString(num7)
		};
		HGTextMeshProUGUI obj = text;
		string format = count;
		object[] args = array;
		((TMP_Text)obj).text = string.Format(format, args);
	}

	private void Inventory_onInventoryChangedGlobal(Inventory inv)
	{
		if ((Object)(object)inv == (Object)(object)inventory)
		{
			UpdateCounters();
		}
	}
}
internal class MultiKillTracker : MonoBehaviour
{
	private CharacterMaster master;

	private CharacterBody body;

	public int multiKillCount;

	private void Start()
	{
		master = ((Component)this).GetComponent<CharacterMaster>();
	}

	private void Update()
	{
		if (!Object.op_Implicit((Object)(object)body) && master.hasBody)
		{
			body = master.GetBody();
		}
		else
		{
			multiKillCount = Math.Max(multiKillCount, body.multiKillCount);
		}
	}
}
internal class StatPanelBehaviour : MonoBehaviour
{
	public HUD HUD;

	private bool added;

	public CharacterBody targetBody;

	public HGTextMeshProUGUI targetText;

	public GameObject label;

	public GameObject statStrip;

	public MultiKillTracker tracker;

	private string stats => "Max HP: " + Math.Max(0f, targetBody.healthComponent.fullHealth) + Environment.NewLine + "Full HP: " + Math.Max(0f, targetBody.healthComponent.fullCombinedHealth) + Environment.NewLine + "Regen: " + targetBody.regen + Environment.NewLine + "Damage: " + targetBody.damage + Environment.NewLine + "Atk Speed: " + targetBody.attackSpeed + Environment.NewLine + "Crit: " + targetBody.crit + Environment.NewLine + "Crit Damage: " + targetBody.critMultiplier + "x" + Environment.NewLine + "Speed: " + Math.Round(((Vector3)(ref targetBody.characterMotor.velocity)).magnitude, 1) + Environment.NewLine + "Armor: " + targetBody.armor + Environment.NewLine + "Shield: " + targetBody.healthComponent.shield + Environment.NewLine + "Barrier: " + Mathf.CeilToInt(targetBody.healthComponent.barrier) + Environment.NewLine + "Jumps: " + (targetBody.maxJumpCount - targetBody.characterMotor.jumpCount) + Environment.NewLine + "Multi Kill Count: " + targetBody.multiKillCount + Environment.NewLine + "Highest Multi Kill: " + tracker.multiKillCount + Environment.NewLine + "Elite Status: " + targetBody.GetEliteBuff() + Environment.NewLine + Environment.NewLine;

	private void Awake()
	{
		HUD = ((Component)this).GetComponent<HUD>();
	}

	private void OnDisable()
	{
		if (Object.op_Implicit((Object)(object)targetText))
		{
			Object.Destroy((Object)(object)((Component)((TMP_Text)targetText).transform.parent).gameObject);
		}
		if (Object.op_Implicit((Object)(object)label))
		{
			Object.Destroy((Object)(object)label);
		}
		Object.Destroy((Object)(object)this);
	}

	private void Update()
	{
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		if (Configs.enableScoreboardStats.Value && Object.op_Implicit((Object)(object)HUD) && Object.op_Implicit((Object)(object)HUD.scoreboardPanel) && Object.op_Implicit((Object)(object)label) && Object.op_Implicit((Object)(object)statStrip))
		{
			bool activeInHierarchy = HUD.scoreboardPanel.activeInHierarchy;
			label.SetActive(activeInHierarchy);
			statStrip.SetActive(activeInHierarchy);
		}
		if (!added && Object.op_Implicit((Object)(object)HUD) && Object.op_Implicit((Object)(object)HUD.targetBodyObject) && Object.op_Implicit((Object)(object)HUD.gameModeUiInstance))
		{
			added = true;
			targetBody = HUD.targetBodyObject.GetComponentInChildren<CharacterBody>();
			tracker = targetBody.masterObject.AddComponent<MultiKillTracker>();
			ObjectivePanelController componentInChildren = HUD.gameModeUiInstance.GetComponentInChildren<ObjectivePanelController>();
			GameObject gameObject = ((Component)((Component)componentInChildren).GetComponentInChildren<LabelSkinController>()).gameObject;
			label = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
			label.transform.localPosition = Vector3.zero;
			label.transform.SetAsFirstSibling();
			label.GetComponent<LanguageTextMeshController>().token = Language.GetString(targetBody.baseNameToken) + " " + Language.GetString("STAT_TITLE") + ":";
			GameObject objectiveTrackerPrefab = componentInChildren.objectiveTrackerPrefab;
			if (Object.op_Implicit((Object)(object)objectiveTrackerPrefab))
			{
				Transform parent = objectiveTrackerPrefab.transform.parent;
				statStrip = Object.Instantiate<GameObject>(objectiveTrackerPrefab, parent);
				statStrip.SetActive(true);
				statStrip.transform.localPosition = Vector3.zero;
				((Component)statStrip.transform.GetChild(0)).gameObject.SetActive(false);
				statStrip.transform.SetAsLastSibling();
				targetText = statStrip.GetComponentInChildren<HGTextMeshProUGUI>();
				((TMP_Text)targetText).fontSize = 14f;
				((TMP_Text)targetText).alignment = (TextAlignmentOptions)513;
				gameObject.transform.SetParent(parent);
			}
		}
		else if (Object.op_Implicit((Object)(object)targetText) && Object.op_Implicit((Object)(object)targetBody) && Object.op_Implicit((Object)(object)tracker))
		{
			if (Object.op_Implicit((Object)(object)label) && label.transform.GetSiblingIndex() != 0)
			{
				label.transform.SetSiblingIndex(0);
			}
			if (((TMP_Text)targetText).transform.parent.GetSiblingIndex() != 1)
			{
				((TMP_Text)targetText).transform.parent.SetSiblingIndex(1);
			}
			((TMP_Text)targetText).text = stats;
		}
	}
}
internal class Configs
{
	internal static ConfigFile config;

	internal static HUDData hudData;

	internal static string jsonFilePath;

	internal static readonly bool ResetHUDData;

	internal static ConfigEntry<bool> enableTooltipImprovements;

	internal static ConfigEntry<bool> enableBodyStats;

	internal static ConfigEntry<bool> enableCommandImprovements;

	internal static ConfigEntry<bool> enableMenuPause;

	internal static ConfigEntry<bool> enableBuffTimer;

	internal static ConfigEntry<bool> enableItemCounter;

	internal static ConfigEntry<bool> enableDPS;

	internal static ConfigEntry<float> DPSResetTimer;

	internal static ConfigEntry<float> DPSRefreshTimer;

	internal static ConfigEntry<KeyCode> DPSRefreshKey;

	internal static ConfigEntry<bool> enableCustomHUD;

	internal static ConfigEntry<KeyCode> HUDToggleKey;

	internal static ConfigEntry<KeyCode> SnappingToggleKey;

	internal static ConfigEntry<KeyCode> IncreaseSnap;

	internal static ConfigEntry<KeyCode> DecreaseSnap;

	internal static ConfigEntry<KeyCode> GridToggleKey;

	internal static ConfigEntry<KeyCode> AxisLockKey;

	internal static ConfigEntry<KeyCode> ShowTransforms;

	internal static ConfigEntry<bool> enableBuffCountdown;

	internal static ConfigEntry<bool> enableBuffClockdown;

	internal static ConfigEntry<bool> enableScoreboardStats;

	internal static void Init()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		config = new ConfigFile(Paths.ConfigPath + "\\ImprovedUI\\ImprovedUI.cfg", true);
		string text = "01 - General";
		enableCommandImprovements = config.Bind<bool>(text, "Enable Command Improvements", true, (ConfigDescription)null);
		enableTooltipImprovements = config.Bind<bool>(text, "Enable Item Tooltip Improvements", true, "This will also add tooltips to items on the Command panel.");
		enableBodyStats = config.Bind<bool>(text, "Enable Survivor Stats", true, (ConfigDescription)null);
		enableMenuPause = config.Bind<bool>(text, "Enable Item Selection Menu Pause", true, "Pauses the game in single player, works for Command, Scrappers and Void Cradles.");
		enableDPS = config.Bind<bool>(text, "Enable DPS Meter", true, (ConfigDescription)null);
		enableCustomHUD = config.Bind<bool>(text, "Enable Customizable HUD", true, "This will enable draggable hud elements and preset features.");
		enableBuffTimer = config.Bind<bool>(text, "Enable Buff Timer", true, (ConfigDescription)null);
		enableItemCounter = config.Bind<bool>(text, "Enable Item Counters On Scoreboard", true, (ConfigDescription)null);
		string text2 = "02 - DPSMeter";
		DPSResetTimer = config.Bind<float>(text2, "DPS Meter Reset Time", 10000f, (ConfigDescription)null);
		DPSRefreshTimer = config.Bind<float>(text2, "DPS Meter Refresh Time", 50f, (ConfigDescription)null);
		DPSRefreshKey = config.Bind<KeyCode>(text2, "DPS Meter Reset Key", (KeyCode)107, (ConfigDescription)null);
		string text3 = "03 - Customizable HUD";
		HUDToggleKey = config.Bind<KeyCode>(text3, "Toggle Customization Key", (KeyCode)108, (ConfigDescription)null);
		GridToggleKey = config.Bind<KeyCode>(text3, "Grid View Key", (KeyCode)103, (ConfigDescription)null);
		SnappingToggleKey = config.Bind<KeyCode>(text3, "Enable Snapping Key", (KeyCode)110, (ConfigDescription)null);
		IncreaseSnap = config.Bind<KeyCode>(text3, "Increase Snap Size", (KeyCode)43, "Mouse scroll up also works.");
		DecreaseSnap = config.Bind<KeyCode>(text3, "Decrease Snap Size", (KeyCode)45, "Mouse scroll down also works.");
		AxisLockKey = config.Bind<KeyCode>(text3, "Axis Lock Key", (KeyCode)304, (ConfigDescription)null);
		ShowTransforms = config.Bind<KeyCode>(text3, "Show/Hide Window Transforms", (KeyCode)116, (ConfigDescription)null);
		string text4 = "04 - Buff Timer";
		enableBuffCountdown = config.Bind<bool>(text4, "Enable Buff Timer Countdown", true, "This will show a countdown on top of the buff icon.");
		enableBuffClockdown = config.Bind<bool>(text4, "Enable Buff Timer Dark Icon Overlay", true, "This will show a darker icon overlay, that fills up clockwise.");
		string text5 = "05 - Body Stats";
		enableScoreboardStats = config.Bind<bool>(text5, "Show Stats With Scoreboard", false, "The body stats will only show up when the scoreboard is shown.");
		if (enableCustomHUD.Value && MainPlugin.debug)
		{
			LoadTransformDataFromJson();
		}
	}

	internal static void LoadTransformDataFromJson()
	{
		jsonFilePath = Path.Combine(Path.GetDirectoryName(config.ConfigFilePath), "HUDData.json");
		string text = "";
		bool flag = true;
		bool flag2 = true;
		if (File.Exists(jsonFilePath))
		{
			text = File.ReadAllText(jsonFilePath);
			try
			{
				JSONNode.Parse(text);
			}
			catch
			{
				Debug.LogWarning((object)"[ImprovedUI] HUD config file malformed. Using defaults.");
				flag = false;
			}
		}
		else
		{
			Debug.LogWarning((object)"[ImprovedUI] HUD config file not found. Using defaults.");
			flag = false;
			flag2 = false;
		}
		if (!flag)
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ImprovedUI.HUDData.json"))
			{
				text = new StreamReader(stream).ReadToEnd();
			}
			if (!flag2)
			{
				File.WriteAllText(jsonFilePath, text);
			}
		}
		hudData = new HUDData(JSON.Parse(text));
	}
}
internal class Hook
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_SetPickupOptions <>9__0_0;

		public static hook_OnDisplayEnd <>9__0_1;

		internal void <Hooks>b__0_0(orig_SetPickupOptions o, PickupPickerPanel s, Option[] c)
		{
			o.Invoke(s, c);
			if (RoR2Application.isInSinglePlayer)
			{
				Time.timeScale = 0f;
			}
		}

		internal void <Hooks>b__0_1(orig_OnDisplayEnd o, PickupPickerController e, NetworkUIPromptController a, LocalUser i, CameraRigController f)
		{
			o.Invoke(e, a, i, f);
			if (RoR2Application.isInSinglePlayer)
			{
				Time.timeScale = 1f;
			}
		}
	}

	internal static void Hooks()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Expected O, but got Unknown
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		//IL_0085: 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_0090: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: Expected O, but got Unknown
		if (MainPlugin.debug)
		{
		}
		if (Configs.enableCommandImprovements.Value)
		{
			PickupPickerPanel.SetPickupOptions += new hook_SetPickupOptions(PickupPickerPanel_SetPickupOptions);
		}
		if (Configs.enableTooltipImprovements.Value)
		{
			TooltipController.SetTooltipProvider += new hook_SetTooltipProvider(TooltipController_SetTooltipProvider);
			EquipmentIcon.Update += new hook_Update(EquipmentIcon_Update);
		}
		if (!Configs.enableMenuPause.Value)
		{
			return;
		}
		object obj = <>c.<>9__0_0;
		if (obj == null)
		{
			hook_SetPickupOptions val = delegate(orig_SetPickupOptions o, PickupPickerPanel s, Option[] c)
			{
				o.Invoke(s, c);
				if (RoR2Application.isInSinglePlayer)
				{
					Time.timeScale = 0f;
				}
			};
			<>c.<>9__0_0 = val;
			obj = (object)val;
		}
		PickupPickerPanel.SetPickupOptions += (hook_SetPickupOptions)obj;
		object obj2 = <>c.<>9__0_1;
		if (obj2 == null)
		{
			hook_OnDisplayEnd val2 = delegate(orig_OnDisplayEnd o, PickupPickerController e, NetworkUIPromptController a, LocalUser i, CameraRigController f)
			{
				o.Invoke(e, a, i, f);
				if (RoR2Application.isInSinglePlayer)
				{
					Time.timeScale = 1f;
				}
			};
			<>c.<>9__0_1 = val2;
			obj2 = (object)val2;
		}
		PickupPickerController.OnDisplayEnd += (hook_OnDisplayEnd)obj2;
	}

	private static void EquipmentIcon_Update(orig_Update orig, EquipmentIcon self)
	{
		orig.Invoke(self);
		if (Object.op_Implicit((Object)(object)self.tooltipProvider) && ((DisplayData)(ref self.currentDisplayData)).isReady && Object.op_Implicit((Object)(object)self.currentDisplayData.equipmentDef))
		{
			string @string = Language.GetString(self.currentDisplayData.equipmentDef.descriptionToken);
			self.tooltipProvider.overrideBodyText = @string;
		}
	}

	private static void PickupPickerPanel_SetPickupOptions(orig_SetPickupOptions orig, PickupPickerPanel self, Option[] options)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: 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_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_025c: 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_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: 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_0085: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: 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_00b3: Invalid comparison between Unknown and I4
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Invalid comparison between Unknown and I4
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Invalid comparison between Unknown and I4
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: 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_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Invalid comparison between Unknown and I4
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0154: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Invalid comparison between Unknown and I4
		//IL_0178: 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_0182: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self, options);
		int num = options.Length;
		for (int i = 0; i < num; i++)
		{
			MPButton val = self.buttonAllocator.elements[i];
			TooltipProvider val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<TooltipProvider>() : null);
			PickupDef pickupDef = PickupCatalog.GetPickupDef(options[i].pickupIndex);
			if (!Object.op_Implicit((Object)(object)val2) || pickupDef == null)
			{
				continue;
			}
			ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
			EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(pickupDef.equipmentIndex);
			Color titleColor = Color.white;
			if (Object.op_Implicit((Object)(object)itemDef))
			{
				ItemTierDef val3 = (Object.op_Implicit((Object)(object)itemDef._itemTierDef) ? itemDef._itemTierDef : ItemTierCatalog.GetItemTierDef(((int)itemDef.deprecatedTier != 5) ? itemDef.deprecatedTier : itemDef.tier));
				if ((int)itemDef.darkColorIndex > 0)
				{
					titleColor = Color32.op_Implicit(ColorCatalog.GetColor(itemDef.darkColorIndex));
				}
				else if ((int)itemDef.colorIndex > 0)
				{
					titleColor = Color32.op_Implicit(ColorCatalog.GetColor(itemDef.colorIndex));
				}
				else if (Object.op_Implicit((Object)(object)val3) && (int)val3.darkColorIndex > 0)
				{
					titleColor = Color32.op_Implicit(ColorCatalog.GetColor(val3.darkColorIndex));
				}
				else if (Object.op_Implicit((Object)(object)val3) && (int)val3.colorIndex > 0)
				{
					titleColor = Color32.op_Implicit(ColorCatalog.GetColor(val3.colorIndex));
				}
			}
			else if (Object.op_Implicit((Object)(object)equipmentDef))
			{
				titleColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)5));
			}
			val2.titleColor = titleColor;
			val2.titleToken = (Object.op_Implicit((Object)(object)itemDef) ? itemDef.nameToken : equipmentDef.nameToken);
			val2.bodyToken = (Object.op_Implicit((Object)(object)itemDef) ? itemDef.descriptionToken : equipmentDef.descriptionToken);
		}
		GridLayoutGroup componentInChildren = ((Component)self).GetComponentInChildren<GridLayoutGroup>();
		if (Object.op_Implicit((Object)(object)((Component)self).GetComponent<Command>()) && Object.op_Implicit((Object)(object)componentInChildren))
		{
			RectTransform component = ((Component)componentInChildren).GetComponent<RectTransform>();
			component.sizeDelta += Vector2.up * (float)num * 14.5f;
			((Transform)component).localPosition = Vector2.op_Implicit(Vector2.up * (float)num * -25.7f);
		}
	}

	private static void EquipmentIcon_SetDisplayData(orig_SetDisplayData orig, EquipmentIcon self, DisplayData newDisplayData)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self, (ValueType)(object)newDisplayData);
		if (Object.op_Implicit((Object)(object)self.tooltipProvider) && Utility.IsNullOrWhiteSpace(self.tooltipProvider.overrideBodyText) && (Object)(object)newDisplayData.equipmentDef != (Object)null)
		{
			self.tooltipProvider.overrideBodyText = newDisplayData.equipmentDef.descriptionToken;
		}
	}

	private static void TooltipController_SetTooltipProvider(orig_SetTooltipProvider orig, TooltipController self, TooltipProvider provider)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		ItemIcon component = ((Component)provider).GetComponent<ItemIcon>();
		EquipmentIcon component2 = ((Component)provider).GetComponent<EquipmentIcon>();
		if (Object.op_Implicit((Object)(object)component) && Utility.IsNullOrWhiteSpace(provider.overrideBodyText))
		{
			ItemDef itemDef = ItemCatalog.GetItemDef(component.itemIndex);
			if (Object.op_Implicit((Object)(object)itemDef))
			{
				provider.overrideBodyText = Language.GetString(itemDef.descriptionToken);
			}
		}
		orig.Invoke(self, provider);
	}
}
[Serializable]
internal class HUDData
{
	[Serializable]
	internal class PresetData
	{
		internal string name;

		internal Dictionary<string, TransformData> transforms = new Dictionary<string, TransformData>();

		public TransformData GetTransformDataByName(string transformName)
		{
			TransformData value = null;
			transforms.TryGetValue(transformName, out value);
			if (MainPlugin.debug)
			{
				if (value != null)
				{
					Debug.LogWarning((object)value.name);
				}
				else
				{
					Debug.LogWarning((object)("NO TRANSFORMDATA: " + transformName));
				}
			}
			return value;
		}

		internal void AddTransformData(TransformData transformData)
		{
			transforms.Add(transformData.name, transformData);
		}

		internal PresetData(string name)
		{
			this.name = name;
		}

		internal PresetData()
		{
		}
	}

	[Serializable]
	internal class TransformData
	{
		internal string name;

		internal Vector3 position;

		internal Vector3 rotation;

		internal float scale;

		internal TransformData(string name, Vector3 position, Vector3 rotation, float scale)
		{
			//IL_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			this.name = name;
			this.position = position;
			this.rotation = rotation;
			this.scale = scale;
		}

		internal TransformData()
		{
		}
	}

	internal string defaultPreset = "Default";

	internal List<PresetData> presets = new List<PresetData>();

	internal void SaveHUDData()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_001a: Expected O, but got Unknown
		//IL_0041: 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_0049: Expected O, but got Unknown
		//IL_004e: Expected O, but got Unknown
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Expected O, but got Unknown
		//IL_0088: Expected O, but got Unknown
		//IL_0094: 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_009c: Expected O, but got Unknown
		//IL_00a1: Expected O, but got Unknown
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Expected O, but got Unknown
		//IL_00e3: Expected O, but got Unknown
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Expected O, but got Unknown
		//IL_00fc: Expected O, but got Unknown
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Expected O, but got Unknown
		//IL_016f: Expected O, but got Unknown
		JSONNode val = (JSONNode)new JSONObject();
		JSONObject val2 = new JSONObject();
		JSONNode val3 = (JSONNode)val2;
		val["HUDData"] = (JSONNode)val2;
		JSONNode val4 = val3;
		val3 = (val4["DefaultPreset"] = JSONNode.op_Implicit(defaultPreset));
		JSONNode val6 = val3;
		JSONObject val7 = new JSONObject();
		val3 = (JSONNode)val7;
		val4["Presets"] = (JSONNode)val7;
		JSONNode val8 = val3;
		foreach (PresetData preset in presets)
		{
			PresetData presetData = preset;
			string name = presetData.name;
			JSONObject val9 = new JSONObject();
			val3 = (JSONNode)val9;
			val8[name] = (JSONNode)val9;
			JSONNode val10 = val3;
			JSONObject val11 = new JSONObject();
			val3 = (JSONNode)val11;
			val10["HUDElements"] = (JSONNode)val11;
			JSONNode val12 = val3;
			foreach (KeyValuePair<string, TransformData> transform in presetData.transforms)
			{
				TransformData value = transform.Value;
				string name2 = value.name;
				JSONObject val13 = new JSONObject();
				val3 = (JSONNode)val13;
				val12[name2] = (JSONNode)val13;
				JSONNode val14 = val3;
				JSONObject val15 = new JSONObject();
				val3 = (JSONNode)val15;
				val14["Position"] = (JSONNode)val15;
				JSONNode val16 = val3;
				val16["x"] = JSONNode.op_Implicit(value.position.x);
				val16["y"] = JSONNode.op_Implicit(value.position.y);
				val16["z"] = JSONNode.op_Implicit(value.position.z);
				JSONObject val17 = new JSONObject();
				val3 = (JSONNode)val17;
				val14["Rotation"] = (JSONNode)val17;
				JSONNode val18 = val3;
				val18["x"] = JSONNode.op_Implicit(value.rotation.x);
				val18["y"] = JSONNode.op_Implicit(value.rotation.y);
				val18["z"] = JSONNode.op_Implicit(value.rotation.z);
				val14["Scale"] = JSONNode.op_Implicit(value.scale);
			}
		}
		File.WriteAllText(Configs.jsonFilePath, val.ToString(1), Encoding.UTF8);
	}

	internal PresetData GetPresetDataByName(string presetName)
	{
		PresetData presetData = presets.Find((PresetData x) => x.name == presetName);
		if (MainPlugin.debug)
		{
			if (presetData != null)
			{
				Debug.LogWarning((object)presetData.name);
			}
			else
			{
				Debug.LogWarning((object)("NO PRESET: " + presetName));
			}
		}
		return presetData;
	}

	internal HUDData()
	{
	}

	internal HUDData(JSONNode jsonObject)
	{
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		JSONNode val = jsonObject["HUDData"];
		HUDData hUDData = new HUDData
		{
			defaultPreset = JSONNode.op_Implicit(val["DefaultPreset"])
		};
		List<JSONNode> list = val["Presets"].Children.ToList();
		List<string> list2 = val["Presets"].Keys.ToList();
		for (int i = 0; i < list.Count; i++)
		{
			JSONNode val2 = list[i];
			PresetData presetData = new PresetData(list2[i]);
			List<JSONNode> list3 = val2["HUDElements"].Children.ToList();
			List<string> list4 = val2["HUDElements"].Keys.ToList();
			for (int j = 0; j < list3.Count; j++)
			{
				JSONNode val3 = list3[j];
				JSONNode val4 = val3["Position"];
				JSONNode val5 = val3["Rotation"];
				presetData.AddTransformData(new TransformData(list4[j], new Vector3(JSONNode.op_Implicit(val4["x"]), JSONNode.op_Implicit(val4["y"]), JSONNode.op_Implicit(val4["z"])), new Vector3(JSONNode.op_Implicit(val5["x"]), JSONNode.op_Implicit(val5["y"]), JSONNode.op_Implicit(val5["z"])), JSONNode.op_Implicit(val3["Scale"])));
				Debug.LogWarning((object)(list4[j] + " scale: " + JSONNode.op_Implicit(val3["Scale"])));
			}
			presets.Add(presetData);
		}
	}
}
[BepInIncompatibility("AAAHIFU.CleanerHud")]
[BepInIncompatibility("com.xoxfaby.BetterUI")]
[BepInIncompatibility("bubbet.riskui")]
[BepInPlugin("com.Dragonyck.ImprovedUI", "ImprovedUI", "1.2.1")]
public class MainPlugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnClientConnect <>9__4_0;

		internal void <Awake>b__4_0(orig_OnClientConnect self, NetworkManagerSystemSteam user, NetworkConnection t)
		{
		}
	}

	public const string MODUID = "com.Dragonyck.ImprovedUI";

	public const string MODNAME = "ImprovedUI";

	public const string VERSION = "1.2.1";

	internal static bool debug;

	private void Awake()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		if (debug)
		{
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				hook_OnClientConnect val = delegate
				{
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			NetworkManagerSystemSteam.OnClientConnect += (hook_OnClientConnect)obj;
		}
		Configs.Init();
		Prefabs.CreatePrefabs();
		Hook.Hooks();
	}
}
internal class Prefabs
{
	internal static GameObject commandPanelPrefab;

	internal static GameObject inputBoxPrefab;

	internal static GameObject dontDestroyOnLoad;

	internal static GameObject windowTransformPrefab;

	internal static GameObject buffIconPrefab;

	internal static Sprite dragWindowSprite;

	internal static Shader defaultShader;

	internal static Shader UIShader;

	internal static T Load<T>(string path)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
	}

	internal static void CreatePrefabs()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_030b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Expected O, but got Unknown
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cd: 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_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01af: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_059c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_062e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0633: Unknown result type (might be due to invalid IL or missing references)
		//IL_0665: Unknown result type (might be due to invalid IL or missing references)
		//IL_066a: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_071c: Unknown result type (might be due to invalid IL or missing references)
		//IL_072b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0770: Unknown result type (might be due to invalid IL or missing references)
		//IL_0775: Unknown result type (might be due to invalid IL or missing references)
		//IL_07df: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e9: Expected O, but got Unknown
		//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5a: Expected O, but got Unknown
		//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ac1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b04: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b09: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b30: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b5a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bbb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c13: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c4a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c61: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c66: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c80: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c8a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ca9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cb3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d00: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d0a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d28: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d5c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d63: Expected O, but got Unknown
		//IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e51: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e5b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e8e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f5f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f69: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0f8a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fa5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0faf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fb4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0fd0: Unknown result type (might be due to invalid IL or missing references)
		//IL_104f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1054: Unknown result type (might be due to invalid IL or missing references)
		//IL_105e: Unknown result type (might be due to invalid IL or missing references)
		//IL_10f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_10f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_1102: Unknown result type (might be due to invalid IL or missing references)
		//IL_1197: Unknown result type (might be due to invalid IL or missing references)
		//IL_119c: Unknown result type (might be due to invalid IL or missing references)
		//IL_11a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_11ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_1248: Unknown result type (might be due to invalid IL or missing references)
		//IL_124d: Unknown result type (might be due to invalid IL or missing references)
		//IL_1257: Unknown result type (might be due to invalid IL or missing references)
		dontDestroyOnLoad = new GameObject("dontDestroyOnLoad");
		dontDestroyOnLoad.SetActive(false);
		Object.DontDestroyOnLoad((Object)(object)dontDestroyOnLoad);
		defaultShader = Load<Shader>("RoR2/Base/Shaders/HGStandard.shader");
		UIShader = Load<Shader>("RoR2/Base/Shaders/HGUIIgnoreZ.shader");
		if (Configs.enableBuffTimer.Value)
		{
			buffIconPrefab = Load<GameObject>("RoR2/Base/UI/BuffIcon.prefab");
			BuffTimer buffTimer = buffIconPrefab.AddComponent<BuffTimer>();
			GameObject gameObject = ((Component)buffIconPrefab.transform.GetChild(0)).gameObject;
			((TMP_Text)gameObject.GetComponent<HGTextMeshProUGUI>()).fontSize = 18f;
			if (Configs.enableBuffCountdown.Value)
			{
				GameObject val = Object.Instantiate<GameObject>(gameObject);
				val.transform.SetParent(buffIconPrefab.transform);
				val.transform.localPosition = new Vector3(25f, 65f, 0f);
				((Component)val.transform).transform.localScale = Vector3.one;
				HGTextMeshProUGUI component = val.GetComponent<HGTextMeshProUGUI>();
				((TMP_Text)component).horizontalAlignment = (HorizontalAlignmentOptions)2;
				buffTimer.countdown = component;
				((TMP_Text)val.GetComponent<HGTextMeshProUGUI>()).text = "";
			}
			if (Configs.enableBuffClockdown.Value)
			{
				GameObject val2 = NewRect("Clockdown", null, typeof(Image));
				RectTransform component2 = val2.GetComponent<RectTransform>();
				((Component)component2).transform.SetParent(buffIconPrefab.transform);
				component2.pivot = Vector2.zero;
				component2.sizeDelta = Vector2.one * 48f;
				((Transform)component2).localPosition = Vector3.zero;
				((Transform)component2).localRotation = Quaternion.identity;
				((Transform)component2).localScale = Vector3.one;
				Image component3 = val2.GetComponent<Image>();
				component3.type = (Type)3;
				component3.fillAmount = 0f;
				component3.fillOrigin = 2;
				component3.fillClockwise = true;
				((Graphic)component3).color = Color32.op_Implicit(new Color32((byte)62, (byte)62, (byte)62, (byte)200));
				buffTimer.fill = component3;
			}
			Object.DontDestroyOnLoad((Object)(object)buffIconPrefab);
		}
		if (Configs.enableCommandImprovements.Value)
		{
			commandPanelPrefab = Load<GameObject>("RoR2/Base/Command/CommandPickerPanel.prefab");
			commandPanelPrefab.AddComponent<Command>();
			PickupPickerPanel component4 = commandPanelPrefab.GetComponent<PickupPickerPanel>();
			component4.maxColumnCount = 6;
			GridLayoutGroup gridlayoutGroup = component4.gridlayoutGroup;
			gridlayoutGroup.constraint = (Constraint)1;
			gridlayoutGroup.constraintCount = 6;
			((LayoutGroup)gridlayoutGroup).childAlignment = (TextAnchor)1;
			RectTransform component5 = ((Component)gridlayoutGroup).GetComponent<RectTransform>();
			((Behaviour)((Component)component5).GetComponent<RawImage>()).enabled = false;
			component5.sizeDelta = Vector2.right * 444f;
			((Transform)component5).localPosition = Vector2.op_Implicit(Vector2.up * 100f);
			component5.anchorMin = new Vector2(0.5f, 1f);
			component5.anchorMax = new Vector2(0.5f, 1f);
			GameObject val3 = NewRect("Scroll", ((Component)gridlayoutGroup).transform.parent);
			val3.transform.localPosition = ((Component)gridlayoutGroup).transform.localPosition;
			((Component)gridlayoutGroup).transform.SetParent(val3.transform);
			ScrollRect val4 = val3.AddComponent<ScrollRect>();
			val4.horizontal = false;
			val4.content = component5;
			val4.scrollSensitivity = 30f;
			RectTransform component6 = ((Component)val4).GetComponent<RectTransform>();
			component6.sizeDelta = new Vector2(500f, 510f);
			((Transform)component6).localPosition = Vector3.zero;
			Image val5 = val3.gameObject.AddComponent<Image>();
			((Graphic)val5).color = new Color(0.12549f, 0.12549f, 0.12549f);
			val5.sprite = Load<Sprite>("RoR2/Base/UI/texUIHighlightBoxOutlineThickIcon.png");
			val5.type = (Type)2;
			val3.gameObject.AddComponent<Mask>();
			component4.buttonPrefab.AddComponent<TooltipProvider>();
			Object.DontDestroyOnLoad((Object)(object)commandPanelPrefab);
		}
		if (Configs.enableItemCounter.Value)
		{
			GameObject val6 = Load<GameObject>("RoR2/Base/UI/ScoreboardStrip.prefab");
			Object.DontDestroyOnLoad((Object)(object)val6);
			ScoreboardStrip component7 = val6.GetComponent<ScoreboardStrip>();
			TextMeshProUGUI moneyText = component7.moneyText;
			GameObject val7 = NewRect("Text", ((TMP_Text)moneyText).transform, typeof(HGTextMeshProUGUI), typeof(ItemCountBehaviour));
			val7.GetComponent<ItemCountBehaviour>().scoreboard = component7;
			RectTransform val8 = (RectTransform)val7.transform;
			((Transform)val8).localPosition = new Vector3(-100f, 20f);
			val8.sizeDelta = new Vector2(300f, 50f);
			HGTextMeshProUGUI component8 = val7.GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component8).fontSize = 18f;
			((TMP_Text)component8).alignment = (TextAlignmentOptions)516;
			((TMP_Text)component8).text = "";
		}
		bool value = Configs.enableCustomHUD.Value;
		bool value2 = Configs.enableDPS.Value;
		bool value3 = Configs.enableBodyStats.Value;
		if (!(value || value2 || value3))
		{
			return;
		}
		GameObject val9 = Load<GameObject>("RoR2/Base/UI/HUDSimple.prefab");
		HUD component9 = val9.GetComponent<HUD>();
		ChildLocator component10 = val9.GetComponent<ChildLocator>();
		HUDScaleController component11 = val9.GetComponent<HUDScaleController>();
		if (value3)
		{
			val9.AddComponent<StatPanelBehaviour>();
		}
		if (value2)
		{
			GameObject val10 = Object.Instantiate<GameObject>(component9.lunarCoinContainer);
			((Graphic)val10.GetComponentInChildren<RawImage>()).color = Color32.op_Implicit(new Color32((byte)166, (byte)117, (byte)115, (byte)34));
			val10.transform.SetParent(component9.lunarCoinContainer.transform.parent);
			val10.transform.localScale = Vector3.one;
			val10.transform.localPosition = Vector3.zero;
			val10.transform.localRotation = Quaternion.identity;
			Object.Destroy((Object)(object)val10.GetComponent<MoneyText>());
			HGTextMeshProUGUI[] componentsInChildren = val10.GetComponentsInChildren<HGTextMeshProUGUI>();
			((Graphic)componentsInChildren[0]).color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)201, (byte)201, byte.MaxValue));
			((TMP_Text)componentsInChildren[0]).text = "0";
			((Graphic)componentsInChildren[1]).color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)201, (byte)201, byte.MaxValue));
			((TMP_Text)componentsInChildren[1]).text = "<sprite=3 tint = 1>";
			DPSBehaviour dPSBehaviour = val10.AddComponent<DPSBehaviour>();
			dPSBehaviour.hud = component9;
			dPSBehaviour.text = componentsInChildren[0];
			((RectTransform)component9.lunarCoinContainer.transform.parent).sizeDelta = new Vector2(201f, 127f);
		}
		if (value && MainPlugin.debug)
		{
			inputBoxPrefab = NewRect("InputBox", null, typeof(Image), typeof(TMP_InputField));
			((RectTransform)inputBoxPrefab.transform).sizeDelta = new Vector2(110f, 30f);
			GameObject val11 = NewRect("Text Area", inputBoxPrefab.transform, typeof(RectMask2D));
			val11.transform.localPosition = Vector2.op_Implicit(new Vector2(5f, -14f));
			val11.layer = LayerIndex.ui.intVal;
			GameObject val12 = NewRect("Text", val11.transform, typeof(TextMeshProUGUI));
			val12.layer = LayerIndex.ui.intVal;
			TMP_InputField component12 = inputBoxPrefab.GetComponent<TMP_InputField>();
			component12.textViewport = (RectTransform)val11.transform;
			component12.textComponent = (TMP_Text)(object)val12.GetComponent<TextMeshProUGUI>();
			component12.pointSize = 20f;
			component12.characterValidation = (CharacterValidation)8;
			component12.inputValidator = (TMP_InputValidator)(object)TransformInputValidator.NewValidator();
			Image component13 = inputBoxPrefab.GetComponent<Image>();
			component13.sprite = Load<Sprite>("RoR2/Base/UI/texUIHighlightBoxOutline.png");
			component13.type = (Type)1;
			windowTransformPrefab = NewRect("WindowTransform",