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 Template2 v1.1.2
BepInEx/plugins/FunnyAudio.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FunnyAudio.NetcodePatcher; using HarmonyLib; using Hypick.Services; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("FunnyAudio")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.2.0")] [assembly: AssemblyInformationalVersion("1.1.2+c2d34d56a92551caae5c901fcf55f3f1fd63c7a2")] [assembly: AssemblyProduct("FunnyAudio")] [assembly: AssemblyTitle("FunnyAudio")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 Hypick { [BepInPlugin("FunnyAudio", "FunnyAudio", "1.0.0")] public class Plugin : BaseUnityPlugin { public static PluginConfig Config; private readonly Harmony _harmony = new Harmony("FunnyAudio"); public TemplateService Service; internal static AudioClip[] BonkSFX; internal static AudioClip[] VineBoomSFX; internal static AudioClip[] YippeeSFX; internal static AudioClip[] AhhSFX; internal static AudioClip[] AngryScreechSFX; internal static List<AudioClip> FartsSFX = new List<AudioClip>(); internal static List<AudioClip> MoaningsSFX = new List<AudioClip>(); internal static List<AudioClip> NMBShotgunShoots = new List<AudioClip>(); internal static AudioClip[] NMBShotgunReload; internal static AudioClip[] NMBNutCrackerAim; internal static AudioClip[] NMBNutCrackerDie; internal static AudioClip[] NMBNutCrackerHitEye; public static Plugin Instance { get; set; } public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger; public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown Instance = this; } private void Awake() { Config = new PluginConfig(((BaseUnityPlugin)this).Config); Service = new TemplateService(); Log.LogInfo((object)"Load assets..."); LoadAssetBundle(GetFilePath("bonk"), out BonkSFX); LoadAssetBundle(GetFilePath("vineboom"), out VineBoomSFX); LoadAssetBundle(GetFilePath("yippee"), out YippeeSFX); LoadAssetBundle(GetFilePath("ahh"), out AhhSFX); LoadAssetBundle(GetFilePath("angryscreech"), out AngryScreechSFX); LoadListAssetBundle(new string[2] { "fart", "fartfar" }, FartsSFX); LoadListAssetBundle(new string[2] { "moaning", "moaningfar" }, MoaningsSFX); LoadListAssetBundle(new string[2] { "blast", "blast2" }, NMBShotgunShoots); LoadAssetBundle(GetFilePath("Shotgun/reload"), out NMBShotgunReload); LoadAssetBundle(GetFilePath("NutCracker/turn"), out NMBNutCrackerAim); LoadAssetBundle(GetFilePath("NutCracker/die"), out NMBNutCrackerDie); LoadAssetBundle(GetFilePath("NutCracker/hiteye"), out NMBNutCrackerHitEye); Log.LogInfo((object)"Applying patches..."); _harmony.PatchAll(); Log.LogInfo((object)"Patches applied"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"FunnyAudio is fully loaded!"); } private void LoadAssetBundle(string path, out AudioClip[] audioClips) { AssetBundle val = AssetBundle.LoadFromFile(path); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load asset bundle from " + path)); audioClips = null; } else { audioClips = val.LoadAllAssets<AudioClip>(); } } private void LoadListAssetBundle(string[] fileNames, List<AudioClip> audioClips) { foreach (string fileName in fileNames) { string filePath = GetFilePath(fileName); AssetBundle val = AssetBundle.LoadFromFile(filePath); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load asset bundle from " + filePath)); } else { audioClips.Add(val.LoadAllAssets<AudioClip>()[0]); } } } private string GetFilePath(string fileName) { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location); return Path.Combine(directoryName, "Assets", fileName); } } public static class Categories { public const string Shovel = "Shotgun"; public const string SpringMan = "SpringMan"; public const string HoarderBug = "HoarderBug"; public const string Landmine = "Landmine"; public const string Airhorn = "Airhorn"; public const string Shotgun = "Shotgun"; public const string NutCracker = "NutCracker"; } public class PluginConfig { public bool ShovelHitSFX { get; private set; } public bool SpringNoises { get; private set; } public bool ChitterSFX { get; private set; } public bool HitPlayerSFX { get; private set; } public bool AngryVoiceSFX { get; private set; } public bool MineDetonate { get; private set; } public bool AirhornActivate { get; private set; } public bool ShotgunNeedMoreBullets { get; private set; } public bool NutCrackerNeedMoreBullets { get; private set; } public PluginConfig(ConfigFile cfg) { ShovelHitSFX = cfg.Bind<bool>("Shotgun", "ShovelHitSFX", true, "Replaces the sound of a shovel hitting with the sound of Bonk (https://www.youtube.com/watch?v=6TP0abZdRXg)").Value; SpringNoises = cfg.Bind<bool>("SpringMan", "SpringNoises", true, "Replaces coil spring sounds with Vine Boom sounds (https://www.youtube.com/watch?v=Oc7Cin_87H4)").Value; ChitterSFX = cfg.Bind<bool>("HoarderBug", "ChitterSFX", true, "Replaces the sound of the Hoarding Bug with the sound of Yippee (https://www.youtube.com/watch?v=0CqEKoy-fIQ)").Value; HitPlayerSFX = cfg.Bind<bool>("HoarderBug", "HitPlayerSFX", true, "Replaces the sound of the Hoarding Bug with the sound Ahh (https://www.youtube.com/watch?v=09gX0WL0AmI)").Value; AngryVoiceSFX = cfg.Bind<bool>("HoarderBug", "AngryVoiceSFX", true, "Replaces the Hoarding Bug aggressiveness sound with AAAAAAGHH").Value; MineDetonate = cfg.Bind<bool>("Landmine", "MineDetonate", true, "Replaces the sound of a mine explosion with a POWERFUL explosion").Value; AirhornActivate = cfg.Bind<bool>("Airhorn", "AirhornActivate", true, "Replaces Airhorn sound with moans").Value; ShotgunNeedMoreBullets = cfg.Bind<bool>("Shotgun", "ShotgunNeedMoreBullets", true, "").Value; NutCrackerNeedMoreBullets = cfg.Bind<bool>("NutCracker", "NutCrackerNeedMoreBullets", true, "").Value; } } public static class PluginInfo { public const string PLUGIN_GUID = "FunnyAudio"; public const string PLUGIN_NAME = "FunnyAudio"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace Hypick.Services { public class TemplateService { public bool ReturnTrue() { return true; } public bool ReturnFalse() { return false; } } } namespace Hypick.Patches { [HarmonyPatch(typeof(ForestGiantAI))] internal class ForestGiantAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start() { } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(GrabbableObject __instance) { if (Plugin.Config.AirhornActivate && (Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).GetComponent<NoisemakerProp>() != (Object)null && ((Object)__instance.itemProperties).name == "Airhorn") { ((Component)__instance).GetComponent<NoisemakerProp>().noiseSFX[0] = Plugin.MoaningsSFX[0]; ((Component)__instance).GetComponent<NoisemakerProp>().noiseSFXFar[0] = Plugin.MoaningsSFX[0]; } } } [HarmonyPatch(typeof(HoarderBugAI))] internal class HoarderBugAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ref AudioClip[] ___chitterSFX, ref AudioClip ___hitPlayerSFX, ref AudioClip ___angryVoiceSFX) { ___chitterSFX = (Plugin.Config.ChitterSFX ? Plugin.YippeeSFX : ___chitterSFX); ___hitPlayerSFX = (Plugin.Config.HitPlayerSFX ? Plugin.AhhSFX[0] : ___hitPlayerSFX); ___angryVoiceSFX = (Plugin.Config.AngryVoiceSFX ? Plugin.AngryScreechSFX[0] : ___angryVoiceSFX); } } [HarmonyPatch(typeof(Landmine))] internal class LandminePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ref AudioClip[] ___mineDetonate, ref AudioClip[] ___mineDetonateFar) { if (Plugin.Config.MineDetonate) { ___mineDetonate[0] = Plugin.FartsSFX[0]; ___mineDetonateFar[0] = Plugin.FartsSFX[1]; } } } [HarmonyPatch(typeof(NutcrackerEnemyAI))] internal class NutcrackerEnemyAIPatch { [HarmonyPatch("KillEnemy")] [HarmonyPrefix] private static void KillEnemy(NutcrackerEnemyAI __instance) { if (Plugin.Config.NutCrackerNeedMoreBullets) { AudioSource component = ((Component)__instance).gameObject.GetComponent<AudioSource>(); component.PlayOneShot(Plugin.NMBNutCrackerDie[0], 1f); } } [HarmonyPatch("HitEnemy")] [HarmonyPrefix] private static void HitEnemy(NutcrackerEnemyAI __instance) { if (Plugin.Config.NutCrackerNeedMoreBullets) { AudioSource val = ((Component)__instance).gameObject.AddComponent<AudioSource>(); val.spatialBlend = 1f; val.volume = 10f; val.clip = Plugin.NMBNutCrackerHitEye[0]; val.Play(); } } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ref AudioClip[] ___gunShootSFX, ref AudioClip[] ___gunReloadSFX) { if (Plugin.Config.ShotgunNeedMoreBullets) { int index = Random.Range(0, Plugin.NMBShotgunShoots.Count); ___gunShootSFX[0] = Plugin.NMBShotgunShoots[index]; ___gunReloadSFX = Plugin.NMBShotgunReload; } } } [HarmonyPatch(typeof(Shovel))] internal class ShovelPatch { [HarmonyPatch("HitShovelClientRpc")] [HarmonyPatch("HitShovel")] [HarmonyPrefix] private static void HitShovel(ref AudioClip[] ___hitSFX) { if (Plugin.Config.ShovelHitSFX) { ___hitSFX = Plugin.BonkSFX; } } } [HarmonyPatch(typeof(SpringManAI))] internal class SpringManAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void Update(ref AudioClip[] ___springNoises) { if (Plugin.Config.SpringNoises) { ___springNoises = Plugin.VineBoomSFX; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace FunnyAudio.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }