Decompiled source of Exploding BingBong v1.1.0

ExplodingBingBong.dll

Decompiled 2 weeks 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExplodingBingBong")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Exploding BingBong")]
[assembly: AssemblyTitle("ExplodingBingBong")]
[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.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ExplodingBingBong
{
	[BepInPlugin("net.catcraze777.plugins.explodingbingbong", "Exploding BingBong", "1.0.0")]
	public class ExplodingBingBongPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(ItemImpactSFX), "OnCollisionEnter")]
		private class ExplodingBingBongImpactPatcher
		{
			private static void Prefix(ItemImpactSFX __instance, ref Item ___item)
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					BingBong component = ((Component)__instance).gameObject.GetComponent<BingBong>();
					if (((Object)(object)component != (Object)null || allItemsExplode) && __instance.vel > triggerVelocity && !Object.op_Implicit((Object)(object)___item.holderCharacter))
					{
						Logger.LogInfo((object)"BOOM!!!!!!");
						GameObject val = PhotonNetwork.Instantiate("0_Items/Dynamite", ((Component)__instance).transform.position, ((Component)__instance).transform.rotation, (byte)0, (object[])null);
						val.GetComponent<PhotonView>().RPC("RPC_Explode", (RpcTarget)0, Array.Empty<object>());
						PhotonNetwork.Destroy(((Component)__instance).gameObject);
					}
				}
				catch (Exception ex)
				{
					Logger.LogError((object)("Error in Exploding BingBong patch: " + ex.Message));
				}
			}
		}

		internal static ManualLogSource Logger;

		private static Harmony? _harmony;

		public const string PLUGIN_GUID = "net.catcraze777.plugins.explodingbingbong";

		private static bool allItemsExplode;

		private static float triggerVelocity;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("net.catcraze777.plugins.explodingbingbong");
			_harmony.PatchAll();
			allItemsExplode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllItemsExplode", false, "Set to true to have ALL items explode upon a hard enough impact.").Value;
			triggerVelocity = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TriggerVelocity", 36f, "The minimum velocity required for the item to explode upon contact with the environment.").Value;
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin net.catcraze777.plugins.explodingbingbong is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ExplodingBingBong";

		public const string PLUGIN_NAME = "Exploding BingBong";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}