Decompiled source of ProgressTrackerOverview v1.0.2

Mods/ProgressTrackerOverview.dll

Decompiled 5 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppRUMBLE.Economy;
using Il2CppRUMBLE.Economy.Interactables;
using Il2CppRUMBLE.Interactions;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Players;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
using ProgressTrackerOverview;
using RumbleModdingAPI;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MyMod), "ProgressTrackerOverview", "1.0.2", "Kalamart", null)]
[assembly: VerifyLoaderVersion(0, 6, 5, true)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 31, 90)]
[assembly: MelonAuthorColor(255, 255, 31, 90)]
[assembly: AssemblyTitle("ProgressTrackerOverview")]
[assembly: AssemblyDescription("Adds an overview of your total GC/BP progress on the gear market's progress tracker")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ProgressTrackerOverview")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("621d30a5-8fa1-4d87-9826-92c0149b033e")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.2.0")]
namespace ProgressTrackerOverview;

public static class BuildInfo
{
	public const string ModName = "ProgressTrackerOverview";

	public const string ModVersion = "1.0.2";

	public const string Description = "Adds an overview of your total GC/BP progress on the gear market's progress tracker";

	public const string Author = "Kalamart";

	public const string Company = "";
}
public class MyMod : MelonMod
{
	private bool initialized = false;

	private bool needUpdate = false;

	private static ProgressTracker progressTracker;

	private static CatalogHandler handler;

	private GameObject BPGCtext;

	private GameObject BPtext;

	private GameObject GCtext;

	private TextMeshPro bpobj_only;

	private TextMeshPro gcobj_only;

	private TextMeshPro bpobj;

	private TextMeshPro gcobj;

	public static void Log(string msg)
	{
		MelonLogger.Msg(msg);
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		needUpdate = sceneName == "Gym";
		initialized = false;
	}

	public override void OnFixedUpdate()
	{
		if (needUpdate)
		{
			if (!initialized)
			{
				InitOverview();
				initialized = true;
			}
			UpdateProgressOverview();
			needUpdate = false;
		}
	}

	private void InitOverview()
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0211: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ProgressTracker.GetGameObject();
		progressTracker = gameObject.GetComponent<ProgressTracker>();
		handler = CatalogHandler.GetGameObject().GetComponent<CatalogHandler>();
		Transform child = gameObject.transform.GetChild(1).GetChild(1).GetChild(0);
		GameObject val = Object.Instantiate<GameObject>(((Component)child).gameObject);
		val.SetActive(true);
		val.transform.SetParent(gameObject.transform);
		((Object)val).name = "Overview";
		val.transform.localPosition = new Vector3(0f, -0.18f, 0.05f);
		val.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
		val.transform.localRotation = Quaternion.identity;
		BPGCtext = ((Component)val.transform.GetChild(0)).gameObject;
		BPtext = ((Component)val.transform.GetChild(1)).gameObject;
		GCtext = ((Component)val.transform.GetChild(2)).gameObject;
		BPtext.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
		GCtext.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
		Object.Destroy((Object)(object)((Component)val.transform.GetChild(3)).gameObject);
		bpobj_only = ((Component)BPtext.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>();
		gcobj_only = ((Component)GCtext.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>();
		bpobj = ((Component)BPGCtext.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>();
		gcobj = ((Component)BPGCtext.transform.GetChild(1)).gameObject.GetComponent<TextMeshPro>();
		Color topLeft = ((TMP_Text)gcobj).colorGradient.topLeft;
		((TMP_Text)gcobj).colorGradient = new VertexGradient(topLeft);
		((TMP_Text)gcobj_only).colorGradient = new VertexGradient(topLeft);
		((TMP_Text)bpobj).colorGradient = new VertexGradient(Color.white);
		((TMP_Text)bpobj_only).colorGradient = new VertexGradient(Color.white);
		GameObject gameObject2 = ItemHighlightWindow.GetGameObject();
		CollisionHandler component = ((Component)gameObject2.transform.GetChild(6).GetChild(3)).gameObject.GetComponent<CollisionHandler>();
		GameObject gameObject3 = MessageScreen.GetGameObject();
		InteractionTouch component2 = ((Component)gameObject3.transform.GetChild(2).GetChild(1)).gameObject.GetComponent<InteractionTouch>();
		((InteractionBase)component2).onEndInteraction.AddListener(UnityAction.op_Implicit((Action)proceedButtonPressed));
		((UnityEvent<Collider>)(object)component.onTriggerEnter).AddListener(UnityAction<Collider>.op_Implicit((Action<Collider>)trackButtonPressed));
		Log("Initialized Overview objects");
	}

	public void proceedButtonPressed()
	{
		needUpdate = true;
	}

	public void trackButtonPressed(Collider collider)
	{
		needUpdate = true;
	}

	public void UpdateProgressOverview()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Invalid comparison between Unknown and I4
		int num = 0;
		int num2 = 0;
		Enumerator<string> enumerator = progressTracker.presentingItems.GetEnumerator();
		while (enumerator.MoveNext())
		{
			string current = enumerator.Current;
			CatalogItem catalogItem = handler.GetCatalogItem(current);
			foreach (Currency item in (Il2CppArrayBase<Currency>)(object)catalogItem.RequiredCurrencies)
			{
				if ((int)item.Type == 0)
				{
					num2 += item.Amount;
				}
				else if (num < item.Amount)
				{
					num = item.Amount;
				}
			}
		}
		bool flag = num2 > 0;
		bool flag2 = num > 0;
		BPGCtext.SetActive(flag && flag2);
		GCtext.SetActive(flag && !flag2);
		BPtext.SetActive(!flag && flag2);
		PlayerData data = Players.GetLocalPlayer().Data;
		int coinsAmount = data.EconomyData.CoinsAmount;
		int battlePoints = data.GeneralData.BattlePoints;
		((TMP_Text)gcobj).text = $"GC: {coinsAmount}/{num2}";
		((TMP_Text)bpobj).text = $"BP: {battlePoints}/{num}";
		((TMP_Text)gcobj_only).text = ((TMP_Text)gcobj).text;
		((TMP_Text)bpobj_only).text = ((TMP_Text)bpobj).text;
	}
}