Decompiled source of NoMoreAudioFilters v1.0.8

BepInEx/plugins/welniany/NoMoreAudioFiltersMod.dll

Decompiled 2 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 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("NoMoreAudioFiltersMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("NoMoreAudioFiltersMod")]
[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 NoMoreAudioFiltersMod
{
	[BepInPlugin("org.bepinex.plugins.welniany.nomoreaudiofilters", "NoMoreAudioFiltersMod", "1.0.0.0")]
	[BepInProcess("PEAK.exe")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		private void Awake()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin loaded!");
			GameObject val = new GameObject("NoAudioFilters-YT:@Welnianyy");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.AddComponent<RemoveAudioFiltersComponent>();
		}
	}
	public class NoMoreAudioFiltersTag : MonoBehaviour
	{
	}
	public class RemoveAudioFiltersComponent : MonoBehaviour
	{
		private float interval = 5f;

		private float timer = 0f;

		private void Loopuj_Postaci()
		{
			foreach (Character allCharacter in Character.AllCharacters)
			{
				Transform root = ((Component)allCharacter.refs.helperObjects).transform.GetRoot();
				if (root.childCount >= 3)
				{
					Transform child = root.GetChild(2);
					AudioSource componentInChildren = ((Component)child).GetComponentInChildren<AudioSource>();
					if (!((Object)(object)componentInChildren == (Object)null) && !((Object)(object)((Component)componentInChildren).GetComponent<NoMoreAudioFiltersTag>() != (Object)null) && !(componentInChildren.maxDistance <= 300f))
					{
						componentInChildren.bypassEffects = true;
						componentInChildren.bypassReverbZones = true;
						componentInChildren.bypassListenerEffects = true;
						componentInChildren.maxDistance = 300f;
						componentInChildren.minDistance = 30f;
						componentInChildren.dopplerLevel = 0f;
						componentInChildren.reverbZoneMix = 0f;
						componentInChildren.spread = 0f;
						componentInChildren.rolloffMode = (AudioRolloffMode)1;
						Plugin.Logger.LogInfo((object)("Znaleziony obiekt + ustawiony: " + ((Object)((Component)componentInChildren).gameObject.transform.parent).name + " - " + ((Object)((Component)componentInChildren).gameObject).name));
						RemoveFilters(componentInChildren);
						((Component)componentInChildren).gameObject.AddComponent<NoMoreAudioFiltersTag>();
					}
				}
			}
		}

		private void Update()
		{
			timer += Time.deltaTime;
			if (timer >= interval)
			{
				timer = 0f;
				Loopuj_Postaci();
			}
		}

		private void RemoveFilters(AudioSource src)
		{
			Behaviour[] components = ((Component)src).GetComponents<Behaviour>();
			foreach (Behaviour val in components)
			{
				if ((val is AudioReverbFilter || val is AudioEchoFilter || val is AudioDistortionFilter || val is AudioLowPassFilter || val is AudioHighPassFilter || val is AudioChorusFilter) && val.enabled)
				{
					val.enabled = false;
					Plugin.Logger.LogInfo((object)("Wyłączono filtr " + ((object)val).GetType().Name + " z " + ((Object)((Component)src).gameObject).name));
				}
			}
			src.bypassEffects = true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "NoMoreAudioFiltersMod";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}