Decompiled source of FixBossHealthDisplay v1.0.0

FixBossHealthDisplay.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using On.RoR2.UI;
using RoR2.UI;
using TMPro;
using UnityEngine;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FixBossHealthDisplay
{
	[BepInPlugin("top.sshh.FixBossHealthDisplay", "FixBossHealthDisplay", "1.0.0")]
	public class FixBossHealthDisplay : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_LateUpdate <>9__0_0;

			internal void <Awake>b__0_0(orig_LateUpdate orig, HUDBossHealthBarController self)
			{
				bool flag = Object.op_Implicit((Object)(object)self.currentBossGroup) && self.currentBossGroup.combatSquad.memberCount > 0;
				self.container.SetActive(flag);
				if (flag)
				{
					float totalObservedHealth = self.currentBossGroup.totalObservedHealth;
					float totalMaxObservedMaxHealth = self.currentBossGroup.totalMaxObservedMaxHealth;
					float num = ((totalMaxObservedMaxHealth == 0f) ? 0f : Mathf.Clamp01(totalObservedHealth / totalMaxObservedMaxHealth));
					self.delayedTotalHealthFraction = Mathf.Clamp(Mathf.SmoothDamp(self.delayedTotalHealthFraction, num, ref self.healthFractionVelocity, 0.1f, float.PositiveInfinity, Time.deltaTime), num, 1f);
					self.fillRectImage.fillAmount = num;
					self.delayRectImage.fillAmount = self.delayedTotalHealthFraction;
					HUDBossHealthBarController.sharedStringBuilder.Clear().Append(totalObservedHealth.ToString("#", CultureInfo.InvariantCulture)).Append("/")
						.Append(totalMaxObservedMaxHealth.ToString("#", CultureInfo.InvariantCulture));
					((TMP_Text)self.healthLabel).SetText(HUDBossHealthBarController.sharedStringBuilder);
					((TMP_Text)self.bossNameLabel).SetText(self.currentBossGroup.bestObservedName, true);
				}
			}
		}

		public void Awake()
		{
			//IL_0015: 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: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_LateUpdate val = delegate(orig_LateUpdate orig, HUDBossHealthBarController self)
				{
					bool flag = Object.op_Implicit((Object)(object)self.currentBossGroup) && self.currentBossGroup.combatSquad.memberCount > 0;
					self.container.SetActive(flag);
					if (flag)
					{
						float totalObservedHealth = self.currentBossGroup.totalObservedHealth;
						float totalMaxObservedMaxHealth = self.currentBossGroup.totalMaxObservedMaxHealth;
						float num = ((totalMaxObservedMaxHealth == 0f) ? 0f : Mathf.Clamp01(totalObservedHealth / totalMaxObservedMaxHealth));
						self.delayedTotalHealthFraction = Mathf.Clamp(Mathf.SmoothDamp(self.delayedTotalHealthFraction, num, ref self.healthFractionVelocity, 0.1f, float.PositiveInfinity, Time.deltaTime), num, 1f);
						self.fillRectImage.fillAmount = num;
						self.delayRectImage.fillAmount = self.delayedTotalHealthFraction;
						HUDBossHealthBarController.sharedStringBuilder.Clear().Append(totalObservedHealth.ToString("#", CultureInfo.InvariantCulture)).Append("/")
							.Append(totalMaxObservedMaxHealth.ToString("#", CultureInfo.InvariantCulture));
						((TMP_Text)self.healthLabel).SetText(HUDBossHealthBarController.sharedStringBuilder);
						((TMP_Text)self.bossNameLabel).SetText(self.currentBossGroup.bestObservedName, true);
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			HUDBossHealthBarController.LateUpdate += (hook_LateUpdate)obj;
		}
	}
}