Merge remote-tracking branch 'nullworks/newui'

This commit is contained in:
TotallyNotElite 2018-08-19 23:43:17 +02:00
commit af5cfd19d0
40 changed files with 270 additions and 323 deletions

View File

@ -1,7 +1,6 @@
target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/angles.hpp"
"${CMAKE_CURRENT_LIST_DIR}/averager.hpp"
"${CMAKE_CURRENT_LIST_DIR}/backpacktf.hpp"
"${CMAKE_CURRENT_LIST_DIR}/base64.hpp"
"${CMAKE_CURRENT_LIST_DIR}/chatlog.hpp"
"${CMAKE_CURRENT_LIST_DIR}/chatstack.hpp"

10
include/EventLogging.hpp Executable file
View File

@ -0,0 +1,10 @@
/*
Created on 29.07.18.
*/
#pragma once
namespace event_logging
{
bool isEnabled();
}

View File

@ -7,9 +7,8 @@
#pragma once
#include <core/logging.hpp>
#include "common.hpp"
#include <core/logging.hpp>
namespace angles
{

View File

@ -1,35 +0,0 @@
/*
* backpacktf.hpp
*
* Created on: Jul 23, 2017
* Author: nullifiedcat
*/
#pragma once
namespace backpacktf
{
constexpr float REFINED_METAL_PRICE = 0.075f; // $
constexpr unsigned REQUEST_INTERVAL =
10; // Make a backpack.tf request every 30 seconds
constexpr unsigned MAX_CACHE_AGE = 60 * 30;
constexpr unsigned OUTDATED_AGE =
60 * 60 * 24 * 3; // After how many seconds backpack is marked "outdated"
// (possibly private)
struct backpack_data_s
{
bool pending{ false };
bool bad{ true };
bool no_value{ false }; // No recorded value
bool outdated_value{ false }; // Outdated value. Private inventory?
unsigned last_request{ 0 };
float value{ 0 };
unsigned id{ 0 };
};
const backpack_data_s &get_data(unsigned id);
void init();
bool enabled();
} // namespace backpacktf

View File

@ -7,6 +7,7 @@
#pragma once
#include "config.h"
#include <string>
namespace chatlog

View File

@ -9,6 +9,7 @@
#define CHATSTACK_INTERVAL 0.8f
#include "config.h"
#include <string>
#include <stack>
#include <functional>

View File

@ -47,9 +47,8 @@
#include "averager.hpp"
#include "core/macros.hpp"
#include <visual/colors.hpp>
#if ENABLE_VISUALS
#include <visual/colors.hpp>
#include <visual/drawing.hpp>
#include "visual/fidgetspinner.hpp"
#include <visual/EffectGlow.hpp>
@ -94,7 +93,6 @@
#include "votelogger.hpp"
#include "crits.hpp"
#include "textmode.hpp"
#include "backpacktf.hpp"
#include "core/sharedobj.hpp"
#include "init.hpp"
#include "reclasses/reclasses.hpp"

View File

@ -15,4 +15,5 @@
#define ENABLE_TEXTMODE_STDIN @EnableTextmodeStdin@
#define ENABLE_NULL_GRAPHICS @EnableNullGraphics@
#define TEXTMODE @Textmode@
#define ENABLE_PROFILER @EnableProfiler@
#define ENABLE_PROFILER @EnableProfiler@
#define ENABLE_ONLINE @EnableOnlineFeatures@

View File

@ -64,6 +64,7 @@ bool IsProjectileACrit(CachedEntity *ent);
class CachedEntity
{
public:
typedef CachedEntity ThisClass;
CachedEntity();
~CachedEntity();

View File

@ -14,6 +14,7 @@
#include <studio.h>
#include <stdexcept>
class CachedEntity;
#define CACHE_MAX_HITBOXES 64
namespace hitbox_cache

View File

@ -8,7 +8,7 @@
#pragma once
#include "common.hpp"
#if ENABLE_VISUALS
namespace hacks::shared::esp
{
@ -59,3 +59,4 @@ void AddEntityString(CachedEntity *entity, const std::string &string,
void SetEntityColor(CachedEntity *entity, const rgba_t &color);
void ResetEntityStrings();
} // namespace hacks::shared::esp
#endif

View File

@ -2,7 +2,9 @@
#include <hacks/Aimbot.hpp>
namespace hacks::shared::lightesp
{
#if ENABLE_VISUALS
void run();
void draw();
rgba_t LightESPColor(CachedEntity *ent);
#endif
} // namespace hacks::shared::lightesp

View File

@ -3,9 +3,12 @@
*/
#pragma once
#include "config.h"
#if ENABLE_ONLINE
#include <string>
#if ENABLE_VISUALS
#include <colors.hpp>
#endif
#include <config.h>
#include <vector>
@ -24,7 +27,9 @@ struct user_data
bool no_target{ false };
bool is_developer{};
bool has_color{ false };
#if ENABLE_VISUALS
colors::rgba_t color{};
#endif
bool rainbow{ false };
};
@ -35,3 +40,4 @@ void update();
user_data *getUserData(unsigned steamId);
} // namespace online
#endif

View File

@ -24,8 +24,9 @@ enum class k_EState
CAT,
STATE_LAST = CAT
};
#if ENABLE_VISUALS
extern rgba_t k_Colors[];
#endif
const std::string k_Names[] = { "DEFAULT", "FRIEND", "RAGE", "IPC",
"DEVELOPER" };
const char *const k_pszNames[] = { "DEFAULT", "FRIEND", "RAGE", "IPC",
@ -34,7 +35,9 @@ const char *const k_pszNames[] = { "DEFAULT", "FRIEND", "RAGE", "IPC",
struct userdata
{
k_EState state{ k_EState::DEFAULT };
#if ENABLE_VISUALS
rgba_t color{ 0, 0, 0, 0 };
#endif
float inventory_value{ 0 };
unsigned deaths_to{ 0 };
unsigned kills{ 0 };
@ -50,9 +53,10 @@ constexpr bool IsFriendly(k_EState state)
return state == k_EState::DEVELOPER || state == k_EState::FRIEND ||
state == k_EState::IPC;
}
#if ENABLE_VISUALS
rgba_t Color(unsigned steamid);
rgba_t Color(CachedEntity *player);
#endif
userdata &AccessData(unsigned steamid);
userdata &AccessData(CachedEntity *player);
bool IsDefault(unsigned steamid);

View File

@ -5,8 +5,8 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/drawmgr.hpp"
"${CMAKE_CURRENT_LIST_DIR}/EffectChams.hpp"
"${CMAKE_CURRENT_LIST_DIR}/EffectGlow.hpp"
"${CMAKE_CURRENT_LIST_DIR}/EventLogging.hpp"
"${CMAKE_CURRENT_LIST_DIR}/fidgetspinner.hpp"
"${CMAKE_CURRENT_LIST_DIR}/EventLogging.hpp"
"${CMAKE_CURRENT_LIST_DIR}/SDLHooks.hpp")
if(EnableGUI)

View File

@ -10,7 +10,7 @@
#include <glez/color.hpp>
class CachedEntity;
#if ENABLE_VISUALS
namespace colors
{
namespace chat
@ -165,3 +165,4 @@ rgba_t EntityF(CachedEntity *ent);
} // namespace colors
using rgba_t = colors::rgba_t;
#endif

View File

@ -1,6 +1,5 @@
target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/angles.cpp"
"${CMAKE_CURRENT_LIST_DIR}/backpacktf.cpp"
"${CMAKE_CURRENT_LIST_DIR}/chatlog.cpp"
"${CMAKE_CURRENT_LIST_DIR}/chatstack.cpp"
"${CMAKE_CURRENT_LIST_DIR}/conditions.cpp"

170
src/EventLogging.cpp Executable file
View File

@ -0,0 +1,170 @@
/*
Created on 29.07.18.
*/
#include "config.h"
#include <EventLogging.hpp>
#include <settings/Bool.hpp>
#include <helpers.hpp>
#if ENABLE_VISUALS
#include <colors.hpp>
#include <init.hpp>
static settings::Bool enable{ "chat.log-events", "false" };
static void handlePlayerConnectClient(KeyValues *kv)
{
PrintChat("\x07%06X%s\x01 \x07%06X%s\x01 joining", 0xa06ba0,
kv->GetString("name"), 0x914e65, kv->GetString("networkid"));
}
static void handlePlayerActivate(KeyValues *kv)
{
int uid = kv->GetInt("userid");
int entity = g_IEngine->GetPlayerForUserID(uid);
player_info_s info{};
if (g_IEngine->GetPlayerInfo(entity, &info))
PrintChat("\x07%06X%s\x01 connected", 0xa06ba0, info.name);
}
static void handlePlayerDisconnect(KeyValues *kv)
{
CachedEntity *player =
ENTITY(g_IEngine->GetPlayerForUserID(kv->GetInt("userid")));
if (player == nullptr)
return;
PrintChat("\x07%06X%s\x01 \x07%06X%s\x01 disconnected",
colors::chat::team(player->m_iTeam()), kv->GetString("name"),
0x914e65, kv->GetString("networkid"));
}
static void handlePlayerTeam(KeyValues *kv)
{
if (kv->GetBool("disconnect"))
return;
int oteam = kv->GetInt("oldteam");
int nteam = kv->GetInt("team");
const char *oteam_s = teamname(oteam);
const char *nteam_s = teamname(nteam);
PrintChat("\x07%06X%s\x01 changed team (\x07%06X%s\x01 -> "
"\x07%06X%s\x01)",
0xa06ba0, kv->GetString("name"), colors::chat::team(oteam),
oteam_s, colors::chat::team(nteam), nteam_s);
}
static void handlePlayerHurt(KeyValues *kv)
{
int victim = kv->GetInt("userid");
int attacker = kv->GetInt("attacker");
int health = kv->GetInt("health");
player_info_s kinfo{};
player_info_s vinfo{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(victim), &vinfo);
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(attacker), &kinfo);
CachedEntity *vic = ENTITY(g_IEngine->GetPlayerForUserID(victim));
CachedEntity *att = ENTITY(g_IEngine->GetPlayerForUserID(attacker));
if (vic == nullptr || att == nullptr)
return;
PrintChat("\x07%06X%s\x01 hurt \x07%06X%s\x01 down to \x07%06X%d\x01hp",
colors::chat::team(att->m_iTeam()), kinfo.name,
colors::chat::team(vic->m_iTeam()), vinfo.name, 0x2aaf18, health);
}
static void handlePlayerDeath(KeyValues *kv)
{
int victim = kv->GetInt("userid");
int attacker = kv->GetInt("attacker");
player_info_s kinfo{};
player_info_s vinfo{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(victim), &vinfo);
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(attacker), &kinfo);
CachedEntity *vic = ENTITY(g_IEngine->GetPlayerForUserID(victim));
CachedEntity *att = ENTITY(g_IEngine->GetPlayerForUserID(attacker));
if (vic == nullptr || att == nullptr)
return;
PrintChat("\x07%06X%s\x01 killed \x07%06X%s\x01",
colors::chat::team(att->m_iTeam()), kinfo.name,
colors::chat::team(vic->m_iTeam()), vinfo.name);
}
static void handlePlayerSpawn(KeyValues *kv)
{
int id = kv->GetInt("userid");
player_info_s info{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(id), &info);
CachedEntity *player = ENTITY(g_IEngine->GetPlayerForUserID(id));
if (player == nullptr)
return;
PrintChat("\x07%06X%s\x01 (re)spawned",
colors::chat::team(player->m_iTeam()), info.name);
}
static void handlePlayerChangeClass(KeyValues *kv)
{
int id = kv->GetInt("userid");
player_info_s info{};
g_IEngine->GetPlayerInfo(g_IEngine->GetPlayerForUserID(id), &info);
CachedEntity *player = ENTITY(g_IEngine->GetPlayerForUserID(id));
if (player == nullptr)
return;
PrintChat("\x07%06X%s\x01 changed to \x07%06X%s\x01",
colors::chat::team(player->m_iTeam()), info.name, 0xa06ba0,
classname(kv->GetInt("class")));
}
static void handleVoteCast(KeyValues *kv)
{
int vote_option = kv->GetInt("vote_option");
int team = kv->GetInt("team");
int idx = kv->GetInt("entityid");
player_info_s info{};
const char *team_s = teamname(team);
if (g_IEngine->GetPlayerInfo(idx, &info))
PrintChat("\x07%06X%s\x01 Voted \x07%06X%d\x01 on team \x07%06X%s\x01",
colors::chat::team(team), info.name, colors::chat::team(team),
vote_option, colors::chat::team(team), team_s);
}
class LoggingEventListener : public IGameEventListener
{
public:
void FireGameEvent(KeyValues *event) override
{
if (!enable)
return;
const char *name = event->GetName();
if (!strcmp(name, "player_connect_client"))
handlePlayerConnectClient(event);
else if (!strcmp(name, "player_activate"))
handlePlayerActivate(event);
else if (!strcmp(name, "player_disconnect"))
handlePlayerDisconnect(event);
else if (!strcmp(name, "player_team"))
handlePlayerTeam(event);
else if (!strcmp(name, "player_hurt"))
handlePlayerHurt(event);
else if (!strcmp(name, "player_death"))
handlePlayerDeath(event);
else if (!strcmp(name, "player_spawn"))
handlePlayerSpawn(event);
else if (!strcmp(name, "player_changeclass"))
handlePlayerChangeClass(event);
else if (!strcmp(name, "vote_cast"))
handleVoteCast(event);
}
};
static LoggingEventListener listener{};
InitRoutine init([]() { g_IGameEventManager->AddListener(&listener, false); });
bool event_logging::isEnabled()
{
return *enable;
}
#endif

