diff --git a/config.h b/config.h index d17412a..9ac3be4 100644 --- a/config.h +++ b/config.h @@ -43,6 +43,8 @@ public: SDK::TArray AllPlayers = {}; SDK::UPalCharacterImportanceManager* UCIM = NULL; SDK::UObject* WorldContextObject = NULL; + int AddItemSlot = 0; + int AddItemCount = 2; enum QuickItemSet { diff --git a/feature.cpp b/feature.cpp index df8ee2c..9f3960e 100644 --- a/feature.cpp +++ b/feature.cpp @@ -41,5 +41,74 @@ void DrawUActorComponent(SDK::TArray Comps,ImColor color) } } } - +} + + +void AddToInventoryContainer(__int32 mCount, __int32 mIndex) +{ + SDK::APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter(); + if (!p_appc != NULL) + return; + + SDK::APalPlayerController* p_apc = static_cast(p_appc->Controller); + if (!p_apc) + return; + + SDK::APalPlayerState* p_apps = static_cast(p_apc->PlayerState); + if (!p_apps) + return; + + SDK::UPalPlayerInventoryData* InventoryData = p_apps->GetInventoryData(); + if (!InventoryData) + return; + + SDK::UPalItemContainerMultiHelper* InventoryMultiHelper = InventoryData->InventoryMultiHelper; + if (!InventoryMultiHelper) + return; + + SDK::TArray Containers = InventoryMultiHelper->Containers; + if (Containers.Num() <= 0) + return; + + SDK::UPalItemSlot* pSelectedSlot = Containers[0]->Get(mIndex); + + if (!pSelectedSlot != NULL) + return; + + SDK::FPalItemId FirstItemId = pSelectedSlot->GetItemId(); + int32 StackCount = pSelectedSlot->GetStackCount(); + __int32 mNewCount = StackCount += mCount; + InventoryData->RequestAddItem(FirstItemId.StaticId, mNewCount, true); +} + + +void UnlockAllEffigies() { + SDK::APalPlayerCharacter* pPalCharacter = Config.GetPalPlayerCharacter(); + if (!pPalCharacter) + return; + + SDK::UWorld* world = Config.GetUWorld(); + if (!world) + return; + + SDK::TUObjectArray* objects = world->GObjects; + + for (int i = 0; i < objects->NumElements; ++i) { + SDK::UObject* object = objects->GetByIndex(i); + + if (!object) { + continue; + } + + if (!object->IsA(SDK::APalLevelObjectRelic::StaticClass())) { + continue; + } + + SDK::APalLevelObjectObtainable* relic = (SDK::APalLevelObjectObtainable*)object; + if (!relic) { + continue; + } + + ((SDK::APalPlayerState*)pPalCharacter->PlayerState)->RequestObtainLevelObject_ToServer(relic); + } } diff --git a/feature.h b/feature.h index 54d6ce2..fbf8cd9 100644 --- a/feature.h +++ b/feature.h @@ -7,5 +7,7 @@ void ESP(); void DrawUActorComponent(SDK::TArray Comps,ImColor color); -void DrawPosition(); +void UnlockAllEffigies(); + +void AddToInventoryContainer(__int32 mCount, __int32 mIndex = 0); diff --git a/src/Menu.cpp b/src/Menu.cpp index 8833396..7d074fe 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -265,69 +265,20 @@ namespace DX11_Base { } } - if (ImGui::Button("Give x2 first item", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) + ImGui::InputInt("Slot to modify (start 0):", &Config.AddItemSlot); + ImGui::InputInt("Multiple of how much:", &Config.AddItemCount); + + // this does not work lol + // std::stringstream AddItemsString; + // AddItemsString << "Give " << Config.AddItemCount << " items from slot" << Config.AddItemSlot; + if (ImGui::Button("Give items from slot", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) { - SDK::APalPlayerCharacter* p_appc = Config.GetPalPlayerCharacter(); - if (p_appc != NULL) - { - if (Config.GetPalPlayerCharacter()->GetPalPlayerController() != NULL) - { - if (Config.GetPalPlayerCharacter()->GetPalPlayerController()->GetPalPlayerState() != NULL) - { - SDK::UPalPlayerInventoryData* InventoryData = Config.GetPalPlayerCharacter()->GetPalPlayerController()->GetPalPlayerState()->GetInventoryData(); - if (InventoryData != NULL) { - SDK::UPalItemContainerMultiHelper* InventoryMultiHelper = InventoryData->InventoryMultiHelper; - if (InventoryMultiHelper != NULL) { - SDK::TArray Containers = InventoryMultiHelper->Containers; - if (Containers.Num() == 0) { - return; - } - - SDK::UPalItemSlot* FirstSlot = Containers[0]->Get(0); - - if (FirstSlot != NULL) - { - SDK::FPalItemId FirstItemId = FirstSlot->GetItemId(); - int32 StackCount = FirstSlot->GetStackCount(); - InventoryData->RequestAddItem(FirstItemId.StaticId, StackCount * 2, true); - } - } - } - } - } - } + AddToInventoryContainer(Config.AddItemCount, Config.AddItemSlot); } - if (ImGui::Button("All Effigies", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) + if (ImGui::Button("Unlock All Effigies", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) { - SDK::APalPlayerCharacter* pPalCharacter = Config.GetPalPlayerCharacter(); - if (!pPalCharacter) - return; - - SDK::UWorld* world = Config.GetUWorld(); - if (!world) - return; - - SDK::TUObjectArray* objects = world->GObjects; - - for (int i = 0; i < objects->NumElements; ++i) { - SDK::UObject* object = objects->GetByIndex(i); - - if (!object) { - continue; - } - - if (!object->IsA(SDK::APalLevelObjectRelic::StaticClass())) { - continue; - } - - SDK::APalLevelObjectObtainable* relic = (SDK::APalLevelObjectObtainable*)object; - if (!relic) { - continue; - } - - ((SDK::APalPlayerState*)pPalCharacter->PlayerState)->RequestObtainLevelObject_ToServer(relic); - } + UnlockAllEffigies(); } ////ImGui::InputText("Pal Name", Config.PalName, sizeof(Config.PalName));