Decompiled source of MultiplayerMapsInSinglePlayer v2.0.3

Mods/MultiplayerMapsInSinglePlayer.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2Cpp;
using Il2CppRUMBLE.Audio;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.MoveSystem;
using Il2CppRUMBLE.Networking.MatchFlow;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Utilities;
using Il2CppTMPro;
using MelonLoader;
using MultiplayerMapsInSinglePlayer;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "MultiplayerMapsInSinglePlayer", "2.0.3", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("MultiplayerMapsInSinglePlayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MultiplayerMapsInSinglePlayer")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a1ecbc05-cfec-4a4b-ba0b-5bf9bf4f1186")]
[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 MultiplayerMapsInSinglePlayer;

public class main : MelonMod
{
	private bool sceneChanged = false;

	private string currentScene = "";

	private bool DDOLInit = false;

	private bool init = false;

	private bool waitedATick = false;

	private GameObject ddolButton;

	private GameObject gymButtonMap0;

	private GameObject gymButtonMap1;

	private GameObject returntoGymButton;

	private GameObject textPanel;

	private GameObject textPanelText;

	private GameObject gymTextPanelTitle;

	private GameObject gymTextPanelTitleText;

	private GameObject gymTextPanelRing;

	private GameObject gymTextPanelRingText;

	private GameObject gymTextPanelPit;

	private GameObject gymTextPanelPitText;

	private GameObject returnToGymPanel;

	private GameObject returnToGymPanelText;

	private GameObject modParent;

	private SceneManager sceneManager;

	private GameObject[] pools = (GameObject[])(object)new GameObject[7];

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		sceneChanged = true;
		init = false;
		waitedATick = false;
	}

	public override void OnFixedUpdate()
	{
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_03df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0404: Unknown result type (might be due to invalid IL or missing references)
		//IL_0429: Unknown result type (might be due to invalid IL or missing references)
		//IL_044e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_0498: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0507: Unknown result type (might be due to invalid IL or missing references)
		//IL_052c: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ab: Expected O, but got Unknown
		//IL_077a: Unknown result type (might be due to invalid IL or missing references)
		//IL_079f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0846: Unknown result type (might be due to invalid IL or missing references)
		//IL_086b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0890: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_096f: Unknown result type (might be due to invalid IL or missing references)
		//IL_099c: Unknown result type (might be due to invalid IL or missing references)
		//IL_09a3: Expected O, but got Unknown
		//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0af6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bc2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c1a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c21: Expected O, but got Unknown
		//IL_0c4e: Unknown result type (might be due to invalid IL or missing references)
		if (!sceneChanged)
		{
			return;
		}
		try
		{
			if (currentScene == "Gym" && !init)
			{
				if (!waitedATick)
				{
					waitedATick = true;
					return;
				}
				if (!DDOLInit)
				{
					sceneManager = Singleton<SceneManager>.instance;
					ddolButton = Object.Instantiate<GameObject>(InteractionButton.GetGameObject());
					ddolButton.active = false;
					Object.DontDestroyOnLoad((Object)(object)ddolButton);
					textPanel = Object.Instantiate<GameObject>(((Component)RankRelaxControls.GetGameObject().transform.GetChild(17)).gameObject);
					textPanelText = Object.Instantiate<GameObject>(((Component)RankRelaxControls.GetGameObject().transform.GetChild(15).GetChild(6)).gameObject);
					textPanelText.transform.parent = textPanel.transform;
					((Object)textPanel).name = "TextPanel";
					textPanel.active = false;
					Object.DontDestroyOnLoad((Object)(object)textPanel);
					pools[0] = Structures.GetPoolBall();
					pools[1] = Structures.GetPoolCube();
					pools[2] = Structures.GetPoolDisc();
					pools[3] = Structures.GetPoolLargeRock();
					pools[4] = Structures.GetPoolPillar();
					pools[5] = Structures.GetPoolSmallRock();
					pools[6] = Structures.GetPoolWall();
					DDOLInit = true;
				}
				gymButtonMap0 = Object.Instantiate<GameObject>(ddolButton);
				((Object)gymButtonMap0).name = "Teleport To Ring Button";
				gymButtonMap1 = Object.Instantiate<GameObject>(ddolButton);
				((Object)gymButtonMap1).name = "Teleport To Pit Button";
				gymButtonMap0.transform.position = new Vector3(5.2317f, 1.4f, 10.2582f);
				gymButtonMap0.transform.rotation = Quaternion.Euler(1.0437f, 31.2109f, 335.5875f);
				((Component)gymButtonMap0.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					LoadMap0();
				}));
				gymButtonMap1.transform.position = new Vector3(5.4477f, 1.4f, 10.6f);
				gymButtonMap1.transform.rotation = Quaternion.Euler(1.0437f, 31.2109f, 335.5875f);
				((Component)gymButtonMap1.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					LoadMap1();
				}));
				gymButtonMap0.active = true;
				gymButtonMap1.active = true;
				gymTextPanelTitle = Object.Instantiate<GameObject>(textPanel);
				gymTextPanelRing = Object.Instantiate<GameObject>(textPanel);
				gymTextPanelPit = Object.Instantiate<GameObject>(textPanel);
				((Object)gymTextPanelTitle).name = "Teleport Title";
				((Object)gymTextPanelRing).name = "Ring Plate";
				((Object)gymTextPanelPit).name = "Pit Plate";
				gymTextPanelTitleText = ((Component)gymTextPanelTitle.transform.GetChild(0)).gameObject;
				gymTextPanelRingText = ((Component)gymTextPanelRing.transform.GetChild(0)).gameObject;
				gymTextPanelPitText = ((Component)gymTextPanelPit.transform.GetChild(0)).gameObject;
				gymTextPanelTitle.transform.position = new Vector3(5.1022f, 1.4485f, 10.2802f);
				gymTextPanelTitle.transform.rotation = Quaternion.Euler(12.7274f, 122.3016f, 90f);
				gymTextPanelTitle.transform.localScale = new Vector3(0.3548f, 0.3288f, 0.2806f);
				gymTextPanelRing.transform.position = new Vector3(5.2791f, 1.3159f, 10.1191f);
				gymTextPanelRing.transform.rotation = Quaternion.Euler(39.6996f, 122.3016f, 90.0003f);
				gymTextPanelRing.transform.localScale = new Vector3(0.1548f, 0.1288f, 0.2806f);
				gymTextPanelRingText.transform.localScale = new Vector3(7.5414f, 3.6636f, 6.462f);
				gymTextPanelPit.transform.position = new Vector3(5.504f, 1.3159f, 10.4646f);
				gymTextPanelPit.transform.rotation = Quaternion.Euler(39.6996f, 122.3016f, 90.0003f);
				gymTextPanelPit.transform.localScale = new Vector3(0.1548f, 0.1288f, 0.2806f);
				gymTextPanelPitText.transform.localScale = new Vector3(7.5414f, 3.6636f, 6.462f);
				gymTextPanelTitle.active = true;
				gymTextPanelRing.active = true;
				gymTextPanelPit.active = true;
				((TMP_Text)gymTextPanelTitleText.GetComponent<TextMeshPro>()).text = "Teleport To Maps:";
				((TMP_Text)gymTextPanelRingText.GetComponent<TextMeshPro>()).text = "Ring";
				((TMP_Text)gymTextPanelPitText.GetComponent<TextMeshPro>()).text = "Pit";
				modParent = new GameObject();
				((Object)modParent).name = "MultiplayerMapsInSinglePlayer";
				gymButtonMap0.transform.parent = modParent.transform;
				gymButtonMap1.transform.parent = modParent.transform;
				gymTextPanelTitle.transform.parent = modParent.transform;
				gymTextPanelRing.transform.parent = modParent.transform;
				gymTextPanelPit.transform.parent = modParent.transform;
				modParent.transform.parent = MatchConsole.GetGameObject().transform;
				init = true;
			}
			else if (currentScene == "Map0" && !init)
			{
				if (!waitedATick)
				{
					waitedATick = true;
					return;
				}
				if (Singleton<PlayerManager>.instance.AllPlayers.Count != 1)
				{
					init = true;
					return;
				}
				GameObject gameObject = ((Component)Map0Production.GetGameObject().transform.GetChild(0).GetChild(1).GetChild(0)).gameObject;
				gameObject.AddComponent<GroundCollider>().collider = (Collider)(object)gameObject.GetComponent<MeshCollider>();
				gameObject.layer = 9;
				Pedestals.GetGameObject().active = false;
				MatchHandler component = MatchHandler.GetGameObject().GetComponent<MatchHandler>();
				component.CurrentMatchPhase = (MatchPhase)2;
				returntoGymButton = Object.Instantiate<GameObject>(ddolButton);
				((Object)returntoGymButton).name = "Return To Gym Button";
				returntoGymButton.transform.position = new Vector3(1.9859f, -4.0983f, 18.9987f);
				returntoGymButton.transform.rotation = Quaternion.Euler(357.8411f, 272.1151f, 76.6469f);
				((Component)returntoGymButton.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					LoadGym();
				}));
				returntoGymButton.active = true;
				returnToGymPanel = Object.Instantiate<GameObject>(textPanel);
				((Object)returnToGymPanel).name = "Return To Gym Plate";
				returnToGymPanelText = ((Component)returnToGymPanel.transform.GetChild(0)).gameObject;
				returnToGymPanel.transform.position = new Vector3(1.7225f, -3.9242f, 19.0338f);
				returnToGymPanel.transform.rotation = Quaternion.Euler(90f, 92.2793f, 0f);
				returnToGymPanel.transform.localScale = new Vector3(0.3548f, 0.3288f, 0.2806f);
				returnToGymPanel.active = true;
				((TMP_Text)returnToGymPanelText.GetComponent<TextMeshPro>()).text = "Return to Gym";
				GameObject val = Object.Instantiate<GameObject>(returntoGymButton);
				((Object)val).name = "Respawn Player Button";
				val.transform.position = new Vector3(2.5859f, -4.0983f, 18.9787f);
				((Component)val.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).GetComponent<PlayerResetSystem>().ResetPlayerController();
				}));
				GameObject val2 = Object.Instantiate<GameObject>(returnToGymPanel);
				((Object)val2).name = "Respawn Player Panel";
				val2.transform.position = new Vector3(2.3459f, -3.9242f, 19.0187f);
				((TMP_Text)((Component)val2.transform.GetChild(0)).GetComponent<TextMeshPro>()).text = "Respawn";
				GameObject val3 = new GameObject("QuickSwapper");
				ShiftstoneQuickswapper.GetGameObject().transform.parent = val3.transform;
				val3.transform.position = new Vector3(1.2436f, -3.7218f, 16.8382f);
				component.FadeIn();
				init = true;
			}
			else if (currentScene == "Map1" && !init)
			{
				if (!waitedATick)
				{
					waitedATick = true;
					return;
				}
				if (Singleton<PlayerManager>.instance.AllPlayers.Count != 1)
				{
					init = true;
					return;
				}
				SceneProcessors.GetGameObject().GetComponent<SceneProcessorBatch>().ExecuteBatch();
				Pedestals.GetGameObject().active = false;
				MatchHandler component2 = MatchHandler.GetGameObject().GetComponent<MatchHandler>();
				component2.CurrentMatchPhase = (MatchPhase)2;
				component2.FadeIn();
				returntoGymButton = Object.Instantiate<GameObject>(ddolButton);
				((Object)returntoGymButton).name = "Return To Gym Button";
				returntoGymButton.transform.position = new Vector3(0f, 0.9909f, 10.719f);
				returntoGymButton.transform.rotation = Quaternion.Euler(358.2508f, 93.5928f, 274.9258f);
				((Component)returntoGymButton.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					LoadGym();
				}));
				returntoGymButton.active = true;
				returnToGymPanel = Object.Instantiate<GameObject>(textPanel);
				((Object)returnToGymPanel).name = "Return To Gym Plate";
				returnToGymPanelText = ((Component)returnToGymPanel.transform.GetChild(0)).gameObject;
				returnToGymPanel.transform.position = new Vector3(-0.257f, 1.221f, 10.7388f);
				returnToGymPanel.transform.rotation = Quaternion.Euler(90f, 92.2793f, 0f);
				returnToGymPanel.transform.localScale = new Vector3(0.3548f, 0.3288f, 0.2806f);
				returnToGymPanel.active = true;
				((TMP_Text)returnToGymPanelText.GetComponent<TextMeshPro>()).text = "Return to Gym";
				GameObject val4 = new GameObject("QuickSwapper");
				ShiftstoneQuickswapper.GetGameObject().transform.parent = val4.transform;
				val4.transform.position = new Vector3(-0.6655f, 1.4164f, 8.5891f);
				init = true;
			}
		}
		catch
		{
			return;
		}
		sceneChanged = false;
	}

	private void LoadGym()
	{
		DestroyStructures();
		sceneManager.LoadSceneAsync(1, false, false, 2f, (LoadSceneMode)0, (AudioCall)null);
	}

	private void LoadMap0()
	{
		DestroyStructures();
		sceneManager.LoadSceneAsync(3, false, false, 2f, (LoadSceneMode)0, (AudioCall)null);
	}

	private void LoadMap1()
	{
		DestroyStructures();
		sceneManager.LoadSceneAsync(4, false, false, 2f, (LoadSceneMode)0, (AudioCall)null);
	}

	public void DestroyStructures()
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < pools.Length; i++)
		{
			for (int j = 0; j < pools[i].transform.childCount; j++)
			{
				GameObject gameObject = ((Component)pools[i].transform.GetChild(j)).gameObject;
				if (gameObject.activeSelf)
				{
					gameObject.GetComponent<Structure>().Kill(Vector3.zero, false, false, true);
				}
			}
		}
	}
}