Decompiled source of ExplosiveWhoopieCushion v1.0.0

ExplosiveFarts.dll

Decompiled 4 months 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 ExplosiveFartsMod.patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("netstandard")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.CoreModule")]
[assembly: AssemblyCompany("ExplosiveFarts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Explosive Farts")]
[assembly: AssemblyTitle("ExplosiveFarts")]
[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 ExplosiveFartsMod
{
	[BepInPlugin("Zmodding-ExplosiveFartsMod", "ExplosiveFartsMod", "1.0.0")]
	public class Main : BaseUnityPlugin
	{
		private static Main instance;

		private const string GUID = "Zmodding-ExplosiveFartsMod";

		private const string NAME = "ExplosiveFartsMod";

		private const string VERSION = "1.0.0";

		internal static ManualLogSource cout;

		private readonly Harmony harmony = new Harmony("Zmodding-ExplosiveFartsMod");

		private void Awake()
		{
			cout = ((BaseUnityPlugin)this).Logger;
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Zmodding-ExplosiveFartsMod is loaded!");
			harmony.PatchAll(typeof(Main));
			harmony.PatchAll(typeof(ExplosiveFarts));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ExplosiveFarts";

		public const string PLUGIN_NAME = "Explosive Farts";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ExplosiveFartsMod.patches
{
	[HarmonyPatch(typeof(WhoopieCushionItem))]
	internal class ExplosiveFarts
	{
		[HarmonyPatch("Fart")]
		[HarmonyILManipulator]
		private static void ExplodeFart(ILContext il)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Main.cout.LogInfo((object)"recieved");
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<WhoopieCushionItem>(x, "timesPlayingInOneSpot")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Action<WhoopieCushionItem>>((Action<WhoopieCushionItem>)delegate(WhoopieCushionItem self)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				Landmine.SpawnExplosion(((Component)self).transform.position, true, 4f, 12f, 50, 100f, (GameObject)null, false);
			});
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}