Decompiled source of RWBYNoise v1.0.4

RWBYNoise.dll

Decompiled 11 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 GameNetcodeStuff;
using HarmonyLib;
using RWBYNoise.Patches;
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("RWBYNoise")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RWBYNoise")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8d09fd51-f98a-47e2-af3e-952ed70b29d1")]
[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 RWBYNoise
{
	[BepInPlugin("Poseidon.RWBYNoise", "RWBY Noise Mod", "1.0.0.0")]
	public class RWBYNoiseBase : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.RWBYNoise";

		private const string modName = "RWBY Noise Mod";

		private const string modVersion = "1.0.0.0";

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

		private static RWBYNoiseBase Instance;

		internal 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.RWBYNoise");
			mls.LogInfo((object)"The RWBY Noise mod has been loaded correctly. Please wait to see if the external audio will load correctly.");
			harmony.PatchAll(typeof(RWBYNoiseBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("RWBYNoise.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "rubyintro");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"RWBY sound loaded correctly. Great job!");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load the bundle. Please check to see if you have ''chatterbox'' in the main directory if the mod. If not, please redownload the old version.");
			}
		}
	}
}
namespace RWBYNoise.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprintPatch(ref float ___sprintMeter)
		{
			___sprintMeter = 1f;
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = RWBYNoiseBase.SoundFX[0];
			__instance.firedVoiceSFX = RWBYNoiseBase.SoundFX[0];
		}
	}
}