Decompiled source of Health Bar Hider v2.2.0

Mods/HealthBarHider.dll

Decompiled a week 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;
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.2.0", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 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 <hideEnemyHealths>d__8 : 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 <hideEnemyHealths>d__8(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
			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;
					if ((Object)(object)<tempPlayer>5__2.Controller != (Object)(object)Singleton<PlayerManager>.instance.localPlayer.Controller)
					{
						((Component)((Component)<tempPlayer>5__2.Controller).gameObject.transform.GetChild(6).GetChild(1)).gameObject.SetActive(!<>4__this.hideOthers);
					}
					<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_0049: 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_005b: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Expected O, but got Unknown
		HealthbarHider.ModName = "Health Bar Hider";
		HealthbarHider.ModVersion = "2.2.0";
		HealthbarHider.SetFolder("HealthbarHider");
		HealthbarHider.AddDescription("Description", "Description", "Toggles Healthbars on Everyone", new Tags
		{
			IsSummary = true
		});
		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[1].Value;
		hideOthers = (bool)HealthbarHider.Settings[2].Value;
		HealthbarHider.ModSaved += Save;
		UI.instance.UI_Initialized += UIInit;
		Calls.onMapInitialized += mapInit;
		Calls.onPlayerSpawned += playerSpawned;
	}

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

	public void Save()
	{
		hideSelf = (bool)HealthbarHider.Settings[1].Value;
		hideOthers = (bool)HealthbarHider.Settings[2].Value;
		((Component)Players.GetLocalHealthbarGameObject().transform.GetChild(1)).gameObject.SetActive(!hideSelf);
		MelonCoroutines.Start(hideEnemyHealths());
	}

	private void mapInit()
	{
		((Component)Players.GetLocalHealthbarGameObject().transform.GetChild(1)).gameObject.SetActive(!hideSelf);
	}

	private void playerSpawned()
	{
		if (Singleton<PlayerManager>.instance.AllPlayers.Count > 1)
		{
			MelonCoroutines.Start(hideEnemyHealths());
		}
	}

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