Decompiled source of GearSwapper v1.0.0

GearSwapper.dll

Decompiled 2 years 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;
		}
	}
}
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()
			{
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Expected O, but got Unknown
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a0: Expected O, but got Unknown
				//IL_0235: Unknown result type (might be due to invalid IL or missing references)
				//IL_023c: Expected O, but got Unknown
				//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d8: Expected O, but got Unknown
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val2;
				if (Input.GetKeyDown((KeyCode)286))
				{
					int num = 0;
					GearIDRange val = null;
					foreach (GearIDRange item in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)3))
					{
						if (num == 2)
						{
							val = item;
						}
						num++;
					}
					ManualLogSource log = Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(39, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("f5 has been pressed to swap to mine dep");
					}
					log.LogInfo(val2);
					GearSwapManager.RequestToEquip(val);
				}
				if (Input.GetKeyDown((KeyCode)285))
				{
					int num2 = 0;
					GearIDRange val3 = null;
					foreach (GearIDRange item2 in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)3))
					{
						if (num2 == 1)
						{
							val3 = item2;
						}
						num2++;
					}
					ManualLogSource log2 = Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(46, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("f4 has been pressed to swap to c-foam launcher");
					}
					log2.LogInfo(val2);
					GearSwapManager.RequestToEquip(val3);
				}
				if (Input.GetKeyDown((KeyCode)284))
				{
					int num3 = 0;
					GearIDRange val4 = null;
					foreach (GearIDRange item3 in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)3))
					{
						if (num3 == 0)
						{
							val4 = item3;
						}
						num3++;
					}
					ManualLogSource log3 = Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(42, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("f3 has been pressed to swap to bio tracker");
					}
					log3.LogInfo(val2);
					GearSwapManager.RequestToEquip(val4);
				}
				if (Input.GetKeyDown((KeyCode)283))
				{
					int num4 = 0;
					GearIDRange val5 = null;
					foreach (GearIDRange item4 in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)3))
					{
						if (num4 == 3)
						{
							val5 = item4;
						}
						num4++;
					}
					ManualLogSource log4 = Log;
					val2 = new BepInExInfoLogInterpolatedStringHandler(43, 0, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("f2 has been pressed to swap to burst sentry");
					}
					log4.LogInfo(val2);
					GearSwapManager.RequestToEquip(val5);
				}
				if (!Input.GetKeyDown((KeyCode)282))
				{
					return;
				}
				int num5 = 0;
				GearIDRange val6 = null;
				foreach (GearIDRange item5 in (Il2CppArrayBase<GearIDRange>)(object)GearManager.GetAllGearForSlot((InventorySlot)3))
				{
					if (num5 == 5)
					{
						val6 = item5;
					}
					num5++;
				}
				ManualLogSource log5 = Log;
				val2 = new BepInExInfoLogInterpolatedStringHandler(44, 0, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("f1 has been pressed to swap to sniper sentry");
				}
				log5.LogInfo(val2);
				GearSwapManager.RequestToEquip(val6);
			}
		}

		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;
		}
	}
}