Decompiled source of PGLab v1.0.0

PGLab.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppSLZ.Combat;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.VRMK;
using MelonLoader;
using Microsoft.CodeAnalysis;
using PGLab;
using PGLab.NoBlood;
using PGLab.Softbody;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Main), "PGLab", "1.0.0", "PGLab", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PGLab")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+5a5e57bbf5cb8b57596cd2570411aacf84cc375b")]
[assembly: AssemblyProduct("PGLab")]
[assembly: AssemblyTitle("PGLab")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PGLab
{
	public class Main : MelonMod
	{
		public override void OnInitializeMelon()
		{
			try
			{
				MelonLogger.Msg("Making BONELAB PG...");
				NoBloodPatches.ApplyPatches((MelonMod)(object)this);
				BreastPatches.ApplyPatches((MelonMod)(object)this);
				ButtPatches.ApplyPatches((MelonMod)(object)this);
				MelonLogger.Msg("Finished making BONELAB PG.");
			}
			catch (Exception ex)
			{
				MelonLogger.Error("An error occurred during initialization: " + ex.Message);
			}
		}
	}
}
namespace PGLab.Softbody
{
	internal class BreastPatches
	{
		public static void ApplyPatches(MelonMod mod)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			Harmony harmonyInstance = ((MelonBase)mod).HarmonyInstance;
			MethodInfo method = typeof(Avatar).GetMethod("GenerateBreastMesh");
			MethodInfo method2 = typeof(PhysSoftBody).GetMethod("CalibrateTorsoColliders");
			MethodInfo method3 = typeof(PhysSoftBody).GetMethod("CalibrateJoints");
			MethodInfo method4 = typeof(PhysSoftBody).GetMethod("UpdateKinematicBridges");
			MethodInfo method5 = typeof(BreastPatches).GetMethod("DontRunThis", BindingFlags.Static | BindingFlags.Public);
			if (method != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method2 != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method2, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method3 != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method3, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method4 != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method4, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static void RevertPatches(MelonMod mod)
		{
			Harmony harmonyInstance = ((MelonBase)mod).HarmonyInstance;
			MethodInfo method = typeof(Avatar).GetMethod("GenerateBreastMesh");
			MethodInfo method2 = typeof(PhysSoftBody).GetMethod("CalibrateTorsoColliders");
			MethodInfo method3 = typeof(PhysSoftBody).GetMethod("CalibrateJoints");
			MethodInfo method4 = typeof(PhysSoftBody).GetMethod("UpdateKinematicBridges");
			if (method != null)
			{
				harmonyInstance.Unpatch((MethodBase)method, (HarmonyPatchType)1, "*");
			}
			if (method2 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method2, (HarmonyPatchType)1, "*");
			}
			if (method3 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method3, (HarmonyPatchType)1, "*");
			}
			if (method4 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method4, (HarmonyPatchType)1, "*");
			}
		}

		public static bool DontRunThis(MethodBase __originalMethod)
		{
			return false;
		}
	}
	internal class ButtPatches
	{
		public static void ApplyPatches(MelonMod mod)
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			Harmony harmonyInstance = ((MelonBase)mod).HarmonyInstance;
			MethodInfo method = typeof(Avatar).GetMethod("GenerateButtMesh");
			MethodInfo method2 = typeof(PhysSoftBody).GetMethod("CalibrateTorsoColliders");
			MethodInfo method3 = typeof(PhysSoftBody).GetMethod("CalibrateJoints");
			MethodInfo method4 = typeof(PhysSoftBody).GetMethod("UpdateKinematicBridges");
			MethodInfo method5 = typeof(BreastPatches).GetMethod("DontRunThis", BindingFlags.Static | BindingFlags.Public);
			if (method != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method2 != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method2, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method3 != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method3, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method4 != null && method5 != null)
			{
				harmonyInstance.Patch((MethodBase)method4, new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static void RevertPatches(MelonMod mod)
		{
			Harmony harmonyInstance = ((MelonBase)mod).HarmonyInstance;
			MethodInfo method = typeof(Avatar).GetMethod("GenerateButtMesh");
			MethodInfo method2 = typeof(PhysSoftBody).GetMethod("CalibrateTorsoColliders");
			MethodInfo method3 = typeof(PhysSoftBody).GetMethod("CalibrateJoints");
			MethodInfo method4 = typeof(PhysSoftBody).GetMethod("UpdateKinematicBridges");
			if (method != null)
			{
				harmonyInstance.Unpatch((MethodBase)method, (HarmonyPatchType)1, "*");
			}
			if (method2 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method2, (HarmonyPatchType)1, "*");
			}
			if (method3 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method3, (HarmonyPatchType)1, "*");
			}
			if (method4 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method4, (HarmonyPatchType)1, "*");
			}
		}

		public static bool DontRunThis(MethodBase __originalMethod)
		{
			return false;
		}
	}
}
namespace PGLab.NoBlood
{
	internal class NoBloodPatches
	{
		public static void ApplyPatches(MelonMod mod)
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			Harmony harmonyInstance = ((MelonBase)mod).HarmonyInstance;
			MethodInfo method = typeof(VisualDamageReceiver).GetMethod("ReceiveAttack");
			MethodInfo method2 = typeof(ImpactProperties).GetMethod("ReceiveAttack");
			MethodInfo method3 = typeof(NoBloodPatches).GetMethod("DontRunThis", BindingFlags.Static | BindingFlags.Public);
			if (method != null && method3 != null)
			{
				harmonyInstance.Patch((MethodBase)method, new HarmonyMethod(method3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (method2 != null && method3 != null)
			{
				harmonyInstance.Patch((MethodBase)method2, new HarmonyMethod(method3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public static void RevertPatches(MelonMod mod)
		{
			Harmony harmonyInstance = ((MelonBase)mod).HarmonyInstance;
			MethodInfo method = typeof(VisualDamageReceiver).GetMethod("ReceiveAttack");
			MethodInfo method2 = typeof(ImpactProperties).GetMethod("ReceiveAttack");
			if (method != null)
			{
				harmonyInstance.Unpatch((MethodBase)method, (HarmonyPatchType)1, "*");
			}
			if (method2 != null)
			{
				harmonyInstance.Unpatch((MethodBase)method2, (HarmonyPatchType)1, "*");
			}
		}

		public static bool DontRunThis(MethodBase __originalMethod)
		{
			return false;
		}
	}
}