Decompiled source of ClearVisor v1.0.3

BepInEx/Plugins/ClearVisor/ClearVisor.dll

Decompiled 3 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ClearVisor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ClearVisor")]
[assembly: AssemblyTitle("ClearVisor")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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 ClearVisor
{
	[BepInPlugin("com.clearvisor", "Clear Visor", "1.0.3")]
	public class ClearVisorPlugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Clear Visor has loaded!");
			GameObject val = new GameObject("ClearVisor_Runtime")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<ClearVisorRuntime>().Initialize(((BaseUnityPlugin)this).Logger);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Clear Visor runtime initialized successfully.");
		}
	}
	public sealed class ClearVisorRuntime : MonoBehaviour
	{
		private const string VisorObjectName = "PlayerHUDHelmetModel";

		private ManualLogSource logger;

		private GameObject visorObject;

		private float nextSearchTime;

		public void Initialize(ManualLogSource pluginLogger)
		{
			logger = pluginLogger;
		}

		private void Update()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)visorObject != (Object)null)
			{
				if (visorObject.activeSelf)
				{
					visorObject.SetActive(false);
				}
			}
			else
			{
				if (Time.unscaledTime < nextSearchTime)
				{
					return;
				}
				nextSearchTime = Time.unscaledTime + 2f;
				GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
				foreach (GameObject val in array)
				{
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					Scene scene = val.scene;
					if (((Scene)(ref scene)).IsValid())
					{
						scene = val.scene;
						if (((Scene)(ref scene)).isLoaded && string.Equals(((Object)val).name, "PlayerHUDHelmetModel", StringComparison.OrdinalIgnoreCase))
						{
							visorObject = val;
							visorObject.SetActive(false);
							logger.LogInfo((object)"Helmet visor successfully disabled.");
							break;
						}
					}
				}
			}
		}
	}
}