Decompiled source of RevLabs v1.0.0

Mods/RevLabs.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using RUMBLE.Environment;
using RUMBLE.Managers;
using RUMBLE.Players.Subsystems;
using RUMBLE.Utilities;
using RevLabs;
using RumbleModdingAPI;
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(Class1), "RevLabs", "1.0.0", "Revenoon", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("RevLabs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RevLabs")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8c3d206e-3a94-47c5-aacc-23650b65bdd6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RevLabs;

public class Class1 : MelonMod
{
	private string currentScene = "";

	private GameObject livCam;

	private Camera realCamera;

	private GameObject screenWall;

	private GameObject screenFloor;

	private GameObject player;

	private DateTime pause;

	private bool rKeyPressed = false;

	private bool rKeyReleased = true;

	private bool eKeyPressed = false;

	private bool eKeyReleased = true;

	private string[] fileText;

	private ParkInstance parkInstance;

	public static string[] ReadFileText(string filePath, string fileName)
	{
		try
		{
			return File.ReadAllLines(filePath + "\\" + fileName);
		}
		catch
		{
			return null;
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		if (sceneName == "Gym")
		{
			MelonLogger.Msg(Singleton<PlayerManager>.instance.localPlayer.Data.GeneralData.PublicUsername);
		}
		currentScene = sceneName;
		fileText = ReadFileText("UserData\\RevLabs", "Settings.txt");
	}

	public override void OnUpdate()
	{
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		if (!(currentScene == "Park"))
		{
			return;
		}
		if (Input.GetKeyDown((KeyCode)114) && rKeyReleased && !rKeyPressed)
		{
			MelonLogger.Msg("Normal Mode");
			parkInstance = GameObject.Find("________________LOGIC__________________ /Park Instance").GetComponent<ParkInstance>();
			parkInstance.RPC_CleanScene();
			VisualEffects.GetGameObject().SetActive(false);
			livCam = GameObject.Find("AllLIVStuff");
			if ((Object)(object)livCam != (Object)null)
			{
				realCamera = GameObject.Find("LIV Camera").GetComponent<Camera>();
				if ((Object)(object)realCamera != (Object)null)
				{
					realCamera.orthographic = false;
				}
				livCam.transform.position = new Vector3(2.2f, -1.9f, -5.2f);
				livCam.transform.rotation = Quaternion.Euler(351.7f, 325f, 0f);
			}
			screenWall = GameObject.Find("ColorScreen");
			if ((Object)(object)screenWall != (Object)null)
			{
				screenWall.transform.position = new Vector3(-32f, 0f, -16f);
				screenWall.transform.rotation = Quaternion.Euler(0f, 235f, 0f);
				RemoveObstructions();
			}
			screenFloor = GameObject.Find("ColorPlain");
			if ((Object)(object)screenFloor != (Object)null)
			{
				screenFloor.transform.position = new Vector3(0f, -5.889f, 0f);
				Arena.GetGameObject().SetActive(false);
			}
			pause = DateTime.Now.AddSeconds(int.Parse(fileText[0].Substring(29)));
			rKeyPressed = true;
			rKeyReleased = false;
		}
		if (Input.GetKeyUp((KeyCode)114) && !rKeyReleased)
		{
			rKeyReleased = true;
		}
		if (Input.GetKeyDown((KeyCode)101) && eKeyReleased && !eKeyPressed)
		{
			MelonLogger.Msg("Orthographic Mode");
			parkInstance = GameObject.Find("________________LOGIC__________________ /Park Instance").GetComponent<ParkInstance>();
			parkInstance.RPC_CleanScene();
			VisualEffects.GetGameObject().SetActive(false);
			livCam = GameObject.Find("AllLIVStuff");
			if ((Object)(object)livCam != (Object)null)
			{
				realCamera = GameObject.Find("LIV Camera").GetComponent<Camera>();
				if ((Object)(object)realCamera != (Object)null)
				{
					realCamera.orthographic = true;
				}
				livCam.transform.position = new Vector3(2.2f, -1.9f, -5.2f);
				livCam.transform.rotation = Quaternion.Euler(0f, 325f, 0f);
			}
			screenWall = GameObject.Find("ColorScreen");
			if ((Object)(object)screenWall != (Object)null)
			{
				screenWall.transform.position = new Vector3(-32f, 0f, -16f);
				screenWall.transform.rotation = Quaternion.Euler(0f, 235f, 0f);
				RemoveObstructions();
			}
			screenFloor = GameObject.Find("ColorPlain");
			if ((Object)(object)screenFloor != (Object)null)
			{
				screenFloor.transform.position = new Vector3(0f, -5.889f, 0f);
				Arena.GetGameObject().SetActive(false);
			}
			pause = DateTime.Now.AddSeconds(int.Parse(fileText[0].Substring(29)));
			eKeyPressed = true;
			eKeyReleased = false;
		}
		if (Input.GetKeyUp((KeyCode)101) && !eKeyReleased)
		{
			eKeyReleased = true;
		}
	}

	public override void OnFixedUpdate()
	{
		//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_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		if (rKeyPressed && pause <= DateTime.Now)
		{
			PlayerResetSystem component = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>();
			player = ((Component)Players.GetPlayerController()).gameObject;
			component.RPC_RelocatePlayerController(new Vector3(-11.9f, -2.5f, -4f), Quaternion.Euler(0f, 50f, 0f));
			rKeyPressed = false;
		}
		if (eKeyPressed && pause <= DateTime.Now)
		{
			PlayerResetSystem component2 = ((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.GetComponent<PlayerResetSystem>();
			player = ((Component)Players.GetPlayerController()).gameObject;
			component2.RPC_RelocatePlayerController(new Vector3(-11.9f, -2.5f, -4f), Quaternion.Euler(0f, 50f, 0f));
			eKeyPressed = false;
		}
	}

	private void RemoveObstructions()
	{
		LeavesSpherePark000.GetGameObject().SetActive(false);
		RootBaseMesh008.GetGameObject().SetActive(false);
		LargePedistal9.GetGameObject().SetActive(false);
		SetC.GetGameObject().SetActive(false);
		Slide.GetGameObject().SetActive(false);
	}
}