View File

@ -49,7 +49,7 @@ IgnoreReason shouldTargetSteamId(unsigned id)
auto &pl = playerlist::AccessData(id);
if (playerlist::IsFriendly(pl.state))
return IgnoreReason::LOCAL_PLAYER_LIST;
#if ENABLE_ONLINE
auto *co = online::getUserData(id);
if (co)
{
@ -67,7 +67,7 @@ IgnoreReason shouldTargetSteamId(unsigned id)
if (co->is_developer)
return IgnoreReason::DEVELOPER;
}
#endif
return IgnoreReason::DO_NOT_IGNORE;
}
IgnoreReason shouldTarget(CachedEntity *entity)
@ -93,11 +93,11 @@ bool shouldAlwaysRenderEspSteamId(unsigned id)
auto &pl = playerlist::AccessData(id);
if (pl.state != playerlist::k_EState::DEFAULT)
return true;
#if ENABLE_ONLINE
auto *co = online::getUserData(id);
if (co)
return true;
#endif
return false;
}
bool shouldAlwaysRenderEsp(CachedEntity *entity)
@ -158,4 +158,4 @@ void onKilledBy(CachedEntity *entity)
{
onKilledBy(entity->player_info.friendsID);
}
} // namespace player_tools
} // namespace player_tools

