Decompiled source of RageLab v1.0.0

Mods/RageLab.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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 BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Audio;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.VoidLogic;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using RageLab;
using RageLab.Levels;
using RageLab.Timers;
using StreamlabsIntegration;
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), "RageLab", "1.0.0", "notnotnotswipez", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RageLab")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RageLab")]
[assembly: AssemblyTitle("RageLab")]
[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 RageLab
{
	public class Core : MelonMod
	{
		public static bool iceEverything = false;

		public static bool playerReady = false;

		public static HealthMode prevHealthMode;

		public static GenericEventTimer greaseFingersTimer;

		public static float lastDeltaTime;

		private static List<Action> OnLoadQueueActions = new List<Action>();

		private static List<GenericLevelEnemySpawns> levelSpawns = new List<GenericLevelEnemySpawns>();

		public override void OnInitializeMelon()
		{
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			if (HelperMethods.IsAndroid())
			{
				MelonLogger.Error("RAGELAB NOT SUPPORTED ON QUEST!");
				((MelonBase)this).HarmonyInstance.UnpatchSelf();
				return;
			}
			Player_Health.OnPlayerDeath += PlayerDeath.op_Implicit((Action)delegate
			{
				Audio3dManager.Play2dOneShot(RageAssets.spongeStink, Audio3dManager.hardInteraction, new Nullable<float>(1f), new Nullable<float>(1f));
			});
			levelSpawns.Add(new MineDiveEnemySpawns());
			levelSpawns.Add(new MotorwayEnemySpawns());
			AssetBundle bundle = AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(EmbeddedResourceHelper.GetResourceBytes("ragelab.assets")));
			RageAssets.LoadAssets(bundle);
			Core.OnDonationEvent = (Action<float, string, string>)Delegate.Combine(Core.OnDonationEvent, new Action<float, string, string>(OnDonationReceived));
			Hooking.OnLevelLoaded += OnLevelLoaded;
			Hooking.OnUIRigCreated += delegate
			{
				playerReady = true;
				foreach (Action onLoadQueueAction in OnLoadQueueActions)
				{
					onLoadQueueAction();
				}
				OnLoadQueueActions.Clear();
			};
			greaseFingersTimer = new GenericEventTimer(10f, loop: true, OnGreaseFingers);
			Page mainPage = Page.Root.CreatePage("RageLab", Color.red, 0, true);
			Settings.Initialize(mainPage);
		}

		public override void OnUpdate()
		{
			lastDeltaTime = Time.deltaTime;
			greaseFingersTimer.Update(lastDeltaTime);
		}

		private void OnLevelLoaded(LevelInfo info)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (Settings.extraEnemySpawns.GetValue())
			{
				foreach (GenericLevelEnemySpawns levelSpawn in levelSpawns)
				{
					if (((ScannableReference)info.levelReference).Barcode.ID == levelSpawn.LevelBarcode)
					{
						levelSpawn.SpawnOnLevel();
					}
				}
			}
			if (Settings.dualHelicopter.GetValue() && ((ScannableReference)info.levelReference).Barcode.ID == "SLZ.BONELAB.Content.Level.SprintBridge04")
			{
				MelonCoroutines.Start(WaitAndCloneCopter());
			}
			Player_Health val = ((Il2CppObjectBase)Player.RigManager.health).TryCast<Player_Health>();
			prevHealthMode = ((Health)val).healthMode;
			if (Settings.poorHealth.GetValue())
			{
				val.reloadLevelOnDeath = true;
				((Health)val).healthMode = (HealthMode)2;
				val.currDeathTime = 0.01f;
				val.deathTimeAmount = 0.01f;
				val.instaDeathTimeAmount = 0.01f;
				val.deathTimeReduction = 0.01f;
			}
			if (Settings.greaseFingers.GetValue())
			{
				greaseFingersTimer.Start();
			}
		}

		private void PlayerReadyAction(Action action)
		{
			if (playerReady)
			{
				action();
			}
			else
			{
				OnLoadQueueActions.Add(action);
			}
		}

		private IEnumerator WaitAndCloneCopter()
		{
			yield return (object)new WaitForSeconds(5f);
			CloneSprintBridgeHelicopter();
		}

		private void CloneSprintBridgeHelicopter()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("HeavyHunterChopper_Spline");
			ObjectDestructible componentInChildren = val.GetComponentInChildren<ObjectDestructible>();
			componentInChildren.damageFromAttack = false;
			componentInChildren._health = 9000000f;
			componentInChildren.maxHealth = 9000000f;
			foreach (Rigidbody componentsInChild in val.GetComponentsInChildren<Rigidbody>())
			{
				componentsInChild.detectCollisions = false;
			}
			GameObject val2 = Object.Instantiate<GameObject>(val, val.transform.position, val.transform.rotation);
			val2.GetComponentInChildren<SplineJoint>()._curSplineIndex = 6000;
			ChopperController componentInChildren2 = val2.GetComponentInChildren<ChopperController>();
			componentInChildren2.StartVolumeInside(false);
			componentInChildren2.AGRO(Player.RigManager.physicsRig.marrowEntity);
			componentInChildren2.StartVolume(false);
			componentInChildren2.StartLowPass(false);
		}

		private void OnDonationReceived(float amount, string user, string message)
		{
			if ((double)amount >= (double)Settings.resetLevelPrice.GetValue() - 0.1)
			{
				PlayerReadyAction(delegate
				{
					MelonCoroutines.Start(WaitAndResetLevel());
				});
			}
			else if ((double)amount >= (double)Settings.cultistPrice.GetValue() - 0.1)
			{
				PlayerReadyAction(delegate
				{
					RageUtils.SpawnItemWithLabel("SLZ.BONELAB.Content.Spawnable.NPCCultist", 1.5f, "Physics/Root/Head", user, null);
				});
			}
			else if ((double)amount >= (double)Settings.omniProjectorPrice.GetValue() - 0.1)
			{
				PlayerReadyAction(delegate
				{
					RageUtils.SpawnItemWithLabel("c1534c5a-7c6d-4f53-b61c-e4024f6d6e69", 1.5f, "Physics/Root/Head", user, null);
				});
			}
			else if ((double)amount >= (double)Settings.nullbodyPrice.GetValue() - 0.1)
			{
				PlayerReadyAction(delegate
				{
					RageUtils.SpawnItemWithLabel("c1534c5a-d82d-4f65-89fd-a4954e756c6c", 1.5f, "Physics/Root_M/Spine_M/Chest_M/Head_M", user, null);
				});
			}
			else if ((double)amount >= (double)Settings.crabletPrice.GetValue() - 0.1)
			{
				PlayerReadyAction(delegate
				{
					RageUtils.SpawnItemWithLabel("c1534c5a-4583-48b5-ac3f-eb9543726162", 1.5f, "PhysicsRig/Head", user, null);
				});
			}
			else
			{
				if (!((double)amount >= (double)Settings.nullratPrice.GetValue() - 0.1))
				{
					return;
				}
				PlayerReadyAction(delegate
				{
					RageUtils.SpawnItemWithLabel("c1534c5a-ef15-44c0-88ae-aebc4e756c6c", 1.5f, "Physics/Head", user, delegate(GameObject go)
					{
						//IL_0120: Unknown result type (might be due to invalid IL or missing references)
						Color val = default(Color);
						switch (Random.RandomRangeInt(0, 6))
						{
						case 0:
							((Color)(ref val))..ctor(1f, 0f, 0f);
							break;
						case 1:
							((Color)(ref val))..ctor(0f, 1f, 0f);
							break;
						case 2:
							((Color)(ref val))..ctor(0f, 0f, 1f);
							break;
						case 3:
							((Color)(ref val))..ctor(1f, 0.984f, 0f);
							break;
						case 4:
							((Color)(ref val))..ctor(0.9f, 0f, 1f);
							break;
						case 5:
							((Color)(ref val))..ctor(0f, 0.76f, 1f);
							break;
						default:
							((Color)(ref val))..ctor(1f, 0f, 0f);
							break;
						}
						foreach (MeshRenderer componentsInChild in go.GetComponentsInChildren<MeshRenderer>())
						{
							if (!((Object)((Renderer)componentsInChild).material).name.Contains("eye"))
							{
								((Renderer)componentsInChild).material.SetColor("_Color", val);
							}
						}
					});
				});
			}
		}

		private IEnumerator WaitAndResetLevel()
		{
			Audio3dManager.Play2dOneShot(RageAssets.bombTimerSound, Audio3dManager.hardInteraction, new Nullable<float>(1f), new Nullable<float>(1f));
			yield return (object)new WaitForSecondsRealtime(6.5f);
			SceneStreamer.Reload();
		}

		private void OnGreaseFingers()
		{
			bool flag = false;
			if (TryDrop(Player.LeftHand))
			{
				flag = true;
			}
			if (TryDrop(Player.RightHand))
			{
				flag = true;
			}
			if (flag)
			{
				Audio3dManager.Play2dOneShot(RageAssets.dropItemSound, Audio3dManager.hardInteraction, new Nullable<float>(0.1f), new Nullable<float>(1f));
			}
		}

		private bool TryDrop(Hand hand)
		{
			if (hand.HasAttachedObject())
			{
				Grip val = ((Il2CppObjectBase)hand.AttachedReceiver).TryCast<Grip>();
				if ((Object)(object)val != (Object)null)
				{
					val.ForceDetach(true);
					return true;
				}
			}
			return false;
		}
	}
	public class EmbeddedResourceHelper
	{
		public static byte[] GetResourceBytes(string filename)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string[] manifestResourceNames = executingAssembly.GetManifestResourceNames();
			foreach (string text in manifestResourceNames)
			{
				if (!text.Contains(filename))
				{
					continue;
				}
				using Stream stream = executingAssembly.GetManifestResourceStream(text);
				if (stream == null)
				{
					return null;
				}
				byte[] array = new byte[stream.Length];
				stream.Read(array, 0, array.Length);
				return array;
			}
			return null;
		}
	}
	public class RageAssets
	{
		public static AudioClip dropItemSound;

		public static AudioClip bombTimerSound;

		public static AudioClip spongeStink;

		public static void LoadAssets(AssetBundle bundle)
		{
			dropItemSound = HelperMethods.LoadPersistentAsset<AudioClip>(bundle, "assets/ragelab/itemdrop.wav");
			bombTimerSound = HelperMethods.LoadPersistentAsset<AudioClip>(bundle, "assets/ragelab/bombexplosion.mp3");
			spongeStink = HelperMethods.LoadPersistentAsset<AudioClip>(bundle, "assets/ragelab/spongebob.mp3");
		}
	}
	public class RageUtils
	{
		public static void SpawnItem(string barcode, Vector3 location, Quaternion rotation, Action<GameObject> onSpawn)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			GameObjectCrate val = ((Il2CppObjectBase)AssetWarehouse.Instance._crateRegistry[new Barcode(barcode)]).TryCast<GameObjectCrate>();
			Action<GameObject> action = delegate(GameObject go)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				GameObject obj = Object.Instantiate<GameObject>(go, location, rotation);
				onSpawn?.Invoke(obj);
			};
			((CrateT<GameObject>)(object)val).LoadAsset(Action<GameObject>.op_Implicit(action));
		}

		public static void SpawnItemInfrontOfPlayer(string barcode, float distance, Vector3 rotationOffset, Action<GameObject> onSpawn)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			Transform head = ((Rig)Player.RigManager.physicsRig).m_head;
			Vector3 forward = head.forward;
			forward.y = 0f;
			((Vector3)(ref forward)).Normalize();
			Vector3 location = head.position + forward * distance;
			Quaternion val = Quaternion.LookRotation(head.forward * -1f);
			val *= Quaternion.Euler(rotationOffset);
			SpawnItem(barcode, location, val, onSpawn);
		}

		public static void SpawnItemInfrontOfPlayer(string barcode, float distance, Action<GameObject> onSpawn)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			SpawnItemInfrontOfPlayer(barcode, distance, Vector3.zero, onSpawn);
		}

		public static void SpawnItemWithLabel(string barcode, float distance, string path, string label, Action<GameObject> onSpawn)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Action<GameObject> onSpawn2 = delegate(GameObject go)
			{
				MakeNameCanvas(go.transform.Find(path), 0.005f, 0.5f, label);
				BehaviourBaseNav componentInChildren = go.GetComponentInChildren<BehaviourBaseNav>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					componentInChildren.SetEngaged(((Component)Player.RigManager).GetComponentInChildren<TriggerRefProxy>());
				}
				onSpawn?.Invoke(go);
			};
			SpawnItemInfrontOfPlayer(barcode, distance, Vector3.zero, onSpawn2);
		}

		private static GameObject MakeNameCanvas(Transform parent, float scale, float yAdd, string text)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			GameObject val = new GameObject("Looker");
			GameObject val2 = new GameObject("NameCanvas");
			val2.transform.parent = val.transform;
			val2.transform.localPosition = Vector3.zero;
			val2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
			val.AddComponent<LookAtCameraContinuous>();
			Canvas val3 = val2.AddComponent<Canvas>();
			val3.renderMode = (RenderMode)2;
			val.transform.parent = parent;
			val.transform.localPosition = Vector3.zero;
			val.transform.position = val.transform.position + Vector3.up * yAdd;
			val2.transform.localScale = Vector3.one * scale;
			TextMeshProUGUI val4 = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)val4).text = text;
			((TMP_Text)val4).alignment = (TextAlignmentOptions)4098;
			((TMP_Text)val4).enableAutoSizing = true;
			return val2;
		}
	}
	public static class Settings
	{
		private static MelonPreferences_Category mainCategory = MelonPreferences.CreateCategory("RageLab");

		public static SavedBoolSetting dualHelicopter = new SavedBoolSetting(mainCategory, "dualHelicopter", defaultValue: true, "Dual Helicopter", reloadRequired: true);

		public static SavedBoolSetting slowDoors = new SavedBoolSetting(mainCategory, "slowDoors", defaultValue: true, "Slow Doors", reloadRequired: true);

		public static SavedBoolSetting moonbaseHighGravity = new SavedBoolSetting(mainCategory, "moonbaseHighGravity", defaultValue: true, "Moonbase High Gravity", reloadRequired: true);

		public static SavedBoolSetting extraEnemySpawns = new SavedBoolSetting(mainCategory, "extraEnemySpawns", defaultValue: true, "Extra Enemy Spawns", reloadRequired: true);

		public static SavedBoolSetting poorHealth = new SavedBoolSetting(mainCategory, "poorHealth", defaultValue: true, "Poor Health", reloadRequired: false);

		public static SavedBoolSetting greaseFingers = new SavedBoolSetting(mainCategory, "greaseFingers", defaultValue: true, "Grease Fingers", reloadRequired: false);

		public static SavedFloatSetting nullratPrice = new SavedFloatSetting(mainCategory, "nullratPrice", 1f, "NullRat Price");

		public static SavedFloatSetting crabletPrice = new SavedFloatSetting(mainCategory, "crabletPrice", 2f, "Crablet Price");

		public static SavedFloatSetting nullbodyPrice = new SavedFloatSetting(mainCategory, "nullbodyPrice", 5f, "Nullbody Price");

		public static SavedFloatSetting omniProjectorPrice = new SavedFloatSetting(mainCategory, "omniPrice", 10f, "Omni Projector Price");

		public static SavedFloatSetting cultistPrice = new SavedFloatSetting(mainCategory, "cultistPrice", 15f, "Cultist Price");

		public static SavedFloatSetting resetLevelPrice = new SavedFloatSetting(mainCategory, "resetPrice", 25f, "Reset Level Price");

		public static void Initialize(Page mainPage)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			mainPage.CreateBool("Grease Fingers", Color.green, greaseFingers.GetValue(), (Action<bool>)delegate(bool b)
			{
				greaseFingers.SetValue(b);
				if (!b)
				{
					Core.greaseFingersTimer.Stop();
				}
				else
				{
					Core.greaseFingersTimer.Start();
				}
			});
			mainPage.CreateBool("Poor Health", Color.green, poorHealth.GetValue(), (Action<bool>)delegate(bool b)
			{
				poorHealth.SetValue(b);
				Player_Health val2 = ((Il2CppObjectBase)Player.RigManager.health).TryCast<Player_Health>();
				if (!b)
				{
					val2.reloadLevelOnDeath = false;
					((Health)val2).healthMode = (HealthMode)1;
					val2.currDeathTime = 3f;
					val2.deathTimeAmount = 3f;
					val2.instaDeathTimeAmount = 3f;
					val2.deathTimeReduction = 3f;
				}
				else
				{
					val2.reloadLevelOnDeath = true;
					((Health)val2).healthMode = (HealthMode)2;
					val2.currDeathTime = 0.01f;
					val2.deathTimeAmount = 0.01f;
					val2.instaDeathTimeAmount = 0.01f;
					val2.deathTimeReduction = 0.01f;
				}
			});
			Page val = mainPage.CreatePage("Level Options", Color.yellow, 0, true);
			Page page = mainPage.CreatePage("Donation Options", Color.yellow, 0, true);
			dualHelicopter.InitializeMenuEntry(val);
			slowDoors.InitializeMenuEntry(val);
			moonbaseHighGravity.InitializeMenuEntry(val);
			extraEnemySpawns.InitializeMenuEntry(val);
			nullratPrice.InitializeMenuEntry(page);
			crabletPrice.InitializeMenuEntry(page);
			nullbodyPrice.InitializeMenuEntry(page);
			omniProjectorPrice.InitializeMenuEntry(page);
			cultistPrice.InitializeMenuEntry(page);
			resetLevelPrice.InitializeMenuEntry(page);
			val.CreateFunction("Reload Level", Color.green, (Action)delegate
			{
				SceneStreamer.Reload();
			});
		}
	}
	public abstract class SavedSetting<T>
	{
		internal MelonPreferences_Entry<T> _entry;

		internal MelonPreferences_Category _Category;

		internal string displayName;

		public SavedSetting(MelonPreferences_Category category, string name, T defaultValue, string displayName)
		{
			_entry = category.CreateEntry<T>(name, defaultValue, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_Category = category;
			this.displayName = displayName;
		}

		public void SetValue(T value)
		{
			_entry.Value = value;
			_Category.SaveToFile(false);
		}

		public T GetValue()
		{
			return _entry.Value;
		}

		public abstract void InitializeMenuEntry(Page page);
	}
	public class SavedBoolSetting : SavedSetting<bool>
	{
		private bool reloadRequired = false;

		public SavedBoolSetting(MelonPreferences_Category category, string name, bool defaultValue, string displayName, bool reloadRequired)
			: base(category, name, defaultValue, displayName)
		{
			this.reloadRequired = reloadRequired;
		}

		public override void InitializeMenuEntry(Page page)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			page.CreateBool(displayName, Color.green, _entry.Value, (Action<bool>)delegate(bool b)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Expected O, but got Unknown
				SetValue(b);
				if (reloadRequired)
				{
					Notifier.Send(new Notification
					{
						Title = NotificationText.op_Implicit("Level Reload Required!"),
						ShowTitleOnPopup = true,
						Message = NotificationText.op_Implicit("Reload to apply relevant changes."),
						PopupLength = 3f
					});
				}
			});
		}
	}
	public class SavedFloatSetting : SavedSetting<float>
	{
		public SavedFloatSetting(MelonPreferences_Category category, string name, float defaultValue, string displayName)
			: base(category, name, defaultValue, displayName)
		{
		}

		public override void InitializeMenuEntry(Page page)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			page.CreateFloat(displayName, Color.green, _entry.Value, 1f, 0f, 100f, (Action<float>)delegate(float f)
			{
				SetValue(f);
			});
		}
	}
}
namespace RageLab.Timers
{
	public class GenericEventTimer
	{
		private float currentTime;

