Decompiled source of GearSwapper v1.1.0

GearSwapper.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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GTFO.API;
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("GearSwapper")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GearSwapper")]
[assembly: AssemblyTitle("GearSwapper")]
[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 GearSwapper
{
	[BepInPlugin("GearSwapper", "GearSwapper", "1.0.0")]
	public class Plugin : BasePlugin
	{
		private class GearSwapper : MonoBehaviour
		{
			public ManualLogSource Log;

			public void Initialize()
			{
				Log.LogInfo((object)"Plugin is loaded");
			}

			public void Update()
			{
				if (Input.GetKeyDown((KeyCode)282))
				{
					GearIDRange gearID = getGearID(0);
					GearSwapManager.RequestToEquip(gearID);
					Log.LogInfo((object)"F1 has been pressed to swap to bio");
				}
				if (Input.GetKeyDown((KeyCode)283))
				{
					GearIDRange gearID2 = getGearID(1);
					GearSwapManager.RequestToEquip(gearID2);
					Log.LogInfo((object)"F2 has been pressed to swap to cfoam");
				}
				if (Input.GetKeyDown((KeyCode)284))
				{
					GearIDRange gearID3 = getGearID(2);
					GearSwapManager.RequestToEquip(gearID3);
					Log.LogInfo((object)"F3 has been pressed to swap to mine");
				}
				if (Input.GetKeyDown((KeyCode)285))
				{
					GearIDRange gearID4 = getGearID(3);
					GearSwapManager.RequestToEquip(gearID4);
					Log.LogInfo((object)"F4 has been pressed to swap to burst sentry");
				}
				if (Input.GetKeyDown((KeyCode)286))
				{
					GearIDRange gearID5 = getGearID(5);
					GearSwapManager.RequestToEquip(gearID5);
					Log.LogInfo((object)"F5 has been pressed to swap to sniper sentry");
				}
				if (Input.GetKeyDown((KeyCode)287))
				{
					GearIDRange gearID6 = getGearID(6);
					GearSwapManager.RequestToEquip(gearID6);
					Log.LogInfo((object)"F6 has been pressed to swap to shotgun sentry");
				}
				if (Input.GetKeyDown((KeyCode)288))
				{
					GearIDRange gearID7 = getGearID(4);
					GearSwapManager.RequestToEquip(gearID7);
					Log.LogInfo((object)"F7 has been pressed to swap to hel auto sentry");
				}
			}

			private GearIDRange getGearID(int index)
			{
				int num = 0;
				GearIDRange result = null;
				foreach (GearIDRange item in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)3))
				{
					if (num == index)
					{
						result = item;
					}
					num++;
				}
				return result;
			}
		}

		public override void Load()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading Plugin");
			}
			log.LogInfo(val);
			GearSwapper gearSwapper = ((BasePlugin)this).AddComponent<GearSwapper>();
			gearSwapper.Log = ((BasePlugin)this).Log;
			EventAPI.OnExpeditionStarted += gearSwapper.Initialize;
		}
	}
}