diff --git a/Project Reboot 3.0/FortPickup.cpp b/Project Reboot 3.0/FortPickup.cpp index c268e8a..b717907 100644 --- a/Project Reboot 3.0/FortPickup.cpp +++ b/Project Reboot 3.0/FortPickup.cpp @@ -61,7 +61,10 @@ AFortPickup* AFortPickup::SpawnPickup(UFortItemDefinition* ItemDef, FVector Loca char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) { - // LOG_INFO(LogDev, "Woah!"); + constexpr bool bTestPrinting = false; // we could just use our own logger but eh + + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "CompletePickupAnimationHook!"); auto Pawn = Cast(Pickup->GetPickupLocationData()->GetPickupTarget()); @@ -92,10 +95,10 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) auto ItemInstanceToSwap = WorldInventory->FindItemInstance(CurrentItemGuid); - if (!ItemInstanceToSwap) - return CompletePickupAnimationOriginal(Pickup); + // if (!ItemInstanceToSwap) + // return CompletePickupAnimationOriginal(Pickup); - auto ItemEntryToSwap = ItemInstanceToSwap->GetItemEntry(); + auto ItemEntryToSwap = ItemInstanceToSwap ? ItemInstanceToSwap->GetItemEntry() : nullptr; auto ItemDefinitionToSwap = ItemEntryToSwap ? Cast(ItemEntryToSwap->GetItemDefinition()) : nullptr; bool bHasSwapped = false; @@ -105,6 +108,9 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) auto ItemDefGoingInPrimary = IsPrimaryQuickbar(PickupItemDefinition); std::vector> PairsToMarkDirty; // vector of sets or something so no duplicates?? + + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "Start cpyCount: {}", cpyCount); bool bForceOverflow = false; @@ -126,6 +132,8 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) PrimarySlotsFilled++; } + // LOG_INFO(LogDev, "[{}] PrimarySlotsFilled: {}", i, PrimarySlotsFilled); + bIsInventoryFull = (PrimarySlotsFilled /* - 6 */) >= 5; if (bIsInventoryFull) // probs shouldnt do in loop but alr @@ -139,12 +147,18 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) bHasSwapped = true; + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "[{}] Swapping: {}", i, ItemDefinitionToSwap->GetFullName()); + continue; // ??? } } if (CurrentItemEntry->GetItemDefinition() == PickupItemDefinition) { + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "[{}] Found stack of item!", i); + if (CurrentItemEntry->GetCount() < PickupItemDefinition->GetMaxStackSize()) { int OverStack = CurrentItemEntry->GetCount() + cpyCount - PickupItemDefinition->GetMaxStackSize(); @@ -158,6 +172,9 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) bEverStacked = true; + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "[{}] We are stacking {}.", i, AmountToStack); + // if (cpyCount > 0) // break; } @@ -167,6 +184,9 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) if ((bIsInventoryFull || bForceOverflow) && cpyCount > 0) // overflow { + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "[{}] Overflow", i); + UFortWorldItemDefinition* ItemDefinitionToSpawn = PickupItemDefinition; int AmountToSpawn = cpyCount > PickupItemDefinition->GetMaxStackSize() ? PickupItemDefinition->GetMaxStackSize() : cpyCount; @@ -181,6 +201,9 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) if (cpyCount > 0 && !bIsInventoryFull) { + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "Attempting to add to inventory."); + if (bDoesStackExist ? PickupItemDefinition->DoesAllowMultipleStacks() : true) { auto NewItemCount = cpyCount > PickupItemDefinition->GetMaxStackSize() ? PickupItemDefinition->GetMaxStackSize() : cpyCount; @@ -188,6 +211,9 @@ char AFortPickup::CompletePickupAnimationHook(AFortPickup* Pickup) auto NewItem = WorldInventory->AddItem(PickupItemDefinition, nullptr, NewItemCount, PickupEntry->GetLoadedAmmo(), true); + if constexpr (bTestPrinting) + LOG_INFO(LogDev, "Added item with count {} to inventory.", NewItemCount); + // if (NewItem) cpyCount -= NewItemCount; } diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 81c69ca..67f923a 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -985,19 +985,22 @@ static inline uint64 FindPickTeam() { if (Engine_Version == 426) { - auto testAddr = Memcury::Scanner::FindPattern("88 54 24 10 53 56 41 54 41 55 41 56 48 83 EC 60 4C 8B A1").Get(); // 14.60 ???? + auto testAddr = Memcury::Scanner::FindPattern("88 54 24 10 53 56 41 54 41 55 41 56 48 83 EC 60 4C 8B A1").Get(); // 14.60 what is happening lol ???? if (testAddr) return testAddr; } + else if (Engine_Version == 500) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 88 54 24 10 55 56 57 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 70 45 33 ED 4D").Get(); // 19.10 + else if (Engine_Version >= 427) // different start return Memcury::Scanner::FindPattern("48 89 5C 24 ? 88 54 24 10 55 56 57 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 70 4C 8B A1").Get(); - auto Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%d]", false); + auto Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%d]", false, 0, Engine_Version >= 427); // todo check if its just s18+ but this doesn't matter for now cuz we hardcode sig if (!Addr.Get()) - Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%s]"); + Addr = Memcury::Scanner::FindStringRef(L"PickTeam for [%s] used beacon value [%s]"); // i don't even know what version this is return FindBytes(Addr, Fortnite_Version <= 2.5 ? std::vector{ 0x48, 0x89, 0x6C } : std::vector{ 0x40, 0x55 }, 1000, 0, true); } diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index eebbab3..b7dd082 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -101,7 +101,7 @@ inline __int64 GetFunctionIdxOrPtr(UFunction* Function) if ((*(uint8_t*)(NativeAddr + i) == 0x41 && *(uint8_t*)(NativeAddr + i + 1) == 0xFF)) // wtf ue500 { - LOG_INFO(LogDev, "Uhhhhhh report this to milxnor if u not on 19.10 {}", Function->GetName()); + LOG_INFO(LogDev, "Uhhhhhh report this to milxnor if u not on 18.40+ {}", Function->GetName()); bFoundValidate = true; continue; } diff --git a/Project Reboot 3.0/reboot.h b/Project Reboot 3.0/reboot.h index 5029543..4219609 100644 --- a/Project Reboot 3.0/reboot.h +++ b/Project Reboot 3.0/reboot.h @@ -347,6 +347,8 @@ static UObject* GetPlaylistToUse() // Playlist = FindObject("/MoleGame/Playlists/Playlist_MoleGame.Playlist_MoleGame"); // Playlist = FindObject("/Game/Athena/Playlists/DADBRO/Playlist_DADBRO_Squads_8.Playlist_DADBRO_Squads_8"); + Playlist = FindObject("/Game/Athena/Playlists/Playlist_DefaultDuo.Playlist_DefaultDuo"); + if (Globals::bCreative) Playlist = FindObject("/Game/Athena/Playlists/Creative/Playlist_PlaygroundV2.Playlist_PlaygroundV2"); diff --git a/README.md b/README.md index 2911323..1681bc2 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,7 @@ F7 - Start event F8 - Start Aircraft + +## TODO + +- Rewrite picking up code. \ No newline at end of file