Decompiled source of InsanityDisplay v1.3.3

plugins/InsanityDisplay/InsanityDisplay.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 GameNetcodeStuff;
using LC_InsanityDisplay.ModCompatibility;
using LC_InsanityDisplay.Plugin;
using LC_InsanityDisplay.Plugin.ModCompatibility;
using LC_InsanityDisplay.Plugin.UI;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using TMPro;
using Unity.Netcode;
using UnityEngine;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("InsanityDisplay.Confusified.com.GitHub")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.3.0")]
[assembly: AssemblyInformationalVersion("1.3.3+61b604d108ae2104b6abcbcb5a8d9eefef2d1577")]
[assembly: AssemblyProduct("Insanity Display")]
[assembly: AssemblyTitle("InsanityDisplay.Confusified.com.GitHub")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.3.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 LC_InsanityDisplay
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "InsanityDisplay.Confusified.com.GitHub";

		public const string PLUGIN_NAME = "Insanity Display";

		public const string PLUGIN_VERSION = "1.3.3";
	}
}
namespace LC_InsanityDisplay.ModCompatibility
{
	public class InfectedCompanyCompatibility : MonoBehaviour
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_StartGame <0>__RoundStarted;

			public static EventHandler <1>__UpdateInfectedCompanyHUD;

			public static EventHandler <2>__ToggleInfectedOnly;
		}

		internal const string ModGUID = "InfectedCompany.InfectedCompany";

		private static readonly WaitUntil WaitUntilSpawningEnemies = new WaitUntil((Func<bool>)(() => RoundManager.Instance.currentLevel.spawnEnemiesAndScrap));

		private static readonly WaitForSeconds WaitSetSeconds = new WaitForSeconds(5f);

		public static GameObject InfectedMeter { get; private set; } = null;


		public static Slider InfectedMeterComponent { get; private set; } = null;


		public static bool IsPlayerInfected { get; internal set; } = false;


		public static bool IsInfectedCompanyEnabled { get; private set; } = false;


		public static bool OnlyUseInfectedCompany { get; private set; } = false;


		private static void Initialize()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__RoundStarted;
			if (obj == null)
			{
				hook_StartGame val = RoundStarted;
				<>O.<0>__RoundStarted = val;
				obj = (object)val;
			}
			StartOfRound.StartGame += (hook_StartGame)obj;
			IsInfectedCompanyEnabled = ConfigHandler.Compat.InfectedCompany.Value;
			OnlyUseInfectedCompany = ConfigHandler.Compat.InfectedCompany_InfectedOnly.Value;
			ConfigHandler.Compat.InfectedCompany.SettingChanged += UpdateInfectedCompanyHUD;
			ConfigHandler.Compat.InfectedCompany_InfectedOnly.SettingChanged += ToggleInfectedOnly;
		}

		private static void UpdateInfectedCompanyHUD(object sender, EventArgs e)
		{
			IsInfectedCompanyEnabled = ConfigHandler.Compat.InfectedCompany.Value;
			if (!IsInfectedCompanyEnabled)
			{
				if (IsPlayerInfected)
				{
					InfectedMeter.SetActive(true);
				}
				else if (!OnlyUseInfectedCompany)
				{
					HUDInjector.InsanityMeter.SetActive(true);
				}
			}
			else if (IsPlayerInfected)
			{
				InfectedMeter.SetActive(false);
				HUDInjector.InsanityMeter.SetActive(true);
			}
			else if (OnlyUseInfectedCompany)
			{
				HUDInjector.InsanityMeter.SetActive(false);
			}
			HUDBehaviour.UpdateMeter(settingChanged: true);
		}

		private static void ToggleInfectedOnly(object sender, EventArgs e)
		{
			OnlyUseInfectedCompany = ConfigHandler.Compat.InfectedCompany_InfectedOnly.Value;
			if (!IsInfectedCompanyEnabled)
			{
				if (IsPlayerInfected)
				{
					InfectedMeter.SetActive(true);
				}
				if (!OnlyUseInfectedCompany)
				{
					HUDInjector.InsanityMeter.SetActive(true);
				}
			}
			else if (OnlyUseInfectedCompany && !IsPlayerInfected)
			{
				HUDInjector.InsanityMeter.SetActive(false);
			}
			else
			{
				HUDInjector.InsanityMeter.SetActive(true);
			}
			HUDBehaviour.UpdateMeter(settingChanged: true);
		}

		private static void Start()
		{
			Slider[] array = Object.FindObjectsOfType<Slider>(true);
			Slider[] array2 = array;
			foreach (Slider val in array2)
			{
				if (((Object)((Component)val).gameObject).name == "InsanityMeter")
				{
					InfectedMeterComponent = val;
					InfectedMeter = ((Component)val).gameObject;
					break;
				}
			}
			if (Object.op_Implicit((Object)(object)InfectedMeter))
			{
				IsPlayerInfected = false;
			}
		}

		private static void RoundStarted(orig_StartGame orig, StartOfRound self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)InfectedMeter))
			{
				((MonoBehaviour)Initialise.Instance).StartCoroutine(CheckIfInfectedOnStart());
			}
		}

		private static IEnumerator CheckIfInfectedOnStart()
		{
			yield return WaitUntilSpawningEnemies;
			yield return WaitSetSeconds;
			if (InfectedMeter.activeSelf)
			{
				IsPlayerInfected = true;
			}
			else
			{
				IsPlayerInfected = false;
			}
			if (IsInfectedCompanyEnabled)
			{
				if (IsPlayerInfected)
				{
					InfectedMeter.SetActive(false);
					HUDInjector.InsanityMeter.SetActive(true);
					yield break;
				}
				InfectedMeter.SetActive(true);
				if (OnlyUseInfectedCompany && HUDInjector.InsanityMeter.activeSelf)
				{
					HUDInjector.InsanityMeter.SetActive(false);
				}
			}
			else if (!OnlyUseInfectedCompany)
			{
				HUDInjector.InsanityMeter.SetActive(true);
			}
		}
	}
	public class LethalCompanyVRCompatibility
	{
		internal const string ModGUID = "io.daxcess.lcvr";

		private static void Initialize()
		{
			Chainloader.PluginInfos.TryGetValue("io.daxcess.lcvr", out var value);
			ConfigFile config = value.Instance.Config;
			ConfigEntry<bool> val = default(ConfigEntry<bool>);
			foreach (ConfigDefinition key in config.Keys)
			{
				if (key.Key == "DisableVR" && config.TryGetEntry<bool>(key, ref val))
				{
					if (val.Value)
					{
						break;
					}
					CompatibleDependencyAttribute.IsLCVRPresent = true;
				}
			}
		}
	}
}
namespace LC_InsanityDisplay.Plugin
{
	public class ConfigHandler
	{
		public enum CenteredIconSettings
		{
			Never,
			AvoidOverlap,
			Always
		}

		public class Compat
		{
			public static ConfigEntry<bool> LCCrouchHUD { get; internal set; }

			public static ConfigEntry<bool> An0nPatches { get; internal set; }

