Decompiled source of InsanityDisplay Indev v1.0.2

InsanityDisplay-1.3.0a3/InsanityDisplay.dll

Decompiled 5 months 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;
using com.Confusified.InsanityDisplay.NetcodePatcher;

[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("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("com.Confusified.InsanityDisplay")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+beb6eadfa7b1044c5a9ec811799bcbf07e1b54df")]
[assembly: AssemblyProduct("InsanityDisplay")]
[assembly: AssemblyTitle("com.Confusified.InsanityDisplay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 = "com.Confusified.InsanityDisplay";

		public const string PLUGIN_NAME = "InsanityDisplay";

		public const string PLUGIN_VERSION = "1.3.0";
	}
}
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()
		{
			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> 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.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("me.eladnlg.customhud", typeof(EladsHUDCompatibility))]
	[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("com.Confusified.InsanityDisplay", "InsanityDisplay", "1.3.0")]
	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;

		public static ConfigFile modConfig;

		internal static ManualLogSource Logger { get; private set; }

		internal static Initialise Instance { get; private set; }

		public void Awake()
		{
			Logger = Logger.CreateLogSource("com.Confusified.InsanityDisplay");
			Logger = Logger;
			Instance = this;
			ConfigHandler.InitialiseConfig();
			if (!ConfigHandler.ModEnabled.Value)
			{
				Logger.LogInfo((object)"Stopped loading InsanityDisplay 1.3.0, as it is disabled through the config file");
				Object.Destroy((Object)(object)this);
			}
			else
			{
				CompatibleDependencyAttribute.Init((BaseUnityPlugin)(object)this);
				Hook();
				Logger.LogInfo((object)"InsanityDisplay 1.3.0 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;
		}

		static Initialise()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			string[] array = new string[1];
			string configPath = Paths.ConfigPath;
			string text = "com.Confusified.InsanityDisplay";
			array[0] = configPath + "\\" + text.Substring(4, text.Length - 4).Replace(".", "\\");
			configLocation = Utility.CombinePaths(array);
			modConfig = new ConfigFile(configLocation + ".cfg", false);
			Logger = null;
			Instance = null;
		}
	}
	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";

		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;
			}
		}

		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_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)An0nTextHUD == (Object)null) && !((Object)(object)An0nTransform == (Object)null) && !(localPosition == Vector3.zero))
			{
				An0nTransform.SetLocalPositionAndRotation(ConfigHandler.Compat.An0nPatches.Value ? (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";

		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(-7f, 4f, 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)
			{
				CompatibleDependencyAttribute.IsEladsHudPresent = true;
				ConfigHandler.Compat.EladsHUD.SettingChanged += UpdateVisibility;
			}
		}

		private static void Start()
		{
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			if (CompatibleDependencyAttribute.IsLCVRPresent || !ConfigHandler.Compat.EladsHUD.Value)
			{
				return;
			}
			Mask[] componentsInChildren = ((Component)HUDInjector.TopLeftHUD.transform.parent).GetComponentsInChildren<Mask>(true);
			foreach (Mask val in componentsInChildren)
			{
				GameObject gameObject = ((Component)((Component)val).gameObject.transform.parent.parent).gameObject;
				if (((Object)gameObject).name == "Stamina")
				{
					EladsHUDObject = ((Component)gameObject.transform.parent).gameObject;
					BatteryLayoutTransform = EladsHUDObject.transform.GetChild(2);
					((Component)gameObject.transform.GetChild(1)).gameObject.SetActive(false);
					((Component)gameObject.transform.GetChild(2)).gameObject.SetActive(false);
					HUDInjector.InsanityMeter = Object.Instantiate<GameObject>(gameObject, EladsHUDObject.transform);
					HUDInjector.InsanityMeter.SetActive(false);
					((Object)HUDInjector.InsanityMeter).name = "InsanityMeter";
					((Component)gameObject.transform.GetChild(1)).gameObject.SetActive(true);
					((Component)gameObject.transform.GetChild(2)).gameObject.SetActive(true);
					break;
				}
			}
			InsanityMeterShadow = ((Component)HUDInjector.InsanityMeter.transform.GetChild(0)).gameObject;
			((Object)InsanityMeterShadow).name = "Insanity BG";
			GameObject gameObject2 = ((Component)HUDInjector.InsanityMeter.transform.GetChild(1)).gameObject;
			InsanityPercentageObject = ((Component)HUDInjector.InsanityMeter.transform.GetChild(2)).gameObject;
			((Object)InsanityPercentageObject).name = "InsanityInfo";
			InsanityPercentageText = InsanityPercentageObject.GetComponent<TextMeshProUGUI>();
			((TMP_Text)InsanityPercentageText).horizontalAlignment = (HorizontalAlignmentOptions)4;
			Image[] componentsInChildren2 = HUDInjector.InsanityMeter.gameObject.GetComponentsInChildren<Image>();
			foreach (Image val2 in componentsInChildren2)
			{
				if (Object.op_Implicit((Object)(object)((Component)val2).gameObject.GetComponent<Mask>()))
				{
					HUDInjector.InsanityMeterComponent = val2;
					break;
				}
			}
			Object.Destroy((Object)(object)gameObject2);
			Transform transform = HUDInjector.InsanityMeter.transform;
			transform.localPosition += InsanityBarOffset;
			Transform transform2 = InsanityPercentageObject.transform;
			transform2.localPosition += PercentageObjectOffset;
			Transform batteryLayoutTransform = BatteryLayoutTransform;
			batteryLayoutTransform.localPosition += BatteryLayoutOffset;
			oldBarFill = -1;
			InsanityPercentageObject.SetActive(true);
			HUDInjector.InsanityMeter.SetActive(true);
		}

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

		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(-2f, 28f, 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)
			{
				ConfigHandler.Compat.GeneralImprovements.SettingChanged += UpdateDisplayPosition;
			}
		}

		private static void Start()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (!HitpointDisplayActive)
			{
				return;
			}
			TextMeshProUGUI[] componentsInChildren = HUDInjector.TopLeftHUD.GetComponentsInChildren<TextMeshProUGUI>(true);
			TextMeshProUGUI[] array = componentsInChildren;
			int num = 0;
			if (num < array.Length)
			{
				TextMeshProUGUI val = array[num];
				if (((Object)val).name == "HP")
				{
					HitpointDisplay = ((Component)val).gameObject;
				}
			}
			if (Object.op_Implicit((Object)(object)HitpointDisplay))
			{
				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);
			}
		}
	}
	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.EladsHUD, false);
			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.LethalCompanyVR, true);
			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("com.Confusified.InsanityDisplay", Version.Parse("1.3.0"), (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;

		internal static float CurrentMeterFill;

		private static ConfigHandler.CenteredIconSettings IconSetting;

		private static Vector3 NewPosition;

		private static bool NeverCenter;

		private static bool AlwaysCenter;

		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_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_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_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_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_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: 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_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_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 && NeverCenter))
			{
				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);
				}
			}
			LastIconPosition = NewPosition;
			Transform transform = PlayerIcon.transform;
			Vector3 localPosition = (PlayerRedIcon.transform.localPosition = NewPosition);
			transform.localPosition = localPosition;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace com.Confusified.InsanityDisplay.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}