View File

@ -4,7 +4,6 @@
* Created on: Jun 5, 2017
* Author: nullifiedcat
*/
#include "angles.hpp"
namespace angles

View File

@ -1,239 +0,0 @@
/*
* backpacktf.cpp
*
* Created on: Jul 23, 2017
* Author: nullifiedcat
*/
#include "backpacktf.hpp"
#include "json.hpp"
#include "https_request.hpp"
#include "common.hpp"
#include <thread>
#include <queue>
#include <settings/Bool.hpp>
static settings::Bool bptf_enable{ "backpack-tf.enable", "false" };
namespace backpacktf
{
std::unordered_map<unsigned, backpack_data_s> cache{};
std::queue<backpack_data_s *> pending_queue{};
std::mutex queue_mutex{};
std::mutex cache_mutex{};
bool thread_running{ true };
std::string api_key_s = "";
bool valid_api_key = false;
CatCommand api_key("bptf_key", "Set API Key", [](const CCommand &args) {
api_key_s = args.ArgS();
logging::Info("API key changed!");
valid_api_key = false;
if (api_key_s.length() != 24)
{
logging::Info("API key must be exactly 24 characters long");
valid_api_key = false;
}
else
{
valid_api_key = true;
}
});
void store_data(unsigned id, float value, bool no_value, bool outdated_value);
void processing_thread()
{
logging::Info("[bp.tf] Starting the thread");
while (thread_running)
{
if (enabled())
{
try
{
std::vector<backpack_data_s *> batch{};
int count = 0;
{
std::lock_guard<std::mutex> lock(queue_mutex);
while (not pending_queue.empty() && ++count < 100)
{
batch.push_back(pending_queue.front());
pending_queue.pop();
}
}
if (count)
{
logging::Info("[bp.tf] Requesting data for %d users",
count);
std::string id_list = "";
for (const auto &x : batch)
{
x->pending = false;
id_list += format("[U:1:", x->id, "],");
}
// Remove trailing ','
id_list = id_list.substr(0, id_list.length() - 1);
std::string query =
format("steamids=", id_list, "&key=", api_key_s);
try
{
auto sock = https::RAII_HTTPS_Socket("backpack.tf");
std::string response =
sock.get("/api/users/info/v1?" + query);
if (response.compare("HTTP/1.1 200 OK\r\n") != 0)
{
size_t status = response.find("\r\n");
throw std::runtime_error(
"Response isn't 200 OK! It's " +
response.substr(0, status));
}
std::string body =
response.substr(response.find("\r\n\r\n") + 4);
try
{
nlohmann::json data = nlohmann::json::parse(body);
nlohmann::json users = data["users"];
std::lock_guard<std::mutex> lock(cache_mutex);
for (auto it = users.begin(); it != users.end();
++it)
{
unsigned userid = strtoul(
it.key().substr(5).c_str(), nullptr, 10);
try
{
unsigned userid =
strtoul(it.key().substr(5).c_str(),
nullptr, 10);
const auto &v = it.value();
if (not v.is_object())
{
logging::Info("Data for %u (%s) is not "
"an object!",
userid, it.key().c_str());
continue;
}
std::string name = v.at("name");
logging::Info(
"Parsing data for user %u (%s)", userid,
name.c_str());
if (v.find("inventory") == v.end())
{
store_data(userid, 0, true, false);
continue;
}
const auto &inv =
v.at("inventory").at("440");
if (inv.find("value") == inv.end())
{
store_data(userid, 0, true, false);
}
else
{
float value = float(inv["value"]);
unsigned updated =
unsigned(inv["updated"]);
store_data(
userid, value * REFINED_METAL_PRICE,
false,
(unsigned(time(0)) - updated >
OUTDATED_AGE));
}
}
catch (std::exception &ex)
{
logging::Info(
"Error while parsing user %s: %s",
it.key().c_str(), ex.what());
}
}
}
catch (std::exception &e)
{
logging::Info(
"[bp.tf] Exception while parsing response: %s",
e.what());
}
}
catch (std::exception &e)
{
logging::Info("[bp.tf] HTTPS exception: %s", e.what());
}
}
}
catch (std::exception &e)
{
logging::Info("[bp.tf] Thread exception: %s", e.what());
}
}
sleep(REQUEST_INTERVAL);
}
}
void request_data(unsigned id)
{
if (cache[id].pending)
return;
cache[id].pending = true;
{
std::lock_guard<std::mutex> lock(queue_mutex);
pending_queue.push(&cache[id]);
}
}
bool enabled()
{
return bptf_enable && valid_api_key;
}
backpack_data_s &access_data(unsigned id)
{
try
{
return cache.at(id);
}
catch (std::out_of_range &oor)
{
cache.emplace(id, backpack_data_s{});
cache.at(id).id = id;
return cache.at(id);
}
}
void store_data(unsigned id, float value, bool none, bool outdated)
{
auto &d = access_data(id);
d.last_request = unsigned(time(0));
d.bad = false;
d.value = value;
d.no_value = none;
d.outdated_value = outdated;
d.pending = false;
}
const backpack_data_s &get_data(unsigned id)
{
auto &d = access_data(id);
if (d.bad || ((unsigned) time(0) - MAX_CACHE_AGE > cache[id].last_request))
{
request_data(id);
}
return d;
}
std::thread &GetBackpackTFThread()
{
static std::thread thread(processing_thread);
return thread;
}
void init()
{
GetBackpackTFThread();
}
} // namespace backpacktf

