Decompiled source of AutoBreakDungeonItems v1.0.2

plugins/AutoBreakDungeonItems.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
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;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("AutoBreakDungeonItems")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+09264c9369bcd2cde65ab218892b3378c39332f7")]
[assembly: AssemblyProduct("AutoBreakDungeonItems")]
[assembly: AssemblyTitle("AutoBreakDungeonItems")]
[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 AutoBreakDungeonItems
{
	public static class Logging
	{
		public static ManualLogSource Logger => Plugin.Log;

		public static void Log(LogLevel level, string message)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			Logger.Log(level, (object)message);
		}

		public static void LogInfo(string message)
		{
			Logger.LogInfo((object)message);
		}

		public static void LogDebug(string message)
		{
			Logger.LogDebug((object)message);
		}

		public static void LogWarning(string message)
		{
			Logger.LogWarning((object)message);
		}

		public static void LogError(string message)
		{
			Logger.LogError((object)message);
		}

		public static void LogFatal(string message)
		{
			Logger.LogFatal((object)message);
		}
	}
	[BepInPlugin("reithegoat.dev.AutoBreakDungeonItems", "AutoBreakDungeonItems", "1.0.1")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Interaction_Chest), "Reveal")]
		public static class RevealPatch
		{
			public static void Postfix(Interaction_Chest __instance)
			{
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				Logging.LogInfo("KILLING ALL ENTITIES THAT DROP MULTIPLE LOOT ON DEATH");
				DropMultipleLootOnDeath[] array = Object.FindObjectsOfType<DropMultipleLootOnDeath>();
				for (int i = 0; i < array.Length; i++)
				{
					Health component = ((Component)array[i]).GetComponent<Health>();
					if (!((Object)(object)component == (Object)null))
					{
						component.DealDamage(component.HP + 1f, ((Component)component).gameObject, ((Component)component).transform.position, false, (AttackTypes)4, false, (AttackFlags)32);
					}
				}
			}
		}

		public const string PluginGuid = "reithegoat.dev.AutoBreakDungeonItems";

		public const string PluginName = "AutoBreakDungeonItems";

		public const string PluginVer = "1.0.1";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("reithegoat.dev.AutoBreakDungeonItems");

		internal static string PluginPath;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			Logging.LogInfo("Loaded AutoBreakDungeonItems!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			Logging.LogInfo("Unloaded AutoBreakDungeonItems!");
		}
	}
}