aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBDKPlayer <fabian.stotz@yahoo.de>2020-08-01 17:25:01 +0200
committerBDKPlayer <fabian.stotz@yahoo.de>2020-08-01 17:25:01 +0200
commita927cae5522db4eadc250a6cda03494f7a8c2a83 (patch)
treed2bd059fd98cbb8734ec1e34c92e026db61e7462
parent344570fdb59f01ef1f3e9f47c8313660c39f6f8f (diff)
added diplomacy ESP
-rw-r--r--Classes.h24
-rw-r--r--ESP.cpp21
-rw-r--r--ESP.h3
-rw-r--r--Engine.cpp25
-rw-r--r--Engine.h1
5 files changed, 74 insertions, 0 deletions
diff --git a/Classes.h b/Classes.h
index 61c5fcf..872a627 100644
--- a/Classes.h
+++ b/Classes.h
@@ -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
diff --git a/ESP.cpp b/ESP.cpp
index 11bf487..1df2f68 100644
--- a/ESP.cpp
+++ b/ESP.cpp
@@ -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);
diff --git a/ESP.h b/ESP.h
index a6d9b1e..ab58148 100644
--- a/ESP.h
+++ b/ESP.h
@@ -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 };
diff --git a/Engine.cpp b/Engine.cpp
index f59e68e..e3adeaa 100644
--- a/Engine.cpp
+++ b/Engine.cpp
@@ -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();
diff --git a/Engine.h b/Engine.h
index 4344e25..87cc120 100644
--- a/Engine.h
+++ b/Engine.h
@@ -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;