View File

@ -380,8 +380,6 @@ free(logname);*/
logging::Info("Initialized Fidget Spinner");
#endif
hacks::shared::spam::init();
backpacktf::init();
logging::Info("Initialized Backpack.TF integration");
#endif
#if not LAGBOT_MODE
hacks::shared::walkbot::Initialize();

View File

@ -10,7 +10,9 @@
#include <hacks/AntiAim.hpp>
#include <hacks/ESP.hpp>
#include <hacks/Backtrack.hpp>
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <PlayerTools.hpp>
#include <settings/Bool.hpp>
#include "common.hpp"

View File

@ -6,7 +6,6 @@
*/
#include <hacks/hacklist.hpp>
#include <glez/draw.hpp>
#include <settings/Bool.hpp>
#include <hacks/AntiAim.hpp>

View File

@ -35,10 +35,12 @@ void Accuse(int eid, const std::string &hack, const std::string &details)
}
else
{
#if ENABLE_VISUALS
PrintChat("\x07%06X%s\x01 (%s) suspected \x07%06X%s\x01: %s",
colors::chat::team(ENTITY(eid)->m_iTeam()), info.name,
classname(CE_INT(ent, netvar.iClass)), 0xe05938,
hack.c_str(), details.c_str());
#endif
}
}
}

