Decompiled source of RSHMod v1.0.0

RSH-mod.dll

Decompiled 2 years ago
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using RSH_mod.Patches;
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("RSH-mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RSH-mod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f59cae03-45be-48a8-83ca-66b616d5bd15")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RSH_mod
{
	[BepInPlugin("Kaclo4.RSHmod", "RSH Mod", "0.0.1")]
	public class RSHModBase : BaseUnityPlugin
	{
		private const string modGUID = "Kaclo4.RSHmod";

		private const string modName = "RSH Mod";

		private const string modVersion = "0.0.1";

		private readonly Harmony harmony = new Harmony("Kaclo4.RSHmod");

		private static RSHModBase Instance;

		internal static ManualLogSource mls;

		internal static AudioClip[] BoomArray;

		private void Awake()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Kaclo4.RSHmod");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "RSH-mod.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "rshboombox";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			BoomArray = val.LoadAllAssets<AudioClip>().ToArray();
			if (BoomArray.Length == 0)
			{
				mls.LogError((object)"Asset array is empty");
				return;
			}
			mls.LogInfo((object)"The test mod has awaken :)");
			harmony.PatchAll(typeof(BoomboxItemPatch));
		}
	}
}
namespace RSH_mod.Patches
{
	[HarmonyPatch(typeof(BoomboxItem))]
	internal class BoomboxItemPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void BoomboxAudioPatch(BoomboxItem __instance)
		{
			__instance.musicAudios = RSHModBase.BoomArray;
			RSHModBase.mls.LogDebug((object)$"Loaded boombox with {RSHModBase.BoomArray.Length} Songs");
		}
	}
}