debug esp

# Helpers
- GetPlayerInventoryComponent
- GetPlayerEquippedWeapon
- GetActorsOfType
This commit is contained in:
NightFyre 2024-01-26 19:28:58 -05:00
parent a454ccd815
commit 294e31579e
6 changed files with 175 additions and 15 deletions

View File

@ -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<class AActor*> 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<class UModelComponent*> ModelComponents; // 0xC8(0x10)(ExportObject, ZeroConstructor, ContainsInstancedReference, UObjectWrapper, NativeAccessSpecifierPublic)

View File

@ -78,9 +78,31 @@ SDK::APalPlayerState* config::GetPalPlayerState()
return static_cast<SDK::APalPlayerState*>(pPlayer->PlayerState);
}
bool GetTAllPlayers(SDK::TArray<class SDK::APalCharacter*>* 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<class SDK::APalCharacter*>* outResult)
{
SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager();
if (!mPal)
return false;
@ -88,9 +110,9 @@ bool GetTAllPlayers(SDK::TArray<class SDK::APalCharacter*>* outResult)
return true;
}
bool GetTAllImpNPC(SDK::TArray<class SDK::APalCharacter*>* outResult)
bool config::GetTAllImpNPC(SDK::TArray<class SDK::APalCharacter*>* outResult)
{
SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager();
SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager();
if (!mPal)
return false;
@ -98,9 +120,9 @@ bool GetTAllImpNPC(SDK::TArray<class SDK::APalCharacter*>* outResult)
return true;
}
bool GetTAllNPC(SDK::TArray<class SDK::APalCharacter*>* outResult)
bool config::GetTAllNPC(SDK::TArray<class SDK::APalCharacter*>* outResult)
{
SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager();
SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager();
if (!mPal)
return false;
@ -108,9 +130,9 @@ bool GetTAllNPC(SDK::TArray<class SDK::APalCharacter*>* outResult)
return true;
}
bool GetTAllPals(SDK::TArray<class SDK::APalCharacter*>* outResult)
bool config::GetTAllPals(SDK::TArray<class SDK::APalCharacter*>* outResult)
{
SDK::UPalCharacterImportanceManager* mPal = config::GetCharacterImpManager();
SDK::UPalCharacterImportanceManager* mPal = GetCharacterImpManager();
if (!mPal)
return false;
@ -118,6 +140,52 @@ bool GetTAllPals(SDK::TArray<class SDK::APalCharacter*>* outResult)
return true;
}
bool config::GetAllActorsofType(SDK::UClass* mType, std::vector<SDK::AActor*>* outArray, bool bLoopAllLevels, bool bSkipLocalPlayer)
{
SDK::UWorld* pWorld = Config.gWorld;
if (!pWorld)
return false;
SDK::AActor* pLocalPlayer = static_cast<SDK::AActor*>(GetPalPlayerCharacter());
std::vector<SDK::AActor*> result;
// Get Levels
SDK::TArray<SDK::ULevel*> pLevelsArray = pWorld->Levels;
__int32 levelsCount = pLevelsArray.Count();
// Loop Levels Array
for (int i = 0; i < levelsCount; i++)
{
if (!pLevelsArray.IsValidIndex(i))
continue;
SDK::TArray<SDK::AActor*> 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()
{

View File

@ -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<SDK::APalPlayerCharacter*> GetTAllPlayers();
static bool GetTAllPlayers(SDK::TArray<class SDK::APalCharacter*>* outResult);
static bool GetTAllImpNPC(SDK::TArray<class SDK::APalCharacter*>* outResult);
static bool GetTAllNPC(SDK::TArray<class SDK::APalCharacter*>* outResult);
static bool GetTAllPals(SDK::TArray<class SDK::APalCharacter*>* outResult);
static bool GetAllActorsofType(SDK::UClass* mType, std::vector<SDK::AActor*>* outArray, bool bLoopAllLevels = false , bool bSkipLocalPlayer = false);
static void Init();
static void Update(const char* filterText);
static const std::vector<std::string>& GetFilteredItems();

View File

@ -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<APalPlayerController*>(pLocalPlayer->Controller);
if (!pPlayerController)
return;
std::vector<AActor*> 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<float>(outScreen.X), static_cast<float>(outScreen.Y));
draw->AddText(screen, ImColor(color), data);
}
}
void DrawUActorComponent(SDK::TArray<SDK::UActorComponent*> 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<APalPlayerController*>(p_appc->Controller);
if (!p_apc)
return;
APalPlayerState* p_apps = static_cast<SDK::APalPlayerState*>(p_apc->PlayerState);
if (!p_apps)
return;
UPalPlayerInventoryData* InventoryData = p_apps->GetInventoryData();
if (!InventoryData)
return;
UPalItemContainerMultiHelper* InventoryMultiHelper = InventoryData->InventoryMultiHelper;
if (!InventoryMultiHelper)
return;
TArray<class SDK::UPalItemContainer*> 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);
}

View File

@ -5,11 +5,12 @@
void ESP();
void DrawUActorComponent(SDK::TArray<SDK::UActorComponent*> Comps,ImColor color);
void ESP_DEBUG(double mDist, SDK::UClass* mEntType = SDK::AActor::StaticClass());
void DrawUActorComponent(SDK::TArray<SDK::UActorComponent*> 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);
void RemoveAncientTechPoint(__int32 mPoints);
void AddToInventoryContainer(__int32 mCount, __int32 mIndex = 0);

View File

@ -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()