Decompiled source of LethalHUD v1.3.3

plugins/LethalHUD/LethalHUD.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using GoodItemScan;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalHUD.Compats;
using LethalHUD.Configs;
using LethalHUD.HUD;
using LethalHUD.Misc;
using LethalHUD.Scan;
using Microsoft.CodeAnalysis;
using SoftMasking;
using TMPro;
using Unity.Netcode;
using Unity.Netcode.Transports.UTP;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("GoodItemScan")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("s1ckboy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 s1ckboy")]
[assembly: AssemblyFileVersion("1.3.3.0")]
[assembly: AssemblyInformationalVersion("1.3.3+f91980db272533dfff00ff36bd3bbd201a5f9ce1")]
[assembly: AssemblyProduct("LethalHUD")]
[assembly: AssemblyTitle("LethalHUD")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalHUD
{
	public static class Enums
	{
		public enum SlotEnums
		{
			None,
			Rainbow,
			Summer,
			Winter,
			Vaporwave,
			Deepmint,
			Radioactive,
			TideEmber
		}

		public enum ItemValue
		{
			Default,
			Dollar
		}

		public enum ScanMode
		{
			Default,
			Hold,
			Toggle
		}

		public enum ScanLines
		{
			Default,
			Circles,
			Hexagons,
			Circuit,
			Noisy,
			Scifi
		}

		public enum ScanNodeShape
		{
			Default,
			Triangle,
			Target
		}

		public enum WeightUnit
		{
			Pounds,
			Kilograms,
			Manuls
		}

		public enum WeightUnitDisplay
		{
			OnlyOne,
			KgAndPounds,
			PoundsAndManuls,
			KgAndManuls,
			KgPoundsAndManuls
		}

		public enum WeightDecimalFormat
		{
			Rounded,
			TwoDecimalsDot,
			TwoDecimalsComma
		}

		public enum MTColorMode
		{
			Solid,
			Gradient
		}

		public enum SprintStyle
		{
			Solid,
			Shades,
			Gradient
		}

		public enum ClockStyle
		{
			Regular,
			Compact
		}

		public enum HPDisplayMode
		{
			Plain,
			Percent,
			Label
		}

		public enum FPSPingLayout
		{
			Vertical,
			Horizontal
		}

		public enum TotalValuePrefix
		{
			Full,
			Short,
			None
		}

		internal static Color solarFlare = new Color(1f, 0.8f, 0.3f);

		internal static Color moltenCore = new Color(1f, 0.2f, 0f);

		internal static Color skyWave = new Color(0.4f, 0.65f, 1f);

		internal static Color moonlitMist = new Color(0.8f, 0.8f, 1f);

		internal static Color pinkPrism = new Color(1f, 0.4f, 1f);

		internal static Color aquaPulse = new Color(0.4f, 1f, 1f);

		internal static Color mintWave = new Color(0.5647f, 0.8706f, 0.7843f);

		internal static Color deepTeal = new Color(0.1608f, 0.2863f, 0.2549f);

		internal static Color neonLime = new Color(0.443f, 0.78f, 0f);

		internal static Color lemonGlow = new Color(0.941f, 1f, 0.471f);

		internal static Color crimsonSpark = new Color(1f, 0.27f, 0f);

		internal static Color deepOcean = new Color(0f, 0.48f, 0.54f);

		private static readonly float baseIntensity = 352.08f;

		private static readonly float customBaseIntensity = 100f;

		internal static void DirtIntensityHandlerByScanLine()
		{
			Bloom scanBloom = ScanController.ScanBloom;
			if (!((Object)(object)scanBloom == (Object)null))
			{
				if (Plugins.ConfigEntries.SelectedScanlineMode.Value == ScanLines.Default)
				{
					((VolumeParameter<float>)(object)scanBloom.dirtIntensity).Override(Mathf.Max(0f, baseIntensity + Plugins.ConfigEntries.DirtIntensity.Value));
				}
				else
				{
					((VolumeParameter<float>)(object)scanBloom.dirtIntensity).Override(Mathf.Max(0f, customBaseIntensity + Plugins.ConfigEntries.DirtIntensity.Value));
				}
			}
		}
	}
	internal class Loggers
	{
		private static void Log(LogLevel logLevel, object data)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Plugins.Logger.Log(logLevel, data);
		}

		internal static void Info(object data)
		{
			Log((LogLevel)16, data);
		}

		internal static void Debug(object data)
		{
			Log((LogLevel)32, data);
		}

		internal static void Message(object data)
		{
			Log((LogLevel)8, data);
		}

		internal static void Warning(object data)
		{
			Log((LogLevel)4, data);
		}

		internal static void Error(object data)
		{
			Log((LogLevel)2, data);
		}

		internal static void Fatal(object data)
		{
			Log((LogLevel)1, data);
		}
	}
	[BepInPlugin("LethalHUD", "LethalHUD", "1.3.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugins : BaseUnityPlugin
	{
		internal struct ScanNodeCircleTextures
		{
			public Sprite Outer;

			public Sprite Inner;
		}

		internal static Dictionary<Enums.ScanLines, Texture2D> ScanlineTextures = new Dictionary<Enums.ScanLines, Texture2D>();

		internal static Dictionary<Enums.ScanNodeShape, ScanNodeCircleTextures> ScanNodeSprites = new Dictionary<Enums.ScanNodeShape, ScanNodeCircleTextures>();

		internal static Plugins Instance { get; private set; }

		internal static Harmony Harmony { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static ConfigFile Config { get; private set; }

		internal static ConfigEntries ConfigEntries { get; private set; }

		public void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Harmony = new Harmony("LethalHUD");
			Logger = Logger.CreateLogSource("LethalHUD");
			Loggers.Info("Plugin LethalHUD loaded!");
			ConfigFile val = ConfigUtils.CreateLocalConfigFile((BaseUnityPlugin)(object)this, "bootstrap", saveOnInit: true);
			ConfigEntry<bool> val2 = val.Bind<bool>("Main", "Use Local Config", false, "If enabled, uses a local config file instead of the global config. Requires restart.");
			Config = (val2.Value ? ConfigUtils.CreateLocalConfigFile((BaseUnityPlugin)(object)this) : ConfigUtils.CreateGlobalConfigFile((BaseUnityPlugin)(object)this));
			ConfigEntries = new ConfigEntries();
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "unfathomablyridiculousoriginalassetbundlenameforlethalhud");
			AssetBundle val3 = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val3 == (Object)null)
			{
				Loggers.Error("Failed to load unfathomablyridiculousoriginalassetbundlenameforlethalhud assetbundle.");
				return;
			}
			foreach (Enums.ScanLines value in Enum.GetValues(typeof(Enums.ScanLines)))
			{
				string text2 = value.ToString();
				Texture2D val4 = val3.LoadAsset<Texture2D>(text2);
				if ((Object)(object)val4 != (Object)null)
				{
					ScanlineTextures[value] = val4;
				}
				else
				{
					Loggers.Warning("Texture '" + text2 + "' not found in asset bundle.");
				}
			}
			foreach (Enums.ScanNodeShape value2 in Enum.GetValues(typeof(Enums.ScanNodeShape)))
			{
				string text3 = $"{value2}_Outer";
				string text4 = $"{value2}_Inner";
				Sprite val5 = val3.LoadAsset<Sprite>(text3);
				Sprite val6 = val3.LoadAsset<Sprite>(text4);
				if ((Object)(object)val5 == (Object)null)
				{
					Logger.LogWarning((object)("ScanNode texture '" + text3 + "' not found."));
				}
				if ((Object)(object)val6 == (Object)null)
				{
					Logger.LogWarning((object)("ScanNode texture '" + text4 + "' not found."));
				}
				ScanNodeSprites[value2] = new ScanNodeCircleTextures
				{
					Outer = val5,
					Inner = val6
				};
			}
			Harmony.PatchAll();
			val.Save();
			HalloweenManager.Instance.RestoreOnLoad();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalHUD";

		public const string PLUGIN_NAME = "LethalHUD";

		public const string PLUGIN_VERSION = "1.3.3";
	}
}
namespace LethalHUD.Scan
{
	internal static class ScanController
	{
		private const float ScanDuration = 1.3f;

		private static Texture2D _lastRecoloredTexture;

		private static Volume _cachedScanVolume;

		private static MeshRenderer ScanRenderer
		{
			get
			{
				HUDManager instance = HUDManager.Instance;
				object result;
				if (instance == null)
				{
					result = null;
				}
				else
				{
					Animator scanEffectAnimator = instance.scanEffectAnimator;
					result = ((scanEffectAnimator != null) ? ((Component)scanEffectAnimator).GetComponent<MeshRenderer>() : null);
				}
				return (MeshRenderer)result;
			}
		}

		private static Volume ScanVolume
		{
			get
			{
				if ((Object)(object)_cachedScanVolume == (Object)null)
				{
					GameObject val = GameObject.Find("Systems/Rendering/ScanSphere/ScanVolume");
					_cachedScanVolume = ((val != null) ? val.GetComponent<Volume>() : null);
				}
				return _cachedScanVolume;
			}
		}

		private static Vignette ScanVignette
		{
			get
			{
				Volume scanVolume = ScanVolume;
				return (scanVolume == null) ? null : scanVolume.profile?.components?.OfType<Vignette>().FirstOrDefault();
			}
		}

		internal static Bloom ScanBloom
		{
			get
			{
				Volume scanVolume = ScanVolume;
				return (scanVolume == null) ? null : scanVolume.profile?.components?.OfType<Bloom>().FirstOrDefault();
			}
		}

		private static float ScanProgress => 0.7692308f * (HUDManager.Instance.playerPingingScan + 1f);

		private static bool IsInspecting => (StartOfRound.Instance?.localPlayerController?.IsInspectingItem).GetValueOrDefault();

		private static void SetScanColorAlpha(float alpha)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer scanRenderer = ScanRenderer;
			if (!((Object)(object)((scanRenderer != null) ? ((Renderer)scanRenderer).material : null) == (Object)null))
			{
				Color color = ((Renderer)ScanRenderer).material.color;
				color.a = alpha;
				((Renderer)ScanRenderer).material.color = color;
			}
		}

		internal static void SetScanColor(Color? overrideColor = null)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			if (!IsInspecting)
			{
				Color val = (Color)(((??)overrideColor) ?? ConfigHelper.GetScanColor());
				if (ModCompats.IsBetterScanVisionPresent)
				{
					BetterScanVisionProxy.OverrideNightVisionColor();
				}
				MeshRenderer scanRenderer = ScanRenderer;
				if ((Object)(object)((scanRenderer != null) ? ((Renderer)scanRenderer).material : null) != (Object)null)
				{
					((Renderer)ScanRenderer).material.color = val;
				}
				if ((Object)(object)ScanVignette != (Object)null)
				{
					((VolumeParameter<Color>)(object)ScanVignette.color).Override(val);
					UpdateVignetteIntensity();
				}
				if ((Object)(object)ScanBloom != (Object)null)
				{
					((VolumeParameter<Color>)(object)ScanBloom.tint).Override(val);
					UpdateScanTexture();
				}
			}
		}

		internal static void UpdateScanAlpha()
		{
			if (!((Object)(object)HUDManager.Instance == (Object)null) && !((Object)(object)ScanRenderer == (Object)null) && !IsInspecting)
			{
				float value = Plugins.ConfigEntries.Alpha.Value;
				float num = value;
				if (Plugins.ConfigEntries.FadeOut.Value && HUDManager.Instance.playerPingingScan > -1f)
				{
					num *= ScanProgress;
				}
				SetScanColorAlpha(num);
			}
		}

		internal static void UpdateVignetteIntensity()
		{
			if (!IsInspecting)
			{
				((VolumeParameter<float>)(object)ScanVignette?.intensity).Override(Plugins.ConfigEntries.VignetteIntensity.Value);
			}
		}

		internal static void UpdateScanTexture()
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ScanBloom == (Object)null || IsInspecting)
			{
				return;
			}
			Enums.DirtIntensityHandlerByScanLine();
			Texture2D selectedTexture = GetSelectedTexture();
			if (!((Object)(object)selectedTexture == (Object)null))
			{
				if (Plugins.ConfigEntries.RecolorScanLines.Value)
				{
					RecolorAndApplyTexture(ConfigHelper.GetScanColor(), selectedTexture);
				}
				else
				{
					((VolumeParameter<Texture>)(object)ScanBloom.dirtTexture).Override((Texture)(object)selectedTexture);
				}
			}
		}

		private static void RecolorAndApplyTexture(Color color, Texture2D baseTex)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			Texture2D texture = new Texture2D(((Texture)baseTex).width, ((Texture)baseTex).height, (TextureFormat)4, true);
			texture.SetPixels(baseTex.GetPixels());
			HUDUtils.RecolorTexture(ref texture, color);
			texture.Apply(true, false);
			if ((Object)(object)_lastRecoloredTexture != (Object)null)
			{
				Object.Destroy((Object)(object)_lastRecoloredTexture);
			}
			_lastRecoloredTexture = texture;
			((VolumeParameter<Texture>)(object)ScanBloom.dirtTexture).Override((Texture)(object)_lastRecoloredTexture);
		}

		private static Texture2D GetSelectedTexture()
		{
			Enums.ScanLines value = Plugins.ConfigEntries.SelectedScanlineMode.Value;
			if (Plugins.ScanlineTextures.TryGetValue(value, out var value2) && (Object)(object)value2 != (Object)null)
			{
				return value2;
			}
			Loggers.Warning($"Scanline texture '{value}' missing. Falling back to Default.");
			if (value != 0 && Plugins.ScanlineTextures.TryGetValue(Enums.ScanLines.Default, out var value3) && (Object)(object)value3 != (Object)null)
			{
				return value3;
			}
			Loggers.Error("No scanline textures could be applied.");
			return null;
		}
	}
	internal static class ScanNodeController
	{
		private static readonly Dictionary<ScanNodeProperties, float> nodeAppearTimes = new Dictionary<ScanNodeProperties, float>();

		internal static float lifetime = Plugins.ConfigEntries.ScanNodeLifetime.Value;

		internal static float fadeDuration = Plugins.ConfigEntries.ScanNodeFadeDuration.Value;

		private static readonly AnimationCurve fadeCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);

		internal static void UpdateTimers(RectTransform[] scanElements, Dictionary<RectTransform, ScanNodeProperties> scanNodes)
		{
			foreach (RectTransform val in scanElements)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				if (!scanNodes.TryGetValue(val, out var value) || (Object)(object)value == (Object)null)
				{
					CleanInvalidNodes();
					continue;
				}
				if (!nodeAppearTimes.ContainsKey(value))
				{
					nodeAppearTimes[value] = Time.time;
				}
				float num = Time.time - nodeAppearTimes[value];
				if (num >= lifetime + fadeDuration)
				{
					RemoveNode(val, value, scanNodes);
					continue;
				}
				float alpha = ((num > lifetime) ? fadeCurve.Evaluate((num - lifetime) / fadeDuration) : 1f);
				CanvasGroup component = ((Component)val).GetComponent<CanvasGroup>();
				component.alpha = alpha;
			}
		}

		internal static void UpdateGoodItemScanNodes()
		{
			if (!ModCompats.IsGoodItemScanPresent || GoodItemScan.scanner == null)
			{
				return;
			}
			Scanner scanner = GoodItemScan.scanner;
			List<ScanNodeProperties> list = scanner._scanNodes.Keys.ToList();
			foreach (ScanNodeProperties item in list)
			{
				if (!GoodItemScanProxy.TryGetRectTransform(item, out var rectTransform) || (Object)(object)rectTransform == (Object)null)
				{
					nodeAppearTimes.Remove(item);
					continue;
				}
				if (!((Component)rectTransform).gameObject.activeInHierarchy)
				{
					nodeAppearTimes.Remove(item);
					continue;
				}
				if (!nodeAppearTimes.ContainsKey(item))
				{
					nodeAppearTimes[item] = Time.time;
				}
				float num = Time.time - nodeAppearTimes[item];
				float num2 = ((num > lifetime) ? fadeCurve.Evaluate((num - lifetime) / fadeDuration) : 1f);
				CanvasGroup component = ((Component)rectTransform).GetComponent<CanvasGroup>();
				if ((Object)(object)component != (Object)null)
				{
					component.alpha = num2;
				}
				((Component)rectTransform).gameObject.SetActive(num2 > 0f);
			}
		}

		internal static void ResetGoodItemScanNodes()
		{
			if (!ModCompats.IsGoodItemScanPresent || GoodItemScan.scanner == null)
			{
				return;
			}
			Scanner scanner = GoodItemScan.scanner;
			if (scanner == null || scanner._scannedNodes == null)
			{
				return;
			}
			foreach (KeyValuePair<ScanNodeProperties, int> scanNode in scanner._scanNodes)
			{
				if (GoodItemScanProxy.TryGetRectTransform(scanNode.Key, out var rectTransform) && !((Object)(object)rectTransform == (Object)null))
				{
					nodeAppearTimes[scanNode.Key] = Time.time;
					((Component)rectTransform).gameObject.SetActive(true);
					CanvasGroup component = ((Component)rectTransform).GetComponent<CanvasGroup>();
					if ((Object)(object)component != (Object)null)
					{
						component.alpha = 1f;
					}
				}
			}
		}

		private static void RemoveNode(RectTransform element, ScanNodeProperties node, Dictionary<RectTransform, ScanNodeProperties> scanNodes)
		{
			((Component)element).gameObject.SetActive(false);
			scanNodes.Remove(element);
			nodeAppearTimes.Remove(node);
		}

		private static void CleanInvalidNodes()
		{
			List<ScanNodeProperties> list = new List<ScanNodeProperties>();
			foreach (KeyValuePair<ScanNodeProperties, float> nodeAppearTime in nodeAppearTimes)
			{
				if ((Object)(object)nodeAppearTime.Key == (Object)null)
				{
					list.Add(nodeAppearTime.Key);
				}
			}
			foreach (ScanNodeProperties item in list)
			{
				nodeAppearTimes.Remove(item);
			}
		}
	}
	internal static class ScanNodeTextureManager
	{
		private static readonly Dictionary<GameObject, Color> nodeColors = new Dictionary<GameObject, Color>();

		internal static void Tick()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			GameObject val = GameObject.Find("UI/Canvas/ObjectScanner");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Enums.ScanNodeShape value = Plugins.ConfigEntries.ScanNodeShapeChoice.Value;
			if (!Plugins.ScanNodeSprites.TryGetValue(value, out var value2))
			{
				return;
			}
			Sprite inner = value2.Inner;
			Sprite outer = value2.Outer;
			foreach (Transform item in val.transform)
			{
				Transform val2 = item;
				if (((Object)val2).name.StartsWith("ScanObject"))
				{
					ApplySpritesToScanObject(((Component)val2).gameObject, inner, outer);
				}
			}
		}

		private static void ApplySpritesToScanObject(GameObject scanObject, Sprite innerSprite, Sprite outerSprite)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)scanObject == (Object)null || !scanObject.activeInHierarchy)
			{
				return;
			}
			Transform obj = scanObject.transform.Find("Circle/Inner");
			Image val = ((obj != null) ? ((Component)obj).GetComponent<Image>() : null);
			Transform obj2 = scanObject.transform.Find("Circle/Outer");
			Image val2 = ((obj2 != null) ? ((Component)obj2).GetComponent<Image>() : null);
			if (!((Object)(object)val == (Object)null) && !((Object)(object)val2 == (Object)null))
			{
				if (!nodeColors.ContainsKey(((Component)val).gameObject))
				{
					nodeColors[((Component)val).gameObject] = ((Graphic)val).color;
				}
				if (!nodeColors.ContainsKey(((Component)val2).gameObject))
				{
					nodeColors[((Component)val2).gameObject] = ((Graphic)val2).color;
				}
				val.sprite = innerSprite;
				val2.sprite = outerSprite;
				((Graphic)val).color = nodeColors[((Component)val).gameObject];
				((Graphic)val2).color = nodeColors[((Component)val2).gameObject];
			}
		}

		internal static void ForceRefresh()
		{
			Tick();
		}

		internal static void ClearDestroyedObjects()
		{
			List<GameObject> list = new List<GameObject>();
			foreach (KeyValuePair<GameObject, Color> nodeColor in nodeColors)
			{
				if ((Object)(object)nodeColor.Key == (Object)null)
				{
					list.Add(nodeColor.Key);
				}
			}
			foreach (GameObject item in list)
			{
				nodeColors.Remove(item);
			}
		}
	}
}
namespace LethalHUD.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal static class GameNetworkManagerPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("NoPunctuation")]
		private static bool NoPunctuation_Prefix(string input, ref string __result)
		{
			if (string.IsNullOrEmpty(input))
			{
				__result = "Nameless";
			}
			else
			{
				__result = ChatController.NoPunctuation(input);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal static class HUDManagerPatch
	{
		[CompilerGenerated]
		private sealed class <ScanTextureRoutine>d__20 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

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

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

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

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

			private bool MoveNext()
			{
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				ScanNodeTextureManager.Tick();
				ScanNodeTextureManager.ClearDestroyedObjects();
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			}

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

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

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

			private object <>2__current;

			public HUDManager __instance;

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

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

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

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

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

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

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

		private static CallbackContext pingScan;

		private static bool _isScanToggled;

		private static Coroutine _toggleCoroutine;

		private static int lastSlotCount;

		[HarmonyPrefix]
		[HarmonyPatch("PingScan_performed")]
		private static void OnScanTriggered(ref CallbackContext context)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			pingScan = context;
			if (ModCompats.IsGoodItemScanPresent)
			{
				ScanNodeController.ResetGoodItemScanNodes();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("UseSignalTranslatorClientRpc")]
		private static void OnHUDManagerUseSignalTranslatorClientRpc(ref string signalMessage)
		{
			SignalTranslatorController.SetSignalText(signalMessage);
		}

		[HarmonyPrefix]
		[HarmonyPatch("DisableAllScanElements")]
		private static void OnHUDManagerDisabledAllScanElements()
		{
			if (ModCompats.IsGoodItemScanPresent)
			{
				ScanNodeController.ResetGoodItemScanNodes();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("SetClockVisible")]
		private static void OnHUDManagerSetClockVisible(ref bool visible)
		{
			ClockController.UpdateClockVisibility(ref visible);
			ClockController.ApplyClockAlpha();
		}

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void OnHUDManagerStart(HUDManager __instance)
		{
			ScanController.SetScanColor();
			ScanController.UpdateScanTexture();
			PlayerHPDisplay.Init();
			ScrapValueDisplay.Init();
			ClockController.ApplyClockAppearance();
			PlanetInfoDisplay.ApplyColors();
			if (ModCompats.IsBetterScanVisionPresent)
			{
				BetterScanVisionProxy.OverrideNightVisionColor();
			}
			((MonoBehaviour)__instance).StartCoroutine(ScanTextureRoutine());
		}

		[HarmonyPostfix]
		[HarmonyPatch("OnEnable")]
		private static void OnHUDManagerEnable(HUDManager __instance)
		{
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<LethalHUDMono>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<LethalHUDMono>();
			}
			if ((Object)(object)((Component)__instance).gameObject.GetComponent<StatsDisplay>() == (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<StatsDisplay>();
			}
			ChatController.ColorChatInputField(HUDManager.Instance.chatTextField, Time.time * 0.25f);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "DisplaySignalTranslatorMessage")]
		private static bool OnHUDManagerDisplaySignalTranslatorMessage(string signalMessage, int seed, SignalTranslator signalTranslator, ref IEnumerator __result)
		{
			if ((Object)(object)signalTranslator != (Object)null && !string.IsNullOrEmpty(signalMessage))
			{
				__result = SignalTranslatorController.DisplaySignalTranslatorMessage(signalMessage, seed, signalTranslator);
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("DisplayNewScrapFound")]
		private static void OnHUDManagerDisplayNewScrapFound()
		{
			InventoryFrames.SetSlotColors();
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetClock")]
		private static void OnHUDManagerSetClock(HUDManager __instance, float timeNormalized, float numberOfHours)
		{
			ClockController.TryOverrideClock(__instance, timeNormalized, numberOfHours);
		}

		[HarmonyPostfix]
		[HarmonyPatch("Update")]
		private static void OnHUDManagerUpdate(HUDManager __instance)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			ScanController.UpdateScanAlpha();
			PlayerHPDisplay.UpdateNumber();
			WeightController.UpdateWeightDisplay();
			InputAction val = IngamePlayerSettings.Instance.playerInput.actions.FindAction("PingScan", false);
			switch (Plugins.ConfigEntries.ScanModeType.Value)
			{
			case Enums.ScanMode.Default:
				StopToggleScan(__instance);
				break;
			case Enums.ScanMode.Hold:
				StopToggleScan(__instance);
				if (val.IsPressed())
				{
					__instance.PingScan_performed(pingScan);
				}
				break;
			case Enums.ScanMode.Toggle:
				if (val.WasPressedThisFrame())
				{
					if (_isScanToggled)
					{
						StopToggleScan(__instance);
					}
					else
					{
						StartToggleScan(__instance);
					}
				}
				break;
			}
			int num = __instance.itemSlotIconFrames.Length;
			if (num != lastSlotCount)
			{
				ScrapValueDisplay.RefreshSlots();
				lastSlotCount = num;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("UpdateScanNodes")]
		private static void OnHUDManagerUpdateScanNodes(HUDManager __instance)
		{
			if (Plugins.ConfigEntries.ScanNodeFade.Value)
			{
				ScanNodeController.UpdateTimers(__instance.scanElements, __instance.scanNodes);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("AddChatMessage")]
		private static void OnHUDManagerAddChatMessage(HUDManager __instance, string chatMessage, string nameOfUserWhoTyped, int playerWhoSent)
		{
			if (!string.IsNullOrEmpty(chatMessage))
			{
				string value;
				if (!string.IsNullOrEmpty(nameOfUserWhoTyped))
				{
					string coloredPlayerName = ChatController.GetColoredPlayerName(nameOfUserWhoTyped);
					string coloredChatMessage = ChatController.GetColoredChatMessage(chatMessage);
					value = coloredPlayerName + ": " + coloredChatMessage;
				}
				else
				{
					value = ChatController.GetColoredChatMessage(chatMessage);
				}
				if (__instance.ChatMessageHistory.Count > 0)
				{
					List<string> chatMessageHistory = __instance.ChatMessageHistory;
					chatMessageHistory[chatMessageHistory.Count - 1] = value;
					((TMP_Text)__instance.chatText).text = string.Join("\n", __instance.ChatMessageHistory);
				}
				__instance.PingHUDElement(__instance.Chat, Plugins.ConfigEntries.ChatFadeDelayTime.Value, 1f, 0f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("OpenMenu_performed")]
		private static void OnHUDManagerOpenMenu_performed(HUDManager __instance)
		{
			__instance.PingHUDElement(__instance.Chat, Plugins.ConfigEntries.ChatFadeDelayTime.Value, 1f, 0f);
		}

		[HarmonyPostfix]
		[HarmonyPatch("SubmitChat_performed")]
		private static void OnHUDManagerSubmitChat_performed(HUDManager __instance)
		{
			__instance.PingHUDElement(__instance.Chat, Plugins.ConfigEntries.ChatFadeDelayTime.Value, 1f, 0f);
		}

		[HarmonyPostfix]
		[HarmonyPatch("ChangeControlTipMultiple")]
		private static void AfterChangeControlTipMultiple()
		{
			ControlTipController.ApplyColor();
		}

		[HarmonyPostfix]
		[HarmonyPatch("ClearControlTips")]
		private static void AfterClearControlTips()
		{
			ControlTipController.ApplyColor();
		}

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

		private static void StartToggleScan(HUDManager __instance)
		{
			if (_toggleCoroutine == null)
			{
				_isScanToggled = true;
				_toggleCoroutine = ((MonoBehaviour)__instance).StartCoroutine(ToggleScanRoutine(__instance));
			}
		}

		private static void StopToggleScan(HUDManager __instance)
		{
			if (_toggleCoroutine != null)
			{
				((MonoBehaviour)__instance).StopCoroutine(_toggleCoroutine);
				_toggleCoroutine = null;
				_isScanToggled = false;
			}
		}

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

		private static void TryPerformScan(HUDManager __instance)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)localPlayerController == (Object)null))
			{
				FieldInfo fieldInfo = AccessTools.Field(typeof(HUDManager), "playerPingingScan");
				float num = (float)fieldInfo.GetValue(__instance);
				if (num <= -1f && __instance.CanPlayerScan())
				{
					fieldInfo.SetValue(__instance, 0.3f);
					((Component)__instance.scanEffectAnimator).transform.position = ((Component)localPlayerController.gameplayCamera).transform.position;
					__instance.scanEffectAnimator.SetTrigger("scan");
					__instance.PingHUDElement(__instance.Compass, 1f, 0.8f, 0.12f);
					__instance.UIAudio.PlayOneShot(__instance.scanSFX);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal static class PlayerControllerBPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("BeginGrabObject")]
		private static void OnPlayerControllerBBeginGrabObject()
		{
			InventoryFrames.HandsFull();
		}

		[HarmonyPrefix]
		[HarmonyPatch("NoPunctuation")]
		private static bool OnPlayerControllerBNoPunctuation(string input, ref string __result)
		{
			if (string.IsNullOrEmpty(input))
			{
				__result = "Nameless";
			}
			else
			{
				__result = ChatController.NoPunctuation(input);
			}
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("SwitchToItemSlot")]
		private static void OnPlayerControllerBSwitchToItemSlot(PlayerControllerB __instance, int slot)
		{
			if ((Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				return;
			}
			if (!Plugins.ConfigEntries.ShowItemValue.Value && ScrapValueDisplay.slotTexts != null)
			{
				ScrapValueDisplay.Hide(slot);
			}
			if (ScrapValueDisplay.slotTexts != null && slot >= 0 && slot < ScrapValueDisplay.slotTexts.Length)
			{
				if ((Object)(object)__instance.ItemSlots[slot] != (Object)null)
				{
					int scrapValue = __instance.ItemSlots[slot].scrapValue;
					ScrapValueDisplay.UpdateSlot(slot, scrapValue);
				}
				else
				{
					ScrapValueDisplay.UpdateSlot(slot, 0);
				}
				if (__instance.twoHanded)
				{
					HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.SlotFadeDelayTime.Value / 2f, Math.Clamp(Plugins.ConfigEntries.SlotFade.Value + 0.25f, 0f, 1f), Plugins.ConfigEntries.SlotFade.Value);
				}
				else
				{
					HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.SlotFadeDelayTime.Value, 1f, Plugins.ConfigEntries.SlotFade.Value);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("DespawnHeldObject")]
		private static void OnPlayerControllerBDespawnHeldObject(PlayerControllerB __instance)
		{
			ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0);
		}

		[HarmonyPostfix]
		[HarmonyPatch("DiscardHeldObject")]
		private static void OnPlayerControllerBDiscardHeldObject(PlayerControllerB __instance)
		{
			ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0);
		}

		[HarmonyPostfix]
		[HarmonyPatch("DestroyItemInSlot")]
		private static void OnPlayerControllerBDestroyItemInSlot(PlayerControllerB __instance)
		{
			ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0);
		}

		[HarmonyPostfix]
		[HarmonyPatch("DropAllHeldItems")]
		private static void OnPlayerControllerBDiscardAllHelditems(PlayerControllerB __instance)
		{
			ScrapValueDisplay.UpdateSlot(__instance.currentItemSlot, 0);
		}

		[HarmonyPostfix]
		[HarmonyPatch("DamagePlayer")]
		private static void OnPlayerControllerBDamagePlayer()
		{
			PlayerHPDisplay.ShakeOnHit();
		}

		[HarmonyPostfix]
		[HarmonyPatch("SpawnPlayerAnimation")]
		private static void OnPlayerControllerBSpawnPlayerAnimation()
		{
			ScrapValueDisplay.ClearItemSlots();
		}

		[HarmonyPostfix]
		[HarmonyPatch("LateUpdate")]
		private static void OnPlayerLateUpdate(PlayerControllerB __instance)
		{
			if (__instance.isTypingChat)
			{
				ChatController.PlayerTypingIndicator();
			}
			SprintMeterController.UpdateSprintMeterColor();
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal static class TerminalPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("BeginUsingTerminal")]
		private static void OnTerminalBeginUsingTerminal()
		{
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, Plugins.ConfigEntries.SlotFade.Value, 0f);
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.13f, 0.01f);
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Compass, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.8f, 0.01f);
		}

		[HarmonyPostfix]
		[HarmonyPatch("QuitTerminal")]
		private static void OnTerminalQuitTerminal()
		{
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Inventory, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.13f, Plugins.ConfigEntries.SlotFade.Value);
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Chat, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.13f, 0f);
			HUDManager.Instance.PingHUDElement(HUDManager.Instance.Compass, Plugins.ConfigEntries.TerminalFadeDelaysTime.Value, 0.8f, 0.12f);
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	internal static class TimeOfDayPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("MoveTimeOfDay")]
		private static void OnTimeOfDayMoveTimeOfDay()
		{
			ClockController.ApplyRealtimeClock();
		}
	}
}
namespace LethalHUD.Misc
{
	internal static class ControlTipController
	{
		private static readonly Color DefaultColorA = Color.white;

