Decompiled source of Quantity Of Lab v1.1.0

Mods/QuantityOfLab.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
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 Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using Microsoft.CodeAnalysis;
using QuantityOfLab;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "QuantityOfLab", "1.0.0", "The Static Squad", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("QuantityOfLab")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QuantityOfLab")]
[assembly: AssemblyTitle("QuantityOfLab")]
[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]
	[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 QuantityOfLab
{
	public class Core : MelonMod
	{
		public static bool activateMod;

		private static Random random = new Random();

		private bool canFire;

		private float fireTimer;

		public override void OnInitializeMelon()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			((MelonBase)this).LoggerInstance.Msg("Initialized.");
			Page.Root.CreateFunction("Activate QuantityOfLab", Color.yellow, (Action)delegate
			{
				activateMod = !activateMod;
				((MelonBase)this).LoggerInstance.Msg("QuantityOfLab is now " + (activateMod ? "on" : "off") + ".");
			});
		}

		public override void OnUpdate()
		{
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (!activateMod)
			{
				return;
			}
			if (!canFire)
			{
				fireTimer -= Time.deltaTime;
				if (fireTimer <= 0f)
				{
					fireTimer = 1f;
					canFire = true;
				}
				return;
			}
			canFire = false;
			switch (random.Next(0, 10))
			{
			case 1:
			{
				foreach (Rigidbody item in Object.FindObjectsOfType<Rigidbody>())
				{
					item.AddForce(Vector3.one * (float)random.Next(1, 30), (ForceMode)1);
				}
				break;
			}
			case 2:
			{
				HashSet<Rigidbody> selfRbs = Player.GetPhysicsRig().selfRbs;
				List<Rigidbody> list = new List<Rigidbody>(selfRbs.Count);
				Enumerator<Rigidbody> enumerator2 = selfRbs.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					Rigidbody current2 = enumerator2.Current;
					list.Add(current2);
				}
				Object.Destroy((Object)(object)((Component)list[random.Next(0, Player.PhysicsRig.selfRbs.Count - 1)]).gameObject.AddComponent<FixedJoint>(), (float)random.Next(0, 2));
				break;
			}
			case 3:
			{
				Vector3 position = ((Component)((Component)((Rig)Player.GetPhysicsRig()).m_head).transform).transform.position;
				for (int i = 0; i < 10; i++)
				{
					GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
					obj.transform.position = position;
					obj.AddComponent<Rigidbody>();
					((Renderer)obj.GetComponent<MeshRenderer>()).sharedMaterials = ((Renderer)((Il2CppArrayBase<SkinnedMeshRenderer>)(object)Player.Avatar.bodyMeshes)[0]).sharedMaterials;
					Object.Destroy((Object)(object)obj, (float)random.Next(1, 7));
				}
				break;
			}
			case 4:
			{
				foreach (Rigidbody item2 in Object.FindObjectsOfType<Rigidbody>())
				{
					item2.collisionDetectionMode = (CollisionDetectionMode)(!((double)random.NextSingle() > 0.6));
				}
				break;
			}
			case 5:
				Time.timeScale = 1f + random.NextSingle();
				break;
			case 6:
			{
				Enumerator<Rigidbody> enumerator2 = Player.PhysicsRig.selfRbs.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					enumerator2.Current.AddForce(Vector3.up * (float)random.Next(0, 4), (ForceMode)1);
				}
				break;
			}
			case 7:
			{
				int index = random.Next(0, Guns.All.Count - 1);
				HelperMethods.SpawnCrate(Guns.All[index], ((Rig)Player.GetPhysicsRig()).m_head.position + ((Rig)Player.GetPhysicsRig()).m_head.forward, default(Quaternion), Vector3.one, false, (Action<GameObject>)null, (Action<GameObject>)null);
				break;
			}
			case 8:
			{
				foreach (Camera item3 in (Il2CppArrayBase<Camera>)(object)Player.ControllerRig.cameras)
				{
					item3.farClipPlane = random.Next(1, 1000);
					item3.nearClipPlane = random.NextSingle() / 2f;
				}
				break;
			}
			case 9:
				Player.GetPhysicsRig().ResetHands((Handedness)3);
				break;
			case 10:
				HelperMethods.SpawnCrate(NPCs.All[random.Next(0, NPCs.All.Count - 1)], ((Component)((Rig)Player.GetPhysicsRig()).m_head).transform.position + ((Component)((Rig)Player.GetPhysicsRig()).m_head).transform.forward * 2f, default(Quaternion), default(Vector3), false, (Action<GameObject>)null, (Action<GameObject>)null);
				break;
			}
		}
	}
}