Decompiled source of SuperSlipperyJellyfish v1.0.0

SuperSlipperyJellyfish.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
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("SuperSlipperyJellyfish")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SuperSlipperyJellyfish")]
[assembly: AssemblyTitle("SuperSlipperyJellyfish")]
[assembly: AssemblyVersion("1.0.0.0")]
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.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
public class ModInfo
{
	public const string name = "SuperSlipperyJellyfish";

	public const string guid = "fayemod.SSJF";

	public const string ver = "1.0.0";

	public const string auth = "faye";

	public const string initMessage = "SuperSlipperyJellyfish 1.0.0 written by faye";
}
namespace SuperSlipperyJellyfish
{
	[BepInPlugin("fayemod.SSJF", "SuperSlipperyJellyfish", "1.0.0")]
	public class Base : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("fayemod.SSJF");

		public static ConfigEntry<int> multiplier;

		public static ConfigEntry<bool> volume;

		private void Awake()
		{
			Log.Init("SuperSlipperyJellyfish 1.0.0 written by faye");
			multiplier = ((BaseUnityPlugin)this).Config.Bind<int>("Super Slippery Jellyfish", "Multiplier", 2, "The multiplier the jellyfish slipperiness is multiplied by. Is 2 by default.");
			volume = ((BaseUnityPlugin)this).Config.Bind<bool>("Super Slippery Jellyfish", "Multiply volume?", true, "Is the SFX's volume also multiplied by the multiplier? Is true by default.");
			harmony.PatchAll(typeof(JellyfishPatch));
		}
	}
	internal class JellyfishPatch
	{
		private static Rigidbody GetBodypartRig(Character character, BodypartType bp)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			return character.refs.ragdoll.partDict[bp].Rig;
		}

		[HarmonyPatch(typeof(SlipperyJellyfish), "Trigger")]
		[HarmonyPrefix]
		private static bool TriggerPatch(int targetID, SlipperyJellyfish __instance)
		{
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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)
			Character component = ((Component)PhotonView.Find(targetID)).GetComponent<Character>();
			if (!((Object)(object)component == (Object)null))
			{
				Log.Write.LogInfo((object)$"Running original code with {Base.multiplier.Value}x force multiplier");
				Rigidbody bodypartRig = GetBodypartRig(component, (BodypartType)16);
				Rigidbody bodypartRig2 = GetBodypartRig(component, (BodypartType)13);
				Rigidbody bodypartRig3 = GetBodypartRig(component, (BodypartType)0);
				Rigidbody bodypartRig4 = GetBodypartRig(component, (BodypartType)4);
				component.RPCA_Fall(2f);
				bodypartRig.AddForce((component.data.lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1);
				bodypartRig2.AddForce((component.data.lookDirection_Flat + Vector3.up) * 200f, (ForceMode)1);
				bodypartRig3.AddForce(Vector3.up * (1500f * (float)Base.multiplier.Value), (ForceMode)1);
				bodypartRig4.AddForce(component.data.lookDirection_Flat * -300f, (ForceMode)1);
				component.refs.afflictions.AddStatus((STATUSTYPE)3, 0.05f, true);
				for (int i = 0; i < __instance.slipSFX.Length; i++)
				{
					if (Base.volume.Value)
					{
						__instance.slipSFX[i].settings.volume = Base.multiplier.Value;
					}
					__instance.slipSFX[i].Play(((Component)__instance).transform.position);
				}
			}
			return false;
		}
	}
	public sealed class Log
	{
		private static Log instance;

		private static readonly object singletonLock = new object();

		private static ManualLogSource source = new ManualLogSource("fayemod.SSJF");

		public static Log Instance
		{
			get
			{
				lock (singletonLock)
				{
					if (instance == null)
					{
						instance = new Log();
					}
					return instance;
				}
			}
		}

		public static ManualLogSource Write => source;

		private Log()
		{
		}

		public static void Init(string initMessage)
		{
			Logger.Sources.Add((ILogSource)(object)source);
			source.LogMessage((object)initMessage);
			source.LogMessage((object)"Logger component initialised.");
		}

		public static void Delete()
		{
			source.LogMessage((object)"Bye :(");
			Logger.Sources.Remove((ILogSource)(object)source);
		}
	}
}