		private static readonly Color DefaultColorB = Color.white;

		private static TMP_Text[] lastTips;

		private static string[] lastTipTexts;

		private static string lastHexA;

		private static string lastHexB;

		private static Enums.MTColorMode lastMode;

		internal static void ApplyColor()
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			HUDManager instance = HUDManager.Instance;
			if (instance?.controlTipLines == null || instance.controlTipLines.Length == 0 || (instance.controlTipLines == lastTips && !HasConfigChanged() && !HasTextChanged(instance)))
			{
				return;
			}
			string value = Plugins.ConfigEntries.MTColorGradientA.Value;
			string value2 = Plugins.ConfigEntries.MTColorGradientB.Value;
			switch (Plugins.ConfigEntries.MTColorSelection.Value)
			{
			case Enums.MTColorMode.Solid:
				ApplySingleColor(instance, value, DefaultColorA);
				break;
			case Enums.MTColorMode.Gradient:
				if (HUDUtils.HasCustomGradient(value, value2))
				{
					ApplyGradient(instance, value, value2, DefaultColorA, DefaultColorB);
				}
				else
				{
					ApplySingleColor(instance, value, DefaultColorA);
				}
				break;
			}
			CacheState(instance);
		}

		private static bool HasConfigChanged()
		{
			Enums.MTColorMode value = Plugins.ConfigEntries.MTColorSelection.Value;
			string value2 = Plugins.ConfigEntries.MTColorGradientA.Value;
			string value3 = Plugins.ConfigEntries.MTColorGradientB.Value;
			return value != lastMode || value2 != lastHexA || value3 != lastHexB;
		}

