Decompiled source of Health Bar Hider v2.3.1

Mods/HealthBarHider.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HealthBarHider;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI.RMAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(HealthBarHiderClass), "Health Bar Hider", "2.3.1", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 7, 2, true)]
[assembly: AssemblyTitle("HealthBarHider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HealthBarHider")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3550aa35-70e6-42ce-8bf8-abdced19af28")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HealthBarHider;

public class HealthBarHiderClass : MelonMod
{
	[CompilerGenerated]
	private sealed class <hideHealths>d__7 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public HealthBarHiderClass <>4__this;

		private Enumerator<Player> <>s__1;

		private Player <tempPlayer>5__2;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <hideHealths>d__7(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>s__1 = null;
			<tempPlayer>5__2 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(1f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>s__1 = Singleton<PlayerManager>.instance.AllPlayers.GetEnumerator();
				while (<>s__1.MoveNext())
				{
					<tempPlayer>5__2 = <>s__1.Current;
					try
					{
						if ((int)<tempPlayer>5__2.Controller.controllerType == 1)
						{
							((Component)<tempPlayer>5__2.Controller.PlayerUI.localUIBar.Renderer).gameObject.SetActive(!<>4__this.hideSelf);
						}
						else
						{
							((Component)<tempPlayer>5__2.Controller.PlayerUI.remoteUIBar.Renderer).gameObject.SetActive(!<>4__this.hideOthers);
						}
					}
					catch
					{
					}
					<tempPlayer>5__2 = null;
				}
				<>s__1 = null;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private bool hideSelf = false;

	private bool hideOthers = false;

	private Mod HealthbarHider = new Mod();

	public override void OnLateInitializeMelon()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		HealthbarHider.ModName = "Health Bar Hider";
		HealthbarHider.ModVersion = "2.3.1";
		HealthbarHider.SetFolder("HealthbarHider");
		HealthbarHider.AddToList("Hide Self", true, 0, "Turns On/Off Self Health", new Tags());
		HealthbarHider.AddToList("Hide Others", false, 0, "Turns On/Off Others Health", new Tags());
		HealthbarHider.GetFromFile();
		hideSelf = (bool)HealthbarHider.Settings[0].Value;
		hideOthers = (bool)HealthbarHider.Settings[1].Value;
		HealthbarHider.ModSaved += Save;
		UI.instance.UI_Initialized += UIInit;
		Actions.onPlayerSpawned += playerSpawned;
	}

	public void UIInit()
	{
		UI.instance.AddMod(HealthbarHider);
	}

	public void Save()
	{
		hideSelf = (bool)HealthbarHider.Settings[0].Value;
		hideOthers = (bool)HealthbarHider.Settings[1].Value;
		MelonCoroutines.Start(hideHealths());
	}

	private void playerSpawned(Player player)
	{
		MelonCoroutines.Start(hideHealths());
	}

	[IteratorStateMachine(typeof(<hideHealths>d__7))]
	private IEnumerator hideHealths()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <hideHealths>d__7(0)
		{
			<>4__this = this
		};
	}
}