From c171ab722363a1d3d14b0c81d0b453d76987ec40 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Wed, 14 Dec 2016 07:55:39 +0300 Subject: [PATCH] refactor --- uran/TODO | 1 + uran/src/entity.cpp | 5 ++- uran/src/entity.h | 3 +- uran/src/entitycache.cpp | 12 +++---- uran/src/globals.h | 1 - uran/src/hack.cpp | 21 +++++-------- uran/src/hacks/Aimbot.cpp | 42 ++++++++++++------------- uran/src/hacks/Aimbot.h | 2 +- uran/src/hacks/Airstuck.cpp | 1 - uran/src/hacks/AntiDisguise.cpp | 4 +-- uran/src/hacks/AutoHeal.cpp | 8 ++--- uran/src/hacks/AutoReflect.cpp | 14 ++++----- uran/src/hacks/AutoSticky.cpp | 4 +-- uran/src/hacks/AutoStrafe.cpp | 2 +- uran/src/hacks/Bunnyhop.cpp | 6 ++-- uran/src/hacks/ESP.cpp | 18 +++++------ uran/src/hacks/FollowBot.cpp | 26 +++++++-------- uran/src/hacks/Misc.cpp | 22 ++++++------- uran/src/hacks/SpyAlert.cpp | 6 ++-- uran/src/hacks/Trigger.cpp | 18 +++++------ uran/src/helpers.cpp | 56 ++++++++++++++++----------------- uran/src/hooks.cpp | 1 - uran/src/localplayer.cpp | 16 +++++----- uran/src/playerresource.cpp | 4 +-- uran/src/prediction.cpp | 6 ++-- uran/src/targethelper.cpp | 10 +++--- 26 files changed, 148 insertions(+), 161 deletions(-) diff --git a/uran/TODO b/uran/TODO index 6829072e..8eec041a 100644 --- a/uran/TODO +++ b/uran/TODO @@ -40,6 +40,7 @@ InsultSpam Airstuck Idle Kick fix Anti Backstab Critical rifles bodyshotting +FLAG ESP Hitbox position cache Spy alert uses angles More esp tweaking diff --git a/uran/src/entity.cpp b/uran/src/entity.cpp index d1973a63..024329ed 100644 --- a/uran/src/entity.cpp +++ b/uran/src/entity.cpp @@ -8,8 +8,7 @@ a * entity.cpp #include "copypasted/Netvar.h" #include "common.h" -// TODO globals -EntityVariables eoffsets; +EntityVariables netvar; void EntityVariables::Init() { this->iCond = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_nPlayerCond"); @@ -58,5 +57,5 @@ void EntityVariables::Init() { } void InitEntityOffsets() { - eoffsets.Init(); + netvar.Init(); } diff --git a/uran/src/entity.h b/uran/src/entity.h index 5dc55c35..f1b14eb0 100644 --- a/uran/src/entity.h +++ b/uran/src/entity.h @@ -86,7 +86,6 @@ public: offset_t test; }; -// TODO globals -extern EntityVariables eoffsets; +extern EntityVariables netvar; #endif /* ENTITY_H_ */ diff --git a/uran/src/entitycache.cpp b/uran/src/entitycache.cpp index 0b3e4eb7..0b172708 100644 --- a/uran/src/entitycache.cpp +++ b/uran/src/entitycache.cpp @@ -46,21 +46,21 @@ void CachedEntity::Update(int idx) { } m_bAlivePlayer = false; if (m_iClassID == ClassID::CTFPlayer) { - m_bAlivePlayer = !(m_bNULL || m_bDormant || GetEntityValue(m_pEntity, eoffsets.iLifeState)); - m_iTeam = Var(eoffsets.iTeamNum); // TODO + m_bAlivePlayer = !(m_bNULL || m_bDormant || GetEntityValue(m_pEntity, netvar.iLifeState)); + m_iTeam = Var(netvar.iTeamNum); // TODO m_bEnemy = (m_iTeam != g_pLocalPlayer->team); m_bIsVisible = (IsEntityVisible(m_pEntity, 0) || IsEntityVisible(m_pEntity, 4)); - m_iHealth = Var(eoffsets.iHealth); + m_iHealth = Var(netvar.iHealth); m_iMaxHealth = g_pPlayerResource->GetMaxHealth(m_pEntity); if (m_bIsVisible) m_lLastSeen = 0; else m_lLastSeen++; } if (m_iClassID == ClassID::CObjectSentrygun || m_iClassID == ClassID::CObjectDispenser || m_iClassID == ClassID::CObjectTeleporter) { - m_iTeam = Var(eoffsets.iTeamNum); // TODO + m_iTeam = Var(netvar.iTeamNum); // TODO m_bEnemy = (m_iTeam != g_pLocalPlayer->team); m_bIsVisible = (IsEntityVisible(m_pEntity, 0)); - m_iHealth = Var(eoffsets.iBuildingHealth); - m_iMaxHealth = Var(eoffsets.iBuildingMaxHealth); + m_iHealth = Var(netvar.iBuildingHealth); + m_iMaxHealth = Var(netvar.iBuildingMaxHealth); if (m_bIsVisible) m_lLastSeen = 0; else m_lLastSeen++; } diff --git a/uran/src/globals.h b/uran/src/globals.h index 87a96b1e..53833581 100644 --- a/uran/src/globals.h +++ b/uran/src/globals.h @@ -13,7 +13,6 @@ class ConVar; class GlobalSettings { public: void Init(); - // TODO ConVar* flForceFOV; ConVar* bHackEnabled; ConVar* bIgnoreTaunting; diff --git a/uran/src/hack.cpp b/uran/src/hack.cpp index 14cedb5d..34598457 100644 --- a/uran/src/hack.cpp +++ b/uran/src/hack.cpp @@ -179,7 +179,7 @@ void Hk_Shutdown(void* thisptr, const char* reason) { bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) { if (g_pLocalPlayer->entity) { if (g_pLocalPlayer->bWasZoomed) { - SetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 |= cond::zoomed); + SetEntityValue(g_pLocalPlayer->entity, netvar.iCond, g_pLocalPlayer->cond_0 |= cond::zoomed); } } bool ret = ((CreateMove_t*)hooks::hkClientMode->GetMethod(hooks::offCreateMove))(thisptr, inputSample, cmd); @@ -231,7 +231,7 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) { }*/ if (g_pLocalPlayer->entity) { if (g_Settings.bNoZoom->GetBool()) { - SetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &= ~cond::zoomed); + SetEntityValue(g_pLocalPlayer->entity, netvar.iCond, g_pLocalPlayer->cond_0 &= ~cond::zoomed); } } @@ -253,15 +253,15 @@ void hack::Hk_FrameStageNotify(void* thisptr, int stage) { //logging::Info("FrameStageNotify %i", stage); // Ambassador to festive ambassador changer. simple. if (g_pLocalPlayer->weapon) { - int defidx = GetEntityValue(g_pLocalPlayer->weapon, eoffsets.iItemDefinitionIndex); + int defidx = GetEntityValue(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex); if (defidx == 61) { - SetEntityValue(g_pLocalPlayer->weapon, eoffsets.iItemDefinitionIndex, 1006); + SetEntityValue(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex, 1006); } } ((FrameStageNotify_t*)hooks::hkClient->GetMethod(hooks::offFrameStageNotify))(thisptr, stage); if (stage == 5 && g_Settings.bNoFlinch->GetBool()) { static Vector oldPunchAngles = Vector(); - Vector punchAngles = GetEntityValue(g_pLocalPlayer->entity, eoffsets.vecPunchAngle); + Vector punchAngles = GetEntityValue(g_pLocalPlayer->entity, netvar.vecPunchAngle); QAngle viewAngles; interfaces::engineClient->GetViewAngles(viewAngles); viewAngles -= VectorToQAngle(punchAngles - oldPunchAngles); @@ -271,8 +271,8 @@ void hack::Hk_FrameStageNotify(void* thisptr, int stage) { if (g_Settings.bNoZoom->GetBool()) { if (g_pLocalPlayer->entity) { - g_pLocalPlayer->bWasZoomed = GetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed; - SetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond, g_pLocalPlayer->cond_0 &~ cond::zoomed); + g_pLocalPlayer->bWasZoomed = GetEntityValue(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed; + SetEntityValue(g_pLocalPlayer->entity, netvar.iCond, g_pLocalPlayer->cond_0 &~ cond::zoomed); } } } @@ -311,14 +311,9 @@ void hack::InitHacks() { void hack::Initialize() { logging::Initialize(); - //std::string test = ""; logging::Info("Build: " __DATE__ " " __TIME__); logging::Info("Loading shared objects..."); sharedobj::LoadAllSharedObjects(); - /* TODO */ - //logging::Info("TRYIN' SHIT"); - //CGlowObject* gom = (CGlowObject*)((uintptr_t)sharedobj::client->lmap->l_addr + 0x01FC6260); - //logging::Info("MANAGER?? 0x%08f", gom); logging::Info("Creating interfaces..."); interfaces::CreateInterfaces(); logging::Info("Interfaces created!"); @@ -368,8 +363,6 @@ void hack::Initialize() { } void hack::Think() { - //logging::Info("Hack::Think"); - // Fucking TODo usleep(250000); } diff --git a/uran/src/hacks/Aimbot.cpp b/uran/src/hacks/Aimbot.cpp index a473965e..a3f6cca7 100644 --- a/uran/src/hacks/Aimbot.cpp +++ b/uran/src/hacks/Aimbot.cpp @@ -52,7 +52,7 @@ Aimbot::Aimbot() { this->v_bSilent = CreateConVar("u_aimbot_silent", "1", "Silent mode"); this->v_bZoomedOnly = CreateConVar("u_aimbot_zoomed", "1", "Only acitve with zoomed rifle"); this->v_iAutoShootCharge = CreateConVar("u_aimbot_autoshoot_charge", "0.0", "Minimal charge for autoshoot"); - this->v_iMinRange = CreateConVar("u_aimbot_minrange", "0", "Minimum range to aim"); + this->v_iMaxRange = CreateConVar("u_aimbot_maxrange", "0", "Max distance"); this->v_bRespectCloak = CreateConVar("u_aimbot_respect_cloak", "1", "Will not shoot cloaked spies."); this->v_bCharge = CreateConVar("u_aimbot_charge", "0", "Autoshoot only with charge ready"); this->v_bEnabledAttacking = CreateConVar("u_aimbot_enable_attack_only", "0", "Aimbot only active with attack key held"); @@ -118,7 +118,7 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) { } if (IsAmbassador(g_pLocalPlayer->weapon)) { - if ((interfaces::gvars->curtime - GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flLastFireTime)) <= 1.0) { + if ((interfaces::gvars->curtime - GetEntityValue(g_pLocalPlayer->weapon, netvar.flLastFireTime)) <= 1.0) { return true; } } @@ -218,9 +218,9 @@ bool Aimbot::CreateMove(void*, float, CUserCmd* cmd) { case 3: { float scr; if (IsBuilding(ent)) { - scr = 450.0f - GetEntityValue(ent, eoffsets.iBuildingHealth); + scr = 450.0f - GetEntityValue(ent, netvar.iBuildingHealth); } else { - scr = 450.0f - GetEntityValue(ent, eoffsets.iHealth); + scr = 450.0f - GetEntityValue(ent, netvar.iHealth); } if (scr > target_highest_score) { target_highest_score = scr; @@ -244,13 +244,13 @@ void Aimbot::PaintTraverse(void*, unsigned int, bool, bool) { IClientEntity* ent = interfaces::entityList->GetClientEntity(this->m_iLastTarget); if (!ent) return; if (IsPlayer(ent)) { - int clazz = GetEntityValue(ent, eoffsets.iClass); + int clazz = GetEntityValue(ent, netvar.iClass); if (clazz < 0 || clazz > 9) return; player_info_t info; if (!interfaces::engineClient->GetPlayerInfo(this->m_iLastTarget, &info)) return; - AddCenterString(colors::yellow, colors::black, "Prey: %i HP %s (%s)", GetEntityValue(ent, eoffsets.iHealth), tfclasses[clazz], info.name); + AddCenterString(colors::yellow, colors::black, "Prey: %i HP %s (%s)", GetEntityValue(ent, netvar.iHealth), tfclasses[clazz], info.name); } else if (IsBuilding(ent)) { - AddCenterString(colors::yellow, colors::black, "Prey: %i HP LV %i %s", GetEntityValue(ent, eoffsets.iBuildingHealth), GetEntityValue(ent, eoffsets.iUpgradeLevel), GetBuildingType(ent)); + AddCenterString(colors::yellow, colors::black, "Prey: %i HP LV %i %s", GetEntityValue(ent, netvar.iBuildingHealth), GetEntityValue(ent, netvar.iUpgradeLevel), GetBuildingType(ent)); } } @@ -260,14 +260,14 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) { if (entity->IsDormant()) return false; if (IsPlayer(entity)) { if (IsPlayerInvulnerable(entity)) return false; - int team = GetEntityValue(entity, eoffsets.iTeamNum); + int team = GetEntityValue(entity, netvar.iTeamNum); int local = interfaces::engineClient->GetLocalPlayer(); IClientEntity* player = interfaces::entityList->GetClientEntity(local); - char life_state = GetEntityValue(entity, eoffsets.iLifeState); + char life_state = GetEntityValue(entity, netvar.iLifeState); if (life_state) return false; if (!player) return false; - if (v_bRespectCloak->GetBool() && (GetEntityValue(entity, eoffsets.iCond) & cond::cloaked)) return false; - int health = GetEntityValue(entity, eoffsets.iHealth); + if (v_bRespectCloak->GetBool() && (GetEntityValue(entity, netvar.iCond) & cond::cloaked)) return false; + int health = GetEntityValue(entity, netvar.iHealth); /*if (this->v_bCharge->GetBool() && (GetEntityValue(player, eoffsets.iClass) == 2)) { int rifleHandle = GetEntityValue(player, eoffsets.hActiveWeapon); IClientEntity* rifle = interfaces::entityList->GetClientEntity(rifleHandle & 0xFFF); @@ -275,14 +275,14 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) { float bdmg = GetEntityValue(rifle, eoffsets.flChargedDamage); if (health > 150 && (health > (150 + bdmg) || bdmg < 15.0f)) return false; }*/ - int team_my = GetEntityValue(player, eoffsets.iTeamNum); + int team_my = GetEntityValue(player, netvar.iTeamNum); if (team == team_my) return false; Vector enemy_pos = entity->GetAbsOrigin(); Vector my_pos = player->GetAbsOrigin(); - if (v_iMinRange->GetInt() > 0) { - if ((enemy_pos - my_pos).Length() > v_iMinRange->GetInt()) return false; + if (v_iMaxRange->GetInt() > 0) { + if ((enemy_pos - my_pos).Length() > v_iMaxRange->GetInt()) return false; } - int econd = GetEntityValue(entity, eoffsets.iCond1); + int econd = GetEntityValue(entity, netvar.iCond1); if ((econd & cond_ex::vacc_bullet)) return false; if (GetRelation(entity) == relation::FRIEND) return false; Vector resultAim; @@ -301,11 +301,11 @@ bool Aimbot::ShouldTarget(IClientEntity* entity) { return true; } else if (IsBuilding(entity)) { if (!v_bAimBuildings->GetBool()) return false; - int team = GetEntityValue(entity, eoffsets.iTeamNum); + int team = GetEntityValue(entity, netvar.iTeamNum); if (team == g_pLocalPlayer->team) return false; Vector enemy_pos = entity->GetAbsOrigin(); - if (v_iMinRange->GetInt() > 0) { - if ((enemy_pos - g_pLocalPlayer->v_Origin).Length() > v_iMinRange->GetInt()) return false; + if (v_iMaxRange->GetInt() > 0) { + if ((enemy_pos - g_pLocalPlayer->v_Origin).Length() > v_iMaxRange->GetInt()) return false; } Vector resultAim; // TODO fix proj buildings @@ -370,9 +370,9 @@ bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) { if (g_pLocalPlayer->clazz == tf_class::tf_sniper) { if (g_pLocalPlayer->cond_0 & cond::zoomed) { if (this->v_iAutoShootCharge->GetBool()) { - int rifleHandle = GetEntityValue(local, eoffsets.hActiveWeapon); + int rifleHandle = GetEntityValue(local, netvar.hActiveWeapon); IClientEntity* rifle = interfaces::entityList->GetClientEntity(rifleHandle & 0xFFF); - float bdmg = GetEntityValue(rifle, eoffsets.flChargedDamage); + float bdmg = GetEntityValue(rifle, netvar.flChargedDamage); if (bdmg < this->v_iAutoShootCharge->GetFloat()) return true; } else { if (!CanHeadshot(g_pLocalPlayer->entity)) return true; @@ -380,7 +380,7 @@ bool Aimbot::Aim(IClientEntity* entity, CUserCmd* cmd) { } } if (g_pLocalPlayer->weapon && g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == ClassID::CTFCompoundBow) { - float begincharge = GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flChargeBeginTime); + float begincharge = GetEntityValue(g_pLocalPlayer->weapon, netvar.flChargeBeginTime); float charge = 0; if (begincharge != 0) { charge = interfaces::gvars->curtime - begincharge; diff --git a/uran/src/hacks/Aimbot.h b/uran/src/hacks/Aimbot.h index 72a0cf3c..d810a7c4 100644 --- a/uran/src/hacks/Aimbot.h +++ b/uran/src/hacks/Aimbot.h @@ -54,7 +54,7 @@ public: ConVar* v_bZoomedOnly; ConVar* v_iAutoShootCharge; ConVar* v_flAutoShootHuntsmanCharge; - ConVar* v_iMinRange; + ConVar* v_iMaxRange; ConVar* v_bRespectCloak; ConVar* v_bCharge; ConVar* v_bEnabledAttacking; diff --git a/uran/src/hacks/Airstuck.cpp b/uran/src/hacks/Airstuck.cpp index 1456b4b3..d32aa68a 100644 --- a/uran/src/hacks/Airstuck.cpp +++ b/uran/src/hacks/Airstuck.cpp @@ -23,7 +23,6 @@ const char* Airstuck::GetName() { } bool Airstuck::CreateMove(void*, float, CUserCmd* cmd) { - // TODO Airstuck. interfaces::cvar->FindVar("net_fakeloss")->SetValue(0); interfaces::cvar->FindVar("host_timescale")->SetValue(1.0f); if (v_bStuck->GetBool()) { diff --git a/uran/src/hacks/AntiDisguise.cpp b/uran/src/hacks/AntiDisguise.cpp index f0a3e93d..9c778e31 100644 --- a/uran/src/hacks/AntiDisguise.cpp +++ b/uran/src/hacks/AntiDisguise.cpp @@ -26,8 +26,8 @@ void AntiDisguise::PaintTraverse(void*, unsigned int, bool, bool) { IClientEntity* ent = interfaces::entityList->GetClientEntity(i); if (!ent) continue; if (ent->GetClientClass()->m_ClassID == ClassID::CTFPlayer) { - if (GetEntityValue(ent, eoffsets.iClass) == tf_class::tf_spy) { - SetEntityValue(ent, eoffsets.iCond, GetEntityValue(ent, eoffsets.iCond) &~ cond::disguised); + if (GetEntityValue(ent, netvar.iClass) == tf_class::tf_spy) { + SetEntityValue(ent, netvar.iCond, GetEntityValue(ent, netvar.iCond) &~ cond::disguised); } } } diff --git a/uran/src/hacks/AutoHeal.cpp b/uran/src/hacks/AutoHeal.cpp index 9c1f8c6b..7f297a82 100644 --- a/uran/src/hacks/AutoHeal.cpp +++ b/uran/src/hacks/AutoHeal.cpp @@ -33,7 +33,7 @@ int AutoHeal::GetHealingPriority(int idx) { if (!CanHeal(idx)) return -1; IClientEntity* ent = interfaces::entityList->GetClientEntity(idx); int priority = 0; - int health = GetEntityValue(ent, eoffsets.iHealth); + int health = GetEntityValue(ent, netvar.iHealth); int maxhealth = g_pPlayerResource->GetMaxHealth(ent); int maxbuffedhealth = maxhealth * 1.5; int maxoverheal = maxbuffedhealth - maxhealth; @@ -54,11 +54,11 @@ bool AutoHeal::CanHeal(int idx) { IClientEntity* ent = interfaces::entityList->GetClientEntity(idx); if (!ent) return false; if (ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) return false; - if (GetEntityValue(ent, eoffsets.iLifeState)) return false; - if (g_pLocalPlayer->team != GetEntityValue(ent, eoffsets.iTeamNum)) return false; + if (GetEntityValue(ent, netvar.iLifeState)) return false; + if (g_pLocalPlayer->team != GetEntityValue(ent, netvar.iTeamNum)) return false; if (g_pLocalPlayer->v_Origin.DistToSqr(ent->GetAbsOrigin()) > 420 * 420) return false; if (!IsEntityVisible(ent, 7)) return false; - if (GetEntityValue(ent, eoffsets.iCond) & cond::cloaked) return false; + if (GetEntityValue(ent, netvar.iCond) & cond::cloaked) return false; return true; } diff --git a/uran/src/hacks/AutoReflect.cpp b/uran/src/hacks/AutoReflect.cpp index 528d9749..5b978ce4 100644 --- a/uran/src/hacks/AutoReflect.cpp +++ b/uran/src/hacks/AutoReflect.cpp @@ -25,24 +25,24 @@ bool AutoReflect::ShouldReflect(IClientEntity* ent) { case ClassID::CTFProjectile_Rocket: case ClassID::CTFProjectile_SentryRocket: case ClassID::CTFProjectile_EnergyBall: { - int deflected = GetEntityValue(ent, eoffsets.Rocket_iDeflected); + int deflected = GetEntityValue(ent, netvar.Rocket_iDeflected); if (deflected) return false; // TODO deflected by enemy player - if (GetEntityValue(ent, eoffsets.iTeamNum) == g_pLocalPlayer->team) return false; + if (GetEntityValue(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false; return true; } break; case ClassID::CTFProjectile_Cleaver: case ClassID::CTFProjectile_Jar: case ClassID::CTFProjectile_JarMilk: { - int deflected = GetEntityValue(ent, eoffsets.Rocket_iDeflected); + int deflected = GetEntityValue(ent, netvar.Rocket_iDeflected); if (deflected) return false; - if (GetEntityValue(ent, eoffsets.iTeamNum) == g_pLocalPlayer->team) return false; + if (GetEntityValue(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false; return true; } break; case ClassID::CTFGrenadePipebombProjectile: { - int deflected = GetEntityValue(ent, eoffsets.Rocket_iDeflected); + int deflected = GetEntityValue(ent, netvar.Rocket_iDeflected); if (deflected) return false; - if (GetEntityValue(ent, eoffsets.iTeamNum) == g_pLocalPlayer->team) return false; - if (GetEntityValue(ent, eoffsets.iPipeType) == 1) { + if (GetEntityValue(ent, netvar.iTeamNum) == g_pLocalPlayer->team) return false; + if (GetEntityValue(ent, netvar.iPipeType) == 1) { if (!v_bReflectStickies->GetBool()) return false; } return true; diff --git a/uran/src/hacks/AutoSticky.cpp b/uran/src/hacks/AutoSticky.cpp index eec5112a..aa5d29f6 100644 --- a/uran/src/hacks/AutoSticky.cpp +++ b/uran/src/hacks/AutoSticky.cpp @@ -30,7 +30,7 @@ bool AutoSticky::ShouldDetonate(IClientEntity* bomb) { CachedEntity* ent = gEntityCache.GetEntity(i); if (ent->m_bNULL) continue; if (ent->m_iClassID != ClassID::CTFPlayer && !(this->v_bBuildings->GetBool() && IsBuilding(ent->m_pEntity))) continue; - if (ent->m_iTeam == GetEntityValue(bomb, eoffsets.iTeamNum)) continue; + if (ent->m_iTeam == GetEntityValue(bomb, netvar.iTeamNum)) continue; if (ent->m_pEntity->GetAbsOrigin().DistToSqr(bomb->GetAbsOrigin()) > this->v_flDetonateDistance->GetFloat() * this->v_flDetonateDistance->GetFloat()) continue; return true; } @@ -44,7 +44,7 @@ bool AutoSticky::CreateMove(void*, float, CUserCmd* cmd) { if (ent->m_bNULL) continue; if (ent->m_iClassID != ClassID::CTFGrenadePipebombProjectile) continue; if (g_pLocalPlayer->entity) { - IClientEntity* owner = interfaces::entityList->GetClientEntity(ent->Var(eoffsets.hThrower) & 0xFFF); + IClientEntity* owner = interfaces::entityList->GetClientEntity(ent->Var(netvar.hThrower) & 0xFFF); //logging::Info("Owner: 0x%08x", owner); if (!owner) continue; if (owner != g_pLocalPlayer->entity) continue; diff --git a/uran/src/hacks/AutoStrafe.cpp b/uran/src/hacks/AutoStrafe.cpp index df45771c..61720301 100644 --- a/uran/src/hacks/AutoStrafe.cpp +++ b/uran/src/hacks/AutoStrafe.cpp @@ -24,7 +24,7 @@ bool AutoStrafe::CreateMove(void*, float, CUserCmd* cmd) { if (!v_bEnabled->GetBool()) return true; if (g_pLocalPlayer->entity && !g_pLocalPlayer->life_state) { // TODO FL_ONGROUND - if (GetEntityValue(g_pLocalPlayer->entity, eoffsets.iFlags) & (1 << 0)) return true; + if (GetEntityValue(g_pLocalPlayer->entity, netvar.iFlags) & (1 << 0)) return true; if (abs(cmd->mousedx) > 1) { cmd->sidemove = (cmd->mousedx) < 0.0f ? -450.0f : 450.0f; } diff --git a/uran/src/hacks/Bunnyhop.cpp b/uran/src/hacks/Bunnyhop.cpp index 311aeb8a..e2d110c8 100644 --- a/uran/src/hacks/Bunnyhop.cpp +++ b/uran/src/hacks/Bunnyhop.cpp @@ -28,12 +28,12 @@ bool Bunnyhop::CreateMove(void* thisptr, float sampling, CUserCmd* cmd) { if (!this->v_bEnabled->GetBool()) return true; int player = interfaces::engineClient->GetLocalPlayer(); IClientEntity* entity = interfaces::entityList->GetClientEntity(player); - int cond3 = GetEntityValue(entity, eoffsets.iCond3); + int cond3 = GetEntityValue(entity, netvar.iCond3); if (cond3 & cond_ex3::grappling) return true; - int flags = GetEntityValue(entity, eoffsets.iFlags); + int flags = GetEntityValue(entity, netvar.iFlags); if (v_bAutoJump->GetBool()) { - Vector vel = GetEntityValue(g_pLocalPlayer->entity, eoffsets.vVelocity); + Vector vel = GetEntityValue(g_pLocalPlayer->entity, netvar.vVelocity); if (sqrt((vel.x * vel.x + vel.y * vel.y)) > v_iAutoJumpSpeed->GetInt()) { cmd->buttons |= IN_JUMP; } diff --git a/uran/src/hacks/ESP.cpp b/uran/src/hacks/ESP.cpp index 626df35a..e716dc1e 100644 --- a/uran/src/hacks/ESP.cpp +++ b/uran/src/hacks/ESP.cpp @@ -111,12 +111,12 @@ void ESP::ProcessEntityPT(CachedEntity* ent) { switch (ent->m_iClassID) { case ClassID::CTFPlayer: { if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team && !GetRelation(ent->m_pEntity)) { - if (ent->Var(eoffsets.iCond) & cond::cloaked) return; + if (ent->Var(netvar.iCond) & cond::cloaked) return; if (ent->m_lLastSeen > v_iLegitSeenTicks->GetInt()) { return; } } - if (ent->Var(eoffsets.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool() && !GetRelation(ent->m_pEntity)) break; + if (ent->Var(netvar.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool() && !GetRelation(ent->m_pEntity)) break; if (!ent->m_bAlivePlayer) break; color = colors::GetTeamColor(ent->m_iTeam, !ent->m_bIsVisible); switch (GetRelation(ent->m_pEntity)) { @@ -127,7 +127,7 @@ void ESP::ProcessEntityPT(CachedEntity* ent) { color = colors::yellow; break; } - DrawBox(ent, color, 3.0f, -15.0f, true, ent->Var(eoffsets.iHealth), ent->m_iMaxHealth); + DrawBox(ent, color, 3.0f, -15.0f, true, ent->Var(netvar.iHealth), ent->m_iMaxHealth); break; } case ClassID::CObjectSentrygun: @@ -138,9 +138,9 @@ void ESP::ProcessEntityPT(CachedEntity* ent) { return; } } - if (ent->Var(eoffsets.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool()) break; - color = colors::GetTeamColor(ent->Var(eoffsets.iTeamNum), !ent->m_bIsVisible); - DrawBox(ent, color, 1.0f, 0.0f, true, ent->Var(eoffsets.iBuildingHealth), ent->Var(eoffsets.iBuildingMaxHealth)); + if (ent->Var(netvar.iTeamNum) == g_pLocalPlayer->team && !v_bTeammates->GetBool()) break; + color = colors::GetTeamColor(ent->Var(netvar.iTeamNum), !ent->m_bIsVisible); + DrawBox(ent, color, 1.0f, 0.0f, true, ent->Var(netvar.iBuildingHealth), ent->Var(netvar.iBuildingMaxHealth)); break; } } @@ -214,8 +214,8 @@ void ESP::ProcessEntity(CachedEntity* ent) { case ClassID::CTFPlayer: { if (!ent->m_bAlivePlayer) break; if (ent->m_IDX == interfaces::engineClient->GetLocalPlayer()) break; - int pclass = ent->Var(eoffsets.iClass); - int pcond = ent->Var(eoffsets.iCond); + int pclass = ent->Var(netvar.iClass); + int pcond = ent->Var(netvar.iCond); player_info_t info; if (!interfaces::engineClient->GetPlayerInfo(ent->m_IDX, &info)) return; powerup_type power = GetPowerupOnPlayer(ent->m_pEntity); @@ -270,7 +270,7 @@ void ESP::ProcessEntity(CachedEntity* ent) { case ClassID::CObjectDispenser: case ClassID::CObjectTeleporter: { if (!ent->m_bEnemy && !v_bTeammates->GetBool()) break; - int level = ent->Var(eoffsets.iUpgradeLevel); + int level = ent->Var(netvar.iUpgradeLevel); const char* name = (ent->m_iClassID == 89 ? "Teleporter" : (ent->m_iClassID == 88 ? "Sentry Gun" : "Dispenser")); color = colors::GetTeamColor(ent->m_iTeam, !ent->m_bIsVisible); if (v_bLegit->GetBool() && ent->m_iTeam != g_pLocalPlayer->team) { diff --git a/uran/src/hacks/FollowBot.cpp b/uran/src/hacks/FollowBot.cpp index 5acb7b03..bc468731 100644 --- a/uran/src/hacks/FollowBot.cpp +++ b/uran/src/hacks/FollowBot.cpp @@ -33,7 +33,7 @@ bool FollowBot::ShouldPopUber(bool force) { IClientEntity* ent = interfaces::entityList->GetClientEntity(i); if (ent == g_pLocalPlayer->entity) continue; if (IsFriendlyBot(ent)) { - if (GetEntityValue(ent, eoffsets.iLifeState)) continue; + if (GetEntityValue(ent, netvar.iLifeState)) continue; //IClientEntity* medigun; // TODO } @@ -83,8 +83,8 @@ void FollowBot::ProcessEntity(IClientEntity* entity, bool enemy) { int FollowBot::ShouldNotTarget(IClientEntity* ent, bool notrace) { if (!ent || ent->IsDormant()) return 1; if (ent->GetClientClass()->m_ClassID != 241) return 2; - if (GetEntityValue(ent, eoffsets.iLifeState)) return 3; - bool enemy = GetEntityValue(ent, eoffsets.iTeamNum) != g_pLocalPlayer->team; + if (GetEntityValue(ent, netvar.iLifeState)) return 3; + bool enemy = GetEntityValue(ent, netvar.iTeamNum) != g_pLocalPlayer->team; if (enemy) return 4; if (!this->IsOwner(ent)) { @@ -142,15 +142,15 @@ void FollowBot::Tick(CUserCmd* cmd) { if (!owner_entity) break; //bool owner_zoomed = (GetEntityValue(owner_entity, eoffsets.iCond) & cond::zoomed); // - if (IClientEntity* weapon = interfaces::entityList->GetClientEntity(GetEntityValue(owner_entity, eoffsets.hActiveWeapon) & 0xFFF)) { + if (IClientEntity* weapon = interfaces::entityList->GetClientEntity(GetEntityValue(owner_entity, netvar.hActiveWeapon) & 0xFFF)) { if (weapon) { if (weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle || weapon->GetClientClass()->m_ClassID == ClassID::CTFSniperRifle) { - bool bot_zoomed = (GetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed); + bool bot_zoomed = (GetEntityValue(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed); if (!bot_zoomed) { cmd->buttons |= IN_ATTACK2; } } else { - bool bot_zoomed = (GetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed); + bool bot_zoomed = (GetEntityValue(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed); if (bot_zoomed) { cmd->buttons |= IN_ATTACK2; } @@ -167,7 +167,7 @@ void FollowBot::Tick(CUserCmd* cmd) { IClientEntity* healtr = this->GetBestHealingTarget(); m_hTargetHealing = (healtr ? healtr->entindex() : 0); if (healtr) { - if (GetEntityValue(healtr, eoffsets.iHealth) < 35 && !GetEntityValue(healtr, eoffsets.iLifeState)) { + if (GetEntityValue(healtr, netvar.iHealth) < 35 && !GetEntityValue(healtr, netvar.iLifeState)) { m_iShouldUbercharge = 1; } if (g_pLocalPlayer->health < 35) { @@ -179,7 +179,7 @@ void FollowBot::Tick(CUserCmd* cmd) { if (owner_entity && (0 == (g_nTick % 20))) { static bool forward = false; static bool jump = false; - if (!jump && GetEntityValue(g_pLocalPlayer->entity, eoffsets.vVelocity).IsZero(10.0f) && !(GetEntityValue(g_pLocalPlayer->entity, eoffsets.iCond) & cond::zoomed)) { + if (!jump && GetEntityValue(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(10.0f) && !(GetEntityValue(g_pLocalPlayer->entity, netvar.iCond) & cond::zoomed)) { interfaces::engineClient->ExecuteClientCmd("+jump"); jump = true; } else if (jump) { @@ -249,8 +249,8 @@ IClientEntity* FollowBot::GetBestHealingTarget() { for (int i = 0; i < 64 && i < interfaces::entityList->GetHighestEntityIndex(); i++) { IClientEntity* cur = interfaces::entityList->GetClientEntity(i); if (cur && cur->GetClientClass()->m_ClassID == ClassID::CTFPlayer) { - if (GetEntityValue(cur, eoffsets.iTeamNum) != g_pLocalPlayer->team) continue; - if (GetEntityValue(cur, eoffsets.iLifeState)) continue; + if (GetEntityValue(cur, netvar.iTeamNum) != g_pLocalPlayer->team) continue; + if (GetEntityValue(cur, netvar.iLifeState)) continue; if (cur == g_pLocalPlayer->entity) continue; int score = this->GetHealingPriority(cur); if (score > best_score && score != 0) { @@ -275,11 +275,11 @@ int FollowBot::GetHealingPriority(IClientEntity* ent) { if (!ent) return 0; int result = 0; - if (GetEntityValue(ent, eoffsets.iLifeState)) return 0; - if (GetEntityValue(ent, eoffsets.iTeamNum) != g_pLocalPlayer->team) return 0; + if (GetEntityValue(ent, netvar.iLifeState)) return 0; + if (GetEntityValue(ent, netvar.iTeamNum) != g_pLocalPlayer->team) return 0; if (!IsEntityVisible(ent, 4)) return 0; - int health = GetEntityValue(ent, eoffsets.iHealth); + int health = GetEntityValue(ent, netvar.iHealth); int maxhealth = g_pPlayerResource->GetMaxHealth(ent); int maxbuffedhealth = maxhealth * 1.5; int maxoverheal = maxbuffedhealth - maxhealth; diff --git a/uran/src/hacks/Misc.cpp b/uran/src/hacks/Misc.cpp index e7cf576a..6d0beee6 100644 --- a/uran/src/hacks/Misc.cpp +++ b/uran/src/hacks/Misc.cpp @@ -208,8 +208,8 @@ void CC_DisonnectVAC(const CCommand& args) { void CC_DumpAttribs(const CCommand& args) { if (g_pLocalPlayer->weapon) { for (int i = 0; i < 15; i++) { - logging::Info("%i %f", GetEntityValue(g_pLocalPlayer->weapon, eoffsets.AttributeList + i * 12), - GetEntityValue(g_pLocalPlayer->weapon, eoffsets.AttributeList + i * 12 + 4)); + logging::Info("%i %f", GetEntityValue(g_pLocalPlayer->weapon, netvar.AttributeList + i * 12), + GetEntityValue(g_pLocalPlayer->weapon, netvar.AttributeList + i * 12 + 4)); } } } @@ -285,7 +285,7 @@ bool Misc::CreateMove(void*, float, CUserCmd* cmd) { //logging::Info("a"); if (ent->GetClientClass()->m_ClassID != ClassID::CTFPlayer) goto breakif; //logging::Info("a"); - if (GetEntityValue(ent, eoffsets.iTeamNum) == g_pLocalPlayer->team) goto breakif; + if (GetEntityValue(ent, netvar.iTeamNum) == g_pLocalPlayer->team) goto breakif; //logging::Info("Making string for %i", curindex); const char* str = MakeInfoString(ent); if (str) { @@ -309,26 +309,26 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) { if (g_pLocalPlayer->weapon) { IClientEntity* weapon = g_pLocalPlayer->weapon; AddSideString(draw::white, draw::black, "Weapon: %s [%i]", weapon->GetClientClass()->GetName(), weapon->GetClientClass()->m_ClassID); - AddSideString(draw::white, draw::black, "flNextPrimaryAttack: %f", GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flNextPrimaryAttack)); - AddSideString(draw::white, draw::black, "nTickBase: %f", (float)(GetEntityValue(g_pLocalPlayer->entity, eoffsets.nTickBase)) * interfaces::gvars->interval_per_tick); + AddSideString(draw::white, draw::black, "flNextPrimaryAttack: %f", GetEntityValue(g_pLocalPlayer->weapon, netvar.flNextPrimaryAttack)); + AddSideString(draw::white, draw::black, "nTickBase: %f", (float)(GetEntityValue(g_pLocalPlayer->entity, netvar.nTickBase)) * interfaces::gvars->interval_per_tick); AddSideString(draw::white, draw::black, "CanShoot: %i", BulletTime()); - AddSideString(draw::white, draw::black, "Decaps: %i", GetEntityValue(g_pLocalPlayer->entity, eoffsets.iDecapitations)); - AddSideString(draw::white, draw::black, "Damage: %f", GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flChargedDamage)); - AddSideString(draw::white, draw::black, "DefIndex: %i", GetEntityValue(g_pLocalPlayer->weapon, eoffsets.iItemDefinitionIndex)); + AddSideString(draw::white, draw::black, "Decaps: %i", GetEntityValue(g_pLocalPlayer->entity, netvar.iDecapitations)); + AddSideString(draw::white, draw::black, "Damage: %f", GetEntityValue(g_pLocalPlayer->weapon, netvar.flChargedDamage)); + AddSideString(draw::white, draw::black, "DefIndex: %i", GetEntityValue(g_pLocalPlayer->weapon, netvar.iItemDefinitionIndex)); AddSideString(draw::white, draw::black, "GlobalVars: 0x%08x", interfaces::gvars); AddSideString(draw::white, draw::black, "realtime: %f", interfaces::gvars->realtime); AddSideString(draw::white, draw::black, "interval_per_tick: %f", interfaces::gvars->interval_per_tick); - AddSideString(draw::white, draw::black, "ambassador_can_headshot: %i", (interfaces::gvars->curtime - GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flLastFireTime)) > 0.95); + AddSideString(draw::white, draw::black, "ambassador_can_headshot: %i", (interfaces::gvars->curtime - GetEntityValue(g_pLocalPlayer->weapon, netvar.flLastFireTime)) > 0.95); AddSideString(draw::white, draw::black, "WeaponMode: %i", GetWeaponMode(g_pLocalPlayer->entity)); AddSideString(draw::white, draw::black, "ToGround: %f", DistanceToGround(g_pLocalPlayer->v_Origin)); - AddSideString(draw::white, draw::black, "ServerTime: %f", GetEntityValue(g_pLocalPlayer->entity, eoffsets.nTickBase) * interfaces::gvars->interval_per_tick); + AddSideString(draw::white, draw::black, "ServerTime: %f", GetEntityValue(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick); AddSideString(draw::white, draw::black, "CurTime: %f", interfaces::gvars->curtime); float speed, gravity; GetProjectileData(g_pLocalPlayer->weapon, speed, gravity); AddSideString(draw::white, draw::black, "Speed: %f", speed); AddSideString(draw::white, draw::black, "Gravity: %f", gravity); AddSideString(draw::white, draw::black, "IsZoomed: %i", g_pLocalPlayer->bWasZoomed); - AddSideString(draw::white, draw::black, "???: %f", GetEntityValue(g_pLocalPlayer->entity, eoffsets.test)); + AddSideString(draw::white, draw::black, "???: %f", GetEntityValue(g_pLocalPlayer->entity, netvar.test)); //AddSideString(draw::white, draw::black, "VecPunchAngle: %f %f %f", pa.x, pa.y, pa.z); //draw::DrawString(10, y, draw::white, draw::black, false, "VecPunchAngleVel: %f %f %f", pav.x, pav.y, pav.z); //y += 14; diff --git a/uran/src/hacks/SpyAlert.cpp b/uran/src/hacks/SpyAlert.cpp index 4abdc6d5..f1a4f0fe 100644 --- a/uran/src/hacks/SpyAlert.cpp +++ b/uran/src/hacks/SpyAlert.cpp @@ -29,9 +29,9 @@ void SpyAlert::PaintTraverse(void*, unsigned int, bool, bool) { for (int i = 0; i < interfaces::entityList->GetHighestEntityIndex() && i < 64; i++) { IClientEntity* ent = interfaces::entityList->GetClientEntity(i); if (!ent) continue; - if (GetEntityValue(ent, eoffsets.iLifeState)) continue; - if (GetEntityValue(ent, eoffsets.iClass) != tf_class::tf_spy) continue; - if (GetEntityValue(ent, eoffsets.iTeamNum) == g_pLocalPlayer->team) continue; + if (GetEntityValue(ent, netvar.iLifeState)) continue; + if (GetEntityValue(ent, netvar.iClass) != tf_class::tf_spy) continue; + if (GetEntityValue(ent, netvar.iTeamNum) == g_pLocalPlayer->team) continue; Vector spypos = ent->GetAbsOrigin(); Vector mypos = g_pLocalPlayer->v_Origin; float distance = spypos.DistTo(mypos); diff --git a/uran/src/hacks/Trigger.cpp b/uran/src/hacks/Trigger.cpp index 83c24462..f42991d1 100644 --- a/uran/src/hacks/Trigger.cpp +++ b/uran/src/hacks/Trigger.cpp @@ -60,21 +60,21 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) { if (!entity) return true; bool isPlayer = false; switch (entity->GetClientClass()->m_ClassID) { - case 241: + case ClassID::CTFPlayer: isPlayer = true; break; - case 89: - case 88: - case 86: + case ClassID::CObjectTeleporter: + case ClassID::CObjectSentrygun: + case ClassID::CObjectDispenser: if (!this->v_bBuildings->GetBool()) { return true; } break; default: return true; - }; // TODO magic number + }; int team = g_pLocalPlayer->team; - int eteam = GetEntityValue(entity, eoffsets.iTeamNum); + int eteam = GetEntityValue(entity, netvar.iTeamNum); if (team == eteam) return true; Vector enemy_pos = entity->GetAbsOrigin(); Vector my_pos = g_pLocalPlayer->entity->GetAbsOrigin(); @@ -88,8 +88,8 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) { if (GetRelation(entity) == relation::FRIEND) return true; if (IsPlayerInvulnerable(entity)) return true; if (!this->v_bIgnoreCloak->GetBool() && - ((GetEntityValue(entity, eoffsets.iCond)) & cond::cloaked)) return true; - int health = GetEntityValue(entity, eoffsets.iHealth); + ((GetEntityValue(entity, netvar.iCond)) & cond::cloaked)) return true; + int health = GetEntityValue(entity, netvar.iHealth); bool bodyshot = false; if (g_pLocalPlayer->clazz == tf_class::tf_sniper) { // If sniper.. @@ -98,7 +98,7 @@ bool Triggerbot::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) { } // If we need charge... if (!bodyshot && this->v_bBodyshot->GetBool()) { - float bdmg = GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flChargedDamage); + float bdmg = GetEntityValue(g_pLocalPlayer->weapon, netvar.flChargedDamage); if (CanHeadshot(g_pLocalPlayer->entity) && (bdmg) >= health) { bodyshot = true; } diff --git a/uran/src/helpers.cpp b/uran/src/helpers.cpp index 0c19bd07..13702ae4 100644 --- a/uran/src/helpers.cpp +++ b/uran/src/helpers.cpp @@ -26,8 +26,8 @@ void EndConVars() { bool IsPlayerInvulnerable(IClientEntity* player) { - int cond1 = GetEntityValue(player, eoffsets.iCond); - int cond2 = GetEntityValue(player, eoffsets.iCond1); + int cond1 = GetEntityValue(player, netvar.iCond); + int cond2 = GetEntityValue(player, netvar.iCond1); int uber_mask_1 = (cond::uber | cond::bonk); int uber_mask_2 = (cond_ex::hidden_uber | cond_ex::canteen_uber | cond_ex::misc_uber | cond_ex::phlog_uber); if ((cond1 & uber_mask_1) || (cond2 & uber_mask_2)) { @@ -39,9 +39,9 @@ bool IsPlayerInvulnerable(IClientEntity* player) { } bool IsPlayerCritBoosted(IClientEntity* player) { - int cond1 = GetEntityValue(player, eoffsets.iCond); - int cond2 = GetEntityValue(player, eoffsets.iCond1); - int cond4 = GetEntityValue(player, eoffsets.iCond3); + int cond1 = GetEntityValue(player, netvar.iCond); + int cond2 = GetEntityValue(player, netvar.iCond1); + int cond4 = GetEntityValue(player, netvar.iCond3); int crit_mask_1 = (cond::kritzkrieg); int crit_mask_2 = (cond_ex::halloween_crit | cond_ex::canteen_crit | cond_ex::first_blood_crit | cond_ex::winning_crit | cond_ex::intelligence_crit | cond_ex::on_kill_crit | cond_ex::phlog_crit | cond_ex::misc_crit); @@ -197,8 +197,8 @@ powerup_type GetPowerupType(IClientEntity* ent) { powerup_type GetPowerupOnPlayer(IClientEntity* player) { if (!player) return powerup_type::not_powerup; - uint32_t cond2 = GetEntityValue(player, eoffsets.iCond2); - uint32_t cond3 = GetEntityValue(player, eoffsets.iCond3); + uint32_t cond2 = GetEntityValue(player, netvar.iCond2); + uint32_t cond3 = GetEntityValue(player, netvar.iCond3); //if (!(cond2 & cond_ex2::powerup_generic)) return powerup_type::not_powerup; if (cond2 & cond_ex2::powerup_strength) return powerup_type::strength; if (cond2 & cond_ex2::powerup_haste) return powerup_type::haste; @@ -231,7 +231,7 @@ int GetHitboxPosition(IClientEntity* entity, int hb, Vector& out) { if (!shdr) return 2; // TODO rewrite - mstudiohitboxset_t* set = shdr->pHitboxSet(GetEntityValue(entity, eoffsets.iHitboxSet)); + mstudiohitboxset_t* set = shdr->pHitboxSet(GetEntityValue(entity, netvar.iHitboxSet)); if (!set) return 4; mstudiobbox_t* box = set->pHitbox(hb); if (!box) return 5; @@ -314,7 +314,7 @@ bool IsEntityVisible(IClientEntity* entity, int hb) { //logging::Info("Couldn't get hitbox position: %i", hb); return false; } - ray.Init(local->GetAbsOrigin() + GetEntityValue(local, eoffsets.vViewOffset), hit); + ray.Init(local->GetAbsOrigin() + GetEntityValue(local, netvar.vViewOffset), hit); interfaces::trace->TraceRay(ray, 0x4200400B, trace_filter, &trace_visible); if (trace_visible.m_pEnt) { return ((IClientEntity*)trace_visible.m_pEnt) == entity; @@ -332,7 +332,7 @@ Vector GetBuildingPosition(IClientEntity* ent) { res.z += 8; break; case ClassID::CObjectSentrygun: - switch (GetEntityValue(ent, eoffsets.iUpgradeLevel)) { + switch (GetEntityValue(ent, netvar.iUpgradeLevel)) { case 1: res.z += 30; break; @@ -411,8 +411,8 @@ float DistToSqr(IClientEntity* entity) { weaponmode GetWeaponMode(IClientEntity* player) { if (!player) return weapon_invalid; - int weapon_handle = GetEntityValue(player, eoffsets.hActiveWeapon); - if (weapon_handle == GetEntityValue(player, eoffsets.hMyWeapons + sizeof(int) * 2)) return weaponmode::weapon_melee; + int weapon_handle = GetEntityValue(player, netvar.hActiveWeapon); + if (weapon_handle == GetEntityValue(player, netvar.hMyWeapons + sizeof(int) * 2)) return weaponmode::weapon_melee; IClientEntity* weapon = interfaces::entityList->GetClientEntity(weapon_handle & 0xFFF); if (!weapon) return weaponmode::weapon_invalid; switch (weapon->GetClientClass()->m_ClassID) { @@ -431,9 +431,9 @@ weaponmode GetWeaponMode(IClientEntity* player) { case ClassID::CTFSyringeGun: return weaponmode::weapon_projectile; }; - if (weapon_handle == GetEntityValue(player, eoffsets.hMyWeapons + sizeof(int) * 3)) return weaponmode::weapon_pda; - if (GetEntityValue(player, eoffsets.iClass) == tf_class::tf_medic) { - if (weapon_handle == GetEntityValue(player, eoffsets.hMyWeapons + sizeof(int) * 1)) return weaponmode::weapon_medigun; + if (weapon_handle == GetEntityValue(player, netvar.hMyWeapons + sizeof(int) * 3)) return weaponmode::weapon_pda; + if (GetEntityValue(player, netvar.iClass) == tf_class::tf_medic) { + if (weapon_handle == GetEntityValue(player, netvar.hMyWeapons + sizeof(int) * 1)) return weaponmode::weapon_medigun; } return weaponmode::weapon_hitscan; } @@ -455,7 +455,7 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, float& gravity) { rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 528))(weapon); break; case ClassID::CTFCompoundBow: { - float servertime = (float)GetEntityValue(g_pLocalPlayer->entity, eoffsets.nTickBase) * interfaces::gvars->interval_per_tick; + float servertime = (float)GetEntityValue(g_pLocalPlayer->entity, netvar.nTickBase) * interfaces::gvars->interval_per_tick; float curtime_old = interfaces::gvars->curtime; interfaces::gvars->curtime = servertime; rspeed = ((GetProjectileData*) *(*(const void ***) weapon + 527))(weapon); @@ -487,16 +487,16 @@ const char* MakeInfoString(IClientEntity* player) { player_info_t info; if (!interfaces::engineClient->GetPlayerInfo(player->entindex(), &info)) return (const char*)0; logging::Info("a"); - int hWeapon = GetEntityValue(player, eoffsets.hActiveWeapon); - if (GetEntityValue(player, eoffsets.iLifeState)) { - sprintf(buf, "%s is dead %s", info.name, tfclasses[GetEntityValue(player, eoffsets.iClass)]); + int hWeapon = GetEntityValue(player, netvar.hActiveWeapon); + if (GetEntityValue(player, netvar.iLifeState)) { + sprintf(buf, "%s is dead %s", info.name, tfclasses[GetEntityValue(player, netvar.iClass)]); return buf; } if (hWeapon) { IClientEntity* weapon = interfaces::entityList->GetClientEntity(hWeapon & 0xFFF); - sprintf(buf, "%s is %s with %i health using %s", info.name, tfclasses[GetEntityValue(player, eoffsets.iClass)], GetEntityValue(player, eoffsets.iHealth), weapon->GetClientClass()->GetName()); + sprintf(buf, "%s is %s with %i health using %s", info.name, tfclasses[GetEntityValue(player, netvar.iClass)], GetEntityValue(player, netvar.iHealth), weapon->GetClientClass()->GetName()); } else { - sprintf(buf, "%s is %s with %i health", info.name, tfclasses[GetEntityValue(player, eoffsets.iClass)], GetEntityValue(player, eoffsets.iHealth)); + sprintf(buf, "%s is %s with %i health", info.name, tfclasses[GetEntityValue(player, netvar.iClass)], GetEntityValue(player, netvar.iHealth)); } logging::Info("Result: %s", buf); return buf; @@ -561,14 +561,13 @@ relation GetRelation(IClientEntity* ent) { } bool IsSentryBuster(IClientEntity* entity) { - // TODO - return (entity && entity->GetClientClass()->m_ClassID == ClassID::CTFPlayer && GetEntityValue(entity, eoffsets.iClass) == tf_class::tf_demoman && g_pPlayerResource->GetMaxHealth(entity) == 2500); + return (entity && entity->GetClientClass()->m_ClassID == ClassID::CTFPlayer && GetEntityValue(entity, netvar.iClass) == tf_class::tf_demoman && g_pPlayerResource->GetMaxHealth(entity) == 2500); } bool IsAmbassador(IClientEntity* entity) { if (!entity) return false; if (entity->GetClientClass()->m_ClassID != ClassID::CTFRevolver) return false; - int defidx = GetEntityValue(entity, eoffsets.iItemDefinitionIndex); + int defidx = GetEntityValue(entity, netvar.iItemDefinitionIndex); switch (defidx) { case 61: case 1006: @@ -638,12 +637,11 @@ bool CanHeadshot(IClientEntity* player) { } bool BulletTime() { - float tickbase = (float)(GetEntityValue(g_pLocalPlayer->entity, eoffsets.nTickBase)) * interfaces::gvars->interval_per_tick; - float nextattack = GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flNextPrimaryAttack); + float tickbase = (float)(GetEntityValue(g_pLocalPlayer->entity, netvar.nTickBase)) * interfaces::gvars->interval_per_tick; + float nextattack = GetEntityValue(g_pLocalPlayer->weapon, netvar.flNextPrimaryAttack); return nextattack <= tickbase; } -// TODO casting QAngle VectorToQAngle(Vector in) { return *(QAngle*)∈ } @@ -681,7 +679,7 @@ bool IsEntityVisiblePenetration(IClientEntity* entity, int hb) { if (ret) { return false; } - ray.Init(local->GetAbsOrigin() + GetEntityValue(local, eoffsets.vViewOffset), hit); + ray.Init(local->GetAbsOrigin() + GetEntityValue(local, netvar.vViewOffset), hit); interfaces::trace->TraceRay(ray, 0x4200400B, trace::g_pFilterPenetration, &trace_visible); bool s = false; if (trace_visible.m_pEnt) { @@ -752,7 +750,7 @@ void RunEnginePrediction(IClientEntity* ent, CUserCmd *ucmd) { SetEntityValue(ent, 0x105C, ucmd); // set up the globals - interfaces::gvars->curtime = interfaces::gvars->interval_per_tick * GetEntityValue(ent, eoffsets.nTickBase); + interfaces::gvars->curtime = interfaces::gvars->interval_per_tick * GetEntityValue(ent, netvar.nTickBase); interfaces::gvars->frametime = interfaces::gvars->interval_per_tick; oStartTrackPredictionErrors(ent); diff --git a/uran/src/hooks.cpp b/uran/src/hooks.cpp index 50f79635..5ecca006 100644 --- a/uran/src/hooks.cpp +++ b/uran/src/hooks.cpp @@ -68,7 +68,6 @@ void hooks::VMTHook::Apply() { *vmt = array + 3; } -// TODO rename these hooks::VMTHook* hooks::hkClientMode = 0; hooks::VMTHook* hooks::hkPanel = 0; hooks::VMTHook* hooks::hkClient = 0; diff --git a/uran/src/localplayer.cpp b/uran/src/localplayer.cpp index df4868f8..4c88e164 100644 --- a/uran/src/localplayer.cpp +++ b/uran/src/localplayer.cpp @@ -11,14 +11,14 @@ void LocalPlayer::Update() { entity_idx = interfaces::engineClient->GetLocalPlayer(); entity = interfaces::entityList->GetClientEntity(entity_idx); - team = GetEntityValue(entity, eoffsets.iTeamNum); - life_state = GetEntityValue(entity, eoffsets.iLifeState); - v_ViewOffset = GetEntityValue(entity, eoffsets.vViewOffset); + team = GetEntityValue(entity, netvar.iTeamNum); + life_state = GetEntityValue(entity, netvar.iLifeState); + v_ViewOffset = GetEntityValue(entity, netvar.vViewOffset); v_Origin = entity->GetAbsOrigin(); v_Eye = v_Origin + v_ViewOffset; - cond_0 = GetEntityValue(entity, eoffsets.iCond); - clazz = GetEntityValue(entity, eoffsets.iClass); - health = GetEntityValue(entity, eoffsets.iHealth); + cond_0 = GetEntityValue(entity, netvar.iCond); + clazz = GetEntityValue(entity, netvar.iClass); + health = GetEntityValue(entity, netvar.iHealth); this->bUseSilentAngles = false; if (cond_0 & cond::zoomed) { if (flZoomBegin == 0.0f) flZoomBegin = interfaces::gvars->curtime; @@ -27,10 +27,10 @@ void LocalPlayer::Update() { } - int hWeapon = GetEntityValue(entity, eoffsets.hActiveWeapon); + int hWeapon = GetEntityValue(entity, netvar.hActiveWeapon); if (hWeapon) { weapon = interfaces::entityList->GetClientEntity(hWeapon & 0xFFF); - bIsReloading = (GetEntityValue(weapon, eoffsets.iReloadMode) == 1); + bIsReloading = (GetEntityValue(weapon, netvar.iReloadMode) == 1); } else { weapon = 0; bIsReloading = false; diff --git a/uran/src/playerresource.cpp b/uran/src/playerresource.cpp index dab5d918..20a2ed68 100644 --- a/uran/src/playerresource.cpp +++ b/uran/src/playerresource.cpp @@ -27,7 +27,7 @@ int TFPlayerResource::GetMaxHealth(IClientEntity* player) { if (!m_pEntity) return 0; int idx = player->entindex(); if (idx >= 64 || idx < 0) return 0; - return *(int*)((unsigned int)m_pEntity + eoffsets.iMaxHealth + 4 * idx); + return *(int*)((unsigned int)m_pEntity + netvar.iMaxHealth + 4 * idx); } int TFPlayerResource::GetMaxBuffedHealth(IClientEntity* player) { @@ -35,7 +35,7 @@ int TFPlayerResource::GetMaxBuffedHealth(IClientEntity* player) { if (!m_pEntity) return 0; int idx = player->entindex(); if (idx >= 64 || idx < 0) return 0; - return *(int*)((unsigned int)m_pEntity + eoffsets.iMaxBuffedHealth + 4 * idx); + return *(int*)((unsigned int)m_pEntity + netvar.iMaxBuffedHealth + 4 * idx); } diff --git a/uran/src/prediction.cpp b/uran/src/prediction.cpp index 64adaf63..30b5452d 100644 --- a/uran/src/prediction.cpp +++ b/uran/src/prediction.cpp @@ -17,7 +17,7 @@ Vector SimpleLatencyPrediction(IClientEntity* ent, int hb) { GetHitboxPosition(ent, hb, result); float latency = interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING); - result += GetEntityValue(ent, eoffsets.vVelocity) * latency; + result += GetEntityValue(ent, netvar.vVelocity) * latency; //logging::Info("Returning!"); return result; } @@ -27,7 +27,7 @@ Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravi Vector result = ent->GetAbsOrigin(); float dtg = DistanceToGround(result); GetHitboxPosition(ent, hb, result); - Vector vel = GetEntityValue(ent, eoffsets.vVelocity); + Vector vel = GetEntityValue(ent, netvar.vVelocity); // TODO ProjAim /*float tt = g_pLocalPlayer->v_Eye.DistTo(result) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING) - 0.20; @@ -42,7 +42,7 @@ Vector ProjectilePrediction(IClientEntity* ent, int hb, float speed, float gravi float ttt = dtt / speed + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + interfaces::engineClient->GetNetChannelInfo()->GetLatency(FLOW_INCOMING); float oz = result.z; - int flags = GetEntityValue(ent, eoffsets.iFlags); + int flags = GetEntityValue(ent, netvar.iFlags); bool ground = (flags & (1 << 0)); if (!ground) result.z -= ttt * ttt * 400; result += vel * ttt; diff --git a/uran/src/targethelper.cpp b/uran/src/targethelper.cpp index 6121dcd8..01f09929 100644 --- a/uran/src/targethelper.cpp +++ b/uran/src/targethelper.cpp @@ -39,12 +39,12 @@ int GetScoreForEntity(IClientEntity* entity) { } return 0; } - int clazz = GetEntityValue(entity, eoffsets.iClass); - int health = GetEntityValue(entity, eoffsets.iHealth); + int clazz = GetEntityValue(entity, netvar.iClass); + int health = GetEntityValue(entity, netvar.iHealth); float distance = (g_pLocalPlayer->v_Origin - entity->GetAbsOrigin()).Length(); - bool zoomed = (GetEntityValue(entity, eoffsets.iCond) & cond::zoomed); - int condx = (GetEntityValue(entity, eoffsets.iCond1)); - int condx2 = (GetEntityValue(entity, eoffsets.iCond2)); + bool zoomed = (GetEntityValue(entity, netvar.iCond) & cond::zoomed); + int condx = (GetEntityValue(entity, netvar.iCond1)); + int condx2 = (GetEntityValue(entity, netvar.iCond2)); bool pbullet = (condx & cond_ex::vacc_pbullet); bool special = false; bool kritz = IsPlayerCritBoosted(entity);