using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Hear everyone")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Hear everyone")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ac46f136-a2ab-428e-96da-a9e14e65288d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
public static class HearAllConfig
{
private static ConfigEntry<float> soundVolume;
public static void InitConfig(ConfigFile configFile)
{
soundVolume = configFile.Bind<float>("Settings", "Adjust Global Voice Audio", 1f, "This changes the volume of all inbound players. A setting if 1.0 will be full, normal volume, and 0 being completely deafned.");
}
public static float GetsoundVolumeConfig()
{
return soundVolume.Value;
}
}
namespace LethalMenu.Cheats
{
[HarmonyPatch(typeof(StartOfRound), "UpdatePlayerVoiceEffects")]
internal class HearEveryone : HarmonyPatch
{
public static void Postfix(StartOfRound __instance)
{
if (StartOfRound.Instance.shipIsLeaving)
{
return;
}
for (int i = 0; i < __instance.allPlayerScripts.Length; i++)
{
PlayerControllerB val = __instance.allPlayerScripts[i];
if ((Object)(object)val != (Object)null && (Object)(object)val.currentVoiceChatAudioSource != (Object)null)
{
AudioSource currentVoiceChatAudioSource = val.currentVoiceChatAudioSource;
AudioLowPassFilter component = ((Component)currentVoiceChatAudioSource).GetComponent<AudioLowPassFilter>();
AudioHighPassFilter component2 = ((Component)currentVoiceChatAudioSource).GetComponent<AudioHighPassFilter>();
if ((Object)(object)component != (Object)null)
{
((Behaviour)component).enabled = false;
}
if ((Object)(object)component2 != (Object)null)
{
((Behaviour)component2).enabled = false;
}
float volume = HearAllConfig.GetsoundVolumeConfig();
currentVoiceChatAudioSource.panStereo = 0f;
SoundManager.Instance.playerVoicePitchTargets[(int)(IntPtr)(long)val.playerClientId] = 1f;
SoundManager.Instance.SetPlayerPitch(1f, (int)val.playerClientId);
currentVoiceChatAudioSource.spatialBlend = 0f;
val.currentVoiceChatIngameSettings.set2D = true;
val.voicePlayerState.Volume = volume;
}
}
}
}
}
namespace HearEveryone
{
[BepInPlugin("Project_BlueFlame.HearEveryone", "HearEveryone", "1.0.0")]
public class HearEveryone : BaseUnityPlugin
{
private const string modGUID = "Project_BlueFlame.HearEveryone";
private const string modName = "HearEveryone";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Project_BlueFlame.HearEveryone");
private static HearEveryone Instance;
internal static ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
HearAllConfig.InitConfig(((BaseUnityPlugin)this).Config);
mls = Logger.CreateLogSource("Project_BlueFlame.HearEveryone");
harmony.PatchAll();
}
}
}