Decompiled source of GotBagels v1.0.0

GotBagels.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 GotBagels.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("GotBagels")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GotBagels")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("24e2beef-cf9c-4bdd-b5eb-dcccbbf0f173")]
[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 GotBagels
{
	[BepInPlugin("We.GotBagels", "GotBagels", "1.0.0")]
	public class BagelsBase : BaseUnityPlugin
	{
		private const string modGUID = "We.GotBagels";

		private const string modName = "GotBagels";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("We.GotBagels");

		private static BagelsBase 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("We.GotBagels");
			mls.LogInfo((object)"Fresh Bagels out of the oven!");
			harmony.PatchAll(typeof(BagelsBase));
			harmony.PatchAll(typeof(BagelSoundStartofRound));
			harmony.PatchAll(typeof(BagelOpen));
			mls = ((BaseUnityPlugin)this).Logger;
			SoundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("GotBagels.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "bagels");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully buttered bagels!");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load bagel assets. Bagels are burnt :(");
			}
		}
	}
}
namespace GotBagels.Patches
{
	[HarmonyPatch(typeof(GiftBoxItem))]
	internal class BagelOpen
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(GiftBoxItem __instance)
		{
			__instance.openGiftAudio = BagelsBase.SoundFX[0];
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class BagelSoundStartofRound
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void OverrideAudio(StartOfRound __instance)
		{
			__instance.shipIntroSpeechSFX = BagelsBase.SoundFX[0];
		}
	}
}