Decompiled source of ExplodingBarbedWireBat v1.0.2

plugins/ExplodingBarbedWireBat.dll

Decompiled a year 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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 = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ExplodingBarbedWireBat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExplodingBarbedWireBat")]
[assembly: AssemblyTitle("ExplodingBarbedWireBat")]
[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 ExplodingBarbedWireBat
{
	[BepInPlugin("GeeEm.WrestlingEmpire.ExplodingBarbedWireBat", "ExplodingBarbedWireBat", "1.0.2")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(DFOGOCNBECG))]
		public class DFOGOCNBECGPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("IANCANDCNEH")]
			private static void Postfix(DFOGOCNBECG __instance, int CGCIFACJJFM, int GKNIAFAOLJK, float BKCOBKGNDAA, float JHCBBFEIKHL, float HCFCAFCHOKA, float FPLEMEKHJLD)
			{
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				if (CGCIFACJJFM <= 0)
				{
					return;
				}
				float num = BKCOBKGNDAA;
				float num2 = JHCBBFEIKHL;
				float num3 = HCFCAFCHOKA;
				GDFKEAMIOAG val = JFLEBEBCGFA.HLLBCKILNNG[CGCIFACJJFM];
				if (val.CMECDGMCMLC == "Barbed Bat")
				{
					if (BKCOBKGNDAA == 0f && JHCBBFEIKHL == 0f && HCFCAFCHOKA == 0f)
					{
						num = val.NJDGEELLAKG;
						num2 = val.FNNBCDPJBIO;
						num3 = val.BMFDFFLPBOJ;
					}
					ALIGLHEIAGO.MDFJMAEDJMG(3, 2, new Color(10f, 10f, 10f), configSize.Value, (GameObject)null, num, num2, num3, 0f, 0f, 0f, 1);
				}
			}
		}

		[HarmonyPatch(typeof(GDFKEAMIOAG))]
		public class GDFKEAMIOAGPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("NDHLEAEDNAK")]
			private static void NDHLEAEDNAKPostfix(GDFKEAMIOAG __instance)
			{
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				if (!configExplosionOnThrow.Value || !(__instance.CMECDGMCMLC == "Barbed Bat"))
				{
					return;
				}
				for (int i = 1; i <= NJBJIIIACEP.NBBBLJDBLNM; i++)
				{
					DFOGOCNBECG val = NJBJIIIACEP.OAAMGFLINOB[i];
					if (__instance.FNNBCDPJBIO > val.FNNBCDPJBIO && __instance.FNNBCDPJBIO < val.DFINJNKKMFL(3) + __instance.FBAMIOMCLKM / 2f && __instance.BGPEKDFJGII == 0)
					{
						int num = 0;
						int num2 = val.KFHGMKAKGDC();
						if (num2 >= 3)
						{
							num = val.MDOAGGHHHDC(__instance.NJDGEELLAKG, __instance.BMFDFFLPBOJ, __instance.NIMHPNKOPAE);
						}
						else if (__instance.GBLDMIAPNEP(val.NJDGEELLAKG, __instance.FNNBCDPJBIO, val.BMFDFFLPBOJ, 0f) > 0)
						{
							num = ((num2 != 2) ? 1 : 2);
						}
						if (num2 < 0 && __instance.FNNBCDPJBIO < val.DFINJNKKMFL(1) - 5f)
						{
							num = 0;
						}
						if (num > 0)
						{
							float num3 = (__instance.NJDGEELLAKG + val.NJDGEELLAKG) / 2f;
							float num4 = (__instance.BMFDFFLPBOJ + val.BMFDFFLPBOJ) / 2f;
							ALIGLHEIAGO.MDFJMAEDJMG(3, 2, new Color(10f, 10f, 10f), configSize.Value, (GameObject)null, num3, __instance.FNNBCDPJBIO, num4, 0f, 0f, 0f, 1);
						}
					}
				}
			}
		}

		public const string PluginGuid = "GeeEm.WrestlingEmpire.ExplodingBarbedWireBat";

		public const string PluginName = "ExplodingBarbedWireBat";

		public const string PluginVer = "1.0.2";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("GeeEm.WrestlingEmpire.ExplodingBarbedWireBat");

		internal static string PluginPath;

		public static ConfigEntry<float> configSize;

		public static ConfigEntry<bool> configExplosionOnThrow;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			configSize = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ExplosionSize", 2f, "The size of an explosion");
			configExplosionOnThrow = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExplosionOnThrow", true, "Make explosions when the weapon hits someone midair");
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded ExplodingBarbedWireBat!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded ExplodingBarbedWireBat!");
		}
	}
}