Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BetterHudLite v0.4.1
plugins/BetterHudLite.dll
Decompiled a year agousing System; using System.Collections; 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 EntityStates.Seeker; using On.EntityStates.Seeker; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BetterHudLite")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d304ed89452485c31893f582e12f3e806f6d9742")] [assembly: AssemblyProduct("BetterHudLite")] [assembly: AssemblyTitle("BetterHudLite")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace BetterHudLite; public abstract class BaseHudHandler : MonoBehaviour { protected HUD _hud; public void Init(HUD hud) { _hud = hud; ((MonoBehaviour)this).StartCoroutine(hackyDelayedMoveHud()); } private IEnumerator hackyDelayedMoveHud() { yield return null; MoveHud(); } protected abstract void MoveHud(); } [BepInPlugin("com.TheTimeSweeper.BetterHudLite", "BetterHudLite", "0.4.1")] public class BetterHudLitePlugin : BaseUnityPlugin { public static BetterHudLitePlugin instance; private void Awake() { //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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown instance = this; Confug.doConfig(); AsyncOperationHandle<Sprite> val = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/UI/texUIHighlightHeader.png"); val.Completed += delegate(AsyncOperationHandle<Sprite> handle) { BoxNukerHudHandler.frame = handle.Result; }; HUD.Awake += new hook_Awake(HUD_Awake); try { Meditate.SetupInputUIIcons += new hook_SetupInputUIIcons(MeditationUI_SetupInputUIIcons); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Gearbox oopsie probably\n" + ex)); } } private void HUD_Awake(orig_Awake orig, HUD self) { orig.Invoke(self); if (Confug.doBar) { ((Component)self).gameObject.AddComponent<HealthHudHandler>().Init(self); } if (Confug.doSkills) { ((Component)self).gameObject.AddComponent<SkillsHudHandler>().Init(self); } if (Confug.doNuke) { ((Component)self).gameObject.AddComponent<BoxNukerHudHandler>().Init(self); } } private void MeditationUI_SetupInputUIIcons(orig_SetupInputUIIcons orig, Meditate self) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (Confug.doSkills) { ((Component)self.overlayInstanceChildLocator).transform.localPosition = new Vector3(0f, 120f, 0f); } } private void ShowBoxesGodDang(HUD hud) { Sprite sprite = ((Component)hud.mainUIPanel.transform.Find("SpringCanvas/BottomRightCluster/Scaler/Outline")).GetComponent<Image>().sprite; RectTransform[] componentsInChildren = hud.mainUIPanel.GetComponentsInChildren<RectTransform>(); foreach (RectTransform val in componentsInChildren) { if ((Object)(object)((Component)val).GetComponent<Graphic>() == (Object)null) { Image val2 = ((Component)val).gameObject.AddComponent<Image>(); val2.sprite = sprite; val2.type = (Type)1; } } } } public class BoxNukerHudHandler : BaseHudHandler { public static Sprite frame; protected override void MoveHud() { Image[] componentsInChildren = _hud.mainUIPanel.GetComponentsInChildren<Image>(); for (int i = 0; i < componentsInChildren.Length; i++) { if ((Object)(object)componentsInChildren[i].sprite == (Object)(object)frame) { ((Behaviour)componentsInChildren[i]).enabled = false; } } } } public class Confug { private static bool loadedIcon; private static ConfigEntry<bool> _doBar; private static ConfigEntry<bool> _doSkills; private static ConfigEntry<bool> _hideSkillKeys; private static ConfigEntry<bool> _doNuke; public static ConfigEntry<float> healthBarWidth; public static ConfigEntry<float> healthBarHeight; public static ConfigEntry<float> healthBarX; public static ConfigEntry<float> healthBarY; public static ConfigEntry<float> skillScale; public static ConfigEntry<float> skillsY; public static ConfigEntry<float> skillsX; public static bool doBar { get { reloadConfig(); return _doBar.Value; } } public static bool doSkills { get { reloadConfig(); return _doSkills.Value; } } public static bool HideSkillKeys { get { reloadConfig(); return _hideSkillKeys.Value; } } public static bool doNuke { get { reloadConfig(); return _doNuke.Value; } } private static BetterHudLitePlugin plugin => BetterHudLitePlugin.instance; private static void reloadConfig() { ((BaseUnityPlugin)plugin).Config.Reload(); } public static void doConfig() { string section = "Health UI"; _doBar = BindAndOptions(section, "Do the health bar", defaultValue: true, "Brings the health and level bar to the center"); healthBarWidth = BindAndOptions(section, "Health Bar Width Factor", 1f, "size of health bar, range 0 to 4.5, 0 making it nonexistent, 4.5 making it cover the screen\nless than 0 just shifts it to the right, higher than 4.5 goes off screen obviously"); healthBarHeight = BindAndOptions(section, "Health Bar Height Multiplier", 1f, "multiply health bar height by this value\nexpands both up and down. attempts to move skills with it"); healthBarX = BindAndOptions(section, "Health Bar X", 0f, -1000f, 1000f, "move the health bar left or right"); healthBarY = BindAndOptions(section, "Health Bar Y", 0f, -1000f, 2000f, "move the health bar up or down\n600 is right above crosshair, 400 is right under crosshair"); string section2 = "Skills UI"; _doSkills = BindAndOptions(section2, "Do the skills", defaultValue: true, "Brings the skills to the center above where the health bar is (if that's also enabled)"); skillScale = BindAndOptions(section2, "skills Scale", 1f, "scale (size) of whole skills section"); skillsX = BindAndOptions(section2, "Skills X", 0f, -1000f, 1000f, "move skills left or right"); skillsY = BindAndOptions(section2, "Skills Y", 0f, -1000f, 2000f, "move skills up or down. automatically adjusted by Health Bar Height Multiplier config\n500 is right above crosshair 300 is right under crosshair"); _hideSkillKeys = BindAndOptions(section2, "Hide Skill Keys", defaultValue: false, "Hide the M1, M2, etc under your skills. Woops oversight requires Do The Skills enabled, don't have time to fix sorry"); string section3 = "Other"; _doNuke = BindAndOptions(section3, "Nuke all transparent boxes", defaultValue: false, "Finds all transparent boxes on the hud (like the one around inventory and currencies) and hides them."); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } description += $"\nDefault: {defaultValue}"; if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val = ((BaseUnityPlugin)BetterHudLitePlugin.instance).Config.Bind<T>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption<T>(val, min, max, restartRequired); } return val; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired) { //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_0021: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown if (entry is ConfigEntry<float>) { ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry<float>, new SliderConfig { min = min, max = max, formatString = "{0:0.00}", restartRequired = restartRequired })); } if (entry is ConfigEntry<int>) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry<int>, new IntSliderConfig { min = (int)min, max = (int)max, restartRequired = restartRequired })); } if (entry is ConfigEntry<bool>) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry<bool>, restartRequired)); } if (entry is ConfigEntry<KeyboardShortcut>) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry as ConfigEntry<KeyboardShortcut>, restartRequired)); } if (!loadedIcon) { loadedIcon = true; try { ModSettingsManager.SetModIcon(LoadSpriteFromModFolder("icon.png")); } catch (Exception ex) { Debug.LogError((object)("error adding ROO mod icon\n" + ex)); } } } internal static Sprite LoadSpriteFromModFolder(string fileName, bool pointFilter = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BetterHudLitePlugin.instance).Info.Location), fileName); Texture2D val = new Texture2D(2, 2); byte[] array = File.ReadAllBytes(path); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)((!pointFilter) ? 1 : 0); val.Apply(); if (pointFilter) { ((Texture)val).filterMode = (FilterMode)0; val.Apply(); } ((Object)val).name = fileName; ((Texture)val).filterMode = (FilterMode)0; val.Apply(); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height); Sprite val3 = Sprite.Create(val, val2, new Vector2(0.5f, 0.5f), 16f); ((Object)val3).name = fileName; return val3; } } public class HealthHudHandler : BaseHudHandler { protected override void MoveHud() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_005c: 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_0092: 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) RectTransform val = (RectTransform)_hud.mainUIPanel.transform.Find("SpringCanvas/BottomLeftCluster/BarRoots"); Transform val2 = ((Transform)val).Find("LevelDisplayCluster/BuffDisplayRoot"); val2.SetParent(((Transform)val).parent); ((Transform)val).SetParent(_hud.mainUIPanel.transform.Find("SpringCanvas/BottomCenterCluster")); ((Transform)val).rotation = Quaternion.identity; val.pivot = new Vector2(0.5f, 0.25f); val.anchoredPosition = new Vector2(Confug.healthBarX.Value, Confug.healthBarY.Value); val.sizeDelta = new Vector2(-432f + -432f * (0f - (Confug.healthBarWidth.Value - 1f)), Confug.healthBarHeight.Value * 72f); } } public class SkillsHudHandler : BaseHudHandler { protected override void MoveHud() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_008a: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)_hud.mainUIPanel.transform.Find("SpringCanvas/BottomRightCluster"); RectTransform val2 = (RectTransform)_hud.mainUIPanel.transform.Find("SpringCanvas/BottomCenterCluster"); RectTransform val3 = (RectTransform)_hud.mainUIPanel.transform.Find("SpringCanvas/BottomRightCluster/Scaler"); RectTransform val4 = (RectTransform)((Transform)val3).Find("SprintCluster"); ((Transform)val4).SetParent(((Transform)val3).parent); val4.anchoredPosition = new Vector2(-100f, 0f); val4.anchorMin = new Vector2(1f, 0.5f); val4.anchorMax = new Vector2(1f, 0.5f); RectTransform val5 = (RectTransform)((Transform)val3).Find("InventoryCluster"); ((Transform)val5).SetParent(((Transform)val3).parent); val5.anchoredPosition = new Vector2(-146f, 0f); val5.anchorMin = new Vector2(1f, 0.5f); val5.anchorMax = new Vector2(1f, 0.5f); ((Component)val3).transform.SetParent(_hud.mainUIPanel.transform.Find("SpringCanvas/BottomCenterCluster")); ((Transform)val3).rotation = Quaternion.identity; val3.pivot = new Vector2(0.5f, 0f); val3.sizeDelta = new Vector2(-639f, -234f); float num = Confug.healthBarHeight.Value - 1f; float num2 = 18f; ((Transform)val3).localScale = ((Transform)val3).localScale * Confug.skillScale.Value; val3.anchoredPosition = new Vector2(60f + Confug.skillsX.Value, 80f + num * num2 + Confug.skillsY.Value); InputBindingDisplayController[] componentsInChildren = ((Component)val3).GetComponentsInChildren<InputBindingDisplayController>(); foreach (InputBindingDisplayController val6 in componentsInChildren) { if (Confug.HideSkillKeys) { ((Component)((Component)val6).transform.parent).gameObject.SetActive(false); continue; } Transform parent = ((Component)val6).transform.parent; Vector3 localPosition = parent.localPosition; localPosition.y += 9f; parent.localPosition = localPosition; Image component = ((Component)parent).GetComponent<Image>(); Color color = ((Graphic)component).color; color.a = 0.76f; ((Graphic)component).color = color; } ((Component)((Transform)val3).Find("UtilityArea")).transform.localPosition = new Vector3(-363f, 0f, 0f); GraphicRaycaster component2 = ((Component)val).GetComponent<GraphicRaycaster>(); GraphicRaycaster val7 = ((Component)val2).gameObject.AddComponent<GraphicRaycaster>(); val7.blockingObjects = component2.blockingObjects; val7.ignoreReversedGraphics = component2.ignoreReversedGraphics; ((MonoBehaviour)val7).useGUILayout = ((MonoBehaviour)component2).useGUILayout; RectTransform val8 = (RectTransform)_hud.mainUIPanel.transform.parent.Find("NotificationArea"); val8.anchorMin = new Vector2(0.8f, 0.05f); val8.anchorMax = new Vector2(0.8f, 0.05f); RectTransform val9 = (RectTransform)((Transform)val2).Find("SpectatorLabel"); val9.anchoredPosition = new Vector2(0f, 150f); } }