		private static bool HasTextChanged(HUDManager hud)
		{
			if (lastTipTexts == null || lastTipTexts.Length != hud.controlTipLines.Length)
			{
				return true;
			}
			for (int i = 0; i < hud.controlTipLines.Length; i++)
			{
				TextMeshProUGUI val = hud.controlTipLines[i];
				if (!((Object)(object)val == (Object)null))
				{
					string text = ((TMP_Text)val).text;
					if (lastTipTexts[i] != text)
					{
						return true;
					}
				}
			}
			return false;
		}

		private static void CacheState(HUDManager hud)
		{
			TMP_Text[] controlTipLines = (TMP_Text[])(object)hud.controlTipLines;
			lastTips = controlTipLines;
			lastMode = Plugins.ConfigEntries.MTColorSelection.Value;
			lastHexA = Plugins.ConfigEntries.MTColorGradientA.Value;
			lastHexB = Plugins.ConfigEntries.MTColorGradientB.Value;
			lastTipTexts = new string[hud.controlTipLines.Length];
			for (int i = 0; i < hud.controlTipLines.Length; i++)
			{
				string[] array = lastTipTexts;
				int num = i;
				TextMeshProUGUI obj = hud.controlTipLines[i];
				array[num] = ((obj != null) ? ((TMP_Text)obj).text : null);
			}
		}

