using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppRUMBLE.MoveSystem;
using Il2CppRUMBLE.Poses;
using Il2CppTMPro;
using MelonLoader;
using RumbleModUI;
using RumbleModdingAPI;
using TetrisMoves;
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), "TetrisMoves", "3.0.9", "ERROR", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonAuthorColor(255, 255, 0, 0)]
[assembly: AssemblyTitle("TetrisMoves")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TetrisMoves")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b10c94a1-8a40-4701-bc5b-98eabb44dfea")]
[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 TetrisMoves;
public static class BuildInfo
{
public const string ModName = "TetrisMoves";
public const string ModVersion = "3.0.9";
public const string Description = "Makes your moves activate in a Tetris-style grab-bag way! You have 3 moves and you have to do them in the specified order.";
public const string Author = "ERROR";
public const string Company = "";
}
public static class ListExtensions
{
private static Random rng = new Random();
public static void Shuffle<T>(this IList<T> list)
{
int num = list.Count;
while (num > 1)
{
num--;
int index = rng.Next(num + 1);
T value = list[index];
list[index] = list[num];
list[num] = value;
}
}
}
public class Main : MelonMod
{
[HarmonyPatch(typeof(PlayerStackProcessor), "Execute", new Type[]
{
typeof(Stack),
typeof(StackConfiguration)
})]
public static class ExecutePatch
{
private static List<string> modifiers = new List<string>
{
"Explode", "Straight", "Kick", "Stomp", "RockSlide", "Parry", "HoldLeft", "HoldRight", "Flick", "Uppercut",
"Jump"
};
private static bool Prefix(Stack stack, StackConfiguration overrideConfig)
{
if (!modToggled)
{
return true;
}
if (currentScene == "Gym" || currentScene == "Park")
{
string cachedName = stack.cachedName;
if (!includeModifiers && modifiers.Contains(cachedName))
{
return true;
}
if (cachedName != currentMove)
{
MelonLogger.Msg("Move '" + cachedName + "' was incorrect! Expected: '" + currentMove + "'");
return false;
}
activeMoves.RemoveAt(0);
if (activeMoves.Count == 0)
{
SetRandomMoveSet();
}
else
{
currentMove = activeMoves[0];
UpdateMoveDisplay();
}
return true;
}
return true;
}
}
private bool init = false;
private static string currentScene = "Loader";
private GameObject nextMoveText;
private static TextMeshPro nextMoveTMP;
private static string currentMove;
private Mod mod = new Mod();
private UI UI = UI.instance;
private static bool modToggled;
private ModSetting<bool> ModToggled;
private static bool includeModifiers;
private ModSetting<bool> IncludeModifiers;
private static List<PoseInputSource> disabledMoves = new List<PoseInputSource>();
private static List<string> activeMoves = new List<string>
{
"Explode", "Straight", "Kick", "Stomp", "RockSlide", "Parry", "HoldLeft", "HoldRight", "Explode", "Flick",
"Uppercut", "Jump"
};
public static Dictionary<string, string> moveNameMapping = new Dictionary<string, string>
{
{ "Explode", "Explode" },
{ "Flick", "Flick" },
{ "HoldRight", "Hold Right" },
{ "Parry", "Parry" },
{ "HoldLeft", "Hold Left" },
{ "RockSlide", "Dash" },
{ "SpawnCube", "Cube" },
{ "Uppercut", "Uppercut" },
{ "SpawnWall", "Wall" },
{ "Jump", "Jump" },
{ "Kick", "Kick" },
{ "SpawnBall", "Ball" },
{ "Stomp", "Stomp" },
{ "Disc", "Disc" },
{ "SpawnPillar", "Pillar" },
{ "Straight", "Straight" }
};
private static List<string> moveBag = new List<string>();
public override void OnLateInitializeMelon()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
Calls.onMapInitialized += OnMapInitialized;
mod.ModName = "TetrisMoves";
mod.ModVersion = "3.0.9";
mod.SetFolder("TetrisMoves");
mod.AddDescription("Description", "", "Makes your moves activate in a Tetris-style grab-bag way! You have 3 moves and you have to do them in the specified order.", new Tags
{
IsSummary = true
});
ModToggled = mod.AddToList("Toggle Mod", true, 0, "Toggles the mod on or off", new Tags());
IncludeModifiers = mod.AddToList("Include Modifiers?", false, 0, "Gray box toggles on if you want to include only specific modifers too", new Tags());
mod.GetFromFile();
mod.ModSaved += Save;
UI.instance.UI_Initialized += OnUIInit;
Save();
}
public void OnUIInit()
{
UI.AddMod(mod);
}
public void Save()
{
modToggled = (bool)((ModSetting)ModToggled).Value;
includeModifiers = (bool)((ModSetting)IncludeModifiers).Value;
if (init)
{
activeMoves.Clear();
moveBag.Clear();
if (modToggled)
{
SetRandomMoveSet();
UpdateMoveDisplay();
}
else
{
((TMP_Text)nextMoveTMP).text = string.Empty;
}
}
}
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
}
public void OnMapInitialized()
{
if (currentScene == "Gym" || currentScene == "Park")
{
Initialize();
}
}
public void Initialize()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
nextMoveText = Create.NewText("Next Move: NaM", 0.5f, Color.white, Vector3.zero, Quaternion.identity);
nextMoveTMP = nextMoveText.GetComponent<TextMeshPro>();
((TMP_Text)nextMoveTMP).alignment = (TextAlignmentOptions)514;
((TMP_Text)nextMoveTMP).enableWordWrapping = false;
((Object)nextMoveText).name = "Next Move Text";
nextMoveText.transform.SetParent(Players.GetLocalHealthbarGameObject().transform.GetChild(1), false);
nextMoveText.transform.localPosition = new Vector3(0f, 0.0422f, 1f);
SetRandomMoveSet();
if (!modToggled)
{
((TMP_Text)nextMoveTMP).text = string.Empty;
}
init = true;
}
private static void UpdateMoveDisplay()
{
string value;
IEnumerable<string> values = activeMoves.Select((string move) => moveNameMapping.TryGetValue(move, out value) ? value : "Unknown Move");
string text = string.Join(" -> ", values);
((TMP_Text)nextMoveTMP).text = "Next Moves: " + text;
}
public static void SetRandomMoveSet()
{
List<string> collection = new List<string> { "Disc", "SpawnPillar", "SpawnBall", "SpawnWall", "SpawnCube" };
List<string> list = new List<string>(collection);
if (includeModifiers)
{
list.AddRange(new List<string>
{
"Explode", "Straight", "Kick", "Stomp", "RockSlide", "Parry", "HoldLeft", "HoldRight", "Flick", "Uppercut",
"Jump"
});
}
if (moveBag == null || moveBag.Count < 3)
{
moveBag = new List<string>(list);
moveBag.Shuffle();
}
activeMoves = moveBag.Take(3).ToList();
currentMove = activeMoves[0];
string value;
IEnumerable<string> values = activeMoves.Select((string move) => moveNameMapping.TryGetValue(move, out value) ? value : "Unknown Move");
string text = string.Join(" -> ", values);
((TMP_Text)nextMoveTMP).text = "Next Moves: " + text;
moveBag.RemoveRange(0, 3);
}
}