Decompiled source of HunkHud v0.2.6

HunkHud.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using HunkHud.Components;
using HunkHud.Components.UI;
using HunkHud.Modules;
using MaterialHud;
using MonoMod.RuntimeDetour;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using ZioConfigFile;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace HunkHud
{
	public class CustomHudElement : HudElement
	{
		protected CharacterBody _prevBody;

		public CharacterBody targetBody => base._targetCharacterBody;

		public CharacterMaster targetMaster
		{
			get
			{
				HUD hud = base._hud;
				if (hud == null)
				{
					return null;
				}
				return hud.targetMaster;
			}
		}

		protected virtual void OnEnable()
		{
			if (((HudElement)this).hud == null)
			{
				HUD val = (((HudElement)this).hud = ((Component)((Component)this).transform.root).GetComponent<HUD>());
			}
			HUD.onHudTargetChangedGlobal += HUD_onHudTargetChangedGlobal;
			InstanceTracker.Add<CustomHudElement>(this);
		}

		protected virtual void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			((HudElement)this).hud = newHud;
			_prevBody = targetBody;
		}

		protected virtual void OnDisable()
		{
			HUD.onHudTargetChangedGlobal -= HUD_onHudTargetChangedGlobal;
			InstanceTracker.Remove<CustomHudElement>(this);
		}
	}
	public class LevelDisplay : ExpBar
	{
		private float expFillMin;

		private float expFillMax = 0.76f;

		public Image fillImage;

		private void Update()
		{
			//IL_0016: 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_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_004d: Unknown result type (might be due to invalid IL or missing references)
			TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)base.source)) ? 1 : ((int)base.source.teamIndex));
			float num = 0f;
			if (Object.op_Implicit((Object)(object)TeamManager.instance))
			{
				num = Mathf.InverseLerp((float)TeamManager.instance.GetTeamCurrentLevelExperience(val), (float)TeamManager.instance.GetTeamNextLevelExperience(val), (float)TeamManager.instance.GetTeamExperience(val));
			}
			if (Object.op_Implicit((Object)(object)fillImage))
			{
				fillImage.fillAmount = Util.Remap(num, 0f, 1f, expFillMin, expFillMax);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.public_ParticleSystem.HunkHud", "HunkHud", "0.2.6")]
	public class HunkHudMain : BaseUnityPlugin
	{
		public const string GUID = "com.public_ParticleSystem.HunkHud";

		public const string MODAUTHOR = "public_ParticleSystem";

		public const string MODNAME = "HunkHud";

		public const string VERSION = "0.2.6";

		public static HunkHudMain instance { get; private set; }

		public void Awake()
		{
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			PluginConfig.Init(((BaseUnityPlugin)this).Config);
			((MonoBehaviour)this).StartCoroutine("Load");
			Compat.Init();
		}

		private IEnumerator Load()
		{
			AssetBundleCreateRequest request = AssetBundle.LoadFromFileAsync(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "hunkhudassets"));
			yield return request;
			HudAssets.mainAssetBundle = request.assetBundle;
			HudAssets.Init();
		}
	}
	internal static class Compat
	{
		internal static bool ROOInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");

		internal static bool HunkInstalled => Chainloader.PluginInfos.ContainsKey("com.rob.Hunk");

		internal static bool DanteInstalled => Chainloader.PluginInfos.ContainsKey("com.rob.Dante");

		internal static bool RiskUIEnabled
		{
			get
			{
				if (Chainloader.PluginInfos.ContainsKey("bubbet.riskui"))
				{
					return GetRiskUIEnabled();
				}
				return false;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static bool GetRiskUIEnabled()
		{
			return RiskUIPlugin.Enabled.Value;
		}

		internal static void Init()
		{
			HUD.onHudTargetChangedGlobal += HUD_onHudTargetChangedGlobal;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void HUD_onHudTargetChangedGlobal(HUD hud)
		{
		}
	}
}
namespace HunkHud.Modules
{
	public static class HudAssets
	{
		public static AssetBundle mainAssetBundle;

		private static Hook onLoadHook;

		private static Hook notifHook;

		private static Hook crosshairHook;

		private static Hook hudAwakeHook;

		internal static void Init()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			crosshairHook = new Hook((MethodBase)typeof(CrosshairController).GetMethod("Awake", (BindingFlags)(-1)), typeof(HudAssets).GetMethod("CrosshairController_Awake", (BindingFlags)(-1)));
			hudAwakeHook = new Hook((MethodBase)typeof(HUD).GetMethod("Awake", (BindingFlags)(-1)), typeof(HudAssets).GetMethod("HUD_Awake", (BindingFlags)(-1)));
			onLoadHook = new Hook((MethodBase)typeof(RiskUIPlugin).GetMethod("onLoad", (BindingFlags)(-1)), typeof(HudAssets).GetMethod("RiskUIPlugin_onLoad", (BindingFlags)(-1)));
			notifHook = new Hook((MethodBase)typeof(NotificationAreaLoader).GetMethod("get_genericNotificationPrefab", (BindingFlags)(-1)), typeof(HudAssets).GetMethod("NotificationAreaLoader_get_genericNotificationPrefab", (BindingFlags)(-1)));
		}

		private static void CrosshairController_Awake(Action<CrosshairController> orig, CrosshairController self)
		{
			orig(self);
			((Component)(object)self).GetOrAddComponent<DynamicCrosshair>();
		}

		private static void HUD_Awake(Action<HUD> orig, HUD self)
		{
			orig(self);
			ChildLocator component = ((Component)self).GetComponent<ChildLocator>();
			component.FindChild("TopCenterCluster").FindOrInstantiate("ObjectiveGauge");
			component.FindChild("CrosshairExtras").FindOrInstantiate("LuminousGauge");
			CustomHealthBar customHealthBar = (CustomHealthBar)(object)(self.healthBar = (HealthBar)(object)((Component)component.FindChild("BottomLeftCluster").FindOrInstantiate("CustomHealthBar").transform.GetChild(0)).GetComponent<CustomHealthBar>());
			self.levelText = ((Component)customHealthBar).GetComponentInChildren<LevelText>();
			self.expBar = ((Component)customHealthBar).GetComponentInChildren<ExpBar>();
		}

		private static GameObject NotificationAreaLoader_get_genericNotificationPrefab(Func<GameObject> _)
		{
			return mainAssetBundle.LoadAsset<GameObject>("ItemNotification");
		}

		private static void RiskUIPlugin_onLoad(Action<RiskUIPlugin> orig, RiskUIPlugin self)
		{
			orig(self);
			UpdateRiskUI();
			ModifyRiskUI();
		}

		private static void UpdateRiskUI()
		{
			//IL_0044: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: 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_01bc: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			HUD component = RiskUIPlugin._newHud.GetComponent<HUD>();
			ChildLocator component2 = RiskUIPlugin._newHud.GetComponent<ChildLocator>();
			List<NameTransformPair> list = component2.transformPairs.ToList();
			Transform val = component.mainUIPanel.transform.Find("SpringCanvas");
			list.AddRange((IEnumerable<NameTransformPair>)(object)new NameTransformPair[10]
			{
				new NameTransformPair
				{
					name = "SpringCanvas",
					transform = val
				},
				new NameTransformPair
				{
					name = "UpperRightCluster",
					transform = val.Find("UpperRightCluster")
				},
				new NameTransformPair
				{
					name = "BottomRightCluster",
					transform = val.Find("BottomRightCluster")
				},
				new NameTransformPair
				{
					name = "UpperLeftCluster",
					transform = val.Find("UpperLeftCluster")
				},
				new NameTransformPair
				{
					name = "BottomCenterCluster",
					transform = val.Find("BottomCenterCluster")
				},
				new NameTransformPair
				{
					name = "LeftCluster",
					transform = val.Find("LeftCluster")
				},
				new NameTransformPair
				{
					name = "RightCluster",
					transform = val.Find("RightCluster")
				},
				new NameTransformPair
				{
					name = "NotificationArea",
					transform = component.mainContainer.transform.Find("NotificationArea")
				},
				new NameTransformPair
				{
					name = "ScoreboardPanel",
					transform = val.Find("ScoreboardPanel")
				},
				new NameTransformPair
				{
					name = "SkillDisplayRoot",
					transform = val.Find("BottomRightCluster/Scaler")
				}
			});
			BepinConfigParentManager[] componentsInChildren = ((Component)component).GetComponentsInChildren<BepinConfigParentManager>();
			foreach (BepinConfigParentManager val2 in componentsInChildren)
			{
				string name = ((Object)((Component)val2).gameObject).name;
				if (!(name == "BuffDisplayRoot"))
				{
					if (name == "InventoryContainer")
					{
						val2.choices[0] = val2.choices[1];
						((Component)val2).transform.SetParent(val2.choices[1], false);
						list.Add(new NameTransformPair
						{
							name = "InventoryDisplayRoot",
							transform = ((Component)val2).transform
						});
					}
				}
				else
				{
					Transform val3 = val2.choices[2];
					((Component)val3).GetComponent<RectTransform>().anchoredPosition3D = new Vector3(0f, -40f, 0f);
					val2.choices[0] = val3;
					val2.choices[1] = val3;
					val2.choices[2] = val3;
					val2.choices[3] = val3;
					((Component)val2).transform.SetParent(val3, false);
					RectTransform component3 = ((Component)val2).GetComponent<RectTransform>();
					component3.pivot = new Vector2(0.5f, 1f);
					component3.anchoredPosition3D = Vector3.zero;
					list.Add(new NameTransformPair
					{
						name = "BuffDisplayRoot",
						transform = ((Component)val2).transform
					});
				}
			}
			component2.transformPairs = list.ToArray();
		}

		private static void ModifyRiskUI()
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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)
			HUD component = RiskUIPlugin._newHud.GetComponent<HUD>();
			ChildLocator component2 = RiskUIPlugin._newHud.GetComponent<ChildLocator>();
			RiskUIPlugin._newClassicRunHud.AddComponent<ObjectiveDisplayMover>();
			RiskUIPlugin._newSimulacrumHud.AddComponent<ObjectiveDisplayMover>();
			RiskUIPlugin._allyCard.AddComponent<CanvasGroup>();
			RiskUIPlugin._allyCard.AddComponent<AllyHealthBarMover>();
			Transform obj = RiskUIPlugin._allyCard.transform.Find("Healthbar/HealthTextContainer/CurrentHealthText");
			if (obj != null)
			{
				((Component)(object)obj).SetInactiveSafe();
			}
			Transform obj2 = RiskUIPlugin._allyCard.transform.Find("Healthbar/HealthTextContainer/Slash");
			if (obj2 != null)
			{
				((Component)(object)obj2).SetInactiveSafe();
			}
			Transform obj3 = RiskUIPlugin._allyCard.transform.Find("Healthbar/HealthTextContainer/MaxHealthText");
			if (obj3 != null)
			{
				((Component)(object)obj3).SetInactiveSafe();
			}
			((Component)component2.FindChild("InventoryDisplayRoot")).gameObject.AddComponent<ItemDisplayMover>();
			((Component)component2.FindChild("SkillDisplayRoot")).gameObject.AddComponent<SkillIconMover>();
			((Component)component2.FindChild("UpperLeftCluster").GetChild(0)).gameObject.AddComponent<MoneyDisplayMover>().costType = (CostTypeIndex)1;
			((Component)component2.FindChild("UpperLeftCluster").GetChild(1)).gameObject.AddComponent<MoneyDisplayMover>().costType = (CostTypeIndex)14;
			((Component)component2.FindChild("UpperLeftCluster").GetChild(2)).gameObject.AddComponent<MoneyDisplayMover>().costType = (CostTypeIndex)3;
			Transform obj4 = component2.FindChild("BottomLeftCluster").Find("BarRoots/HealthText");
			if (obj4 != null)
			{
				((Component)(object)obj4).SetInactiveSafe();
			}
			Transform obj5 = component2.FindChild("BottomLeftCluster").Find("BarRoots/Seperator");
			if (obj5 != null)
			{
				((Component)(object)obj5).SetInactiveSafe();
			}
			HealthBar healthBar = component.healthBar;
			if (healthBar != null)
			{
				((Component)(object)healthBar).SetInactiveSafe();
			}
			ExpBar expBar = component.expBar;
			if (expBar != null)
			{
				((Component)(object)expBar).SetInactiveSafe();
			}
			LevelText levelText = component.levelText;
			if (levelText != null)
			{
				((Component)(object)levelText).SetInactiveSafe();
			}
		}

		private static T GetOrAddComponent<T>(this GameObject go) where T : Component
		{
			if (!Object.op_Implicit((Object)(object)go))
			{
				return default(T);
			}
			return go.GetComponent<T>() ?? go.AddComponent<T>();
		}

		private static T GetOrAddComponent<T>(this Component co) where T : Component
		{
			if (!Object.op_Implicit((Object)(object)co))
			{
				return default(T);
			}
			return co.GetComponent<T>() ?? co.gameObject.AddComponent<T>();
		}

		private static void SetInactiveSafe(this Component co, bool active = false)
		{
			if (Object.op_Implicit((Object)(object)co))
			{
				co.gameObject.SetActive(active);
			}
		}

		private static GameObject FindOrInstantiate(this Transform transform, string assetName)
		{
			Transform obj = transform.Find(assetName);
			GameObject val = ((obj != null) ? ((Component)obj).gameObject : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				val = Object.Instantiate<GameObject>(mainAssetBundle.LoadAsset<GameObject>(assetName), transform);
				((Object)val).name = assetName;
				val.transform.SetParent(transform);
			}
			return val;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public static class PluginConfig
	{
		private static ConfigFile cfg;

		public static ConfigEntry<bool> customHUD;

		public static ConfigEntry<bool> dynamicCustomHUD;

		public static ConfigEntry<bool> disableChat;

		public static ConfigEntry<bool> dynamicCrosshair;

		public static ConfigEntry<bool> fancyShield;

		public static ConfigEntry<bool> shieldBubble;

		public static ConfigEntry<float> vignetteStrength;

		public static ConfigEntry<bool> overTheShoulderCamera;

		public static ConfigEntry<bool> overTheShoulderCameraGlobal;

		public static ConfigEntry<float> cameraSmoothSpeed;

		internal static void Init(ConfigFile config)
		{
			cfg = config;
			customHUD = cfg.BindAndOptions("01 - General", "Custom HUD", defaultValue: true, "Set to true to enable a custom HUD tailored just for HUNK.");
			dynamicCustomHUD = cfg.BindAndOptions("01 - General", "Dynamic Custom HUD", defaultValue: true, "Set to false to keep HUNK's custom HUD on the screen at all times.");
			vignetteStrength = cfg.BindAndOptionsSlider("03 - Camera", "Vignette Strength", 0f, "Adds a subtle vignette to the screen to put more focus on the center.", 0f, 1f);
		}

		public static void InitROO(Sprite modSprite, string modDescription)
		{
			ModSettingsManager.SetModIcon(modSprite);
			ModSettingsManager.SetModDescription(modDescription);
		}

		public static ConfigEntry<T> BindAndOptions<T>(this ConfigFile config, string section, string name, T defaultValue, string description = "", bool restartRequired = false)
		{
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			description += $" (Default: {defaultValue})";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<T> val = config.Bind<T>(section, name, defaultValue, description);
			if (Compat.ROOInstalled)
			{
				TryRegisterOption<T>(val, restartRequired);
			}
			return val;
		}

		public static ConfigEntry<float> BindAndOptionsSlider(this ConfigFile config, string section, string name, float defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			description += $" (Default: {defaultValue})";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<float> val = config.Bind<float>(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>()));
			if (Compat.ROOInstalled)
			{
				TryRegisterOptionSlider(val, min, max, restartRequired);
			}
			return val;
		}

		public static ConfigEntry<int> BindAndOptionsSlider(this ConfigFile config, string section, string name, int defaultValue, string description = "", int min = 0, int max = 20, bool restartRequired = false)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			if (string.IsNullOrEmpty(description))
			{
				description = name;
			}
			description += $" (Default: {defaultValue})";
			if (restartRequired)
			{
				description += " (restart required)";
			}
			ConfigEntry<int> val = config.Bind<int>(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), Array.Empty<object>()));
			if (Compat.ROOInstalled)
			{
				TryRegisterOptionSlider(val, min, max, restartRequired);
			}
			return val;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			if (entry is ConfigEntry<float>)
			{
				ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry<float>, new SliderConfig
				{
					min = 0f,
					max = 20f,
					FormatString = "{0:0.00}",
					restartRequired = restartRequired
				}), "com.public_ParticleSystem.HunkHud", "HunkHud");
			}
			if (entry is ConfigEntry<int>)
			{
				ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry<int>, restartRequired), "com.public_ParticleSystem.HunkHud", "HunkHud");
			}
			if (entry is ConfigEntry<bool>)
			{
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry<bool>, restartRequired), "com.public_ParticleSystem.HunkHud", "HunkHud");
			}
			if (entry is ConfigEntry<KeyboardShortcut>)
			{
				ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry as ConfigEntry<KeyboardShortcut>, restartRequired), "com.public_ParticleSystem.HunkHud", "HunkHud");
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void TryRegisterOptionSlider(ConfigEntry<int> entry, int min, int max, bool restartRequired)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig
			{
				min = min,
				max = max,
				formatString = "{0:0.00}",
				restartRequired = restartRequired
			}), "com.public_ParticleSystem.HunkHud", "HunkHud");
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private static void TryRegisterOptionSlider(ConfigEntry<float> entry, float min, float max, bool restartRequired)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig
			{
				min = min,
				max = max,
				FormatString = "{0:0.00}",
				restartRequired = restartRequired
			}), "com.public_ParticleSystem.HunkHud", "HunkHud");
		}
	}
}
namespace HunkHud.Components
{
	public class AllyHealthBarMover : DisplayMover
	{
		private AllyCardController cardController;

