Merge pull request #23 from BennettStaley/master

add all effigies and ability to multiply item slots.
This commit is contained in:
swordbluesword 2024-01-27 15:00:24 +08:00 committed by GitHub
commit dda1bc40c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 92 additions and 2 deletions

View File

@ -43,6 +43,8 @@ public:
SDK::TArray<SDK::APalPlayerCharacter*> AllPlayers = {};
SDK::UPalCharacterImportanceManager* UCIM = NULL;
SDK::UObject* WorldContextObject = NULL;
int AddItemSlot = 0;
int AddItemCount = 2;
enum QuickItemSet
{

View File

@ -41,5 +41,74 @@ void DrawUActorComponent(SDK::TArray<SDK::UActorComponent*> 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<SDK::APalPlayerController*>(p_appc->Controller);
if (!p_apc)
return;
SDK::APalPlayerState* p_apps = static_cast<SDK::APalPlayerState*>(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<class SDK::UPalItemContainer*> 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);
}
}

View File

@ -7,5 +7,7 @@ void ESP();
void DrawUActorComponent(SDK::TArray<SDK::UActorComponent*> Comps,ImColor color);
void DrawPosition();
void UnlockAllEffigies();
void AddToInventoryContainer(__int32 mCount, __int32 mIndex = 0);

View File

@ -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); }