diff --git a/Project Reboot 3.0/FortGadgetItemDefinition.cpp b/Project Reboot 3.0/FortGadgetItemDefinition.cpp index 6b97e35..716ecec 100644 --- a/Project Reboot 3.0/FortGadgetItemDefinition.cpp +++ b/Project Reboot 3.0/FortGadgetItemDefinition.cpp @@ -25,8 +25,54 @@ void UFortGadgetItemDefinition::UpdateTrackedAttributesHook(UFortGadgetItemDefin { // LOG_INFO(LogDev, "UpdateTrackedAttributesHook Return: 0x{:x}", __int64(_ReturnAddress()) - __int64(GetModuleHandleW(0))); + return; + + AFortPlayerState* PlayerState = nullptr; // how do we get it bro.... + UAbilitySystemComponent* ASC = PlayerState->GetAbilitySystemComponent(); + if (GadgetItemDefinition->ShouldDestroyGadgetWhenTrackedAttributesIsZero()) { - // PlayerState->MulticastTriggerOnGadgetTrackedAttributeDestroyedFX + bool bIsEveryTrackedAttributeZero = true; + + for (int i = 0; i < GadgetItemDefinition->GetTrackedAttributes().Num(); i++) + { + auto& CurrentTrackedAttribute = GadgetItemDefinition->GetTrackedAttributes().at(i); + + // LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Property Name {}", i, GadgetItemDefinition->GetTrackedAttributes().at(i).GetAttributePropertyName()); + // LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Name {}", i, GadgetItemDefinition->GetTrackedAttributes().at(i).GetAttributeName()); + // LOG_INFO(LogDev, "[{}] TrackedAttribute Attribute Owner {}", i, GadgetItemDefinition->GetTrackedAttributes().at(i).AttributeOwner->GetPathName()); + + if (!ASC) + break; + + int CurrentAttributeValue = -1; + + for (int i = 0; i < ASC->GetSpawnedAttributes().Num(); i++) + { + auto CurrentSpawnedAttribute = ASC->GetSpawnedAttributes().at(i); + + if (CurrentSpawnedAttribute->IsA(CurrentTrackedAttribute.AttributeOwner)) + { + auto PropertyOffset = CurrentSpawnedAttribute->GetOffset(CurrentTrackedAttribute.GetAttributePropertyName()); + + if (PropertyOffset != -1) + { + if (CurrentSpawnedAttribute->GetPtr(PropertyOffset)->GetCurrentValue() != 0) + { + bIsEveryTrackedAttributeZero = false; + break; + } + } + } + } + } + + if (bIsEveryTrackedAttributeZero) + { + // REMOVE THE ITEM + + static auto MulticastTriggerOnGadgetTrackedAttributeDestroyedFXFn = FindObject("/Script/FortniteGame.FortPlayerStateZone.MulticastTriggerOnGadgetTrackedAttributeDestroyedFX"); + PlayerState->ProcessEvent(MulticastTriggerOnGadgetTrackedAttributeDestroyedFXFn, &GadgetItemDefinition); + } } } \ No newline at end of file diff --git a/Project Reboot 3.0/FortLootPackage.cpp b/Project Reboot 3.0/FortLootPackage.cpp index 432a6a9..b526a68 100644 --- a/Project Reboot 3.0/FortLootPackage.cpp +++ b/Project Reboot 3.0/FortLootPackage.cpp @@ -17,14 +17,19 @@ struct FFortGameFeatureLootTableData #ifdef EXPERIMENTAL_LOOTING template -void CollectDataTablesRows(std::vector DataTables, std::map* OutMap, std::function Check = []() { return true; }) +void CollectDataTablesRows(const std::vector& DataTables, std::map* OutMap, std::function Check = []() { return true; }) { std::vector DataTablesToIterate; - static auto CompositeDataTableClass = FindObject("/Script/Engine.CompositeDataTable"); + static auto CompositeDataTableClass = FindObject(L"/Script/Engine.CompositeDataTable"); - for (auto DataTable : DataTables) + for (UDataTable* DataTable : DataTables) { + if (!DataTable->IsValidLowLevel()) + { + continue; // Remove from vector? + } + // if (auto CompositeDataTable = Cast(DataTable)) if (DataTable->IsA(CompositeDataTableClass)) { diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index e307bd7..14d7d06 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -1476,11 +1476,67 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo return ClientOnPawnDiedOriginal(PlayerController, DeathReport); } +bool IsBuildingOkForEditing(ABuildingSMActor* BuildingActorToEdit) +{ + // we should check if these are valid ptrs but idk if it exists on every version and im too lazy to check + static auto EditModeSupportOffset = BuildingActorToEdit->GetOffset("EditModeSupport"); + static auto EditModePatternDataOffset = BuildingActorToEdit->GetOffset("EditModePatternData"); + + bool idkSomeAttachmentCheck = false; + + if (false) + { + // again idk if this is the same for every build + + static auto AttachmentPlacementBlockingActorsOffset = BuildingActorToEdit->GetOffset("AttachmentPlacementBlockingActors"); + auto& AttachmentPlacementBlockingActors = BuildingActorToEdit->Get>(AttachmentPlacementBlockingActorsOffset); + + // bro what + + /* auto AttachmentPlacementBlockingActorsIt = *AttachmentPlacementBlockingActors.Data; // hm? + auto v3 = &AttachmentPlacementBlockingActorsIt[AttachmentPlacementBlockingActors.Num()]; + if (AttachmentPlacementBlockingActors.Data == v3) + { + idkSomeAttachmentCheck = false; + } + else + { + bool bdid = false; + + while (!*AttachmentPlacementBlockingActors) + { + if (++AttachmentPlacementBlockingActors == v3) + { + idkSomeAttachmentCheck = false; + bdid = true; + break; + } + } + + if (!bdid) + idkSomeAttachmentCheck = true; + } */ + } + + // some other stuff to but too much + + return BuildingActorToEdit->IsPlayerBuildable() && !idkSomeAttachmentCheck; +} + void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit) { if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks. return; + if (BuildingActorToEdit->GetEditingPlayer() && BuildingActorToEdit->GetEditingPlayer() != PlayerController->GetPlayerState()) + return; + + if (BuildingActorToEdit->IsDestroyed() /* || !BuildingActorToEdit->GetWorld() */) + return; + + if (!IsBuildingOkForEditing(BuildingActorToEdit)) + return; + auto Pawn = PlayerController->GetMyFortPawn(); if (!Pawn) @@ -1536,10 +1592,10 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame // LOG_INFO(LogDev, "RotationIterations: {}", RotationIterations); - if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->IsDestroyed() || BuildingActorToEdit->GetEditingPlayer() != PlayerState) + if (!BuildingActorToEdit /* || !BuildingActorToEdit->GetWorld() */ || BuildingActorToEdit->GetEditingPlayer() != PlayerState || BuildingActorToEdit->IsDestroyed()) { - LOG_INFO(LogDev, "Cheater?"); - LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit)); + // LOG_INFO(LogDev, "Cheater?"); + // LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit)); return ServerEditBuildingActorOriginal(Context, Stack, Ret); } @@ -1557,7 +1613,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame BuildingActor->SetPlayerPlaced(true); } - // we should do more things here + // we should do more things here but it might just be challenge related things return ServerEditBuildingActorOriginal(Context, Stack, Ret); } @@ -1589,9 +1645,6 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl auto EditTool = Cast(Pawn->GetCurrentWeapon()); - BuildingActorToStopEditing->GetEditingPlayer() = nullptr; - // BuildingActorToStopEditing->OnRep_EditingPlayer(); - if (EditTool) { EditTool->GetEditActor() = nullptr; diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index ce2009b..c1c6669 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -550,27 +550,22 @@ std::vector Addresses::GetFunctionsToNull() toNull.push_back(Memcury::Scanner::FindPattern("40 55 57 41 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 80 3D ? ? ? ? ? 0F B6 FA 44 8B F9 74 3B 80 3D ? ? ? ? ? 0F").Get()); } - if (std::floor(Fortnite_Version) == 16) - { - toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 49 8B D9 45 8A F8 4C 8B F2 48").Get()); // no reservation in gakme - } - if (std::floor(Fortnite_Version) == 17) { // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 70 08 48 89 78 10 55 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 ED").Get()); // collectgarbage } - if (Fortnite_Version == 17.50) - { - toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 49 8B D9 45 8A").Get()); // no reservation in game - } - if (Engine_Version == 500) { // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45").Get()); // GC } + if (Engine_Version >= 426) + { + toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 49 8B D9 45 8A").Get()); // No reserve + } + toNull.push_back(Addresses::ChangeGameSessionId); return toNull; diff --git a/Project Reboot 3.0/commands.h b/Project Reboot 3.0/commands.h index f37b578..6629fb5 100644 --- a/Project Reboot 3.0/commands.h +++ b/Project Reboot 3.0/commands.h @@ -201,12 +201,6 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg) if (bShouldUpdate) WorldInventory->Update(); - auto GameState = Cast(GetWorld()->GetGameState()); - - auto ItemLevel = UFortLootLevel::GetItemLevel(WID->GetLootLevelData(), GameState->GetWorldLevel()); - - LOG_INFO(LogDev, "ItemLevel: {}", ItemLevel); - LOG_INFO(LogDev, "PickLevel: {}", WID->PickLevel(ItemLevel)); SendMessageToConsole(PlayerController, L"Granted item!"); } else if (Command == "printsimulatelootdrops")