		private static void ApplySingleColor(HUDManager hud, string hex, Color fallback)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			Color color = HUDUtils.ParseHexColor(hex, fallback);
			TextMeshProUGUI[] controlTipLines = hud.controlTipLines;
			foreach (TextMeshProUGUI val in controlTipLines)
			{
				if ((Object)(object)val != (Object)null)
				{
					((Graphic)val).color = color;
				}
			}
		}

		private static void ApplyGradient(HUDManager hud, string hexA, string hexB, Color fallbackA, Color fallbackB)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b6: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			Color val = HUDUtils.ParseHexColor(hexA, fallbackA);
			Color val2 = HUDUtils.ParseHexColor(hexB, fallbackB);
			TextMeshProUGUI[] controlTipLines = hud.controlTipLines;
			foreach (TextMeshProUGUI val3 in controlTipLines)
			{
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				((TMP_Text)val3).ForceMeshUpdate(false, false);
				TMP_TextInfo textInfo = ((TMP_Text)val3).textInfo;
				int characterCount = textInfo.characterCount;
				if (characterCount == 0)
				{
					continue;
				}
				for (int j = 0; j < characterCount; j++)
				{
					TMP_CharacterInfo val4 = textInfo.characterInfo[j];
					if (val4.isVisible)
					{
						float num = ((characterCount > 1) ? ((float)j / (float)(characterCount - 1)) : 0f);
						Color val5 = Color.Lerp(val, val2, num);
						int vertexIndex = val4.vertexIndex;
						TMP_MeshInfo val6 = textInfo.meshInfo[val4.materialReferenceIndex];
						val6.colors32[vertexIndex] = Color32.op_Implicit(val5);
						val6.colors32[vertexIndex + 1] = Color32.op_Implicit(val5);
						val6.colors32[vertexIndex + 2] = Color32.op_Implicit(val5);
						val6.colors32[vertexIndex + 3] = Color32.op_Implicit(val5);
					}
				}
				for (int k = 0; k < ((TMP_Text)val3).textInfo.meshInfo.Length; k++)
				{
					((TMP_Text)val3).textInfo.meshInfo[k].mesh.colors32 = ((TMP_Text)val3).textInfo.meshInfo[k].colors32;
					((TMP_Text)val3).UpdateGeometry(((TMP_Text)val3).textInfo.meshInfo[k].mesh, k);
				}
			}
		}
	}
	public class HalloweenManager
	{
		[Serializable]
		private class StoredValues
		{
			public string ScanColor;

			public string SlotColor;

			public string GradientColorA;

			public string GradientColorB;

			public string HandsFullColor;

			public Enums.SprintStyle SprintColoring;

			public string SprintMeterColor;

			public string WeightStarterColor;

			public string ClockNumberColor;

			public string ClockBoxColor;

			public string ClockIconColor;

			public string ClockShipLeaveColor;

			public string SignalTextColor;

			public string GradientNameColorA;

			public string GradientNameColorB;

			public string ChatInputText;

			public string ChatMessageColor;

			public string GradientMessageColorA;

			public string GradientMessageColorB;

			public string LoadingTextColor;

			public string PlanetHeaderColor;

			public string PlanetSummaryColor;

			public Enums.MTColorMode MTColorMode;

			public string MTColorGradientA;

			public string MTColorGradientB;

			public string HealthColor;
		}

		private StoredValues _originalValues;

		private bool _ignoreUnifyMostColors;

		public static HalloweenManager Instance { get; } = new HalloweenManager();


		public bool IgnoreUnifyMostColors => _ignoreUnifyMostColors;

		public void ApplyHalloweenMode()
		{
			if (_originalValues == null)
			{
				_originalValues = ConfigUtils.LoadStoredValues<StoredValues>("HalloweenHUD") ?? new StoredValues
				{
					ScanColor = Plugins.ConfigEntries.ScanColor.Value,
					SlotColor = Plugins.ConfigEntries.SlotColor.Value,
					GradientColorA = Plugins.ConfigEntries.GradientColorA.Value,
					GradientColorB = Plugins.ConfigEntries.GradientColorB.Value,
					HandsFullColor = Plugins.ConfigEntries.HandsFullColor.Value,
					SprintColoring = Plugins.ConfigEntries.SprintColoring.Value,
					SprintMeterColor = Plugins.ConfigEntries.SprintMeterColor.Value,
					WeightStarterColor = Plugins.ConfigEntries.WeightStarterColor.Value,
					ClockNumberColor = Plugins.ConfigEntries.ClockNumberColor.Value,
					ClockBoxColor = Plugins.ConfigEntries.ClockBoxColor.Value,
					ClockIconColor = Plugins.ConfigEntries.ClockIconColor.Value,
					ClockShipLeaveColor = Plugins.ConfigEntries.ClockShipLeaveColor.Value,
					SignalTextColor = Plugins.ConfigEntries.SignalTextColor.Value,
					GradientNameColorA = Plugins.ConfigEntries.GradientNameColorA.Value,
					GradientNameColorB = Plugins.ConfigEntries.GradientNameColorB.Value,
					ChatInputText = Plugins.ConfigEntries.ChatInputText.Value,
					ChatMessageColor = Plugins.ConfigEntries.ChatMessageColor.Value,
					GradientMessageColorA = Plugins.ConfigEntries.GradientMessageColorA.Value,
					GradientMessageColorB = Plugins.ConfigEntries.GradientMessageColorB.Value,
					LoadingTextColor = Plugins.ConfigEntries.LoadingTextColor.Value,
					PlanetHeaderColor = Plugins.ConfigEntries.PlanetHeaderColor.Value,
					PlanetSummaryColor = Plugins.ConfigEntries.PlanetSummaryColor.Value,
					MTColorMode = Plugins.ConfigEntries.MTColorSelection.Value,
					MTColorGradientA = Plugins.ConfigEntries.MTColorGradientA.Value,
					MTColorGradientB = Plugins.ConfigEntries.MTColorGradientB.Value,
					HealthColor = Plugins.ConfigEntries.HealthColor.Value
				};
				ConfigUtils.SaveStoredValues(_originalValues, "HalloweenHUD");
			}
			_ignoreUnifyMostColors = true;
			Plugins.ConfigEntries.ScanColor.Value = "#6611BB";
			Plugins.ConfigEntries.SlotColor.Value = "#FF8800";
			Plugins.ConfigEntries.GradientColorA.Value = "#CC4400";
			Plugins.ConfigEntries.GradientColorB.Value = "#AA55EE";
			Plugins.ConfigEntries.HandsFullColor.Value = "#FF0000";
			Plugins.ConfigEntries.SprintColoring.Value = Enums.SprintStyle.Gradient;
			Plugins.ConfigEntries.SprintMeterColor.Value = "#AA55EE";
			Plugins.ConfigEntries.WeightStarterColor.Value = "#FF8800";
			Plugins.ConfigEntries.ClockNumberColor.Value = "#AA55EE";
			Plugins.ConfigEntries.ClockBoxColor.Value = "#6611BB";
			Plugins.ConfigEntries.ClockIconColor.Value = "#FF8800";
			Plugins.ConfigEntries.ClockShipLeaveColor.Value = "#FF8800";
			Plugins.ConfigEntries.SignalTextColor.Value = "#AA55EE";
			Plugins.ConfigEntries.GradientNameColorA.Value = "#AA55EE";
			Plugins.ConfigEntries.GradientNameColorB.Value = "#FF8800";
			Plugins.ConfigEntries.ChatInputText.Value = "#6611BB";
			Plugins.ConfigEntries.ChatMessageColor.Value = "#AA55EE";
			Plugins.ConfigEntries.GradientMessageColorA.Value = "#FF8800";
			Plugins.ConfigEntries.GradientMessageColorB.Value = "#AA55EE";
			Plugins.ConfigEntries.LoadingTextColor.Value = "#FF8800";
			Plugins.ConfigEntries.PlanetHeaderColor.Value = "#AA55EE";
			Plugins.ConfigEntries.PlanetSummaryColor.Value = "#FF8800";
			Plugins.ConfigEntries.MTColorSelection.Value = Enums.MTColorMode.Gradient;
			Plugins.ConfigEntries.MTColorGradientA.Value = "#AA55EE";
			Plugins.ConfigEntries.MTColorGradientB.Value = "#FF8800";
			Plugins.ConfigEntries.HealthColor.Value = "#AA55EE";
			RefreshUI();
			_ignoreUnifyMostColors = false;
		}

		public void RestoreOriginalValues()
		{
			if (_originalValues != null)
			{
				_ignoreUnifyMostColors = true;
				Plugins.ConfigEntries.ScanColor.Value = _originalValues.ScanColor;
				Plugins.ConfigEntries.SlotColor.Value = _originalValues.SlotColor;
				Plugins.ConfigEntries.GradientColorA.Value = _originalValues.GradientColorA;
				Plugins.ConfigEntries.GradientColorB.Value = _originalValues.GradientColorB;
				Plugins.ConfigEntries.HandsFullColor.Value = _originalValues.HandsFullColor;
				Plugins.ConfigEntries.SprintColoring.Value = _originalValues.SprintColoring;
				Plugins.ConfigEntries.SprintMeterColor.Value = _originalValues.SprintMeterColor;
				Plugins.ConfigEntries.WeightStarterColor.Value = _originalValues.WeightStarterColor;
				Plugins.ConfigEntries.ClockNumberColor.Value = _originalValues.ClockNumberColor;
				Plugins.ConfigEntries.ClockBoxColor.Value = _originalValues.ClockBoxColor;
				Plugins.ConfigEntries.ClockIconColor.Value = _originalValues.ClockIconColor;
				Plugins.ConfigEntries.ClockShipLeaveColor.Value = _originalValues.ClockShipLeaveColor;
				Plugins.ConfigEntries.SignalTextColor.Value = _originalValues.SignalTextColor;
				Plugins.ConfigEntries.GradientNameColorA.Value = _originalValues.GradientNameColorA;
				Plugins.ConfigEntries.GradientNameColorB.Value = _originalValues.GradientNameColorB;
				Plugins.ConfigEntries.ChatInputText.Value = _originalValues.ChatInputText;
				Plugins.ConfigEntries.ChatMessageColor.Value = _originalValues.ChatMessageColor;
				Plugins.ConfigEntries.GradientMessageColorA.Value = _originalValues.GradientMessageColorA;
				Plugins.ConfigEntries.GradientMessageColorB.Value = _originalValues.GradientMessageColorB;
				Plugins.ConfigEntries.LoadingTextColor.Value = _originalValues.LoadingTextColor;
				Plugins.ConfigEntries.PlanetHeaderColor.Value = _originalValues.PlanetHeaderColor;
				Plugins.ConfigEntries.PlanetSummaryColor.Value = _originalValues.PlanetSummaryColor;
				Plugins.ConfigEntries.MTColorSelection.Value = _originalValues.MTColorMode;
				Plugins.ConfigEntries.MTColorGradientA.Value = _originalValues.MTColorGradientA;
				Plugins.ConfigEntries.MTColorGradientB.Value = _originalValues.MTColorGradientB;
				Plugins.ConfigEntries.HealthColor.Value = _originalValues.HealthColor;
				RefreshUI();
				_ignoreUnifyMostColors = false;
			}
		}

		public void RestoreOnLoad()
		{
			StoredValues storedValues = ConfigUtils.LoadStoredValues<StoredValues>("HalloweenHUD");
			if (storedValues != null)
			{
				_originalValues = storedValues;
			}
			if (Plugins.ConfigEntries.HalloweenMode.Value)
			{
				ApplyHalloweenMode();
			}
			else if (_originalValues != null)
			{
				RestoreOriginalValues();
			}
		}

		private void RefreshUI()
		{
			InventoryFrames.SetSlotColors();
			ChatController.ApplyLocalPlayerColor(Plugins.ConfigEntries.GradientNameColorA.Value, Plugins.ConfigEntries.GradientNameColorB.Value);
			ClockController.ApplyClockAppearance();
			SprintMeterController.UpdateSprintMeterColor();
			WeightController.UpdateWeightDisplay();
		}
	}
	public class StatsDisplay : NetworkBehaviour
	{
		private float deltaTime;

		private ulong currentPing = 0uL;

		private float pingTimer = 0f;

		private readonly float pingInterval = 0.5f;

		private TextMeshProUGUI statsText;

		private UnityTransport transport;

		private string lastText = "";

		private Enums.MTColorMode lastMode;

		private string lastHexA = "";

		private string lastHexB = "";

		private bool lastSplit;

		private string lastSeparateHex = "";

		private void Start()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			ref UnityTransport reference = ref transport;
			NetworkTransport networkTransport = NetworkManager.Singleton.NetworkConfig.NetworkTransport;
			reference = (UnityTransport)(object)((networkTransport is UnityTransport) ? networkTransport : null);
			GameObject val = new GameObject("StatsDisplay");
			GameObject val2 = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/");
			val.transform.SetParent(val2.transform, false);
			statsText = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)statsText).font = ((TMP_Text)HUDManager.Instance.chatText).font;
			((TMP_Text)statsText).fontSize = 12f;
			((TMP_Text)statsText).richText = true;
			((TMP_Text)statsText).alignment = (TextAlignmentOptions)257;
			Material val3 = Object.Instantiate<Material>(((TMP_Text)statsText).fontMaterial);
			val3.EnableKeyword("UNDERLAY_ON");
			val3.SetColor("_UnderlayColor", Color.black);
			val3.SetFloat("_UnderlayOffsetX", 1.2f);
			val3.SetFloat("_UnderlayOffsetY", -1.2f);
			val3.SetFloat("_UnderlaySoftness", 0.35f);
			((TMP_Text)statsText).fontMaterial = val3;
			RectTransform rectTransform = ((TMP_Text)statsText).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(0f, 1f);
			rectTransform.pivot = new Vector2(0f, 1f);
			rectTransform.anchoredPosition = new Vector2(Plugins.ConfigEntries.FPSCounterX.Value, 0f - Plugins.ConfigEntries.FPSCounterY.Value);
		}

		private void Update()
		{
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f;
			if (((NetworkBehaviour)this).IsHost && (Object)(object)transport != (Object)null)
			{
				pingTimer += Time.deltaTime;
				if (pingTimer >= pingInterval)
				{
					pingTimer = 0f;
					foreach (NetworkClient connectedClients in NetworkManager.Singleton.ConnectedClientsList)
					{
						ulong currentRtt = ((NetworkTransport)transport).GetCurrentRtt(connectedClients.ClientId);
						SendPingClientRpc(connectedClients.ClientId, currentRtt);
					}
				}
			}
			if (Plugins.ConfigEntries.ShowFPSDisplay.Value || Plugins.ConfigEntries.ShowPingDisplay.Value || Plugins.ConfigEntries.ShowSeedDisplay.Value)
			{
				List<string> list = new List<string>();
				if (Plugins.ConfigEntries.ShowFPSDisplay.Value)
				{
					int num = Mathf.RoundToInt(1f / deltaTime);
					list.Add($"FPS: {num}");
				}
				if (Plugins.ConfigEntries.ShowPingDisplay.Value)
				{
					list.Add($"Ping: {currentPing} ms");
				}
				if (Plugins.ConfigEntries.ShowSeedDisplay.Value && (Object)(object)StartOfRound.Instance != (Object)null && !StartOfRound.Instance.inShipPhase)
				{
					list.Add($"Seed: {StartOfRound.Instance.randomMapSeed}");
				}
				string separator = ((Plugins.ConfigEntries.MiscLayoutEnum.Value == Enums.FPSPingLayout.Vertical) ? "\n─────────\n" : " | ");
				string text = string.Join(separator, list);
				bool value = Plugins.ConfigEntries.SplitAdditionalMTFromToolTips.Value;
				string value2 = Plugins.ConfigEntries.SeperateAdditionalMiscToolsColors.Value;
				if (text != lastText || Plugins.ConfigEntries.MTColorSelection.Value != lastMode || Plugins.ConfigEntries.MTColorGradientA.Value != lastHexA || Plugins.ConfigEntries.MTColorGradientB.Value != lastHexB || value != lastSplit || value2 != lastSeparateHex)
				{
					((TMP_Text)statsText).text = text;
					((TMP_Text)statsText).alignment = (TextAlignmentOptions)257;
					((TMP_Text)statsText).rectTransform.anchoredPosition = new Vector2(Plugins.ConfigEntries.FPSCounterX.Value, 0f - Plugins.ConfigEntries.FPSCounterY.Value);
					((TMP_Text)statsText).enableWordWrapping = false;
					ApplyTextColor(statsText);
					lastText = text;
					lastMode = Plugins.ConfigEntries.MTColorSelection.Value;
					lastHexA = Plugins.ConfigEntries.MTColorGradientA.Value;
					lastHexB = Plugins.ConfigEntries.MTColorGradientB.Value;
					lastSplit = value;
					lastSeparateHex = value2;
				}
			}
			else
			{
				((TMP_Text)statsText).text = "";
				lastText = "";
			}
		}

		private void ApplyTextColor(TextMeshProUGUI tmp)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: 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_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: 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_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			bool value = Plugins.ConfigEntries.SplitAdditionalMTFromToolTips.Value;
			string text = (value ? Plugins.ConfigEntries.SeperateAdditionalMiscToolsColors.Value : Plugins.ConfigEntries.MTColorGradientA.Value);
			string text2 = (value ? Plugins.ConfigEntries.SeperateAdditionalMiscToolsColors.Value : Plugins.ConfigEntries.MTColorGradientB.Value);
			switch (Plugins.ConfigEntries.MTColorSelection.Value)
			{
			case Enums.MTColorMode.Solid:
				((Graphic)tmp).color = HUDUtils.ParseHexColor(text, Color.white);
				break;
			case Enums.MTColorMode.Gradient:
				if (HUDUtils.HasCustomGradient(text, text2) && !value)
				{
					((TMP_Text)tmp).ForceMeshUpdate(false, false);
					TMP_TextInfo textInfo = ((TMP_Text)tmp).textInfo;
					int characterCount = textInfo.characterCount;
					if (characterCount == 0)
					{
						break;
					}
					Color val = HUDUtils.ParseHexColor(text, Color.white);
					Color val2 = HUDUtils.ParseHexColor(text2, Color.white);
					for (int i = 0; i < characterCount; i++)
					{
						TMP_CharacterInfo val3 = textInfo.characterInfo[i];
						if (val3.isVisible)
						{
							float num = ((characterCount > 1) ? ((float)i / (float)(characterCount - 1)) : 0f);
							Color val4 = Color.Lerp(val, val2, num);
							int vertexIndex = val3.vertexIndex;
							TMP_MeshInfo val5 = textInfo.meshInfo[val3.materialReferenceIndex];
							val5.colors32[vertexIndex] = Color32.op_Implicit(val4);
							val5.colors32[vertexIndex + 1] = Color32.op_Implicit(val4);
							val5.colors32[vertexIndex + 2] = Color32.op_Implicit(val4);
							val5.colors32[vertexIndex + 3] = Color32.op_Implicit(val4);
						}
					}
					for (int j = 0; j < ((TMP_Text)tmp).textInfo.meshInfo.Length; j++)
					{
						((TMP_Text)tmp).textInfo.meshInfo[j].mesh.colors32 = ((TMP_Text)tmp).textInfo.meshInfo[j].colors32;
						((TMP_Text)tmp).UpdateGeometry(((TMP_Text)tmp).textInfo.meshInfo[j].mesh, j);
					}
				}
				else
				{
					((Graphic)tmp).color = HUDUtils.ParseHexColor(text, Color.white);
				}
				break;
			}
		}

		[ClientRpc]
		private void SendPingClientRpc(ulong targetClientId, ulong ping)
		{
			if (NetworkManager.Singleton.LocalClientId == targetClientId)
			{
				currentPing = ping;
			}
		}
	}
}
namespace LethalHUD.HUD
{
	internal static class ChatController
	{
		private static readonly Dictionary<string, string> localPlayerColors = new Dictionary<string, string>();

