Rift tour

This commit is contained in:
Gray
2024-03-14 19:29:58 -04:00
parent 215d7b81d0
commit c19f67c675
7 changed files with 367 additions and 114 deletions

View File

@@ -4,11 +4,6 @@
#include "GameplayAbilitySpec.h" #include "GameplayAbilitySpec.h"
#include "AttributeSet.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 FPredictionKey = PadHex18;
// using FGameplayEventData = PadHexA8; // using FGameplayEventData = PadHexA8;

View File

@@ -1265,7 +1265,7 @@ DWORD WINAPI SpectateThread(LPVOID PC)
Sleep(3000); Sleep(3000);
LOG_INFO(LogDev, "bugha!"); LOG_INFO(LogDev, "Spectate!");
SpectatingPC->SpectateOnDeath(); SpectatingPC->SpectateOnDeath();
@@ -1617,7 +1617,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
if (IsRestartingSupported() && Globals::bAutoRestart && !bIsInAutoRestart) if (IsRestartingSupported() && Globals::bAutoRestart && !bIsInAutoRestart)
{ {
// wtf // wht
if (GameState->GetGamePhase() > EAthenaGamePhase::Warmup) if (GameState->GetGamePhase() > EAthenaGamePhase::Warmup)
{ {
@@ -1657,6 +1657,22 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
return ClientOnPawnDiedOriginal(PlayerController, DeathReport); 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) void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
{ {
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks. if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks.
@@ -1667,6 +1683,9 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
if (!Pawn) if (!Pawn)
return; return;
if (!IsOkForEditing(BuildingActorToEdit, PlayerController))
return;
auto PlayerState = PlayerController->GetPlayerState(); auto PlayerState = PlayerController->GetPlayerState();
if (!PlayerState) if (!PlayerState)
@@ -1691,7 +1710,7 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
#if 1 #if 1
EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()));
#else #else
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon()); EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
#endif #endif
if (!EditTool) if (!EditTool)
@@ -1772,10 +1791,12 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
if (!EditToolInstance) if (!EditToolInstance)
return; return;
FGuid EditToolGuid = EditToolInstance->GetItemEntry()->GetItemGuid(); // Should we ref?
#if 1 #if 1
EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolGuid)); // ERM
#else #else
Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid())); // ERM Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolGuid)); // ERM
EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon()); EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
#endif #endif
#else #else
@@ -1786,8 +1807,8 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
{ {
static auto bEditConfirmedOffset = EditTool->GetOffset("bEditConfirmed"); static auto bEditConfirmedOffset = EditTool->GetOffset("bEditConfirmed");
if (bEditConfirmedOffset == -1) if (bEditConfirmedOffset != -1)
EditTool->Get<bool>(bEditConfirmedOffset) = true; EditTool->Get<bool>(bEditConfirmedOffset) = true; // this probably does nothing on server
EditTool->SetEditActor(nullptr); EditTool->SetEditActor(nullptr);
} }

View File

