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 ProwlerBracken v1.0.2
BepInEx/plugins/ProwlerBracken.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using ProwlerBracken.AssetManagement; using ProwlerBracken.Libraries; using ProwlerBracken.Patches; 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("ProwlerBracken")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ProwlerBracken")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2f4ad9e2-101c-4abf-b1ee-8551bf4b9409")] [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")] namespace ProwlerBracken { [BepInPlugin("Danninx.Prowler", "Prowler Bracken", "0.0.1")] public class ProwlerBrackenBase : BaseUnityPlugin { private static ProwlerBrackenBase _instance; private readonly Harmony Harmony = new Harmony("Danninx.Prowler"); internal static ProwlerBrackenBase Instance { get { return _instance; } set { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if ((Object)_instance == (Object)null) { _instance = value; } else { Object.Destroy((Object)value); } } } private void Awake() { Instance = this; Assets.PopulateAssets(((BaseUnityPlugin)this).Logger); ((BaseUnityPlugin)this).Logger.LogError((object)"You're the best of all of us Miles..."); Harmony.PatchAll(typeof(ProwlerBrackenBase)); Harmony.PatchAll(typeof(BrackenPatch)); } internal static void LogInfo(object message) { ((BaseUnityPlugin)Instance).Logger.LogInfo(message); } internal static void LogWarning(object message) { ((BaseUnityPlugin)Instance).Logger.LogWarning(message); } internal static void LogError(object message) { ((BaseUnityPlugin)Instance).Logger.LogError(message); } } public static class PluginInfo { public const string GUID = "Danninx.Prowler"; public const string NAME = "Prowler Bracken"; public const string VERSION = "0.0.1"; public const string ASSET_BUNDLE_NAME = "prowleraudio"; } } namespace ProwlerBracken.Patches { [HarmonyPatch(typeof(FlowermanAI))] internal class BrackenPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void ChangeBrackenSounds(FlowermanAI __instance) { __instance.creatureAngerVoice.clip = Assets.ProwlerChase; __instance.crackNeckAudio.clip = Assets.ProwlerKill; __instance.crackNeckSFX = Assets.ProwlerKill; ((Component)__instance).gameObject.AddComponent<ProwlerBehavior>().Initialize((EnemyAI)(object)__instance); ProwlerBrackenBase.LogInfo("Prowler initiated."); } [HarmonyPatch("Update")] [HarmonyPostfix] public static void DisableRandomPitch(FlowermanAI __instance) { __instance.creatureAngerVoice.pitch = 1f; } } } namespace ProwlerBracken.Libraries { internal class ProwlerBehavior : MonoBehaviour { private AudioSource AmbienceSource; public const float PLAY_INTERVAL_MIN = 15f; public const float PLAY_INTERVAL_MAX = 40f; public const float MAX_AUDIO_DIST = 100f; private float NextAudioTime; private EnemyAI ProwlerAI; public void Initialize(EnemyAI ProwlerAI) { this.ProwlerAI = ProwlerAI; AmbienceSource = ProwlerAI.creatureVoice; SetNextTime(); } private void Update() { if ((double)Time.time > (double)NextAudioTime) { SetNextTime(); AudioClip randomAmbienceSFX = Assets.GetRandomAmbienceSFX(); ProwlerBrackenBase.LogInfo("Played ambience audio " + ((Object)randomAmbienceSFX).name); AmbienceSource.PlayOneShot(randomAmbienceSFX); } } private void SetNextTime() { NextAudioTime = Time.time + Random.Range(15f, 40f); } } } namespace ProwlerBracken.AssetManagement { public static class Assets { public static AssetBundle AssetBundle { get; private set; } public static AudioClip ProwlerKill { get; private set; } public static List<AudioClip> ProwlerAmbienceSFX { get; private set; } public static AudioClip ProwlerChase { get; private set; } private static string GetAssemblyName() { return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0]; } public static void PopulateAssets(ManualLogSource ModLogger) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)AssetBundle != (Object)null) { return; } string name = GetAssemblyName() + ".AssetManagement.prowleraudio"; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) { AssetBundle = AssetBundle.LoadFromStream(stream); } ProwlerKill = AssetBundle.LoadAsset<AudioClip>("Assets/ProwlerKill.mp3"); ProwlerChase = AssetBundle.LoadAsset<AudioClip>("Assets/ProwlerChase.mp3"); ProwlerAmbienceSFX = new List<AudioClip>(); ModLogger.LogInfo((object)"Prowler ambience clips loaded."); string[] allAssetNames = AssetBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { string[] array = text.Split(new char[1] { '/' }); if (array[1] == "ambiencesfx") { AudioClip item = AssetBundle.LoadAsset<AudioClip>(text); ProwlerAmbienceSFX.Add(item); } } } public static AudioClip GetRandomAmbienceSFX() { if (ProwlerAmbienceSFX.Count == 0) { return null; } int index = Random.Range(0, ProwlerAmbienceSFX.Count - 1); return ProwlerAmbienceSFX[index]; } } }