Decompiled source of AltScrollInventory v0.1.0

AltScrollInventory.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AltScrollInventory")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AltScrollInventory")]
[assembly: AssemblyTitle("AltScrollInventory")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 AltScrollInventory
{
	[BepInPlugin("sbg.altscroll.inventory", "AltScrollInventory", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerGolfer), "SetPitch")]
		internal static class Patch_PlayerGolfer_SetPitch
		{
			private static bool Prefix()
			{
				return !IsAltHeld();
			}
		}

		public const string ModGuid = "sbg.altscroll.inventory";

		public const string ModName = "AltScrollInventory";

		public const string ModVersion = "0.1.0";

		internal static ManualLogSource Log;

		private int lastSign;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("sbg.altscroll.inventory").PatchAll();
			Log.LogInfo((object)"AltScrollInventory v0.1.0 loaded.");
		}

		private void Update()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (!IsAltHeld())
			{
				lastSign = 0;
				return;
			}
			GameplayActions gameplay = PlayerInput.Controls.Gameplay;
			float num = ((GameplayActions)(ref gameplay)).Pitch.ReadValue<float>();
			int num2 = ((num > 0.05f) ? 1 : ((num < -0.05f) ? (-1) : 0));
			if (num2 != 0 && num2 != lastSign)
			{
				if (num2 > 0)
				{
					Hotkeys.CycleRight();
				}
				else
				{
					Hotkeys.CycleLeft();
				}
			}
			lastSign = num2;
		}

		internal static bool IsAltHeld()
		{
			Keyboard current = Keyboard.current;
			if (current != null)
			{
				if (!((ButtonControl)current.leftAltKey).isPressed)
				{
					return ((ButtonControl)current.rightAltKey).isPressed;
				}
				return true;
			}
			return false;
		}
	}
}