@@ -132,6 +132,27 @@ void AFortPlayerControllerAthena::EndGhostModeHook(AFortPlayerControllerAthena*
return EndGhostModeOriginal(PlayerController); 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<UFunction>("/Script/FortniteGame.FortPlayerControllerGameplay:OnRep_FlyingModifierIndex");
if (!WantedFlightSpeedChangedFn)
{
return;
}
static auto FlyingModifierIndexOffset = Context->GetOffset("FlyingModifierIndex");
Context->Get<int>(FlyingModifierIndexOffset) = Index;
return Context->ProcessEvent(WantedFlightSpeedChangedFn);
}
void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraft) void AFortPlayerControllerAthena::EnterAircraftHook(UObject* PC, AActor* Aircraft)
{ {
auto PlayerController = Cast<AFortPlayerController>(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner()); auto PlayerController = Cast<AFortPlayerController>(Engine_Version < 424 ? PC : ((UActorComponent*)PC)->GetOwner());

View File

@@ -253,6 +253,7 @@ public:
static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh
static void EndGhostModeHook(AFortPlayerControllerAthena* PlayerController); static void EndGhostModeHook(AFortPlayerControllerAthena* PlayerController);
static void ServerCreativeSetFlightSpeedIndexHook(UObject* Context, FFrame* Stack);
static void EnterAircraftHook(UObject* PC, AActor* Aircraft); static void EnterAircraftHook(UObject* PC, AActor* Aircraft);
static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone static void ServerRequestSeatChangeHook(AFortPlayerControllerAthena* PlayerController, int TargetSeatIndex); // actually in zone
static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller); static void ServerRestartPlayerHook(AFortPlayerControllerAthena* Controller);

View File

@@ -65,6 +65,95 @@ struct FActorSpawnParametersUE500
TFunction<void(UObject*)> CustomPreSpawnInitalization; // my favorite TFunction<void(UObject*)> 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 <typename T = AActor>
T*& GetGameMode()
{
static auto AuthorityGameModeOffset = GetOffset("AuthorityGameMode");
return this->Get<T*>(AuthorityGameModeOffset);
}
class AGameState*& GetGameState()
{
static auto GameStateOffset = GetOffset("GameState");
return this->Get<class AGameState*>(GameStateOffset);
}
class UNetDriver*& GetNetDriver()
{
static auto NetDriverOffset = GetOffset("NetDriver");
return this->Get<class UNetDriver*>(NetDriverOffset);
}
UGameInstance* GetOwningGameInstance()
{
static auto OwningGameInstanceOffset = GetOffset("OwningGameInstance");
return this->Get<UGameInstance*>(OwningGameInstanceOffset);
}
inline FTimerManager& GetTimerManager()
{
return GetOwningGameInstance()->GetTimerManager();
// return (GetOwningGameInstance() ? GetOwningGameInstance()->GetTimerManager() : *TimerManager);
}
template <typename ActorType>
ActorType* SpawnActor(UClass* Class, FTransform UserTransformPtr = FTransform(), PadHexB0 SpawnParameters = CreateSpawnParameters())
{
auto actor = (ActorType*)SpawnActorOriginal(this, Class, &UserTransformPtr, &SpawnParameters);
return actor;
}
template <typename ActorType>
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<ActorType>(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 // #define USE_VIRTUALALLOC_SPAWNPARAMS
static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr) static inline void* CreateSpawnParameters(ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::Undefined, bool bDeferConstruction = false, UObject* Owner = nullptr)
@@ -196,3 +285,4 @@ public:
void Listen(); void Listen();
}; };
#endif

View File

@@ -224,8 +224,6 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index)
{ {
if (Index == 0) // Start of Event if (Index == 0) // Start of Event
{ {
auto MasterScripting = FindObject<UObject>("/Buffet/Levels/Buffet_P.Buffet_P:PersistentLevel.BP_Event_Master_Scripting_2");
auto AllSatelliteDishes = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject<UClass>("/Game/Athena/Apollo/Environments/BuildingActors/Complex/Props/Apollo_Complex_Satellite_Dish_Top_01.Apollo_Complex_Satellite_Dish_Top_01_C")); auto AllSatelliteDishes = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject<UClass>("/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++) for (int i = 0; i < AllSatelliteDishes.Num(); i++)
@@ -233,60 +231,117 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index)
AllSatelliteDishes.At(i)->K2_DestroyActor(); AllSatelliteDishes.At(i)->K2_DestroyActor();
} }
MasterScripting->ProcessEvent(MasterScripting->FindFunction("EnableTheMutator")); auto AllSpecialEventMutators = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject<UClass>("/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 CurrentSpecialEventMutator = AllSpecialEventMutators.At(i);
auto CurrentController = ClientConnections.At(i)->GetPlayerController();
CurrentController->AddComponentByClass(FindObject<UClass>("/Script/SpecialEventGameplayRuntime.FortControllerComponent_SpecialEvent")); auto ScriptActor = CurrentSpecialEventMutator->Get<AActor*>(CurrentSpecialEventMutator->GetOffset("ScriptActor"));
CurrentPawn->AddComponentByClass(FindObject<UClass>("/Script/BuffetRuntime.FortSpecialRelevancyPawnAttachComponent"));
if (!ScriptActor)
{
ScriptActor = Cast<AActor>(GetEventScripting());
LOG_INFO(LogEvent, "ScriptActor set for mutator: {}", CurrentSpecialEventMutator->GetName());
} }
} }
if (Index == 1) // Memories, BP_Buffet_PhaseScripting_Phase1_C
{
//EventPawn->TeleportTo(FVector(-963.630f, 25453.090f, 359392.125f), EventPawn->GetActorRotation());
auto Phase1Scripting = FindObject("/Buffet/Levels/Buffet_Part_3.Buffet_Part_3:PersistentLevel.BP_Buffet_PhaseScripting_Phase1_2");
auto TeleportRef = Phase1Scripting->Get<AActor*>(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 (Index == 2) // Slide if (Index == 2) // Slide
{ {
auto Script = FindObject<UObject>("/Buffet/Levels/Buffet_Part_4.Buffet_Part_4.PersistentLevel.BP_Buffet_PhaseScripting_Paint_4"); auto Script = FindObject<UObject>("/Buffet/Levels/Buffet_Part_4.Buffet_Part_4.PersistentLevel.BP_Buffet_PhaseScripting_Paint_4");
auto SplineActor = Script->Get<AActor*>(Script->GetOffset("SplineActor"));
auto PawnLocation = Script->Get<AActor*>(Script->GetOffset("PawnLocation")) = SplineActor;
Script->Get<bool>(Script->GetOffset("bRaceStarted")) = true; auto AllWrapsSpawners = UGameplayStatics::GetAllActorsOfClass(GetWorld(), FindObject<UClass>("/Script/SpecialEventGameplayRuntime.FortSpecialRelevancyActorSpawner"));
Script->ProcessEvent(Script->FindFunction("OnRep_bRaceStarted"));
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<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_WrapChangePickup.BP_Buffet_Paint_WrapChangePickup_C");
}
else if (CurrentWrapSpawner->GetName().contains("Paint_Pickup"))
{
ClassToSpawn = FindObject<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_Pickup.BP_Buffet_Paint_Pickup_C");
}
auto SpawnedWrap = GetWorld()->SpawnActor<AActor>(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++) for (int i = 0; i < ClientConnections.Num(); i++)
{ {
auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn();
auto CurrentController = ClientConnections.At(i)->GetPlayerController(); auto CurrentController = ClientConnections.At(i)->GetPlayerController();
auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); if (!CurrentPawn)
CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_IntroTrackFinder.BP_Buffet_Paint_IntroTrackFinder_C")); continue;
auto PlayerComponent = CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_PlayerComponent.BP_Buffet_Paint_PlayerComponent_C")); // WHY DOESnT IT WORK AUTO
auto MovementComponent = CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_MovementComponent.BP_Buffet_Paint_MovementComponent_C")); auto MovementComponent = CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/WrapWorldPrototype/BP_Buffet_Paint_MovementComponent.BP_Buffet_Paint_MovementComponent_C"));
PlayerComponent->Get<AActor*>(PlayerComponent->GetOffset("OwningPlayerController")) = CurrentController;
struct
{
AActor* Pawn;
AActor* ReturnValue;
}wrapmanagerparams{};
wrapmanagerparams.Pawn = CurrentPawn;
Script->ProcessEvent(Script->FindFunction("GetWrapManagerForPlayer"), &wrapmanagerparams);
MovementComponent->Get<bool>(MovementComponent->GetOffset("bIsMovingAlongSpline")) = true;
MovementComponent->Get<float>(MovementComponent->GetOffset("ReplicatedTotalSplineTime")) = 59.793846f; // TotalSplineTime
MovementComponent->Get<AActor*>(MovementComponent->GetOffset("TargetSplineActor")) = SplineActor;
MovementComponent->ProcessEvent(MovementComponent->FindFunction("SetSplineActor"), &SplineActor);
bool IsMoving = true;
MovementComponent->ProcessEvent(MovementComponent->FindFunction("SetIsMovingAlongSpline"), &IsMoving);
MovementComponent->Get<float>(MovementComponent->GetOffset("ReplicatedSplineInterpStrength")) = 1.3f; // SplineInterpStrength
auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode();
auto GameState = Cast<AFortGameStateAthena>(GameMode->GetGameState());
MovementComponent->Get<float>(MovementComponent->GetOffset("StartServerWorldTime")) = GameState->GetServerWorldTimeSeconds();
MovementComponent->ProcessEvent(MovementComponent->FindFunction("OnRep_TargetSplineActor"));
PlayerComponent->Get<AActor*>(PlayerComponent->GetOffset("WrapManager")) = wrapmanagerparams.ReturnValue;
PlayerComponent->Get<UObject*>(PlayerComponent->GetOffset("MovementComponent")) = MovementComponent; PlayerComponent->Get<UObject*>(PlayerComponent->GetOffset("MovementComponent")) = MovementComponent;
PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializePaintComponent")); int StasisMode = 3;
PlayerComponent->ProcessEvent(PlayerComponent->FindFunction("InitializeMovementComponent")); 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 if (Index == 4) // Storm King
@@ -295,7 +350,6 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index)
auto DefaultPlane = FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BP_PlanePrototype.Default__BP_PlanePrototype_C"); auto DefaultPlane = FindObject("/Buffet/Gameplay/Blueprints/WolfMother/BP_PlanePrototype.Default__BP_PlanePrototype_C");
{
auto WID = Cast<UFortWorldItemDefinition>(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing auto WID = Cast<UFortWorldItemDefinition>(FindObject("WID_Buffet_BeatMatchingBoomBox", nullptr, ANY_PACKAGE)); // Storm King weapon thing
for (int i = 0; i < ClientConnections.Num(); i++) for (int i = 0; i < ClientConnections.Num(); i++)
@@ -306,7 +360,7 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index)
auto WorldInventory = CurrentController->GetWorldInventory(); auto WorldInventory = CurrentController->GetWorldInventory();
bool bShouldUpdate = false; bool bShouldUpdate = false;
WorldInventory->AddItem(WID, &bShouldUpdate, 1, 9999); WorldInventory->AddItem(WID, &bShouldUpdate, 1);
if (bShouldUpdate) if (bShouldUpdate)
WorldInventory->Update(); WorldInventory->Update();
@@ -326,64 +380,52 @@ void ActivatePhaseAtIndexHook(UObject* SpecialEventScript, int Index)
} }
} }
} }
}
if (Index == 5) // Ariana Knocked
{
auto ReviveScripting = FindObject("/Buffet/Levels/Buffet_Reflect.Buffet_Reflect:PersistentLevel.BP_Buffet_PhaseScripting_Revive_2");
auto ManualTeleportLocation = ReviveScripting->Get<FVector>(ReviveScripting->GetOffset("ManualTeleportLocation"));
auto ManualTeleportRotation = ReviveScripting->Get<FRotator>(ReviveScripting->GetOffset("Manual_Teleport_Rotation"));
for (int i = 0; i < ClientConnections.Num(); i++)
{
auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn();
}
}
if (Index == 6) // Ariana 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++) for (int i = 0; i < ClientConnections.Num(); i++)
{ {
auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn();
CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); CurrentPawn->AddComponentByClass(FindObject<UClass>("/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<FRotator>(ReviveScripting->GetOffset("Manual_Teleport_Rotation"));
for (int i = 0; i < ClientConnections.Num(); i++)
{
auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn();
CurrentPawn->AddComponentByClass(FindObject<UClass>("/BuffetPlaylist/Playlist/BuffetCharacterMovementMutatorComponent.BuffetCharacterMovementMutatorComponent_C")); CurrentPawn->AddComponentByClass(FindObject<UClass>("/BuffetPlaylist/Playlist/BuffetCharacterMovementMutatorComponent.BuffetCharacterMovementMutatorComponent_C"));
} }
} }
if (Index == 8) // Bubbles if (Index == 8) // Bubbles
{ {
auto BubblesScripting = FindObject<UObject>("/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<bool>(BubblesScripting->GetOffset("bUsePlayerMovementMode")) = false;
BubblesScripting->Get<AActor*>(BubblesScripting->GetOffset("FollowActor")) = FindObject<AActor>("/Buffet/Levels/Buffet_Bubbles.Buffet_Bubbles:PersistentLevel.BP_Buffet_BubbleFollowActor_2");
}
if (Index == 9) // Clouds
{
for (int i = 0; i < ClientConnections.Num(); i++) for (int i = 0; i < ClientConnections.Num(); i++)
{ {
auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn(); auto CurrentPawn = ClientConnections.At(i)->GetPlayerController()->GetPawn();
auto ComptoRemove = CurrentPawn->GetComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C"));
auto RemoveComponent = CurrentPawn->GetComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/Stars/BP_Buffet_Stars_PlayerComponent.BP_Buffet_Stars_PlayerComponent_C")); auto BubbleMovementComponent = CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/Bubble/BP_BubblePlayerMovementComponent.BP_BubblePlayerMovementComponent_C"));
CurrentPawn->ProcessEvent(CurrentPawn->FindFunction("K2_DestroyComponent"), RemoveComponent); /*
struct
{
UObject* InSplineComponent;
float StartDistance;
CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/Llama/BP_Buffet_Llama_PlayerComponent.BP_Buffet_Llama_PlayerComponent_C")); }SetSplineComponent;
CurrentPawn->AddComponentByClass(FindObject<UClass>("/Buffet/Gameplay/Blueprints/PostEvent/LlamaSpeedControlComponent.LlamaSpeedControlComponent_C")); 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<UObject*>(BubbleMovementComponent->GetOffset("SplineComponent")) = BubbleSpline;
BubbleMovementComponent->Get<bool>(BubbleMovementComponent->GetOffset("bIsMovingAlongSpline")) = true;
auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode();
auto GameState = Cast<AFortGameStateAthena>(GameMode->GetGameState());
BubbleMovementComponent->Get<float>(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 if (Index == 10) // Escher
@@ -454,7 +496,7 @@ void AttemptFinishPhaseHook(AActor* SpecialEventScript, FGameplayTag PhaseTag)
static auto OnRep_ReplicatedActivePhaseIndexFn = FindObject<UFunction>("/Script/SpecialEventGameplayRuntime.SpecialEventScript.OnRep_ReplicatedActivePhaseIndex"); static auto OnRep_ReplicatedActivePhaseIndexFn = FindObject<UFunction>("/Script/SpecialEventGameplayRuntime.SpecialEventScript.OnRep_ReplicatedActivePhaseIndex");
auto Connections = GetWorld()->GetNetDriver()->GetClientConnections(); auto& Connections = GetWorld()->GetNetDriver()->GetClientConnections();
if (LastTag == "Kiwi.Phase.Islands") // PrisonBlocks (Event Start) 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); 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<AFortGameStateAthena>(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<AActor>(FindObject<UClass>("/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<AActor*>(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<UObject>("/Kiwi/Levels/Kiwi_P.Kiwi_P:PersistentLevel.BP_Kiwi_Master_Scripting_2");
auto EventPlaylist = GetEventPlaylist();
struct { UObject* GameState; UObject* Playlist; FGameplayTagContainer PlaylistContextTags; } OnReadyParams{ Cast<AFortGameStateAthena>(GetWorld()->GetGameState()), EventPlaylist };
if (EventPlaylist)
{
static auto GameplayTagContainerOffset = EventPlaylist->GetOffset("GameplayTagContainer");
OnReadyParams.PlaylistContextTags = EventPlaylist->Get<FGameplayTagContainer>(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); static __int64 (*FlowStep_SetPhaseToActiveOriginal)(AActor* SpecialEventPhase);
__int64 FlowStep_SetPhaseToActiveHook(AActor* SpecialEventPhase) __int64 FlowStep_SetPhaseToActiveHook(AActor* SpecialEventPhase)
@@ -844,6 +952,12 @@ DWORD WINAPI Main(LPVOID)
{ {
Hooking::MinHook::Hook(FindObject<UObject>("/Script/FortniteGame.Default__FortMissionLibrary"), FindObject<UFunction>(L"/Script/FortniteGame.FortMissionLibrary:TeleportPlayerPawn"), TeleportPlayerPawnHook, Hooking::MinHook::Hook(FindObject<UObject>("/Script/FortniteGame.Default__FortMissionLibrary"), FindObject<UFunction>(L"/Script/FortniteGame.FortMissionLibrary:TeleportPlayerPawn"), TeleportPlayerPawnHook,
(PVOID*)&TeleportPlayerPawnOriginal, false, true); (PVOID*)&TeleportPlayerPawnOriginal, false, true);
// Todo hook UBuffetRacePlayerMovementComponent::ServerTeleportPlayer?
}
if (Fortnite_Version == 17.50)
{
Hooking::MinHook::Hook(FindObject<UObject>("/Script/SpecialEventGameplayRuntime.Default__SpecialEventScript"), FindObject<UFunction>(L"/Script/SpecialEventGameplayRuntime.SpecialEventScript:StartEventAtIndex"), StartEventAtIndexHook,
(PVOID*)&StartEventAtIndexOriginal, false, true);
} }
} }
@@ -1130,6 +1244,12 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"),
AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true); AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true);
static auto ServerCreativeSetFlightSpeedIndexFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerGameplay.ServerCreativeSetFlightSpeedIndex");
if (ServerCreativeSetFlightSpeedIndexFn)
Hooking::MinHook::Hook(FindObject<UObject>("/Script/FortniteGame.Default__FortPlayerControllerGameplay"), ServerCreativeSetFlightSpeedIndexFn,
AFortPlayerControllerAthena::ServerCreativeSetFlightSpeedIndexHook, nullptr, false, true);
if (Fortnite_Version < 19) // its all screwed up idk if (Fortnite_Version < 19) // its all screwed up idk
{ {
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"),

View File

@@ -83,3 +83,8 @@ public:
}; };
*/ */
struct PadHex10 { char Pad[0x10]; };
struct PadHex18 { char Pad[0x18]; };
struct PadHexA8 { char Pad[0xA8]; };
struct PadHexB0 { char Pad[0xB0]; };