Decompiled source of Babel7ara v1.0.1

babal7ara/babAl7ara.dll

Decompiled 10 months ago
using System.Collections.Generic;
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 UnityEngine;
using babAl7ara.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("babAl7ara")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("babAl7ara")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dccc548d-b177-4be1-b4a0-3ade6d5136e3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace babAl7ara
{
	[BepInPlugin("Poseidon.babEl7ara", "bab el 7ara", "1.0.1")]
	public class teyam : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.babEl7ara";

		private const string modName = "bab el 7ara";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("Poseidon.babEl7ara");

		private static teyam Instance;

		internal ManualLogSource mls;

		internal static AudioSource newSound;

		internal static List<AudioClip> SoundFX;

		internal static List<AudioClip> SoundFX2;

		internal static List<AudioClip> SoundFX3;

		internal static List<AudioClip> SoundFX4;

		internal static List<AudioSource> SoundFX5;

		internal static AssetBundle Bundle;

		internal static AssetBundle Bundle2;

		internal static AssetBundle Bundle3;

		internal static AssetBundle Bundle4;

		internal static AssetBundle Bundle5;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Poseidon.babEl7ara");
			mls.LogInfo((object)"abo 3esam kshf ras el7areem");
			harmony.PatchAll(typeof(teyam));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			harmony.PatchAll(typeof(FlowermanAiPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			SoundFX2 = new List<AudioClip>();
			SoundFX3 = new List<AudioClip>();
			SoundFX4 = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("babAl7ara.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "l2nk 7reme");
			Bundle2 = AssetBundle.LoadFromFile(location + "abo 3esam");
			Bundle3 = AssetBundle.LoadFromFile(location + "died");
			Bundle4 = AssetBundle.LoadFromFile(location + "music");
			Bundle5 = AssetBundle.LoadFromFile(location + "teyam");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"successfully load asset bundle");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
				SoundFX2 = Bundle2.LoadAllAssets<AudioClip>().ToList();
				SoundFX3 = Bundle3.LoadAllAssets<AudioClip>().ToList();
				SoundFX4 = Bundle4.LoadAllAssets<AudioClip>().ToList();
				SoundFX5 = Bundle5.LoadAllAssets<AudioSource>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
		}
	}
}
namespace babAl7ara.Patches
{
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanAiPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void OverrideAudio(FlowermanAI __instance)
		{
			__instance.creatureAngerVoice = teyam.SoundFX5[0];
			__instance.crackNeckSFX = teyam.SoundFX[0];
			((EnemyAI)__instance).creatureSFX = teyam.SoundFX5[0];
			((EnemyAI)__instance).creatureVoice = teyam.SoundFX5[0];
			((EnemyAI)__instance).dieSFX = teyam.SoundFX[0];
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = teyam.SoundFX[0];
			__instance.changeSuitSFX = teyam.SoundFX2[0];
			__instance.allPlayersDeadAudio = teyam.SoundFX3[0];
			__instance.disableSpeakerSFX = teyam.SoundFX2[0];
		}
	}
}