Decompiled source of Remove Claptrap v1.1.0

RemoveClaptrap.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG;
using On.RoR2;
using RoR2;
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(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RemoveClaptrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RemoveClaptrap")]
[assembly: AssemblyTitle("RemoveClaptrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RemoveClaptrap;

[BepInPlugin("com.claptraphater.RemoveClaptrap", "REMOVE CLAPTRAP", "1.1.0")]
public class RemoveClaptrap : BaseUnityPlugin
{
	public static string[] thingsThatMightBeClaptrap = new string[9] { "claptrap", "cl4p-tp", "clap-trap", "cl4p-tr4p", "cl4ptp", "claptp", "clap-tp", "clapbot", "trapbot" };

	public static int claptrapsFound = 0;

	public void Awake()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Expected O, but got Unknown
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Expected O, but got Unknown
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Expected O, but got Unknown
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Expected O, but got Unknown
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Expected O, but got Unknown
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Expected O, but got Unknown
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Expected O, but got Unknown
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Expected O, but got Unknown
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Expected O, but got Unknown
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Expected O, but got Unknown
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Expected O, but got Unknown
		Debug.LogWarning((object)"LETS SEE YOU GET PAST THIS, FUCKER");
		SurvivorCatalog.SetSurvivorDefs += new hook_SetSurvivorDefs(SurvivorCatalog_SetSurvivorDefs);
		BodyCatalog.SetBodyPrefabs += new hook_SetBodyPrefabs(BodyCatalog_SetBodyPrefabs);
		MasterCatalog.SetEntries += new hook_SetEntries(MasterCatalog_SetEntries);
		ArtifactCatalog.SetArtifactDefs += new hook_SetArtifactDefs(ArtifactCatalog_SetArtifactDefs);
		BuffCatalog.SetBuffDefs += new hook_SetBuffDefs(BuffCatalog_SetBuffDefs);
		EffectCatalog.SetEntries += new hook_SetEntries(EffectCatalog_SetEntries);
		EliteCatalog.SetEliteDefs += new hook_SetEliteDefs(EliteCatalog_SetEliteDefs);
		EntityStateCatalog.SetElements += new hook_SetElements(EntityStateCatalog_SetElements);
		EquipmentCatalog.SetEquipmentDefs += new hook_SetEquipmentDefs(EquipmentCatalog_SetEquipmentDefs);
		GameEndingCatalog.SetGameEndingDefs += new hook_SetGameEndingDefs(GameEndingCatalog_SetGameEndingDefs);
		GameModeCatalog.SetGameModes += new hook_SetGameModes(GameModeCatalog_SetGameModes);
		ItemCatalog.SetItemDefs += new hook_SetItemDefs(ItemCatalog_SetItemDefs);
		MusicTrackCatalog.SetEntries += new hook_SetEntries(MusicTrackCatalog_SetEntries);
		PickupCatalog.SetEntries += new hook_SetEntries(PickupCatalog_SetEntries);
		ProjectileCatalog.SetProjectilePrefabs += new hook_SetProjectilePrefabs(ProjectileCatalog_SetProjectilePrefabs);
		SceneCatalog.SetSceneDefs += new hook_SetSceneDefs(SceneCatalog_SetSceneDefs);
		SurfaceDefCatalog.SetSurfaceDefs += new hook_SetSurfaceDefs(SurfaceDefCatalog_SetSurfaceDefs);
		UnlockableCatalog.SetUnlockableDefs += new hook_SetUnlockableDefs(UnlockableCatalog_SetUnlockableDefs);
		RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
		{
			Debug.Log((object)("Hunt completed. " + claptrapsFound + " Claptraps eliminated."));
		});
	}

	private void UnlockableCatalog_SetUnlockableDefs(orig_SetUnlockableDefs orig, UnlockableDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].nameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<UnlockableDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void SurfaceDefCatalog_SetSurfaceDefs(orig_SetSurfaceDefs orig, SurfaceDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<SurfaceDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void SceneCatalog_SetSceneDefs(orig_SetSceneDefs orig, SceneDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].nameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<SceneDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void ProjectileCatalog_SetProjectilePrefabs(orig_SetProjectilePrefabs orig, GameObject[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<GameObject>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void PickupCatalog_SetEntries(orig_SetEntries orig, PickupDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].nameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<PickupDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void MusicTrackCatalog_SetEntries(orig_SetEntries orig, MusicTrackDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].cachedName.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<MusicTrackDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void ItemCatalog_SetItemDefs(orig_SetItemDefs orig, ItemDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].nameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<ItemDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void GameModeCatalog_SetGameModes(orig_SetGameModes orig, Run[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].nameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<Run>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void GameEndingCatalog_SetGameEndingDefs(orig_SetGameEndingDefs orig, GameEndingDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].cachedName.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<GameEndingDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void EquipmentCatalog_SetEquipmentDefs(orig_SetEquipmentDefs orig, EquipmentDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<EquipmentDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void EntityStateCatalog_SetElements(orig_SetElements orig, Type[] newEntries1, EntityStateConfiguration[] newEntries2)
	{
		int num = newEntries2.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries1[i].Name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<Type>(ref newEntries1, i, 1);
					claptrapsFound++;
				}
			}
		}
		int num2 = newEntries2.Length;
		for (int k = 0; k < num2; k++)
		{
			string[] array2 = thingsThatMightBeClaptrap;
			foreach (string value2 in array2)
			{
				if (((Object)newEntries2[k]).name.ToLower().Contains(value2))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<EntityStateConfiguration>(ref newEntries2, k, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries1, newEntries2);
	}

	private void EliteCatalog_SetEliteDefs(orig_SetEliteDefs orig, EliteDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<EliteDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void EffectCatalog_SetEntries(orig_SetEntries orig, EffectDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].prefabName.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<EffectDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void BuffCatalog_SetBuffDefs(orig_SetBuffDefs orig, BuffDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<BuffDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void ArtifactCatalog_SetArtifactDefs(orig_SetArtifactDefs orig, ArtifactDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].nameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<ArtifactDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void MasterCatalog_SetEntries(orig_SetEntries orig, GameObject[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<GameObject>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void BodyCatalog_SetBodyPrefabs(orig_SetBodyPrefabs orig, GameObject[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (((Object)newEntries[i]).name.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<GameObject>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}

	private void SurvivorCatalog_SetSurvivorDefs(orig_SetSurvivorDefs orig, SurvivorDef[] newEntries)
	{
		int num = newEntries.Length;
		for (int i = 0; i < num; i++)
		{
			string[] array = thingsThatMightBeClaptrap;
			foreach (string value in array)
			{
				if (newEntries[i].cachedName.ToLower().Contains(value) || newEntries[i].displayNameToken.ToLower().Contains(value))
				{
					Debug.LogError((object)"CLAPTRAP IDENTIFIED. PURGING.");
					ArrayUtils.ArrayRemoveAtAndResize<SurvivorDef>(ref newEntries, i, 1);
					claptrapsFound++;
				}
			}
		}
		orig.Invoke(newEntries);
	}
}