Poop.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.Configuration;
using BepInEx.Logging;
using BoplFixedMath;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("Poop")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Gives the player a chance to poop out an arrow on every jump")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Poop")]
[assembly: AssemblyTitle("Poop")]
[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 Poop
{
	[BepInPlugin("com.PizzaMan730.Poop", "Poop", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private static Harmony harmony;

		public static ConfigFile config;

		public static ConfigEntry<float> chance;

		private void Awake()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			config = ((BaseUnityPlugin)this).Config;
			chance = config.Bind<float>("Poop", "Poop chance", 50f, "Percent chance that you poop when jumping");
			Log.LogInfo((object)"Poop has loaded!");
			harmony = new Harmony("com.PizzaMan730.Poop");
			harmony.PatchAll(typeof(Patch));
		}
	}
	[HarmonyPatch]
	public class Patch
	{
		[HarmonyPatch(typeof(SlimeController), "Jump")]
		[HarmonyPrefix]
		private static bool Jump(ref bool ___wasUpsideDown, ref PlayerPhysics ___playerPhysics, ref PlayerBody ___body)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			Fix rotation = ___body.fixtrans.rotation;
			bool flag = ___playerPhysics.getAttachedGround().currentNormal(___body).y < 0L;
			___wasUpsideDown = flag;
			___playerPhysics.Jump();
			if (!(Updater.RandomFix((Fix)1L, (Fix)2L) <= (Fix)(1f + Plugin.chance.Value / 100f)))
			{
				return false;
			}
			BoplBody val = new BoplBody();
			ThrowItem2[] array = Resources.FindObjectsOfTypeAll(typeof(ThrowItem2)) as ThrowItem2[];
			ThrowItem2[] array2 = array;
			foreach (ThrowItem2 val2 in array2)
			{
				if (((Object)val2).name == "Grenade")
				{
					val = val2.ItemPrefab;
				}
			}
			Vec2 val3 = default(Vec2);
			if ((double)(float)rotation < 0.75 || (double)(float)rotation >= 5.5)
			{
				((Vec2)(ref val3))..ctor(___body.fixtrans.position.x, ___body.fixtrans.position.y - (Fix)2L);
			}
			else if ((double)(float)rotation < 5.5 && (float)rotation >= 4f)
			{
				((Vec2)(ref val3))..ctor(___body.fixtrans.position.x - (Fix)2L, ___body.fixtrans.position.y);
			}
			else if ((float)rotation < 4f && (double)(float)rotation >= 2.5)
			{
				((Vec2)(ref val3))..ctor(___body.fixtrans.position.x, ___body.fixtrans.position.y + (Fix)3L);
			}
			else if ((double)(float)rotation < 2.5 && (double)(float)rotation >= 0.75)
			{
				((Vec2)(ref val3))..ctor(___body.fixtrans.position.x + (Fix)2L, ___body.fixtrans.position.y);
			}
			BoplBody val4 = FixTransform.InstantiateFixed<BoplBody>(val, val3, ___body.fixtrans.rotation);
			val4.Scale = ___body.fixtrans.Scale;
			val4.StartVelocity = new Vec2(-___body.Velocity.x / (Fix)5L, -___body.Velocity.y / (Fix)5L);
			val4.rotation = ___body.fixtrans.rotation;
			val4.StartAngularVelocity = Fix.Zero;
			Item component = ((Component)val4).GetComponent<Item>();
			Grenade component2 = ((Component)component).GetComponent<Grenade>();
			component2.hasBeenThrown = true;
			DPhysicsCircle val5 = (((Object)(object)val4 != (Object)null) ? ((Component)val4).GetComponent<DPhysicsCircle>() : null);
			if ((Object)(object)val5 != (Object)null && !((MonoUpdatable)val5).IsDestroyed && !val5.initHasBeenCalled)
			{
				val5.ManualInit();
			}
			component2.DetonatesOnOwner = false;
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Poop";

		public const string PLUGIN_NAME = "Poop";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}