Decompiled source of SoundConfig v1.0.3

SoundConfig.dll

Decompiled 7 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SoundConfig")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0fda41b74e25ebe9f84fa82e81b87231abeed0d0")]
[assembly: AssemblyProduct("SoundConfig")]
[assembly: AssemblyTitle("SoundConfig")]
[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 SoundConfig
{
	[BepInPlugin("SoundConfig", "SoundConfig", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch]
		internal class Patches
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(SprayPaintItem), "Start")]
			public static void Start(SprayPaintItem __instance, ref AudioSource ___sprayAudio)
			{
				___sprayAudio.volume = _sprayVolume.Value;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(BoomboxItem), "Start")]
			public static void Start(BoomboxItem __instance, ref AudioSource ___boomboxAudio)
			{
				___boomboxAudio.volume = _boomboxVolume.Value;
			}
		}

		private bool _initialized;

		private static ConfigEntry<float> _boomboxVolume;

		private static ConfigEntry<float> _sprayVolume;

		private void Awake()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource val = Logger.CreateLogSource("SoundConfig");
			val.LogInfo((object)"Loading SoundConfig");
			_boomboxVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "BoomboxVolume", 0.3f, "Default boombox volume. (0-1.0)");
			_sprayVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SprayVolume", 0.3f, "Default volume of spray paint sound effects. (0-1.0)");
			new Harmony("SoundConfig").PatchAll();
		}

		private void Init()
		{
			if (!_initialized)
			{
				_initialized = true;
				ModdedServer.SetServerModdedOnly();
			}
		}

		public void Start()
		{
			Init();
		}

		public void OnDestroy()
		{
			Init();
		}
	}
	public static class ScPluginInfo
	{
		public const string PLUGIN_GUID = "SoundConfig";

		public const string PLUGIN_NAME = "SoundConfig";

		public const string PLUGIN_VERSION = "1.0.0";
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SoundConfig";

		public const string PLUGIN_NAME = "SoundConfig";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}