Decompiled source of FasterBotCheese v0.0.2

FasterBotCheese.dll

Decompiled 5 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using GTFO.API;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using SNetwork;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("FasterBotCheese")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FasterBotCheese")]
[assembly: AssemblyTitle("FasterBotCheese")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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 FasterBotCheese
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("hirnukuono-FasterBotCheese", "hirnukuono-FasterBotCheese", "0.0.2")]
	public class Plugin : BasePlugin
	{
		private class FasterBotCheese : MonoBehaviour
		{
			public bool lupa;

			public bool running1;

			public bool running2;

			public bool running3;

			public bool running4;

			public ManualLogSource Log;

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

			public void Update()
			{
				if (Input.GetKeyDown((KeyCode)282) && SNet.IsMaster)
				{
					if (Input.GetKey((KeyCode)287))
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ToggleBot(0)), (Action)null);
					}
					else
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(KickBot(0)), (Action)null);
					}
					Log.LogInfo((object)"Slot 1 lock/toggle requested");
				}
				if (Input.GetKeyDown((KeyCode)283) && SNet.IsMaster)
				{
					if (Input.GetKey((KeyCode)287))
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ToggleBot(1)), (Action)null);
					}
					else
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(KickBot(1)), (Action)null);
					}
					Log.LogInfo((object)"Slot 2 lock/toggle requested");
				}
				if (Input.GetKeyDown((KeyCode)284) && SNet.IsMaster)
				{
					if (Input.GetKey((KeyCode)287))
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ToggleBot(2)), (Action)null);
					}
					else
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(KickBot(2)), (Action)null);
					}
					Log.LogInfo((object)"Slot 3 lock/toggle requested");
				}
				if (Input.GetKeyDown((KeyCode)286) && SNet.IsMaster)
				{
					if (Input.GetKey((KeyCode)287))
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ToggleBot(3)), (Action)null);
					}
					else
					{
						CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(KickBot(3)), (Action)null);
					}
					Log.LogInfo((object)"Slot 4 lock/toggle requested");
				}
			}

			private IEnumerator KickBot(int slot)
			{
				lupa = true;
				if (slot == 0 && running1)
				{
					Log.LogInfo((object)"slot 1 request already running!");
					lupa = false;
				}
				if (slot == 1 && running2)
				{
					Log.LogInfo((object)"slot 2 request already running!");
					lupa = false;
				}
				if (slot == 2 && running3)
				{
					Log.LogInfo((object)"slot 3 request already running!");
					lupa = false;
				}
				if (slot == 3 && running4)
				{
					Log.LogInfo((object)"slot 3 request already running!");
					lupa = false;
				}
				if (lupa)
				{
					if (slot == 0)
					{
						running1 = true;
					}
					if (slot == 1)
					{
						running2 = true;
					}
					if (slot == 2)
					{
						running3 = true;
					}
					if (slot == 3)
					{
						running4 = true;
					}
					Log.LogInfo((object)("i will kick slot " + slot));
					SlotPermission orig = ((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot];
					((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot] = (SlotPermission)1;
					yield return (object)new WaitForSeconds(1f);
					((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot] = orig;
					if (slot == 0)
					{
						running1 = false;
					}
					if (slot == 1)
					{
						running2 = false;
					}
					if (slot == 2)
					{
						running3 = false;
					}
					if (slot == 3)
					{
						running4 = false;
					}
				}
				yield return null;
			}

			private IEnumerator ToggleBot(int slot)
			{
				lupa = true;
				if (slot == 0 && running1)
				{
					Log.LogInfo((object)"slot 1 request already running!");
					lupa = false;
				}
				if (slot == 1 && running2)
				{
					Log.LogInfo((object)"slot 2 request already running!");
					lupa = false;
				}
				if (slot == 2 && running3)
				{
					Log.LogInfo((object)"slot 3 request already running!");
					lupa = false;
				}
				if (slot == 3 && running4)
				{
					Log.LogInfo((object)"slot 3 request already running!");
					lupa = false;
				}
				if (lupa)
				{
					if (slot == 0)
					{
						running1 = true;
					}
					if (slot == 1)
					{
						running2 = true;
					}
					if (slot == 2)
					{
						running3 = true;
					}
					if (slot == 3)
					{
						running4 = true;
					}
					Log.LogInfo((object)("i will toggle lock status of slot " + slot));
					if ((int)((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot] == 2 || (int)((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot] == 3)
					{
						((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot] = (SlotPermission)1;
					}
					else
					{
						((Il2CppArrayBase<SlotPermission>)(object)SNet.Slots.m_playerSlotPermissions)[slot] = (SlotPermission)3;
					}
					if (slot == 0)
					{
						running1 = false;
					}
					if (slot == 1)
					{
						running2 = false;
					}
					if (slot == 2)
					{
						running3 = false;
					}
					if (slot == 3)
					{
						running4 = false;
					}
				}
				yield return null;
			}
		}

		public override void Load()
		{
			FasterBotCheese fasterBotCheese = ((BasePlugin)this).AddComponent<FasterBotCheese>();
			fasterBotCheese.Log = ((BasePlugin)this).Log;
			EventAPI.OnExpeditionStarted += fasterBotCheese.Initialize;
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "FasterBotCheese";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}