Decompiled source of RiskUIFixed v1.0.2

RiskUIFIxed.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates.Drifter.Bag;
using HG.Reflection;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using ScavengerBingo;
using SimpleJSON;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.UI;
using Zio;
using ZioConfigFile;
using ZioRiskOfOptions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RiskUIFIxed")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RiskUIFIxed")]
[assembly: AssemblyTitle("RiskUIFIxed")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExamplePlugin
{
	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);
		}
	}
}
namespace MaterialHud
{
	public class AddressablePrefabLoader : MonoBehaviour
	{
		public string Address;

		public bool defaultActiveState = true;

		private void OnValidate()
		{
			Awake();
		}

		private void Awake()
		{
			//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)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)Address).WaitForCompletion();
			Object.Instantiate<GameObject>(val, ((Component)this).transform).SetActive(defaultActiveState);
		}
	}
	public class BepinConfigParentManager : MonoBehaviour, IConfigHandler
	{
		public Transform[] choices;

		public string category;

		public string key;

		public string description;

		private ZioConfigEntry<int> _configEntry;

		public void Awake()
		{
			Startup();
			((ZioConfigEntryBase)_configEntry).SettingChanged += ConfigUpdated;
		}

		private void OnEnable()
		{
			ConfigUpdated(null, null, arg3: false);
		}

		public void OnDestroy()
		{
			((ZioConfigEntryBase)_configEntry).SettingChanged -= ConfigUpdated;
		}

		private void ConfigUpdated(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			int num = Math.Min(choices.Length - 1, _configEntry.Value);
			((Component)this).transform.SetParent(choices[num], false);
		}

		public void Startup()
		{
			_configEntry = ConfigHelper.Bind(category, key, 0, description, null, choices.Length - 1);
		}
	}
	public class BepinScaleController : MonoBehaviour
	{
		public string Category;

		public string Key;

		public string Description;

		private ZioConfigEntry<float> _configValue;

		private void Awake()
		{
			_configValue = ConfigHelper.Bind(Category, Key, 100f, Description, null, 300f);
			((ZioConfigEntryBase)_configValue).SettingChanged += SettingChanged;
		}

		private void OnEnable()
		{
			SettingChanged(null, null, arg3: false);
		}

		private void OnDestroy()
		{
			((ZioConfigEntryBase)_configValue).SettingChanged -= SettingChanged;
		}