View File

@ -7,7 +7,9 @@
#include "common.hpp"
#include <hacks/AutoReflect.hpp>
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
static settings::Bool enable{ "autoreflect.enable", "false" };

View File

@ -9,7 +9,9 @@
#include "hacks/Aimbot.hpp"
#include "hacks/Backtrack.hpp"
#include <boost/circular_buffer.hpp>
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
#include <hacks/Backtrack.hpp>

View File

@ -8,7 +8,9 @@
#include "common.hpp"
#include <hacks/FollowBot.hpp>
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
static settings::Bool enable{ "follow-bot.enable", "false" };

View File

@ -1,6 +1,8 @@
#include <glez/draw.hpp>
#include <settings/Bool.hpp>
#include "hacks/LightESP.hpp"
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
static settings::Bool enable{ "lightesp.enable", "false" };
@ -71,7 +73,7 @@ void draw()
}
#endif
}
#if ENABLE_VISUALS
rgba_t LightESPColor(CachedEntity *ent)
{
if (!playerlist::IsDefault(ent))
@ -80,4 +82,5 @@ rgba_t LightESPColor(CachedEntity *ent)
}
return colors::green;
}
#endif
} // namespace hacks::shared::lightesp

View File

@ -5,6 +5,7 @@
* Author: nullifiedcat
*/
#include "common.hpp"
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
@ -12,13 +13,14 @@
#include <fcntl.h>
#include <link.h>
#include <hacks/AntiAim.hpp>
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
#include "core/sharedobj.hpp"
#include "hack.hpp"
#include "common.hpp"
static settings::Bool render_zoomed{ "visuals.render-local-zoomed", "false" };
static settings::Bool anti_afk{ "misc.anti-afk", "false" };

