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 Kakasquito v1.0.0
Kakasquito.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; [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 = "")] [assembly: AssemblyCompany("Kakasquito")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Kaka screams deathsquito!")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Kakasquito")] [assembly: AssemblyTitle("Kakasquito")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Kakasquito; [BepInPlugin("Kakasquito", "Kakasquito", "1.0.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(ZSFX), "Awake")] private static class ZSFX_Awake_Patch { private static void Postfix(ZSFX __instance) { string zSFXName = GetZSFXName(__instance); Dictionary<string, Dictionary<string, AudioClip>> customSFXList = Plugin.customSFXList; if (customSFXList != null && customSFXList.TryGetValue(zSFXName, out var value)) { __instance.m_audioClips = value.Values.ToArray(); } else { if (customSFX == null || __instance.m_audioClips == null) { return; } for (int i = 0; i < __instance.m_audioClips.Length; i++) { if (__instance.m_audioClips[i] != null && customSFX.TryGetValue(((Object)__instance.m_audioClips[i]).name, out var value2)) { __instance.m_audioClips[i] = value2; } } } } } public static Dictionary<string, Dictionary<string, AudioClip>> customSFXList = new Dictionary<string, Dictionary<string, AudioClip>>(); public static Dictionary<string, AudioClip> customSFX = new Dictionary<string, AudioClip>(); public static Plugin instance; private void Awake() { instance = this; PreloadAudioClips(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Kakasquito is loaded!"); } public void PreloadAudioClips() { Debug.Log((object)"Preloading audio clips."); string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "deathsquito1.wav"); string path2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "deathsquito2.wav"); PreloadClipCoroutine(path, (AudioType)0, customSFX); PreloadClipCoroutine(path2, (AudioType)0, customSFX); customSFXList.Add("sfx_deathsquito_attack", customSFX); } private void PreloadClipCoroutine(string path, AudioType audioType, Dictionary<string, AudioClip> whichDict) { //IL_0058: 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_0090: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown if (path.EndsWith(".txt") || !path.Contains(".")) { return; } Debug.Log((object)("path: " + path)); path = "file:///" + path.Replace("\\", "/"); try { UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(path, audioType); audioClip.SendWebRequest(); while (!audioClip.isDone) { } if (audioClip != null) { DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)audioClip.downloadHandler; if (val != null) { AudioClip audioClip2 = val.audioClip; if ((Object)audioClip2 != (Object)null) { string text = (((Object)audioClip2).name = Path.GetFileNameWithoutExtension(path)); string text2 = text; if (!whichDict.ContainsKey(text2)) { whichDict[text2] = audioClip2; } Debug.Log((object)("Added audio clip " + text2 + " to dict")); } else { Debug.Log((object)("audio clip is null. data: " + ((DownloadHandler)val).text)); } } else { Debug.Log((object)("DownloadHandler is null. bytes downloaded: " + audioClip.downloadedBytes)); } } else { Debug.Log((object)("www is null " + audioClip.url)); } } catch { } } public static string GetZSFXName(ZSFX zfx) { string name = ((Object)zfx).name; char[] anyOf = new char[2] { '(', ' ' }; int num = name.IndexOfAny(anyOf); if (num != -1) { return name.Remove(num); } return name; } } public static class PluginInfo { public const string PLUGIN_GUID = "Kakasquito"; public const string PLUGIN_NAME = "Kakasquito"; public const string PLUGIN_VERSION = "1.0.0"; }