		internal static bool ColoringEnabled => Plugins.ConfigEntries.ColoredNames.Value;

		internal static string NoPunctuation(string input)
		{
			return new string(new ReadOnlySpan<char>(input.Where((char c) => char.IsLetterOrDigit(c) || c == '_' || c == '.').ToArray()));
		}

		internal static void ApplyLocalPlayerColor(string colorA, string colorB = null)
		{
			if (!string.IsNullOrEmpty(colorA) && !string.IsNullOrEmpty(colorB))
			{
				localPlayerColors["LocalPlayer"] = colorA;
				localPlayerColors["LocalPlayer_B"] = colorB;
			}
		}

		internal static string GetColoredPlayerName(string playerName)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			if (!ColoringEnabled || string.IsNullOrEmpty(playerName))
			{
				return "<color=#FF0000>" + playerName + "</color>";
			}
			if (localPlayerColors.TryGetValue("LocalPlayer", out var value) && localPlayerColors.TryGetValue("LocalPlayer_B", out var value2))
			{
				Color startColor = default(Color);
				ColorUtility.TryParseHtmlString(value, ref startColor);
				Color endColor = default(Color);
				ColorUtility.TryParseHtmlString(value2, ref endColor);
				return HUDUtils.ApplyStaticGradient(playerName, startColor, endColor);
			}
			Color startColor2 = default(Color);
			ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientNameColorA.Value, ref startColor2);
			Color endColor2 = default(Color);
			ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientNameColorB.Value, ref endColor2);
			return HUDUtils.ApplyStaticGradient(playerName, startColor2, endColor2);
		}

		internal static string GetColoredChatMessage(string message)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(message))
			{
				return null;
			}
			message = message.Trim();
			Color startColor = default(Color);
			Color endColor = default(Color);
			if (HUDUtils.HasCustomGradient(Plugins.ConfigEntries.GradientMessageColorA.Value, Plugins.ConfigEntries.GradientMessageColorB.Value) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientMessageColorA.Value, ref startColor) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientMessageColorB.Value, ref endColor))
			{
				return HUDUtils.ApplyStaticGradient(message, startColor, endColor);
			}
			return "<color=" + Plugins.ConfigEntries.ChatMessageColor.Value + ">" + message + "</color>";
		}

		internal static void PlayerTypingIndicator()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI typingIndicator = HUDManager.Instance.typingIndicator;
			((TMP_Text)typingIndicator).enableVertexGradient = true;
			((Graphic)typingIndicator).color = Color.white;
			if ((Object)(object)typingIndicator == (Object)null)
			{
				return;
			}
			Color startColor = default(Color);
			Color endColor = default(Color);
			if (HUDUtils.HasCustomGradient(Plugins.ConfigEntries.GradientColorA.Value, Plugins.ConfigEntries.GradientColorB.Value) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorA.Value, ref startColor) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorB.Value, ref endColor))
			{
				HUDUtils.ApplyVertexGradient(typingIndicator, startColor, endColor, Time.time * 0.2f);
				return;
			}
			switch (InventoryFrames.CurrentSlotColorMode)
			{
			case Enums.SlotEnums.Rainbow:
				HUDUtils.ApplyRainbowGradient(typingIndicator, Time.time * 0.25f);
				break;
			case Enums.SlotEnums.None:
				((TMP_Text)typingIndicator).colorGradient = new VertexGradient(ConfigHelper.GetSlotColor());
				break;
			default:
				HUDUtils.ApplyVertexGradient(typingIndicator, InventoryFrames.CurrentGradientStartColor, InventoryFrames.CurrentGradientEndColor, Time.time * 0.25f);
				break;
			}
		}

		internal static void ColorChatInputField(TMP_InputField inputField, float time)
		{
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			Color val3;
			if (HUDUtils.HasCustomGradient(Plugins.ConfigEntries.GradientColorA.Value, Plugins.ConfigEntries.GradientColorB.Value))
			{
				Color val = default(Color);
				Color val2 = default(Color);
				if (ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorA.Value, ref val) && ColorUtility.TryParseHtmlString(Plugins.ConfigEntries.GradientColorB.Value, ref val2))
				{
					float num = Mathf.SmoothStep(0f, 1f, Mathf.Sin(time * MathF.PI * 2f) * 0.5f + 0.5f);
					val3 = Color.Lerp(val, val2, num);
				}
				else
				{
					val3 = ConfigHelper.GetSlotColor();
				}
			}
			else
			{
				switch (InventoryFrames.CurrentSlotColorMode)
				{
				case Enums.SlotEnums.Rainbow:
				{
					float num3 = 0.5f;
					float num4 = time * num3 % 1f;
					val3 = Color.HSVToRGB(num4, 1f, 1f);
					break;
				}
				case Enums.SlotEnums.None:
					val3 = ConfigHelper.GetSlotColor();
					break;
				default:
				{
					float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Sin(time * MathF.PI * 2f) * 0.5f + 0.5f);
					val3 = Color.Lerp(InventoryFrames.CurrentGradientStartColor, InventoryFrames.CurrentGradientEndColor, num2);
					break;
				}
				}
			}
			inputField.caretColor = val3;
			if ((Object)(object)inputField.textComponent != (Object)null)
			{
				Enums.SlotEnums currentSlotColorMode = InventoryFrames.CurrentSlotColorMode;
				if (1 == 0)
				{
				}
				Color val4 = (Color)(currentSlotColorMode switch
				{
					Enums.SlotEnums.Rainbow => new Color(1f - val3.r, 1f - val3.g, 1f - val3.b, val3.a), 
					Enums.SlotEnums.None => HUDUtils.ParseHexColor(Plugins.ConfigEntries.ChatInputText.Value), 
					_ => new Color(1f - val3.r, 1f - val3.g, 1f - val3.b, val3.a), 
				});
				if (1 == 0)
				{
				}
				Color color = val4;
				((Graphic)inputField.textComponent).color = color;
			}
			Graphic placeholder = inputField.placeholder;
			TMP_Text val5 = (TMP_Text)(object)((placeholder is TMP_Text) ? placeholder : null);
			if (val5 != null)
			{
				((Graphic)val5).color = val3;
			}
		}
	}
	internal static class ClockController
	{
		private static bool skipAlphaCheck;

		private static readonly HashSet<SelectableLevel> DisabledClockLevels = new HashSet<SelectableLevel>();

		private static TextMeshProUGUI clockNumber;

		private static Image clockIcon;

		private static Transform clockParent;

		private static Image boxImage;

		private static bool _defaultsCached;

		private static Vector3 defaultClockPos;

		private static Vector3 defaultIconPos;

		private static Vector2 defaultParentSize;

		private static Vector2 defaultIconSize;

		private static bool defaultWordWrap;

		internal static void CacheDefaultLayout()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clockParent == (Object)null) && !((Object)(object)clockNumber == (Object)null) && !((Object)(object)clockIcon == (Object)null))
			{
				RectTransform component = ((Component)clockParent).GetComponent<RectTransform>();
				RectTransform component2 = ((Component)clockIcon).GetComponent<RectTransform>();
				defaultParentSize = component.sizeDelta;
				defaultIconSize = component2.sizeDelta;
				defaultClockPos = ((TMP_Text)clockNumber).transform.localPosition;
				defaultIconPos = ((Component)clockIcon).transform.localPosition;
				defaultWordWrap = ((TMP_Text)clockNumber).enableWordWrapping;
			}
		}

		internal static void ApplyClockAppearance()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)HUDManager.Instance == (Object)null))
			{
				clockNumber = HUDManager.Instance.clockNumber;
				clockIcon = HUDManager.Instance.clockIcon;
				clockParent = ((TMP_Text)clockNumber).transform.parent;
				boxImage = ((Component)clockParent).GetComponent<Image>();
				if ((Object)(object)clockNumber != (Object)null)
				{
					((Graphic)clockNumber).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockNumberColor.Value, Color.white);
				}
				if ((Object)(object)boxImage != (Object)null)
				{
					((Graphic)boxImage).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockBoxColor.Value, Color.white);
				}
				if ((Object)(object)clockIcon != (Object)null)
				{
					((Graphic)clockIcon).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockIconColor.Value, new Color(1f, 0.31f, 0f));
				}
				if ((Object)(object)HUDManager.Instance.shipLeavingEarlyIcon != (Object)null)
				{
					((Graphic)HUDManager.Instance.shipLeavingEarlyIcon).color = HUDUtils.ParseHexColor(Plugins.ConfigEntries.ClockShipLeaveColor.Value, Color.white);
				}
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(-0.5893304f, 0.5893304f, 0.5893303f);
				clockParent.localScale = val * Plugins.ConfigEntries.ClockSizeMultiplier.Value;
				if (!_defaultsCached)
				{
					CacheDefaultLayout();
					_defaultsCached = true;
				}
				if (Plugins.ConfigEntries.ClockFormat.Value == Enums.ClockStyle.Compact)
				{
					ApplyCompactLayout();
				}
				else
				{
					ApplyRegularLayout();
				}
			}
		}

		internal static void TryOverrideClock(HUDManager hud, float timeNormalized, float numberOfHours)
		{
			if ((Object)(object)hud == (Object)null || (Object)(object)hud.clockNumber == (Object)null)
			{
				return;
			}
			int num = (int)(timeNormalized * (60f * numberOfHours)) + 360;
			int num2 = num / 60;
			int num3 = num % 60;
			string text;
			if (Plugins.ConfigEntries.NormalHumanBeingClock.Value)
			{
				text = $"{num2 % 24:00}:{num3:00}";
			}
			else
			{
				int num4 = num2 % 12;
				if (num4 == 0)
				{
					num4 = 12;
				}
				string text2 = ((Plugins.ConfigEntries.ClockFormat.Value == Enums.ClockStyle.Compact) ? " " : "\n");
				string text3 = ((num2 >= 12) ? "PM" : "AM");
				text = $"{num4:00}:{num3:00}{text2}{text3}";
			}
			((TMP_Text)hud.clockNumber).text = text;
		}

		internal static void ApplyCompactLayout()
		{
			//IL_003f: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clockParent == (Object)null) && !((Object)(object)clockNumber == (Object)null) && !((Object)(object)clockIcon == (Object)null))
			{
				RectTransform component = ((Component)clockParent).GetComponent<RectTransform>();
				component.sizeDelta = new Vector2(component.sizeDelta.x, 50f);
				((TMP_Text)clockNumber).enableWordWrapping = false;
				RectTransform component2 = ((Component)clockIcon).GetComponent<RectTransform>();
				component2.sizeDelta = defaultIconSize * 0.6f;
				((TMP_Text)clockNumber).transform.localPosition = defaultClockPos + new Vector3(10f, -1f, 0f);
				((Component)clockIcon).transform.localPosition = defaultIconPos + new Vector3(-25f, -2f, 0f);
			}
		}

		internal static void ApplyRegularLayout()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clockParent == (Object)null) && !((Object)(object)clockNumber == (Object)null) && !((Object)(object)clockIcon == (Object)null))
			{
				RectTransform component = ((Component)clockParent).GetComponent<RectTransform>();
				RectTransform component2 = ((Component)clockIcon).GetComponent<RectTransform>();
				component.sizeDelta = defaultParentSize;
				component2.sizeDelta = defaultIconSize;
				((TMP_Text)clockNumber).transform.localPosition = defaultClockPos;
				((Component)clockIcon).transform.localPosition = defaultIconPos;
				((TMP_Text)clockNumber).enableWordWrapping = defaultWordWrap;
			}
		}

		internal static void UpdateClockVisibility(ref bool visible)
		{
			if (visible)
			{
				skipAlphaCheck = true;
				return;
			}
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				return;
			}
			if (localPlayerController.inTerminalMenu)
			{
				visible = false;
				return;
			}
			if (!Plugins.ConfigEntries.ShowClockInShip.Value && localPlayerController.isInHangarShipRoom)
			{
				visible = false;
				return;
			}
			if (!Plugins.ConfigEntries.ShowClockInFacility.Value && localPlayerController.isInsideFactory)
			{
				visible = false;
				return;
			}
			SelectableLevel currentLevel = StartOfRound.Instance.currentLevel;
			if (DisabledClockLevels.Contains(currentLevel))
			{
				visible = false;
			}
			else
			{
				visible = true;
			}
		}

		internal static void ApplyClockAlpha()
		{
			if (!((Object)(object)HUDManager.Instance == (Object)null))
			{
				CanvasGroup val = ((Component)clockParent).GetComponent<CanvasGroup>() ?? ((Component)clockParent).gameObject.AddComponent<CanvasGroup>();
				float targetAlpha = GetTargetAlpha();
				val.alpha = targetAlpha;
			}
		}

		private static float GetTargetAlpha()
		{
			if (skipAlphaCheck)
			{
				skipAlphaCheck = false;
				return 1f;
			}
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if ((Object)(object)localPlayerController == (Object)null)
			{
				return 1f;
			}
			if (localPlayerController.isInsideFactory)
			{
				return Plugins.ConfigEntries.ClockVisibilityInFacility.Value;
			}
			if (localPlayerController.isInHangarShipRoom)
			{
				return Plugins.ConfigEntries.ClockVisibilityInShip.Value;
			}
			return 1f;
		}

		internal static void ApplyRealtimeClock()
		{
			if (Plugins.ConfigEntries.RealtimeClock.Value && (Object)(object)TimeOfDay.Instance != (Object)null)
			{
				TimeOfDay.Instance.changeHUDTimeInterval = 4f;
			}
		}
	}
	internal static class CompassController
	{
		internal static RawImage CompassImage => HUDManager.Instance?.compassImage;

		internal static void SetCompassColor(Color? overrideColor = null)
		{
			//IL_0046: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)CompassImage == (Object)null))
			{
				PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
				if (!((Object)(object)val == (Object)null))
				{
					Color color = (Color)(((??)overrideColor) ?? ConfigHelper.GetSlotColor());
					color.a = (val.isPlayerDead ? 0f : Plugins.ConfigEntries.CompassAlpha.Value);
					((Graphic)CompassImage).color = color;
				}
			}
		}

		internal static void SetCompassWavyGradient()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
			if (!((Object)(object)val == (Object)null) && !val.isPlayerDead)
			{
				HUDUtils.ApplyCompassWavyGradient(InventoryFrames.CurrentGradientStartColor, InventoryFrames.CurrentGradientEndColor);
			}
		}

		internal static void SoftMaskStuff()
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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)
			if ((Object)(object)CompassImage == (Object)null)
			{
				return;
			}
			PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			SoftMask componentInParent = ((Component)CompassImage).GetComponentInParent<SoftMask>();
			if (!((Object)(object)componentInParent == (Object)null))
			{
				bool value = Plugins.ConfigEntries.CompassInvertMask.Value;
				bool value2 = Plugins.ConfigEntries.CompassInvertOutsides.Value;
				float value3 = Plugins.ConfigEntries.CompassAlpha.Value;
				if (val.isPlayerDead)
				{
					componentInParent.invertMask = false;
					componentInParent.invertOutsides = false;
					Vector4 val2 = Color.op_Implicit(componentInParent.channelWeights);
					val2.w = 0f;
					componentInParent.channelWeights = Color.op_Implicit(val2);
				}
				else
				{
					componentInParent.invertMask = value;
					componentInParent.invertOutsides = value2;
					Vector4 val3 = Color.op_Implicit(componentInParent.channelWeights);
					val3.w = value3;
					componentInParent.channelWeights = Color.op_Implicit(val3);
				}
			}
		}
	}
	internal static class HUDUtils
	{
		private static float _rainbowTime;

		private static float _gradientWaveTime;

		private static float _loadingOffset;

		private static RawImage CompassImage => CompassController.CompassImage;

		internal static Color ParseHexColor(string hex)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			Color val = default(Color);
			if (ColorUtility.TryParseHtmlString(hex, ref val))
			{
				return new Color(val.r, val.g, val.b);
			}
			Loggers.Warning("Invalid HEX color: " + hex + ". Defaulting to original blue.");
			return new Color(0f, 0.047f, 1f);
		}

		internal static Color ParseHexColor(string hex, Color fallback)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (string.IsNullOrWhiteSpace(hex))
			{
				return fallback;
			}
			Color result = default(Color);
			if (ColorUtility.TryParseHtmlString(hex, ref result))
			{
				return result;
			}
			Loggers.Warning("Invalid HEX color: " + hex + ". Defaulting to original blue.");
			return fallback;
		}

		internal static bool HasCustomGradient(string a, string b)
		{
			return !string.IsNullOrWhiteSpace(a) && !string.IsNullOrWhiteSpace(b) && !string.Equals(a, b, StringComparison.OrdinalIgnoreCase);
		}

		internal static void RecolorTexture(ref Texture2D texture, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			float num = color.r + color.g + color.b;
			List<Color> list = texture.GetPixels().ToList();
			Loggers.Debug("ScanTexture pixel count: " + list.Count);
			for (int num2 = list.Count - 1; num2 >= 0; num2--)
			{
				float num3 = list[num2].r + list[num2].g + list[num2].b;
				if (!(num3 < 0.05f) && !(list[num2].a < 0.05f))
				{
					float num4 = ((num == 0f) ? 0f : (num3 / num));
					list[num2] = new Color(color.r * num4, color.g * num4, color.b * num4);
				}
			}
			texture.SetPixels(list.ToArray());
		}

		internal static string ApplyStaticGradient(string input, Color startColor, Color endColor, float minBrightness = 0.15f)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			int length = input.Length;
			for (int i = 0; i < length; i++)
			{
				float num = (float)i / (float)Mathf.Max(1, length - 1);
				Color val = Color.Lerp(startColor, endColor, num);
				float num2 = 0.299f * val.r + 0.587f * val.g + 0.114f * val.b;
				if (num2 < minBrightness)
				{
					float num3 = Mathf.Clamp01((minBrightness - num2) * 0.5f);
					val = Color.Lerp(val, Color.white, num3);
				}
				string arg = ColorUtility.ToHtmlStringRGB(val);
				text += $"<color=#{arg}>{input[i]}</color>";
			}
			return text;
		}

		internal static void ApplyVertexGradient(TextMeshProUGUI tmpText, Color startColor, Color endColor, float time, float waveFrequency = 1.5f)
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tmpText == (Object)null))
			{
				float num = Mathf.SmoothStep(0f, 1f, Mathf.Sin((time + 0f) * waveFrequency * MathF.PI * 2f) * 0.5f + 0.5f);
				float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Sin((time + 1f) * waveFrequency * MathF.PI * 2f) * 0.5f + 0.5f);
				Color val = Color.Lerp(startColor, endColor, num);
				Color val2 = Color.Lerp(startColor, endColor, num2);
				VertexGradient colorGradient = default(VertexGradient);
				((VertexGradient)(ref colorGradient))..ctor(val, val, val2, val2);
				((TMP_Text)tmpText).colorGradient = colorGradient;
				((TMP_Text)tmpText).ForceMeshUpdate(false, false);
			}
		}

		internal static void ApplyRainbowGradient(TextMeshProUGUI tmpText, float time)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tmpText == (Object)null))
			{
				float num = 0.5f;
				float num2 = time * num % 1f;
				Color val = Color.HSVToRGB((num2 + 0f) % 1f, 1f, 1f);
				Color val2 = Color.HSVToRGB((num2 + 0.33f) % 1f, 1f, 1f);
				Color val3 = Color.HSVToRGB((num2 + 0.66f) % 1f, 1f, 1f);
				Color val4 = Color.HSVToRGB((num2 + 0.99f) % 1f, 1f, 1f);
				((TMP_Text)tmpText).colorGradient = new VertexGradient(val, val2, val3, val4);
				((TMP_Text)tmpText).ForceMeshUpdate(false, false);
			}
		}

		internal static void ApplyCompassRainbow()
		{
			//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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)CompassImage == (Object)null))
			{
				_rainbowTime += Time.deltaTime * 0.15f;
				float num = _rainbowTime % 1f;
				Color color = Color.HSVToRGB(num, 1f, 1f);
				color.a = ((Graphic)CompassImage).color.a;
				((Graphic)CompassImage).color = color;
			}
		}

		internal static void ApplyCompassWavyGradient(Color startColor, Color endColor)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)CompassImage == (Object)null))
			{
				_gradientWaveTime += Time.deltaTime * 0.15f;
				float num = Mathf.SmoothStep(0f, 1f, Mathf.Sin(_gradientWaveTime * MathF.PI * 2f) * 0.5f + 0.5f);
				Color val = Color.Lerp(startColor, endColor, num);
				Color gamma = ((Color)(ref val)).gamma;
				gamma.a = ((Graphic)CompassImage).color.a;
				((Graphic)CompassImage).color = gamma;
			}
		}

		internal static void ApplyRainbow(Image[] frames)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			int num = frames.Length;
			float num2 = Time.time * 0.15f;
			for (int i = 0; i < num; i++)
			{
				float num3 = (num2 + (float)i / (float)num) % 1f;
				Color color = Color.HSVToRGB(num3, 1f, 1f);
				if ((Object)(object)frames[i] != (Object)null)
				{
					((Graphic)frames[i]).color = color;
				}
			}
		}

		internal static void ApplyWavyGradient(Image[] frames, Color startColor, Color endColor, float speed = 0.15f, float waveFrequency = 2f)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0083: 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)
			if (frames != null && frames.Length != 0)
			{
				_gradientWaveTime = (_gradientWaveTime + Time.deltaTime * speed) % 1f;
				int num = frames.Length;
				for (int i = 0; i < num; i++)
				{
					float num2 = (float)i / (float)(num - 1);
					float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Sin((_gradientWaveTime + num2 * waveFrequency) * MathF.PI * 2f) * 0.5f + 0.5f);
					Color val = Color.Lerp(startColor, endColor, num3);
					Color gamma = ((Color)(ref val)).gamma;
					((Graphic)frames[i]).color = gamma;
				}
			}
		}

		internal static Color GetGradientColor(Color baseColor, float fillAmount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			Color.RGBToHSV(baseColor, ref num, ref num2, ref num3);
			float num4 = Mathf.Lerp(0f, 1f / 3f, 1f - fillAmount);
			float num5 = (num + num4) % 2f;
			return Color.HSVToRGB(num5, num2, num3);
		}

		internal static Color GetShadeColor(Color baseColor, float fillAmount)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result