Decompiled source of Suicidal Cleanup Crew v1.0.0

SelfCleanupCrew.dll

Decompiled 5 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SelfCleanupCrew")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f8aa87f99c2a178cd1f72ec57d21971f62bf9d9e")]
[assembly: AssemblyProduct("Self Cleanup Crew")]
[assembly: AssemblyTitle("SelfCleanupCrew")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SelfCleanupCrew
{
	[BepInPlugin("SelfCleanupCrew", "Self Cleanup Crew", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		internal static Harmony _Harmony;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"SelfCleanupCrew loaded. Attempting patch...");
			_Harmony = new Harmony("SelfCleanupCrew");
			_Harmony.PatchAll();
			Logger.LogDebug((object)"Patching done!");
		}
	}
	[HarmonyPatch]
	public class EnemyBombThrowerHeadPatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch(typeof(EnemyBombThrowerHead), "ExplodeRPC")]
		public static IEnumerable<CodeInstruction> ExplodeTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Expected O, but got Unknown
			List<CodeInstruction> list = instructions.ToList();
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Stfld)
				{
					Plugin.Logger.LogDebug((object)$"{i} Found Stfld in: {list[i].operand.ToString()}");
					if (list[i].operand.ToString().Contains("enemyHost"))
					{
						Plugin.Logger.LogDebug((object)$"{i} Attempting to patch away: {((object)list[i]).ToString()}");
						list[i].opcode = OpCodes.Pop;
						list.Insert(i + 1, new CodeInstruction(OpCodes.Pop, (object)null));
					}
				}
			}
			return list.AsEnumerable();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SelfCleanupCrew";

		public const string PLUGIN_NAME = "Self Cleanup Crew";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}