From 26fc159cc303165622016018dffe380c1940a8b3 Mon Sep 17 00:00:00 2001 From: julianacat Date: Tue, 11 Jul 2017 08:57:39 -0500 Subject: [PATCH 01/48] Followbot Rework --- src/drawmgr.cpp | 3 + src/hacks/Aimbot.cpp | 6 +- src/hacks/FollowBot.cpp | 1081 +++++++++++++++++++++++++-------------- src/hacks/FollowBot.h | 23 +- 4 files changed, 711 insertions(+), 402 deletions(-) diff --git a/src/drawmgr.cpp b/src/drawmgr.cpp index 3c81a05d..c8f20ddf 100644 --- a/src/drawmgr.cpp +++ b/src/drawmgr.cpp @@ -79,6 +79,9 @@ void DrawCheatVisuals() { PROF_SECTION(PT_spyalert); SAFE_CALL(hacks::tf::spyalert::Draw()); } +#ifdef IPC_ENABLED + IF_GAME(IsTF()) SAFE_CALL(hacks::shared::followbot::Draw()); +#endif { PROF_SECTION(DRAW_esp); hacks::shared::esp::Draw(); diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index d6337491..165c7d20 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -897,7 +897,7 @@ void Reset() { } // Function called when we need to draw to screen -static CatVar fov_draw(CV_SWITCH, "aimbot_fov_draw", "0", "Draw Fov Ring", "Draws a ring to represent your current aimbot fov\nDoesnt change according to zoom fov\nWIP"); +static CatVar fov_draw(CV_SWITCH, "aimbot_fov_draw", "0", "Draw Fov Ring", "Draws a ring to represent your current aimbot fov"); void DrawText() { // Dont draw to screen when aimbot is disabled if (!enabled) return; @@ -913,13 +913,13 @@ void DrawText() { // Grab the screen resolution and save to some vars int width, height; g_IEngine->GetScreenSize(width, height); + // Some math to find radius of the fov circle - // float radius = tanf(DEG2RAD((float)fov) / 2) / tanf(DEG2RAD(draw::fov) / 2) * width; - float mon_fov = (float(width) / float(height) / (4.0f / 3.0f)); float fov_real = RAD2DEG(2 * atanf(mon_fov * tanf(DEG2RAD(draw::fov / 2)))); float radius = tan(DEG2RAD(float(fov)) / 2) / tan(DEG2RAD(fov_real) / 2) * (width); + // Draw a circle with our newfound circle float px = 0; float py = 0; diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 460ea1fe..155ab134 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -12,123 +12,465 @@ #ifdef IPC_ENABLED namespace hacks { namespace shared { namespace followbot { + +// User settings +CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs"); +CatVar follow_distance(CV_FLOAT, "fb_follow_distance", "175", "Followbot Follow Distance", "How close the bots should stay to the target"); +CatVar follow_activation(CV_FLOAT, "fb_follow_activation", "450", "Followbot Activation Distance", "How close a player should be until the followbot will pick a target"); +CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic selected weapon", "If enabled, this bot will select same weapon slot as the owner"); +CatVar always_medigun(CV_SWITCH, "fb_always_medigun", "0", "Always use Medigun", "Medics will always use Medigun"); +CatVar crumb_draw(CV_SWITCH, "fb_crumb_draw", "1", "Draw Crumbs", "Draws the path made for the followbot"); +CatVar roaming(CV_SWITCH, "fb_roaming", "0", "Roaming", "Allows the bot to find a different target if it cant find one using the steam id"); +CatVar sync_taunt(CV_SWITCH, "fb_sync_taunt", "0", "Mimic taunts", "Bots will taunt if target is taunting"); -unsigned follow_steamid { 0 }; -Vector last_direction; -float lost_time { 0 }; -float idle_time { 0 }; -int following_idx { 0 }; +// Var to store the current steamid to follow +unsigned follow_steamid { 1 }; + +// Vars that control jumping and the followbot +float idle_time = 0; +// Var that decides how the followbot will act and move +EFollowType current_follow_type = EFollowType::ENTITY; +CachedEntity* target_last = 0; +//int target_last_idx = 0; + +// Var that controls whether the followbot is allowed to move +bool allow_moving = true; +//bool find_new_ent = true; +int following_idx = 0; + +// Arrays to store selected ents std::set selection {}; std::set selection_secondary {}; -//Cats vars for old followbot +// Vars for vector followbot float destination_point_time { 0.0f }; Vector destination_point {}; bool destination_reached { false }; -bool allow_moving { true }; -//Initalize vars for BreadCrumb followbot -//An array for storing the breadcrumbs -static CatVar crumbFollowDistance(CV_FLOAT, "fb_follow_distance", "150", "Followbot Distance", "How close the bots should stay to you"); +// Vars for breadcrumb followbot +// An array for storing the breadcrumbs Vector breadcrumbs [55]; -float crumbWaitPrune = 0; -float crumbWaitVis = 0; +// Array Bookkeeping vars int crumbBottom = 0; int crumbTop = 0; int crumbArrayLength = 0; -bool crumbAbleToMove = false; +// Timeout vars +float crumb_prune_timeout = 0; +// Used for states for the followbot bool crumbStopped = true; bool crumbFindNew = false; bool crumbForceMove = false; -//A function to start the crumb followbot up -void CrumbStart() { - //A check to make sure using the fb tool repeatedly doesnt clear the cache of crumbs - if (crumbStopped || !crumbAbleToMove) { - crumbTop = 0; - crumbBottom = 0; - crumbArrayLength = 0; - crumbWaitPrune = g_GlobalVars->curtime; - crumbWaitVis = g_GlobalVars->curtime; - crumbFindNew = true; - crumbStopped = false; - crumbAbleToMove = true; - logging::Info("Crumb Start"); - } -} - -//A function to place a crumb into the array -void CrumbTopAdd(Vector crumbToAdd) { - //Once the crumbs have hit the limit of the array, loop around and over write unused spots - if (crumbTop == 55) { - crumbTop = 0; - } else { - //Else, bump the top number market of the array - crumbTop = crumbTop + 1; - } - - //Put the newly determined crumb into the array and add to the length - crumbArrayLength = crumbArrayLength + 1; - breadcrumbs[crumbTop] = crumbToAdd; - logging::Info("Crumb Top add"); - - //The array can only hold so many crumbs, once it goes over its cap, stop the bot to prevent un-needed movement - if (crumbArrayLength > 55) { - crumbStopped = true; - logging::Info("Crumb Overload!\nDumping array"); - } -} - -//A function to free a crumb from the array -void CrumbBottomAdd() { - //Once the crumbs have hit the limit of the array, loop around and over write unused spots - if (crumbBottom == 55) { - crumbBottom = 0; - } else { - //Else, bump the top number market of the array - crumbBottom = crumbBottom + 1; - } - - //Subtract from the length to make room for more crumbs - crumbArrayLength = crumbArrayLength - 1; - logging::Info("Crumb Bottom add"); - - //A check to detect if too many crumbs have been removed. Without crumbs the bot will just use random variables in the array. - //To prevent un-nessasary movement, just clear the array and wait for player - if (crumbArrayLength < 0) { - crumbStopped = true; - logging::Info("Crumb Over-Prune!\nDumping array"); - } -} - -//A function to calculate distance from a entity, to the floor -float crumbDistanceToFloor(CachedEntity* ent) { - if (ent->m_Type == ENTITY_PLAYER) { - if (CE_INT(ent, netvar.iFlags) & FL_ONGROUND) return 0; +// Function called after create move +void AfterCreateMove() { + + // Primary Selection handling and selection clearing + auto it = selection.begin(); + while (it != selection.end()) { + int idx = *it; + CachedEntity* entity = ENTITY(idx); + if (CE_BAD(entity)) { + selection.erase(it++); + } else { + hacks::shared::esp::AddEntityString(entity, "[SELECTED]", colors::orange); + if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { + hacks::shared::esp::SetEntityColor(entity, colors::yellow); + } + ++it; + } } - Vector& origin = ent->m_vecOrigin; - float v1 = DistanceToGround(origin + Vector(10.0f, 10.0f, 0.0f)); - float v2 = DistanceToGround(origin + Vector(-10.0f, 10.0f, 0.0f)); - float v3 = DistanceToGround(origin + Vector(10.0f, -10.0f, 0.0f)); - float v4 = DistanceToGround(origin + Vector(-10.0f, -10.0f, 0.0f)); - return MIN(v1, MIN(v2, MIN(v3, v4))); + + // Secondary Selection handling + it = selection_secondary.begin(); + while (it != selection_secondary.end()) { + int idx = *it; + CachedEntity* entity = ENTITY(idx); + if (CE_BAD(entity)) { + selection_secondary.erase(it++); + } else { + hacks::shared::esp::AddEntityString(entity, "[SELECTED (SECONDARY)]", colors::orange); + if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { + hacks::shared::esp::SetEntityColor(entity, colors::yellow); + } + ++it; + } + } + + // Processing Selection is done, attemt to walk + DoWalking(); } +CatVar deboog1(CV_INT, "fb_deboog", "0", "Mimic taunts", "Bots will taunt if target is taunting"); +//if ((int)deboog1 <= 1) return; +// Function for followbots to use for following, weapon selection, etc... +void DoWalking() { + + if (!bot) return; + + + + // Get our best target, preferably from a steamid -bool IsBot(CachedEntity* entity) { - if (!ipc::peer) return false; - if (entity->m_Type == ENTITY_PLAYER) { - if (ipc::peer) { - for (unsigned i = 1; i < cat_ipc::max_peers; i++) { - if (!ipc::peer->memory->peer_data[i].free && ipc::peer->memory->peer_user_data[i].friendid == entity->player_info.friendsID) { - return true; + //following_idx = 0; + CachedEntity* best_target = 0; + CachedEntity* target_priority = 0; + + // Get ent from steamid + for (int i = 1; i < HIGHEST_ENTITY; i++) { + + CachedEntity* ent = ENTITY(i); + + if (CE_BAD(ent)) continue; + if (ent == LOCAL_E) continue; + if (ent->m_Type != ENTITY_PLAYER) continue; + if (!ent->m_bAlivePlayer) continue; + if (ent->m_bEnemy) continue; + if (g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin) > 3400.0F) continue; + + if (ent->player_info.friendsID == follow_steamid) { + target_priority = ent; + break; + } + } + + // Check Steam id target + if (CE_GOOD(target_priority)) { + // If last target isnt the priority, vis check it + if (target_last != target_priority) { + if (target_priority->IsVisible()) { + target_last = target_priority; + best_target = target_priority; + crumbStopped = true; + } + } else { + best_target = target_priority; + } + + + + } + // Doesnt work for some reason, FIX!!! + // If we cant use steam id target, try someone else + if (roaming && CE_BAD(best_target)) { + + // Check last target if good + if (CE_GOOD(target_last)) { + if (g_pLocalPlayer->v_Origin.DistTo(target_last->m_vecOrigin) < 3400.0F && target_last->m_bAlivePlayer && !crumbStopped) { + best_target = target_last; + } + } + + // Without good target we must find a new one + if (CE_BAD(best_target)) { + + float target_highest_score = -256; + CachedEntity* ent; + target_last = 0; + crumbStopped = true; + + for (int i = 0; i < HIGHEST_ENTITY; i++) { + ent = ENTITY(i); + + if (CE_BAD(ent)) continue; + if (ent == LOCAL_E) continue; + if (!ent->m_bAlivePlayer) continue; + + if (ent->m_bEnemy) continue; + if (g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin) > 3400.0F) continue; + // Check activation distance + if (g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin) > (float)follow_activation) continue; + if (!ent->IsVisible()) continue; + + // Distance Priority works in our case + float scr = 4096.0f - g_pLocalPlayer->v_Origin.DistTo(ent->m_vecOrigin); + if (scr > target_highest_score) { + target_highest_score = scr; + target_last = ent; + best_target = ent; + } + } + } + } + + CachedEntity* found_entity = best_target; + int following_idx2 = 0; + if (CE_GOOD(found_entity)) { + following_idx2 = found_entity->m_IDX; + hacks::shared::esp::AddEntityString(found_entity, "[FOLLOWING]", colors::green); + hacks::shared::esp::SetEntityColor(found_entity, colors::green); + } else { + logging::Info("Found ent is bad"); + crumbStopped = true; + return; + } + + + + // Slot Changer/Mimicer + logging::Info("Slot changer"); + // Set a static var for last slot check + static float last_slot_check = 0.0f; + + // If curtime is less than the last time we checked the slot, then reset our check timer + if (g_GlobalVars->curtime < last_slot_check) last_slot_check = 0.0f; + + // If we have a follow target, user settings tell us that we should mess with the slot, the local player is alive, and our target is alive + if (following_idx2 && (always_medigun || mimic_slot) && (g_GlobalVars->curtime - last_slot_check > 1.0f) && !g_pLocalPlayer->life_state && !CE_BYTE(found_entity, netvar.iLifeState)) { + + // We are checking our slot so reset the timer + last_slot_check = g_GlobalVars->curtime; + + // Get the follow targets active weapon + int owner_weapon_eid = (CE_INT(found_entity, netvar.hActiveWeapon) & 0xFFF); + IClientEntity* owner_weapon = g_IEntityList->GetClientEntity(owner_weapon_eid); + + // If both the follow targets and the local players weapons arnt null or dormant + if (owner_weapon && CE_GOOD(g_pLocalPlayer->weapon())) { + + // IsBaseCombatWeapon() + if (vfunc(RAW_ENT(g_pLocalPlayer->weapon()), 190, 0)(RAW_ENT(g_pLocalPlayer->weapon())) && + vfunc(owner_weapon, 190, 0)(owner_weapon)) { + + // Get the players slot numbers and store in some vars + int my_slot = vfunc(RAW_ENT(g_pLocalPlayer->weapon()), 395, 0)(RAW_ENT(g_pLocalPlayer->weapon())); + int owner_slot = vfunc(owner_weapon, 395, 0)(owner_weapon); + + // If the local player is a medic and user settings allow, then keep the medigun out + if (g_pLocalPlayer->clazz == tf_medic && always_medigun) { + if (my_slot != 1) { + g_IEngine->ExecuteClientCmd("slot2"); + } + + // Else we attemt to keep our weapon mimiced with our follow target + } else { + if (my_slot != owner_slot) { + g_IEngine->ExecuteClientCmd(format("slot", owner_slot + 1).c_str()); + } + } + } + } + } + + + logging::Info("Start follow"); + // Main followbot code + if (allow_moving) { + // Switch to different types of following mechanisms depending on the type we need to go to + switch (current_follow_type) { + case EFollowType::VECTOR: // If were using a vector to follow, we just go directly to it + + // If destination_point_time is more than curtime than we reset it to zero + if (destination_point_time > g_GlobalVars->curtime) destination_point_time = 0.0f; + // If we havent reached our destination and the destination point timeout isnt more than 5 seconds, then we continue to walk to the destination point + if (!destination_reached && (g_GlobalVars->curtime - destination_point_time < 5.0f)) { + // Walk to the point + WalkTo(destination_point); + // If we have reached the destination point then we set the var to true + if (g_pLocalPlayer->v_Origin.DistTo(destination_point) < 50.0f) destination_reached = true; + } + // Break from the switch + break; + + case EFollowType::ENTITY: // If were using a player to follow, we use the breadcrumb followbot + + if (CE_GOOD(found_entity)) { + //If the bot is lost but it finds the player again, start the followbot again. + if (crumbStopped) { + crumbForceMove = true; + CrumbReset(); + } + } else { + // If the entity we have isnt good, we stop the crumb followbot + crumbStopped = true; + } + + + // Breadcrumb followbot + if (!crumbStopped) { + // Generate new breadcrumbs made by the player only if they are close to the ground. If the bot is told to generate a starting point, it does that as well. + if ((found_entity->m_vecOrigin.DistTo(breadcrumbs[crumbTop]) > 40.0F || crumbFindNew) && DistanceToGround(found_entity) < 25) { + // Add to the crumb. + CrumbTopAdd(found_entity->m_vecOrigin); + + // If the bot was forced to select a point, add a buffer crumb and bump to the newly selected point and use it + if (crumbFindNew) { + crumbFindNew = false; + CrumbTopAdd(found_entity->m_vecOrigin); + CrumbBottomAdd(); + } + } + + // Prune used crumbs from the stack to make way for new ones when you get close to them. + if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 40.0F ) { + // Debug Logging + logging::Info("Pruning"); + + // When the bot is forced to move to the player, since they have reached their destination we reset the var + crumbForceMove = false; + + // Check 15 times for close crumbs to prune, this allows simple miss steps to be smoothed out as well as make room for new crumbs + for (int i = 0; i < 15; i++) { + + //When one is close or too high, just bump the array and reset the stuck timer + if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 60.0F && crumbArrayLength > 1) { + CrumbBottomAdd(); + + // When pruning is finished. Break the loop + } else { + crumb_prune_timeout = g_GlobalVars->curtime; + logging::Info("Finish Prune"); + break; + } + } + // Reset stuck timer + crumb_prune_timeout = g_GlobalVars->curtime; + } + + // When player to follow is too far away. the bot cant see the player or the bot is forced to the player, then follow breadcrumbs + if ((g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) > (float)follow_distance || crumbForceMove) && crumbArrayLength >= 1 ) { + WalkTo(breadcrumbs[crumbBottom]); + + // If a crumb hasnt been pruned in a while, it probably cant travel to it so reset and wait for the player to collect it. + if (g_GlobalVars->curtime - 2.5F > crumb_prune_timeout) { + crumbStopped = true; + logging::Info("Cannot goto next crumb!\nCrumb Lost!"); + } + + // If the bot is next to the player then we clear our crumbs as theres no need to follow previously generated ones. + } else if (g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) < 100.0F && found_entity->IsVisible()) { + CrumbReset(); + crumbForceMove = false; + } + } + } + } + + + + + // If we have a follow target, then we attempt to mimic their conditions + if (following_idx2) { + + // If follow target is too far away and the local player is zoomed, then unzoom + if (found_entity->m_vecOrigin.DistTo(LOCAL_E->m_vecOrigin) > 325.0f) { + if (g_pLocalPlayer->bZoomed) g_pUserCmd->buttons |= IN_ATTACK2; + } + + // If found target is heavy and the local player is too, + if (CE_INT(found_entity, netvar.iClass) == tf_heavy && g_pLocalPlayer->clazz == tf_heavy) { + // If found target is spun up, then spin up too + if (HasCondition(found_entity)) { + g_pUserCmd->buttons |= IN_ATTACK2; + } + } + + // If found target is zoomed + if (HasCondition(found_entity)) { + // If the local player isnt zoomed and its class is sniper, then zoom in to mimic the followed target + if (!g_pLocalPlayer->bZoomed && g_pLocalPlayer->clazz == tf_sniper) { + g_pUserCmd->buttons |= IN_ATTACK2; + } + } + + // If user settings allow, we attemt to mimic taunting player + if (sync_taunt) { + // Check if target is taunting + if (HasCondition(found_entity)) { + // Check if local player isnt taunting + if (!HasCondition(LOCAL_E)) { + g_IEngine->ExecuteClientCmd("taunt"); } } } } - return false; } +// Used on a bot to select a target to follow +CatCommand follow("fb_follow", "Follows you (or player with SteamID specified)", [](const CCommand& args) { + + // Set our target steam id to the argument put into the command + follow_steamid = strtol(args.Arg(1), nullptr, 10); + + // Tell the followbot to follow entities + current_follow_type = EFollowType::ENTITY; + // Allow the followbot to move + allow_moving = true; +}); + +// Used by the main player to send an ipc request to the bots to follow +CatCommand follow_me("fb_follow_me", "Makes all bots follow you", []() { + + // Check if the ipc server is connected + if (ipc::peer) { + // Get our steam id + unsigned id = g_ISteamUser->GetSteamID().GetAccountID(); + // Send our id through the ipc server + ipc::peer->SendMessage((const char*)&id, 0, ipc::commands::set_follow_steamid, 0, 0); + } +}); + +// User command for cat_fb_tool +CatCommand tool("fb_tool", "Followbot multitool", [](const CCommand& args) { + + // Check if ipc server is connected + if (!ipc::peer) return; + + // If argument is "select" + if (!strcmp(args.Arg(1), "select")) { + logging::Info("FB TOOL -> SELECT"); + + // Check if the shift key is depressed + if (g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LSHIFT)) { + + // Shift cleans selection.. + selection.clear(); + selection_secondary.clear(); + logging::Info("Selection cleared!"); + + // If the shift key isnt depressed + } else { + + // Make a var and try to get an ent of what we are looking at + int eindex = 0; + WhatIAmLookingAt(&eindex, nullptr); + logging::Info("Selecting entity..."); + + // If the entity isnt null, Add the entity to the selection + if (eindex) { + SelectEntity(eindex); + } + } + + // If argument is "move" + } else if (!strcmp(args.Arg(1), "move")) { + logging::Info("FB TOOL -> MOVE"); + + // Create a vector and attemt to get an end vector from it + Vector destination; + WhatIAmLookingAt(nullptr, &destination); + + // Send the vector through the ipc server and tell the bots to move to it + float array[3] = { destination.x, destination.y, destination.z }; + ipc::peer->SendMessage((const char*)array, MakeMask(), ipc::commands::move_to_vector, nullptr, 0); + + // If argument is "stay" + } else if (!strcmp(args.Arg(1), "stay")) { + logging::Info("FB TOOL -> STAY"); + + // Send a message through the ipc server to notify the bots to stop moving + ipc::peer->SendMessage(nullptr, MakeMask(), ipc::commands::stop_moving, nullptr, 0); + + // If argument is "follow" + } else if (!strcmp(args.Arg(1), "follow")) { + logging::Info("FB TOOL -> FOLLOW"); + + // Send a message through the ipc server to notify the bots to start moving + ipc::peer->SendMessage(nullptr, MakeMask(), ipc::commands::start_moving, nullptr, 0); + } +}); + +// Helper Functions for bot selection + void SelectEntity(int idx) { logging::Info("Selecting entity %i", idx); CachedEntity* entity = ENTITY(idx); @@ -142,43 +484,23 @@ void SelectEntity(int idx) { logging::Info("Selected!"); } } - -void AddMessageHandlers(ipc::peer_t* peer) { - peer->SetCommandHandler(ipc::commands::set_follow_steamid, [](cat_ipc::command_s& command, void* payload) { - logging::Info("IPC Message: now following %ld", *(unsigned*)&command.cmd_data); - hacks::shared::followbot::follow_steamid = *(unsigned*)&command.cmd_data; - //Tell followbot to follow - crumbForceMove = true; - CrumbStart(); - }); - peer->SetCommandHandler(ipc::commands::move_to_vector, [](cat_ipc::command_s& command, void* payload) { - float* data = (float*)&command.cmd_data; - logging::Info("IPC Message: moving to %.2f %.2f %.2f", data[0], data[1], data[2]); - destination_point = Vector(data[0], data[1], data[2]); - destination_point_time = g_GlobalVars->curtime; - destination_reached = false; - //prevent followbot from following - crumbAbleToMove = false; - crumbStopped = true; - }); - peer->SetCommandHandler(ipc::commands::start_moving, [](cat_ipc::command_s& command, void* payload) { - allow_moving = true; - //Tell followbot to follow - crumbAbleToMove = true; - }); - peer->SetCommandHandler(ipc::commands::stop_moving, [](cat_ipc::command_s& command, void* payload) { - allow_moving = false; - crumbStopped = true; - }); -} - -CatCommand follow_me("fb_follow_me", "Makes all bots follow you", []() { - if (ipc::peer) { - unsigned id = g_ISteamUser->GetSteamID().GetAccountID(); - ipc::peer->SendMessage((const char*)&id, 0, ipc::commands::set_follow_steamid, 0, 0); + +// A Function to tell whether an entity input into it is a bot +bool IsBot(CachedEntity* entity) { + if (!ipc::peer) return false; + if (entity->m_Type == ENTITY_PLAYER) { + if (ipc::peer) { + for (unsigned i = 1; i < cat_ipc::max_peers; i++) { + if (!ipc::peer->memory->peer_data[i].free && ipc::peer->memory->peer_user_data[i].friendid == entity->player_info.friendsID) { + return true; + } + } + } } -}); - + return false; +} + +// :thinking: unsigned MakeMask() { unsigned result = 0; if (!ipc::peer) return 0; @@ -194,54 +516,77 @@ unsigned MakeMask() { } return result; } + +// Ipc message handlers. When an ipc event comes from an ipc server, its called below +void AddMessageHandlers(ipc::peer_t* peer) { + + // When the ipc server gives us a steam id to follow, we run the following + peer->SetCommandHandler(ipc::commands::set_follow_steamid, [](cat_ipc::command_s& command, void* payload) { + // Log in console the steam id that were following + logging::Info("IPC Message: now following %ld", *(unsigned*)&command.cmd_data); + // Set our steam id that we want to follow + hacks::shared::followbot::follow_steamid = *(unsigned*)&command.cmd_data; + // Tell the followbot to follow entities + current_follow_type = EFollowType::ENTITY; + }); + + // When the ipc server gives us a vector to follow, we run the following + peer->SetCommandHandler(ipc::commands::move_to_vector, [](cat_ipc::command_s& command, void* payload) { + // Create a var to recieve the payload with + float* data = (float*)&command.cmd_data; + // Log in console the vector that we will attemt to goto + logging::Info("IPC Message: moving to %.2f %.2f %.2f", data[0], data[1], data[2]); + // Set our dest info with the payload data + destination_point = Vector(data[0], data[1], data[2]); + destination_point_time = g_GlobalVars->curtime; + destination_reached = false; + // Notify the followbot to follow vectors + current_follow_type = EFollowType::VECTOR; + }); + + // When the ipc server tells us to start moving, we run the following + peer->SetCommandHandler(ipc::commands::start_moving, [](cat_ipc::command_s& command, void* payload) { + allow_moving = true; + }); + + // When the ipc server tells us to stop moving, we run the following + peer->SetCommandHandler(ipc::commands::stop_moving, [](cat_ipc::command_s& command, void* payload) { + allow_moving = false; + }); +} -CatCommand tool("fb_tool", "Followbot multitool", [](const CCommand& args) { - if (!ipc::peer) return; - if (args.ArgC() == 1) { - // TODO open a gui or something... - } else { - if (!strcmp(args.Arg(1), "select")) { - logging::Info("FB TOOL -> SELECT"); - if (g_IInputSystem->IsButtonDown(ButtonCode_t::KEY_LSHIFT)) { - // Shift cleans selection.. - selection.clear(); - selection_secondary.clear(); - logging::Info("Selection cleared!"); - } else { - logging::Info("Selecting entity..."); - int eindex = 0; - WhatIAmLookingAt(&eindex, nullptr); - if (eindex) { - SelectEntity(eindex); - } +// Function for when you want to goto a vector +void WalkTo(const Vector& vector) { + + // Check if the local player is not moving + if (CE_VECTOR(LOCAL_E, netvar.vVelocity).IsZero(1.0f)) { + // Set idle time if we havent already + if (!idle_time) idle_time = g_GlobalVars->curtime; + // If the vector is too high for the local player to reach, + if (vector.z - LOCAL_E->m_vecOrigin.z > 30.0f) { + // If the time idle is over 2 seconds + if (g_GlobalVars->curtime - idle_time > 2.0f) { + // If the player isnt zoomed, then jump + if (!g_pLocalPlayer->bZoomed) + g_pUserCmd->buttons |= IN_JUMP; } - } else if (!strcmp(args.Arg(1), "move")) { - logging::Info("FB TOOL -> MOVE"); - Vector destination; - WhatIAmLookingAt(nullptr, &destination); - float array[3] = { destination.x, destination.y, destination.z }; - ipc::peer->SendMessage((const char*)array, MakeMask(), ipc::commands::move_to_vector, nullptr, 0); - } else if (!strcmp(args.Arg(1), "stay")) { - logging::Info("FB TOOL -> STAY"); - ipc::peer->SendMessage(nullptr, MakeMask(), ipc::commands::stop_moving, nullptr, 0); - } else if (!strcmp(args.Arg(1), "follow")) { - logging::Info("FB TOOL -> FOLLOW"); - ipc::peer->SendMessage(nullptr, MakeMask(), ipc::commands::start_moving, nullptr, 0); + // Since the vector is close enough we reset our idle timer + } else { + idle_time = 0; } } -}); - -CatCommand follow("fb_follow", "Follows you (or player with SteamID specified)", [](const CCommand& args) { - follow_steamid = strtol(args.Arg(1), nullptr, 10); -}); -CatVar bot(CV_SWITCH, "fb_bot", "0", "This player is a bot", "Set to 1 in followbots' configs"); -CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "1", "Mimic selected weapon", "If enabled, this bot will select same weapon slot as the owner"); -CatVar always_medigun(CV_SWITCH, "fb_always_medigun", "1", "Always use Medigun", "Medics will always use Medigun"); -//CatVar sync_taunt(CV_SWITCH, "fb_sync_taunt", "1", "Synchronize taunts", "Bots will taunt if owner is taunting"); + + // Calculate how to get to a vector + auto result = ComputeMove(LOCAL_E->m_vecOrigin, vector); + // Push our move to usercmd + g_pUserCmd->forwardmove = result.first; + g_pUserCmd->sidemove = result.second; +} // I've spent 2 days on writing this method. // I couldn't succeed. // Just removed everything and put movement fix code from createmove here. +// Helper function for WalkTo std::pair ComputeMove(const Vector& a, const Vector& b) { Vector diff = (b - a); if (diff.Length() == 0) return { 0, 0 }; @@ -254,247 +599,195 @@ std::pair ComputeMove(const Vector& a, const Vector& b) { float yaw = DEG2RAD(ang.y - g_pUserCmd->viewangles.y); return { cos(yaw) * 450, -sin(yaw) * 450 }; } - -// I've removed that too early. -void PrintDebug() { -/* - const Vector& a = LOCAL_E->m_vecOrigin; - const Vector& b = last_direction; - - Vector diff = (b - a); - if (diff.Length() == 0) return; - AddSideString(format("dx: ", diff.x)); - AddSideString(format("dy: ", diff.y)); - //float v_cos = diff.x / diff.Length(); - //float rad = acos(v_cos); - //if (diff.y < 0) rad = 2 * PI - rad; - //AddSideString(format("angle: ", rad / PI, " PI")); - float yan = g_Settings.last_angles.y; - float yaw = DEG2RAD(yan); - AddSideString(format("yaw: ", yaw / PI, " PI")); - //float rad_diff = yaw - rad; - //AddSideString(format("diff: ", rad_diff / PI, " PI")); - - auto move = ComputeMove(a, b); - AddSideString(format("forward: ", move.first)); - AddSideString(format("side: ", move.second));*/ + + +// Crumb Followbot Helper functions + +//A function to reset the crumb followbot +void CrumbReset() { + + //A check to make sure using the fb tool repeatedly doesnt clear the cache of crumbs + //if (crumbStopped) { + crumbTop = 0; + crumbBottom = 0; + crumbArrayLength = 0; + crumb_prune_timeout = g_GlobalVars->curtime; + crumbFindNew = true; + crumbStopped = false; + logging::Info("Crumb Reset"); + //} } -void WalkTo(const Vector& vector) { - if (CE_VECTOR(LOCAL_E, netvar.vVelocity).IsZero(1.0f)) { - if (!idle_time) idle_time = g_GlobalVars->curtime; - if (LOCAL_E->m_vecOrigin.DistTo(vector) > 150.0f) { - if (g_GlobalVars->curtime - idle_time > 2.0f) { - if (!g_pLocalPlayer->bZoomed) - g_pUserCmd->buttons |= IN_JUMP; - } - } else { - idle_time = 0; - } - } - auto result = ComputeMove(LOCAL_E->m_vecOrigin, vector); - - g_pUserCmd->forwardmove = result.first; - g_pUserCmd->sidemove = result.second; +// A function to place a crumb into the array +void CrumbTopAdd(Vector crumbToAdd) { + + // Once the crumbs have hit the limit of the array, loop around and over write unused spots + if (crumbTop >= 55) { + crumbTop = 0; + } else { + // Else, bump the top number market of the array + crumbTop = crumbTop + 1; + } + + // Put the newly determined crumb into the array and add to the length + crumbArrayLength = crumbArrayLength + 1; + breadcrumbs[crumbTop] = crumbToAdd; + logging::Info("Crumb Top add"); + + // The array can only hold so many crumbs, once it goes over its cap, stop the bot to prevent un-needed movement + if (crumbArrayLength > 55) { + CrumbReset(); + crumbStopped = true; + logging::Info("Crumb Overload!\nDumping array"); + } } -void AfterCreateMove() { - auto it = selection.begin(); - while (it != selection.end()) { - int idx = *it; - CachedEntity* entity = ENTITY(idx); - if (CE_BAD(entity)) { - selection.erase(it++); - } else { - hacks::shared::esp::AddEntityString(entity, "[SELECTED]", colors::orange); - if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { - hacks::shared::esp::SetEntityColor(entity, colors::yellow); - } - ++it; - } - } - it = selection_secondary.begin(); - while (it != selection_secondary.end()) { - int idx = *it; - CachedEntity* entity = ENTITY(idx); - if (CE_BAD(entity)) { - selection_secondary.erase(it++); - } else { - hacks::shared::esp::AddEntityString(entity, "[SELECTED (SECONDARY)]", colors::orange); - if (fmod(g_GlobalVars->curtime, 2.0f) < 1.0f) { - hacks::shared::esp::SetEntityColor(entity, colors::yellow); - } - ++it; - } - } - DoWalking(); +// A function to free a crumb from the array +void CrumbBottomAdd() { + + // Once the crumbs have hit the limit of the array, loop around and over write unused spots + if (crumbBottom >= 55) { + crumbBottom = 0; + } else { + // Else, bump the top number market of the array + crumbBottom = crumbBottom + 1; + } + + // Subtract from the length to make room for more crumbs + crumbArrayLength = crumbArrayLength - 1; + logging::Info("Crumb Bottom add"); + + // A check to detect if too many crumbs have been removed. Without crumbs the bot will just use random variables in the array. + // To prevent un-nessasary movement, just clear the array and wait for player + if (crumbArrayLength < 0) { + CrumbReset(); + crumbStopped = true; + logging::Info("Crumb Over-Prune!\nDumping array"); + } } -void DoWalking() { +// Function called when we need to draw onto the screen +void Draw() { + + // Dont draw if bot isnt true if (!bot) return; - following_idx = 0; - for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) { - CachedEntity* ent = ENTITY(i); - if (CE_BAD(ent)) continue; - if (ent->player_info.friendsID == follow_steamid) { - following_idx = i; + + // If user settings allow, draw our breadcrumbs + if (crumb_draw) + DrawFollowbot(); +} + +// A Function for when we want to draw out the crumbs in the array onto the screen +void DrawFollowbot() { + + /*switch (current_follow_type) { + case EFollowType::VECTOR: // If our follow type is a vector, then we just draw a rect on the vector + + // Create a vector for the screen, run world to screen to bring the world vector into the screen vector, then draw a rect at the point + Vector scn; + draw::WorldToScreen(destination_point, scn); + drawgl::FilledRect(scn.x - 3, scn.y - 3, 6, 6); + // Return as we are finished + break; + + case EFollowType::ENTITY: // If our follow type is entity, then we draw out the crumbs here + logging::Info("Drawcrumb1"); + // Check if we have enough crumbs to draw a line between + if (crumbArrayLength < 2) { + + // If not, we check if we have 1 point and draw on it + if (crumbArrayLength == 1) { + + // Get the entity vector to screen and draw a rect on it + Vector scn; + draw::WorldToScreen(breadcrumbs[crumbBottom], scn); + drawgl::FilledRect(scn.x - 3, scn.y - 3, 6, 6); + } + + // Return as we have nothing else to do break; } + + // Create book keeping vars to draw with + Vector scnSrt, scnEnd; + int tmpCrumb1, tmpCrumb2; + + // For loop to draw through the crumbs + for (int i = 0; i < crumbArrayLength; i++) { + + // We need 2 crumbs to draw a line, so we get the number in the array for 2 crumbs + tmpCrumb1 = crumbBottom + i; + tmpCrumb2 = crumbBottom + i + 1; + + // Correction for array numbers when one goes over our limit + if (tmpCrumb1 >= 55) + tmpCrumb1 - 55; + if (tmpCrumb2 >= 55) + tmpCrumb1 - 55; + + // Take our 2 crumbs and get a position on the screen + draw::WorldToScreen(breadcrumbs[tmpCrumb1], scnSrt); + draw::WorldToScreen(breadcrumbs[tmpCrumb2], scnEnd); + + // Draw a line from one crumb to the other + drawgl::Line(scnSrt.x, scnSrt.y, scnEnd.x - scnSrt.x, scnEnd.y - scnSrt.y, colors::white); + + // If this is our first iteration, draw a box on 1 + if (i == 1) + drawgl::FilledRect(scnSrt.x - 3, scnSrt.y - 3, 6, 6); + } + break; + }*/ + AddSideString(format("Array Length: ", crumbArrayLength)); + AddSideString(format("Top Crumb: ", crumbTop)); + AddSideString(format("Bottom Crumb: ", crumbBottom)); + // Not using switch due to switch not working + if (crumbArrayLength < 2) { + + // If not, we check if we have 1 point and draw on it + if (crumbArrayLength == 1) { + + // Get the entity vector to screen and draw a rect on it + Vector scn; + draw::WorldToScreen(breadcrumbs[crumbBottom], scn); + drawgl::FilledRect(scn.x - 3, scn.y - 3, 6, 6); + } + + // Return as we have nothing else to do + return; } - CachedEntity* found_entity = ENTITY(following_idx); - static float last_slot_check = 0.0f; - if (g_GlobalVars->curtime < last_slot_check) last_slot_check = 0.0f; + // Create book keeping vars to draw with + Vector scnSrt, scnEnd; + int tmpCrumb1, tmpCrumb2; - if (following_idx && (always_medigun || mimic_slot) && (g_GlobalVars->curtime - last_slot_check > 1.0f) && !g_pLocalPlayer->life_state && !CE_BYTE(found_entity, netvar.iLifeState)) { - int owner_weapon_eid = (CE_INT(found_entity, netvar.hActiveWeapon) & 0xFFF); - IClientEntity* owner_weapon = g_IEntityList->GetClientEntity(owner_weapon_eid); - if (owner_weapon && CE_GOOD(g_pLocalPlayer->weapon())) { - // IsBaseCombatWeapon() - if (vfunc(RAW_ENT(g_pLocalPlayer->weapon()), 190, 0)(RAW_ENT(g_pLocalPlayer->weapon())) && - vfunc(owner_weapon, 190, 0)(owner_weapon)) { - int my_slot = vfunc(RAW_ENT(g_pLocalPlayer->weapon()), 395, 0)(RAW_ENT(g_pLocalPlayer->weapon())); - int owner_slot = vfunc(owner_weapon, 395, 0)(owner_weapon); - if (g_pLocalPlayer->clazz == tf_medic && always_medigun) { - if (my_slot != 1) { - g_IEngine->ExecuteClientCmd("slot2"); - } - } else { - if (my_slot != owner_slot) { - g_IEngine->ExecuteClientCmd(format("slot", owner_slot + 1).c_str()); - } - } - } - // FIXME proper classes - // FIXME IsBaseCombatWeapon - } - last_slot_check = g_GlobalVars->curtime; - } - - //Nullified Cats Followbot code used for followbot tool - //Keeping this for the followbot move and stay commands - //TODO remove player follow from this or change it to be a backup for the crumb follow bot - if (!crumbAbleToMove) { - if (destination_point_time > g_GlobalVars->curtime) destination_point_time = 0.0f; - - if (!destination_reached && (g_GlobalVars->curtime - destination_point_time < 5.0f)) { - WalkTo(destination_point); - last_direction = destination_point; - if (g_pLocalPlayer->v_Origin.DistTo(destination_point) < 50.0f) destination_reached = true; - } else if (following_idx) { - if (allow_moving) { - if (!found_entity->IsVisible()) { - if (!lost_time) { - lost_time = g_GlobalVars->curtime; - } - if (g_GlobalVars->curtime - lost_time < 2.0f) { - WalkTo(last_direction); - } - } else { - lost_time = 0; - if (found_entity->m_vecOrigin.DistTo(LOCAL_E->m_vecOrigin) > 150.0f) { - WalkTo(found_entity->m_vecOrigin); - } - last_direction = found_entity->m_vecOrigin; - } - } - } - } - - //Breadcrumb followbot - if (allow_moving && crumbAbleToMove && !crumbStopped) { - //Generate new breadcrumbs made by the player only if they are close to the ground. If the bot is told to generate a starting point, it does that as well. - if ((found_entity->m_vecOrigin.DistTo(breadcrumbs[crumbTop]) > 40.0F || crumbFindNew) && crumbDistanceToFloor(found_entity) < 25) { - //Add to the crumb. - CrumbTopAdd(found_entity->m_vecOrigin); - - //If the bot was forced to select a point, add a buffer crumb and bump to the newly selected point and use it - if (crumbFindNew) { - crumbFindNew = false; - CrumbTopAdd(found_entity->m_vecOrigin); - CrumbBottomAdd(); - } - } - - //Prune used crumbs from the stack to make way for new ones when you get close to them. - if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 40.0F) { - //Debug Logging - logging::Info("Pruning"); - - //When the bot is forced to move to the player, since they have reached their destination we reset the var - crumbForceMove = false; - - //Check 15 times for close crumbs to prune, this allows simple miss steps to be smoothed out as well as make room for new crumbs - for (int i = 0; i < 15; i++) { - //When one is close or too high, just bump the array and reset the stuck timer - if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 60.0F) { - CrumbBottomAdd(); - - //When pruning is finished. Break the loop - } else { - crumbWaitPrune = g_GlobalVars->curtime; - logging::Info("Finish Prune"); - break; - } - } - //Reset stuck timer - crumbWaitPrune = g_GlobalVars->curtime; - } - - //When the player is not visible to the bot, within 5 seconds of it not being visible we stop the bot and wait for the player to collect it - if (!found_entity->IsVisible()) { - if (g_GlobalVars->curtime - 5.0F > crumbWaitVis && g_GlobalVars->curtime - 2.5F > crumbWaitPrune) { - //crumbStopped = true; - logging::Info("Crumb Lost!"); - } - - //If the player is visible, then reset our lost timer. - } else crumbWaitVis = g_GlobalVars->curtime; - - - //When player to follow is too far away. the bot cant see the player or the bot is forced to the player, then follow breadcrumbs - if ((g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) > (float)crumbFollowDistance || crumbForceMove) && crumbArrayLength >= 1 ) { - WalkTo(breadcrumbs[crumbBottom]); - - //If a crumb hasnt been pruned in a while, it probably cant travel to it so reset and wait for the player to collect it. - if (g_GlobalVars->curtime - 2.5F > crumbWaitPrune) { - crumbStopped = true; - logging::Info("Cannot goto next crumb!\nCrumb Lost!"); - } - - //If the bot is next to the player then we clear our crumbs as theres no need to follow previously generated ones. - } else if (g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) < 100.0F && found_entity->IsVisible()) { - crumbForceMove = false; - crumbStopped = true; - CrumbStart(); - } - - //If the bot is lost but it finds the player again, start the followbot again. - } else if (crumbStopped && allow_moving && crumbAbleToMove && found_entity->IsVisible() && (g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) < 3000.0F)) { - crumbForceMove = true; - CrumbStart(); - logging::Info("Crumb found player!"); - } - - if (following_idx) { - if (found_entity->m_vecOrigin.DistTo(LOCAL_E->m_vecOrigin) > 150.0f) { - if (LOCAL_E->m_vecOrigin.DistTo(found_entity->m_vecOrigin) > 350.0f) { - if (g_pLocalPlayer->bZoomed) g_pUserCmd->buttons |= IN_ATTACK2; - } - } - if (CE_INT(found_entity, netvar.iClass) == tf_heavy && g_pLocalPlayer->clazz == tf_heavy) { - if (HasCondition(found_entity)) { - g_pUserCmd->buttons |= IN_ATTACK2; - } - } - if (HasCondition(found_entity)) { - if (!g_pLocalPlayer->bZoomed && g_pLocalPlayer->clazz == tf_sniper) { - g_pUserCmd->buttons |= IN_ATTACK2; - } - } + // For loop to draw through the crumbs + for (int i = 0; i < crumbArrayLength; i++) { + + // We need 2 crumbs to draw a line, so we get the number in the array for 2 crumbs + tmpCrumb1 = crumbBottom + i; + tmpCrumb2 = crumbBottom + i + 1; + + // Correction for array numbers when one goes over our limit + if (tmpCrumb1 >= 55) + tmpCrumb1 - 55; + if (tmpCrumb2 >= 55) + tmpCrumb1 - 55; + + // Take our 2 crumbs and get a position on the screen + draw::WorldToScreen(breadcrumbs[tmpCrumb1], scnSrt); + draw::WorldToScreen(breadcrumbs[tmpCrumb2], scnEnd); + + // Draw a line from one crumb to the other + drawgl::Line(scnSrt.x, scnSrt.y, scnEnd.x - scnSrt.x, scnEnd.y - scnSrt.y, colors::white); + + // If this is our first iteration, draw a box on 1 + if (i == 0) + drawgl::FilledRect(scnSrt.x - 3, scnSrt.y - 3, 6, 6); } + return; } - + }}} #endif diff --git a/src/hacks/FollowBot.h b/src/hacks/FollowBot.h index a97cdfd8..c38c069d 100644 --- a/src/hacks/FollowBot.h +++ b/src/hacks/FollowBot.h @@ -18,19 +18,32 @@ class CachedEntity; namespace hacks { namespace shared { namespace followbot { -extern CatCommand move_to_crosshair; -extern CatCommand follow; -extern CatCommand follow_entity; +enum class EFollowType { + VECTOR, // When we need to goto a vector + ENTITY // when we dont have a specific steamid, but we still want to follow an entity +}; + +//extern CatCommand move_to_crosshair; +//extern CatCommand follow; +//extern CatCommand follow_entity; extern CatVar bot; extern unsigned follow_steamid; extern int following_idx; bool IsBot(CachedEntity* entity); -void DoWalking(); -void PrintDebug(); void AddMessageHandlers(ipc::peer_t* peer); void AfterCreateMove(); +void Draw(); +void CrumbReset(); +void CrumbTopAdd(Vector crumbToAdd); +void CrumbBottomAdd(); +void DoWalking(); +void DrawFollowbot(); +std::pair ComputeMove(const Vector& a, const Vector& b); +void WalkTo(const Vector& vector); +unsigned MakeMask(); +void SelectEntity(int idx); }}} From cae1a5b542a07d420ab3ec47e5a3547f1075421d Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 13 Jul 2017 14:43:20 -0500 Subject: [PATCH 02/48] Added ignore deadringer and some checks to auto sticky and reflect --- src/hacks/Aimbot.cpp | 15 +++++++++++++-- src/hacks/AutoReflect.cpp | 4 ++++ src/hacks/AutoSticky.cpp | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 165c7d20..11202a9c 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -55,6 +55,7 @@ static CatVar wait_for_charge(CV_SWITCH, "aimbot_charge", "0", "Wait for sniper static CatVar ignore_vaccinator(CV_SWITCH, "aimbot_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies"); static CatVar ignore_cloak(CV_SWITCH, "aimbot_ignore_cloak", "1", "Ignore cloaked", "Don't aim at invisible enemies"); +static CatVar ignore_deadringer(CV_SWITCH, "aimbot_ignore_deadringer", "1", "Ignore deadringer", "Don't aim at deadringed enemies"); static CatVar buildings_sentry(CV_SWITCH, "aimbot_buildings_sentry", "1", "Aim Sentry", "Should aimbot aim at sentryguns?"); static CatVar buildings_other(CV_SWITCH, "aimbot_buildings_other", "1", "Aim Other building", "Should aimbot aim at other buildings"); static CatVar stickybot(CV_SWITCH, "aimbot_stickys", "0", "Aim Sticky", "Should aimbot aim at stickys"); @@ -361,8 +362,18 @@ bool IsTargetStateGood(CachedEntity* entity) { if (ignore_taunting && HasCondition(entity)) return false; // Dont target invulnerable players, ex: uber, bonk if (IsPlayerInvulnerable(entity)) return false; - // If settings allow, dont target cloaked players - if (ignore_cloak && IsPlayerInvisible(entity)) return false; + // Checks for cloaked/deadringed players + if (ignore_cloak || ignore_deadringer) { + if (IsPlayerInvisible(entity)) { + // Determine whether cloaked player is using deadringer and checks user settings accordingly + // Item id for deadringer is 59 as of time of creation + if (HasWeapon(entity, 59)) { + if (ignore_deadringer) return false; + } else { + if (ignore_cloak) return false; + } + } + } // If settings allow, dont target vaccinated players if (g_pLocalPlayer->weapon_mode == weaponmode::weapon_hitscan || LOCAL_W->m_iClassID == CL_CLASS(CTFCompoundBow)) if (ignore_vaccinator && HasCondition(entity)) return false; diff --git a/src/hacks/AutoReflect.cpp b/src/hacks/AutoReflect.cpp index 5c241dd2..7e8316b9 100644 --- a/src/hacks/AutoReflect.cpp +++ b/src/hacks/AutoReflect.cpp @@ -32,6 +32,10 @@ void CreateMove() { // Check if player is using a flame thrower if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFFlameThrower)) return; + + // Check for phlogistinator, which is item 594 + if (HasWeapon(LOCAL_E, 594)) return; + // If user settings allow, return if local player is in attack if (idle_only && (g_pUserCmd->buttons & IN_ATTACK)) return; diff --git a/src/hacks/AutoSticky.cpp b/src/hacks/AutoSticky.cpp index ab7ca58c..ecd178b2 100644 --- a/src/hacks/AutoSticky.cpp +++ b/src/hacks/AutoSticky.cpp @@ -81,7 +81,7 @@ void CreateMove() { if (g_pLocalPlayer->clazz != tf_demoman) return; // Check for sticky jumper, which is item 265, if true, return - if (HasWeapon(LOCAL_E, 265)); + if (HasWeapon(LOCAL_E, 265)) return; // Clear the arrays bombs.clear(); From 22d8716b05d928155f2f59304d9d1b54522b4581 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 13 Jul 2017 15:26:58 -0500 Subject: [PATCH 03/48] Fixed minigun autoshoot per request --- src/hacks/Aimbot.cpp | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 11202a9c..f84f4711 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -94,6 +94,8 @@ static CatVar huntsman_full_auto(CV_SWITCH, "aimbot_full_auto_huntsman", "1", "A // Debug vars static CatVar aimbot_debug(CV_SWITCH, "aimbot_debug", "0", "Aimbot Debug", "Display simple debug info for aimbot"); static CatVar engine_projpred(CV_SWITCH, "debug_aimbot_engine_pp", "0", "Engine ProjPred"); +// Followbot vars +static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); /* TODO IMPLEMENT static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); @@ -122,10 +124,6 @@ void CreateMove() { // Check if aimbot is enabled if (!enabled) return; - // Save should aim info - bool shouldAim = ShouldAim(); - bool aimkeyStatus = UpdateAimkey(); - // Refresh projectile info int huntsman_ticks = 0; projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), cur_proj_speed, cur_proj_grav)); @@ -142,23 +140,27 @@ void CreateMove() { huntsman_ticks = max(0, huntsman_ticks - 1); } + // Save should aim info + // We do this as we need to pass whether the aimkey allows aiming to both the find target and aiming system. If we just call the func than toggle aimkey would break so we save it to a var to use it twice + bool aimkey_status = UpdateAimkey(); + // Refresh our best target - CachedEntity* target = RetrieveBestTarget(aimkeyStatus); + CachedEntity* target = RetrieveBestTarget(aimkey_status); // Check target for dormancy and if there even is a target at all if (CE_GOOD(target) && foundTarget) { + // Set target esp color to pink hacks::shared::esp::SetEntityColor(target, colors::pink); // Check if player can aim and if aimkey allows aiming // We also preform a CanShoot check here per the old canshoot method - if (shouldAim && aimkeyStatus && GetCanAim(1)) { + if (ShouldAim() && aimkey_status && GetCanAim(1)) { // Check if player isnt using a huntsman if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFCompoundBow)) { - // If settings allow, limit aiming to only when can shoot - // We do this here only if wip is true as we do the check elsewhere for legacy + // We check if we need to do a canshoot check as we might want to shoot but not aim, so do that check here if (GetCanAim(2)) { // Check the flNextPrimaryAttack netvar to tell when to aim if (CanShoot()) Aim(target); @@ -252,6 +254,7 @@ bool ShouldAim() { return false; }; } + IF_GAME (IsTF()) { // Check if player is zooming if (g_pLocalPlayer->bZoomed) { @@ -259,8 +262,19 @@ bool ShouldAim() { if (!CanHeadshot()) return false; } } - } - IF_GAME (IsTF()) { + + // Minigun spun up handler + if (g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFMinigun)) { + int weapon_state = CE_INT(g_pLocalPlayer->weapon(), netvar.iWeaponState); + // If user setting for autospin isnt true, then we check if minigun is already zoomed + if ((weapon_state == MinigunState_t::AC_STATE_IDLE || weapon_state == MinigunState_t::AC_STATE_STARTFIRING) && !auto_spin_up) { + return false; + } + if (!(g_pUserCmd->buttons & (IN_ATTACK2 | IN_ATTACK))) { + return false; + } + } + // Check if crithack allows attacking if (!AllowAttacking()) return false; From 984385d92e643090ec4ecd7b53ee8eb45e27c80c Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 13 Jul 2017 22:28:56 -0500 Subject: [PATCH 04/48] stuff --- TODO | 198 +++++++++++++++++++++++++++------------ simple-ipc | 2 +- src/hacks/AutoSticky.cpp | 3 + src/hacks/FollowBot.cpp | 54 ++++++++--- src/hacks/Spam.cpp | 56 +++++++++-- 5 files changed, 227 insertions(+), 86 deletions(-) diff --git a/TODO b/TODO index 620a5ae1..4c0cd318 100644 --- a/TODO +++ b/TODO @@ -1,67 +1,141 @@ -MULTIPLATFORM: - -Signature Scanner -Whole IPC thing | actually, no. cathook for windows WON'T have followbots/ipc. -Signatures and offsets -File handling (playerlist, spam, etc...) -CMake? - -------------====----------- +//==================================================================================================// +//Big TODO list for cathook // +//Organized by Julianacat // +//==================================================================================================// -TF2C teams -TF2C merc -HL2DM teams -fullbright toggle -Hunter Rifle -TTS -namesteal -autovote -voice command spam (not like 1 voice command every 1 ms but like just spamming it on the menu) +//----------------------------------------------------------------------------------------------------------------------// +//Aimbot/Triggerbot // +//------------------------------------------------------------------------------------------------------------------// // + // // +Hook + Aimbot FIX // // + // // +no aim sapper // // + // // +Make hacks respect Mannpower powerups and other conditions when calcuating damage, hitbox and prioritizing targets // // +Proper AutoHitbox, Isnt this already a thing?? // // + // // +Flare aim on fire // // +Improve Projectile Aimbot. A lot. // // +ProjPredOrigin // // +MAX -> MIN priority // // + // // +Hunter Rifle? // // + // // +AutoDetonator // // + // // +No AutoShoot when disguised // // +Ambassador bodyshotting // // +No Trigger Mediguns // // +More projectile weapons aimbot (wrap assassin, wrangler, stickybomb, airstrike) // // +Auto trigger DR before rockets // // + // // +Make make sentrys slightly lower priority (for getting those pesky turtle engies) // // + // // +Make building aimbot compensate for gravity on projectile weapons // // + // // +add Spectator Silent for projectile weapons // // + // // +Improve aimbot accuracy // // + // // +Add Multipoint (Take hitbox, shrink it, then use corners as points to check) // // + // // +Make ambasador check rely on wait for charge user setting // // + // // +//------------------------------------------------------------------------------------------------------------------// // +// // +//----------------------------------------------------------------------------------------------------------------------// + + -dominatesay assistsay worldsay -AutoDetonator +//----------------------------------------------------------------------------------------------------------------------// +//Visuals/GUI // +//------------------------------------------------------------------------------------------------------------------// // + // // +Display on the left // // + // // +make gui color change // // + // // +Cheat status menu (A gui to display enabled/disabled states of user settings for when the menu is off) // // + // // +add teleporter count down // // +add spy cloak esp // // + // // +Make ubercharge esp color RGB when fully charged // // + // // +fullbright toggle // // + // // +FLAG ESP? // // + // // +ESP Icons // // +ESP Distance sort // // +Show sapped buildings in ESP // // +halloween medkits // // +carrying esp // // +Tracers/Spy Cam // // + // // +//------------------------------------------------------------------------------------------------------------------// // +// // +//----------------------------------------------------------------------------------------------------------------------// -ProjPredOrigin -MAX -> MIN priority -Deflected by enemy player - Aim Stickies -FLAG ESP -no aim sapper -Improve Projectile Aimbot. A lot. -Proper AutoHitbox -Display on the left -Flare aim on fire -Aim Sticky -Proj Pred visuals -Hook + Aimbot FIX -ESP Icons -ESP Distance sort -Show sapped buildings in ESP -Make hacks respect Mannpower powerups and other conditions when calcuating damage, hitbox and prioritizing targets -Fake Lag -Engine Prediction -AutoSticky improve -No AutoShoot when disguised -Ambassador bodyshotting -No Trigger Mediguns -More projectile weapons aimbot (wrap assassin, wrangler, stickybomb, airstrike) -Auto trigger DR before rockets -Sticky vischeck -InsultSpam -Critical rifles bodyshotting -FLAG ESP -Spy alert uses angles -halloween medkits -carrying esp -Tracers/Spy Cam -Bodyshot if not zoomed -Proper medic followbot AI -Bot option for aiming at owner's prey (just for fun) -Bot pathfinding & navigation files system -Proper entity classes (actually I might just use a lot of helper functions taking IClientEntity* as first arg) -Priority system optimization and testing -General optimization and refactoring -Bone ESP -XorString or something to make it harder to detect. \ No newline at end of file + + +//----------------------------------------------------------------------------------------------------------------------// +//Chat and Related // +//------------------------------------------------------------------------------------------------------------------// // + // // +TTS // // +namesteal // // +autovote // // + // // +dominatesay assistsay worldsay // // +InsultSpam // // + // // +//------------------------------------------------------------------------------------------------------------------// // +// // +//----------------------------------------------------------------------------------------------------------------------// + + + +//----------------------------------------------------------------------------------------------------------------------// +//Followbots // +//------------------------------------------------------------------------------------------------------------------// // + // // +Proper medic followbot AI, breadcrumb followbot is good but a nav system would be better // // + // // +Bot option for aiming at owner's prey (just for fun) // // +Bot pathfinding & navigation files system // // +Proper entity classes (actually I might just use a lot of helper functions taking IClientEntity* as first arg) // // + // // +//------------------------------------------------------------------------------------------------------------------// // +// // +//----------------------------------------------------------------------------------------------------------------------// + + + +//----------------------------------------------------------------------------------------------------------------------// +//Misc // +//------------------------------------------------------------------------------------------------------------------// // + // // +Proper Fake Lag // // +Add auto-strafe // // + // // +Fix achievement hack getting blocked with sv_cheats // // + // // +Spy alert uses angles // // + // // +Add ignore gunslinger to melee crit hack // // + // // +Priority system optimization and testing // // +General optimization and refactoring // // + // // +XorString or something to make it harder to detect. // // + // // +TF2C teams // // +TF2C merc // // +HL2DM teams // // + // // +//------------------------------------------------------------------------------------------------------------------// // +// // +//----------------------------------------------------------------------------------------------------------------------// diff --git a/simple-ipc b/simple-ipc index 94a287d6..e532876f 160000 --- a/simple-ipc +++ b/simple-ipc @@ -1 +1 @@ -Subproject commit 94a287d6faa00d44e1084b04e602842849858443 +Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839 diff --git a/src/hacks/AutoSticky.cpp b/src/hacks/AutoSticky.cpp index ecd178b2..c5937a77 100644 --- a/src/hacks/AutoSticky.cpp +++ b/src/hacks/AutoSticky.cpp @@ -77,6 +77,9 @@ void CreateMove() { // Check user settings if auto-sticky is enabled if (!enabled) return; + // Check if game is a tf game + IF_GAME (!IsTF()) return; + // Check if player is demoman if (g_pLocalPlayer->clazz != tf_demoman) return; diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 155ab134..f8538900 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -13,6 +13,19 @@ namespace hacks { namespace shared { namespace followbot { + + + + +/* Big Followbot TODO list +1. Fix crash when setting followbot_idx var and remove the fix var in its place +2. Test with followbots to ensure that vector followbot and crumb followbot work as intended +3. Clean the finished code and push to main from fork +*/ + + + + // User settings CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs"); CatVar follow_distance(CV_FLOAT, "fb_follow_distance", "175", "Followbot Follow Distance", "How close the bots should stay to the target"); @@ -50,7 +63,7 @@ bool destination_reached { false }; // Vars for breadcrumb followbot // An array for storing the breadcrumbs -Vector breadcrumbs [55]; +static Vector breadcrumbs [55]; // Array Bookkeeping vars int crumbBottom = 0; int crumbTop = 0; @@ -112,8 +125,8 @@ void DoWalking() { // Get our best target, preferably from a steamid //following_idx = 0; - CachedEntity* best_target = 0; - CachedEntity* target_priority = 0; + CachedEntity* best_target = nullptr; + CachedEntity* target_priority = nullptr; // Get ent from steamid for (int i = 1; i < HIGHEST_ENTITY; i++) { @@ -165,7 +178,7 @@ void DoWalking() { float target_highest_score = -256; CachedEntity* ent; - target_last = 0; + target_last = nullptr; crumbStopped = true; for (int i = 0; i < HIGHEST_ENTITY; i++) { @@ -193,6 +206,9 @@ void DoWalking() { } CachedEntity* found_entity = best_target; + // TODO, setting following_idx causes a crash for an unknown reason, probs to do with autoheal. + // I created a different var to take its place and prevent the crash but i need to fix the crash with the externed var. + // For now this works and it will stay like this untill i fix it int following_idx2 = 0; if (CE_GOOD(found_entity)) { following_idx2 = found_entity->m_IDX; @@ -206,8 +222,10 @@ void DoWalking() { + + // Slot Changer/Mimicer - logging::Info("Slot changer"); + // Set a static var for last slot check static float last_slot_check = 0.0f; @@ -252,9 +270,12 @@ void DoWalking() { } - logging::Info("Start follow"); + + + // Main followbot code if (allow_moving) { + // Switch to different types of following mechanisms depending on the type we need to go to switch (current_follow_type) { case EFollowType::VECTOR: // If were using a vector to follow, we just go directly to it @@ -274,7 +295,7 @@ void DoWalking() { case EFollowType::ENTITY: // If were using a player to follow, we use the breadcrumb followbot if (CE_GOOD(found_entity)) { - //If the bot is lost but it finds the player again, start the followbot again. + // If the bot is lost but it finds the player again, start the followbot again. if (crumbStopped) { crumbForceMove = true; CrumbReset(); @@ -311,7 +332,7 @@ void DoWalking() { // Check 15 times for close crumbs to prune, this allows simple miss steps to be smoothed out as well as make room for new crumbs for (int i = 0; i < 15; i++) { - //When one is close or too high, just bump the array and reset the stuck timer + // When one is close or too high, just bump the array and reset the stuck timer if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 60.0F && crumbArrayLength > 1) { CrumbBottomAdd(); @@ -563,7 +584,7 @@ void WalkTo(const Vector& vector) { // Set idle time if we havent already if (!idle_time) idle_time = g_GlobalVars->curtime; // If the vector is too high for the local player to reach, - if (vector.z - LOCAL_E->m_vecOrigin.z > 30.0f) { + if (vector.z - LOCAL_E->m_vecOrigin.z > 15.0f) { // If the time idle is over 2 seconds if (g_GlobalVars->curtime - idle_time > 2.0f) { // If the player isnt zoomed, then jump @@ -603,7 +624,7 @@ std::pair ComputeMove(const Vector& a, const Vector& b) { // Crumb Followbot Helper functions -//A function to reset the crumb followbot +// A function to reset the crumb followbot void CrumbReset() { //A check to make sure using the fb tool repeatedly doesnt clear the cache of crumbs @@ -679,7 +700,14 @@ void Draw() { // A Function for when we want to draw out the crumbs in the array onto the screen void DrawFollowbot() { - + + // Usefull debug info to know + AddSideString(format("Array Length: ", crumbArrayLength)); + AddSideString(format("Top Crumb: ", crumbTop)); + AddSideString(format("Bottom Crumb: ", crumbBottom)); + + // Disabled as the enum was misbeghaving for an unknown reason + /*switch (current_follow_type) { case EFollowType::VECTOR: // If our follow type is a vector, then we just draw a rect on the vector @@ -738,9 +766,7 @@ void DrawFollowbot() { } break; }*/ - AddSideString(format("Array Length: ", crumbArrayLength)); - AddSideString(format("Top Crumb: ", crumbTop)); - AddSideString(format("Bottom Crumb: ", crumbBottom)); + // Not using switch due to switch not working if (crumbArrayLength < 2) { diff --git a/src/hacks/Spam.cpp b/src/hacks/Spam.cpp index bc53e301..4e15e220 100644 --- a/src/hacks/Spam.cpp +++ b/src/hacks/Spam.cpp @@ -14,8 +14,13 @@ static CatEnum spam_enum({"DISABLED", "CUSTOM", "DEFAULT", "LENNYFACES", "BLANKS CatVar spam_source(spam_enum, "spam", "0", "Chat Spam", "Defines source of spam lines. CUSTOM spam file must be set in cat_spam_file and loaded with cat_spam_reload (Use console!)"); CatVar random_order(CV_SWITCH, "spam_random", "0", "Random Order"); CatVar filename(CV_STRING, "spam_file", "spam.txt", "Spam file", "Spam file name. Each line should be no longer than 100 characters, file must be located in cathook data folder"); -CatVar teamname_spam(CV_SWITCH, "spam_teamname", "0", "Teamname Spam", "Spam changes the tournament name"); CatCommand reload("spam_reload", "Reload spam file", Reload); + +static CatEnum voicecommand_enum({"DISABLED", "RANDOM", "MEDIC", "THANKS", "NICE SHOT", "CHEERS", "JEERS"}); +CatVar voicecommand_spam(voicecommand_enum, "spam_voicecommand", "0", "Voice Command Spam", "Spams tf voice commands"); + +CatVar teamname_spam(CV_SWITCH, "spam_teamname", "0", "Teamname Spam", "Spam changes the tournament name"); + bool teamname_swap = false; int current_index { 0 }; @@ -24,6 +29,8 @@ TextFile file {}; const std::string teams[] = { "RED", "BLU" }; + + // FUCK enum class. // It doesn't have bitwise operators by default!! WTF!! static_cast(REEE)! @@ -166,15 +173,46 @@ bool FormatSpamMessage(std::string& message) { } void CreateMove() { - if (teamname_spam) { - if (teamname_swap) { - teamname_swap = false; - g_IEngine->ServerCmd("tournament_teamname Cat"); - } else { - teamname_swap = true; - g_IEngine->ServerCmd("tournament_teamname Hook"); - } + + IF_GAME (IsTF2()) { + // Spam changes the tournament name in casual and compeditive gamemodes + if (teamname_spam) { + if (teamname_swap) { + teamname_swap = false; + g_IEngine->ServerCmd("tournament_teamname Cat"); + } else { + teamname_swap = true; + g_IEngine->ServerCmd("tournament_teamname Hook"); + } + } + + if (voicecommand_spam) { + static float last_voice_spam = 0.0f; + if (g_GlobalVars->curtime - 4.0F > last_voice_spam) { + switch ((int)voicecommand_spam) { + case 1: // RANDOM + g_IEngine->ServerCmd(format("voicemenu ", floor(RandFloatRange(0, 2.9)), " ", floor(RandFloatRange(0, 8.9))).c_str()); + break; + case 2: // MEDIC + g_IEngine->ServerCmd("voicemenu 0 0"); + break; + case 3: // THANKS + g_IEngine->ServerCmd("voicemenu 0 1"); + break; + case 4: // NICE SHOT + g_IEngine->ServerCmd("voicemenu 2 6"); + break; + case 5: // CHEERS + g_IEngine->ServerCmd("voicemenu 2 2"); + break; + case 6: // JEERS + g_IEngine->ServerCmd("voicemenu 2 3"); + } + last_voice_spam = g_GlobalVars->curtime; + } + } } + if (!spam_source) return; static int safety_ticks = 0; static int last_spam = 0; From 9d13e787b696217b42064b67feaa99c21196310c Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 14 Jul 2017 20:47:27 +0300 Subject: [PATCH 05/48] custom spam/killsay files automatically reload. fix imgui int for some catvars --- src/gui/im/Im.cpp | 1 + src/hack.cpp | 1 + src/hacks/KillSay.cpp | 3 +++ src/hacks/Spam.cpp | 6 ++++++ src/hacks/Spam.h | 1 + src/textfile.cpp | 16 ++++++++++++++++ src/textfile.h | 1 + 7 files changed, 29 insertions(+) diff --git a/src/gui/im/Im.cpp b/src/gui/im/Im.cpp index c3ce75d6..b6131498 100644 --- a/src/gui/im/Im.cpp +++ b/src/gui/im/Im.cpp @@ -31,6 +31,7 @@ void CatVar_Integer(CatVar& var) { int value = var; ImGui::PushItemWidth(120.0f); int step = var.restricted ? (var.max - var.min) / 50 : 1; + if (step == 0) step = 1; if (ImGui::InputInt(label, &value, step, step * 20)) { var = value; } diff --git a/src/hack.cpp b/src/hack.cpp index 3746fbca..87e29fdf 100644 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -272,6 +272,7 @@ void hack::Initialize() { hacks::shared::anticheat::Init(); hacks::tf2::healarrow::Init(); InitSpinner(); + hacks::shared::spam::Init(); logging::Info("Initialized Fidget Spinner"); } diff --git a/src/hacks/KillSay.cpp b/src/hacks/KillSay.cpp index 18c9e128..8ec75c48 100644 --- a/src/hacks/KillSay.cpp +++ b/src/hacks/KillSay.cpp @@ -82,6 +82,9 @@ void Reload() { void Init() { g_IEventManager2->AddListener(&getListener(), (const char*)"player_death", false); + filename.InstallChangeCallback([](IConVar* var, const char* pszOV, float flOV) { + file.TryLoad(std::string(filename.GetString())); + }); } void Shutdown() { diff --git a/src/hacks/Spam.cpp b/src/hacks/Spam.cpp index bc53e301..b56798d2 100644 --- a/src/hacks/Spam.cpp +++ b/src/hacks/Spam.cpp @@ -137,6 +137,12 @@ int QueryPlayer(Query query) { return index_result; } +void Init() { + filename.InstallChangeCallback([](IConVar* var, const char* pszOV, float flOV) { + file.TryLoad(std::string(filename.GetString())); + }); +} + bool SubstituteQueries(std::string& input) { size_t index = input.find("%query:"); while (index != std::string::npos) { diff --git a/src/hacks/Spam.h b/src/hacks/Spam.h index f32375ee..bab2173a 100644 --- a/src/hacks/Spam.h +++ b/src/hacks/Spam.h @@ -25,6 +25,7 @@ extern CatVar enabled; extern CatVar filename; extern CatCommand reload; +void Init(); void CreateMove(); void Reset(); void Reload(); diff --git a/src/textfile.cpp b/src/textfile.cpp index 0499c562..28c1b7d2 100644 --- a/src/textfile.cpp +++ b/src/textfile.cpp @@ -18,6 +18,21 @@ TextFile::TextFile() : lines {} {} +bool TextFile::TryLoad(std::string name) { + if (name.length() == 0) return false; + std::string filename = format("cathook/", name); + std::ifstream file(filename, std::ios::in); + if (!file) { + return false; + } + lines.clear(); + for (std::string line; std::getline(file, line);) { + if (*line.rbegin() == '\r') line.erase(line.length() - 1, 1); + lines.push_back(line); + } + return true; +} + void TextFile::Load(std::string name) { std::string filename = format("cathook/", name); std::ifstream file(filename, std::ios::in); @@ -27,6 +42,7 @@ void TextFile::Load(std::string name) { } lines.clear(); for (std::string line; std::getline(file, line);) { + if (*line.rbegin() == '\r') line.erase(line.length() - 1, 1); lines.push_back(line); } } diff --git a/src/textfile.h b/src/textfile.h index 29ee7523..e9df7356 100644 --- a/src/textfile.h +++ b/src/textfile.h @@ -17,6 +17,7 @@ class TextFile { public: TextFile(); void Load(std::string filename); + bool TryLoad(std::string filename); size_t LineCount() const; const std::string& Line(size_t id) const; public: From b42afe7feb253d876b68eb694618692c80781717 Mon Sep 17 00:00:00 2001 From: julianacat Date: Fri, 14 Jul 2017 19:22:07 -0500 Subject: [PATCH 06/48] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a32d4f0f..5ebd583f 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ and a lot of useful features, including Ubuntu dependencies installation: ```bash -sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install git libc6-dev gcc-6 g++-6 libc6-dev:i386 g++-6-multilib gdb libsdl2-dev libglew-dev libfreetype6-dev libfreetype6-dev:i386 -y && +sudo apt update && sudo apt install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt update && sudo apt install gcc-snapshot -y && sudo apt update && sudo apt install git libc6-dev gcc-6 g++-6 libc6-dev:i386 g++-6-multilib gdb libsdl2-dev libglew-dev libfreetype6-dev libfreetype6-dev:i386 -y ``` From 133830a1c61209edd128080b56f95da0c6c316ec Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 15 Jul 2017 14:38:13 +0300 Subject: [PATCH 07/48] AutoReflect key + experimental cat_nolerp --- src/hacks/AutoReflect.cpp | 3 ++- src/hooks/CreateMove.cpp | 37 ++++++++++++++++--------------------- tf-settings/menu.json | 3 ++- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/src/hacks/AutoReflect.cpp b/src/hacks/AutoReflect.cpp index 5c241dd2..1a6a88eb 100644 --- a/src/hacks/AutoReflect.cpp +++ b/src/hacks/AutoReflect.cpp @@ -17,7 +17,7 @@ CatVar enabled(CV_SWITCH, "reflect_enabled", "0", "Auto Reflect", "Master AutoRe CatVar idle_only(CV_SWITCH, "reflect_only_idle", "0", "Only when not shooting", "Don't AutoReflect if you're holding M1"); CatVar legit(CV_SWITCH, "reflect_legit", "0", "Legit Reflect", "Only Auto-airblasts projectiles that you can see, doesnt move your crosshair"); CatVar dodgeball(CV_SWITCH, "reflect_dodgeball", "0", "Dodgeball Mode", "Allows auto-reflect to work in dodgeball servers"); - +CatVar blastkey(CV_KEY, "reflect_key", "0", "Reflect Key", "Hold this key to activate auto-airblast"); CatVar stickies(CV_SWITCH, "reflect_stickybombs", "0", "Reflect stickies", "Reflect Stickybombs"); // TODO setup proj sorting // TODO CatVar big_proj(CV_SWITCH, "reflect_big_projectile", "0", "Reflect big projectiles", "Reflect Rockets"); @@ -29,6 +29,7 @@ CatVar stickies(CV_SWITCH, "reflect_stickybombs", "0", "Reflect stickies", "Refl void CreateMove() { // Check if user settings allow Auto Reflect if (!enabled) return; + if (blastkey && !blastkey.KeyDown()) return; // Check if player is using a flame thrower if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFFlameThrower)) return; diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 24e88a22..94d94b1e 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -13,25 +13,6 @@ #include "hookedmethods.h" #include -// FIXME remove this temporary code already! -float AngleDiff( float destAngle, float srcAngle ) -{ - float delta; - - delta = fmodf(destAngle - srcAngle, 360.0f); - if ( destAngle > srcAngle ) - { - if ( delta >= 180 ) - delta -= 360; - } - else - { - if ( delta <= -180 ) - delta += 360; - } - return delta; -} - #include "../profiler.h" static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump", "Allows jumping while shooting with minigun"); @@ -39,6 +20,8 @@ static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump", CatVar jointeam(CV_SWITCH, "fb_autoteam", "1", "Joins player team automatically (NYI)"); CatVar joinclass(CV_STRING, "fb_autoclass", "spy", "Class that will be picked after joining a team (NYI)"); +CatVar nolerp(CV_SWITCH, "nolerp", "0", "NoLerp mode (experimental)"); + class CMoveData; namespace engine_prediction { @@ -180,6 +163,17 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { time_replaced = false; curtime_old = g_GlobalVars->curtime; + static ConVar* sv_client_min_interp_ratio = g_ICvar->FindVar("sv_client_min_interp_ratio"); + static ConVar* cl_interp = g_ICvar->FindVar("cl_interp"); + static ConVar* cl_interp_ratio = g_ICvar->FindVar("cl_interp_ratio"); + + if (nolerp) { + g_pUserCmd->tick_count += 1; + if (sv_client_min_interp_ratio->GetInt() != -1) sv_client_min_interp_ratio->SetValue(-1); + if (cl_interp->GetInt() != 0) cl_interp->SetValue(0); + if (cl_interp_ratio->GetInt() != 0) cl_interp_ratio->SetValue(0); + } + if (!g_Settings.bInvalid && CE_GOOD(g_pLocalPlayer->entity)) { servertime = (float)CE_INT(g_pLocalPlayer->entity, netvar.nTickBase) * g_GlobalVars->interval_per_tick; g_GlobalVars->curtime = servertime; @@ -188,6 +182,9 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { if (g_Settings.bInvalid) { entity_cache::Invalidate(); } + + // Disabled because this causes EXTREME aimbot inaccuracy + //if (!cmd->command_number) return ret; // PROF_BEGIN(); { PROF_SECTION(EntityCache); @@ -203,8 +200,6 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { SAFE_CALL(g_pLocalPlayer->Update()); } g_Settings.bInvalid = false; - // Disabled because this causes EXTREME aimbot inaccuracy - //if (!cmd->command_number) return ret; #ifdef IPC_ENABLED static int team_joining_state = 0; static float last_jointeam_try = 0; diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 6a8797c9..06bf6625 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -113,7 +113,8 @@ "reflect_legit", "reflect_only_idle", "reflect_stickybombs", - "reflect_dodgeball" + "reflect_dodgeball", + "reflect_key" ] }, { From 390f499ffe9689356263175c0f79ab4324341ef1 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Sat, 15 Jul 2017 16:38:10 +0300 Subject: [PATCH 08/48] fix crash when changing thirdperson settings in menu --- src/globals.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/globals.cpp b/src/globals.cpp index f9505348..4900541c 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -14,7 +14,7 @@ int g_AppID = 0; void ThirdpersonCallback(IConVar* var, const char* pOldValue, float flOldValue) { if (force_thirdperson.convar_parent && !force_thirdperson) { - if (g_pLocalPlayer && g_pLocalPlayer->entity) + if (g_pLocalPlayer && CE_GOOD(g_pLocalPlayer->entity)) CE_INT(g_pLocalPlayer->entity, netvar.nForceTauntCam) = 0; } } From ca753b202af37bb97bf6edec0cb4d925b19335f1 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sat, 15 Jul 2017 17:44:40 -0500 Subject: [PATCH 09/48] re-added triggerbot presision --- src/hacks/Aimbot.cpp | 31 +++++++++++++--- src/hacks/AutoSticky.cpp | 2 +- src/hacks/Trigger.cpp | 78 +++++++++++++++++++++++++++++++++++++++- src/hacks/Trigger.h | 1 + 4 files changed, 105 insertions(+), 7 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 0d4d672c..53d1893a 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -526,10 +526,12 @@ bool CanAutoShoot() { IF_GAME (IsTF2()) { - // Check if players current weapon is an ambasador - if (IsAmbassador(g_pLocalPlayer->weapon())) { - // Check if ambasador can headshot - if (!AmbassadorCanHeadshot()) return false; + if (wait_for_charge) { + // Check if players current weapon is an ambasador + if (IsAmbassador(g_pLocalPlayer->weapon())) { + // Check if ambasador can headshot + if (!AmbassadorCanHeadshot()) return false; + } } } @@ -551,6 +553,25 @@ bool CanAutoShoot() { // Return false due to setting not allowing autoshoot return false; } + static CatVar displace(CV_INT, "displace", "4", "Expand 2D Box", "Expand 2D box by N units"); +Vector SimpleThonkPrediction(CachedEntity* ent, int hb) { + if (!ent) return Vector(); + Vector result; + GetHitbox(ent, hb, result); + float latency = g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + + g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_INCOMING); + result -= CE_VECTOR(ent, netvar.vVelocity) * (int)displace; + return result; +} + +Vector SimpleDisplacementPrediction(CachedEntity* ent, int hb) { + if (!ent) return Vector(); + Vector result; + GetHitbox(ent, hb, result); + Vector displacement = RAW_ENT(ent)->GetAbsOrigin() - ent->m_vecOrigin; + result += displacement; + return result; +} // Grab a vector for a specific ent const Vector& PredictEntity(CachedEntity* entity) { @@ -571,7 +592,7 @@ const Vector& PredictEntity(CachedEntity* entity) { } else { // If using extrapolation, then predict a vector if (extrapolate) - result = SimpleLatencyPrediction(entity, cd.hitbox); + result = SimpleThonkPrediction(entity, cd.hitbox); // else just grab strait from the hitbox else GetHitbox(entity, cd.hitbox, result); diff --git a/src/hacks/AutoSticky.cpp b/src/hacks/AutoSticky.cpp index c5937a77..e0a66006 100644 --- a/src/hacks/AutoSticky.cpp +++ b/src/hacks/AutoSticky.cpp @@ -78,7 +78,7 @@ void CreateMove() { if (!enabled) return; // Check if game is a tf game - IF_GAME (!IsTF()) return; + //IF_GAME (!IsTF()) return; // Check if player is demoman if (g_pLocalPlayer->clazz != tf_demoman) return; diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index 892f7974..ab0af204 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -26,6 +26,8 @@ static CatVar trigger_key_mode(trigger_key_modes_enum, "trigger_key_mode", "1", static CatEnum hitbox_mode_enum({ "AUTO-HEAD", "AUTO-CLOSEST", "Head only" }); static CatVar hitbox_mode(hitbox_mode_enum, "trigger_hitboxmode", "0", "Hitbox Mode", "Defines hitbox selection mode"); + +static CatVar accuracy(CV_INT, "trigger_accuracy", "0", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox"); static CatVar ignore_vaccinator(CV_SWITCH, "trigger_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "trigger_ignore_hoovy", "1", "Ignore Hoovies", "Triggerbot won't attack hoovies"); @@ -42,6 +44,7 @@ static CatVar max_range(CV_INT, "trigger_maxrange", "0", "Max distance", "900-1100 range is efficient for scout/widowmaker engineer", 4096.0f); int last_hb_traced = 0; +Vector forward; // The main "loop" of the triggerbot void CreateMove() { @@ -170,6 +173,35 @@ bool IsTargetStateGood(CachedEntity* entity) { if (last_hb_traced != hitbox_t::head) return false; } + // If usersettings tell us to use accuracy improvements and the cached hitbox isnt null, then we check if it hits here + if (accuracy) { + + // Get a cached hitbox for the one traced + hitbox_cache::CachedHitbox* hb = entity->hitboxes.GetHitbox(last_hb_traced); + + // Check for null + if (hb) { + + // Get the min and max for the hitbox + Vector minz(min(hb->min.x, hb->max.x), min(hb->min.y, hb->max.y), min(hb->min.z, hb->max.z)); + Vector maxz(max(hb->min.x, hb->max.x), max(hb->min.y, hb->max.y), max(hb->min.z, hb->max.z)); + + // Shrink the hitbox here + Vector size = maxz - minz; + Vector smod = size * 0.05f * (int)accuracy; + + // Save the changes to the vectors + minz += smod; + maxz -= smod; + + // Trace and test if it hits the smaller hitbox, if it fails we return false + Vector hit; + if (!CheckLineBox(minz, maxz, g_pLocalPlayer->v_Eye, forward, hit)) { + return false; + } + } + } + // Target passed the tests so return true return true; @@ -219,6 +251,7 @@ bool IsTargetStateGood(CachedEntity* entity) { // A function to return a potential entity in front of the player CachedEntity* FindEntInSight(float range) { + // We dont want to hit ourself so we set an ignore trace_t trace; trace::filter_default.SetSelf(RAW_ENT(g_pLocalPlayer->entity)); @@ -226,7 +259,6 @@ CachedEntity* FindEntInSight(float range) { // Use math to get a vector in front of the player float sp, sy, cp, cy; QAngle angle; - Vector forward; g_IEngine->GetViewAngles(angle); sy = sinf(DEG2RAD(angle[1])); cy = cosf(DEG2RAD(angle[1])); @@ -246,6 +278,7 @@ CachedEntity* FindEntInSight(float range) { // Return an ent if that is what we hit if (trace.m_pEnt) { + last_hb_traced = trace.hitbox; return ENTITY(((IClientEntity*)trace.m_pEnt)->entindex()); } @@ -384,6 +417,49 @@ float EffectiveTargetingRange() { } } +// Helper functions to trace for hitboxes + +// TEMPORARY CODE. +// TODO +bool GetIntersection(float fDst1, float fDst2, Vector P1, Vector P2, Vector& Hit) { + if ((fDst1 * fDst2) >= 0.0f) return false; + if (fDst1 == fDst2) return false; + Hit = P1 + (P2 - P1) * (-fDst1 / (fDst2 - fDst1)); + return true; +} + +bool InBox(Vector Hit, Vector B1, Vector B2, int Axis) { + if (Axis == 1 && Hit.z > B1.z && Hit.z < B2.z && Hit.y > B1.y && Hit.y < B2.y) return true; + if (Axis == 2 && Hit.z > B1.z && Hit.z < B2.z && Hit.x > B1.x && Hit.x < B2.x) return true; + if (Axis == 3 && Hit.x > B1.x && Hit.x < B2.x && Hit.y > B1.y && Hit.y < B2.y) return true; + return false; +} + +bool CheckLineBox(Vector B1, Vector B2, Vector L1, Vector L2, Vector& Hit) { + if (L2.x < B1.x && L1.x < B1.x) return false; + if (L2.x > B2.x && L1.x > B2.x) return false; + if (L2.y < B1.y && L1.y < B1.y) return false; + if (L2.y > B2.y && L1.y > B2.y) return false; + if (L2.z < B1.z && L1.z < B1.z) return false; + if (L2.z > B2.z && L1.z > B2.z) return false; + if (L1.x > B1.x && L1.x < B2.x && + L1.y > B1.y && L1.y < B2.y && + L1.z > B1.z && L1.z < B2.z) + { + Hit = L1; + return true; + } + if ((GetIntersection(L1.x - B1.x, L2.x - B1.x, L1, L2, Hit) && InBox(Hit, B1, B2, 1)) + || (GetIntersection(L1.y - B1.y, L2.y - B1.y, L1, L2, Hit) && InBox(Hit, B1, B2, 2)) + || (GetIntersection(L1.z - B1.z, L2.z - B1.z, L1, L2, Hit) && InBox(Hit, B1, B2, 3)) + || (GetIntersection(L1.x - B2.x, L2.x - B2.x, L1, L2, Hit) && InBox(Hit, B1, B2, 1)) + || (GetIntersection(L1.y - B2.y, L2.y - B2.y, L1, L2, Hit) && InBox(Hit, B1, B2, 2)) + || (GetIntersection(L1.z - B2.z, L2.z - B2.z, L1, L2, Hit) && InBox(Hit, B1, B2, 3))) + return true; + + return false; +} + void Draw() { } diff --git a/src/hacks/Trigger.h b/src/hacks/Trigger.h index f963678d..317a6b8b 100644 --- a/src/hacks/Trigger.h +++ b/src/hacks/Trigger.h @@ -22,6 +22,7 @@ bool HeadPreferable(CachedEntity* target); bool UpdateAimkey(); float EffectiveTargetingRange(); void Draw(); +bool CheckLineBox(Vector B1, Vector B2, Vector L1, Vector L2, Vector& Hit); }}} From 259e073cfb7b1d8e84c90b715848cd81f8bde9e3 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sat, 15 Jul 2017 17:49:13 -0500 Subject: [PATCH 10/48] Revert aimbot change --- src/entityhitboxcache.cpp | 8 ++++++-- src/hacks/Aimbot.cpp | 31 +++++-------------------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/entityhitboxcache.cpp b/src/entityhitboxcache.cpp index a265a900..06221177 100644 --- a/src/entityhitboxcache.cpp +++ b/src/entityhitboxcache.cpp @@ -36,7 +36,8 @@ void EntityHitboxCache::Update() { SAFE_CALL(InvalidateCache()); if (CE_BAD(parent_ref)) return; } - +static CatVar add_tick(CV_SWITCH, "add_tick", "1", "Expand 2D Box", "Expand 2D box by N units"); +static CatVar add_ticks(CV_INT, "add_ticks", "2", "Expand 2D Box", "Expand 2D box by N units"); void EntityHitboxCache::Init() { model_t *model; studiohdr_t *shdr; @@ -45,6 +46,9 @@ void EntityHitboxCache::Init() { m_bInit = true; model = 0; if (CE_BAD(parent_ref)) return; + + tickcount += 1; + SAFE_CALL(model = (model_t*)RAW_ENT(parent_ref)->GetModel()); if (!model) return; if (!m_bModelSet || model != m_pLastModel) { @@ -80,7 +84,7 @@ bool EntityHitboxCache::VisibilityCheck(int id) { } static CatEnum setupbones_time_enum({ "ZERO", "CURTIME", "LP SERVERTIME", "SIMTIME" }); -static CatVar setupbones_time(setupbones_time_enum, "setupbones_time", "1", "Setupbones", "Defines setupbones 4th argument, change it if your aimbot misses, idk!!"); +static CatVar setupbones_time(setupbones_time_enum, "setupbones_time", "3", "Setupbones", "Defines setupbones 4th argument, change it if your aimbot misses, idk!!"); matrix3x4_t* EntityHitboxCache::GetBones() { static float bones_setup_time = 0.0f; diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 53d1893a..0d4d672c 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -526,12 +526,10 @@ bool CanAutoShoot() { IF_GAME (IsTF2()) { - if (wait_for_charge) { - // Check if players current weapon is an ambasador - if (IsAmbassador(g_pLocalPlayer->weapon())) { - // Check if ambasador can headshot - if (!AmbassadorCanHeadshot()) return false; - } + // Check if players current weapon is an ambasador + if (IsAmbassador(g_pLocalPlayer->weapon())) { + // Check if ambasador can headshot + if (!AmbassadorCanHeadshot()) return false; } } @@ -553,25 +551,6 @@ bool CanAutoShoot() { // Return false due to setting not allowing autoshoot return false; } - static CatVar displace(CV_INT, "displace", "4", "Expand 2D Box", "Expand 2D box by N units"); -Vector SimpleThonkPrediction(CachedEntity* ent, int hb) { - if (!ent) return Vector(); - Vector result; - GetHitbox(ent, hb, result); - float latency = g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_OUTGOING) + - g_IEngine->GetNetChannelInfo()->GetLatency(FLOW_INCOMING); - result -= CE_VECTOR(ent, netvar.vVelocity) * (int)displace; - return result; -} - -Vector SimpleDisplacementPrediction(CachedEntity* ent, int hb) { - if (!ent) return Vector(); - Vector result; - GetHitbox(ent, hb, result); - Vector displacement = RAW_ENT(ent)->GetAbsOrigin() - ent->m_vecOrigin; - result += displacement; - return result; -} // Grab a vector for a specific ent const Vector& PredictEntity(CachedEntity* entity) { @@ -592,7 +571,7 @@ const Vector& PredictEntity(CachedEntity* entity) { } else { // If using extrapolation, then predict a vector if (extrapolate) - result = SimpleThonkPrediction(entity, cd.hitbox); + result = SimpleLatencyPrediction(entity, cd.hitbox); // else just grab strait from the hitbox else GetHitbox(entity, cd.hitbox, result); From 819af72987b8a477695d0ccc32dd72e775245767 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sat, 15 Jul 2017 17:52:00 -0500 Subject: [PATCH 11/48] well crap... --- src/entityhitboxcache.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/entityhitboxcache.cpp b/src/entityhitboxcache.cpp index 06221177..a265a900 100644 --- a/src/entityhitboxcache.cpp +++ b/src/entityhitboxcache.cpp @@ -36,8 +36,7 @@ void EntityHitboxCache::Update() { SAFE_CALL(InvalidateCache()); if (CE_BAD(parent_ref)) return; } -static CatVar add_tick(CV_SWITCH, "add_tick", "1", "Expand 2D Box", "Expand 2D box by N units"); -static CatVar add_ticks(CV_INT, "add_ticks", "2", "Expand 2D Box", "Expand 2D box by N units"); + void EntityHitboxCache::Init() { model_t *model; studiohdr_t *shdr; @@ -46,9 +45,6 @@ void EntityHitboxCache::Init() { m_bInit = true; model = 0; if (CE_BAD(parent_ref)) return; - - tickcount += 1; - SAFE_CALL(model = (model_t*)RAW_ENT(parent_ref)->GetModel()); if (!model) return; if (!m_bModelSet || model != m_pLastModel) { @@ -84,7 +80,7 @@ bool EntityHitboxCache::VisibilityCheck(int id) { } static CatEnum setupbones_time_enum({ "ZERO", "CURTIME", "LP SERVERTIME", "SIMTIME" }); -static CatVar setupbones_time(setupbones_time_enum, "setupbones_time", "3", "Setupbones", "Defines setupbones 4th argument, change it if your aimbot misses, idk!!"); +static CatVar setupbones_time(setupbones_time_enum, "setupbones_time", "1", "Setupbones", "Defines setupbones 4th argument, change it if your aimbot misses, idk!!"); matrix3x4_t* EntityHitboxCache::GetBones() { static float bones_setup_time = 0.0f; From fc38d071d01772e418eb6e5fba22464d04f33018 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 16 Jul 2017 21:26:40 -0500 Subject: [PATCH 12/48] Fixed followbot dying --- src/hacks/FollowBot.cpp | 264 ++++++++++++++++++++-------------------- 1 file changed, 135 insertions(+), 129 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index f8538900..a2949c71 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -28,8 +28,8 @@ namespace hacks { namespace shared { namespace followbot { // User settings CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs"); -CatVar follow_distance(CV_FLOAT, "fb_follow_distance", "175", "Followbot Follow Distance", "How close the bots should stay to the target"); -CatVar follow_activation(CV_FLOAT, "fb_follow_activation", "450", "Followbot Activation Distance", "How close a player should be until the followbot will pick a target"); +CatVar follow_distance(CV_FLOAT, "fb_distance", "175", "Followbot Follow Distance", "How close the bots should stay to the target"); +CatVar follow_activation(CV_FLOAT, "fb_activation", "175", "Followbot Activation Distance", "How close a player should be until the followbot will pick a target"); CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic selected weapon", "If enabled, this bot will select same weapon slot as the owner"); CatVar always_medigun(CV_SWITCH, "fb_always_medigun", "0", "Always use Medigun", "Medics will always use Medigun"); CatVar crumb_draw(CV_SWITCH, "fb_crumb_draw", "1", "Draw Crumbs", "Draws the path made for the followbot"); @@ -38,19 +38,12 @@ CatVar sync_taunt(CV_SWITCH, "fb_sync_taunt", "0", "Mimic taunts", "Bots will ta // Var to store the current steamid to follow unsigned follow_steamid { 1 }; - -// Vars that control jumping and the followbot -float idle_time = 0; -// Var that decides how the followbot will act and move +// Vars that decides how the followbot will act and move EFollowType current_follow_type = EFollowType::ENTITY; CachedEntity* target_last = 0; -//int target_last_idx = 0; - -// Var that controls whether the followbot is allowed to move -bool allow_moving = true; -//bool find_new_ent = true; int following_idx = 0; +bool allow_moving = true; // Arrays to store selected ents std::set selection {}; @@ -59,18 +52,20 @@ std::set selection_secondary {}; // Vars for vector followbot float destination_point_time { 0.0f }; Vector destination_point {}; -bool destination_reached { false }; - + +// Var that control jumping and the followbot +float idle_time = 0; + // Vars for breadcrumb followbot + // An array for storing the breadcrumbs static Vector breadcrumbs [55]; // Array Bookkeeping vars int crumbBottom = 0; int crumbTop = 0; int crumbArrayLength = 0; -// Timeout vars -float crumb_prune_timeout = 0; // Used for states for the followbot +float crumb_prune_timeout = 0; bool crumbStopped = true; bool crumbFindNew = false; bool crumbForceMove = false; @@ -113,8 +108,7 @@ void AfterCreateMove() { // Processing Selection is done, attemt to walk DoWalking(); } -CatVar deboog1(CV_INT, "fb_deboog", "0", "Mimic taunts", "Bots will taunt if target is taunting"); -//if ((int)deboog1 <= 1) return; + // Function for followbots to use for following, weapon selection, etc... void DoWalking() { @@ -208,14 +202,13 @@ void DoWalking() { CachedEntity* found_entity = best_target; // TODO, setting following_idx causes a crash for an unknown reason, probs to do with autoheal. // I created a different var to take its place and prevent the crash but i need to fix the crash with the externed var. - // For now this works and it will stay like this untill i fix it + // For now this works and it will stay like this untill I find a way to fix it int following_idx2 = 0; if (CE_GOOD(found_entity)) { following_idx2 = found_entity->m_IDX; hacks::shared::esp::AddEntityString(found_entity, "[FOLLOWING]", colors::green); hacks::shared::esp::SetEntityColor(found_entity, colors::green); } else { - logging::Info("Found ent is bad"); crumbStopped = true; return; } @@ -268,103 +261,110 @@ void DoWalking() { } } } - + // Main followbot code - if (allow_moving) { - - // Switch to different types of following mechanisms depending on the type we need to go to - switch (current_follow_type) { - case EFollowType::VECTOR: // If were using a vector to follow, we just go directly to it + - // If destination_point_time is more than curtime than we reset it to zero - if (destination_point_time > g_GlobalVars->curtime) destination_point_time = 0.0f; - // If we havent reached our destination and the destination point timeout isnt more than 5 seconds, then we continue to walk to the destination point - if (!destination_reached && (g_GlobalVars->curtime - destination_point_time < 5.0f)) { - // Walk to the point - WalkTo(destination_point); - // If we have reached the destination point then we set the var to true - if (g_pLocalPlayer->v_Origin.DistTo(destination_point) < 50.0f) destination_reached = true; + // Switch to different types of following mechanisms depending on the type we need to go to + switch (current_follow_type) { + case EFollowType::VECTOR: // If were using a vector to follow, we just go directly to it + + // If destination_point_time is more than curtime than we reset it to zero + if (destination_point_time > g_GlobalVars->curtime) destination_point_time = 0.0f; + + // If we havent reached our destination and the destination point timeout isnt more than 5 seconds, then we continue to walk to the destination point + if (g_GlobalVars->curtime - destination_point_time < 5.0f) { + + // Walk to the point + WalkTo(destination_point); + + // If we have reached the destination point then we want to disable the vector followbot + if (g_pLocalPlayer->v_Origin.DistTo(destination_point) < 50.0f) { + current_follow_type = EFollowType::ENTITY; } - // Break from the switch - break; + } + // Break from the switch + break; - case EFollowType::ENTITY: // If were using a player to follow, we use the breadcrumb followbot + case EFollowType::ENTITY: // If were using a player to follow, we use the breadcrumb followbot - if (CE_GOOD(found_entity)) { - // If the bot is lost but it finds the player again, start the followbot again. - if (crumbStopped) { - crumbForceMove = true; - CrumbReset(); - } - } else { - // If the entity we have isnt good, we stop the crumb followbot - crumbStopped = true; - } + if (CE_GOOD(found_entity)) { + // If the bot is lost but it finds the player again, start the followbot again. + if (crumbStopped) { + crumbForceMove = true; + CrumbReset(); + } + } else { + // If the entity we have isnt good, we stop the crumb followbot + crumbStopped = true; + } - - // Breadcrumb followbot - if (!crumbStopped) { - // Generate new breadcrumbs made by the player only if they are close to the ground. If the bot is told to generate a starting point, it does that as well. - if ((found_entity->m_vecOrigin.DistTo(breadcrumbs[crumbTop]) > 40.0F || crumbFindNew) && DistanceToGround(found_entity) < 25) { - // Add to the crumb. - CrumbTopAdd(found_entity->m_vecOrigin); - - // If the bot was forced to select a point, add a buffer crumb and bump to the newly selected point and use it - if (crumbFindNew) { - crumbFindNew = false; - CrumbTopAdd(found_entity->m_vecOrigin); - CrumbBottomAdd(); - } - } - - // Prune used crumbs from the stack to make way for new ones when you get close to them. - if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 40.0F ) { - // Debug Logging - logging::Info("Pruning"); - - // When the bot is forced to move to the player, since they have reached their destination we reset the var - crumbForceMove = false; - - // Check 15 times for close crumbs to prune, this allows simple miss steps to be smoothed out as well as make room for new crumbs - for (int i = 0; i < 15; i++) { - - // When one is close or too high, just bump the array and reset the stuck timer - if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 60.0F && crumbArrayLength > 1) { - CrumbBottomAdd(); - - // When pruning is finished. Break the loop - } else { - crumb_prune_timeout = g_GlobalVars->curtime; - logging::Info("Finish Prune"); - break; - } - } - // Reset stuck timer - crumb_prune_timeout = g_GlobalVars->curtime; - } - - // When player to follow is too far away. the bot cant see the player or the bot is forced to the player, then follow breadcrumbs - if ((g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) > (float)follow_distance || crumbForceMove) && crumbArrayLength >= 1 ) { - WalkTo(breadcrumbs[crumbBottom]); - - // If a crumb hasnt been pruned in a while, it probably cant travel to it so reset and wait for the player to collect it. - if (g_GlobalVars->curtime - 2.5F > crumb_prune_timeout) { - crumbStopped = true; - logging::Info("Cannot goto next crumb!\nCrumb Lost!"); - } + // Breadcrumb followbot + if (!crumbStopped) { - // If the bot is next to the player then we clear our crumbs as theres no need to follow previously generated ones. - } else if (g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) < 100.0F && found_entity->IsVisible()) { - CrumbReset(); - crumbForceMove = false; + // Generate new breadcrumbs made by the player only if they are close to the ground. If the bot is told to generate a starting point, it does that as well. + if ((found_entity->m_vecOrigin.DistTo(breadcrumbs[crumbTop]) > 40.0F || crumbFindNew) && DistanceToGround(found_entity) < 40) { + + // Add to the crumb. + CrumbTopAdd(found_entity->m_vecOrigin); + + // If the bot was forced to select a point, we tell it that we no longer need a new one and clear the bottom crumb to use the newest one + if (crumbFindNew) { + crumbFindNew = false; + CrumbBottomAdd(); } + + } + + // Prune used crumbs from the stack to make way for new ones when you get close to them. + if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 40.0F ) { + + // Debug Logging + logging::Info("Pruning"); + + // When the bot is forced to move to the player, since they have reached their destination we reset the var + crumbForceMove = false; + + // Check 15 times for close crumbs to prune, this allows simple miss steps to be smoothed out as well as make room for new crumbs + for (int i = 0; i < 15; i++) { + + // When one is close or too high, just bump the array and reset the stuck timer + if (g_pLocalPlayer->v_Origin.DistTo(breadcrumbs[crumbBottom]) < 60.0F && crumbArrayLength > 1) { + CrumbBottomAdd(); + + // When pruning is finished. Break the loop + } else { + crumb_prune_timeout = g_GlobalVars->curtime; + logging::Info("Finish Prune"); + break; + } + } + // Reset stuck timer + crumb_prune_timeout = g_GlobalVars->curtime; + } + + // When player to follow is too far away. the bot cant see the player or the bot is forced to the player, then follow breadcrumbs if movement is allowed + if ((g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) > (float)follow_distance || crumbForceMove) && crumbArrayLength >= 1 && allow_moving) { + WalkTo(breadcrumbs[crumbBottom]); + + // If a crumb hasnt been pruned in a while, it probably cant travel to it so reset and wait for the player to collect it. + if (g_GlobalVars->curtime - 2.5F > crumb_prune_timeout) { + crumbStopped = true; + logging::Info("Cannot goto next crumb!\nCrumb Lost!"); + } + + // If the bot is next to the player then we clear our crumbs as theres no need to follow previously generated ones. + } else if (g_pLocalPlayer->v_Origin.DistTo(found_entity->m_vecOrigin) < 100.0F && found_entity->IsVisible()) { + CrumbReset(); + crumbForceMove = false; } } } + @@ -379,6 +379,7 @@ void DoWalking() { // If found target is heavy and the local player is too, if (CE_INT(found_entity, netvar.iClass) == tf_heavy && g_pLocalPlayer->clazz == tf_heavy) { + // If found target is spun up, then spin up too if (HasCondition(found_entity)) { g_pUserCmd->buttons |= IN_ATTACK2; @@ -387,6 +388,7 @@ void DoWalking() { // If found target is zoomed if (HasCondition(found_entity)) { + // If the local player isnt zoomed and its class is sniper, then zoom in to mimic the followed target if (!g_pLocalPlayer->bZoomed && g_pLocalPlayer->clazz == tf_sniper) { g_pUserCmd->buttons |= IN_ATTACK2; @@ -395,8 +397,10 @@ void DoWalking() { // If user settings allow, we attemt to mimic taunting player if (sync_taunt) { + // Check if target is taunting if (HasCondition(found_entity)) { + // Check if local player isnt taunting if (!HasCondition(LOCAL_E)) { g_IEngine->ExecuteClientCmd("taunt"); @@ -560,7 +564,6 @@ void AddMessageHandlers(ipc::peer_t* peer) { // Set our dest info with the payload data destination_point = Vector(data[0], data[1], data[2]); destination_point_time = g_GlobalVars->curtime; - destination_reached = false; // Notify the followbot to follow vectors current_follow_type = EFollowType::VECTOR; }); @@ -583,14 +586,13 @@ void WalkTo(const Vector& vector) { if (CE_VECTOR(LOCAL_E, netvar.vVelocity).IsZero(1.0f)) { // Set idle time if we havent already if (!idle_time) idle_time = g_GlobalVars->curtime; - // If the vector is too high for the local player to reach, - if (vector.z - LOCAL_E->m_vecOrigin.z > 15.0f) { - // If the time idle is over 2 seconds - if (g_GlobalVars->curtime - idle_time > 2.0f) { - // If the player isnt zoomed, then jump - if (!g_pLocalPlayer->bZoomed) - g_pUserCmd->buttons |= IN_JUMP; - } + + // If the time idle is over 2 seconds + if (g_GlobalVars->curtime - idle_time > 2.0f) { + // If the player isnt zoomed, then jump + if (!g_pLocalPlayer->bZoomed) + g_pUserCmd->buttons |= IN_JUMP; + // Since the vector is close enough we reset our idle timer } else { idle_time = 0; @@ -627,31 +629,30 @@ std::pair ComputeMove(const Vector& a, const Vector& b) { // A function to reset the crumb followbot void CrumbReset() { - //A check to make sure using the fb tool repeatedly doesnt clear the cache of crumbs - //if (crumbStopped) { - crumbTop = 0; - crumbBottom = 0; - crumbArrayLength = 0; - crumb_prune_timeout = g_GlobalVars->curtime; - crumbFindNew = true; - crumbStopped = false; - logging::Info("Crumb Reset"); - //} + // We just reset the bookkeeping vars for the array, no need to clear the array as everything will be re-written anyways + crumbTop = 0; + crumbBottom = 0; + crumbArrayLength = 0; + crumb_prune_timeout = g_GlobalVars->curtime; + crumbFindNew = true; + crumbStopped = false; + logging::Info("Crumb Reset"); + } // A function to place a crumb into the array void CrumbTopAdd(Vector crumbToAdd) { // Once the crumbs have hit the limit of the array, loop around and over write unused spots - if (crumbTop >= 55) { + if (crumbTop == 55) { crumbTop = 0; } else { // Else, bump the top number market of the array - crumbTop = crumbTop + 1; + crumbTop++; } // Put the newly determined crumb into the array and add to the length - crumbArrayLength = crumbArrayLength + 1; + crumbArrayLength++; breadcrumbs[crumbTop] = crumbToAdd; logging::Info("Crumb Top add"); @@ -667,15 +668,15 @@ void CrumbTopAdd(Vector crumbToAdd) { void CrumbBottomAdd() { // Once the crumbs have hit the limit of the array, loop around and over write unused spots - if (crumbBottom >= 55) { + if (crumbBottom == 55) { crumbBottom = 0; } else { // Else, bump the top number market of the array - crumbBottom = crumbBottom + 1; + crumbBottom++; } // Subtract from the length to make room for more crumbs - crumbArrayLength = crumbArrayLength - 1; + crumbArrayLength--; logging::Info("Crumb Bottom add"); // A check to detect if too many crumbs have been removed. Without crumbs the bot will just use random variables in the array. @@ -705,8 +706,12 @@ void DrawFollowbot() { AddSideString(format("Array Length: ", crumbArrayLength)); AddSideString(format("Top Crumb: ", crumbTop)); AddSideString(format("Bottom Crumb: ", crumbBottom)); + AddSideString(format("Crumb Stopped: ", crumbStopped)); + AddSideString(format("Curtime: ", g_GlobalVars->curtime)); + AddSideString(format("Timeout: ", crumb_prune_timeout)); - // Disabled as the enum was misbeghaving for an unknown reason + + // Disabled as the enum was misbehaving for an unknown reason /*switch (current_follow_type) { case EFollowType::VECTOR: // If our follow type is a vector, then we just draw a rect on the vector @@ -767,7 +772,8 @@ void DrawFollowbot() { break; }*/ - // Not using switch due to switch not working + + // Not using switch due to switch not working correctly if (crumbArrayLength < 2) { // If not, we check if we have 1 point and draw on it @@ -798,7 +804,7 @@ void DrawFollowbot() { if (tmpCrumb1 >= 55) tmpCrumb1 - 55; if (tmpCrumb2 >= 55) - tmpCrumb1 - 55; + tmpCrumb2 - 55; // Take our 2 crumbs and get a position on the screen draw::WorldToScreen(breadcrumbs[tmpCrumb1], scnSrt); From e80ed09ba63cfc665b60a2bf0aba2fefc1566d4f Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 16 Jul 2017 22:18:54 -0500 Subject: [PATCH 13/48] Updated menu for push --- src/hacks/FollowBot.cpp | 4 +-- tf-settings/menu.json | 65 ++++++++++++++++++++++------------------- 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index a2949c71..d2459b70 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -28,8 +28,8 @@ namespace hacks { namespace shared { namespace followbot { // User settings CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs"); -CatVar follow_distance(CV_FLOAT, "fb_distance", "175", "Followbot Follow Distance", "How close the bots should stay to the target"); -CatVar follow_activation(CV_FLOAT, "fb_activation", "175", "Followbot Activation Distance", "How close a player should be until the followbot will pick a target"); +CatVar follow_distance(CV_FLOAT, "fb_distance", "175", "Follow Distance", "How close the bots should stay to the target"); +CatVar follow_activation(CV_FLOAT, "fb_activation", "175", "Activation Distance", "How close a player should be until the followbot will pick them as a target"); CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic selected weapon", "If enabled, this bot will select same weapon slot as the owner"); CatVar always_medigun(CV_SWITCH, "fb_always_medigun", "0", "Always use Medigun", "Medics will always use Medigun"); CatVar crumb_draw(CV_SWITCH, "fb_crumb_draw", "1", "Draw Crumbs", "Draws the path made for the followbot"); diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 06bf6625..4aedf10e 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -16,14 +16,16 @@ "type": "list", "name": "Ignore", "list": [ + "aimbot_ignore_cloak", + "aimbot_ignore_deadringer", + "aimbot_ignore_vaccinator", "ignore_taunting", "aimbot_ignore_hoovy", + "aimbot_teammates", "aimbot_buildings_sentry", "aimbot_buildings_other", - "aimbot_stickys", - "aimbot_teammates", - "aimbot_ignore_cloak", - "aimbot_ignore_vaccinator" + "aimbot_stickys" + ] }, { @@ -110,11 +112,11 @@ "name": "Auto Reflect", "list": [ "reflect_enabled", + "reflect_key", "reflect_legit", "reflect_only_idle", "reflect_stickybombs", - "reflect_dodgeball", - "reflect_key" + "reflect_dodgeball" ] }, { @@ -138,6 +140,7 @@ "trigger_maxrange", "trigger_charge", "trigger_hitboxmode", + "trigger_accuracy", "trigger_key_mode", "trigger_key" ] @@ -345,36 +348,23 @@ "type": "list", "name": "Chat Settings", "list": [ + "spam", + "killsay", + "uberspam", + "spam_file", + "killsay_file", + "spam_random", "chat_newlines", "clean_chat", - "killsay", - "killsay_file", - "spam", - "spam_random", - "spam_file", - "spam_teamname", - "uberspam", - "uberspam_build", + "chat_crypto", "uberspam_ready", "uberspam_used", "uberspam_ended", "uberspam_team", - "uberspam_file" - ] - }, - { - "type": "list", - "name": "Follow Bot Settings", - "data": "ipc", - "list": [ - "fb_bot", - "fb_auto_playerlist", - "fb_mimic_slot", - "fb_always_medigun", - "fb_autoclass", - "fb_follow_distance", - "ipc_server", - "fb_autoteam" + "uberspam_build", + "uberspam_file", + "spam_voicecommand", + "spam_teamname" ] }, { @@ -392,6 +382,20 @@ "ac_bhop_count" ] }, + { + "type": "list", + "name": "Followbot", + "list": [ + "fb_bot", + "fb_distance", + "fb_activation", + "fb_roaming", + "fb_mimic_slot", + "fb_always_medigun", + "fb_sync_taunt", + "fb_crumb_draw" + ] + }, { "type": "list", "name": "Miscellaneous", @@ -492,6 +496,7 @@ "debug_info", "log", "setupbones_time", + "nolerp", "skinchanger_debug", "software_cursor_mode", "experimental_cursor_fix", From 257d7e168219ca7f46c1d7a9dc7ca9b81bd35100 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 16 Jul 2017 22:21:28 -0500 Subject: [PATCH 14/48] Dont you just like clean syntax? --- tf-settings/menu.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 4aedf10e..91ee2899 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -25,7 +25,6 @@ "aimbot_buildings_sentry", "aimbot_buildings_other", "aimbot_stickys" - ] }, { From 79115daf2840674d99a65fbd69ffc282e38c533f Mon Sep 17 00:00:00 2001 From: julianacat Date: Mon, 17 Jul 2017 00:22:31 -0500 Subject: [PATCH 15/48] team aimbot settings wew --- src/hacks/Aimbot.cpp | 6 +++--- src/hacks/FollowBot.cpp | 2 +- src/helpers.cpp | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 0d4d672c..1d8a84ed 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -59,7 +59,8 @@ static CatVar ignore_deadringer(CV_SWITCH, "aimbot_ignore_deadringer", "1", "Ign static CatVar buildings_sentry(CV_SWITCH, "aimbot_buildings_sentry", "1", "Aim Sentry", "Should aimbot aim at sentryguns?"); static CatVar buildings_other(CV_SWITCH, "aimbot_buildings_other", "1", "Aim Other building", "Should aimbot aim at other buildings"); static CatVar stickybot(CV_SWITCH, "aimbot_stickys", "0", "Aim Sticky", "Should aimbot aim at stickys"); -static CatVar teammates(CV_SWITCH, "aimbot_teammates", "0", "Aim at teammates", "Aim at your own team. Useful for HL2DM"); +static CatEnum teammates_enum({ "ENEMY ONLY", "TEAMMATE ONLY", "BOTH" }); +static CatVar teammates(teammates_enum, "aimbot_teammates", "0", "Aim at teammates", "Use to choose which team/s to target"); static CatVar silent(CV_SWITCH, "aimbot_silent", "1", "Silent", "Your screen doesn't get snapped to the point where aimbot aims at"); static CatVar target_lock(CV_SWITCH, "aimbot_target_lock", "0", "Target Lock", "Keeps your previously chosen target untill target check fails"); static CatEnum hitbox_enum({ @@ -96,7 +97,6 @@ static CatVar engine_projpred(CV_SWITCH, "debug_aimbot_engine_pp", "0", "Engine // Followbot vars static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); /* TODO IMPLEMENT -static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); */ @@ -354,7 +354,7 @@ bool IsTargetStateGood(CachedEntity* entity) { // Dont aim at dead player if (!entity->m_bAlivePlayer) return false; // Dont aim at teammates - if (!entity->m_bEnemy && !teammates) return false; + if ((int)teammates != 2 && ((!entity->m_bEnemy && !teammates) || (entity->m_bEnemy && teammates))) return false; // Check if player is too far away if (EffectiveTargetingRange()) { if (entity->m_flDistance > EffectiveTargetingRange()) return false; diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index d2459b70..767378b0 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -168,7 +168,7 @@ void DoWalking() { } // Without good target we must find a new one - if (CE_BAD(best_target)) { + if (CE_BAD(best_target) || g_GlobalVars->curtime - 2.5F > crumb_prune_timeout) { float target_highest_score = -256; CachedEntity* ent; diff --git a/src/helpers.cpp b/src/helpers.cpp index ad8497bd..03fefa59 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -505,11 +505,9 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) { rgrav = 0.2f; rspeed = 990.0f; } else if (weapon->m_iClassID == CL_CLASS(CTFCrossbow)) { - // TODO, get correct gravity rgrav = 0.2f; rspeed = 2400.0f; } else if (weapon->m_iClassID == CL_CLASS(CTFShotgunBuildingRescue)) { - // TODO, get correct gravity rgrav = 0.2f; rspeed = 2400.0f; } @@ -518,7 +516,7 @@ bool GetProjectileData(CachedEntity* weapon, float& speed, float& gravity) { return (rspeed || rgrav); } -constexpr unsigned developer_list[] = { 306902159, 347272825, 401679596 }; +constexpr unsigned developer_list[] = { 306902159, 347272825, 401679596, 416491033, 175278337 }; bool Developer(CachedEntity* ent) { for (int i = 0; i < sizeof(developer_list) / sizeof(unsigned); i++) { From 0bc3451bbbcf9a27e38a0918e467be6b8a05dd82 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Wed, 19 Jul 2017 16:50:10 +0300 Subject: [PATCH 16/48] FIX empty cat_name leading to "unnamed" ingame, added trigger accuracy to menu, added rage-only mode for aimbot, fixed legit ESP --- simple-ipc | 2 +- src/hacks/Aimbot.cpp | 7 +++++++ src/hacks/ESP.cpp | 1 + src/hacks/Trigger.cpp | 2 +- src/helpers.cpp | 3 +++ src/hooks/others.cpp | 2 +- tf-settings/menu.json | 1 + 7 files changed, 15 insertions(+), 3 deletions(-) diff --git a/simple-ipc b/simple-ipc index e532876f..94a287d6 160000 --- a/simple-ipc +++ b/simple-ipc @@ -1 +1 @@ -Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839 +Subproject commit 94a287d6faa00d44e1084b04e602842849858443 diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 1d8a84ed..702fe6fc 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -100,6 +100,8 @@ static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Sp static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); */ +static CatVar rageonly(CV_SWITCH, "aimbot_rage_only", "0", "Ignore non-rage targets", "Use playerlist to set up rage targets"); + // Current Entity int target_eid { 0 }; CachedEntity* target = 0; @@ -359,6 +361,11 @@ bool IsTargetStateGood(CachedEntity* entity) { if (EffectiveTargetingRange()) { if (entity->m_flDistance > EffectiveTargetingRange()) return false; } + if (rageonly) { + if (playerlist::AccessData(entity).state != playerlist::k_EState::RAGE) { + return false; + } + } IF_GAME (IsTF()) { // If settings allow waiting for charge, and current charge cant kill target, dont aim if (wait_for_charge && g_pLocalPlayer->holding_sniper_rifle) { diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 4ba4ca9b..3cd9c63d 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -399,6 +399,7 @@ void _FASTCALL ProcessEntity(CachedEntity* ent) { // only if bTeammatePowerup or bTeammates is true if (legit && ent->m_iTeam != g_pLocalPlayer->team && playerlist::IsDefault(info.friendsID)) { if (IsPlayerInvisible(ent)) return; + if (vischeck && !ent->IsVisible()) return; /*if (ent->m_lLastSeen > (unsigned)v_iLegitSeenTicks->GetInt()) { return; }*/ diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index ab0af204..f115b30e 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -27,7 +27,7 @@ static CatVar trigger_key_mode(trigger_key_modes_enum, "trigger_key_mode", "1", static CatEnum hitbox_mode_enum({ "AUTO-HEAD", "AUTO-CLOSEST", "Head only" }); static CatVar hitbox_mode(hitbox_mode_enum, "trigger_hitboxmode", "0", "Hitbox Mode", "Defines hitbox selection mode"); -static CatVar accuracy(CV_INT, "trigger_accuracy", "0", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox"); +static CatVar accuracy(CV_INT, "trigger_accuracy", "0", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox. Recommended to use with sniper rifle/ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "trigger_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "trigger_ignore_hoovy", "1", "Ignore Hoovies", "Triggerbot won't attack hoovies"); diff --git a/src/helpers.cpp b/src/helpers.cpp index 03fefa59..74398d80 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -726,7 +726,10 @@ void PrintChat(const char* fmt, ...) { vsprintf(buf, fmt, list); va_end(list); std::unique_ptr str(strfmt("\x07%06X[\x07%06XCAT\x07%06X]\x01 %s", 0x5e3252, 0xba3d9a, 0x5e3252, buf)); + // FIXME DEBUG LOG + logging::Info("%s", str.get()); chat->Printf(str.get()); + } else { } } diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 9d3a0b20..a7bf11cf 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -215,7 +215,7 @@ static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); - if ((force_name.convar->m_StringLength > 3) && steamID == g_ISteamUser->GetSteamID()) { + if ((strlen(force_name.GetString()) > 1) && steamID == g_ISteamUser->GetSteamID()) { return force_name_newlined; } return original(_this, steamID); diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 91ee2899..ef1c3c76 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -135,6 +135,7 @@ "type": "list", "name": "Triggerbot Preferences", "list": [ + "trigger_accuracy", "trigger_zoomed", "trigger_maxrange", "trigger_charge", From e87fad18dbcd0efec7d4fc5c0cc09f8fe1624ee5 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Wed, 19 Jul 2017 17:16:12 +0300 Subject: [PATCH 17/48] cat_cfg_rebase, cat_cfg_resetbase, cat_save_complete --- src/cvwrapper.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++ src/cvwrapper.h | 7 +++++ src/hacks/Misc.cpp | 21 -------------- 3 files changed, 76 insertions(+), 21 deletions(-) diff --git a/src/cvwrapper.cpp b/src/cvwrapper.cpp index 50c42572..b70cd9f9 100644 --- a/src/cvwrapper.cpp +++ b/src/cvwrapper.cpp @@ -12,6 +12,74 @@ int CatVar::last_id { 0 }; +int rebased_count { 0 }; + +int GetRebasedCatVarCount() { + return rebased_count; +} + +static CatCommand cfg_rebase("cfg_setbase", "Rebase config", []() { + for (auto& cv : CatVarList()) { + std::string value(cv->GetString()); + if (value != cv->defaults) { + cv->current_base = value; + rebased_count++; + } + } + logging::Info("Successfully rebased %d variables", rebased_count); +}); + +static CatCommand cfg_resetbase("cfg_resetbase", "Reset config base", []() { + for (auto& cv : CatVarList()) { + cv->current_base = cv->defaults; + } + rebased_count = 0; +}); + +static CatCommand save_settings("save", "Save settings (optional filename)", [](const CCommand& args) { + std::string filename("lastcfg"); + if (args.ArgC() > 1) { + filename = std::string(args.Arg(1)); + } + std::string path = format("tf/cfg/cat_", filename, ".cfg"); + logging::Info("Saving settings to %s", path.c_str()); + if (GetRebasedCatVarCount()) { + logging::Info("[Warning] %d CatVars are rebased!", GetRebasedCatVarCount()); + } + std::ofstream file(path, std::ios::out); + if (file.bad()) { + logging::Info("Couldn't open the file!"); + return; + } + for (const auto& i : CatVarList()) { + if (i->GetBase() != std::string(i->GetString())) { + file << CON_PREFIX << i->name << " \"" << i->GetString() << "\"\n"; + } + } + file.close(); +}); + +static CatCommand save_settings_complete("save_complete", "Save all settings (optional filename)", [](const CCommand& args) { + std::string filename("lastcfg"); + if (args.ArgC() > 1) { + filename = std::string(args.Arg(1)); + } + std::string path = format("tf/cfg/cat_", filename, ".cfg"); + logging::Info("Saving settings to %s", path.c_str()); + if (GetRebasedCatVarCount()) { + logging::Info("[Warning] %d CatVars are rebased!", GetRebasedCatVarCount()); + } + std::ofstream file(path, std::ios::out); + if (file.bad()) { + logging::Info("Couldn't open the file!"); + return; + } + for (const auto& i : CatVarList()) { + file << CON_PREFIX << i->name << " \"" << i->GetString() << "\"\n"; + } + file.close(); +}); + // Prevent initialization errors. std::vector& registrationArray() { static std::vector vector; @@ -94,6 +162,7 @@ void CatVar::Register() { id = last_id++; convar = CreateConVar(CON_PREFIX + name, defaults, desc_short); convar_parent = convar->m_pParent; + current_base = defaults; while (!callbacks.empty()) { callbacks.back()(this); callbacks.pop_back(); diff --git a/src/cvwrapper.h b/src/cvwrapper.h index 19fcd262..aa0602d3 100644 --- a/src/cvwrapper.h +++ b/src/cvwrapper.h @@ -94,6 +94,10 @@ public: return g_IInputSystem->IsButtonDown(static_cast(static_cast(*this))); } + inline const std::string& GetBase() const { + return current_base; + } + public: const CatVar_t type; const std::string name; @@ -102,6 +106,8 @@ public: const std::string desc_long { "" }; const CatEnum* const enum_type { nullptr }; + std::string current_base { "0" }; + bool restricted { false }; float min { 0.0f }; float max { 0.0f }; @@ -121,5 +127,6 @@ std::vector& commandRegistrationArray(); std::vector& CatVarList(); void RegisterCatVars(); +int GetRebasedCatVarCount(); #endif /* CVWRAPPER_H_ */ diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index f8adb551..9ce8d713 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -485,27 +485,6 @@ CatCommand name("name_set", "Immediate name change", [](const CCommand& args) { ch->SendNetMsg(setname, false); } }); -CatCommand save_settings("save", "Save settings (optional filename)", [](const CCommand& args) { - std::string filename("lastcfg"); - if (args.ArgC() > 1) { - filename = std::string(args.Arg(1)); - } - std::string path = format("tf/cfg/cat_", filename, ".cfg"); - logging::Info("Saving settings to %s", path.c_str()); - std::ofstream file(path, std::ios::out); - if (file.bad()) { - logging::Info("Couldn't open the file!"); - return; - } - for (const auto& i : RegisteredVarsList()) { - if (i) { - if (strcmp(i->GetString(), i->GetDefault())) { - file << i->GetName() << " \"" << i->GetString() << "\"\n"; - } - } - } - file.close(); -}); CatCommand say_lines("say_lines", "Say with newlines (\\n)", [](const CCommand& args) { std::string message(args.ArgS()); ReplaceString(message, "\\n", "\n"); From 0fc558acb684dfe17d2679424f096f10db9785b4 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Wed, 19 Jul 2017 19:50:05 +0300 Subject: [PATCH 18/48] WIP clang makefile (doesn't link) --- makefile | 31 ++++++++++++++++++++++++++----- src/gui/im/Schema.cpp | 7 ++++--- src/hacks/LagExploit.cpp | 2 +- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/makefile b/makefile index ad5065d4..e25d84fb 100644 --- a/makefile +++ b/makefile @@ -1,19 +1,32 @@ +ifndef CLANG CXX=$(shell sh -c "which g++-6 || which g++") CC=$(shell sh -c "which gcc-6 || which gcc") +LD=$(CXX) +else +CXX=clang++ +CC=clang +LD=ld.lld +endif DEFINES=_GLIBCXX_USE_CXX11_ABI=0 _POSIX=1 FREETYPE_GL_USE_VAO RAD_TELEMETRY_DISABLED LINUX=1 USE_SDL _LINUX=1 POSIX=1 GNUC=1 NO_MALLOC_OVERRIDE WARNING_FLAGS=-pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native +COMMON_FLAGS=-fpermissive -O3 -shared -Wno-unknown-pragmas -fmessage-length=0 -m32 -fvisibility=hidden -fPIC -march=native -mtune=native + +ifdef CLANG +COMMON_FLAGS+=-Wno-c++11-narrowing +endif ifdef BUILD_DEBUG COMMON_FLAGS+=-g3 -ggdb else +ifndef CLANG COMMON_FLAGS+=-flto endif +endif CFLAGS=$(COMMON_FLAGS) -CXXFLAGS=-std=gnu++1z $(COMMON_FLAGS) +CXXFLAGS=-std=gnu++14 $(COMMON_FLAGS) ifndef NO_WARNINGS CFLAGS+=$(WARNING_FLAGS) @@ -27,11 +40,19 @@ SDKFOLDER=$(realpath source-sdk-2013/mp/src) SIMPLE_IPC_DIR = $(realpath simple-ipc/src/include) INCLUDES=-Iucccccp -isystemsrc/freetype-gl -isystemsrc/imgui -isystem/usr/local/include/freetype2 -isystem/usr/include/freetype2 -I$(SIMPLE_IPC_DIR) -isystem$(SDKFOLDER)/public -isystem$(SDKFOLDER)/mathlib -isystem$(SDKFOLDER)/common -isystem$(SDKFOLDER)/public/tier1 -isystem$(SDKFOLDER)/public/tier0 -isystem$(SDKFOLDER) LIB_DIR=lib -LDFLAGS=-m32 -fno-gnu-unique -D_GLIBCXX_USE_CXX11_ABI=0 -shared -L$(realpath $(LIB_DIR)) +LDFLAGS=-shared -L$(realpath $(LIB_DIR)) +ifdef CLANG +LDFLAGS+=-melf_i386 +else +LDFLAGS+=-m32 -fno-gnu-unique +endif + ifndef BUILD_DEBUG +ifndef CLANG LDFLAGS+=-flto endif -LDLIBS=-static -lc -lstdc++ -ltier0 -lvstdlib -l:libSDL2-2.0.so.0 -static -lGLEW -lfreetype -lpthread +endif +LDLIBS=-l:libSDL2-2.0.so.0 -static -l:libc.so.6 -static -l:libstdc++.so.6 -l:libtier0.so -l:libvstdlib.so -static -l:libGLEW.so -l:libfreetype.so SRC_DIR = src RES_DIR = res OUT_NAME = libcathook.so @@ -126,7 +147,7 @@ src/sdk/utlbuffer.o : CFLAGS+=-w $(TARGET): $(OBJECTS) @echo Building cathook - @$(CXX) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $(TARGET) + $(LD) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS) clean: find src -type f -name '*.o' -delete diff --git a/src/gui/im/Schema.cpp b/src/gui/im/Schema.cpp index c264a95f..3cbe0c50 100644 --- a/src/gui/im/Schema.cpp +++ b/src/gui/im/Schema.cpp @@ -7,6 +7,8 @@ #include "Schema.hpp" + +#include "../../helpers.h" #include "../../cvwrapper.h" #include "../../logging.h" @@ -23,13 +25,12 @@ CatVar* FindCatVar(const std::string name) { ListEntry_Dummy* FromJson(nlohmann::json json) { if (json.is_string()) { const std::string var_name = json; - logging::Info("[Debug] Variable: %s", var_name.c_str()); ListEntry_Dummy* cv; try { cv = (ListEntry_Dummy*)(new ListEntry_Variable(*FindCatVar(var_name))); } catch (std::runtime_error& er) { logging::Info("[Error] %s", er.what()); - cv = (ListEntry_Dummy*)(new ListEntry_Label("malformed object")); + cv = (ListEntry_Dummy*)(new ListEntry_Label(format("[", var_name, "]"))); } return cv; } else if (json.is_object()) { @@ -129,7 +130,7 @@ CatCommand reloadscheme("reloadscheme", "Reload Scheme", []() { } for (const auto& v : CatVarList()) { if (map_present.find(v) == map_present.end()) { - logging::Info("%s is not in any list!", v->name.c_str()); + logging::Info("%s is not present in the GUI!", v->name.c_str()); } } //TraverseList(&main_list); diff --git a/src/hacks/LagExploit.cpp b/src/hacks/LagExploit.cpp index 4799835d..09d4409e 100644 --- a/src/hacks/LagExploit.cpp +++ b/src/hacks/LagExploit.cpp @@ -12,7 +12,7 @@ namespace hacks { namespace shared { namespace lagexploit { CatVar toggle(CV_SWITCH, "removecond_toggle", "0", "Toggle Lag Exploit", "Toggle lag exploit (RemoveCond)"); CatVar key(CV_KEY, "removecond_key", "0", "RemoveCond Key"); CatVar lagMasterSwitch(CV_SWITCH, "removecond_master", "1", "Master Lag Exploit Switch", "Master switch for the lag exploit\nDisabling this disables everything else that uses remove conds"); -CatVar lagValue(CV_INT, "removecond_value", "450", "RemoveCond Value", "Value of user cmds to spam with"); +CatVar lagValue(CV_INT, "removecond_value", "900", "RemoveCond Value", "Value of user cmds to spam with"); CatCommand do_lagexploit("removecond", "RemoveCond (for use in scripts)", []() { AddExploitTicks(6); From c962074eb4a63e740a1608af2114ce86c94d050b Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 15:06:34 -0500 Subject: [PATCH 19/48] Rewrote wait for charge + added tracers --- src/hacks/Aimbot.cpp | 51 ++++++++++++++++++++++++++++++++++------- src/hacks/ESP.cpp | 21 +++++++++++++++++ src/hacks/FollowBot.cpp | 9 +------- 3 files changed, 65 insertions(+), 16 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 1d8a84ed..d9dc4fef 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -52,6 +52,7 @@ static CatVar priority_mode(priority_mode_enum, "aimbot_prioritymode", "0", "Pri "SMART: Basically Auto-Threat. Will be tweakable eventually. " "FOV, DISTANCE, HEALTH are self-explainable. HEALTH picks the weakest enemy"); static CatVar wait_for_charge(CV_SWITCH, "aimbot_charge", "0", "Wait for sniper rifle charge", "Aimbot waits until it has enough charge to kill"); +static CatVar ambassador_wait(CV_SWITCH, "aimbot_ambassador", "1", "Wait for headshot", "Aimbot waits until it has enough charge to headshot with the ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "aimbot_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies"); static CatVar ignore_cloak(CV_SWITCH, "aimbot_ignore_cloak", "1", "Ignore cloaked", "Don't aim at invisible enemies"); @@ -96,9 +97,7 @@ static CatVar aimbot_debug(CV_SWITCH, "aimbot_debug", "0", "Aimbot Debug", "Disp static CatVar engine_projpred(CV_SWITCH, "debug_aimbot_engine_pp", "0", "Engine ProjPred"); // Followbot vars static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Spin up minigun if you can see target, useful for followbots"); -/* TODO IMPLEMENT static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); -*/ // Current Entity int target_eid { 0 }; @@ -362,9 +361,26 @@ bool IsTargetStateGood(CachedEntity* entity) { IF_GAME (IsTF()) { // If settings allow waiting for charge, and current charge cant kill target, dont aim if (wait_for_charge && g_pLocalPlayer->holding_sniper_rifle) { - float bdmg = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flChargedDamage); - if (g_GlobalVars->curtime - g_pLocalPlayer->flZoomBegin <= 1.0f) bdmg = 50.0f; - if ((bdmg * 3) < (HasDarwins(entity) ? (entity->m_iHealth * 1.15) : entity->m_iHealth)) { + + // Grab netvar for current charge damage and multiply by 3 for headshot + float cdmg = CE_FLOAT(LOCAL_W, netvar.flChargedDamage) * 3; + + // Darwins damage correction, Darwins protects against 15% of damage + if (HasDarwins(entity)) + cdmg = (cdmg * .85) - 1; + // Vaccinator damage correction, Vac charge protects against 75% of damage + if (HasCondition(entity)) { + cdmg = (cdmg * .25) - 1; + // Passive bullet resist protects against 10% of damage + } else if (HasCondition(entity)) { + cdmg = (cdmg * .90) - 1; + } + // Invis damage correction, Invis spies get protection from 10% of damage + if (IsPlayerInvisible(entity)) + cdmg = (cdmg * .80) - 1; + + // Check if player will die from headshot or if target has more health than normal overheal allows. + if ( !(entity->m_iHealth <= 150 || entity->m_iHealth <= cdmg || !g_pLocalPlayer->bZoomed || entity->m_iHealth > entity->m_iMaxHealth + (entity->m_iMaxHealth * 0.5)) ) { return false; } } @@ -493,6 +509,7 @@ void Aim(CachedEntity* entity) { // Grab the targets vector, and vector it for the eye angles tr = (PredictEntity(entity) - g_pLocalPlayer->v_Eye); VectorAngles(tr, angles); + // Clamp angles fClampAngle(angles); @@ -508,8 +525,10 @@ void Aim(CachedEntity* entity) { // A function to check whether player can autoshoot bool CanAutoShoot() { + // First check whether user settings allow autoshoot if (autoshoot) { + // A var for weapons not to use with autoshoot static int forbiddenWeapons[] = { CL_CLASS(CTFCompoundBow), CL_CLASS(CTFKnife) }; int weapon_class; @@ -524,10 +543,21 @@ bool CanAutoShoot() { } } + // Check if zoomed, and zoom if not, then zoom + IF_GAME (IsTF()) { + if (g_pLocalPlayer->clazz == tf_class::tf_sniper) { + if (g_pLocalPlayer->holding_sniper_rifle) { + if (auto_zoom && !HasCondition(LOCAL_E)) { + g_pUserCmd->buttons |= IN_ATTACK2; + attack = false; + } + } + } + } + // Check if ambassador can headshot IF_GAME (IsTF2()) { - // Check if players current weapon is an ambasador - if (IsAmbassador(g_pLocalPlayer->weapon())) { + if (ambassador_wait && IsAmbassador(g_pLocalPlayer->weapon())) { // Check if ambasador can headshot if (!AmbassadorCanHeadshot()) return false; } @@ -614,7 +644,12 @@ int BestHitbox(CachedEntity* target) { headonly = true; // If player is using an ambassador, set headonly to true } else if (IsAmbassador(g_pLocalPlayer->weapon())) { - headonly = true; + // We only want to aim for the head if the ambassador can headshot + if (AmbassadorCanHeadshot()) { + headonly = true; + // 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher + if (target->m_iHealth <= 18) headonly = false; + } // If player is using a rocket based weapon, prefer the hip } else if (ci == CL_CLASS(CTFRocketLauncher) || ci == CL_CLASS(CTFRocketLauncher_AirStrike) || diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 4ba4ca9b..9f357ec5 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -13,6 +13,8 @@ namespace hacks { namespace shared { namespace esp { CatVar show_weapon(CV_SWITCH, "esp_weapon", "1", "Show weapon name", "Show which weapon does the enemy use"); +CatEnum tracers_enum({ "OFF", "CENTER", "BOTTOM" }); +CatVar tracers(tracers_enum, "esp_tracers", "0", "Tracers", "SDraws a line from the player to a position on your screen"); CatVar local_esp(CV_SWITCH, "esp_local", "1", "ESP Local Player", "Shows local player ESP in thirdperson"); CatVar buildings(CV_SWITCH, "esp_buildings", "1", "Building ESP", "Show buildings"); CatVar enabled(CV_SWITCH, "esp_enabled", "0", "ESP", "Master ESP switch"); @@ -650,6 +652,25 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) { } } + if (tracers && ent->m_Type == ENTITY_PLAYER) { + + // Grab the screen resolution and save to some vars + int width, height; + g_IEngine->GetScreenSize(width, height); + + // Center values on screen + width = width / 2; + // Only center height if we are using center mode + if ((int)tracers == 2) height = height / 2; + + // Get world to screen + Vector scn; + draw::WorldToScreen(ent->m_vecOrigin, scn); + + // Draw a line + drawgl::Line(scn.x, scn.y, width - scn.x, height - scn.y, fg); + } + if (ent->m_Type == ENTITY_PLAYER) { if (joy_esp) { auto hb = ent->hitboxes.GetHitbox(0); diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 767378b0..f558939f 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -14,17 +14,10 @@ namespace hacks { namespace shared { namespace followbot { - - - /* Big Followbot TODO list 1. Fix crash when setting followbot_idx var and remove the fix var in its place -2. Test with followbots to ensure that vector followbot and crumb followbot work as intended -3. Clean the finished code and push to main from fork */ - - - + // User settings CatVar bot(CV_SWITCH, "fb_bot", "0", "Master Followbot Switch", "Set to 1 in followbots' configs"); From ee9056e4a3767f9001c28819d8f7acac13a2b89c Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 15:12:59 -0500 Subject: [PATCH 20/48] General fixes --- src/hacks/Aimbot.cpp | 11 ++++------- src/hacks/ESP.cpp | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index d9dc4fef..8520b19a 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -52,7 +52,6 @@ static CatVar priority_mode(priority_mode_enum, "aimbot_prioritymode", "0", "Pri "SMART: Basically Auto-Threat. Will be tweakable eventually. " "FOV, DISTANCE, HEALTH are self-explainable. HEALTH picks the weakest enemy"); static CatVar wait_for_charge(CV_SWITCH, "aimbot_charge", "0", "Wait for sniper rifle charge", "Aimbot waits until it has enough charge to kill"); -static CatVar ambassador_wait(CV_SWITCH, "aimbot_ambassador", "1", "Wait for headshot", "Aimbot waits until it has enough charge to headshot with the ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "aimbot_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies"); static CatVar ignore_cloak(CV_SWITCH, "aimbot_ignore_cloak", "1", "Ignore cloaked", "Don't aim at invisible enemies"); @@ -557,7 +556,7 @@ bool CanAutoShoot() { // Check if ambassador can headshot IF_GAME (IsTF2()) { - if (ambassador_wait && IsAmbassador(g_pLocalPlayer->weapon())) { + if (IsAmbassador(g_pLocalPlayer->weapon())) { // Check if ambasador can headshot if (!AmbassadorCanHeadshot()) return false; } @@ -645,11 +644,9 @@ int BestHitbox(CachedEntity* target) { // If player is using an ambassador, set headonly to true } else if (IsAmbassador(g_pLocalPlayer->weapon())) { // We only want to aim for the head if the ambassador can headshot - if (AmbassadorCanHeadshot()) { - headonly = true; - // 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher - if (target->m_iHealth <= 18) headonly = false; - } + headonly = AmbassadorCanHeadshot(); + // 18 health is a good number to use as thats the usual minimum damage it can do with a bodyshot, but damage could potentially be higher + if (target->m_iHealth <= 18) headonly = false; // If player is using a rocket based weapon, prefer the hip } else if (ci == CL_CLASS(CTFRocketLauncher) || ci == CL_CLASS(CTFRocketLauncher_AirStrike) || diff --git a/src/hacks/ESP.cpp b/src/hacks/ESP.cpp index 9f357ec5..b6ecfbc1 100644 --- a/src/hacks/ESP.cpp +++ b/src/hacks/ESP.cpp @@ -661,7 +661,7 @@ void _FASTCALL ProcessEntityPT(CachedEntity* ent) { // Center values on screen width = width / 2; // Only center height if we are using center mode - if ((int)tracers == 2) height = height / 2; + if ((int)tracers == 1) height = height / 2; // Get world to screen Vector scn; From 0d9850099013a201a85e7e9dcfb8920305faa085 Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 15:21:12 -0500 Subject: [PATCH 21/48] Updated Menu --- tf-settings/menu.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 91ee2899..9bf6924a 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -182,6 +182,7 @@ "esp_buildings", "esp_local", "esp_powerups", + "esp_tracers", { "type": "list", "name": "Emoji ESP", From 24bd3bb78a530430a639a9858575e3a4aed21ded Mon Sep 17 00:00:00 2001 From: julianacat Date: Wed, 19 Jul 2017 22:35:54 -0500 Subject: [PATCH 22/48] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ebd583f..8ec5fb66 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ You will want to update these files if you wish to have an updated menu. ## Followbots `cathook-ipc-server` allows you to run and control Followbots to do your evil bidding in-game. The installation for Followbots is quite complex, and will not be covered on this page. Obviously, you must have several user accounts ready to run TF2. -A guide for Followbots can be found here: [How to setup and use followbots.](https://www.youtube.com/watch?v=kns5-nw7xUg) +A guide for Followbots can be found here: [How to setup followbots.](https://github.com/nullifiedcat/cathook/wiki/Setting-up-Followbots) [How to use followbots.](https://github.com/nullifiedcat/cathook/wiki/Using-Followbots) You may also ask someone in our discord server to help you out. The installation script is as followed: From eba7c7b92bf85e45ea88c09bbe8966dea11bc955 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 00:56:49 -0500 Subject: [PATCH 23/48] Added Namestealer + Fixed anti-afk --- src/hacks/Misc.cpp | 24 ++++++++------ src/hooks/others.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++ tf-settings/menu.json | 1 + 3 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/hacks/Misc.cpp b/src/hacks/Misc.cpp index f8adb551..db828fe2 100644 --- a/src/hacks/Misc.cpp +++ b/src/hacks/Misc.cpp @@ -322,19 +322,25 @@ void CreateMove() { // Check if user settings allow anti-afk if (anti_afk) { + // If the timer exceeds 1 minute, jump and reset the timer - if ( g_GlobalVars->curtime - afkTimeIdle > 60 ) { + if (g_GlobalVars->curtime - 60 > afkTimeIdle) { + + // Send random commands + g_pUserCmd->sidemove = RandFloatRange(-450.0, 450.0); + g_pUserCmd->forwardmove = RandFloatRange(-450.0, 450.0); + g_pUserCmd->buttons = rand(); - // If player didnt jump, then we dont reset the timer - if (CE_INT(g_pLocalPlayer->entity, netvar.movetype) == MOVETYPE_FLY) + // After 1 second we reset the idletime + if (g_GlobalVars->curtime - 61 > afkTimeIdle) { + logging::Info("Finish idle"); + afkTimeIdle = g_GlobalVars->curtime; + } + } else { + // If the player uses a button, reset the timer + if (g_pUserCmd->buttons & IN_FORWARD || g_pUserCmd->buttons & IN_BACK || g_pUserCmd->buttons & IN_MOVELEFT || g_pUserCmd->buttons & IN_MOVERIGHT || g_pUserCmd->buttons & IN_JUMP || !LOCAL_E->m_bAlivePlayer) afkTimeIdle = g_GlobalVars->curtime; - - // Attemt to jump - g_pUserCmd->buttons = g_pUserCmd->buttons &~ IN_JUMP; } - // If the player uses a button, reset the timer - if ( g_pUserCmd->buttons & IN_FORWARD || g_pUserCmd->buttons & IN_BACK || g_pUserCmd->buttons & IN_MOVELEFT || g_pUserCmd->buttons & IN_MOVERIGHT || g_pUserCmd->buttons & IN_JUMP || !LOCAL_E->m_bAlivePlayer ) - afkTimeIdle = g_GlobalVars->curtime; } IF_GAME (IsTF2()) { diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 9d3a0b20..12783e75 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,8 +213,83 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); +CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks"); + +static std::string stolen_name; + +// Func to get a new entity to steal name from +bool StolenName(){ + + // Array to store potential namestealer targets with a bookkeeper to tell how full it is + int potential_targets[32]; + int potential_targets_length = 0; + + // Go through entities looking for potential targets + for (int i = 1; i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + + // Check if ent is a good target + if (!ent) continue; + if (ent == LOCAL_E) continue; + if (!ent->m_Type == ENTITY_PLAYER) continue; + if (ent->m_bEnemy) continue; + + // Check if name is current one + player_info_s info; + if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { + + // If our name is the same as current, than change it + if (std::string(info.name) == stolen_name) continue; + + // a ent without a name is no ent we need, contine for a different one + } else continue; + + // Save the ent to our array + potential_targets[potential_targets_length] = i; + potential_targets_length++; + if (potential_targets_length >= 32) break; + } + + // Get random number that we can use with our array + int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); + + // Get a idx from our random array position + int new_target = potential_targets[target_random_num]; + + // Checks to prevent crashes + if (!ENTITY(new_target) || potential_targets_length == 0) return false; + + // Grab username of user + player_info_s info; + if (g_IEngine->GetPlayerInfo(new_target, &info)) { + + // If our name is the same as current, than change it and return true + stolen_name = std::string(info.name); + return true; + } + + // Didnt get playerinfo + return false; +} + const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); + + // Check User settings if namesteal is allowed + if (namesteal && steamID == g_ISteamUser->GetSteamID()) { + + // We dont want to steal names while not in-game as there are no targets to steal from + if (g_IEngine->IsInGame()) { + + // Check if we have a username to steal, func automaticly steals a name in it. + if (StolenName()) { + + // Return the name that has changed from the func above + return format(stolen_name, "\x0F").c_str(); + } + } + } + if ((force_name.convar->m_StringLength > 3) && steamID == g_ISteamUser->GetSteamID()) { return force_name_newlined; } diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 9bf6924a..94ac78a4 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -407,6 +407,7 @@ "name", "fakelag", "disconnect_reason", + "name_stealer", "minigun_jump", "spycrab", "skinchanger", From 4d77bfcfb123bc4f584000c61422394f37757914 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:12:01 -0500 Subject: [PATCH 24/48] Added more control to name stealer --- src/hooks/others.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 12783e75..2a0cb6be 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,7 +213,8 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); -CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks"); +CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); +CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); static std::string stolen_name; @@ -239,7 +240,13 @@ bool StolenName(){ if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { // If our name is the same as current, than change it - if (std::string(info.name) == stolen_name) continue; + if (std::string(info.name) == stolen_name) { + // Since we found the ent we stole our name from and it is still good, if user settings are passive, then we return true and dont alter our name + if ((int)namesteal == 1) { + return true; + // Otherwise we continue to change our name to something else + } else continue; + } // a ent without a name is no ent we need, contine for a different one } else continue; From 28921a5a30ede15cfcf756f6aa1ed80157dd5c3a Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:23:10 -0500 Subject: [PATCH 25/48] Fixed double accuracy settings --- simple-ipc | 2 +- tf-settings/menu.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/simple-ipc b/simple-ipc index 94a287d6..e532876f 160000 --- a/simple-ipc +++ b/simple-ipc @@ -1 +1 @@ -Subproject commit 94a287d6faa00d44e1084b04e602842849858443 +Subproject commit e532876ffd707a48389d54ff904dcc40a84f2839 diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 6ca2e5ce..94ac78a4 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -135,7 +135,6 @@ "type": "list", "name": "Triggerbot Preferences", "list": [ - "trigger_accuracy", "trigger_zoomed", "trigger_maxrange", "trigger_charge", From c8534cc8716313f3c48a58c5300b10cbc2cf8dfe Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:25:50 -0500 Subject: [PATCH 26/48] Fix github --- src/hooks/others.cpp | 80 -------------------------------------------- 1 file changed, 80 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 273b147b..d4ee1270 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,89 +213,9 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); -CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); -CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); - -static std::string stolen_name; - -// Func to get a new entity to steal name from -bool StolenName(){ - - // Array to store potential namestealer targets with a bookkeeper to tell how full it is - int potential_targets[32]; - int potential_targets_length = 0; - - // Go through entities looking for potential targets - for (int i = 1; i < HIGHEST_ENTITY; i++) { - CachedEntity* ent = ENTITY(i); - - // Check if ent is a good target - if (!ent) continue; - if (ent == LOCAL_E) continue; - if (!ent->m_Type == ENTITY_PLAYER) continue; - if (ent->m_bEnemy) continue; - - // Check if name is current one - player_info_s info; - if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { - - // If our name is the same as current, than change it - if (std::string(info.name) == stolen_name) { - // Since we found the ent we stole our name from and it is still good, if user settings are passive, then we return true and dont alter our name - if ((int)namesteal == 1) { - return true; - // Otherwise we continue to change our name to something else - } else continue; - } - - // a ent without a name is no ent we need, contine for a different one - } else continue; - - // Save the ent to our array - potential_targets[potential_targets_length] = i; - potential_targets_length++; - if (potential_targets_length >= 32) break; - } - - // Get random number that we can use with our array - int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); - - // Get a idx from our random array position - int new_target = potential_targets[target_random_num]; - - // Checks to prevent crashes - if (!ENTITY(new_target) || potential_targets_length == 0) return false; - - // Grab username of user - player_info_s info; - if (g_IEngine->GetPlayerInfo(new_target, &info)) { - - // If our name is the same as current, than change it and return true - stolen_name = std::string(info.name); - return true; - } - - // Didnt get playerinfo - return false; -} const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); - - // Check User settings if namesteal is allowed - if (namesteal && steamID == g_ISteamUser->GetSteamID()) { - - // We dont want to steal names while not in-game as there are no targets to steal from - if (g_IEngine->IsInGame()) { - - // Check if we have a username to steal, func automaticly steals a name in it. - if (StolenName()) { - - // Return the name that has changed from the func above - return format(stolen_name, "\x0F").c_str(); - } - } - } if ((strlen(force_name.GetString()) > 1) && steamID == g_ISteamUser->GetSteamID()) { From ace8447fcbd2f0e63ccd0cb4241177d1165e7903 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:26:06 -0500 Subject: [PATCH 27/48] Fix github revert --- src/hooks/others.cpp | 80 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index d4ee1270..273b147b 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -213,9 +213,89 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); +CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); +CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); + +static std::string stolen_name; + +// Func to get a new entity to steal name from +bool StolenName(){ + + // Array to store potential namestealer targets with a bookkeeper to tell how full it is + int potential_targets[32]; + int potential_targets_length = 0; + + // Go through entities looking for potential targets + for (int i = 1; i < HIGHEST_ENTITY; i++) { + CachedEntity* ent = ENTITY(i); + + // Check if ent is a good target + if (!ent) continue; + if (ent == LOCAL_E) continue; + if (!ent->m_Type == ENTITY_PLAYER) continue; + if (ent->m_bEnemy) continue; + + // Check if name is current one + player_info_s info; + if (g_IEngine->GetPlayerInfo(ent->m_IDX, &info)) { + + // If our name is the same as current, than change it + if (std::string(info.name) == stolen_name) { + // Since we found the ent we stole our name from and it is still good, if user settings are passive, then we return true and dont alter our name + if ((int)namesteal == 1) { + return true; + // Otherwise we continue to change our name to something else + } else continue; + } + + // a ent without a name is no ent we need, contine for a different one + } else continue; + + // Save the ent to our array + potential_targets[potential_targets_length] = i; + potential_targets_length++; + if (potential_targets_length >= 32) break; + } + + // Get random number that we can use with our array + int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); + + // Get a idx from our random array position + int new_target = potential_targets[target_random_num]; + + // Checks to prevent crashes + if (!ENTITY(new_target) || potential_targets_length == 0) return false; + + // Grab username of user + player_info_s info; + if (g_IEngine->GetPlayerInfo(new_target, &info)) { + + // If our name is the same as current, than change it and return true + stolen_name = std::string(info.name); + return true; + } + + // Didnt get playerinfo + return false; +} const char* GetFriendPersonaName_hook(ISteamFriends* _this, CSteamID steamID) { static const GetFriendPersonaName_t original = (GetFriendPersonaName_t)hooks::steamfriends.GetMethod(offsets::GetFriendPersonaName()); + + // Check User settings if namesteal is allowed + if (namesteal && steamID == g_ISteamUser->GetSteamID()) { + + // We dont want to steal names while not in-game as there are no targets to steal from + if (g_IEngine->IsInGame()) { + + // Check if we have a username to steal, func automaticly steals a name in it. + if (StolenName()) { + + // Return the name that has changed from the func above + return format(stolen_name, "\x0F").c_str(); + } + } + } if ((strlen(force_name.GetString()) > 1) && steamID == g_ISteamUser->GetSteamID()) { From d9031c6f95632e743bc796523eee95a6a11d7d1d Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 01:41:08 -0500 Subject: [PATCH 28/48] Fixed namesteal not using enum --- src/hacks/Aimbot.cpp | 3 +++ src/hooks/others.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 24843770..ef90bc0f 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -472,6 +472,9 @@ bool IsTargetStateGood(CachedEntity* entity) { // Check if sticky aimbot is enabled if (!stickybot) return false; + // Only hitscan weapons can break stickys so check for them. + if (!(GetWeaponMode() == weapon_hitscan || GetWeaponMode() == weapon_melee)) return false; + // Check if target is within range if (EffectiveTargetingRange()) { if (entity->m_flDistance > (int)EffectiveTargetingRange()) return false; diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 273b147b..2dc351cb 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -214,7 +214,7 @@ void Shutdown_hook(void* _this, const char* reason) { static CatVar resolver(CV_SWITCH, "resolver", "0", "Resolve angles"); CatEnum namesteal_enum({ "OFF", "PASSIVE", "ACTIVE" }); -CatVar namesteal(CV_SWITCH, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); +CatVar namesteal(namesteal_enum, "name_stealer", "0", "Name Stealer", "Attemt to steal your teammates names. Usefull for avoiding kicks\nPassive only changes when the name stolen is no longer the best name to use\nActive Attemps to change the name whenever possible"); static std::string stolen_name; From 4bcd4f0ae0f187cfbda5c8c1ba60233bcfd333e9 Mon Sep 17 00:00:00 2001 From: julianacat Date: Thu, 20 Jul 2017 02:53:39 -0500 Subject: [PATCH 29/48] Fixed Name stealer not working + crashing --- src/hooks/others.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hooks/others.cpp b/src/hooks/others.cpp index 2dc351cb..17a2aaa2 100644 --- a/src/hooks/others.cpp +++ b/src/hooks/others.cpp @@ -254,18 +254,20 @@ bool StolenName(){ // Save the ent to our array potential_targets[potential_targets_length] = i; potential_targets_length++; + + // With our maximum amount of players reached, dont search for anymore if (potential_targets_length >= 32) break; } + // Checks to prevent crashes + if (potential_targets_length == 0) return false; + // Get random number that we can use with our array int target_random_num = floor(RandFloatRange(0, potential_targets_length - 0.1F)); // Get a idx from our random array position int new_target = potential_targets[target_random_num]; - // Checks to prevent crashes - if (!ENTITY(new_target) || potential_targets_length == 0) return false; - // Grab username of user player_info_s info; if (g_IEngine->GetPlayerInfo(new_target, &info)) { From d94f6b9741939fdcc7b05c4dae8c748c14382e4d Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Thu, 20 Jul 2017 12:12:47 +0300 Subject: [PATCH 30/48] Transparent FOV circle --- src/hacks/Aimbot.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 702fe6fc..89f7ee98 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -100,6 +100,7 @@ static CatVar auto_spin_up(CV_SWITCH, "aimbot_spin_up", "0", "Auto Spin Up", "Sp static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automatically zoom in if you can see target, useful for followbots"); */ +static CatVar fovcircle_opacity(CV_FLOAT, "aimbot_fov_draw_opacity", "0.7", "FOV Circle Opacity", "Defines opacity of FOV circle", 0.0f, 1.0f); static CatVar rageonly(CV_SWITCH, "aimbot_rage_only", "0", "Ignore non-rage targets", "Use playerlist to set up rage targets"); // Current Entity @@ -937,6 +938,9 @@ void DrawText() { if (fov && float(fov) < 180) { // Dont show ring while player is dead if (LOCAL_E->m_bAlivePlayer) { + rgba_t color = GUIColor(); + color.a = float(fovcircle_opacity); + // Grab the screen resolution and save to some vars int width, height; g_IEngine->GetScreenSize(width, height); @@ -960,7 +964,7 @@ void DrawText() { px = width / 2 + radius * cos(ang); py = height / 2 + radius * sin(ang); } - drawgl::Line(px, py, x - px, y - py, GUIColor()); + drawgl::Line(px, py, x - px, y - py, color); px = x; py = y; } From 7315875a3a2052a7753cccf8bf838fbb89232865 Mon Sep 17 00:00:00 2001 From: The Codacy Badger Date: Fri, 21 Jul 2017 05:33:17 +0000 Subject: [PATCH 31/48] Add Codacy badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 5ebd583f..420bae5c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # Cathook Multihack + +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=badger) + ![banner](https://raw.githubusercontent.com/nullifiedcat/cathook/master/banner.png) cathook is a multihack for Team Fortress 2 for Linux. cathook includes some joke features like From 6bccfa6a5816e08fcb0f4295e903d14a122e99f1 Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:34:21 -0500 Subject: [PATCH 32/48] Added Codacy Seal of Approval Should change this to cathook's when pushed. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5ebd583f..6b6c4d88 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=Badge_Grade) # Cathook Multihack ![banner](https://raw.githubusercontent.com/nullifiedcat/cathook/master/banner.png) From 4a4df68028b95163a22a76fbeb598c298dbc4239 Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:35:24 -0500 Subject: [PATCH 33/48] uh. --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index df4fb0be..dbcfb188 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=Badge_Grade) # Cathook Multihack -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=badger) - ![banner](https://raw.githubusercontent.com/nullifiedcat/cathook/master/banner.png) cathook is a multihack for Team Fortress 2 for Linux. cathook includes some joke features like From bbbe32cc894a93a34c42bc31643df5a7bc8a39e3 Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:36:19 -0500 Subject: [PATCH 34/48] Added Codacy Badge to the bottom. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dbcfb188..bf8c3018 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=Badge_Grade) # Cathook Multihack ![banner](https://raw.githubusercontent.com/nullifiedcat/cathook/master/banner.png) @@ -76,3 +75,5 @@ The installation script is as followed: git clone --recursive https://github.com/nullifiedcat/cathook-ipc-server && cd cathook-ipc-server && make -j4 ``` To run the Followbot server, run `./bin/cathook-ipc-server`. You can also use `./bin/cathook-ipc-server &>/dev/null &` to run it in background. + +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=Badge_Grade) From ac7c98b60337d56d699bca5040ab137932af211b Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:42:59 -0500 Subject: [PATCH 35/48] Strings must use doublequote. --- generate-class-headers.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/generate-class-headers.js b/generate-class-headers.js index 55b3509b..49bc310f 100644 --- a/generate-class-headers.js +++ b/generate-class-headers.js @@ -1,14 +1,14 @@ -const fs = require('fs'); +const fs = require("fs"); var full_class_table = {}; try { - full_class_table = JSON.parse(fs.readFileSync('full-class-table.json').toString()); + full_class_table = JSON.parse(fs.readFileSync("full-class-table.json").toString()); } catch (e) {} -const file = fs.readFileSync(process.argv[2]).toString().split('\n'); +const file = fs.readFileSync(process.argv[2]).toString().split("\n"); const modname = process.argv[3]; -console.log('Generating info for', modname, 'from', process.argv[2]); +console.log("Generating info for", modname, "from", process.argv[2]); var classes = {}; for (var i in file) { @@ -19,7 +19,7 @@ for (var i in file) { } } -fs.writeFileSync('full-class-table.json', JSON.stringify(full_class_table)); +fs.writeFileSync("full-class-table.json", JSON.stringify(full_class_table)); var header_constexpr = `/* AUTO-GENERATED HEADER - DO NOT MODIFY @@ -50,10 +50,10 @@ namespace client_classes { `; for (var clz in full_class_table) { - var value = '0'; + var value = "0"; if (classes[clz]) value = classes[clz]; header_constexpr += '\t\tstatic constexpr int ' + clz + ' = ' + value + ';\n'; - header += '\t\tint ' + clz + ' { ' + value + ' };\n'; + header += "\t\tint " + clz + " { " + value + " };\n"; } header += ` @@ -70,8 +70,8 @@ header_constexpr += ` #endif /* $mod_CONSTEXPR_AUTOGEN_HPP */`; -fs.writeFileSync('src/classinfo/' + modname + '.gen.hpp', header.replace(/\$mod/g, modname)); -fs.writeFileSync('src/classinfo/' + modname + '_constexpr.gen.hpp', header_constexpr.replace(/\$mod/g, modname)); +fs.writeFileSync("src/classinfo/" + modname + ".gen.hpp", header.replace(/\$mod/g, modname)); +fs.writeFileSync("src/classinfo/" + modname + "_constexpr.gen.hpp", header_constexpr.replace(/\$mod/g, modname)); -console.log(classes); \ No newline at end of file +console.log(classes); From 2486c8171f2780cf4004b993628a2ee1f694327e Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:44:04 -0500 Subject: [PATCH 36/48] Strings must use doublequote. --- generate-dummy-header.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/generate-dummy-header.js b/generate-dummy-header.js index d3e7e323..4cb8facb 100644 --- a/generate-dummy-header.js +++ b/generate-dummy-header.js @@ -1,8 +1,8 @@ -const fs = require('fs'); +const fs = require("fs"); var full_class_table = {}; try { - full_class_table = JSON.parse(fs.readFileSync('full-class-table.json').toString()); + full_class_table = JSON.parse(fs.readFileSync("full-class-table.json").toString()); } catch (e) {} console.log('Generating dummy class header'); @@ -22,7 +22,7 @@ namespace client_classes { `; for (var clz in full_class_table) { - header += '\t\tint ' + clz + ' { 0 };\n'; + header += "\t\tint " + clz + " { 0 };\n"; } header += ` @@ -33,4 +33,4 @@ header += ` #endif /* DUMMY_AUTOGEN_HPP */`; -fs.writeFileSync('src/classinfo/dummy.gen.hpp', header); \ No newline at end of file +fs.writeFileSync("src/classinfo/dummy.gen.hpp", header); From ea1eac0eb8b1c8a38295e619ab7d02a66ae959a8 Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:45:23 -0500 Subject: [PATCH 37/48] Strings must use doublequote. --- generate-dynamic-header.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/generate-dynamic-header.js b/generate-dynamic-header.js index 774f41bf..ba4e377d 100644 --- a/generate-dynamic-header.js +++ b/generate-dynamic-header.js @@ -1,11 +1,11 @@ -const fs = require('fs'); +const fs = require("fs"); var full_class_table = {}; try { - full_class_table = JSON.parse(fs.readFileSync('full-class-table.json').toString()); + full_class_table = JSON.parse(fs.readFileSync("full-class-table.json").toString()); } catch (e) {} -console.log('Generating dummy class header'); +console.log("Generating dummy class header"); var header = `/* AUTO-GENERATED HEADER - DO NOT MODIFY @@ -24,7 +24,7 @@ namespace client_classes { `; for (var clz in full_class_table) { - header += '\t\tint ' + clz + ' { 0 };\n'; + header += "\t\tint " + clz + " { 0 };\n"; } header += ` @@ -35,7 +35,7 @@ header += ` #endif /* DYNAMIC_AUTOGEN_HPP */`; -var POPULATED_MAP = ''; +var POPULATED_MAP = ""; for (var clz in full_class_table) { POPULATED_MAP += `\t\tclassid_mapping["${clz}"] = &${clz};\n`; @@ -69,5 +69,5 @@ dynamic dynamic_list; }`; -fs.writeFileSync('src/classinfo/dynamic.gen.hpp', header); -fs.writeFileSync('src/classinfo/dynamic.gen.cpp', source); \ No newline at end of file +fs.writeFileSync("src/classinfo/dynamic.gen.hpp", header); +fs.writeFileSync("src/classinfo/dynamic.gen.cpp", source); From 912034465041537a091d068c07fe352f4ca57045 Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:46:20 -0500 Subject: [PATCH 38/48] Strings must use doublequote. --- generate-class-headers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-class-headers.js b/generate-class-headers.js index 49bc310f..71191ab0 100644 --- a/generate-class-headers.js +++ b/generate-class-headers.js @@ -52,7 +52,7 @@ namespace client_classes { for (var clz in full_class_table) { var value = "0"; if (classes[clz]) value = classes[clz]; - header_constexpr += '\t\tstatic constexpr int ' + clz + ' = ' + value + ';\n'; + header_constexpr += "\t\tstatic constexpr int " + clz + " = " + value + ";\n"; header += "\t\tint " + clz + " { " + value + " };\n"; } From 4a9bcb81888c221e48e1bf5461124ac8c5963b5e Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:46:51 -0500 Subject: [PATCH 39/48] Strings must use doublequote. --- generate-dummy-header.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-dummy-header.js b/generate-dummy-header.js index 4cb8facb..7fe18669 100644 --- a/generate-dummy-header.js +++ b/generate-dummy-header.js @@ -5,7 +5,7 @@ try { full_class_table = JSON.parse(fs.readFileSync("full-class-table.json").toString()); } catch (e) {} -console.log('Generating dummy class header'); +console.log("Generating dummy class header"); var header = `/* AUTO-GENERATED HEADER - DO NOT MODIFY From 66c2f1d9a69ab886fe9f7a6e0e198a4773662424 Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 00:50:16 -0500 Subject: [PATCH 40/48] Apparently I don't know what the fuck I'm doing why do we even need this --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index bf8c3018..343a4328 100644 --- a/README.md +++ b/README.md @@ -75,5 +75,3 @@ The installation script is as followed: git clone --recursive https://github.com/nullifiedcat/cathook-ipc-server && cd cathook-ipc-server && make -j4 ``` To run the Followbot server, run `./bin/cathook-ipc-server`. You can also use `./bin/cathook-ipc-server &>/dev/null &` to run it in background. - -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/d208d05091854caaa51d2757d2097b2c)](https://www.codacy.com/app/SylveonBottle/cathook?utm_source=github.com&utm_medium=referral&utm_content=SylveonBottle/cathook&utm_campaign=Badge_Grade) From de80c172bdccc4d38538dbf78f16a56a6d3ce71e Mon Sep 17 00:00:00 2001 From: SylveonBottle Date: Fri, 21 Jul 2017 01:03:01 -0500 Subject: [PATCH 41/48] Where'd you come from..? --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 343a4328..5ebd583f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ # Cathook Multihack - ![banner](https://raw.githubusercontent.com/nullifiedcat/cathook/master/banner.png) cathook is a multihack for Team Fortress 2 for Linux. cathook includes some joke features like From 5baf022f780ad81d848a545585c7f44d867799e4 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 12:13:14 +0300 Subject: [PATCH 42/48] Add trigger delay, close #206 --- src/hacks/SpyAlert.cpp | 2 +- src/hacks/Trigger.cpp | 34 +++++++++++++++++++++++++++++++--- tf-settings/menu.json | 3 ++- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/hacks/SpyAlert.cpp b/src/hacks/SpyAlert.cpp index 79eb6d63..86b1a7c1 100644 --- a/src/hacks/SpyAlert.cpp +++ b/src/hacks/SpyAlert.cpp @@ -35,7 +35,7 @@ void Draw() { closest_spy_distance = 0.0f; spy_count = 0; if (last_say > g_GlobalVars->curtime) last_say = 0; - for (int i = 0; i < HIGHEST_ENTITY && i < 64; i++) { + for (int i = 0; i < HIGHEST_ENTITY && i < 32; i++) { ent = ENTITY(i); if (CE_BAD(ent)) continue; if (CE_BYTE(ent, netvar.iLifeState)) continue; diff --git a/src/hacks/Trigger.cpp b/src/hacks/Trigger.cpp index f115b30e..18b5795a 100644 --- a/src/hacks/Trigger.cpp +++ b/src/hacks/Trigger.cpp @@ -27,7 +27,7 @@ static CatVar trigger_key_mode(trigger_key_modes_enum, "trigger_key_mode", "1", static CatEnum hitbox_mode_enum({ "AUTO-HEAD", "AUTO-CLOSEST", "Head only" }); static CatVar hitbox_mode(hitbox_mode_enum, "trigger_hitboxmode", "0", "Hitbox Mode", "Defines hitbox selection mode"); -static CatVar accuracy(CV_INT, "trigger_accuracy", "0", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox. Recommended to use with sniper rifle/ambassador"); +static CatVar accuracy(CV_INT, "trigger_accuracy", "1", "Improve accuracy", "Improves triggerbot accuracy when aiming for specific hitbox. Recommended to use with sniper rifle/ambassador"); static CatVar ignore_vaccinator(CV_SWITCH, "trigger_ignore_vaccinator", "1", "Ignore Vaccinator", "Hitscan weapons won't fire if enemy is vaccinated against bullets"); static CatVar ignore_hoovy(CV_SWITCH, "trigger_ignore_hoovy", "1", "Ignore Hoovies", "Triggerbot won't attack hoovies"); @@ -42,13 +42,20 @@ static CatVar zoomed_only(CV_SWITCH, "trigger_zoomed", "1", "Zoomed only", "Don' static CatVar max_range(CV_INT, "trigger_maxrange", "0", "Max distance", "Max range for triggerbot\n" "900-1100 range is efficient for scout/widowmaker engineer", 4096.0f); - + +static CatVar delay(CV_FLOAT, "trigger_delay", "0", "Delay", "Triggerbot delay in seconds", 0.0f, 1.0f); + +float target_time = 0.0f; + int last_hb_traced = 0; Vector forward; // The main "loop" of the triggerbot void CreateMove() { + float backup_time = target_time; + target_time = 0; + // Check if aimbot is enabled if (!enabled) return; @@ -65,7 +72,23 @@ void CreateMove() { if (CE_BAD(ent)) return; // Determine whether the triggerbot should shoot, then act accordingly - if (IsTargetStateGood(ent)) g_pUserCmd->buttons |= IN_ATTACK; + if (IsTargetStateGood(ent)) { + target_time = backup_time; + if (delay) { + if (target_time > g_GlobalVars->curtime) { + target_time = 0.0f; + } + if (!target_time) { + target_time = g_GlobalVars->curtime; + } else { + if (g_GlobalVars->curtime - float(delay) >= target_time) { + g_pUserCmd->buttons |= IN_ATTACK; + } + } + } else { + g_pUserCmd->buttons |= IN_ATTACK; + } + } return; } @@ -95,6 +118,11 @@ bool ShouldShoot() { if (HasCondition(g_pLocalPlayer->entity)) return false; // Check if player is cloaked if (IsPlayerInvisible(g_pLocalPlayer->entity)) return false; + + if (IsAmbassador(g_pLocalPlayer->weapon())) { + // Check if ambasador can headshot + if (!AmbassadorCanHeadshot()) return false; + } } IF_GAME (IsTF2()) { diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 94ac78a4..23bf9928 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -135,11 +135,12 @@ "type": "list", "name": "Triggerbot Preferences", "list": [ + "trigger_delay", + "trigger_accuracy", "trigger_zoomed", "trigger_maxrange", "trigger_charge", "trigger_hitboxmode", - "trigger_accuracy", "trigger_key_mode", "trigger_key" ] From 368603552e702fe89ae51845af37f7f436b8e16c Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 16:19:17 +0300 Subject: [PATCH 43/48] Improved chams --- src/EffectChams.cpp | 67 +++++++++++++++++++++++++++++++------------ src/EffectChams.hpp | 1 + tf-settings/menu.json | 5 +++- 3 files changed, 54 insertions(+), 19 deletions(-) diff --git a/src/EffectChams.cpp b/src/EffectChams.cpp index 69e73183..c34e7ae8 100644 --- a/src/EffectChams.cpp +++ b/src/EffectChams.cpp @@ -22,7 +22,10 @@ static CatVar ammobox(CV_SWITCH, "chams_ammo", "0", "Ammoboxes", "Render chams o static CatVar buildings(CV_SWITCH, "chams_buildings", "0", "Buildings", "Render chams on buildings"); static CatVar stickies(CV_SWITCH, "chams_stickies", "0", "Stickies", "Render chams on stickybombs"); static CatVar teammate_buildings(CV_SWITCH, "chams_teammate_buildings", "0", "Teammate Buildings", "Render chams on teammates buildings"); -static CatVar weapons(CV_SWITCH, "chams_weapons", "1", "Weapons", "Render chams on players weapons"); +static CatVar recursive(CV_SWITCH, "chams_recursive", "1", "Recursive", "Render chams on weapons and cosmetics"); +static CatVar weapons_white(CV_SWITCH, "chams_weapons_white", "1", "White Weapons", "Should chams on weapons be white"); +static CatVar legit(CV_SWITCH, "chams_legit", "0", "Legit chams", "Don't show chams through walls"); +static CatVar singlepass(CV_SWITCH, "chams_singlepass", "0", "Single-pass", "Render chams only once (this disables 'darker' chams on invisible parts of player"); void EffectChams::Init() { logging::Info("Init EffectChams..."); @@ -102,12 +105,6 @@ bool EffectChams::ShouldRenderChams(IClientEntity* entity) { if (entity->entindex() < 0) return false; CachedEntity* ent = ENTITY(entity->entindex()); if (CE_BAD(ent)) return false; - if (weapons && vfunc(entity, 0xBE, 0)(entity)) { - IClientEntity* owner = vfunc(entity, 0x1C3, 0)(entity); - if (owner) { - return ShouldRenderChams(owner); - } - } switch (ent->m_Type) { case ENTITY_BUILDING: if (!buildings) return false; @@ -141,6 +138,35 @@ bool EffectChams::ShouldRenderChams(IClientEntity* entity) { return false; } +void EffectChams::RenderChamsRecursive(IClientEntity* entity) { + entity->DrawModel(1); + + if (!recursive) return; + + IClientEntity *attach; + int passes = 0; + + attach = g_IEntityList->GetClientEntity(*(int*)((uintptr_t)entity + netvar.m_Collision - 24) & 0xFFF); + while (attach && passes++ < 32) { + if (attach->ShouldDraw()) { + if (entity->GetClientClass()->m_ClassID == RCC_PLAYER && vfunc(attach, 190, 0)(attach)) { + if (weapons_white) { + rgba_t mod_original; + g_IVRenderView->GetColorModulation(mod_original.rgba); + g_IVRenderView->SetColorModulation(colors::white); + attach->DrawModel(1); + g_IVRenderView->SetColorModulation(mod_original.rgba); + } else { + attach->DrawModel(1); + } + } + else + attach->DrawModel(1); + } + attach = g_IEntityList->GetClientEntity(*(int*)((uintptr_t)attach + netvar.m_Collision - 20) & 0xFFF); + } +} + void EffectChams::RenderChams(int idx) { CMatRenderContextPtr ptr(GET_RENDER_CONTEXT); IClientEntity* entity = g_IEntityList->GetClientEntity(idx); @@ -148,17 +174,22 @@ void EffectChams::RenderChams(int idx) { if (ShouldRenderChams(entity)) { rgba_t color = ChamsColor(entity); rgba_t color_2 = color * 0.6f; - mat_unlit_z->AlphaModulate(1.0f); - ptr->DepthRange(0.0f, 0.01f); - g_IVRenderView->SetColorModulation(color); - g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit_z : mat_lit_z); - entity->DrawModel(1); - //((DrawModelExecute_t)(hooks::hkIVModelRender->GetMethod(hooks::offDrawModelExecute)))(_this, state, info, matrix); - mat_unlit->AlphaModulate(1.0f); - g_IVRenderView->SetColorModulation(color_2); - ptr->DepthRange(0.0f, 1.0f); - g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit : mat_lit); - entity->DrawModel(1); + if (!legit) { + mat_unlit_z->AlphaModulate(1.0f); + ptr->DepthRange(0.0f, 0.01f); + g_IVRenderView->SetColorModulation(color_2); + g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit_z : mat_lit_z); + + RenderChamsRecursive(entity); + } + + if (legit || !singlepass) { + mat_unlit->AlphaModulate(1.0f); + g_IVRenderView->SetColorModulation(color); + ptr->DepthRange(0.0f, 1.0f); + g_IVModelRender->ForcedMaterialOverride(flat ? mat_unlit : mat_lit); + RenderChamsRecursive(entity); + } } } } diff --git a/src/EffectChams.hpp b/src/EffectChams.hpp index b457c310..a55fa069 100644 --- a/src/EffectChams.hpp +++ b/src/EffectChams.hpp @@ -29,6 +29,7 @@ public: void RenderChams(int idx); void BeginRenderChams(); void EndRenderChams(); + void RenderChamsRecursive(IClientEntity* entity); public: bool init { false }; bool drawing { false }; diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 23bf9928..1791aef7 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -245,13 +245,16 @@ "name": "Chams", "list": [ "chams_enable", + "chams_legit", + "chams_singlepass", "chams_health", "chams_players", "chams_teammates", "chams_buildings", "chams_teammate_buildings", "chams_flat", - "chams_weapons", + "chams_recursive", + "chams_weapons_white", "chams_medkits", "chams_ammo", "chams_stickies" From 0139a6e86f2785588a08602faddff2d3061f9e12 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 16:28:18 +0300 Subject: [PATCH 44/48] Draw menu ABOVE visuals. Don't draw anything with no_visuals 1 --- src/hooks/PaintTraverse.h | 1 + src/hooks/sdl.cpp | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/hooks/PaintTraverse.h b/src/hooks/PaintTraverse.h index 2c463d4a..ad70f2b0 100644 --- a/src/hooks/PaintTraverse.h +++ b/src/hooks/PaintTraverse.h @@ -12,6 +12,7 @@ class CatVar; extern CatVar no_zoom; extern CatVar clean_screenshots; +extern CatVar disable_visuals; void PaintTraverse_hook(void*, unsigned int, bool, bool); #endif /* PAINTTRAVERSE_H_ */ diff --git a/src/hooks/sdl.cpp b/src/hooks/sdl.cpp index 7c0595ee..5e3e7504 100644 --- a/src/hooks/sdl.cpp +++ b/src/hooks/sdl.cpp @@ -38,7 +38,7 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) { static SDL_GLContext ctx_tf2 = SDL_GL_GetCurrentContext(); static SDL_GLContext ctx_imgui = nullptr; static SDL_GLContext ctx_text = nullptr; - { + if (!disable_visuals) { PROF_SECTION(DRAW_cheat); if (!ctx_imgui) { ctx_imgui = SDL_GL_CreateContext(window); @@ -55,15 +55,7 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) { return; } - SDL_GL_MakeCurrent(window, ctx_imgui); - { - PROF_SECTION(DRAW_imgui); - ImGui_ImplSdl_NewFrame(window); - menu::im::Render(); - ImGui::Render(); - } SDL_GL_MakeCurrent(window, ctx_text); - { std::lock_guard draw_lock(drawing_mutex); drawgl::PreRender(); @@ -79,6 +71,13 @@ void SDL_GL_SwapWindow_hook(SDL_Window* window) { drawgl::PostRender(); } + SDL_GL_MakeCurrent(window, ctx_imgui); + { + PROF_SECTION(DRAW_imgui); + ImGui_ImplSdl_NewFrame(window); + menu::im::Render(); + ImGui::Render(); + } } { PROF_SECTION(DRAW_valve); From f56822984852337d9003e9c2cbd6504afc05c99f Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 17:02:20 +0300 Subject: [PATCH 45/48] cat_nolerp 1 does something now --- src/globals.cpp | 10 ++++++++++ src/globals.h | 5 +++++ src/hooks/CreateMove.cpp | 16 ++++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/globals.cpp b/src/globals.cpp index 4900541c..f4ad12e3 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -19,6 +19,11 @@ void ThirdpersonCallback(IConVar* var, const char* pOldValue, float flOldValue) } } +ConVar* sv_client_min_interp_ratio; +ConVar* cl_interp_ratio; +ConVar* cl_interp; +ConVar* cl_interpolate; + unsigned long tickcount = 0; char* force_name_newlined = new char[32] { 0 }; bool need_name_change = true; @@ -38,6 +43,11 @@ CatVar disconnect_reason(CV_STRING, "disconnect_reason", "", "Disconnect reason" CatVar event_log(CV_SWITCH, "events", "1", "Advanced Events"); void GlobalSettings::Init() { + sv_client_min_interp_ratio = g_ICvar->FindVar("sv_client_min_interp_ratio"); + cl_interp_ratio = g_ICvar->FindVar("cl_interp_ratio"); + cl_interp = g_ICvar->FindVar("cl_interp"); + cl_interpolate = g_ICvar->FindVar("cl_interpolate"); + bSendPackets = new bool; *bSendPackets = true; force_thirdperson.OnRegister([](CatVar* var) { diff --git a/src/globals.h b/src/globals.h index f56591e1..1615a516 100644 --- a/src/globals.h +++ b/src/globals.h @@ -15,6 +15,11 @@ class CatVar; extern int g_AppID; extern unsigned long tickcount; +extern ConVar* sv_client_min_interp_ratio; +extern ConVar* cl_interp_ratio; +extern ConVar* cl_interp; +extern ConVar* cl_interpolate; + extern CatVar event_log; extern CatVar cathook; // Master switch extern CatVar ignore_taunting; diff --git a/src/hooks/CreateMove.cpp b/src/hooks/CreateMove.cpp index 94d94b1e..2d922652 100644 --- a/src/hooks/CreateMove.cpp +++ b/src/hooks/CreateMove.cpp @@ -163,15 +163,19 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) { time_replaced = false; curtime_old = g_GlobalVars->curtime; - static ConVar* sv_client_min_interp_ratio = g_ICvar->FindVar("sv_client_min_interp_ratio"); - static ConVar* cl_interp = g_ICvar->FindVar("cl_interp"); - static ConVar* cl_interp_ratio = g_ICvar->FindVar("cl_interp_ratio"); - if (nolerp) { g_pUserCmd->tick_count += 1; - if (sv_client_min_interp_ratio->GetInt() != -1) sv_client_min_interp_ratio->SetValue(-1); - if (cl_interp->GetInt() != 0) cl_interp->SetValue(0); + if (sv_client_min_interp_ratio->GetInt() != -1) { + //sv_client_min_interp_ratio->m_nFlags = 0; + sv_client_min_interp_ratio->SetValue(-1); + } + if (cl_interp->m_fValue != 0) { + cl_interp->SetValue(0); + cl_interp->m_fValue = 0.0f; + cl_interp->m_nValue = 0; + } if (cl_interp_ratio->GetInt() != 0) cl_interp_ratio->SetValue(0); + if (cl_interpolate->GetInt() != 0) cl_interpolate->SetValue(0); } if (!g_Settings.bInvalid && CE_GOOD(g_pLocalPlayer->entity)) { From a935c9a1b47a488e0fce252f0249baafd151a32f Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 18:26:24 +0300 Subject: [PATCH 46/48] FOV circle for FOV < 1 --- src/hacks/Aimbot.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index a62ae3dc..c664ddd8 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -970,7 +970,7 @@ void DrawText() { // Broken from kathook merge, TODO needs to be adapted for imgui if (fov_draw) { // It cant use fovs greater than 180, so we check for that - if (fov && float(fov) < 180) { + if (float(fov) > 0.0f && float(fov) < 180) { // Dont show ring while player is dead if (LOCAL_E->m_bAlivePlayer) { rgba_t color = GUIColor(); From 4c3662aad5addcd3d0459ac0d53c3fe6e9ed4491 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 19:18:22 +0300 Subject: [PATCH 47/48] aimbot miss chance --- src/hacks/Aimbot.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index c664ddd8..d4886f36 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -101,6 +101,8 @@ static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automa static CatVar fovcircle_opacity(CV_FLOAT, "aimbot_fov_draw_opacity", "0.7", "FOV Circle Opacity", "Defines opacity of FOV circle", 0.0f, 1.0f); static CatVar rageonly(CV_SWITCH, "aimbot_rage_only", "0", "Ignore non-rage targets", "Use playerlist to set up rage targets"); +static CatVar miss_chance(CV_FLOAT, "aimbot_miss_chance", "0", "Miss chance", "From 0 to 1. Aimbot will NOT aim in these % cases", 0.0f, 1.0f); + // Current Entity int target_eid { 0 }; CachedEntity* target = 0; @@ -222,6 +224,7 @@ bool ShouldAim() { if (g_pUserCmd->buttons & IN_USE) return false; // Check if using action slot item if (g_pLocalPlayer->using_action_slot_item) return false; + IF_GAME (IsTF2()) { // Check if Carrying A building if (CE_BYTE(g_pLocalPlayer->entity, netvar.m_bCarryingObject)) return false; @@ -509,6 +512,12 @@ bool IsTargetStateGood(CachedEntity* entity) { // A function to aim at a specific entitiy void Aim(CachedEntity* entity) { + if (float(miss_chance) > 0.0f) { + if ((rand() % 100) < float(miss_chance) * 100.0f) { + return; + } + } + // Dont aim at a bad entity if (CE_BAD(entity)) return; From 4c8adff107c994b7afba1c00ff0827a401942469 Mon Sep 17 00:00:00 2001 From: nullifiedcat Date: Fri, 21 Jul 2017 20:20:54 +0300 Subject: [PATCH 48/48] Working Infinite Healthpacks, close #209 --- src/hacks/LagExploit.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/hacks/LagExploit.cpp b/src/hacks/LagExploit.cpp index 09d4409e..e5609064 100644 --- a/src/hacks/LagExploit.cpp +++ b/src/hacks/LagExploit.cpp @@ -148,26 +148,25 @@ void CreateMove() { } // Infinite healthpacks (I'll probably have to move this somewhere else) - if (infinite_packs && CE_GOOD(LOCAL_E) && LOCAL_E->m_iHealth != LOCAL_E->m_iMaxHealth) { + if (infinite_packs && CE_GOOD(LOCAL_E) && LOCAL_E->m_iHealth < LOCAL_E->m_iMaxHealth) { ICollideable* p = RAW_ENT(LOCAL_E)->GetCollideable(); - const Vector& max1 = p->OBBMaxs(); - const Vector& min1 = p->OBBMins(); + const Vector& max1 = p->OBBMaxs() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); + const Vector& min1 = p->OBBMins() + RAW_ENT(LOCAL_E)->GetAbsOrigin(); for (int i = 1; i < entity_cache::max; i++) { CachedEntity* e = ENTITY(i); + if (CE_BAD(e)) continue; if (e->m_iClassID != CL_CLASS(CBaseAnimating)) continue; if (e->m_ItemType != ITEM_HEALTH_SMALL && e->m_ItemType != ITEM_HEALTH_MEDIUM && e->m_ItemType != ITEM_HEALTH_LARGE) continue; - if (e->m_flDistance < 54.0f) amount = 900; - // Not working for some reason? - /*ICollideable* c = RAW_ENT(e)->GetCollideable(); - const Vector& max2 = c->OBBMaxs(); - const Vector& min2 = c->OBBMins(); + ICollideable* c = RAW_ENT(e)->GetCollideable(); + const Vector& max2 = c->OBBMaxs() + e->m_vecOrigin;// + Vector(10, 10, 10); + const Vector& min2 = c->OBBMins() + e->m_vecOrigin;// - Vector(10, 10, 10); if ( (min1.x <= max2.x && max1.x >= min2.x) && (min1.y <= max2.y && max1.y >= min2.y) && (min1.z <= max2.z && max1.z >= min2.z) ) { - logging::Info("Collision with %d", i); + //logging::Info("Collision with %d", i); amount = 900; break; - }*/ + } } }