Decompiled source of EmoteWheelClick v1.0.0

EmoteWheelFix.dll

Decompiled 4 days 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.Logging;
using HarmonyLib;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EmoteWheelFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmoteWheelFix")]
[assembly: AssemblyTitle("EmoteWheelFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 EmoteWheelClick
{
	[BepInPlugin("jill920.EmoteWheelClick", "Emote Wheel Click", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance;

		public static ManualLogSource Log;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"========================================");
			Log.LogInfo((object)"[EmoteWheelClick] LOADED v1.0.0");
			Log.LogInfo((object)"  Right-click on emote wheel to switch pages");
			Log.LogInfo((object)"========================================");
			try
			{
				_harmony = new Harmony("jill920.EmoteWheelClick");
				_harmony.PatchAll(Assembly.GetExecutingAssembly());
				Log.LogInfo((object)"Harmony patches applied successfully");
			}
			catch (Exception ex)
			{
				Log.LogError((object)("Failed to apply patches: " + ex.Message));
			}
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace EmoteWheelClick.Patches
{
	[HarmonyPatch(typeof(EmoteWheel))]
	internal class EmoteWheelPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePostfix(EmoteWheel __instance)
		{
			try
			{
				if (!((Object)(object)__instance == (Object)null) && ((Component)__instance).gameObject.activeInHierarchy && Input.GetMouseButtonDown(1))
				{
					Traverse val = Traverse.Create((object)__instance);
					Traverse val2 = val.Field("page");
					Traverse val3 = val.Field("pages");
					if (val2.FieldExists() && val3.FieldExists())
					{
						int value = val2.GetValue<int>();
						int value2 = val3.GetValue<int>();
						int num = (value + 1) % value2;
						val2.SetValue((object)num);
						typeof(EmoteWheel).GetMethod("InitWheel", BindingFlags.Instance | BindingFlags.Public)?.Invoke(__instance, null);
					}
				}
			}
			catch (Exception)
			{
			}
		}
	}
}