		protected override void Awake()
		{
			//IL_0016: 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)
			base.Awake();
			offset = new Vector3(-500f, 0f, 0f);
			cardController = ((Component)this).GetComponent<AllyCardController>();
		}

		public override void CheckForActivity()
		{
			HealthComponent val = (Object.op_Implicit((Object)(object)cardController) ? cardController.cachedHealthComponent : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				float num = val.health + val.shield;
				float num2 = val.fullHealth + val.fullShield;
				if (num / num2 < 0.99f)
				{
					SetActive();
				}
			}
		}
	}
	public abstract class DisplayMover : CustomHudElement, IConfigHandler
	{
		public float delayTimer = 0.1f;

		public float activeInterval = 3f;

		public float activeTimer = 8f;

		public float smoothSpeed = 4f;

		public Vector3 offset;

		public CanvasGroup canvas;

		[NonSerialized]
		public Vector3 activePosition;

		[NonSerialized]
		public Vector3 desiredPosition;

		[NonSerialized]
		public ZioConfigEntry<bool> _configEntry;

		public abstract void CheckForActivity();

		protected virtual void ConfigUpdated(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Behaviour)this).enabled = _configEntry?.Value ?? true;
		}

		public virtual void Startup()
		{
			_configEntry = ConfigHelper.Bind<bool>("HunkHud", ((object)this).GetType().Name, true, "Enable or disable moving this hud element", (Action<ZioConfigEntry<bool>>)null, (object)null);
		}

		public void SetActive()
		{
			SetActive(activeInterval);
		}

		public virtual void SetActive(float time)
		{
			activeTimer = Mathf.Max(activeTimer, time);
			delayTimer = Mathf.Max(delayTimer, 0.1f);
		}

		protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			base.HUD_onHudTargetChangedGlobal(newHud);
			SetActive(8f);
		}

		protected virtual void Awake()
		{
			canvas = ((Component)this).GetComponent<CanvasGroup>() ?? ((Component)this).gameObject.AddComponent<CanvasGroup>();
			Startup();
			((ZioConfigEntryBase)_configEntry).SettingChanged += ConfigUpdated;
		}

		protected virtual void Start()
		{
			//IL_0007: 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_002d: 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)
			activePosition = ((Component)this).transform.localPosition;
			offset.x = Mathf.Abs(offset.x) * Mathf.Sign(((Component)this).transform.position.x);
			offset.y = Mathf.Abs(offset.y) * Mathf.Sign(((Component)this).transform.position.y);
		}

		protected override void OnEnable()
		{
			base.OnEnable();
			ConfigUpdated(null, null, arg3: false);
		}

		protected virtual void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//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_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_009e: 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)
			Vector3 localPosition = ((Component)this).transform.localPosition;
			Vector3 val = activePosition;
			if (activeTimer <= 0f)
			{
				val += offset;
			}
			if (offset.x == 0f)
			{
				val.x = localPosition.x;
			}
			if (offset.y == 0f)
			{
				val.y = localPosition.y;
			}
			if (offset.z == 0f)
			{
				val.z = localPosition.z;
			}
			((Component)this).transform.localPosition = Vector3.Lerp(localPosition, val, smoothSpeed * Time.deltaTime);
			canvas.alpha = Mathf.Clamp01(2f * (activeTimer + 0.5f));
		}

		protected virtual void FixedUpdate()
		{
			activeTimer -= Time.fixedDeltaTime;
			delayTimer -= Time.fixedDeltaTime;
			if (Object.op_Implicit((Object)(object)((HudElement)this).hud?.scoreboardPanel) && ((HudElement)this).hud.scoreboardPanel.activeSelf)
			{
				SetActive(activeInterval * 0.5f);
			}
			if (delayTimer <= 0f)
			{
				delayTimer = 0.1f;
				CheckForActivity();
			}
		}

		protected virtual void OnDestroy()
		{
			((ZioConfigEntryBase)_configEntry).SettingChanged -= ConfigUpdated;
		}
	}
	[RequireComponent(typeof(CrosshairController))]
	[RequireComponent(typeof(HudElement))]
	public class DynamicCrosshair : MonoBehaviour
	{
		public float range = 300f;

		public float interval = 0.2f;

		private HudElement hudElement;

		private (Image image, Color color)[] crosshairSprites;

		private float stopwatch;

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			hudElement = ((Component)this).GetComponent<HudElement>();
			List<(Image, Color)> list = new List<(Image, Color)>();
			SpritePosition[] spriteSpreadPositions = ((Component)this).GetComponent<CrosshairController>().spriteSpreadPositions;
			foreach (SpritePosition val in spriteSpreadPositions)
			{
				Image val2 = (Object.op_Implicit((Object)(object)val.target) ? ((Component)val.target).GetComponent<Image>() : null);
				if (Object.op_Implicit((Object)(object)val2))
				{
					list.Add((val2, ((Graphic)val2).color));
				}
			}
			crosshairSprites = list.ToArray();
		}

		private void FixedUpdate()
		{
			stopwatch -= Time.fixedDeltaTime;
			if (stopwatch <= 0f)
			{
				stopwatch = interval;
				Simulate();
			}
		}

		private void Simulate()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = (Object.op_Implicit((Object)(object)hudElement) ? hudElement.targetCharacterBody : null);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.inputBank))
			{
				return;
			}
			Ray aimRay = val.inputBank.GetAimRay();
			Color? val2 = null;
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(aimRay, ref val3, range, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)2))
			{
				HurtBox val4 = (Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).collider) ? ((Component)((RaycastHit)(ref val3)).collider).GetComponent<HurtBox>() : null);
				if (Object.op_Implicit((Object)(object)val4))
				{
					CharacterBody val5 = (Object.op_Implicit((Object)(object)val4.healthComponent) ? val4.healthComponent.body : null);
					if (Object.op_Implicit((Object)(object)val5) && (Object)(object)val5 != (Object)(object)val)
					{
						val2 = ((val5.teamComponent.teamIndex == val.teamComponent.teamIndex) ? Color.green : Color.red);
					}
				}
			}
			for (int i = 0; i < crosshairSprites.Length; i++)
			{
				((Graphic)crosshairSprites[i].image).color = (Color)(((??)val2) ?? crosshairSprites[i].color);
			}
		}
	}
	public class HealthBarMover : DisplayMover
	{
		private uint prevLevel;

		private InteractionDriver interactionDriver;

		public override void CheckForActivity()
		{
			//IL_00b2: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Invalid comparison between Unknown and I4
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Invalid comparison between Unknown and I4
			HealthComponent val = (Object.op_Implicit((Object)(object)base.targetBody) ? base.targetBody.healthComponent : null);
			if (!Object.op_Implicit((Object)(object)val))
			{
				return;
			}
			float num = val.health + val.shield;
			float num2 = val.fullHealth + val.fullShield;
			if (num / num2 < 0.99f)
			{
				SetActive();
			}
			uint num3 = Convert.FloorToUIntClamped(base.targetBody.level);
			if (num3 != prevLevel)
			{
				prevLevel = num3;
				SetActive();
			}
			if (!Object.op_Implicit((Object)(object)interactionDriver))
			{
				return;
			}
			PurchaseInteraction val2 = (Object.op_Implicit((Object)(object)interactionDriver.currentInteractable) ? interactionDriver.currentInteractable.GetComponent<PurchaseInteraction>() : null);
			if (Object.op_Implicit((Object)(object)val2))
			{
				CostTypeIndex costType = val2.costType;
				if ((int)costType == 2 || (int)costType == 15)
				{
					SetActive();
				}
			}
		}

		protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			base.HUD_onHudTargetChangedGlobal(newHud);
			interactionDriver = (Object.op_Implicit((Object)(object)base.targetBody) ? ((Component)base.targetBody).GetComponent<InteractionDriver>() : null);
		}
	}
	public class ItemDisplayMover : DisplayMover
	{
		private InteractionDriver interactionDriver;

		protected override void Awake()
		{
			//IL_0016: 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)
			base.Awake();
			offset = new Vector3(0f, 250f, 0f);
		}

		protected override void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 localPosition = ((Component)this).transform.localPosition;
			localPosition.x = 0f;
			((Component)this).transform.localPosition = localPosition;
			base.Start();
		}

		public override void CheckForActivity()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Invalid comparison between I4 and Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			if (Object.op_Implicit((Object)(object)interactionDriver))
			{
				PurchaseInteraction val = (Object.op_Implicit((Object)(object)interactionDriver.currentInteractable) ? interactionDriver.currentInteractable.GetComponent<PurchaseInteraction>() : null);
				if (Object.op_Implicit((Object)(object)val) && 4 <= (int)val.costType && (int)val.costType <= 13)
				{
					SetActive();
				}
			}
		}

		protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			if (Object.op_Implicit((Object)(object)_prevBody))
			{
				_prevBody.onInventoryChanged -= base.SetActive;
			}
			base.HUD_onHudTargetChangedGlobal(newHud);
			if (Object.op_Implicit((Object)(object)base.targetBody))
			{
				base.targetBody.onInventoryChanged += base.SetActive;
			}
			interactionDriver = (Object.op_Implicit((Object)(object)base.targetBody) ? ((Component)base.targetBody).GetComponent<InteractionDriver>() : null);
		}
	}
	public class MoneyDisplayMover : DisplayMover
	{
		public CostTypeIndex costType;

		private int cachedMoney;

		private MoneyText moneyText;

		private InteractionDriver interactionDriver;

		protected override void Awake()
		{
			base.Awake();
			moneyText = ((Component)this).GetComponent<MoneyText>();
			activeInterval = 2.25f;
		}

		public override void CheckForActivity()
		{
			//IL_006b: 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 (Object.op_Implicit((Object)(object)moneyText))
			{
				int displayAmount = moneyText.displayAmount;
				if (displayAmount != cachedMoney)
				{
					cachedMoney = displayAmount;
					SetActive();
				}
			}
			if (Object.op_Implicit((Object)(object)interactionDriver))
			{
				PurchaseInteraction val = (Object.op_Implicit((Object)(object)interactionDriver.currentInteractable) ? interactionDriver.currentInteractable.GetComponent<PurchaseInteraction>() : null);
				if (Object.op_Implicit((Object)(object)val) && val.costType == costType)
				{
					SetActive();
				}
			}
		}

		protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			base.HUD_onHudTargetChangedGlobal(newHud);
			interactionDriver = (Object.op_Implicit((Object)(object)base.targetBody) ? ((Component)base.targetBody).GetComponent<InteractionDriver>() : null);
		}
	}
	public class ObjectiveDisplayMover : DisplayMover
	{
		private int prevCount;

		private ObjectivePanelController objectivePanel;

		protected override void Awake()
		{
			//IL_0016: 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)
			base.Awake();
			offset = new Vector3(400f, 100f, 0f);
			objectivePanel = ((Component)this).GetComponentInChildren<ObjectivePanelController>();
			GlobalEventManager.onTeamLevelUp += GlobalEventManager_onTeamLevelUp;
		}

		protected override void OnDestroy()
		{
			base.OnDestroy();
			GlobalEventManager.onTeamLevelUp -= GlobalEventManager_onTeamLevelUp;
		}

		private void GlobalEventManager_onTeamLevelUp(TeamIndex team)
		{
			SetActive();
		}

		public override void CheckForActivity()
		{
			if (Object.op_Implicit((Object)(object)objectivePanel))
			{
				int count = objectivePanel.objectiveTrackers.Count;
				if (count != prevCount)
				{
					prevCount = count;
					SetActive();
				}
			}
		}
	}
	public class SkillIconMover : DisplayMover
	{
		private int prevStocks;

		protected override void Awake()
		{
			//IL_0016: 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)
			base.Awake();
			offset = new Vector3(0f, 0f, 0f);
			activeInterval = 2.25f;
		}

		public override void CheckForActivity()
		{
			CharacterBody obj = base.targetBody;
			int? obj2;
			if (obj == null)
			{
				obj2 = null;
			}
			else
			{
				EquipmentSlot equipmentSlot = obj.equipmentSlot;
				obj2 = ((equipmentSlot != null) ? new int?(equipmentSlot.stock) : null);
			}
			int? num = obj2;
			int valueOrDefault = num.GetValueOrDefault();
			if (valueOrDefault != prevStocks)
			{
				prevStocks = valueOrDefault;
				SetActive();
			}
		}

		protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			if (Object.op_Implicit((Object)(object)_prevBody))
			{
				_prevBody.onSkillActivatedAuthority -= OnSkillActivatedAuthority;
			}
			base.HUD_onHudTargetChangedGlobal(newHud);
			if (Object.op_Implicit((Object)(object)base.targetBody))
			{
				base.targetBody.onSkillActivatedAuthority += OnSkillActivatedAuthority;
			}
		}

		private void OnSkillActivatedAuthority(GenericSkill skill)
		{
			if (skill.stock < skill.maxStock)
			{
				SetActive();
			}
		}
	}
}
namespace HunkHud.Components.UI
{
	public class BandDisplay : CustomHudElement
	{
		public Gradient fillGradient;

