Decompiled source of AmberAlert v1.0.0

AmberAlert.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AmberAlert.Patches;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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("AmberAlert")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AmberAlert")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("749e755d-1f7b-4832-99bb-6f4fc2eb8c1f")]
[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 AmberAlert
{
	[BepInPlugin("Gewdz.AmberAlertMod", "Amber Alert Mod", "1.0.0.0")]
	public class AmberAlertPlugin : BaseUnityPlugin
	{
		private const string modGUID = "Gewdz.AmberAlertMod";

		private const string modName = "Amber Alert Mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Gewdz.AmberAlertMod");

		private static AmberAlertPlugin Instance;

		internal static AudioClip[] newSFX;

		internal ManualLogSource mls;

		private void Awake()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Gewdz.AmberAlertMod");
			AssetBundle val = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("AmberAlert.dll".ToCharArray()) + "amberalert");
			if ((Object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newSFX = val.LoadAssetWithSubAssets<AudioClip>("assets/amberalert.mp3");
			mls.LogInfo((object)newSFX.Length);
			mls.LogInfo((object)((Object)newSFX[0]).name);
			mls.LogInfo((object)((object)newSFX[0]).ToString());
			harmony.PatchAll(typeof(GhostGirlAudioPatch));
			mls.LogInfo((object)"Amber Alert Missing Child is loaded");
			harmony.PatchAll(typeof(AmberAlertPlugin));
		}
	}
}
namespace AmberAlert.Patches
{
	[HarmonyPatch(typeof(DressGirlAI))]
	internal class GhostGirlAudioPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void patchM(ref AudioClip ___breathingSFX)
		{
			AudioClip[] newSFX = AmberAlertPlugin.newSFX;
			if (newSFX != null && newSFX.Length >= 0)
			{
				AudioClip val = newSFX[0];
				___breathingSFX = val;
			}
		}
	}
}