Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of DaewenSFX v1.1.1
AddranorLive-DaewenSFX.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AddranorLive_DaewenSFX.Patches; 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: TargetFramework(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("AddranorLive-DaewenSFX")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AddranorLive-DaewenSFX")] [assembly: AssemblyTitle("AddranorLive-DaewenSFX")] [assembly: AssemblyVersion("1.0.0.0")] namespace AddranorLive_DaewenSFX { [BepInPlugin("AddranorLive-DaewenSFX", "DaewenSFX", "1.0.0")] public class Plugin : BaseUnityPlugin { internal const string modGUID = "AddranorLive-DaewenSFX"; internal const string modName = "DaewenSFX"; internal const string modVersion = "1.0.0"; internal readonly Harmony harmony = new Harmony("TopraksuK.FBTRJ"); internal static string PluginPath = Paths.PluginPath; internal static Plugin Instance; internal static ManualLogSource MLS; private ConfigEntry<bool> configJester; private ConfigEntry<bool> configTurret; private ConfigEntry<bool> configBonk; private ConfigEntry<bool> configClownHorn; private ConfigEntry<bool> configSecret; private void Awake() { BindConfig(ref configJester, "SFX", "Jester SFX", defaultValue: true, "Enables the Jester Winding and Screaming custom SFX (Free Bird TOTEM Remix)"); BindConfig(ref configTurret, "SFX", "Turret Spot SFX", defaultValue: true, "Enables the Turret spot custom SFX (Metal Gear Solid Alert)"); BindConfig(ref configBonk, "SFX", "Bonk SFX", defaultValue: true, "Enables the Shovel custom SFX (Doge Bonk)"); BindConfig(ref configClownHorn, "SFX", "Clown Horn SFX", defaultValue: true, "Enables the Clown Horn custom SFX (Huh?!)"); BindConfig(ref configSecret, "Secret", "Secret SFX", defaultValue: true, "Enables the secret custom SFX (Try and find it !)"); if ((Object)(object)Instance == (Object)null) { Instance = this; } string text = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("AddranorLive-DaewenSFX.dll".ToCharArray()); AssetBundle jesterBundle = AssetBundle.LoadFromFile(text + "jestersfx"); AssetBundle val = AssetBundle.LoadFromFile(text + "daewensfx"); MLS = Logger.CreateLogSource("AddranorLive-DaewenSFX"); MLS.LogInfo((object)"AddranorLive-DaewenSFX : Loading files from mod."); PatchJesterAI(jesterBundle); PatchHornAndSecretSFX(val); PatchShovelSFX(val); PatchTurretAI(val); MLS.LogInfo((object)"AddranorLive-DaewenSFX : All files loaded."); } private void PatchJesterAI(AssetBundle JesterBundle) { if ((Object)(object)JesterBundle == (Object)null) { LogError("AddranorLive-DaewenSFX : Failed to load audio asset for : Jester Free Bird TOTEM Remix Theme"); return; } if (configJester.Value) { JesterAIPatch.windingSFX = JesterBundle.LoadAssetWithSubAssets<AudioClip>("assets/freebird1.mp3")[0]; JesterAIPatch.screamingSFX = JesterBundle.LoadAssetWithSubAssets<AudioClip>("assets/freebird2.mp3")[0]; } harmony.PatchAll(typeof(JesterAIPatch)); if (configJester.Value) { MLS.LogInfo((object)"AddranorLive-DaewenSFX : Jester Free Bird TOTEM Remix Theme loaded successfully !"); } } private void PatchHornAndSecretSFX(AssetBundle AudioBundle) { if (!configClownHorn.Value && !configSecret.Value) { return; } if ((Object)(object)AudioBundle == (Object)null) { if (configClownHorn.Value) { LogError("AddranorLive-DaewenSFX : Failed to load audio asset for : Huh?!"); } return; } if (configClownHorn.Value) { NoiseMakerPatch.ClownHornSFX = AudioBundle.LoadAssetWithSubAssets<AudioClip>("assets/assetbundles/daewensfx/huhsfx.wav")[0]; NoiseMakerPatch.ClownHornSFXFar = AudioBundle.LoadAssetWithSubAssets<AudioClip>("assets/assetbundles/daewensfx/huhfarsfx.wav")[0]; LogInfo(((object)NoiseMakerPatch.ClownHornSFX)?.ToString() + " / " + (object)NoiseMakerPatch.ClownHornSFXFar); } if (configSecret.Value) { NoiseMakerPatch.AirHornSFX = AudioBundle.LoadAssetWithSubAssets<AudioClip>("assets/assetbundles/daewensfx/secretsfx.wav")[0]; NoiseMakerPatch.AirHornSFXFar = AudioBundle.LoadAssetWithSubAssets<AudioClip>("assets/assetbundles/daewensfx/secretfarsfx.wav")[0]; LogInfo(((object)NoiseMakerPatch.AirHornSFX)?.ToString() + " / " + (object)NoiseMakerPatch.AirHornSFXFar); } harmony.PatchAll(typeof(NoiseMakerPatch)); if (configClownHorn.Value) { MLS.LogInfo((object)"AddranorLive-DaewenSFX : Huh?! loaded successfully !"); } } private void PatchShovelSFX(AssetBundle AudioBundle) { if (configBonk.Value) { if ((Object)(object)AudioBundle == (Object)null) { LogError("AddranorLive-DaewenSFX : Failed to load audio asset for : Bonk"); return; } ShovelPatch.shovelHitSFX = AudioBundle.LoadAssetWithSubAssets<AudioClip>("assets/assetbundles/daewensfx/bonksfx.wav"); MLS.LogInfo((object)ShovelPatch.shovelHitSFX[0]); harmony.PatchAll(typeof(ShovelPatch)); MLS.LogInfo((object)"AddranorLive-DaewenSFX : Bonk loaded successfully !"); } } private void PatchTurretAI(AssetBundle TurretBundle) { if (configTurret.Value) { if ((Object)(object)TurretBundle == (Object)null) { LogError("AddranorLive-DaewenSFX : Failed to load audio asset for : Turrent MGS Alert Spotted"); return; } TurretPatch.turretDetectionSFX = TurretBundle.LoadAssetWithSubAssets<AudioClip>("assets/assetbundles/daewensfx/turretseeplayer.wav")[0]; harmony.PatchAll(typeof(TurretPatch)); MLS.LogInfo((object)"AddranorLive-DaewenSFX : Turret MGS Alert Spotted loaded successfully !"); } } public static void LogInfo(string info) { MLS.LogInfo((object)(info + " (AddranorLive_LethalMods)")); } public static void LogWarning(string warning) { MLS.LogWarning((object)(warning + " (AddranorLive_LethalMods)")); } public static void LogError(string error) { MLS.LogError((object)(error + " (AddranorLive_LethalMods)")); } public void BindConfig<T>(ref ConfigEntry<T> config, string section, string key, T defaultValue, string description = "") { config = ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description); } } } namespace AddranorLive_DaewenSFX.Patches { [HarmonyPatch(typeof(JesterAI))] internal class JesterAIPatch { internal static AudioClip windingSFX; internal static AudioClip screamingSFX; [HarmonyPatch("Start")] [HarmonyPostfix] public static void JesterAIPopUpSFXPatch(ref AudioClip ___popGoesTheWeaselTheme) { if ((Object)(object)windingSFX != (Object)null) { ___popGoesTheWeaselTheme = windingSFX; } } [HarmonyPatch("Start")] [HarmonyPostfix] public static void JesterAIScreamSFXPatch(ref AudioClip ___screamingSFX) { if ((Object)(object)screamingSFX != (Object)null) { ___screamingSFX = screamingSFX; } } [HarmonyPatch(typeof(JesterAI), "SetJesterInitialValues")] [HarmonyPostfix] public static void JestAIInitialPatch(ref float ___popUpTimer) { ___popUpTimer = 35f; } } [HarmonyPatch(typeof(NoisemakerProp))] internal class NoiseMakerPatch { internal static AudioClip ClownHornSFX; internal static AudioClip ClownHornSFXFar; internal static AudioClip AirHornSFX; internal static AudioClip AirHornSFXFar; [HarmonyPatch("Start")] [HarmonyPostfix] private static void AudioPatch(NoisemakerProp __instance) { if (((Object)((GrabbableObject)__instance).itemProperties).name == "ClownHorn" && (Object)(object)ClownHornSFX != (Object)null && (Object)(object)ClownHornSFXFar != (Object)null) { __instance.noiseSFX[0] = ClownHornSFX; __instance.noiseSFXFar[0] = ClownHornSFXFar; __instance.minPitch = 0.85f; __instance.maxPitch = 1.15f; } if (((Object)((GrabbableObject)__instance).itemProperties).name == "Airhorn" && (Object)(object)AirHornSFX != (Object)null && (Object)(object)AirHornSFXFar != (Object)null) { __instance.noiseSFX[0] = AirHornSFX; __instance.noiseSFXFar[0] = AirHornSFXFar; __instance.minPitch = 1f; __instance.maxPitch = 1f; } } } [HarmonyPatch(typeof(Shovel))] internal class ShovelPatch { internal static AudioClip[] shovelHitSFX; [HarmonyPatch("HitShovelClientRpc")] [HarmonyPatch("HitShovel")] [HarmonyPrefix] private static void HitSFXPatch(ref AudioClip[] ___hitSFX) { ___hitSFX = shovelHitSFX; } } [HarmonyPatch(typeof(Turret))] internal class TurretPatch { internal static AudioClip turretDetectionSFX; [HarmonyPatch("Start")] [HarmonyPostfix] public static void TurretDetectionSFXPatch(ref AudioClip ___detectPlayerSFX) { if ((Object)(object)turretDetectionSFX != (Object)null) { ___detectPlayerSFX = turretDetectionSFX; } } } }