-
Автор темы
- #1
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
All resolvers from project-thunder kappa :D
Код:
#include "Resolver.h"
int Globals::Shots = 0;
bool Globals::change;
CUserCmd* Globals::UserCmd;
int Globals::TargetID;
IClientEntity* Globals::Target;
float YawDelta[64];
float reset[64];
float Delta[64];
float OldLowerBodyYaw[64];
float Resolved_angles[64];
int iSmart;
static int jitter = -1;
void NormalizedAngle(float& flAngle)
{
if (std::isnan(flAngle)) flAngle = 0.0f;
if (std::isinf(flAngle)) flAngle = 0.0f;
float flRevolutions = flAngle / 360;
if (flAngle > 180 || flAngle < -180)
{
if (flRevolutions < 0)
flRevolutions = -flRevolutions;
flRevolutions = round(flRevolutions);
if (flAngle < 0)
flAngle = (flAngle + 360 * flRevolutions);
else
flAngle = (flAngle - 360 * flRevolutions);
}
}
float RandomFloat(float min, float max)
{
typedef float(*RandomFloat_t)(float, float);
return ((RandomFloat_t)GetProcAddress(GetModuleHandle("vstdlib.dll"), "RandomFloat")) (min, max);
}
void R::Resolve()
{
IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
for (int i = 0; i < Interfaces::EntList->GetHighestEntityIndex(); ++i) {
IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
if (!pEntity || pEntity->IsDormant() || !pEntity->IsAlive())
continue;
if (pEntity->GetTeamNum() == pLocal->GetTeamNum() || !pLocal->IsAlive())
continue;
player_info_t pTemp;
if (!Interfaces::Engine->GetPlayerInfo(i, &pTemp))
continue;
Vector* EyeYaw = pEntity->GetEyeAnglesPointer();
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 1 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
static bool isMoving;
float PlayerIsMoving = abs(pEntity->GetVelocity().Length());
if (PlayerIsMoving > 0.1) isMoving = true;
else if (PlayerIsMoving <= 0.1) isMoving = false;
static float StoredLBY = 0.0f;
static bool bLowerBodyIsUpdated;
if (pEntity->GetLowerBodyYaw() != StoredLBY) bLowerBodyIsUpdated = true;
else bLowerBodyIsUpdated = false;
float bodyeyedelta = pEntity->GetEyeAngles().y - pEntity->GetLowerBodyYaw();
if (bLowerBodyIsUpdated || isMoving || fabsf(bodyeyedelta) >= 35.0f)
{
EyeYaw->y = pEntity->GetLowerBodyYaw();
StoredLBY = pEntity->GetLowerBodyYaw();
}
else
{
if (fabsf(bodyeyedelta) < 35.0f && fabsf(bodyeyedelta) > 0.0f)
EyeYaw->y = pEntity->GetLowerBodyYaw() + bodyeyedelta;
}
}
Vector* eyeAngles = pEntity->GetEyeAnglesPointer();
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 2 && eyeAngles->y != pEntity->GetLowerBodyYaw() || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
int value = (iSmart) % 73/*13%*/;
switch (value) {
case 0: eyeAngles->y += 0.0f; break;
case 1: eyeAngles->y += 10; break;
case 2: eyeAngles->y += 20; break;
case 3: eyeAngles->y += 30; break;
case 4: eyeAngles->y += 40; break;
case 5: eyeAngles->y += 50; break;
case 6: eyeAngles->y += 60; break;
case 7: eyeAngles->y += 70; break;
case 8: eyeAngles->y += 80; break;
case 9: eyeAngles->y += 90; break;
case 10: eyeAngles->y += 100; break;
case 11: eyeAngles->y += 110; break;
case 12: eyeAngles->y += 120; break;
case 13: eyeAngles->y += 130; break;
case 14: eyeAngles->y += 140; break;
case 15: eyeAngles->y += 150; break;
case 16: eyeAngles->y += 160; break;
case 17: eyeAngles->y += 170; break;
case 18: eyeAngles->y += 180; break;
case 19: eyeAngles->y += 190; break;
case 20: eyeAngles->y += 200; break;
case 21: eyeAngles->y += 210; break;
case 22: eyeAngles->y += 220; break;
case 23: eyeAngles->y += 230; break;
case 24: eyeAngles->y += 240; break;
case 25: eyeAngles->y += 250; break;
case 26: eyeAngles->y += 260; break;
case 27: eyeAngles->y += 270; break;
case 28: eyeAngles->y += 280; break;
case 29: eyeAngles->y += 290; break;
case 30: eyeAngles->y += 300; break;
case 31: eyeAngles->y += 310; break;
case 32: eyeAngles->y += 320; break;
case 33: eyeAngles->y += 330; break;
case 34: eyeAngles->y += 340; break;
case 35: eyeAngles->y += 350; break;
case 36: eyeAngles->y += 360; break;
case 37: eyeAngles->y += 0.0f; break;
case 38: eyeAngles->y -= 10; break;
case 39: eyeAngles->y -= 20; break;
case 40: eyeAngles->y -= 30; break;
case 41: eyeAngles->y -= 40; break;
case 42: eyeAngles->y -= 50; break;
case 43: eyeAngles->y -= 60; break;
case 44: eyeAngles->y -= 70; break;
case 45: eyeAngles->y -= 80; break;
case 46: eyeAngles->y -= 90; break;
case 47: eyeAngles->y -= 100; break;
case 48: eyeAngles->y -= 110; break;
case 49: eyeAngles->y -= 120; break;
case 50: eyeAngles->y -= 130; break;
case 51: eyeAngles->y -= 140; break;
case 52: eyeAngles->y -= 150; break;
case 53: eyeAngles->y -= 160; break;
case 54: eyeAngles->y -= 170; break;
case 55: eyeAngles->y -= 180; break;
case 56: eyeAngles->y -= 190; break;
case 57: eyeAngles->y -= 200; break;
case 58: eyeAngles->y -= 210; break;
case 59: eyeAngles->y -= 220; break;
case 60: eyeAngles->y -= 230; break;
case 61: eyeAngles->y -= 240; break;
case 62: eyeAngles->y -= 250; break;
case 63: eyeAngles->y -= 260; break;
case 64: eyeAngles->y -= 270; break;
case 65: eyeAngles->y -= 280; break;
case 66: eyeAngles->y -= 290; break;
case 67: eyeAngles->y -= 300; break;
case 68: eyeAngles->y -= 310; break;
case 69: eyeAngles->y -= 320; break;
case 70: eyeAngles->y -= 330; break;
case 71: eyeAngles->y -= 340; break;
case 72: eyeAngles->y -= 350; break;
case 73: eyeAngles->y -= 360; break;
if (jitter)
eyeAngles->y += 90;
else
eyeAngles->y + 90;
break;
if (jitter)
eyeAngles->y -= 90;
else
eyeAngles->y = -90;
break;
}
}
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 3 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
IClientEntity* ent = Interfaces::EntList->GetClientEntity(i);
for (int i = 0; i < 32; i++) {
if (!pEntity || !pEntity->IsAlive() || !(pEntity->GetEyeAngles().y >= 85.f && pEntity->GetEyeAngles().y <= 89.f))
continue;
float CurYaw = pEntity->GetLowerBodyYaw();
if (OldLowerBodyYaw[i] != CurYaw) {
Delta[i] = pEntity->GetEyeAngles().y - CurYaw;
OldLowerBodyYaw[i] = CurYaw;
*(float*)((uintptr_t)ent + 0xAA08 + 4) = CurYaw;
continue;
}
else {
*(float*)((uintptr_t)ent + 0xAA08 + 4) = pEntity->GetEyeAngles().y - Delta[i];
}
float yClamped = pEntity->GetEyeAngles().y;
while (yClamped < -180.0f)
yClamped += 360.0f;
while (yClamped > 180.0f)
yClamped -= 360.0f;
*(float*)((uintptr_t)ent + 0xAA08 + 4) = yClamped;
}
Resolved_angles[i] = *(float*)((uintptr_t)ent + 0xAA08 + 4);
}
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 4 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
int shoots = Globals::Shots;
if (shoots == 4)
{
eyeAngles->y += 45;
shoots = 0;
}
}
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 5 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
Vector* eyeAngles = pEntity->GetEyeAnglesPointer();
int num = Globals::Shots % 4;
switch (num)
{
case 0:eyeAngles->y = rand() % 360; break;
case 1:eyeAngles->y = 0; break;
case 2:eyeAngles->y = rand() % 180; break;
case 3:eyeAngles->y = 180; break;
}
}
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 6 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
IClientEntity* pClient = (IClientEntity*)Interfaces::EntList->GetClientEntity(i);
Vector* eyeAngles = pEntity->GetEyeAnglesPointer();
Vector* angs = pClient->GetEyeAnglesPointer();
static float OldLowerBodyYaws[64];
static float OldYawDeltas[64];
angs->y = pClient->GetLowerBodyYaw();
float CurYaw = pClient->GetLowerBodyYaw();
if (OldLowerBodyYaws[i] != CurYaw) {
OldYawDeltas[i] = eyeAngles->y - CurYaw;
OldLowerBodyYaws[i] = CurYaw;
eyeAngles->y = CurYaw;
continue;
}
else {
eyeAngles->y = eyeAngles->y - OldYawDeltas[i];
}
}
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 7 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
IClientEntity* ent = (IClientEntity*)Interfaces::EntList->GetClientEntity(i);
static float time_at_update[65];
int index = ent->GetIndex();
float LowerYaw = ent->GetLowerBodyYaw();
static float flTemp[65];
static float OldLowerBodyYawsX[65];
static float resolved_yaw[65];
static float OldYawDeltasX[65];
const CRecvProxyData *pData;
float flYaw = pData->m_Value.m_Float;
float simTime_since_lby_update = ent->GetSimulationTime() - time_at_update[index];
if (OldLowerBodyYawsX[index] != LowerYaw)
{
OldYawDeltasX[index] = LowerYaw - OldLowerBodyYawsX[index];
OldLowerBodyYawsX[index] = LowerYaw;
time_at_update[index] = ent->GetSimulationTime();
if (ent->GetVelocity().Length2D() > 0.1f && ent->GetFlags() & FL_ONGROUND)
{
flTemp[index] = LowerYaw;
OldLowerBodyYawsX[index] = LowerYaw;
}
else
{
flTemp[index] = OldLowerBodyYawsX[index];
}
}
else
{
flTemp[index] = LowerYaw - OldYawDeltasX[index];
}
float FixedResolve = flTemp[index];
NormalizedAngle(FixedResolve);
if (simTime_since_lby_update > 1.125f)
{
flYaw = FixedResolve;
}
else
{
if (simTime_since_lby_update <= 0.57f) // if it wasnt long ago that lby updated, just check nearby
{
resolved_yaw[index] = FixedResolve + RandomFloat(-35, 35); // -35.0 - 35.0
}
else // if its getting old info, check in a wider area
{
resolved_yaw[index] = FixedResolve + RandomFloat(-90, 90);
}
flYaw = resolved_yaw[index];
}
}
if (Menu::Window.RageBotTab.AccuracyResolverYaw.GetIndex() == 8 || Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1)
{
IClientEntity* pClient = (IClientEntity*)Interfaces::EntList->GetClientEntity(i);
CCacheAngle aCacheAngle[64];
float flYaw = pClient->GetLowerBodyYaw();
if (!pClient->IsDormant()) {
float flCurTime = Interfaces::Globals->curtime;
static float flTimeUpdate = 0.5f;
static float flNextTimeUpdate = flCurTime + flTimeUpdate;
if (flCurTime >= flNextTimeUpdate) {
aCacheAngle[i].bFlip = !aCacheAngle[i].bFlip;
}
if (flNextTimeUpdate < flCurTime || flNextTimeUpdate - flCurTime > 10.f)
flNextTimeUpdate = flCurTime + flTimeUpdate;
if (aCacheAngle[i].bFlip)
{
flYaw += 35.f;
}
else {
flYaw -= 35.f;
}
}
eyeAngles->y = flYaw;
}
if (Menu::Window.RageBotTab.AccuracyResolverPitch.GetIndex() == 1) //pitch
{
std::string strPitch = std::to_string(EyeYaw->x);
if (EyeYaw->x < -179.f) EyeYaw->x += 360.f;
else if (EyeYaw->x > 90.0 || EyeYaw->x < -90.0) EyeYaw->x = 89.f;
else if (EyeYaw->x > 89.0 && EyeYaw->x < 91.0) EyeYaw->x -= 90.f;
else if (EyeYaw->x > 179.0 && EyeYaw->x < 181.0) EyeYaw->x -= 180;
else if (EyeYaw->x > -179.0 && EyeYaw->x < -181.0) EyeYaw->x += 180;
else if (fabs(EyeYaw->x) == 0) EyeYaw->x = std::copysign(89.0f, EyeYaw->x);
}
}
}