Decompiled source of PowerLift v1.0.0

Mods/PowerLift.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppFemur;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using PowerLift;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Mod), "PowerLift", "1.0.0", "TheUltimateNuke", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PowerLift")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+d96ccdf215f37c32a478c0cc46d324c30ccbfe81")]
[assembly: AssemblyProduct("PowerLift")]
[assembly: AssemblyTitle("PowerLift")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 PowerLift
{
	[HarmonyPatch(typeof(MovementHandeler_HumanoidMediumEctomorph), "ArmActionGrabbing")]
	public static class GrabPatch
	{
		private static void Postfix(MovementHandeler_HumanoidMediumEctomorph __instance, Side side)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Invalid comparison between Unknown and I4
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			ConfigurableJoint val = null;
			Rigidbody val2 = null;
			Transform partTransform = ((MovementHandeler)__instance).actor.bodyHandeler.Chest.PartTransform;
			Transform val3 = null;
			Transform val4 = null;
			Rigidbody val5 = null;
			Rigidbody val6 = null;
			if ((int)side != 0)
			{
				if ((int)side != 1)
				{
					return;
				}
				val3 = ((MovementHandeler)__instance).actor.bodyHandeler.RightArm.PartTransform;
				val4 = ((MovementHandeler)__instance).actor.bodyHandeler.RightForarm.PartTransform;
				_ = ((MovementHandeler)__instance).actor.bodyHandeler.RightHand.PartTransform;
				val5 = ((MovementHandeler)__instance).actor.bodyHandeler.RightArm.PartRigidbody;
				val6 = ((MovementHandeler)__instance).actor.bodyHandeler.RightForarm.PartRigidbody;
				_ = ((MovementHandeler)__instance).actor.bodyHandeler.RightHand.PartRigidbody;
				val = ((MovementHandeler)__instance).actor.bodyHandeler.rightGrabJoint;
				val2 = ((MovementHandeler)__instance).actor.bodyHandeler.rightGrabRigidbody;
				_ = ((MovementHandeler)__instance).actor.bodyHandeler.rightGrabTransform;
			}
			else
			{
				val3 = ((MovementHandeler)__instance).actor.bodyHandeler.LeftArm.PartTransform;
				val4 = ((MovementHandeler)__instance).actor.bodyHandeler.LeftForarm.PartTransform;
				_ = ((MovementHandeler)__instance).actor.bodyHandeler.LeftHand.PartTransform;
				val5 = ((MovementHandeler)__instance).actor.bodyHandeler.LeftArm.PartRigidbody;
				val6 = ((MovementHandeler)__instance).actor.bodyHandeler.LeftForarm.PartRigidbody;
				_ = ((MovementHandeler)__instance).actor.bodyHandeler.LeftHand.PartRigidbody;
				val = ((MovementHandeler)__instance).actor.bodyHandeler.leftGrabJoint;
				val2 = ((MovementHandeler)__instance).actor.bodyHandeler.leftGrabRigidbody;
				_ = ((MovementHandeler)__instance).actor.bodyHandeler.leftGrabTransform;
			}
			if (((MovementHandeler)__instance).actor.controlHandeler.lift && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
			{
				float num = Mathf.Clamp(Mathf.Sin(val2.mass / 800f) * 200f, 0f, Mod.LiftStrength);
				((MovementHandeler)__instance).AlignToVector(val5, -val3.up, Vector3.up + partTransform.forward * 0.8f, 0.1f, Mathf.Approximately(Mod.LiftStrength, 25f) ? Mod.LiftStrength : (Mod.LiftStrength / 4f));
				((MovementHandeler)__instance).AlignToVector(val6, -val4.up, Vector3.up + partTransform.forward * 0.8f, 0.1f, Mathf.Approximately(Mod.LiftStrength, 25f) ? Mod.LiftStrength : (Mod.LiftStrength / 4f));
				if (((MovementHandeler)__instance).actor.controlHandeler.onGround)
				{
					val2.AddForce(Vector3.up * num, (ForceMode)1);
					val5.AddForce(Vector3.down * num, (ForceMode)1);
				}
			}
		}
	}
	public class Mod : MelonMod
	{
		private static readonly MelonPreferences_Category _category = MelonPreferences.CreateCategory("PowerLift", "PowerLift");

		private static readonly MelonPreferences_Entry<float> _liftStrengthPref = _category.CreateEntry<float>("LiftStrength", 100f, "Lift Strength", (string)null, false, false, (ValueValidator)null, (string)null);

		public static float LiftStrength
		{
			get
			{
				return _liftStrengthPref.Value;
			}
			set
			{
				_liftStrengthPref.Value = value;
			}
		}

		public static Instance Logger => Melon<Mod>.Logger;

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg(ConsoleColor.Green, "Mod PowerLift initialized!");
		}
	}
	internal static class MyModInfo
	{
		public const string Author = "TheUltimateNuke";

		public const string Name = "PowerLift";

		public const string Version = "1.0.0";
	}
}