		private void SettingChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			//IL_0019: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			float num = _configValue.Value / 100f;
			Vector3 localScale = ((Component)this).transform.localScale;
			localScale.y = num;
			localScale.x = num;
			((Component)this).transform.localScale = localScale;
		}
	}
	public class BepinVerticalSpacing : MonoBehaviour
	{
		private ZioConfigEntry<float> configEntry;

		public string desc;

		public string key;

		private GridLayoutGroup target;

		public float Value
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return target.spacing.y;
			}
			set
			{
				//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_001b: Unknown result type (might be due to invalid IL or missing references)
				Vector2 spacing = target.spacing;
				spacing.y = value;
				target.spacing = spacing;
			}
		}

		private void Awake()
		{
			target = ((Component)this).GetComponent<GridLayoutGroup>();
			configEntry = ConfigHelper.Bind("Repositioning", key, Value, desc, null, 200f);
			((ZioConfigEntryBase)configEntry).SettingChanged += SettingChanged;
		}

		private void OnEnable()
		{
			SettingChanged(null, null, arg3: false);
		}

		private void OnDestroy()
		{
			((ZioConfigEntryBase)configEntry).SettingChanged -= SettingChanged;
		}

		private void SettingChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			Value = configEntry.Value;
		}
	}
	public class CloneFillValue : MonoBehaviour
	{
		public Image from;

		private Image _to;

		private void Awake()
		{
			_to = ((Component)this).GetComponent<Image>();
		}

		private void Update()
		{
			_to.fillAmount = from.fillAmount;
		}
	}
	public class CombatHealthBarLoader : MonoBehaviour
	{
		public CombatHealthBarViewer viewer;

		private static GameObject HealthBar => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/CombatHealthbar.prefab").WaitForCompletion();

		public void Start()
		{
			viewer.healthBarPrefab = HealthBar;
		}
	}
	public static class ConfigHelper
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<ZioConfigEntryBase, object, bool> <>9__8_0;

			public static UnityAction <>9__10_0;

			public static UnityAction <>9__10_1;

			internal void <get_SelectedProfile>b__8_0(ZioConfigEntryBase _, object profile, bool _)
			{
				SelectedProfile = (int)profile;
			}

			internal void <MakeSelectedProfileOptions>b__10_0()
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Expected O, but got Unknown
				configFiles.Add(new ZioConfigFile(whichFile.FileSystem, UPath.op_Implicit($"{UPathExtensions.GetDirectory(whichFile.FilePath)}/RiskUI/{default(Guid)}"), true, whichFile.OwnerMetadata));
				option.max = configFiles.Count - 1;
			}

			internal void <MakeSelectedProfileOptions>b__10_1()
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				whichFile.FileSystem.DeleteFile(configFiles[SelectedProfile].FilePath);
				configFiles.RemoveAt(SelectedProfile);
				option.max = configFiles.Count - 1;
			}
		}

		public static Dictionary<string, ZioConfigEntryBase> Entries = new Dictionary<string, ZioConfigEntryBase>();

		private static ZioConfigEntry<int> _selectedProfile;

		private static IntSliderConfig option;

		public static ZioConfigFile whichFile => RiskUIPlugin.ConfigFile;

		public static List<ZioConfigFile> configFiles => RiskUIPlugin.ConfigFiles;

		public static int SelectedProfile
		{
			get
			{
				if (_selectedProfile != null)
				{
					return _selectedProfile.Value;
				}
				_selectedProfile = whichFile.Bind<int>("Profiles", "Selected Profile", 0, "Currently selected profile.");
				((ZioConfigEntryBase)_selectedProfile).SettingChanged += delegate(ZioConfigEntryBase _, object profile, bool _)
				{
					SelectedProfile = (int)profile;
				};
				if (RiskUIPlugin.RiskOfOptionsEnabled)
				{
					MakeSelectedProfileOptions();
				}
				return _selectedProfile.Value;
			}
			set
			{
				_selectedProfile.Value = value;
				foreach (KeyValuePair<ConfigDefinition, ZioConfigEntryBase> item in whichFile)
				{
					if (!(item.Key == ((ZioConfigEntryBase)_selectedProfile).Definition))
					{
						ApplyConfigProfile(item.Value);
					}
				}
			}
		}

		private static void MakeSelectedProfileOptions()
		{
			//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_001d: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			option = new IntSliderConfig
			{
				max = configFiles.Count - 1
			};
			ModSettingsManager.AddOption((BaseOption)new ZioIntSliderOption(_selectedProfile, option));
			object obj = <>c.<>9__10_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					//IL_001a: Unknown result type (might be due to invalid IL or missing references)
					//IL_001f: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					//IL_004c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0056: Expected O, but got Unknown
					configFiles.Add(new ZioConfigFile(whichFile.FileSystem, UPath.op_Implicit($"{UPathExtensions.GetDirectory(whichFile.FilePath)}/RiskUI/{default(Guid)}"), true, whichFile.OwnerMetadata));
					option.max = configFiles.Count - 1;
				};
				<>c.<>9__10_0 = val;
				obj = (object)val;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Add Profile", "Profiles", (UnityAction)obj));
			object obj2 = <>c.<>9__10_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					//IL_001a: Unknown result type (might be due to invalid IL or missing references)
					whichFile.FileSystem.DeleteFile(configFiles[SelectedProfile].FilePath);
					configFiles.RemoveAt(SelectedProfile);
					option.max = configFiles.Count - 1;
				};
				<>c.<>9__10_1 = val2;
				obj2 = (object)val2;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Delete Profile", "Profiles", (UnityAction)obj2));
		}

		public static ZioConfigEntry<T> Bind<T>(string category, string key, T defaultValue, string desc, [CanBeNull] Action<ZioConfigEntry<T>> firstSetupCallback = null, object riskOfOptionsExtra = null)
		{
			string key2 = category + key;
			if (!Entries.ContainsKey(key2))
			{
				ZioConfigEntry<T> val = RiskUIPlugin.ConfigFile.Bind<T>(category, key, defaultValue, desc);
				((ZioConfigEntryBase)val).SettingChanged += UpdateSelectedProfile;
				foreach (ZioConfigFile configFile in RiskUIPlugin.ConfigFiles)
				{
					configFile.Bind<T>(category, key, defaultValue, desc);
				}
				ApplyConfigProfile((ZioConfigEntryBase)(object)val);
				if (RiskUIPlugin.RiskOfOptionsEnabled)
				{
					FillRiskOfOptions<T>(val, riskOfOptionsExtra);
				}
				Entries.Add(key2, (ZioConfigEntryBase)(object)val);
				firstSetupCallback?.Invoke(val);
			}
			return (ZioConfigEntry<T>)(object)Entries[key2];
		}

		private static void UpdateSelectedProfile(ZioConfigEntryBase arg1, object arg2, bool arg3)
		{
			configFiles[SelectedProfile][arg1.Definition].BoxedValue = arg1.BoxedValue;
		}

		private static void ApplyConfigProfile(ZioConfigEntryBase configEntry)
		{
			if (RiskUIPlugin.NeverBeforeInitialized)
			{
				UpdateSelectedProfile(configEntry, null, arg3: false);
			}
			else
			{
				configEntry.BoxedValue = configFiles[SelectedProfile][configEntry.Definition].BoxedValue;
			}
		}

		private static void FillRiskOfOptions<T>(ZioConfigEntry<T> configEntry, object riskOfOptionsExtra = null)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Expected O, but got Unknown
			//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_007c: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			//IL_0087: 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_009d: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			if (!(configEntry is ZioConfigEntry<string> val))
			{
				if (!(configEntry is ZioConfigEntry<bool> val2))
				{
					if (!(configEntry is ZioConfigEntry<int> val3))
					{
						if (!(configEntry is ZioConfigEntry<float> val4))
						{
							if (configEntry is ZioConfigEntry<Color> val5)
							{
								ModSettingsManager.AddOption((BaseOption)new ZioColorOption(val5));
							}
						}
						else
						{
							ModSettingsManager.AddOption((BaseOption)new ZioSliderOption(val4, new SliderConfig
							{
								max = (float)riskOfOptionsExtra
							}));
						}
					}
					else
					{
						ModSettingsManager.AddOption((BaseOption)new ZioIntSliderOption(val3, new IntSliderConfig
						{
							max = (int)riskOfOptionsExtra
						}));
					}
				}
				else
				{
					ModSettingsManager.AddOption((BaseOption)new ZioCheckBoxOption(val2));
				}
			}
			else
			{
				ModSettingsManager.AddOption((BaseOption)new ZioStringInputFieldOption(val));
			}
		}
	}
	public class DifficultyTextController : MonoBehaviour, IConfigHandler
	{
		public TextMeshProUGUI text;

		public string[] segmentTokens;

		public Image ringImage;

		public Image ringBehind;

		public RedToColorRemapperIndividual textRecolorer;

		public RedToColorRemapperIndividual ringRecolorer;

		public RedToColorRemapperIndividual ringBehindRecolorer;

		public RedToColorRemapperIndividual timerTextRecolorer;

		public RedToColorRemapperIndividual timerCentiTextRecolorer;

		public TextMeshProUGUI monsterLevel;

		public float levelsPerSegment = 3f;

		private int _previousSegment = -1;

		private ZioConfigEntry<bool> _textRecolor;

		private ZioConfigEntry<bool> _ringLowerRecolor;

		private ZioConfigEntry<bool> _ringRecolor;

		private ZioConfigEntry<bool> _timerRecolor;

		private ZioConfigEntry<bool> _timerCentiRecolor;

		private ZioConfigEntry<bool> _monsterLevelEnabled;

		public static readonly Color[] DifficultyColors = (Color[])(object)new Color[9]
		{
			new Color(0.28627452f, 0.9490196f, 0.8509804f),
			new Color(0.2627451f, 83f / 85f, 38f / 85f),
			new Color(1f, 0.8862745f, 0.4f),
			new Color(1f, 0.6627451f, 0.2627451f),
			new Color(1f, 0.4862745f, 12f / 85f),
			new Color(1f, 0.4f, 0.2627451f),
			new Color(1f, 0.2627451f, 12f / 85f),
			new Color(1f, 0.101960786f, 0.101960786f),
			new Color(0.827451f, 0f, 0f)
		};

		private void Awake()
		{
			Debug.Log((object)"Difficulty controler ran");
			text = ((Component)this).GetComponent<TextMeshProUGUI>();
			segmentTokens = new string[9];
			segmentTokens[0] = "Easy";
			segmentTokens[1] = "Normal";
			segmentTokens[2] = "Hard";
			segmentTokens[3] = "Very Hard";
			segmentTokens[4] = "Insane";
			segmentTokens[5] = "Impossible";
			segmentTokens[6] = "i see you";
			segmentTokens[7] = "I'm coming for you";
			segmentTokens[8] = "HAHAHHAHAHAHAHHAHAH";
			textRecolorer = new RedToColorRemapperIndividual();
			ringRecolorer = new RedToColorRemapperIndividual();
			ringBehindRecolorer = new RedToColorRemapperIndividual();
			timerTextRecolorer = new RedToColorRemapperIndividual();
			timerCentiTextRecolorer = new RedToColorRemapperIndividual();
			GameObject val = GameObject.Find("RiskUI(Clone)");
			GameObject val2 = HarmonyPatches.FindRecursive(val.transform, "Monster Level");
			if ((Object)(object)val2 != (Object)null)
			{
				Debug.Log((object)("Found MLevel: " + (object)val2));
				monsterLevel = val2.GetComponent<TextMeshProUGUI>();
			}
			textRecolorer.target = (MonoBehaviour)(object)text;
			ringRecolorer.target = (MonoBehaviour)(object)ringImage;
			ringBehindRecolorer.target = (MonoBehaviour)(object)ringBehind;
			timerTextRecolorer.target = (MonoBehaviour)(object)HarmonyPatches.FindRecursive(val.transform, "Seconds").GetComponent<TextMeshProUGUI>();
			timerCentiTextRecolorer.target = (MonoBehaviour)(object)HarmonyPatches.FindRecursive(val.transform, "CentiSeconds").GetComponent<TextMeshProUGUI>();
			Debug.Log((object)text);
			Startup();
			((ZioConfigEntryBase)_textRecolor).SettingChanged += TextColorerChanged;
			((ZioConfigEntryBase)_ringLowerRecolor).SettingChanged += RingLowerColorerChanged;
			((ZioConfigEntryBase)_ringRecolor).SettingChanged += RingColorerChanged;
			((ZioConfigEntryBase)_timerRecolor).SettingChanged += TimerColorerChanged;
			((ZioConfigEntryBase)_timerCentiRecolor).SettingChanged += CentiColorerChanged;
			((ZioConfigEntryBase)_monsterLevelEnabled).SettingChanged += MonsterLevelChanged;
		}

		private void MonsterLevelChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Component)monsterLevel).gameObject.SetActive(_monsterLevelEnabled.Value);
		}

		private void OnDestroy()
		{
			((ZioConfigEntryBase)_textRecolor).SettingChanged -= TextColorerChanged;
			((ZioConfigEntryBase)_ringLowerRecolor).SettingChanged -= RingLowerColorerChanged;
			((ZioConfigEntryBase)_ringRecolor).SettingChanged -= RingColorerChanged;
			((ZioConfigEntryBase)_timerRecolor).SettingChanged -= TimerColorerChanged;
			((ZioConfigEntryBase)_timerCentiRecolor).SettingChanged -= CentiColorerChanged;
		}

		private void RingColorerChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Behaviour)ringRecolorer).enabled = !_ringRecolor.Value;
			UpdateColors();
		}

		private void RingLowerColorerChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Behaviour)ringBehindRecolorer).enabled = !_ringLowerRecolor.Value;
			UpdateColors();
		}

		private void TextColorerChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Behaviour)textRecolorer).enabled = !_textRecolor.Value;
			UpdateColors();
		}

		private void CentiColorerChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Behaviour)timerCentiTextRecolorer).enabled = !_timerCentiRecolor.Value;
			UpdateColors();
		}

		private void TimerColorerChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((Behaviour)timerTextRecolorer).enabled = !_timerRecolor.Value;
			UpdateColors();
		}

		public void Update()
		{
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				float num = Run.instance.ambientLevel - 1f;
				float num2 = num / levelsPerSegment;
				int num3 = Mathf.FloorToInt(num2);
				float fillAmount = num2 - (float)num3;
				if (num3 >= segmentTokens.Length)
				{
					fillAmount = 1f;
				}
				if (_monsterLevelEnabled.Value)
				{
					((TMP_Text)monsterLevel).text = Language.GetStringFormatted("AMBIENT_LEVEL_DISPLAY_FORMAT", new object[1] { Mathf.FloorToInt(num + 1f) });
				}
				int num4 = Math.Min(segmentTokens.Length - 1, num3);
				if (num4 != _previousSegment)
				{
					((TMP_Text)text).text = Language.GetString(segmentTokens[num4]).ToUpper();
					_previousSegment = num4;
					UpdateColors();
				}
				ringImage.fillAmount = fillAmount;
			}
		}

		private void UpdateColors()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				int num = Math.Max(0, _previousSegment);
				Color color = DifficultyColors[num];
				if (_ringRecolor.Value)
				{
					((Graphic)(Image)ringRecolorer.target).color = color;
				}
				if (_ringLowerRecolor.Value)
				{
					((Graphic)(Image)ringBehindRecolorer.target).color = color;
				}
				if (_textRecolor.Value)
				{
					((Graphic)(TextMeshProUGUI)textRecolorer.target).color = color;
				}
				if (_timerRecolor.Value)
				{
					((Graphic)(TextMeshProUGUI)timerTextRecolorer.target).color = color;
				}
				if (_timerCentiRecolor.Value)
				{
					((Graphic)(TextMeshProUGUI)timerCentiTextRecolorer.target).color = color;
				}
			}
		}

		public void Startup()
		{
			_textRecolor = ConfigHelper.Bind("General", "Difficulty Text Colored Per Difficulty", defaultValue: false, "Should the difficulty text be recolored based on current difficulty.");
			_ringLowerRecolor = ConfigHelper.Bind("General", "Difficulty Lower Ring Colored Per Difficulty", defaultValue: false, "Should the difficulty lower ring be recolored based on current difficulty.");
			_ringRecolor = ConfigHelper.Bind("General", "Difficulty Upper Ring Colored Per Difficulty", defaultValue: false, "Should the difficulty upper ring be recolored based on current difficulty.");
			_timerRecolor = ConfigHelper.Bind("General", "Timer Text Colored Per Difficulty", defaultValue: false, "Should the timer text be recolored based on current difficulty.");
			_timerCentiRecolor = ConfigHelper.Bind("General", "Centisecond Timer Text Colored Per Difficulty", defaultValue: false, "Should the timer centisecond text be recolored based on current difficulty.");
			_monsterLevelEnabled = ConfigHelper.Bind("General", "Monster Level Text Enable", defaultValue: false, "Should the monster level text be displayed.");
		}
	}
	[HarmonyPatch]
	public static class DisableSynergies
	{
		public static void DisableFunction(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.Index += 3;
			val.Emit(OpCodes.Ret);
		}
	}
	public class FieldLoader : MonoBehaviour
	{
		public string addressablePath;

		public string targetFieldName;

		public MonoBehaviour target;

		private static readonly MethodInfo LoadAsset = typeof(Addressables).GetMethod("LoadAssetAsync", new Type[1] { typeof(string) });

		public void Start()
		{
			Type type = ((object)target).GetType();
			FieldInfo field = type.GetField(targetFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (!(field == null))
			{
				MethodInfo methodInfo = LoadAsset.MakeGenericMethod(field.FieldType);
				object obj = methodInfo.Invoke(null, new object[1] { addressablePath });
				MethodInfo method = obj.GetType().GetMethod("WaitForCompletion", BindingFlags.Instance | BindingFlags.Public);
				object value = method.Invoke(obj, null);
				field.SetValue(target, value);
			}
		}
	}
	[HarmonyPatch]
	public static class HarmonyPatches
	{
		public static readonly Type hBar = typeof(HealthBar);

		[HarmonyPostfix]
		[HarmonyPatch(typeof(CameraRigController), "GetHUDPath")]
		public static void RedirectHUDToAssetBundle(ref string __result)
		{
			__result = "RiskUI/RiskUI_HUD";
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CameraRigController), "UpdateHUD")]
		public static bool ReplaceHUDInUpdateHUD(CameraRigController __instance)
		{
			try
			{
				if (!__instance.createHud)
				{
					return true;
				}
				if (Object.op_Implicit((Object)(object)__instance.hud))
				{
					Object.Destroy((Object)(object)((Component)__instance.hud).gameObject);
				}
				GameObject val = RiskUIPlugin.CreateHud();
				if ((Object)(object)val == (Object)null)
				{
					return true;
				}
				GameObject val2 = Object.Instantiate<GameObject>(val);
				__instance.hud = val2.GetComponent<HUD>();
				if ((Object)(object)__instance.hud == (Object)null)
				{
					Object.Destroy((Object)(object)val2);
					return true;
				}
				Canvas component = ((Component)__instance.hud).GetComponent<Canvas>();
				if ((Object)(object)component != (Object)null)
				{
					if ((Object)(object)component.worldCamera == (Object)null)
					{
						component.worldCamera = __instance.uiCam;
						Debug.Log((object)"Assigned uiCam to HUD Canvas");
					}
				}
				else
				{
					Debug.LogError((object)"HUD is missing Canvas component!");
				}
				__instance.hud.cameraRigController = __instance;
				CrosshairManager component2 = ((Component)__instance.hud).GetComponent<CrosshairManager>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.cameraRigController = __instance;
				}
				__instance.hud.localUserViewer = __instance.localUserViewer;
				CameraRigController.OnHUDUpdated?.Invoke();
				Debug.Log((object)"Custom RiskUI HUD loaded successfully");
				return false;
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error in ReplaceHUDInUpdateHUD: {arg}");
				return true;
			}
		}

		[HarmonyILManipulator]
		[HarmonyPatch(typeof(HealthBar), "UpdateBarInfos")]
		public static void FixInfusionColor(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, hBar, "voidPanelColor")
			});
			val.Remove();
			val.EmitDelegate<Func<Color>>((Func<Color>)delegate
			{
				//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_000c: 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_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
				Color value3 = RiskUIPlugin.VoidColor.Value;
				return (value3 == Color.clear) ? Color.HSVToRGB(Mathf.Sin(Time.time) * 0.5f + 0.5f, 1f, 1f) : value3;
			});
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, hBar, "infusionPanelColor")
			});
			val.Remove();
			val.EmitDelegate<Func<Color>>((Func<Color>)delegate
			{
				//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_000c: 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_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
				Color value2 = RiskUIPlugin.InfusionColor.Value;
				return (value2 == Color.clear) ? Color.HSVToRGB(Mathf.Sin(Time.time) * 0.5f + 0.5f, 1f, 1f) : value2;
			});
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, hBar, "voidShieldsColor")
			});
			val.Remove();
			val.EmitDelegate<Func<Color>>((Func<Color>)delegate
			{
				//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_000c: 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_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
				Color value = RiskUIPlugin.VoidShieldColor.Value;
				return (value == Color.clear) ? Color.HSVToRGB(Mathf.Sin(Time.time) * 0.5f + 0.5f, 1f, 1f) : value;
			});
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Run), "InstantiateUi")]
		public static void ReplaceUIPrefab(Run __instance)
		{
			try
			{
				if ((__instance.nameToken == "ECLIPSE_GAMEMODE_NAME" || __instance.nameToken == "GAMEMODE_CLASSIC_RUN_NAME") && (Object)(object)__instance.uiPrefab != (Object)null)
				{
					__instance.uiPrefab = RiskUIPlugin.CreateClassicRunHud();
				}
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error in ReplaceUIPrefab: {arg}");
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DifficultyDef), "GetIconSprite")]
		public static bool SwapIcon(DifficultyDef __instance, ref Sprite __result)
		{
			if (__instance.nameToken == null || !RiskUIPlugin.DifficultyIconMap.ContainsKey(__instance.nameToken))
			{
				return true;
			}
			__result = RiskUIPlugin.DifficultyIconMap[__instance.nameToken];
			return false;
		}

		[HarmonyILManipulator]
		[HarmonyPatch(typeof(AllyCardManager), "Awake")]
		public static void ReplaceAllyCards(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Prefabs/UI/AllyCard")
			});
			val.RemoveRange(2);
			val.EmitDelegate<Func<GameObject>>((Func<GameObject>)RiskUIPlugin.CreateAllyCard);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(AllyCardController), "Awake")]
		public static void AllyCardFix(AllyCardController __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("droneitem");
			val.transform.position = ((Component)__instance).transform.position;
			__instance.droneItemIndicatorObj = val;
		}

		public static void MoveVoidSurvivorController(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<VoidSurvivorController>(x, "overlayChildLocatorEntry")
			});
			val.RemoveRange(2);
			val.Emit(OpCodes.Ldstr, "BottomLeftCluster");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(EnemyInfoPanel), "Init")]
		public static void ChangeMonsterInventory()
		{
			EnemyInfoPanel.panelPrefab = RiskUIPlugin.EnemyInfoPanel;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ObjectivePanelController), "AddObjectiveTracker")]
		public static bool ReplaceObjectiveTrackerPrefab(ObjectivePanelController __instance)
		{
			__instance.objectiveTrackerPrefab = RiskUIPlugin.CreateObjectiveTracker();
			Debug.Log((object)__instance.objectiveTrackerPrefab);
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ObjectiveTracker), "SetStrip")]
		public static bool StripFix(ObjectiveTracker __instance, GameObject stripObject)
		{
			try
			{
				Debug.Log((object)"=== StripFix Patch ===");
				Debug.Log((object)$"stripObject is null: {(Object)(object)stripObject == (Object)null}");
				Debug.Log((object)$"__instance is null: {__instance == null}");
				if ((Object)(object)stripObject == (Object)null)
				{
					Debug.LogError((object)"stripObject is NULL!");
					return true;
				}
				__instance.stripObject = stripObject;
				Transform val = stripObject.transform.Find("Label");
				Debug.Log((object)$"Label transform found: {(Object)(object)val != (Object)null}");
				if ((Object)(object)val != (Object)null)
				{
					__instance.label = ((Component)val).GetComponent<TextMeshProUGUI>();
					Debug.Log((object)$"Label component: {(Object)(object)__instance.label != (Object)null}");
				}
				else
				{
					Debug.LogError((object)"Could not find 'Label' transform!");
				}
				Transform val2 = stripObject.transform.Find("Checkbox");
				Debug.Log((object)$"Checkbox transform found: {(Object)(object)val2 != (Object)null}");
				if ((Object)(object)val2 != (Object)null)
				{
					__instance.checkbox = ((Component)val2).GetComponent<Image>();
					Debug.Log((object)$"Checkbox component: {(Object)(object)__instance.checkbox != (Object)null}");
				}
				else
				{
					Debug.LogError((object)"Could not find 'Checkbox' transform!");
				}
				if ((Object)(object)__instance.label != (Object)null && (Object)(object)__instance.checkbox != (Object)null)
				{
					__instance.UpdateStrip();
					Debug.Log((object)"UpdateStrip called successfully");
				}
				else
				{
					Debug.LogError((object)"Missing required components - skipping UpdateStrip");
				}
				Debug.Log((object)"=== End StripFix ===");
				return false;
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error in StripFix: {arg}");
				return true;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ContextManager), "Awake")]
		public static bool ReplaceContextManagerUpdate(ContextManager __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			__instance.inspectDisplay = new GameObject("instanceDisplay");
			__instance.contextDisplay = new GameObject("ContextDisplay");
			GameObject val = new GameObject("InspectGlyph");
			GameObject val2 = new GameObject("InspectDescription");
			val.transform.SetParent(__instance.inspectDisplay.transform);
			val2.transform.SetParent(__instance.inspectDisplay.transform);
			__instance.inspectGlyphTMP = val.AddComponent<TextMeshProUGUI>();
			__instance.inspectDescriptionTMP = val2.AddComponent<TextMeshProUGUI>();
			GameObject val3 = new GameObject("ContextGlyph");
			GameObject val4 = new GameObject("ContextDescription");
			val3.transform.SetParent(__instance.contextDisplay.transform);
			val4.transform.SetParent(__instance.contextDisplay.transform);
			__instance.glyphTMP = val3.AddComponent<TextMeshProUGUI>();
			__instance.descriptionTMP = val4.AddComponent<TextMeshProUGUI>();
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CombatHealthBarViewer), "Awake")]
		public static bool CombatHealthPrefabFix(CombatHealthBarViewer __instance)
		{
			__instance.healthBarPrefab = FindPrefab("Assets/RoR2/Base/UI/HUD/CombatHealthbar.prefab");
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(NotificationUIController), "SetUpNotification")]
		public static bool NotificationPrefabFix(NotificationUIController __instance)
		{
			__instance.genericNotificationPrefab = FindPrefab("Assets/RoR2/Base/UI/HUD/NotificationPanels/NotificationPanel2.prefab");
			__instance.genericTransformationNotificationPrefab = FindPrefab("Assets/RoR2/Base/UI/HUD/NotificationPanels/GenericTransformationNotificationPanel.prefab");
			__instance.cloverVoidTransformationNotificationPrefab = FindPrefab("Assets/RoR2/DLC1/Items/CloverVoid/CloverVoidTransformationNotificationPanel.prefab");
			__instance.droneRepairNotificationPrefab = FindPrefab("Assets/RoR2/DLC3/UI/NotificationPanels/DroneRepairNotificationPanel.prefab");
			__instance.teleportOnLowHealthRegenTransformationNotificationPrefab = FindPrefab("Assets/RoR2/DLC2/Items/LowerPricedChests/TeleportOnLowHealthRegenTransformationNotificationPanel.prefab");
			__instance.contagiousVoidTransformationNotificationPrefab = FindPrefab("Assets/RoR2/DLC1/UI/HUD/NotificationPanels/VoidTransformationNotificationPanel.prefab");
			__instance.regeneratingScrapRegenTransformationNotificationPrefab = FindPrefab("Assets/RoR2/DLC1/Items/RegeneratingScrap/RegeneratingScrapRegenTransformationNotificationPanel.prefab");
			__instance.LowerPricedChestsRegenTransformationNotificationPrefab = FindPrefab("Assets/RoR2/DLC2/Items/LowerPricedChests/LowerPricedChestsRegenTransformationNotificationPanel.prefab");
			return true;
		}

		public static bool ItemIconPrefabFix(ItemIcon __instance)
		{
			return true;
		}

		public static bool SpriteAsNumberManagerPrefabFix(SpriteAsNumberManager __instance)
		{
			__instance.imagePrefab = FindPrefab("Assets/RoR2/Base/UI/SpriteText/Visual_Assets/SpriteNumberImage.prefab").transform;
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ItemInventoryDisplay), "Awake")]
		public static bool DebugIID(ItemInventoryDisplay __instance)
		{
			__instance.itemIconPrefab = FindPrefab("Assets/RoR2/Base/UI/ItemIcon.prefab");
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUD), "Awake")]
		public static bool ScoreBoardPatch(HUD __instance)
		{
			__instance.scoreboardPanel = GameObject.Find("ScoreboardPanel");
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUD), "Awake")]
		public static void DifFix(HUD __instance)
		{
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			GameObject val = GameObject.Find("RiskUI(Clone)");
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			GameObject val2 = FindRecursive(val.transform, "DifficultyText");
			if ((Object)(object)val2 != (Object)null)
			{
				Debug.Log((object)("Found Text: " + (object)val2));
				val2.AddComponent<DifficultyTextController>();
			}
			GameObject val3 = FindRecursive(val.transform, "HorizontalLayout");
			if ((Object)(object)val3 == (Object)null)
			{
				Debug.LogError((object)"Could not find HorizontalLayout");
			}
			else
			{
				GameObject val4 = FindRecursive(val3.transform, "Image");
				if ((Object)(object)val4 != (Object)null)
				{
					Debug.Log((object)("Found BackRing: " + (object)val4));
					val2.GetComponent<DifficultyTextController>().ringBehind = val4.GetComponent<Image>();
				}
				GameObject val5 = FindRecursive(val.transform, "Top");
				if ((Object)(object)val5 != (Object)null)
				{
					Debug.Log((object)("Found Ring: " + (object)val5));
					val2.GetComponent<DifficultyTextController>().ringImage = val5.GetComponent<Image>();
				}
			}
			GameObject val6 = FindRecursive(val.transform, "TextContainer");
			if ((Object)(object)val6 != (Object)null)
			{
				GameObject val7 = FindRecursive(val.transform, "ItemContainer");
				val7.AddComponent<Image>();
				((Behaviour)val7.GetComponent<Image>()).enabled = false;
			}
			GameObject val8 = FindRecursive(val.transform, "ScoreboardPanel");
			if ((Object)(object)val8 != (Object)null)
			{
			}
			GameObject val9 = FindRecursive(val.transform, "BottomRightCluster");
			if ((Object)(object)val9 != (Object)null)
			{
				GameObject val10 = FindRecursive(val.transform, "Scaler");
				GameObject val11 = new GameObject("UtilityArea");
				val11.transform.SetParent(val10.transform);
				GameObject val12 = new GameObject("DisplayRoot");
				val12.transform.SetParent(val11.transform);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SkillIcon), "Update")]
		public static bool SkillFix(SkillIcon __instance)
		{
			float cooldownRemaining = __instance.targetSkill.cooldownRemaining;
			float num = __instance.targetSkill.CalculateFinalRechargeInterval();
			float fillAmount = Mathf.Clamp01(1f - cooldownRemaining / num);
			GameObject val = FindRecursive(((Component)__instance).transform, "OnCooldown");
			Image component = FindRecursive(((Component)__instance).transform, "Mask").GetComponent<Image>();
			if (cooldownRemaining == 0f)
			{
				((Behaviour)component).enabled = false;
				val.SetActive(false);
			}
			else
			{
				((Behaviour)component).enabled = true;
				val.SetActive(true);
			}
			component.fillAmount = fillAmount;
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ScoreboardStrip), "SetMaster")]
		public static void SbFixfinal(ScoreboardStrip __instance, CharacterMaster newMaster)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			GameObject val = GameObject.Find("RiskUI(Clone)");
			GameObject val2 = GameObject.Find("RoR2Application");
			GameObject val3 = FindRecursive(val2.transform, "MPEventSystem Player0");
			GameObject val4 = new GameObject("ItemCount");
			val4.transform.parent = ((Component)__instance).transform;
			GameObject val5 = new GameObject("nameFocusHiglight");
			val5.transform.parent = ((Component)__instance).transform;
			val5.AddComponent<Image>();
			val4.AddComponent<HGTextMeshProUGUI>();
			__instance.itemCountText = (TextMeshProUGUI)(object)val4.GetComponent<HGTextMeshProUGUI>();
			__instance.nameFocusHighlight = val5.GetComponent<Image>();
			UIInputPassthrough val6 = ((Component)__instance).gameObject.AddComponent<UIInputPassthrough>();
			((Behaviour)val6).enabled = true;
			val6.OnlyAllowMovement = true;
			MPEventSystemLocator val7 = ((Component)__instance).gameObject.AddComponent<MPEventSystemLocator>();
			((Behaviour)val7).enabled = true;
			val7.eventSystemProvider = val.GetComponent<MPEventSystemProvider>();
			val7.eventSystem = val3.GetComponent<MPEventSystem>();
			UILayerSetFromParent val8 = ((Component)__instance).gameObject.AddComponent<UILayerSetFromParent>();
			((Behaviour)val8).enabled = false;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BaggedObject), "OnEnter")]
		public static void FixDrifterUI(BaggedObject __instance)
		{
			__instance.uiOverlayPrefab = FindPrefab("Assets/RoR2/DLC3/Characters/Drifter/Skills/Passive/Bag UI.prefab");
		}

		[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPatch(typeof(HUDBossHealthBarController), "<ApplyBars>g__HandleBar|37_0")]
		public static void CallHandleBar(Image targetImage, ref BarInfo healthInfo, ref BarInfo oldHealthInfo)
		{
		}

		[HarmonyPatch(typeof(HUDBossHealthBarController), "ApplyBars")]
		[HarmonyPrefix]
		private static void AfterApplyBars(HUDBossHealthBarController __instance)
		{
			Debug.Log((object)"Running Bars");
			GameObject val = FindRecursive(((Component)__instance).gameObject.transform, "Center");
			GameObject val2 = FindRecursive(val.transform, "FillPanelRight");
			Image targetImage = default(Image);
			if (val2.TryGetComponent<Image>(ref targetImage))
			{
				Debug.Log((object)"Got RightBar");
				CallHandleBar(targetImage, ref __instance.healthInfo, ref __instance.oldHealthInfo);
			}
			GameObject val3 = FindRecursive(((Component)__instance).gameObject.transform, "Delayed");
			GameObject val4 = FindRecursive(val3.transform, "FillPanelRight");
			Image targetImage2 = default(Image);
			if (val4.TryGetComponent<Image>(ref targetImage2))
			{
				Debug.Log((object)"Got RightDelay");
				CallHandleBar(targetImage2, ref __instance.healthInfo, ref __instance.oldHealthInfo);
			}
		}

		public static GameObject FindPrefab(string name)
		{
			GameObject val = null;
			foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
			{
				val = allLoadedAssetBundle.LoadAsset<GameObject>(name);
				if ((Object)(object)val != (Object)null)
				{
					Debug.Log((object)("RiskUI: Found Prefab: " + name));
					return val;
				}
			}
			Debug.Log((object)("RiskUI: Didnt find Prefab: " + name));
			return val;
		}

		public static GameObject FindRecursive(Transform parent, string name)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			if (((Object)parent).name == name)
			{
				return ((Component)parent).gameObject;
			}
			foreach (Transform item in parent)
			{
				Transform parent2 = item;
				GameObject val = FindRecursive(parent2, name);
				if ((Object)(object)val != (Object)null)
				{
					return val;
				}
			}
			return null;
		}
	}
	public class HideFromBepinConfig : MonoBehaviour, IConfigHandler
	{
		public GameObject target;

		public string configName;

		public string configDesc;

		public string configCategory;

		public bool defaultValue;

		private ZioConfigEntry<bool> _configEntry;

		public void Awake()
		{
			Startup();
			((ZioConfigEntryBase)_configEntry).SettingChanged += SettingChanged;
			SettingChanged();
		}

		public void OnDestroy()
		{
			((ZioConfigEntryBase)_configEntry).SettingChanged -= SettingChanged;
		}

		private void SettingChanged(ZioConfigEntryBase config, object oldValue, bool ignoreSave)
		{
			SettingChanged();
		}

		private void SettingChanged()
		{
			target.SetActive(_configEntry.Value);
		}

		public void Startup()
		{
			_configEntry = ConfigHelper.Bind(configCategory, configName, defaultValue, configDesc);
		}
	}
	public class HideIfFirst : MonoBehaviour
	{
		public GameObject target;

		public int position;

		private void Awake()
		{
			target.SetActive(((Component)this).transform.GetSiblingIndex() != position);
		}
	}
	public class MaterialEquipmentIcon : MonoBehaviour
	{
		public EquipmentIcon icon;

		public Image onCooldown;

		public Image mask;

		public TextMeshProUGUI stockText;

		public GameObject keyText;

		public void Update()
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00b3: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			if (!icon.hasEquipment)
			{
				((Component)((TMP_Text)stockText).transform.parent).gameObject.SetActive(false);
				mask.fillAmount = 0f;
				((Behaviour)onCooldown).enabled = false;
				return;
			}
			EquipmentState val = (icon.displayAlternateEquipment ? icon.targetInventory.alternateEquipmentState : icon.targetInventory.currentEquipmentState);
			FixedTimeStamp now = FixedTimeStamp.now;
			FixedTimeStamp chargeFinishTime = val.chargeFinishTime;
			((Behaviour)onCooldown).enabled = ((DisplayData)(ref icon.currentDisplayData)).showCooldown;
			float num = Mathf.Max(0f, chargeFinishTime - now);
			if (float.IsPositiveInfinity(num))
			{
				num = 0f;
			}
			float cooldown = val.equipmentDef.cooldown;
			bool flag = true;
			cooldown *= icon.targetInventory.CalculateEquipmentCooldownScale();
			mask.fillAmount = num / cooldown;
			((Component)((TMP_Text)stockText).transform.parent).gameObject.SetActive(icon.currentDisplayData.maxStock > 1);
		}
	}
	public class MaterialSkillIcon : MonoBehaviour
	{
		public Image onCooldown;

		public SkillIcon icon;

		public Image mask;

		public TextMeshProUGUI stockText;

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)icon.targetSkill))
			{
				float cooldownRemaining = icon.targetSkill.cooldownRemaining;
				float num = icon.targetSkill.CalculateFinalRechargeInterval();
				bool flag = num >= float.Epsilon;
				mask.fillAmount = (flag ? (cooldownRemaining / num) : 0f);
				((Behaviour)onCooldown).enabled = flag && icon.targetSkill.stock <= 0 && mask.fillAmount > float.Epsilon;
				if (icon.targetSkill.maxStock > 1)
				{
					((Component)((TMP_Text)stockText).transform.parent).gameObject.SetActive(true);
				}
				else
				{
					((Component)((TMP_Text)stockText).transform.parent).gameObject.SetActive(false);
				}
			}
		}
	}
	public class NotificationAreaLoader : MonoBehaviour
	{
		public NotificationUIController controller;

		private static GameObject genericNotificationPrefab => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/NotificationPanel2.prefab").WaitForCompletion();

		private static GameObject genericTransformationNotificationPrefab => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/GenericTransformationNotificationPanel.prefab").WaitForCompletion();

		private static GameObject contagiousVoidTransformationNotificationPrefab => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/UI/VoidTransformationNotificationPanel.prefab").WaitForCompletion();

		private static GameObject cloverVoidTransformationNotificationPrefab => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/CloverVoid/CloverVoidTransformationNotificationPanel.prefab").WaitForCompletion();

		private static GameObject regeneratingScrapRegenTransformationNotificationPrefab => Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapRegenTransformationNotificationPanel.prefab").WaitForCompletion();

		public void Start()
		{
			controller.genericNotificationPrefab = genericNotificationPrefab;
			controller.genericTransformationNotificationPrefab = genericTransformationNotificationPrefab;
			controller.contagiousVoidTransformationNotificationPrefab = contagiousVoidTransformationNotificationPrefab;
			controller.cloverVoidTransformationNotificationPrefab = cloverVoidTransformationNotificationPrefab;
			controller.regeneratingScrapRegenTransformationNotificationPrefab = regeneratingScrapRegenTransformationNotificationPrefab;
		}
	}
	public class HealthbarRecolor : MonoBehaviour, IConfigHandler
	{
		public class HealthBarConfig
		{
			private static readonly Type StyleType = typeof(HealthBarStyle);

			public HealthBarStyle style;

			private readonly FieldInfo _fieldInfo;

			private ZioConfigEntry<Color> _configValue;

			private bool rainbow;

			public Color Color
			{
				get
				{
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					return ((BarStyle)_fieldInfo.GetValue(style)).baseColor;
				}
				set
				{
					//IL_0012: Unknown result type (might be due to invalid IL or missing references)
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_001a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
					BarStyle val = (BarStyle)_fieldInfo.GetValue(style);
					val.baseColor = value;
					_fieldInfo.SetValue(style, val);
				}
			}

			public HealthBarConfig(string category, string key, string desc, string field, HealthBarStyle styleIn, bool b)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				style = styleIn;
				_fieldInfo = StyleType.GetField(field, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
				_configValue = ConfigHelper.Bind<Color>(category, key, Color, desc);
				if (b)
				{
					((ZioConfigEntryBase)_configValue).SettingChanged += ConfigChanged;
				}
			}

			public void Destroy()
			{
				((ZioConfigEntryBase)_configValue).SettingChanged -= ConfigChanged;
			}

			public void ConfigChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
			{
				//IL_0008: 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_0023: Unknown result type (might be due to invalid IL or missing references)
				rainbow = _configValue.Value == Color.clear;
				Color = _configValue.Value;
			}

			public void Update(Color color)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				if (rainbow)
				{
					Color = color;
				}
			}
		}

		public string whichBar = "Player HealthBar";

		public HealthBar healthBar;

		private readonly Dictionary<string, HealthBarConfig> entries = new Dictionary<string, HealthBarConfig>();

		public void Awake()
		{
			Startup(b: true);
			OnEnable();
		}

		private void OnEnable()
		{
			foreach (KeyValuePair<string, HealthBarConfig> entry in entries)
			{
				entry.Value.ConfigChanged(null, null, arg3: false);
			}
		}

		private void SetupConfig(string key, string desc, HealthBarStyle style, string field, bool b)
		{
			string key2 = "Recoloring " + whichBar + key;
			HealthBarConfig value = new HealthBarConfig("Recoloring " + whichBar, key, desc, field, style, b);
			entries[key2] = value;
		}

		private void OnDestroy()
		{
			foreach (KeyValuePair<string, HealthBarConfig> entry in entries)
			{
				entry.Value.Destroy();
			}
		}

		private void Update()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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)
			Color color = Color.HSVToRGB(Mathf.Sin(Time.time) * 0.5f + 0.5f, 1f, 1f);
			foreach (KeyValuePair<string, HealthBarConfig> entry in entries)
			{
				entry.Value.Update(color);
			}
		}

		public void Startup(bool b)
		{
			HealthBarStyle style = healthBar.style;
			SetupConfig("Trailing Under", "When hurt the bit that is slow to catch up.", style, "trailingUnderHealthBarStyle", b);
			SetupConfig("Instant Health", "From medkits, etc.", style, "instantHealthBarStyle", b);
			SetupConfig("Trailing Over", "The general color of the healthbar.", style, "trailingOverHealthBarStyle", b);
			SetupConfig("Shield", "Shield", style, "shieldBarStyle", b);
			SetupConfig("Curse", "Curse refers to having Shaped glass / anything that temporarily lowers max HP & normally leaves you w/ the white outlined section.", style, "curseBarStyle", b);
			SetupConfig("Barrier", "Barrier", style, "barrierBarStyle", b);
			SetupConfig("Flash", "?", style, "flashBarStyle", b);
			SetupConfig("Cull", "Cull refers to things like guillotine / freeze, and is only seen when an allied minion (turret / zoea / drone, etc..) is hit by a Glacial Elite's death effect radius. Cull can't be applied to players however.", style, "cullBarStyle", b);
			SetupConfig("Low Health Over", "Color for delicate watches and things like that.", style, "lowHealthOverStyle", b);
			SetupConfig("Low Health Under", "?", style, "lowHealthUnderStyle", b);
			SetupConfig("Magnetic", "A unused??? healthbar style.", style, "magneticStyle", b);
			SetupConfig("OSP", "One shot protection color.", style, "ospStyle", b);
		}

		public void Startup()
		{
			Startup(b: false);
		}
	}
	public class RedToColorRemapperIndividual : MonoBehaviour, IConfigHandler
	{
		public string configKey;

		public string configDesc;

		private Color defaultColor;

		private ZioConfigEntry<Color> _configEntry;

		public MonoBehaviour target;

		private bool _rainbow;

		public void Startup()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			defaultColor = GetColor();
			_configEntry = ConfigHelper.Bind<Color>("Recoloring", configKey, defaultColor, configDesc);
		}

		public void Awake()
		{
			Startup();
			((ZioConfigEntryBase)_configEntry).SettingChanged += UpdateColor;
		}

		private void OnEnable()
		{
			UpdateColor();
		}

		private void OnDestroy()
		{
			((ZioConfigEntryBase)_configEntry).SettingChanged -= UpdateColor;
		}

		private void UpdateColor(ZioConfigEntryBase config, object oldValue, bool ignoreSave)
		{
			UpdateColor();
		}

		private void SetColor(Color color)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			MonoBehaviour val = target;
			MonoBehaviour val2 = val;
			TextMeshProUGUI val3 = (TextMeshProUGUI)(object)((val2 is TextMeshProUGUI) ? val2 : null);
			if (val3 == null)
			{
				Image val4 = (Image)(object)((val2 is Image) ? val2 : null);
				if (val4 == null)
				{
					HealthBar val5 = (HealthBar)(object)((val2 is HealthBar) ? val2 : null);
					if (val5 != null)
					{
						val5.style.trailingOverHealthBarStyle.baseColor = color;
					}
				}
				else
				{
					((Graphic)val4).color = color;
				}
			}
			else
			{
				((Graphic)val3).color = color;
			}
		}

		private Color GetColor()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			MonoBehaviour val = target;
			MonoBehaviour val2 = val;
			TextMeshProUGUI val3 = (TextMeshProUGUI)(object)((val2 is TextMeshProUGUI) ? val2 : null);
			if (val3 == null)
			{
				Image val4 = (Image)(object)((val2 is Image) ? val2 : null);
				if (val4 == null)
				{
					return ((HealthBar)(((val2 is HealthBar) ? val2 : null)?)).style.trailingOverHealthBarStyle.baseColor ?? Color.black;
				}
				return ((Graphic)val4).color;
			}
			return ((Graphic)val3).color;
		}

		private void UpdateColor()
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			if (_configEntry.Value == Color.clear)
			{
				_rainbow = true;
			}
			else
			{
				SetColor(_configEntry.Value);
			}
		}

		private void Update()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (_rainbow)
			{
				SetColor(Color.HSVToRGB(Mathf.Sin(Time.time) * 0.5f + 0.5f, 1f, 1f));
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("bubbet.riskui", "Risk UI", "1.4.0")]
	public class RiskUIPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__28_0;

			public static UnityAction <>9__28_1;

			internal void <MakeRiskofOptions>b__28_0()
			{
				Application.OpenURL("https://github.com/Bubbet/Risk-Of-Rain-Mods/issues/new");
			}

			internal void <MakeRiskofOptions>b__28_1()
			{
				Application.OpenURL("https://ko-fi.com/bubbet");
			}
		}

		public AssetBundle assetBundle;

		private static GameObject _newHud;

		private static GameObject _newClassicRunHud;

		private static GameObject _newSimulacrumHud;

		private static GameObject _allyCard;

		private static GameObject _ObjectiveTracker;

		public static GameObject BaseWaveUI;

		public static GameObject EnemyInfoPanel;

		public static readonly Dictionary<string, Sprite> DifficultyIconMap = new Dictionary<string, Sprite>();

		public static ZioConfigEntry<Color> VoidColor;

		public static ZioConfigEntry<Color> InfusionColor;

		public static ZioConfigEntry<Color> VoidShieldColor;

		public static ZioConfigFile ConfigFile;

		private string description;

		private Sprite icon;

		public static ZioConfigEntry<bool> Enabled;

		private Harmony harm;

		private PatchClassProcessor patcher;

		public static readonly List<ZioConfigFile> ConfigFiles = new List<ZioConfigFile>();

		public static bool NeverBeforeInitialized;

		public static bool RiskOfOptionsEnabled => Chainloader.PluginInfos.ContainsKey("bubbet.zioriskofoptions");

		public void Awake()
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0094: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogMessage((object)"Loaded");
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			try
			{
				JSONNode val = JSON.Parse(File.OpenText(Path.Combine(directoryName, "manifest.json")).ReadToEnd());
				description = ((object)val["description"]).ToString();
				byte[] array = File.ReadAllBytes(Path.Combine(directoryName, "icon.png"));
				Texture2D val2 = new Texture2D(256, 256);
				ImageConversion.LoadImage(val2, array);
				icon = Sprite.Create(val2, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f));
			}
			catch (Exception)
			{
			}
			harm = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			patcher = new PatchClassProcessor(harm, typeof(HarmonyPatches));
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(onLoad));
			assetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "riskui"));
			_newHud = assetBundle.LoadAsset<GameObject>("RiskUI");
			_newClassicRunHud = assetBundle.LoadAsset<GameObject>("MaterialClassicRunInfoHudPanel");
			_allyCard = assetBundle.LoadAsset<GameObject>("MaterialAllyCard");
			EnemyInfoPanel = assetBundle.LoadAsset<GameObject>("MaterialMonsterItemInventory");
			_ObjectiveTracker = assetBundle.LoadAsset<GameObject>("MaterialObjectiveStrip");
			_newSimulacrumHud = assetBundle.LoadAsset<GameObject>("MaterialSimulacrum");
			BaseWaveUI = assetBundle.LoadAsset<GameObject>("MaterialDefaultWaveUI");
			DifficultyIconMap["SUNNY_NAME"] = assetBundle.LoadAsset<Sprite>("Sunny (More Difficulties)");
			DifficultyIconMap["RAINSOON_NAME"] = assetBundle.LoadAsset<Sprite>("ThunderStorm (More Difficulties)");
			DifficultyIconMap["HIFU_DIFFICULTY_NAME"] = assetBundle.LoadAsset<Sprite>("Inferno (Inferno)");
			DifficultyIconMap["DIFFICULTY_CONFIGURABLEDIFFICULTYMOD_NAME"] = assetBundle.LoadAsset<Sprite>("Pluviculture (ConfigurableDifficulty)");
			DifficultyIconMap["Mico27_DIFFICULTY_TROPICALSTORM_NAME"] = assetBundle.LoadAsset<Sprite>("Tropical Storm (Tropical Storm)");
			DifficultyIconMap["GROOVYDIFFICULTY_4_NAME"] = assetBundle.LoadAsset<Sprite>("Deluge (UntitledDifficultyMod)");
			DifficultyIconMap["CALYPSO_NAME"] = assetBundle.LoadAsset<Sprite>("Calypso (More Difficulties)");
			DifficultyIconMap["GROOVYDIFFICULTY_5_NAME"] = assetBundle.LoadAsset<Sprite>("Charybdis (UntitledDifficultyMod)");
			DifficultyIconMap["TEMPEST_NAME"] = assetBundle.LoadAsset<Sprite>("Tempest (More Difficulties)");
			DifficultyIconMap["SCYLLA_NAME"] = assetBundle.LoadAsset<Sprite>("Armageddon (More Difficulties)");
			DifficultyIconMap["DIFFICULTY_EASY_NAME"] = assetBundle.LoadAsset<Sprite>("Drizzle");
			DifficultyIconMap["DIFFICULTY_NORMAL_NAME"] = assetBundle.LoadAsset<Sprite>("Rainstorm");
			DifficultyIconMap["DIFFICULTY_HARD_NAME"] = assetBundle.LoadAsset<Sprite>("Monsoon");
		}

		private void FixScavBingo()
		{
			BingoUI.BingoAchievementDisplay.AddComponent<LayoutElement>().ignoreLayout = true;
		}

		private void onLoad()
		{
			//IL_000b: 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_001c: Expected O, but got Unknown
			//IL_0027: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Expected O, but got Unknown
			ConfigFile = new ZioConfigFile(RoR2Application.cloudStorage, UPath.op_Implicit("/RiskUI.cfg"), true, (BaseUnityPlugin)(object)this);
			foreach (UPath item in FileSystemExtensions.EnumeratePaths((IFileSystem)(object)RoR2Application.cloudStorage, new UPath("/RiskUI/")))
			{
				ConfigFiles.Add(new ZioConfigFile(RoR2Application.cloudStorage, item, true, (BaseUnityPlugin)(object)this));
			}
			if (ConfigFiles.Count < 1)
			{
				NeverBeforeInitialized = true;
				ConfigFiles.Add(new ZioConfigFile(RoR2Application.cloudStorage, UPath.op_Implicit($"/RiskUI/{default(Guid)}"), true, (BaseUnityPlugin)(object)this));
			}
			Enabled = ConfigHelper.Bind("General", "Enabled", defaultValue: true, "Should the hud be replaced. Only updates on hud awake, so stage change and starting new runs.");
			((ZioConfigEntryBase)Enabled).SettingChanged += EnabledChanged;
			EnabledChanged();
			VoidColor = ConfigHelper.Bind<Color>("Recoloring Player HealthBar", "Void Color", Color32.op_Implicit(new Color32((byte)181, (byte)100, (byte)189, byte.MaxValue)), "Color of void, Void Fiends health bar.");
			InfusionColor = ConfigHelper.Bind<Color>("Recoloring Player HealthBar", "Infusion Color", Color32.op_Implicit(new Color32((byte)221, (byte)44, (byte)38, byte.MaxValue)), "Color of infusion.");
			VoidShieldColor = ConfigHelper.Bind<Color>("Recoloring Player HealthBar", "Void Shield Color", Color32.op_Implicit(new Color32((byte)229, (byte)127, (byte)240, byte.MaxValue)), "Color of void shield.");
			if (RiskOfOptionsEnabled)
			{
				MakeRiskofOptions();
			}
			if (Chainloader.PluginInfos.ContainsKey("com.Dragonyck.Synergies") && Chainloader.PluginInfos["com.Dragonyck.Synergies"].Metadata.Version <= new Version("2.0.3"))
			{
				DisableSynergies();
			}
			if (Chainloader.PluginInfos.ContainsKey("com.groovesalad.ScavengerBingo"))
			{
				FixScavBingo();
			}
			IConfigHandler[] componentsInChildren = _newHud.GetComponentsInChildren<IConfigHandler>();
			foreach (IConfigHandler configHandler in componentsInChildren)
			{
				configHandler.Startup();
			}
		}

		private void DisableSynergies()
		{
		}

		private void EnabledChanged()
		{
			if (Enabled.Value)
			{
				patcher.Patch();
			}
			else
			{
				harm.UnpatchSelf();
			}
		}

		private void EnabledChanged(ZioConfigEntryBase arg1, object arg2, bool arg3)
		{
			EnabledChanged();
		}

		private void MakeRiskofOptions()
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_009b: 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_00a6: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)icon))
			{
				ModSettingsManager.SetModIcon(icon);
			}
			if (description != null)
			{
				ModSettingsManager.SetModDescription(description);
			}
			object obj = <>c.<>9__28_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					Application.OpenURL("https://github.com/Bubbet/Risk-Of-Rain-Mods/issues/new");
				};
				<>c.<>9__28_0 = val;
				obj = (object)val;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Report An Issue", "General", "If you find a bug in the mod, reporting an issue is the best way to ensure it gets fixed.", "Open Link", (UnityAction)obj));
			object obj2 = <>c.<>9__28_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					Application.OpenURL("https://ko-fi.com/bubbet");
				};
				<>c.<>9__28_1 = val2;
				obj2 = (object)val2;
			}
			ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Donate to Bubbet", "General", "Donate to the programmer of RiskUI.", "Open Link", (UnityAction)obj2));
		}

		[SystemInitializer(new Type[] { })]
		private void CheckForBetterUI()
		{
			if (Chainloader.PluginInfos.ContainsKey("com.xoxfaby.BetterUI"))
			{
				EditBetterUIConfigs();
			}
		}

		private void EditBetterUIConfigs()
		{
		}

		public static GameObject CreateHud()
		{
			return _newHud;
		}

		public static GameObject CreateClassicRunHud()
		{
			return _newClassicRunHud;
		}

		public static GameObject CreateSimulcrum()
		{
			return _newSimulacrumHud;
		}

		public static GameObject CreateAllyCard()
		{
			return _allyCard;
		}

		public static GameObject CreateObjectiveTracker()
		{
			return _ObjectiveTracker;
		}
	}
	public interface IConfigHandler
	{
		void Startup();
	}
	public class TextSizeBepin : MonoBehaviour, IConfigHandler
	{
		public string Key;

		public string Description;

		public TextMeshProUGUI Target;

		private ZioConfigEntry<float> _configEntry;

		public void Awake()
		{
			Startup();
			((ZioConfigEntryBase)_configEntry).SettingChanged += SettingChanged;
		}

		private void OnEnable()
		{
			SettingChanged(null, null, arg3: false);
		}

		private void OnDestroy()
		{
			((ZioConfigEntryBase)_configEntry).SettingChanged -= SettingChanged;
		}

		private void SettingChanged(ZioConfigEntryBase zioConfigEntryBase, object o, bool arg3)
		{
			((TMP_Text)Target).fontSize = _configEntry.Value;
		}

		public void Startup()
		{
			_configEntry = ConfigHelper.Bind("Rescaling", Key, ((TMP_Text)Target).fontSize, Description, null, 100f);
		}
	}
}