diff --git a/include/PlayerTools.hpp b/include/PlayerTools.hpp index a9a55ee9..3e992f2e 100644 --- a/include/PlayerTools.hpp +++ b/include/PlayerTools.hpp @@ -6,6 +6,7 @@ #include "config.h" #include +#include "settings/Bool.hpp" #if ENABLE_VISUALS #include @@ -15,7 +16,7 @@ class CachedEntity; namespace player_tools { - +extern settings::Bool ignoreCathook; enum class IgnoreReason { DO_NOT_IGNORE, @@ -40,4 +41,4 @@ std::optional forceEspColor(CachedEntity *entity); #endif void onKilledBy(CachedEntity *entity); -} // namespace player_tools \ No newline at end of file +} // namespace player_tools diff --git a/src/PlayerTools.cpp b/src/PlayerTools.cpp index d09c1b1e..0ffdcac9 100644 --- a/src/PlayerTools.cpp +++ b/src/PlayerTools.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include "PlayerTools.hpp" #include "entitycache.hpp" @@ -15,6 +14,7 @@ static settings::Int betrayal_limit{ "player-tools.betrayal-limit", "true" }; static settings::Bool taunting{ "player-tools.ignore.taunting", "true" }; static settings::Bool hoovy{ "player-tools.ignore.hoovy", "true" }; +settings::Bool ignoreCathook{ "player-tools.ignore.cathook", "true" }; static settings::Bool online_notarget{ "player-tools.ignore.online.notarget", "true" }; @@ -47,7 +47,7 @@ IgnoreReason shouldTargetSteamId(unsigned id) } auto &pl = playerlist::AccessData(id); - if (playerlist::IsFriendly(pl.state)) + if (playerlist::IsFriendly(pl.state) || (pl.state == playerlist::k_EState::CAT && *ignoreCathook)) return IgnoreReason::LOCAL_PLAYER_LIST; #if ENABLE_ONLINE auto *co = online::getUserData(id); diff --git a/src/hooks/DispatchUserMessage.cpp b/src/hooks/DispatchUserMessage.cpp index 0e8e66db..b9779255 100644 --- a/src/hooks/DispatchUserMessage.cpp +++ b/src/hooks/DispatchUserMessage.cpp @@ -15,6 +15,8 @@ static settings::Bool clean_chat{ "chat.clean", "false" }; static settings::Bool dispatch_log{ "debug.log-dispatch-user-msg", "false" }; static settings::String chat_filter{ "chat.censor.filter", "" }; static settings::Bool chat_filter_enable{ "chat.censor.enable", "false" }; +static settings::Bool identify{ "chat.identify", "false" }; +static settings::Bool answerIdentify{ "chat.identify.answer", "true" }; static bool retrun = false; static Timer sendmsg{}; @@ -216,9 +218,8 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, } } #if !LAGBOT_MODE -/*if (sendmsg.test_and_set(300000) && - hacks::shared::antiaim::communicate) - chat_stack::Say("!!meow");*/ +if (*identify && sendmsg.test_and_set(300000)) + chat_stack::Say("!!meow"); #endif if (crypt_chat) { @@ -226,20 +227,32 @@ DEFINE_HOOKED_METHOD(DispatchUserMessage, bool, void *this_, int type, { if (ucccccp::validate(message)) { + std::string msg = ucccccp::decrypt(message); #if !LAGBOT_MODE -/* if (ucccccp::decrypt(message) == "meow" && - hacks::shared::antiaim::communicate && - data[0] != LOCAL_E->m_IDX && - playerlist::AccessData(ENTITY(data[0])).state != - playerlist::k_EState::CAT) +// if (ucccccp::decrypt(message) == "meow" && +// hacks::shared::antiaim::communicate && +// data[0] != LOCAL_E->m_IDX && +// playerlist::AccessData(ENTITY(data[0])).state != +// playerlist::k_EState::CAT) +// { +// playerlist::AccessData(ENTITY(data[0])).state = +// playerlist::k_EState::CAT; +// chat_stack::Say("!!meow"); +// } + CachedEntity *ent = ENTITY(data[0]); + if (msg != "Attempt at ucccccping and failing" && msg != "Unsupported version" && ent != LOCAL_E) { - playerlist::AccessData(ENTITY(data[0])).state = - playerlist::k_EState::CAT; - chat_stack::Say("!!meow"); - }*/ + auto &state = playerlist::AccessData(ent).state; + if (state == playerlist::k_EState::DEFAULT) + { + state = playerlist::k_EState::CAT; + if (*answerIdentify && sendmsg.test_and_set(60000)) + chat_stack::Say("!!meow"); + } + } #endif PrintChat("\x07%06X%s\x01: %s", 0xe05938, name.c_str(), - ucccccp::decrypt(message).c_str()); + msg.c_str()); } } } diff --git a/src/navparser.cpp b/src/navparser.cpp index 98940dcb..b0390aaf 100644 --- a/src/navparser.cpp +++ b/src/navparser.cpp @@ -240,6 +240,7 @@ static bool ensureArrival; // overwrite it int priority = 0; static Vector lastArea = { 0.0f, 0.0f, 0.0f }; +static int persistentTries = 0; // dest = Destination, navToLocalCenter = Should bot travel to local center // first before resuming pathing activity? (Increases accuracy) persistent = @@ -277,6 +278,7 @@ bool NavTo(Vector dest, bool navToLocalCenter, bool persistent, findClosestNavSquare_localAreas.clear(); priority = instructionPriority; inactivity.update(); + persistentTries = 0; return true; } @@ -304,7 +306,7 @@ void ignoreManagerCM() void Repath() { - if (ensureArrival) + if (ensureArrival && persistentTries < 10) { logging::Info("Pathing: NavBot inactive for too long. Ignoring " "connection and finding another path..."); @@ -313,6 +315,7 @@ void Repath() // Find a new path TF2MAP->pather->Reset(); crumbs = findPath(g_pLocalPlayer->v_Origin, crumbs.back(), i1, i2); + persistentTries++; } else { diff --git a/src/votelogger.cpp b/src/votelogger.cpp index a4f26fdd..fb1e5bce 100644 --- a/src/votelogger.cpp +++ b/src/votelogger.cpp @@ -25,6 +25,7 @@ void dispatchUserMessage(bf_read &buffer, int type) break; case 46: { + // TODO: Add always vote no/vote no on friends. Cvar is "vote option2" was_local_player = false; auto caller = (unsigned char) buffer.ReadByte(); // unknown