View File

@ -2,8 +2,6 @@
// Created by bencat07 on 17.08.18.
//
#include "common.hpp"
#include <glez/draw.hpp>
#include <glez/color.hpp>
#include "navparser.hpp"
#include "FollowBot.hpp"
#include "NavBot.hpp"

View File

@ -4,10 +4,11 @@
* Created on: Mar 28, 2017
* Author: nullifiedcat
*/
#include <glez/draw.hpp>
#include <settings/Int.hpp>
#include "common.hpp"
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Int.hpp>
#include "hacks/Radar.hpp"
#ifndef FEATURE_RADAR_DISABLED

View File

@ -12,7 +12,9 @@
#include <sys/dir.h>
#include <sys/stat.h>
#include <hacks/hacklist.hpp>
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
static settings::Button recording_key{ "walkbot.recording-key", "<null>" };

View File

@ -5,7 +5,9 @@
#include <hacks/hacklist.hpp>
#include <settings/Bool.hpp>
#if ENABLE_VISUALS
#include <menu/GuiInterface.hpp>
#endif
#include "HookedMethods.hpp"
#include "MiscTemporary.hpp"
#include "navparser.hpp"
@ -78,14 +80,13 @@ DEFINE_HOOKED_METHOD(LevelInit, void, void *this_, const char *name)
logging::Info("Loaded Skybox: %s", succ ? "true" : "false");
ConVar *holiday = g_ICvar->FindVar("tf_forced_holiday");
for (int i = 0; i < 32; i++)
g_Settings.brute.brutenum[i] = 0;
if (halloween_mode)
holiday->SetValue(2);
else if (holiday->m_nValue == 2)
holiday->SetValue(0);
#endif
for (int i = 0; i < 32; i++)
g_Settings.brute.brutenum[i] = 0;
g_IEngine->ClientCmd_Unrestricted("exec cat_matchexec");
#if !LAGBOT_MODE
hacks::shared::aimbot::Reset();

View File

@ -29,7 +29,9 @@ DEFINE_HOOKED_METHOD(Paint, void, IEngineVGui *this_, PaintMode_t mode)
#endif
hacks::shared::catbot::update();
hitrate::Update();
#if ENABLE_ONLINE
online::update();
#endif
#if ENABLE_IPC
static Timer nametimer{};
if (nametimer.test_and_set(1000 * 10))