		private float startingTime;

		private bool loop;

		private bool running;

		private Action onFinished;

		public GenericEventTimer(float time, bool loop, Action onFinished)
		{
			currentTime = time;
			startingTime = time;
			this.loop = loop;
			this.onFinished = onFinished;
		}

		public void Start(float timeOverride = -1f)
		{
			if (timeOverride != -1f)
			{
				startingTime = timeOverride;
			}
			currentTime = startingTime;
			running = true;
		}

		public void Stop()
		{
			running = false;
		}

		public void Update(float deltaTime)
		{
			if (!running)
			{
				return;
			}
			currentTime -= deltaTime;
			if (currentTime < 0f)
			{
				onFinished();
				running = false;
				if (loop)
				{
					Start();
				}
			}
		}
	}
}
namespace RageLab.Patches
{
	[HarmonyPatch(typeof(Player_Health), "TAKEDAMAGE")]
	public class PlayerDamagePatch
	{
		public static void Prefix(ref float damage)
		{
			if (Settings.poorHealth.GetValue())
			{
				damage *= 6f;
			}
		}
	}
	[HarmonyPatch(typeof(Player_Health), "Death")]
	public class PlayerDeathPatch
	{
		public static void Postfix(Player_Health __instance)
		{
			__instance.isInstaDying = false;
			__instance.isFadingVignette = false;
			if (Settings.poorHealth.GetValue())
			{
				__instance.currDeathTime = 0.01f;
				__instance.deathTimeAmount = 0.01f;
				__instance.instaDeathTimeAmount = 0.01f;
				__instance.deathTimeReduction = 0.01f;
			}
		}
	}
	[HarmonyPatch(typeof(GameControl_MoonBase), "MoonMode")]
	public class MoonBaseMoonModePatch
	{
		public static void Prefix(GameControl_MoonBase __instance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (Settings.moonbaseHighGravity.GetValue())
			{
				__instance._moonGrav = new Vector3(0f, -29.43f, 0f);
			}
		}
	}
	[HarmonyPatch(typeof(LinearJoint), "Start")]
	public class LinearJointInitPatch
	{
		public static void Postfix(LinearJoint __instance)
		{
			JointSlowerHelper.SlowJoint(__instance._configurableJoint, 50f);
		}
	}
	[HarmonyPatch(typeof(Cart), "Setup")]
	public class CartInitPatch
	{
		public static void Postfix(Cart __instance)
		{
			JointSlowerHelper.SlowJoint(__instance.joint, 50f);
		}
	}
	[HarmonyPatch(typeof(LoadingScene), "Start")]
	public class LoadingSceneStartPatch
	{
		public static void Postfix(LoadingScene __instance)
		{
			Core.playerReady = false;
			if (((Scannable)SceneStreamer.Session.Level).Barcode.ID == "SLZ.BONELAB.Content.Level.SprintBridge04")
			{
				Core.iceEverything = true;
			}
			else
			{
				Core.iceEverything = false;
			}
		}
	}
	public static class JointSlowerHelper
	{
		public static void SlowJoint(ConfigurableJoint joint, float slowMult)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			if (Settings.slowDoors.GetValue())
			{
				Rigidbody component = ((Component)joint).GetComponent<Rigidbody>();
				float num = 500f / component.mass;
				slowMult *= num;
				if (((Object)((Component)component).gameObject).name.Contains("airlock_smalldoor", StringComparison.CurrentCultureIgnoreCase))
				{
					slowMult = 100f;
				}
				JointDrive xDrive = joint.xDrive;
				JointDrive yDrive = joint.yDrive;
				JointDrive zDrive = joint.zDrive;
				((JointDrive)(ref xDrive)).positionDamper = ((JointDrive)(ref xDrive)).positionDamper * slowMult;
				((JointDrive)(ref yDrive)).positionDamper = ((JointDrive)(ref yDrive)).positionDamper * slowMult;
				((JointDrive)(ref zDrive)).positionDamper = ((JointDrive)(ref zDrive)).positionDamper * slowMult;
				joint.xDrive = xDrive;
				joint.yDrive = yDrive;
				joint.zDrive = zDrive;
				MarrowJoint component2 = ((Component)joint).GetComponent<MarrowJoint>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					ConfigurableJointInfo defaultConfigJointInfo = component2._defaultConfigJointInfo;
					defaultConfigJointInfo.xDriveExt = new JointDriveExt
					{
						positionDamper = ((JointDrive)(ref xDrive)).positionDamper,
						positionSpring = ((JointDrive)(ref xDrive)).positionSpring,
						maximumForce = ((JointDrive)(ref xDrive)).maximumForce
					};
					defaultConfigJointInfo.yDriveExt = new JointDriveExt
					{
						positionDamper = ((JointDrive)(ref yDrive)).positionDamper,
						positionSpring = ((JointDrive)(ref yDrive)).positionSpring,
						maximumForce = ((JointDrive)(ref yDrive)).maximumForce
					};
					defaultConfigJointInfo.zDriveExt = new JointDriveExt
					{
						positionDamper = ((JointDrive)(ref zDrive)).positionDamper,
						positionSpring = ((JointDrive)(ref zDrive)).positionSpring,
						maximumForce = ((JointDrive)(ref zDrive)).maximumForce
					};
					component2._defaultConfigJointInfo = defaultConfigJointInfo;
				}
			}
		}
	}
}
namespace RageLab.Levels
{
	public class EnemySpawnPoint
	{
		public Vector3 location;

