using System;
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 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.0.1", "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
{
private PlayerManager playerManager;
private bool sceneChanged = false;
private string currentScene = "Loader";
private int playerCount = 1;
private bool hideSelf = false;
private bool hideOthers = false;
private DateTime EnemyHealthHideTimer;
private bool EnemyHealthHideTimerActive;
private DateTime healthTimer = DateTime.Now;
private bool healthTimerActive = false;
private GameObject localHealth;
private bool init = false;
private UI UI = UI.instance;
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.0.1";
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;
}
public void UIInit()
{
UI.AddMod(HealthbarHider);
}
public void Save()
{
hideSelf = (bool)HealthbarHider.Settings[1].Value;
hideOthers = (bool)HealthbarHider.Settings[2].Value;
localHealth.SetActive(!hideSelf);
hideEnemyHealths();
}
public override void OnFixedUpdate()
{
if (init && EnemyHealthHideTimerActive && EnemyHealthHideTimer <= DateTime.Now)
{
EnemyHealthHideTimerActive = false;
hideEnemyHealths();
}
if (init && healthTimerActive && healthTimer <= DateTime.Now)
{
localHealth = GameObject.Find("Health/Local/Player health bar");
localHealth.SetActive(false);
healthTimerActive = false;
}
if (!init && sceneChanged && currentScene != "Loader")
{
try
{
playerManager = Singleton<PlayerManager>.instance;
playerCount = 1;
if (hideSelf)
{
healthTimer = DateTime.Now.AddSeconds(2.0);
healthTimerActive = true;
}
if (hideOthers && playerCount != playerManager.AllPlayers.Count)
{
playerCount = playerManager.AllPlayers.Count;
hideEnemyHealths();
}
sceneChanged = false;
init = true;
return;
}
catch
{
return;
}
}
if (currentScene == "Park" && hideOthers && playerCount != playerManager.AllPlayers.Count)
{
playerCount = playerManager.AllPlayers.Count;
EnemyHealthHideTimer = DateTime.Now.AddSeconds(2.0);
EnemyHealthHideTimerActive = true;
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
sceneChanged = true;
currentScene = sceneName;
init = false;
}
private void hideEnemyHealths()
{
Enumerator<Player> enumerator = playerManager.AllPlayers.GetEnumerator();
while (enumerator.MoveNext())
{
Player current = enumerator.Current;
if ((Object)(object)current.Controller != (Object)(object)playerManager.localPlayer.Controller)
{
((Component)((Component)current.Controller).gameObject.transform.GetChild(2).GetChild(0).GetChild(0)).gameObject.SetActive(!hideOthers);
}
}
}
}