Decompiled source of notationClipper v1.2.0

Mods/notationClipper.dll

Decompiled 5 days ago
using System;
using System.CodeDom.Compiler;
using System.Configuration;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Poses;
using Il2CppTMPro;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.UI;
using notationClipper;

[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), "notationClipper", "1.2.0", "klibe", null)]
[assembly: VerifyLoaderVersion(0, 6, 3, true)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 240, 205, 53)]
[assembly: MelonAuthorColor(255, 240, 205, 53)]
[assembly: AssemblyTitle("notationClipper")]
[assembly: AssemblyDescription("Displays your combos on screen!")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0c4fb5e0-dd9a-40e6-be7c-c121f3555e3b")]
[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 notationClipper
{
	public static class BuildInfo
	{
		public const string ModName = "notationClipper";

		public const string ModVersion = "1.2.0";

		public const string Description = "Displays your combos on screen!";

		public const string Author = "klibe";

		public const string Company = "";
	}
	public class Validation : ValidationParameters
	{
		private int Length;

		public Validation(int i)
		{
			Length = i;
		}

		public override bool DoValidation(string Input)
		{
			if (Input.Length == Length)
			{
				return true;
			}
			return false;
		}
	}
	public class main : MelonMod
	{
		[HarmonyPatch(typeof(PlayerPoseSystem), "OnPoseSetCompleted", new Type[] { typeof(PoseSet) })]
		private static class PosePatch
		{
			private static void Postfix(PoseSet set)
			{
				moveDetected(turnToNotation(((Object)set).name));
			}
		}

		private Mod NotationClipper = new Mod();

		private static string comboString = "";

		private bool lockDetected = false;

		private bool UTurnDetected = false;

		private static int state = -1;

		private static int comboTimer = 0;

		private static int postComboTimer = 0;

		private static int comboMaxTime = 25;

		private static int postComboMaxTime = 50;

		private static Color[] colors = (Color[])(object)new Color[4]
		{
			new Color(1f, 1f, 1f),
			new Color(0.92f, 0.57f, 0.2f),
			new Color(0.72f, 0.47f, 0.15f),
			new Color(1f, 0.2f, 0.2f)
		};

		private string currentScene = "";

		private static bool init = false;

		private static bool foundPlayerController = false;

		private GameObject notationText;

		private static TextMeshPro notationTextRef;

		private static PlayerManager playerManager;

		private static Player selfPlayer;

		private static bool localPlayerFound = false;

		private static bool displayText;

		private static bool displayShiftstonesOnText;

		private static bool detectJoystick;

		private static bool alwaysDisplayText;

		private static Color recordingColor = new Color(1f, 0.2f, 0.2f);

		private static Color comboingColor = new Color(47f / 51f, 0.57254905f, 0.20392157f);

		private static string[] moveNames = new string[17]
		{
			"SprintPoseSet", "PoseSetStraight", "PoseSetUppercut", "PoseSetKick", "PoseSetStomp", "PoseSetParry", "PoseSetDash", "PoseSetRockjump", "PoseSetHoldRight", "PoseSetHoldLeft",
			"PoseSetFlick", "PoseSetExplode", "PoseSetDisc", "PoseSetSpawnPillar", "PoseSetBall", "PoseSetWall_Grounded", "PoseSetSpawnCube"
		};

		private static char[] moveSymbols = new char[17]
		{
			'R', 'S', 'U', 'K', 'G', 'P', 'D', 'J', 'H', 'H',
			'F', 'E', 'd', 'p', 'b', 'w', 'c'
		};

		private void updateModUIVariables()
		{
			displayText = (bool)NotationClipper.Settings[1].Value;
			displayShiftstonesOnText = (bool)NotationClipper.Settings[2].Value;
			detectJoystick = (bool)NotationClipper.Settings[3].Value;
			alwaysDisplayText = (bool)NotationClipper.Settings[4].Value;
			comboTimer = (int)((float)NotationClipper.Settings[5].Value * 50f);
			postComboTimer = (int)((float)NotationClipper.Settings[6].Value * 50f);
		}

		public void OnUIInit()
		{
			Calls.onMapInitialized += sceneLoad;
			UI.instance.AddMod(NotationClipper);
			MelonLogger.Msg("Added Mod");
		}

		public override void OnLateInitializeMelon()
		{
			//IL_0050: 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_0062: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			((MelonBase)this).OnLateInitializeMelon();
			NotationClipper.ModName = "notationClipper";
			NotationClipper.ModVersion = "1.2.0";
			NotationClipper.SetFolder("notationClipper");
			NotationClipper.AddDescription("Description", "Description", "Displays your combos on screen!", new Tags
			{
				IsSummary = true
			});
			NotationClipper.AddToList("Display Toggle", false, 0, "If on, will display notation!", new Tags());
			NotationClipper.AddToList("Display Shiftstones", true, 0, "Toggles if shiftstones display on the text", new Tags());
			NotationClipper.AddToList("Clip Joystick", true, 0, "Toggles if joystick flicks display on the text", new Tags());
			NotationClipper.AddToList("Combo Timer", 0.15f, "The amount of seconds allowed between moves before a combo is considered over.", new Tags());
			NotationClipper.AddToList("Post Combo Timer", 0.2f, "The amount of time after a combo before the text disappears.", new Tags());
			NotationClipper.GetFromFile();
			updateModUIVariables();
			NotationClipper.ModSaved += updateModUIVariables;
			UI.instance.UI_Initialized += OnUIInit;
		}

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

		public void sceneLoad()
		{
			init = false;
			setupText();
		}

		private void setupText()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			if (!(currentScene == "Loader"))
			{
				notationText = Create.NewText("", 1f, comboingColor, new Vector3(0f, 1f, 0f), Quaternion.identity);
				((Object)notationText).name = "notationClipper Text Display";
				notationText.transform.parent = Players.GetLocalHealthbarGameObject().transform;
				notationText.transform.localPosition = new Vector3(-0.025f, 0.6f, 1f);
				notationText.transform.localRotation = Quaternion.Euler(4f, 0f, 0f);
				notationTextRef = notationText.GetComponent<TextMeshPro>();
				((TMP_Text)notationTextRef).enableWordWrapping = false;
				((TMP_Text)notationTextRef).SetOutlineColor(Color32.op_Implicit(Color.black));
				((TMP_Text)notationTextRef).outlineWidth = 0.4f;
				((TMP_Text)notationTextRef).fontSize = 0.9f;
				((TMP_Text)notationTextRef).alignment = (TextAlignmentOptions)514;
				selfPlayer = Players.GetLocalPlayer();
				init = true;
			}
		}

		public override void OnFixedUpdate()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			if (!init)
			{
				return;
			}
			if (detectJoystick)
			{
				Vector2 joystick = LeftController.GetJoystick();
				if (joystick.y > 0.9f && !lockDetected)
				{
					lockDetected = true;
					moveDetected('^');
				}
				if (joystick.y < 0.5f && lockDetected)
				{
					lockDetected = false;
				}
				if (joystick.y < -0.9f && !UTurnDetected)
				{
					UTurnDetected = true;
					moveDetected('u');
				}
				if (joystick.y > -0.5f && UTurnDetected)
				{
					UTurnDetected = false;
				}
			}
			if (state == 2)
			{
				postComboTimer--;
				if (postComboTimer <= 0)
				{
					state = 0;
					((Graphic)notationTextRef).color = colors[state];
					comboString = "";
					displayCombo();
				}
			}
			if (state == 1)
			{
				comboTimer--;
				if (comboTimer <= 0)
				{
					state = 2;
					((Graphic)notationTextRef).color = colors[state];
					postComboTimer = postComboMaxTime;
				}
			}
		}

		private static char turnToNotation(string original)
		{
			char result = 'R';
			for (int i = 0; i < 17; i++)
			{
				if (original == moveNames[i])
				{
					result = moveSymbols[i];
					break;
				}
			}
			return result;
		}

		private static string getShiftStones()
		{
			string text = "";
			short num = ((Il2CppArrayBase<short>)(object)selfPlayer.Data.EquipedShiftStones)[0];
			short num2 = ((Il2CppArrayBase<short>)(object)selfPlayer.Data.EquipedShiftStones)[1];
			bool flag = num == 2 || num2 == 2;
			bool flag2 = num == 1 || num2 == 1;
			bool flag3 = num == 4 || num2 == 4;
			bool flag4 = num == 7 || num2 == 7;
			if ((comboString.Contains("JD") || comboString.Contains("JJ")) && flag)
			{
				text += "F";
			}
			if (comboString.Contains("H") && flag2)
			{
				text += "C";
			}
			if ((comboString.Contains("D") || comboString.Contains("J")) && flag3)
			{
				text += "S";
			}
			if (comboString.Contains("E") && flag4)
			{
				text += "V";
			}
			return text;
		}

		private static string getNotatedCombo(bool useShiftstones)
		{
			string result = comboString;
			if (useShiftstones)
			{
				string text = "";
				text = getShiftStones();
				string text2 = ((text == "") ? "" : "/ ");
				result = text + text2 + comboString;
			}
			return result;
		}

		private static void displayCombo()
		{
			((TMP_Text)notationTextRef).text = getNotatedCombo(displayShiftstonesOnText);
		}

		private static void moveDetected(char moveSymbol)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (state != 3 && state != 1)
			{
				comboString = "";
				state = 1;
				((Graphic)notationTextRef).color = colors[state];
			}
			if (state == 1)
			{
				comboTimer = comboMaxTime;
			}
			if (!comboString.EndsWith("R") || moveSymbol != 'R')
			{
				comboString += moveSymbol;
			}
			if (comboString != "" && (alwaysDisplayText || state == 3))
			{
				displayCombo();
			}
		}
	}
}
namespace notationClipper.Properties
{
	[CompilerGenerated]
	[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.11.0.0")]
	internal sealed class Settings : ApplicationSettingsBase
	{
		private static Settings defaultInstance = (Settings)(object)SettingsBase.Synchronized((SettingsBase)(object)new Settings());

		public static Settings Default => defaultInstance;
	}
}