Decompiled source of More Park Friends v2.0.1

Mods/MoreParkFriends.dll

Decompiled 5 months ago
using System.Collections;
using System.Diagnostics;
using System.IO;
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 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(MoreParkFriendsClass), "More Park Friends", "2.0.1", "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("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 = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Parkboard").GetComponent<ParkBoardGymVariant>();
		component.hostPlayerCapacity *= multiplier;
	}
}
namespace MoreParkFriends;

public class MoreParkFriendsClass : MelonMod
{
	public string FILEPATH = "UserData\\MoreParkFriends";

	public string FILENAME = "Multiplier.txt";

	public static int multiplier = 2;

	public override void OnLateInitializeMelon()
	{
		MelonCoroutines.Start(CheckIfFileExists(FILEPATH, FILENAME));
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		((MelonMod)this).OnSceneWasLoaded(buildIndex, sceneName);
		if (sceneName == "Gym")
		{
			if (multiplier <= 0)
			{
				multiplier = 1;
			}
			if (9 < multiplier)
			{
				multiplier = 9;
			}
			GameObject val = GameObject.Find("--------------LOGIC--------------/Heinhouser products/Parkboard/RotatingScreen/HostPanel/Player Cpapcity/TextandIcons/");
			for (int i = 1; i <= 5; i++)
			{
				((TMP_Text)((Component)val.transform.GetChild(i)).GetComponent<TextMeshPro>()).text = ((1 + i) * multiplier).ToString();
			}
		}
	}

	public IEnumerator CheckIfFileExists(string filePath, string fileName)
	{
		if (!File.Exists(filePath + "\\" + fileName))
		{
			if (!Directory.Exists(filePath))
			{
				MelonLogger.Msg("Folder Not Found, Creating Folder: " + filePath);
				Directory.CreateDirectory(filePath);
			}
			if (!File.Exists(filePath + "\\" + fileName))
			{
				MelonLogger.Msg("Creating File " + filePath + "\\" + fileName);
				File.Create(filePath + "\\" + fileName);
			}
			multiplier = 2;
			for (int i = 0; i < 60; i++)
			{
				yield return (object)new WaitForFixedUpdate();
			}
			File.WriteAllLines(contents: new string[1] { "2" }, path: filePath + "\\" + fileName);
		}
		else
		{
			multiplier = int.Parse(File.ReadAllLines(FILEPATH + "\\" + FILENAME)[0]);
		}
		yield return null;
	}
}