using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("your_name")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Sample BepInEx plugin template for H3VR!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("audio_balancing")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace plugin
{
[BepInPlugin("Aiyke.Audio_balance", "Audio balancing", "1.0.0")]
[BepInProcess("h3vr.exe")]
public class audio_balance : BaseUnityPlugin
{
public static ConfigEntry<float> vol_master;
public static ConfigEntry<float> vol_shots;
public static ConfigEntry<float> vol_shot_mech;
public static ConfigEntry<float> vol_handling;
public static ConfigEntry<float> vol_amb;
public static ConfigEntry<float> vol_casings;
public static ConfigEntry<float> vol_reverb;
public static ConfigEntry<float> vol_voices;
private static float time_since_shot_fired;
private static bool shot_sound_active;
private static float t0;
private static float t1;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
vol_master = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Master volume", 1.5f, "General volume, affects everything\nWARNING: values above 3 can lead to distortion.");
vol_shots = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Shots", 1f, "Volume of shot sounds.");
vol_shot_mech = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Shot mechanics", 0.5f, "Volume of mechanical sounds immediately following a shot.\nThis is usually the sound of the bolt snapping forward with automatic guns.\nA lower values makes the main shots sound more pronounced while firing.");
vol_handling = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Handling", 1f, "Volume of handling/operation sounds.");
vol_amb = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Ambience", 0.5f, "Volume of ambient sounds.\nSome ambient sounds are inaudibly quiet without this mod, so they have been adjusted a bit.\nReload the scene for changes to take effect.");
vol_casings = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Casings", 1f, "Volume of empty casings.");
vol_reverb = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Reverb", 1f, "Volume of reverb/echo/tails after shots.");
vol_voices = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Voices", 1f, "Volume of enemy voice lines.");
Harmony.CreateAndPatchAll(typeof(audio_balance), (string)null);
Logger.LogMessage((object)"audio_balance is active.");
}
private void Update()
{
Logger = ((BaseUnityPlugin)this).Logger;
time_since_shot_fired += Time.deltaTime;
if (time_since_shot_fired < 0.4f)
{
shot_sound_active = true;
Logger.LogDebug((object)time_since_shot_fired);
}
else
{
shot_sound_active = false;
}
}
[HarmonyPatch(typeof(FVRFireArm), "Awake")]
[HarmonyPostfix]
private static void patch_audio_clip_sets(FVRFireArm __instance)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Unknown result type (might be due to invalid IL or missing references)
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0386: Unknown result type (might be due to invalid IL or missing references)
//IL_038b: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_041a: Unknown result type (might be due to invalid IL or missing references)
//IL_0429: Unknown result type (might be due to invalid IL or missing references)
//IL_042e: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_0473: Unknown result type (might be due to invalid IL or missing references)
//IL_0478: Unknown result type (might be due to invalid IL or missing references)
//IL_0489: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_049d: Unknown result type (might be due to invalid IL or missing references)
//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
Logger.LogDebug((object)("- - - Now editing audio clip sets for " + ((Object)__instance).name + " - - -"));
AudioEvent boltSlideBackHeld = __instance.AudioClipSet.BoltSlideBackHeld;
boltSlideBackHeld.VolumeRange *= vol_handling.Value;
AudioEvent boltSlideBackLocked = __instance.AudioClipSet.BoltSlideBackLocked;
boltSlideBackLocked.VolumeRange *= vol_handling.Value;
AudioEvent boltSlideForward = __instance.AudioClipSet.BoltSlideForward;
boltSlideForward.VolumeRange *= vol_handling.Value;
AudioEvent boltSlideForwardHeld = __instance.AudioClipSet.BoltSlideForwardHeld;
boltSlideForwardHeld.VolumeRange *= vol_handling.Value;
Logger.LogDebug((object)"\t.");
AudioEvent breachOpen = __instance.AudioClipSet.BreachOpen;
breachOpen.VolumeRange *= vol_handling.Value;
AudioEvent breachClose = __instance.AudioClipSet.BreachClose;
breachClose.VolumeRange *= vol_handling.Value;
AudioEvent catchOnSear = __instance.AudioClipSet.CatchOnSear;
catchOnSear.VolumeRange *= vol_handling.Value;
AudioEvent chamberManual = __instance.AudioClipSet.ChamberManual;
chamberManual.VolumeRange *= vol_handling.Value;
AudioEvent fireSelector = __instance.AudioClipSet.FireSelector;
fireSelector.VolumeRange *= vol_handling.Value;
AudioEvent handleBack = __instance.AudioClipSet.HandleBack;
handleBack.VolumeRange *= vol_handling.Value;
AudioEvent handleBackEmpty = __instance.AudioClipSet.HandleBackEmpty;
handleBackEmpty.VolumeRange *= vol_handling.Value;
AudioEvent handleForward = __instance.AudioClipSet.HandleForward;
handleForward.VolumeRange *= vol_handling.Value;
AudioEvent handleForwardEmpty = __instance.AudioClipSet.HandleForwardEmpty;
handleForwardEmpty.VolumeRange *= vol_handling.Value;
AudioEvent handleUp = __instance.AudioClipSet.HandleUp;
handleUp.VolumeRange *= vol_handling.Value;
AudioEvent handleDown = __instance.AudioClipSet.HandleDown;
handleDown.VolumeRange *= vol_handling.Value;
Logger.LogDebug((object)"\t.");
AudioEvent magazineIn = __instance.AudioClipSet.MagazineIn;
magazineIn.VolumeRange *= vol_handling.Value;
AudioEvent magazineOut = __instance.AudioClipSet.MagazineOut;
magazineOut.VolumeRange *= vol_handling.Value;
AudioEvent magazineEjectRound = __instance.AudioClipSet.MagazineEjectRound;
magazineEjectRound.VolumeRange *= vol_handling.Value;
AudioEvent prefire = __instance.AudioClipSet.Prefire;
prefire.VolumeRange *= vol_handling.Value;
AudioEvent safety = __instance.AudioClipSet.Safety;
safety.VolumeRange *= vol_handling.Value;
AudioEvent triggerReset = __instance.AudioClipSet.TriggerReset;
triggerReset.VolumeRange *= vol_handling.Value;
AudioEvent topCoverRelease = __instance.AudioClipSet.TopCoverRelease;
topCoverRelease.VolumeRange *= vol_handling.Value;
AudioEvent topCoverUp = __instance.AudioClipSet.TopCoverUp;
topCoverUp.VolumeRange *= vol_handling.Value;
AudioEvent topCoverDown = __instance.AudioClipSet.TopCoverDown;
topCoverDown.VolumeRange *= vol_handling.Value;
AudioEvent stockOpen = __instance.AudioClipSet.StockOpen;
stockOpen.VolumeRange *= vol_handling.Value;
AudioEvent stockClosed = __instance.AudioClipSet.StockClosed;
stockClosed.VolumeRange *= vol_handling.Value;
Logger.LogDebug((object)"\t.");
AudioEvent bipodOpen = __instance.AudioClipSet.BipodOpen;
bipodOpen.VolumeRange *= vol_handling.Value;
AudioEvent bipodClosed = __instance.AudioClipSet.BipodClosed;
bipodClosed.VolumeRange *= vol_handling.Value;
AudioEvent beltGrab = __instance.AudioClipSet.BeltGrab;
beltGrab.VolumeRange *= vol_handling.Value;
AudioEvent beltRelease = __instance.AudioClipSet.BeltRelease;
beltRelease.VolumeRange *= vol_handling.Value;
AudioEvent beltSeat = __instance.AudioClipSet.BeltSeat;
beltSeat.VolumeRange *= vol_handling.Value;
Logger.LogDebug((object)"\tAudio event patching complete.");
}
[HarmonyPatch(typeof(FVRFireArm), "PlayAudioEvent")]
[HarmonyPrefix]
private static bool PlayAudioEvent_prefix(FVRFireArm __instance, FirearmAudioEventType eType, float pitchmod = 1f)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Invalid comparison between Unknown and I4
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Invalid comparison between Unknown and I4
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Invalid comparison between Unknown and I4
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Expected O, but got Unknown
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_034a: Unknown result type (might be due to invalid IL or missing references)
//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Invalid comparison between Unknown and I4
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_039c: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Invalid comparison between Unknown and I4
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0408: Unknown result type (might be due to invalid IL or missing references)
//IL_0412: Unknown result type (might be due to invalid IL or missing references)
//IL_0421: Unknown result type (might be due to invalid IL or missing references)
//IL_0431: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Invalid comparison between Unknown and I4
//IL_0463: Unknown result type (might be due to invalid IL or missing references)
//IL_046f: Unknown result type (might be due to invalid IL or missing references)
//IL_0479: Unknown result type (might be due to invalid IL or missing references)
//IL_0488: Unknown result type (might be due to invalid IL or missing references)
//IL_0498: Unknown result type (might be due to invalid IL or missing references)
//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
//IL_05a9: Invalid comparison between Unknown and I4
//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
//IL_04e8: Expected O, but got Unknown
//IL_061d: Unknown result type (might be due to invalid IL or missing references)
//IL_0620: Invalid comparison between Unknown and I4
//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
//IL_05ff: Unknown result type (might be due to invalid IL or missing references)
//IL_060f: Unknown result type (might be due to invalid IL or missing references)
//IL_0694: Unknown result type (might be due to invalid IL or missing references)
//IL_0697: Invalid comparison between Unknown and I4
//IL_0642: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_065d: Unknown result type (might be due to invalid IL or missing references)
//IL_0667: Unknown result type (might be due to invalid IL or missing references)
//IL_0676: Unknown result type (might be due to invalid IL or missing references)
//IL_0686: Unknown result type (might be due to invalid IL or missing references)
//IL_070b: Unknown result type (might be due to invalid IL or missing references)
//IL_070e: Invalid comparison between Unknown and I4
//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
//IL_06de: Unknown result type (might be due to invalid IL or missing references)
//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0730: Unknown result type (might be due to invalid IL or missing references)
//IL_073c: Unknown result type (might be due to invalid IL or missing references)
//IL_0746: Unknown result type (might be due to invalid IL or missing references)
//IL_0755: Unknown result type (might be due to invalid IL or missing references)
//IL_0765: Unknown result type (might be due to invalid IL or missing references)
Logger.LogDebug((object)(Time.unscaledTime + ": FVRFireArm.PlayAudioEvent"));
Vector3 position = ((Component)__instance).transform.position;
GM.CurrentPlayerBody.GetPlayerIFF();
if ((int)eType == 100)
{
Logger.LogDebug((object)"\t < < Shot > >");
AudioSource val = (AudioSource)new GameObject("One shot audio").AddComponent(typeof(AudioSource));
((Component)val).transform.position = __instance.GetMuzzle().position;
val.clip = __instance.AudioClipSet.Shots_Main.Clips[Random.Range(0, __instance.AudioClipSet.Shots_Main.Clips.Count)];
val.spatialBlend = 0.6f;
val.volume = (__instance.AudioClipSet.Shots_Main.VolumeRange.y + 0.1f) * vol_shots.Value;
val.pitch = Random.Range((__instance.AudioClipSet.Shots_Main.PitchRange.x + __instance.AudioClipSet.Shots_Main.PitchRange.x + __instance.AudioClipSet.Shots_Main.PitchRange.y) / 3f, (__instance.AudioClipSet.Shots_Main.PitchRange.y + __instance.AudioClipSet.Shots_Main.PitchRange.y + __instance.AudioClipSet.Shots_Main.PitchRange.x) / 3f) * pitchmod;
val.Play();
Object.Destroy((Object)(object)val, val.clip.length);
shot_sound_active = true;
time_since_shot_fired = 0f;
return false;
}
if ((int)eType == 101)
{
Logger.LogDebug((object)"\t < < Supressed shot > >");
AudioSource val2 = (AudioSource)new GameObject("One shot audio").AddComponent(typeof(AudioSource));
((Component)val2).transform.position = __instance.GetMuzzle().position;
val2.clip = __instance.AudioClipSet.Shots_Suppressed.Clips[Random.Range(0, __instance.AudioClipSet.Shots_Suppressed.Clips.Count)];
val2.spatialBlend = 0.6f;
val2.volume = __instance.AudioClipSet.Shots_Suppressed.VolumeRange.y * vol_shots.Value;
val2.pitch = Random.Range((__instance.AudioClipSet.Shots_Suppressed.PitchRange.x + __instance.AudioClipSet.Shots_Suppressed.PitchRange.x + __instance.AudioClipSet.Shots_Suppressed.PitchRange.y) / 3f, (__instance.AudioClipSet.Shots_Suppressed.PitchRange.y + __instance.AudioClipSet.Shots_Suppressed.PitchRange.y + __instance.AudioClipSet.Shots_Suppressed.PitchRange.x) / 3f) * pitchmod;
val2.Play();
Object.Destroy((Object)(object)val2, val2.clip.length);
shot_sound_active = true;
time_since_shot_fired = 0f;
return false;
}
if ((int)eType == 8)
{
Logger.LogDebug((object)"\t < BoltRelease; skipping. >");
return false;
}
if (!shot_sound_active)
{
return true;
}
if ((int)eType == 0)
{
Logger.LogDebug((object)"\t < BoltSlideForward >");
__instance.m_pool_mechanics.PlayClipVolumePitchOverride(__instance.AudioClipSet.BoltSlideForward, position, __instance.AudioClipSet.BoltSlideForward.VolumeRange / vol_handling.Value * Random.Range(0.9f, 1.1f) * vol_shot_mech.Value, __instance.AudioClipSet.BoltSlideForward.PitchRange, (AudioMixerGroup)null);
return false;
}
if ((int)eType == 1)
{
Logger.LogDebug((object)"\t < BoltSlideBack >");
__instance.m_pool_mechanics.PlayClipVolumePitchOverride(__instance.AudioClipSet.BoltSlideBack, position, __instance.AudioClipSet.BoltSlideBack.VolumeRange / vol_handling.Value * 0.8f * vol_shot_mech.Value, __instance.AudioClipSet.BoltSlideBack.PitchRange, (AudioMixerGroup)null);
return false;
}
if ((int)eType == 5)
{
Logger.LogDebug((object)"\t < CatchOnSear >");
__instance.m_pool_mechanics.PlayClipVolumePitchOverride(__instance.AudioClipSet.CatchOnSear, position, __instance.AudioClipSet.CatchOnSear.VolumeRange * 0.8f * vol_shot_mech.Value, __instance.AudioClipSet.CatchOnSear.PitchRange, (AudioMixerGroup)null);
return false;
}
if ((int)eType == 6)
{
Logger.LogDebug((object)"\t < HammerHit >");
GameObject val3 = new GameObject("One shot audio");
val3.transform.position = position;
AudioSource val4 = (AudioSource)val3.AddComponent(typeof(AudioSource));
val4.clip = __instance.AudioClipSet.HammerHit.Clips[Random.Range(0, __instance.AudioClipSet.HammerHit.Clips.Count)];
val4.spatialBlend = 0.5f;
val4.volume = 0.7f * ((vol_shots.Value + vol_handling.Value) / 2f);
val4.pitch = (__instance.AudioClipSet.HammerHit.PitchRange.x + __instance.AudioClipSet.HammerHit.PitchRange.y) / 2f;
val4.Play();
Object.Destroy((Object)(object)val4, val4.clip.length);
return false;
}
if ((int)eType == 7)
{
Logger.LogDebug((object)"\t < Prefire >");
__instance.m_pool_mechanics.PlayClipVolumePitchOverride(__instance.AudioClipSet.Prefire, position, __instance.AudioClipSet.Prefire.VolumeRange / vol_handling.Value * 0.8f * vol_shot_mech.Value, __instance.AudioClipSet.Prefire.PitchRange, (AudioMixerGroup)null);
return false;
}
if ((int)eType == 16)
{
Logger.LogDebug((object)"\t < TriggerReset >");
__instance.m_pool_handling.PlayClipVolumePitchOverride(__instance.AudioClipSet.TriggerReset, position, __instance.AudioClipSet.TriggerReset.VolumeRange / vol_handling.Value * 0.7f * vol_shot_mech.Value, __instance.AudioClipSet.TriggerReset.PitchRange, (AudioMixerGroup)null);
return false;
}
if ((int)eType == 29)
{
Logger.LogDebug((object)"\t < MagazineEjectRound >");
__instance.m_pool_handling.PlayClipVolumePitchOverride(__instance.AudioClipSet.MagazineEjectRound, position, __instance.AudioClipSet.MagazineEjectRound.VolumeRange / vol_handling.Value * 0.6f * vol_shot_mech.Value, __instance.AudioClipSet.MagazineEjectRound.PitchRange, (AudioMixerGroup)null);
return false;
}
if ((int)eType == 53)
{
Logger.LogDebug((object)"\t < BeltSettle >");
__instance.m_pool_handling.PlayClipVolumePitchOverride(__instance.AudioClipSet.BeltSettle, position, __instance.AudioClipSet.BeltSettle.VolumeRange * 0.9f * vol_shot_mech.Value, __instance.AudioClipSet.BeltSettle.PitchRange, (AudioMixerGroup)null);
return false;
}
return true;
}
[HarmonyPatch(typeof(FVRPlayerBody), "Update")]
[HarmonyPostfix]
private static void UpdateFVRPlayerBody_postix(FVRPlayerBody __instance)
{
AudioListener.volume *= vol_master.Value;
}
[HarmonyPatch(typeof(FVRAmbienceController), "Start")]
[HarmonyPostfix]
private static void FVRAmbienceControllerStart_postix(FVRAmbienceController __instance)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_033b: Unknown result type (might be due to invalid IL or missing references)
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0358: Unknown result type (might be due to invalid IL or missing references)
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0379: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "TakeAndHoldClassic")
{
for (int i = 0; i < __instance.AmbienceClips.Capacity; i++)
{
if (((Object)__instance.AmbienceClips[i]).name == "Level_TakeAndHold_MainHalls")
{
GameObject val = new GameObject("One shot audio");
val.transform.position = Vector3.zero;
AudioSource val2 = (AudioSource)val.AddComponent(typeof(AudioSource));
val2.clip = __instance.AmbienceClips[i];
val2.spatialBlend = 0f;
val2.volume = 1f * vol_amb.Value;
val2.pitch = 1f;
val2.loop = true;
val2.Play();
GameObject val3 = new GameObject("One shot audio");
val3.transform.position = Vector3.zero;
AudioSource val4 = (AudioSource)val3.AddComponent(typeof(AudioSource));
val4.clip = __instance.AmbienceClips[i];
val4.spatialBlend = 0f;
val4.volume = 0.8f * vol_amb.Value;
val4.pitch = 0.75f;
val4.loop = true;
val4.Play();
}
}
}
if (((Scene)(ref activeScene)).name == "TakeAndHold_WinterWasteland")
{
for (int j = 0; j < __instance.AmbienceClips.Capacity; j++)
{
if (((Object)__instance.AmbienceClips[j]).name == "Level_WurstWorld_Open")
{
GameObject val5 = new GameObject("One shot audio");
val5.transform.position = Vector3.zero;
AudioSource val6 = (AudioSource)val5.AddComponent(typeof(AudioSource));
val6.clip = __instance.AmbienceClips[j];
val6.spatialBlend = 0f;
val6.volume = 0.9f * vol_amb.Value;
val6.pitch = 1f;
val6.loop = true;
val6.Play();
GameObject val7 = new GameObject("One shot audio");
val7.transform.position = Vector3.zero;
AudioSource val8 = (AudioSource)val7.AddComponent(typeof(AudioSource));
val8.clip = __instance.AmbienceClips[j];
val8.spatialBlend = 0f;
val8.volume = 0.8f * vol_amb.Value;
val8.pitch = 0.6f;
val8.loop = true;
val8.Play();
}
if (((Object)__instance.AmbienceClips[j]).name == "Level_WurstWorld_Enclosed")
{
GameObject val9 = new GameObject("One shot audio");
val9.transform.position = Vector3.zero;
AudioSource val10 = (AudioSource)val9.AddComponent(typeof(AudioSource));
val10.clip = __instance.AmbienceClips[j];
val10.spatialBlend = 0f;
val10.volume = 1f * vol_amb.Value;
val10.pitch = 1f;
val10.loop = true;
val10.Play();
GameObject val11 = new GameObject("One shot audio");
val11.transform.position = Vector3.zero;
AudioSource val12 = (AudioSource)val11.AddComponent(typeof(AudioSource));
val12.clip = __instance.AmbienceClips[j];
val12.spatialBlend = 0f;
val12.volume = 0.9f * vol_amb.Value;
val12.pitch = 0.7f;
val12.loop = true;
val12.Play();
}
if (((Object)__instance.AmbienceClips[j]).name == "rotw_Wind_Heavy_Loop_05")
{
__instance.AmbienceVolumes[j] *= 0.5f;
}
}
}
__instance.MaxVolume = 1f * vol_amb.Value;
}
[HarmonyPatch(typeof(FVRPlayerBody), "Start")]
[HarmonyPostfix]
private static void FVRPlayerBodyStart_postix(FVRPlayerBody __instance)
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
AudioClip clip = null;
AudioSource[] array = Object.FindObjectsOfType<AudioSource>();
for (int i = 0; i < array.Length; i++)
{
if ((Object)(object)array[i].clip != (Object)null && ((Object)array[i]).name == "_AmbientAudio")
{
clip = array[i].clip;
}
}
for (int j = 1; j < 3; j++)
{
GameObject val = new GameObject("One shot audio");
val.transform.position = ((Component)GM.CurrentPlayerBody.FilteredHead).transform.position;
AudioSource val2 = (AudioSource)val.AddComponent(typeof(AudioSource));
val2.clip = clip;
val2.spatialBlend = 0f;
val2.volume = 1f * vol_amb.Value;
val2.pitch = 1f;
val2.loop = true;
val2.Play();
}
GameObject val3 = new GameObject("One shot audio");
val3.transform.position = ((Component)GM.CurrentPlayerBody.FilteredHead).transform.position;
AudioSource val4 = (AudioSource)val3.AddComponent(typeof(AudioSource));
val4.clip = clip;
val4.spatialBlend = 0f;
val4.volume = 0.8f * vol_amb.Value;
val4.pitch = 0.8f;
val4.loop = true;
val4.Play();
GameObject val5 = new GameObject("One shot audio");
val5.transform.position = ((Component)GM.CurrentPlayerBody.FilteredHead).transform.position;
AudioSource val6 = (AudioSource)val5.AddComponent(typeof(AudioSource));
val6.clip = clip;
val6.spatialBlend = 0f;
val6.volume = 0.6f * vol_amb.Value;
val6.pitch = 0.6f;
val6.loop = true;
val6.Play();
}
[HarmonyPatch(typeof(FVRPooledAudioSource), "Play")]
[HarmonyPostfix]
private static void FVRPooledAudioSource_Play_postfix(FVRPooledAudioSource __instance)
{
if (((Object)__instance).name == "PooledSource_Casings" || ((Object)__instance).name == "PooledSource_Casings(Clone)")
{
AudioSource source = __instance.Source;
source.volume *= vol_casings.Value;
}
if (((Object)__instance).name == "PooledSource_NPCBarks" || ((Object)__instance).name == "PooledSource_NPCBarks(Clone)")
{
AudioSource source2 = __instance.Source;
source2.volume *= vol_voices.Value;
}
if (((Object)__instance).name == "PooledSource_GunTail" || ((Object)__instance).name == "PooledSource_GunTail(Clone)")
{
AudioSource source3 = __instance.Source;
source3.volume *= vol_reverb.Value;
}
}
}
}