diff options
Diffstat (limited to 'ESP.cpp')
-rw-r--r-- | ESP.cpp | 81 |
1 files changed, 51 insertions, 30 deletions
@@ -12,24 +12,24 @@ uint32_t ESP::colors_hex[8] = { 0xff0000ff, 0xffff0000,0xff00ff00,0xffffff00,0xf void ESP::DrawBox(Unit* unit, int32_t color, bool drawName = false) { - Vector3 one3 = unit->position; - one3.x -= unit->pUnitData->collisionX; - one3.y -= unit->pUnitData->collisionY; + Vector3 one3 = unit->GetPosition(); + one3.x -= unit->GetUnitData()->GetCollision().x; + one3.y -= unit->GetUnitData()->GetCollision().y; Vector2 one = Engine::Get()->worldToScreen(one3); - Vector3 two3 = unit->position; - two3.x += unit->pUnitData->collisionX; - two3.y += unit->pUnitData->collisionY; + Vector3 two3 = unit->GetPosition(); + two3.x += unit->GetUnitData()->GetCollision().x; + two3.y += unit->GetUnitData()->GetCollision().y; Vector2 two = Engine::Get()->worldToScreen(two3); - Vector3 three3 = unit->position; - three3.x -= unit->pUnitData->collisionX; - three3.y += unit->pUnitData->collisionY; + Vector3 three3 = unit->GetPosition(); + three3.x -= unit->GetUnitData()->GetCollision().x; + three3.y += unit->GetUnitData()->GetCollision().y; Vector2 three = Engine::Get()->worldToScreen(three3); - Vector3 four3 = unit->position; - four3.x += unit->pUnitData->collisionX; - four3.y -= unit->pUnitData->collisionY; + Vector3 four3 = unit->GetPosition(); + four3.x += unit->GetUnitData()->GetCollision().x; + four3.y -= unit->GetUnitData()->GetCollision().y; Vector2 four = Engine::Get()->worldToScreen(four3); ImVec2 ivOne = ImVec2(one.x, one.y); @@ -42,10 +42,10 @@ void ESP::DrawBox(Unit* unit, int32_t color, bool drawName = false) if (drawName) { - Vector3 textPos = unit->position; + Vector3 textPos = unit->GetPosition(); Vector2 screenTextPos = Engine::Get()->worldToScreen(textPos); ImVec2 ivTextPos = ImVec2(screenTextPos.x, screenTextPos.y); - Renderer::Get()->RenderText(unit->pUnitData->name, ivTextPos, 16, color, false); + Renderer::Get()->RenderText(std::string(unit->GetUnitData()->GetName()), ivTextPos, 16, color, false); } } @@ -82,9 +82,9 @@ void ESP::DrawBox(Vector3 position, Vector2 edgeSize, int32_t color) void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, float thickness = 1.f, bool drawName = false) { - static const float PI = 3.14159265358979323846f; + const float PI = 3.14159265358979323846f; int32_t tileSize = Engine::Get()->GetWorld()->pMap->GetTileSize(); - Vector3 center = unit->position; + Vector3 center = unit->GetPosition(); std::vector<ImVec2> screeenPoints; @@ -101,12 +101,12 @@ void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, { Renderer::Get()->RenderLine(screeenPoints[i], screeenPoints[i - 1], color, thickness); } - Renderer::Get()->RenderLine(screeenPoints[0], screeenPoints[screeenPoints.size()-1], color, thickness); + Renderer::Get()->RenderLine(screeenPoints[0], screeenPoints[screeenPoints.size() - 1], color, thickness); if (drawName) { Vector2 screenTextPos = Engine::Get()->worldToScreen(center); ImVec2 ivTextPos = ImVec2(screenTextPos.x, screenTextPos.y); - Renderer::Get()->RenderText(unit->pUnitData->name, ivTextPos, 16, color, false); + Renderer::Get()->RenderText(unit->GetUnitData()->GetName(), ivTextPos, 16, color, false); } } @@ -117,7 +117,7 @@ void ESP::LoadConfig() trebuchetESP = config->ReadInt("ESP", "trebuchetESP"); gaiaESP = config->ReadInt("ESP", "gaiaESP"); goldESP = config->ReadInt("ESP", "goldESP"); - stoneESP = config->ReadInt("ESP", "stoneESP"); + stoneESP = config->ReadInt("ESP", "stoneESP"); } void ESP::SaveConfig() @@ -135,14 +135,28 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) { if (playerUnitEsp[playerIndex]) { - if (strcmp(unit->pUnitData->name, "FLARE") == 0) + if (!allyEsp && Engine::Get()->GetLocalPlayer()->IsAllied(player)) + { + return; + } + + if (!neutralEsp && Engine::Get()->GetLocalPlayer()->IsNeutral(player)) + { + return; + } + + if (!enemyEsp && Engine::Get()->GetLocalPlayer()->IsEnemy(player)) + { + return; + } + if (strcmp(unit->GetUnitData()->GetName(), "FLARE") == 0) { return; //Dont display annoying flares that Bots use } if (siegeImpactLocation) { - if (std::string(unit->pUnitData->name).find("Projectile Scorpion") != std::string::npos) + if (std::string(unit->GetUnitData()->GetName()).find("Projectile Scorpion") != std::string::npos) { Vector3* destination = unit->GetTargetPosition(); if (destination) @@ -152,7 +166,7 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) } } - if (std::string(unit->pUnitData->name).find("Projectile Mangonel") != std::string::npos) + if (std::string(unit->GetUnitData()->GetName()).find("Projectile Mangonel") != std::string::npos) { Vector3* destination = unit->GetTargetPosition(); if (destination) @@ -162,7 +176,7 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) } } - if (std::string(unit->pUnitData->name).find("Projectile Trebuchet") != std::string::npos) + if (std::string(unit->GetUnitData()->GetName()).find("Projectile Trebuchet") != std::string::npos) { Vector3* destination = unit->GetTargetPosition(); if (destination) @@ -173,12 +187,12 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) } } - if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Miscellaneous) + /*if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Miscellaneous) { return; } - - if (strcmp(unit->pUnitData->name, "CSTL") == 0) + */ + if (strcmp(unit->GetUnitData()->GetName(), "CSTL") == 0) { DrawBox(unit, colors_hex[*player->pColor], true); return; @@ -186,7 +200,7 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) DrawBox(unit, colors_hex[*player->pColor], playerUnitNameEsp[playerIndex]); - if (trebuchetESP && (std::string(unit->pUnitData->name).find("TREBU") != std::string::npos || std::string(unit->pUnitData->name).find("PTREB") != std::string::npos)) + if (trebuchetESP && (std::string(unit->GetUnitData()->GetName()).find("TREBU") != std::string::npos || std::string(unit->GetUnitData()->GetName()).find("PTREB") != std::string::npos)) { DrawCircle(unit, 16, colors_hex[*player->pColor], 100, 2, true); } @@ -219,7 +233,7 @@ void ESP::OnNeutralUnit(Unit* unit) { if (gaiaESP || goldESP || stoneESP) { - std::string unitName = unit->pUnitData->name; + std::string unitName = unit->GetUnitData()->GetName(); Vector2 screenPos = Engine::Get()->worldToScreen(unit); if (goldESP && strcmp(unitName.c_str(), "GOLDM") == 0) @@ -277,7 +291,7 @@ void ESP::OnNeutralUnit(Unit* unit) Renderer::Get()->RenderText(unitName, ImVec2(screenPos.x, screenPos.y), 16, 0xffffffff); return; } - + if (strcmp(unitName.c_str(), "RELIC") == 0) { Renderer::Get()->RenderCircleFilled(ImVec2(screenPos.x, screenPos.y), 50, 0x40ffffff); @@ -289,8 +303,15 @@ void ESP::OnNeutralUnit(Unit* unit) void ESP::OnMenuMainWindow() { ImGui::Separator(); + ImGui::Text("Diplomacy ESP"); + ImGui::Checkbox("Ally", &allyEsp); + ImGui::SameLine(); + ImGui::Checkbox("Neutral", &neutralEsp); + ImGui::SameLine(); + ImGui::Checkbox("Enemy", &enemyEsp); + ImGui::Text("Siege ESP"); - ImGui::Checkbox("Siege Impact", &siegeImpactLocation); + //ImGui::Checkbox("Siege Impact", &siegeImpactLocation); ImGui::Checkbox("Trebuchet range", &trebuchetESP); ImGui::Separator(); ImGui::Text("Resource ESP"); |