//// BY JNIYENx9999 ////
//// Watermark: https://discord.gg/TRMS3CXwJJ ////
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
namespace AotForms //// BY JNIYENx9999 ////
//// Watermark: https://discord.gg/TRMS3CXwJJ ////
{
internal static class TELEKILL
{
private static Task upPlayerTask;
private static CancellationTokenSource cts;
private static bool isRunning = false;
internal static void Work()
{
if (isRunning) return;
isRunning = true;
cts?.Dispose();
cts = new CancellationTokenSource();
upPlayerTask = Task.Run(async () =>
{
try
{
while (!cts.Token.IsCancellationRequested)
{
if (!Config.JNIYENSPAWNKILL)/// BY JNIYENx9999 ////
//// Watermark:
https://discord.gg/TRMS3CXwJJ ////
{
await Task.Delay(10, cts.Token);
continue;
}
var closestEntity = default(Entity);
var minDistance = float.MaxValue;
if (Core.Entities == null || !Core.Entities.Any())
{
await Task.Delay(10, cts.Token);
continue;
} /// BY
JNIYENx9999 ////
////
Watermark: https://discord.gg/TRMS3CXwJJ ////
foreach (var entity in Core.Entities.Values)
{
if (!entity.IsKnown || entity.IsDead ||
(Config.IgnoreKnocked && entity.IsKnocked))
continue;
var playerDistance =
Vector3.Distance(Core.LocalMainCamera, entity.Head);
if (playerDistance > 200) continue;
if (playerDistance < minDistance)
{
minDistance = playerDistance;
closestEntity = entity;
}
}
/// BY
JNIYENx9999 ////
////
Watermark: https://discord.gg/TRMS3CXwJJ ////
if (closestEntity != null)
{
try
{
var localRootBone =
InternalMemory.Read<uint>(Core.LocalPlayer + (uint)Bones.Root, out var
localRootBonePtr);
var localTransform =
InternalMemory.Read<uint>(localRootBonePtr + 0x8, out var localTransformValue);
var localTransformObj =
InternalMemory.Read<uint>(localTransformValue + 0x8, out var localTransformObjPtr);
var localMatrix =
InternalMemory.Read<uint>(localTransformObjPtr + 0x20, out var localMatrixValue);
var enemyRootBone =
InternalMemory.Read<uint>(closestEntity.Address + (uint)Bones.Root, out var
enemyRootBonePtr);
var enemyTransform =
InternalMemory.Read<uint>(enemyRootBonePtr + 0x8, out var enemyTransformValue);
var enemyTransformObj =
InternalMemory.Read<uint>(enemyTransformValue + 0x8, out var enemyTransformObjPtr);
var enemyMatrix =
InternalMemory.Read<uint>(enemyTransformObjPtr + 0x20, out var enemyMatrixValue);
if (!Transform.GetNodePosition(enemyRootBonePtr,
out var enemyRootTransform))
{
await Task.Delay(10, cts.Token);
continue;
}
InternalMemory.Write<Vector3>(localMatrixValue +
0x80, enemyRootTransform);
}
catch (Exception)
{
await Task.Delay(10, cts.Token);
continue;
}
}
await Task.Delay(10, cts.Token);
}
}
/// BY JNIYENx9999 ////
//// Watermark: https://discord.gg/TRMS3CXwJJ ////
catch (OperationCanceledException)
{
}
catch (Exception)
{
}
finally
{
isRunning = false;
}
}, cts.Token);
}
}
}