using System; 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 RoR2; 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.7.2", FrameworkDisplayName = "")] [assembly: AssemblyCompany("UltrakillHitstop")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("UltrakillHitstop")] [assembly: AssemblyTitle("UltrakillHitstop")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 LoaderPunchEffectMod { [BepInPlugin("com.yourname.ultrakillhitstoploader", "Ultrakill Hitstop Loader", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "com.yourname.ultrakillhitstoploader"; public const string PluginName = "Ultrakill Hitstop Loader"; public const string PluginVersion = "1.0.0"; public static ManualLogSource Log; public static AudioClip HammerImpact; public static AudioClip HammerExplosion; private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"[Ultrakill Hitstop Loader] Инициализация..."); LoadAudioFiles(); Harmony val = new Harmony("com.yourname.ultrakillhitstoploader"); val.PatchAll(); Log.LogInfo((object)"[Ultrakill Hitstop Loader] Мод успешно загружен!"); } private void LoadAudioFiles() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string filePath = Path.Combine(directoryName, "HammerImpact.wav"); string filePath2 = Path.Combine(directoryName, "HammerExplosion1.wav"); HammerImpact = LoadWav(filePath); HammerExplosion = LoadWav(filePath2); } private AudioClip LoadWav(string filePath) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 if (!File.Exists(filePath)) { Log.LogError((object)("Файл не найден по пути: " + filePath)); return null; } UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + filePath, (AudioType)20); try { audioClip.SendWebRequest(); while (!audioClip.isDone) { } if ((int)audioClip.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip); ((Object)content).name = Path.GetFileNameWithoutExtension(filePath); Log.LogInfo((object)$"Успешно загружен звук: {((Object)content).name} (Длительность: {content.length:F2} сек)"); return content; } Log.LogError((object)("Ошибка загрузки звука " + filePath + ": " + audioClip.error)); return null; } finally { ((IDisposable)audioClip)?.Dispose(); } } } [HarmonyPatch(typeof(HealthComponent), "TakeDamage")] public static class HealthComponent_TakeDamage_Patch { private static BodyIndex loaderBodyIndex = (BodyIndex)(-1); [HarmonyPrefix] public static void Prefix(HealthComponent __instance, DamageInfo damageInfo) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (damageInfo == null || (Object)(object)damageInfo.attacker == (Object)null || !NetworkServer.active) { return; } CharacterBody component = damageInfo.attacker.GetComponent(); if (!((Object)(object)component == (Object)null)) { if ((int)loaderBodyIndex == -1) { loaderBodyIndex = BodyCatalog.FindBodyIndex("LoaderBody"); } if (component.bodyIndex == loaderBodyIndex && damageInfo.procCoefficient >= 1f && ((Vector3)(ref damageInfo.force)).sqrMagnitude > 10000f && (Object)(object)Plugin.HammerImpact != (Object)null) { AudioSource.PlayClipAtPoint(Plugin.HammerImpact, damageInfo.position); } } } } }