using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using DoubleJump;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Mod), "DoubleJump", "1.0.0", "mitch", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DoubleJump")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoubleJump")]
[assembly: AssemblyTitle("DoubleJump")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 DoubleJump
{
public class Mod : MelonMod
{
public enum ControllerSide
{
Left,
Right,
Both
}
public enum JumpButton
{
A,
B,
ThumbstickPress
}
private MelonPreferences_Category _prefs;
private MelonPreferences_Entry<bool> _enabled;
private MelonPreferences_Entry<ControllerSide> _side;
private MelonPreferences_Entry<JumpButton> _button;
private MelonPreferences_Entry<int> _extraJumps;
private MelonPreferences_Entry<float> _jumpForce;
private int _extraUsed;
public override void OnInitializeMelon()
{
_prefs = MelonPreferences.CreateCategory("DoubleJump");
_enabled = _prefs.CreateEntry<bool>("Enabled", true, (string)null, "Master on/off switch.", false, false, (ValueValidator)null, (string)null);
_side = _prefs.CreateEntry<ControllerSide>("Controller", ControllerSide.Right, (string)null, "Which controller's button triggers the air jump: Left, Right, or Both.", false, false, (ValueValidator)null, (string)null);
_button = _prefs.CreateEntry<JumpButton>("Button", JumpButton.A, (string)null, "Button to press in the air to jump again: A, B, or ThumbstickPress.", false, false, (ValueValidator)null, (string)null);
_extraJumps = _prefs.CreateEntry<int>("ExtraJumps", 1, (string)null, "How many extra mid-air jumps you get (1 = double jump, 2 = triple, ...).", false, false, (ValueValidator)null, (string)null);
_jumpForce = _prefs.CreateEntry<float>("JumpForce", 5.5f, (string)null, "Upward launch speed of the air jump. Higher = jump higher.", false, false, (ValueValidator)null, (string)null);
SetupBoneMenu();
((MelonBase)this).LoggerInstance.Msg("DoubleJump ready.");
}
private void SetupBoneMenu()
{
//IL_000a: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Double Jump", Color.cyan, 0, true);
obj.CreateBool("Enabled", Color.yellow, _enabled.Value, (Action<bool>)delegate(bool v)
{
_enabled.Value = v;
_prefs.SaveToFile(false);
});
obj.CreateEnum("Controller", Color.green, (Enum)_side.Value, (Action<Enum>)delegate(Enum v)
{
_side.Value = (ControllerSide)(object)v;
_prefs.SaveToFile(false);
});
obj.CreateEnum("Button", Color.red, (Enum)_button.Value, (Action<Enum>)delegate(Enum v)
{
_button.Value = (JumpButton)(object)v;
_prefs.SaveToFile(false);
});
}
public override void OnUpdate()
{
if (!_enabled.Value)
{
return;
}
RigManager rigManager = Player.RigManager;
if (!Object.op_Implicit((Object)(object)rigManager))
{
return;
}
PhysicsRig physicsRig = rigManager.physicsRig;
if (Object.op_Implicit((Object)(object)physicsRig))
{
PhysGrounder physG = physicsRig.physG;
if ((Object)(object)physG != (Object)null && physG.isGrounded)
{
_extraUsed = 0;
}
else if (_extraUsed < _extraJumps.Value && JumpPressed())
{
Launch(physicsRig);
_extraUsed++;
}
}
}
private bool JumpPressed()
{
bool flag = false;
if (_side.Value != ControllerSide.Right && Object.op_Implicit((Object)(object)Player.LeftController))
{
flag |= ButtonDown(Player.LeftController);
}
if (_side.Value != ControllerSide.Left && Object.op_Implicit((Object)(object)Player.RightController))
{
flag |= ButtonDown(Player.RightController);
}
return flag;
}
private bool ButtonDown(BaseController c)
{
return _button.Value switch
{
JumpButton.B => c.GetBButtonDown(),
JumpButton.ThumbstickPress => c.GetThumbStickDown(),
_ => c.GetAButtonDown(),
};
}
private void Launch(PhysicsRig physRig)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
float value = _jumpForce.Value;
foreach (Rigidbody componentsInChild in ((Component)physRig).GetComponentsInChildren<Rigidbody>())
{
Vector3 velocity = componentsInChild.velocity;
componentsInChild.velocity = new Vector3(velocity.x, value, velocity.z);
}
}
}
}