Decompiled source of Hexaback v1.0.1

Mods/HexaBack.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using HexaBack;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
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: MelonInfo(typeof(Core), "HexaBack", "1.0.0", "freakycheesy", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("HexaBack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eb94cb027c29cc39750a90ff2aca81ab42a09115")]
[assembly: AssemblyProduct("HexaBack")]
[assembly: AssemblyTitle("HexaBack")]
[assembly: NeutralResourcesLanguage("en-US")]
[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 HexaBack
{
	public class Core : MelonMod
	{
		public static Page page;

		public static MelonPreferences_Category category;

		public static MelonPreferences_Entry<bool> modEnabled;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("Initialized HexaBack.");
			CreatePrefs();
			CreateBoneMenu();
			Hooking.OnLevelLoaded += Hooking_OnMarrowGameStarted;
		}

		private static void CreatePrefs()
		{
			category = MelonPreferences.CreateCategory("Hexaback");
			category.SetFilePath("UserData/freakycheesy.cfg", true);
			modEnabled = category.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		}

		private void CreateBoneMenu()
		{
			//IL_000b: 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)
			page = Page.Root.CreatePage("Hexaback", Color.green, 0, true);
			page.CreateBool("Toggle Mod (Works on Level Load)", Color.green, modEnabled.Value, (Action<bool>)delegate(bool a)
			{
				modEnabled.Value = a;
				Save();
			});
		}

		private static void Save()
		{
			category.SaveToFile(true);
			MelonPreferences.Save();
		}

		public override void OnApplicationQuit()
		{
			MelonPreferences.Save();
			((MelonBase)this).OnApplicationQuit();
		}

		private void Hooking_OnMarrowGameStarted(LevelInfo info)
		{
			MakeHeptabodyHexabody(Player.PhysicsRig);
		}

		private static void MakeHeptabodyHexabody(PhysicsRig rig)
		{
			Collider component = ((Component)((Rig)rig).m_shoulderLf).GetComponent<Collider>();
			Collider component2 = ((Component)((Rig)rig).m_shoulderRt).GetComponent<Collider>();
			Collider component3 = ((Component)((Rig)rig).m_elbowLf).GetComponent<Collider>();
			Collider component4 = ((Component)((Rig)rig).m_elbowRt).GetComponent<Collider>();
			Hand[] array = (Hand[])(object)new Hand[2] { rig.leftHand, rig.rightHand };
			if (modEnabled.Value)
			{
				component.isTrigger = true;
				component2.isTrigger = true;
				component3.isTrigger = true;
				component4.isTrigger = true;
				RemapRig remapHeptaRig = ((Rig)rig).manager.remapHeptaRig;
				remapHeptaRig.jumpVelocity /= 1.3f;
				Hand[] array2 = array;
				foreach (Hand val in array2)
				{
					float num = 2f;
					PhysHand physHand = val.physHand;
					physHand._armInternalMult *= num;
				}
			}
		}
	}
}