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 6446db4..7d074fe 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -264,6 +264,23 @@ namespace DX11_Base { } } } + + 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))) + { + AddToInventoryContainer(Config.AddItemCount, Config.AddItemSlot); + } + + if (ImGui::Button("Unlock All Effigies", ImVec2(ImGui::GetWindowContentRegionWidth() - 3, 20))) + { + UnlockAllEffigies(); + } + ////ImGui::InputText("Pal Name", Config.PalName, sizeof(Config.PalName)); // //if (!Config.IsMonster){ImGui::InputInt("Pal Rank", &Config.PalRank);} // //if (Config.IsMonster) { ImGui::InputInt("Pal Count", &Config.PalNum); }