Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RepoParry v1.0.0
RepoParry.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RepoParry")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RepoParry")] [assembly: AssemblyTitle("RepoParry")] [assembly: AssemblyVersion("1.0.0.0")] [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 RepoParry { [BepInPlugin("local.repo.parry", "REPO Parry", "1.0.0")] public class ParryPlugin : BaseUnityPlugin { internal static ParryPlugin Instance; internal static ConfigEntry<Key> ParryKey; internal static ConfigEntry<float> ParryWindow; internal static ConfigEntry<float> Cooldown; internal static ConfigEntry<bool> ResetCooldownOnSuccess; internal static ConfigEntry<float> PushRadius; internal static ConfigEntry<float> PushForce; internal static ConfigEntry<bool> ShowTimer; internal static ConfigEntry<float> TimerOffsetY; internal static ConfigEntry<int> TimerFontSize; private float parryEndTime; private float nextReadyTime; private GUIStyle style; internal static bool IsParrying { get { if ((Object)(object)Instance != (Object)null) { return Time.time < Instance.parryEndTime; } return false; } } private void Awake() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) Instance = this; ParryKey = ((BaseUnityPlugin)this).Config.Bind<Key>("General", "ParryKey", (Key)20, "Кнопка парирования."); ParryWindow = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ParryWindow", 0.15f, new ConfigDescription("Сколько секунд длится окно парирования.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 1f), Array.Empty<object>())); Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Cooldown", 1f, new ConfigDescription("Кулдаун парирования, секунды.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); ResetCooldownOnSuccess = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ResetCooldownOnSuccess", true, "Сбрасывать кулдаун после успешного парирования."); PushRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "PushRadius", 4f, new ConfigDescription("Радиус, в котором враги отбрасываются при успешном парировании.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); PushForce = ((BaseUnityPlugin)this).Config.Bind<float>("Effect", "PushForce", 20f, new ConfigDescription("Сила отбрасывания врагов (0 = выключить).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); ShowTimer = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowTimer", true, "Показывать текст с таймером кулдауна."); TimerOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "TimerOffsetY", 80f, new ConfigDescription("Отступ текста от низа экрана, пиксели.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 600f), Array.Empty<object>())); TimerFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "TimerFontSize", 22, new ConfigDescription("Размер шрифта таймера.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 60), Array.Empty<object>())); new Harmony("local.repo.parry").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"REPO Parry loaded"); } private void Update() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (Keyboard.current != null && ((ButtonControl)Keyboard.current[ParryKey.Value]).wasPressedThisFrame) { TryParry(); } } private void TryParry() { if (!(Time.time < nextReadyTime)) { parryEndTime = Time.time + ParryWindow.Value; nextReadyTime = Time.time + Cooldown.Value; } } internal void OnParried() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) parryEndTime = 0f; if (ResetCooldownOnSuccess.Value) { nextReadyTime = 0f; } if (PushForce.Value <= 0f || (Object)(object)Camera.main == (Object)null) { return; } Vector3 position = ((Component)Camera.main).transform.position; HashSet<Enemy> hashSet = new HashSet<Enemy>(); Collider[] array = Physics.OverlapSphere(position, PushRadius.Value); for (int i = 0; i < array.Length; i++) { Enemy componentInParent = ((Component)array[i]).GetComponentInParent<Enemy>(); if (!((Object)(object)componentInParent == (Object)null) && hashSet.Add(componentInParent)) { Rigidbody componentInChildren = ((Component)componentInParent).GetComponentInChildren<Rigidbody>(); if (!((Object)(object)componentInChildren == (Object)null)) { Vector3 val = componentInChildren.position - position; Vector3 normalized = ((Vector3)(ref val)).normalized; componentInChildren.AddForce(normalized * PushForce.Value, (ForceMode)1); } } } } private void OnGUI() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (ShowTimer.Value) { if (style == null) { style = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }; } style.fontSize = TimerFontSize.Value; string text; Color textColor; if (IsParrying) { text = "PARRY!"; textColor = Color.yellow; } else if (Time.time < nextReadyTime) { text = "Parry: " + (nextReadyTime - Time.time).ToString("0.0") + "s"; textColor = Color.red; } else { text = "Parry: ready"; textColor = Color.green; } style.normal.textColor = textColor; GUI.Label(new Rect(0f, (float)Screen.height - TimerOffsetY.Value, (float)Screen.width, 40f), text, style); } } } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] internal static class HurtPatch { private static bool Prefix(PlayerHealth __instance) { if (!ParryPlugin.IsParrying) { return true; } if ((Object)(object)PlayerAvatar.instance == (Object)null || (Object)(object)PlayerAvatar.instance.playerHealth != (Object)(object)__instance) { return true; } ParryPlugin.Instance.OnParried(); return false; } } }