diff --git a/SDK/Engine_classes.hpp b/SDK/Engine_classes.hpp index 70ef374..5273fd8 100644 --- a/SDK/Engine_classes.hpp +++ b/SDK/Engine_classes.hpp @@ -13923,7 +13923,9 @@ public: class ULevel : public UObject { public: - uint8 Pad_336A[0x90]; // Fixing Size After Last Property [ Dumper-7 ] + uint8 Pad_336A[0x70]; // Fixing Size After Last Property [ Dumper-7 ] + TArray Actors; // 0x98 + unsigned char kek_00A8[0x10]; // padding class UWorld* OwningWorld; // 0xB8(0x8)(ZeroConstructor, Transient, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UModel* Model; // 0xC0(0x8)(ZeroConstructor, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) TArray ModelComponents; // 0xC8(0x10)(ExportObject, ZeroConstructor, ContainsInstancedReference, UObjectWrapper, NativeAccessSpecifierPublic) diff --git a/config.cpp b/config.cpp index c70b6f8..3d02219 100644 --- a/config.cpp +++ b/config.cpp @@ -78,9 +78,31 @@ SDK::APalPlayerState* config::GetPalPlayerState() return static_cast(pPlayer->PlayerState); } -bool GetTAllPlayers(SDK::TArray* outResult) +SDK::UPalPlayerInventoryData* config::GetInventoryComponent() { - SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager(); + SDK::APalPlayerState* pPlayerState = GetPalPlayerState(); + if (!pPlayerState) + return nullptr; + + return pPlayerState->InventoryData; +} + +SDK::APalWeaponBase* config::GetPlayerEquippedWeapon() +{ + SDK::APalPlayerCharacter* pPalCharacter = GetPalPlayerCharacter(); + if (!pPalCharacter) + return nullptr; + + SDK::UPalShooterComponent* pWeaponInventory = pPalCharacter->ShooterComponent; + if (!pWeaponInventory) + return nullptr; + + return pWeaponInventory->HasWeapon; +} + +bool config::GetTAllPlayers(SDK::TArray* outResult) +{ + SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager(); if (!mPal) return false; @@ -88,9 +110,9 @@ bool GetTAllPlayers(SDK::TArray* outResult) return true; } -bool GetTAllImpNPC(SDK::TArray* outResult) +bool config::GetTAllImpNPC(SDK::TArray* outResult) { - SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager(); + SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager(); if (!mPal) return false; @@ -98,9 +120,9 @@ bool GetTAllImpNPC(SDK::TArray* outResult) return true; } -bool GetTAllNPC(SDK::TArray* outResult) +bool config::GetTAllNPC(SDK::TArray* outResult) { - SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager(); + SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager(); if (!mPal) return false; @@ -108,9 +130,9 @@ bool GetTAllNPC(SDK::TArray* outResult) return true; } -bool GetTAllPals(SDK::TArray* outResult) +bool config::GetTAllPals(SDK::TArray* outResult) { - SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager(); + SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager(); if (!mPal) return false; @@ -118,6 +140,52 @@ bool GetTAllPals(SDK::TArray* outResult) return true; } +bool config::GetAllActorsofType(SDK::UClass* mType, std::vector* outArray, bool bLoopAllLevels, bool bSkipLocalPlayer) +{ + SDK::UWorld* pWorld = Config.gWorld; + if (!pWorld) + return false; + + SDK::AActor* pLocalPlayer = static_cast(GetPalPlayerCharacter()); + std::vector result; + + // Get Levels + SDK::TArray pLevelsArray = pWorld->Levels; + __int32 levelsCount = pLevelsArray.Count(); + + // Loop Levels Array + for (int i = 0; i < levelsCount; i++) + { + if (!pLevelsArray.IsValidIndex(i)) + continue; + + SDK::TArray pActorsArray = pLevelsArray[i]->Actors; + __int32 actorsCount = pActorsArray.Count(); + + // Loop Actor Array + for (int j = 0; j < actorsCount; j++) + { + if (!pActorsArray.IsValidIndex(j)) + continue; + + SDK::AActor* pActor = pActorsArray[j]; + if (!pActor || !pActor->RootComponent || (pActor == pLocalPlayer && bSkipLocalPlayer)) + continue; + + if (!pActor->IsA(mType)) + continue; + + result.push_back(pActor); + } + + if (bLoopAllLevels) + continue; + else + break; + } + *outArray = result; + return result.size() > 0; +} void config::Init() { diff --git a/config.h b/config.h index e75e03d..be280ad 100644 --- a/config.h +++ b/config.h @@ -29,6 +29,9 @@ public: bool IsQuick = false; bool matchDbItems = true; bool isEq = false; + bool isDebugESP = false; + float mDebugESPDistance = 5.0f; + //def and value float SpeedModiflers = 1.0f; int DamageUp = 0; @@ -62,11 +65,14 @@ public: static SDK::UPalCharacterImportanceManager* GetCharacterImpManager(); static SDK::APalPlayerCharacter* GetPalPlayerCharacter(); static SDK::APalPlayerState* GetPalPlayerState(); + static SDK::UPalPlayerInventoryData* GetInventoryComponent(); + static SDK::APalWeaponBase* GetPlayerEquippedWeapon(); static SDK::TArray GetTAllPlayers(); static bool GetTAllPlayers(SDK::TArray* outResult); static bool GetTAllImpNPC(SDK::TArray* outResult); static bool GetTAllNPC(SDK::TArray* outResult); static bool GetTAllPals(SDK::TArray* outResult); + static bool GetAllActorsofType(SDK::UClass* mType, std::vector* outArray, bool bLoopAllLevels = false , bool bSkipLocalPlayer = false); static void Init(); static void Update(const char* filterText); static const std::vector& GetFilteredItems(); diff --git a/feature.cpp b/feature.cpp index 6e3f5fb..971d761 100644 --- a/feature.cpp +++ b/feature.cpp @@ -28,6 +28,49 @@ void ESP() ImGui::GetBackgroundDrawList()->AddText(nullptr, 16, ImVec2(10, 10 + (i * 30)), ImColor(128,0,0), T[i]->GetFullName().c_str()); } +void ESP_DEBUG(float mDist, ImVec4 color, UClass* mEntType) +{ + APalPlayerCharacter* pLocalPlayer = Config.GetPalPlayerCharacter(); + if (!pLocalPlayer) + return; + + APalPlayerController* pPlayerController = static_cast(pLocalPlayer->Controller); + if (!pPlayerController) + return; + + std::vector actors; + if (!config::GetAllActorsofType(mEntType, &actors, true)) + return; + + auto draw = ImGui::GetWindowDrawList(); + + __int32 actorsCount = actors.size(); + for (AActor* actor : actors) + { + FVector actorLocation = actor->K2_GetActorLocation(); + FVector localPlayerLocation = pLocalPlayer->K2_GetActorLocation(); + float distantTo = pLocalPlayer->GetDistanceTo(actor); + if (distantTo > mDist) + continue; + + FVector2D outScreen; + if (!pPlayerController->ProjectWorldLocationToScreen(actorLocation, &outScreen, true)) + continue; + + char data[0x256]; + const char* StringData = "OBJECT: [%s]\nCLASS: [%s]\nINDEX: [%d]\nPOSITION: { %0.0f, %0.0f, %0.0f }\nDISTANCE: [%.0fm]"; + if (distantTo >= 1000.f) + { + distantTo /= 1000.f; + StringData = "OBJECT: [%s]\nCLASS: [%s]\nINDEX: [%d]\nPOSITION: { %0.0f, %0.0f, %0.0f }\nDISTANCE: [%.0fkm]"; + } + sprintf_s(data, StringData, actor->GetName().c_str(), actor->Class->GetFullName().c_str(), actorLocation.X, actorLocation.Y, actorLocation.Z, distantTo); + + ImVec2 screen = ImVec2(static_cast(outScreen.X), static_cast(outScreen.Y)); + draw->AddText(screen, ImColor(color), data); + } +} + void DrawUActorComponent(SDK::TArray Comps,ImColor color) { ImGui::GetBackgroundDrawList()->AddText(nullptr, 16, ImVec2(ImGui::GetIO().DisplaySize.x / 2, ImGui::GetIO().DisplaySize.y / 2), color, "Drawing..."); @@ -146,4 +189,42 @@ void RemoveAncientTechPoint(__int32 mPoints) return; pTechData->bossTechnologyPoint -= mPoints; +} + +// Credit: BennettStaley +void AddToInventoryContainer(__int32 mCount, __int32 mIndex) +{ + APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter(); + if (!p_appc != NULL) + return; + + APalPlayerController* p_apc = static_cast(p_appc->Controller); + if (!p_apc) + return; + + APalPlayerState* p_apps = static_cast(p_apc->PlayerState); + if (!p_apps) + return; + + UPalPlayerInventoryData* InventoryData = p_apps->GetInventoryData(); + if (!InventoryData) + return; + + UPalItemContainerMultiHelper* InventoryMultiHelper = InventoryData->InventoryMultiHelper; + if (!InventoryMultiHelper) + return; + + TArray Containers = InventoryMultiHelper->Containers; + if (Containers.Count() <= 0) + return; + + UPalItemSlot* pSelectedSlot = Containers[0]->Get(mIndex); + + if (!pSelectedSlot != NULL) + return; + + FPalItemId FirstItemId = pSelectedSlot->GetItemId(); + __int32 StackCount = pSelectedSlot->GetStackCount(); + __int32 mNewCount = StackCount += mCount; + InventoryData->RequestAddItem(FirstItemId.StaticId, mNewCount, true); } \ No newline at end of file diff --git a/feature.h b/feature.h index cd0b46a..880942d 100644 --- a/feature.h +++ b/feature.h @@ -5,11 +5,12 @@ void ESP(); -void DrawUActorComponent(SDK::TArray Comps,ImColor color); +void ESP_DEBUG(double mDist, SDK::UClass* mEntType = SDK::AActor::StaticClass()); + +void DrawUActorComponent(SDK::TArray Comps, ImColor color); void DrawPosition(); - void ResetStamina(); void SetInfiniteAmmo(bool bInfAmmo); @@ -22,4 +23,6 @@ void AddAncientTechPoints(__int32 mPoints); void RemoveTechPoints(__int32 mPoints); -void RemoveAncientTechPoint(__int32 mPoints); \ No newline at end of file +void RemoveAncientTechPoint(__int32 mPoints); + +void AddToInventoryContainer(__int32 mCount, __int32 mIndex = 0); \ No newline at end of file diff --git a/src/Menu.cpp b/src/Menu.cpp index 7a37ca1..b99ce3e 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -518,9 +518,10 @@ namespace DX11_Base { if (g_GameVariables->m_ShowDemo) ImGui::ShowDemoWindow(); - } - + if (Config.isDebugESP) + ESP_DEBUG(Config.mDebugESPDistance); + } void Menu::MainMenu() { @@ -584,7 +585,6 @@ namespace DX11_Base { void Menu::HUD(bool* p_open) { - } void Menu::Loops()