using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using GlobalSettings; using HarmonyLib; using Microsoft.CodeAnalysis; 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(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")] [assembly: AssemblyCompany("SilksongAnimals")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SilksongAnimals")] [assembly: AssemblyTitle("SilksongAnimals")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] 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 SilksongAnimals { [HarmonyPatch(typeof(HeroController), "BindCompleted")] public class BindCompletedPatch { public static void Postfix(HeroController __instance) { if (((ToolBase)Gameplay.WarriorCrest).IsEquipped) { Plugin.AudioSource.Play(); } } } [BepInPlugin("rinsoko.animals", "Animals", "0.0.0")] public class Plugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__5 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string path; public Plugin <>4__this; private UnityWebRequest 5__1; private AudioClip 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__1 = null; 5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = UnityWebRequestMultimedia.GetAudioClip("file://" + path, (AudioType)14); <>1__state = -3; <>2__current = 5__1.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if ((int)5__1.result != 1) { ((BaseUnityPlugin)<>4__this).Logger.LogError((object)5__1.error); result = false; } else { 5__2 = DownloadHandlerAudioClip.GetContent(5__1); AudioSource.clip = 5__2; result = false; } <>m__Finally1(); break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (5__1 != null) { ((IDisposable)5__1).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static AudioSource AudioSource { get; private set; } public void Start() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Awwwwwwwww!"); new Harmony("rinsoko.animals").PatchAll(); string path = Path.Combine(Paths.PluginPath, "animals.ogg"); GameObject val = new GameObject("MyPluginAudio"); Object.DontDestroyOnLoad((Object)(object)val); AudioSource = val.AddComponent(); AudioSource.spatialBlend = 0f; ((MonoBehaviour)this).StartCoroutine(Load(path)); } private IEnumerator Load(string path) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__5(0) { <>4__this = this, path = path }; } } [HarmonyPatch(typeof(HeroController), "ResetWarriorCrestState")] public class ResetWarriorCrestStatePatch { public static void Postfix(HeroController __instance) { Plugin.AudioSource.Stop(); } } }