			public static ConfigEntry<bool> LethalCompanyPatched { get; internal set; }

			public static ConfigEntry<bool> EladsHUD { get; internal set; }

			public static ConfigEntry<bool> GeneralImprovements { get; internal set; }

			public static ConfigEntry<bool> HealthMetrics { get; internal set; }

			public static ConfigEntry<bool> DamageMetrics { get; internal set; }

			public static ConfigEntry<bool> LethalCompanyVR { get; internal set; }

			public static ConfigEntry<bool> InfectedCompany { get; internal set; }

			public static ConfigEntry<bool> InfectedCompany_InfectedOnly { get; internal set; }

			public static ConfigEntry<bool> ShyHUD { get; internal set; }
		}

		public static byte CurrentVersion = 3;

		public static ConfigEntry<bool> ModEnabled { get; internal set; } = null;


		public static ConfigEntry<string> MeterColor { get; internal set; } = null;


		public static ConfigEntry<bool> useAccurateDisplay { get; internal set; } = null;


		public static ConfigEntry<bool> enableReverse { get; internal set; } = null;


		public static ConfigEntry<bool> alwaysFull { get; internal set; } = null;


		public static ConfigEntry<CenteredIconSettings> iconAlwaysCentered { get; internal set; } = null;


		public static ConfigEntry<byte> ConfigVersion { get; internal set; } = null;