		public GameObject fullObj;

		public GameObject fillObj;

		public Image fillImage;

		public string buffName;

		public string cooldownName;

		[NonSerialized]
		public HealthBarMover healthBar;

		private float timer;

		private int maxBuffs;

		private void FixedUpdate()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)base.targetBody) && Object.op_Implicit((Object)(object)healthBar))
			{
				if (base.targetBody.HasBuff(BuffCatalog.FindBuffIndex(buffName)))
				{
					SetRingReady();
					return;
				}
				int buffCount = base.targetBody.GetBuffCount(BuffCatalog.FindBuffIndex(cooldownName));
				if (buffCount > 0)
				{
					SetRingCooldown(buffCount);
					return;
				}
			}
			fillObj.SetActive(false);
			fullObj.SetActive(false);
		}

		private void SetRingReady()
		{
			fullObj.SetActive(true);
			fillObj.SetActive(false);
			timer = 0f;
			maxBuffs = 0;
		}

		private void SetRingCooldown(int newBuffs)
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			fullObj.SetActive(false);
			fillObj.SetActive(true);
			healthBar.SetActive();
			maxBuffs = Math.Max(maxBuffs, newBuffs);
			float num = Util.Remap(timer, 0f, (float)maxBuffs, 0f, 1f);
			((Graphic)fillImage).color = fillGradient.Evaluate(num);
			fillImage.fillAmount = num;
			timer += Time.fixedDeltaTime;
		}

		public BandDisplay()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_008c: 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_0096: 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_00a3: 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_00b5: 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_00d5: 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_00eb: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey
				{
					alpha = 1f,
					time = 0f
				},
				new GradientAlphaKey
				{
					alpha = 1f,
					time = 1f
				}
			};
			val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[5]
			{
				new GradientColorKey
				{
					color = Color.red,
					time = 0f
				},
				new GradientColorKey
				{
					color = Color.yellow,
					time = 0.5f
				},
				new GradientColorKey
				{
					color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
					time = 0.6f
				},
				new GradientColorKey
				{
					color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
					time = 0.95f
				},
				new GradientColorKey
				{
					color = Color.white,
					time = 1f
				}
			};
			fillGradient = val;
			base..ctor();
		}
	}
	public class BandDisplayController : CustomHudElement
	{
		public HealthBarMover healthBar;

		protected override void HUD_onHudTargetChangedGlobal(HUD newHud)
		{
			if (Object.op_Implicit((Object)(object)_prevBody))
			{
				_prevBody.onInventoryChanged -= CheckInventory;
			}
			base.HUD_onHudTargetChangedGlobal(newHud);
			if (Object.op_Implicit((Object)(object)base.targetBody))
			{
				base.targetBody.onInventoryChanged += CheckInventory;
			}
		}

		private void CheckInventory()
		{
			Inventory inventory = (Object.op_Implicit((Object)(object)base.targetMaster) ? base.targetMaster.inventory : null);
			AddOrRemovePrefab("BandDisplay", new string[2] { "FireRing", "IceRing" });
			AddOrRemovePrefab("BandDisplayVoid", new string[1] { "ElementalRingVoid" });
			AddOrRemovePrefab("BandDisplayHealing", new string[2] { "ITEM_HEALING_BAND", "ITEM_BARRIER_BAND" });
			AddOrRemovePrefab("BandDisplayNova", new string[1] { "ITEM_NOVA_BAND" });
			AddOrRemovePrefab("BandDisplaySacrificial", new string[1] { "ITEM_SANDSWEPT_SACRIFICIAL_BAND" });
			void AddOrRemovePrefab(string prefabName, string[] itemName)
			{
				//IL_0016: 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_0023: Unknown result type (might be due to invalid IL or missing references)
				bool flag = false;
				if (Object.op_Implicit((Object)(object)inventory))
				{
					for (int i = 0; i < itemName.Length; i++)
					{
						ItemIndex val = ItemCatalog.FindItemIndex(itemName[i]);
						if (inventory.GetItemCount(val) > 0)
						{
							flag = true;
							break;
						}
					}
				}
				Transform val2 = ((Component)this).transform.Find(prefabName);
				bool flag2 = (Object)(object)val2 != (Object)null;
				if (flag != flag2)
				{
					if (flag2)
					{
						Object.Destroy((Object)(object)((Component)val2).gameObject);
					}
					else
					{
						GameObject obj = Object.Instantiate<GameObject>(HudAssets.mainAssetBundle.LoadAsset<GameObject>(prefabName), ((Component)this).transform);
						((Object)obj).name = prefabName;
						BandDisplay component = obj.GetComponent<BandDisplay>();
						component.healthBar = healthBar;
						((HudElement)component).hud = ((HudElement)this).hud;
					}
				}
			}
		}
	}
	public class CustomHealthBar : HealthBar
	{
		[Serializable]
		public struct CustomBarInfo
		{
			[NonSerialized]
			public bool enabled;

			[NonSerialized]
			public float targetFill;

			[NonSerialized]
			public float currentFill;

			[SerializeField]
			public Image image;
		}

		public static CustomHealthBar instance;

		public Gradient healthBarGradient;

		public Color shieldColor;

		public Color pinkShieldColor;

		public Color infusionColor;

		public CustomBarInfo healthFill;

		public CustomBarInfo lowHealthFill;

		public CustomBarInfo shieldFill;

		public CustomBarInfo damageFill;

		public CustomBarInfo healingFill;

		public CustomBarInfo curseFill;

		public CustomBarInfo barrierFill;

		public CustomBarInfo barrierFillShiny;

		public CustomBarInfo delayedDamageMask;

		public CustomBarInfo ospFill;

		public CustomBarInfo echoFill;

		public CustomBarInfo collapseFill;

		public CustomBarInfo cullFill;

		public TextMeshProUGUI gunText;

		public RawImage gunIcon;

		public GameObject gunIconHolder;

		public RawImage characterIcon;

		public RawImage characterIconBorder;

		public GameObject characterIconHolder;

		public GameObject lunarRuinDisplay;

		public GameObject immunityDisplay;

		public GameObject biomassBar;

		public HealthBarMover hpBarMover;

		private float fillSpeed;

		private float minFill;

		private float maxFill;

		private float inverseFillMin;

		private float inverseFillMax;

		public CharacterBody targetBody => ((HealthBar)this).source?.body;

		private void Awake()
		{
			((HealthBar)this).Awake();
			SetDefaults();
			biomassBar.SetActive(false);
			gunIconHolder.SetActive(false);
			characterIconHolder.SetActive(true);
		}

		private void OnEnable()
		{
			((HealthBar)this).OnEnable();
			SingletonHelper.Assign<CustomHealthBar>(ref instance, this);
		}

		private void OnDisable()
		{
			((HealthBar)this).OnDisable();
			SingletonHelper.Unassign<CustomHealthBar>(ref instance, this);
		}

		private void Update()
		{
			base.updateTimer -= Time.deltaTime;
			if ((Object)(object)base._source != (Object)(object)base.oldSource)
			{
				base.updateTimer = 0f;
				base.oldSource = base._source;
				SetCharacterIcon();
			}
			if (base.updateTimer <= 0f)
			{
				base.updateTimer = base.updateDelay;
				SetCharacterIcon();
				UpdateCustomBarInfos();
				ApplyCustomBars();
			}
			ApplyCustomBarsUpdate();
		}

		private void ApplyCustomBarsUpdate()
		{
			Apply(ref healthFill);
			Apply(ref shieldFill);
			Apply(ref damageFill);
		}

		private void ApplyCustomBars()
		{
			Apply(ref healingFill);
			Apply(ref barrierFill);
			Apply(ref barrierFillShiny);
			Apply(ref lowHealthFill);
			Apply(ref curseFill);
			Apply(ref cullFill);
			Apply(ref delayedDamageMask);
			Apply(ref collapseFill);
			Apply(ref echoFill);
			Apply(ref ospFill);
		}

		private void Apply(ref CustomBarInfo info)
		{
			if (info.currentFill != info.targetFill)
			{
				info.currentFill = Mathf.Lerp(info.currentFill, info.targetFill, fillSpeed * Time.deltaTime);
			}
			((Behaviour)info.image).enabled = info.enabled;
			info.image.fillAmount = info.currentFill;
		}

		private void SetDefaults()
		{
			healthFill.enabled = false;
			healingFill.enabled = false;
			lowHealthFill.enabled = false;
			shieldFill.enabled = false;
			barrierFill.enabled = false;
			barrierFillShiny.enabled = false;
			damageFill.targetFill = 0f;
			damageFill.enabled = 0f < damageFill.currentFill;
			delayedDamageMask.enabled = false;
			collapseFill.enabled = false;
			echoFill.enabled = false;
			ospFill.enabled = false;
			cullFill.enabled = false;
			immunityDisplay.SetActive(false);
		}

		private void UpdateCustomBarInfos()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_009b: 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_00a9: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)((HealthBar)this).source) || !Object.op_Implicit((Object)(object)targetBody))
			{
				SetDefaults();
				return;
			}
			if (base.isInventoryCheckDirty)
			{
				((HealthBar)this).CheckInventory();
			}
			HealthBarValues healthBarValues = ((HealthBar)this).source.GetHealthBarValues();
			float num = 1f - (healthBarValues.healthFraction + healthBarValues.shieldFraction);
			float num2 = 1f - healthBarValues.curseFraction;
			float num3 = Mathf.Clamp01(GetCollapseFraction() * num2);
			((Graphic)shieldFill.image).color = (healthBarValues.hasVoidShields ? pinkShieldColor : shieldColor);
			((Graphic)healthFill.image).color = (healthBarValues.hasInfusion ? infusionColor : healthBarGradient.Evaluate(healthBarValues.healthFraction));
			GameObject obj = immunityDisplay;
			if (obj != null)
			{
				obj.SetActive(targetBody.HasBuff(Buffs.HiddenInvincibility));
			}
			GameObject obj2 = lunarRuinDisplay;
			if (obj2 != null)
			{
				obj2.SetActive(healthBarValues.hasLunarRuin);
			}
			float num4 = Util.Remap(healthBarValues.healthFraction, 0f, 1f, minFill, maxFill);
			healthFill.enabled = healthBarValues.healthFraction > 0f;
			healthFill.targetFill = num4;
			healthFill.currentFill = Mathf.Min(num4, healthFill.currentFill);
			float num5 = Util.Remap(healthBarValues.healthFraction + healthBarValues.shieldFraction, 0f, 1f, minFill, maxFill);
			damageFill.targetFill = num5;
			damageFill.currentFill = Mathf.Max(num5, damageFill.currentFill);
			damageFill.enabled = damageFill.currentFill > num5;
			shieldFill.enabled = healthBarValues.shieldFraction > 0f;
			shieldFill.targetFill = num5;
			shieldFill.currentFill = Mathf.Min(num5, shieldFill.currentFill);
			Remap(ref healingFill, healthBarValues.healthFraction, healthFill.currentFill < healthFill.targetFill, inverse: false);
			Remap(ref lowHealthFill, HealthComponent.lowHealthFraction * num2, (base.hasLowHealthItem || base.hasLowHealthBuff) && !((HealthBar)this).source.isHealthLow, inverse: false);
			Remap(ref barrierFill, healthBarValues.barrierFraction, healthBarValues.barrierFraction > 0f, inverse: false);
			Remap(ref barrierFillShiny, healthBarValues.barrierFraction, healthBarValues.barrierFraction > 0f, inverse: false);
			Remap(ref cullFill, healthBarValues.cullFraction, healthBarValues.cullFraction > 0f, inverse: false);
			Remap(ref curseFill, healthBarValues.curseFraction, healthBarValues.curseFraction > 0f, inverse: true);
			Remap(ref ospFill, healthBarValues.ospFraction + num, healthBarValues.ospFraction > 0f, inverse: true);
			Remap(ref delayedDamageMask, healthBarValues.healthFraction + healthBarValues.shieldFraction, enabled: true, inverse: false);
			Remap(ref collapseFill, num3 + num, num3 > 0f && targetBody.HasBuff(Buffs.Fracture), inverse: true);
			Remap(ref echoFill, healthBarValues.echoFraction + num, healthBarValues.echoFraction > 0f && targetBody.HasBuff(Buffs.DelayedDamageDebuff), inverse: true);
			if (echoFill.enabled || collapseFill.enabled)
			{
				hpBarMover?.SetActive();
				damageFill.currentFill = damageFill.targetFill;
			}
			void Remap(ref CustomBarInfo bar, float value, bool enabled, bool inverse)
			{
				bar.enabled = enabled;
				value = Mathf.Clamp01(value);
				bar.currentFill = (bar.targetFill = (inverse ? Util.Remap(value, 0f, 1f, inverseFillMin, inverseFillMax) : Util.Remap(value, 0f, 1f, minFill, maxFill)));
			}
		}

		private float GetCollapseFraction()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Invalid comparison between Unknown and I4
			//IL_005f: 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)
			DotController val = DotController.FindDotController(((Component)targetBody).gameObject);
			if (!Object.op_Implicit((Object)(object)val) || !val.HasDotActive((DotIndex)8))
			{
				return 0f;
			}
			float num = 0f;
			foreach (DotStack dotStack in val.dotStackList)
			{
				if ((int)dotStack.dotIndex == 8)
				{
					float damage = dotStack.damage;
					ModifyIncomingDamage(ref damage, dotStack.attackerObject, dotStack.attackerTeam, dotStack.damageType);
					num += Mathf.Max(0f, damage);
				}
			}
			return num / ((HealthBar)this).source.fullCombinedHealth;
		}

		private void ModifyIncomingDamage(ref float damage, GameObject attacker, TeamIndex attackerTeam, DamageTypeCombo damageType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: 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_008a: 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_00a0: 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_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			if ((damageType.damageTypeExtended & 0x10000000) != 0)
			{
				damage = ((HealthBar)this).source.fullHealth * 0.1f;
			}
			if (targetBody.HasBuff(Buffs.KnockUpHitEnemiesJuggleCount))
			{
				damage *= 1f + 0.1f * (float)targetBody.GetBuffCount(Buffs.KnockUpHitEnemiesJuggleCount);
			}
			if (targetBody.HasBuff(Buffs.lunarruin))
			{
				damage *= 1f + 0.1f * (float)targetBody.GetBuffCount(Buffs.lunarruin);
			}
			if (attackerTeam == targetBody.teamComponent.teamIndex)
			{
				damage *= TeamCatalog.GetTeamDef(attackerTeam)?.friendlyFireScaling ?? 1f;
			}
			CharacterBody val = (Object.op_Implicit((Object)(object)attacker) ? attacker.GetComponent<CharacterBody>() : null);
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.inventory))
			{
				int itemCount;
				if (((HealthBar)this).source.combinedHealth >= ((HealthBar)this).source.fullCombinedHealth * 0.9f)
				{
					itemCount = val.inventory.GetItemCount(Items.Crowbar);
					if (itemCount > 0)
					{
						damage *= 1f + 0.75f * (float)itemCount;
					}
				}
				itemCount = val.inventory.GetItemCount(Items.NearbyDamageBonus);
				if (itemCount > 0)
				{
					Vector3 val2 = targetBody.corePosition - val.corePosition;
					if (((Vector3)(ref val2)).sqrMagnitude <= 169f)
					{
						damage *= 1f + (float)itemCount * 0.2f;
					}
				}
				itemCount = val.inventory.GetItemCount(Items.FragileDamageBonus);
				if (itemCount > 0)
				{
					damage *= 1f + (float)itemCount * 0.2f;
				}
			}
			if ((damageType.damageType & 0x10) != 0)
			{
				damage *= 1.5f;
			}
			if (targetBody.HasBuff(Buffs.DeathMark))
			{
				damage *= 1.5f;
			}
			if ((damageType.damageType & 2) == 0)
			{
				float num = targetBody.armor + ((HealthBar)this).source.adaptiveArmorValue;
				if ((targetBody.bodyFlags & 0x40) != 0 && DamageTypeCombo.op_Implicit(damageType & DamageTypeCombo.op_Implicit((DamageType)131072)) != 0L)
				{
					num += 300f;
				}
				float num2 = ((num >= 0f) ? (1f - num / (num + 100f)) : (2f - 100f / (100f - num)));
				damage = Mathf.Max(1f, damage * num2);
				if (Object.op_Implicit((Object)(object)targetBody.inventory))
				{
					int itemCount = targetBody.inventory.GetItemCount(Items.ArmorPlate);
					if (itemCount > 0)
					{
						damage = Mathf.Max(1f, damage - 5f * (float)itemCount);
					}
				}
			}
			if (targetBody.hasOneShotProtection && (damageType.damageType & 0x40000) == 0)
			{
				float num3 = (((HealthBar)this).source.fullCombinedHealth + ((HealthBar)this).source.barrier) * (1f - targetBody.oneShotProtectionFraction);
				float num4 = Mathf.Max(0f, num3 - ((HealthBar)this).source.serverDamageTakenThisUpdate);
				damage = Mathf.Min(damage, num4);
			}
			if ((damageType.damageType & 0x80000) != 0)
			{
				damage *= Mathf.Lerp(3f, 1f, ((HealthBar)this).source.combinedHealthFraction);
			}
			if (targetBody.HasBuff(Buffs.LunarShell))
			{
				damage = Mathf.Min(damage, ((HealthBar)this).source.fullHealth * 0.1f);
			}
			if (Object.op_Implicit((Object)(object)targetBody.inventory))
			{
				int itemCount = targetBody.inventory.GetItemCount(Items.MinHealthPercentage);
				if (itemCount > 0)
				{
					float num5 = ((HealthBar)this).source.fullCombinedHealth * ((float)itemCount / 100f);
					damage = Mathf.Max(0f, Mathf.Min(damage, ((HealthBar)this).source.combinedHealth - num5));
				}
			}
			if (targetBody.HasBuff(Buffs.DelayedDamageBuff))
			{
				damage *= 0.8f;
			}
		}

		public void SetCharacterIcon()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)targetBody))
			{
				Color bodyColor = targetBody.bodyColor;
				bodyColor.a = 0.5f;
				((Graphic)characterIconBorder).color = bodyColor;
				characterIcon.texture = targetBody.portraitIcon;
			}
		}

		public void SetGenericIcon(Texture icon = null)
		{
			gunIconHolder.SetActive(true);
			characterIconHolder.SetActive(false);
			gunIcon.texture = icon;
		}

		public CustomHealthBar()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: 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_008c: 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_0096: 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_00a3: 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_00b5: 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_00d5: 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_00eb: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			Gradient val = new Gradient();
			val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
			{
				new GradientAlphaKey
				{
					alpha = 1f,
					time = 0f
				},
				new GradientAlphaKey
				{
					alpha = 1f,
					time = 1f
				}
			};
			val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[4]
			{
				new GradientColorKey
				{
					color = Color.red,
					time = 0f
				},
				new GradientColorKey
				{
					color = Color.yellow,
					time = 0.5f
				},
				new GradientColorKey
				{
					color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
					time = 0.8f
				},
				new GradientColorKey
				{
					color = new Color(31f / 85f, 57f / 85f, 23f / 51f),
					time = 1f
				}
			};
			healthBarGradient = val;
			shieldColor = new Color(0.14901961f, 0.70980394f, 0.80784315f);
			pinkShieldColor = new Color(0.80784315f, 0.29803923f, 0.7607843f);
			infusionColor = new Color(1f, 18f / 85f, 0.23137255f);
			fillSpeed = 1.5f;
			minFill = 0.341f;
			maxFill = 0.752f;
			inverseFillMin = 0.248f;
			inverseFillMax = 0.659f;
			((HealthBar)this)..ctor();
		}
	}
	public class LuminousDisplay : CustomHudElement
	{
		public Color activeColor = Color.white;

		public Color inactiveColor = new Color(0f, 0f, 0f, 0.25f);

		public TextMeshProUGUI label;

		public GameObject baseHolder;

		public Image[] pips;

		private void FixedUpdate()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			int num = (Object.op_Implicit((Object)(object)base.targetBody) ? base.targetBody.GetBuffCount(Buffs.IncreasePrimaryDamageBuff) : 0);
			if (num == 0)
			{
				baseHolder.SetActive(false);
				return;
			}
			for (int i = 0; i < pips.Length; i++)
			{
				((Graphic)pips[i]).color = ((num > i) ? activeColor : inactiveColor);
			}
			((TMP_Text)label).text = num.ToString();
			baseHolder.SetActive(true);
		}
	}
	public class ObjectiveChargeDisplay : MonoBehaviour
	{
		public Image fill;

		public GameObject fullBar;

		public TextMeshProUGUI label;

		public CanvasGroup canvas;

		private float targetAlpha;

		private void Awake()
		{
			((Component)this).transform.SetSiblingIndex(1);
		}

		private void FixedUpdate()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected I4, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			ActivationState val = (ActivationState)0;
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance))
			{
				val = TeleporterInteraction.instance.activationState;
			}
			switch (val - 1)
			{
			default:
				targetAlpha = 0f;
				break;
			case 0:
				fullBar.SetActive(false);
				fill.fillAmount = 0f;
				((TMP_Text)label).text = "";
				targetAlpha = Mathf.Lerp(targetAlpha, 1f, Time.fixedDeltaTime);
				break;
			case 1:
				fullBar.SetActive(false);
				fill.fillAmount = TeleporterInteraction.instance.chargeFraction;
				((TMP_Text)label).text = $"{TeleporterInteraction.instance.chargePercent}%";
				targetAlpha = 1f;
				break;
			case 2:
				fullBar.SetActive(true);
				fill.fillAmount = 1f;
				((TMP_Text)label).text = "100%";
				targetAlpha = Mathf.Lerp(targetAlpha, 0f, Time.fixedDeltaTime);
				break;
			}
			canvas.alpha = targetAlpha;
			((Component)canvas).gameObject.SetActive(targetAlpha > 0f);
		}
	}
}