using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Evanaellio.HyperJump;
using HarmonyLib;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Hyper Jump")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("Hyper Jump")]
[assembly: AssemblyCopyright("Created by Evanaellio")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("4.0.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonInfo(typeof(HyperJump), "Hyper Jump", "4.0.0", "Evanaellio", "https://bonelab.thunderstore.io/package/Evanaellio/HyperJump/")]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("4.0.0.0")]
namespace Evanaellio.HyperJump;
public static class BuildInfo
{
public const string Name = "Hyper Jump";
public const string Author = "Evanaellio";
public const string Company = null;
public const string Version = "4.0.0";
public const string DownloadLink = "https://bonelab.thunderstore.io/package/Evanaellio/HyperJump/";
}
public class HyperJump : MelonMod
{
[HarmonyPatch(typeof(RemapRig))]
public static class RemapRigPatches
{
[HarmonyPatch("Jump")]
[HarmonyPrefix]
public static void Jump()
{
if (!ProfilePreferences.ActiveProfile.Equals(ProfilePreferences.ProfilesEnum.Disabled))
{
TriggerHyperJump(ProfilePreferences.Profiles[ProfilePreferences.ActiveProfile]);
JumpChargeStartedDate = null;
}
}
}
private static DateTime? JumpChargeStartedDate;
public static PhysicsRig PhysicsRig => Player.PhysicsRig;
public static ControllerRig ControllerRig => (ControllerRig)(object)Player.ControllerRig;
public static PhysGrounder PhysGrounder => Player.PhysicsRig.physG;
public override void OnInitializeMelon()
{
ProfilePreferences.InitializePreferencesAndMenu();
MelonLogger.Msg("HyperJump loaded");
}
public override void OnUpdate()
{
if (!((Object)(object)ControllerRig == (Object)null) && ControllerRig._secondaryAButtonDown && !JumpChargeStartedDate.HasValue)
{
JumpChargeStartedDate = DateTime.Now;
}
}
private static void TriggerHyperJump(ProfilePreferences.Profile profile)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
if (PhysGrounder.isGrounded)
{
float num = 1f;
if (profile.JumpChargingTime > 0f)
{
DateTime now = DateTime.Now;
DateTime? jumpChargeStartedDate = JumpChargeStartedDate;
TimeSpan timeSpan = (now - jumpChargeStartedDate) ?? TimeSpan.Zero;
num = Mathf.InverseLerp(0f, profile.JumpChargingTime * 1000f, (float)timeSpan.TotalMilliseconds);
}
Vector3 pelvisVelocity = PhysicsRig.pelvisVelocity;
pelvisVelocity.y = 0f;
float magnitude = ((Vector3)(ref pelvisVelocity)).magnitude;
Vector3 val = ((Rig)ControllerRig).m_head.forward * magnitude * profile.ForwardLeapMultiplier * 18f;
Vector3 val2 = Vector3.up * profile.UpwardJumpMultiplier * 90f;
PhysicsRig.torso.rbPelvis.AddForce((val2 + val) * num, (ForceMode)2);
}
}
}
public static class ProfilePreferences
{
public class EditableSetting<T>
{
public T Initial;
public Action<T> Update;
}
public class CustomProfileSetting
{
public EditableSetting<float> UpwardJumpMultiplier;
public EditableSetting<float> ForwardLeapMultiplier;
public EditableSetting<float> JumpChargingTime;
}
public class Profile
{
public virtual float UpwardJumpMultiplier { get; set; }
public virtual float ForwardLeapMultiplier { get; set; }
public virtual float JumpChargingTime { get; set; }
}
public class CustomProfile : Profile
{
public string Category { get; set; }
public override float UpwardJumpMultiplier
{
get
{
return MelonPreferences.GetEntryValue<float>(Category, "UpwardJumpMultiplier");
}
set
{
MelonPreferences.SetEntryValue<float>(Category, "UpwardJumpMultiplier", value);
}
}
public override float ForwardLeapMultiplier
{
get
{
return MelonPreferences.GetEntryValue<float>(Category, "ForwardLeapMultiplier");
}
set
{
MelonPreferences.SetEntryValue<float>(Category, "ForwardLeapMultiplier", value);
}
}
public override float JumpChargingTime
{
get
{
return MelonPreferences.GetEntryValue<float>(Category, "JumpChargingTime");
}
set
{
MelonPreferences.SetEntryValue<float>(Category, "JumpChargingTime", value);
}
}
}
public enum ProfilesEnum
{
Default,
Instant,
Disabled,
CustomA,
CustomB,
CustomC
}
private const string HyperJumpCategory = "HyperJump";
private static readonly string[] CustomProfileCategories = new string[3] { "HyperJumpCustomA", "HyperJumpCustomB", "HyperJumpCustomC" };
private static readonly Profile DefaultProfile = new Profile
{
UpwardJumpMultiplier = 1f,
ForwardLeapMultiplier = 1f,
JumpChargingTime = 1.5f
};
private static readonly Profile InstantProfile = new Profile
{
UpwardJumpMultiplier = DefaultProfile.UpwardJumpMultiplier,
ForwardLeapMultiplier = DefaultProfile.ForwardLeapMultiplier,
JumpChargingTime = 0f
};
public static readonly Dictionary<ProfilesEnum, Profile> Profiles = new Dictionary<ProfilesEnum, Profile>
{
{
ProfilesEnum.Default,
DefaultProfile
},
{
ProfilesEnum.Instant,
InstantProfile
}
};
public static ProfilesEnum ActiveProfile
{
get
{
string entryValue = MelonPreferences.GetEntryValue<string>("HyperJump", "ActiveProfile");
if (Enum.TryParse<ProfilesEnum>(entryValue, ignoreCase: true, out var result))
{
return result;
}
MelonLogger.Warning("Invalid profile '" + entryValue + "', using the default profile instead");
return ProfilesEnum.Default;
}
set
{
MelonPreferences.SetEntryValue<string>("HyperJump", "ActiveProfile", value.ToString().ToLowerInvariant());
}
}
public static void InitializePreferencesAndMenu()
{
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
MelonPreferences.CreateCategory("HyperJump");
MelonPreferences.CreateEntry<string>("HyperJump", "ActiveProfile", "default", (string)null, (string)null, false, false, (ValueValidator)null);
List<CustomProfileSetting> list = new List<CustomProfileSetting>();
string[] customProfileCategories = CustomProfileCategories;
foreach (string text in customProfileCategories)
{
MelonPreferences.CreateCategory(text);
MelonPreferences.CreateEntry<float>(text, "UpwardJumpMultiplier", DefaultProfile.UpwardJumpMultiplier, (string)null, (string)null, false, false, (ValueValidator)null);
MelonPreferences.CreateEntry<float>(text, "ForwardLeapMultiplier", DefaultProfile.ForwardLeapMultiplier, (string)null, (string)null, false, false, (ValueValidator)null);
MelonPreferences.CreateEntry<float>(text, "JumpChargingTime", DefaultProfile.JumpChargingTime, (string)null, (string)null, false, false, (ValueValidator)null);
CustomProfile profile = new CustomProfile
{
Category = text
};
Enum.TryParse<ProfilesEnum>(text.Remove(0, "HyperJump".Length), ignoreCase: true, out var result);
Profiles.Add(result, profile);
CustomProfileSetting item = new CustomProfileSetting
{
UpwardJumpMultiplier = new EditableSetting<float>
{
Initial = profile.UpwardJumpMultiplier,
Update = delegate(float f)
{
profile.UpwardJumpMultiplier = f;
}
},
ForwardLeapMultiplier = new EditableSetting<float>
{
Initial = profile.ForwardLeapMultiplier,
Update = delegate(float f)
{
profile.ForwardLeapMultiplier = f;
}
},
JumpChargingTime = new EditableSetting<float>
{
Initial = profile.JumpChargingTime,
Update = delegate(float f)
{
profile.JumpChargingTime = f;
}
}
};
list.Add(item);
}
EditableSetting<Enum> editableSetting = new EditableSetting<Enum>
{
Initial = ActiveProfile,
Update = delegate(Enum profileEnum)
{
ActiveProfile = (ProfilesEnum)(object)profileEnum;
}
};
Page val = Page.Root.CreatePage("HyperJump", Color.white, 0, true);
val.CreateEnum("Profile", Color.white, editableSetting.Initial, editableSetting.Update);
List<Page> list2 = new List<Page>
{
val.CreatePage("Custom A", new Color(0.906f, 0.298f, 0.235f), 0, true),
val.CreatePage("Custom B", new Color(0.18f, 0.8f, 0.443f), 0, true),
val.CreatePage("Custom C", new Color(0.204f, 0.596f, 0.859f), 0, true)
};
for (int j = 0; j < list2.Count; j++)
{
Page val2 = list2[j];
CustomProfileSetting customProfileSetting = list[j];
val2.CreateFloat("Upward jump multiplier", val2.Color, customProfileSetting.UpwardJumpMultiplier.Initial, 0.2f, 0f, 5f, customProfileSetting.UpwardJumpMultiplier.Update);
val2.CreateFloat("Forward leap multiplier", val2.Color, customProfileSetting.ForwardLeapMultiplier.Initial, 0.2f, 0f, 5f, customProfileSetting.ForwardLeapMultiplier.Update);
val2.CreateFloat("Jump charge time (seconds)", val2.Color, customProfileSetting.JumpChargingTime.Initial, 0.2f, 0f, 5f, customProfileSetting.JumpChargingTime.Update);
}
}
}