Decompiled source of LCPocketBoombox v1.0.0

LCPocketBoombox.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LC_Boombox_Mod.Patches;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC Boombox Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC Boombox Mod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("02aa5d63-a3ce-4838-bc31-0e4dad63ef12")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LC_Boombox_Pocket_Patch
{
	[BepInPlugin("TeletubbyPo.BoomboxAlwaysPlay", "LC Boombox Pocket Play", "1.0.0")]
	public class LCBoomboxPocketMod : BaseUnityPlugin
	{
		private const string modGUID = "TeletubbyPo.BoomboxAlwaysPlay";

		private const string modName = "LC Boombox Pocket Play";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("TeletubbyPo.BoomboxAlwaysPlay");

		private static LCBoomboxPocketMod Instance;

		internal ManualLogSource modLogger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			modLogger = Logger.CreateLogSource("TeletubbyPo.BoomboxAlwaysPlay");
			modLogger.LogInfo((object)"Boombox Pocket Player Loaded Successfully!");
			harmony.PatchAll(typeof(BoomboxItemPatch));
		}
	}
}
namespace LC_Boombox_Mod.Patches
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxItemPatch
	{
		[HarmonyPatch("PocketItem")]
		[HarmonyPrefix]
		public static bool PocketItem(ref BoomboxItem __instance)
		{
			GrabbableObject component = ((Component)__instance).GetComponent<GrabbableObject>();
			if (((NetworkBehaviour)component).IsOwner && (Object)(object)component.playerHeldBy != (Object)null)
			{
				component.playerHeldBy.IsInspectingItem = false;
			}
			component.isPocketed = true;
			((Component)component).gameObject.GetComponent<AudioSource>().PlayOneShot(component.itemProperties.pocketSFX, 1f);
			component.EnableItemMeshes(false);
			return false;
		}
	}
}