diff options
author | BDKPlayer <fabian.stotz@yahoo.de> | 2020-03-16 11:29:36 +0100 |
---|---|---|
committer | BDKPlayer <fabian.stotz@yahoo.de> | 2020-03-16 11:29:36 +0100 |
commit | 1fb0a22efeebe9c0b375449bb00c92183599949b (patch) | |
tree | 5c17321143c99699449b12527f810c9d0030430a | |
parent | 27074de05971f1e9ac7ca95b6a7397af7427ce58 (diff) |
Added: Siege impact ESP
-rw-r--r-- | Classes.h | 85 | ||||
-rw-r--r-- | Core.cpp | 16 | ||||
-rw-r--r-- | ESP.cpp | 70 | ||||
-rw-r--r-- | ESP.h | 5 | ||||
-rw-r--r-- | FeatureManager.cpp | 2 | ||||
-rw-r--r-- | Offsets.h | 4 |
6 files changed, 174 insertions, 8 deletions
@@ -71,6 +71,73 @@ class ObjectManager; class Player; +enum class EnumUnitDataClass : int16_t //From Age of Empires 2013 +{ + InvalidClass = -1, + Archer = 0, + Artifact = 1, + TradeBoat = 2, + Building = 3, + Civilian = 4, + OceanFish = 5, + Infantry = 6, + BerryBush = 7, + StoneMine = 8, + PreyAnimal = 9, + PredatorAnimal = 10, + Miscellaneous = 11, + Cavalry = 12, + SiegeWeapon = 13, + Terrain = 14, + Tree = 15, + TreeStump = 16, + Healer = 17, + Monk = 18, + TradeCart = 19, + TransportBoat = 20, + FishingBoat = 21, + Warship = 22, + Conquistador = 23, + WarElephant = 24, + Hero = 25, + ElephantArcher = 26, + Wall = 27, + Phalanx = 28, + DomesticAnimal = 29, + Flag = 30, + DeepSeaFish = 31, + GoldMine = 32, + ShoreFish = 33, + Cliff = 34, + Petard = 35, + CavalryArcher = 36, + Doppelganger = 37, + Bird = 38, + Gate = 39, + SalvagePile = 40, + ResourcePile = 41, + Relic = 42, + MonkWithRelic = 43, + HandCannoneer = 44, + TwoHandedSwordsman = 45, + Pikeman = 46, + Scout = 47, + OreMine = 48, + Farm = 49, + Spearman = 50, + PackedUnit = 51, + Tower = 52, + BoardingBoat = 53, + UnpackedSiegeUnit = 54, + Ballista = 55, + Raider = 56, + CavalryRaider = 57, + Livestock = 58, + King = 59, + MiscBuilding = 60, + ControlledAnimal = 61 +}; + class PathfindingSystem { public: @@ -174,10 +241,13 @@ public: }; //Size=0x02CC + class UnitData { public: - char pad_0x0000[0x48]; //0x0000 + char pad_0x0000[0x20]; //0x0000 + __int16 Class; //0x0020 + char pad_0x0022[0x26]; //0x0022 __int16 unk; //0x0048 __int16 maxHp; //0x004A char pad_0x004C[0x8]; //0x004C @@ -186,7 +256,6 @@ public: float collisionZ; //0x005C char pad_0x0060[0x120]; //0x0060 char* name; //0x0180 - }; //Size=0x0408 @@ -201,6 +270,18 @@ public: char pad_0x0094[0x4]; //0x0094 Vector3 position; + //When moving sadly height isnt set. When attack it works. + Vector3* GetTargetPosition() + { + uint64_t actionList = *reinterpret_cast<uint64_t*>((uint64_t)this + 0x278); + if (!actionList){return NULL;} + uint64_t targetDataWrapper = *reinterpret_cast<uint64_t*>(actionList + 0x10); + if (!targetDataWrapper) { return NULL; } + uint64_t actionMoveTo = *reinterpret_cast<uint64_t*>(targetDataWrapper); + if (!actionMoveTo) { return NULL; } + return reinterpret_cast<Vector3*>(actionMoveTo + 0x38); + } + }; //Size=0x0250 class ObjectManager @@ -22,7 +22,7 @@ Core::Core() //Register Features here FeatureManager::Get()->registerFeature(new ResourceInformation()); FeatureManager::Get()->registerFeature(new ESP()); - FeatureManager::Get()->registerFeature(new MinimapText()); + //FeatureManager::Get()->registerFeature(new MinimapText()); FeatureManager::Get()->OnInitialise(); } @@ -34,6 +34,7 @@ void createPlayerTreeNode(Player* player, int playerIndex) std::string playerText = "Player " + std::to_string(playerIndex); if (ImGui::TreeNode(player->name)) { + ImGui::PushStyleColor(ImGuiCol_Text, 0xffffffff); ImGui::Text("Player %p", player); FeatureManager::Get()->OnMenuPlayerTreenode(player, playerIndex); if (ImGui::TreeNode("Units")) @@ -71,6 +72,7 @@ void createPlayerTreeNode(Player* player, int playerIndex) ImGui::Text("Cavalry %.d", calavaryCount); ImGui::TreePop(); } + ImGui::PopStyleColor(); ImGui::TreePop(); } ImGui::PopStyleColor(); @@ -81,20 +83,26 @@ void Core::OnPresent() { __try { + printf("Valid: "); MainScreen* mainScreen = Engine::Get()->GetMainScreen(); if (!mainScreen) { return; } - + printf("mainScreen %p", mainScreen); World* world = Engine::Get()->GetWorld(); - + if (!world) + { + return; + } + printf(" world %p", world); PlayerArray* playerArray = world->pPlayerArray; if (!playerArray) { return; } + printf(" playerArray %p", playerArray); int totalPlayers = Engine::Get()->GetTotalPlayers(); static bool openOverlay = true; @@ -142,7 +150,7 @@ void Core::OnPresent() Renderer::Get()->EndScene(); - ImGui::SetNextWindowBgAlpha(0.35f); + ImGui::SetNextWindowBgAlpha(0.55f); if (openOverlay) { __try @@ -45,15 +45,76 @@ void ESP::DrawBox(Unit* unit, int32_t color, bool drawName = false) } } +void ESP::DrawBox(Vector3 position, Vector2 edgeSize, int32_t color) +{ + Vector3 one3 = position; + one3.x -= edgeSize.x; + one3.y -= edgeSize.y; + Vector2 one = Engine::Get()->worldToScreen(one3); + + Vector3 two3 = position; + two3.x += edgeSize.x; + two3.y += edgeSize.y; + Vector2 two = Engine::Get()->worldToScreen(two3); + + Vector3 three3 = position; + three3.x -= edgeSize.x; + three3.y += edgeSize.y; + Vector2 three = Engine::Get()->worldToScreen(three3); + + Vector3 four3 = position; + four3.x += edgeSize.x; + four3.y -= edgeSize.y; + Vector2 four = Engine::Get()->worldToScreen(four3); + + ImVec2 ivOne = ImVec2(one.x, one.y); + ImVec2 ivTwo = ImVec2(two.x, two.y); + ImVec2 ivThree = ImVec2(three.x, three.y); + ImVec2 ivFour = ImVec2(four.x, four.y); + + + Renderer::Get()->RenderRect(ivOne, ivFour, ivTwo, ivThree, color); +} + void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) { + if (playerUnitEsp[playerIndex]) { if (strcmp(unit->pUnitData->name, "FLARE") == 0) { return; //Dont display annoying flares that Bots use } + + if (playerSiegeImpactLocation[playerIndex]) + { + if (std::string(unit->pUnitData->name).find("Projectile Mangonel") != std::string::npos) + { + Vector3* destination = unit->GetTargetPosition(); + if (destination) + { + Vector2 screenDestinationPos = Engine::Get()->worldToScreen(*destination); + Renderer::Get()->RenderCircleFilled(ImVec2(screenDestinationPos.x, screenDestinationPos.y), 10, colors_hex[*player->color] & 0x77ffffff); + } + } + } + + if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Miscellaneous) + { + return; + } + DrawBox(unit, colors_hex[*player->color], playerUnitNameEsp[playerIndex]); + + if (playerUnitDestinationEsp[playerIndex]) + { + Vector3* targetPosition = unit->GetTargetPosition(); + if (!targetPosition || targetPosition->x <= 0 || targetPosition->y <= 0) { return; } + + Vector2 screenPos = Engine::Get()->worldToScreen(unit); + Vector2 screenTargetPos = Engine::Get()->worldToScreen(*targetPosition); + Renderer::Get()->RenderLine(ImVec2(screenPos.x, screenPos.y), ImVec2(screenTargetPos.x, screenTargetPos.y), colors_hex[*player->color]); + } } } @@ -64,13 +125,15 @@ void ESP::OnMenuPlayerTreenode(Player* player, int playerIndex) { ImGui::PushItemWidth(100); ImGui::Checkbox("Unit", &playerUnitEsp[playerIndex]); + ImGui::Checkbox("Unit Destination", &playerUnitDestinationEsp[playerIndex]); + ImGui::Checkbox("Siege Impact", &playerSiegeImpactLocation[playerIndex]); ImGui::TreePop(); } } void ESP::OnNeutralUnit(Unit* unit) { - if (gaiaEsp) + if (gaiaEsp || goldESP || stoneESP) { std::string unitName = unit->pUnitData->name; Vector2 screenPos = Engine::Get()->worldToScreen(unit); @@ -91,6 +154,11 @@ void ESP::OnNeutralUnit(Unit* unit) return; } + if (!gaiaEsp) + { + return; + } + if (strcmp(unitName.c_str(), "FISHS") == 0 || strcmp(unitName.c_str(), "FISHX") == 0 || strcmp(unitName.c_str(), "FISH1") == 0 || strcmp(unitName.c_str(), "FISH2") == 0 || strcmp(unitName.c_str(), "FISH3") == 0 || strcmp(unitName.c_str(), "FISH4") == 0 || @@ -1,12 +1,16 @@ #pragma once #include "Feature.h" +struct Vector2; +struct Vector3; class ESP : public Feature { bool gaiaEsp = true; bool goldESP = true; bool stoneESP = true; bool playerUnitEsp[8] = { true,true,true,true,true,true,true,true }; + bool playerSiegeImpactLocation[8] = { true,true,true,true,true,true,true,true }; + bool playerUnitDestinationEsp[8] = { true,true,true,true,true,true,true,true }; bool playerUnitNameEsp[8] = { false,false,false,false,false,false,false,false }; //bool playerBuildingEsp[8] = { false,true,true,true,true,true,true,true }; @@ -21,4 +25,5 @@ class ESP : public Feature void OnMenuMainWindow(); void DrawBox(Unit* unit, int32_t color, bool drawName); + void DrawBox(Vector3 position, Vector2 edgeSize, int32_t color); };
\ No newline at end of file diff --git a/FeatureManager.cpp b/FeatureManager.cpp index c70b72d..027ad10 100644 --- a/FeatureManager.cpp +++ b/FeatureManager.cpp @@ -23,7 +23,7 @@ FeatureManager* FeatureManager::Get() void FeatureManager::registerFeature(Feature* feature) { static int feature_numer = 0; - printf("Registered feature %d\n", feature_numer); + printf("Registered feature %d\n", feature_numer++); features.push_back(feature); } @@ -20,4 +20,8 @@ namespace Offsets //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 int64_t tribePanelInven_localPlayer = 0x208; + + + //Pattern + int64_t unit_actionlist = 0x278; //48 8B 8B ? ? ? ? E8 ? ? ? ? 48 85 FF }
\ No newline at end of file |