Decompiled source of DisableEmoteWheel v0.1.0

DiableEmoteWheel.dll

Decompiled 3 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[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.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DisableEmoteWheel;

[BepInPlugin("Pix.DisableEmoteWheel", "DisableEmoteWheel", "0.1.0")]
public sealed class DisableEmoteWheelPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Player), "HandleRadialInput")]
	private static class Patch_Player_HandleRadialInput
	{
		private static bool Prefix(Player __instance)
		{
			if (CfgEnabled != null && !CfgEnabled.Value)
			{
				return true;
			}
			if (__instance != Player.m_localPlayer)
			{
				return true;
			}
			return false;
		}
	}

	public const string PluginGuid = "Pix.DisableEmoteWheel";

	public const string PluginName = "DisableEmoteWheel";

	public const string PluginVersion = "0.1.0";

	internal static ConfigEntry<bool> CfgEnabled;

	private Harmony _harmony;

	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		CfgEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable/disable the mod at runtime.");
		_harmony = new Harmony("Pix.DisableEmoteWheel");
		_harmony.PatchAll(typeof(DisableEmoteWheelPlugin).Assembly);
	}

	private void OnDestroy()
	{
		try
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
		catch
		{
		}
	}
}