Decompiled source of KeepBoosters v1.0.1

plugins/KeepBoosters.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("KeepBoosters")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ab74d137fd951f1cd8e505426c8437d7ae6e2d39")]
[assembly: AssemblyProduct("KeepBoosters")]
[assembly: AssemblyTitle("KeepBoosters")]
[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 ReTFO.KeepBoosters
{
	[BepInPlugin("RoboRyGuy.KeepBoosters", "KeepBoosters", "1.0.1")]
	[BepInProcess("GTFO.exe")]
	public class Plugin : BasePlugin
	{
		public const string Name = "KeepBoosters";

		public const string Author = "RoboRyGuy";

		public const string GUID = "RoboRyGuy.KeepBoosters";

		public const string Version = "1.0.1";

		private static Plugin? _plugin;

		protected Harmony harmony = new Harmony("RoboRyGuy.KeepBoosters");

		public static Plugin Get()
		{
			return TryGet() ?? throw new NullReferenceException("Tried to retrieve KeepBoosters, but it was not loaded!");
		}

		public static Plugin? TryGet()
		{
			return _plugin ?? (_plugin = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.FirstOrDefault((KeyValuePair<string, PluginInfo> p) => p.Key == "RoboRyGuy.KeepBoosters").Value.Instance as Plugin);
		}

		public static bool TryGet([NotNullWhen(true)] out Plugin? plugin)
		{
			plugin = TryGet();
			return plugin != null;
		}

		public override void Load()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			_plugin = this;
			harmony.PatchAll(((object)this).GetType());
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RoboRyGuy.KeepBoosters");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
		}

		public override bool Unload()
		{
			harmony.UnpatchSelf();
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BoosterImplant), "GetCompositPublicName", new Type[] { typeof(bool) })]
		public static void PostGetPublicName(BoosterImplant __instance)
		{
			__instance.Uses = 10;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DropServerManager), "NewGameSession")]
		public static void PreNewGameSession(ref Il2CppStructArray<uint> boosterIds)
		{
			boosterIds = new Il2CppStructArray<uint>(0L);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DropServerGameSession), "ConsumeBoosters")]
		public static bool PreIssueConsumeBoosters()
		{
			return false;
		}
	}
}