From 8d34f148e5ddb2ad15c8ad5d38ec4b495d6491a9 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Tue, 15 Nov 2016 15:45:41 +0300 Subject: [PATCH] fffffffffffffffffff --- uran/.cproject | 97 +++++++++++++++++++++++++++- uran/.gitignore | 3 +- uran/.settings/language.settings.xml | 13 +++- uran/TODO | 17 ++--- uran/src/drawing.cpp | 4 +- uran/src/entity.cpp | 9 +++ uran/src/entity.h | 9 +++ uran/src/entitycache.cpp | 3 + uran/src/entitycache.h | 2 + uran/src/hack.cpp | 51 +++++++++------ uran/src/hacks/HAimbot.cpp | 10 ++- uran/src/hacks/HEsp.cpp | 6 +- uran/src/hacks/HTrigger.cpp | 1 + uran/src/hacks/IHack.h | 1 + uran/src/hacks/Misc.cpp | 47 ++++++++++++-- uran/src/hacks/Misc.h | 3 + uran/src/hacks/Quickscope.cpp | 43 ++++++++++++ uran/src/hacks/Quickscope.h | 19 ++++++ uran/src/helpers.cpp | 36 +++++++---- uran/src/helpers.h | 14 +++- uran/src/localplayer.cpp | 11 +++- uran/src/localplayer.h | 3 + uran/src/playerresource.cpp | 36 +++++++++++ uran/src/playerresource.h | 23 +++++++ uran/src/relations.cpp | 51 +++++++++++++++ uran/src/relations.h | 41 ++++++++++++ uran/src/targethelper.cpp | 1 + 27 files changed, 495 insertions(+), 59 deletions(-) create mode 100644 uran/src/hacks/Quickscope.cpp create mode 100644 uran/src/hacks/Quickscope.h create mode 100644 uran/src/playerresource.cpp create mode 100644 uran/src/playerresource.h create mode 100644 uran/src/relations.cpp create mode 100644 uran/src/relations.h diff --git a/uran/.cproject b/uran/.cproject index 212da46d..aac74169 100644 --- a/uran/.cproject +++ b/uran/.cproject @@ -2,7 +2,7 @@ - + @@ -23,7 +23,7 @@ - + @@ -44,6 +44,9 @@ @@ -140,6 +143,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/uran/.gitignore b/uran/.gitignore index b2e63e8e..99981a27 100644 --- a/uran/.gitignore +++ b/uran/.gitignore @@ -4,4 +4,5 @@ /Debug/objects.mk /Debug/sources.mk /Debug/ -/src_/ \ No newline at end of file +/src_/ +/TF2/ diff --git a/uran/.settings/language.settings.xml b/uran/.settings/language.settings.xml index b17102c2..1f6506fc 100644 --- a/uran/.settings/language.settings.xml +++ b/uran/.settings/language.settings.xml @@ -1,6 +1,6 @@ - + @@ -22,4 +22,15 @@ + + + + + + + + + + + diff --git a/uran/TODO b/uran/TODO index 9e92a3f7..40f62598 100644 --- a/uran/TODO +++ b/uran/TODO @@ -1,6 +1,4 @@ -killsay - -ESP: Box, bones +ESP: bones TRIGGER: Amby charge TRIGGER: Ignore vaccinator @@ -8,7 +6,6 @@ Priority FIX OPTIMIZE Buildings aimbot -priority system proper player struct optimize buildings aim @@ -19,13 +16,17 @@ priority system Target system respect mannpower powerups Aimbot charge detection respect powerups -Entity::AddEntityString +huntsman aim fix +minigun aim fix +ignore SB +no flinch + +Sapped buildings ESP +AimBest optimize Glow Objects remove magic numbers -actual ammo box esp no trigger/aim vacc uber LINES (trace crshr->enemy) - -"legit" esp mode +disg spy aim SPY ALERT \ No newline at end of file diff --git a/uran/src/drawing.cpp b/uran/src/drawing.cpp index e221835f..ae61236e 100644 --- a/uran/src/drawing.cpp +++ b/uran/src/drawing.cpp @@ -79,7 +79,7 @@ ESPStringCompound::ESPStringCompound() { void draw::Initialize() { draw::font_handle = interfaces::surface->CreateFont(); draw::font_handle_large = interfaces::surface->CreateFont(); - interfaces::surface->SetFontGlyphSet(draw::font_handle, "Ubuntu Mono Bold", 17, 500, 0, 0, 0x200); + interfaces::surface->SetFontGlyphSet(draw::font_handle, "Tahoma", 16, 400, 0, 0, 0x200); // Ubuntu Mono Bold interfaces::surface->SetFontGlyphSet(draw::font_handle_large, "TF2 BUILD", 32, 500, 0, 0, 0x200); } @@ -105,7 +105,7 @@ void draw::DrawString(int x, int y, Color color, bool center, const char* text, x -= (l / 2); } draw::GetStringLength((char*)text, l, h); - draw::DrawRect(x, y + 1, l, h - 5, colors::black); + draw::DrawRect(x - 1, y + 1, l + 1, h - 5, colors::black); draw::DrawString(draw::font_handle, x, y, color, string); } diff --git a/uran/src/entity.cpp b/uran/src/entity.cpp index fad3ec14..cce8695e 100644 --- a/uran/src/entity.cpp +++ b/uran/src/entity.cpp @@ -32,6 +32,15 @@ void EntityVariables::Init() { this->iHitboxSet = gNetvars.get_offset("DT_BaseAnimating", "m_nHitboxSet"); this->vVelocity = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_vecVelocity[0]"); this->bGlowEnabled = gNetvars.get_offset("DT_TFPlayer", "m_bGlowEnabled"); + this->iReloadMode = gNetvars.get_offset("DT_TFWeaponBase", "m_iReloadMode"); + this->iMaxHealth = gNetvars.get_offset("DT_TFPlayerResource", "m_iMaxHealth"); + this->flNextAttack = gNetvars.get_offset("DT_BaseCombatCharacter", "bcc_localdata", "m_flNextAttack"); + this->iNextMeleeCrit = gNetvars.get_offset("DT_TFPlayer", "m_Shared", "m_iNextMeleeCrit"); + this->flNextPrimaryAttack = gNetvars.get_offset("DT_BaseCombatWeapon", "LocalActiveWeaponData", "m_flNextPrimaryAttack"); + this->iNextThinkTick = gNetvars.get_offset("DT_BaseCombatWeapon", "LocalActiveWeaponData", "m_nNextThinkTick"); + this->flReloadPriorNextFire = gNetvars.get_offset("DT_TFWeaponBase", "LocalActiveTFWeaponData", "m_flReloadPriorNextFire"); + this->flObservedCritChance = gNetvars.get_offset("DT_TFWeaponBase", "LocalActiveTFWeaponData", "m_flObservedCritChance"); + this->nTickBase = gNetvars.get_offset("DT_BasePlayer", "localdata", "m_nTickBase"); } void InitEntityOffsets() { diff --git a/uran/src/entity.h b/uran/src/entity.h index 20b5dc71..67971f73 100644 --- a/uran/src/entity.h +++ b/uran/src/entity.h @@ -53,6 +53,15 @@ public: offset_t vVelocity; offset_t bGlowEnabled; offset_t iGlowIndex; + offset_t iReloadMode; + offset_t iMaxHealth; + offset_t flNextAttack; + offset_t iNextMeleeCrit; + offset_t flNextPrimaryAttack; + offset_t iNextThinkTick; + offset_t flReloadPriorNextFire; + offset_t flObservedCritChance; + offset_t nTickBase; }; // TODO globals diff --git a/uran/src/entitycache.cpp b/uran/src/entitycache.cpp index 75e0a14f..72b43bc0 100644 --- a/uran/src/entitycache.cpp +++ b/uran/src/entitycache.cpp @@ -12,6 +12,7 @@ #include "enums.h" #include "entity.h" #include "localplayer.h" +#include "playerresource.h" #include "helpers.h" #include "fixsdk.h" @@ -62,6 +63,8 @@ void CachedEntity::Update(int idx) { m_iTeam = Var(eoffsets.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_iMaxHealth = g_pPlayerResource->GetMaxHealth(m_pEntity); if (m_bIsVisible) m_lLastSeen = 0; else m_lLastSeen++; } diff --git a/uran/src/entitycache.h b/uran/src/entitycache.h index 09e31c23..c8cf0c0c 100644 --- a/uran/src/entitycache.h +++ b/uran/src/entitycache.h @@ -38,6 +38,8 @@ public: int m_iTeam; bool m_bAlivePlayer; bool m_bEnemy; + int m_iMaxHealth; + int m_iHealth; bool m_bIsVisible; unsigned long m_lLastSeen; diff --git a/uran/src/hack.cpp b/uran/src/hack.cpp index 8e23a597..2ff859af 100644 --- a/uran/src/hack.cpp +++ b/uran/src/hack.cpp @@ -31,11 +31,13 @@ #include "hacks/HPyroBot.h" #include "hacks/HAimbot.h" #include "hacks/AntiAim.h" +#include "hacks/Quickscope.h" #include "hacks/Misc.h" #include "usercmd.h" #include "drawing.h" #include "entity.h" #include "localplayer.h" +#include "playerresource.h" #include @@ -117,6 +119,9 @@ bool hack::Hk_CreateMove(void* thisptr, float inputSample, CUserCmd* cmd) { return true; } if (!cmd) return ret; + + g_pPlayerResource->Update(); + g_pLocalPlayer->Update(); g_pLocalPlayer->v_OrigViewangles = cmd->viewangles; gEntityCache.Update(); @@ -179,6 +184,33 @@ void hack::Initialize() { logging::Info("Creating interfaces..."); interfaces::CreateInterfaces(); logging::Info("Interfaces created!"); + logging::Info("APPID: %i", interfaces::engineClient->GetAppID()); + logging::Info("Dumping NetVars..."); + CDumper dumper; + dumper.SaveDump(); + logging::Info("Initializing surface..."); + draw::Initialize(); + logging::Info("Adding hacks..."); + SetCVarInterface(interfaces::cvar); + hack::AddHack(new AntiAim()); + logging::Info("Quickscoping"); + hack::AddHack(new Quickscope()); + hack::AddHack(new HBunnyhop()); + hack::AddHack(new Misc()); + hack::AddHack(new HEsp()); + hack::AddHack(new HAimbot()); + hack::AddHack(new HTrigger()); + //hack::AddHack(new HGlow()); + hack::AddHack(new HPyroBot()); + ConVar_Register(); + logging::Info("Initializing NetVar tree..."); + gNetvars.init(); + logging::Info("Initializing entity offsets..."); + InitEntityOffsets(); + + g_pLocalPlayer = new LocalPlayer(); + g_pPlayerResource = new TFPlayerResource(); + logging::Info("Hooking PaintTraverse..."); hooks::hkPaintTraverse = new hooks::VMTHook(); hooks::hkPaintTraverse->Init(interfaces::panel, 0); @@ -190,28 +222,11 @@ void hack::Initialize() { while(!(clientMode = **(uintptr_t***)((uintptr_t)((*(void***)interfaces::baseClient)[10]) + 1))) { sleep(1); } - g_pLocalPlayer = new LocalPlayer(); hooks::hkCreateMove->Init((void*)clientMode, 0); hooks::hkCreateMove->HookMethod((void*)&hack::Hk_CreateMove, hooks::offCreateMove); hooks::hkCreateMove->Apply(); logging::Info("Hooked!"); - logging::Info("Initializing surface..."); - draw::Initialize(); - logging::Info("Adding hacks..."); - SetCVarInterface(interfaces::cvar); - hack::AddHack(new AntiAim()); - hack::AddHack(new HBunnyhop()); - hack::AddHack(new HTrigger()); - hack::AddHack(new HEsp()); - hack::AddHack(new HAimbot()); - //hack::AddHack(new HGlow()); - hack::AddHack(new HPyroBot()); - hack::AddHack(new Misc()); - ConVar_Register(); - logging::Info("Initializing NetVar tree..."); - gNetvars.init(); - logging::Info("Initializing entity offsets..."); - InitEntityOffsets(); + logging::Info("Init done!"); } diff --git a/uran/src/hacks/HAimbot.cpp b/uran/src/hacks/HAimbot.cpp index d5211a85..efc05b3d 100644 --- a/uran/src/hacks/HAimbot.cpp +++ b/uran/src/hacks/HAimbot.cpp @@ -55,9 +55,15 @@ void HAimbot::Create() { } bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) { + if (!this->v_bEnabled->GetBool()) return true; if (this->v_bEnabledAttacking->GetBool() && !(cmd->buttons & IN_ATTACK)) { return true; } + + if (g_pLocalPlayer->bIsReloading) { + return true; + } + if (this->v_bStrictAttack->GetBool() ) { cmd->buttons = cmd->buttons &~ IN_ATTACK; } @@ -71,7 +77,7 @@ bool HAimbot::CreateMove(void*, float, CUserCmd* cmd) { if (g_pLocalPlayer->weapon) { if (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID == 210) return true; } /* Grappling hook */ - if (!this->v_bEnabled->GetBool()) return true; + //logging::Info("Creating move.. aimbot"); m_bProjectileMode = (GetProjectileData(g_pLocalPlayer->weapon, m_flProjSpeed, m_bProjArc)); if (!this->v_bPriority->GetBool()) { @@ -130,6 +136,7 @@ bool HAimbot::ShouldTarget(IClientEntity* entity) { char life_state = GetEntityValue(entity, eoffsets.iLifeState); if (life_state) return false; // TODO magic number: life state if (!player) return false; + if (v_bRespectCloak->GetBool() && (GetEntityValue(entity, eoffsets.iCond) & cond::cloaked)) return false; int health = GetEntityValue(entity, eoffsets.iHealth); if (this->v_bCharge->GetBool() && (GetEntityValue(player, eoffsets.iClass) == 2)) { int rifleHandle = GetEntityValue(player, eoffsets.hActiveWeapon); @@ -147,6 +154,7 @@ bool HAimbot::ShouldTarget(IClientEntity* entity) { } int econd = GetEntityValue(entity, eoffsets.iCond1); if ((econd & cond_ex::vacc_bullet)) return false; + if (GetRelation(entity) == relation::FRIEND) return false; if (!m_bProjectileMode) { Vector hbv; if (GetHitboxPosition(entity, v_iHitbox->GetInt(), hbv)) return false; diff --git a/uran/src/hacks/HEsp.cpp b/uran/src/hacks/HEsp.cpp index b574cef8..7c6b78f6 100644 --- a/uran/src/hacks/HEsp.cpp +++ b/uran/src/hacks/HEsp.cpp @@ -128,7 +128,7 @@ void HEsp::ProcessEntityPT(CachedEntity* ent) { color = colors::yellow; break; } - DrawBox(ent, color, 3.0f, -15.0f, true, ent->Var(eoffsets.iHealth), ClassMaxHealth(ent->Var(eoffsets.iClass))); + DrawBox(ent, color, 3.0f, -15.0f, true, ent->Var(eoffsets.iHealth), ent->m_iMaxHealth); break; } case ClassID::CObjectSentrygun: @@ -238,7 +238,7 @@ void HEsp::ProcessEntity(CachedEntity* ent) { } if (pclass > 0 && pclass < 10) ent->AddESPString(color, "%s", classes[pclass - 1]); - //ent->AddESPString(color, "%i", health); + ent->AddESPString(color, "%i / %i HP", ent->m_iHealth, ent->m_iMaxHealth); if (pcond & cond::cloaked) { ent->AddESPString(color, "CLOAKED"); } @@ -262,7 +262,7 @@ void HEsp::ProcessEntity(CachedEntity* ent) { const char* name = (ent->m_iClassID == 89 ? "Teleporter" : (ent->m_iClassID == 88 ? "Sentry Gun" : "Dispenser")); color = TEAM_COLORS[ent->Var(eoffsets.iTeamNum)]; ent->AddESPString(color, "LV %i %s", level, name); - //ent->AddESPString(color, "%i HP", health); + ent->AddESPString(color, "%i / %i HP", ent->Var(eoffsets.iBuildingHealth), ent->Var(eoffsets.iBuildingMaxHealth)); if (this->v_bShowDistance) { ent->AddESPString(color, "%im", (int)(ent->m_flDistance / 64 * 1.22f)); } diff --git a/uran/src/hacks/HTrigger.cpp b/uran/src/hacks/HTrigger.cpp index 58d0c8f6..111be770 100644 --- a/uran/src/hacks/HTrigger.cpp +++ b/uran/src/hacks/HTrigger.cpp @@ -98,6 +98,7 @@ bool HTrigger::CreateMove(void* thisptr, float sampl, CUserCmd* cmd) { cmd->buttons |= IN_ATTACK; return true; } + 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; diff --git a/uran/src/hacks/IHack.h b/uran/src/hacks/IHack.h index 564bafcc..395ad4d0 100644 --- a/uran/src/hacks/IHack.h +++ b/uran/src/hacks/IHack.h @@ -9,6 +9,7 @@ #define IHACK_H_ class CUserCmd; +class ConVar; #define DECL_HACK \ void Create(); \ diff --git a/uran/src/hacks/Misc.cpp b/uran/src/hacks/Misc.cpp index 2077bb98..4c057fa4 100644 --- a/uran/src/hacks/Misc.cpp +++ b/uran/src/hacks/Misc.cpp @@ -11,7 +11,11 @@ #include "../helpers.h" #include "../drawing.h" #include "../localplayer.h" +#include "../logging.h" #include "../interfaces.h" +#include "../entity.h" +#include "../usercmd.h" +#include "../sdk/in_buttons.h" #include "../fixsdk.h" #include @@ -32,14 +36,43 @@ void CC_Shutdown(const CCommand& args) { hack::Shutdown(); } -void Misc::Create() { - v_bDbWeaponInfo = CreateConVar("u_misc_debug_weapon", "0", "Debug info: Weapon"); - c_SayLine = CreateConCommand("u_say_lines", CC_SayLines, "Uses ^ as a newline character"); - c_Shutdown = CreateConCommand("u_shutdown", CC_Shutdown, "Stops the hack"); - +void CC_AddFriend(const CCommand& args) { + if (args.ArgC() < 1) return; + if (!atoi(args[1])) return; + logging::Info("Adding friend %s", args.Arg(1)); + friends[n_friends++] = atoi(args[1]); } +void CC_AddRage(const CCommand& args) { + if (args.ArgC() < 1) return; + if (!atoi(args[1])) return; + logging::Info("Adding rage %s", args.Arg(1)); + rage[n_rage++] = atoi(args[1]); +} + + +void Misc::Create() { + v_bDbWeaponInfo = CreateConVar("u_misc_debug_weapon", "0", "Debug info: Weapon"); + v_bSemiAuto = CreateConVar("u_misc_semiauto", "0", "Force semi-auto"); + c_SayLine = CreateConCommand("u_say_lines", CC_SayLines, "Uses ^ as a newline character"); + c_Shutdown = CreateConCommand("u_shutdown", CC_Shutdown, "Stops the hack"); + c_AddFriend = CreateConCommand("u_addfriend", CC_AddFriend, "Adds a friend"); + c_AddRage = CreateConCommand("u_addrage", CC_AddRage, "Adds player to rage list"); +} + +int sa_switch = 0; + bool Misc::CreateMove(void*, float, CUserCmd* cmd) { + if (v_bSemiAuto->GetBool()) { + if (cmd->buttons & IN_ATTACK) { + if (sa_switch > 5) { + cmd->buttons = cmd->buttons &~ IN_ATTACK; + } + sa_switch++; + } else { + sa_switch = 0; + } + } return true; } @@ -54,6 +87,10 @@ void Misc::PaintTraverse(void*, unsigned int, bool, bool) { IClientEntity* weapon = g_pLocalPlayer->weapon; draw::DrawString(10, y, draw::white, false, "Weapon: %s [%i]", weapon->GetClientClass()->GetName(), weapon->GetClientClass()->m_ClassID); y += 14; + draw::DrawString(10, y, draw::white, false, "flNextAttack: %f", GetEntityValue(g_pLocalPlayer->entity, eoffsets.flNextAttack)); + y += 14; + draw::DrawString(10, y, draw::white, false, "nTickBase: %i", GetEntityValue(g_pLocalPlayer->entity, eoffsets.nTickBase)); + y += 14; } } } diff --git a/uran/src/hacks/Misc.h b/uran/src/hacks/Misc.h index b37511d0..e9298be5 100644 --- a/uran/src/hacks/Misc.h +++ b/uran/src/hacks/Misc.h @@ -20,8 +20,11 @@ public: void Destroy(); void PaintTraverse(void*, unsigned int, bool, bool); ConVar* v_bDbWeaponInfo; + ConVar* v_bSemiAuto; ConCommand* c_SayLine; ConCommand* c_Shutdown; + ConCommand* c_AddFriend; + ConCommand* c_AddRage; }; #endif /* HACKS_MISC_H_ */ diff --git a/uran/src/hacks/Quickscope.cpp b/uran/src/hacks/Quickscope.cpp new file mode 100644 index 00000000..5134e283 --- /dev/null +++ b/uran/src/hacks/Quickscope.cpp @@ -0,0 +1,43 @@ +/* + * Quickscope.cpp + * + * Created on: Nov 12, 2016 + * Author: nullifiedcat + */ + +#include "Quickscope.h" + +#include "../localplayer.h" +#include "../helpers.h" +#include "../entity.h" +#include "../usercmd.h" +#include "../sdk/in_buttons.h" + +#include "../fixsdk.h" +#include +#include + +void Quickscope::Create() { + v_bEnabled = CreateConVar("u_quickscope", "1", "Quickscope mode"); +} + +bool Quickscope::CreateMove(void*, float, CUserCmd* cmd) { + if (!v_bEnabled->GetBool()) return true; + if (g_pLocalPlayer->clazz == tf_class::tf_sniper) { + if (!g_pLocalPlayer->weapon) return false; + switch (g_pLocalPlayer->weapon->GetClientClass()->m_ClassID) { + case ClassID::CTFSniperRifle: + break; + default: + return true; + } + float bdmg = GetEntityValue(g_pLocalPlayer->weapon, eoffsets.flChargedDamage); + if (bdmg <= 15.0f && (g_pLocalPlayer->cond_0 & cond::zoomed)) { + cmd->buttons = cmd->buttons &~ IN_ATTACK; + } + } + return true; +} + +void Quickscope::Destroy() {} +void Quickscope::PaintTraverse(void*, unsigned int, bool, bool) { } diff --git a/uran/src/hacks/Quickscope.h b/uran/src/hacks/Quickscope.h new file mode 100644 index 00000000..cfa5a4c2 --- /dev/null +++ b/uran/src/hacks/Quickscope.h @@ -0,0 +1,19 @@ +/* + * Quickscope.h + * + * Created on: Nov 12, 2016 + * Author: nullifiedcat + */ + +#ifndef HACKS_QUICKSCOPE_H_ +#define HACKS_QUICKSCOPE_H_ + +#include "IHack.h" + +class Quickscope : public IHack { +public: + DECL_HACK + ConVar* v_bEnabled; +}; + +#endif /* HACKS_QUICKSCOPE_H_ */ diff --git a/uran/src/helpers.cpp b/uran/src/helpers.cpp index 952519d1..491d4927 100644 --- a/uran/src/helpers.cpp +++ b/uran/src/helpers.cpp @@ -30,9 +30,13 @@ bool IsPlayerInvulnerable(IClientEntity* player) { int cond1 = GetEntityValue(player, eoffsets.iCond); int cond2 = GetEntityValue(player, eoffsets.iCond1); - int uber_mask_1 = (cond::uber | cond::uber_expiration | cond::bonk); + 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)) return true; + if ((cond1 & uber_mask_1) || (cond2 & uber_mask_2)) { + //logging::Info("COND1: %i MASK1: %i", cond1, uber_mask_1); + //logging::Info("COND2: %i MASK2: %i", cond2, uber_mask_2); + return true; + } return false; } @@ -148,6 +152,7 @@ pack_type GetHealthPackType(IClientEntity* ent) { pack_type GetAmmoPackType(IClientEntity* ent) { if (!ent) return pack_type::not_pack; const char* name = GetModelPath(ent); + if (strlen(name) < 30) return pack_type::not_pack; return pack_type::not_pack; } @@ -159,7 +164,6 @@ powerup_type GetPowerupType(IClientEntity* ent) { const char* name = GetModelPath(ent); if (strlen(name) < 35) return powerup_type::not_powerup; if (name[27] != 'u' || name[22] != 'p') return powerup_type::not_powerup; - if (name[30] == 's' && name[31] == 't') return powerup_type::strength; if (name[30] == 'd' && name[32] == 'f') return powerup_type::resistance; if (name[30] == 'v') return powerup_type::vampire; @@ -204,7 +208,8 @@ void VectorTransform (const float *in1, const matrix3x4_t& in2, float *out) out[2] = (in1[0] * in2[2][0] + in1[1] * in2[2][1] + in1[2] * in2[2][2]) + in2[2][3]; } -int ClassMaxHealth(int clazz) { +// TODO deprecated +/*int ClassMaxHealth(int clazz) { switch(clazz) { case tf_scout: case tf_spy: @@ -222,7 +227,7 @@ int ClassMaxHealth(int clazz) { return 175; } return 0; -} +}*/ int GetHitboxPosition(IClientEntity* entity, int hb, Vector& out) { if (!entity) return 1; @@ -458,10 +463,10 @@ relation GetRelation(IClientEntity* ent) { if (ent->IsDormant()) return relation::NEUTRAL; player_info_t info; if (!interfaces::engineClient->GetPlayerInfo(ent->entindex(), &info)) return relation::NEUTRAL; - for (int i = 0; i < 1; i++) { + for (int i = 0; i < n_friends; i++) { if (friends[i] == info.friendsID) return relation::FRIEND; } - for (int i = 0; i < 1; i++) { + for (int i = 0; i < n_rage; i++) { if (rage[i] == info.friendsID) return relation::RAGE; } return relation::NEUTRAL; @@ -508,6 +513,12 @@ float GetFov(Vector angle, Vector src, Vector dst) return RAD2DEG(acos(u_dot_v / (pow(mag, 2)))); } +bool CanShoot(IClientEntity* weapon) { + if (!weapon) return false; + + return false; +} + const char* powerups[] = { "STRENGTH", "RESISTANCE", @@ -524,13 +535,12 @@ const char* powerups[] = { "CRITS" }; -uint32 friends[] = { - 39133950 -}; +uint32 friends[256]; -uint32 rage[] = { - 36315583 -}; +uint32 rage[256]; + +int n_friends = 0; +int n_rage = 0; const char* packs[] = { "+", diff --git a/uran/src/helpers.h b/uran/src/helpers.h index 4663c7c5..93b96a92 100644 --- a/uran/src/helpers.h +++ b/uran/src/helpers.h @@ -13,6 +13,7 @@ class IClientEntity; class ConVar; class ConCommand; class CUserCmd; +class CCommand; class Vector; #define PI 3.14159265358979323846f @@ -24,6 +25,8 @@ class Vector; #include "fixsdk.h" #include +//typedef void ( *FnCommandCallback_t )( const CCommand &command ); + bool IsPlayerCritBoosted(IClientEntity* player); bool IsPlayerInvulnerable(IClientEntity* player); bool IsPlayerInvisible(IClientEntity* player); @@ -48,8 +51,11 @@ bool GetProjectileData(IClientEntity* weapon, float& speed, bool& arc); bool IsVectorVisible(Vector a, Vector b); bool PredictProjectileAim(Vector origin, IClientEntity* target, hitbox hb, float speed, bool arc, Vector& result); relation GetRelation(IClientEntity* ent); -int ClassMaxHealth(int clazz); +// TODO deprecated +//int ClassMaxHealth(int clazz); bool CheckCE(CachedEntity* entity); +bool CanShoot(IClientEntity* entity); + // F1 c&p Vector CalcAngle(Vector src, Vector dst); void MakeVector(Vector ang, Vector& out); @@ -57,7 +63,9 @@ float GetFov(Vector ang, Vector src, Vector dst); extern const char* powerups[POWERUP_COUNT]; extern const char* packs[PACK_COUNT]; -extern uint32 friends[1]; -extern uint32 rage[1]; +extern uint32 friends[256]; +extern int n_friends; +extern int n_rage; +extern uint32 rage[256]; #endif /* HELPERS_H_ */ diff --git a/uran/src/localplayer.cpp b/uran/src/localplayer.cpp index 128ebc00..e18ac61e 100644 --- a/uran/src/localplayer.cpp +++ b/uran/src/localplayer.cpp @@ -25,10 +25,17 @@ void LocalPlayer::Update() { v_Eye = v_Origin + v_ViewOffset; cond_0 = GetEntityValue(entity, eoffsets.iCond); clazz = GetEntityValue(entity, eoffsets.iClass); + + + int hWeapon = GetEntityValue(entity, eoffsets.hActiveWeapon); - if (hWeapon) + if (hWeapon) { weapon = interfaces::entityList->GetClientEntity(hWeapon & 0xFFF); - else weapon = 0; + bIsReloading = (GetEntityValue(weapon, eoffsets.iReloadMode) == 1); + } else { + weapon = 0; + bIsReloading = false; + } } LocalPlayer* g_pLocalPlayer = 0; diff --git a/uran/src/localplayer.h b/uran/src/localplayer.h index 5667b3ad..0fec4c9e 100644 --- a/uran/src/localplayer.h +++ b/uran/src/localplayer.h @@ -25,6 +25,9 @@ public: int cond_1; int cond_2; int cond_3; + + bool bIsReloading; + Vector v_ViewOffset; Vector v_Origin; Vector v_Eye; diff --git a/uran/src/playerresource.cpp b/uran/src/playerresource.cpp new file mode 100644 index 00000000..b8bbcc7f --- /dev/null +++ b/uran/src/playerresource.cpp @@ -0,0 +1,36 @@ +/* + * playerresource.cpp + * + * Created on: Nov 13, 2016 + * Author: nullifiedcat + */ + +#include "playerresource.h" +#include "interfaces.h" +#include "enums.h" +#include "entity.h" + +#include "fixsdk.h" +#include +#include +#include + +void TFPlayerResource::Update() { + m_pEntity = 0; + for (int i = 0; i < interfaces::entityList->GetHighestEntityIndex(); i++) { + IClientEntity* ent = interfaces::entityList->GetClientEntity(i); + if (ent && ent->GetClientClass()->m_ClassID == ClassID::CTFPlayerResource) { + m_pEntity = ent; + } + } +} + +int TFPlayerResource::GetMaxHealth(IClientEntity* player) { + if (!player) return 0; + 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); +} + +TFPlayerResource* g_pPlayerResource = 0; diff --git a/uran/src/playerresource.h b/uran/src/playerresource.h new file mode 100644 index 00000000..c95e4d7f --- /dev/null +++ b/uran/src/playerresource.h @@ -0,0 +1,23 @@ +/* + * playerresource.h + * + * Created on: Nov 13, 2016 + * Author: nullifiedcat + */ + +#ifndef PLAYERRESOURCE_H_ +#define PLAYERRESOURCE_H_ + +class IClientEntity; + +class TFPlayerResource { +public: + void Update(); + int GetMaxHealth(IClientEntity* player); + + IClientEntity* m_pEntity; +}; + +extern TFPlayerResource* g_pPlayerResource; + +#endif /* PLAYERRESOURCE_H_ */ diff --git a/uran/src/relations.cpp b/uran/src/relations.cpp new file mode 100644 index 00000000..c54e5ae0 --- /dev/null +++ b/uran/src/relations.cpp @@ -0,0 +1,51 @@ +/* + * relations.cpp + * + * Created on: Nov 13, 2016 + * Author: nullifiedcat + */ + +#include "relations.h" +#include "logging.h" + + + +void CRelations::Add(uint32 id, relation rel) { + logging::Info("Adding"); +} + +void CRelations::Remove(uint32 id) { + for (int i = 0; i < m_nFriends; i++) { + if (m_Friends[i] == id) { + m_nFriends--; + ShiftArray(m_Friends, i, m_nFriends); + } + } + for (int i = 0; i < m_nFriendlies; i++) { + if (m_Friendlies[i] == id) { + m_nFriendlies--; + ShiftArray(m_Friendlies, i, m_nFriendlies); + } + } + for (int i = 0; i < m_nRage; i++) { + if (m_Rage[i] == id) { + m_nRage--; + ShiftArray(m_Rage, i, m_nRage); + } + } +} + +void CRelations::WriteConfig() { + FILE* cfg = fopen("", "w"); + + fclose(cfg); +} + +void CRelations::ShiftArray(uint32* array, int idx, int max) { + for (int i = idx; i < max; i++) { + array[idx] = array[idx + 1]; + } +} + +char* RelStr[] = { "NONE", "FRIEND", "FRIENDLY", "RAGE" }; +CRelations* g_pRelations = 0; diff --git a/uran/src/relations.h b/uran/src/relations.h new file mode 100644 index 00000000..24126f41 --- /dev/null +++ b/uran/src/relations.h @@ -0,0 +1,41 @@ +/* + * relations.h + * + * Created on: Nov 13, 2016 + * Author: nullifiedcat + */ + +#ifndef RELATIONS_H_ +#define RELATIONS_H_ + +typedef unsigned long uint32; + +enum relation { + NONE = 0, + FRIEND, // PURPLE color + FRIENDLY, // Ignored by aimbot, GREEN color + RAGE // Max target priority, YELLOW color +}; + +#define MAX_FRIENDS 256 + +class CRelations { +public: + void Add(uint32 id, relation rel); + void Remove(uint32 id); + void WriteConfig(); + void ShiftArray(uint32* array, int idx, int max); + + uint32 m_Friends[MAX_FRIENDS]; + uint32 m_Friendlies[MAX_FRIENDS]; + uint32 m_Rage[MAX_FRIENDS]; + + int m_nFriends; + int m_nFriendlies; + int m_nRage; +}; + +extern char* RelStr[4]; +extern CRelations* g_pRelations; + +#endif /* RELATIONS_H_ */ diff --git a/uran/src/targethelper.cpp b/uran/src/targethelper.cpp index 10a2d9cd..4564a7c3 100644 --- a/uran/src/targethelper.cpp +++ b/uran/src/targethelper.cpp @@ -74,5 +74,6 @@ int GetScoreForEntity(IClientEntity* entity) { } } if (total > 99) total = 99; + if (GetRelation(entity) == relation::RAGE) total = 999; return total; }