Decompiled source of Huntsman Museum Update Beta Humming v1.0.0

plugins/HuntsmanMuseumUpdateBetaHumming.dll

Decompiled 3 weeks ago
using System;
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 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("zyxterus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025 zyxterus")]
[assembly: AssemblyDescription("Changes the Huntsman's humming to the beta version of the Museum Update.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+edbcdaf973845e802f5ff6e1e8da44648444b4a7")]
[assembly: AssemblyProduct("HuntsmanMuseumUpdateBetaHumming")]
[assembly: AssemblyTitle("HuntsmanMuseumUpdateBetaHumming")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/zyxterus/HuntsmanMuseumUpdateBetaHumming")]
[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.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 HuntsmanMuseumUpdateBetaHumming
{
	[HarmonyPatch(typeof(EnemyHunterAnim))]
	internal static class EnemyHunterAnimPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("Awake")]
		private static void Awake_Postfix(EnemyHunterAnim __instance)
		{
			__instance.soundHumming.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.Instance.HummingAudioClip };
			Logger.LogDebug("Patched EnemyHunterAnim to use custom humming audio clip.");
		}
	}
	internal static class Logger
	{
		public static ManualLogSource ManualLogSource { get; private set; }

		public static void Initialize(ManualLogSource manualLogSource)
		{
			ManualLogSource = manualLogSource;
		}

		public static void LogDebug(object data)
		{
			Log((LogLevel)32, data);
		}

		public static void LogInfo(object data)
		{
			Log((LogLevel)16, data);
		}

		public static void LogMessage(object data)
		{
			Log((LogLevel)8, data);
		}

		public static void LogWarning(object data)
		{
			Log((LogLevel)4, data);
		}

		public static void LogError(object data)
		{
			Log((LogLevel)2, data);
		}

		public static void LogFatal(object data)
		{
			Log((LogLevel)1, data);
		}

		public static void Log(LogLevel logLevel, object data)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource manualLogSource = ManualLogSource;
			if (manualLogSource != null)
			{
				manualLogSource.Log(logLevel, data);
			}
		}
	}
	[BepInPlugin("HuntsmanMuseumUpdateBetaHumming", "HuntsmanMuseumUpdateBetaHumming", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance { get; private set; }

		internal static string PluginFolder => Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location);

		internal Harmony? Harmony { get; set; }

		internal AudioClip HummingAudioClip { get; set; }

		private void Awake()
		{
			Instance = this;
			Logger.Initialize(Logger.CreateLogSource("HuntsmanMuseumUpdateBetaHumming"));
			string text = Path.Combine(PluginFolder, "huntsman_museum_update_beta_humming");
			Logger.LogDebug("Loading AssetBundle from: " + text);
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Logger.LogDebug("Loading HummingClip from AssetBundle");
			HummingAudioClip = val.LoadAsset<AudioClip>("enemy hunter humming loop.ogg");
			Logger.LogDebug("Applying Harmony patches");
			HarmonyPatch();
			Logger.LogInfo("HuntsmanMuseumUpdateBetaHumming has awoken!");
		}

		internal void HarmonyPatch()
		{
			//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();
		}

		internal void HarmonyUnpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "HuntsmanMuseumUpdateBetaHumming";

		public const string PLUGIN_NAME = "HuntsmanMuseumUpdateBetaHumming";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	[DebuggerNonUserCode]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
}