using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using ExtraBBRanks;
using Il2CppRUMBLE.Managers;
using Il2CppTMPro;
using MelonLoader;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Class1), "ExtraBBRanks", "1.0.3", "NichRumble", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: AssemblyTitle("ExtraBBRanks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExtraBBRanks")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0d755e41-183f-4589-96b3-7a666c28958b")]
[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 ExtraBBRanks;
public class Class1 : MelonMod
{
private bool loaded = false;
private bool sceneChanged = false;
private string currentScene = "";
private GameObject rankGameObject;
private GameObject levelGameObject;
private GameObject levelTextStatic;
private GameObject rankTextStatic;
private static TextMeshPro rankTextComponent;
private static TextMeshPro levelTextComponent;
private PlayerManager playerManager;
private GameObject LeaderTextStatic;
public static string[] Ranks = new string[19]
{
"Massif", "Block", "Seamount", "Mountain Range", "Seamount Chain", "Terrain", "Province", "Country", "Terrane", "Craton",
"Shield", "Microcontinent", "Subcontinent", "Continent", "Tectonic Place", "Lithospheric Hemisphere", "Lithosphere", "Geosphere", "Planet"
};
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
currentScene = sceneName;
sceneChanged = true;
if (loaded && (Object)(object)rankGameObject != (Object)null && (Object)(object)levelGameObject != (Object)null)
{
rankGameObject.SetActive(currentScene == "Gym");
levelGameObject.SetActive(currentScene == "Gym");
if (currentScene == "Gym")
{
UpdateLevelProgressBar();
UpdateRankText();
}
}
}
public override void OnFixedUpdate()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: 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_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Unknown result type (might be due to invalid IL or missing references)
//IL_0398: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0407: Unknown result type (might be due to invalid IL or missing references)
if (currentScene != "Gym" || !sceneChanged)
{
return;
}
try
{
if (!loaded)
{
playerManager = Managers.GetPlayerManager();
rankGameObject = new GameObject("RankInfo");
levelGameObject = new GameObject("LevelBar");
rankTextStatic = Object.Instantiate<GameObject>(Nr.GetGameObject());
if ((Object)(object)rankTextStatic == (Object)null)
{
MelonLogger.Error("Failed to instantiate rankTextStatic.");
return;
}
levelTextStatic = Object.Instantiate<GameObject>(rankTextStatic);
if ((Object)(object)levelTextStatic == (Object)null)
{
MelonLogger.Error("Failed to instantiate levelTextStatic.");
}
rankTextStatic.transform.parent = rankGameObject.transform;
((Object)rankTextStatic).name = "RankText";
levelTextStatic.transform.parent = levelGameObject.transform;
((Object)levelTextStatic).name = "LevelBarText";
rankTextComponent = rankTextStatic.GetComponent<TextMeshPro>();
if ((Object)(object)rankTextComponent == (Object)null)
{
MelonLogger.Error("TextMeshPro component not found on rankTextStatic.");
return;
}
levelTextComponent = levelTextStatic.GetComponent<TextMeshPro>();
if ((Object)(object)rankTextComponent == (Object)null)
{
MelonLogger.Error("TextMeshPro component not found on levelTextStatic.");
return;
}
((TMP_Text)rankTextComponent).text = "Rank: " + GetPlayerRank(GetPlayerBP());
((TMP_Text)rankTextComponent).fontSize = 3f;
((Graphic)rankTextComponent).color = new Color(255f, 255f, 255f, 255f);
((TMP_Text)rankTextComponent).outlineColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
((TMP_Text)rankTextComponent).alignment = (TextAlignmentOptions)514;
((TMP_Text)rankTextComponent).enableWordWrapping = false;
((TMP_Text)rankTextComponent).outlineWidth = 0.1f;
((TMP_Text)levelTextComponent).text = GetLevelProgressBar(GetPlayerLevel());
((TMP_Text)levelTextComponent).fontSize = 3f;
((Graphic)levelTextComponent).color = new Color(255f, 255f, 255f, 255f);
((TMP_Text)levelTextComponent).outlineColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
((TMP_Text)levelTextComponent).alignment = (TextAlignmentOptions)514;
((TMP_Text)levelTextComponent).enableWordWrapping = false;
((TMP_Text)levelTextComponent).outlineWidth = 0.1f;
rankTextStatic.transform.localPosition = new Vector3(0f, 0.9f, 0f);
rankTextStatic.transform.localRotation = Quaternion.Euler(0f, 314.4196f, 0f);
rankGameObject.transform.position = new Vector3(1.6177f, 2.2473f, 1.7972f);
rankGameObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
levelTextStatic.transform.localPosition = new Vector3(0f, 0.7f, 0f);
levelTextStatic.transform.localRotation = Quaternion.Euler(0f, 314.4196f, 0f);
levelTextStatic.transform.localScale = new Vector3(0.8f, 0.9f, 0.1f);
levelGameObject.transform.position = new Vector3(1.6177f, 2.2473f, 1.7972f);
levelGameObject.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
loaded = true;
Object.DontDestroyOnLoad((Object)(object)rankGameObject);
Object.DontDestroyOnLoad((Object)(object)levelGameObject);
MelonLogger.Msg("Extra Black Belt Ranks Mod Loaded.");
}
rankGameObject.SetActive(true);
levelGameObject.SetActive(true);
sceneChanged = false;
}
catch
{
}
}
private int GetPlayerBP()
{
if (playerManager.localPlayer != null)
{
return playerManager.localPlayer.Data.GeneralData.BattlePoints;
}
MelonLogger.Msg("localPlayer is null. Player data might not be initialized yet.");
return 0;
}
private string GetPlayerLevel()
{
if (playerManager.localPlayer != null)
{
return playerManager.localPlayer.Data.GeneralData.BattlePoints.ToString();
}
MelonLogger.Msg("localPlayer is null. Player data might not be initialized yet.");
return "0";
}
private string GetPlayerRank(int playerBP)
{
int num = 0;
while (playerBP >= 156)
{
playerBP -= 156;
num++;
}
return $"Black Belt x{num}";
}
private string GetLevelProgressBar(string PlayerLevel)
{
int num = int.Parse(PlayerLevel);
int num2 = num / 156 + 1;
int num3 = num % 156 / 12;
string text = "[";
for (int i = 0; i < num3; i++)
{
text += "=";
}
for (int j = num3; j < 12; j++)
{
text += "-";
}
text += "]";
return $"Progress Until Level: {num2}" + text;
}
private void UpdateLevelProgressBar()
{
if ((Object)(object)levelTextComponent != (Object)null)
{
((TMP_Text)levelTextComponent).text = GetLevelProgressBar(GetPlayerLevel());
}
}
private void UpdateRankText()
{
if ((Object)(object)rankTextComponent != (Object)null)
{
((TMP_Text)rankTextComponent).text = "Rank: " + GetPlayerRank(GetPlayerBP());
}
}
}