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 QuickDodge v1.1.0
QuickDodge.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("AddForce")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AddForce")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("2aec1865-2ea8-4f05-97ae-543099338529")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace QuickDodge; internal static class AddForceBehaviour { private static bool bForce; private static float timer; public static void Update() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Config.Bind(); if (((ButtonControl)Config.dodgeKey).wasPressedThisFrame && !bForce) { bForce = true; timer = 0f; } if (bForce) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if (localPlayerController.moveInputVector == Vector2.zero) { localPlayerController.externalForces += ((Component)localPlayerController).transform.forward.SetPositionY(0f) * Config.dodgeSpeed; } else { localPlayerController.externalForces += (((Component)localPlayerController).transform.right * localPlayerController.moveInputVector.x + localPlayerController.moveInputVector.y * ((Component)localPlayerController).transform.forward) * Config.dodgeSpeed; } timer += Time.deltaTime; if (timer >= Config.dodgeTime) { bForce = false; } } } public static Vector3 SetPositionY(this Vector3 position, float y) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) return new Vector3(position.x, y, position.z); } } internal static class Config { public static KeyControl dodgeKey = Keyboard.current.fKey; public static float dodgeSpeed = 100f; public static float dodgeTime = 0.1f; private static string keyDisplayNames; private static bool isBind; public static void Bind() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!isBind) { keyDisplayNames = string.Join(", ", ((IEnumerable<KeyControl>)(object)Keyboard.current.allKeys).Select((KeyControl x) => ((InputControl)x).displayName)); dodgeKey = BindKey("按键配置", "闪避键", Keyboard.current.fKey, "按键对应字符串参考: " + keyDisplayNames); dodgeSpeed = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("闪避配置", "闪避速度 DodgeSpeed", 100f, string.Empty).Value; dodgeTime = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<float>("闪避配置", "闪避时长 DodgeTime", 0.1f, string.Empty).Value; isBind = true; } } private static KeyControl BindKey(string section, string key, KeyControl defaultValue, string configDescription = null) { try { ConfigEntry<string> val = ((BaseUnityPlugin)Plugin.Instance).Config.Bind<string>(section, key, ((InputControl)defaultValue).displayName, configDescription); KeyControl val2 = Keyboard.current.FindKeyOnCurrentKeyboardLayout(val.Value); if (val2 != null) { return val2; } Plugin.Log.LogWarning((object)("闪避键设置失败!" + key + ":" + val.Value)); return defaultValue; } catch (Exception ex) { Plugin.Log.LogWarning((object)("闪避键设置失败!" + ex.Message)); return defaultValue; } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerB_Patch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance) { if ((Object)(object)__instance == (Object)(object)StartOfRound.Instance.localPlayerController) { AddForceBehaviour.Update(); } } } [BepInPlugin("qh3.QuickDodge", "QuickDodge", "1.0.0")] public class Plugin : BaseUnityPlugin { public static Plugin Instance; private static readonly Harmony harmony = new Harmony("qh3.QuickDodge"); internal static ManualLogSource Log = Logger.CreateLogSource("qh3.QuickDodge"); private void Awake() { Log.LogInfo((object)"Loading QuickDodge"); Instance = this; harmony.PatchAll(typeof(PlayerControllerB_Patch)); } }