Decompiled source of Aimbot v1.1.0

Aimbot.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Aimbot;
using HBMF.GameResources;
using HBMF.ModMenu;
using HarmonyLib;
using Il2Cpp;
using MelonLoader;
using MelonLoader.Preferences;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "Aimbot", "1.1.0", "korbykob", null)]
[assembly: MelonGame("GexagonVR", "Hard Bullet")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Aimbot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Aimbot")]
[assembly: AssemblyTitle("Aimbot")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Aimbot;

public class Mod : MelonMod
{
	internal static MelonPreferences_Entry<bool> enabled;

	public override void OnInitializeMelon()
	{
		enabled = MelonPreferences.CreateCategory("Aimbot").CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		Menu.CreateCategory("AIMBOT").CreateBool("ENABLE", enabled.Value, (Action<bool>)delegate(bool value)
		{
			enabled.Value = value;
		});
	}
}
[HarmonyPatch(typeof(Chamber), "FireProjectile", new Type[]
{
	typeof(EntityType),
	typeof(Vector4)
})]
public class GunPatch
{
	private static Vector3 rotation;

	public static void Prefix(Chamber __instance)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: 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_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: 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)
		if (!Mod.enabled.Value || !((Object)(object)((Component)((Component)__instance).transform).GetComponentInParent<EnemyRoot>() == (Object)null))
		{
			return;
		}
		Transform val = ((Component)__instance).transform.Find("ProjectileInstantiatePosition");
		rotation = val.localEulerAngles;
		Transform val2 = null;
		float num = -1f;
		for (int i = 0; i < GameResources.Enemies.childCount; i++)
		{
			EnemyRoot component = ((Component)GameResources.Enemies.GetChild(i)).GetComponent<EnemyRoot>();
			if (component.HealthContainer.HealthPercent > 0f)
			{
				Transform val3 = ((Component)component).transform.Find("[BODY]/PhysicalBones/head");
				Vector3 val4 = val3.position - val.position;
				float num2 = Vector3.Dot(((Vector3)(ref val4)).normalized, val.forward);
				if (num2 >= 0.85f && ((Object)(object)val2 == (Object)null || num2 > num))
				{
					val2 = val3;
					num = num2;
				}
			}
		}
		if ((Object)(object)val2 != (Object)null)
		{
			val.LookAt(val2);
		}
	}

	public static void Postfix(Chamber __instance)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		if (Mod.enabled.Value && (Object)(object)((Component)((Component)__instance).transform).GetComponentInParent<EnemyRoot>() == (Object)null)
		{
			((Component)__instance).transform.Find("ProjectileInstantiatePosition").localEulerAngles = rotation;
		}
	}
}