diff --git a/Project Reboot 3.0/AbilitySystemComponent.h b/Project Reboot 3.0/AbilitySystemComponent.h index f313acd..9ce9b5f 100644 --- a/Project Reboot 3.0/AbilitySystemComponent.h +++ b/Project Reboot 3.0/AbilitySystemComponent.h @@ -4,11 +4,6 @@ #include "GameplayAbilitySpec.h" #include "AttributeSet.h" -struct PadHex10 { char Pad[0x10]; }; -struct PadHex18 { char Pad[0x18]; }; -struct PadHexA8 { char Pad[0xA8]; }; -struct PadHexB0 { char Pad[0xB0]; }; - // using FPredictionKey = PadHex18; // using FGameplayEventData = PadHexA8; diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 63a0c3d..df2df49 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -1265,7 +1265,7 @@ DWORD WINAPI SpectateThread(LPVOID PC) Sleep(3000); - LOG_INFO(LogDev, "bugha!"); + LOG_INFO(LogDev, "Spectate!"); SpectatingPC->SpectateOnDeath(); @@ -1617,7 +1617,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo if (IsRestartingSupported() && Globals::bAutoRestart && !bIsInAutoRestart) { - // wtf + // wht if (GameState->GetGamePhase() > EAthenaGamePhase::Warmup) { @@ -1657,6 +1657,22 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo return ClientOnPawnDiedOriginal(PlayerController, DeathReport); } +bool Idk(ABuildingSMActor* BuildingActor) +{ + return true; // bIsPlayerBuildable && EditModeSupport && EditModePatternData && GameState->StructuralSupportSystem && ?? && ?? +} + +bool IsOkForEditing(ABuildingSMActor* BuildingActor, AFortPlayerController* Controller) +{ + if (BuildingActor->GetEditingPlayer() && + BuildingActor->GetEditingPlayer() != Controller->GetPlayerState()) + return false; + + return !BuildingActor->IsDestroyed() && + // BuildingActor->GetWorld() && + Idk(BuildingActor); +} + void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit) { if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks. @@ -1667,6 +1683,9 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr if (!Pawn) return; + if (!IsOkForEditing(BuildingActorToEdit, PlayerController)) + return; + auto PlayerState = PlayerController->GetPlayerState(); if (!PlayerState) @@ -1691,7 +1710,7 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr #if 1 EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); #else - auto EditTool = Cast(Pawn->GetCurrentWeapon()); + EditTool = Cast(Pawn->GetCurrentWeapon()); #endif if (!EditTool) @@ -1772,10 +1791,12 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl if (!EditToolInstance) return; + FGuid EditToolGuid = EditToolInstance->GetItemEntry()->GetItemGuid(); // Should we ref? + #if 1 - EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM + EditTool = Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolGuid)); // ERM #else - Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM + Cast(Pawn->EquipWeaponDefinition(EditToolDef, EditToolGuid)); // ERM EditTool = Cast(Pawn->GetCurrentWeapon()); #endif #else @@ -1786,8 +1807,8 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl { static auto bEditConfirmedOffset = EditTool->GetOffset("bEditConfirmed"); - if (bEditConfirmedOffset == -1) - EditTool->Get(bEditConfirmedOffset) = true; + if (bEditConfirmedOffset != -1) + EditTool->Get(bEditConfirmedOffset) = true; // this probably does nothing on server EditTool->SetEditActor(nullptr); } diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.cpp b/Project Reboot 3.0/FortPlayerControllerAthena.cpp index bac31f0..acd2d31 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.cpp +++ b/Project Reboot 3.0/FortPlayerControllerAthena.cpp @@ -132,6 +132,27 @@ void AFortPlayerControllerAthena::EndGhostModeHook(AFortPlayerControllerAthena* return EndGhostModeOriginal(PlayerController); } +void AFortPlayerControllerAthena::ServerCreativeSetFlightSpeedIndexHook(UObject* Context, FFrame* Stack) +{ + int Index; + Stack->StepCompiledIn(&Index); + + // LOG_INFO(LogDev, "Player {} wanting to change creative flight speed at index {}", Context->GetName(), Index); + + static auto WantedFlightSpeedChangedFn = FindObject("/Script/FortniteGame.FortPlayerControllerGameplay:OnRep_FlyingModifierIndex"); + + if (!WantedFlightSpeedChangedFn) + { + return; + } + + static auto FlyingModifierIndexOffset = Context->GetOffset("FlyingModifierIndex"); + Context->Get(FlyingModifierIndexOffset) = Index; + + return Context->ProcessEvent(WantedFlightSpeedChangedFn); +} + + void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraft) { auto PlayerController = Cast(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner()); diff --git a/Project Reboot 3.0/FortPlayerControllerAthena.h b/Project Reboot 3.0/FortPlayerControllerAthena.h index 50dedc1..1731069 100644 --- a/Project Reboot 3.0/FortPlayerControllerAthena.h +++ b/Project Reboot 3.0/FortPlayerControllerAthena.h @@ -253,6 +253,7 @@ public: static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh static void EndGhostModeHook(AFortPlayerControllerAthena* PlayerController); + static void ServerCreativeSetFlightSpeedIndexHook(UObject* Context, FFrame* Stack); static void EnterAircraftHook(UObject* PC, AActor* Aircraft); static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller); diff --git a/Project Reboot 3.0/World.h b/Project Reboot 3.0/World.h index 44ca210..10fe581 100644 --- a/Project Reboot 3.0/World.h +++ b/Project Reboot 3.0/World.h @@ -65,6 +65,95 @@ struct FActorSpawnParametersUE500 TFunction CustomPreSpawnInitalization; // my favorite }; +#if 0 + +static inline PadHexB0 CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr) +{ + if (Engine_Version >= 500) + { + FActorSpawnParametersUE500 addr{}; + + addr.Owner = Owner; + addr.bDeferConstruction = bDeferConstruction; + addr.SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; + return *(PadHexB0*)&addr; + } + else + { + FActorSpawnParameters addr{}; + + addr.Owner = Owner; + addr.bDeferConstruction = bDeferConstruction; + addr.SpawnCollisionHandlingOverride = SpawnCollisionHandlingOverride; + return *(PadHexB0*)&addr; + } + + return PadHexB0(); +} + +class UWorld : public UObject, public FNetworkNotify +{ +public: + static inline UObject* (*SpawnActorOriginal)(UWorld* World, UClass* Class, FTransform const* UserTransformPtr, void* SpawnParameters); + + template + T*& GetGameMode() + { + static auto AuthorityGameModeOffset = GetOffset("AuthorityGameMode"); + return this->Get(AuthorityGameModeOffset); + } + + class AGameState*& GetGameState() + { + static auto GameStateOffset = GetOffset("GameState"); + return this->Get(GameStateOffset); + } + + class UNetDriver*& GetNetDriver() + { + static auto NetDriverOffset = GetOffset("NetDriver"); + return this->Get(NetDriverOffset); + } + + UGameInstance* GetOwningGameInstance() + { + static auto OwningGameInstanceOffset = GetOffset("OwningGameInstance"); + return this->Get(OwningGameInstanceOffset); + } + + inline FTimerManager& GetTimerManager() + { + return GetOwningGameInstance()->GetTimerManager(); + // return (GetOwningGameInstance() ? GetOwningGameInstance()->GetTimerManager() : *TimerManager); + } + + template + ActorType* SpawnActor(UClass* Class, FTransform UserTransformPtr = FTransform(), PadHexB0 SpawnParameters = CreateSpawnParameters()) + { + auto actor = (ActorType*)SpawnActorOriginal(this, Class, &UserTransformPtr, &SpawnParameters); + + return actor; + } + + template + ActorType* SpawnActor(UClass* Class, FVector Location, FQuat Rotation = FQuat(), FVector Scale3D = FVector(1, 1, 1), PadHexB0 SpawnParameters = CreateSpawnParameters()) + { + FTransform UserTransformPtr{}; + UserTransformPtr.Translation = Location; + UserTransformPtr.Rotation = Rotation; + UserTransformPtr.Scale3D = Scale3D; + + auto actor = SpawnActor(Class, UserTransformPtr, SpawnParameters); + + return actor; + } + + AWorldSettings* GetWorldSettings(bool bCheckStreamingPersistent = false, bool bChecked = true) const; + AWorldSettings* K2_GetWorldSettings(); // DONT USE WHEN POSSIBLE + + void Listen(); +}; +#else // #define USE_VIRTUALALLOC_SPAWNPARAMS static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr) @@ -195,4 +284,5 @@ public: AWorldSettings* K2_GetWorldSettings(); // DONT USE WHEN POSSIBLE void Listen(); -}; \ No newline at end of file +}; +#endif \ No newline at end of file diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 71c0ad7..d094f71 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -224,8 +224,6 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) { if (Index == 0) // Start of Event { - auto MasterScripting = FindObject("/Buffet/Levels/Buffet_P.Buffet_P:PersistentLevel.BP_Event_Master_Scripting_2"); - auto AllSatelliteDishes = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Game/Athena/Apollo/Environments/BuildingActors/Complex/Props/Apollo_Complex_Satellite_Dish_Top_01.Apollo_Complex_Satellite_Dish_Top_01_C")); for (int i = 0; i < AllSatelliteDishes.Num(); i++) @@ -233,60 +231,117 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) AllSatelliteDishes.At(i)->K2_DestroyActor(); } - MasterScripting->ProcessEvent(MasterScripting->FindFunction("EnableTheMutator")); + auto AllSpecialEventMutators = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Script/SpecialEventGameplayRuntime.FortAthenaMutator_SpecialEvent")); - for (int i = 0; i < ClientConnections.Num(); i++) + for (int i = 0; i < AllSpecialEventMutators.Num(); i++) { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - auto CurrentController = ClientConnections.At(i)->GetPlayerController(); + auto CurrentSpecialEventMutator = AllSpecialEventMutators.At(i); - CurrentController->AddComponentByClass(FindObject("/Script/SpecialEventGameplayRuntime.FortControllerComponent_SpecialEvent")); - CurrentPawn->AddComponentByClass(FindObject("/Script/BuffetRuntime.FortSpecialRelevancyPawnAttachComponent")); - } - } - if (Index == 1) // Memories, BP_Buffet_PhaseScripting_Phase1_C - { - //EventPawn->TeleportTo(FVector(-963.630f, 25453.090f, 359392.125f), EventPawn->GetActorRotation()); + auto ScriptActor = CurrentSpecialEventMutator->Get(CurrentSpecialEventMutator->GetOffset("ScriptActor")); - auto Phase1Scripting = FindObject("/Buffet/Levels/Buffet_Part_3.Buffet_Part_3:PersistentLevel.BP_Buffet_PhaseScripting_Phase1_2"); - - auto TeleportRef = Phase1Scripting->Get(Phase1Scripting->GetOffset("TeleportRef")); - - //EventPawn->TeleportTo(TeleportRef->GetActorLocation(), EventPawn->GetActorRotation()); - - for (int i = 0; i < ClientConnections.Num(); i++) - { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - - //CurrentPawn->TeleportTo(TeleportRef->GetActorLocation(), CurrentPawn->GetActorRotation()); - - //Globals::PawnTeleportRotDefault = CurrentPawn->GetActorRotation(); - - CurrentPawn->ForceNetUpdate(); + if (!ScriptActor) + { + ScriptActor = Cast(GetEventScripting()); + LOG_INFO(LogEvent, "ScriptActor set for mutator: {}", CurrentSpecialEventMutator->GetName()); + } } } if (Index == 2) // Slide { auto Script = FindObject("/Buffet/Levels/Buffet_Part_4.Buffet_Part_4.PersistentLevel.BP_Buffet_PhaseScripting_Paint_4"); + auto SplineActor = Script->Get(Script->GetOffset("SplineActor")); + auto PawnLocation = Script->Get(Script->GetOffset("PawnLocation")) = SplineActor; - Script->Get(Script->GetOffset("bRaceStarted")) = true; - Script->ProcessEvent(Script->FindFunction("OnRep_bRaceStarted")); + auto AllWrapsSpawners = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Script/SpecialEventGameplayRuntime.FortSpecialRelevancyActorSpawner")); - Script->ProcessEvent(Script->FindFunction("OnReady_4E0ADA484A9A29A99CA6DD97BE645F09"), &OnReadyParams); + for (int i = 0; i < AllWrapsSpawners.Num(); i++) + { + auto CurrentWrapSpawner = AllWrapsSpawners.At(i); + + if (CurrentWrapSpawner) + { + auto WrapSpawnerLocation = CurrentWrapSpawner->GetActorLocation(); + auto WrapSpawnerRotation = CurrentWrapSpawner->GetActorRotation(); + UClass* ClassToSpawn = nullptr; + + if (CurrentWrapSpawner->GetName().contains("WrapChangePickup")) + { + ClassToSpawn = FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_WrapChangePickup.BP_Buffet_Paint_WrapChangePickup_C"); + } + else if (CurrentWrapSpawner->GetName().contains("Paint_Pickup")) + { + ClassToSpawn = FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_Pickup.BP_Buffet_Paint_Pickup_C"); + } + auto SpawnedWrap = GetWorld()->SpawnActor(ClassToSpawn, WrapSpawnerLocation, WrapSpawnerRotation.Quaternion(), FVector(1, 1, 1), + CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AlwaysSpawn, true, nullptr)); + + if (SpawnedWrap) + { + LOG_INFO(LogDev, "Spawner Spawned a Wrap: {}", SpawnedWrap->GetName()); + } + else + { + LOG_INFO(LogDev, "Spawner Failed to spawn a Wrap {}!", CurrentWrapSpawner->GetName()); + } + } + else + { + LOG_INFO(LogDev, "Spawner Invalid!"); + } + } for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); auto CurrentController = ClientConnections.At(i)->GetPlayerController(); - auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); - CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_IntroTrackFinder.BP_Buffet_Paint_IntroTrackFinder_C")); + if (!CurrentPawn) + continue; + + auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); // WHY DOESnT IT WORK AUTO auto MovementComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_MovementComponent.BP_Buffet_Paint_MovementComponent_C")); + PlayerComponent->Get(PlayerComponent->GetOffset("OwningPlayerController")) = CurrentController; + + struct + { + AActor* Pawn; + AActor* ReturnValue; + }wrapmanagerparams{}; + wrapmanagerparams.Pawn = CurrentPawn; + + Script->ProcessEvent(Script->FindFunction("GetWrapManagerForPlayer"), &wrapmanagerparams); + + MovementComponent->Get(MovementComponent->GetOffset("bIsMovingAlongSpline")) = true; + MovementComponent->Get(MovementComponent->GetOffset("ReplicatedTotalSplineTime")) = 59.793846f; // TotalSplineTime + MovementComponent->Get(MovementComponent->GetOffset("TargetSplineActor")) = SplineActor; + MovementComponent->ProcessEvent(MovementComponent->FindFunction("SetSplineActor"), &SplineActor); + bool IsMoving = true; + MovementComponent->ProcessEvent(MovementComponent->FindFunction("SetIsMovingAlongSpline"), &IsMoving); + MovementComponent->Get(MovementComponent->GetOffset("ReplicatedSplineInterpStrength")) = 1.3f; // SplineInterpStrength + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = Cast(GameMode->GetGameState()); + MovementComponent->Get(MovementComponent->GetOffset("StartServerWorldTime")) = GameState->GetServerWorldTimeSeconds(); + + MovementComponent->ProcessEvent(MovementComponent->FindFunction("OnRep_TargetSplineActor")); + + PlayerComponent->Get(PlayerComponent->GetOffset("WrapManager")) = wrapmanagerparams.ReturnValue; + PlayerComponent->Get(PlayerComponent->GetOffset("MovementComponent")) = MovementComponent; - PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializePaintComponent")); - PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializeMovementComponent")); + int StasisMode = 3; + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("SetStasisMode"), &StasisMode); // ?? + } + } + if (Index == 3) + { + for (int i = 0; i < ClientConnections.Num(); i++) + { + auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = ClientConnections.At(i)->GetPlayerController(); + int StasisMode = 0; + + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("SetStasisMode"), &StasisMode); } } if (Index == 4) // Storm King @@ -295,95 +350,82 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index) auto DefaultPlane = FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BP_PlanePrototype.Default__BP_PlanePrototype_C"); - { - auto WID = Cast(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing - - for (int i = 0; i < ClientConnections.Num(); i++) - { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); - - auto WorldInventory = CurrentController->GetWorldInventory(); - - bool bShouldUpdate = false; - WorldInventory->AddItem(WID, &bShouldUpdate, 1, 9999); - - if (bShouldUpdate) - WorldInventory->Update(); - - SendMessageToConsole(CurrentController, L"Gave WID_Buffet_BeatMatchingBoomBox!"); - } - - auto AllWeps = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BeatmatchingWeapon/B_Buffet_BeatMatchingWeaponPrototype.B_Buffet_BeatMatchingWeaponPrototype_C")); - - for (int i = 0; i < AllWeps.Num(); i++) - { - auto CurrentWep = AllWeps.At(i); - - if (CurrentWep != nullptr) - { - CurrentWep->Get(CurrentWep->GetOffset("Phase4ScriptingRef")) = StormScript; - } - } - } - } - if (Index == 5) // Ariana Knocked - { - auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2"); - - auto ManualTeleportLocation = ReviveScripting->Get(ReviveScripting->GetOffset("ManualTeleportLocation")); - - auto ManualTeleportRotation = ReviveScripting->Get(ReviveScripting->GetOffset("Manual_Teleport_Rotation")); + auto WID = Cast(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto CurrentController = (AFortPlayerControllerAthena*)ClientConnections.At(i)->GetPlayerController(); + + auto WorldInventory = CurrentController->GetWorldInventory(); + + bool bShouldUpdate = false; + WorldInventory->AddItem(WID, &bShouldUpdate, 1); + + if (bShouldUpdate) + WorldInventory->Update(); + + SendMessageToConsole(CurrentController, L"Gave WID_Buffet_BeatMatchingBoomBox!"); + } + + auto AllWeps = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BeatmatchingWeapon/B_Buffet_BeatMatchingWeaponPrototype.B_Buffet_BeatMatchingWeaponPrototype_C")); + + for (int i = 0; i < AllWeps.Num(); i++) + { + auto CurrentWep = AllWeps.At(i); + + if (CurrentWep != nullptr) + { + CurrentWep->Get(CurrentWep->GetOffset("Phase4ScriptingRef")) = StormScript; + } } } if (Index == 6) // Ariana { + auto ReflectScript = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Stars_2"); + for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); - } - } - if (Index == 7) // Ariana Dance - { - auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2"); - - auto ReflectScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Reflect_2"); - - auto ManualTeleportRotation = ReviveScripting->Get(ReviveScripting->GetOffset("Manual_Teleport_Rotation")); - - for (int i = 0; i < ClientConnections.Num(); i++) - { - auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); - CurrentPawn->AddComponentByClass(FindObject("/BuffetPlaylist/Playlist/BuffetCharacterMovementMutatorComponent.BuffetCharacterMovementMutatorComponent_C")); } } if (Index == 8) // Bubbles { - auto BubblesScripting = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_PhaseScripting_Bubble_4"); + //auto BubbleScript = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_PhaseScripting_Bubble_4"); + //auto BubbleSpline = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_SmallBubblePath_2.Spline"); - BubblesScripting->Get(BubblesScripting->GetOffset("bUsePlayerMovementMode")) = false; - - BubblesScripting->Get(BubblesScripting->GetOffset("FollowActor")) = FindObject("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_BubbleFollowActor_2"); - } - if (Index == 9) // Clouds - { for (int i = 0; i < ClientConnections.Num(); i++) { auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); + auto ComptoRemove = CurrentPawn->GetComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); - auto RemoveComponent = CurrentPawn->GetComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); + auto BubbleMovementComponent = CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Bubble/BP_BubblePlayerMovementComponent.BP_BubblePlayerMovementComponent_C")); - CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("K2_DestroyComponent"), RemoveComponent); + /* + struct + { + UObject* InSplineComponent; + float StartDistance; - CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/Llama/BP_Buffet_Llama_PlayerComponent.BP_Buffet_Llama_PlayerComponent_C")); - CurrentPawn->AddComponentByClass(FindObject("/Buffet/Gameplay/Blueprints/PostEvent/LlamaSpeedControlComponent.LlamaSpeedControlComponent_C")); + }SetSplineComponent; + SetSplineComponent.StartDistance = 0; + SetSplineComponent.InSplineComponent = BubbleSpline; + + // Works but too fast and player not in correct place on the spline. + BubbleMovementComponent->ProcessEvent(BubbleMovementComponent->FindFunction("SetSplineComponent"), &SetSplineComponent); + BubbleMovementComponent->Get(BubbleMovementComponent->GetOffset("SplineComponent")) = BubbleSpline; + BubbleMovementComponent->Get(BubbleMovementComponent->GetOffset("bIsMovingAlongSpline")) = true; + auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); + auto GameState = Cast(GameMode->GetGameState()); + BubbleMovementComponent->Get(BubbleMovementComponent->GetOffset("StartServerWorldTime")) = GameState->GetServerWorldTimeSeconds(); + bool IsMoving = true; + BubbleMovementComponent->ProcessEvent(BubbleMovementComponent->FindFunction("SetIsMovingAlongSpline"), &IsMoving); + */ + + CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("K2_DestroyComponent"), &ComptoRemove); } } if (Index == 10) // Escher @@ -454,7 +496,7 @@ void AttemptFinishPhaseHook(AActor* SpecialEventScript, FGameplayTag PhaseTag) static auto OnRep_ReplicatedActivePhaseIndexFn = FindObject("/Script/SpecialEventGameplayRuntime.SpecialEventScript.OnRep_ReplicatedActivePhaseIndex"); - auto Connections = GetWorld()->GetNetDriver()->GetClientConnections(); + auto& Connections = GetWorld()->GetNetDriver()->GetClientConnections(); if (LastTag == "Kiwi.Phase.Islands") // PrisonBlocks (Event Start) { @@ -511,6 +553,72 @@ void TeleportPlayerPawnHook(UObject* Context, FFrame& Stack, void* Ret) return TeleportPlayerPawnOriginal(Context, Stack, Ret); } +/* + +// Storm King Spawning, I might put this in its own class soon. +bool bStormKingSpawned = false; +static inline void (*DADBroOnGamephaseStepChangedOriginal)(UObject* Context, FFrame& Stack, void* Ret); +void DADBroOnGamephaseStepChangedHook(UObject* Context, FFrame& Stack, void* Ret) +{ + auto GameState = Cast(GetWorld()->GetGameState()); + + if (!GameState) + return DADBroOnGamephaseStepChangedOriginal(Context, Stack, Ret); + + FRotator Rotation; + Context->ProcessEvent(Context->FindFunction("GetDesiredDadBroRotation"), &Rotation); + + if (GameState->GetGamePhaseStep() == EAthenaGamePhaseStep::StormShrinking && bStormKingSpawned == false) + { + auto StormKing = GetWorld()->SpawnActor(FindObject("/Game/Athena/DADBRO/DADBRO_Pawn.DADBRO_Pawn_C"), FVector{ 5150.0f, 4900.0f, -100.0f }, Rotation.Quaternion(), FVector{ 1,1,1 }, CreateSpawnParameters(ESpawnActorCollisionHandlingMethod::AlwaysSpawn)); + + if (StormKing) + { + bStormKingSpawned = true; + Context->Get(Context->GetOffset("DadBroPawn")) = StormKing; + Context->ProcessEvent(Context->FindFunction("OnRep_DadBroPawn")); + } + else + { + LOG_INFO(LogDev, "Failed to spawn StormKing!"); + } + } + + return DADBroOnGamephaseStepChangedOriginal(Context, Stack, Ret); +} +*/ + +static void (*StartEventAtIndexOriginal)(UObject* Context, FFrame& Stack, void* Ret); +void StartEventAtIndexHook(UObject* Context, FFrame& Stack, void* Ret) +{ + int32 InStartingIndex; + Stack.StepCompiledIn(&InStartingIndex); + + if (Fortnite_Version == 17.50) + { + auto Scripting = FindObject("/Kiwi/Levels/Kiwi_P.Kiwi_P:PersistentLevel.BP_Kiwi_Master_Scripting_2"); + auto EventPlaylist = GetEventPlaylist(); + + struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ Cast(GetWorld()->GetGameState()), EventPlaylist }; + if (EventPlaylist) + { + static auto GameplayTagContainerOffset = EventPlaylist->GetOffset("GameplayTagContainer"); + OnReadyParams.PlaylistContextTags = EventPlaylist->Get(GameplayTagContainerOffset); + } + else + { + OnReadyParams.PlaylistContextTags = FGameplayTagContainer(); + } + + Scripting->ProcessEvent(Scripting->FindFunction("OnReady_F1A32853487CB7603278E6847A5F2625"), &OnReadyParams); + Context->ProcessEvent(Context->FindFunction("LoadKiwiAssets"), &OnReadyParams); + Context->ProcessEvent(Context->FindFunction("BP_OnScriptReady"), &OnReadyParams); + Scripting->ProcessEvent(Scripting->FindFunction("startevent"), &InStartingIndex); + } + + return StartEventAtIndexOriginal(Context, Stack, Ret); +} + static __int64 (*FlowStep_SetPhaseToActiveOriginal)(AActor* SpecialEventPhase); __int64 FlowStep_SetPhaseToActiveHook(AActor* SpecialEventPhase) @@ -844,6 +952,12 @@ DWORD WINAPI Main(LPVOID) { Hooking::MinHook::Hook(FindObject("/Script/FortniteGame.Default__FortMissionLibrary"), FindObject(L"/Script/FortniteGame.FortMissionLibrary:TeleportPlayerPawn"), TeleportPlayerPawnHook, (PVOID*)&TeleportPlayerPawnOriginal, false, true); + // Todo hook UBuffetRacePlayerMovementComponent::ServerTeleportPlayer? + } + if (Fortnite_Version == 17.50) + { + Hooking::MinHook::Hook(FindObject("/Script/SpecialEventGameplayRuntime.Default__SpecialEventScript"), FindObject(L"/Script/SpecialEventGameplayRuntime.SpecialEventScript:StartEventAtIndex"), StartEventAtIndexHook, + (PVOID*)&StartEventAtIndexOriginal, false, true); } } @@ -1130,6 +1244,12 @@ DWORD WINAPI Main(LPVOID) Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"), AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true); + static auto ServerCreativeSetFlightSpeedIndexFn = FindObject(L"/Script/FortniteGame.FortPlayerControllerGameplay.ServerCreativeSetFlightSpeedIndex"); + + if (ServerCreativeSetFlightSpeedIndexFn) + Hooking::MinHook::Hook(FindObject("/Script/FortniteGame.Default__FortPlayerControllerGameplay"), ServerCreativeSetFlightSpeedIndexFn, + AFortPlayerControllerAthena::ServerCreativeSetFlightSpeedIndexHook, nullptr, false, true); + if (Fortnite_Version < 19) // its all screwed up idk { Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"), diff --git a/Project Reboot 3.0/inc.h b/Project Reboot 3.0/inc.h index 75d0c38..d586f27 100644 --- a/Project Reboot 3.0/inc.h +++ b/Project Reboot 3.0/inc.h @@ -82,4 +82,9 @@ public: } }; -*/ \ No newline at end of file +*/ + +struct PadHex10 { char Pad[0x10]; }; +struct PadHex18 { char Pad[0x18]; }; +struct PadHexA8 { char Pad[0xA8]; }; +struct PadHexB0 { char Pad[0xB0]; }; \ No newline at end of file