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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; using testRepoMod; [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("Drunger")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright (c) linkoid 2025")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+82aef2314362b776a11a8e8a1322f70071a4f078")] [assembly: AssemblyProduct("Linkoid.Repo.testRepoMod")] [assembly: AssemblyTitle("Linkoid.Repo.testRepoMod")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/linkoid/Repo.Sdks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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; } } } [HarmonyPatch(typeof(AudioSource), "Play", new Type[] { })] public class ShadowChildSoundPatch { private static float upPitch = 1.3f; private static float downPitch = 0.7f; private static void Prefix(AudioSource __instance) { if ((Object)(object)__instance.clip == (Object)null) { return; } string name = ((Object)__instance.clip).name; if (name == "enemy thin man notice01" || name == "enemy thin man notice02" || name == "enemy thin man notice03") { if ((Object)(object)global::testRepoMod.testRepoMod.Instance.NoticeClip != (Object)null) { __instance.clip = global::testRepoMod.testRepoMod.Instance.NoticeClip; __instance.pitch = Random.Range(downPitch, upPitch); } return; } if (name == "enemy thin man tentacle grow loop" || name == "enemy thin man teleport in" || name == "enemy thin man teleport out") { if ((Object)(object)global::testRepoMod.testRepoMod.Instance.MovementClip != (Object)null) { __instance.clip = global::testRepoMod.testRepoMod.Instance.MovementClip; __instance.pitch = Random.Range(downPitch, upPitch); } return; } if (name == "enemy thin man attack scream01" || name == "enemy thin man attack scream02" || name == "enemy thin man attack scream03") { if ((Object)(object)global::testRepoMod.testRepoMod.Instance.ScreamClip != (Object)null) { __instance.clip = global::testRepoMod.testRepoMod.Instance.ScreamClip; __instance.pitch = Random.Range(downPitch, upPitch); } return; } if (name == "enemy thin man attack scream01 global" || name == "enemy thin man attack scream02 global" || name == "enemy thin man attack scream03 global") { if ((Object)(object)global::testRepoMod.testRepoMod.Instance.ScreamGlobalClip != (Object)null) { __instance.clip = global::testRepoMod.testRepoMod.Instance.ScreamGlobalClip; __instance.pitch = Random.Range(downPitch, upPitch); } return; } switch (name) { case "enemy thin man death": if ((Object)(object)global::testRepoMod.testRepoMod.Instance.DeathClip != (Object)null) { __instance.clip = global::testRepoMod.testRepoMod.Instance.DeathClip; __instance.pitch = Random.Range(downPitch, upPitch); } break; default: if (!(name == "enemy thin man hurt03")) { __instance.pitch = 1f; break; } goto case "enemy thin man hurt01"; case "enemy thin man hurt01": case "enemy thin man hurt02": if ((Object)(object)global::testRepoMod.testRepoMod.Instance.HurtClip != (Object)null) { __instance.clip = global::testRepoMod.testRepoMod.Instance.HurtClip; __instance.pitch = Random.Range(downPitch, upPitch); } break; } } } namespace testRepoMod { [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { testRepoMod.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { testRepoMod.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } [BepInPlugin("Drunger.testRepoMod", "testRepoMod", "1.0")] public class testRepoMod : BaseUnityPlugin { [CompilerGenerated] private sealed class d__38 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public string path; public AudioType audioType; public Action onLoaded; public testRepoMod <>4__this; private string 5__1; private UnityWebRequest 5__2; object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__38(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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; 5__1 = "file:///" + path.Replace("\\", "/"); 5__2 = UnityWebRequestMultimedia.GetAudioClip(5__1, audioType); <>1__state = -3; <>2__current = 5__2.SendWebRequest(); <>1__state = 1; result = true; break; case 1: <>1__state = -3; if ((int)5__2.result == 1) { onLoaded(DownloadHandlerAudioClip.GetContent(5__2)); Logger.LogInfo((object)("Loaded audio: " + path)); } else { Logger.LogError((object)("Failed to load audio: " + path + " — " + 5__2.error)); } 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__2 != null) { ((IDisposable)5__2).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__37 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public testRepoMod <>4__this; private string 5__1; object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object? IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__37(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)<>4__this).Info.Location), "sounds"); <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(Path.Combine(5__1, "notice_sound.wav"), (AudioType)20, delegate(AudioClip clip) { <>4__this.NoticeClip = clip; })); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(Path.Combine(5__1, "movement_sound.wav"), (AudioType)20, delegate(AudioClip clip) { <>4__this.MovementClip = clip; })); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(Path.Combine(5__1, "scream_sound.wav"), (AudioType)20, delegate(AudioClip clip) { <>4__this.ScreamClip = clip; })); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(Path.Combine(5__1, "scream_global_sound.wav"), (AudioType)20, delegate(AudioClip clip) { <>4__this.ScreamGlobalClip = clip; })); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(Path.Combine(5__1, "death_sound.wav"), (AudioType)20, delegate(AudioClip clip) { <>4__this.DeathClip = clip; })); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip(Path.Combine(5__1, "hurt_sound.wav"), (AudioType)20, delegate(AudioClip clip) { <>4__this.HurtClip = clip; })); <>1__state = 6; return true; case 6: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static testRepoMod Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } internal AudioClip? NoticeClip { get; private set; } internal AudioClip? MovementClip { get; private set; } internal AudioClip? ScreamClip { get; private set; } internal AudioClip? ScreamGlobalClip { get; private set; } internal AudioClip? DeathClip { get; private set; } internal AudioClip? HurtClip { get; private set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); ((MonoBehaviour)this).StartCoroutine(LoadCustomAudio()); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } [IteratorStateMachine(typeof(d__37))] private IEnumerator LoadCustomAudio() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__37(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__38))] private IEnumerator LoadClip(string path, AudioType audioType, Action onLoaded) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__38(0) { <>4__this = this, path = path, audioType = audioType, onLoaded = onLoaded }; } internal void Patch() { //IL_001a: 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_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } }