ADDED cat_fb_jointeam cat_fb_autoclass

This commit is contained in:
nullifiedcat 2017-03-23 20:16:40 +03:00
parent f59a41d0c4
commit d4bb2c669c
5 changed files with 64 additions and 11 deletions

View File

@ -33,7 +33,7 @@ struct mstudiobbox_t;
#define CE_VECTOR(entity, offset) CE_VAR(entity, offset, Vector)
#define CE_GOOD_NO_DORMANT_CHECK(entity) (!g_Settings.bInvalid && dynamic_cast<CachedEntity*>(entity) && dynamic_cast<IClientEntity*>(entity->m_pEntity))
#define CE_GOOD(entity) (!g_Settings.bInvalid && dynamic_cast<CachedEntity*>(entity) && dynamic_cast<IClientEntity*>(entity->m_pEntity) && entity->m_pEntity->GetIClientEntity() && !entity->m_pEntity->GetIClientEntity()->IsDormant())
#define CE_GOOD(entity) (!g_Settings.bInvalid && dynamic_cast<CachedEntity*>(entity) && dynamic_cast<IClientEntity*>(entity->m_pEntity) && (g_IEntityList->GetClientEntity(entity->m_IDX) == entity->m_pEntity) && entity->m_pEntity->GetIClientEntity() && !entity->m_pEntity->GetIClientEntity()->IsDormant())
#define CE_BAD(entity) (!CE_GOOD(entity))
#define IDX_GOOD(idx) (idx >= 0 && idx < HIGHEST_ENTITY && idx < MAX_ENTITIES)

View File

@ -84,7 +84,7 @@ int HealingPriority(int idx) {
}
if (ipc::peer) {
if (hacks::shared::followbot::bot && hacks::shared::followbot::following_idx == idx) {
priority *= 2.0f;
priority *= 3.0f;
}
}
return priority;

View File

@ -109,7 +109,7 @@ void DoWalking() {
}
CachedEntity* found_entity = ENTITY(following_idx);
if (mimic_slot) {
if (mimic_slot && !g_pLocalPlayer->life_state) {
CachedEntity* owner_weapon = ENTITY(CE_INT(found_entity, netvar.hActiveWeapon) & 0xFFF);
if (CE_GOOD(owner_weapon) && CE_GOOD(g_pLocalPlayer->weapon())) {
// FIXME proper classes

View File

@ -34,6 +34,9 @@ float AngleDiff( float destAngle, float srcAngle )
static CatVar minigun_jump(CV_SWITCH, "minigun_jump", "0", "TF2C minigun jump", "Allows jumping while shooting with minigun");
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)");
bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
SEGV_BEGIN;
@ -96,6 +99,51 @@ bool CreateMove_hook(void* thisptr, float inputSample, CUserCmd* cmd) {
g_Settings.bInvalid = false;
// Disabled because this causes EXTREME aimbot inaccuracy
//if (!cmd->command_number) return ret;
if (hacks::shared::followbot::bot) {
static int team_joining_state = 0;
static float last_jointeam_try = 0;
if (g_GlobalVars->curtime < last_jointeam_try) last_jointeam_try = 0.0f;
if (!g_pLocalPlayer->team) team_joining_state = 1;
else {
if (team_joining_state) {
logging::Info("Trying to change CLASS");
g_IEngine->ExecuteClientCmd(format("join_class ", joinclass.GetString()).c_str());
}
team_joining_state = 0;
}
if (team_joining_state) {
CachedEntity* found_entity = nullptr;
for (int i = 1; i < 32 && i < HIGHEST_ENTITY; i++) {
CachedEntity* ent = ENTITY(i);
if (CE_BAD(ent)) continue;
if (!ent->m_pPlayerInfo) continue;
if (ent->m_pPlayerInfo->friendsID == hacks::shared::followbot::follow_steamid) {
found_entity = ent;
break;
}
}
if (found_entity && CE_GOOD(found_entity)) {
if (jointeam && team_joining_state == 1 && (g_GlobalVars->curtime - last_jointeam_try) > 1.0f) {
last_jointeam_try = g_GlobalVars->curtime;
switch (CE_INT(found_entity, netvar.iTeamNum)) {
case TEAM_RED:
logging::Info("Trying to join team RED");
g_IEngine->ExecuteClientCmd("jointeam red"); break;
case TEAM_BLU:
logging::Info("Trying to join team BLUE");
g_IEngine->ExecuteClientCmd("jointeam blue"); break;
}
}
}
}
}
if (CE_GOOD(g_pLocalPlayer->entity)) {
g_pLocalPlayer->v_OrigViewangles = cmd->viewangles;
// PROF_BEGIN();

View File

@ -47,14 +47,19 @@ CatCommand connect("ipc_connect", "Connect to IPC server", []() {
return;
}
peer = new peer_t("cathook_followbot_server", false, false);
peer->Connect();
logging::Info("peer count: %i", peer->memory->peer_count);
logging::Info("magic number: 0x%08x", peer->memory->global_data.magic_number);
logging::Info("magic number offset: 0x%08x", (uintptr_t)&peer->memory->global_data.magic_number - (uintptr_t)peer->memory);
peer->SetCallback(CommandCallback);
StoreClientData();
thread_running = true;
pthread_create(&listener_thread, nullptr, listen, nullptr);
try {
peer->Connect();
logging::Info("peer count: %i", peer->memory->peer_count);
logging::Info("magic number: 0x%08x", peer->memory->global_data.magic_number);
logging::Info("magic number offset: 0x%08x", (uintptr_t)&peer->memory->global_data.magic_number - (uintptr_t)peer->memory);
peer->SetCallback(CommandCallback);
StoreClientData();
thread_running = true;
pthread_create(&listener_thread, nullptr, listen, nullptr);
} catch (std::runtime_error& error) {
logging::Info("Runtime error: %s", error.what());
}
});
CatCommand disconnect("ipc_disconnect", "Disconnect from IPC server", []() {
thread_running = false;