Decompiled source of CleanestHud v1.0.2

plugins/CleanestHud.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
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 BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CleanestHud.HudChanges;
using CleanestHud.HudChanges.SurvivorSpecific;
using CleanestHud.ModSupport;
using EntityStates.Seeker;
using HarmonyLib;
using IL.RoR2;
using IL.RoR2.UI;
using JetBrains.Annotations;
using LookingGlass.ItemCounters;
using LookingGlass.StatsDisplay;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Seeker;
using On.RoR2;
using On.RoR2.CameraModes;
using On.RoR2.ConVar;
using On.RoR2.UI;
using R2API.Utils;
using RiskOfOptions;
using RoR2;
using RoR2.CameraModes;
using RoR2.ConVar;
using RoR2.ContentManagement;
using RoR2.HudOverlay;
using RoR2.UI;
using RoR2.UI.SkinControllers;
using RoR2BepInExPack.GameAssetPathsBetter;
using RobDriver.Modules.Misc;
using SS2;
using SS2.Items;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CleanestHud")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+56316fbacaacab1a88a8d1f852a29112329b55d1")]
[assembly: AssemblyProduct("CleanestHud")]
[assembly: AssemblyTitle("CleanestHud")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CleanestHud
{
	internal class AssetEdits
	{
		internal static void EditScoreboardStripAsset(GameObject scoreboardStripAsset)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			scoreboardStripAsset.GetComponent<RawImage>().texture = (Texture)(object)ModAssets.AssetBundle.LoadAsset<Texture2D>("NewNavHighlight");
			Transform child = scoreboardStripAsset.transform.GetChild(0);
			((Component)child).GetComponent<Image>().sprite = HudResources.HudAssets.WhiteSprite;
			child.Find("ClassBackground").DisableImageComponent();
			child.Find("EquipmentBackground").DisableImageComponent();
			((Graphic)((Component)child.Find("TotalTextContainer/MoneyText")).GetComponent<HGTextMeshProUGUI>()).color = Color.white;
			((TMP_Text)((Component)child.GetChild(2)).GetComponent<HGTextMeshProUGUI>()).alignment = (TextAlignmentOptions)514;
			child.Find("NameLabel/NameFocusHighlight").DisableImageComponent();
		}

		internal static void EditItemIconIngame(GameObject itemIconIngameAsset)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			((Component)itemIconIngameAsset.transform.GetChild(1)).GetComponent<RawImage>().texture = (Texture)(object)ModAssets.AssetBundle.LoadAsset<Texture2D>("NewNavHighlight");
			HGButton component = itemIconIngameAsset.GetComponent<HGButton>();
			((ColorBlock)(ref ((Selectable)component).m_Colors)).highlightedColor = Main.Helpers.ChangeColorWhileKeepingAlpha(((ColorBlock)(ref ((Selectable)component).m_Colors)).highlightedColor, Color.white);
			((ColorBlock)(ref ((Selectable)component).m_Colors)).normalColor = Main.Helpers.ChangeColorWhileKeepingAlpha(((ColorBlock)(ref ((Selectable)component).m_Colors)).normalColor, Color.white);
			((ColorBlock)(ref ((Selectable)component).m_Colors)).pressedColor = Main.Helpers.ChangeColorWhileKeepingAlpha(((ColorBlock)(ref ((Selectable)component).m_Colors)).pressedColor, Color.white);
			((ColorBlock)(ref ((Selectable)component).m_Colors)).selectedColor = Main.Helpers.ChangeColorWhileKeepingAlpha(((ColorBlock)(ref ((Selectable)component).m_Colors)).selectedColor, Color.white);
			((Selectable)component).m_Colors.m_ColorMultiplier = 1.5f;
		}

		internal static void RemoveGameEndReportPanelDetails(GameObject gameEndReportPanelAsset)
		{
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			Transform obj = gameEndReportPanelAsset.transform.Find("SafeArea (JUICED)");
			Transform val = obj.Find("BodyArea");
			Transform obj2 = obj.Find("HeaderArea");
			HGTextMeshProUGUI component = ((Component)obj2.Find("DeathFlavorText")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component).fontStyle = (FontStyles)0;
			((TMP_Text)component).fontSizeMax = 30f;
			((Graphic)((Component)obj2.Find("ResultArea/ResultLabel")).GetComponent<HGTextMeshProUGUI>()).material = HudResources.HudAssets.FontMaterial;
			Transform obj3 = val.Find("StatsAndChatArea");
			Transform val2 = obj3.Find("ChatArea");
			Transform child = val2.GetChild(0);
			Transform child2 = child.GetChild(2).GetChild(0);
			Transform obj4 = obj3.Find("StatsContainer");
			Transform val3 = obj4.Find("Stats Body");
			Transform obj5 = val3.Find("ScrollView");
			Transform val4 = obj5.Find("Viewport/Content");
			Transform val5 = obj5.Find("Scrollbar Vertical");
			val2.DisableImageComponent();
			child.GetChild(0).DisableImageComponent();
			((Component)child2.GetChild(1)).gameObject.SetActive(false);
			((Component)child2.GetChild(2)).gameObject.SetActive(false);
			((Component)obj4.Find("BorderImage")).gameObject.SetActive(false);
			obj4.Find("Stats And Player Nav/Stats Header").DisableImageComponent();
			val3.DisableImageComponent();
			val4.Find("SelectedDifficultyStrip").DisableImageComponent();
			val4.Find("EnabledArtifactsStrip").DisableImageComponent();
			val5.DisableImageComponent();
			val5.Find("Sliding Area/Handle").DisableImageComponent();
			RectTransform component2 = ((Component)val2).GetComponent<RectTransform>();
			component2.sizeDelta = new Vector2(817f, 200f);
			((Transform)component2).localPosition = new Vector3(441.5f, -311.66666f, 0f);
			Transform obj6 = val.Find("RightArea/InfoArea");
			Transform obj7 = obj6.Find("Info Body");
			Transform val6 = obj7.Find("ItemArea");
			Transform val7 = val6.Find("ScrollView");
			Transform val8 = obj7.Find("UnlockArea");
			Transform val9 = val8.Find("ScrollView");
			obj6.Find("BorderImage").DisableImageComponent();
			obj6.Find("Info Header").DisableImageComponent();
			val6.Find("Item Header").DisableImageComponent();
			val7.DisableImageComponent();
			val7.Find("Scrollbar Vertical").DisableImageComponent();
			val8.Find("Unlocked Header").DisableImageComponent();
			val9.DisableImageComponent();
			val9.Find("Scrollbar Vertical").DisableImageComponent();
		}

		internal static void RemoveMoonDetonationPanelDetails(GameObject moonDetonationPanelAsset)
		{
			//IL_0015: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			((Transform)moonDetonationPanelAsset.GetComponent<RectTransform>()).localPosition = new Vector3(576.4219f, -200f, 0f);
			Transform obj = moonDetonationPanelAsset.transform.Find("Juice").Find("Container");
			obj.Find("Backdrop").DisableImageComponent();
			obj.Find("Border").DisableImageComponent();
			HGTextMeshProUGUI component = ((Component)obj.Find("CountdownTitleLabel")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component).fontSharedMaterial = HudResources.HudAssets.FontMaterial;
			((Graphic)component).color = Color.red;
			HGTextMeshProUGUI component2 = ((Component)obj.Find("CountdownLabel")).GetComponent<HGTextMeshProUGUI>();
			((TMP_Text)component2).fontSharedMaterial = HudResources.HudAssets.FontMaterial;
			((Graphic)component2).color = Color.red;
		}

		internal static void RemoveChatBoxDetails(GameObject chatBoxAsset)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			chatBoxAsset.DisableImageComponent();
			Transform obj = chatBoxAsset.transform.Find("PermanentBG");
			Image component = ((Component)obj).GetComponent<Image>();
			component.sprite = HudResources.HudAssets.WhiteSprite;
			((Graphic)component).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)212));
			Image component2 = ((Component)obj.Find("Input Field")).GetComponent<Image>();
			component2.sprite = HudResources.HudAssets.WhiteSprite;
			((Graphic)component2).color = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, (byte)100));
			RectTransform component3 = ((Component)obj).GetComponent<RectTransform>();
			((Transform)component3).localPosition = new Vector3(0f, 1f, 0f);
			component3.sizeDelta = new Vector2(0f, 48f);
			Transform obj2 = chatBoxAsset.transform.Find("StandardRect/Scroll View");
			obj2.Find("Background").DisableImageComponent();
			obj2.Find("BorderImage").DisableImageComponent();
			((Behaviour)((Component)obj2.Find("Scrollbar Vertical")).GetComponent<Scrollbar>()).enabled = true;
		}
	}
	public static class ConfigOptions
	{
		public static class SpecialConfig
		{
			public enum SeekerMeditateHudPosition
			{
				AboveHealthBar,
				OverCrosshair
			}

			public enum SeekerLotusHudPosition
			{
				AboveSkillsMiddle,
				LeftOfSkills
			}
		}

		public static ConfigEntry<bool> AllowHudStructureEdits;

		public static ConfigEntry<bool> AllowHudDetailsEdits;

		public static ConfigEntry<bool> AllowHudColorEdits;

		public static ConfigEntry<bool> AllowSurvivorSpecificEdits;

		public static ConfigEntry<float> HudTransparency;

		public static ConfigEntry<bool> ShowSkillKeybinds;

		public static ConfigEntry<bool> ShowSkillAndEquipmentOutlines;

		public static ConfigEntry<bool> ShowSprintAndInventoryKeybinds;

		public static ConfigEntry<bool> AllowInspectPanelFadeIn;

		public static ConfigEntry<float> InspectPanelFadeInDuration;

		public static ConfigEntry<bool> AllowAllyCardBackgrounds;

		public static ConfigEntry<bool> AllowScoreboardLabels;

		public static ConfigEntry<bool> AllowScoreboardItemHighlightColoring;

		public static ConfigEntry<bool> AllowAutoScoreboardHighlight;

		public static ConfigEntry<bool> EnableConsistentDifficultyBarBrightness;

		public static ConfigEntry<bool> AllowSimulacrumWaveBarAnimating;

		public static ConfigEntry<bool> AllowVoidFiendMeterAnimating;

		public static ConfigEntry<SpecialConfig.SeekerMeditateHudPosition> SeekerMeditateHudPosition;

		public static ConfigEntry<SpecialConfig.SeekerLotusHudPosition> SeekerLotusHudPosition;

		public static ConfigEntry<string> BodyNameBlacklist_Config;

		internal static string[] BodyNameBlacklist_Array;

		public static ConfigEntry<bool> AllowDebugLogging;

		public static event Action OnShowSkillKeybindsChanged;

		public static event Action OnShowSkillAndEquipmentOutlinesChanged;

		public static event Action OnShowSprintAndInventoryKeybindsChanged;

		private static void HudTransparency_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				Extensions.GetOrAddComponent<CanvasGroup>((Component)(object)Main.MyHud).alpha = HudTransparency.Value;
				HudDetails.SetInspectPanelMaxAlpha();
			}
		}

		private static void ShowSkillKeybinds_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetSkillsAndEquipmentReminderTextStatus();
				ConfigOptions.OnShowSkillKeybindsChanged?.Invoke();
				HudStructure.RepositionSprintAndInventoryReminders();
				HudStructure.RepositionSkillScaler();
			}
		}

		private static void ShowSkillAndEquipmentOutlines_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetSkillOutlinesStatus();
				ConfigOptions.OnShowSkillAndEquipmentOutlinesChanged?.Invoke();
			}
		}

		private static void ShowSprintAndInventoryKeybinds_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetSprintAndInventoryKeybindsStatus();
				ConfigOptions.OnShowSprintAndInventoryKeybindsChanged?.Invoke();
			}
		}

		private static void AllowInspectPanelFadeIn_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetInspectPanelFadeInStatus();
			}
		}

		private static void InspectPanelFadeInDuration_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetInspectPanelFadeInStatus();
			}
		}

		private static void AllowAllyCardBackgrounds_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				if (AllowAllyCardBackgrounds.Value)
				{
					HudColor.ColorAllAllyCardBackgrounds();
				}
				HudDetails.SetAllyCardBackgroundsStatus();
			}
		}

		private static void AllowScoreboardLabels_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetScoreboardLabelsActiveOrNot(Main.MyHudLocator.FindChild("ScoreboardPanel"));
			}
		}

		private static void AllowScoreboardItemHighlightColoring_SettingChanged(object sender, EventArgs e)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			if (!Main.IsHudEditable)
			{
				return;
			}
			ScoreboardController component = ((Component)Main.MyHudLocator.FindChild("ScoreboardPanel")).GetComponent<ScoreboardController>();
			for (int i = 0; i < component.stripAllocator.elements.Count; i++)
			{
				Color newColor;
				if ((Object)(object)component.stripAllocator.elements[i].userBody == (Object)null)
				{
					Color color = ((Graphic)((Component)((Component)component.stripAllocator.elements[i]).transform.GetChild(0)).GetComponent<Image>()).color;
					color.a = 1f;
					newColor = color;
				}
				else
				{
					newColor = component.stripAllocator.elements[i].userBody.bodyColor;
				}
				HUD myHud = Main.MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(HudColor.DelayColorItemIconHighlights(component.stripAllocator.elements[i], newColor));
				}
			}
		}

		private static void EnableConsistentDifficultyBarBrightness_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetFakeInfiniteLastDifficultySegmentStatus();
				HudColor.ColorDifficultyBar();
			}
		}

		private static void AllowSimulacrumWaveBarAnimating_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				HudDetails.SetSimulacrumWaveBarAnimatorStatus();
			}
		}

		private static void AllowVoidFiendMeterAnimating_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				VoidFiend.SetVoidFiendMeterAnimatorStatus();
			}
		}

		private static void SeekerMeditateHudPosition_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				Seeker.RepositionSeekerMeditationUI();
			}
		}

		private static void SeekerLotusUiPosition_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable)
			{
				Seeker.RepositionSeekerLotusUI();
			}
		}

		private static void BodyNameBlacklist_Config_SettingChanged(object sender, EventArgs e)
		{
			BodyNameBlacklist_Array = BodyNameBlacklist_Config.Value.Split(',');
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static void BindConfigOptions(ConfigFile config)
		{
			AllowHudStructureEdits = Extensions.BindOption<bool>(config, "HUD Settings", "Allow HUD structure edits", "Should the structure editing phase of the HUD loading be allowed to happen?\n\nNOTE: This option is REALLY not supported, it will likely cause problems! Especially with some already supported modded survivors! This will also only take effect next stage or the next time the HUD is created!", true, (ConfigFlags)2);
			AllowHudDetailsEdits = Extensions.BindOption<bool>(config, "HUD Settings", "Allow HUD details edits", "Should the details editing phase of the HUD loading be allowed to happen?\n\nNOTE: This option is not very supported, it may not fully work! This will also only take effect next stage or the next time the HUD is created!", true, (ConfigFlags)2);
			AllowHudColorEdits = Extensions.BindOption<bool>(config, "HUD Settings", "Allow HUD color edits", "Should the HUD be colored based on the survivor being played/spectated?\n\nNOTE: This option is not very supported, it may not fully work! This will also only take effect next stage or the next time the HUD is created!", true, (ConfigFlags)2);
			HudTransparency = Extensions.BindOptionSteppedSlider(config, "HUD Settings", "HUD Transparency", "How transparent should the entire HUD be?\n1 = 100% opaque (no transparency), 0.8 = 80% opaque (20% transparency)", 0.8f, 0.05f, 0f, 10f, (ConfigFlags)2);
			ShowSkillAndEquipmentOutlines = Extensions.BindOption<bool>(config, "HUD Settings", "Show skill outlines", "Should skills have survivor-colored outlines?", true, (ConfigFlags)2);
			ShowSkillKeybinds = Extensions.BindOption<bool>(config, "HUD Settings", "Show skill & equipment keybinds", "Should the keybinds set for your 4 skills & equipment be displayed below your skills be shown?", false, (ConfigFlags)2);
			ShowSprintAndInventoryKeybinds = Extensions.BindOption<bool>(config, "HUD Settings", "Show sprint and inventory keybinds", "Should the keybinds set for sprinting and opening the inventory menu be shown?", false, (ConfigFlags)2);
			AllowInspectPanelFadeIn = Extensions.BindOption<bool>(config, "HUD Settings", "Allow inspect panel fade-in", "Should the inspect panel do it's fade-in animation whenever an item is clicked?", false, (ConfigFlags)2);
			InspectPanelFadeInDuration = Extensions.BindOptionSteppedSlider(config, "HUD Settings", "Inspect panel fade-in duration", "Set a custom duration for the inspect panel's fade-in animation. Vanilla is 0.2", 0.4f, 0.05f, 0f, 5f, (ConfigFlags)2);
			AllowAllyCardBackgrounds = Extensions.BindOption<bool>(config, "HUD Settings", "Allow ally backgrounds", "Should the allies on the left side of the HUD have their backgrounds? If Allowd, the backgrounds will be properly colored.", true, (ConfigFlags)2);
			AllowScoreboardLabels = Extensions.BindOption<bool>(config, "HUD Settings", "Allow inventories menu labels", "Should the player/items/equipment labels be visible on the inventories screen?", false, (ConfigFlags)2);
			AllowScoreboardItemHighlightColoring = Extensions.BindOption<bool>(config, "HUD Settings", "Allow changing inventory item icon highlight colors", "Should the highlights for item icons in the TAB inventories menu be colored based on the survivor that has those items?", true, (ConfigFlags)2);
			AllowAutoScoreboardHighlight = Extensions.BindOption<bool>(config, "HUD Settings", "Allow auto highlight when opening the inventory menu", "Should the automatic highlight for the first person in TAB inventories list be allowed?", false, (ConfigFlags)2);
			EnableConsistentDifficultyBarBrightness = Extensions.BindOption<bool>(config, "HUD Settings", "Enable consistent difficulty bar segment brightness", "Should the coloring for the difficulty bar stay at the same brightness instead of getting darker as the difficulty increases?", true, (ConfigFlags)2);
			AllowSimulacrumWaveBarAnimating = Extensions.BindOption<bool>(config, "HUD Settings", "Allow simulacrum wave progress bar animations", "Should the progress bar on the simulacrum's wave UI be allowed to animate & squish around whenever enemies spawn/enemies are left?\nNOTE: Will cause the bar to become stuck squished after a second or 2 of an active wave.", false, (ConfigFlags)2);
			AllowSurvivorSpecificEdits = Extensions.BindOption<bool>(config, "HUD Settings - Survivor Specific", "Allow survivor-specific HUD edits", "Should the editing phase for survivor-specific HUD elements be allowed to happen? This should be turned off if HUD structure edits are turned off.\n\nNOTE: This option is REALLY not supported, it may cause problems! This will also only take effect next stage or the next time the HUD is created!", true, (ConfigFlags)2);
			AllowVoidFiendMeterAnimating = Extensions.BindOption<bool>(config, "HUD Settings - Survivor Specific", "Allow Void Fiend corruption meter animations", "Should Void Fiend's corruption meter be allowed to animate & squish around whenever the percentage changes?\nNOTE: Currently, when the animations disabled, the colors of the meter do not change based on your form.", false, (ConfigFlags)2);
			SeekerMeditateHudPosition = Extensions.BindOption<SpecialConfig.SeekerMeditateHudPosition>(config, "HUD Settings - Survivor Specific", "Seeker Meditate Minigame UI Position", "Choose the position for the UI of the minigame you do for Seeker's meditation.", SpecialConfig.SeekerMeditateHudPosition.OverCrosshair, (ConfigFlags)2);
			SeekerLotusHudPosition = Extensions.BindOption<SpecialConfig.SeekerLotusHudPosition>(config, "HUD Settings - Survivor Specific", "Seeker Lotus UI Position", "Choose the position for the lotus flower thing on the UI that shows your progress towards your 7th meditation.", SpecialConfig.SeekerLotusHudPosition.LeftOfSkills, (ConfigFlags)2);
			BodyNameBlacklist_Config = Extensions.BindOption<string>(config, "HUD Settings - Survivor Specific", "Survivor Blacklist", "If the HUD gets messed up when playing with certain survivors, add their BODY name (i.e. CommandoBody) here to stop the majority of the mod's hud changes when playing that survivor. Each body name needs separated by a comma and NO spaces.", "", (ConfigFlags)2);
			BodyNameBlacklist_Array = BodyNameBlacklist_Config.Value.Split(',');
			AllowDebugLogging = Extensions.BindOption<bool>(config, "Other", "Allow debug logging", "Allow to do some extra debug logging that can help diagnose issues with the mod.", false, (ConfigFlags)2);
			if (RiskOfOptionsMod.ModIsRunning)
			{
				HudTransparency.SettingChanged += HudTransparency_SettingChanged;
				ShowSkillAndEquipmentOutlines.SettingChanged += ShowSkillAndEquipmentOutlines_SettingChanged;
				ShowSkillKeybinds.SettingChanged += ShowSkillKeybinds_SettingChanged;
				ShowSprintAndInventoryKeybinds.SettingChanged += ShowSprintAndInventoryKeybinds_SettingChanged;
				AllowInspectPanelFadeIn.SettingChanged += AllowInspectPanelFadeIn_SettingChanged;
				InspectPanelFadeInDuration.SettingChanged += InspectPanelFadeInDuration_SettingChanged;
				AllowAllyCardBackgrounds.SettingChanged += AllowAllyCardBackgrounds_SettingChanged;
				AllowScoreboardItemHighlightColoring.SettingChanged += AllowScoreboardItemHighlightColoring_SettingChanged;
				EnableConsistentDifficultyBarBrightness.SettingChanged += EnableConsistentDifficultyBarBrightness_SettingChanged;
				AllowSimulacrumWaveBarAnimating.SettingChanged += AllowSimulacrumWaveBarAnimating_SettingChanged;
				AllowVoidFiendMeterAnimating.SettingChanged += AllowVoidFiendMeterAnimating_SettingChanged;
				SeekerMeditateHudPosition.SettingChanged += SeekerMeditateHudPosition_SettingChanged;
				SeekerLotusHudPosition.SettingChanged += SeekerLotusUiPosition_SettingChanged;
				BodyNameBlacklist_Config.SettingChanged += BodyNameBlacklist_Config_SettingChanged;
				RiskOfOptionsMod.SetupModCategoryInfo();
			}
			if (LookingGlassMod.ModIsRunning)
			{
				LookingGlassMod.HookStatsPanelConfig_SettingChanged();
			}
		}
	}
	internal static class Extensions
	{
		internal static Transform FindWithPartialMatch(this Transform thisTransform, string partialName)
		{
			if (thisTransform.childCount == 0)
			{
				return null;
			}
			for (int i = 0; i < thisTransform.childCount; i++)
			{
				Transform child = thisTransform.GetChild(i);
				if (((Object)child).name.Contains(partialName))
				{
					return child;
				}
			}
			return null;
		}

		internal static List<Transform> FindListOfPartialMatches(this Transform thisTransform, string partialName)
		{
			List<Transform> list = new List<Transform>();
			if (thisTransform.childCount == 0)
			{
				return null;
			}
			for (int i = 0; i < thisTransform.childCount; i++)
			{
				Transform child = thisTransform.GetChild(i);
				if (((Object)child).name.Contains(partialName))
				{
					list.Add(child);
				}
			}
			return list;
		}

		internal static void DisableImageComponent(this Transform transform)
		{
			Image val = default(Image);
			if (((Component)transform).TryGetComponent<Image>(ref val))
			{
				((Behaviour)val).enabled = false;
			}
			else
			{
				Log.Error("Could not find image component in transform " + ((Object)transform).name);
			}
		}

		internal static void DisableImageComponent(this GameObject gameObject)
		{
			Image val = default(Image);
			if (gameObject.TryGetComponent<Image>(ref val))
			{
				((Behaviour)val).enabled = false;
			}
			else
			{
				Log.Error("Could not find image component in GameObject " + ((Object)gameObject).name);
			}
		}

		internal static void DisableImageComponent(this AllyCardController allyCardController)
		{
			Image val = default(Image);
			if (((Component)allyCardController).TryGetComponent<Image>(ref val))
			{
				((Behaviour)val).enabled = false;
			}
			else
			{
				Log.Error("Could not find image component in allyCardController " + ((Object)allyCardController).name);
			}
		}

		internal static void DisableRawImageComponent(this Transform transform)
		{
			RawImage val = default(RawImage);
			if (((Component)transform).TryGetComponent<RawImage>(ref val))
			{
				((Behaviour)val).enabled = false;
			}
			else
			{
				Log.Error("Could not find image component in transform " + ((Object)transform).name);
			}
		}

		internal static void DisableRawImageComponent(this GameObject gameObject)
		{
			RawImage val = default(RawImage);
			if (gameObject.TryGetComponent<RawImage>(ref val))
			{
				((Behaviour)val).enabled = false;
			}
			else
			{
				Log.Error("Could not find image component in allyCardController " + ((Object)gameObject).name);
			}
		}
	}
	internal class HudResources
	{
		internal static class HudAssets
		{
			private static readonly AssetReferenceT<Texture2D> _textWhiteReference = new AssetReferenceT<Texture2D>(RoR2_Base_Common.texWhite_png);

			internal static Sprite WhiteSprite;

			private static readonly AssetReferenceT<Material> _fontMaterialReference = new AssetReferenceT<Material>(RoR2_Base_Common_Fonts_Bombardier.tmpBombDropshadow3D_mat);

			internal static Material FontMaterial;

			private static readonly AssetReferenceT<GameObject> _gameEndReportPanelAssetReference = new AssetReferenceT<GameObject>(RoR2_Base_UI.GameEndReportPanel_prefab);

			private static readonly AssetReferenceT<GameObject> _scoreboardStripAssetReference = new AssetReferenceT<GameObject>(RoR2_Base_UI.ScoreboardStrip_prefab);

			private static readonly AssetReferenceT<GameObject> _itemIconIngameAssetReference = new AssetReferenceT<GameObject>(RoR2_Base_UI.ItemIconScoreboard_InGame_prefab);

			private static readonly AssetReferenceT<GameObject> _moonDetonationPanelAssetReference = new AssetReferenceT<GameObject>(RoR2_Base_UI.HudCountdownPanel_prefab);

			private static readonly AssetReferenceT<GameObject> _chatBoxAssetReference = new AssetReferenceT<GameObject>(RoR2_Base_UI.ChatBox_prefab);

			private static readonly AssetReferenceT<GameObject> _statStripTemplateAssetReference = new AssetReferenceT<GameObject>(RoR2_Base_UI.StatStripTemplate_prefab);

			internal static void SetupAssets()
			{
				AssignSomeAssets();
				EditOtherAssets();
			}

			private static void AssignSomeAssets()
			{
				//IL_0013: 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)
				//IL_0046: 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_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				Texture2D texWhite = null;
				AsyncOperationHandle<Texture2D> val = AssetAsyncReferenceManager<Texture2D>.LoadAsset(_textWhiteReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<Texture2D> handle)
				{
					texWhite = handle.Result;
				};
				WhiteSprite = Sprite.Create(texWhite, new Rect(0f, 0f, 4f, 4f), Vector2.zero);
				AsyncOperationHandle<Material> val2 = AssetAsyncReferenceManager<Material>.LoadAsset(_fontMaterialReference, (AsyncReferenceHandleUnloadType)2);
				val2.Completed += delegate(AsyncOperationHandle<Material> handle)
				{
					FontMaterial = handle.Result;
				};
			}

			private static void EditOtherAssets()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: 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_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0105: Unknown result type (might be due to invalid IL or missing references)
				AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_gameEndReportPanelAssetReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
				{
					AssetEdits.RemoveGameEndReportPanelDetails(handle.Result);
					AssetAsyncReferenceManager<GameObject>.UnloadAsset(_gameEndReportPanelAssetReference);
				};
				val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_scoreboardStripAssetReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
				{
					AssetEdits.EditScoreboardStripAsset(handle.Result);
					AssetAsyncReferenceManager<GameObject>.UnloadAsset(_scoreboardStripAssetReference);
				};
				val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_itemIconIngameAssetReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
				{
					AssetEdits.EditItemIconIngame(handle.Result);
					AssetAsyncReferenceManager<GameObject>.UnloadAsset(_itemIconIngameAssetReference);
				};
				val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_moonDetonationPanelAssetReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
				{
					AssetEdits.RemoveMoonDetonationPanelDetails(handle.Result);
					AssetAsyncReferenceManager<GameObject>.UnloadAsset(_moonDetonationPanelAssetReference);
				};
				val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_chatBoxAssetReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
				{
					AssetEdits.RemoveChatBoxDetails(handle.Result);
					AssetAsyncReferenceManager<GameObject>.UnloadAsset(_chatBoxAssetReference);
				};
				val = AssetAsyncReferenceManager<GameObject>.LoadAsset(_statStripTemplateAssetReference, (AsyncReferenceHandleUnloadType)2);
				val.Completed += delegate(AsyncOperationHandle<GameObject> handle)
				{
					handle.Result.DisableImageComponent();
					AssetAsyncReferenceManager<GameObject>.UnloadAsset(_statStripTemplateAssetReference);
				};
			}
		}

		internal static class ImportantHudTransforms
		{
			internal static Transform RunInfoHudPanel;

			internal static Transform RightInfoBar;

			internal static Transform BarRoots;

			internal static Transform InspectPanelArea
			{
				get
				{
					if (!Main.IsHudFinishedLoading)
					{
						return null;
					}
					return Helpers.GetContainerFromScoreboardPanel(Main.MyHudLocator.FindChild("ScoreboardPanel")).GetChild(2).GetChild(0);
				}
			}

			internal static void FindImportantHudTransforms()
			{
				RunInfoHudPanel = Main.MyHudLocator.FindChild("UpperRightCluster").GetChild(0);
				RightInfoBar = RunInfoHudPanel.Find("RightInfoBar");
				BarRoots = Main.MyHudLocator.FindChild("BottomLeftCluster").Find("BarRoots");
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			if (ConfigOptions.AllowDebugLogging.Value)
			{
				_logSource.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public static class Main
	{
		internal static class OnHooks
		{
			[CompilerGenerated]
			private sealed class <DelayOnCameraChange>d__5 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public CameraRigController cameraRigController;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <DelayOnCameraChange>d__5(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = null;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						Log.Debug("DelayOnCameraChange");
						if ((Object)(object)cameraRigController.targetBody == (Object)null)
						{
							Log.Error("targetCharacterBody WAS NULL IN DelayOnCameraChange! NO HUD CHANGES WILL OCCUR!");
							return false;
						}
						if (ConfigOptions.AllowHudStructureEdits.Value)
						{
							HudStructure.MoveSpectatorLabel();
						}
						if (ConfigOptions.AllowSurvivorSpecificEdits.Value)
						{
							EditSurvivorSpecificUI();
						}
						if (ConfigOptions.AllowHudColorEdits.Value)
						{
							HUD myHud = MyHud;
							if (myHud != null)
							{
								((MonoBehaviour)myHud).StartCoroutine(HudColor.SetSurvivorColorFromTargetBody(cameraRigController.targetBody));
							}
						}
						return false;
					}
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			[CompilerGenerated]
			private sealed class <DelayRemoveBadHealthSubBar>d__9 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public Transform backgroundPanel;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <DelayRemoveBadHealthSubBar>d__9(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = null;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						backgroundPanel.GetChild(2)?.DisableImageComponent();
						return false;
					}
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			[CompilerGenerated]
			private sealed class <DelayScoreboardController_Rebuild>d__15 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public ScoreboardController scoreboardController;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <DelayScoreboardController_Rebuild>d__15(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						if (!IsHudEditable)
						{
							return false;
						}
						<>2__current = null;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						EditScoreboardStripsIfApplicable(scoreboardController);
						if (IsGameModeSimulacrum)
						{
							SetupSuppressedItemsStripEditor(scoreboardController);
						}
						return false;
					}
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			[CompilerGenerated]
			private sealed class <WaitForHpBarToFinishLoading>d__1 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public Transform hpBarShrunkenRoot;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <WaitForHpBarToFinishLoading>d__1(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						break;
					case 1:
						<>1__state = -1;
						break;
					}
					if (hpBarShrunkenRoot.childCount == 0)
					{
						Log.Debug("HUD HP bar does not have any children to modify yet, waiting");
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					BeginLiveHudChanges();
					return false;
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			internal static void HUD_Awake(orig_Awake orig, HUD hud)
			{
				orig.Invoke(hud);
				Log.Debug("HUD_Awake");
				MyHud = hud;
				MyHudLocator = ((Component)MyHud).GetComponent<ChildLocator>();
				HudResources.ImportantHudTransforms.FindImportantHudTransforms();
				Transform hpBarShrunkenRoot = HudResources.ImportantHudTransforms.BarRoots.Find("HealthbarRoot").Find("ShrunkenRoot");
				HUD myHud = MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(WaitForHpBarToFinishLoading(hpBarShrunkenRoot));
				}
			}

			[IteratorStateMachine(typeof(<WaitForHpBarToFinishLoading>d__1))]
			private static IEnumerator WaitForHpBarToFinishLoading(Transform hpBarShrunkenRoot)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <WaitForHpBarToFinishLoading>d__1(0)
				{
					hpBarShrunkenRoot = hpBarShrunkenRoot
				};
			}

			private static void BeginLiveHudChanges()
			{
				IsHudFinishedLoading = true;
				string name = ((Object)HudCameraTargetBody).name;
				string text = name.Substring(0, name.Length - 7);
				if (ConfigOptions.BodyNameBlacklist_Array.Contains(text))
				{
					Log.Info("Character body " + text + " is blacklisted from the HUD! 99% of HUD changes will not occur.");
					IsHudUserBlacklisted = true;
					return;
				}
				Log.Debug("Character body " + text + " is NOT blacklisted from the HUD!");
				IsHudUserBlacklisted = false;
				HudDetails.RemoveBadHealthSubBarFromPersonalHealthBar();
				HUD myHud = MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(HudDetails.DelayRemoveBadHealthSubBarFromAllAllyCards());
				}
				Extensions.GetOrAddComponent<CanvasGroup>((Component)(object)MyHud).alpha = ConfigOptions.HudTransparency.Value;
				if (ConfigOptions.AllowHudStructureEdits.Value)
				{
					HudStructure.EditHudStructure();
					HudStructure.RepositionHudElementsBasedOnWidth();
				}
				if (ConfigOptions.AllowHudDetailsEdits.Value)
				{
					HudDetails.EditHudDetails();
				}
				if (ConfigOptions.EnableConsistentDifficultyBarBrightness.Value && ConfigOptions.AllowHudColorEdits.Value)
				{
					HudDetails.SetFakeInfiniteLastDifficultySegmentStatus();
				}
				if (ConfigOptions.AllowSurvivorSpecificEdits.Value)
				{
					EditSurvivorSpecificUI();
				}
			}

			internal static void HUD_OnDestroy(orig_OnDestroy orig, HUD self)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				IsHudFinishedLoading = false;
				IsHudUserBlacklisted = true;
				IsColorChangeCoroutineWaiting = false;
				HudColor.SurvivorColor = Color.clear;
			}

			internal static void CameraModeBase_OnTargetChanged(orig_OnTargetChanged orig, CameraModeBase self, CameraRigController cameraRigController, OnTargetChangedArgs args)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, cameraRigController, args);
				if (!Object.op_Implicit((Object)(object)cameraRigController.targetBody))
				{
					Log.Debug("cameraRigController.targetBody was invalid? returning");
				}
				else if ((Object)(object)MyHud != (Object)null)
				{
					HUD myHud = MyHud;
					if (myHud != null)
					{
						((MonoBehaviour)myHud).StartCoroutine(DelayOnCameraChange(cameraRigController));
					}
				}
				else
				{
					Log.Debug("MyHud was null in CameraModeBase_OnTargetChanged somehow, not doing DelayOnCameraChange");
				}
			}

			[IteratorStateMachine(typeof(<DelayOnCameraChange>d__5))]
			private static IEnumerator DelayOnCameraChange(CameraRigController cameraRigController)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <DelayOnCameraChange>d__5(0)
				{
					cameraRigController = cameraRigController
				};
			}

			private static void EditSurvivorSpecificUI()
			{
				if (IsHudEditable)
				{
					HudStructure.ResetSkillsScalerLocalPositionToDefault();
					HudStructure.ResetInventoryClusterLocalPositionToDefault();
					HudStructure.ResetSprintClusterLocalPositionToDefault();
					Main.OnSurvivorSpecificHudEditsFinished?.Invoke();
					HudStructure.RepositionSkillScaler();
					HudStructure.RepositionSprintAndInventoryReminders();
				}
				else
				{
					Log.Debug("Cannot do survivor-specific HUD edits, the HUD is not editable!");
				}
			}

			internal static void BaseConVar_AttemptSetString(orig_AttemptSetString orig, BaseConVar self, string newValue)
			{
				orig.Invoke(self, newValue);
				if (self.name == "resolution")
				{
					HudStructure.RepositionHudElementsBasedOnWidth();
				}
			}

			internal static void AllyCardController_Awake(orig_Awake orig, AllyCardController self)
			{
				orig.Invoke(self);
				if (!IsHudUserBlacklisted)
				{
					Transform child = ((Component)self).transform.GetChild(0);
					HUD myHud = MyHud;
					if (myHud != null)
					{
						((MonoBehaviour)myHud).StartCoroutine(HudDetails.DelayEditAllyCardPortrait(child));
					}
					if (!ConfigOptions.AllowAllyCardBackgrounds.Value)
					{
						self.DisableImageComponent();
					}
					HealthBar healthBar = self.healthBar;
					Transform backgroundPanel = ((healthBar != null) ? ((Component)healthBar).transform.GetChild(0) : null);
					HUD myHud2 = MyHud;
					if (myHud2 != null)
					{
						((MonoBehaviour)myHud2).StartCoroutine(DelayRemoveBadHealthSubBar(backgroundPanel));
					}
				}
			}

			[IteratorStateMachine(typeof(<DelayRemoveBadHealthSubBar>d__9))]
			private static IEnumerator DelayRemoveBadHealthSubBar(Transform backgroundPanel)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <DelayRemoveBadHealthSubBar>d__9(0)
				{
					backgroundPanel = backgroundPanel
				};
			}

			internal static void AllyCardController_UpdateInfo(orig_UpdateInfo orig, AllyCardController self)
			{
				orig.Invoke(self);
				if (!IsHudUserBlacklisted && ConfigOptions.AllowAllyCardBackgrounds.Value)
				{
					HudColor.ColorAllyCardControllerBackground(self);
				}
			}

			internal static void HealthBar_InitializeHealthBar(orig_InitializeHealthBar orig, HealthBar self)
			{
				if (((Object)self).name != "HealthbarRoot")
				{
					orig.Invoke(self);
					return;
				}
				Log.Debug("HealthBar_InitializeHealthBar");
				self.spriteAsNumberManager = null;
				Transform val = ((Component)self).transform.Find("Managed_Sprite_HP");
				if ((Object)(object)val != (Object)null)
				{
					((Component)val).gameObject.SetActive(false);
				}
				else
				{
					Log.Debug("Couldn't find managedSpriteHP! This is OK though since it isn't needed for the HUD.");
				}
				Transform val2 = ((Component)self).transform.Find("Slash");
				if ((Object)(object)val2 != (Object)null)
				{
					((Component)val2).gameObject.SetActive(true);
				}
				else
				{
					Log.Error("Couldn't find \"Slash\" on the HP bar! Another mod may have already disabled/removed it. This means the improved HP bar text will not be shown, and no text will be shown if \"managedSpriteHP\" was successfully set to inactive. Report this on github!");
				}
				orig.Invoke(self);
			}

			internal static void InfiniteTowerWaveProgressBar_OnEnable(orig_OnEnable orig, InfiniteTowerWaveProgressBar simulacrumTowerWaveProgressBar)
			{
				orig.Invoke(simulacrumTowerWaveProgressBar);
				if (!IsHudUserBlacklisted)
				{
					simulacrumTowerWaveProgressBar.barImage.sprite = HudResources.HudAssets.WhiteSprite;
					HudColor.ColorSimulacrumWaveProgressBar(((Component)simulacrumTowerWaveProgressBar.barImage).transform.parent);
					HudDetails.SetSimulacrumWaveBarAnimatorStatus();
				}
			}

			internal static void NotificationUIController_SetUpNotification(orig_SetUpNotification orig, NotificationUIController self, NotificationInfo notificationInfo)
			{
				orig.Invoke(self, notificationInfo);
				if (!IsHudUserBlacklisted)
				{
					HUD myHud = MyHud;
					if (myHud != null)
					{
						((MonoBehaviour)myHud).StartCoroutine(HudDetails.DelayRemoveNotificationBackground());
					}
				}
			}

			internal static void ScoreboardController_Rebuild(orig_Rebuild orig, ScoreboardController scoreboardController)
			{
				if (IsHudUserBlacklisted)
				{
					orig.Invoke(scoreboardController);
					return;
				}
				HudDetails.SetScoreboardLabelsActiveOrNot(((Component)scoreboardController).transform);
				orig.Invoke(scoreboardController);
				HUD myHud = MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(DelayScoreboardController_Rebuild(scoreboardController));
				}
			}

			[IteratorStateMachine(typeof(<DelayScoreboardController_Rebuild>d__15))]
			private static IEnumerator DelayScoreboardController_Rebuild(ScoreboardController scoreboardController)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <DelayScoreboardController_Rebuild>d__15(0)
				{
					scoreboardController = scoreboardController
				};
			}

			private static void EditScoreboardStripsIfApplicable(ScoreboardController scoreboardController)
			{
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				foreach (ScoreboardStrip element in scoreboardController.stripAllocator.elements)
				{
					Transform transform = ((Component)element).transform;
					if (element.itemInventoryDisplay.itemIconPrefabWidth != 58f)
					{
						HudStructure.EditScoreboardStrip(element);
					}
					Image component = ((Component)transform.GetChild(0)).GetComponent<Image>();
					if (IsHudEditable && (Object)(object)element.userBody != (Object)null && !Helpers.AreColorsEqualIgnoringAlpha(((Graphic)component).color, element.userBody.bodyColor))
					{
						HudColor.ColorAllOfScoreboardStrip(element, element.userBody.bodyColor);
					}
				}
			}

			private static void SetupSuppressedItemsStripEditor(ScoreboardController scoreboardController)
			{
				Transform obj = ((Component)scoreboardController).transform.Find("Container/SuppressedItems");
				if (obj != null)
				{
					Extensions.GetOrAddComponent<HudEditorComponents.SuppressedItemsStripEditor>((Component)(object)obj);
				}
			}

			internal static void ScoreboardController_SelectFirstScoreboardStrip(orig_SelectFirstScoreboardStrip orig, ScoreboardController self)
			{
				if (IsHudUserBlacklisted)
				{
					orig.Invoke(self);
				}
				if (ConfigOptions.AllowAutoScoreboardHighlight.Value)
				{
					orig.Invoke(self);
				}
			}

			internal static void DifficultyBarController_OnCurrentSegmentIndexChanged(orig_OnCurrentSegmentIndexChanged orig, DifficultyBarController self, int newSegmentIndex)
			{
				orig.Invoke(self, newSegmentIndex);
				if (!IsHudUserBlacklisted)
				{
					Log.Debug("DifficultyBarController_OnCurrentSegmentIndexChanged");
					Log.Debug($"newSegmentIndex is {newSegmentIndex}");
					Log.Debug($"ConfigOptions.EnableConsistentDifficultyBarBrightness.Value is {ConfigOptions.EnableConsistentDifficultyBarBrightness.Value}");
					if (ConfigOptions.EnableConsistentDifficultyBarBrightness.Value)
					{
						HudDetails.SetFakeInfiniteLastDifficultySegmentStatus();
					}
				}
			}
		}

		internal static class ILHooks
		{
			[CompilerGenerated]
			private sealed class <DelayFixFirstBuffRotation>d__2 : IEnumerator<object>, IEnumerator, IDisposable
			{
				private int <>1__state;

				private object <>2__current;

				public RectTransform rectTransform;

				object IEnumerator<object>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <DelayFixFirstBuffRotation>d__2(int <>1__state)
				{
					this.<>1__state = <>1__state;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = null;
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						if (IsHudFinishedLoading)
						{
							((Transform)rectTransform).rotation = Quaternion.identity;
						}
						return false;
					}
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}
			}

			internal static void BossGroup_UpdateObservations(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "<sprite name=\"CloudRight\" tint=1>")
				}))
				{
					Log.Error("COULD NOT IL HOOK BossGroup_UpdateObservations");
					Log.Warning($"cursor is {val}");
					Log.Warning($"il is {il}");
				}
				else
				{
					val.EmitDelegate<Func<string, string>>((Func<string, string>)((string cloudRightString) => cloudRightString.Insert(0, " ")));
				}
			}

			internal static void BuffDisplay_UpdateLayout(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				MethodReference val2 = default(MethodReference);
				if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val2),
					(Instruction x) => ILPatternMatchingExt.MatchEndfinally(x),
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0)
				}))
				{
					Log.Error("COULD NOT IL HOOK BuffDisplay_UpdateLayout");
					Log.Warning($"cursor is {val}");
					Log.Warning($"il is {il}");
					return;
				}
				val.EmitDelegate<Action<BuffDisplay>>((Action<BuffDisplay>)delegate(BuffDisplay buffDisplay)
				{
					//IL_008d: Unknown result type (might be due to invalid IL or missing references)
					if (!(((Object)buffDisplay).name != "BuffDisplayRoot") && buffDisplay.buffIconDisplayData.Count >= 1)
					{
						if ((Object)(object)buffDisplay.buffIconDisplayData[0].buffIconComponent != (Object)null)
						{
							HUD myHud = MyHud;
							if (myHud != null)
							{
								((MonoBehaviour)myHud).StartCoroutine(DelayFixFirstBuffRotation(buffDisplay.buffIconDisplayData[0].buffIconComponent.rectTransform));
							}
						}
						if (!IsHudUserBlacklisted)
						{
							((Transform)buffDisplay.rectTranform).localPosition = new Vector3((float)(-24 * buffDisplay.buffIconDisplayData.Count), -45f, 0f);
						}
					}
				});
				val.Emit(OpCodes.Ldarg_0);
			}

			[IteratorStateMachine(typeof(<DelayFixFirstBuffRotation>d__2))]
			private static IEnumerator DelayFixFirstBuffRotation(RectTransform rectTransform)
			{
				//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
				return new <DelayFixFirstBuffRotation>d__2(0)
				{
					rectTransform = rectTransform
				};
			}

			internal static void ItemIcon_SetItemIndex(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemIcon>(x, "glowImage"),
					(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "op_Implicit")
				}))
				{
					Log.Error("COULD NOT IL HOOK ItemIcon_SetItemIndex PART 1");
					Log.Warning($"cursor is {val}");
					Log.Warning($"il is {il}");
					return;
				}
				try
				{
					val.Emit(OpCodes.Ldarg_0);
					val.EmitDelegate<Action<ItemIcon>>((Action<ItemIcon>)delegate(ItemIcon itemIcon)
					{
						if (!IsHudUserBlacklisted && !(((Object)itemIcon.image).name != "ItemIconScoreboard_InGame(Clone)"))
						{
							itemIcon.glowImage = ((Component)((Component)itemIcon).transform.GetChild(1)).GetComponent<RawImage>();
							HudColor.ColorSingleItemIconHighlight(itemIcon);
						}
					});
				}
				catch (Exception arg)
				{
					Log.Error($"COULD NOT EMIT INTO ItemIcon_SetItemIndex PART 1 DUE TO {arg}");
				}
				if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.75f),
					(Instruction x) => ILPatternMatchingExt.MatchNewobj<Color>(x),
					(Instruction x) => ILPatternMatchingExt.MatchCallvirt<Graphic>(x, "set_color")
				}))
				{
					Log.Error("COULD NOT IL HOOK ItemIcon_SetItemIndex PART 2");
					Log.Warning($"cursor is {val}");
					Log.Warning($"il is {il}");
					return;
				}
				ILLabel val2 = val.DefineLabel();
				try
				{
					val.MarkLabel(val2);
					val.Index = 0;
				}
				catch (Exception arg2)
				{
					Log.Error($"COULD NOT EMIT INTO ItemIcon_SetItemIndex PART 2 DUE TO {arg2}");
				}
				if (!val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[3]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemIcon>(x, "glowImage"),
					(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "op_Implicit")
				}))
				{
					Log.Error("COULD NOT IL HOOK ItemIcon_SetItemIndex PART 3");
					Log.Warning($"cursor is {val}");
					Log.Warning($"il is {il}");
					return;
				}
				try
				{
					val.Emit(OpCodes.Br, (object)val2);
				}
				catch (Exception arg3)
				{
					Log.Error($"COULD NOT EMIT INTO ItemIcon_SetItemIndex PART 3 DUE TO {arg3}");
				}
			}
		}

		internal static class Events
		{
			internal static void InfiniteTowerRun_onWaveInitialized(InfiniteTowerWaveController obj)
			{
				if (!IsHudUserBlacklisted)
				{
					HUD myHud = MyHud;
					if (myHud != null)
					{
						((MonoBehaviour)myHud).StartCoroutine(HudDetails.DelayRemoveSimulacrumWavePopUpPanelDetails());
					}
					HUD myHud2 = MyHud;
					if (myHud2 != null)
					{
						((MonoBehaviour)myHud2).StartCoroutine(HudDetails.DelayRemoveTimeUntilNextWaveBackground());
					}
				}
			}

			internal static void Run_onRunStartGlobal(Run obj)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				HudColor.SurvivorColor = Color.clear;
			}

			internal static void RunArtifactManager_onArtifactEnabledGlobal([NotNull] RunArtifactManager runArtifactManager, [NotNull] ArtifactDef artifactDef)
			{
				if (artifactDef.cachedName == "MonsterTeamGainsItems" && runArtifactManager.IsArtifactEnabled(artifactDef) && IsHudEditable)
				{
					HUD myHud = MyHud;
					if (myHud != null)
					{
						((MonoBehaviour)myHud).StartCoroutine(HudDetails.DelayRemoveMonstersItemsPanelDetails());
					}
				}
			}
		}

		internal static class Helpers
		{
			public static Color GetAdjustedColor(Color rgbColor, float saturationMultiplier = 1f, float brightnessMultiplier = 1f, float colorIntensityMultiplier = 1f, float transparencyMultiplier = 1f)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: 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)
				float num = default(float);
				float num2 = default(float);
				float num3 = default(float);
				Color.RGBToHSV(rgbColor, ref num, ref num2, ref num3);
				Color result = Color.HSVToRGB(num, num2 * saturationMultiplier, num3 * brightnessMultiplier, true);
				result.r = rgbColor.r * colorIntensityMultiplier;
				result.g = rgbColor.g * colorIntensityMultiplier;
				result.b = rgbColor.b * colorIntensityMultiplier;
				result.a = rgbColor.a * transparencyMultiplier;
				return result;
			}

			internal static void LogMissingHudVariable(string methodName, string variableName, string containingClassName = null)
			{
				string text = "Could not do " + methodName;
				if (containingClassName != null)
				{
					text = text + " in " + containingClassName;
				}
				text = text + "! The " + variableName + " was null or did it not exist!";
				Log.Error(text);
			}

			internal static bool AreColorsEqualIgnoringAlpha(Color color1, Color color2)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (color1.r == color2.r && color1.g == color2.g)
				{
					return color1.b == color2.b;
				}
				return false;
			}

			internal static Color ChangeColorWhileKeepingAlpha(Color originalColor, Color newColor)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: 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_0018: Unknown result type (might be due to invalid IL or missing references)
				return new Color(newColor.r, newColor.b, newColor.g, originalColor.a);
			}
		}

		public static HUD MyHud = null;

		public static ChildLocator MyHudLocator = null;

		public static bool IsHudFinishedLoading = false;

		public static bool IsHudUserBlacklisted = true;

		internal static bool IsColorChangeCoroutineWaiting = false;

		internal static List<Color> LastKnownScoreboardBodyColors = new List<Color>();

		public static bool IsHudEditable
		{
			get
			{
				if (IsHudFinishedLoading && !IsHudUserBlacklisted)
				{
					return (Object)(object)MyHudLocator != (Object)null;
				}
				return false;
			}
		}

		internal static CharacterBody HudCameraTargetBody
		{
			get
			{
				if (!Object.op_Implicit((Object)(object)MyHud))
				{
					Log.Error("HUD did not exist when trying to get HudCameraTargetBody!");
					return null;
				}
				if (!Object.op_Implicit((Object)(object)MyHud.targetBodyObject))
				{
					Log.Error("HUD did not have a valid targetBodyObject!");
					return null;
				}
				return MyHud.cameraRigController.targetBody;
			}
		}

		internal static bool IsGameModeSimulacrum => Run.instance.gameModeIndex == GameModeCatalog.FindGameModeIndex("InfiniteTowerRun");

		internal static bool AreSimulacrumWavesRunning
		{
			get
			{
				Run instance = Run.instance;
				if ((Object)(object)((InfiniteTowerRun)((instance is InfiniteTowerRun) ? instance : null)).waveController != (Object)null)
				{
					return true;
				}
				return false;
			}
		}

		public static event Action OnSurvivorSpecificHudEditsFinished;
	}
	public static class ModAssets
	{
		public static AssetBundle AssetBundle;

		public const string BundleName = "cleanesthud";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Plugin.PluginInfo.Location), "cleanesthud");

		public static void Init()
		{
			AssetBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("LordVGames.CleanestHud", "CleanestHud", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Awake <0>__HUD_Awake;

			public static hook_OnDestroy <1>__HUD_OnDestroy;

			public static hook_OnTargetChanged <2>__CameraModeBase_OnTargetChanged;

			public static hook_AttemptSetString <3>__BaseConVar_AttemptSetString;

			public static hook_Awake <4>__AllyCardController_Awake;

			public static hook_UpdateInfo <5>__AllyCardController_UpdateInfo;

			public static hook_InitializeHealthBar <6>__HealthBar_InitializeHealthBar;

			public static hook_OnCurrentSegmentIndexChanged <7>__DifficultyBarController_OnCurrentSegmentIndexChanged;

			public static hook_OnEnable <8>__InfiniteTowerWaveProgressBar_OnEnable;

			public static hook_SetUpNotification <9>__NotificationUIController_SetUpNotification;

			public static hook_Rebuild <10>__ScoreboardController_Rebuild;

			public static hook_SelectFirstScoreboardStrip <11>__ScoreboardController_SelectFirstScoreboardStrip;

			public static hook_OnOverlayInstanceAdded <12>__VoidSurvivorController_OnOverlayInstanceAdded;

			public static hook_SetupInputUIIcons <13>__Meditate_SetupInputUIIcons;

			public static Manipulator <14>__BossGroup_UpdateObservations;

			public static Manipulator <15>__BuffDisplay_UpdateLayout;

			public static Manipulator <16>__ItemIcon_SetItemIndex;

			public static Action<InfiniteTowerWaveController> <17>__InfiniteTowerRun_onWaveInitialized;

			public static Action<Run> <18>__Run_onRunStartGlobal;

			public static ArtifactStateChangeDelegate <19>__RunArtifactManager_onArtifactEnabledGlobal;

			public static Action <20>__RepositionSeekerLotusUI;

			public static Action <21>__SetupViendEdits;

			public static Action<CharacterBody> <22>__CharacterBody_onBodyInventoryChangedGlobal;

			public static Action <23>__OnHudDetailEditsFinished;

			public static Action <24>__OnSurvivorSpecificHudEditsFinished;

			public static Action <25>__OnHudColorUpdate;

			public static hook_OnDestroy <26>__HUD_OnDestroy;

			public static Action <27>__SetWeaponTextStatus;

			public static Action <28>__OnSurvivorSpecificHudEditsFinished;

			public static Action <29>__OnHudColorUpdate;

			public static hook_OnDestroy <30>__HUD_OnDestroy;

			public static Action <31>__ConfigOptions_OnShowSprintAndInventoryKeybindsChanged;

			public static Action <32>__ConfigOptions_OnShowSkillKeybindsChanged;
		}

		public const string PluginAuthor = "LordVGames";

		public const string PluginName = "CleanestHud";

		public const string PluginVersion = "1.0.2";

		public const string PluginGUID = "LordVGames.CleanestHud";

		public static PluginInfo PluginInfo { get; private set; }

		public void Awake()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_0086: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_046b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			//IL_00fb: 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_0106: Expected O, but got Unknown
			//IL_011b: 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_0126: Expected O, but got Unknown
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Expected O, but got Unknown
			//IL_015b: 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_0166: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Expected O, but got Unknown
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Expected O, but got Unknown
			//IL_023b: 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_0246: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Expected O, but got Unknown
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Expected O, but got Unknown
			PluginInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			ModAssets.Init();
			ConfigOptions.BindConfigOptions(((BaseUnityPlugin)this).Config);
			HudResources.HudAssets.SetupAssets();
			object obj = <>O.<0>__HUD_Awake;
			if (obj == null)
			{
				hook_Awake val = Main.OnHooks.HUD_Awake;
				<>O.<0>__HUD_Awake = val;
				obj = (object)val;
			}
			HUD.Awake += (hook_Awake)obj;
			object obj2 = <>O.<1>__HUD_OnDestroy;
			if (obj2 == null)
			{
				hook_OnDestroy val2 = Main.OnHooks.HUD_OnDestroy;
				<>O.<1>__HUD_OnDestroy = val2;
				obj2 = (object)val2;
			}
			HUD.OnDestroy += (hook_OnDestroy)obj2;
			object obj3 = <>O.<2>__CameraModeBase_OnTargetChanged;
			if (obj3 == null)
			{
				hook_OnTargetChanged val3 = Main.OnHooks.CameraModeBase_OnTargetChanged;
				<>O.<2>__CameraModeBase_OnTargetChanged = val3;
				obj3 = (object)val3;
			}
			CameraModeBase.OnTargetChanged += (hook_OnTargetChanged)obj3;
			object obj4 = <>O.<3>__BaseConVar_AttemptSetString;
			if (obj4 == null)
			{
				hook_AttemptSetString val4 = Main.OnHooks.BaseConVar_AttemptSetString;
				<>O.<3>__BaseConVar_AttemptSetString = val4;
				obj4 = (object)val4;
			}
			BaseConVar.AttemptSetString += (hook_AttemptSetString)obj4;
			object obj5 = <>O.<4>__AllyCardController_Awake;
			if (obj5 == null)
			{
				hook_Awake val5 = Main.OnHooks.AllyCardController_Awake;
				<>O.<4>__AllyCardController_Awake = val5;
				obj5 = (object)val5;
			}
			AllyCardController.Awake += (hook_Awake)obj5;
			object obj6 = <>O.<5>__AllyCardController_UpdateInfo;
			if (obj6 == null)
			{
				hook_UpdateInfo val6 = Main.OnHooks.AllyCardController_UpdateInfo;
				<>O.<5>__AllyCardController_UpdateInfo = val6;
				obj6 = (object)val6;
			}
			AllyCardController.UpdateInfo += (hook_UpdateInfo)obj6;
			object obj7 = <>O.<6>__HealthBar_InitializeHealthBar;
			if (obj7 == null)
			{
				hook_InitializeHealthBar val7 = Main.OnHooks.HealthBar_InitializeHealthBar;
				<>O.<6>__HealthBar_InitializeHealthBar = val7;
				obj7 = (object)val7;
			}
			HealthBar.InitializeHealthBar += (hook_InitializeHealthBar)obj7;
			object obj8 = <>O.<7>__DifficultyBarController_OnCurrentSegmentIndexChanged;
			if (obj8 == null)
			{
				hook_OnCurrentSegmentIndexChanged val8 = Main.OnHooks.DifficultyBarController_OnCurrentSegmentIndexChanged;
				<>O.<7>__DifficultyBarController_OnCurrentSegmentIndexChanged = val8;
				obj8 = (object)val8;
			}
			DifficultyBarController.OnCurrentSegmentIndexChanged += (hook_OnCurrentSegmentIndexChanged)obj8;
			object obj9 = <>O.<8>__InfiniteTowerWaveProgressBar_OnEnable;
			if (obj9 == null)
			{
				hook_OnEnable val9 = Main.OnHooks.InfiniteTowerWaveProgressBar_OnEnable;
				<>O.<8>__InfiniteTowerWaveProgressBar_OnEnable = val9;
				obj9 = (object)val9;
			}
			InfiniteTowerWaveProgressBar.OnEnable += (hook_OnEnable)obj9;
			object obj10 = <>O.<9>__NotificationUIController_SetUpNotification;
			if (obj10 == null)
			{
				hook_SetUpNotification val10 = Main.OnHooks.NotificationUIController_SetUpNotification;
				<>O.<9>__NotificationUIController_SetUpNotification = val10;
				obj10 = (object)val10;
			}
			NotificationUIController.SetUpNotification += (hook_SetUpNotification)obj10;
			object obj11 = <>O.<10>__ScoreboardController_Rebuild;
			if (obj11 == null)
			{
				hook_Rebuild val11 = Main.OnHooks.ScoreboardController_Rebuild;
				<>O.<10>__ScoreboardController_Rebuild = val11;
				obj11 = (object)val11;
			}
			ScoreboardController.Rebuild += (hook_Rebuild)obj11;
			object obj12 = <>O.<11>__ScoreboardController_SelectFirstScoreboardStrip;
			if (obj12 == null)
			{
				hook_SelectFirstScoreboardStrip val12 = Main.OnHooks.ScoreboardController_SelectFirstScoreboardStrip;
				<>O.<11>__ScoreboardController_SelectFirstScoreboardStrip = val12;
				obj12 = (object)val12;
			}
			ScoreboardController.SelectFirstScoreboardStrip += (hook_SelectFirstScoreboardStrip)obj12;
			object obj13 = <>O.<12>__VoidSurvivorController_OnOverlayInstanceAdded;
			if (obj13 == null)
			{
				hook_OnOverlayInstanceAdded val13 = VoidFiend.VoidSurvivorController_OnOverlayInstanceAdded;
				<>O.<12>__VoidSurvivorController_OnOverlayInstanceAdded = val13;
				obj13 = (object)val13;
			}
			VoidSurvivorController.OnOverlayInstanceAdded += (hook_OnOverlayInstanceAdded)obj13;
			object obj14 = <>O.<13>__Meditate_SetupInputUIIcons;
			if (obj14 == null)
			{
				hook_SetupInputUIIcons val14 = Seeker.Meditate_SetupInputUIIcons;
				<>O.<13>__Meditate_SetupInputUIIcons = val14;
				obj14 = (object)val14;
			}
			Meditate.SetupInputUIIcons += (hook_SetupInputUIIcons)obj14;
			object obj15 = <>O.<14>__BossGroup_UpdateObservations;
			if (obj15 == null)
			{
				Manipulator val15 = Main.ILHooks.BossGroup_UpdateObservations;
				<>O.<14>__BossGroup_UpdateObservations = val15;
				obj15 = (object)val15;
			}
			BossGroup.UpdateObservations += (Manipulator)obj15;
			object obj16 = <>O.<15>__BuffDisplay_UpdateLayout;
			if (obj16 == null)
			{
				Manipulator val16 = Main.ILHooks.BuffDisplay_UpdateLayout;
				<>O.<15>__BuffDisplay_UpdateLayout = val16;
				obj16 = (object)val16;
			}
			BuffDisplay.UpdateLayout += (Manipulator)obj16;
			object obj17 = <>O.<16>__ItemIcon_SetItemIndex;
			if (obj17 == null)
			{
				Manipulator val17 = Main.ILHooks.ItemIcon_SetItemIndex;
				<>O.<16>__ItemIcon_SetItemIndex = val17;
				obj17 = (object)val17;
			}
			ItemIcon.SetItemIndex += (Manipulator)obj17;
			InfiniteTowerRun.onWaveInitialized += Main.Events.InfiniteTowerRun_onWaveInitialized;
			Run.onRunStartGlobal += Main.Events.Run_onRunStartGlobal;
			object obj18 = <>O.<19>__RunArtifactManager_onArtifactEnabledGlobal;
			if (obj18 == null)
			{
				ArtifactStateChangeDelegate val18 = Main.Events.RunArtifactManager_onArtifactEnabledGlobal;
				<>O.<19>__RunArtifactManager_onArtifactEnabledGlobal = val18;
				obj18 = (object)val18;
			}
			RunArtifactManager.onArtifactEnabledGlobal += (ArtifactStateChangeDelegate)obj18;
			Main.OnSurvivorSpecificHudEditsFinished += Seeker.RepositionSeekerLotusUI;
			ConfigOptions.OnShowSkillKeybindsChanged += Seeker.RepositionSeekerLotusUI;
			Main.OnSurvivorSpecificHudEditsFinished += VoidFiend.SetupViendEdits;
			if (Starstorm2.ModIsRunning)
			{
				CharacterBody.onBodyInventoryChangedGlobal += Starstorm2.CharacterBody_onBodyInventoryChangedGlobal;
			}
			if (LookingGlassMod.ModIsRunning)
			{
				HudDetails.OnHudDetailEditsFinished += LookingGlassMod.OnHudDetailEditsFinished;
			}
			if (Driver.ModIsRunning)
			{
				try
				{
					new Harmony("LordVGames.CleanestHud").CreateClassProcessor(typeof(Driver.HarmonyPatches)).Patch();
					Main.OnSurvivorSpecificHudEditsFinished += Driver.OnSurvivorSpecificHudEditsFinished;
					HudColor.OnHudColorUpdate += Driver.OnHudColorUpdate;
					object obj19 = <>O.<26>__HUD_OnDestroy;
					if (obj19 == null)
					{
						hook_OnDestroy val19 = Driver.HUD_OnDestroy;
						<>O.<26>__HUD_OnDestroy = val19;
						obj19 = (object)val19;
					}
					HUD.OnDestroy += (hook_OnDestroy)obj19;
					ConfigOptions.OnShowSkillKeybindsChanged += Driver.SetWeaponTextStatus;
				}
				catch
				{
					Log.Error("Couldn't setup Driver mod support! Either Driver mod added support itself or something else went wrong.");
				}
			}
			if (Myst.ModIsRunning)
			{
				Main.OnSurvivorSpecificHudEditsFinished += Myst.OnSurvivorSpecificHudEditsFinished;
				HudColor.OnHudColorUpdate += Myst.OnHudColorUpdate;
				object obj21 = <>O.<30>__HUD_OnDestroy;
				if (obj21 == null)
				{
					hook_OnDestroy val20 = Myst.HUD_OnDestroy;
					<>O.<30>__HUD_OnDestroy = val20;
					obj21 = (object)val20;
				}
				HUD.OnDestroy += (hook_OnDestroy)obj21;
				ConfigOptions.OnShowSprintAndInventoryKeybindsChanged += Myst.ConfigOptions_OnShowSprintAndInventoryKeybindsChanged;
				ConfigOptions.OnShowSkillKeybindsChanged += Myst.ConfigOptions_OnShowSkillKeybindsChanged;
			}
		}
	}
}
namespace CleanestHud.ModSupport
{
	internal class Driver
	{
		[HarmonyPatch]
		internal static class HarmonyPatches
		{
			[HarmonyPatch(typeof(DriverHooks), "NormalHudSetup")]
			[HarmonyILManipulator]
			internal static void TakeActionRegardingThatIndividual(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val = new ILCursor(il);
				ILLabel val2 = val.DefineLabel();
				if (!val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "SprintCluster")
				}))
				{
					Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name + " PART 1");
					Log.Warning($"il is {il}");
				}
				val.EmitDelegate<Func<bool>>((Func<bool>)(() => Main.IsHudUserBlacklisted));
				val.Emit(OpCodes.Brfalse, (object)val2);
				if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0),
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "InventoryCluster")
				}))
				{
					Log.Error("COULD NOT IL HOOK " + ((MemberReference)il.Method).Name + " PART 2");
					Log.Warning($"il is {il}");
				}
				val.Index += 4;
				val.MarkLabel(val2);
			}

			[HarmonyPatch(typeof(DriverHooks), "NormalHudSetup")]
			[HarmonyPrefix]
			internal static bool ShouldAllowWeaponSlotCreation()
			{
				if (Main.IsHudUserBlacklisted)
				{
					return true;
				}
				return AllowDriverWeaponSlotCreation;
			}
		}

		[CompilerGenerated]
		private sealed class <DelayEditWeaponSlotStructure>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayEditWeaponSlotStructure>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					try
					{
						EditWeaponSlotStructure();
					}
					catch
					{
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool? _modexists;

		private static bool AllowDriverWeaponSlotCreation;

		internal static bool ModIsRunning
		{
			get
			{
				bool valueOrDefault = _modexists.GetValueOrDefault();
				if (!_modexists.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.rob.Driver");
					_modexists = valueOrDefault;
				}
				return _modexists.Value;
			}
		}

		private static bool IsHudCameraTargetDriver => Main.HudCameraTargetBody?.baseNameToken == "ROB_DRIVER_BODY_NAME";

		private static Transform DriverWeaponSlot
		{
			get
			{
				if (!Main.IsHudEditable)
				{
					return null;
				}
				return ((Component)Main.MyHud.equipmentIcons[0]).gameObject.transform.parent.Find("WeaponSlot");
			}
		}

		internal static void HUD_OnDestroy(orig_OnDestroy orig, HUD self)
		{
			orig.Invoke(self);
			AllowDriverWeaponSlotCreation = false;
		}

		internal static void OnSurvivorSpecificHudEditsFinished()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHudCameraTargetDriver)
			{
				TryDestroyDriverWeaponSlot();
				HudStructure.ResetSkillsScalerLocalPositionToDefault();
				HudStructure.ResetSprintClusterLocalPositionToDefault();
			}
			else
			{
				HudStructure.SkillScalerLocalPosition = new Vector2(35f, 98f);
				HudStructure.SprintClusterLocalPosition = new Vector2(-439f, -64f);
				HudStructure.InventoryClusterLocalPosition = new Vector2(-511f, -64f);
			}
		}

		private static void TryDestroyDriverWeaponSlot()
		{
			try
			{
				Object.Destroy((Object)(object)((Component)((Component)Main.MyHud.equipmentIcons[0]).gameObject.transform.parent.Find("WeaponSlot")).gameObject);
			}
			catch
			{
			}
		}

		internal static void OnHudColorUpdate()
		{
			if (!IsHudCameraTargetDriver)
			{
				return;
			}
			AllowDriverWeaponSlotCreation = true;
			try
			{
				DriverHooks.NormalHudSetup(Main.MyHud);
			}
			catch
			{
			}
			if (!Main.IsHudUserBlacklisted && ConfigOptions.AllowHudStructureEdits.Value)
			{
				HUD myHud = Main.MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(DelayEditWeaponSlotStructure());
				}
			}
		}

		[IteratorStateMachine(typeof(<DelayEditWeaponSlotStructure>d__13))]
		private static IEnumerator DelayEditWeaponSlotStructure()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayEditWeaponSlotStructure>d__13(0);
		}

		private static void EditWeaponSlotStructure()
		{
			//IL_0057: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00ca: 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_00e0: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			if (Main.IsHudEditable)
			{
				Transform driverWeaponSlot = DriverWeaponSlot;
				if (!((Object)(object)driverWeaponSlot == (Object)null))
				{
					Transform child = driverWeaponSlot.GetChild(1);
					Transform child2 = child.GetChild(6);
					Transform child3 = child.GetChild(10);
					Transform child4 = ((Component)Main.MyHud.skillIcons[0]).transform.GetChild(5);
					driverWeaponSlot.localScale = new Vector3(2.3f, 2.3f, 2.3f);
					driverWeaponSlot.localPosition = new Vector3(-269.2665f, driverWeaponSlot.localPosition.y, driverWeaponSlot.localPosition.z);
					child2.position = new Vector3(child2.position.x, child4.position.y, child2.position.z);
					SetWeaponTextStatus();
					child3.localScale = new Vector3(0.44f, child3.localScale.y, child3.localScale.z);
					child3.localPosition = new Vector3(child3.localPosition.x, -0.5f, child3.localPosition.z);
				}
			}
		}

		internal static void SetWeaponTextStatus()
		{
			if (Main.IsHudEditable)
			{
				Transform driverWeaponSlot = DriverWeaponSlot;
				if ((Object)(object)driverWeaponSlot == (Object)null)
				{
					Log.Error("Driver weapon slot was null in EditWeaponSlotStructure");
				}
				else
				{
					((Component)driverWeaponSlot.GetChild(1).GetChild(6)).gameObject.SetActive(ConfigOptions.ShowSkillKeybinds.Value);
				}
			}
		}
	}
	internal class LookingGlassMod
	{
		[CompilerGenerated]
		private sealed class <DelayRemoveLookingGlassStatsPanelBackground>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			private Transform <rightInfoBar>5__2;

			private Transform <playerStats>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayRemoveLookingGlassStatsPanelBackground>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<rightInfoBar>5__2 = null;
				<playerStats>5__3 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<rightInfoBar>5__2 = HudResources.ImportantHudTransforms.RunInfoHudPanel.Find("RightInfoBar");
					<playerStats>5__3 = null;
					goto IL_007c;
				case 2:
					<>1__state = -1;
					goto IL_007c;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_007c:
					if (!Object.op_Implicit((Object)(object)<rightInfoBar>5__2.Find("PlayerStats")))
					{
						Log.Debug("Couldn't find LookingGlass PlayerStats, waiting a lil bit");
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					<playerStats>5__3 = <rightInfoBar>5__2.Find("PlayerStats");
					break;
				}
				PanelSkinController val = default(PanelSkinController);
				if (!((Component)<playerStats>5__3).TryGetComponent<PanelSkinController>(ref val))
				{
					Log.Debug("Couldn't find LookingGlass PlayerStats PanelSkinController, waiting a lil bit");
					<>2__current = null;
					<>1__state = 3;
					return true;
				}
				Extensions.TryDestroyComponent<PanelSkinController>((Component)(object)<playerStats>5__3);
				Extensions.TryDestroyComponent<Image>((Component)(object)<playerStats>5__3);
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static bool? _modexists;

		internal static bool ModIsRunning
		{
			get
			{
				bool valueOrDefault = _modexists.GetValueOrDefault();
				if (!_modexists.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("droppod.lookingglass");
					_modexists = valueOrDefault;
				}
				return _modexists.Value;
			}
		}

		internal static bool ItemCountersConfigValue
		{
			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			get
			{
				if (ModIsRunning)
				{
					return ItemCounter.itemCounters.Value;
				}
				return false;
			}
		}

		internal static bool StatsPanelConfigValue
		{
			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			get
			{
				if (ModIsRunning)
				{
					return StatsDisplayClass.statsDisplay.Value;
				}
				return false;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		internal static void HookStatsPanelConfig_SettingChanged()
		{
			if (StatsDisplayClass.statsDisplay != null)
			{
				StatsDisplayClass.statsDisplay.SettingChanged += StatsPanelConfig_SettingChanged;
			}
		}

		internal static void StatsPanelConfig_SettingChanged(object sender, EventArgs e)
		{
			if (Main.IsHudEditable && StatsPanelConfigValue)
			{
				HUD myHud = Main.MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(DelayRemoveLookingGlassStatsPanelBackground());
				}
			}
		}

		[IteratorStateMachine(typeof(<DelayRemoveLookingGlassStatsPanelBackground>d__9))]
		internal static IEnumerator DelayRemoveLookingGlassStatsPanelBackground()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayRemoveLookingGlassStatsPanelBackground>d__9(0);
		}

		internal static void OnHudDetailEditsFinished()
		{
			if (ModIsRunning && StatsPanelConfigValue)
			{
				HUD myHud = Main.MyHud;
				if (myHud != null)
				{
					((MonoBehaviour)myHud).StartCoroutine(DelayRemoveLookingGlassStatsPanelBackground());
				}
			}
		}
	}
	internal class Myst
	{
		private static bool? _modexists;

		private static Transform mystScaler;

		private static Transform normalScaler;

		private static Transform equipmentSlotDisplayRoot;

		private static Transform skillsPanel1;

		private static Transform skillsPanel2;

		internal static bool ModIsRunning
		{
			get
			{
				bool valueOrDefault = _modexists.GetValueOrDefault();
				if (!_modexists.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.JavAngle.MystMod");
					_modexists = valueOrDefault;
				}
				return _modexists.Value;
			}
		}

		private static bool IsHudCameraTargetMyst
		{
			get
			{
				if ((Object)(object)Main.HudCameraTargetBody != (Object)null)
				{
					return Main.HudCameraTargetBody?.baseNameToken == "JAVANGLE_MYST_BODY_NAME";
				}
				return false;
			}
		}

		internal static void HUD_OnDestroy(orig_OnDestroy orig, HUD self)
		{
			orig.Invoke(self);
			mystScaler = null;
			normalScaler = null;
			equipmentSlotDisplayRoot = null;
			skillsPanel1 = null;
			skillsPanel2 = null;
		}

		internal static void OnSurvivorSpecificHudEditsFinished()
		{
			if ((Object)(object)Main.HudCameraTargetBody == (Object)null)
			{
				return;
			}
			Transform val = Main.MyHud.mainContainer.transform.Find("MystHuD(Clone)");
			if (!((Object)(object)val == (Object)null))
			{
				mystScaler = val.GetChild(0).GetChild(0);
				normalScaler = Main.MyHudLocator.FindChild("SkillDisplayRoot");
				if (IsHudCameraTargetMyst)
				{
					ReplaceNormalScalerWithMystScaler();
					EditEquipmentSlotStructure();
					EditMystScalerDetails();
				}
				else
				{
					ReplaceMystScalerWithNormalScaler();
				}
			}
		}

		private static void ReplaceNormalScalerWithMystScaler()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			((Component)mystScaler).gameObject.SetActive(true);
			for (int i = 0; i < normalScaler.childCount; i++)
			{
				Transform child = normalScaler.GetChild(i);
				if (((Object)child).name.Contains("Skill") || ((Object)child).name == "EquipmentSlot")
				{
					((Component)child).gameObject.SetActive(false);
				}
			}
			ConfigOptions_OnShowSkillKeybindsChanged();
			mystScaler.parent.rotation = Quaternion.identity;
		}

		private static void ReplaceMystScalerWithNormalScaler()
		{
			((Component)mystScaler).gameObject.SetActive(false);
			for (int i = 0; i < normalScaler.childCount; i++)
			{
				Transform child = normalScaler.GetChild(i);
				if (((Object)child).name.Contains("Skill") || ((Object)child).name == "EquipmentSlot")
				{
					((Component)child).gameObject.SetActive(true);
				}
			}
			ResetNormalSprintAndInventoryRemindersStatus();
		}

		private static void EditEquipmentSlotStructure()
		{
			//IL_002e: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			equipmentSlotDisplayRoot = mystScaler.Find("EquipmentSlot").GetChild(0);
			equipmentSlotDisplayRoot.localScale = new Vector3(0.8f, 0.785f, 0.8f);
			equipmentSlotDisplayRoot.localPosition = new Vector3(-28f, 17.25f, 0f);
			equipmentSlotDisplayRoot.Find("BGPanel").localPosition = Vector3.zero;
			equipmentSlotDisplayRoot.Find("EquipmentTextBackgroundPanel").localPosition = new Vector3(0f, -34.0633f, 0f);
		}

		private static void EditMystScalerDetails()
		{
			//IL_005f: 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_00e4: 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)
			Vector3 localScale = default(Vector3);
			((Vector3)(ref localScale))..ctor(0.15f, 0.125f, 1f);
			DisableNormalSprintAndInventoryReminders();
			((Component)mystScaler.GetChild(1)).gameObject.SetActive(false);
			skillsPanel1 = mystScaler.Find("Panel1 Default");
			for (int i = 0; i < skillsPanel1.childCount; i++)
			{
				Transform obj = skillsPanel1.GetChild(i).Find("SkillBackgroundPanel");
				obj.localScale = localScale;
				obj.DisableImageComponent();
			}
			skillsPanel2 = mystScaler.Find("Panel2 Extra");
			for (int j = 0; j < skillsPanel2.childCount; j++)
			{
				Transform obj2 = skillsPanel2.GetChild(j).Find("SkillBackgroundPanel");
				obj2.localScale = localScale;
				obj2.DisableImageComponent();
			}
			Transform obj3 = equipmentSlotDisplayRoot.Find("EquipmentTextBackgroundPanel");
			obj3.localScale = new Vector3(0.2f, 0.15f, 1f);
			obj3.DisableImageComponent();
			Transform child = mystScaler.Find("TooltipCluster").GetChild(2).GetChild(0);
			child.localScale = new Vector3(0.225f, 0.225f, 1f);
			child.DisableImageComponent();
			Transform obj4 = mystScaler.Find("Resourse Guages");
			Transform child2 = obj4.GetChild(0).GetChild(0);
			child2.DisableImageComponent();
			((Component)child2.GetChild(0)).gameObject.SetActive(false);
			Transform child3 = obj4.GetChild(1).GetChild(0);
			child3.DisableImageComponent();
			((Component)child3.GetChild(0)).gameObject.SetActive(false);
		}

		internal static void OnHudColorUpdate()
		{
			if ((Object)(object)Main.HudCameraTargetBody == (Object)null)
			{
				return;
			}
			Transform val = Main.MyHud.mainContainer.transform.Find("MystHuD(Clone)");
			if (!((Object)(object)val == (Object)null))
			{
				val.GetChild(0).GetChild(0);
				if (!(Main.HudCameraTargetBody.baseNameToken != "JAVANGLE_MYST_BODY_NAME"))
				{
					ColorMystScaler();
				}
			}
		}

		private static void ColorMystScaler()
		{
			//IL_001f: 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_0088: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < skillsPanel1.childCount; i++)
			{
				((Graphic)((Component)skillsPanel1.GetChild(i).GetChild(0)).gameObject.GetComponent<Image>()).color = HudColor.SurvivorColor;
			}
			for (int j = 0; j < skillsPanel2.childCount; j++)
			{
				((Graphic)((Component)skillsPanel2.GetChild(j).Find("IsReadyPanel")).gameObject.GetComponent<Image>()).color = HudColor.SurvivorColor;
			}
			((Graphic)((Component)equipmentSlotDisplayRoot.GetChild(0)).GetComponent<Image>()).color = HudColor.SurvivorColor;
			((Graphic)((Component)equipmentSlotDisplayRoot.Find("BGPanel")).GetComponent<Image>()).color = Main.Helpers.GetAdjustedColor(HudColor.SurvivorColor, 1f, 1f, 0.643f);
		}

		internal static void ConfigOptions_OnShowSprintAndInventoryKeybindsChanged()
		{
			if (!((Object)(object)mystScaler == (Object)null) && IsHudCameraTargetMyst)
			{
				DisableNormalSprintAndInventoryReminders();
				Transform child = mystScaler.GetChild(0);
				((Component)child.Find("SprintCluster")).gameObject.SetActive(ConfigOptions.ShowSprintAndInventoryKeybinds.Value);
				((Component)child.Find("InventoryCluster")).gameObject.SetActive(ConfigOptions.ShowSprintAndInventoryKeybinds.Value);
			}
		}

		private static void Dis