Decompiled source of DK Rap Intro Mod v1.0.1

DKRapIntroMod.dll

Decompiled 6 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 HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DKRapIntroMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DKRapIntroMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e8e5f662-dfae-4764-9736-57abcd70976f")]
[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 DKRapIntroMod;

[BepInPlugin("ttv.teammenship.dkrapintromod", "DK Rap Intro Mod", "1.0.1")]
public class DKRapCore : BaseUnityPlugin
{
	private const string modGUID = "ttv.teammenship.dkrapintromod";

	private const string modName = "DK Rap Intro Mod";

	private const string modVersion = "1.0.1";

	private readonly Harmony harmony = new Harmony("ttv.teammenship.dkrapintromod");

	private static DKRapCore Instance;

	internal static List<AudioClip> SoundFX;

	internal static AssetBundle Bundle;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		harmony.PatchAll(typeof(DKRapCore));
		harmony.PatchAll(typeof(startofroundpatch));
		harmony.PatchAll(typeof(StartPatch));
		SoundFX = new List<AudioClip>();
		Bundle = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("DKRapIntroMod.dll".ToCharArray()) + "dk_rap");
		if ((Object)(object)Bundle != (Object)null)
		{
			Debug.Log((object)"[DK] OKAY!");
			SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
		}
		else
		{
			Debug.Log((object)"[DK] Donkey Kong has been captured by K. Rool! Something has gone terribly wrong!");
		}
	}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class startofroundpatch
{
	[HarmonyPatch("Start")]
	[HarmonyPrefix]
	private static void OverrideAudio(StartOfRound __instance)
	{
		Debug.Log((object)"[DK]: welcome aboard skipper!");
		__instance.shipIntroSpeechSFX = DKRapCore.SoundFX[0];
	}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartPatch
{
	[HarmonyPatch("ResetShip")]
	[HarmonyPostfix]
	private static void OverrideAudio(StartOfRound __instance)
	{
		int num = Random.Range(0, 6);
		Debug.Log((object)"[DK]: we're doing this again...");
		Debug.Log((object)("[DK]: Funky's lucky number is: " + num));
		if (num < 5)
		{
			__instance.shipIntroSpeechSFX = DKRapCore.SoundFX[0];
		}
		else
		{
			__instance.shipIntroSpeechSFX = DKRapCore.SoundFX[1];
		}
	}
}