Decompiled source of HyperVelocity v0.1.0

Hyper Velocity.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Decorators;
using PluginConfig.API.Fields;
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("UKMod template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UKMod template")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d018c2f-f5bc-47be-a844-3e9888579d1f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HyperVelocity;

[BepInPlugin("com.nico.hypervelocity", "Hyper Velocity", "0.1.0")]
public class HyperVelocityPlugin : BaseUnityPlugin
{
	public const string GUID = "com.nico.hypervelocity";

	public const string VERSION = "0.1.0";

	public static PluginConfigurator config;

	public static BoolField modifyEntityVelocity;

	public static FloatField entityVelocityModifier;

	public static BoolField modifyRagdollVelocity;

	public static FloatField ragdollVelocityModifier;

	public static BoolField modifyPlayerVelocity;

	public static FloatField playerVelocityModifier;

	private void Awake()
	{
		//IL_0026: 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: Expected O, but got Unknown
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_0089: 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_00ae: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Expected O, but got Unknown
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Expected O, but got Unknown
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Expected O, but got Unknown
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Expected O, but got Unknown
		config = PluginConfigurator.Create("Hyper Velocity", "com.nico.hypervelocity");
		new ConfigHeader(config.rootPanel, "Entity Velocity", 24);
		modifyEntityVelocity = new BoolField(config.rootPanel, "Modify Entity Velocity", "modify_entity_velocity", true);
		entityVelocityModifier = new FloatField(config.rootPanel, "Entity Velocity Modifier", "entity_velocity_modifier", 3f, 0f, 20f);
		new ConfigHeader(config.rootPanel, "Ragdoll / Debris Velocity", 24);
		modifyRagdollVelocity = new BoolField(config.rootPanel, "Modify Ragdoll/Debris Velocity", "modify_ragdoll_velocity", true);
		ragdollVelocityModifier = new FloatField(config.rootPanel, "Ragdoll/Debris Velocity Modifier", "ragdoll_velocity_modifier", 3f, 0f, 20f);
		new ConfigHeader(config.rootPanel, "Player Velocity", 24);
		modifyPlayerVelocity = new BoolField(config.rootPanel, "Modify Player Velocity", "modify_player_velocity", false);
		playerVelocityModifier = new FloatField(config.rootPanel, "Player Velocity Modifier", "player_velocity_modifier", 3f, 0f, 20f);
		Harmony val = new Harmony("com.nico.hypervelocity");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"com.nico.hypervelocity loaded.");
	}
}
public static class VelocityClassifier
{
	public static float GetMultiplier(Rigidbody rb)
	{
		if ((Object)(object)rb == (Object)null)
		{
			return 1f;
		}
		NewMovement componentInParent = ((Component)rb).GetComponentInParent<NewMovement>();
		if ((Object)(object)componentInParent != (Object)null)
		{
			if (HyperVelocityPlugin.modifyPlayerVelocity.value)
			{
				return HyperVelocityPlugin.playerVelocityModifier.value;
			}
			return 1f;
		}
		EnemyIdentifier componentInParent2 = ((Component)rb).GetComponentInParent<EnemyIdentifier>();
		if ((Object)(object)componentInParent2 != (Object)null && !componentInParent2.dead)
		{
			if (HyperVelocityPlugin.modifyEntityVelocity.value)
			{
				return HyperVelocityPlugin.entityVelocityModifier.value;
			}
			return 1f;
		}
		if (HyperVelocityPlugin.modifyRagdollVelocity.value)
		{
			return HyperVelocityPlugin.ragdollVelocityModifier.value;
		}
		return 1f;
	}
}
[HarmonyPatch(typeof(Rigidbody), "AddForce", new Type[]
{
	typeof(Vector3),
	typeof(ForceMode)
})]
public static class Rigidbody_AddForce_Patch
{
	private static void Prefix(Rigidbody __instance, ref Vector3 force, ForceMode mode)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Invalid comparison between Unknown and I4
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		if ((int)mode == 1 || (int)mode == 2)
		{
			float multiplier = VelocityClassifier.GetMultiplier(__instance);
			if (multiplier != 1f)
			{
				force *= multiplier;
			}
		}
	}
}
[HarmonyPatch(typeof(Rigidbody), "AddExplosionForce")]
public static class Rigidbody_AddExplosionForce_Patch
{
	private static void Prefix(Rigidbody __instance, ref float explosionForce)
	{
		float multiplier = VelocityClassifier.GetMultiplier(__instance);
		if (multiplier != 1f)
		{
			explosionForce *= multiplier;
		}
	}
}