Decompiled source of ChainHangLow v1.0.2

ChainHangLow.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using ChainHangLow.ChainHangLow.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ChainHangLow")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Replaces Item Drop Ship Sound with Chain Hang Low by Jibbs")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+43206f0475d7dae18e393eaa115cfd192399712f")]
[assembly: AssemblyProduct("ChainHangLow")]
[assembly: AssemblyTitle("ChainHangLow")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ChainHangLow
{
	[BepInPlugin("kidkool.ChainHangLow", "Replace Dropship with Chain Hang Low", "1.0.2")]
	public class ChainHangLowBase : BaseUnityPlugin
	{
		private const string modGUID = "ChainHangLow";

		private const string modName = "ChainHangLow";

		private const string modVersion = "1.0.2";

		private readonly Harmony harmony = new Harmony("ChainHangLow");

		private static ChainHangLowBase Instance;

		internal ManualLogSource mls;

		public static AudioClip newAudio;

		public static AudioClip newAudio1;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("ChainHangLow");
			mls.LogInfo((object)"ChainHangLow is loading.");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "ChainHangLow.dll";
			AssetBundle val = AssetBundle.LoadFromFile(location.TrimEnd(text.ToCharArray()) + "chainhanglow");
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load audio assets!");
				return;
			}
			newAudio = val.LoadAsset<AudioClip>("assets/ChainHangLow/ChainHangLow.ogg");
			newAudio1 = val.LoadAsset<AudioClip>("assets/ChainHangLow/ChainHangLowReverb.ogg");
			harmony.PatchAll(typeof(SoundPatch));
			mls.LogInfo((object)"ChainHangLow is loaded. Is it platinum or is it gold?");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ChainHangLow";

		public const string PLUGIN_NAME = "ChainHangLow";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ChainHangLow.ChainHangLow.Patches
{
	[HarmonyPatch(typeof(ItemDropship))]
	internal class SoundPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ChainHangLowPatch(ItemDropship __instance)
		{
			AudioClip newAudio = ChainHangLowBase.newAudio;
			AudioClip newAudio2 = ChainHangLowBase.newAudio1;
			AudioSource component = ((Component)((Component)__instance).transform.Find("Music")).gameObject.GetComponent<AudioSource>();
			AudioSource component2 = ((Component)((Component)((Component)__instance).transform.Find("Music")).transform.Find("Music (1)")).gameObject.GetComponent<AudioSource>();
			component.clip = newAudio;
			component2.clip = newAudio2;
		}
	}
}