Decompiled source of CharredPark v2.0.1

Mods/CharredPark.dll

Decompiled 5 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using CharredPark;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using MelonLoader;
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(main), "CharredPark", "2.0.1", "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("CharredPark")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CharredPark")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c66b5be4-23e4-4ed0-9b0e-08d569bd47c0")]
[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 CharredPark;

public class main : MelonMod
{
	private string currentScene = "Loader";

	public override void OnLateInitializeMelon()
	{
		Calls.onMapInitialized += Loaded;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
	}

	private void Loaded()
	{
		try
		{
			if (currentScene == "Park")
			{
				MelonCoroutines.Start(ReskinPark());
			}
		}
		catch (Exception ex)
		{
			MelonLogger.Msg((object)ex);
		}
	}

	private IEnumerator ReskinPark()
	{
		Material metalMaterial = ((Renderer)RootBaseMesh005_2.GetGameObject().GetComponent<MeshRenderer>()).material;
		MeshRenderer slide = Slide_.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0and1and2(slide, metalMaterial);
		((Il2CppArrayBase<Material>)(object)((Renderer)slide).materials)[3].shader = new Shader(((Il2CppObjectBase)metalMaterial.shader).Pointer);
		Material woodMaterial = ((Il2CppArrayBase<Material>)(object)((Renderer)slide).materials)[3];
		MeshRenderer plank0MeshRenderer = Plank000.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(plank0MeshRenderer, woodMaterial);
		MeshRenderer plank1MeshRenderer = Plank001.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(plank1MeshRenderer, woodMaterial);
		MeshRenderer plank2MeshRenderer = Plank002.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(plank2MeshRenderer, woodMaterial);
		MeshRenderer stationFloor = Platform_.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0and1(stationFloor, metalMaterial);
		ReskinMeshRendererMaterials2(stationFloor, woodMaterial);
		GameObject arenas = Arenas.GetGameObject();
		for (int k = 0; k < arenas.transform.GetChildCount(); k++)
		{
			MeshRenderer areana = ((Component)arenas.transform.GetChild(k).GetChild(0)).GetComponent<MeshRenderer>();
			ReskinMeshRendererMaterials1and2(areana, metalMaterial);
		}
		ReskinMeshRenderer(((Component)arenas.transform.GetChild(0).GetChild(1)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRenderer(((Component)arenas.transform.GetChild(5).GetChild(1)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRendererMaterials0(((Component)arenas.transform.GetChild(1).GetChild(3)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRendererMaterials1(((Component)arenas.transform.GetChild(1).GetChild(3)).GetComponent<MeshRenderer>(), woodMaterial);
		ReskinMeshRendererMaterials0(((Component)arenas.transform.GetChild(2).GetChild(2)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRendererMaterials1(((Component)arenas.transform.GetChild(2).GetChild(2)).GetComponent<MeshRenderer>(), woodMaterial);
		ReskinMeshRendererMaterials0(((Component)arenas.transform.GetChild(3).GetChild(2)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRendererMaterials1(((Component)arenas.transform.GetChild(3).GetChild(2)).GetComponent<MeshRenderer>(), woodMaterial);
		ReskinMeshRendererMaterials0(((Component)arenas.transform.GetChild(4).GetChild(2)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRendererMaterials1(((Component)arenas.transform.GetChild(4).GetChild(2)).GetComponent<MeshRenderer>(), woodMaterial);
		ReskinMeshRendererMaterials0(((Component)arenas.transform.GetChild(5).GetChild(3)).GetComponent<MeshRenderer>(), metalMaterial);
		ReskinMeshRendererMaterials1(((Component)arenas.transform.GetChild(5).GetChild(3)).GetComponent<MeshRenderer>(), woodMaterial);
		MeshRenderer hoop0 = BoulderBallHoop0.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0and1and2and3(hoop0, metalMaterial);
		ReskinMeshRendererMaterials4(hoop0, woodMaterial);
		MeshRenderer hoop1 = BoulderBallHoop1.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0and1and2and3(hoop1, metalMaterial);
		ReskinMeshRendererMaterials4(hoop1, woodMaterial);
		MeshRenderer tetherball0 = Tetherball0.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0and1and3(tetherball0, metalMaterial);
		ReskinMeshRendererMaterials2(tetherball0, woodMaterial);
		MeshRenderer tetherball1 = Tetherball1.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0and1and3(tetherball1, metalMaterial);
		ReskinMeshRendererMaterials2(tetherball1, woodMaterial);
		MeshRenderer bagPlank0 = Plank0.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(bagPlank0, woodMaterial);
		MeshRenderer bagPlank1 = Plank1.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(bagPlank1, woodMaterial);
		MeshRenderer bagPlank2 = Plank2.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(bagPlank2, woodMaterial);
		MeshRenderer bagPlank3 = Plank3.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(bagPlank3, woodMaterial);
		GameObject scoreboard = Scoreboard.GetGameObject();
		for (int j = 0; j < 10; j++)
		{
			ReskinMeshRenderer(((Component)scoreboard.transform.GetChild(j)).gameObject.GetComponent<MeshRenderer>(), metalMaterial);
		}
		MeshRenderer parkboardModel = Model.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRendererMaterials0(parkboardModel, woodMaterial);
		ReskinMeshRendererMaterials1(parkboardModel, metalMaterial);
		MeshRenderer parkboardRotatingScreen = RotatingScreen.GetGameObject().GetComponent<MeshRenderer>();
		ReskinMeshRenderer(parkboardRotatingScreen, woodMaterial);
		GameObject parkboardPrimaryDisplay = PrimaryDisplay.GetGameObject();
		bool done = false;
		while (!done)
		{
			try
			{
				for (int i = 0; i < 4; i++)
				{
					ReskinMeshRenderer(((Component)parkboardPrimaryDisplay.transform.GetChild(0).GetChild(i)).gameObject.GetComponent<MeshRenderer>(), woodMaterial);
				}
				ReskinMeshRenderer(((Component)parkboardPrimaryDisplay.transform.GetChild(2).GetChild(0)).gameObject.GetComponent<MeshRenderer>(), woodMaterial);
				done = true;
			}
			catch
			{
			}
			if (!done)
			{
				yield return (object)new WaitForFixedUpdate();
			}
		}
	}

	private void ReskinMeshRendererWithChildren(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		ReskinMeshRenderer(meshRendererToBeReskinned, mat);
		for (int i = 0; i < ((Component)meshRendererToBeReskinned).transform.childCount; i++)
		{
			ReskinMeshRenderer(((Component)((Component)meshRendererToBeReskinned).transform.GetChild(i)).GetComponent<MeshRenderer>(), mat);
		}
	}

	private void ReskinMeshRenderer(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			array[i] = mat;
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials0and1(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 0 && i != 1)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials0and2(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 0 && i != 2)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials1and2(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 1 && i != 2)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials0and1and2(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 0 && i != 1 && i != 2)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials0and1and3(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 0 && i != 1 && i != 3)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials0and1and2and3(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 0 && i != 1 && i != 2 && i != 3)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials0(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 0)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials1(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 1)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials2(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 2)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials3(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 3)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}

	private void ReskinMeshRendererMaterials4(MeshRenderer meshRendererToBeReskinned, Material mat)
	{
		Material[] array = (Material[])(object)new Material[((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length];
		for (int i = 0; i < ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials).Length; i++)
		{
			if (i != 4)
			{
				array[i] = ((Il2CppArrayBase<Material>)(object)((Renderer)meshRendererToBeReskinned).materials)[i];
			}
			else
			{
				array[i] = mat;
			}
		}
		((Renderer)meshRendererToBeReskinned).materials = Il2CppReferenceArray<Material>.op_Implicit(array);
	}
}