Decompiled source of Scooby Laugh Sound Mod v0.1.0

Scooby_Laugh_Sound_Mod/CMSound_Mod.dll

Decompiled 7 months ago
using System;
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 CMSound_Mod.Patches;
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("CMSound_Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CMSound_Mod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9ab0826c-30f5-4487-a6a6-ae2e0f7c3e99")]
[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 CMSound_Mod
{
	[BepInPlugin("Poseidon.CMSound_Mod", "CM Sound Mod", "1.1.0.0")]
	public class CMSound_Mod_Base : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.CMSound_Mod";

		private const string modName = "CM Sound Mod";

		private const string modVersion = "1.1.0.0";

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

		internal static CMSound_Mod_Base Instance;

		internal static ManualLogSource mls;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Poseidon.CMSound_Mod");
			mls.LogInfo((object)"The Scooby Laugh is Active!!!!!");
			harmony.PatchAll(typeof(CMSound_Mod_Base));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("CMSound_Mod.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "scoob");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle!");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle!");
			}
		}
	}
}
namespace CMSound_Mod.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			Random random = new Random();
			int num = random.Next(0, 2);
			Random random2 = new Random();
			int num2 = random2.Next(0, 2);
			Random random3 = new Random();
			int num3 = random3.Next(0, 2);
			Random random4 = new Random();
			int num4 = random4.Next(0, 2);
			Random random5 = new Random();
			int num5 = random5.Next(0, 2);
			Random random6 = new Random();
			int num6 = random6.Next(0, 2);
			Random random7 = new Random();
			int num7 = random7.Next(0, 2);
			Random random8 = new Random();
			int num8 = random8.Next(0, 2);
			Random random9 = new Random();
			int num9 = random9.Next(0, 2);
			Random random10 = new Random();
			int num10 = random10.Next(0, 2);
			Random random11 = new Random();
			int num11 = random11.Next(0, 2);
			Random random12 = new Random();
			int num12 = random12.Next(0, 2);
			Random random13 = new Random();
			int num13 = random13.Next(0, 2);
			Random random14 = new Random();
			int num14 = random14.Next(0, 2);
			Random random15 = new Random();
			int num15 = random15.Next(0, 2);
			__instance.shipIntroSpeechSFX = CMSound_Mod_Base.SoundFX[0];
			if (num == 1)
			{
				__instance.playerJumpSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num2 == 1)
			{
				__instance.playedDrowningSFX = Object.op_Implicit((Object)(object)CMSound_Mod_Base.SoundFX[0]);
			}
			if (num3 == 1)
			{
				__instance.hitPlayerSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num4 == 1)
			{
				__instance.shipArriveSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num5 == 1)
			{
				__instance.zeroDaysLeftAlertSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num6 == 1)
			{
				__instance.alarmSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num7 == 1)
			{
				__instance.bloodGoreSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num8 == 1)
			{
				__instance.shipDepartSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num9 == 1)
			{
				__instance.disableSpeakerSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num10 == 1)
			{
				__instance.suckedIntoSpaceSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num11 == 1)
			{
				__instance.firedVoiceSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num12 == 1)
			{
				__instance.fallDamageSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num13 == 1)
			{
				__instance.damageSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num14 == 1)
			{
				__instance.changeSuitSFX = CMSound_Mod_Base.SoundFX[0];
			}
			if (num15 == 1)
			{
				__instance.HUDSystemAlertSFX = CMSound_Mod_Base.SoundFX[0];
			}
		}
	}
}