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 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("HuntsMan_LouderFootSteps")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HuntsMan_LouderFootSteps")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e8e23e75-2b4c-46b1-8bea-aa4a4a871eb2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LouderHunterFootsteps;
[HarmonyPatch(typeof(EnemyHunterAnim))]
internal static class HunterFootstepPatches
{
private static bool PlayModifiedFootstep(Sound footstepSound, Vector3 position, string logName)
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
if (footstepSound == null)
{
return false;
}
float volume = footstepSound.Volume;
float falloffMultiplier = footstepSound.FalloffMultiplier;
float reverbMix = footstepSound.ReverbMix;
try
{
footstepSound.Volume = volume * Plugin.FootstepVolumeMultiplier.Value;
footstepSound.Volume = Mathf.Clamp(footstepSound.Volume, 0f, 5f);
footstepSound.FalloffMultiplier = falloffMultiplier * Plugin.FootstepFalloffMultiplier.Value;
if (Plugin.EnableFootstepEcho.Value)
{
footstepSound.ReverbMix = Plugin.FootstepEchoMix.Value;
Plugin.LogDebug($"Playing {logName} with Vol: {footstepSound.Volume:F2}, FalloffMult: {footstepSound.FalloffMultiplier:F2}, ReverbMix: {footstepSound.ReverbMix:F2}");
}
else
{
footstepSound.ReverbMix = reverbMix;
Plugin.LogDebug($"Playing {logName} with Vol: {footstepSound.Volume:F2}, FalloffMult: {footstepSound.FalloffMultiplier:F2}, ReverbMix: OFF (Original: {reverbMix:F2})");
}
footstepSound.Play(position, 1f, 1f, 1f, 1f);
return true;
}
catch (Exception arg)
{
Plugin.LogError($"Error playing modified footstep {logName}: {arg}");
return false;
}
finally
{
if (footstepSound != null)
{
footstepSound.Volume = volume;
footstepSound.FalloffMultiplier = falloffMultiplier;
footstepSound.ReverbMix = reverbMix;
}
}
}
[HarmonyPatch("FootstepShort")]
[HarmonyPrefix]
private static bool FootstepShort_Prefix(EnemyHunterAnim __instance)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.enemy?.CenterTransform != (Object)null)
{
if (PlayModifiedFootstep(__instance.soundFootstepShort, __instance.enemy.CenterTransform.position, "FootstepShort"))
{
return false;
}
}
else
{
Plugin.LogError("FootstepShort_Prefix: Could not find required transforms!");
}
return true;
}
[HarmonyPatch("FootstepLong")]
[HarmonyPrefix]
private static bool FootstepLong_Prefix(EnemyHunterAnim __instance)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.enemy?.CenterTransform != (Object)null)
{
if (PlayModifiedFootstep(__instance.soundFootstepLong, __instance.enemy.CenterTransform.position, "FootstepLong"))
{
return false;
}
}
else
{
Plugin.LogError("FootstepLong_Prefix: Could not find required transforms!");
}
return true;
}
}
[BepInPlugin("com.plusblankplus.louderhunterfootsteps", "Louder Hunter Footsteps", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("com.plusblankplus.louderhunterfootsteps");
public static Plugin Instance { get; private set; }
internal static ManualLogSource Log { get; private set; }
public static ConfigEntry<float> FootstepVolumeMultiplier { get; private set; }
public static ConfigEntry<float> FootstepFalloffMultiplier { get; private set; }
public static ConfigEntry<bool> EnableFootstepEcho { get; private set; }
public static ConfigEntry<float> FootstepEchoMix { get; private set; }
private void Awake()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Loading configuration...");
FootstepVolumeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "FootstepVolumeMultiplier", 1f, new ConfigDescription("Multiplier for Hunter footstep base volume. 1.0 = normal, >1.0 louder, <1.0 quieter.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>()));
FootstepFalloffMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "FootstepFalloffMultiplier", 1f, new ConfigDescription("Multiplier for Hunter footstep sound falloff distance. >1.0 increases range, <1.0 decreases range. Affects min/max distance of the sound type.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 5f), Array.Empty<object>()));
EnableFootstepEcho = ((BaseUnityPlugin)this).Config.Bind<bool>("Echo", "EnableFootstepEcho", false, "Enable an echo/reverb effect on footsteps. Requires Audio Reverb Zones in the level to work.");
FootstepEchoMix = ((BaseUnityPlugin)this).Config.Bind<float>("Echo", "FootstepEchoMix", 0.5f, new ConfigDescription("How much the footstep sound interacts with level reverb zones (0.0 = none, 1.0 = full). Only effective if EnableFootstepEcho is true and reverb zones exist.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
Log.LogInfo((object)$"Hunter Footstep Volume Multiplier set to: {FootstepVolumeMultiplier.Value}");
Log.LogInfo((object)$"Hunter Footstep Falloff Multiplier set to: {FootstepFalloffMultiplier.Value}");
Log.LogInfo((object)$"Hunter Footstep Echo Enabled: {EnableFootstepEcho.Value}, Mix: {FootstepEchoMix.Value}");
Log.LogInfo((object)"Applying Harmony patches for Louder Hunter Footsteps...");
harmony.PatchAll(typeof(HunterFootstepPatches));
Log.LogInfo((object)"Harmony patches applied successfully!");
Log.LogInfo((object)"Plugin com.plusblankplus.louderhunterfootsteps v1.0.0 is loaded!");
}
else
{
Object.Destroy((Object)(object)this);
}
}
internal static void LogDebug(string msg)
{
ManualLogSource log = Log;
if (log != null)
{
log.LogDebug((object)msg);
}
}
internal static void LogInfo(string msg)
{
ManualLogSource log = Log;
if (log != null)
{
log.LogInfo((object)msg);
}
}
internal static void LogWarning(string msg)
{
ManualLogSource log = Log;
if (log != null)
{
log.LogWarning((object)msg);
}
}
internal static void LogError(string msg)
{
ManualLogSource log = Log;
if (log != null)
{
log.LogError((object)msg);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.plusblankplus.louderhunterfootsteps";
public const string PLUGIN_NAME = "Louder Hunter Footsteps";
public const string PLUGIN_VERSION = "1.0.0";
}