Decompiled source of PoseHitboxes v1.0.0

Mods/PoseHitboxes.dll

Decompiled 2 years ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using MelonLoader;
using PoseHitboxes;
using RUMBLE.Tutorial.MoveLearning;
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(ClassPH), "PoseHitboxes", "1.0.0", "Marcopolo1613", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("PoseHitboxes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PoseHitboxes")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("138ef4a5-245f-4c7b-a130-69645d5b6e5b")]
[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 PoseHitboxes;

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

	private bool sceneChanged = false;

	private bool loaded = false;

	private PoseGhost poseGhost;

	private Material ghosty;

	private Material redy;

	private string currentPoseName = "";

	private int delayCycle = 0;

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

	public override void OnUpdate()
	{
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0261: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0304: Unknown result type (might be due to invalid IL or missing references)
		//IL_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		if (currentScene != "Gym")
		{
			return;
		}
		if (sceneChanged)
		{
			if (delayCycle > 1)
			{
				delayCycle--;
			}
			else
			{
				if (!loaded)
				{
					try
					{
						poseGhost = MoveLearning.GetGameObject().GetComponentInChildren<PoseGhost>();
						ghosty = ((Component)((Component)poseGhost).transform.GetChild(0).GetChild(1)).GetComponent<Renderer>().material;
						redy = ((Component)GymArena.GetGameObject().transform.GetChild(0)).GetComponent<Renderer>().material;
						loaded = true;
					}
					catch
					{
						return;
					}
				}
				sceneChanged = false;
			}
		}
		if (!loaded || !(currentPoseName != ((Object)poseGhost.showCurrentPoseData).name))
		{
			return;
		}
		if (((Component)poseGhost).transform.GetChild(0).GetChild(0).childCount > 0)
		{
			while (((Component)poseGhost).transform.GetChild(0).GetChild(0).childCount > 0 || ((Component)poseGhost).transform.GetChild(0).GetChild(1).childCount > 0)
			{
				Object.DestroyImmediate((Object)(object)((Component)((Component)poseGhost).transform.GetChild(0).GetChild(0).GetChild(0)).gameObject);
				Object.DestroyImmediate((Object)(object)((Component)((Component)poseGhost).transform.GetChild(0).GetChild(1).GetChild(0)).gameObject);
			}
		}
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
		val.transform.parent = ((Component)poseGhost).transform.GetChild(0).GetChild(0);
		val.transform.position = poseGhost.leftHand.position;
		val.transform.localRotation = poseGhost.showCurrentPoseData.leftControllerCondition.DesiredPose.rotation;
		val.transform.localScale = new Vector3(poseGhost.showCurrentPoseData.leftControllerCondition.PositionTreshold, poseGhost.showCurrentPoseData.leftControllerCondition.PositionTreshold, poseGhost.showCurrentPoseData.leftControllerCondition.PositionTreshold);
		val.GetComponent<Renderer>().material = ghosty;
		((Component)((Component)poseGhost).transform.GetChild(0).GetChild(0)).GetComponent<Renderer>().material = redy;
		GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3);
		val2.transform.parent = ((Component)poseGhost).transform.GetChild(0).GetChild(1);
		val2.transform.position = poseGhost.rightHand.position;
		val2.transform.localRotation = poseGhost.showCurrentPoseData.rightControllerCondition.DesiredPose.rotation;
		val2.transform.localScale = new Vector3(poseGhost.showCurrentPoseData.RightControllerCondition.PositionTreshold, poseGhost.showCurrentPoseData.RightControllerCondition.PositionTreshold, poseGhost.showCurrentPoseData.RightControllerCondition.PositionTreshold);
		val2.GetComponent<Renderer>().material = ghosty;
		((Component)((Component)poseGhost).transform.GetChild(0).GetChild(1)).GetComponent<Renderer>().material = redy;
		currentPoseName = ((Object)poseGhost.showCurrentPoseData).name;
	}
}