Decompiled source of AlBaghdadiSpeaker v0.0.1

BepInEx/plugins/al-baghdadi/speakerVoice.dll

Decompiled 4 months ago
using System;
using System.Diagnostics;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("speakerVoice")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("speakerVoice")]
[assembly: AssemblyTitle("speakerVoice")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace speakerVoice
{
	[HarmonyPatch(typeof(StartOfRound))]
	public class PatchClass
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void speakerVoicePatch(ref AudioClip ___shipIntroSpeechSFX)
		{
			AudioClip shipIntroSpeechSFX = Plugin.shipIntroSpeechSFX;
			___shipIntroSpeechSFX = shipIntroSpeechSFX;
		}
	}
	[BepInPlugin("com.sau6son.al-baghdadi", "al-baghdadi-speaker", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		private static Plugin Instance;

		internal static AudioClip shipIntroSpeechSFX;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			if ((Object)Instance == (Object)null)
			{
				Instance = this;
			}
			_harmony = new Harmony("com.sau6son.al-baghdadi");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"sau6son.al-baghdadi is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "speakerVoice.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "speakerVoice-bundle";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load asset bundle!");
				return;
			}
			shipIntroSpeechSFX = val.LoadAsset<AudioClip>("assets/speaker.mp3");
			if ((Object)(object)shipIntroSpeechSFX == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load the audio assets!");
				return;
			}
			_harmony.PatchAll(typeof(PatchClass));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"al-baghdadi-speaker plugin loaded !");
		}
	}
}