Decompiled source of flippy flapper fly v1.1.0

Mods/flippyflappy.dll

Decompiled 11 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using FlippyFlapperFly;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lets you fly by flapping your arms. Kind of. Not really flapping.")]
[assembly: AssemblyDescription("Lets you fly by flapping your arms. Kind of. Not really flapping.")]
[assembly: AssemblyCompany("mei.orginaztiion")]
[assembly: AssemblyProduct("Flippy Flapper Fly")]
[assembly: AssemblyCopyright("Developed by dc@mei_dot_com")]
[assembly: AssemblyTrademark("mei.orginaztiion")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: MelonInfo(typeof(Main), "Flippy Flapper Fly", "1.1.0", "dc@mei_dot_com", "limkkk")]
[assembly: MelonColor(0, 255, 255, 255)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.1.0.0")]
namespace FlippyFlapperFly;

internal class Main : MelonMod
{
	private enum Binding
	{
		B_B,
		B_A,
		A_B,
		A_A,
		STICK_B,
		STICK_A,
		A_STICK,
		B_STICK
	}

	internal static class FlipFlapMenu
	{
		public static void CreateElements()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			Page val = Page.Root.CreatePage("Flippy Flapper Fly", Color.white, 0, true);
			val.CreateFunction("Hold both buttons to fly.", Color.white, (Action)null);
			BoolElement val2 = val.CreateBool("Enabled?", Color.white, _enabledEntry.Value, (Action<bool>)delegate(bool value)
			{
				_enabledEntry.Value = value;
				MelonPreferences.Save();
			});
			((Element)val2).SetTooltip("Whether or not the flight is enabled.");
			FloatElement val3 = val.CreateFloat("Power", Color.white, _powerEntry.Value, 250f, 0f, 100000f, (Action<float>)delegate(float value)
			{
				_powerEntry.Value = value;
				MelonPreferences.Save();
			});
			((Element)val3).SetTooltip("The strength of the flight.");
			EnumElement val4 = val.CreateEnum("Button Binding", Color.white, (Enum)_buttonBindingEnum.Value, (Action<Enum>)delegate(Enum value)
			{
				_buttonBindingEnum.Value = (Binding)(object)value;
				MelonPreferences.Save();
			});
		}
	}

	internal const string Name = "Flippy Flapper Fly";

	internal const string Description = "Lets you fly by flapping your arms. Kind of. Not really flapping.";

	internal const string Author = "dc@mei_dot_com";

	internal const string Company = "mei.orginaztiion";

	internal const string Version = "1.1.0";

	internal const string DownloadLink = "limkkk";

	private static MelonPreferences_Category _settings;

	private static MelonPreferences_Entry<float> _powerEntry;

	private static MelonPreferences_Entry<bool> _enabledEntry;

	private static MelonPreferences_Entry<Binding> _buttonBindingEnum;

	public override void OnEarlyInitializeMelon()
	{
		((MelonBase)this).OnEarlyInitializeMelon();
	}

	public override void OnInitializeMelon()
	{
		((MelonBase)this).OnInitializeMelon();
		_settings = MelonPreferences.CreateCategory("FlippyFlapperFly");
		_enabledEntry = _settings.CreateEntry<bool>("Enabled", true, "Enabled?", "Whether flight is enabled.", false, false, (ValueValidator)null, (string)null);
		_powerEntry = _settings.CreateEntry<float>("Power", 2000f, "Power", "The strength of the flight.", false, false, (ValueValidator)null, (string)null);
		_buttonBindingEnum = _settings.CreateEntry<Binding>("ButtonBinding", Binding.B_B, "Button Binding", "The button binding for flight.", false, false, (ValueValidator)null, (string)null);
		FlipFlapMenu.CreateElements();
	}

	public override void OnLateInitializeMelon()
	{
		((MelonBase)this).OnLateInitializeMelon();
	}

	public override void OnUpdate()
	{
		((MelonBase)this).OnUpdate();
	}

	public override void OnFixedUpdate()
	{
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: 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_0063: 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)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		((MelonBase)this).OnFixedUpdate();
		if (!((Object)(object)Player.PhysicsRig != (Object)null))
		{
			return;
		}
		Rigidbody component = ((Component)((Rig)Player.PhysicsRig).m_spine).GetComponent<Rigidbody>();
		Rigidbody component2 = ((Component)((Rig)Player.PhysicsRig).m_handLf).GetComponent<Rigidbody>();
		Rigidbody component3 = ((Component)((Rig)Player.PhysicsRig).m_handRt).GetComponent<Rigidbody>();
		Vector3 val = component2.velocity - component.velocity + (component3.velocity - component.velocity);
		bool flag = false;
		if (_buttonBindingEnum.Value == Binding.B_B)
		{
			flag = Player.RightController.GetBButton() && Player.LeftController.GetBButton();
		}
		else if (_buttonBindingEnum.Value == Binding.B_A)
		{
			flag = Player.RightController.GetBButton() && Player.LeftController.GetAButton();
		}
		else if (_buttonBindingEnum.Value == Binding.A_B)
		{
			flag = Player.RightController.GetAButton() && Player.LeftController.GetBButton();
		}
		else if (_buttonBindingEnum.Value == Binding.A_A)
		{
			flag = Player.RightController.GetAButton() && Player.LeftController.GetAButton();
		}
		else if (_buttonBindingEnum.Value == Binding.STICK_B)
		{
			flag = Player.RightController.GetThumbStick() && Player.LeftController.GetBButton();
		}
		else if (_buttonBindingEnum.Value == Binding.STICK_A)
		{
			flag = Player.RightController.GetThumbStick() && Player.LeftController.GetAButton();
		}
		else if (_buttonBindingEnum.Value == Binding.A_STICK)
		{
			flag = Player.RightController.GetAButton() && Player.LeftController.GetThumbStick();
		}
		else if (_buttonBindingEnum.Value == Binding.B_STICK)
		{
			flag = Player.RightController.GetBButton() && Player.LeftController.GetThumbStick();
		}
		if (_enabledEntry.Value && flag)
		{
			if (Player.UIRig.popUpMenu.isActive)
			{
				Player.UIRig.popUpMenu.Deactivate();
			}
			if (((Vector3)(ref val)).magnitude > 3f)
			{
				component.AddForce(val * _powerEntry.Value);
			}
		}
	}

	public override void OnLateUpdate()
	{
		((MelonBase)this).OnLateUpdate();
	}
}