diff options
author | BDKPlayer <fabian.stotz@yahoo.de> | 2020-07-31 16:14:55 +0200 |
---|---|---|
committer | BDKPlayer <fabian.stotz@yahoo.de> | 2020-07-31 16:14:55 +0200 |
commit | cdc71b248d67fa5d1ac10a4a35ac3a58f757255e (patch) | |
tree | 631015aacd1356f063efc8f0d7936c18aff1bd65 | |
parent | 1f75a0b4d28c720b0241e4e80d1cd708a9ce6c6f (diff) |
Working minimal version
-rw-r--r-- | CastleManager.cpp | 4 | ||||
-rw-r--r-- | Classes.h | 74 | ||||
-rw-r--r-- | Core.cpp | 38 | ||||
-rw-r--r-- | Debug.cpp | 4 | ||||
-rw-r--r-- | ESP.cpp | 53 | ||||
-rw-r--r-- | Engine.cpp | 11 | ||||
-rw-r--r-- | Engine.h | 1 | ||||
-rw-r--r-- | MinimapText.cpp | 2 | ||||
-rw-r--r-- | Offsets.cpp | 10 | ||||
-rw-r--r-- | RelicManager.cpp | 6 | ||||
-rw-r--r-- | Source.cpp | 4 |
11 files changed, 101 insertions, 106 deletions
diff --git a/CastleManager.cpp b/CastleManager.cpp index 373d6e5..2b7ab6f 100644 --- a/CastleManager.cpp +++ b/CastleManager.cpp @@ -39,13 +39,13 @@ void CastleManager::OnUnitCreated(Unit* unit) { return; } - Player* owningPlayer = unit->pOwner; + Player* owningPlayer = unit->GetOwner(); if (!owningPlayer || owningPlayer == Engine::Get()->GetLocalPlayer()) { return; } - if (strcmp("CSTL", unit->pUnitData->name) == 0) + if (strcmp("CSTL", unit->GetUnitData()->GetName()) == 0) { std::string message = std::string(owningPlayer->name) + " is building a castle!"; const char* charMessage = message.c_str(); @@ -281,52 +281,56 @@ public: class UnitData { public: - char pad_0x0000[0x20]; //0x0000 - __int16 Class; //0x0020 - char pad_0x0022[0x26]; //0x0022 - __int16 unk; //0x0048 - __int16 maxHp; //0x004A - char pad_0x004C[0x8]; //0x004C - float collisionX; //0x0054 - float collisionY; //0x0058 - float collisionZ; //0x005C - char pad_0x0060[0x120]; //0x0060 - char* name; //0x0180 -}; //Size=0x0408 + char* GetName() + { + return *reinterpret_cast<char**>(*(uint64_t*)this + 0x848); + } + + Vector3 GetCollision() + { + return *(Vector3*)(*(uint64_t*)this + 0x718); + } + +}; class Unit { -public: - char pad_0x0000[0x10]; //0x0000 - UnitData* pUnitData; //0x0010 - Player* pOwner; //0x0018 - char pad_0x0020[0x70]; //0x0020 - float fHealth; //0x0090 - char pad_0x0094[0x4]; //0x0094 - Vector3 position; - - //When moving sadly height isnt set. When attack it works. - Vector3* GetTargetPosition() +private: + float GetPosX() + { + int32_t position = *reinterpret_cast<int64_t*>((uint64_t)this + 0x1a0) ^ 0x187F64ADC21CDE88 ^ 0x4F019E376DDAD1E5; + return *(float*)(&position); + } + + float GetPosY() { - uint64_t actionList = *reinterpret_cast<uint64_t*>((uint64_t)this + 0x288); - 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); + int32_t position = *reinterpret_cast<int64_t*>((uint64_t)this + 0x308) ^ 0x51E534524D81CFA6; + return *(float*)(&position); } + float GetPosZ() + { + int32_t position = (*reinterpret_cast<int64_t*>((uint64_t)this + 0x3f8) - 0x17258AE0D9C58D92 ) ^ 0x78E0AFEAF822FC61; + return *(float*)(&position); + } +public: + + UnitData* GetUnitData() + { + return reinterpret_cast<UnitData*>((uint64_t)this + 0x10); + } - typedef char(__fastcall* fhsMoveToCaller)(Unit* unit, Unit* targetUnit, World* world, int64_t zero, float xPos, float yPos, int zero2); - void MoveTo(World* world, float xPos, float yPos) + Player* GetOwner() { - static fhsMoveToCaller moveUnitCaller = (fhsMoveToCaller)((int64_t)GetModuleHandle(NULL) + 0xc863a0); //outdated and desync - moveUnitCaller(this, 0, world, 0, xPos, yPos, 0); + return *reinterpret_cast<Player**>((uint64_t)this + 0x18); } -}; //Size=0x0250 + Vector3 GetPosition() + { + return Vector3(GetPosX(), GetPosY(), GetPosZ()); + } +}; class ObjectManager { @@ -82,20 +82,20 @@ void __fastcall OnCreateUnitHook(Registers* registers) Core::Core() { - printf("Core::Core()\n"); - onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15); + //printf("Core::Core()\n"); + //onCreateUnitHook.Hook((BYTE*)GetModuleHandle(NULL) + Offsets::createUnitHook, (BYTE*)OnCreateUnitHook, 15); FeatureManager* featureManager = FeatureManager::Get(); - featureManager->RegisterFeature(new InitialiseOffsets()); + //featureManager->RegisterFeature(new InitialiseOffsets()); //Register Features here - featureManager->RegisterFeature(new ResourceInformation()); + //featureManager->RegisterFeature(new ResourceInformation()); featureManager->RegisterFeature(new ESP()); featureManager->RegisterFeature(new MinimapText()); - featureManager->RegisterFeature(new RelicManager()); - featureManager->RegisterFeature(new CustomLoadingScreen("C:\\wallpaper.jpg")); + //featureManager->RegisterFeature(new RelicManager()); + //featureManager->RegisterFeature(new CustomLoadingScreen("C:\\wallpaper.jpg")); //featureManager->RegisterFeature(new PauseManager()); - featureManager->RegisterFeature(new CastleManager()); + //featureManager->RegisterFeature(new CastleManager()); #ifdef _DEBUG featureManager->RegisterFeature(new Debug()); @@ -124,19 +124,20 @@ void createPlayerTreeNode(Player* player, int playerIndex) Unit* unit = player->pObjectManager->units[i]; if (!unit) { continue; } - if (unit->pOwner == player) + if (unit->GetOwner() == player) { ImGui::Text("%p", unit); ImGui::SameLine(); - ImGui::Text("%s", unit->pUnitData->name); + ImGui::Text("%s", unit->GetUnitData()->GetName()); + ImGui::Text("%f %f %f", unit->GetPosition().x, unit->GetPosition().y, unit->GetPosition().z); ImGui::SameLine(); - std::string text = std::string("Copy##") + std::string(unit->pUnitData->name) + std::to_string(i); + //std::string text = std::string("Copy##") + std::string(unit->GetUnitData()->GetName()) + std::to_string(i); - if (ImGui::Button(text.c_str())) + if (ImGui::Button("Copy")) { Utility::CopyToClipboard((uint64_t)unit); } - std::string vmtTree = std::string("VMT##") + std::string(unit->pUnitData->name) + "VMT"; + /*std::string vmtTree = std::string("VMT##") + std::string(unit->pUnitData->name) + "VMT"; if (ImGui::TreeNode(vmtTree.c_str())) { for (int vmtIndex = 0; vmtIndex < 175; vmtIndex++) @@ -150,9 +151,9 @@ void createPlayerTreeNode(Player* player, int playerIndex) } } ImGui::TreePop(); - } + }*/ - if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building) + /*if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Building) { buildingCount++; } @@ -163,7 +164,7 @@ void createPlayerTreeNode(Player* player, int playerIndex) if (unit->pUnitData->Class == (int16_t)EnumUnitDataClass::Cavalry) { calavaryCount++; - } + }*/ } } ImGui::Text("Buildings %.d", buildingCount); @@ -182,7 +183,6 @@ void Core::OnPresent() { __try { - //printf("Valid: "); MainScreen* mainScreen = Engine::Get()->GetMainScreen(); if (!mainScreen) { @@ -194,7 +194,7 @@ void Core::OnPresent() { return; } - //printf(" world %p", world); + //printf("world %p", world); PlayerArray* playerArray = world->pPlayerArray; if (!playerArray) @@ -216,7 +216,7 @@ void Core::OnPresent() for (int i = 0; i < gaiaPlayer->pObjectManager->Count; i++) { Unit* unit = gaiaPlayer->pObjectManager->units[i]; - if (!unit || unit->pUnitData->Class == -1) + if (!unit /*|| unit->GetUnitData()->Class == -1*/) { continue; } @@ -239,7 +239,7 @@ void Core::OnPresent() for (int j = 0; j < player->pObjectManager->Count; j++) { Unit* unit = player->pObjectManager->units[j]; - if (!unit || unit->pUnitData->Class == -1) + if (!unit /*|| unit->pUnitData->Class == -1*/) { continue; } @@ -18,9 +18,9 @@ void Debug::OnMenuMainWindow() ImGui::Separator(); ImGui::Text("Debug"); //ImGui::Text("Idle: %d", idleUnit); - if (ImGui::Button("Flare")) + if (ImGui::Button("nothing")) { - Engine::Get()->Flare(100.f, 100.f); + } ImGui::Separator(); } @@ -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); } } @@ -84,7 +84,7 @@ void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, { static 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; @@ -106,7 +106,7 @@ void ESP::DrawCircle(Unit* unit, int radius, int32_t color, int smoothness = 16, { 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); } } @@ -135,12 +135,12 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) { if (playerUnitEsp[playerIndex]) { - if (strcmp(unit->pUnitData->name, "FLARE") == 0) + if (strcmp(unit->GetUnitData()->GetName(), "FLARE") == 0) { return; //Dont display annoying flares that Bots use } - if (siegeImpactLocation) + /*if (siegeImpactLocation) { if (std::string(unit->pUnitData->name).find("Projectile Scorpion") != std::string::npos) { @@ -171,14 +171,15 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) Renderer::Get()->RenderCircleFilled(ImVec2(screenDestinationPos.x, screenDestinationPos.y), 30, colors_hex[*player->pColor] & 0x77ffffff); } } - } + }*/ - 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,12 +187,12 @@ 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); } - if (playerUnitDestinationEsp[playerIndex]) + /*if (playerUnitDestinationEsp[playerIndex]) { Vector3* targetPosition = unit->GetTargetPosition(); if (!targetPosition || targetPosition->x <= 0 || targetPosition->y <= 0) { return; } @@ -199,7 +200,7 @@ void ESP::OnUnitIteration(Unit* unit, Player* player, int playerIndex) 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->pColor]); - } + }*/ } } @@ -219,7 +220,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) @@ -290,7 +291,7 @@ void ESP::OnMenuMainWindow() { ImGui::Separator(); 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"); @@ -92,7 +92,7 @@ Vector2 Engine::worldToScreen(Vector3 position) const Vector2 Engine::worldToScreen(Unit* unit) const { - return worldToScreen(unit->position); + return worldToScreen(unit->GetPosition()); } uint32_t Engine::GetPlayerColor(int colorIndex) const @@ -249,12 +249,3 @@ void Engine::PrintBottomNotification(const char* message, unsigned int hexcolor) static tPrintBottomText fPrintBottomText = (tPrintBottomText)(base + Offsets::printBottomText); fPrintBottomText(GetMainScreen()->pGameScreen, message, hexcolor, 0xffffffffffffffff); //Color format: RBGA } - -int64_t Engine::Flare(float xPos, float yPos) const -{ - typedef __int64(__fastcall* tCreateFlare) (Player* player, __int64 hundert12, __int64 zero1, __int64 zero2, float xPos, float yPos, int64_t zero3, int64_t zero4); - static tCreateFlare fCreateFlare = (tCreateFlare)(base + 0xc31270); - - return fCreateFlare(GetLocalPlayer(), 0x112, 0, 0, 220.f, 220.f, 0, 0); - //__usercall fhsCreateFlare_MAYBE_7FF718CF1270@<rax>( __int64 a3_zero@<r8>, __int64 a4_zero@<r9>, float xPos@<xmm2>, float yPos@<xmm3>, __int64 a5_zero, int a6_Zero) -} @@ -45,5 +45,4 @@ public: void SendChat(const char* message, bool teamchat = false) const; void PrintNotification(const char* message) const; void PrintBottomNotification(const char* message, unsigned int hexcolor) const; - int64_t Flare(float xPos, float yPos) const; };
\ No newline at end of file diff --git a/MinimapText.cpp b/MinimapText.cpp index 974558d..0153d77 100644 --- a/MinimapText.cpp +++ b/MinimapText.cpp @@ -102,7 +102,7 @@ void MinimapText::OnInitialise() { hookEnabled = &enabled; - minimapHook.Hook((BYTE*)(int64_t)GetModuleHandle(NULL) + Offsets::minimapHookOffset, (BYTE*)minimapProxy, 14); + minimapHook.Hook((BYTE*)(int64_t)GetModuleHandle(NULL) + Offsets::minimapHookOffset, (BYTE*)minimapProxy, 20); } void MinimapText::OnShutdown() diff --git a/Offsets.cpp b/Offsets.cpp index cee34de..56695f7 100644 --- a/Offsets.cpp +++ b/Offsets.cpp @@ -3,23 +3,23 @@ namespace Offsets { //48 8D 0D ? ? ? ? 41 B8 ? ? ? ? E8 ? ? ? ? 33 C0 //5 - int64_t pathfindingSystem = 0x2bb6e10; + int64_t pathfindingSystem = 0x2BB80D0; //48 8B 0D ? ? ? ? E8 ? ? ? ? C6 85 //5 - int64_t mainScreen = 0x2ba4988; + int64_t mainScreen = 0x2BA5C48; //48 8B 0D ? ? ? ? 48 85 C9 0F 84 ? ? ? ? 40 //4 - int64_t tribePanelInven = 0x2ba5ed0; + int64_t tribePanelInven = 0x2BA7190; //48 8B 83 ? ? ? ? 48 8B 48 70 F3 0F 10 //4 int64_t tribePanelInven_localPlayer = 0x208; //4C 8B 05 ? ? ? ? 45 84 - int64_t pAVGame = 0x2b96dd8; + int64_t pAVGame = 0x2B98098; //TODO %s: %d/%d //MinimapText 88 85 ? ? ? ? 41 8B 46 0C //2 - int64_t minimapHookOffset = 0xcb1646; + int64_t minimapHookOffset = 0xCB2616; //Functions int64_t printNotification = 0xca7b10; //48 83 EC 48 48 8B 05 ? ? ? ? 4C 8D //4 diff --git a/RelicManager.cpp b/RelicManager.cpp index 74d259a..db5306c 100644 --- a/RelicManager.cpp +++ b/RelicManager.cpp @@ -21,7 +21,7 @@ void RelicManager::OnMenuMainWindow() { continue; } - if (strcmp(unit->pUnitData->name, "RELIC") == 0) + if (strcmp(unit->GetUnitData()->GetName(), "RELIC") == 0) { relics.push_back(unit); } @@ -36,7 +36,7 @@ void RelicManager::OnMenuMainWindow() if (ImGui::Button("<")) { currentRelic = (currentRelic - 1) % relics.size(); - Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->position); + Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->GetPosition()); } ImGui::SameLine(); ImGui::Text("%d/%d", currentRelic + 1, relics.size()); @@ -44,7 +44,7 @@ void RelicManager::OnMenuMainWindow() if (ImGui::Button(">")) { currentRelic = (currentRelic + 1) % relics.size(); - Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->position); + Engine::Get()->GetLocalPlayer()->SetCameraPosition(relics[currentRelic]->GetPosition()); } } ImGui::Separator(); @@ -287,11 +287,11 @@ DWORD __stdcall InitHooks(LPVOID hModule) presentHook.Unhook(); - Sleep(1000); + Sleep(100); (WNDPROC)SetWindowLongPtr(window, GWLP_WNDPROC, (LONG_PTR)OriginalWndProcHandler); - Sleep(1000); + Sleep(100); FreeLibraryAndExitThread((HMODULE)hModule, 0); } |