		public static void InitialiseConfig()
		{
			ModEnabled = Initialise.modConfig.Bind<bool>("Display Settings", "Meter enabled", true, "Add a meter which displays your current insanity level?");
			MeterColor = Initialise.modConfig.Bind<string>("Display Settings", "Color of the Meter", "7300A6FF", "The colour that the insanity meter will have\n The colour value must be in HEX\nExample: FFFFFF(FF) (White)");
			useAccurateDisplay = Initialise.modConfig.Bind<bool>("Display Settings", "Accurate meter", true, "Show your insanity value more accurately, instead of showing it in the vanilla way");
			enableReverse = Initialise.modConfig.Bind<bool>("Display Settings", "Sanity Meter", false, "Turn the insanity meter into a sanity meter");
			alwaysFull = Initialise.modConfig.Bind<bool>("Display Settings", "Always Show", false, "Always show the insanity meter, for aesthetic purposes");
			iconAlwaysCentered = Initialise.modConfig.Bind<CenteredIconSettings>("Display Settings", "Center Player Icon", CenteredIconSettings.AvoidOverlap, "Always have the player icon centered, instead of it moving to it's vanilla position when the insanity meter is not visible");
			Compat.LCCrouchHUD = Initialise.modConfig.Bind<bool>("CrouchHUD Compatibility Settings", "Enable CrouchHUD compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
			Compat.An0nPatches = Initialise.modConfig.Bind<bool>("An0n Patches Compatibility Settings", "Enable An0n Patches compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
			Compat.LethalCompanyPatched = Initialise.modConfig.Bind<bool>("LethalCompanyPatched Compatibility Settings", "Enable LethalCompanyPatched compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
			Compat.EladsHUD = Initialise.modConfig.Bind<bool>("Elads HUD Compatibility Settings", "Enable Elads HUD compatibility", true, "Enabling this will add another bar above the stamina bar displaying your insanity level");
			Compat.GeneralImprovements = Initialise.modConfig.Bind<bool>("GeneralImprovements Compatibility Settings", "Enable GeneralImprovements compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
			Compat.HealthMetrics = Initialise.modConfig.Bind<bool>("HealthMetrics Compatibility Settings", "Enable HealthMetrics compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
			Compat.DamageMetrics = Initialise.modConfig.Bind<bool>("DamageMetrics Compatibility Settings", "Enable DamageMetrics compatibility", true, "Enabling this will adjust the hud to avoid overlapping");
			Compat.LethalCompanyVR = Initialise.modConfig.Bind<bool>("LethalCompanyVR Compatibility Settings", "Enable LethalCompanyVR compatibility", true, "Enabling this will add the insanity meter to the hud in VR");
			Compat.InfectedCompany = Initialise.modConfig.Bind<bool>("InfectedCompany Compatibility Settings", "Enable InfectedCompany compatibility", true, "Enabling this will hide InfectedCompany's insanity meter and use this mod's insanity meter instead");
			Compat.InfectedCompany_InfectedOnly = Initialise.modConfig.Bind<bool>("InfectedCompany Compatibility Settings", "Only show Insanity Meter when infected", false, "Enabling this will only show the insanity meter when you are the infected");
			Compat.ShyHUD = Initialise.modConfig.Bind<bool>("ShyHUD Compatibility Settings", "Enable ShyHUD compatibility", true, "Enabling this will hide the insanity meter when it's full");
			ConfigVersion = Initialise.modConfig.Bind<byte>("z Do Not Touch z", "Config Version", (byte)0, "The current version of your config file");
			RemoveDeprecatedSettings();
			FixColor();
		}

		internal static void SettingChanged(object sender = null, EventArgs e = null)
		{
			if (Object.op_Implicit((Object)(object)HUDInjector.InsanityMeter))
			{
				HUDBehaviour.UpdateMeter(settingChanged: true);
			}
			if (Object.op_Implicit((Object)(object)HUDBehaviour.PlayerIcon) && Object.op_Implicit((Object)(object)HUDBehaviour.PlayerRedIcon))
			{
				HUDBehaviour.UpdateIconPosition(settingChanged: true);
			}
		}

		internal static void FixColor(object obj = null, EventArgs args = null)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if (MeterColor.Value.StartsWith("#"))
			{
				MeterColor.Value.Substring(1);
			}
			Color val = default(Color);
			ColorUtility.TryParseHtmlString("#" + MeterColor.Value, ref val);
			if (val.a != 1f)
			{
				val.a = 1f;
			}
			MeterColor.Value = ColorUtility.ToHtmlStringRGBA(val);
			HUDBehaviour.InsanityMeterColor = val;
			if (Object.op_Implicit((Object)(object)HUDInjector.InsanityMeter))
			{
				HUDBehaviour.UpdateMeter(settingChanged: true);
			}
		}

		public static void RemoveDeprecatedSettings()
		{
			//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			byte value = ConfigVersion.Value;
			if (value == CurrentVersion)
			{
				return;
			}
			if (value < 2)
			{
				ConfigEntry<bool> val = Initialise.modConfig.Bind<bool>("Display Settings", "Always Centered Player Icon", true, (ConfigDescription)null);
				if (val.Value)
				{
					iconAlwaysCentered.Value = CenteredIconSettings.Always;
				}
				else
				{
					iconAlwaysCentered.Value = CenteredIconSettings.AvoidOverlap;
				}
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable LCCrouchHUD compatibility", true, (ConfigDescription)null);
				Compat.LCCrouchHUD.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable An0n Patches compatibility", true, (ConfigDescription)null);
				Compat.An0nPatches.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable Elads HUD compatibility", true, (ConfigDescription)null);
				Compat.EladsHUD.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable GeneralImprovements compatibility", true, (ConfigDescription)null);
				Compat.GeneralImprovements.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable HealthMetrics compatibility", true, (ConfigDescription)null);
				Compat.HealthMetrics.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable DamgeMetrics compatibility", true, (ConfigDescription)null);
				Compat.DamageMetrics.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable LethalCompanyVR compatibility", true, (ConfigDescription)null);
				Compat.LethalCompanyVR.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Enable InfectedCompany compatibility", true, (ConfigDescription)null);
				Compat.InfectedCompany.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				val = Initialise.modConfig.Bind<bool>("Mod Compatibility Settings", "Only show Insanity Meter when infected", true, (ConfigDescription)null);
				Compat.InfectedCompany_InfectedOnly.Value = val.Value;
				Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
				if (value < 1)
				{
					val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable LCCrouchHUD compatibility", true, (ConfigDescription)null);
					Compat.LCCrouchHUD.Value = val.Value;
					Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
					val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable An0n Patches compatibility", true, (ConfigDescription)null);
					Compat.An0nPatches.Value = val.Value;
					Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
					val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable Elads HUD compatibility", true, (ConfigDescription)null);
					Compat.EladsHUD.Value = val.Value;
					Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
					val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable GeneralImprovements compatibility", true, (ConfigDescription)null);
					Compat.GeneralImprovements.Value = val.Value;
					Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
					val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable HealthMetrics compatibility", true, (ConfigDescription)null);
					Compat.HealthMetrics.Value = val.Value;
					Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
					val = Initialise.modConfig.Bind<bool>("Compatibility Settings", "Enable DamageMetrics compatibility", true, (ConfigDescription)null);
					Compat.DamageMetrics.Value = val.Value;
					Initialise.modConfig.Remove(((ConfigEntryBase)val).Definition);
					ConfigEntry<Color> val2 = Initialise.modConfig.Bind<Color>("Display Settings", "Color of the meter", new Color(0.45f, 0f, 0.65f, 1f), (ConfigDescription)null);
					MeterColor.Value = ColorUtility.ToHtmlStringRGB(val2.Value);
					Initialise.modConfig.Remove(((ConfigEntryBase)val2).Definition);
				}
			}
			PropertyInfo property = ((object)Initialise.modConfig).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(Initialise.modConfig, null);
			dictionary.Clear();
			ConfigVersion.Value = CurrentVersion;
			Initialise.Logger.LogDebug((object)$"Succesfully updated config file version from {value} => {CurrentVersion}");
		}
	}
	[CompatibleDependency("ainavt.lc.lethalconfig", typeof(LethalConfigCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("BMX.LobbyCompatibility", typeof(LobbyCompatibility_Compatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("LCCrouchHUD", typeof(CrouchHUDCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("ShaosilGaming.GeneralImprovements", typeof(GeneralImprovementsCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("com.an0n.patch", typeof(An0nPatchesCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("LethalCompanyPatched", typeof(An0nPatchesCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("me.eladnlg.customhud", typeof(EladsHUDCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("Matsuura.HealthMetrics", typeof(HealthMetricsCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("Matsuura.TestAccount666.DamageMetrics", typeof(DamageMetricsCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("io.daxcess.lcvr", typeof(LethalCompanyVRCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("InfectedCompany.InfectedCompany", typeof(InfectedCompanyCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CompatibleDependency("ShyHUD", typeof(ShyHUDCompatibility))]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("InsanityDisplay.Confusified.com.GitHub", "Insanity Display", "1.3.3")]
	public class Initialise : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_SetSavedValues <0>__InjectIntoHud;

			public static hook_SetPlayerSanityLevel <1>__InsanityValueChanged;
		}

		public static readonly string configLocation = Utility.CombinePaths(new string[1] { Paths.ConfigPath + "\\" + "InsanityDisplay.Confusified.com.GitHub".Substring(16, 12).Replace(".", "\\") + "InsanityDisplay.Confusified.com.GitHub".Substring(0, 15) });

		public static ConfigFile modConfig = new ConfigFile(configLocation + ".cfg", false);

		internal static ManualLogSource Logger { get; private set; } = null;


		internal static Initialise Instance { get; private set; } = null;


		public void Awake()
		{
			Logger = Logger.CreateLogSource("InsanityDisplay.Confusified.com.GitHub");
			Logger = Logger;
			Instance = this;
			ConfigHandler.InitialiseConfig();
			if (!ConfigHandler.ModEnabled.Value)
			{
				Logger.LogInfo((object)"Stopped loading Insanity Display 1.3.3, as it is disabled through the config file");
				Object.Destroy((Object)(object)this);
				return;
			}
			CompatibleDependencyAttribute.Init((BaseUnityPlugin)(object)this);
			Logger.LogDebug((object)"Checked for compatible mods");
			Hook();
			Logger.LogDebug((object)"Hooked");
			Logger.LogInfo((object)"Insanity Display v1.3.3 loaded");
		}

		private static void Hook()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			Logger.LogDebug((object)"Hooking...");
			object obj = <>O.<0>__InjectIntoHud;
			if (obj == null)
			{
				hook_SetSavedValues val = HUDInjector.InjectIntoHud;
				<>O.<0>__InjectIntoHud = val;
				obj = (object)val;
			}
			HUDManager.SetSavedValues += (hook_SetSavedValues)obj;
			object obj2 = <>O.<1>__InsanityValueChanged;
			if (obj2 == null)
			{
				hook_SetPlayerSanityLevel val2 = HUDBehaviour.InsanityValueChanged;
				<>O.<1>__InsanityValueChanged = val2;
				obj2 = (object)val2;
			}
			PlayerControllerB.SetPlayerSanityLevel += (hook_SetPlayerSanityLevel)obj2;
		}
	}
	internal class CompatibleDependencyAttribute : BepInDependency
	{
		public static bool IsEladsHudPresent;

		public static bool IsLCVRPresent;

		public static bool ShyHUDPresent;

		public Type Handler;

		private const BindingFlags bindingFlags = BindingFlags.Static | BindingFlags.NonPublic;

		private static IEnumerable<CompatibleDependencyAttribute> attributes;

		internal CompatibleDependencyAttribute(string guid, Type handlerType)
			: base(guid, (DependencyFlags)2)
		{
			Handler = handlerType;
		}

		internal static void Init(BaseUnityPlugin source)
		{
			attributes = ((MemberInfo)((object)source).GetType()).GetCustomAttributes<CompatibleDependencyAttribute>();
			foreach (CompatibleDependencyAttribute attribute in attributes)
			{
				InvokeMethodIfFound(attribute, "Initialize");
			}
		}

		internal static void Activate()
		{
			foreach (CompatibleDependencyAttribute attribute in attributes)
			{
				InvokeMethodIfFound(attribute, "Start");
			}
		}

		private static void InvokeMethodIfFound(CompatibleDependencyAttribute attribute, string methodToRun)
		{
			if (attribute != null && IsModPresent(((BepInDependency)attribute).DependencyGUID))
			{
				attribute.Handler.GetMethod(methodToRun, BindingFlags.Static | BindingFlags.NonPublic)?.Invoke(null, null);
			}
		}

		internal static bool IsModPresent(string ModGUID)
		{
			return Chainloader.PluginInfos.ContainsKey(ModGUID);
		}
	}
}
namespace LC_InsanityDisplay.Plugin.ModCompatibility
{
	public class An0nPatchesCompatibility
	{
		internal const string ModGUID = "com.an0n.patch";

		internal const string AlternateModGUID = "LethalCompanyPatched";

		private static GameObject An0nTextHUD = null;

		private static Transform An0nTransform = null;

		private static Vector3 localPositionOffset = new Vector3(3f, 15f, 0f);

		private static Vector3 localPosition = Vector3.zero;

		private static bool DisableAn0nHud = false;

		private static void Initialize()
		{
			DisableAn0nHud = CompatibleDependencyAttribute.IsEladsHudPresent || CompatibleDependencyAttribute.IsLCVRPresent;
			if (!DisableAn0nHud)
			{
				ConfigHandler.Compat.An0nPatches.SettingChanged += UpdateAn0nDisplay;
				ConfigHandler.Compat.LethalCompanyPatched.SettingChanged += UpdateAn0nDisplay;
			}
		}

		private static void Start()
		{
			//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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (DisableAn0nHud)
			{
				return;
			}
			Animator[] componentsInChildren = HUDInjector.TopLeftHUD.GetComponentsInChildren<Animator>(true);
			Animator[] array = componentsInChildren;
			foreach (Animator val in array)
			{
				if (!(((Object)val).name != "HPSP"))
				{
					An0nTextHUD = ((Component)val).gameObject;
					break;
				}
			}
			if (Object.op_Implicit((Object)(object)An0nTextHUD))
			{
				An0nTransform = An0nTextHUD.transform;
				if (localPosition == Vector3.zero)
				{
					localPosition = An0nTransform.localPosition;
				}
				UpdateAn0nDisplay();
			}
		}

		private static void UpdateAn0nDisplay(object sender = null, EventArgs e = null)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)An0nTextHUD == (Object)null) && !((Object)(object)An0nTransform == (Object)null) && !(localPosition == Vector3.zero))
			{
				bool flag = (CompatibleDependencyAttribute.IsModPresent("com.an0n.patch") && ConfigHandler.Compat.An0nPatches.Value) || (CompatibleDependencyAttribute.IsModPresent("LethalCompanyPatched") && ConfigHandler.Compat.LethalCompanyPatched.Value);
				An0nTransform.SetLocalPositionAndRotation(flag ? (localPosition + localPositionOffset) : localPosition, An0nTransform.localRotation);
			}
		}
	}
	public class CrouchHUDCompatibility
	{
		internal const string ModGUID = "LCCrouchHUD";

		private static GameObject CrouchHUD = null;

		private static Transform IconTransform = null;

		private static Vector3 positionToLocal = Vector3.zero;

		private static Vector3 localPositionOffset = new Vector3(3f, 7f, 0f);

		private static bool DisableCrouchHUD = false;

		private static void Initialize()
		{
			DisableCrouchHUD = CompatibleDependencyAttribute.IsEladsHudPresent || CompatibleDependencyAttribute.IsLCVRPresent;
			if (!DisableCrouchHUD)
			{
				ConfigHandler.Compat.LCCrouchHUD.SettingChanged += UpdateIconPosition;
			}
		}

		private static void Start()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (DisableCrouchHUD)
			{
				return;
			}
			Transform transform = HUDBehaviour.PlayerIcon.transform;
			CrouchHUD = ((Component)transform.GetChild(transform.childCount - 1)).gameObject;
			if (Object.op_Implicit((Object)(object)CrouchHUD))
			{
				IconTransform = CrouchHUD.transform;
				if (positionToLocal == Vector3.zero)
				{
					positionToLocal = IconTransform.localPosition;
				}
				UpdateIconPosition();
			}
		}

		private static void UpdateIconPosition(object sender = null, EventArgs e = null)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_003d: 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)
			if (!((Object)(object)CrouchHUD == (Object)null) && !((Object)(object)IconTransform == (Object)null) && !(positionToLocal == Vector3.zero))
			{
				IconTransform.SetLocalPositionAndRotation(ConfigHandler.Compat.LCCrouchHUD.Value ? (positionToLocal + localPositionOffset) : positionToLocal, IconTransform.localRotation);
			}
		}
	}
	public class DamageMetricsCompatibility
	{
		internal const string ModGUID = "Matsuura.TestAccount666.DamageMetrics";

		private static GameObject DamageMeter = null;

		private static Transform MeterTransform = null;

		private static Vector3 localPositionOffset = new Vector3(-10f, 0f, 0f);

		private static Vector3 localPosition = Vector3.zero;

		private static bool DisableDamageMetrics;

		private static void Initialize()
		{
			DisableDamageMetrics = CompatibleDependencyAttribute.IsEladsHudPresent || CompatibleDependencyAttribute.IsLCVRPresent;
			if (!DisableDamageMetrics)
			{
				ConfigHandler.Compat.DamageMetrics.SettingChanged += UpdateHealthMeter;
			}
		}

		private static void Start()
		{
			//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)
			if (!DisableDamageMetrics)
			{
				DamageMeter = HealthMetricsCompatibility.Shared_FetchHUDDisplay();
				if (Object.op_Implicit((Object)(object)DamageMeter))
				{
					MeterTransform = DamageMeter.transform;
					localPosition = DamageMeter.transform.localPosition;
					UpdateHealthMeter();
				}
			}
		}

		internal static void UpdateHealthMeter(object sender = null, EventArgs e = null)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_003d: 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)
			if (!((Object)(object)DamageMeter == (Object)null) && !((Object)(object)MeterTransform == (Object)null) && !(localPosition == Vector3.zero))
			{
				MeterTransform.SetLocalPositionAndRotation(ConfigHandler.Compat.DamageMetrics.Value ? (localPosition + localPositionOffset) : localPosition, MeterTransform.localRotation);
			}
		}
	}
	public class EladsHUDCompatibility
	{
		internal const string ModGUID = "me.eladnlg.customhud";

		internal const string OxygenGUID = "consequential.Oxygen";

		private static bool EladsHUDEnabled;

		private static Vector3 InsanityBarOffset = new Vector3(0f, 8f, 0f);

		private static Vector3 PercentageObjectOffset = new Vector3(0f, 26.4f, 0f);

		private static Vector3 BatteryLayoutOffset = new Vector3(-16f, 4f, 0f);

		private static Vector3 PTTOffset = new Vector3(120f, 20f, 0f);

		private static int oldBarFill = -1;

		internal static GameObject InsanityPercentageObject { get; private set; } = null;


		private static GameObject EladsHUDObject { get; set; } = null;


		private static TextMeshProUGUI InsanityPercentageText { get; set; } = null;


		private static Transform BatteryLayoutTransform { get; set; } = null;


		private static GameObject InsanityMeterShadow { get; set; } = null;


		private static void Initialize()
		{
			if (CompatibleDependencyAttribute.IsLCVRPresent)
			{
				Initialise.Logger.LogDebug((object)"Elad's HUD and LCVR are both found, they are not compatible with each other");
				return;
			}
			CompatibleDependencyAttribute.IsEladsHudPresent = true;
			ConfigHandler.Compat.EladsHUD.SettingChanged += UpdateVisibility;
		}

		private static void Start()
		{
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			if (CompatibleDependencyAttribute.IsLCVRPresent || !ConfigHandler.Compat.EladsHUD.Value)
			{
				return;
			}
			GameObject val = null;
			CanvasGroup[] componentsInChildren = ((Component)HUDInjector.TopLeftHUD.transform.parent).GetComponentsInChildren<CanvasGroup>(true);
			foreach (CanvasGroup val2 in componentsInChildren)
			{
				if (((Object)val2).name == "PlayerInfo(Clone)")
				{
					val = ((Component)((Component)val2).transform.Find("Stamina")).gameObject;
					EladsHUDObject = ((Component)val2).gameObject;
				}
				if ((Object)(object)val != (Object)null)
				{
					break;
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Initialise.Logger.LogError((object)"Could not find Elad's Hud Stamina bar");
				return;
			}
			BatteryLayoutTransform = EladsHUDObject.transform.GetChild(2);
			((Component)val.transform.GetChild(1)).gameObject.SetActive(false);
			((Component)val.transform.GetChild(2)).gameObject.SetActive(false);
			HUDInjector.InsanityMeter = Object.Instantiate<GameObject>(val, EladsHUDObject.transform);
			HUDInjector.InsanityMeter.SetActive(false);
			((Object)HUDInjector.InsanityMeter).name = "InsanityMeter";
			((Component)val.transform.GetChild(1)).gameObject.SetActive(true);
			((Component)val.transform.GetChild(2)).gameObject.SetActive(true);
			Initialise.Logger.LogDebug((object)"Created insanity bar");
			InsanityMeterShadow = ((Component)HUDInjector.InsanityMeter.transform.GetChild(0)).gameObject;
			((Object)InsanityMeterShadow).name = "Insanity BG";
			GameObject gameObject = ((Component)HUDInjector.InsanityMeter.transform.GetChild(1)).gameObject;
			InsanityPercentageObject = ((Component)HUDInjector.InsanityMeter.transform.GetChild(2)).gameObject;
			((Object)InsanityPercentageObject).name = "InsanityInfo";
			if (CompatibleDependencyAttribute.IsModPresent("consequential.Oxygen"))
			{
				Transform transform = InsanityPercentageObject.transform;
				transform.localPosition += InsanityBarOffset;
			}
			InsanityPercentageText = InsanityPercentageObject.GetComponent<TextMeshProUGUI>();
			((TMP_Text)InsanityPercentageText).horizontalAlignment = (HorizontalAlignmentOptions)4;
			Image[] componentsInChildren2 = HUDInjector.InsanityMeter.gameObject.GetComponentsInChildren<Image>();
			foreach (Image val3 in componentsInChildren2)
			{
				if (Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent<Mask>()))
				{
					HUDInjector.InsanityMeterComponent = val3;
					((Object)((Component)val3).transform).name = "InsanityBar";
					break;
				}
			}
			if ((Object)(object)HUDInjector.InsanityMeterComponent == (Object)null)
			{
				Initialise.Logger.LogError((object)"InsanityMeterComponent is null (BAD)");
				return;
			}
			GameObject gameObject2 = ((Component)((Component)HUDInjector.InsanityMeterComponent).transform.parent.GetChild(1)).gameObject;
			Object.Destroy((Object)(object)gameObject);
			Object.Destroy((Object)(object)gameObject2);
			Transform transform2 = HUDInjector.InsanityMeter.transform;
			transform2.localPosition += InsanityBarOffset;
			Transform transform3 = InsanityPercentageObject.transform;
			transform3.localPosition += PercentageObjectOffset;
			Transform batteryLayoutTransform = BatteryLayoutTransform;
			batteryLayoutTransform.localPosition += BatteryLayoutOffset;
			Chainloader.PluginInfos.TryGetValue("me.eladnlg.customhud", out var value);
			ConfigFile config = value.Instance.Config;
			float num = 1f;
			ConfigEntry<float> val4 = default(ConfigEntry<float>);
			foreach (ConfigDefinition key in config.Keys)
			{
				if (key.Key == "HUDScale" && config.TryGetEntry<float>(key, ref val4))
				{
					num = val4.Value;
				}
			}
			Transform transform4 = ((Component)HUDInjector.HUDManagerInstance.PTTIcon).transform;
			((Component)transform4).gameObject.SetActive(false);
			Transform parent = transform4.parent;
			transform4.SetParent(InsanityPercentageObject.transform);
			transform4.position = InsanityPercentageObject.transform.position;
			transform4.localPosition += PTTOffset;
			transform4.localScale *= num;
			transform4.SetParent(parent, true);
			((Component)transform4).gameObject.SetActive(true);
			oldBarFill = -1;
			InsanityPercentageObject.SetActive(true);
			HUDInjector.InsanityMeter.SetActive(true);
		}

		private static void UpdateVisibility(object sender = null, EventArgs e = null)
		{
			EladsHUDEnabled = ConfigHandler.Compat.EladsHUD.Value;
			_ = EladsHUDEnabled;
		}

		internal static void UpdatePercentageText()
		{
			int num = (int)MathF.Round(HUDInjector.InsanityMeterComponent.fillAmount * 100f);
			if (oldBarFill != num)
			{
				oldBarFill = num;
				((TMP_Text)InsanityPercentageText).text = $"{num}%";
			}
		}

		internal static void UpdateColour()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)InsanityPercentageText).color = HUDBehaviour.InsanityMeterColor;
		}
	}
	public class GeneralImprovementsCompatibility
	{
		internal const string ModGUID = "ShaosilGaming.GeneralImprovements";

		private static GameObject HitpointDisplay = null;

		private static Vector3 localPosition = Vector3.zero;

		private static Vector3 localPositionOffset = new Vector3(0f, 22f, 0f);

		public static bool HitpointDisplayActive = false;

		private static void Initialize()
		{
			ConfigFile config = Chainloader.PluginInfos["ShaosilGaming.GeneralImprovements"].Instance.Config;
			ConfigEntry<bool> val = default(ConfigEntry<bool>);
			foreach (ConfigDefinition key in config.Keys)
			{
				if (!(key.Key != "ShowHitPoints"))
				{
					config.TryGetEntry<bool>(key, ref val);
					HitpointDisplayActive = val.Value;
					break;
				}
			}
			if (HitpointDisplayActive)
			{
				Initialise.Logger.LogDebug((object)"GI's ShowHitPoints is enabled");
				ConfigHandler.Compat.GeneralImprovements.SettingChanged += UpdateDisplayPosition;
			}
		}

		private static void Start()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			if (!HitpointDisplayActive)
			{
				return;
			}
			HitpointDisplay = ((Component)HUDInjector.TopLeftHUD.transform.Find("HPUI")).gameObject;
			if (!Object.op_Implicit((Object)(object)HitpointDisplay))
			{
				Initialise.Logger.LogError((object)"Could not find GI's HP display");
				return;
			}
			if (localPosition == Vector3.zero)
			{
				localPosition = HitpointDisplay.transform.localPosition;
			}
			UpdateDisplayPosition();
		}

		internal static void UpdateDisplayPosition(object sender = null, EventArgs e = null)
		{
			//IL_0033: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (HitpointDisplayActive && Object.op_Implicit((Object)(object)HitpointDisplay))
			{
				Transform transform = HitpointDisplay.transform;
				transform.SetLocalPositionAndRotation(ConfigHandler.Compat.GeneralImprovements.Value ? (localPosition + localPositionOffset) : localPosition, transform.localRotation);
				Initialise.Logger.LogDebug((object)"Repositioned GI's HP UI");
			}
		}
	}
	public class HealthMetricsCompatibility
	{
		internal const string ModGUID = "Matsuura.HealthMetrics";

		private static GameObject HealthMeter = null;

		private static Transform MeterTransform = null;

		private static Vector3 localPositionOffset = new Vector3(-2f, 0f, 0f);

		private static Vector3 localPosition = Vector3.zero;

		private static bool DisableHealthMetrics;

		private static void Initialize()
		{
			DisableHealthMetrics = CompatibleDependencyAttribute.IsEladsHudPresent || CompatibleDependencyAttribute.IsLCVRPresent;
			if (!DisableHealthMetrics)
			{
				ConfigHandler.Compat.HealthMetrics.SettingChanged += UpdateHealthMeter;
			}
		}

		private static void Start()
		{
			//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)
			if (!DisableHealthMetrics)
			{
				HealthMeter = Shared_FetchHUDDisplay();
				if (Object.op_Implicit((Object)(object)HealthMeter))
				{
					MeterTransform = HealthMeter.transform;
					localPosition = HealthMeter.transform.localPosition;
					UpdateHealthMeter();
				}
			}
		}

		internal static void UpdateHealthMeter(object sender = null, EventArgs e = null)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_003d: 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)
			if (!((Object)(object)HealthMeter == (Object)null) && !((Object)(object)MeterTransform == (Object)null) && !(localPosition == Vector3.zero))
			{
				MeterTransform.SetLocalPositionAndRotation(ConfigHandler.Compat.HealthMetrics.Value ? (localPosition + localPositionOffset) : localPosition, MeterTransform.localRotation);
			}
		}

		internal static GameObject Shared_FetchHUDDisplay()
		{
			TextMeshProUGUI[] componentsInChildren = HUDInjector.TopLeftHUD.GetComponentsInChildren<TextMeshProUGUI>(true);
			TextMeshProUGUI[] array = componentsInChildren;
			foreach (TextMeshProUGUI val in array)
			{
				if (((Object)((Component)val).gameObject).name == "HealthHUDDisplay")
				{
					return ((Component)val).gameObject;
				}
			}
			return null;
		}
	}
	public class LethalConfigCompatibility
	{
		internal const string ModGUID = "ainavt.lc.lethalconfig";

		private static void Initialize()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			LethalConfigManager.SkipAutoGen();
			TextInputFieldConfigItem val = new TextInputFieldConfigItem(ConfigHandler.MeterColor, new TextInputFieldOptions
			{
				CharacterLimit = 9,
				RequiresRestart = false
			});
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
			BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(ConfigHandler.useAccurateDisplay, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.enableReverse, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.alwaysFull, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			EnumDropDownConfigItem<ConfigHandler.CenteredIconSettings> val3 = new EnumDropDownConfigItem<ConfigHandler.CenteredIconSettings>(ConfigHandler.iconAlwaysCentered, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.LCCrouchHUD, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.An0nPatches, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.LethalCompanyPatched, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.EladsHUD, true);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.GeneralImprovements, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.HealthMetrics, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.DamageMetrics, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.InfectedCompany, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.InfectedCompany_InfectedOnly, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			val2 = new BoolCheckBoxConfigItem(ConfigHandler.Compat.ShyHUD, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.SetModDescription("Adds an insanity meter to the hud in vanilla style");
			Initialise.Logger.LogDebug((object)"Added entries to LethalConfig");
			ConfigHandler.MeterColor.SettingChanged += ConfigHandler.FixColor;
			ConfigHandler.alwaysFull.SettingChanged += ConfigHandler.SettingChanged;
			ConfigHandler.enableReverse.SettingChanged += ConfigHandler.SettingChanged;
			ConfigHandler.iconAlwaysCentered.SettingChanged += ConfigHandler.SettingChanged;
		}
	}
	public class LobbyCompatibility_Compatibility
	{
		internal const string ModGUID = "BMX.LobbyCompatibility";

		private static void Initialize()
		{
			PluginHelper.RegisterPlugin("InsanityDisplay.Confusified.com.GitHub", Version.Parse("1.3.3"), (CompatibilityLevel)0, (VersionStrictness)0);
		}
	}
	public class ShyHUDCompatibility
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_LateUpdate <0>__UpdateMeterFade;

			public static EventHandler <1>__UpdateSetting;
		}

		internal const string ModGUID = "ShyHUD";

		internal static float CurrentTransparency = 1f;

		internal static bool ShyHUDEnabled;

		private static bool FadeToZero = false;

		private static bool FadeToOne = false;

		private static CanvasRenderer InsanityMeterCanvasRenderer { get; set; } = null;


		private static void Initialize()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			CompatibleDependencyAttribute.ShyHUDPresent = true;
			if (!CompatibleDependencyAttribute.IsEladsHudPresent)
			{
				UpdateSetting();
				object obj = <>O.<0>__UpdateMeterFade;
				if (obj == null)
				{
					hook_LateUpdate val = UpdateMeterFade;
					<>O.<0>__UpdateMeterFade = val;
					obj = (object)val;
				}
				PlayerControllerB.LateUpdate += (hook_LateUpdate)obj;
				ConfigHandler.Compat.ShyHUD.SettingChanged += UpdateSetting;
			}
		}

		private static void Start()
		{
			if (!CompatibleDependencyAttribute.IsEladsHudPresent)
			{
				CurrentTransparency = 1f;
			}
		}

		internal static void UpdateMeterFade(orig_LateUpdate orig, PlayerControllerB self)
		{
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)HUDInjector.InsanityMeter))
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)InsanityMeterCanvasRenderer))
			{
				InsanityMeterCanvasRenderer = HUDInjector.InsanityMeter.GetComponent<CanvasRenderer>();
			}
			if (Object.op_Implicit((Object)(object)InsanityMeterCanvasRenderer) && ((NetworkBehaviour)self).IsOwner && (!((NetworkBehaviour)self).IsServer || self.isHostPlayerObject) && self.isPlayerControlled && !self.isPlayerDead)
			{
				float fillAmount = HUDInjector.InsanityMeterComponent.fillAmount;
				float alpha = InsanityMeterCanvasRenderer.GetAlpha();
				if (ShyHUDEnabled && CurrentTransparency > 0f && !HUDBehaviour.SetAlwaysFull && (HUDBehaviour.CurrentMeterFill >= 0.9101f || HUDBehaviour.CurrentMeterFill <= 0.2976f) && !FadeToZero)
				{
					FadeToZero = true;
					FadeToOne = false;
					((Graphic)HUDInjector.InsanityMeterComponent).CrossFadeAlpha(0f, 5f, false);
					CurrentTransparency = alpha;
				}
				else if ((HUDBehaviour.CurrentMeterFill > 0.2976f && HUDBehaviour.CurrentMeterFill < 0.9101f && !FadeToOne) || (HUDBehaviour.SetAlwaysFull && !FadeToOne))
				{
					FadeToZero = false;
					FadeToOne = true;
					((Graphic)HUDInjector.InsanityMeterComponent).CrossFadeAlpha(1f, 0.5f, false);
					CurrentTransparency = alpha;
				}
				if (alpha >= 0.9999f)
				{
					FadeToOne = false;
					InsanityMeterCanvasRenderer.SetAlpha(1f);
					CurrentTransparency = 1f;
				}
				else if (alpha < 0.0001f)
				{
					FadeToZero = false;
					InsanityMeterCanvasRenderer.SetAlpha(0f);
					CurrentTransparency = 0f;
				}
			}
		}

