Decompiled source of TheBnuyMemeCollection v1.1.0

plugins/TheBnuyMemeCollection.dll

Decompiled 5 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TheBnuyMemeCollection.patches;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("AstraBun")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+0ac2c96a42d3ce82a960a9e7fdc20c232ab07808")]
[assembly: AssemblyProduct("TheBnuyMemeCollection")]
[assembly: AssemblyTitle("TheBnuyMemeCollection")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TheBnuyMemeCollection
{
	[BepInPlugin("AstraBun.TheBnuyMemeCollection", "TheBnuyMemeCollection", "1.1.0")]
	public class TheBnuyMemeCollection : BaseUnityPlugin
	{
		internal static TheBnuyMemeCollection Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
			Logger.LogInfo((object)(((BaseUnityPlugin)this).Info.Metadata.GUID + " Prepare for bunny memes heheheheheheh"));
			((Component)this).gameObject.AddComponent<ShopMusicRunner>();
		}

		internal void Patch()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			//IL_0025: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll(typeof(MuseumBoomboxIs365PartyGirlPatch));
			Harmony.PatchAll(typeof(MuseumBoomboxGreenLightPatch));
			Harmony.PatchAll(typeof(EnemyBeamerAttackIntroPatch));
			Harmony.PatchAll(typeof(EnemyHunterHummingLoopPatch));
			Harmony.PatchAll(typeof(EnemyTrudgeImpactSoundPatch));
			Harmony.PatchAll(typeof(EnemyHiddenSoundPatch));
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}
namespace TheBnuyMemeCollection.patches
{
	[HarmonyPatch(typeof(EnemyBeamerAnim), "Awake")]
	internal class EnemyBeamerAttackIntroPatch
	{
		[CompilerGenerated]
		private sealed class <ReplaceBeamerSound>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyBeamerAnim anim;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReplaceBeamerSound>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Invalid comparison between Unknown and I4
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AudioClip");
					string text = Path.Combine(path, "enemy beamer attack intro.ogg");
					string text2 = "file://" + text.Replace("\\", "/");
					<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)14);
					<>2__current = <www>5__2.SendWebRequest();
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					if ((int)<www>5__2.result != 1)
					{
						TheBnuyMemeCollection.Logger.LogError((object)("Failed to load replacement sound: " + <www>5__2.error));
						return false;
					}
					AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
					if (anim.soundAttackIntro != null && anim.soundAttackIntro.Sounds != null && anim.soundAttackIntro.Sounds.Length != 0)
					{
						anim.soundAttackIntro.Sounds[0] = content;
					}
					else
					{
						TheBnuyMemeCollection.Logger.LogWarning((object)"Could not find SoundAttackIntro or its Sounds[]");
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPostfix]
		private static void Postfix(EnemyBeamerAnim __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(ReplaceBeamerSound(__instance));
		}

		[IteratorStateMachine(typeof(<ReplaceBeamerSound>d__1))]
		private static IEnumerator ReplaceBeamerSound(EnemyBeamerAnim anim)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReplaceBeamerSound>d__1(0)
			{
				anim = anim
			};
		}
	}
	[HarmonyPatch(typeof(EnemyHiddenAnim), "Update")]
	internal class EnemyHiddenSoundPatch
	{
		[CompilerGenerated]
		private sealed class <ReplaceHiddenSound>d__2 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyHiddenAnim anim;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReplaceHiddenSound>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Invalid comparison between Unknown and I4
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AudioClip");
					string text = Path.Combine(path, "rholiday.ogg");
					string text2 = "file://" + text.Replace("\\", "/");
					<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)14);
					<>2__current = <www>5__2.SendWebRequest();
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					if ((int)<www>5__2.result != 1)
					{
						TheBnuyMemeCollection.Logger.LogError((object)("Failed to load replacement sound: " + <www>5__2.error));
						return false;
					}
					AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
					if (anim.soundPlayerMove != null && anim.soundPlayerMove.Sounds != null && anim.soundPlayerMove.Sounds.Length != 0)
					{
						anim.soundPlayerMove.Sounds[0] = content;
					}
					else
					{
						TheBnuyMemeCollection.Logger.LogWarning((object)"Could not find soundPlayerMove or its Sounds[]");
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly HashSet<EnemyHiddenAnim> patched = new HashSet<EnemyHiddenAnim>();

		[HarmonyPostfix]
		private static void Postfix(EnemyHiddenAnim __instance)
		{
			if (!patched.Contains(__instance))
			{
				patched.Add(__instance);
				((MonoBehaviour)__instance).StartCoroutine(ReplaceHiddenSound(__instance));
			}
		}

		[IteratorStateMachine(typeof(<ReplaceHiddenSound>d__2))]
		private static IEnumerator ReplaceHiddenSound(EnemyHiddenAnim anim)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReplaceHiddenSound>d__2(0)
			{
				anim = anim
			};
		}
	}
	[HarmonyPatch(typeof(EnemyHunterAnim), "Awake")]
	internal class EnemyHunterHummingLoopPatch
	{
		[CompilerGenerated]
		private sealed class <ReplaceSound>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemyHunterAnim anim;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReplaceSound>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Invalid comparison between Unknown and I4
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AudioClip");
					string text = Path.Combine(path, "enemy hunter nutting loop.ogg");
					string text2 = "file://" + text.Replace("\\", "/");
					<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)14);
					<>2__current = <www>5__2.SendWebRequest();
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					if ((int)<www>5__2.result != 1)
					{
						TheBnuyMemeCollection.Logger.LogError((object)("Failed to load replacement sound: " + <www>5__2.error));
						return false;
					}
					AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
					if (anim.soundHumming != null && anim.soundHumming.Sounds != null && anim.soundHumming.Sounds.Length != 0)
					{
						anim.soundHumming.Sounds[0] = content;
					}
					else
					{
						TheBnuyMemeCollection.Logger.LogWarning((object)"Could not find soundHumming or its Sounds[]");
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPostfix]
		private static void Postfix(EnemyHunterAnim __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(ReplaceSound(__instance));
		}

		[IteratorStateMachine(typeof(<ReplaceSound>d__1))]
		private static IEnumerator ReplaceSound(EnemyHunterAnim anim)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReplaceSound>d__1(0)
			{
				anim = anim
			};
		}
	}
	[HarmonyPatch(typeof(EnemySlowWalkerAnim), "Awake")]
	internal class EnemyTrudgeImpactSoundPatch
	{
		[CompilerGenerated]
		private sealed class <ReplaceSound>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EnemySlowWalkerAnim anim;

			private UnityWebRequest <www>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReplaceSound>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<www>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Invalid comparison between Unknown and I4
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AudioClip");
					string text = Path.Combine(path, "VineBoom.ogg");
					string text2 = "file://" + text.Replace("\\", "/");
					<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(text2, (AudioType)14);
					<>2__current = <www>5__2.SendWebRequest();
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					if ((int)<www>5__2.result != 1)
					{
						TheBnuyMemeCollection.Logger.LogError((object)("Failed to load replacement sound: " + <www>5__2.error));
						return false;
					}
					AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
					Array array = new Sound[4] { anim.sfxFootstepSmall, anim.sfxFootstepBig, anim.sfxAttackImplosionImpactLocal, anim.sfxAttackImplosionHitLocal };
					foreach (Sound item in array)
					{
						Sound val = item;
						if (val != null && val.Sounds != null && val.Sounds.Length != 0)
						{
							val.Sounds[0] = content;
						}
						else
						{
							TheBnuyMemeCollection.Logger.LogWarning((object)("Could not find " + ((val != null) ? ((Object)val.Source).name : null) + " or its Sounds[]"));
						}
					}
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPostfix]
		private static void Postfix(EnemySlowWalkerAnim __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(ReplaceSound(__instance));
		}

		[IteratorStateMachine(typeof(<ReplaceSound>d__1))]
		private static IEnumerator ReplaceSound(EnemySlowWalkerAnim anim)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReplaceSound>d__1(0)
			{
				anim = anim
			};
		}
	}
	[HarmonyPatch(typeof(ValuableBoombox), "Start")]
	internal class ForceUniqueMaterialPatch
	{
		[HarmonyPostfix]
		private static void Postfix(ValuableBoombox __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			Renderer component = ((Component)__instance.speaker1).GetComponent<Renderer>();
			Renderer component2 = ((Component)__instance.speaker2).GetComponent<Renderer>();
			component.material = new Material(component.material);
			component2.material = new Material(component2.material);
		}
	}
	[HarmonyPatch(typeof(ValuableBoombox), "Update")]
	internal class MuseumBoomboxGreenLightPatch
	{
		private static readonly FieldInfo PhysGrabField = typeof(Trap).GetField("physGrabObject", BindingFlags.Instance | BindingFlags.NonPublic);

		private static readonly Color Green = new Color(0.541f, 0.808f, 0f);

		private static readonly Color White = Color.white;

		private static readonly Color Black = Color.black;

		private static float[] _spectrum = new float[64];

		[HarmonyPostfix]
		private static void Postfix(ValuableBoombox __instance)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			object? obj = PhysGrabField?.GetValue(__instance);
			PhysGrabObject val = (PhysGrabObject)((obj is PhysGrabObject) ? obj : null);
			if (val == null || !val.grabbed)
			{
				return;
			}
			AudioSource source = __instance.soundBoomboxMusic.Source;
			if (!((Object)(object)source == (Object)null) && source.isPlaying)
			{
				source.GetSpectrumData(_spectrum, 0, (FFTWindow)5);
				float num = 0f;
				for (int i = 1; i <= 6; i++)
				{
					num += _spectrum[i];
				}
				num /= 6f;
				float num2 = Mathf.Clamp01(num * 20f);
				Color val2 = ((!(num2 < 0.3f)) ? Color.Lerp(White, Green, (num2 - 0.3f) / 0.7f) : Color.Lerp(Black, White, num2 / 0.3f));
				Material material = ((Component)__instance.speaker1).GetComponent<Renderer>().material;
				Material material2 = ((Component)__instance.speaker2).GetComponent<Renderer>().material;
				material.SetColor("_EmissionColor", val2);
				material2.SetColor("_EmissionColor", val2);
				__instance.light1.color = val2;
				__instance.light2.color = val2;
				__instance.light1.intensity = Mathf.Lerp(__instance.light1.intensity, 4f, Time.deltaTime * 8f);
				__instance.light2.intensity = Mathf.Lerp(__instance.light2.intensity, 4f, Time.deltaTime * 8f);
			}
		}
	}
	[HarmonyPatch(typeof(ValuableBoombox))]
	[HarmonyPatch("Start")]
	internal class MuseumBoomboxIs365PartyGirlPatch
	{
		[CompilerGenerated]
		private sealed class <ReplaceBoomboxClip>d__1 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ValuableBoombox boombox;

			private UnityWebRequest <wwwmedia>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReplaceBoomboxClip>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<wwwmedia>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Invalid comparison between Unknown and I4
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AudioClip");
					string text = Path.Combine(path, "boombox music partygirl.ogg");
					string text2 = text.Replace("\\", "/");
					<wwwmedia>5__2 = UnityWebRequestMultimedia.GetAudioClip("file://" + text2, (AudioType)14);
					<>2__current = <wwwmedia>5__2.SendWebRequest();
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					if ((int)<wwwmedia>5__2.result != 1)
					{
						TheBnuyMemeCollection.Logger.LogError((object)("Failed to load AudioClip: " + <wwwmedia>5__2.error));
						return false;
					}
					AudioClip content = DownloadHandlerAudioClip.GetContent(<wwwmedia>5__2);
					boombox.soundBoomboxMusic.Sounds[0] = content;
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[HarmonyPostfix]
		private static void Postfix(ValuableBoombox __instance)
		{
			((MonoBehaviour)__instance).StartCoroutine(ReplaceBoomboxClip(__instance));
		}

		[IteratorStateMachine(typeof(<ReplaceBoomboxClip>d__1))]
		private static IEnumerator ReplaceBoomboxClip(ValuableBoombox boombox)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReplaceBoomboxClip>d__1(0)
			{
				boombox = boombox
			};
		}
	}
	public class ShopMusicRunner : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <LoadReplacementClip>d__3 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public ShopMusicRunner <>4__this;

			private UnityWebRequest <req>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadReplacementClip>d__3(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				int num = <>1__state;
				if (num == -3 || num == 1)
				{
					try
					{
					}
					finally
					{
						<>m__Finally1();
					}
				}
				<req>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Invalid comparison between Unknown and I4
				bool result;
				try
				{
					int num = <>1__state;
					ShopMusicRunner shopMusicRunner = <>4__this;
					switch (num)
					{
					default:
						result = false;
						break;
					case 0:
					{
						<>1__state = -1;
						string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
						string text = Path.Combine(directoryName, "AudioClip", "shophoopdreams.ogg").Replace("\\", "/");
						<req>5__2 = UnityWebRequestMultimedia.GetAudioClip("file://" + text, (AudioType)14);
						<>1__state = -3;
						<>2__current = <req>5__2.SendWebRequest();
						<>1__state = 1;
						result = true;
						break;
					}
					case 1:
						<>1__state = -3;
						if ((int)<req>5__2.result != 1)
						{
							TheBnuyMemeCollection.Logger.LogError((object)("Failed to load replacement music: " + <req>5__2.error));
							result = false;
						}
						else
						{
							shopMusicRunner.replacementClip = DownloadHandlerAudioClip.GetContent(<req>5__2);
							((Object)shopMusicRunner.replacementClip).name = "shophoopdreams";
							TheBnuyMemeCollection.Logger.LogInfo((object)"Replacement music loaded");
							result = false;
						}
						<>m__Finally1();
						break;
					}
				}
				catch
				{
					//try-fault
					((IDisposable)this).Dispose();
					throw;
				}
				return result;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			private void <>m__Finally1()
			{
				<>1__state = -1;
				if (<req>5__2 != null)
				{
					((IDisposable)<req>5__2).Dispose();
				}
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private bool musicReplaced;

		private AudioClip? replacementClip;

		private void Start()
		{
			TheBnuyMemeCollection.Logger.LogInfo((object)"ShopMusicRunner.Start()");
			((MonoBehaviour)this).StartCoroutine(LoadReplacementClip());
		}

		[IteratorStateMachine(typeof(<LoadReplacementClip>d__3))]
		private IEnumerator LoadReplacementClip()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadReplacementClip>d__3(0)
			{
				<>4__this = this
			};
		}

		private void Update()
		{
			if (musicReplaced || (Object)(object)replacementClip == (Object)null)
			{
				return;
			}
			AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>();
			foreach (AudioSource val in array)
			{
				if ((Object)(object)val.clip != (Object)null && ((Object)val.clip).name.ToLower().Contains("shop"))
				{
					bool isPlaying = val.isPlaying;
					val.clip = replacementClip;
					if (isPlaying)
					{
						val.Play();
					}
					TheBnuyMemeCollection.Logger.LogInfo((object)("Replaced shop music on: " + ((Object)((Component)val).gameObject).name));
					musicReplaced = true;
					break;
				}
			}
		}
	}
}