From 6224d0cca35dddbd3700fa44fe4324e80e478fc7 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Mon, 3 Oct 2022 20:20:29 +0200 Subject: [PATCH] add: continuing the player esp, still not working --- DevourClient/Features/ESP/ESP.cpp | 83 ++++++++++++++----------------- 1 file changed, 37 insertions(+), 46 deletions(-) diff --git a/DevourClient/Features/ESP/ESP.cpp b/DevourClient/Features/ESP/ESP.cpp index 7f3394f..a8c1107 100644 --- a/DevourClient/Features/ESP/ESP.cpp +++ b/DevourClient/Features/ESP/ESP.cpp @@ -6,53 +6,44 @@ #include "../../Utils/Output/Output.hpp" void ESP::PlayerESP() { - IL2CPP::Thread::Attach(IL2CPP::Domain::Get()); - - ImGui::SetNextWindowPos(ImVec2(0, 0)); - ImGui::SetNextWindowSize(ImVec2(1024, 768)); - ImGui::Begin("PlayerESPOverlay", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoBackground); - - while (1) { - if (settings::player_esp || settings::player_snaplines) { - for (Unity::CGameObject* player : Players::PlayerList) { - if (!player) { - continue; - } - - Unity::Vector3 pivotPos = player->GetComponent("Transform")->GetMemberValue("position"); - - Unity::Vector3 playerFootPos; - playerFootPos.x = pivotPos.x; - playerFootPos.z = pivotPos.z; - playerFootPos.y = pivotPos.y - 2.f; //At the feet - - Unity::Vector3 playerHeadPos; - playerHeadPos.x = pivotPos.x; - playerHeadPos.z = pivotPos.z; - playerHeadPos.y = pivotPos.y + 2.f; //At the head - - Unity::CGameObject* Camera = Unity::GameObject::Find("Camera"); - if (!Camera) { - continue; - } - - Unity::CComponent* CameraMain = Camera->GetComponent("Camera"); - if (!CameraMain) { - continue; - } - - Unity::Vector3 w2s_footpos = CameraMain->CallMethodSafe("WorldToScreenPoint"); - Unity::Vector3 w2s_headpos = CameraMain->CallMethodSafe("WorldToScreenPoint"); - - if (w2s_footpos.z > 0.f) - { - auto pDrawList = ImGui::GetWindowDrawList(); - - pDrawList->AddRect(ImVec2(10, 10), ImVec2(100, 100), ImColor(255, 0, 0)); - pDrawList->AddText(ImVec2(10, 10), ImColor(255, 0, 0), "test"); - //Render.Render.DrawBoxESP(w2s_footpos, w2s_headpos, settings::player_esp_color, "", settings::player_snaplines, settings::player_esp); - } + if (settings::player_esp || settings::player_snaplines) { + for (Unity::CGameObject* player : Players::PlayerList) { + if (!player || player == Players::LocalPlayer) { + continue; } + + Unity::Vector3 pivotPos = player->GetComponent("Transform")->GetMemberValue("position"); + + Unity::Vector3 playerFootPos; + playerFootPos.x = pivotPos.x; + playerFootPos.z = pivotPos.z; + playerFootPos.y = pivotPos.y - 2.f; //At the feet + + Unity::Vector3 playerHeadPos; + playerHeadPos.x = pivotPos.x; + playerHeadPos.z = pivotPos.z; + playerHeadPos.y = pivotPos.y + 2.f; //At the head + + Unity::CGameObject* Camera = Unity::GameObject::Find("Main Camera"); + if (!Camera) { + continue; + } + + Unity::CComponent* CameraMain = Camera->GetComponent("Camera"); + if (!CameraMain) { + continue; + } + + Unity::Vector2 w2s_footpos = CameraMain->CallMethodSafe("WorldToScreenPoint"); + Unity::Vector2 w2s_headpos = CameraMain->CallMethodSafe("WorldToScreenPoint"); + + auto draw = ImGui::GetBackgroundDrawList(); + + + ImColor box(settings::player_esp_color[0], settings::player_esp_color[1], + settings::player_esp_color[2], settings::player_esp_color[3]); + + draw->AddRect(ImVec2(w2s_headpos.x, settings::width - w2s_headpos.y), ImVec2(w2s_footpos.x, settings::width - w2s_footpos.y), box); } } } \ No newline at end of file