using System; 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 ModsCacones.Patches; using Photon.Pun; using UnityEngine; [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("Desay1")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+08fdb3e3a7a20473a320f046c0fdf1778583e625")] [assembly: AssemblyProduct("DesaSounds")] [assembly: AssemblyTitle("DesaSounds")] [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; } } } public static class EnemyDuckExtension { private static readonly ConditionalWeakTable data = new ConditionalWeakTable(); public static EnemyDuckData GetDuckData(this EnemyDuck instance) { return data.GetOrCreateValue(instance); } } public static class EnemyTickExtension { private static readonly ConditionalWeakTable data = new ConditionalWeakTable(); public static EnemyTickData GetTickData(this EnemyTick instance) { return data.GetOrCreateValue(instance); } } namespace ModsCacones.Patches { [HarmonyPatch(typeof(EnemyBombThrowerHead))] public class EnemyBombHeadPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(EnemyBombThrowerHead __instance) { AudioSource val = ((Component)__instance).gameObject.GetComponent() ?? ((Component)__instance).gameObject.AddComponent(); val.dopplerLevel = 0f; val.spatialBlend = 0f; val.maxDistance = 800f; __instance.soundLaugh.Source = val; __instance.soundLaugh.Doppler = 0f; __instance.soundLaugh.LoopFalloffMax = 800f; } [HarmonyPatch("SoundLoopLogic")] [HarmonyPrefix] private static bool SoundLoopLogicPatch(EnemyBombThrowerHead __instance) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 __instance.soundLaugh.PlayLoop((int)__instance.currentState == 2, 1f, 1f, 1f, 1f); return false; } } [HarmonyPatch(typeof(EnemyDuck))] public class EnemyDuckPatch { public static List AngryClips = new List(); public static List DestranClips = new List(); public static List ValRotoClips = new List(); public static List StunClips = new List(); public static List CachadoClips = new List(); public static List AtrapadoClips = new List(); public static List LibertadClips = new List(); [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(EnemyDuck __instance) { if (PhotonNetwork.IsConnected) { PhotonView val = ((Component)__instance).gameObject.GetComponent() ?? ((Component)__instance).gameObject.AddComponent(); mySync orSetSync_Duck = myHelper.GetOrSetSync_Duck(__instance); } } [HarmonyPatch("StateAttackStart")] [HarmonyPrefix] private static void GritoEnojo(EnemyDuck __instance) { if (SemiFunc.IsMasterClientOrSingleplayer() && __instance.stateImpulse) { __instance.GetDuckData().angry = true; mySync orSetSync_Duck = myHelper.GetOrSetSync_Duck(__instance); orSetSync_Duck.SyncSound("duck", "angry", myHelper.GetRandomSound(AngryClips)); } } [HarmonyPatch("StateDeTransform")] [HarmonyPostfix] private static void GritoDestr(EnemyDuck __instance) { if (SemiFunc.IsMasterClientOrSingleplayer() && __instance.stateTimer <= 0f) { __instance.GetDuckData().angry = false; mySync orSetSync_Duck = myHelper.GetOrSetSync_Duck(__instance); orSetSync_Duck.SyncSound("duck", "calm", myHelper.GetRandomSound(DestranClips)); } } [HarmonyPatch("StateStun")] [HarmonyPostfix] private static void Stuneado(EnemyDuck __instance) { if (SemiFunc.IsMasterClientOrSingleplayer() && __instance.enemy.IsStunned() && ((__instance.enemy.StateStunned.stunTimer >= 6f && __instance.enemy.StateStunned.stunTimer <= 7f) || (__instance.enemy.StateStunned.stunTimer >= 12f && __instance.enemy.StateStunned.stunTimer <= 13f))) { mySync orSetSync_Duck = myHelper.GetOrSetSync_Duck(__instance); orSetSync_Duck.SyncSound("duck", "stun", myHelper.GetRandomSound(StunClips)); } } [HarmonyPatch("DuckBucketLogic")] [HarmonyPostfix] private static void Bucket(EnemyDuck __instance) { if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (__instance.duckBucketActive) { if (__instance.GetDuckData().trapped == 0) { mySync orSetSync_Duck = myHelper.GetOrSetSync_Duck(__instance); orSetSync_Duck.SyncSound("duck", "cachado", myHelper.GetRandomSound(CachadoClips)); __instance.GetDuckData().trapped = 1; } else if (__instance.GetDuckData().trapped >= 550) { mySync orSetSync_Duck2 = myHelper.GetOrSetSync_Duck(__instance); orSetSync_Duck2.SyncSound("duck", "atrapado", myHelper.GetRandomSound(AtrapadoClips)); __instance.GetDuckData().trapped = 1; } else { __instance.GetDuckData().trapped++; } } else if (__instance.GetDuckData().trapped > 0) { mySync orSetSync_Duck3 = myHelper.GetOrSetSync_Duck(__instance); orSetSync_Duck3.SyncSound("duck", "libertad", myHelper.GetRandomSound(LibertadClips)); __instance.GetDuckData().trapped = 0; } } } [HarmonyPatch(typeof(EnemyHunter))] public class EnemyHunterPatch { [HarmonyPatch(typeof(EnemyHunter), "ShootRPC")] public static class EnemyScript_ShootRPC_Patch { private static void Postfix(Vector3 _hitPosition, EnemyHunter __instance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } float num = 0.1f; LayerMask val = LayerMask.op_Implicit(LayerMask.op_Implicit(SemiFunc.LayerMaskGetPhysGrabObject()) + LayerMask.GetMask(new string[1] { "Player" }) + LayerMask.GetMask(new string[1] { "Default" }) + LayerMask.GetMask(new string[1] { "Enemy" })); Collider[] array = Physics.OverlapSphere(_hitPosition, num, LayerMask.op_Implicit(val)); Collider[] array2 = array; foreach (Collider val2 in array2) { PlayerController componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { if (componentInParent.playerName == "Chapita") { PlayRandomLine(__instance, "chapita"); } else if (componentInParent.playerName == "Trickap") { PlayRandomLine(__instance, "joker"); } else { PlayRandomLine(__instance, "player"); } break; } PlayerTumble componentInParent2 = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null) { PlayRandomLine(__instance, "player"); break; } EnemyRigidbody componentInParent3 = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent3 != (Object)null) { PlayRandomLine(__instance, "player"); break; } PlayRandomLine(__instance, "miss"); } } } public static List ClipsMiss = new List(); public static List ClipsHitPlayer = new List(); public static List ClipsHitChapita = new List(); public static List ClipsHitJoker = new List(); [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(EnemyHunter __instance) { if (PhotonNetwork.IsConnected) { PhotonView val = ((Component)__instance).gameObject.GetComponent() ?? ((Component)__instance).gameObject.AddComponent(); mySync orSetSync_Hunter = myHelper.GetOrSetSync_Hunter(__instance); } } private static void PlayRandomLine(EnemyHunter __instance, string hit) { if (SemiFunc.IsMasterClientOrSingleplayer()) { mySync orSetSync_Hunter = myHelper.GetOrSetSync_Hunter(__instance); switch (hit) { case "miss": orSetSync_Hunter.SyncSound("hunter", "miss", myHelper.GetRandomSound(ClipsMiss)); break; case "player": orSetSync_Hunter.SyncSound("hunter", "hit", myHelper.GetRandomSound(ClipsHitPlayer)); break; case "chapita": orSetSync_Hunter.SyncSound("hunter", "chapas", myHelper.GetRandomSound(ClipsHitChapita)); break; case "joker": orSetSync_Hunter.SyncSound("hunter", "joker", myHelper.GetRandomSound(ClipsHitJoker)); break; } } } } [HarmonyPatch(typeof(EnemyTick))] public class EnemyTickPatch { public static List AtaqueClips = new List(); public static List IrseClips = new List(); public static List DeadClips = new List(); [HarmonyPatch("Awake")] [HarmonyPrefix] private static void AwakePatch(EnemyTick __instance) { if (PhotonNetwork.IsConnected) { PhotonView val = ((Component)__instance).gameObject.GetComponent() ?? ((Component)__instance).gameObject.AddComponent(); mySync orSetSync_Tick = myHelper.GetOrSetSync_Tick(__instance); } } [HarmonyPatch("Suck")] [HarmonyPostfix] private static void Ataque(EnemyTick __instance) { if (SemiFunc.IsMasterClientOrSingleplayer() && !__instance.GetTickData().bite) { __instance.GetTickData().bite = true; mySync orSetSync_Tick = myHelper.GetOrSetSync_Tick(__instance); orSetSync_Tick.SyncSound("tick", "ataque", myHelper.GetRandomSound(AtaqueClips)); } } [HarmonyPatch("StateRunAway")] [HarmonyPostfix] private static void Huida(EnemyTick __instance) { if (SemiFunc.IsMasterClientOrSingleplayer() && __instance.GetTickData().bite) { __instance.GetTickData().bite = false; mySync orSetSync_Tick = myHelper.GetOrSetSync_Tick(__instance); orSetSync_Tick.SyncSound("tick", "irse", myHelper.GetRandomSound(IrseClips)); } } [HarmonyPatch("OnDeath")] [HarmonyPrefix] private static void Muerto(EnemyTick __instance) { if (SemiFunc.IsMasterClientOrSingleplayer()) { mySync orSetSync_Tick = myHelper.GetOrSetSync_Tick(__instance); orSetSync_Tick.SyncSound("tick", "dead", myHelper.GetRandomSound(DeadClips)); } } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector))] internal class PhysGrabObjectImpactDetectorPatch { [HarmonyPatch("DestroyObject")] [HarmonyPrefix] private static void ValDestroyed(ValuableObject? ___valuableObject) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)___valuableObject == (Object)null || !SemiFunc.IsMasterClientOrSingleplayer()) { return; } LayerMask val = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "PhysGrabObject" })); Collider[] array = Physics.OverlapSphere(((Component)___valuableObject).transform.position, 15f, LayerMask.op_Implicit(val)); Collider[] array2 = array; foreach (Collider val2 in array2) { EnemyParent componentInParent = ((Component)val2).GetComponentInParent(); if (!((Object)(object)componentInParent != (Object)null) || !(((Object)componentInParent).name == "Enemy - Duck(Clone)")) { continue; } EnemyDuck componentInParent2 = ((Component)componentInParent.Enemy).GetComponentInParent(); if ((Object)(object)componentInParent2 == (Object)null) { break; } if (!componentInParent2.enemy.IsStunned() & !componentInParent2.GetDuckData().angry) { mySync component = ((Component)componentInParent2).GetComponent(); if ((Object)(object)component != (Object)null) { component.SyncSound("duck", "roto", myHelper.GetRandomSound(EnemyDuckPatch.ValRotoClips)); } } } } } public class EnemyDuckData { public bool angry = false; public int trapped = 0; } public class EnemyTickData { public bool bite = false; } public static class myHelper { public static int GetRandomSound(List clipsList) { if (clipsList == null || clipsList.Count == 0) { return -1; } return Random.Range(0, clipsList.Count); } public static AudioSource GetOrSetEnemyAS_Hunter(EnemyHunter instance) { AudioSource val = ((Component)instance).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)instance).gameObject.AddComponent(); val.spatialBlend = 1f; val.maxDistance = 1000f; val.dopplerLevel = 0f; } return val; } public static AudioSource GetOrSetEnemyAS_Duck(EnemyDuck instance) { AudioSource val = ((Component)instance).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)instance).gameObject.AddComponent(); val.spatialBlend = 1f; val.maxDistance = 800f; val.dopplerLevel = 0f; } return val; } public static AudioSource GetOrSetEnemyAS_Tick(EnemyTick instance) { AudioSource val = ((Component)instance).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)instance).gameObject.AddComponent(); val.spatialBlend = 1f; val.maxDistance = 800f; val.dopplerLevel = 0f; } return val; } public static mySync GetOrSetSync_Hunter(EnemyHunter __instance) { mySync mySync2 = ((Component)__instance).GetComponent(); if ((Object)(object)mySync2 == (Object)null) { mySync2 = ((Component)__instance).gameObject.AddComponent(); mySync2.hunter = __instance; } return mySync2; } public static mySync GetOrSetSync_Duck(EnemyDuck __instance) { mySync mySync2 = ((Component)__instance).GetComponent(); if ((Object)(object)mySync2 == (Object)null) { mySync2 = ((Component)__instance).gameObject.AddComponent(); mySync2.duck = __instance; } return mySync2; } public static mySync GetOrSetSync_Tick(EnemyTick __instance) { mySync mySync2 = ((Component)__instance).GetComponent(); if ((Object)(object)mySync2 == (Object)null) { mySync2 = ((Component)__instance).gameObject.AddComponent(); mySync2.tick = __instance; } return mySync2; } } public class mySync : MonoBehaviourPun { public EnemyDuck? duck; public EnemyHunter? hunter; public EnemyTick? tick; private AudioSource audioSource; public void SyncSound(string enemy, string list, int clip) { ((MonoBehaviourPun)this).photonView.RPC("PlaySoundRPC", (RpcTarget)0, new object[3] { enemy, list, clip }); } [PunRPC] public void PlaySoundRPC(string enemy, string list, int clip) { //IL_04f0: Unknown result type (might be due to invalid IL or missing references) if (clip == -1) { return; } switch (enemy) { case "duck": if ((Object)(object)duck != (Object)null) { audioSource = myHelper.GetOrSetEnemyAS_Duck(duck); } switch (list) { case "angry": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.AngryClips[clip]); } break; case "calm": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.DestranClips[clip]); } break; case "roto": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.ValRotoClips[clip]); } break; case "stun": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.StunClips[clip]); } break; case "cachado": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.CachadoClips[clip]); } break; case "atrapado": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.AtrapadoClips[clip]); } break; case "libertad": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyDuckPatch.LibertadClips[clip]); } break; } break; case "hunter": if ((Object)(object)hunter != (Object)null) { audioSource = myHelper.GetOrSetEnemyAS_Hunter(hunter); } switch (list) { case "miss": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyHunterPatch.ClipsMiss[clip]); } break; case "hit": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyHunterPatch.ClipsHitPlayer[clip]); } break; case "chapas": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyHunterPatch.ClipsHitChapita[clip]); } break; case "joker": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyHunterPatch.ClipsHitJoker[clip]); } break; } break; case "tick": if ((Object)(object)tick != (Object)null) { audioSource = myHelper.GetOrSetEnemyAS_Tick(tick); } switch (list) { case "ataque": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyTickPatch.AtaqueClips[clip]); } break; case "irse": if (!audioSource.isPlaying) { audioSource.PlayOneShot(EnemyTickPatch.IrseClips[clip]); } break; case "dead": if (!audioSource.isPlaying) { audioSource.Stop(); } AudioSource.PlayClipAtPoint(EnemyTickPatch.DeadClips[clip], ((Component)audioSource).transform.position); break; } break; } } } } namespace DesaSounds { [BepInPlugin("Desay1.DesaSounds", "DesaSounds", "1.0")] public class DesaSounds : BaseUnityPlugin { private static string modFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static DesaSounds Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; LoadSounds("snipermissbundle", EnemyHunterPatch.ClipsMiss); LoadSounds("sniperhitbundle", EnemyHunterPatch.ClipsHitPlayer); LoadSounds("sniperchapas", EnemyHunterPatch.ClipsHitChapita); LoadSounds("sniperjoker", EnemyHunterPatch.ClipsHitJoker); LoadSounds("demoangry", EnemyDuckPatch.AngryClips); LoadSounds("democalm", EnemyDuckPatch.DestranClips); LoadSounds("demoroto", EnemyDuckPatch.ValRotoClips); LoadSounds("demostun", EnemyDuckPatch.StunClips); LoadSounds("democachado", EnemyDuckPatch.CachadoClips); LoadSounds("demoatrapado", EnemyDuckPatch.AtrapadoClips); LoadSounds("demolibertad", EnemyDuckPatch.LibertadClips); LoadSounds("pulgaAtaque", EnemyTickPatch.AtaqueClips); LoadSounds("pulgaIrse", EnemyTickPatch.IrseClips); LoadSounds("pulgaDead", EnemyTickPatch.DeadClips); Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } private void LoadSounds(string bundleName, List loadedClips) { string text = Path.Combine(modFolder, bundleName); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { return; } AudioClip[] array = val.LoadAllAssets(); if (array.Length != 0) { AudioClip[] array2 = array; foreach (AudioClip item in array2) { loadedClips.Add(item); } } } 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(); } } private void Update() { } } }