Decompiled source of ParkLink v1.1.0

Mods/LinkInPark.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AudioImportLib;
using BoneLib;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.Warehouse;
using LinkInPark;
using MelonLoader;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
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(Core), "LinkInPark", "1.0.0", "The Static Team", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("LinkInPark")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LinkInPark")]
[assembly: AssemblyTitle("LinkInPark")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LinkInPark
{
	public class Core : MelonMod
	{
		public static AudioClip music { get; private set; }

		public override void OnInitializeMelon()
		{
			((MelonBase)this).LoggerInstance.Msg("Initialized.");
			((MelonBase)this).HarmonyInstance.PatchAll();
			try
			{
				music = API.LoadAudioClip(Path.Combine(MelonEnvironment.UserLibsDirectory, "song.mp3"), true);
			}
			catch (Exception ex)
			{
				((MelonBase)this).LoggerInstance.Error("Failed to load music: " + ex.ToString());
				return;
			}
			Hooking.OnLevelLoaded += Hooking_OnLevelLoaded;
			Hooking.OnWarehouseReady += Hooking_OnWarehouseReady;
		}

		private void Hooking_OnWarehouseReady()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			SceneStreamer.Load(new Barcode("fa534c5a83ee4ec6bd641fec424c4142.Level.LevelHalfwayPark"), (Barcode)null);
		}

		private void Hooking_OnLevelLoaded(LevelInfo obj)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			string title = ((Scannable)((CrateReferenceT<LevelCrate>)(object)obj.levelReference).Crate).Title;
			if (title.Contains("Halfway") && title.Contains("Park"))
			{
				AudioSource val = new GameObject("LinkInPark").AddComponent<AudioSource>();
				val.volume = 1f;
				val.loop = true;
				val.clip = music;
				val.Play();
			}
		}
	}
}