View File

@ -1,7 +1,8 @@
/*
Created on 23.06.18.
*/
#include "config.h"
#if ENABLE_ONLINE
#include <online/Online.hpp>
#include <core/cvwrapper.hpp>
@ -12,6 +13,7 @@
#undef null
#include <co/OnlineService.hpp>
#include <fstream>
#include <init.hpp>
@ -332,4 +334,5 @@ user_data *getUserData(unsigned steamId)
// SteamID does not belong to online user
return nullptr;
}
} // namespace online
} // namespace online
#endif

View File

@ -18,14 +18,17 @@ namespace playerlist
std::unordered_map<unsigned, userdata> data{};
const userdata null_data{};
#if ENABLE_VISUALS
rgba_t k_Colors[] = { colors::empty, colors::FromRGBA8(99, 226, 161, 255),
colors::FromRGBA8(226, 204, 99, 255),
colors::FromRGBA8(232, 134, 6, 255), colors::empty };
#endif
bool ShouldSave(const userdata &data)
{
#if ENABLE_VISUALS
return data.color || (data.state != k_EState::DEFAULT);
#endif
return (data.state != k_EState::DEFAULT);
}
void Save()
@ -114,7 +117,7 @@ void Load()
logging::Info("Reading unsuccessful: %s", e.what());
}
}
#if ENABLE_VISUALS
rgba_t Color(unsigned steamid)
{
if (AccessData(steamid).state == k_EState::DEVELOPER)
@ -137,7 +140,7 @@ rgba_t Color(CachedEntity *player)
return Color(player->player_info.friendsID);
return colors::empty;
}
#endif
userdata &AccessData(unsigned steamid)
{
return data[steamid];
@ -154,7 +157,10 @@ userdata &AccessData(CachedEntity *player)
bool IsDefault(unsigned steamid)
{
const userdata &data = AccessData(steamid);
#if ENABLE_VISUALS
return data.state == k_EState::DEFAULT && !data.color.a;
#endif
return data.state == k_EState ::DEFAULT;
}
bool IsDefault(CachedEntity *entity)
@ -184,7 +190,7 @@ CatCommand pl_set_state(
AccessData(steamid).state = state;
logging::Info("Set %d to %d", steamid, state);
});
#if ENABLE_VISUALS
CatCommand pl_set_color("pl_set_color", "pl_set_color uniqueid r g b",
[](const CCommand &args) {
if (args.ArgC() < 5)
@ -201,7 +207,7 @@ CatCommand pl_set_color("pl_set_color", "pl_set_color uniqueid r g b",
AccessData(steamid).color = color;
logging::Info("Changed %d's color", steamid);
});
#endif
CatCommand pl_info("pl_info", "pl_info uniqueid", [](const CCommand &args) {
if (args.ArgC() < 2)
{

View File

@ -4,10 +4,11 @@
* Created on: Dec 5, 2016
* Author: nullifiedcat
*/
#include <glez/draw.hpp>
#include <settings/Bool.hpp>
#include "common.hpp"
#if ENABLE_VISUALS
#include <glez/draw.hpp>
#endif
#include <settings/Bool.hpp>
static settings::Bool debug_enginepred{ "debug.engine-pred-others", "false" };
static settings::Bool debug_pp_extrapolate{ "debug.pp-extrapolate", "false" };

View File

@ -5,10 +5,10 @@ target_sources(cathook PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/drawmgr.cpp"
"${CMAKE_CURRENT_LIST_DIR}/EffectChams.cpp"
"${CMAKE_CURRENT_LIST_DIR}/EffectGlow.cpp"
"${CMAKE_CURRENT_LIST_DIR}/EventLogging.cpp"
"${CMAKE_CURRENT_LIST_DIR}/fidgetspinner.cpp"
"${CMAKE_CURRENT_LIST_DIR}/EventLogging.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SDLHooks.cpp")
if(EnableGUI)
add_subdirectory(menu)
endif()
endif()

View File

@ -1,10 +1,11 @@
/*
Created on 29.07.18.
*/
#include "config.h"
#include <EventLogging.hpp>
#include <settings/Bool.hpp>
#include <helpers.hpp>
#if ENABLE_VISUALS
#include <colors.hpp>
#include <init.hpp>
@ -166,3 +167,4 @@ bool event_logging::isEnabled()
{
return *enable;
}
#endif