Decompiled source of More Park Friends v2.2.1

Mods/MoreParkFriends.dll

Decompiled 5 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using Il2CppRUMBLE.Environment;
using Il2CppTMPro;
using MelonLoader;
using MoreParkFriends;
using RumbleModUI;
using RumbleModdingAPI.RMAPI;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(MoreParkFriendsClass), "More Park Friends", "2.2.1", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 7, 1, true)]
[assembly: AssemblyTitle("MoreParkFriends")]
[assembly: AssemblyDescription("Increases Selectable Park Player Count")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreParkFriends")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("674bb24a-e35e-4068-8dbe-20e510a504ba")]
[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")]
[HarmonyPatch(typeof(ParkBoardGymVariant), "OnPlayerEnteredTrigger")]
public static class Patch
{
	private static void Prefix()
	{
		int multiplier = MoreParkFriendsClass.multiplier;
		ParkBoardGymVariant component = Parkboard.GetGameObject().GetComponent<ParkBoardGymVariant>();
		component.hostPlayerCapacity *= multiplier;
	}
}
namespace MoreParkFriends;

public class MoreParkFriendsClass : MelonMod
{
	public static int multiplier = 2;

	public static Mod MoreParkFriends = new Mod();

	public override void OnLateInitializeMelon()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		MoreParkFriends.ModName = "More Park Friends";
		MoreParkFriends.ModVersion = "2.2.1";
		MoreParkFriends.SetFolder("MoreParkFriends");
		MoreParkFriends.AddToList("Multiplier", 2, "Changes Player Counts on the Park Board.", new Tags());
		MoreParkFriends.GetFromFile();
		MoreParkFriends.ModSaved += Save;
		UI.instance.UI_Initialized += UIInit;
		Save();
	}

	private void Save()
	{
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		if ((int)MoreParkFriends.Settings[0].SavedValue <= 0)
		{
			MoreParkFriends.Settings[0].Value = 1;
			MoreParkFriends.Settings[0].SavedValue = 1;
		}
		if (9 < (int)MoreParkFriends.Settings[0].SavedValue)
		{
			MoreParkFriends.Settings[0].Value = 9;
			MoreParkFriends.Settings[0].SavedValue = 9;
		}
		multiplier = (int)MoreParkFriends.Settings[0].SavedValue;
		Scene activeScene = SceneManager.GetActiveScene();
		if (((Scene)(ref activeScene)).name == "Gym")
		{
			GameObject gameObject = TextandIcons.GetGameObject();
			for (int i = 1; i <= 5; i++)
			{
				((TMP_Text)((Component)gameObject.transform.GetChild(i)).GetComponent<TextMeshPro>()).text = ((1 + i) * multiplier).ToString();
			}
		}
	}

	private static void UIInit()
	{
		UI.instance.AddMod(MoreParkFriends);
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		if (sceneName == "Gym")
		{
			if (multiplier <= 0)
			{
				multiplier = 1;
			}
			if (9 < multiplier)
			{
				multiplier = 9;
			}
			GameObject gameObject = TextandIcons.GetGameObject();
			for (int i = 1; i <= 5; i++)
			{
				((TMP_Text)((Component)gameObject.transform.GetChild(i)).GetComponent<TextMeshPro>()).text = ((1 + i) * multiplier).ToString();
			}
		}
	}
}