using System;
using System.Collections.Generic;
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 HarmonyLib;
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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Template description")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 RemoveTinnitus
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "RemoveTinnitus";
public const string PLUGIN_NAME = "Template description";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ModNamespace
{
internal class Patches
{
[HarmonyPatch(typeof(ConsoleScript))]
internal static class ConsolePatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPatch()
{
ConsoleScript.instance.LogToConsole("Hello World!");
}
}
}
[BepInPlugin("com.mayzmae.removetinnitus", "RemoveTinnitus", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "com.mayzmae.removetinnitus";
public const string ModName = "RemoveTinnitus";
public const string ModVersion = "1.0.1";
internal static ManualLogSource Logger;
private readonly Harmony _harmony = new Harmony("com.mayzmae.removetinnitus");
public static Plugin Instance { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
_harmony.PatchAll(typeof(Patches));
_harmony.PatchAll(typeof(TinnitusPatch));
Logger.LogInfo((object)"Plugin RemoveTinnitus is loaded!");
}
private void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Instance = null;
}
}
internal class TinnitusPatch
{
private static readonly HashSet<string> noisesT0 = new HashSet<string> { "sonarmegaouchfixed", "sonarmegaouch", "sonarouch", "explosion", "cuteye" };
private static readonly HashSet<string> noisesT1 = new HashSet<string> { "shotgunshot", "gunrifleshot", "pistolshot", "rifleshot" };
[HarmonyPatch(typeof(Sound), "Play", new Type[]
{
typeof(AudioClip),
typeof(Vector2),
typeof(bool),
typeof(bool),
typeof(Transform),
typeof(float),
typeof(float),
typeof(bool),
typeof(bool)
})]
[HarmonyPrefix]
private static void SoundPlayPrefix(AudioClip clip, [HarmonyArgument(5)] ref float volume, [HarmonyArgument(6)] ref float pitch)
{
if (!((Object)(object)clip == (Object)null))
{
ApplyPatch(((Object)clip).name, ref volume, ref pitch);
}
}
public static void ApplyPatch(string soundID, ref float volume, ref float pitch)
{
if (soundID == "tinnitus")
{
volume = 0f;
}
else if (noisesT0.Contains(soundID))
{
volume *= 0.8f;
}
else if (noisesT1.Contains(soundID))
{
volume *= 0.9f;
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}