		private static void UpdateSetting(object sender = null, EventArgs e = null)
		{
			ShyHUDEnabled = ConfigHandler.Compat.ShyHUD.Value;
		}
	}
}
namespace LC_InsanityDisplay.Plugin.UI
{
	public class HUDInjector
	{
		public const string ModName = "InsanityMeter";

		public static Vector3 localPositionOffset = new Vector3(-3.4f, 3.7f, 0f);

		private const float localScaleMultiplier = 0.86f;

		internal static PlayerControllerB LocalPlayerInstance { get; private set; } = null;


		internal static HUDManager HUDManagerInstance { get; private set; } = null;


		internal static GameObject TopLeftHUD { get; private set; } = null;


		public static GameObject InsanityMeter { get; internal set; } = null;


		public static Image InsanityMeterComponent { get; internal set; } = null;


		private static GameObject VanillaSprintMeter { get; set; } = null;


		public static void InjectIntoHud(orig_SetSavedValues orig, HUDManager self, int playerObjectId = -1)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self, playerObjectId);
			if (playerObjectId == -1 || (playerObjectId != -1 && (Object)(object)self.localPlayer == (Object)(object)self.playersManager.allPlayerScripts[playerObjectId]))
			{
				HUDManagerInstance = self;
				LocalPlayerInstance = StartOfRound.Instance.localPlayerController;
				VanillaSprintMeter = ((Component)LocalPlayerInstance.sprintMeterUI).gameObject;
				TopLeftHUD = ((Component)VanillaSprintMeter.transform.parent).gameObject;
				HUDBehaviour.PlayerIcon = ((Component)TopLeftHUD.transform.Find("Self")).gameObject;
				HUDBehaviour.PlayerRedIcon = ((Component)HUDManagerInstance.selfRedCanvasGroup).gameObject;
				HUDBehaviour.VanillaIconPosition = HUDBehaviour.PlayerIcon.transform.localPosition;
				HUDBehaviour.CurrentPosition = HUDBehaviour.VanillaIconPosition;
				HUDBehaviour.CenteredIconPosition = HUDBehaviour.VanillaIconPosition + HUDBehaviour.IconPositionOffset;
				Initialise.Logger.LogDebug((object)"Activating compatibilities...");
				CompatibleDependencyAttribute.Activate();
				Initialise.Logger.LogDebug((object)"Activated all the compatibilities");
				Initialise.Logger.LogDebug((object)"Setting up insanity meter...");
				CreateMeter();
				Initialise.Logger.LogDebug((object)"Finished setting up the insanity meter");
			}
		}

		private static void CreateMeter()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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)
			if (!Object.op_Implicit((Object)(object)InsanityMeter))
			{
				InsanityMeter = Object.Instantiate<GameObject>(VanillaSprintMeter, TopLeftHUD.transform);
				InsanityMeter.SetActive(false);
				((Object)InsanityMeter).name = "InsanityMeter";
				InsanityMeterComponent = InsanityMeter.GetComponentInChildren<Image>(true);
				Transform transform = InsanityMeter.transform;
				transform.SetAsFirstSibling();
				transform.SetLocalPositionAndRotation(VanillaSprintMeter.transform.localPosition + localPositionOffset, transform.localRotation);
				transform.localScale *= 0.86f;
			}
			HUDBehaviour.CurrentlySetColor = new Color(0f, 0f, 0f, 0f);
			HUDBehaviour.LastInsanityLevel = -1f;
			HUDBehaviour.LastIconPosition = HUDBehaviour.VanillaIconPosition;
			HUDBehaviour.UpdateMeter(settingChanged: true);
			if (!Object.op_Implicit((Object)(object)InfectedCompanyCompatibility.InfectedMeter) || !InfectedCompanyCompatibility.IsInfectedCompanyEnabled || !InfectedCompanyCompatibility.OnlyUseInfectedCompany)
			{
				InsanityMeter.SetActive(true);
			}
			HUDBehaviour.UpdateIconPosition(settingChanged: true);
		}
	}
	internal class HUDBehaviour
	{
		public const float accurate_MinValue = 0.2976f;

		public const float accurate_MaxValue = 0.9101f;

		public const float accurate_Diff = 0.61249995f;

		internal static bool SetAlwaysFull;

		internal static bool ReverseEnabled;

		internal static bool usingAccurateDisplay;

		internal static Vector3 CurrentPosition;

		private static ConfigHandler.CenteredIconSettings IconSetting;

		private static Vector3 NewPosition;

		private static bool NeverCenter;

		private static bool AlwaysCenter;

		internal static float CurrentMeterFill;

		private const float lerpNumber1 = 1.179f;

		private const float lerpNumber2 = 0.337f;

		private const float lerpNumber3 = 0.03f;

		public static Color InsanityMeterColor { get; internal set; }

		public static Color CurrentlySetColor { get; internal set; }

		public static GameObject PlayerIcon { get; internal set; } = null;


		public static GameObject PlayerRedIcon { get; internal set; } = null;


		internal static float LastInsanityLevel { get; set; } = -1f;


		internal static float InsanityLevel { get; set; }

		internal static Vector3 LastIconPosition { get; set; }

		internal static Vector3 IconPositionOffset { get; private set; } = new Vector3(-6.8f, 4f, 0f);


		internal static Vector3 VanillaIconPosition { get; set; }

		internal static Vector3 CenteredIconPosition { get; set; }

		internal static void UpdateMeter(bool settingChanged = false)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)HUDInjector.LocalPlayerInstance) || !Object.op_Implicit((Object)(object)HUDInjector.InsanityMeterComponent))
			{
				return;
			}
			if ((settingChanged || (!SetAlwaysFull && (LastInsanityLevel != HUDInjector.LocalPlayerInstance.insanityLevel || (CurrentMeterFill > 0.2976f && LastInsanityLevel == 0f) || (ReverseEnabled && LastInsanityLevel == 0f && CurrentMeterFill < 0.9101f))) || (SetAlwaysFull && CurrentMeterFill != 1f)) && ((!SetAlwaysFull && HUDInjector.InsanityMeter.activeSelf) || SetAlwaysFull))
			{
				CurrentMeterFill = ReturnInsanityLevel();
				HUDInjector.InsanityMeterComponent.fillAmount = CurrentMeterFill;
				if (Object.op_Implicit((Object)(object)EladsHUDCompatibility.InsanityPercentageObject))
				{
					EladsHUDCompatibility.UpdatePercentageText();
				}
			}
			if (CurrentlySetColor != InsanityMeterColor)
			{
				((Graphic)HUDInjector.InsanityMeterComponent).color = InsanityMeterColor;
				CurrentlySetColor = InsanityMeterColor;
				if (Object.op_Implicit((Object)(object)EladsHUDCompatibility.InsanityPercentageObject))
				{
					EladsHUDCompatibility.UpdateColour();
				}
			}
		}

		private static float ReturnInsanityLevel()
		{
			if (SetAlwaysFull)
			{
				return 1f;
			}
			if (Object.op_Implicit((Object)(object)InfectedCompanyCompatibility.InfectedMeter) && InfectedCompanyCompatibility.IsInfectedCompanyEnabled && InfectedCompanyCompatibility.IsPlayerInfected)
			{
				InsanityLevel = InfectedCompanyCompatibility.InfectedMeterComponent.value;
			}
			else
			{
				InsanityLevel = HUDInjector.LocalPlayerInstance.insanityLevel / HUDInjector.LocalPlayerInstance.maxInsanityLevel;
			}
			if (usingAccurateDisplay != ConfigHandler.useAccurateDisplay.Value)
			{
				usingAccurateDisplay = ConfigHandler.useAccurateDisplay.Value;
			}
			if (ReverseEnabled != ConfigHandler.enableReverse.Value)
			{
				ReverseEnabled = ConfigHandler.enableReverse.Value;
			}
			if (usingAccurateDisplay && !Object.op_Implicit((Object)(object)EladsHUDCompatibility.InsanityPercentageObject))
			{
				float num = InsanityLevel * 0.61249995f;
				if (ReverseEnabled)
				{
					return 0.9101f - num;
				}
				return 0.2976f + num;
			}
			if (ReverseEnabled)
			{
				return 1f - InsanityLevel;
			}
			return InsanityLevel;
		}

		internal static void InsanityValueChanged(orig_SetPlayerSanityLevel orig, PlayerControllerB self)
		{
			orig.Invoke(self);
			if (Object.op_Implicit((Object)(object)HUDInjector.InsanityMeterComponent) && !self.isPlayerDead && self.isPlayerControlled)
			{
				if (SetAlwaysFull != ConfigHandler.alwaysFull.Value)
				{
					SetAlwaysFull = ConfigHandler.alwaysFull.Value;
				}
				if (ReverseEnabled != ConfigHandler.enableReverse.Value)
				{
					ReverseEnabled = ConfigHandler.enableReverse.Value;
				}
				float fillAmount = HUDInjector.InsanityMeterComponent.fillAmount;
				float insanityLevel = self.insanityLevel;
				if (((CurrentMeterFill != InsanityLevel || LastInsanityLevel != insanityLevel || CurrentMeterFill != fillAmount) && !SetAlwaysFull) || (SetAlwaysFull && fillAmount != 1f) || (ReverseEnabled && fillAmount < 0.9101f && insanityLevel == 0f && HUDInjector.InsanityMeter.activeSelf))
				{
					UpdateMeter();
				}
				if (Object.op_Implicit((Object)(object)PlayerIcon) && Object.op_Implicit((Object)(object)PlayerRedIcon))
				{
					UpdateIconPosition();
				}
				if (LastInsanityLevel != insanityLevel)
				{
					LastInsanityLevel = insanityLevel;
				}
			}
		}

		internal static void UpdateIconPosition(bool settingChanged = false)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			if (CompatibleDependencyAttribute.IsEladsHudPresent)
			{
				return;
			}
			if (IconSetting != ConfigHandler.iconAlwaysCentered.Value)
			{
				IconSetting = ConfigHandler.iconAlwaysCentered.Value;
			}
			if (NeverCenter != (IconSetting == ConfigHandler.CenteredIconSettings.Never))
			{
				NeverCenter = IconSetting == ConfigHandler.CenteredIconSettings.Never;
			}
			if (AlwaysCenter != (IconSetting == ConfigHandler.CenteredIconSettings.Always))
			{
				AlwaysCenter = IconSetting == ConfigHandler.CenteredIconSettings.Always;
			}
			if (settingChanged)
			{
				CurrentMeterFill = ReturnInsanityLevel();
			}
			if (((LastIconPosition == VanillaIconPosition && NeverCenter) || (LastIconPosition == CenteredIconPosition && AlwaysCenter) || (CurrentMeterFill >= 0.9101f && LastIconPosition == CenteredIconPosition && !NeverCenter) || (!usingAccurateDisplay && CurrentMeterFill < 0.2976f && LastIconPosition == VanillaIconPosition && !AlwaysCenter) || (usingAccurateDisplay && CurrentMeterFill <= 0.2976f && LastIconPosition == VanillaIconPosition && !AlwaysCenter) || (CurrentMeterFill < 0.9101f && CurrentMeterFill > 0.2976f && LastIconPosition == CenteredIconPosition) || (InfectedCompanyCompatibility.IsInfectedCompanyEnabled && Object.op_Implicit((Object)(object)InfectedCompanyCompatibility.InfectedMeter) && !HUDInjector.InsanityMeter.activeSelf && LastIconPosition != VanillaIconPosition)) && !settingChanged)
			{
				return;
			}
			if (NeverCenter || (CurrentMeterFill < 0.2976f && !AlwaysCenter))
			{
				NewPosition = VanillaIconPosition;
			}
			else if (SetAlwaysFull || AlwaysCenter || (CurrentMeterFill > 0.9101f && !NeverCenter))
			{
				NewPosition = CenteredIconPosition;
			}
			else
			{
				float num = 1.179f * (CurrentMeterFill * CurrentMeterFill) - 0.337f * CurrentMeterFill + 0.03f;
				Vector3 val = ((CurrentMeterFill > 0.2976f) ? CenteredIconPosition : VanillaIconPosition);
				if (!HUDInjector.InsanityMeter.activeSelf && val != VanillaIconPosition)
				{
					val = VanillaIconPosition;
				}
				if (Vector3.Distance(NewPosition, val) <= 0.05f)
				{
					NewPosition = val;
				}
				else
				{
					CurrentPosition = PlayerIcon.transform.localPosition;
					NewPosition = Vector3.Lerp(CurrentPosition, val, num);
				}
			}
			Transform transform = PlayerIcon.transform;
			Vector3 localPosition = (PlayerRedIcon.transform.localPosition = NewPosition);
			transform.localPosition = localPosition;
			LastIconPosition = NewPosition;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}