Decompiled source of NoHud v1.0.4

CookiesVPP.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CookiesVPP.patches;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("CookiesVPP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CookiesVPP")]
[assembly: AssemblyTitle("CookiesVPP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CookiesVPP
{
	[BepInPlugin("CookiesVPP", "CookiesVPP", "1.0.0")]
	public class CookiesVPP_B : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("CookiesVPP");

		private static CookiesVPP_B Instance;

		public static ConfigEntry<bool> configHideHud;

		public static InputAction hideHud;

		public static ManualLogSource mls = Logger.CreateLogSource("CookiesVPP");

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			configHideHud = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "hideHud", false, "Changes whether the hud is visible.");
			PlayerControllerBP.hideHud = configHideHud.Value;
			mls.LogInfo((object)"Plugin CookiesVPP is loaded :)");
			harmony.PatchAll(typeof(CookiesVPP_B));
			harmony.PatchAll(typeof(PlayerControllerBP));
			harmony.PatchAll(typeof(HudManagerP));
		}

		private void Update()
		{
			CookiesVPP_InputClass.instance.HideHud.performed += delegate
			{
				HideHud();
			};
		}

		private void HideHud()
		{
			PlayerControllerBP.hideHud = !PlayerControllerBP.hideHud;
			HUDManager.Instance.HideHUD(PlayerControllerBP.hideHud);
		}
	}
	public class CookiesVPP_InputClass : LcInputActions
	{
		public static CookiesVPP_InputClass instance = new CookiesVPP_InputClass();

		[InputAction("HideHud", "<Keyboard>/F6", "", Name = "HideHud")]
		public InputAction HideHud { get; set; }
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CookiesVPP";

		public const string PLUGIN_NAME = "CookiesVPP";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace CookiesVPP.patches
{
	internal class HudManagerP
	{
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		[HarmonyPrefix]
		private static bool ChatCommands(HUDManager __instance)
		{
			string text = __instance.chatTextField.text;
			string text2 = "!";
			string[] array = new string[48]
			{
				"a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
				"k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
				"u", "v", "w", "x", "y", "z", "0", "1", "2", "3",
				"4", "5", "6", "7", "8", "9", "f1", "f2", "f3", "f4",
				"f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12"
			};
			CookiesVPP_B.mls.LogInfo((object)("Said: " + text));
			if (text.ToLower().StartsWith(text2))
			{
				if (text.ToLower().StartsWith(text2 + "hidehud"))
				{
					PlayerControllerBP.hideHud = !PlayerControllerBP.hideHud;
					__instance.HideHUD(PlayerControllerBP.hideHud);
					return true;
				}
				return true;
			}
			return true;
		}
	}
	internal class PlayerControllerBP
	{
		public static bool hideHud;
	}
}