Decompiled source of BPHider v1.0.0

Mods/BPHider.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.Versioning;
using BPHider;
using HarmonyLib;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MatchInfo;
using MelonLoader;
using Microsoft.CodeAnalysis;
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(Main), "BPHider", "1.0.0", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 6, true)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BPHider")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BPHider")]
[assembly: AssemblyTitle("BPHider")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace BPHider
{
	public static class BuildInfo
	{
		public const string ModName = "BPHider";

		public const string ModVersion = "1.0.0";

		public const string Author = "UlvakSkillz";
	}
	public class Main : MelonMod
	{
		[HarmonyPatch(typeof(PlayerController), "Initialize", new Type[] { typeof(Player) })]
		public static class playerspawn
		{
			private static void Postfix(ref PlayerController __instance, ref Player player)
			{
				if (enabled)
				{
					MelonCoroutines.Start(UpdateBP(((Component)((Component)__instance).gameObject.transform.FindChild("NameTag")).GetComponent<PlayerNameTag>()));
				}
			}
		}

		[HarmonyPatch(typeof(PlayerNameTag), "FadePlayerNameTag", new Type[] { typeof(bool) })]
		public static class UpdatePlayerTitleText
		{
			private static void Postfix(ref PlayerNameTag __instance, ref bool on)
			{
				if (on && enabled)
				{
					MelonCoroutines.Start(UpdateBP(__instance));
				}
			}
		}

		[CompilerGenerated]
		private sealed class <HideMatchInfoBP>d__7 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Main <>4__this;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					((TMP_Text)Main.player1BPComponent).text = "??????";
					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();
			}
		}

		[CompilerGenerated]
		private sealed class <UpdateBP>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public PlayerNameTag __instance;

			private TMP_Text <bpTextMeshPro>5__1;

			private Exception <e>5__2;

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

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

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

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

			private bool MoveNext()
			{
				if (<>1__state != 0)
				{
					return false;
				}
				<>1__state = -1;
				try
				{
					<bpTextMeshPro>5__1 = __instance.playerBPAmountText;
					<bpTextMeshPro>5__1.text = "??????";
					<bpTextMeshPro>5__1 = null;
				}
				catch (Exception ex)
				{
					<e>5__2 = ex;
					MelonLogger.Error((object)<e>5__2);
				}
				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 Mod BPHider = new Mod();

		private static bool enabled = true;

		private bool hasMatchInfo = false;

		private string currentScene = "Loader";

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			currentScene = sceneName;
		}

		public override void OnLateInitializeMelon()
		{
			UI.instance.UI_Initialized += UIInit;
			Calls.onMyModsGathered += CheckMods;
			Calls.onMapInitialized += MapInit;
		}

		private void MapInit()
		{
			if ((currentScene == "Map0" || currentScene == "Map1") && hasMatchInfo)
			{
				MelonCoroutines.Start(HideMatchInfoBP());
			}
		}

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

		private void CheckMods()
		{
			if (Mods.findOwnMod("MatchInfo", "1.0.0", false))
			{
				hasMatchInfo = true;
			}
		}

		private void UIInit()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			BPHider.ModName = "BPHider";
			BPHider.ModVersion = "1.0.0";
			BPHider.SetFolder("BPHider");
			BPHider.AddToList("Enabled", true, 0, "Toggles Mod On/Off", new Tags());
			BPHider.GetFromFile();
			BPHider.ModSaved += Save;
			UI.instance.AddMod(BPHider);
			enabled = (bool)BPHider.Settings[0].SavedValue;
		}

		public void Save()
		{
			bool flag = enabled;
			enabled = (bool)BPHider.Settings[0].SavedValue;
			if (enabled != flag)
			{
				Enumerator<Player> enumerator = Singleton<PlayerManager>.instance.AllPlayers.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Player current = enumerator.Current;
					string text = (enabled ? "?????" : current.Data.GeneralData.BattlePoints.ToString());
				}
			}
		}

		[IteratorStateMachine(typeof(<UpdateBP>d__13))]
		private static IEnumerator UpdateBP(PlayerNameTag __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <UpdateBP>d__13(0)
			{
				__instance = __instance
			};
		}
	}
}