Decompiled source of TrollPack v0.1.0

TrollPack.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TrollPack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TrollPack")]
[assembly: AssemblyTitle("TrollPack")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace TrollPack
{
	[BepInPlugin("com.palmstudio.trollpack", "Mod TrollPack REPO", "1.0.0")]
	public class MainPlugin : BaseUnityPlugin
	{
		public static AssetBundle? SfxBundle;

		public static AudioClip? FartSound;

		public static AudioClip? SadTromboneSound;

		public static AudioClip? BuzzerSound;

		public static AudioClip? MimicCallsSound;

		private void Awake()
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			Debug.Log((object)"Ohayo-san.");
			Debug.Log((object)"Memulai loading Asset Bundle...");
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "trollpacksfx");
			if (File.Exists(text))
			{
				SfxBundle = AssetBundle.LoadFromFile(text);
				if ((Object)(object)SfxBundle != (Object)null)
				{
					Debug.Log((object)"Asset Bundle 'trollpacksfx' sukses di-load!");
					FartSound = SfxBundle.LoadAsset<AudioClip>("sfx_fart.mp3");
					SadTromboneSound = SfxBundle.LoadAsset<AudioClip>("sfx_sad_trombone.mp3");
					BuzzerSound = SfxBundle.LoadAsset<AudioClip>("sfx_buzzer.mp3");
					MimicCallsSound = SfxBundle.LoadAsset<AudioClip>("sfx_mimic_calls.mp3");
					Debug.Log((object)"Semua file audio sukses dimuat ke memory!");
				}
			}
			else
			{
				Debug.Log((object)("File Asset Bundle tidak ditemukan di: " + text));
			}
			Harmony val = new Harmony("com.palmstudio.trollpack");
			val.PatchAll();
		}

		public static void PlaySFX_Fart(Vector3 posisi)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)FartSound != (Object)null)
			{
				AudioSource.PlayClipAtPoint(FartSound, posisi);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Jump")]
	public class PlayerJumpPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayerController __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MainPlugin.FartSound != (Object)null)
			{
				Vector3 position = ((Component)__instance).transform.position;
				AudioSource.PlayClipAtPoint(MainPlugin.FartSound, position);
				Debug.Log((object)"Pemain melompat! Memutar sfx_fart.");
			}
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Land")]
	public class PlayerLandPatch
	{
		[HarmonyPostfix]
		public static void Postfix(PlayerController __instance)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)MainPlugin.SadTromboneSound != (Object)null)
			{
				Vector3 position = ((Component)__instance).transform.position;
				AudioSource.PlayClipAtPoint(MainPlugin.SadTromboneSound, position);
				Debug.Log((object)"Pemain landing! Memutar sfx_fart.");
			}
		}
	}
}