using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Poses;
using Il2CppRUMBLE.Utilities;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MoveLimiter;
using RumbleModUI;
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), "MoveLimiter", "2.1.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("MoveLimiter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoveLimiter")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b1f33f41-50c5-4621-b6e4-55df6d828814")]
[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 MoveLimiter;
public class main : MelonMod
{
private bool sceneChanged = false;
private string currentScene = "";
private int sceneChangeCount = 0;
private UI UI = UI.instance;
private Mod MoveLimiter = new Mod();
private List<PoseInputSource> storedMoves = new List<PoseInputSource>();
private bool inAMatch = false;
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
sceneChanged = true;
inAMatch = false;
sceneChangeCount++;
}
public override void OnLateInitializeMelon()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
MoveLimiter.ModName = "MoveLimiter";
MoveLimiter.ModVersion = "2.1.3";
MoveLimiter.SetFolder("MoveLimiter");
MoveLimiter.AddDescription("Description", "Description", "Disables Moves your opponent can't use.", new Tags
{
IsSummary = true
});
MoveLimiter.AddToList("Active", true, 0, "Grey Box Turns Off MoveLimiter", new Tags());
MoveLimiter.GetFromFile();
MoveLimiter.ModSaved += Save;
UI.instance.UI_Initialized += UIInit;
}
public void UIInit()
{
UI.AddMod(MoveLimiter);
}
public void Save()
{
UpdateAvailableMoves();
}
public override void OnFixedUpdate()
{
if (sceneChanged)
{
if (currentScene == "Map0" || currentScene == "Map1")
{
MelonCoroutines.Start(WaitASecondBeforePlayerCheck(sceneChangeCount));
}
sceneChanged = false;
}
}
private void UpdateAvailableMoves()
{
if (!inAMatch)
{
return;
}
if ((bool)MoveLimiter.Settings[1].SavedValue)
{
ChangeAvailableMoves(Singleton<PlayerManager>.instance.AllPlayers[1].Data.GeneralData.BattlePoints);
return;
}
string text = "";
int num;
for (num = 0; num < storedMoves.Count; num++)
{
List<PoseInputSource> currentInputPoses = ((Component)((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform).GetComponentInChildren<PlayerPoseSystem>().currentInputPoses;
if (text != "")
{
text += ", ";
}
text += ((Object)storedMoves[num].poseSet).name;
currentInputPoses.Add(storedMoves[num]);
storedMoves.RemoveAt(num);
num--;
}
if (text != "")
{
MelonLogger.Msg("Restored Moves: " + text);
}
}
public IEnumerator WaitASecondBeforePlayerCheck(int sceneCount)
{
for (int i = 0; i < 300; i++)
{
yield return (object)new WaitForFixedUpdate();
}
while ((Object)(object)Singleton<PlayerManager>.instance.localPlayer.Controller == (Object)null)
{
yield return (object)new WaitForFixedUpdate();
}
bool enabled = ((Behaviour)((Component)((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform).GetComponentInChildren<PlayerPoseSystem>()).enabled;
while (!enabled && sceneCount == sceneChangeCount)
{
enabled = ((Behaviour)((Component)((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform).GetComponentInChildren<PlayerPoseSystem>()).enabled;
yield return (object)new WaitForFixedUpdate();
}
if (enabled && Singleton<PlayerManager>.instance.AllPlayers.Count == 2)
{
inAMatch = true;
if ((bool)MoveLimiter.Settings[1].SavedValue)
{
ChangeAvailableMoves(Singleton<PlayerManager>.instance.AllPlayers[1].Data.GeneralData.BattlePoints);
}
}
}
public void ChangeAvailableMoves(int opponentBP)
{
if (opponentBP >= 156 || opponentBP >= Singleton<PlayerManager>.instance.localPlayer.Data.GeneralData.BattlePoints)
{
return;
}
List<string> list = new List<string>();
string text = "White Belt";
list.Add("PoseSetDisc");
list.Add("PoseSetSpawnPillar");
list.Add("PoseSetStraight");
list.Add("SprintingPoseSet");
if (opponentBP >= 12)
{
text = "Yellow Belt";
list.Add("PoseSetBall");
list.Add("PoseSetKick");
list.Add("PoseSetStomp");
}
if (opponentBP >= 30)
{
text = "Green Belt";
list.Add("PoseSetWall_Grounded");
list.Add("PoseSetRockjump");
list.Add("PoseSetUppercut");
}
if (opponentBP >= 54)
{
text = "Blue Belt";
list.Add("PoseSetSpawnCube");
list.Add("PoseSetDash");
}
if (opponentBP >= 96)
{
text = "Red Belt";
list.Add("PoseSetParry");
list.Add("PoseSetHoldLeft");
list.Add("PoseSetHoldRight");
}
List<PoseInputSource> currentInputPoses = ((Component)((Component)Singleton<PlayerManager>.instance.localPlayer.Controller).gameObject.transform).GetComponentInChildren<PlayerPoseSystem>().currentInputPoses;
string text2 = "";
for (int i = 0; i < currentInputPoses.Count; i++)
{
bool flag = false;
for (int j = 0; j < list.Count; j++)
{
if (((Object)currentInputPoses[i].poseSet).name == list[j])
{
flag = true;
}
}
if (!flag)
{
if (text2 != "")
{
text2 += ", ";
}
text2 += ((Object)currentInputPoses[i].poseSet).name;
storedMoves.Add(currentInputPoses[i]);
currentInputPoses.RemoveAt(i);
i--;
}
}
if (text2 != "")
{
MelonLogger.Msg("Facing " + text + ", Removing Poses: " + text2);
}
}
}