Decompiled source of TubaWalk v0.1.2
plugins/MusicalEncumbering.dll
Decompiled 3 days agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TubaWalk")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TubaWalk")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ea282da8-693d-4cf1-bf7a-8ecac0827eaa")] [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 TubaWalk; [BepInPlugin("com.oathorse.Tuba", "Tuba Walk", "0.1.0")] public class EncumberedWalkSound : BaseUnityPlugin { public const string PluginGUID = "com.oathorse.Tuba"; public const string PluginName = "Tuba Walk"; public const string PluginVersion = "0.1.0"; private readonly Harmony harmony = new Harmony("com.oathorse.Tuba"); private AudioSource audioSource; private AudioClip walkSound; private bool isPlaying; private IEnumerator LoadAudio(string filePath) { UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip("file://" + filePath, (AudioType)14); try { yield return www.SendWebRequest(); if ((int)www.result == 2 || (int)www.result == 3) { Debug.LogError((object)("Error loading OGG file: " + www.error)); yield break; } walkSound = DownloadHandlerAudioClip.GetContent(www); audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.clip = walkSound; } finally { ((IDisposable)www)?.Dispose(); } } private void Awake() { string filePath = Paths.PluginPath + "\\fat-guy-tuba-song.ogg"; ((MonoBehaviour)this).StartCoroutine(LoadAudio(filePath)); harmony.PatchAll(); } private void Update() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } bool flag = ((Character)localPlayer).IsEncumbered(); Vector3 velocity = ((Character)localPlayer).GetVelocity(); Vector3 moveDir = ((Character)localPlayer).GetMoveDir(); if (((Vector3)(ref velocity)).magnitude > 0.1f && ((Vector3)(ref moveDir)).magnitude > 0.1f && flag) { if (!isPlaying) { audioSource.Play(); isPlaying = true; } } else if (isPlaying) { audioSource.Stop(); isPlaying = false; } } }
plugins/TubaWalk.dll
Decompiled 3 days agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TubaWalk")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TubaWalk")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("ea282da8-693d-4cf1-bf7a-8ecac0827eaa")] [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 TubaWalk; [BepInPlugin("com.oathorse.Tuba", "Tuba Walk", "0.1.2")] public class EncumberedWalkSound : BaseUnityPlugin { public const string PluginGUID = "com.oathorse.Tuba"; public const string PluginName = "Tuba Walk"; public const string PluginVersion = "0.1.2"; private readonly Harmony harmony = new Harmony("com.oathorse.Tuba"); private AudioSource audioSource; private AudioClip walkSound; private bool isPlaying; private IEnumerator LoadAudio(string filePath) { string text = "file://" + filePath; Debug.LogError((object)("Loading OGG file: " + text)); UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(text, (AudioType)14); try { yield return www.SendWebRequest(); if ((int)www.result == 2 || (int)www.result == 3) { Debug.LogError((object)("Error loading OGG file: " + www.error)); yield break; } walkSound = DownloadHandlerAudioClip.GetContent(www); audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.clip = walkSound; } finally { ((IDisposable)www)?.Dispose(); } } private void Awake() { string filePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\fat-guy-tuba-song.ogg"; ((MonoBehaviour)this).StartCoroutine(LoadAudio(filePath)); harmony.PatchAll(); } private void Update() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !Object.op_Implicit((Object)(object)audioSource)) { return; } bool flag = ((Character)localPlayer).IsEncumbered(); Vector3 velocity = ((Character)localPlayer).GetVelocity(); Vector3 moveDir = ((Character)localPlayer).GetMoveDir(); if (((Vector3)(ref velocity)).magnitude > 0.1f && ((Vector3)(ref moveDir)).magnitude > 0.1f && flag) { if (!isPlaying) { audioSource.Play(); isPlaying = true; } } else if (isPlaying) { audioSource.Stop(); isPlaying = false; } } }