diff --git a/Project Reboot 3.0/FortDecoItemDefinition.cpp b/Project Reboot 3.0/FortDecoItemDefinition.cpp new file mode 100644 index 0000000..9eb391a --- /dev/null +++ b/Project Reboot 3.0/FortDecoItemDefinition.cpp @@ -0,0 +1,7 @@ +#include "FortDecoItemDefinition.h" + +static UClass* StaticClass() +{ + static auto ptr = FindObject("/Script/FortniteGame.FortDecoItemDefinition"); + return ptr; +} \ No newline at end of file diff --git a/Project Reboot 3.0/FortDecoItemDefinition.h b/Project Reboot 3.0/FortDecoItemDefinition.h new file mode 100644 index 0000000..09fdf17 --- /dev/null +++ b/Project Reboot 3.0/FortDecoItemDefinition.h @@ -0,0 +1,10 @@ +#pragma once + +#include "FortWeaponItemDefinition.h" + +class UFortDecoItemDefinition : public UFortWeaponItemDefinition +{ +public: + + static UClass* StaticClass(); +}; \ No newline at end of file diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index 97f49a2..e41dd36 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -73,6 +73,12 @@ static void StreamLevel(std::string LevelName, FVector Location = {}) Transform.Translation = Location; auto BuildingFoundation = GetWorld()->SpawnActor(BuildingFoundation3x3Class, Transform); + if (!BuildingFoundation) + { + LOG_ERROR(LogGame, "Failed to spawn BuildingFoundation for streaming!"); + return; + } + BuildingFoundation->InitializeBuildingActor(BuildingFoundation, nullptr, false); static auto FoundationNameOffset = FindOffsetStruct("/Script/FortniteGame.BuildingFoundationStreamingData", "FoundationName"); @@ -150,150 +156,160 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game { LastNum2 = AmountOfRestarts; + LOG_INFO(LogDev, "Presetup!"); + GameMode->Get("WarmupRequiredPlayerCount") = 1; - SetPlaylist(GetPlaylistToUse()); + { + SetPlaylist(GetPlaylistToUse()); + LOG_INFO(LogDev, "Set playlist!"); + } - auto Fortnite_Season = std::floor(Fortnite_Version); - - if (Fortnite_Season == 6) + // if (false) { - if (Fortnite_Version != 6.10) + auto Fortnite_Season = std::floor(Fortnite_Version); + + if (Fortnite_Season == 6) { - auto Lake = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake1")); - auto Lake2 = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake2"); - - Fortnite_Version <= 6.21 ? ShowFoundation(Lake) : ShowFoundation(Lake2); - // ^ This shows the lake after or before the event i dont know if this is needed. - } - else - { - auto Lake = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest12")); - ShowFoundation(Lake); - } - - auto FloatingIsland = Fortnite_Version == 6.10 ? FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest13")) : - FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_FloatingIsland")); - - ShowFoundation(FloatingIsland); - } - - if (Fortnite_Season >= 7 && Fortnite_Season <= 10) - { - if (Fortnite_Season == 7) - { - if (Fortnite_Version == 7.30) + if (Fortnite_Version != 6.10) { - auto PleasantParkIdk = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkFestivus")); - ShowFoundation(PleasantParkIdk); + auto Lake = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake1")); + auto Lake2 = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Lake2"); - auto PleasantParkGround = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkDefault"); - ShowFoundation(PleasantParkGround); + Fortnite_Version <= 6.21 ? ShowFoundation(Lake) : ShowFoundation(Lake2); + // ^ This shows the lake after or before the event i dont know if this is needed. + } + else + { + auto Lake = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest12")); + ShowFoundation(Lake); } - auto PolarPeak = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_POI_25x36")); - ShowFoundation(PolarPeak); + auto FloatingIsland = Fortnite_Version == 6.10 ? FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest13")) : + FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_FloatingIsland")); - auto tiltedtower = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.ShopsNew"); - ShowFoundation(tiltedtower); // 7.40 specific? + ShowFoundation(FloatingIsland); } - else if (Fortnite_Season == 8) + if (Fortnite_Season >= 7 && Fortnite_Season <= 10) { - auto Volcano = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_POI_50x53_Volcano")); - ShowFoundation(Volcano); - } - - else if (Fortnite_Season == 10) - { - if (Fortnite_Version >= 10.20) + if (Fortnite_Season == 7) { - auto Island = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest16"); - ShowFoundation(Island); + if (Fortnite_Version == 7.30) + { + auto PleasantParkIdk = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkFestivus")); + ShowFoundation(PleasantParkIdk); + + auto PleasantParkGround = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.PleasentParkDefault"); + ShowFoundation(PleasantParkGround); + } + + auto PolarPeak = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_POI_25x36")); + ShowFoundation(PolarPeak); + + auto tiltedtower = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.ShopsNew"); + ShowFoundation(tiltedtower); // 7.40 specific? } + + else if (Fortnite_Season == 8) + { + auto Volcano = FindObject(("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_POI_50x53_Volcano")); + ShowFoundation(Volcano); + } + + else if (Fortnite_Season == 10) + { + if (Fortnite_Version >= 10.20) + { + auto Island = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.LF_Athena_StreamingTest16"); + ShowFoundation(Island); + } + } + + auto TheBlock = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank + ShowFoundation(TheBlock); } - auto TheBlock = FindObject("/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank - ShowFoundation(TheBlock); - } + if (Fortnite_Version == 17.50f) { + auto FarmAfter = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.farmbase_2")); + ShowFoundation(FarmAfter); - if (Fortnite_Version == 17.50f) { - auto FarmAfter = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.farmbase_2")); - ShowFoundation(FarmAfter); + auto FarmPhase = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.Farm_Phase_03")); // Farm Phases (Farm_Phase_01, Farm_Phase_02 and Farm_Phase_03) + ShowFoundation(FarmPhase); + } - auto FarmPhase = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.Farm_Phase_03")); // Farm Phases (Farm_Phase_01, Farm_Phase_02 and Farm_Phase_03) - ShowFoundation(FarmPhase); - } + if (Fortnite_Version == 17.40f) { + auto AbductedCoral = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.CoralPhase_02")); // Coral Castle Phases (CoralPhase_01, CoralPhase_02 and CoralPhase_03) + ShowFoundation(AbductedCoral); - if (Fortnite_Version == 17.40f) { - auto AbductedCoral = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.CoralPhase_02")); // Coral Castle Phases (CoralPhase_01, CoralPhase_02 and CoralPhase_03) - ShowFoundation(AbductedCoral); + auto CoralFoundation_01 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation_0")); + ShowFoundation(CoralFoundation_01); - auto CoralFoundation_01 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation_0")); - ShowFoundation(CoralFoundation_01); + auto CoralFoundation_05 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation6")); + ShowFoundation(CoralFoundation_05); - auto CoralFoundation_05 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation6")); - ShowFoundation(CoralFoundation_05); + auto CoralFoundation_07 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation3")); + ShowFoundation(CoralFoundation_07); - auto CoralFoundation_07 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation3")); - ShowFoundation(CoralFoundation_07); + auto CoralFoundation_10 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation2_1")); + ShowFoundation(CoralFoundation_10); - auto CoralFoundation_10 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation2_1")); - ShowFoundation(CoralFoundation_10); + auto CoralFoundation_13 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation4")); + ShowFoundation(CoralFoundation_13); - auto CoralFoundation_13 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation4")); - ShowFoundation(CoralFoundation_13); + auto CoralFoundation_17 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation5")); + ShowFoundation(CoralFoundation_17); + } - auto CoralFoundation_17 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.LF_Athena_16x16_Foundation5")); - ShowFoundation(CoralFoundation_17); - } + if (Fortnite_Version == 17.30f) { + auto AbductedSlurpy = FindObject(("LF_Athena_POI_50x50_C /Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.Slurpy_Phase03")); // Slurpy Swamp Phases (Slurpy_Phase01, Slurpy_Phase02 and Slurpy_Phase03) + ShowFoundation(AbductedSlurpy); + } - if (Fortnite_Version == 17.30f) { - auto AbductedSlurpy = FindObject(("LF_Athena_POI_50x50_C /Game/Athena/Apollo/Maps/Apollo_Mother.Apollo_Mother.PersistentLevel.Slurpy_Phase03")); // Slurpy Swamp Phases (Slurpy_Phase01, Slurpy_Phase02 and Slurpy_Phase03) - ShowFoundation(AbductedSlurpy); - } - - if (Fortnite_Season == 13) - { - auto SpawnIsland = FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation"); - ShowFoundation(SpawnIsland); - - // SpawnIsland->RepData->Soemthing = FoundationSetup->LobbyLocation; - } - - if (Fortnite_Version == 12.41) - { - auto JS03 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.LF_Athena_POI_19x19_2")); - ShowFoundation(JS03); - - auto JH00 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head6_18")); - ShowFoundation(JH00); - - auto JH01 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head5_14")); - ShowFoundation(JH01); - - auto JH02 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head3_8")); - ShowFoundation(JH02); - - auto JH03 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head_2")); - ShowFoundation(JH03); - - auto JH04 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head4_11")); - ShowFoundation(JH04); - } - - auto PlaylistToUse = GetPlaylistToUse(); - - if (PlaylistToUse) - { - static auto AdditionalLevelsOffset = PlaylistToUse->GetOffset("AdditionalLevels"); - auto& AdditionalLevels = PlaylistToUse->Get>>(AdditionalLevelsOffset); - - for (int i = 0; i < AdditionalLevels.Num(); i++) + if (Fortnite_Season == 13) { - // auto World = Cast(Playlist->AdditionalLevels[i].Get()); - // StreamLevel(UKismetSystemLibrary::GetPathName(World->PersistentLevel).ToString()); - StreamLevel(AdditionalLevels.at(i).SoftObjectPtr.ObjectID.AssetPathName.ToString()); + auto SpawnIsland = FindObject("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation"); + ShowFoundation(SpawnIsland); + + // SpawnIsland->RepData->Soemthing = FoundationSetup->LobbyLocation; + } + + if (Fortnite_Version == 12.41) + { + auto JS03 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.LF_Athena_POI_19x19_2")); + ShowFoundation(JS03); + + auto JH00 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head6_18")); + ShowFoundation(JH00); + + auto JH01 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head5_14")); + ShowFoundation(JH01); + + auto JH02 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head3_8")); + ShowFoundation(JH02); + + auto JH03 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head_2")); + ShowFoundation(JH03); + + auto JH04 = FindObject(("/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.BP_Jerky_Head4_11")); + ShowFoundation(JH04); + } + + auto PlaylistToUse = GetPlaylistToUse(); + + if (PlaylistToUse) + { + static auto AdditionalLevelsOffset = PlaylistToUse->GetOffset("AdditionalLevels"); + auto& AdditionalLevels = PlaylistToUse->Get>>(AdditionalLevelsOffset); + + LOG_INFO(LogPlaylist, "Loading {} playlist levels.", AdditionalLevels.Num()); + + for (int i = 0; i < AdditionalLevels.Num(); i++) + { + // auto World = Cast(Playlist->AdditionalLevels[i].Get()); + // StreamLevel(UKismetSystemLibrary::GetPathName(World->PersistentLevel).ToString()); + StreamLevel(AdditionalLevels.at(i).SoftObjectPtr.ObjectID.AssetPathName.ToString()); + } } } } @@ -320,14 +336,18 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game { LastNum5 = AmountOfRestarts; - bool bb; - CallOnReadys(&bb); + if (Globals::bGoingToPlayEvent) + { + bool bb; + CallOnReadys(&bb); - if (!bb) - LastNum5 = -1; + if (!bb) + LastNum5 = -1; + } } - /* static auto FortPlayerStartWarmupClass = FindObject("/Script/FortniteGame.FortPlayerStartWarmup"); + /* + static auto FortPlayerStartWarmupClass = FindObject("/Script/FortniteGame.FortPlayerStartWarmup"); TArray Actors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FortPlayerStartWarmupClass); int ActorsNum = Actors.Num(); @@ -335,7 +355,15 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game Actors.Free(); if (ActorsNum == 0) - return false; */ + return false; + */ + + static int LastNum9 = 1; + + if (AmountOfRestarts != LastNum9) + { + LastNum9 = AmountOfRestarts; + } static auto MapInfoOffset = GameState->GetOffset("MapInfo"); auto MapInfo = GameState->Get(MapInfoOffset); @@ -351,6 +379,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game { LastNum3 = AmountOfRestarts; + LOG_INFO(LogNet, "Attempting to listen!"); + GetWorld()->Listen(); SetBitfield(GameMode->GetPtr("bWorldIsReady"), 1, true); @@ -374,11 +404,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game float TimeSeconds = 35.f; // UGameplayStatics::GetTimeSeconds(GetWorld()); - if (Engine_Version >= 424) - { - GameState->GetGamePhase() = EAthenaGamePhase::Warmup; - GameState->OnRep_GamePhase(); - } + LOG_INFO(LogDev, "Initializing!"); GameState->Get("WarmupCountdownEndTime") = TimeSeconds + Duration; GameMode->Get("WarmupCountdownDuration") = Duration; @@ -386,7 +412,9 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game GameState->Get("WarmupCountdownStartTime") = TimeSeconds; GameMode->Get("WarmupEarlyCountdownDuration") = EarlyDuration; - GameState->OnRep_CurrentPlaylistInfo(); + // GameState->Get("bGameModeWillSkipAircraft") = Globals::bGoingToPlayEvent && Fortnite_Version == 17.30; + + // GameState->OnRep_CurrentPlaylistInfo(); LOG_INFO(LogDev, "Initialized!"); } @@ -426,6 +454,18 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena if (!NewPlayerActor) return; + static bool bFirst = Engine_Version >= 424; + + auto GameState = GameMode->GetGameStateAthena(); + + if (bFirst) + { + bFirst = false; + + GameState->GetGamePhase() = EAthenaGamePhase::Warmup; + GameState->OnRep_GamePhase(); + } + auto SpawnIsland_FloorLoot = FindObject("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_Warmup.Tiered_Athena_FloorLoot_Warmup_C"); auto BRIsland_FloorLoot = FindObject("/Game/Athena/Environments/Blueprints/Tiered_Athena_FloorLoot_01.Tiered_Athena_FloorLoot_01_C"); @@ -493,8 +533,6 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena } } - auto GameState = GameMode->GetGameStateAthena(); - auto NewPlayer = (AFortPlayerControllerAthena*)NewPlayerActor; auto WorldInventory = NewPlayer->GetWorldInventory(); @@ -557,7 +595,7 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena PlayerStateAthena->ProcessEvent(OnRep_bHasStartedPlayingFn); } - // if (false) + if (false) { static auto GameplayAbilitySet = LoadObject(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") ? LoadObject(L"/Game/Abilities/Player/Generic/Traits/DefaultPlayer/GAS_AthenaPlayer.GAS_AthenaPlayer") : diff --git a/Project Reboot 3.0/FortPawn.cpp b/Project Reboot 3.0/FortPawn.cpp index 2b30644..32d7d76 100644 --- a/Project Reboot 3.0/FortPawn.cpp +++ b/Project Reboot 3.0/FortPawn.cpp @@ -12,6 +12,15 @@ AFortWeapon* AFortPawn::EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponD return params.Wep; } +bool AFortPawn::PickUpActor(AActor* PickupTarget, UFortDecoItemDefinition* PlacementDecoItemDefinition) +{ + static auto fn = FindObject("/Script/FortniteGame.FortPawn.PickUpActor"); + struct { AActor* PickupTarget; UFortDecoItemDefinition* PlacementDecoItemDefinition; bool ReturnValue; } AFortPawn_PickUpActor_Params{ PickupTarget, PlacementDecoItemDefinition }; + this->ProcessEvent(fn, &AFortPawn_PickUpActor_Params); + + return AFortPawn_PickUpActor_Params.ReturnValue; +} + UClass* AFortPawn::StaticClass() { static auto Class = FindObject("/Script/FortniteGame.FortPawn"); diff --git a/Project Reboot 3.0/FortPawn.h b/Project Reboot 3.0/FortPawn.h index ead910a..495f1ce 100644 --- a/Project Reboot 3.0/FortPawn.h +++ b/Project Reboot 3.0/FortPawn.h @@ -2,12 +2,13 @@ #include "Pawn.h" #include "FortWeapon.h" -#include "FortWeaponItemDefinition.h" +#include "FortDecoItemDefinition.h" class AFortPawn : public APawn { public: AFortWeapon* EquipWeaponDefinition(UFortWeaponItemDefinition* WeaponData, const FGuid& ItemEntryGuid); + bool PickUpActor(AActor* PickupTarget, UFortDecoItemDefinition* PlacementDecoItemDefinition); AFortWeapon*& GetCurrentWeapon() { diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 57c5370..194adff 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -20,8 +20,46 @@ void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor this->ProcessEvent(fn, &AFortPlayerController_ClientReportDamagedResourceBuilding_Params); } +void AFortPlayerController::ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid) +{ + auto ItemInstance = PlayerController->GetWorldInventory()->FindItemInstance(ItemGuid); + auto Pawn = Cast(PlayerController->GetPawn()); + + if (!ItemInstance || !Pawn) + return; + + auto ItemDefinition = ItemInstance->GetItemEntry()->GetItemDefinition(); + + if (auto DecoItemDefinition = Cast(ItemDefinition)) + { + Pawn->PickUpActor(nullptr, DecoItemDefinition); // todo check ret value? + Pawn->GetCurrentWeapon()->GetItemEntryGuid() = ItemGuid; + + static auto FortDecoTool_ContextTrapStaticClass = FindObject("/Script/FortniteGame.FortDecoTool_ContextTrap"); + + if (Pawn->GetCurrentWeapon()->IsA(FortDecoTool_ContextTrapStaticClass)) + { + static auto ContextTrapItemDefinitionOffset = Pawn->GetCurrentWeapon()->GetOffset("ContextTrapItemDefinition"); + Pawn->GetCurrentWeapon()->Get(ContextTrapItemDefinitionOffset) = DecoItemDefinition; + } + + return; + } + + if (!ItemDefinition) + return; + + if (auto Weapon = Pawn->EquipWeaponDefinition((UFortWeaponItemDefinition*)ItemDefinition, ItemInstance->GetItemEntry()->GetItemGuid())) + { + + } + + void AFortPlayerController::ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation) { + if (Fortnite_Version == 17.30 && Globals::bGoingToPlayEvent) + return; // We want to be teleported back to the UFO but we dont use chooseplayerstart + auto PlayerController = Cast(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner()); LOG_INFO(LogDev, "PlayerController: {}", __int64(PlayerController)); diff --git a/Project Reboot 3.0/FortPlayerController.h b/Project Reboot 3.0/FortPlayerController.h index 4f3fb92..a31ae69 100644 --- a/Project Reboot 3.0/FortPlayerController.h +++ b/Project Reboot 3.0/FortPlayerController.h @@ -32,19 +32,7 @@ public: return Class; } - static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid) - { - auto ItemInstance = PlayerController->GetWorldInventory()->FindItemInstance(ItemGuid); - auto Pawn = Cast(PlayerController->GetPawn()); - - if (!ItemInstance || !Pawn) - return; - - if (auto Weapon = Pawn->EquipWeaponDefinition((UFortWeaponItemDefinition*)ItemInstance->GetItemEntry()->GetItemDefinition(), ItemInstance->GetItemEntry()->GetItemGuid())) - { - - } - } + static void ServerExecuteInventoryItemHook(AFortPlayerController* PlayerController, FGuid ItemGuid); static void ServerAttemptAircraftJumpHook(AFortPlayerController* PC, FRotator ClientRotation); static void ServerCreateBuildingActorHook(AFortPlayerController* PlayerController, FCreateBuildingActorData CreateBuildingData); diff --git a/Project Reboot 3.0/FortPlayerPawn.cpp b/Project Reboot 3.0/FortPlayerPawn.cpp index 1dd14de..420ddd8 100644 --- a/Project Reboot 3.0/FortPlayerPawn.cpp +++ b/Project Reboot 3.0/FortPlayerPawn.cpp @@ -68,7 +68,7 @@ void AFortPlayerPawn::ServerHandlePickupHook(AFortPlayerPawn* Pawn, AFortPickup* static auto PickupGuidOffset = FindOffsetStruct("/Script/FortniteGame.FortPickupLocationData", "PickupGuid"); *(AFortPawn**)(__int64(PickupLocationData) + PickupTargetOffset) = Pawn; - *(float*)(__int64(PickupLocationData) + FlyTimeOffset) = 0.40; + *(float*)(__int64(PickupLocationData) + FlyTimeOffset) = 0.40f; *(AFortPawn**)(__int64(PickupLocationData) + ItemOwnerOffset) = Pawn; *(FVector*)(__int64(PickupLocationData) + StartDirectionOffset) = InStartDirection; *(FGuid*)(__int64(PickupLocationData) + PickupGuidOffset) = Pawn->GetCurrentWeapon() ? Pawn->GetCurrentWeapon()->GetItemEntryGuid() : FGuid(); diff --git a/Project Reboot 3.0/GameModeBase.cpp b/Project Reboot 3.0/GameModeBase.cpp index 3cba578..0366421 100644 --- a/Project Reboot 3.0/GameModeBase.cpp +++ b/Project Reboot 3.0/GameModeBase.cpp @@ -5,11 +5,11 @@ APawn* AGameModeBase::SpawnDefaultPawnForHook(AGameModeBase* GameMode, AController* NewPlayer, AActor* StartSpot) { + LOG_INFO(LogDev, "SpawnDefaultPawnFor: 0x{:x}!", __int64(_ReturnAddress()) - __int64(GetModuleHandleW(0))); + static auto PawnClass = FindObject("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C"); GameMode->Get("DefaultPawnClass") = PawnClass; - LOG_INFO(LogDev, "SpawnDefaultPawnFor: 0x{:x}!", __int64(_ReturnAddress()) - __int64(GetModuleHandleW(0))); - static auto fn = FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnAtTransform"); struct { AController* NewPlayer; FTransform SpawnTransform; APawn* ReturnValue; } diff --git a/Project Reboot 3.0/NetDriver.h b/Project Reboot 3.0/NetDriver.h index 9d9ce1d..185946a 100644 --- a/Project Reboot 3.0/NetDriver.h +++ b/Project Reboot 3.0/NetDriver.h @@ -22,6 +22,7 @@ struct FURL // idk where this actually goes class UNetDriver : public UObject { public: + // static inline int ReplicationDriverOffset = 0; static inline bool (*InitListenOriginal)(UNetDriver* NetDriver, FNetworkNotify* InNotify, FURL& ListenURL, bool bReuseAddressAndPort, FString& Error); static inline void (*SetWorldOriginal)(UNetDriver* NetDriver, UWorld* World); static inline void (*TickFlushOriginal)(UNetDriver* NetDriver); diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj b/Project Reboot 3.0/Project Reboot 3.0.vcxproj index 3dc8fb8..8766db5 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj @@ -175,6 +175,7 @@ + @@ -225,6 +226,7 @@ + diff --git a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters index 6c6d04a..f310c48 100644 --- a/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters +++ b/Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters @@ -116,6 +116,9 @@ FortniteGame\Source\FortniteGame\Private\Player + + FortniteGame\Source\FortniteGame\Private\Items + @@ -359,6 +362,9 @@ Reboot\Public + + FortniteGame\Source\FortniteGame\Public\Items + diff --git a/Project Reboot 3.0/World.cpp b/Project Reboot 3.0/World.cpp index a17522d..a4cdae1 100644 --- a/Project Reboot 3.0/World.cpp +++ b/Project Reboot 3.0/World.cpp @@ -66,7 +66,7 @@ void UWorld::Listen() // LEVEL COLLECTIONS auto& LevelCollections = GetWorld()->Get>("LevelCollections"); - int LevelCollectionSize = 0x78; + int LevelCollectionSize = FindObject("/Script/Engine.LevelCollection")->GetPropertiesSize(); *(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = NewNetDriver; *(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = NewNetDriver; diff --git a/Project Reboot 3.0/addresses.cpp b/Project Reboot 3.0/addresses.cpp index 69cf926..678c478 100644 --- a/Project Reboot 3.0/addresses.cpp +++ b/Project Reboot 3.0/addresses.cpp @@ -35,7 +35,7 @@ void Addresses::SetupVersion() Fortnite_Version = 12.41; } - static FString(*GetEngineVersion)() = decltype(GetEngineVersion)(Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B D9 E8 ? ? ? ? 48 8B C8 41 B8 04 ? ? ? 48 8B D3").Get()); + static FString(*GetEngineVersion)() = decltype(GetEngineVersion)(Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B D9 E8 ? ? ? ? 48 8B C8 41 B8 04 ? ? ? 48 8B D3", false).Get()); std::string FullVersion; FString toFree; @@ -314,11 +314,21 @@ std::vector Addresses::GetFunctionsToNull() // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C 89 60 F0 4C 8B E2 4C 89").Get()); // ^ } + if (Engine_Version == 500) + { + toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 40 48 8B FA 48 8B D9 48 85 D2 0F 84 ? ? ? ? 8B").Get()); // idk lmfao + } + if (Fortnite_Version == 12.61) { // toNull.push_back(Memcury::Scanner::FindPattern("48 89 4C 24 ? 55 56 57 41 56 48 81 EC ? ? ? ? 4C 8B B1 ? ? ? ? 33 F6 4C 89 B4 24 ? ? ? ? 48 8B").Get()); // fritter crash } + if (Fortnite_Version == 17.30) + { + 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()); + } + toNull.push_back(Addresses::ChangeGameSessionId); return toNull; diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index d8d42f0..dc4c15d 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -25,6 +25,9 @@ enum ENetMode static ENetMode GetNetModeHook() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; } static ENetMode GetNetModeHook2() { /* std::cout << "AA!\n"; */ return ENetMode::NM_DedicatedServer; } +static bool ReturnTrueHook() { return true; } +static int Return2Hook() { return 2; } + static void NoMCPHook() { return; } static void CollectGarbageHook() { return; } @@ -52,11 +55,12 @@ DWORD WINAPI Main(LPVOID) Offsets::Print(); Addresses::FindAll(); + // Addresses::Print(); Addresses::Init(); Addresses::Print(); static auto GameModeDefault = FindObject(L"/Script/FortniteGame.Default__FortGameModeAthena"); - static auto FortPlayerControllerAthenaDefault = FindObject(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); + static auto FortPlayerControllerAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortPlayerControllerAthena"); // FindObject(L"/Game/Athena/Athena_PlayerController.Default__Athena_PlayerController_C"); static auto FortPlayerPawnAthenaDefault = FindObject(L"/Game/Athena/PlayerPawn_Athena.Default__PlayerPawn_Athena_C"); static auto FortAbilitySystemComponentAthenaDefault = FindObject(L"/Script/FortniteGame.Default__FortAbilitySystemComponentAthena"); @@ -78,6 +82,26 @@ DWORD WINAPI Main(LPVOID) GetLocalPlayerController()->ProcessEvent(SwitchLevel, &Level); + LOG_INFO(LogPlayer, "Switched level."); + + Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr); + + LOG_INFO(LogDev, "FindGIsServer: 0x{:x}", FindGIsServer() - __int64(GetModuleHandleW(0))); + LOG_INFO(LogDev, "FindGIsClient: 0x{:x}", FindGIsClient() - __int64(GetModuleHandleW(0))); + + if (FindGIsServer()) + *(bool*)FindGIsServer() = true; + + if (FindGIsClient()) + *(bool*)FindGIsClient() = false; + + if (Fortnite_Version == 17.30) + { + // Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3E07910), (PVOID)Return2Hook, nullptr); + // Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED12C), (PVOID)ReturnTrueHook, nullptr); + Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x3DED158), (PVOID)ReturnTrueHook, nullptr); + } + /* auto GIsClient = Memcury::Scanner(FindGIsServer()); @@ -102,8 +126,6 @@ DWORD WINAPI Main(LPVOID) LOG_INFO(LogDev, "isded: {}", parms.ret); */ - Hooking::MinHook::Hook((PVOID)Addresses::ActorGetNetMode, (PVOID)GetNetModeHook2, nullptr); - auto& LocalPlayers = GetLocalPlayers(); if (LocalPlayers.Num() && LocalPlayers.Data) @@ -116,23 +138,30 @@ DWORD WINAPI Main(LPVOID) if (func == 0) continue; - *(uint8_t*)func = 0xC3; - } + DWORD dwProtection; + VirtualProtect((PVOID)func, 1, PAGE_EXECUTE_READWRITE, &dwProtection); - Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, - (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false); + *(uint8_t*)func = 0xC3; + + DWORD dwTemp; + VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp); + } // return false; + // UNetDriver::ReplicationDriverOffset = FindOffsetStruct("/Script/Engine.NetDriver", "ReplicationDriver"); // NetDriver->GetOffset("ReplicationDriver"); + + Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, + (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false); Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); Hooking::MinHook::Hook(GameModeDefault, FindObject(L"/Script/Engine.GameModeBase.HandleStartingNewPlayer"), AFortGameModeAthena::Athena_HandleStartingNewPlayerHook, (PVOID*)&AFortGameModeAthena::Athena_HandleStartingNewPlayerOriginal, false); - Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerExecuteInventoryItem"), - AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false); + Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerExecuteInventoryItem"), + AFortPlayerController::ServerExecuteInventoryItemHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerPlayEmoteItem"), - AFortPlayerController::ServerPlayEmoteItemHook, nullptr, false); + AFortPlayerController::ServerPlayEmoteItemHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerCreateBuildingActor"), AFortPlayerController::ServerCreateBuildingActorHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerController.ServerBeginEditingBuildingActor"), @@ -147,12 +176,12 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerSendZiplineState"), AFortPlayerPawn::ServerSendZiplineStateHook, nullptr, false); Hooking::MinHook::Hook(FortPlayerPawnAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerPawn.ServerHandlePickup"), - AFortPlayerPawn::ServerHandlePickupHook, nullptr, false); + AFortPlayerPawn::ServerHandlePickupHook, nullptr, false); - Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"), + /* Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbility"), UAbilitySystemComponent::ServerTryActivateAbilityHook, nullptr, false); Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerTryActivateAbilityWithEventData"), - UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook, nullptr, false); + UAbilitySystemComponent::ServerTryActivateAbilityWithEventDataHook, nullptr, false); */ // Hooking::MinHook::Hook(FortAbilitySystemComponentAthenaDefault, FindObject(L"/Script/GameplayAbilities.AbilitySystemComponent.ServerAbilityRPCBatch"), // UAbilitySystemComponent::ServerAbilityRPCBatchHook, nullptr, false); @@ -165,14 +194,16 @@ DWORD WINAPI Main(LPVOID) } Hooking::MinHook::Hook((PVOID)Addresses::GetPlayerViewpoint, (PVOID)AFortPlayerControllerAthena::GetPlayerViewPointHook, (PVOID*)&AFortPlayerControllerAthena::GetPlayerViewPointOriginal); - Hooking::MinHook::Hook((PVOID)Addresses::KickPlayer, (PVOID)AGameSession::KickPlayerHook, (PVOID*)&AGameSession::KickPlayerOriginal); + // Hooking::MinHook::Hook((PVOID)Addresses::KickPlayer, (PVOID)AGameSession::KickPlayerHook, (PVOID*)&AGameSession::KickPlayerOriginal); Hooking::MinHook::Hook((PVOID)Addresses::TickFlush, (PVOID)UNetDriver::TickFlushHook, (PVOID*)&UNetDriver::TickFlushOriginal); - Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal); + // Hooking::MinHook::Hook((PVOID)Addresses::OnDamageServer, (PVOID)ABuildingActor::OnDamageServerHook, (PVOID*)&ABuildingActor::OnDamageServerOriginal); // Hooking::MinHook::Hook((PVOID)Addresses::CollectGarbage, (PVOID)CollectGarbageHook, nullptr); Hooking::MinHook::Hook((PVOID)Addresses::PickTeam, (PVOID)AFortGameModeAthena::Athena_PickTeamHook, nullptr); srand(time(0)); + LOG_INFO(LogHook, "Finished!"); + while (true) { if (GetAsyncKeyState(VK_F7) & 1) diff --git a/Project Reboot 3.0/events.h b/Project Reboot 3.0/events.h index 467f9d3..578f4da 100644 --- a/Project Reboot 3.0/events.h +++ b/Project Reboot 3.0/events.h @@ -119,6 +119,32 @@ static inline std::vector Events = "/Game/Athena/Environments/Festivus/Blueprints/BP_FestivusManager.BP_FestivusManager_C", "/Game/Athena/Playlists/Music/Playlist_Music_High.Playlist_Music_High", 7.30 + ), + Event + ( + "Rift Tour", + "", + "", + 0, + { + + }, + { + { + { + false, + // "/Buffet/Gameplay/Blueprints/BP_Buffet_Master_Scripting.BP_Buffet_Master_Scripting_C.startevent" + "/Script/SpecialEventGameplayRuntime.SpecialEventScript.StartEventAtIndex" + }, + + 0 + } + }, + + "/Buffet/Gameplay/Blueprints/Buffet_SpecialEventScript.Buffet_SpecialEventScript_C", + // "/Buffet/Gameplay/Blueprints/BP_Buffet_Master_Scripting.BP_Buffet_Master_Scripting_C", + "/BuffetPlaylist/Playlist/Playlist_Buffet.Playlist_Buffet", + 17.30 ) }; @@ -153,7 +179,7 @@ static inline UObject* GetEventScripting() if (!ScriptingClass) { - // LOG_ERROR(LogEvent, "Failed to find ScriptingClass!"); + LOG_ERROR(LogEvent, "Failed to find ScriptingClass!"); return nullptr; } @@ -161,7 +187,7 @@ static inline UObject* GetEventScripting() if (AllScripters.size() <= 0) { - // LOG_ERROR(LogEvent, "Failed to find any scripters!"); + LOG_ERROR(LogEvent, "Failed to find any scripters!"); return nullptr; } @@ -338,6 +364,24 @@ static inline bool CallOnReadys(bool* bWereAllSuccessful = nullptr) } } + /* if (Fortnite_Version == 17.30) + { + static auto onready = FindObject("/Buffet/Gameplay/Blueprints/BP_Buffet_Master_Scripting.BP_Buffet_Master_Scripting_C.OnReady_C6091CF24046D602CBB778A594DB5BA8"); + auto script = FindObject("/Buffet/Levels/Buffet_P.Buffet_P.PersistentLevel.BP_Event_Master_Scripting_2"); + + if (!script) + { + LOG_ERROR(LogEvent, "Failed to find MasterScripting"); + + if (bWereAllSuccessful) + *bWereAllSuccessful = false; + + return false; + } + + script->ProcessEvent(onready, &OnReadyParams); + } */ + return true; } @@ -359,13 +403,53 @@ static inline void StartEvent() auto EventScripting = GetEventScripting(); + LOG_INFO(LogDev, "EventScripting {}", __int64(EventScripting)); + LOG_INFO(LogDev, "EventScripting Name {}", EventScripting->GetFullName()); + // if (!EventScripting) // return; // GetEventScripting handles the printing + CallOnReadys(); + if (Fortnite_Version == 17.30) + { + static bool (*IsServerOrSomething)(UObject * SpecialEventScript) = decltype(IsServerOrSomething)(__int64(GetModuleHandleW(0)) + 0x3DECFC8); + LOG_INFO(LogDev, "IsServerOrSomething {}", IsServerOrSomething(EventScripting)); + + static auto OnRep_RootStartTimeFn = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor.OnRep_RootStartTime"); + static auto MeshRootStartEventFn = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor.MeshRootStartEvent"); + auto SpecialEventScriptMeshActorClass = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScriptMeshActor"); + auto AllSpecialEventScriptMeshActors = UGameplayStatics::GetAllActorsOfClass(GetWorld(), SpecialEventScriptMeshActorClass); + + if (AllSpecialEventScriptMeshActors.Num() > 0) + { + auto SpecialEventScriptMeshActor = AllSpecialEventScriptMeshActors.at(0); + + if (SpecialEventScriptMeshActor) + { + static bool (*sub_7FF7E556D158)(UObject * MeshScriptActor) = decltype(sub_7FF7E556D158)(__int64(GetModuleHandleW(0)) + 0x3DED158); + LOG_INFO(LogDev, "sub_7FF7E556D158 {}", sub_7FF7E556D158(SpecialEventScriptMeshActor)); + + SpecialEventScriptMeshActor->ProcessEvent(MeshRootStartEventFn); + SpecialEventScriptMeshActor->ProcessEvent(OnRep_RootStartTimeFn); + return; + } + else + { + LOG_ERROR(LogEvent, "Failed to find SpecialEventScriptMeshActor"); + } + } + else + { + LOG_ERROR(LogEvent, "AllSpecialEventScriptMeshActors.Num() == 0"); + } + } + for (auto& StartEventFunc : OurEvent.StartEventFunctions) { + LOG_INFO(LogDev, "Finding {}", StartEventFunc.first.second); + auto StartEventUFunc = FindObject(StartEventFunc.first.second); if (!StartEventUFunc) diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index da38687..008d7d9 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -50,14 +50,33 @@ static inline uintptr_t FindBytes(Memcury::Scanner& Scanner, const std::vector= 427) // ok so like the func is split up in ida idfk what to do about it + { + if (Fortnite_Version < 18) + return Memcury::Scanner::FindPattern("40 55 53 57 41 54 41 55 41 57 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8B 05 ? ? ? ? 48 33 C4 48 89 85").Get(); + else + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 60 45 33 ED 45 8A F9 44 38 2D ? ? ? ? 49 8B F8 48 8B").Get(); + } + + auto Addr = Memcury::Scanner::FindStringRef(L"Illegal call to StaticFindObject() while serializing object data!", true, 0, Engine_Version >= 427); return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 255, 0, true); // Addr.ScanFor(bytes, false).Get(); } static inline uint64 FindProcessEvent() { - auto Addr = Memcury::Scanner::FindStringRef(L"AccessNoneNoContext"); - return FindBytes(Addr, { 0x40, 0x55 }, 2000); // Addr.ScanFor({ 0x40, 0x55 }).Get(); + if (Fortnite_Version < 14) + { + auto Addr = Memcury::Scanner::FindStringRef(L"AccessNoneNoContext"); + return FindBytes(Addr, { 0x40, 0x55 }, 2000); // Addr.ScanFor({ 0x40, 0x55 }).Get(); + } + + auto Addr = Memcury::Scanner::FindStringRef(L"UMeshNetworkComponent::ProcessEvent: Invalid mesh network node type: %s", true, 0, Engine_Version >= 500); + return Memcury::Scanner(FindBytes(Addr, { 0xE8 }, 2000, 0, false, Engine_Version < 500 ? 1 : 3)).RelativeOffset(1).Get(); // Addr.ScanFor({ 0x40, 0x55 }).Get(); } static inline uint64 FindObjectArray() @@ -114,12 +133,24 @@ static inline uint64 FindKickPlayer() static inline uint64 FindInitHost() { + if (Engine_Version == 427) // idk im dumb + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 57 41 56 48 8D 6C 24 ? 48 81 EC ? ? ? ? 48 8B F1 4C 8D 05").Get(); + auto Addr = Memcury::Scanner::FindStringRef(L"BeaconPort="); - return FindBytes(Addr, { 0x48, 0x8B, 0xC4 }, 1000, 0, true); + return FindBytes(Addr, (Engine_Version == 427 ? std::vector{ 0x48, 0x8B, 0x5C } : std::vector{ 0x48, 0x8B, 0xC4 }), 1000, 0, true); } static inline uint64 FindPauseBeaconRequests() { + if (Engine_Version == 500) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 33 ED 48 8B F1 84 D2 74 27 80 3D").Get(); + + if (Engine_Version == 427) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 30 33 F6 48 8B F9 84 D2 74").Get(); + + if (Engine_Version == 426) + return Memcury::Scanner::FindPattern("40 57 48 83 EC 30 48 8B F9 84 D2 74 62 80 3D").Get(); + auto Addr = Memcury::Scanner::FindStringRef(L"All Beacon Requests Resumed."); return FindBytes(Addr, { 0x40, 0x53 }, 1000, 0, true); } @@ -132,6 +163,12 @@ static inline uint64 FindGetPlayerViewpoint() static inline uint64 FindSpawnActor() { + if (Engine_Version >= 427) + { + auto stat = Memcury::Scanner::FindStringRef(L"STAT_SpawnActorTime"); + return FindBytes(stat, { 0x48, 0x8B, 0xC4 }, 3000, 0, true); + } + auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified"); return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true); } @@ -165,8 +202,14 @@ static inline uint64 FindSetWorld() static inline uint64 FindInitListen() { + if (Engine_Version == 500) + return Memcury::Scanner::FindPattern("4C 8B DC 49 89 5B 10 49 89 73 18 57 48 83 EC 50 48 8B BC 24 ?? ?? ?? ?? 49 8B F0 48 8B").Get(); + + if (Engine_Version >= 427) + return Memcury::Scanner::FindPattern("4C 8B DC 49 89 5B 08 49 89 73 10 57 48 83 EC 50 48 8B BC 24 ? ? ? ? 49 8B F0 48 8B 01 48 8B").Get(); + auto Addr = Memcury::Scanner::FindStringRef(L"%s IpNetDriver listening on port %i"); - return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 2000, 0, true, 1); + return FindBytes(Addr, Engine_Version < 427 ? std::vector{ 0x48, 0x89, 0x5C } : std::vector{ 0x4C, 0x8B, 0xDC }, 2000, 0, true, 1); } static inline uint64 FindOnDamageServer() @@ -186,6 +229,13 @@ static inline uint64 FindNoMCP() if (Fortnite_Version == 4) return Memcury::Scanner::FindPattern("E8 ? ? ? ? 83 A7 ? ? ? ? ? 83 E0 01").RelativeOffset(1).Get(); + if (Fortnite_Version >= 17) + { + // todo make this relative + // 19.10 + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 54 41 55 41 56 41 57 48 83 EC 20 65 48 8B 04 25 ? ? ? ? BA ? ? ? ? 48 8B 08 8B 04 0A 39 05 ? ? ? ? 7F 23 8A 05 ? ? ? ? 48 8B 5C 24 ? 48 8B 6C 24 ? 48 8B 74 24 ? 48 83 C4 20 41 5F 41 5E 41 5D 41 5C 5F C3 48 8D 0D ? ? ? ? E8 ? ? ? ? 83 3D ? ? ? ? ? 75 C8 E8 ? ? ? ? 45 33").Get(); + } + if (Engine_Version == 421 || Engine_Version == 422) return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 CE").RelativeOffset(1).Get(); @@ -198,6 +248,9 @@ static inline uint64 FindNoMCP() if (Engine_Version == 426) return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 75 10 84 DB").RelativeOffset(1).Get(); + if (Engine_Version == 427) + return Memcury::Scanner::FindPattern("E8 ? ? ? ? 84 C0 74 F0").RelativeOffset(1).Get(); + // return (uintptr_t)GetModuleHandleW(0) + 0x1791CF0; // 11.01 return 0; // return (uintptr_t)GetModuleHandleW(0) + 0x161d600; // 10.40 @@ -213,6 +266,12 @@ static inline uint64 FindCollectGarbage() static inline uint64 FindActorGetNetMode() { + if (Engine_Version == 500) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 F6 41 08 10 48 8B D9 0F 85 ? ? ? ? 48 8B 41 20 48 85 C0 0F 84 ? ? ? ? F7 40").Get(); + + if (Engine_Version == 427) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 E8 ? ? ? ? 48 8B 93 ? ? ? ? 48 8B C8 48 8B F8 E8 ? ? ? ? 48 85 C0 75 29").Get(); + auto AActorGetNetmode = Memcury::Scanner::FindStringRef(L"ClientPlayerLeft %s") .ScanFor({ 0x48, 0x8B, 0xCF, 0xE8 }) .RelativeOffset(4) @@ -223,12 +282,23 @@ static inline uint64 FindActorGetNetMode() static inline uint64 FindTickFlush() { + if (Engine_Version == 427) + return Memcury::Scanner::FindPattern("48 8B C4 48 89 58 18 55 56 57 41 54 41 55 41 56 41 57 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 0F 29 70 B8 0F 29 78 A8 48 8B 05 ? ? ? ? 48 33 C4 48 89 85 ? ? ? ? 8A").Get(); + auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush"); - return FindBytes(Addr, { 0x4C, 0x8B }, 1000, 0, true); + return FindBytes(Addr, (Fortnite_Version < 18 ? std::vector{ 0x4C, 0x8B } : std::vector{ 0x48, 0x8B, 0xC4 }), 1000, 0, true); } static inline uint64 FindGIsServer() { + if (Fortnite_Version == 19.10) + return __int64(GetModuleHandleW(0)) + 0xB30CF9D; + + if (Fortnite_Version == 17.30) + return __int64(GetModuleHandleW(0)) + 0x973E499; + + return 0; + auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 1); Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 1); @@ -238,12 +308,28 @@ static inline uint64 FindGIsServer() static inline uint64 FindChangeGameSessionId() { + if (Engine_Version == 500) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 55 56 57 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 50 4C 8B FA 48 8B F1 E8").Get(); + + if (Engine_Version >= 427) + { + if (Fortnite_Version < 18) + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 70 4C 8B FA 4C").Get(); + else + return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 54 41 55 41 56 41 57 48 8B EC 48 83 EC 70 4C 8B FA 4C").Get(); + } + auto Addr = Memcury::Scanner::FindStringRef(L"Changing GameSessionId from '%s' to '%s'"); return FindBytes(Addr, { 0x40, 0x55 }, 2000, 0, true); } static inline uint64 FindGIsClient() { + if (Fortnite_Version == 17.30) + return __int64(GetModuleHandleW(0)) + 0x973E49B; + + return 0; + auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering"); auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, 2); Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, 2); @@ -269,6 +355,9 @@ static inline uint64 FindGetNetMode() static inline uint64 FindRealloc() { + if (Engine_Version >= 427) + return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 48 8B F1 41 8B D8 48 8B 0D ? ? ? ").Get(); + auto Addr = Memcury::Scanner::FindStringRef(L"a.Budget.BudgetMs", false); if (!Addr.Get()) @@ -296,7 +385,7 @@ static inline uint64 FindPickTeam() static inline uint64 FindInternalTryActivateAbility() { - auto Addr = Memcury::Scanner::FindStringRef(L"InternalTryActivateAbility called with invalid Handle! ASC: %s. AvatarActor: %s"); + auto Addr = Memcury::Scanner::FindStringRef(L"InternalTryActivateAbility called with invalid Handle! ASC: %s. AvatarActor: %s", true, 0, Fortnite_Version >= 18); return FindBytes(Addr, { 0x4C, 0x89, 0x4C }, 1000, 0, true); } @@ -310,9 +399,10 @@ static inline uint64 FindGiveAbility() static inline uint64 FindGiveAbilityAndActivateOnce() { - auto Addr = Memcury::Scanner::FindStringRef(L"GiveAbilityAndActivateOnce called on ability %s on the client, not allowed!"); + auto Addr = Memcury::Scanner::FindStringRef(L"GiveAbilityAndActivateOnce called on ability %s on the client, not allowed!", true, 0, Engine_Version >= 500); + auto res = FindBytes(Addr, { 0x48, 0x89, 0x5C }, 1000, 0, true); - return FindBytes(Addr, { 0x48, 0x89, 0x5C }, 1000, 0, true); + return res; } static inline uint64 FindCantBuild() @@ -320,7 +410,13 @@ static inline uint64 FindCantBuild() auto add = Memcury::Scanner::FindPattern("48 89 5C 24 10 48 89 6C 24 18 48 89 74 24 20 41 56 48 83 EC ? 49 8B E9 4D 8B F0", false).Get(); if (!add) - add = Memcury::Scanner::FindPattern("48 89 54 24 ? 55 56 41 56 48 83 EC 50").Get(); // 4.20 + add = Memcury::Scanner::FindPattern("48 89 54 24 ? 55 56 41 56 48 83 EC 50", false).Get(); // 4.20 + + if (!add) + add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 4D 8B F1 4D 8B F8", false).Get(); // 4.26.1 + + if (!add) + add = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 49 8B E9 4D 8B F8 48 8B DA 48 8B F9 BE ? ? ? ? 48").Get(); // 5.00 return add; diff --git a/Project Reboot 3.0/hooking.h b/Project Reboot 3.0/hooking.h index e6a56e7..b018dd3 100644 --- a/Project Reboot 3.0/hooking.h +++ b/Project Reboot 3.0/hooking.h @@ -201,6 +201,12 @@ namespace Hooking if (!Function) return false; + if (!DefaultClass || !DefaultClass->VFTable) + { + LOG_WARN(LogHook, "DefaultClass or the vtable is null! ({})", __int64(DefaultClass)); + return false; + } + auto Exec = Function->GetFunc(); if (bHookExec) diff --git a/Project Reboot 3.0/log.h b/Project Reboot 3.0/log.h index 8816a5d..f58de27 100644 --- a/Project Reboot 3.0/log.h +++ b/Project Reboot 3.0/log.h @@ -67,6 +67,8 @@ inline void InitLogger() MakeLogger("LogHook"); MakeLogger("LogAbilities"); MakeLogger("LogEvent"); + MakeLogger("LogPlaylist"); + MakeLogger("LogGame"); } #define LOG_DEBUG(loggerName, ...) \ diff --git a/vendor/memcury.h b/vendor/memcury.h index 8d14af2..44c5ba8 100644 --- a/vendor/memcury.h +++ b/vendor/memcury.h @@ -753,7 +753,7 @@ return Scanner(add); } - static auto FindPointerRef(void* Pointer) -> Scanner // credit ender + static auto FindPointerRef(void* Pointer) -> Scanner // credit me and ender { PE::Address add{ nullptr }; @@ -771,19 +771,31 @@ add = PE::Address(&scanBytes[i]); } } + + if (scanBytes[i] == ASM::CALL) + { + if (PE::Address(&scanBytes[i]).RelativeOffset(1).GetAs() == Pointer) + { + add = PE::Address(&scanBytes[i]); + } + } } if (add == 0) { MessageBoxA(0, "FindPointerRef return nullptr", "Memcury", MB_OK); } + else + { + // MessageBoxA(0, std::format("FindPointerRef return 0x{:x}", add.Get() - __int64(GetModuleHandleW(0))).c_str(), "Memcury", MB_OK); + } return Scanner(add); } // Supports wide and normal strings both std and pointers template - static auto FindStringRef(T string, bool bWarnIfNotFound = true, int useRefNum = 0) -> Scanner + static auto FindStringRef(T string, bool bWarnIfNotFound = true, int useRefNum = 0, bool bIsInFunc = false) -> Scanner { PE::Address add{ nullptr }; @@ -878,6 +890,26 @@ } } + if (add.Get()) + { + if (bIsInFunc) + { + for (int i = 0; i < 300; i++) + { + if (*(uint8_t*)(add.Get() - i) == 0x48 && *(uint8_t*)(add.Get() - i + 1) == 0x83) + { + // MessageBoxA(0, std::format("0x{:x}", (__int64(add.Get() - i) - __int64(GetModuleHandleW(0)))).c_str(), "Memcury", MB_OK); + + auto beginFunc = Scanner(add.Get() - i); + + auto ref = FindPointerRef(beginFunc.GetAs()); + + return ref; + } + } + } + } + return Scanner(add); } @@ -1331,15 +1363,15 @@ return true; } - inline void VirtualSwap(void** VTable, int Idx, void* NewFunc) + static void VirtualSwap(void** VTable, int Idx, void* NewFunc) { DWORD dwProtection; - VirtualProtect(VTable, (Idx + 8), PAGE_EXECUTE_READWRITE, &dwProtection); + VirtualProtect(&VTable[Idx], 8, PAGE_EXECUTE_READWRITE, &dwProtection); VTable[Idx] = NewFunc; DWORD dwTemp; - VirtualProtect(VTable, (Idx + 8), dwProtection, &dwTemp); + VirtualProtect(&VTable[Idx], 8, dwProtection, &dwTemp); } // Finds a string ref, then goes searches xref of the function that it's in and returns that address.