Decompiled source of MeleeSwapper v1.1.0

Plugins/MeleeSwapper.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Gear;
using GearSwapPlugin.GearSwap;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using Player;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MeleeSwapper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0745adb2af244bcfa8425a3af9a9125fbbefc8ed")]
[assembly: AssemblyProduct("MeleeSwapper")]
[assembly: AssemblyTitle("MeleeSwapper")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace MeleeSwapper
{
	public class MeleeWeaponSwapper : MonoBehaviour
	{
		private void Update()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Plugin.sledgehammer.Value))
			{
				GearIDRange gearID = GetGearID(0);
				GearSwapManager.RequestToEquip(gearID);
			}
			else if (Input.GetKeyDown(Plugin.knife.Value))
			{
				GearIDRange gearID2 = GetGearID(2);
				GearSwapManager.RequestToEquip(gearID2);
			}
			else if (Input.GetKeyDown(Plugin.bat.Value))
			{
				GearIDRange gearID3 = GetGearID(4);
				GearSwapManager.RequestToEquip(gearID3);
			}
			else if (Input.GetKeyDown(Plugin.spear.Value))
			{
				GearIDRange gearID4 = GetGearID(6);
				GearSwapManager.RequestToEquip(gearID4);
			}
		}

		private GearIDRange GetGearID(int itemIndex)
		{
			int num = 0;
			GearIDRange result = null;
			foreach (GearIDRange item in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)10))
			{
				if (num == itemIndex)
				{
					result = item;
					break;
				}
				num++;
			}
			return result;
		}
	}
	[BepInPlugin("INF.MeleeSwapper", "MeleeSwapper", "1.1.0")]
	public class Plugin : BasePlugin
	{
		public static ManualLogSource L;

		public static ConfigEntry<KeyCode> sledgehammer { get; set; }

		public static ConfigEntry<KeyCode> knife { get; set; }

		public static ConfigEntry<KeyCode> bat { get; set; }

		public static ConfigEntry<KeyCode> spear { get; set; }

		public override void Load()
		{
			sledgehammer = ((BasePlugin)this).Config.Bind<KeyCode>("Hot Keys", "Sledgehammer", (KeyCode)122, "Switch To Sledgehammer");
			knife = ((BasePlugin)this).Config.Bind<KeyCode>("Hot Keys", "Knife", (KeyCode)120, "Switch To Knife");
			bat = ((BasePlugin)this).Config.Bind<KeyCode>("Hot Keys", "Bat", (KeyCode)99, "Switch To Bat");
			spear = ((BasePlugin)this).Config.Bind<KeyCode>("Hot Keys", "Spear", (KeyCode)118, "Switch To Spear");
			((BasePlugin)this).AddComponent<MeleeWeaponSwapper>();
			L = ((BasePlugin)this).Log;
			((BasePlugin)this).Log.LogInfo((object)"Melee Swapper by INF loaded!");
		}
	}
}