Decompiled source of PunkEmotesHotkeys v1.0.1

plugins/PunkEmotesHotkeys.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using AnimationHotkeys.Config;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("PunkEmotesHotkeys")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+5135e3907199bf3d65873ee31a7eaeb09fe4f116")]
[assembly: AssemblyProduct("PunkEmotesHotkeys")]
[assembly: AssemblyTitle("PunkEmotesHotkeys")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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.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;
		}
	}
	[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;
		}
	}
}
internal static class LCMPluginInfo
{
	public const string PLUGIN_GUID = "PunkEmotesHotkeys";

	public const string PLUGIN_NAME = "PunkEmotesHotkeys";

	public const string PLUGIN_VERSION = "1.0.1";
}
namespace AnimationHotkeys
{
	[BepInPlugin("PunkEmotesHotkeys", "PunkEmotesHotkeys", "1.0.1")]
	public class AnimationHotkeysPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		internal static HotkeyConfig HKConfig;

		private void Awake()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			HKConfig = new HotkeyConfig(((BaseUnityPlugin)this).Config);
			Log.LogInfo((object)"Plugin PunkEmotesHotkeys version 1.0.1 is loaded!");
			try
			{
				GameObject val = new GameObject("AnimationHotkeyManager", new Type[1] { typeof(AnimationHotkeyManager) });
				Object.DontDestroyOnLoad((Object)(object)val);
			}
			catch (Exception arg)
			{
				Log.LogError((object)$"Unable to setup manager instance!\n{arg}\n");
			}
		}
	}
	public class AnimationHotkeyManager : MonoBehaviour
	{
		public void Awake()
		{
			AnimationHotkeysPlugin.Log.LogInfo((object)"AnimationHotKeyManager is active");
		}

		public void Update()
		{
			if (Input.GetKeyDown((KeyCode)92))
			{
				AnimationHotkeysPlugin.Log.LogInfo((object)"Backslash down");
				HotkeyQueen.SendEmoteChatMessage(AnimationHotkeysPlugin.HKConfig.BackslashEmote.Value);
			}
		}
	}
	public static class HotkeyQueen
	{
		public static void SendEmoteChatMessage(string emoteName)
		{
			Player mainPlayer = Player._mainPlayer;
			if (mainPlayer == null)
			{
				AnimationHotkeysPlugin.Log.LogInfo((object)"Local player doesn't exist right now");
				return;
			}
			AnimationHotkeysPlugin.Log.LogInfo((object)("Sending this chat message `/em " + emoteName.ToLower() + "`"));
			((Component)mainPlayer).gameObject.GetComponent<ChatBehaviour>().Send_ChatMessage("/em " + emoteName.ToLower());
		}
	}
}
namespace AnimationHotkeys.Config
{
	public class HotkeyConfig
	{
		public readonly ConfigEntry<string> BackslashEmote = config.Bind<string>("Hotkeys", "Backslash Emote", "sitinit02", "The emote you want to play when pressing backslash, make sure to test it with PunkEmotes first!");

		public HotkeyConfig(ConfigFile config)
		{
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}