Decompiled source of RightDrag v0.0.3

plugins/RightDrag/RightDrag.dll

Decompiled a year ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("RightDrag")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RightDrag")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("64443039-edc2-4adb-8193-a459b7477663")]
[assembly: AssemblyFileVersion("0.0.2.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.2.0")]
namespace RightDrag;

[BepInPlugin("rightmod.nhickling.co.uk", "RightDrag", "0.0.0.3")]
public class RightMod : BaseUnityPlugin
{
	public const string pluginGuid = "rightmod.nhickling.co.uk";

	public const string pluginName = "RightDrag";

	public const string pluginVersion = "0.0.0.3";

	private static IInputSystem inputSystem;

	private static ManualLogSource ModLogger;

	private static List<int> activatedSlots = new List<int>();

	public void Awake()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Expected O, but got Unknown
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RightDrag: started");
		inputSystem = UnityInput.Current;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RightDrag: Attached to input state");
		Harmony val = new Harmony("rightmod.nhickling.co.uk");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RightDrag: Fetching patch references");
		MethodInfo methodInfo = AccessTools.Method(typeof(InventoryGridUI), "MouseOverCallback", new Type[2]
		{
			typeof(int),
			typeof(bool)
		}, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(RightMod), "OnPointerEnter_MyPatch", (Type[])null, (Type[])null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RightDrag: Starting Patch");
		val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"RightDrag: Patched");
		ModLogger = ((BaseUnityPlugin)this).Logger;
	}

	public static void OnPointerEnter_MyPatch(InventoryGridUI __instance, int slotIndex, bool isEntering)
	{
		if (inputSystem.GetMouseButton(1))
		{
			if (!activatedSlots.Contains(slotIndex))
			{
				__instance.HandleClickSlot(slotIndex, false);
				activatedSlots.Add(slotIndex);
			}
		}
		else
		{
			activatedSlots.Clear();
		}
	}
}