diff --git a/README.md b/README.md index 2f09c979..dc3b9e48 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Cathook Training Software ![banner](http://i.imgur.com/w96wdtE.png) -[![CircleCI](https://circleci.com/gh/nullworks/cathook.svg?style=svg)](https://circleci.com/gh/nullworks/cathook) (Cathook developement takes place on `testing` branch) +[![CircleCI](https://circleci.com/gh/nullworks/cathook.svg?style=svg)](https://circleci.com/gh/nullworks/cathook) ## Risk of VAC detection diff --git a/data/menu/player-list-row.xml b/data/menu/player-list-row.xml index f4744944..f5d7f623 100755 --- a/data/menu/player-list-row.xml +++ b/data/menu/player-list-row.xml @@ -4,9 +4,9 @@ N/A N/A N/A + N/A N/A - N/A Kick - \ No newline at end of file + diff --git a/data/menu/player-list-window.xml b/data/menu/player-list-window.xml index e5a11f65..dae2f912 100755 --- a/data/menu/player-list-window.xml +++ b/data/menu/player-list-window.xml @@ -1,11 +1,11 @@ - + - + @@ -13,8 +13,8 @@ SteamID Username Class - State - Online + Status + State Color Kick diff --git a/include/playerlist.hpp b/include/playerlist.hpp index 6f048982..56191f35 100644 --- a/include/playerlist.hpp +++ b/include/playerlist.hpp @@ -16,7 +16,7 @@ constexpr int SERIALIZE_VERSION = 3; enum class k_EState { - DEFAULT, + DEFAULT = 0, FRIEND, RAGE, IPC, diff --git a/include/visual/menu/menu/special/PlayerListController.hpp b/include/visual/menu/menu/special/PlayerListController.hpp index c8e06c73..4e5e89d5 100644 --- a/include/visual/menu/menu/special/PlayerListController.hpp +++ b/include/visual/menu/menu/special/PlayerListController.hpp @@ -20,6 +20,7 @@ public: int classId; int teamId; bool dead; + std::string state; }; class PlayerListController : public IMessageHandler @@ -27,6 +28,7 @@ class PlayerListController : public IMessageHandler public: typedef std::function kick_callback_type; typedef std::function open_steam_callback_type; + typedef std::function change_state_callback_type; explicit PlayerListController(Table &table); @@ -45,7 +47,7 @@ public: void updatePlayerLifeState(int id, bool dead); - void updatePlayerCO(int id); + void updatePlayerState(int id, std::string state); void removePlayer(int id); @@ -56,6 +58,8 @@ public: void setOpenSteamCallback(open_steam_callback_type callback); + void setChangeStateCallback(change_state_callback_type callback); + void updateRow(TRow *row); void changeRowColor(TRow *row, const rgba_t &color); @@ -66,5 +70,6 @@ public: kick_callback_type cb_kick; open_steam_callback_type cb_open_steam; + change_state_callback_type cb_change_state; }; } // namespace zerokernel::special diff --git a/src/hacks/AutoBackstab.cpp b/src/hacks/AutoBackstab.cpp index 9d9c1a2f..5468f496 100644 --- a/src/hacks/AutoBackstab.cpp +++ b/src/hacks/AutoBackstab.cpp @@ -346,12 +346,8 @@ void CreateMove() if (hacks::shared::backtrack::isBacktrackEnabled) { if (*hacks::shared::backtrack::latency <= 190 && doRageBackstab()) - { - logging::Info("Ragebackstab"); break; - } - if (doBacktrackStab()) - logging::Info("Backtrackstab"); + doBacktrackStab(); } else { diff --git a/src/trace.cpp b/src/trace.cpp index aba511c4..a3c797cf 100644 --- a/src/trace.cpp +++ b/src/trace.cpp @@ -43,7 +43,7 @@ bool trace::FilterDefault::ShouldHitEntity(IHandleEntity *handle, int mask) { // TODO magic numbers: invisible entity ids case CL_CLASS(CFuncRespawnRoomVisualizer): - case CL_CLASS(CTFKnife): + case CL_CLASS(CTFMedigunShield): case CL_CLASS(CFuncAreaPortalWindow): return false; } diff --git a/src/visual/menu/GuiInterface.cpp b/src/visual/menu/GuiInterface.cpp index 1d66212b..aa9a814c 100644 --- a/src/visual/menu/GuiInterface.cpp +++ b/src/visual/menu/GuiInterface.cpp @@ -26,6 +26,7 @@ static zerokernel::special::PlayerListData createPlayerListData(int userid) data.teamId = g_pPlayerResource->getTeam(idx) - 1; data.dead = !g_pPlayerResource->isAlive(idx); data.steam = info.friendsID; + data.state = playerlist::k_pszNames[static_cast(playerlist::AccessData(info.friendsID).state)]; snprintf(data.name, 31, "%s", info.name); return data; } @@ -95,6 +96,14 @@ static void initPlayerlist() id.Set(steam, EUniverse::k_EUniversePublic, EAccountType::k_EAccountTypeIndividual); g_ISteamFriends->ActivateGameOverlayToUser("steamid", id); }); + controller->setChangeStateCallback([](unsigned steam, int userid) { + auto &pl = playerlist::AccessData(steam); + pl.state = playerlist::k_EState((int) pl.state + 1); + if ((int) pl.state > (int) playerlist::k_EState::STATE_LAST) + pl.state = playerlist::k_EState(0); + logging::Info("%s", std::to_string(steam).c_str()); + controller->updatePlayerState(userid, playerlist::k_Names[(int) pl.state]); + }); } else { diff --git a/src/visual/menu/menu/special/PlayerListController.cpp b/src/visual/menu/menu/special/PlayerListController.cpp index b24c7ff5..7c66e85c 100644 --- a/src/visual/menu/menu/special/PlayerListController.cpp +++ b/src/visual/menu/menu/special/PlayerListController.cpp @@ -12,12 +12,12 @@ Created on 26.07.18. */ -static settings::RVariable color_team_red{ "zk.style.player-list.team.red", "ff0000" }; +static settings::RVariable color_team_red{ "zk.style.player-list.team.red", "ce1015" }; static settings::RVariable color_team_red_dead{ "zk.style.player-list.team.red-dead", "660000" }; static settings::RVariable color_team_blue{ "zk.style.player-list.team.blue", "0000ff" }; static settings::RVariable color_team_blue_dead{ "zk.style.player-list.team.blue-dead", "000066" }; -static settings::RVariable color_team_other{ "zk.style.player-list.team.other", "ffffff" }; -static settings::RVariable color_team_other_dead{ "zk.style.player-list.team.other-dead", "666666" }; +static settings::RVariable color_team_other{ "zk.style.player-list.team.other", "E6E6E6" }; +static settings::RVariable color_team_other_dead{ "zk.style.player-list.team.other-dead", "E6E6E6" }; static const char *class_names[] = { "Unknown", "Scout", "Sniper", "Soldier", "Demoman", "Medic", "Heavy", "Pyro", "Spy", "Engineer" }; @@ -35,6 +35,11 @@ void zerokernel::special::PlayerListController::setOpenSteamCallback(zerokernel: cb_open_steam = std::move(callback); } +void zerokernel::special::PlayerListController::setChangeStateCallback(zerokernel::special::PlayerListController::change_state_callback_type callback) +{ + cb_change_state = std::move(callback); +} + void zerokernel::special::PlayerListController::handleMessage(zerokernel::Message &msg, bool is_relayed) { if (is_relayed) @@ -63,6 +68,17 @@ void zerokernel::special::PlayerListController::handleMessage(zerokernel::Messag cb_kick((int) msg.sender->kv["user_id"]); } } + if (action == "change_state") + { + auto steamId = (std::string) msg.sender->kv["steam_id"]; + errno = 0; + auto id = std::strtoul(steamId.c_str(), nullptr, 10); + if (!errno) + { + if (cb_change_state) + cb_change_state(id, (int) msg.sender->kv["user_id"]); + } + } } void zerokernel::special::PlayerListController::removeAll() @@ -143,6 +159,24 @@ void zerokernel::special::PlayerListController::updatePlayerClass(int id, int cl }); } +void zerokernel::special::PlayerListController::updatePlayerState(int id, std::string state_string) +{ + table.iterateObjects([this, id, state_string](BaseMenuObject *a) { + auto row = dynamic_cast(a); + // Shouldn't happen + if (row == nullptr) + return; + if ((int) row->kv["player_id"] == id) + { + auto state = dynamic_cast(row->getElementById("state")); + if (state) + state->kv["state"] = state_string; + updateRow(row); + return; + } + }); +} + void zerokernel::special::PlayerListController::addPlayer(int id, zerokernel::special::PlayerListData data) { auto row = ObjectFactory::createFromPrefab("player-list-row"); @@ -158,6 +192,7 @@ void zerokernel::special::PlayerListController::addPlayer(int id, zerokernel::sp auto steam = dynamic_cast(trow->getElementById("steam")); auto username = dynamic_cast(trow->getElementById("username")); auto kick = dynamic_cast(trow->getElementById("kick")); + auto state = dynamic_cast(trow->getElementById("state")); if (uid) uid->set(std::to_string(id)); if (steam) @@ -175,6 +210,19 @@ void zerokernel::special::PlayerListController::addPlayer(int id, zerokernel::sp kick->kv["action"] = "kick"; kick->addMessageHandler(*this); } + if (state) + { + state->parent->bb.resize(70, 15); + state->bb.width.setFill(); + state->bb.height.setFill(); + state->bb.updateFillSize(); + + state->kv["state"] = data.state; + state->kv["user_id"] = id; + state->kv["steam_id"] = std::to_string(data.steam); + state->kv["action"] = "change_state"; + state->addMessageHandler(*this); + } updateRow(trow); table.addObject(std::move(row)); } @@ -224,9 +272,15 @@ void zerokernel::special::PlayerListController::updateRow(zerokernel::TRow *row) changeRowColor(row, dead ? *color_team_other_dead : *color_team_other); } - auto el = dynamic_cast(row->getElementById("class")); + auto el = dynamic_cast(row->getElementById("class")); + auto alivestate = dynamic_cast(row->getElementById("alivestate")); + auto state = dynamic_cast(row->getElementById("state")); if (el) { el->set(class_names[classId]); } + if (alivestate) + alivestate->set(dead ? "Dead" : "Alive"); + if (state) + state->set(static_cast(state->kv["state"])); }