Decompiled source of InteractablesBeGone v1.0.1

InteractablesBeGone.dll

Decompiled a week 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 BepInEx.Configuration;
using EntityStates;
using EntityStates.Barrel;
using On.EntityStates.Barrel;
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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("InteractablesBeGone")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InteractablesBeGone")]
[assembly: AssemblyTitle("InteractablesBeGone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace InteractablesBeGone;

internal class Hook
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_OnEnter <>9__0_0;

		public static hook_RpcSetPingable <>9__0_1;

		public static hook_RpcSetTerminalPingable <>9__0_2;

		public static hook_SetHasBeenPurchased <>9__0_3;

		public static hook_RpcSetPingable <>9__0_4;

		public static hook_OnEnter <>9__0_5;

		internal void <Hooks>b__0_0(orig_OnEnter o, Opened s)
		{
			Object.Destroy((Object)(object)((Component)((EntityState)s).outer).gameObject);
		}

		internal void <Hooks>b__0_1(orig_RpcSetPingable o, ShrineBehavior s, bool v)
		{
			Object.Destroy((Object)(object)((Component)s).gameObject);
		}

		internal void <Hooks>b__0_2(orig_RpcSetTerminalPingable o, MultiShopController s, GameObject t, bool v)
		{
			Object.Destroy((Object)(object)((Component)s).gameObject);
		}

		internal void <Hooks>b__0_3(orig_SetHasBeenPurchased o, ShopTerminalBehavior s, bool n)
		{
			if (s.inspectHintOverrideToken != "ACTION_INSPECT_PRINTABLE")
			{
				Object.Destroy((Object)(object)((Component)s).gameObject);
			}
		}

		internal void <Hooks>b__0_4(orig_RpcSetPingable o, PortalStatueBehavior s, GameObject g, bool v)
		{
			Object.Destroy((Object)(object)((Component)s).gameObject);
		}

		internal void <Hooks>b__0_5(orig_OnEnter o, EntityState s)
		{
			Object.Destroy((Object)(object)((Component)s.outer).gameObject);
		}
	}

	internal static void Hooks()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Expected O, but got Unknown
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Expected O, but got Unknown
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Expected O, but got Unknown
		if (MainPlugin.deleteChests.Value)
		{
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter o, Opened s)
				{
					Object.Destroy((Object)(object)((Component)((EntityState)s).outer).gameObject);
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			Opened.OnEnter += (hook_OnEnter)obj;
		}
		if (MainPlugin.deleteShrines.Value)
		{
			object obj2 = <>c.<>9__0_1;
			if (obj2 == null)
			{
				hook_RpcSetPingable val2 = delegate(orig_RpcSetPingable o, ShrineBehavior s, bool v)
				{
					Object.Destroy((Object)(object)((Component)s).gameObject);
				};
				<>c.<>9__0_1 = val2;
				obj2 = (object)val2;
			}
			ShrineBehavior.RpcSetPingable += (hook_RpcSetPingable)obj2;
		}
		if (MainPlugin.deleteMultiShops.Value)
		{
			object obj3 = <>c.<>9__0_2;
			if (obj3 == null)
			{
				hook_RpcSetTerminalPingable val3 = delegate(orig_RpcSetTerminalPingable o, MultiShopController s, GameObject t, bool v)
				{
					Object.Destroy((Object)(object)((Component)s).gameObject);
				};
				<>c.<>9__0_2 = val3;
				obj3 = (object)val3;
			}
			MultiShopController.RpcSetTerminalPingable += (hook_RpcSetTerminalPingable)obj3;
		}
		if (MainPlugin.deleteCleansePool.Value)
		{
			object obj4 = <>c.<>9__0_3;
			if (obj4 == null)
			{
				hook_SetHasBeenPurchased val4 = delegate(orig_SetHasBeenPurchased o, ShopTerminalBehavior s, bool n)
				{
					if (s.inspectHintOverrideToken != "ACTION_INSPECT_PRINTABLE")
					{
						Object.Destroy((Object)(object)((Component)s).gameObject);
					}
				};
				<>c.<>9__0_3 = val4;
				obj4 = (object)val4;
			}
			ShopTerminalBehavior.SetHasBeenPurchased += (hook_SetHasBeenPurchased)obj4;
		}
		if (MainPlugin.deleteGoldChance.Value)
		{
			object obj5 = <>c.<>9__0_4;
			if (obj5 == null)
			{
				hook_RpcSetPingable val5 = delegate(orig_RpcSetPingable o, PortalStatueBehavior s, GameObject g, bool v)
				{
					Object.Destroy((Object)(object)((Component)s).gameObject);
				};
				<>c.<>9__0_4 = val5;
				obj5 = (object)val5;
			}
			PortalStatueBehavior.RpcSetPingable += (hook_RpcSetPingable)obj5;
		}
		if (!MainPlugin.deleteCasino.Value)
		{
			return;
		}
		object obj6 = <>c.<>9__0_5;
		if (obj6 == null)
		{
			hook_OnEnter val6 = delegate(orig_OnEnter o, EntityState s)
			{
				Object.Destroy((Object)(object)((Component)s.outer).gameObject);
			};
			<>c.<>9__0_5 = val6;
			obj6 = (object)val6;
		}
		Opened.OnEnter += (hook_OnEnter)obj6;
	}
}
[BepInPlugin("com.Dragonyck.InteractablesBeGone", "InteractablesBeGone", "1.0.1")]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.InteractablesBeGone";

	public const string MODNAME = "InteractablesBeGone";

	public const string VERSION = "1.0.1";

	internal static ConfigEntry<bool> deleteChests;

	internal static ConfigEntry<bool> deleteShrines;

	internal static ConfigEntry<bool> deleteMultiShops;

	internal static ConfigEntry<bool> deleteCleansePool;

	internal static ConfigEntry<bool> deleteGoldChance;

	internal static ConfigEntry<bool> deleteCasino;

	private void Awake()
	{
		deleteChests = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Chests", true, "Includes barrels, lunar pods, void potential and encrusted cache.");
		deleteShrines = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Shrines", true, (ConfigDescription)null);
		deleteMultiShops = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Multishop Terminals", true, (ConfigDescription)null);
		deleteCleansePool = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Cleansing Pools", true, (ConfigDescription)null);
		deleteGoldChance = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Altar of Gold", true, (ConfigDescription)null);
		deleteCasino = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Adaptive Chest", true, (ConfigDescription)null);
		Hook.Hooks();
	}
}