Decompiled source of PacManDog v1.2.3

PacManDog.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 PacManDog.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("PacManDog")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PacManDog")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("11ecdc4c-2730-4bd5-851e-e4abaaf2505f")]
[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")]
namespace PacManDog
{
	[BepInPlugin("PacManDog", "Pac Man Dog", "1.2.3")]
	public class PacManDogBase : BaseUnityPlugin
	{
		private const string modGUID = "PacManDog";

		private const string modName = "Pac Man Dog";

		private const string modVersion = "1.2.3";

		private readonly Harmony harmony = new Harmony("PacManDog");

		private static PacManDogBase Instance;

		internal ManualLogSource mls;

		internal static AudioClip[] newScreamSFX;

		internal static AudioClip[] newKillPlayerSFX;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("PacManDog");
			mls.LogInfo((object)"PacManDog is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "PacManDog.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "pacmansounds";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newScreamSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/pacmanchasingghosts.mp3");
			newKillPlayerSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/pacmandeath.mp3");
			harmony.PatchAll(typeof(MouthDogAIPatch));
			mls.LogInfo((object)"PacManDog is loaded.");
		}
	}
}
namespace PacManDog.Patches
{
	[HarmonyPatch(typeof(MouthDogAI))]
	internal class MouthDogAIPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void mouthDogAudioPatch(ref AudioClip ___screamSFX, ref AudioClip ___killPlayerSFX)
		{
			AudioClip val = PacManDogBase.newScreamSFX[0];
			___screamSFX = val;
			AudioClip val2 = PacManDogBase.newKillPlayerSFX[0];
			___killPlayerSFX = val2;
		}
	}
}