Decompiled source of VoidFiendHudTweaks v1.0.1

plugins/VoidFiendHudTweaks/VoidFiendHudTweaks.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using HG.GeneralSerializer;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.HudOverlay;
using RoR2.Skills;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("VoidFiendHudTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+447ba2121541f7405c37ac6c9cf2ad6287cdab38")]
[assembly: AssemblyProduct("VoidFiendHudTweaks")]
[assembly: AssemblyTitle("VoidFiendHudTweaks")]
[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 VoidFiendHudTweaks
{
	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 RiskOfOptionsCompatibility
	{
		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
				}
				return _enabled.Value;
			}
		}

		public static void AddCheckBoxOption(ConfigEntry<bool> newEntry)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(newEntry));
		}

		public static void AddCheckBoxOption(ConfigEntry<bool> newEntry, bool restartRequired = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(newEntry, restartRequired));
		}

		public static void AddCheckBoxOption(ConfigEntry<bool> newEntry, string inputName = null, string inputDescription = null, string inputCategory = null, bool inputRestartRequired = false, Delegate inputCheckIfDisabled = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0013: 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_0022: 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_002f: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			CheckBoxConfig val = new CheckBoxConfig
			{
				name = inputName,
				description = inputDescription,
				category = inputCategory,
				restartRequired = inputRestartRequired,
				checkIfDisabled = (IsDisabledDelegate)inputCheckIfDisabled
			};
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(newEntry, val));
		}

		public static void AddColorOption(ConfigEntry<Color> newEntry)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new ColorOption(newEntry));
		}

		public static void AddColorOption(ConfigEntry<Color> newEntry, bool restartRequired = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			ModSettingsManager.AddOption((BaseOption)new ColorOption(newEntry, restartRequired));
		}

		public static void AddColorOption(ConfigEntry<Color> newEntry, string inputName = null, string inputDescription = null, string inputCategory = null, bool inputRestartRequired = false, Delegate inputCheckIfDisabled = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0013: 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_0022: 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_002f: Expected O, but got Unknown
			//IL_0030: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			ColorOptionConfig val = new ColorOptionConfig
			{
				name = inputName,
				description = inputDescription,
				category = inputCategory,
				restartRequired = inputRestartRequired,
				checkIfDisabled = (IsDisabledDelegate)inputCheckIfDisabled
			};
			ModSettingsManager.AddOption((BaseOption)new ColorOption(newEntry, val));
		}

		public static void AddColorOption(ConfigEntry<Color> newEntry, Func<bool> inputCheckIfDisabled = null)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: 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_0017: Expected O, but got Unknown
			//IL_0018: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			ColorOptionConfig val = new ColorOptionConfig
			{
				checkIfDisabled = new IsDisabledDelegate(inputCheckIfDisabled.Invoke)
			};
			ModSettingsManager.AddOption((BaseOption)new ColorOption(newEntry, val));
		}

		public static void InvokeSetModDescription(string description)
		{
			ModSettingsManager.SetModDescription(description);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("treacherousfiend.Void-Fiend-UI-Tweak", "Void-Fiend-UI-Tweak", "1.0.0")]
	public class VoidFiendHudTweaks : BaseUnityPlugin
	{
		public class CorruptionDeltaNotice
		{
			public float ElementTimer;

			public string DeltaValue = string.Empty;

			public bool PositiveDelta;
		}

		public const string PluginGUID = "treacherousfiend.Void-Fiend-UI-Tweak";

		public const string PluginAuthor = "treacherousfiend";

		public const string PluginName = "Void-Fiend-UI-Tweak";

		public const string PluginVersion = "1.0.0";

		public static List<CorruptionDeltaNotice> CorruptionDeltaNoticeList = new List<CorruptionDeltaNotice>();

		public static List<GameObject> CorruptionDeltaNoticeObjects = new List<GameObject>(3);

		public static Image SuppressDeltaImageObject = null;

		public static Image SuppressCorruptDeltaImageObject = null;

		public static Dictionary<SkillDef, Dictionary<string, string>> SpecialSkillDefs = new Dictionary<SkillDef, Dictionary<string, string>>();

		public static Dictionary<SkillDef, Dictionary<string, string>> CorruptedSpecialSkillDefs = new Dictionary<SkillDef, Dictionary<string, string>>();

		public static GameObject CorruptionTimerObject = null;

		public static ConfigEntry<bool> ConfigCorruptionPercentageTweak { get; set; }

		public static ConfigEntry<bool> ConfigCorruptionTimer { get; set; }

		public static ConfigEntry<bool> ConfigCorruptionDelta { get; set; }

		public static ConfigEntry<Color> ConfigCorruptionDeltaPositiveColor { get; set; }

		public static ConfigEntry<Color> ConfigCorruptionDeltaNegativeColor { get; set; }

		public static ConfigEntry<bool> ConfigSuppressHealDelta { get; set; }

		public static ConfigEntry<Color> ConfigSuppressHealDeltaColor { get; set; }

		public static ConfigEntry<bool> ConfigSuppressCorruptDelta { get; set; }

		public static ConfigEntry<Color> ConfigSuppressCorruptDeltaColor { get; set; }

		public static ConfigEntry<bool> ConfigShowPermaCorruptionMin { get; set; }

		public static ConfigEntry<bool> ConfigShowCorruptionTimerWhenUncorrupted { get; set; }

		public static ConfigEntry<bool> ConfigShowCorruptionTimerWhenCorrupted { get; set; }

		public void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			VoidSurvivorController.UpdateUI += new hook_UpdateUI(CustomUpdateUI);
			VoidSurvivorController.OnOverlayInstanceAdded += new hook_OnOverlayInstanceAdded(VoidSurvivorController_OnOverlayInstanceAdded);
			VoidSurvivorController.OnCorruptionModified += new hook_OnCorruptionModified(VoidSurvivorController_OnCorruptionModified);
		}

		public void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			VoidSurvivorController.UpdateUI -= new hook_UpdateUI(CustomUpdateUI);
			VoidSurvivorController.OnOverlayInstanceAdded -= new hook_OnOverlayInstanceAdded(VoidSurvivorController_OnOverlayInstanceAdded);
			VoidSurvivorController.OnCorruptionModified -= new hook_OnCorruptionModified(VoidSurvivorController_OnCorruptionModified);
		}

		private void UpdateCorruptionTimer(VoidSurvivorController survivorController)
		{
			if (!survivorController.isPermanentlyCorrupted)
			{
				float num;
				if (survivorController.isCorrupted)
				{
					if (!ConfigShowCorruptionTimerWhenCorrupted.Value)
					{
						CorruptionTimerObject.SetActive(false);
						return;
					}
					CorruptionTimerObject.SetActive(true);
					num = (survivorController.corruption - survivorController.minimumCorruption) / Mathf.Abs(survivorController.corruptionFractionPerSecondWhileCorrupted * 100f);
				}
				else
				{
					if (!ConfigShowCorruptionTimerWhenUncorrupted.Value)
					{
						CorruptionTimerObject.SetActive(false);
						return;
					}
					num = ((!survivorController.characterBody.outOfCombat) ? ((survivorController.maxCorruption - survivorController.corruption) / survivorController.corruptionPerSecondInCombat) : ((survivorController.maxCorruption - survivorController.corruption) / survivorController.corruptionPerSecondOutOfCombat));
					CorruptionTimerObject.SetActive(true);
				}
				CorruptionTimerObject.GetComponent<TimerText>().seconds = num;
			}
			else
			{
				CorruptionTimerObject.SetActive(false);
			}
		}

		private void UpdateCorruptionDeltaNotices()
		{
			//IL_0045: 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)
			for (int i = 0; i < CorruptionDeltaNoticeList.Count; i++)
			{
				CorruptionDeltaNotice corruptionDeltaNotice = CorruptionDeltaNoticeList[i];
				TextMeshProUGUI component = CorruptionDeltaNoticeObjects[i].GetComponent<TextMeshProUGUI>();
				((TMP_Text)component).text = corruptionDeltaNotice.DeltaValue;
				((Graphic)component).color = (corruptionDeltaNotice.PositiveDelta ? ConfigCorruptionDeltaPositiveColor.Value : ConfigCorruptionDeltaNegativeColor.Value);
				CorruptionDeltaNoticeObjects[i].SetActive(true);
			}
		}

		private float GenerateMeterDelta(Dictionary<SkillDef, Dictionary<string, string>> skillDefDict, SkillDef currSpecialSkill, VoidSurvivorController survivorController, ImageFillController baseFillUi)
		{
			//IL_014d: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			float num = survivorController.corruption / survivorController.maxCorruption;
			float result = num * 100f;
			float fillAmount = 0f;
			float num2 = float.Parse(skillDefDict[currSpecialSkill]["corruptionChange"]) / 100f;
			if (survivorController.characterBody.skillLocator.special.stock > 0 || currSpecialSkill.rechargeStock > 0)
			{
				if (num2 < 0f && ConfigSuppressHealDelta.Value)
				{
					if (num >= num2 && num < 1f)
					{
						((Graphic)SuppressDeltaImageObject).color = ConfigSuppressHealDeltaColor.Value;
						fillAmount = num;
						if (num >= Mathf.Abs(num2))
						{
							num = Mathf.Max(survivorController.minimumCorruption / 100f, num + num2);
						}
					}
				}
				else if (ConfigCorruptionPercentageTweak.Value && survivorController.isCorrupted)
				{
					float num3 = survivorController.maxCorruption - survivorController.minimumCorruption;
					num = (survivorController.corruption - survivorController.minimumCorruption) / num3;
					result = num * 100f;
					if (ConfigSuppressCorruptDelta.Value)
					{
						((Graphic)SuppressDeltaImageObject).color = ConfigSuppressCorruptDeltaColor.Value;
						fillAmount = Mathf.Min(1f, num + num2 * 100f / num3);
					}
				}
				else if (ConfigSuppressCorruptDelta.Value)
				{
					((Graphic)SuppressDeltaImageObject).color = ConfigSuppressCorruptDeltaColor.Value;
					fillAmount = Mathf.Min(1f, num + num2);
				}
			}
			else if (ConfigCorruptionPercentageTweak.Value && survivorController.isCorrupted)
			{
				float num4 = survivorController.maxCorruption - survivorController.minimumCorruption;
				num = (survivorController.corruption - survivorController.minimumCorruption) / num4;
				result = num * 100f;
			}
			baseFillUi.SetTValue(num);
			SuppressDeltaImageObject.fillAmount = fillAmount;
			return result;
		}

		private void CustomUpdateUI(orig_UpdateUI orig, VoidSurvivorController self)
		{
			orig.Invoke(self);
			ImageFillController baseFillUi = null;
			foreach (ImageFillController fillUi in self.fillUiList)
			{
				baseFillUi = fillUi;
			}
			if (self.fillUiList.Count <= 0)
			{
				return;
			}
			SkillDef skillDef = self.characterBody.skillLocator.special.skillDef;
			float num = self.corruption;
			if (self.isPermanentlyCorrupted)
			{
				num = (ConfigShowPermaCorruptionMin.Value ? 100f : self.minimumCorruption);
			}
			else if (!self.isCorrupted && SpecialSkillDefs.ContainsKey(skillDef))
			{
				num = GenerateMeterDelta(SpecialSkillDefs, skillDef, self, baseFillUi);
			}
			else if (CorruptedSpecialSkillDefs.ContainsKey(skillDef))
			{
				num = GenerateMeterDelta(CorruptedSpecialSkillDefs, skillDef, self, baseFillUi);
			}
			StringBuilder stringBuilder = StringBuilderPool.RentStringBuilder();
			StringBuilderExtensions.AppendInt(stringBuilder, Mathf.FloorToInt(num), 1u, 3u).Append("%");
			((TMP_Text)((Component)self.uiCorruptionText).GetComponentInChildren<TextMeshProUGUI>()).SetText(stringBuilder);
			StringBuilderPool.ReturnStringBuilder(stringBuilder);
			if (ConfigCorruptionDelta.Value)
			{
				for (int i = 0; i < CorruptionDeltaNoticeList.Count; i++)
				{
					CorruptionDeltaNotice corruptionDeltaNotice = CorruptionDeltaNoticeList[i];
					if (corruptionDeltaNotice.ElementTimer >= 2f)
					{
						CorruptionDeltaNoticeObjects[i].SetActive(false);
						CorruptionDeltaNoticeList.RemoveAt(i);
					}
					else if (CorruptionDeltaNoticeObjects[i].activeSelf)
					{
						corruptionDeltaNotice.ElementTimer += Time.fixedDeltaTime;
					}
				}
			}
			else
			{
				foreach (GameObject corruptionDeltaNoticeObject in CorruptionDeltaNoticeObjects)
				{
					corruptionDeltaNoticeObject.SetActive(false);
				}
			}
			UpdateCorruptionTimer(self);
		}

		private void RecursiveFindGameObjectChildren(Transform gameObjectTransform, int indentCount)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			foreach (Transform item in gameObjectTransform)
			{
				Transform val = item;
				string text = "";
				int i;
				for (i = 0; i <= indentCount; i++)
				{
					text += "\t";
				}
				Debug.Log((object)(text + (object)((Component)val).gameObject));
				RecursiveFindGameObjectChildren(((Component)val).transform, i + 1);
			}
		}

		private GameObject GenerateCorruptionDeltaHudElement(string name, float ypos, GameObject overlayInstance, float fontSize = -1f)
		{
			//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_0018: 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_002a: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			GameObject val = new GameObject(name);
			val.transform.SetParent(overlayInstance.transform, false);
			RectTransform obj = val.AddComponent<RectTransform>();
			obj.anchorMin = Vector2.zero;
			obj.anchorMax = Vector2.one;
			obj.sizeDelta = Vector2.zero;
			obj.anchoredPosition = new Vector2(30f, ypos);
			TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val2).alignment = (TextAlignmentOptions)513;
			((TMP_Text)val2).horizontalAlignment = (HorizontalAlignmentOptions)1;
			((TMP_Text)val2).verticalAlignment = (VerticalAlignmentOptions)512;
			if (fontSize != -1f)
			{
				((TMP_Text)val2).fontSize = fontSize;
			}
			return val;
		}

		private void VoidSurvivorController_OnOverlayInstanceAdded(orig_OnOverlayInstanceAdded orig, VoidSurvivorController self, OverlayController controller, GameObject instance)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: 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_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: 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_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Expected O, but got Unknown
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Expected O, but got Unknown
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Expected O, but got Unknown
			CorruptionDeltaNoticeObjects = new List<GameObject>();
			CorruptionDeltaNoticeObjects.Add(GenerateCorruptionDeltaHudElement("CorruptionDeltaNumber", 60f, instance));
			CorruptionDeltaNoticeObjects.Add(GenerateCorruptionDeltaHudElement("CorruptionDeltaNumber2", 85f, instance, 24f));
			CorruptionDeltaNoticeObjects.Add(GenerateCorruptionDeltaHudElement("CorruptionDeltaNumber3", 105f, instance, 24f));
			CorruptionTimerObject = new GameObject("CorruptionTimerObject");
			CorruptionTimerObject.transform.SetParent(instance.transform, false);
			RectTransform val = CorruptionTimerObject.AddComponent<RectTransform>();
			val.anchorMin = Vector2.zero;
			val.anchorMax = Vector2.one;
			val.sizeDelta = Vector2.zero;
			val.anchoredPosition = new Vector2(-145f, 2.5f);
			TimerText val2 = CorruptionTimerObject.AddComponent<TimerText>();
			val2.format = ScriptableObject.CreateInstance<TimerStringFormatter>();
			Unit[] array = Array.Empty<Unit>();
			if (self.maxCorruption / Mathf.Abs(self.corruptionFractionPerSecondWhileCorrupted * 100f) > 60f || self.maxCorruption / self.corruptionPerSecondOutOfCombat > 60f || self.maxCorruption / self.corruptionPerSecondInCombat > 60f)
			{
				array = CollectionExtensions.AddToArray<Unit>(array, new Unit
				{
					name = "minutes",
					conversionRate = 60.0,
					maxDigits = 2u,
					minDigits = 2u,
					prefix = string.Empty,
					suffix = ":"
				});
				val.anchoredPosition = new Vector2(-135f, 2.5f);
			}
			array = CollectionExtensions.AddRangeToArray<Unit>(array, (Unit[])(object)new Unit[2]
			{
				new Unit
				{
					name = "seconds",
					conversionRate = 1.0,
					maxDigits = 2u,
					minDigits = 2u,
					prefix = string.Empty,
					suffix = string.Empty
				},
				new Unit
				{
					name = "centiseconds",
					conversionRate = 0.01,
					maxDigits = 2u,
					minDigits = 2u,
					prefix = "<voffset=0.4em><size=40%><mspace=0.5em>.",
					suffix = "</size></voffset></mspace>"
				}
			});
			val2.format.format = new Format
			{
				prefix = "<mspace=0.5em>",
				suffix = "</mspace>",
				units = array
			};
			TextMeshProUGUI obj = (val2.targetLabel = CorruptionTimerObject.AddComponent<TextMeshProUGUI>());
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj).horizontalAlignment = (HorizontalAlignmentOptions)2;
			((TMP_Text)obj).verticalAlignment = (VerticalAlignmentOptions)512;
			CorruptionTimerObject.SetActive(false);
			GameObject val3 = null;
			foreach (Transform item in instance.transform)
			{
				Transform val4 = item;
				if (!(((Object)((Component)val4).gameObject).name == "FillRoot"))
				{
					continue;
				}
				foreach (Transform item2 in val4)
				{
					Transform val5 = item2;
					if (!(((Object)((Component)val5).gameObject).name == "Fill"))
					{
						continue;
					}
					foreach (Transform item3 in val5)
					{
						Transform val6 = item3;
						if (((Object)((Component)val6).gameObject).name == "Fill")
						{
							val3 = ((Component)val6).gameObject;
						}
					}
				}
			}
			if ((Object)(object)val3 != (Object)null)
			{
				GameObject obj2 = Object.Instantiate<GameObject>(val3);
				((Object)obj2).name = "FillSuppressHealDelta";
				SuppressDeltaImageObject = obj2.GetComponent<Image>();
				((Graphic)SuppressDeltaImageObject).color = ConfigSuppressHealDeltaColor.Value;
				obj2.transform.SetParent(val3.transform.parent, false);
				obj2.transform.SetSiblingIndex(1);
			}
			orig.Invoke(self, controller, instance);
		}

		private void VoidSurvivorController_OnCorruptionModified(orig_OnCorruptionModified orig, VoidSurvivorController self, float newCorruption)
		{
			float corruption = self.corruption;
			orig.Invoke(self, newCorruption);
			if (self.isPermanentlyCorrupted || !ConfigCorruptionDelta.Value)
			{
				return;
			}
			float num = newCorruption - corruption;
			float num2 = (self.characterBody.HasBuff(self.corruptedBuffDef) ? (self.corruptionFractionPerSecondWhileCorrupted * (self.maxCorruption - self.minimumCorruption)) : (self.characterBody.outOfCombat ? self.corruptionPerSecondOutOfCombat : self.corruptionPerSecondInCombat));
			if (Mathf.Approximately(num, num2 * Time.fixedDeltaTime) || Mathf.Abs(num) == 100f)
			{
				return;
			}
			CorruptionDeltaNotice corruptionDeltaNotice = new CorruptionDeltaNotice
			{
				ElementTimer = 0f
			};
			StringBuilder stringBuilder = StringBuilderPool.RentStringBuilder();
			if (num > 0f)
			{
				corruptionDeltaNotice.PositiveDelta = true;
				stringBuilder.Append("+");
			}
			else
			{
				corruptionDeltaNotice.PositiveDelta = false;
			}
			if (ConfigCorruptionPercentageTweak.Value && self.isCorrupted)
			{
				num = num / (self.maxCorruption - self.minimumCorruption) * 100f;
			}
			else if (!self.isCorrupted && corruption + newCorruption < self.minimumCorruption)
			{
				num = 0f - (corruption - self.corruption);
			}
			if (!(Mathf.Abs(num) < 1f))
			{
				StringBuilderExtensions.AppendInt(stringBuilder, Mathf.FloorToInt(num), 1u, 3u).Append("%");
				corruptionDeltaNotice.DeltaValue = stringBuilder.ToString();
				StringBuilderPool.ReturnStringBuilder(stringBuilder);
				if (CorruptionDeltaNoticeList.Count >= 3)
				{
					CorruptionDeltaNoticeList.RemoveRange(2, CorruptionDeltaNoticeList.Count - 2);
				}
				CorruptionDeltaNoticeList.Insert(0, corruptionDeltaNotice);
				CorruptionDeltaNoticeList.TrimExcess();
				UpdateCorruptionDeltaNotices();
			}
		}

		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_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_0053: 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_0066: 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_00eb: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			Log.Init(((BaseUnityPlugin)this).Logger);
			SpecialSkillDefs.Add(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/VoidSurvivor/CrushCorruption.asset").WaitForCompletion(), GetSerializedValues(Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.CrushCorruption.asset").WaitForCompletion().serializedFieldsCollection.serializedFields));
			CorruptedSpecialSkillDefs.Add(Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC1/VoidSurvivor/CrushHealth.asset").WaitForCompletion(), GetSerializedValues(Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/DLC1/VoidSurvivor/EntityStates.VoidSurvivor.Weapon.CrushHealth.asset").WaitForCompletion().serializedFieldsCollection.serializedFields));
			ConfigCorruptionPercentageTweak = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Always decrement corruption to 0%", true, "When in corrupted mode, always decrement the hud percentage from 100% to 0% regardless of increased minimum.\n\nDirect changes to the percentage, such as the \"Corrupted Suppress\" ability will appear to change the percentage more than they actually do!\nI recommend using \"Show Suppress Corruption Delta\" with this option to make these changes a bit clearer\n\nDefault: True");
			ConfigSuppressHealDelta = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Show Meter Suppress Heal Delta", false, "Show on the corruption meter how much will be removed by Suppress\n\nDefault: False");
			ConfigSuppressHealDeltaColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI Tweaks", "Meter Suppress Heal Delta Color", new Color(0.58984375f, 17f / 64f, 0.375f, 1f), "The color that will be used if \"Show Suppress Heal Delta\" is enabled\n\nDefault: 964460FF");
			ConfigSuppressCorruptDelta = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Show Meter Suppress Corruption Delta", false, "Show on the corruption meter how much will be added by Corrupted Suppress\n\nDefault: False");
			ConfigSuppressCorruptDeltaColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI Tweaks", "Meter Suppress Corruption Delta Color", new Color(89f / 128f, 0.15234375f, 23f / 128f, 1f), "The color that will be used if \"Show Suppress Corruption Delta\" is enabled\n\nDefault: B2272EFF");
			ConfigCorruptionDelta = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Show Corruption Delta Notices", false, "Show next to the corruption UI the exact amount added or removed to your corruption percentage\nPassive corruption buildup/removal is not shown as part of this delta\nDelta is also hidden if you are permanently corrupted\n\nDefault: False");
			ConfigCorruptionDeltaPositiveColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI Tweaks", "Corruption Delta Notice Positive Color", Color.green, "The color that will be used for positive corruption changes if \"Show Corruption Delta Notice\" is enabled\n\nDefault: 00FF00FF");
			ConfigCorruptionDeltaNegativeColor = ((BaseUnityPlugin)this).Config.Bind<Color>("UI Tweaks", "Corruption Delta Notice Negative Color", Color.red, "The color that will be used for positive corruption changes if \"Show Corruption Delta Notice\" is enabled\n\nDefault: FF0000FF");
			ConfigShowCorruptionTimerWhenUncorrupted = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Show Corruption Timer", false, "Show timer until corrupted underneath corruption UI\n\nDefault: False");
			ConfigShowCorruptionTimerWhenCorrupted = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Show Corruption Timer While Corrupted", false, "Show timer until no longer corrupted underneath corruption UI\n\nDefault: False");
			ConfigShowPermaCorruptionMin = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Tweaks", "Clamp Corruption Percentage to 100%", true, "When disabled, show the minimum corruption when permanently corrupted rather than capping it to 100%\nJust for fun.\n\nDefault: True");
			if (RiskOfOptionsCompatibility.Enabled)
			{
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigCorruptionPercentageTweak);
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigSuppressHealDelta);
				RiskOfOptionsCompatibility.AddColorOption(ConfigSuppressHealDeltaColor, () => !ConfigSuppressHealDelta.Value);
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigSuppressCorruptDelta);
				RiskOfOptionsCompatibility.AddColorOption(ConfigSuppressCorruptDeltaColor, () => !ConfigSuppressCorruptDelta.Value);
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigCorruptionDelta);
				RiskOfOptionsCompatibility.AddColorOption(ConfigCorruptionDeltaPositiveColor, () => !ConfigCorruptionDelta.Value);
				RiskOfOptionsCompatibility.AddColorOption(ConfigCorruptionDeltaNegativeColor, () => !ConfigCorruptionDelta.Value);
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigShowCorruptionTimerWhenUncorrupted);
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigShowCorruptionTimerWhenCorrupted);
				RiskOfOptionsCompatibility.AddCheckBoxOption(ConfigShowPermaCorruptionMin);
				RiskOfOptionsCompatibility.InvokeSetModDescription("Tweak various things about the Void Fiend corruption hud to fit your liking");
			}
		}

		public Dictionary<string, string> GetSerializedValues(SerializedField[] serializedFields)
		{
			//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_0015: 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)
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			foreach (SerializedField val in serializedFields)
			{
				dictionary.Add(val.fieldName, val.fieldValue.stringValue);
			}
			return new Dictionary<string, string>(dictionary);
		}
	}
}