		public Vector3 lookVector;

		public string barcode;

		public EnemySpawnPoint(Vector3 loc, Vector3 look, string barcode)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			location = loc;
			lookVector = look;
			this.barcode = barcode;
		}
	}
	public abstract class GenericLevelEnemySpawns
	{
		public List<EnemySpawnPoint> SpawnPoints = new List<EnemySpawnPoint>();

		public abstract string LevelBarcode { get; }

		public void SpawnOnLevel()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			TriggerRefProxy playerProxy = ((Component)Player.RigManager).GetComponentInChildren<TriggerRefProxy>();
			foreach (EnemySpawnPoint spawnPoint in SpawnPoints)
			{
				RageUtils.SpawnItem(spawnPoint.barcode, spawnPoint.location, Quaternion.Euler(spawnPoint.lookVector), delegate(GameObject go)
				{
					BehaviourBaseNav componentInChildren = go.GetComponentInChildren<BehaviourBaseNav>();
					if (Object.op_Implicit((Object)(object)componentInChildren))
					{
						componentInChildren.SetAgro(playerProxy);
					}
				});
			}
		}
	}
	public class MineDiveEnemySpawns : GenericLevelEnemySpawns
	{
		public override string LevelBarcode => "c2534c5a-54df-470b-baaf-741f4c657665";

		public MineDiveEnemySpawns()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: 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_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_044f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0533: Unknown result type (might be due to invalid IL or missing references)
			//IL_0547: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-24f, -3.38f, 44.88f), new Vector3(1f, 0f, -0.09f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-23.05f, -3.38f, 42.63f), new Vector3(1f, 0f, -0.04f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-57.07f, 0.21f, 63.22f), new Vector3(0.34f, 0f, -0.94f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-62.12f, 9.38f, 82.71f), new Vector3(0.69f, 0f, -0.72f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-56.06f, 25.63f, 129.86f), new Vector3(0.1f, 0f, -1f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-38.47f, 33.53f, 101.11f), new Vector3(-0.26f, 0f, 0.96f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-41.21f, 54.68f, 46.16f), new Vector3(0.17f, 0f, 0.99f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-27.12f, 54.63f, 22.19f), new Vector3(-0.42f, 0f, 0.91f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(2.72f, 45.61f, 24.81f), new Vector3(-0.94f, 0f, -0.35f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(31.75f, 45.61f, 21.6f), new Vector3(-1f, 0f, 0.09f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(41.57f, 45.62f, 24.36f), new Vector3(-1f, 0f, -0.09f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(89.22f, 25.58f, 47.55f), new Vector3(0f, 0f, 1f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(50.94f, 23.03f, 24.16f), new Vector3(0.34f, 0f, -0.94f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(31.89f, 20.27f, 56.04f), new Vector3(0.85f, 0f, 0.53f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(16.27f, 19.69f, 44.69f), new Vector3(0.96f, 0f, -0.26f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-30.98f, 12.84f, 76.01f), new Vector3(-0.2f, 0f, -0.98f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-139.37f, -6.51f, 56.98f), new Vector3(0.85f, 0f, 0.52f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-131.31f, -5.57f, 56.69f), new Vector3(0.58f, 0f, 0.81f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-156.54f, -16.41f, 129.45f), new Vector3(-0.58f, 0f, -0.82f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-310.7f, -23.35f, 330.64f), new Vector3(0.94f, 0f, 0.33f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-444.12f, -23.45f, 331.04f), new Vector3(-0.15f, 0f, -0.99f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-478.89f, -23.49f, 367.46f), new Vector3(0.95f, 0f, -0.33f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-451.02f, -34.88f, 494.59f), new Vector3(-0.84f, 0f, -0.54f), "c1534c5a-2775-4009-9447-22d94e756c6c"));
		}
	}
	public class MotorwayEnemySpawns : GenericLevelEnemySpawns
	{
		public override string LevelBarcode => "SLZ.BONELAB.Content.Level.LevelKartRace";

		public MotorwayEnemySpawns()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(15.92f, 3.1f, -25.52f), new Vector3(0.24f, 0f, -0.97f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(10.43f, 3.1f, -22.91f), new Vector3(-0.04f, 0f, 1f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(14.41f, 3.08f, 20.83f), new Vector3(0.61f, 0f, -0.8f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(-21.69f, 4.93f, 11.2f), new Vector3(0.52f, 0f, -0.85f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(14.61f, 1f, 42.83f), new Vector3(-0.76f, 0f, -0.65f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(46.29f, 3.41f, 46.22f), new Vector3(0.55f, 0f, 0.84f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(44.23f, 4.81f, 13.32f), new Vector3(-0.33f, 0f, 0.94f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
			SpawnPoints.Add(new EnemySpawnPoint(new Vector3(73.2f, 1.75f, -9.65f), new Vector3(-0.99f, 0f, 0.14f), "SLZ.BONELAB.Content.Spawnable.NPCCultist"));
		}
	}
}