Decompiled source of NoBlacksmithSounds v1.0.0

plugins/NoBlacksmithSounds.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("NoBlacksmithSounds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoBlacksmithSounds")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoBlacksmithSounds;

[BepInPlugin("zenethian.noblacksmithsounds", "No Blacksmith Hammer Sounds", "1.0.0")]
public class NoBlacksmithSounds : BaseUnityPlugin
{
	public const string GUID = "zenethian.noblacksmithsounds";

	public const string NAME = "No Blacksmith Hammer Sounds";

	public const string VERSION = "1.0.0";

	internal static ManualLogSource Log;

	public static ConfigEntry<bool> ExampleConfig;

	public static NoBlacksmithSounds Instance { get; private set; }

	internal void Awake()
	{
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		SceneManager.sceneLoaded += SceneManager_sceneLoaded;
	}

	internal void SceneManager_sceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		((MonoBehaviour)Instance).StartCoroutine(DelayMethod(scene));
	}

	private IEnumerator DelayMethod(Scene scene)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		yield return (object)new WaitForSeconds(5f);
		FixHammerSounds(scene);
	}

	private void FixHammerSounds(Scene scene)
	{
		if (!(((Scene)(ref scene)).name == "LowMemory_TransitionScene") && !(((Scene)(ref scene)).name == "MainMenu_Empty"))
		{
			GameObject val = GameObject.Find("HumanSNPC_Blacksmith");
			if ((Object)(object)val != (Object)null)
			{
				Log.LogMessage((object)("De-hammering " + ((Object)val).name + " in scene " + ((Scene)(ref scene)).name));
				AnimEventPlaySound component = val.GetComponent<AnimEventPlaySound>();
				component.Sounds = Array.Empty<Sounds>();
			}
			else
			{
				Log.LogMessage((object)("Nobody to de-hammer in scene " + ((Scene)(ref scene)).name));
			}
		}
	}
}