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 JesterSpeed v1.5.1
JesterSpeed.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JesterSpeed.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("JesterSpeed")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JesterSpeed")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("24f4ef47-ff7e-4525-935b-f063deaf8023")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace JesterSpeedMod { [BepInPlugin("Poseidon.JesterSpeed", "JesterSpeed", "1.5.1")] public class JesterSpeedBase : BaseUnityPlugin { private const string modGUID = "Poseidon.JesterSpeed"; private const string modName = "JesterSpeed"; private const string modVersion = "1.5.1"; private readonly Harmony harmony = new Harmony("Poseidon.JesterSpeed"); private static JesterSpeedBase Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Poseidon.JesterSpeed"); mls.LogInfo((object)"JesterSpeedMod ist erfolgreich gestartet ;)"); harmony.PatchAll(typeof(JesterSpeedBase)); harmony.PatchAll(typeof(PlayerControlerBPatch)); harmony.PatchAll(typeof(JesterCheckPatch)); } } } namespace JesterSpeed.Patches { [HarmonyPatch(typeof(JesterAI))] internal class JesterCheckPatch { private static int previousStateValue; private static float speed; private static ulong targetID; [HarmonyPatch("Update")] [HarmonyPostfix] public static void getState(ref int ___previousState, JesterAI __instance) { previousStateValue = ___previousState; speed = ((EnemyAI)__instance).agent.speed; if (___previousState >= 1) { targetID = ((EnemyAI)__instance).targetPlayer.playerClientId; } } public static int getPreviousStateValue() { return previousStateValue; } public static float getJesterAgentSpeed() { return speed; } public static ulong getJesterAgentTargetID() { return targetID; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControlerBPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void speedBoost(ref float ___sprintMeter, ref float ___sprintMultiplier, ref bool ___isSprinting, ref ulong ___playerClientId, ref bool ___isJumping, ref bool ___isFallingFromJump) { if (JesterCheckPatch.getPreviousStateValue() == 2 && ___playerClientId == JesterCheckPatch.getJesterAgentTargetID() && !___isJumping && !___isFallingFromJump) { ___sprintMeter = 1f; if (___isSprinting) { ___sprintMultiplier = Math.Max(JesterCheckPatch.getJesterAgentSpeed() / 18f * 5f, Mathf.Lerp(___sprintMultiplier, 2.25f, Time.deltaTime * 1f)); } else { ___sprintMultiplier = 1f; } } } } }