diff options
author | BDKPlayer <fabian.stotz@yahoo.de> | 2020-08-01 17:25:01 +0200 |
---|---|---|
committer | BDKPlayer <fabian.stotz@yahoo.de> | 2020-08-01 17:25:01 +0200 |
commit | a927cae5522db4eadc250a6cda03494f7a8c2a83 (patch) | |
tree | d2bd059fd98cbb8734ec1e34c92e026db61e7462 | |
parent | 344570fdb59f01ef1f3e9f47c8313660c39f6f8f (diff) |
added diplomacy ESP
-rw-r--r-- | Classes.h | 24 | ||||
-rw-r--r-- | ESP.cpp | 21 | ||||
-rw-r--r-- | ESP.h | 3 | ||||
-rw-r--r-- | Engine.cpp | 25 | ||||
-rw-r--r-- | Engine.h | 1 |
5 files changed, 74 insertions, 0 deletions
@@ -1,6 +1,7 @@ #pragma once // Generated using ReClass 2016 #include <cstdint> +#include "Engine.h" struct Vector4 { @@ -191,6 +192,29 @@ public: yScreenPos = pos.y; } + bool IsAllied(Player* other) + { + int32_t playerNumber = Engine::Get()->GetPlayerNumber(other); + int32_t* diplomacy = (int32_t*)((int64_t)this + 0xd0); + return *(diplomacy + playerNumber) == 2; + } + + bool IsEnemy(Player* other) + { + int32_t playerNumber = Engine::Get()->GetPlayerNumber(other); + int32_t* diplomacy = (int32_t*)((int64_t)this + 0xd0); + return *(diplomacy + playerNumber) == 4; + } + + bool IsNeutral(Player* other) + { + int32_t playerNumber = Engine::Get()->GetPlayerNumber(other); + int32_t* diplomacy = (int32_t*)((int64_t)this + 0xd0); + + //TODO is 0 correct? + return *(diplomacy + playerNumber) == 1; + } + }; //Size=0x93A0 class World @@ -135,6 +135,20 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) { if (playerUnitEsp[playerIndex]) { + 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 @@ -289,6 +303,13 @@ 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("Trebuchet range", &trebuchetESP); @@ -12,6 +12,9 @@ class ESP : public Feature bool stoneESP = true; bool trebuchetESP = true; bool siegeImpactLocation = true; + bool allyEsp = false; + bool neutralEsp = true; + bool enemyEsp = true; bool playerUnitEsp[9] = { true,true,true,true,true,true,true,true, true }; bool playerUnitDestinationEsp[9] = { false,false,false,false,false,false,false,false, false }; @@ -162,6 +162,31 @@ Player* Engine::GetPlayer(int index) const return playerArray->playerData[index].player; } +//TODO is this stable? +int Engine::GetPlayerNumber(Player* player) +{ + const int64_t totalPlayers = GetTotalPlayers(); + + + MainScreen* mainScreen = GetMainScreen(); + + World* main = GetWorld(); + + PlayerArray* playerArray = main->pPlayerArray; + + + for (int i = 0; i <= totalPlayers; i++) + { + if (playerArray->playerData[i].player == player) + { + return i; + } + } + + printf("Failed to GetPlayerNumber()\n"); + return -1; +} + Player* Engine::GetPlayerByName(char* playerName) const { MainScreen* mainScreen = GetMainScreen(); @@ -38,6 +38,7 @@ public: uint32_t GetPlayerColor(int colorIndex) const; ImVec4 GetPlayerColorImGUI(int colorIndex) const; Player* GetPlayer(int index) const; + int GetPlayerNumber(Player* player); Player* GetPlayerByName(char* playername) const; Player* GetLocalPlayer() const; |